text:
/*
  good instanceId : e2778b98-0b6b-11e6-9db3-000d3a002ed5
  test:
*/

/* jshint camelcase: false */
/* jshint newcap: false */
/* global describe, before, it */

var should = require('should');
var sinon = require('sinon');
var cmdbind = require('../../../../lib/services/azuresqldb/cmd-bind');
var sqldbOperations = require('../../../../lib/services/azuresqldb/client');
var azure = require('../helpers').azure;

var sqldbOps = new sqldbOperations(azure);

describe('SqlDb - bind', function () {

    var cb;

    before(function () {

        var validParams = {
            instance_id: 'e2778b98-0b6b-11e6-9db3-000d3a002ed5',
            service_id: 'fb9bc99e-0aa9-11e6-8a8a-000d3a002ed5',
            plan_id: '3819fdfa-0aaa-11e6-86f4-000d3a002ed5',
            parameters: {
                resourceGroup: 'sqldbResourceGroup',
                sqlServerName: 'golive4',
                sqlServerCreateIfNotExist: true,
                sqlServerParameters: {
                    location: 'westus',
                    properties: {
                        administratorLogin: 'xxxx',
                        administratorLoginPassword: 'xxxxxxx',
                        version: '12.0'
                    }
                },
                sqldbName: 'sqldb',
                sqldbParameters: {
                    location: 'westus',
                    properties: {
                        collation: 'SQL_Latin1_General_CP1_CI_AS',
                        maxSizeBytes: '2147483648',
                        createMode: 'Default',
                        edition: 'Basic',
                        requestedServiceObjectiveName: 'Basic'
                    }
                }
            },
            provisioning_result: {
                'id': '/subscriptions/743f6ed6-83a8-46f0-822d-ea93b953952d/resourceGroups/sqldbResourceGroup/providers/Microsoft.Sql/servers/golive4/databases/sqldb',
                'name': 'sqldb',
                'type': 'Microsoft.Sql/servers/databases',
                'location': 'West US',
                'kind': 'v12.0,user',
                'properties': {
                    'databaseId': 'bf19fd8d-8b08-4b11-aceb-16dafee3c7cc',
                    'edition': 'Basic',
                    'status': 'Online',
                    'serviceLevelObjective': 'Basic',
                    'collation': 'SQL_Latin1_General_CP1_CI_AS',
                    'maxSizeBytes': '2147483648',
                    'creationDate': '2016-07-08T08:54:17.73Z',
                    'currentServiceObjectiveId': 'dd6d99bb-f193-4ec1-86f2-43d3bccbc49c',
                    'requestedServiceObjectiveId': 'dd6d99bb-f193-4ec1-86f2-43d3bccbc49c',
                    'requestedServiceObjectiveName': null,
                    'defaultSecondaryLocation': 'East US',
                    'earliestRestoreDate': '2016-07-08T09:05:03.543Z',
                    'elasticPoolName': null,
                    'containmentState': 2
                },
                'sqlServerName': 'golive4',
                'administratorLogin': 'greg',
                'administratorLoginPassword': 'P@ssw0rd!'
            },
            azure: azure
        };

        cb = new cmdbind(validParams);
        sinon.stub(sqldbOps, 'executeSql').yields(null);
    });

    after(function () {
        sqldbOps.executeSql.restore();
    });

    describe('', function () {
        it('should not callback error', function (done) {
            cb.bind(sqldbOps, function (err, result) {
                should.not.exist(err);
                should.exist(result.databaseLogin);
                should.exist(result.databaseLoginPassword);
                done();
            });
        });
    });
});

describe('SqlDb - bind - user-provided database login', function () {

    var cb;

    before(function () {

        var validParams = {
            instance_id: 'e2778b98-0b6b-11e6-9db3-000d3a002ed5',
            service_id: 'fb9bc99e-0aa9-11e6-8a8a-000d3a002ed5',
            plan_id: '3819fdfa-0aaa-11e6-86f4-000d3a002ed5',
            parameters: {
                sqlServerName: 'golive4',
                sqldbName: 'sqldb',
                userProvidedDatabaseLogin: 'fake-login',
                userProvidedDatabaseLoginPassword: 'fake-login-password',
            },
            provisioning_result: {
                'id': '/subscriptions/743f6ed6-83a8-46f0-822d-ea93b953952d/resourceGroups/sqldbResourceGroup/providers/Microsoft.Sql/servers/golive4/databases/sqldb',
                'name': 'sqldb',
                'type': 'Microsoft.Sql/servers/databases',
                'location': 'West US',
                'kind': 'v12.0,user',
                'properties': {
                    'databaseId': 'bf19fd8d-8b08-4b11-aceb-16dafee3c7cc',
                    'edition': 'Basic',
                    'status': 'Online',
                    'serviceLevelObjective': 'Basic',
                    'collation': 'SQL_Latin1_General_CP1_CI_AS',
                    'maxSizeBytes': '2147483648',
                    'creationDate': '2016-07-08T08:54:17.73Z',
                    'currentServiceObjectiveId': 'dd6d99bb-f193-4ec1-86f2-43d3bccbc49c',
                    'requestedServiceObjectiveId': 'dd6d99bb-f193-4ec1-86f2-43d3bccbc49c',
                    'requestedServiceObjectiveName': null,
                    'defaultSecondaryLocation': 'East US',
                    'earliestRestoreDate': '2016-07-08T09:05:03.543Z',
                    'elasticPoolName': null,
                    'containmentState': 2
                },
                'sqlServerName': 'golive4',
                'administratorLogin': 'greg',
                'administratorLoginPassword': 'P@ssw0rd!'
            },
            azure: azure
        };

        cb = new cmdbind(validParams);
    });

    describe('', function () {
        it('should not callback error', function (done) {
            cb.bind(sqldbOps, function (err, result) {
                should.not.exist(err);
                result.databaseLogin.should.equal('fake-login');
                result.databaseLoginPassword.should.equal('fake-login-password');
                done();
            });
        });
    });
});


text:
<?xml version="1.0" encoding="utf-8"?>
<project name="JooS - PHP QA Tools" default="init">
  <import file="build.xml" />
  <import file="vendor/covex-nn/phpqatools/build.xml" />
</project>

redpajama_set_name: RedPajamaGithub


text:
import { spec } from 'modules/lkqdBidAdapter';
import { newBidder } from 'src/adapters/bidderFactory';
const { expect } = require('chai');

describe('LKQD Bid Adapter Test', function () {
  const adapter = newBidder(spec);

  describe('inherited functions', function () {
    it('exists and is a function', function () {
      expect(adapter.callBids).to.exist.and.to.be.a('function');
    });
  });

  describe('isBidRequestValid', function () {
    let bid = {
      'bidder': 'lkqd',
      'params': {
        'siteId': '662921',
        'placementId': '263'
      },
      'adUnitCode': 'video1',
      'sizes': [[300, 250], [640, 480]],
      'bidId': '30b31c1838de1e',
      'bidderRequestId': '22edbae2733bf6',
      'requestId': 'a09c66c3-53e3-4428-b296-38fc08e7cd2a',
      'transactionId': 'd6f6b392-54a9-454c-85fb-a2fd882c4a2d',
    };

    it('should return true when required params found', function () {
      expect(spec.isBidRequestValid(bid)).to.equal(true);
    });

    it('should return false when required params are not passed', function () {
      let bid = Object.assign({}, bid);
      delete bid.params;
      bid.params = {
        wrong: 'missing zone id'
      };
      expect(spec.isBidRequestValid(bid)).to.equal(false);
    });
  });

  describe('buildRequests', () => {
    const ENDPOINT = 'https://v.lkqd.net/ad';
    let bidRequests = [
      {
        'bidder': 'lkqd',
        'params': {
          'siteId': '662921',
          'placementId': '263'
        },
        'adUnitCode': 'lkqd',
        'sizes': [[300, 250], [640, 480]],
        'bidId': '30b31c1838de1e',
        'bidderRequestId': '22edbae2733bf6',
        'requestId': 'a09c66c3-53e3-4428-b296-38fc08e7cd2a',
        'transactionId': 'd6f6b392-54a9-454c-85fb-a2fd882c4a2d',
      }
    ];
    let bidRequest = [
      {
        'bidder': 'lkqd',
        'params': {
          'siteId': '662921',
          'placementId': '263'
        },
        'adUnitCode': 'lkqd',
        'sizes': [640, 480],
        'bidId': '30b31c1838de1e',
        'bidderRequestId': '22edbae2733bf6',
        'requestId': 'a09c66c3-53e3-4428-b296-38fc08e7cd2a',
        'transactionId': 'd6f6b392-54a9-454c-85fb-a2fd882c4a2d',
      }
    ];

    it('should populate available parameters', function () {
      const requests = spec.buildRequests(bidRequests);
      expect(requests.length).to.equal(2);
      const r1 = requests[0].data;
      expect(r1).to.have.property('pid');
      expect(r1.pid).to.equal('263');
      expect(r1).to.have.property('sid');
      expect(r1.sid).to.equal('662921');
      expect(r1).to.have.property('width');
      expect(r1.width).to.equal(300);
      expect(r1).to.have.property('height');
      expect(r1.height).to.equal(250);
      const r2 = requests[1].data;
      expect(r2).to.have.property('pid');
      expect(r2.pid).to.equal('263');
      expect(r2).to.have.property('sid');
      expect(r2.sid).to.equal('662921');
      expect(r2).to.have.property('width');
      expect(r2.width).to.equal(640);
      expect(r2).to.have.property('height');
      expect(r2.height).to.equal(480);
    });

    it('should not populate unspecified parameters', function () {
      const requests = spec.buildRequests(bidRequests);
      expect(requests.length).to.equal(2);
      const r1 = requests[0].data;
      expect(r1).to.not.have.property('dnt');
      expect(r1).to.not.have.property('contentid');
      expect(r1).to.not.have.property('contenttitle');
      expect(r1).to.not.have.property('contentlength');
      expect(r1).to.not.have.property('contenturl');
      const r2 = requests[1].data;
      expect(r2).to.not.have.property('dnt');
      expect(r2).to.not.have.property('contentid');
      expect(r2).to.not.have.property('contenttitle');
      expect(r2).to.not.have.property('contentlength');
      expect(r2).to.not.have.property('contenturl');
    });

    it('should handle single size request', function () {
      const requests = spec.buildRequests(bidRequest);
      expect(requests.length).to.equal(1);
      const r1 = requests[0].data;
      expect(r1).to.have.property('pid');
      expect(r1.pid).to.equal('263');
      expect(r1).to.have.property('sid');
      expect(r1.sid).to.equal('662921');
      expect(r1).to.have.property('width');
      expect(r1.width).to.equal(640);
      expect(r1).to.have.property('height');
      expect(r1.height).to.equal(480);
    });

    it('sends bid request to ENDPOINT via GET', function () {
      const requests = spec.buildRequests(bidRequests);
      expect(requests.length).to.equal(2);
      const r1 = requests[0];
      expect(r1.url).to.contain(ENDPOINT);
      expect(r1.method).to.equal('GET');
      const r2 = requests[1]
      expect(r2.url).to.contain(ENDPOINT);
      expect(r2.method).to.equal('GET');
    });
  });

  describe('interpretResponse', function () {
    let bidRequest = {
      'url': 'https://ssp.lkqd.net/ad?pid=263&sid=662921&output=vast&execution=any&placement=&playinit=auto&volume=100&timeout=&width=300%E2%80%8C&height=250&pbt=[PREBID_TOKEN]%E2%80%8C&dnt=[DO_NOT_TRACK]%E2%80%8C&pageurl=[PAGEURL]%E2%80%8C&contentid=[CONTENT_ID]%E2%80%8C&contenttitle=[CONTENT_TITLE]%E2%80%8C&contentlength=[CONTENT_LENGTH]%E2%80%8C&contenturl=[CONTENT_URL]&prebid=true%E2%80%8C&rnd=874313435?bidId=253dcb69fb2577&bidWidth=300&bidHeight=250&',
      'data': {
        'bidId': '253dcb69fb2577',
        'bidWidth': '640',
        'bidHeight': '480'
      }
    };
    let serverResponse = {};
    serverResponse.body = `<VAST version="2.0">
<Ad id="677477">
<InLine>
<AdSystem version="1.2">LKQD</AdSystem>
<AdTitle>
<![CDATA[ Mobile Video QA ]]>
</AdTitle>
<Pricing model="CPM" currency="USD">2.87</Pricing>
<Impression>
<![CDATA[
https://sb.scorecardresearch.com/p?C1=1&C2=23229166&C3=platform&C5=01&C7=
]]>
</Impression>
<Impression>
<![CDATA[
https://sb.scorecardresearch.com/p?c1=2&c2=23229166&c3=platform&ns_ap_sv=2.1511.10&ns_type=hidden&ns_st_it=a&ns_st_sv=4.0.0&ns_st_ad=1&ns_st_sq=1&ns_st_id=1522437348&ns_st_ec=1&ns_st_cn=1&ns_st_ev=play&ns_st_ct=va&ns_st_cl=30000&ns_st_pt=0&ns_ts=1522437348
]]>
</Impression>
<Impression>
<![CDATA[
https://t.lkqd.net/t?ev=3&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&key=hiddddddd8&sc=dddflkddd8&prcid=0&bp=&rfp=&segkey=&dur=30.0&cs=-1294926671
]]>
</Impression>
<Impression>
<![CDATA[ http://t.lkqd.net/t?ev=16&env=1&pid=2&sid=71 ]]>
</Impression>
<Impression>
<![CDATA[
https://test.com/?iamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatch&pageurl=&deviceid=&siteid=1374&cookie=8295056521223792901&cpm=4.5&avid=96110&plid=677477&publisherId=662921&siteId=662921&caid=654322&kv1=&kv2=
]]>
</Impression>
<Error>
<![CDATA[
https://t.lkqd.net/t?ev=9&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&dur=30.0&cs=1262611271
]]>
</Error>
<Error>
<![CDATA[ http://t.lkqd.net/t?ev=17&env=1&pid=2&sid=71 ]]>
</Error>
<Creatives>
<Creative>
<Linear>
<Duration>00:00:30</Duration>
<TrackingEvents>
<Tracking event="firstQuartile">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="firstQuartile">
<![CDATA[
https://t.lkqd.net/t?ev=4&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&dur=30.0&cs=-573688932
]]>
</Tracking>
<Tracking event="firstQuartile">
<![CDATA[
https://test.com/?iamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatch&pageurl=&deviceid=&siteid=1374
]]>
</Tracking>
<Tracking event="pause">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="fullscreen">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="mute">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="unmute">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="complete">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="complete">
<![CDATA[
https://t.lkqd.net/t?ev=7&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&dur=30.0&cs=-1387907
]]>
</Tracking>
<Tracking event="complete">
<![CDATA[
https://test.com/?iamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatch&pageurl=&deviceid=&siteid=1374
]]>
</Tracking>
<Tracking event="thirdQuartile">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="thirdQuartile">
<![CDATA[
https://t.lkqd.net/t?ev=6&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&dur=30.0&cs=-503935710
]]>
</Tracking>
<Tracking event="thirdQuartile">
<![CDATA[
https://test.com/?iamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatch&pageurl=&deviceid=&siteid=1374
]]>
</Tracking>
<Tracking event="midpoint">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="midpoint">
<![CDATA[
https://t.lkqd.net/t?ev=5&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&dur=30.0&cs=-1009619773
]]>
</Tracking>
<Tracking event="midpoint">
<![CDATA[
https://test.com/?iamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatch&pageurl=&deviceid=&siteid=1374
]]>
</Tracking>
<Tracking event="start">
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</Tracking>
<Tracking event="start">
<![CDATA[
https://t.lkqd.net/t?ev=2&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&dur=30.0&cs=-1719144354
]]>
</Tracking>
<Tracking event="start">
<![CDATA[
https://test.com/?iamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatch&pageurl=&deviceid=&siteid=1374
]]>
</Tracking>
</TrackingEvents>
<VideoClicks>
<ClickThrough>
<![CDATA[ http://www.lkqd.com/ ]]>
</ClickThrough>
<ClickTracking>
<![CDATA[
https://t.lkqd.net/t?ev=8&tsid=662921&env=3&cb=761218674439&format=0&did=2&osid=6&osv=10.12.6&pubtagtype=vast&render=&apt=auto&uimp=93862023567791182&svrs=0.90&srvid=10.10.4.4&oip=208.59.120.2&vrs=&tsl=&ear=100&width=&height=250&phost=&host=&thost=&appname=&idfa=&aid=&bundleid=&lsid=&loclat=&loclong=&contentid=%5BCONTENT_ID%5D%E2%80%8C&contenttitle=%5BCONTENT_TITLE%5D%E2%80%8C&contentlength=&contenturl=&appstoreurl=&execution=any&placement=&browserid=1&browserv=65.0&adplayersize=small&pid=263&sid=662921&spid=44784&psid=&ppid=&lkqdtagtype=vast&tlr=1&adid=677477&asrc=33062&aoid=96110&dealid=654322&pbid=0&rseat=&radomain=&rcid=&rcrid=&rdealid=&iabc=&dur=30.0&cs=1432204312
]]>
</ClickTracking>
<ClickTracking>
<![CDATA[ http://t.lkqd.net/t?ev=18&env=1&pid=2&sid=71 ]]>
</ClickTracking>
<ClickTracking>
<![CDATA[
https://test.com/?iamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatchiamatrackingpixelforcloudwatch&pageurl=&deviceid=&siteid=1374
]]>
</ClickTracking>
</VideoClicks>
<MediaFiles>
<MediaFile type="video/mp4" delivery="progressive" width="800" height="450" bitrate="1499" scalable="true" maintainAspectRatio="false">
<![CDATA[
https://creative.lkqd.net/internal/lkqd_800x450.mp4
]]>
</MediaFile>
<MediaFile type="video/mp4" delivery="progressive" width="300" height="170" bitrate="626" scalable="true" maintainAspectRatio="false">
<![CDATA[
https://creative.lkqd.net/internal/lkqd_300x250.mp4
]]>
</MediaFile>
</MediaFiles>
</Linear>
</Creative>
<Creative>
<CompanionAds>
<Companion width="300" height="250" id="medium_rectangle">
<HTMLResource>
<![CDATA[

]]>
</HTMLResource>
</Companion>
</CompanionAds>
</Creative>
</Creatives>
<Extensions/>
</InLine>
</Ad>
</VAST>`;

    it('should correctly parse valid bid response', function () {
      const BIDDER_CODE = 'lkqd';
      let bidResponses = spec.interpretResponse(serverResponse, bidRequest);
      expect(bidResponses.length).to.equal(1);
      let bidResponse = bidResponses[0];
      expect(bidResponse.requestId).to.equal(bidRequest.data.bidId);
      expect(bidResponse.bidderCode).to.equal(BIDDER_CODE);
      expect(bidResponse.ad).to.equal('');
      expect(bidResponse.cpm).to.equal(2.87);
      expect(bidResponse.width).to.equal('640');
      expect(bidResponse.height).to.equal('480');
      expect(bidResponse.ttl).to.equal(300);
      expect(bidResponse.creativeId).to.equal('677477');
      expect(bidResponse.currency).to.equal('USD');
      expect(bidResponse.netRevenue).to.equal(true);
      expect(bidResponse.mediaType).to.equal('video');
    });

    it('safely handles XML parsing failure from invalid bid response', function () {
      let invalidServerResponse = {};
      invalidServerResponse.body = '<Ad id="677477"><InLine></AdSystem></InLine></Ad>';

      let result = spec.interpretResponse(invalidServerResponse, bidRequest);
      expect(result.length).to.equal(0);
    });

    it('handles nobid responses', function () {
      let nobidResponse = {};
      nobidResponse.body = '<?xml version=\'1.0\' encoding=\'UTF-8\'?><VAST version=\'2.0\'></VAST>';

      let result = spec.interpretResponse(nobidResponse, bidRequest);
      expect(result.length).to.equal(0);
    });
  });
});


text:
package iso20022

// Specifies an expected date and a due date for the interest payment.
type InterestPaymentDateRange1 struct {

	// Unique and unambiguous identification of the interest payment schedule.
	InterestScheduleIdentification *Max35Text `xml:"IntrstSchdlId,omitempty"`

	// Expected interest payment date.
	ExpectedDate *ISODate `xml:"XpctdDt,omitempty"`

	// Latest date whereby the interest must be paid.
	DueDate *ISODate `xml:"DueDt,omitempty"`
}

func (i *InterestPaymentDateRange1) SetInterestScheduleIdentification(value string) {
	i.InterestScheduleIdentification = (*Max35Text)(&value)
}

func (i *InterestPaymentDateRange1) SetExpectedDate(value string) {
	i.ExpectedDate = (*ISODate)(&value)
}

func (i *InterestPaymentDateRange1) SetDueDate(value string) {
	i.DueDate = (*ISODate)(&value)
}


text:
<?php

namespace PHPMD\Rule\Design;

use PHPMD\AbstractNode;
use PHPMD\AbstractRule;
use PHPMD\Node\MethodNode;
use PHPMD\Rule\FunctionAware;
use PHPMD\Rule\MethodAware;

/**
 * This rule class detects possible development code fragments that were left
 * into the code.
 *
 * @link https://github.com/phpmd/phpmd/issues/265
 * @since 2.3.0
 */
class DevelopmentCodeFragment extends AbstractRule implements MethodAware, FunctionAware
{
    /**
     * This method checks if a given function or method contains an eval-expression
     * and emits a rule violation when it exists.
     *
     * @param \PHPMD\AbstractNode $node
     * @return void
     */
    public function apply(AbstractNode $node)
    {
        $ignoreNS = $this->getBooleanProperty('ignore-namespaces');
        $namespace = $node->getNamespaceName();
        foreach ($node->findChildrenOfType('FunctionPostfix') as $postfix) {
            $fragment = $postfix->getImage();
            if ($ignoreNS) {
                $fragment = str_replace("{$namespace}\\", "", $fragment);
            }
            $fragment = strtolower($fragment);
            $fragment = trim($fragment, "\\");
            if (false === in_array($fragment, $this->getSuspectImages())) {
                continue;
            }

            $image = $node->getImage();
            if ($node instanceof MethodNode) {
                $image = sprintf('%s::%s', $node->getParentName(), $node->getImage());
            }

            $this->addViolation($postfix, array($node->getType(), $image, $fragment));
        }
    }

    /**
     * Returns an array with function images that are normally only used during
     * development.
     *
     * @return array
     */
    protected function getSuspectImages()
    {
        return array_map(
            'strtolower',
            array_map(
                'trim',
                explode(
                    ',',
                    $this->getStringProperty('unwanted-functions')
                )
            )
        );
    }
}


text:
package kuona.maven.analyser;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import kuona.maven.analyser.model.FlareNode;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.*;
import java.io.Closeable;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class MavenPomAnalyser {

  public final XPath xPath = XPathFactory.newInstance().newXPath();
  private AnalyserRuntimeOptions runtimeOptions;
  private XPathExpression projectsXpath;
  private XPathExpression dependenciesXpath;
  private XPathExpression groupIdXpath;
  private XPathExpression artifactIdXpath;
  private XPathExpression versionXpath;

  private MavenPomAnalyser() {
    try {
      projectsXpath = xPath.compile("/projects/project");
      dependenciesXpath = xPath.compile("dependencies/dependency");
      groupIdXpath = xPath.compile("groupId/text()");
      artifactIdXpath = xPath.compile("artifactId/text()");
      versionXpath = xPath.compile("version/text()");
    } catch (XPathExpressionException e) {
      e.printStackTrace();
    }
  }

  public MavenPomAnalyser(AnalyserRuntimeOptions runtimeOptions) {
    this();
    this.runtimeOptions = runtimeOptions;
  }

  public static Map<Integer, MavenArtifact> analysePomFile(String includePattern, String artifactPattern, String path) {
    AnalyserRuntimeOptions analyserRuntimeOptions = new AnalyserRuntimeOptions();
    analyserRuntimeOptions.setInclude(includePattern);
    analyserRuntimeOptions.setArtifactFilter(artifactPattern);

    return new MavenPomAnalyser(analyserRuntimeOptions).analysePom(path);
  }

  public static Map<Integer, MavenArtifact> analysePomFile(String path) {
    AnalyserRuntimeOptions analyserRuntimeOptions = new AnalyserRuntimeOptions();

    return new MavenPomAnalyser(analyserRuntimeOptions).analysePom(path);
  }

  public void analyseDependencies() {
    runtimeOptions.getArgs().stream().forEach(this::analysePath);
  }

  private void analysePath(String path) {
    Map<Integer, MavenArtifact> artifacts = analysePom(path);

    render(artifacts);
  }

  private Map<Integer, MavenArtifact> analysePom(String path) {
    Map<Integer, MavenArtifact> artifacts = new HashMap<>();

    final PomFile pomFile = new PomFile();

    try (Closeable ignored = pomFile.inject(path)) {

      new Maven(path).run("mvn help:effective-pom  -Doutput=target/effective-pom.xml", System.out);

      analyseEffectivePom(path + "/target/effective-pom.xml", artifacts);

    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    return artifacts;
  }

  private void render(Map<Integer, MavenArtifact> artifacts) {
    final List<FlareNode> rootLevelFlareNodes = artifacts.values().stream()
      .filter(runtimeOptions.getIncludeFilter())
      .filter(v -> !v.rootLevel())
      .filter(runtimeOptions.getArtifactFilter())
      .map(this::mapMavenArtifact).collect(Collectors.toList());

    final FlareNode rootNode = new FlareNode("project", rootLevelFlareNodes);

    try (final FileWriter writer = new FileWriter("dependencies.json")) {

      final Gson gson = new GsonBuilder().setPrettyPrinting().create();
      writer.write(gson.toJson(rootNode));
      writer.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  private FlareNode mapMavenArtifact(MavenArtifact a) {

    final FlareNode result = new FlareNode(a.getArtifactId());
    a.getDependencies().stream().filter(runtimeOptions.getIncludeFilter()).forEach(d -> result.add(mapMavenArtifact(d)));
    return result;
  }

  private void analyseEffectivePom(String path, Map<Integer, MavenArtifact> artifacts) {

    try {
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      final Document pom = db.parse(new File(path));

      NodeList nodes = (NodeList) projectsXpath.evaluate(pom, XPathConstants.NODESET);

      int nodecount = nodes.getLength();
      for (int i = 0; i < nodecount; i++) {
        // Removing the node from the DOM speeds up processing SIGNIFICANTLY
        final Node node = nodes.item(i);
        node.getParentNode().removeChild(node);
        analyseProject(node, artifacts);

      }

    } catch (ParserConfigurationException | SAXException | IOException | XPathExpressionException e) {
      throw new RuntimeException(e);
    }

  }

  private void analyseProject(Node projectNode, Map<Integer, MavenArtifact> artifacts) {
    try {

      MavenArtifact mavenArtifact = new MavenArtifact((String) groupIdXpath.evaluate(projectNode, XPathConstants.STRING), (String) artifactIdXpath.evaluate(projectNode, XPathConstants.STRING), (String) versionXpath.evaluate(projectNode, XPathConstants.STRING));

      if (!artifacts.containsKey(mavenArtifact.hashCode())) {
        artifacts.put(mavenArtifact.hashCode(), mavenArtifact);
      } else {
        mavenArtifact = artifacts.get(mavenArtifact.hashCode());
      }

      System.out.println("Found " + mavenArtifact);

      NodeList nodes = (NodeList) dependenciesXpath.evaluate(projectNode, XPathConstants.NODESET);

      int nodecount = nodes.getLength();
      for (int i = 0; i < nodecount; i++) {
        MavenArtifact artifact = new MavenArtifact((String) groupIdXpath.evaluate(nodes.item(i), XPathConstants.STRING), (String) artifactIdXpath.evaluate(nodes.item(i), XPathConstants.STRING), (String) versionXpath.evaluate(nodes.item(i), XPathConstants.STRING));

        if (!artifacts.containsKey(artifact.hashCode())) {
          artifacts.put(artifact.hashCode(), artifact);
        } else {
          artifact = artifacts.get(artifact.hashCode());
        }

        mavenArtifact.addDependent(artifact);
      }

    } catch (XPathExpressionException e) {
      e.printStackTrace();
    }

  }

}


text:
"""UserUpdateHandlerFunction

Updates a user's profile attributes.

"""

from __future__ import print_function

import os
import json
import boto3
import botocore
from apigateway_helpers.exception import APIGatewayException
from apigateway_helpers.headers import get_response_headers

cognito_idp_client = boto3.client("cognito-idp")

def lambda_handler(event, context):
    print("Event: {}".format(json.dumps(event)))

    if "warming" in event and "{}".format(event["warming"]).lower() == "true":
        return {
            "message": "Warmed!"
        }

    event["request-body"] = json.loads(event.get("body", "{}"))

    new_email_address = event["request-body"].get("email-address", "")

    if new_email_address == "":
        raise APIGatewayException("Value for \"email-address\" must be specified in request body.", 400)

    cognito_auth_provider_string = event["requestContext"]["identity"]["cognitoAuthenticationProvider"]
    cognito_idp_name = cognito_auth_provider_string.split(",")[0]
    user_pool_id = "/".join(cognito_idp_name.split("/")[1:])
    cognito_user_pool_sub_value = cognito_auth_provider_string.split(",")[1].split(":")[2]

    response = cognito_idp_client.list_users(
        UserPoolId = user_pool_id,
        AttributesToGet = [],
        Filter = "sub = \"{}\"".format(cognito_user_pool_sub_value),
        Limit = 1
    )

    cognito_user_pool_username = response["Users"][0]["Username"]

    cognito_idp_client.admin_update_user_attributes(
        UserPoolId = user_pool_id,
        Username = cognito_user_pool_username,
        UserAttributes = [
            {
                "Name": "email",
                "Value": new_email_address
            }
        ]
    )

    return {
        "registration-id": cognito_user_pool_username,
        "message": "E-mail address verification message sent."
    }

def proxy_lambda_handler(event, context):

    response_headers = get_response_headers(event, context)

    try:
        return_dict = lambda_handler(event, context)
    except APIGatewayException as e:
        return {
            "statusCode": e.http_status_code,
            "headers": response_headers,
            "body": json.dumps({
                "message": e.http_status_message
            })
        }

    return {
        "statusCode": 200,
        "headers": response_headers,
        "body": json.dumps(return_dict)
    }


text:
package net.spy.memcached.transcoders;

import net.spy.memcached.CachedData;

public class WhalinV1TranscoderTest extends BaseTranscoderCase {

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		setTranscoder(new WhalinV1Transcoder());
	}

	@Override
	public void testByteArray() throws Exception {
		byte[] a={'a', 'b', 'c'};
		try {
			CachedData cd=getTranscoder().encode(a);
			fail("Expected IllegalArgumentException, got " + cd);
		} catch(IllegalArgumentException e) {
			// pass
		}
	}

	@Override
	protected int getStringFlags() {
		// Flags are not used by this transcoder.
		return 0;
	}

}


text:
package zornco.reploidcraft.client.renderers.mechParts;

import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelRideArmorArmLeft extends ModelRideArmorBase {

	ModelRenderer lowerArmLeft;

	public ModelRideArmorArmLeft() {
		super();

	    setTextureOffset("upperArmLeft.shoulderLeft", 58, 0);
	    setTextureOffset("upperArmLeft.bicepLeft", 106, 0);
	    setTextureOffset("lowerArmLeft.armLeft", 110, 0);
	    setTextureOffset("lowerArmLeft.thumbLeft", 158, 0);
	    setTextureOffset("lowerArmLeft.elbowLeft", 158, 11);

		upperArmLeft = new ModelRenderer(this, "upperArmLeft");
		upperArmLeft.setRotationPoint(18F, -25F, 0F);
		setRotation(upperArmLeft, 0F, 0F, 0F);
		upperArmLeft.mirror = true;
		upperArmLeft.addBox("shoulderLeft", -6F, -6F, -6F, 12, 12, 12);
		upperArmLeft.addBox("bicepLeft", -4F, 6F, -4F, 8, 16, 8);
			lowerArmLeft = new ModelRenderer(this, "lowerArmLeft");
			lowerArmLeft.setRotationPoint(0F, 22F, 0F);
			setRotation(lowerArmLeft, 0F, 0F, 0F);
			lowerArmLeft.mirror = true;
			lowerArmLeft.addBox("armLeft", -5F, -5F, -22F, 10, 13, 28);
			lowerArmLeft.addBox("thumbLeft", -7F, -7F, -17F, 8, 8, 3);
			lowerArmLeft.mirror = false;
			lowerArmLeft.addBox("elbowLeft", -4F, -4F, 6F, 8, 11, 5);
		upperArmLeft.addChild(lowerArmLeft);
	}

	public void renderPart(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
	{
		super.renderPart(entity, f, f1, f2, f3, f4, f5);
		upperArmLeft.render(f5);
	}

	public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
	{
		super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
		float f7 = (float)(Math.sin((double)(f1 * (float)Math.PI * 0.2F )))/4f * f;
		setRotation(upperArmLeft, -f7, f7/2, -0.2F*f3);
		setRotation(lowerArmLeft, f7, 0F, 0F);
	}
}


text:
package com.xdandroid.sample;

import android.content.*;
import android.os.*;

import com.xdandroid.hellodaemon.*;

import java.util.concurrent.*;

import io.reactivex.*;
import io.reactivex.disposables.*;

public class TraceServiceImpl extends AbsWorkService {

    //是否 任务完成, 不再需要服务运行?
    public static boolean sShouldStopService;
    public static Disposable sDisposable;

    public static void stopService() {
        //我们现在不再需要服务运行了, 将标志位置为 true
        sShouldStopService = true;
        //取消对任务的订阅
        if (sDisposable != null) sDisposable.dispose();
        //取消 Job / Alarm / Subscription
        cancelJobAlarmSub();
    }

    /**
     * 是否 任务完成, 不再需要服务运行?
     * @return 应当停止服务, true; 应当启动服务, false; 无法判断, 什么也不做, null.
     */
    @Override
    public Boolean shouldStopService(Intent intent, int flags, int startId) {
        return sShouldStopService;
    }

    @Override
    public void startWork(Intent intent, int flags, int startId) {
        System.out.println("检查磁盘中是否有上次销毁时保存的数据");
        sDisposable = Observable
                .interval(3, TimeUnit.SECONDS)
                //取消任务时取消定时唤醒
                .doOnDispose(() -> {
                    System.out.println("保存数据到磁盘。");
                    cancelJobAlarmSub();
                })
                .subscribe(count -> {
                    System.out.println("每 3 秒采集一次数据... count = " + count);
                    if (count > 0 && count % 18 == 0) System.out.println("保存数据到磁盘。 saveCount = " + (count / 18 - 1));
                });
    }

    @Override
    public void stopWork(Intent intent, int flags, int startId) {
        stopService();
    }

    /**
     * 任务是否正在运行?
     * @return 任务正在运行, true; 任务当前不在运行, false; 无法判断, 什么也不做, null.
     */
    @Override
    public Boolean isWorkRunning(Intent intent, int flags, int startId) {
        //若还没有取消订阅, 就说明任务仍在运行.
        return sDisposable != null && !sDisposable.isDisposed();
    }

    @Override
    public IBinder onBind(Intent intent, Void v) {
        return null;
    }

    @Override
    public void onServiceKilled(Intent rootIntent) {
        System.out.println("保存数据到磁盘。");
    }
}


text:
#include <stdlib.h>

#include "iup.h"
#include "iupcontrols.h"

#include <lua.h>
#include <lauxlib.h>

#include "iuplua.h"
#include "il.h"
#include "il_controls.h"

static int TREE_pattern (Ihandle *handle, int id, char* name)
{
  iuplua_call_start(handle, name);
  lua_pushnumber(id);
  return iuplua_call();
}

static int TREE_branchopen (Ihandle *handle, int id)
{
  return TREE_pattern(handle,id,"branchopen");
}

static int TREE_branchclose (Ihandle *handle, int id)
{
  return TREE_pattern(handle,id,"branchclose");
}

static int TREE_showrename (Ihandle *handle, int id)
{
  return TREE_pattern(handle,id,"showrenamecb");
}

static int TREE_executeleaf (Ihandle *handle, int id)
{
  return TREE_pattern(handle,id,"executeleaf");
}

static int TREE_selection (Ihandle *handle, int node, int state)
{
  iuplua_call_start(handle, "selection");
  lua_pushnumber(node);
  lua_pushnumber(state);
  return iuplua_call();
}

static int TREE_renamenode (Ihandle *handle, int id, char* name)
{
  iuplua_call_start(handle, "renamenode");
  lua_pushnumber(id);
  lua_pushstring(name);
  return iuplua_call();
}

static int TREE_rename (Ihandle *handle, int id, char* name)
{
  iuplua_call_start(handle, "renamecb");
  lua_pushnumber(id);
  lua_pushstring(name);
  return iuplua_call();
}

static int TREE_multiselection (Ihandle *handle, int *ids, int n)
{
  int i;
  lua_Object tb;

  iuplua_call_start(handle, "multiselection");

  tb = lua_createtable();
  for (i = 0; i < n; i++)
  {
    lua_beginblock();
    lua_pushobject(tb);
    lua_pushnumber(i+1);
    lua_pushnumber(ids[i]);
    lua_settable();
    lua_endblock();
  }
  lua_pushobject(tb);

  lua_pushnumber (n);
  return iuplua_call();
}

static int TREE_multiunselection (Ihandle *handle, int *ids, int n)
{
  int i;
  lua_Object tb;

  iuplua_call_start(handle, "multiunselection");

  tb = lua_createtable();
  for (i = 0; i < n; i++)
  {
    lua_beginblock();
    lua_pushobject(tb);
    lua_pushnumber(i+1);
    lua_pushnumber(ids[i]);
    lua_settable();
    lua_endblock();
  }
  lua_pushobject(tb);

  lua_pushnumber (n);
  return iuplua_call();
}

static int TREE_dragdrop(Ihandle* handle, int drag_id, int drop_id, int isshift, int iscontrol)
{
  iuplua_call_start(handle, "dragdrop");
  lua_pushnumber(drag_id);
  lua_pushnumber(drop_id);
  lua_pushnumber(isshift);
  lua_pushnumber(iscontrol);
  return iuplua_call();
}

static int TREE_rightclick (Ihandle *handle, int id, char* r)
{
  iuplua_call_start(handle, "rightclick");
  lua_pushnumber(id);
  lua_pushstring(r);
  return iuplua_call();
}

static void CreateTree(void)
{
  int tag = (int)lua_getnumber(lua_getglobal("iuplua_tag"));
  lua_pushusertag(IupTree(), tag);
}

static int tree_getnumberintable(lua_Object o)
{
	lua_pushobject(lua_getglobal("IUPTREEREFERENCETABLE"));
	lua_pushobject(o);
	return (int)lua_getnumber(lua_rawgettable());
}

static void tree_setnumberintable(lua_Object o, int ref)
{
	/* Set in global table in index o, the value of ref.
	   If ref is 0, then set nil in the table. */
	lua_pushobject(lua_getglobal("IUPTREEREFERENCETABLE"));
	lua_pushobject(o);
	if(ref == 0)
		lua_pushnil();
	else
	  lua_pushnumber(ref);
	lua_rawsettable();
}

static void* check_userdata(int numArg)
{
  lua_Object o = lua_getparam(numArg);
  luaL_arg_check(lua_isuserdata(o), numArg, "userdata expected");
  return lua_getuserdata(o);
}

static void cfTreeSetUserId(void)
{
  lua_pushnumber(IupTreeSetUserId(iuplua_checkihandle(1), luaL_check_int(2), check_userdata(3)));
}

static void cfTreeGetUserId(void)
{
  lua_pushusertag(IupTreeGetUserId(iuplua_checkihandle(1), luaL_check_int(2)), LUA_ANYTAG);
}

static lua_Object tree_gettable(Ihandle* ih, int id)
{
  int ref = (int)IupTreeGetUserId(ih, id);
  if(ref == 0)
    return LUA_NOOBJECT;
	else
		return lua_getref(ref-1);
}

static void cfTreeSetTableId(void)
{
  Ihandle* ih = iuplua_checkihandle(1);
  int id = luaL_check_int(2);

  lua_Object o3 = lua_getparam(3);
  if(lua_isnil(o3))
  {
		int ref;
		/* Setting in the id table the reference as nil */
		o3 = tree_gettable(ih, id);
		if(o3 != LUA_NOOBJECT)
		  tree_setnumberintable(o3, 0);

    ref = (int)IupTreeGetUserId(ih, id);
    lua_unref(ref);
    lua_pushnumber(IupTreeSetUserId(ih, id, NULL));
  }
  else
  {
    int ref;
    lua_pushobject(o3);
    ref = lua_ref(1);
    lua_pushnumber(IupTreeSetUserId(ih, id, (void*)(ref+1)));
		tree_setnumberintable(o3, ref+1);
  }
}

static void cfTreeGetTable(void)
{
  Ihandle* ih = iuplua_checkihandle(1);
  int id = luaL_check_int(2);

	lua_Object o3 = tree_gettable(ih, id);
  if(o3 == LUA_NOOBJECT)
    lua_pushnil();
  else
    lua_pushobject(o3);
}

static int tree_gettableid(Ihandle* ih, lua_Object o)
{
  int ref = tree_getnumberintable(o);
  if(ref == 0)
		return -1;
  return IupTreeGetId(ih, (void*) ref);
}

static void cfTreeGetTableId(void)
{
  Ihandle* ih = iuplua_checkihandle(1);
  lua_Object o2 = luaL_tablearg(2);
  int ret = tree_gettableid(ih, o2);
	if(ret == -1)
		lua_pushnil();
	else
		lua_pushnumber(ret);
}

static void cfTreeGetId(void)
{
  lua_pushnumber(IupTreeGetId(iuplua_checkihandle(1), check_userdata(2)));
}

int treelua_open(void)
{
  struct AssocList {
    char *name;
    lua_CFunction func;
  } TreeAssocList [] = {
    {"iup_tree_multiselection_cb", (lua_CFunction)TREE_multiselection},
    {"iup_tree_multiunselection_cb", (lua_CFunction)TREE_multiunselection},
    {"iup_tree_selection_cb", (lua_CFunction)TREE_selection},
    {"iup_tree_branchopen_cb", (lua_CFunction)TREE_branchopen},
    {"iup_tree_branchclose_cb", (lua_CFunction)TREE_branchclose},
    {"iup_tree_executeleaf_cb", (lua_CFunction)TREE_executeleaf},
    {"iup_tree_renamenode_cb", (lua_CFunction)TREE_renamenode},
    {"iup_tree_rename_cb", (lua_CFunction)TREE_rename},
    {"iup_tree_showrename_cb", (lua_CFunction)TREE_showrename},
    {"iup_tree_dragdrop_cb", (lua_CFunction)TREE_dragdrop},
    {"iup_tree_rightclick_cb", (lua_CFunction)TREE_rightclick}
  };
  int SizeTreeAssocList = (sizeof(TreeAssocList)/sizeof(struct AssocList));
  int i ;

  iuplua_register("IupTreeSetUserId", cfTreeSetUserId);
  iuplua_register("IupTreeGetUserId", cfTreeGetUserId);
  iuplua_register("IupTreeGetId",     cfTreeGetId);
  iuplua_register("IupTreeSetTableId", cfTreeSetTableId);
  iuplua_register("IupTreeGetTableId", cfTreeGetTableId);
  iuplua_register("IupTreeGetTable", cfTreeGetTable);

  lua_register("iupCreateTree", CreateTree);

  for (i = 0; i < SizeTreeAssocList; i++)
     lua_register(TreeAssocList[i].name, TreeAssocList[i].func);

#ifdef IUPLUA_USELOH
#ifdef TEC_BIGENDIAN
#ifdef TEC_64
#include "loh/tree_be64.loh"
#else
#include "loh/tree_be32.loh"
#endif
#else
#ifdef TEC_64
#ifdef WIN64
#include "loh/tree_le64w.loh"
#else
#include "loh/tree_le64.loh"
#endif
#else
#include "loh/tree.loh"
#endif
#endif
#else
  iuplua_dofile("luatree.lua");
#endif

  return 1;
}


text:
using System;

namespace CodeModel.Dependencies
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    public class OptionalNeedAttribute : Attribute
    {
        public string[] OptionalNeeds { get; private set; }

        public OptionalNeedAttribute(params string[] optionalNeeds)
        {
            OptionalNeeds = optionalNeeds;
        }
    }
}


text:
<?php
App::uses('Schedule', 'Model');

/**
 * Schedule Test Case
 *
 */
class ScheduleTest extends CakeTestCase {

/**
 * Fixtures
 *
 * @var array
 */
	public $fixtures = array(
		'app.schedule',
		'app.course_professor_subject',
		'app.course',
		'app.banner',
		'app.job',
		'app.post',
		'app.user',
		'app.category',
		'app.subject',
		'app.courses_subject',
		'app.courses_user'
	);

/**
 * setUp method
 *
 * @return void
 */
	public function setUp() {
		parent::setUp();
		$this->Schedule = ClassRegistry::init('Schedule');
	}

/**
 * tearDown method
 *
 * @return void
 */
	public function tearDown() {
		unset($this->Schedule);

		parent::tearDown();
	}

}


text:
FROM ubuntu:18.04
MAINTAINER Owen O'Malley <owen@hortonworks.com>

RUN ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
RUN apt-get update
RUN apt-get install -y \
  cmake \
  gcc \
  g++ \
  git \
  libsasl2-dev \
  libssl-dev \
  make \
  maven \
  openjdk-8-jdk \
  tzdata
RUN update-java-alternatives --set java-1.8.0-openjdk-amd64

WORKDIR /root

CMD git clone https://github.com/apache/orc.git -b master && \
  mkdir orc/build && \
  cd orc/build && \
  cmake .. && \
  make package test-out


text:
/**
 * @class Ext.dd.DropZone
 * @extends Ext.dd.DropTarget
 * This class provides a container DD instance that proxies for multiple child node targets.<br />
 * By default, this class requires that child nodes accepting drop are registered with {@link Ext.dd.Registry}.
 * @constructor
 * @param {Mixed} el The container element
 * @param {Object} config
 */
Ext.dd.DropZone = function(el, config){
    Ext.dd.DropZone.superclass.constructor.call(this, el, config);
};

Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {
    /**
     * Returns a custom data object associated with the DOM node that is the target of the event.  By default
     * this looks up the event target in the {@link Ext.dd.Registry}, although you can override this method to
     * provide your own custom lookup.
     * @param {Event} e The event
     * @return {Object} data The custom data
     */
    getTargetFromEvent : function(e){
        return Ext.dd.Registry.getTargetFromEvent(e);
    },

    /**
     * Called internally when the DropZone determines that a {@link Ext.dd.DragSource} has entered a drop node
     * that it has registered.  This method has no default implementation and should be overridden to provide
     * node-specific processing if necessary.
     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
     * {@link #getTargetFromEvent} for this node)
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     */
    onNodeEnter : function(n, dd, e, data){

    },

    /**
     * Called internally while the DropZone determines that a {@link Ext.dd.DragSource} is over a drop node
     * that it has registered.  The default implementation returns this.dropNotAllowed, so it should be
     * overridden to provide the proper feedback.
     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
     * {@link #getTargetFromEvent} for this node)
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     * @return {String} status The CSS class that communicates the drop status back to the source so that the
     * underlying {@link Ext.dd.StatusProxy} can be updated
     */
    onNodeOver : function(n, dd, e, data){
        return this.dropAllowed;
    },

    /**
     * Called internally when the DropZone determines that a {@link Ext.dd.DragSource} has been dragged out of
     * the drop node without dropping.  This method has no default implementation and should be overridden to provide
     * node-specific processing if necessary.
     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
     * {@link #getTargetFromEvent} for this node)
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     */
    onNodeOut : function(n, dd, e, data){

    },

    /**
     * Called internally when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped onto
     * the drop node.  The default implementation returns false, so it should be overridden to provide the
     * appropriate processing of the drop event and return true so that the drag source's repair action does not run.
     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
     * {@link #getTargetFromEvent} for this node)
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     * @return {Boolean} True if the drop was valid, else false
     */
    onNodeDrop : function(n, dd, e, data){
        return false;
    },

    /**
     * Called internally while the DropZone determines that a {@link Ext.dd.DragSource} is being dragged over it,
     * but not over any of its registered drop nodes.  The default implementation returns this.dropNotAllowed, so
     * it should be overridden to provide the proper feedback if necessary.
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     * @return {String} status The CSS class that communicates the drop status back to the source so that the
     * underlying {@link Ext.dd.StatusProxy} can be updated
     */
    onContainerOver : function(dd, e, data){
        return this.dropNotAllowed;
    },

    /**
     * Called internally when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped on it,
     * but not on any of its registered drop nodes.  The default implementation returns false, so it should be
     * overridden to provide the appropriate processing of the drop event if you need the drop zone itself to
     * be able to accept drops.  It should return true when valid so that the drag source's repair action does not run.
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     * @return {Boolean} True if the drop was valid, else false
     */
    onContainerDrop : function(dd, e, data){
        return false;
    },

    /**
     * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source is now over
     * the zone.  The default implementation returns this.dropNotAllowed and expects that only registered drop
     * nodes can process drag drop operations, so if you need the drop zone itself to be able to process drops
     * you should override this method and provide a custom implementation.
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     * @return {String} status The CSS class that communicates the drop status back to the source so that the
     * underlying {@link Ext.dd.StatusProxy} can be updated
     */
    notifyEnter : function(dd, e, data){
        return this.dropNotAllowed;
    },

    /**
     * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the drop zone.
     * This method will be called on every mouse movement while the drag source is over the drop zone.
     * It will call {@link #onNodeOver} while the drag source is over a registered node, and will also automatically
     * delegate to the appropriate node-specific methods as necessary when the drag source enters and exits
     * registered nodes ({@link #onNodeEnter}, {@link #onNodeOut}). If the drag source is not currently over a
     * registered node, it will call {@link #onContainerOver}.
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     * @return {String} status The CSS class that communicates the drop status back to the source so that the
     * underlying {@link Ext.dd.StatusProxy} can be updated
     */
    notifyOver : function(dd, e, data){
        var n = this.getTargetFromEvent(e);
        if(!n){ // not over valid drop target
            if(this.lastOverNode){
                this.onNodeOut(this.lastOverNode, dd, e, data);
                this.lastOverNode = null;
            }
            return this.onContainerOver(dd, e, data);
        }
        if(this.lastOverNode != n){
            if(this.lastOverNode){
                this.onNodeOut(this.lastOverNode, dd, e, data);
            }
            this.onNodeEnter(n, dd, e, data);
            this.lastOverNode = n;
        }
        return this.onNodeOver(n, dd, e, data);
    },

    /**
     * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source has been dragged
     * out of the zone without dropping.  If the drag source is currently over a registered node, the notification
     * will be delegated to {@link #onNodeOut} for node-specific handling, otherwise it will be ignored.
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag zone
     */
    notifyOut : function(dd, e, data){
        if(this.lastOverNode){
            this.onNodeOut(this.lastOverNode, dd, e, data);
            this.lastOverNode = null;
        }
    },

    /**
     * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the dragged item has
     * been dropped on it.  The drag zone will look up the target node based on the event passed in, and if there
     * is a node registered for that event, it will delegate to {@link #onNodeDrop} for node-specific handling,
     * otherwise it will call {@link #onContainerDrop}.
     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
     * @param {Event} e The event
     * @param {Object} data An object containing arbitrary data supplied by the drag source
     * @return {Boolean} True if the drop was valid, else false
     */
    notifyDrop : function(dd, e, data){
        if(this.lastOverNode){
            this.onNodeOut(this.lastOverNode, dd, e, data);
            this.lastOverNode = null;
        }
        var n = this.getTargetFromEvent(e);
        return n ?
            this.onNodeDrop(n, dd, e, data) :
            this.onContainerDrop(dd, e, data);
    },

    // private
    triggerCacheRefresh : function(){
        Ext.dd.DDM.refreshCache(this.groups);
    }
});


text:
package it.crs4.rapi;

public class RapiOutOfMemoryError extends RapiException
{
  public RapiOutOfMemoryError(String reason) {
    super(reason);
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LiteDB.Shell
{
    public interface ILiteCommand
    {
        bool IsCommand(StringScanner s);
        BsonValue Execute(LiteDatabase db, StringScanner s);
    }
}


text:
 //
 // @author AbdelRauf
 //
#ifndef LIBND4J_LOOPCOORDSHELPER_H
#define LIBND4J_LOOPCOORDSHELPER_H

#include <cstddef>
#include <type_traits>
#include <utility>
#include <pointercast.h>
#include <op_boilerplate.h>
namespace nd4j {

#if defined(__GNUC__)
#define likely(x) __builtin_expect( (x), 1)
#define unlikely(x) __builtin_expect( (x), 0)
#else
#define likely(x)  (x)
#define unlikely(x)  (x)
#endif

	using zip_size_t = std::pair<size_t, size_t>;

	template<size_t Index>
	struct CoordsState :CoordsState<Index - 1> {
		Nd4jLong coord;
		Nd4jLong last_num;
		Nd4jLong stride;
		Nd4jLong adjust;
		CoordsState() :CoordsState<Index - 1>() {}
	};

	template<>
	struct CoordsState<0> {
		Nd4jLong coord;
		Nd4jLong last_num;
		Nd4jLong stride;
		Nd4jLong adjust;
		CoordsState() {}
	};

	template<size_t Index>
	struct ZipCoordsState :ZipCoordsState<Index - 1> {
		Nd4jLong coord;
		Nd4jLong last_num;
		Nd4jLong stride1;
		Nd4jLong stride2;
		Nd4jLong adjust1;
		Nd4jLong adjust2;
		ZipCoordsState() : ZipCoordsState<Index - 1>() {}
	};

	template<>
	struct ZipCoordsState<0> {
		Nd4jLong coord;
		Nd4jLong last_num;
		Nd4jLong stride1;
		Nd4jLong stride2;
		Nd4jLong adjust1;
		Nd4jLong adjust2;
		ZipCoordsState() {}
	};

#define COORDS(x,index)          ((x).::nd4j::CoordsState<(index)>::coord)
#define STRIDE(x,index)          ((x).::nd4j::CoordsState<(index)>::stride)
#define LAST_NUM(x,index)        ((x).::nd4j::CoordsState<(index)>::last_num)
#define OF_ADJUST(x,index)       ((x).::nd4j::CoordsState<(index)>::adjust)
#define ZIP_LAST_NUM(x,index)    ((x).::nd4j::ZipCoordsState<(index)>::last_num)
#define ZIP_COORDS(x,index)      ((x).::nd4j::ZipCoordsState<(index)>::coord)
#define ZIP_STRIDE1(x,index)     ((x).::nd4j::ZipCoordsState<(index)>::stride1)
#define ZIP_STRIDE2(x,index)     ((x).::nd4j::ZipCoordsState<(index)>::stride2)
#define ZIP_OF_ADJUST1(x,index)  ((x).::nd4j::ZipCoordsState<(index)>::adjust1)
#define ZIP_OF_ADJUST2(x,index)  ((x).::nd4j::ZipCoordsState<(index)>::adjust2)

	FORCEINLINE void   index2coords_C(Nd4jLong index, const Nd4jLong rank, const Nd4jLong* bases, Nd4jLong* coords) {
		for (size_t i = rank - 1; i > 0; --i) {
			coords[i] = index % bases[i];
			index /= bases[i];
		}
		coords[0] = index;      // last iteration
	}

	FORCEINLINE void   index2coords_F(Nd4jLong index, const Nd4jLong rank, const Nd4jLong* bases, Nd4jLong* coords) {

		for (size_t i = 0; i < rank - 1; i++) {
			coords[i] = index % bases[i];
			index /= bases[i];
		}
		coords[rank - 1] = index;      // last iteration
	}

	FORCEINLINE size_t offset_from_coords(const Nd4jLong* strides, const Nd4jLong* coords, const  Nd4jLong& rank) {

		size_t offset = 0;
		size_t rank_4 = rank & -4;
		for (int i = 0; i < rank_4; i += 4) {
			offset = offset
				+ coords[i] * strides[i]
				+ coords[i + 1] * strides[i + 1]
				+ coords[i + 2] * strides[i + 2]
				+ coords[i + 3] * strides[i + 3];
		}
		for (int i = rank_4; i < rank; i++) {
			offset += coords[i] * strides[i];
		}
		return offset;
	}

	FORCEINLINE zip_size_t offset_from_coords(const Nd4jLong*& x_strides, const Nd4jLong*& z_strides, const Nd4jLong* coords, const Nd4jLong& rank) {

		zip_size_t offset = { 0,0 };
		size_t rank_4 = rank & -4;
		for (int i = 0; i < rank_4; i += 4) {
			offset.first = offset.first
				+ coords[i] * x_strides[i]
				+ coords[i + 1] * x_strides[i + 1]
				+ coords[i + 2] * x_strides[i + 2]
				+ coords[i + 3] * x_strides[i + 3];
			offset.second = offset.second
				+ coords[i] * z_strides[i]
				+ coords[i + 1] * z_strides[i + 1]
				+ coords[i + 2] * z_strides[i + 2]
				+ coords[i + 3] * z_strides[i + 3];
		}
		for (int i = rank_4; i < rank; i++) {
			offset.first += coords[i] * x_strides[i];
			offset.second += coords[i] * z_strides[i];
		}
		return offset;
	}

	template<size_t Rank, size_t Index, bool Last_Index_Faster = true>
	constexpr size_t StridesOrderInd() {
		return Last_Index_Faster ? Rank - Index - 1 : Index;
	}

	template<size_t Rank, size_t Index, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 == Index), size_t>::type
		coord_inc_n(CoordsState<Rank - 1>& cbs, size_t last_offset) {

		constexpr size_t Ind = StridesOrderInd<Rank, Index, Last_Index_Faster>();

		if (likely(COORDS(cbs, Ind) < LAST_NUM(cbs, Ind))) {
			last_offset += cbs.CoordsState<Ind>::stride;
			COORDS(cbs, Ind) = COORDS(cbs, Ind) + 1;
			return last_offset;
		}
		//overflow case should not happen
		COORDS(cbs, Ind) = 0;
		//last_offset = 0;// last_offset + strides[Ind] - adjust_stride;
		return 0;
	}

	template<size_t Rank, size_t Index, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 != Index), size_t >::type
		coord_inc_n(CoordsState<Rank - 1>& cbs, size_t last_offset) {

		constexpr size_t Ind = StridesOrderInd<Rank, Index, Last_Index_Faster>();

		if (likely(COORDS(cbs, Ind) < LAST_NUM(cbs, Ind))) {
			last_offset = last_offset + cbs.CoordsState<Ind>::stride;
			COORDS(cbs, Ind) = COORDS(cbs, Ind) + 1;
		}
		else {
			//lets adjust offset
			last_offset -= OF_ADJUST(cbs, Ind);
			COORDS(cbs, Ind) = 0;
			last_offset = coord_inc_n<Rank, Index + 1, Last_Index_Faster>(cbs, last_offset);
		}

		return last_offset;

	}

	template<size_t Rank, size_t Index = 0, bool Last_Index_Faster = true>
	FORCEINLINE size_t inc_coords(CoordsState<Rank - 1>& cbs, size_t last_offset) {

		return coord_inc_n<Rank, Index, Last_Index_Faster>(cbs,/* 1,*/ last_offset/*, 0*/);
	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE size_t inc_coords_ews(CoordsState<Rank - 1>& cbs, size_t last_offset, size_t ews) {
		if (ews == 1) {
			constexpr size_t Ind = StridesOrderInd<Rank, rankIndex, Last_Index_Faster>();
			return last_offset + STRIDE(cbs, Ind);
		}
		return coord_inc_n<Rank, rankIndex, Last_Index_Faster>(cbs,/* 1,*/ last_offset/*, 0*/);
	}

	template<size_t Rank, size_t rankIndex, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 == rankIndex), zip_size_t>::type
		coord_inc_n(ZipCoordsState<Rank - 1>& cbs, zip_size_t last_offset) {

		constexpr size_t Ind = StridesOrderInd<Rank, rankIndex, Last_Index_Faster>();

		if (likely(ZIP_COORDS(cbs, Ind) < ZIP_LAST_NUM(cbs, Ind))) {
			last_offset.first += ZIP_STRIDE1(cbs, Ind);
			last_offset.second += ZIP_STRIDE2(cbs, Ind);
			ZIP_COORDS(cbs, Ind) = ZIP_COORDS(cbs, Ind) + 1;
			return last_offset;
		}
		//overflow case should not happen
		ZIP_COORDS(cbs, Ind) = 0;
		//last_offset = 0;// last_offset + strides[Ind] - adjust_stride;
		return { 0,0 };
	}

	template<size_t Rank, size_t rankIndex, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 != rankIndex), zip_size_t >::type
		coord_inc_n(ZipCoordsState<Rank - 1>& cbs, zip_size_t last_offset) {

		constexpr size_t Ind = StridesOrderInd<Rank, rankIndex, Last_Index_Faster>();

		if (likely(ZIP_COORDS(cbs, Ind) < ZIP_LAST_NUM(cbs, Ind))) {
			last_offset.first += ZIP_STRIDE1(cbs, Ind);
			last_offset.second += ZIP_STRIDE2(cbs, Ind);
			ZIP_COORDS(cbs, Ind) = ZIP_COORDS(cbs, Ind) + 1;
		}
		else {

			//lets adjust offset
			last_offset.first -= ZIP_OF_ADJUST1(cbs, Ind);
			last_offset.second -= ZIP_OF_ADJUST2(cbs, Ind);
			ZIP_COORDS(cbs, Ind) = 0;
			last_offset = coord_inc_n<Rank, rankIndex + 1, Last_Index_Faster>(cbs, last_offset);
		}

		return last_offset;

	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE zip_size_t inc_coords(ZipCoordsState<Rank - 1>& cbs, zip_size_t last_offset) {

		return coord_inc_n<Rank, rankIndex, Last_Index_Faster>(cbs, last_offset);
	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 == rankIndex), size_t>::type
		init_coords(CoordsState<Rank - 1>& cbs, const Nd4jLong index, const Nd4jLong* bases, const Nd4jLong* strides, size_t offset = 0) {
		constexpr size_t Ind = StridesOrderInd<Rank, rankIndex, Last_Index_Faster>();
		COORDS(cbs, Ind) = index % bases[Ind];
		LAST_NUM(cbs, Ind) = bases[Ind] - 1;
		STRIDE(cbs, Ind) = strides[Ind];
		OF_ADJUST(cbs, Ind) = bases[Ind] * strides[Ind] - strides[Ind];
		offset += COORDS(cbs, Ind) * strides[Ind];
		return offset;
	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 != rankIndex), size_t>::type
		init_coords(CoordsState<Rank - 1>& cbs, const Nd4jLong index, const Nd4jLong* bases, const Nd4jLong* strides, size_t offset = 0) {
		constexpr size_t Ind = StridesOrderInd<Rank, rankIndex, Last_Index_Faster>();
		COORDS(cbs, Ind) = index % bases[Ind];
		LAST_NUM(cbs, Ind) = bases[Ind] - 1;
		STRIDE(cbs, Ind) = strides[Ind];
		OF_ADJUST(cbs, Ind) = bases[Ind] * strides[Ind] - strides[Ind];
		offset += COORDS(cbs, Ind) * strides[Ind];
		return init_coords<Rank, rankIndex + 1, Last_Index_Faster>(cbs, index / bases[Ind], bases, strides, offset);
	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 == rankIndex), bool>::type
		eq_coords(CoordsState<Rank - 1>& cbs, const Nd4jLong* coords) {
		return COORDS(cbs, rankIndex) == coords[rankIndex];
	}

	template<size_t Rank, size_t rankIndex = 0>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 != rankIndex), bool>::type
		eq_coords(CoordsState<Rank - 1>& cbs, const Nd4jLong* coords) {
		return COORDS(cbs, rankIndex) == coords[rankIndex] && eq_coords<Rank, rankIndex + 1>(cbs, coords);
	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 == rankIndex), bool>::type
		eq_zip_coords(ZipCoordsState<Rank - 1>& cbs, const Nd4jLong* coords) {
		return ZIP_COORDS(cbs, rankIndex) == coords[rankIndex];
	}

	template<size_t Rank, size_t rankIndex = 0>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 != rankIndex), bool>::type
		eq_zip_coords(ZipCoordsState<Rank - 1>& cbs, const Nd4jLong* coords) {
		return ZIP_COORDS(cbs, rankIndex) == coords[rankIndex] && eq_zip_coords<Rank, rankIndex + 1>(cbs, coords);
	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 == rankIndex), zip_size_t>::type
		init_coords(ZipCoordsState<Rank - 1>& cbs, const Nd4jLong index, const Nd4jLong* bases, const Nd4jLong* x_strides, const Nd4jLong* z_strides, zip_size_t offset = {}) {
		constexpr size_t Ind = StridesOrderInd<Rank, rankIndex, Last_Index_Faster>();
		ZIP_COORDS(cbs, Ind) = index % bases[Ind];
		ZIP_LAST_NUM(cbs, Ind) = bases[Ind] - 1;
		ZIP_STRIDE1(cbs, Ind) = x_strides[Ind];
		ZIP_STRIDE2(cbs, Ind) = z_strides[Ind];
		ZIP_OF_ADJUST1(cbs, Ind) = ZIP_LAST_NUM(cbs, Ind) * ZIP_STRIDE1(cbs, Ind);
		ZIP_OF_ADJUST2(cbs, Ind) = ZIP_LAST_NUM(cbs, Ind) * ZIP_STRIDE2(cbs, Ind);
		offset.first += ZIP_COORDS(cbs, Ind) * ZIP_STRIDE1(cbs, Ind);
		offset.second += ZIP_COORDS(cbs, Ind) * ZIP_STRIDE2(cbs, Ind);
		return offset;
	}

	template<size_t Rank, size_t rankIndex = 0, bool Last_Index_Faster = true>
	FORCEINLINE
		typename std::enable_if<(Rank - 1 != rankIndex), zip_size_t>::type
		init_coords(ZipCoordsState<Rank - 1>& cbs, const Nd4jLong index, const Nd4jLong* bases, const Nd4jLong* x_strides, const Nd4jLong* z_strides, zip_size_t offset = {}) {
		constexpr size_t Ind = StridesOrderInd<Rank, rankIndex, Last_Index_Faster>();
		ZIP_COORDS(cbs, Ind) = index % bases[Ind];
		ZIP_LAST_NUM(cbs, Ind) = bases[Ind] - 1;
		ZIP_STRIDE1(cbs, Ind) = x_strides[Ind];
		ZIP_STRIDE2(cbs, Ind) = z_strides[Ind];
		ZIP_OF_ADJUST1(cbs, Ind) = ZIP_LAST_NUM(cbs, Ind) * ZIP_STRIDE1(cbs, Ind);
		ZIP_OF_ADJUST2(cbs, Ind) = ZIP_LAST_NUM(cbs, Ind) * ZIP_STRIDE2(cbs, Ind);
		offset.first += ZIP_COORDS(cbs, Ind) * ZIP_STRIDE1(cbs, Ind);
		offset.second += ZIP_COORDS(cbs, Ind) * ZIP_STRIDE2(cbs, Ind);
		return init_coords<Rank, rankIndex + 1, Last_Index_Faster>(cbs, index / bases[Ind], bases, x_strides, z_strides, offset);
	}

	//inc coords for non constant Ranks
	template<bool Last_Index_Faster = true>
	FORCEINLINE size_t inc_coords(const Nd4jLong* bases, const Nd4jLong* strides, Nd4jLong* coords, size_t last_offset, const size_t rank, const size_t skip = 0) {

		Nd4jLong  val;
		for (int i = rank - skip - 1; i >= 0; i--) {
			val = coords[i] + 1;
			if (likely(val < bases[i])) {
				coords[i] = val;
				last_offset += strides[i];
				break;
			}
			else {
				last_offset -= coords[i] * strides[i];
				coords[i] = 0;
			}
		}
		return last_offset;
	}

	template<>
	FORCEINLINE size_t inc_coords<false>(const Nd4jLong* bases, const Nd4jLong* strides, Nd4jLong* coords, size_t last_offset, const size_t rank, const size_t skip) {

		Nd4jLong  val;
		for (int i = skip; i < rank; i++) {
			val = coords[i] + 1;
			if (likely(val < bases[i])) {
				coords[i] = val;
				last_offset += strides[i];
				break;
			}
			else {
				last_offset -= coords[i] * strides[i];
				coords[i] = 0;
			}
		}
		return last_offset;
	}

	template<bool Last_Index_Faster = true>
	FORCEINLINE zip_size_t inc_coords(const Nd4jLong* bases, const Nd4jLong* x_strides, const  Nd4jLong* z_strides, Nd4jLong* coords, zip_size_t last_offset, const size_t rank, const size_t skip = 0) {

		Nd4jLong  val = 0;
		for (int i = rank - skip - 1; i >= 0; i--) {
			val = coords[i] + 1;
			if (likely(val < bases[i])) {
				coords[i] = val;
				last_offset.first += x_strides[i];
				last_offset.second += z_strides[i];
				break;
			}
			else {
				last_offset.first -= coords[i] * x_strides[i];
				last_offset.second -= coords[i] * z_strides[i];
				coords[i] = 0;
			}
		}
		return last_offset;
	}

	template<>
	FORCEINLINE zip_size_t inc_coords<false>(const Nd4jLong* bases, const Nd4jLong* x_strides, const  Nd4jLong* z_strides, Nd4jLong* coords, zip_size_t last_offset, const size_t rank, const size_t skip) {

		Nd4jLong  val = 0;
		for (int i = skip; i < rank; i++) {
			val = coords[i] + 1;
			if (likely(val < bases[i])) {
				coords[i] = val;

				last_offset.first += x_strides[i];
				last_offset.second += z_strides[i];
				break;
			}
			else {
				last_offset.first -= coords[i] * x_strides[i];
				last_offset.second -= coords[i] * z_strides[i];
				coords[i] = 0;
			}
		}
		return last_offset;
	}

}

#endif


text:
<?php

use Phinx\Migration\AbstractMigration;

class RenameInconsistentConstraints extends AbstractMigration {
  public function up():void {
    $this->runAll();
  }

  public function down():void {
    $this->runAll();
  }

  // Helper methods

  private function runAll():void {
    $this->renameConstraint('show_votes', 'episode_votes_user_id_fkey', 'show_votes_user_id_fkey');
    $this->renameIndex('episode_votes_user_id', 'show_votes_user_id');

    $this->renameConstraint('show', 'episodes_posted_by_fkey', 'show_posted_by_fkey');
    $this->renameIndex('episodes_posted_by', 'show_posted_by');

    $this->renameIndex('global_settings_pkey', 'settings_pkey');

    $this->renameConstraint('previous_usernames', 'log__da_namechange_user_id_fkey', 'previous_usernames_user_id_fkey');
    $this->renameIndex('log__da_namechange_pkey', 'previous_usernames_pkey');
    $this->renameIndex('log__da_namechange_user_id', 'previous_usernames_user_id');

    $this->renameIndex('log__major_changes_pkey', 'major_changes_pkey');
    $this->renameIndex('log__major_changes_appearance_id', 'major_changes_appearance_id');

    $this->renameConstraint('logs', 'log_initiator_fkey', 'logs_initiator_fkey');
    $this->renameIndex('log_pkey', 'logs_pkey');
    $this->renameIndex('log_initiator', 'logs_initiator');

    $this->renameConstraint('locked_posts', 'log__post_lock_user_id_fkey', 'locked_posts_user_id_fkey');
    $this->renameIndex('log__post_lock_pkey', 'locked_posts_pkey');

    $this->renameIndex('log__failed_auth_attempts_pkey', 'failed_auth_attempts_pkey');

    $this->renameIndex('log__post_break_pkey', 'broken_posts_pkey');
  }

  private function renameConstraint(string $table, string $old_name, string $new_name):void {
    if (!$this->isMigratingUp)
      [$old_name, $new_name] = [$new_name, $old_name];
    $this->query("ALTER TABLE $table RENAME CONSTRAINT $old_name TO $new_name");
  }

  private function renameIndex(string $old_name, string $new_name):void {
    if (!$this->isMigratingUp)
      [$old_name, $new_name] = [$new_name, $old_name];
    $this->query("ALTER INDEX $old_name RENAME TO $new_name");
  }
}


text:
import re

def platform_mapped(func):
    r"""Decorates functions for lookups within a config.platform_map dictionary.

    The first level key is mapped to the func.__name__ of the decorated function.
    Regular expressions are used on the second level key, values.
    Note that there is no guaranteed order within the dictionary evaluation. Only the first matching
    regular expression is being used.
    For example:

    config.platform_map = {
        "os": {
            r"Scientific Linux-(.*)": r"Scientific-\1",    # Scientific Linux-x.x -> Scientific-x.x
            r"Ubuntu-14.\d": r"Ubuntu-14",                 # Any Ubuntu-14.x      -> Ubuntu-14
        },
        "arch": {
            "x86_64": "64bit",                             # Maps both x86_64 and amd64 -> 64bit (don't)
            "amd64": "64bit",
        },
    }
    """
    def inner(*args, **kwargs):

        # Since platform is being used within config lazy import config to prevent
        # circular dependencies
        from rez.config import config

        # Original result
        result = func(*args, **kwargs)

        # The function name is used as primary key
        entry = config.platform_map.get(func.__name__)
        if entry:
            for key, value in entry.items():
                result, changes = re.subn(key, value, result)
                if changes > 0:
                    break

        return result
    return inner


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace NorMan
{
    /// <summary>
    /// Interaction logic for ConnectionDialog.xaml
    /// </summary>
    public partial class ConnectionDialog : Window
    {
        public ConnectionDialog()
        {
            InitializeComponent();
        }

        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {

        }
    }
}


text:
/* **************
	v1.0.0, jleach 2015-02

	To be loaded by the VBA project after the original DOM is initialized
	Provides base means for Access/VBA to interact with the JS
	To help alleviate VBA string quote management, only single quotes are used in this script

	ERRORS:
		10: jQuery not present in host page

*****************/

function browseEmbedBridge() {

}

browseEmbedBridge.prototype = {

	initFramework: function() {

		try {
			createEventBridgeElement();
			initJQuery();
		} catch (err) {
			alert(err.message);
		}

		function initJQuery() {
			// for now, I know the test embed has jquery so I'll just use that
			// after the initial tests are set up I'll revisit to dynamically load, etc
			if (typeof jQuery != 'undefined') {
				bemb_$ = jQuery;
			} else {
				throw new bembException(10, "jQuery not present, current version requires jQuery in the hosted page");
			}
		}

		function createEventBridgeElement() {
			// add an element to the DOM that we'll subscribe to for events
			var elem = document.createElement('button');
			elem.setAttribute('id', 'bemb-event-element');
			elem.setAttribute('style', 'display: none;');
			document.body.appendChild(elem);
			this.bridgeElement = elem;
		}

	},

	/////////////////////////////////////
	//
	//	runCode (callString, postFunc)
	//
	//		arg examples:
	//			callString: function() { return addValues(1, 5); }
	//			postFunc:	function() { bembData += 6 }
	//
	//		example VBA call (internal version):
	//			.Exec "mvbj.runCode(function() { return addValues(1, 5)}, function() { return mvbjData += 6; });"
	//
	//		example VBA call (dev interface version):
	//			.RunCode("addValues(1, 5);", "mvbjData += 6;")
	//
	//		example return: 12
	//
	//	Run some function the user provides and stuff the value into bembData
	//	optionally, run a postFunc where they can manipulate that data after
	//  the JS fills it (this is useful for turning JS data into readable VBA data
	//  without having to alter the core function(s) at all)
	//
	/////////////////////////////////////
	runCode: function(callString, postFunc) {

		// run the function they provided, pass the result to the global data var
		bembData = callString();

		// if they gave us a function to run, do it...
		if (typeof postFunc != 'undefined') {
			postFunc();
		}

	},

	// links an event on jquery selected elements... callback to bemb_eventListener
	// func is an optional function passed by the VBA that will modify the mvbjData after the
	// event places its info... useful for coercing complex JS data into readable VB strings
	// (see mvbj.runCode() for a similar example)
	addEventListener: function(elementSelector, eventName, eventID, func) {
		var el = bemb_$(elementSelector);
		el.on(eventName, function(event) {bemb_eventListener(eventID, event, func);});
	},

	jQueryNativeVersion: '',
	bridgeElement: null

}

var bemb = new browseEmbedBridge();	// what we'll call upon to interact with our VBA project
var bembData;						// for transferring data to VBA
var bembRaisedEventID;				// don't want to group the event ID with the event object to transfer, we'll hold this separate
var bembEvent;						// we'll stuff the stringified event data into bembData, but maintain an actual object here...
var bemb_$;							// our very own jQuery... doesn't seem to like being defined in the prototype...

function bembException(number, message) {
	this.message = message;
	this.number = number;
}

// doesn't seem to like being defined in the prototype...
function bemb_eventListener(eventID, event, func) {

	bembRaisedEventID = eventID;

	// this JSON gets mangled somehow, and I believe it's by the charting library
	// it's problematic... should see about parameterizing the json conversion so it's only used when needed
	// or maybe some error handling...
	//bembData = JSON.stringify(event);

	bembEvent = event;
	bembData = event;	// store the event object by default, which they can then use the optional func to translate

	// if they gave us a function to run, do it...
	if (typeof func != 'undefined') {
		func();
	}

	// raise an event on the event bridge so it's received by the subscribing VBA project
	// if the VBA listening method doesn't provide error handling, errors will be propped here
	try {
		this.bridgeElement.onclick();
	} catch (err) {
		alert(err.message);
	}

}


text:
package org.codehaus.plexus.archiver.snappy;

import org.codehaus.plexus.components.io.attributes.Java7FileAttributes;
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
import org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
import org.codehaus.plexus.util.IOUtil;

import javax.annotation.Nonnull;
import javax.annotation.WillNotClose;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;

/**
 * Implementation of {@link org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection} for
 * snappy compressed files.
 */
public class PlexusIoSnappyResourceCollection
    extends PlexusIoCompressedFileResourceCollection
{
    @Nonnull
    protected @WillNotClose InputStream getInputStream( File file )
        throws IOException
    {
        InputStream fis = new FileInputStream( file );
        try
        {
            final InputStream result = SnappyUnArchiver.getSnappyInputStream( fis );
			fis = null;
            return result;
        }
        finally
        {
            IOUtil.close( fis );
        }
    }

	@Override protected PlexusIoResourceAttributes getAttributes(File file) throws IOException {
        return new Java7FileAttributes(file, new HashMap<Integer, String>(), new HashMap<Integer, String>());
	}

	protected String getDefaultExtension()
    {
        return ".snappy";
    }
}