text:
package com.microsoft.azure.management.containerservice.v2020_07_01;

import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.microsoft.rest.ExpandableStringEnum;

/**
 * Defines values for OpenShiftContainerServiceVMSize.
 */
public final class OpenShiftContainerServiceVMSize extends ExpandableStringEnum<OpenShiftContainerServiceVMSize> {
    /** Static value Standard_D2s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_D2S_V3 = fromString("Standard_D2s_v3");

    /** Static value Standard_D4s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_D4S_V3 = fromString("Standard_D4s_v3");

    /** Static value Standard_D8s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_D8S_V3 = fromString("Standard_D8s_v3");

    /** Static value Standard_D16s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_D16S_V3 = fromString("Standard_D16s_v3");

    /** Static value Standard_D32s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_D32S_V3 = fromString("Standard_D32s_v3");

    /** Static value Standard_D64s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_D64S_V3 = fromString("Standard_D64s_v3");

    /** Static value Standard_DS4_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_DS4_V2 = fromString("Standard_DS4_v2");

    /** Static value Standard_DS5_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_DS5_V2 = fromString("Standard_DS5_v2");

    /** Static value Standard_F8s_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_F8S_V2 = fromString("Standard_F8s_v2");

    /** Static value Standard_F16s_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_F16S_V2 = fromString("Standard_F16s_v2");

    /** Static value Standard_F32s_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_F32S_V2 = fromString("Standard_F32s_v2");

    /** Static value Standard_F64s_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_F64S_V2 = fromString("Standard_F64s_v2");

    /** Static value Standard_F72s_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_F72S_V2 = fromString("Standard_F72s_v2");

    /** Static value Standard_F8s for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_F8S = fromString("Standard_F8s");

    /** Static value Standard_F16s for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_F16S = fromString("Standard_F16s");

    /** Static value Standard_E4s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_E4S_V3 = fromString("Standard_E4s_v3");

    /** Static value Standard_E8s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_E8S_V3 = fromString("Standard_E8s_v3");

    /** Static value Standard_E16s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_E16S_V3 = fromString("Standard_E16s_v3");

    /** Static value Standard_E20s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_E20S_V3 = fromString("Standard_E20s_v3");

    /** Static value Standard_E32s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_E32S_V3 = fromString("Standard_E32s_v3");

    /** Static value Standard_E64s_v3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_E64S_V3 = fromString("Standard_E64s_v3");

    /** Static value Standard_GS2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_GS2 = fromString("Standard_GS2");

    /** Static value Standard_GS3 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_GS3 = fromString("Standard_GS3");

    /** Static value Standard_GS4 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_GS4 = fromString("Standard_GS4");

    /** Static value Standard_GS5 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_GS5 = fromString("Standard_GS5");

    /** Static value Standard_DS12_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_DS12_V2 = fromString("Standard_DS12_v2");

    /** Static value Standard_DS13_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_DS13_V2 = fromString("Standard_DS13_v2");

    /** Static value Standard_DS14_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_DS14_V2 = fromString("Standard_DS14_v2");

    /** Static value Standard_DS15_v2 for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_DS15_V2 = fromString("Standard_DS15_v2");

    /** Static value Standard_L4s for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_L4S = fromString("Standard_L4s");

    /** Static value Standard_L8s for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_L8S = fromString("Standard_L8s");

    /** Static value Standard_L16s for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_L16S = fromString("Standard_L16s");

    /** Static value Standard_L32s for OpenShiftContainerServiceVMSize. */
    public static final OpenShiftContainerServiceVMSize STANDARD_L32S = fromString("Standard_L32s");

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

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


text:
#include <limits>
#include <cstdio>

#include "Engine/Engine.hpp"
#include "Debug/Debug.hpp"

#include "System/Time.hpp"
#include "Debug/DebugVectorRenderer.hpp"

DebugGraph::DebugGraph(Allocator* allocator, DebugVectorRenderer* vr) :
	vectorRenderer(vr),
	data(allocator),
	pointStorage(allocator),
	timeRange(5.0)
{
}

DebugGraph::~DebugGraph()
{
}

void DebugGraph::Update()
{
	double timeNow = Time::GetRunningTime();
	double cutoff = timeNow - this->timeRange;

	while (data.GetCount() > 0 && data.Peek().time < cutoff)
	{
		data.Pop();
	}
}

void DebugGraph::DrawToVectorRenderer()
{
	size_t count = data.GetCount();

	// Find range
	double min = std::numeric_limits<double>::max();
	double max = std::numeric_limits<double>::min();
	for (size_t i = 0; i < count; ++i)
	{
		double value = data.At(i).data;
		if (value < min) min = value;
		if (value > max) max = value;
	}

	double diff = max - min;
	double rangeMin = min - diff * 0.1;
	double rangeMax = max + diff * 0.1;
	double rangeSize = rangeMax - rangeMin;

	double timeNow = Time::GetRunningTime();
	double cutoff = timeNow - timeRange;

	Color color(1.0f, 1.0f, 1.0f);

	if (cutoff < 0.0) cutoff = 0.0;

	if (count >= 2) // Can't draw unless there's at least 2 data points
	{
		pointStorage.Resize(count);

		for (size_t i = 0, count = data.GetCount(); i < count; ++i)
		{
			DataPoint& dataPoint = data.At(i);
			double y = (dataPoint.data - rangeMin) / rangeSize;
			double x = (dataPoint.time - cutoff) / this->timeRange;

			Vec3f pos;
			pos.x = drawArea.position.x + static_cast<float>(x) * drawArea.size.x;
			pos.y = drawArea.position.y + drawArea.size.y - (static_cast<float>(y) * drawArea.size.y);
			pos.z = 0.0f;

			pointStorage[i] = pos;
		}

		vectorRenderer->DrawLineChainScreen(count, pointStorage.GetData(), color);
	}
}

void DebugGraph::AddDataPoint(double value)
{
	DataPoint& dataPoint = data.Push();
	dataPoint.data = value;
	dataPoint.time = Time::GetRunningTime();
}

double DebugGraph::GetAverageOverLastSeconds(double seconds)
{
	if (data.GetCount() > 0)
	{
		double lastTime = data.At(data.GetCount() - 1).time - seconds;

		double total = 0.0;
		int framesAdded = 0;

		for (size_t end = data.GetCount(); end > 0; --end)
		{
			const DataPoint point = data.At(end - 1);

			if (point.time > lastTime)
			{
				total += point.data;
				++framesAdded;
			}
			else
				break;
		}

		return total / framesAdded;
	}
	else
		return 0.0;
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta content="width=device-width" name="viewport">
    <meta content="A simple color picker application written in pure JavaScript, for modern browsers." name="description">
    <title>Color Picker</title>
    <link href="../index.min.css" rel="stylesheet">

<input type="color" value="#bada55">


text:
'use strict';

var
  chai = require('chai'),
  Bluebird = require('bluebird'),
  job = require('./../../../../../lib/platforms/saucelabs/job'),
  Job = job.Job,
  utils = require('./utils')

var chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
var
  expect = chai.expect,
  should = chai.should()

if(process.version > 'v6') {

  describe('Job', function() {

    describe('create', function() {

      var job
      this.timeout(0)

      it('should fail to create a test job with invalid browser info provided', function() {
        expect(()=>{Job.create('http://piaxis.tech', {
          os: 'Windows',
          osVersion: '10',
          browser: 'Chrome',
          browserVersion: '1.0'
        })})
        .to.throw('invalid version "1.0" for browser "Chrome" for osVersion "10" for os "Windows"')
      })

      it('should fail to create a test job if unsupported os is provided', function() {
        expect(()=>{ Job.create('http://google.com', {
          os: 'OS X ABC',
          osVersion: 'ABC',
          browser: 'chrome',
          browserVersion: '43.0'
        })})
        .to.throw('invalid os "OS X ABC"')
      })

      it('should fail to create a test job if unsupported browser is provided', function() {
        expect(()=>{ Job.create('http://piaxis.tech', {
          os: 'Windows',
          osVersion: '10',
          browser: 'ABC',
          browserVersion: '40.0'
        })})
        .to.throw('invalid browser "ABC" for osVersion "10" for os "Windows"')
      })

      it('should fail to create a test job if unsupported browser version is provided', function() {
        expect(()=>{ Job.create('http://www.piaxis.tech', {
          os: 'Windows',
          osVersion: '10',
          browser: 'Chrome',
          browserVersion: '1.0'
        })})
        .to.throw('invalid version "1.0" for browser "Chrome" for osVersion "10" for os "Windows"')
      })

      it('should create a test job if a remote url and valid values for all mandatory parameters are provided', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech',{
          os: 'OS X',
          osVersion: 'El Capitan',
          browser: 'Chrome',
          browserVersion: '41.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(job => {
          expect(job.id).to.not.be.undefined
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should create a test job if a remote url and valid values for all mandatory parameters are provided with browser being an android emulator', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech',{
          os: 'Android',
          osVersion: '4.4',
          browser: 'Android Browser',
          browserVersion: null,
          device: "Samsung Galaxy Nexus Emulator"
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(job => {
          expect(job.id).to.not.be.undefined
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should create a test job if a remote url and valid values for all mandatory parameters are provided with browser being an iphone simulator', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech',{
          os: 'iOS',
          osVersion: '10.3',
          browser: 'Mobile Safari',
          browserVersion: null,
          device: "iPhone 6s Plus Simulator"
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(job => {
          expect(job.id).to.not.be.undefined
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should create a test job if a local url and valid values for all mandatory parameters are provided', function() {
        var build = utils.buildDetails()
        return Job.create('http://build.cross-browser-tests-runner.org:3000/tests/pages/tests.html', {
          os: 'Windows',
          osVersion: '8.1',
          browser: 'Firefox',
          browserVersion: '38.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(job => {
          expect(job.id).to.not.be.undefined
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should create a test job if a local url, valid values for all mandatory parameters, and few optional capabilities are provided', function() {
        var build = utils.buildDetails()
        return Job.create('http://build.cross-browser-tests-runner.org:3000/tests/pages/tests.html', {
          os: 'OS X',
          osVersion: 'Yosemite',
          browser: 'Chrome',
          browserVersion: '41.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test,
          video: true,
          screenshots: false,
          captureLogs: false,
          captureHtml: true,
          priority: 0
        })
        .then(job => {
          expect(job.id).to.not.be.undefined
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should create a test job for native runner case if a local url and valid values for all mandatory parameters are provided', function() {
        var build = utils.buildDetails()
        return Job.create('http://build.cross-browser-tests-runner.org:3000/tests/pages/tests.html', {
          os: 'OS X',
          osVersion: 'Yosemite',
          browser: 'Firefox',
          browserVersion: '42.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        },
        'some-run-id',
        true)
        .then(job => {
          expect(job.id).to.not.be.undefined
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

    describe('createMultiple', function() {

      this.timeout(0)

      it('should fail to create test jobs if no browsers are provided', function() {
        expect(()=>{Job.createMultiple('http://google.com', [ ])}).to.throw('no browsers specified for createMultiple')
      })

      it('should throw an error if required keys are not provided', function() {
        expect(()=>{return Job.createMultiple('http://google.com', [
          undefined
        ])})
        .to.throw('required option browser missing')
      })

      it('should tolerate failure of creating a job and ensure the others get created', function() {
        var build = utils.buildDetails()
        return Job.createMultiple('http://www.piaxis.tech', [{
          os: 'Android',
          osVersion: '7.0',
          browser: 'Android Browser',
          browserVersion: null,
          device: 'Android GoogleAPI Emulator'
        }, {
          os: 'Windows',
          osVersion: '8.1',
          browser: 'Firefox',
          browserVersion: '41.0'
        }], {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(jobs => {
          expect(jobs.length).to.equal(2)
          expect(jobs[0].id).to.be.undefined
          expect(jobs[1].id).to.not.be.undefined
          return utils.safeKillJob(jobs[1])
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should create test jobs if a remote url and valid values for all mandatory parameters are provided', function() {
        var build = utils.buildDetails()
        return Job.createMultiple('http://www.piaxis.tech', [{
          os: 'OS X',
          osVersion: 'Yosemite',
          browser: 'Chrome',
          browserVersion: '45.0'
        }, {
          os: 'Windows',
          osVersion: '7',
          browser: 'Firefox',
          browserVersion: '37.0'
        }], {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(jobs => {
          expect(jobs.length).to.equal(2)
          expect(jobs[0].id).to.not.be.undefined
          expect(jobs[1].id).to.not.be.undefined
          let promises = [ utils.safeKillJob(jobs[0]), utils.safeKillJob(jobs[1]) ]
          return Bluebird.all(promises)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should create test jobs if a local url and valid values for all mandatory parameters are provided', function() {
        var build = utils.buildDetails()
        return Job.createMultiple('http://build.cross-browser-tests-runner.org:3000/tests/pages/tests.html', [{
          os: 'OS X',
          osVersion: 'El Capitan',
          browser: 'Firefox',
          browserVersion: '41.0'
        }, {
          os: 'Windows',
          osVersion: '8.1',
          browser: 'Chrome',
          browserVersion: '37.0'
        }], {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(jobs => {
          expect(jobs.length).to.equal(2)
          expect(jobs[0].id).to.not.be.undefined
          expect(jobs[1].id).to.not.be.undefined
          let promises = [ utils.safeKillJob(jobs[0]), utils.safeKillJob(jobs[1]) ]
          return Bluebird.all(promises)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

    describe('status', function() {

      var job
      this.timeout(0)

      it('should say "running" for a running test job', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech', {
          os: 'Windows',
          osVersion: '7',
          browser: 'Chrome',
          browserVersion: '35.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(j => {
          job = j
          return job.status()
        })
        .then(status => {
          if('stopped' === status) {
            utils.log.info('did not expect the job to get done so soon')
          }
          else {
            expect(status).to.be.oneOf(['running', 'queue'])
          }
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should say "stopped" for a stopped test job', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech', {
          os: 'Windows',
          osVersion: '7',
          browser: 'Chrome',
          browserVersion: '35.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(j => {
          job = j
          return utils.safeKillJob(job)
        })
        .then(() => {
          return job.status()
        })
        .then(status => {
          expect(status).to.equal('stopped')
          return true
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should say "stopped" for a test job with an invalid id', function() {
        var build = utils.buildDetails(), saveId, saveJsTestId
        return Job.create('http://www.piaxis.tech', {
          os: 'Windows',
          osVersion: '10',
          browser: 'Firefox',
          browserVersion: '43.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(j => {
          job = j
          saveId = job.scriptJob.session
          job.scriptJob.session = 'XXXXXXXX'
          return job.status()
        })
        .then(status => {
          expect(status).to.equal('stopped')
          job.scriptJob.session = saveId
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

    describe('stop', function() {

      var job
      this.timeout(0)

      it('should successfully stop a running test job and set passed status', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech', {
          os: 'OS X',
          osVersion: 'El Capitan',
          browser: 'Chrome',
          browserVersion: '47.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(job => {
          return job.stop(true)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should successfully stop a test job running on android emulator and marked failed status', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech', {
          os: 'Android',
          osVersion: '4.4',
          browser: 'Android Browser',
          browserVersion: null,
          device: "Samsung Galaxy Nexus Emulator"
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(job => {
          return job.stop(false)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should silently complete if called for an already stopped test job', function() {
        var build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech', {
          os: 'OS X',
          osVersion: 'Sierra',
          browser: 'Firefox',
          browserVersion: '48.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(j => {
          job = j
          return job.stop(true)
        })
        .then(() => {
          return job.stop(true)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

    describe('screenshot', function() {

      this.timeout(0)

      it('should silently return without performing any operations', function() {
        var job, build = utils.buildDetails()
        return Job.create('http://www.piaxis.tech', {
          os: 'OS X',
          osVersion: 'Mavericks',
          browser: 'Chrome',
          browserVersion: '35.0'
        }, {
          build: build.build,
          project: build.project,
          test: build.test
        })
        .then(j => {
          job = j
          return job.screenshot()
        })
        .then(() => {
          return utils.safeKillJob(job)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

  })

}


text:
package openstack

import (
	"bytes"
	"fmt"
	"log"
	"strings"

	"github.com/gophercloud/gophercloud"
	"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/secgroups"
	"github.com/hashicorp/terraform/helper/hashcode"
	"github.com/hashicorp/terraform/helper/resource"
	"github.com/hashicorp/terraform/helper/schema"
)

func computeSecGroupV2RulesCheckForErrors(d *schema.ResourceData) error {
	rawRules := d.Get("rule").(*schema.Set).List()

	for _, rawRule := range rawRules {
		rawRuleMap := rawRule.(map[string]interface{})

		// only one of cidr, from_group_id, or self can be set
		cidr := rawRuleMap["cidr"].(string)
		groupId := rawRuleMap["from_group_id"].(string)
		self := rawRuleMap["self"].(bool)
		errorMessage := fmt.Errorf("Only one of cidr, from_group_id, or self can be set.")

		// if cidr is set, from_group_id and self cannot be set
		if cidr != "" {
			if groupId != "" || self {
				return errorMessage
			}
		}

		// if from_group_id is set, cidr and self cannot be set
		if groupId != "" {
			if cidr != "" || self {
				return errorMessage
			}
		}

		// if self is set, cidr and from_group_id cannot be set
		if self {
			if cidr != "" || groupId != "" {
				return errorMessage
			}
		}
	}

	return nil
}

func expandComputeSecGroupV2CreateRules(d *schema.ResourceData) []secgroups.CreateRuleOpts {
	rawRules := d.Get("rule").(*schema.Set).List()
	createRuleOptsList := make([]secgroups.CreateRuleOpts, len(rawRules))

	for i, rawRule := range rawRules {
		createRuleOptsList[i] = expandComputeSecGroupV2CreateRule(d, rawRule)
	}

	return createRuleOptsList
}

func expandComputeSecGroupV2CreateRule(d *schema.ResourceData, rawRule interface{}) secgroups.CreateRuleOpts {
	rawRuleMap := rawRule.(map[string]interface{})
	groupId := rawRuleMap["from_group_id"].(string)
	if rawRuleMap["self"].(bool) {
		groupId = d.Id()
	}
	return secgroups.CreateRuleOpts{
		ParentGroupID: d.Id(),
		FromPort:      rawRuleMap["from_port"].(int),
		ToPort:        rawRuleMap["to_port"].(int),
		IPProtocol:    rawRuleMap["ip_protocol"].(string),
		CIDR:          rawRuleMap["cidr"].(string),
		FromGroupID:   groupId,
	}
}

func expandComputeSecGroupV2Rule(d *schema.ResourceData, rawRule interface{}) secgroups.Rule {
	rawRuleMap := rawRule.(map[string]interface{})
	return secgroups.Rule{
		ID:            rawRuleMap["id"].(string),
		ParentGroupID: d.Id(),
		FromPort:      rawRuleMap["from_port"].(int),
		ToPort:        rawRuleMap["to_port"].(int),
		IPProtocol:    rawRuleMap["ip_protocol"].(string),
		IPRange:       secgroups.IPRange{CIDR: rawRuleMap["cidr"].(string)},
	}
}

func flattenComputeSecGroupV2Rules(computeClient *gophercloud.ServiceClient, d *schema.ResourceData, sgrs []secgroups.Rule) ([]map[string]interface{}, error) {
	sgrMap := make([]map[string]interface{}, len(sgrs))
	for i, sgr := range sgrs {
		groupId := ""
		self := false
		if sgr.Group.Name != "" {
			if sgr.Group.Name == d.Get("name").(string) {
				self = true
			} else {
				// Since Nova only returns the secgroup Name (and not the ID) for the group attribute,
				// we need to look up all security groups and match the name.
				// Nevermind that Nova wants the ID when setting the Group *and* that multiple groups
				// with the same name can exist...
				allPages, err := secgroups.List(computeClient).AllPages()
				if err != nil {
					return nil, err
				}
				securityGroups, err := secgroups.ExtractSecurityGroups(allPages)
				if err != nil {
					return nil, err
				}

				for _, sg := range securityGroups {
					if sg.Name == sgr.Group.Name {
						groupId = sg.ID
					}
				}
			}
		}

		sgrMap[i] = map[string]interface{}{
			"id":            sgr.ID,
			"from_port":     sgr.FromPort,
			"to_port":       sgr.ToPort,
			"ip_protocol":   sgr.IPProtocol,
			"cidr":          sgr.IPRange.CIDR,
			"self":          self,
			"from_group_id": groupId,
		}
	}
	return sgrMap, nil
}

func computeSecGroupV2RuleHash(v interface{}) int {
	var buf bytes.Buffer
	m := v.(map[string]interface{})
	buf.WriteString(fmt.Sprintf("%d-", m["from_port"].(int)))
	buf.WriteString(fmt.Sprintf("%d-", m["to_port"].(int)))
	buf.WriteString(fmt.Sprintf("%s-", m["ip_protocol"].(string)))
	buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(m["cidr"].(string))))
	buf.WriteString(fmt.Sprintf("%s-", m["from_group_id"].(string)))
	buf.WriteString(fmt.Sprintf("%t-", m["self"].(bool)))

	return hashcode.String(buf.String())
}

func computeSecGroupV2StateRefreshFunc(computeClient *gophercloud.ServiceClient, d *schema.ResourceData) resource.StateRefreshFunc {
	return func() (interface{}, string, error) {
		log.Printf("[DEBUG] Attempting to delete openstack_compute_secgroup_v2 %s", d.Id())

		err := secgroups.Delete(computeClient, d.Id()).ExtractErr()
		if err != nil {
			return nil, "", err
		}

		s, err := secgroups.Get(computeClient, d.Id()).Extract()
		if err != nil {
			err = CheckDeleted(d, err, "Error retrieving openstack_compute_secgroup_v2")
			if err != nil {
				return s, "", err
			}

			log.Printf("[DEBUG] Successfully deleted openstack_compute_secgroup_v2 %s", d.Id())
			return s, "DELETED", nil
		}

		log.Printf("[DEBUG] openstack_compute_secgroup_v2 %s still active", d.Id())
		return s, "ACTIVE", nil
	}
}


text:
package fr.alma.pagerank.job1;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.Reporter;

public class LinkPageReducer extends MapReduceBase implements Reducer<Text, Text, Text, Text> {

	@Override
	public void reduce(Text key, Iterator<Text> values, OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
		 String pagerank = "1.0\t";

	        boolean first = true;
	        while(values.hasNext()){
	            if(!first) pagerank += ",";

	            pagerank += values.next().toString();
	            first = false;
	        }

	        output.collect(key, new Text(pagerank));
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!DOCTYPE Test SYSTEM "test.dtd">
<!--
Author:  Alexander D. Shipilov
Version: $Revision: 1.4 $
-->
<Test
  ID="putfield0301"
  date-of-creation="2004-11-26"
  timeout="1"
  >
  <Author value="Alexander D. Shipilov"/>
  <Description>
    Tests putfield java virtual machine instruction.
    Class implements super class. In super class exist field testField.
    Put 104 to the this.field. Get value from the field. Return it.
  Covered assertions assert_instr211a021 assert_instr211a022 assert_instr211a020 assert_instr211a024 assert_instr211a025 assert_instr211a023 assert_class691
  </Description>

  <Source name="putfield0301p.j"/>

  <Runner ID="Runtime">
    <Param name="toRun" value="org.apache.harmony.vts.test.vm.jvms.instructions.reftypes.putfield.putfield03.putfield0301.putfield0301p"/>
  </Runner>
</Test>


text:
/**
 * @class Basic
 * @classdesc Authentication provider for HTTP basic auth.
 *            Unfortunately, this provider probably won't work in most browsers
 *            because of their security considerations.
 * @memberof HaveAPI.Client.Authentication
 */
Authentication.Basic = function(client, opts, description) {
	this.client = client;
	this.opts = opts;
};
Authentication.Basic.prototype = new Authentication.Base();

/**
 * @method HaveAPI.Client.Authentication.Basic#setup
 * @param {HaveAPI.Client~doneCallback} callback
 */
Authentication.Basic.prototype.setup = function(callback) {
	if(callback !== undefined)
		callback(this.client, true);
};

/**
 * Returns an object with keys 'user' and 'password' that are used
 * for HTTP basic auth.
 * @method HaveAPI.Client.Authentication.Basic#credentials
 * @return {Object} credentials
 */
Authentication.Basic.prototype.credentials = function() {
	return this.opts;
};


text:
package org.docksidestage.dbflute.bsentity;

import java.util.List;
import java.util.ArrayList;

import org.dbflute.dbmeta.DBMeta;
import org.dbflute.dbmeta.AbstractEntity;
import org.dbflute.dbmeta.accessory.DomainEntity;
import org.docksidestage.dbflute.allcommon.DBMetaInstanceHandler;
import org.docksidestage.dbflute.allcommon.CDef;
import org.docksidestage.dbflute.exentity.*;

/**
 * The entity of (会員ステータス)MEMBER_STATUS as TABLE.

 * 会員のステータスを示す固定的なマスタテーブル。いわゆるテーブル区分値!

 * 業務運用上で増えることはなく、増減するときはプログラム修正ともなうレベルの業務変更と考えられる。

 *

 * こういった固定的なマスタテーブルには、更新日時などの共通カラムは定義していないが、業務上そういった情報を管理する必要性が低いという理由に加え、ExampleDBとして共通カラムでER図が埋め尽くされてしまい見づらくなるというところで割り切っている。実業務では統一的に定義することもある。
 *

 * [primary-key]
 *     MEMBER_STATUS_CODE
 *
 * [column]
 *     MEMBER_STATUS_CODE, MEMBER_STATUS_NAME, DESCRIPTION, DISPLAY_ORDER
 *
 * [sequence]
 *
 *
 * [identity]
 *
 *
 * [version-no]
 *
 *
 * [foreign table]
 *
 *
 * [referrer table]
 *     MEMBER, MEMBER_LOGIN
 *
 * [foreign property]
 *
 *
 * [referrer property]
 *     memberList, memberLoginList
 *
 * [get/set template]
 * /= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 * String memberStatusCode = entity.getMemberStatusCode();
 * String memberStatusName = entity.getMemberStatusName();
 * String description = entity.getDescription();
 * Integer displayOrder = entity.getDisplayOrder();
 * entity.setMemberStatusCode(memberStatusCode);
 * entity.setMemberStatusName(memberStatusName);
 * entity.setDescription(description);
 * entity.setDisplayOrder(displayOrder);
 * = = = = = = = = = =/
 *

 * @author DBFlute(AutoGenerator)
 */
public abstract class BsMemberStatus extends AbstractEntity implements DomainEntity {

    // ===================================================================================
    //                                                                          Definition
    //                                                                          ==========
    /** The serial version UID for object serialization. (Default) */
    private static final long serialVersionUID = 1L;

    // ===================================================================================
    //                                                                           Attribute
    //                                                                           =========
    /** (会員ステータスコード)MEMBER_STATUS_CODE: {PK, NotNull, CHAR(3), classification=MemberStatus} */
    protected String _memberStatusCode;

    /** (会員ステータス名称)MEMBER_STATUS_NAME: {NotNull, VARCHAR(50)} */
    protected String _memberStatusName;

    /** (説明)DESCRIPTION: {NotNull, VARCHAR(200)} */
    protected String _description;

    /** (表示順)DISPLAY_ORDER: {UQ, NotNull, INTEGER(10)} */
    protected Integer _displayOrder;

    // ===================================================================================
    //                                                                             DB Meta
    //                                                                             =======
    /** {@inheritDoc} */
    public DBMeta asDBMeta() {
        return DBMetaInstanceHandler.findDBMeta(asTableDbName());
    }

    /** {@inheritDoc} */
    public String asTableDbName() {
        return "MEMBER_STATUS";
    }

    // ===================================================================================
    //                                                                        Key Handling
    //                                                                        ============
    /** {@inheritDoc} */
    public boolean hasPrimaryKeyValue() {
        if (_memberStatusCode == null) { return false; }
        return true;
    }

    /**
     * To be unique by the unique column.

     * You can update the entity by the key when entity update (NOT batch update).
     * @param displayOrder (表示順): UQ, NotNull, INTEGER(10). (NotNull)
     */
    public void uniqueBy(Integer displayOrder) {
        __uniqueDrivenProperties.clear();
        __uniqueDrivenProperties.addPropertyName("displayOrder");
        setDisplayOrder(displayOrder);
    }

    // ===================================================================================
    //                                                             Classification Property
    //                                                             =======================
    /**
     * Get the value of memberStatusCode as the classification of MemberStatus.

     * (会員ステータスコード)MEMBER_STATUS_CODE: {PK, NotNull, CHAR(3), classification=MemberStatus}

     * status of member from entry to withdrawal
     *
It's treated as case insensitive and if the code value is null, it returns null.

     * @return The instance of classification definition (as ENUM type). (NullAllowed: when the column value is null)
     */
    public CDef.MemberStatus getMemberStatusCodeAsMemberStatus() {
        return CDef.MemberStatus.codeOf(getMemberStatusCode());
    }

    /**
     * Set the value of memberStatusCode as the classification of MemberStatus.

     * (会員ステータスコード)MEMBER_STATUS_CODE: {PK, NotNull, CHAR(3), classification=MemberStatus}

     * status of member from entry to withdrawal
     * @param cdef The instance of classification definition (as ENUM type). (NullAllowed: if null, null value is set to the column)
     */
    public void setMemberStatusCodeAsMemberStatus(CDef.MemberStatus cdef) {
        setMemberStatusCode(cdef != null ? cdef.code() : null);
    }

    // ===================================================================================
    //                                                              Classification Setting
    //                                                              ======================
    /**
     * Set the value of memberStatusCode as Formalized (FML).

     * Formalized: as formal member, allowed to use all service
     */
    public void setMemberStatusCode_Formalized() {
        setMemberStatusCodeAsMemberStatus(CDef.MemberStatus.Formalized);
    }

    /**
     * Set the value of memberStatusCode as Withdrawal (WDL).

     * Withdrawal: withdrawal is fixed, not allowed to use service
     */
    public void setMemberStatusCode_Withdrawal() {
        setMemberStatusCodeAsMemberStatus(CDef.MemberStatus.Withdrawal);
    }

    /**
     * Set the value of memberStatusCode as Provisional (PRV).

     * Provisional: first status after entry, allowed to use only part of service
     */
    public void setMemberStatusCode_Provisional() {
        setMemberStatusCodeAsMemberStatus(CDef.MemberStatus.Provisional);
    }

    // ===================================================================================
    //                                                        Classification Determination
    //                                                        ============================
    /**
     * Is the value of memberStatusCode Formalized?

     * Formalized: as formal member, allowed to use all service
     *
It's treated as case insensitive and if the code value is null, it returns false.

     * @return The determination, true or false.
     */
    public boolean isMemberStatusCodeFormalized() {
        CDef.MemberStatus cdef = getMemberStatusCodeAsMemberStatus();
        return cdef != null ? cdef.equals(CDef.MemberStatus.Formalized) : false;
    }

    /**
     * Is the value of memberStatusCode Withdrawal?

     * Withdrawal: withdrawal is fixed, not allowed to use service
     *
It's treated as case insensitive and if the code value is null, it returns false.

     * @return The determination, true or false.
     */
    public boolean isMemberStatusCodeWithdrawal() {
        CDef.MemberStatus cdef = getMemberStatusCodeAsMemberStatus();
        return cdef != null ? cdef.equals(CDef.MemberStatus.Withdrawal) : false;
    }

    /**
     * Is the value of memberStatusCode Provisional?

     * Provisional: first status after entry, allowed to use only part of service
     *
It's treated as case insensitive and if the code value is null, it returns false.

     * @return The determination, true or false.
     */
    public boolean isMemberStatusCodeProvisional() {
        CDef.MemberStatus cdef = getMemberStatusCodeAsMemberStatus();
        return cdef != null ? cdef.equals(CDef.MemberStatus.Provisional) : false;
    }

    /**
     * means member that can use services

     * The group elements:[Formalized, Provisional]
     * @return The determination, true or false.
     */
    public boolean isMemberStatusCode_ServiceAvailable() {
        CDef.MemberStatus cdef = getMemberStatusCodeAsMemberStatus();
        return cdef != null && cdef.isServiceAvailable();
    }

    /**
     * Members are not formalized yet

     * The group elements:[Provisional]
     * @return The determination, true or false.
     */
    public boolean isMemberStatusCode_ShortOfFormalized() {
        CDef.MemberStatus cdef = getMemberStatusCodeAsMemberStatus();
        return cdef != null && cdef.isShortOfFormalized();
    }

    // ===================================================================================
    //                                                                    Foreign Property
    //                                                                    ================
    // ===================================================================================
    //                                                                   Referrer Property
    //                                                                   =================
    /** (会員)MEMBER by MEMBER_STATUS_CODE, named 'memberList'. */
    protected List<Member> _memberList;

    /**
     * [get] (会員)MEMBER by MEMBER_STATUS_CODE, named 'memberList'.
     * @return The entity list of referrer property 'memberList'. (NotNull: even if no loading, returns empty list)
     */
    public List<Member> getMemberList() {
        if (_memberList == null) { _memberList = newReferrerList(); }
        return _memberList;
    }

    /**
     * [set] (会員)MEMBER by MEMBER_STATUS_CODE, named 'memberList'.
     * @param memberList The entity list of referrer property 'memberList'. (NullAllowed)
     */
    public void setMemberList(List<Member> memberList) {
        _memberList = memberList;
    }

    /** (会員ログイン)MEMBER_LOGIN by LOGIN_MEMBER_STATUS_CODE, named 'memberLoginList'. */
    protected List<MemberLogin> _memberLoginList;

    /**
     * [get] (会員ログイン)MEMBER_LOGIN by LOGIN_MEMBER_STATUS_CODE, named 'memberLoginList'.
     * @return The entity list of referrer property 'memberLoginList'. (NotNull: even if no loading, returns empty list)
     */
    public List<MemberLogin> getMemberLoginList() {
        if (_memberLoginList == null) { _memberLoginList = newReferrerList(); }
        return _memberLoginList;
    }

    /**
     * [set] (会員ログイン)MEMBER_LOGIN by LOGIN_MEMBER_STATUS_CODE, named 'memberLoginList'.
     * @param memberLoginList The entity list of referrer property 'memberLoginList'. (NullAllowed)
     */
    public void setMemberLoginList(List<MemberLogin> memberLoginList) {
        _memberLoginList = memberLoginList;
    }

    protected <ELEMENT> List<ELEMENT> newReferrerList() { // overriding to import
        return new ArrayList<ELEMENT>();
    }

    // ===================================================================================
    //                                                                      Basic Override
    //                                                                      ==============
    @Override
    protected boolean doEquals(Object obj) {
        if (obj instanceof BsMemberStatus) {
            BsMemberStatus other = (BsMemberStatus)obj;
            if (!xSV(_memberStatusCode, other._memberStatusCode)) { return false; }
            return true;
        } else {
            return false;
        }
    }

    @Override
    protected int doHashCode(int initial) {
        int hs = initial;
        hs = xCH(hs, asTableDbName());
        hs = xCH(hs, _memberStatusCode);
        return hs;
    }

    @Override
    protected String doBuildStringWithRelation(String li) {
        StringBuilder sb = new StringBuilder();
        if (_memberList != null) { for (Member et : _memberList)
        { if (et != null) { sb.append(li).append(xbRDS(et, "memberList")); } } }
        if (_memberLoginList != null) { for (MemberLogin et : _memberLoginList)
        { if (et != null) { sb.append(li).append(xbRDS(et, "memberLoginList")); } } }
        return sb.toString();
    }

    @Override
    protected String doBuildColumnString(String dm) {
        StringBuilder sb = new StringBuilder();
        sb.append(dm).append(xfND(_memberStatusCode));
        sb.append(dm).append(xfND(_memberStatusName));
        sb.append(dm).append(xfND(_description));
        sb.append(dm).append(xfND(_displayOrder));
        if (sb.length() > dm.length()) {
            sb.delete(0, dm.length());
        }
        sb.insert(0, "{").append("}");
        return sb.toString();
    }

    @Override
    protected String doBuildRelationString(String dm) {
        StringBuilder sb = new StringBuilder();
        if (_memberList != null && !_memberList.isEmpty())
        { sb.append(dm).append("memberList"); }
        if (_memberLoginList != null && !_memberLoginList.isEmpty())
        { sb.append(dm).append("memberLoginList"); }
        if (sb.length() > dm.length()) {
            sb.delete(0, dm.length()).insert(0, "(").append(")");
        }
        return sb.toString();
    }

    @Override
    public MemberStatus clone() {
        return (MemberStatus)super.clone();
    }

    // ===================================================================================
    //                                                                            Accessor
    //                                                                            ========
    /**
     * [get] (会員ステータスコード)MEMBER_STATUS_CODE: {PK, NotNull, CHAR(3), classification=MemberStatus}

     * 会員ステータスを識別するコード。

     * 固定的なデータなので連番とか番号にはせず、データを直接見たときも人が直感的にわかるように、例えば "FML" とかの3桁のコード形式にしている。(3って何会員だっけ?とかの問答をやりたくないので)
     * @return The value of the column 'MEMBER_STATUS_CODE'. (basically NotNull if selected: for the constraint)
     */
    public String getMemberStatusCode() {
        checkSpecifiedProperty("memberStatusCode");
        return convertEmptyToNull(_memberStatusCode);
    }

    /**
     * [set] (会員ステータスコード)MEMBER_STATUS_CODE: {PK, NotNull, CHAR(3), classification=MemberStatus}

     * 会員ステータスを識別するコード。

     * 固定的なデータなので連番とか番号にはせず、データを直接見たときも人が直感的にわかるように、例えば "FML" とかの3桁のコード形式にしている。(3って何会員だっけ?とかの問答をやりたくないので)
     * @param memberStatusCode The value of the column 'MEMBER_STATUS_CODE'. (basically NotNull if update: for the constraint)
     */
    protected void setMemberStatusCode(String memberStatusCode) {
        checkClassificationCode("MEMBER_STATUS_CODE", CDef.DefMeta.MemberStatus, memberStatusCode);
        registerModifiedProperty("memberStatusCode");
        _memberStatusCode = memberStatusCode;
    }

    /**
     * [get] (会員ステータス名称)MEMBER_STATUS_NAME: {NotNull, VARCHAR(50)}

     * 表示用の名称。

     * 国際化対応するときはもっと色々考える必要があるかと...ということで英語名カラムがないので、そのまま区分値メソッド名の一部としても利用される。
     * @return The value of the column 'MEMBER_STATUS_NAME'. (basically NotNull if selected: for the constraint)
     */
    public String getMemberStatusName() {
        checkSpecifiedProperty("memberStatusName");
        return convertEmptyToNull(_memberStatusName);
    }

    /**
     * [set] (会員ステータス名称)MEMBER_STATUS_NAME: {NotNull, VARCHAR(50)}

     * 表示用の名称。

     * 国際化対応するときはもっと色々考える必要があるかと...ということで英語名カラムがないので、そのまま区分値メソッド名の一部としても利用される。
     * @param memberStatusName The value of the column 'MEMBER_STATUS_NAME'. (basically NotNull if update: for the constraint)
     */
    public void setMemberStatusName(String memberStatusName) {
        registerModifiedProperty("memberStatusName");
        _memberStatusName = memberStatusName;
    }

    /**
     * [get] (説明)DESCRIPTION: {NotNull, VARCHAR(200)}

     * 会員ステータスそれぞれの説明。

     * 区分値の一つ一つの要素に気の利いた説明があるとディベロッパーがとても助かるので絶対に欲しい。
     * @return The value of the column 'DESCRIPTION'. (basically NotNull if selected: for the constraint)
     */
    public String getDescription() {
        checkSpecifiedProperty("description");
        return convertEmptyToNull(_description);
    }

    /**
     * [set] (説明)DESCRIPTION: {NotNull, VARCHAR(200)}

     * 会員ステータスそれぞれの説明。

     * 区分値の一つ一つの要素に気の利いた説明があるとディベロッパーがとても助かるので絶対に欲しい。
     * @param description The value of the column 'DESCRIPTION'. (basically NotNull if update: for the constraint)
     */
    public void setDescription(String description) {
        registerModifiedProperty("description");
        _description = description;
    }

    /**
     * [get] (表示順)DISPLAY_ORDER: {UQ, NotNull, INTEGER(10)}

     * UI上のステータスの表示順を示すNO。

     * 並べるときは、このカラムに対して昇順のソート条件にする。
     * @return The value of the column 'DISPLAY_ORDER'. (basically NotNull if selected: for the constraint)
     */
    public Integer getDisplayOrder() {
        checkSpecifiedProperty("displayOrder");
        return _displayOrder;
    }

    /**
     * [set] (表示順)DISPLAY_ORDER: {UQ, NotNull, INTEGER(10)}

     * UI上のステータスの表示順を示すNO。

     * 並べるときは、このカラムに対して昇順のソート条件にする。
     * @param displayOrder The value of the column 'DISPLAY_ORDER'. (basically NotNull if update: for the constraint)
     */
    public void setDisplayOrder(Integer displayOrder) {
        registerModifiedProperty("displayOrder");
        _displayOrder = displayOrder;
    }

    /**
     * For framework so basically DON'T use this method.
     * @param memberStatusCode The value of the column 'MEMBER_STATUS_CODE'. (basically NotNull if update: for the constraint)
     */
    public void mynativeMappingMemberStatusCode(String memberStatusCode) {
        setMemberStatusCode(memberStatusCode);
    }
}


text:
#include <pdal/filters/Selector.hpp>

#include <pdal/PointBuffer.hpp>

#include <iostream>
#include <map>

#include <boost/algorithm/string.hpp>
#include <boost/uuid/string_generator.hpp>

namespace pdal
{
namespace filters
{

// ------------------------------------------------------------------------

Selector::Selector(Stage& prevStage, const Options& options)
    : Filter(prevStage, options)
    , m_ignoreDefault(true)
{
    return;
}

void Selector::initialize()
{
    Filter::initialize();

    checkImpedance();

    return;
}

void Selector::checkImpedance()
{
    Options& options = getOptions();

    m_ignoreDefault = options.getValueOrDefault<bool>("ignore_default", true);
    std::vector<Option>::const_iterator i;

    try
    {
        Option ignored = options.getOption("ignore");
        boost::optional<Options const&> ignored_options = ignored.getOptions();

        if (ignored_options)
        {
            std::vector<Option> ignored_dimensions = ignored_options->getOptions("dimension");
            for (i = ignored_dimensions.begin(); i != ignored_dimensions.end(); ++i)
            {
                m_ignoredMap.insert(std::pair<std::string, bool>(i->getValue<std::string>(), true));
            }
        }
    }
    catch (option_not_found&)
    {
    }

    try
    {
        Option keep = options.getOption("keep");
        boost::optional<Options const&> keep_options = keep.getOptions();

        if (keep_options)
        {
            std::vector<Option> keep_dimensions = keep_options->getOptions("dimension");
            for (i = keep_dimensions.begin(); i != keep_dimensions.end(); ++i)
            {
                m_ignoredMap.insert(std::pair<std::string, bool>(i->getValue<std::string>(), false));
            }
        }
    }
    catch (option_not_found&)
    {
    }

    try
    {
        Option create = options.getOption("create");
        boost::optional<Options const&> create_options = create.getOptions();

        if (create_options)
        {
            std::vector<Option> create_dimensions = create_options->getOptions("dimension");
            for (i = create_dimensions.begin(); i != create_dimensions.end(); ++i)
            {
                Option const& o = *i;
                boost::optional<Options const&> dim_opts = o.getOptions();

                if (!dim_opts)
                    throw pdal_error("create dimension option has no sub options!");
                Options const& ops = *dim_opts;
                std::string name;
                boost::uint32_t size(0);
                std::string description;
                std::string interpretation;
                dimension::id uuid;
                dimension::id parent_uuid;
                double offset(0.0);
                double scale(0.0);
                double minimum(0.0);
                double maximum(0.0);

                name = o.getValue<std::string>();
                scale = ops.getValueOrDefault<double>("scale", 1.0);
                offset = ops.getValueOrDefault<double>("offset", 0.0);
                size = ops.getValueOrDefault<boost::uint32_t>("size", 1);

                description = ops.getValueOrDefault<std::string>("description", "");
                interpretation = ops.getValueOrDefault<std::string>("interpretation", "int32_t");

                /*
                EndianType endianness = Endian_Little;
                std::string endy = ops.getValueOrDefault<std::string>("endianness", "little");
                if (boost::iequals(endy, "big"))
                    endianness = Endian_Big;
                */

                uuid = ops.getValueOrDefault<dimension::id>("uuid", boost::uuids::nil_uuid());
                parent_uuid = ops.getValueOrDefault<dimension::id>("parent_uuid",  boost::uuids::nil_uuid());

                minimum = ops.getValueOrDefault<double>("minimum", 0.0);
                maximum = ops.getValueOrDefault<double>("maximum", 0.0);

                dimension::Interpretation interp = Dimension::getInterpretation(interpretation);

                Dimension d(name, interp, size, description);
                d.setUUID(uuid);

                if (d.getUUID().is_nil())
                    d.createUUID();
                d.setParent(parent_uuid);
                d.setNumericScale(scale);
                d.setNumericOffset(offset);
                d.setMinimum(minimum);
                d.setMaximum(maximum);
                d.setNamespace(getName());
                m_createDimensions.push_back(d);
            }
        }
    }
    catch (option_not_found&)
    {
    }

    return;
}

pdal::StageSequentialIterator* Selector::createSequentialIterator(PointBuffer& buffer) const
{
    return new pdal::filters::iterators::sequential::Selector(*this, buffer);
}

pdal::StageRandomIterator* Selector::createRandomIterator(PointBuffer& buffer) const
{
    return new pdal::filters::iterators::random::Selector(*this, buffer);
}

Options Selector::getDefaultOptions()
{
    Options options;
    Option ignore("ignore", "DimensionName", "An Options set with entries of name 'dimension' names to ignore");
    return options;
}

namespace iterators
{

namespace selector
{

IteratorBase::IteratorBase(pdal::filters::Selector const& filter, PointBuffer&)
    : m_selectorFilter(filter)
{

}

void IteratorBase::alterSchema(PointBuffer& buffer)
{
    Schema original_schema = buffer.getSchema();

    // Add new dimensions to the schema first in case we wanted to ignore them
    // or something silly like that.
    Schema new_schema = buffer.getSchema();
    std::vector<Dimension> const& new_dimensions = m_selectorFilter.getCreatedDimensions();

    bool bOverwriteExistingDimensions = m_selectorFilter.getOptions().getValueOrDefault<bool>("overwite_existing_dimensions", true);
    if (new_dimensions.size())
    {
        for (std::vector<Dimension>::const_iterator i = new_dimensions.begin(); i != new_dimensions.end(); ++i)
        {
            boost::optional<Dimension const&> old_dim = original_schema.getDimensionOptional(i->getName());
            bool bFoundDimension(false);
            if (old_dim)
                bFoundDimension = true;

            if (!bFoundDimension)
            {
                new_schema.appendDimension(*i);
            }
            else if (bOverwriteExistingDimensions)
            {
                Dimension new_dim(*i);
                new_dim.setParent(old_dim->getUUID());
                new_schema.appendDimension(new_dim);
            }
        }
    }

    std::map<std::string, bool> const& ignoredMap = m_selectorFilter.getIgnoredMap();
    schema::Map dimensions = original_schema.getDimensions();
    schema::index_by_index const& dims = dimensions.get<schema::index>();
    for (schema::index_by_index::const_iterator t = dims.begin();
            t != dims.end();
            ++t)
    {

        std::map<std::string, bool>::const_iterator ignored = ignoredMap.find(t->getName());
        if (ignored != ignoredMap.end())
        {
            if (ignored->second) // marked to be dropped
            {
                // set to ignored
                Dimension d2(*t);
                boost::uint32_t flags = d2.getFlags();
                d2.setFlags(flags | dimension::IsIgnored);
                new_schema.setDimension(d2);
            }
        }
        else     // didn't find it in our map of specified dimensions
        {

            if (m_selectorFilter.doIgnoreUnspecifiedDimensions())
            {
                // set to ignored
                Dimension d2(*t);
                boost::uint32_t flags = d2.getFlags();
                d2.setFlags(flags | dimension::IsIgnored);
                new_schema.setDimension(d2);
            }
        }

    }

    buffer.reset(new_schema);
}

} // selector

namespace sequential
{

Selector::Selector(const pdal::filters::Selector& filter, PointBuffer& buffer)
    : pdal::FilterSequentialIterator(filter, buffer)
    , selector::IteratorBase(filter, buffer)
{
    alterSchema(buffer);
    m_selectorFilter.log()->get(logDEBUG4) << "iterator has modified schema" << std::endl;

    return;
}

boost::uint32_t Selector::readBufferImpl(PointBuffer& buffer)
{
    const boost::uint32_t numRead = getPrevIterator().read(buffer);
    return numRead;
}

boost::uint64_t Selector::skipImpl(boost::uint64_t count)
{
    getPrevIterator().skip(count);
    return count;
}

bool Selector::atEndImpl() const
{
    return getPrevIterator().atEnd();
}

} // sequential

namespace random
{
Selector::Selector(const pdal::filters::Selector& filter, PointBuffer& buffer)
    : pdal::FilterRandomIterator(filter, buffer)
    , selector::IteratorBase(filter, buffer)
{
    return;
}

boost::uint64_t Selector::seekImpl(boost::uint64_t count)
{

    return getPrevIterator().seek(count);
}

boost::uint32_t Selector::readBufferImpl(PointBuffer& buffer)
{
    const boost::uint32_t numRead = getPrevIterator().read(buffer);

    return numRead;
}

} // random

} // iterators

}
} // namespaces


text:
import React , { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import DocumentMeta from 'react-document-meta';

//styles
import styles from './styles';
//actions
import * as actionCreators from 'actions/login';
import { goodsClassPage } from 'constants/RouterConfig';
//components
import { Header, SubHeader, CoreIdeaMessage, Footer } from 'components';
import { LoginBox } from 'containers';

@connect(state => state.adminInfo)
export default class LoginSection extends Component {

	static propTypes = {
		dispatch: PropTypes.func,
 	}

	constructor(props) {
		super(props);
		this.actions = bindActionCreators(actionCreators, this.props.dispatch);
	}

	componentWillMount(){
    // Dev: judge the state of administor
    if (this.props.adminInfo.name != '') {
    	window.location.href = goodsClassPage;
    };
	}

	render(){

		const { adminInfo } = this.props;
    const metaData = {
      title: '清风后台登录',
      description: '清风管理员登录界面',
      canonical: 'http://example.com/path/to/page',
      meta: {
        charset: 'utf-8',
        name: {
          keywords: '',
        },
      },
    };

		return (
			<section className={`${styles}`}>
				<DocumentMeta {...metaData} />

				<SubHeader />

						<CoreIdeaMessage />

						<LoginBox />

		);
	}
}


text:
using System.Runtime.InteropServices;

namespace AgathaSample.ServiceHost
{
    //  http://marcmelvin.com/?p=10
    public static class ConsoleHelper
    {
        [DllImport("kernel32.dll")]
        private static extern int AllocConsole();

        [DllImport("kernel32.dll")]
        private static extern int FreeConsole();

        public static void OpenConsole()
        {
            AllocConsole();
        }

        public static void CloseConsole()
        {
            FreeConsole();
        }
    }
}


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

<title>EncryptorDecryptor</title>
<meta name="date" content="2014-10-25">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.pvsagar.smartlockscreen.backend_helpers

Class EncryptorDecryptor

java.lang.Object

com.pvsagar.smartlockscreen.backend_helpers.EncryptorDecryptor

public class EncryptorDecryptor
extends java.lang.Object

Created by aravind on 8/9/14.
 A helper class for encrypting and decrypting passphrase strings

Constructor Summary

Constructors

Constructor and Description

EncryptorDecryptor()

Method Summary

Methods

Modifier and Type
Method and Description

static java.lang.String
decrypt(java.lang.String ivAndEncryptedMessageBase64,
       java.lang.String symKeyHex)

static java.lang.String
encrypt(java.lang.String plainMessage,
       java.lang.String symKeyHex)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

EncryptorDecryptor

public EncryptorDecryptor()

Method Detail

encrypt

public static java.lang.String encrypt(java.lang.String plainMessage,
                       java.lang.String symKeyHex)

decrypt

public static java.lang.String decrypt(java.lang.String ivAndEncryptedMessageBase64,
                       java.lang.String symKeyHex)

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
/*******************************************************************************
 *   Ledger Stellar App
 *   (c) 2017-2018 Ledger
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 ********************************************************************************/
#ifndef _STELLAR_FORMAT_H_
#define _STELLAR_FORMAT_H_

#include "stellar_types.h"

/*
 * the formatter prints the details and defines the order of the details
 * by setting the next formatter to be called
 */
typedef void (*format_function_t)(tx_context_t *txCtx);

/* the current formatter */
extern volatile format_function_t formatter;

/* the current details printed by the formatter */
extern char opCaption[OPERATION_CAPTION_MAX_SIZE];
extern char detailCaption[DETAIL_CAPTION_MAX_SIZE];
extern char detailValue[DETAIL_VALUE_MAX_SIZE];

void format_confirm_transaction(tx_context_t *txCtx);
void format_confirm_operation(tx_context_t *txCtx);
void format_confirm_transaction_details(tx_context_t *txCtx);

void format_confirm_hash(tx_context_t *txCtx);

#endif


text:
package es.bhavishchandnani.myrestaurant.adapters;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.LinkedList;

import es.bhavishchandnani.myrestaurant.R;
import es.bhavishchandnani.myrestaurant.model.TableState;
import es.bhavishchandnani.myrestaurant.views.OnElementClick;
import es.bhavishchandnani.myrestaurant.views.TableStateViewHolder;

import static android.content.ContentValues.TAG;

public class TableStateAdapter extends RecyclerView.Adapter<TableStateViewHolder>{

    private final LayoutInflater layoutInflater;
    private final LinkedList<TableState> tableStateList;
    private OnElementClick<TableState> listener;
    private TableStateViewHolder viewHolder;
    private TableState selectedState;

    public TableStateAdapter(Context context, LinkedList<TableState> tableStateList, TableState state) {
        this.layoutInflater = LayoutInflater.from(context);
        this.tableStateList = tableStateList;
        this.selectedState = state;
    }

    public TableState getSelectedState() {
        return selectedState;
    }

    public void setSelectedState(TableState state) {
        selectedState = state;
    }

    @Override
    public TableStateViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = layoutInflater.inflate(R.layout.item_table_state, parent, false);
        viewHolder = new TableStateViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(TableStateViewHolder item, final int position) {
        final TableState tableState = tableStateList.get(position);
        item.setTableState(tableState, tableState.equals(selectedState));

        item.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.d(TAG, "onClick: clicked item "+ position);
                if (listener != null){
                    listener.clickedOn(tableState, position);
                }
            }
        });
    }

    @Override
    public int getItemCount() {
        return tableStateList.size();
    }

    public void setOnElementClickListener(@NonNull final OnElementClick listener){
        this.listener =  listener;
    }
}


text:
<?php
namespace matuck\LibraryBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use matuck\LibraryBundle\Entity\Download;
use matuck\LibraryBundle\Entity\DownloadRepository;

class ConvertDownloadsCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('library:downloads:convertdownloads')
            ->setDescription('Converts the downloads table')
            ->setHelp('Converts the downloads table into daily downloads and book downloads.')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $conn = $this->getContainer()->get('doctrine')->getManager()->getConnection();
        /* @var $conn \Doctrine\DBAL\Connection */
        echo "Adding downloads table book counts to the book.\n\n";
        $conn->executeQuery('UPDATE book SET book.downcount = IFNULL(book.downcount, 0) + ( SELECT COUNT( d.book_id ) FROM download d WHERE (SELECT MAX(day) FROM dailydownloads) AND d.book_id = book.id )');
        $res = $conn->executeQuery('SELECT DATE(created_at) date, count(*) as dcount FROM download WHERE day > (SELECT MAX(day) FROM dailydownloads) GROUP BY DATE(created_at)')
                ->fetchAll();
        foreach($res as $day)
        {
            echo $day['date']."\t".$day['dcount']."\n";
            $res2 = $conn->executeQuery('SELECT * FROM dailydownloads WHERE day = "'.$day['date'].'  00:00:00"')->fetch();
            if($res2 === FALSE)
            {
                $conn->executeQuery("INSERT INTO dailydownloads (day, downloads) VALUES ('".$day['date']."',".$day['dcount'].") ");
                echo sprintf('Inserting %s with downloads %d', $day['date'], $day['dcount'])."\n\n";
            }
            else
            {
                echo "The day already exist going to run update\n\n";
                $newcount = $res2['downloads'] + $day['dcount'];
                echo sprintf("The existing count %d, the additional count %d, the new count %d.\n\n", $res2['downloads'], $day['dcount'], $newcount);
                $conn->executeQuery(sprintf('UPDATE dailydownloads SET downloads = %d WHERE day = "%s"', $newcount, $res2['day']));
            }
        }

        //$conn->executeQuery('TRUNCATE TABLE download');
    }
}


text:
package dockerswarm

import (
	"context"
	"fmt"

	"github.com/docker/docker/api/types"
	"github.com/prometheus/prometheus/util/strutil"
)

const (
	swarmLabelNetworkPrefix      = swarmLabel + "network_"
	swarmLabelNetworkID          = swarmLabelNetworkPrefix + "id"
	swarmLabelNetworkName        = swarmLabelNetworkPrefix + "name"
	swarmLabelNetworkScope       = swarmLabelNetworkPrefix + "scope"
	swarmLabelNetworkInternal    = swarmLabelNetworkPrefix + "internal"
	swarmLabelNetworkIngress     = swarmLabelNetworkPrefix + "ingress"
	swarmLabelNetworkLabelPrefix = swarmLabelNetworkPrefix + "label_"
)

func (d *Discovery) getNetworksLabels(ctx context.Context) (map[string]map[string]string, error) {
	networks, err := d.client.NetworkList(ctx, types.NetworkListOptions{})
	if err != nil {
		return nil, err
	}
	labels := make(map[string]map[string]string, len(networks))
	for _, network := range networks {
		labels[network.ID] = map[string]string{
			swarmLabelNetworkID:       network.ID,
			swarmLabelNetworkName:     network.Name,
			swarmLabelNetworkScope:    network.Scope,
			swarmLabelNetworkInternal: fmt.Sprintf("%t", network.Internal),
			swarmLabelNetworkIngress:  fmt.Sprintf("%t", network.Ingress),
		}
		for k, v := range network.Labels {
			ln := strutil.SanitizeLabelName(k)
			labels[network.ID][swarmLabelNetworkLabelPrefix+ln] = v
		}
	}

	return labels, nil
}


text:
package org.ggp.base.util.ui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.image.BufferedImage;

import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class CloseableTabs {
	private final static int CLOSE_ICON_SIZE = 8;

	public static void addClosableTab(JTabbedPane tabPane, JComponent tabContent, String tabName, AbstractAction closeAction) {
		JPanel tabTopPanel = new JPanel(new GridBagLayout());
		tabTopPanel.setOpaque(false);

		JButton btnClose = new JButton();
		BufferedImage img = new BufferedImage(CLOSE_ICON_SIZE, CLOSE_ICON_SIZE, BufferedImage.TYPE_4BYTE_ABGR);
		Graphics g = img.getGraphics();
		g.setColor(Color.BLACK);
		g.drawLine(0, CLOSE_ICON_SIZE-1, CLOSE_ICON_SIZE-1, 0);
		g.drawLine(0, 0, CLOSE_ICON_SIZE-1, CLOSE_ICON_SIZE-1);
		btnClose.setIcon(new ImageIcon(img));
		btnClose.addActionListener(closeAction);

		tabTopPanel.add(new JLabel(tabName), new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
		tabTopPanel.add(btnClose, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 4, 0, 0), 0, 0));

		tabPane.addTab(tabName, tabContent);
		tabPane.setTabComponentAt(tabPane.getTabCount()-1, tabTopPanel);
	}
}


text:
#include <aws/monitoring/model/GetMetricStreamResult.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/logging/LogMacros.h>

#include <utility>

using namespace Aws::CloudWatch::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils::Logging;
using namespace Aws::Utils;
using namespace Aws;

GetMetricStreamResult::GetMetricStreamResult() :
    m_outputFormat(MetricStreamOutputFormat::NOT_SET)
{
}

GetMetricStreamResult::GetMetricStreamResult(const Aws::AmazonWebServiceResult<XmlDocument>& result) :
    m_outputFormat(MetricStreamOutputFormat::NOT_SET)
{
  *this = result;
}

GetMetricStreamResult& GetMetricStreamResult::operator =(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
  const XmlDocument& xmlDocument = result.GetPayload();
  XmlNode rootNode = xmlDocument.GetRootElement();
  XmlNode resultNode = rootNode;
  if (!rootNode.IsNull() && (rootNode.GetName() != "GetMetricStreamResult"))
  {
    resultNode = rootNode.FirstChild("GetMetricStreamResult");
  }

  if(!resultNode.IsNull())
  {
    XmlNode arnNode = resultNode.FirstChild("Arn");
    if(!arnNode.IsNull())
    {
      m_arn = Aws::Utils::Xml::DecodeEscapedXmlText(arnNode.GetText());
    }
    XmlNode nameNode = resultNode.FirstChild("Name");
    if(!nameNode.IsNull())
    {
      m_name = Aws::Utils::Xml::DecodeEscapedXmlText(nameNode.GetText());
    }
    XmlNode includeFiltersNode = resultNode.FirstChild("IncludeFilters");
    if(!includeFiltersNode.IsNull())
    {
      XmlNode includeFiltersMember = includeFiltersNode.FirstChild("member");
      while(!includeFiltersMember.IsNull())
      {
        m_includeFilters.push_back(includeFiltersMember);
        includeFiltersMember = includeFiltersMember.NextNode("member");
      }

    }
    XmlNode excludeFiltersNode = resultNode.FirstChild("ExcludeFilters");
    if(!excludeFiltersNode.IsNull())
    {
      XmlNode excludeFiltersMember = excludeFiltersNode.FirstChild("member");
      while(!excludeFiltersMember.IsNull())
      {
        m_excludeFilters.push_back(excludeFiltersMember);
        excludeFiltersMember = excludeFiltersMember.NextNode("member");
      }

    }
    XmlNode firehoseArnNode = resultNode.FirstChild("FirehoseArn");
    if(!firehoseArnNode.IsNull())
    {
      m_firehoseArn = Aws::Utils::Xml::DecodeEscapedXmlText(firehoseArnNode.GetText());
    }
    XmlNode roleArnNode = resultNode.FirstChild("RoleArn");
    if(!roleArnNode.IsNull())
    {
      m_roleArn = Aws::Utils::Xml::DecodeEscapedXmlText(roleArnNode.GetText());
    }
    XmlNode stateNode = resultNode.FirstChild("State");
    if(!stateNode.IsNull())
    {
      m_state = Aws::Utils::Xml::DecodeEscapedXmlText(stateNode.GetText());
    }
    XmlNode creationDateNode = resultNode.FirstChild("CreationDate");
    if(!creationDateNode.IsNull())
    {
      m_creationDate = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(creationDateNode.GetText()).c_str()).c_str(), Aws::Utils::DateFormat::ISO_8601);
    }
    XmlNode lastUpdateDateNode = resultNode.FirstChild("LastUpdateDate");
    if(!lastUpdateDateNode.IsNull())
    {
      m_lastUpdateDate = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(lastUpdateDateNode.GetText()).c_str()).c_str(), Aws::Utils::DateFormat::ISO_8601);
    }
    XmlNode outputFormatNode = resultNode.FirstChild("OutputFormat");
    if(!outputFormatNode.IsNull())
    {
      m_outputFormat = MetricStreamOutputFormatMapper::GetMetricStreamOutputFormatForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(outputFormatNode.GetText()).c_str()).c_str());
    }
    XmlNode statisticsConfigurationsNode = resultNode.FirstChild("StatisticsConfigurations");
    if(!statisticsConfigurationsNode.IsNull())
    {
      XmlNode statisticsConfigurationsMember = statisticsConfigurationsNode.FirstChild("member");
      while(!statisticsConfigurationsMember.IsNull())
      {
        m_statisticsConfigurations.push_back(statisticsConfigurationsMember);
        statisticsConfigurationsMember = statisticsConfigurationsMember.NextNode("member");
      }

    }
  }

  if (!rootNode.IsNull()) {
    XmlNode responseMetadataNode = rootNode.FirstChild("ResponseMetadata");
    m_responseMetadata = responseMetadataNode;
    AWS_LOGSTREAM_DEBUG("Aws::CloudWatch::Model::GetMetricStreamResult", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );
  }
  return *this;
}


text:
APPNAME="DirectFire"

# options

buildexternalsfromsource=

usage(){
cat << EOF
usage: $0 [options]

Build C/C++ code for $APPNAME using Android NDK

OPTIONS:
-s	Build externals from source
-h	this help
EOF
}

while getopts "sh" OPTION; do
case "$OPTION" in
s)
buildexternalsfromsource=1
;;
h)
usage
exit 0
;;
esac
done

# paths

if [ -z "${NDK_ROOT+aaa}" ];then
echo "please define NDK_ROOT"
exit 1
fi

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../../../"
APP_ROOT="$DIR/.."
APP_ANDROID_ROOT="$DIR"

echo "NDK_ROOT = $NDK_ROOT"
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
echo "APP_ROOT = $APP_ROOT"
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"

# make sure assets is exist
#if [ -d "$APP_ANDROID_ROOT"/assets ]; then
    #rm -rf "$APP_ANDROID_ROOT"/assets
#fi

if [[ "$buildexternalsfromsource" ]]; then
    echo "Building external dependencies from source"
    "$NDK_ROOT"/ndk-build  NDK_DEBUG=1 -C "$APP_ANDROID_ROOT" $* \
        "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
else
    echo "Using prebuilt externals"
    "$NDK_ROOT"/ndk-build  NDK_DEBUG=1 -C "$APP_ANDROID_ROOT" $* \
        "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt:${COCOS2DX_ROOT}/directfire_github/trunk/android_prebuild"
fi


text:
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.core.files.storage import default_storage
from django.utils.hashcompat import md5_constructor
import pickle

class Migration(DataMigration):
    """
    Migrate storage hashes.

    """

    def get_storage_hash(self, storage):
        """
        Return a hex string hash for a storage object (or string containing a
        pickle of a storage object).

        """
        try:
            # Make sure that pickle is getting a string, since it can choke
            # with unicode.
            storage_obj = pickle.loads(str(self.pickle))
        except:
            # We need to return some storage, and if there's an exception then
            # it is most likely the default_storage (since that fails with a
            # recursion error due to LazyObject "awesomeness").
            storage_obj = default_storage
        storage_cls = storage_obj.__class__
        name = '%s.%s' % (storage_cls.__module__, storage_cls.__name__)
        return md5_constructor(name).hexdigest()

    def forwards(self, orm):
        "Write your forwards methods here."
        for storage in orm.Storage.objects.all():
            storage_hash = self.get_storage_hash(storage)
            orm.Source.objects.filter(storage=storage).update(
                                        storage_hash=storage_hash)
            orm.Thumbnail.objects.filter(storage=storage).update(
                                        storage_hash=storage_hash)

    def backwards(self, orm):
        "Write your backwards methods here."

    models = {
        'easy_thumbnails.source': {
            'Meta': {'object_name': 'Source'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 9, 8, 0, 32, 41, 855399)'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
            'storage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['easy_thumbnails.Storage']"}),
            'storage_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'})
        },
        'easy_thumbnails.storage': {
            'Meta': {'object_name': 'Storage'},
            'hash': ('django.db.models.fields.CharField', [], {'max_length': '40', 'db_index': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'pickle': ('django.db.models.fields.TextField', [], {})
        },
        'easy_thumbnails.thumbnail': {
            'Meta': {'object_name': 'Thumbnail'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'modified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2010, 9, 8, 0, 32, 41, 855399)'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
            'source': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'thumbnails'", 'to': "orm['easy_thumbnails.Source']"}),
            'storage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['easy_thumbnails.Storage']"}),
            'storage_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'})
        }
    }

    complete_apps = ['easy_thumbnails']


text:
<?php

namespace AppBundle\Service;

use AppBundle\Entity\Issue;
use AppBundle\Entity\IssueActivity;

use Knp\Component\Pager\Pagination\PaginationInterface;
use Knp\Component\Pager\PaginatorInterface;

use Doctrine\ORM\EntityManager;

use Symfony\Component\Translation\TranslatorInterface;

class UserService extends AbstractService
{
    const USERS_LIMIT = 10;

    /** @var PaginatorInterface */
    protected $paginator;

    /**
     * @param EntityManager       $manager
     * @param TranslatorInterface $translator
     * @param PaginatorInterface  $paginatorInterface
     */
    public function __construct(
        EntityManager $manager,
        TranslatorInterface $translator,
        PaginatorInterface $paginatorInterface
    ) {
        $this->paginator = $paginatorInterface;
        parent::__construct($manager, $translator);
    }

    /**
     * @param int $page
     * @param int $limit
     *
     * @return PaginationInterface
     */
    public function getUsersList($page, $limit)
    {
        return $this->paginator->paginate(
            $this->getUsersRepository()->getListQuery(),
            $page,
            $limit
        );
    }

    /**
     * @param int $userId
     *
     * @return Issue[]
     */
    public function getUserIssues($userId)
    {
        return $this->getIssuesRepository()->getNotClosedUserIssues($userId);
    }

    /**
     * @param int $userId
     *
     * @return Issue[]
     */
    public function getUserAssignedIssues($userId)
    {
        return $this->getIssuesRepository()->getNotClosedUserAssignedIssues($userId);
    }

    /**
     * @param int $userId
     *
     * @return IssueActivity[]
     */
    public function getUserActivities($userId)
    {
        return $this->getActivitiesRepository()->getUserActivities($userId);
    }
}


text:
'use strict';

//Videos service used for videos REST endpoint
angular.module('mean.videos').factory('Videos', ['$resource',
	function($resource) {
		return $resource('videos/:videoId', {
			videoId: '@_id'
		}, {
			update: {
				method: 'PUT'
			},
			query: {
				method:'GET', isArray:true
			},
			search: {
				method:'GET',url:'videos/search', isArray:true
			},
			userlist: {
				method:'GET',url:'videos/userlist', isArray:true
			},
			tags: {
				method:'GET',url:'videos/tags', isArray:true
			},
			categories: {
				method:'GET',url:'videos/categories', isArray:true
			}
		});
	}
]);

angular.module('mean.videos').service('VideoHelper', ['$location',
	function($location) {

		this.getYoutubePlayer = function(url){
        	return 'https://www.youtube.com/embed/'+this.getYouTubeID(url);
        };

        this.getYoutubeThumb = function(url){
        	return 'http://img.youtube.com/vi/'+this.getYouTubeID(url)+'/2.jpg';
        };

        this.getYouTubeID = function(url){
		  	var ID = '';
		  	url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
		  	if(url[2] !== undefined) {
			    ID = url[2].split(/[^0-9a-z_]/i);
			    ID = ID[0];
			}
			else {
			    ID = url;
			}
			return ID;
		};

		this.getDomainName = function(url){
        	return url.replace('http://','').replace('https://','').replace('www.','').split(/[/?#]/)[0];
        };

	}
]);


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.frostwire.jlibtorrent.swig;

public class session_proxy {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected session_proxy(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(session_proxy obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        libtorrent_jni.delete_session_proxy(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public session_proxy() {
    this(libtorrent_jni.new_session_proxy__SWIG_0(), true);
  }

  public session_proxy(session_proxy arg0) {
    this(libtorrent_jni.new_session_proxy__SWIG_1(session_proxy.getCPtr(arg0), arg0), true);
  }

}


text:
<?php
// This is an example opendb.php
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
?>


text:
package ru.job4j.array;

import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
 *Class TurnTest в данном классе происходит тестирование класса Turn.
 *@author Anton Kondratkov
 *@since 20.11.2017
 */

public class TurnTest {
    /**
     * Метод тестирует метод Turn.reverse() для массива {2, 6, inheritance, 4}.
     */
    @Test
    public void whenTurnArrayWithEvenAmountOfElementsThenTurnedArray() {
        //создаём объект.
        Turn turn = new Turn();
        //передаём заданный массив в метод reverse.
        int[] input = {2, 6, 1, 4};
        int[] result = turn.reverse(input);
        // Задаем ожидаемый результат.
        int[] expected = {4, 1, 6, 2};
        //Проверяем результат и ожидаемое значение.
        assertThat(result, is(expected));
    }
    /**
     * Метод тестирует метод Turn.reverse() для массива {inheritance, 2, 3, 4, 5}.
     */
    @Test
    public void whenTurnArrayWithOddAmountOfElementsThenTurnedArray() {
        //создаём объект.
        Turn turn = new Turn();
        //передаём заданный массив в метод reverse.
        int[] input = {1, 2, 3, 4, 5};
        int[] result = turn.reverse(input);
        // Задаем ожидаемый результат.
        int[] expected = {5, 4, 3, 2, 1};
        //Проверяем результат и ожидаемое значение.
        assertThat(result, is(expected));
    }
}


text:
"""
This student submission file is used to test the autotester
It represents the test case where:

  The submission passes with full marks
"""

import json

print(json.dumps({'name': 'pass_test', 'output': 'NA', 'marks_earned': 2, 'marks_total': 2, 'status': 'pass'}))


text:
"""
Written by Jason Pitt
Revised by Dominic Fitzgerald on 30 May 2017
"""
import os
import re
import warnings
from subprocess import Popen, PIPE

import six
from swiftseq.core import SwiftSeqStrings

FIRST_RESULT = 0
FIRST_IN_GROUP = 0

def make_readgroup_dict(bam, samtools_path):
    """
    This is a combination of extractReadGroupsStrings() and makeReadGroupDict()

    Side effects: None
    :param bam:
    :param samtools_path:
    :return:
    """

    # Get the stdout from a subprocess running samtools to extract only readgroups (@RG)
    samtools_output, _ = Popen(
        [samtools_path, 'view', '-H', bam, '|', 'grep', '\'@RG\''],
        stdout=PIPE
    ).communicate()
    samtools_output = samtools_output.decode('utf-8')

    # Add every readgroup line to a list
    readgroup_strings = list()
    for line in str(samtools_output).split('\n'):
        if line.startswith('@RG'):
            readgroup_strings.append(line.strip().replace(' ', '_'))

    readgroup_ids = dict()
    readgroup_id_re = re.compile(r'ID:(.*?)(\t|$)')
    for readgroup_string in readgroup_strings:
        re_result = readgroup_id_re.findall(readgroup_string)
        if re_result:
            readgroup_id_name = re_result[FIRST_RESULT][FIRST_IN_GROUP]
            readgroup_ids[readgroup_id_name] = readgroup_string

    return readgroup_ids

# TODO Will need to modify this to handle bams already split by RG
def create_readgroup_files(inputdata_symlinks, samtools_path):
    """

    Side effects: Creates two files
    :param data_symlinks: list
    :param samtools: str Path to the samtools executable
    """
    for file_ in inputdata_symlinks:
        dirPath = os.path.dirname(file_)
        readGroupIds = make_readgroup_dict(file_, samtools_path)
        readgroup_out_path = os.path.join(dirPath, SwiftSeqStrings.readgroups_out_filename)
        readgroup_id_out_path = os.path.join(dirPath, SwiftSeqStrings.readgroups_ids_out_filename)

        with open(readgroup_out_path, 'w') as rg_out, open(readgroup_id_out_path, 'w') as rgid_out:
            for readgroup in readGroupIds:
                rg_filename_root, rg_filename_ext = os.path.splitext(file_)
                rg_filename = '.'.join((rg_filename_root, six.u(readgroup), rg_filename_ext.strip('.')))
                rg_out.write(rg_filename + '\n')
                rgid_out.write(readgroup + '\n')

def extract_SM(readGroupString):
    ''' Get the SM from the read group string

    If there is no SM, need to decide what to do... could have that file ignored..
    This is likely the best option since a file without RG ID will be ignored
    as well '''

    SMregex = re.compile(r'SM:(.*?)(\t|$)')
    file_ = None
    # Need to handle when one isn't found or if multiples
    try:
        SM = SMregex.findall(readGroupString)[0]
        if len(SM) > 1:
            warnings.warn(('Warning: one or more read groups in %s have multiple SM fields .') % (file_))
    except IndexError:
        warnings.warn(('Warning: %s does not contain an SM field in its read group.') % (file_))
    # Need to make sure it is actually ignored
    # For TN pairs, the entire pair will need ot be ignored

    return SM

def is_uniform_SM_fields(read_group_strings):
    """
    I have no idea what this function does
    It was kind of a function stub
    """
    return len({extract_SM(read_group_string) for read_group_string in read_group_strings}) == 1


text:
package co.infinum.princeofversions.util;

import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;

public class MapUtil {

    private MapUtil() {
        throw new UnsupportedOperationException("Cannot create instance of this class.");
    }

    @SafeVarargs
    public static <K, V> Map<K, V> from(Map.Entry<K, V>... entries) {
        Map<K, V> map = new HashMap<>(entries.length);
        for (Map.Entry<K, V> entry : entries) {
            map.put(entry.getKey(), entry.getValue());
        }
        return map;
    }

    public static <K, V> Map.Entry<K, V> entry(K key, V value) {
        return new AbstractMap.SimpleEntry<>(key, value);
    }

}