text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Collections;
using System.Collections.Generic;
using MixedRealityToolkit.InputModule.Utilities.Interations;
using MixedRealityToolkit.UX.BoundingBoxes;
using MixedRealityToolkit.Examples.InputModule;
using MixedRealityToolkit.UX.Buttons;
using MixedRealityToolkit.UX.AppBarControl;
using UnityEngine;

namespace MixedRealityToolkit.UX.BoundingBoxes
{
    public class BoundingBoxRig : MonoBehaviour
    {
        [Header("Flattening")]
        [SerializeField]
        [Tooltip("Choose this option if Rig is to be applied to a 2D object.")]
        private BoundingBox.FlattenModeEnum flattenedAxis;

        [Header("Customization Settings")]
        [SerializeField]
        private Material scaleHandleMaterial;

        [SerializeField]
        private Material rotateHandleMaterial;

        [SerializeField]
        private Material interactingMaterial;

        [Header("Behavior")]
        [SerializeField]
        private float scaleRate = 1.0f;

        [SerializeField]
        [Tooltip("This is the maximum scale that one grab can accomplish.")]
        private float maxScale = 2.0f;

        [SerializeField]
        private BoundingBoxGizmoHandle.RotationType rotationType = BoundingBoxGizmoHandle.RotationType.objectCoordinates;

        [SerializeField]
        private BoundingBoxGizmoHandle.HandMotionType handMotionToRotate = BoundingBoxGizmoHandle.HandMotionType.handRotatesToRotateObject;

        [Header("Preset Components")]
        [SerializeField]
        [Tooltip("To visualize the object bounding box, drop the MixedRealityToolkit/UX/Prefabs/BoundingBoxes/BoundingBoxBasic.prefab here.")]
        private BoundingBox boundingBoxPrefab;

        [SerializeField]
        [Tooltip("AppBar prefab.")]
        private AppBar appBarPrefab;

        private BoundingBox boxInstance;

        private GameObject objectToBound;

        private AppBar appBarInstance;

        private GameObject[] rotateHandles;

        private GameObject[] cornerHandles;

        private List<Vector3> handleCentroids;

        private GameObject transformRig;

        private BoundingBoxGizmoHandle[] rigScaleGizmoHandles;

        private BoundingBoxGizmoHandle[] rigRotateGizmoHandles;

        private bool showRig = false;

        private Vector3 scaleHandleSize = new Vector3(0.04f, 0.04f, 0.04f);

        private Vector3 rotateHandleSize = new Vector3(0.04f, 0.04f, 0.04f);

        private bool destroying = false;

        public BoundingBox BoundingBoxPrefab
        {
            get
            {
                return boundingBoxPrefab;
            }

            set
            {
                boundingBoxPrefab = value;
            }
        }

        public Material ScaleHandleMaterial
        {
            get
            {
                return scaleHandleMaterial;
            }

            set
            {
                scaleHandleMaterial = value;
            }
        }

        public Material RotateHandleMaterial
        {
            get
            {
                return rotateHandleMaterial;
            }

            set
            {
                rotateHandleMaterial = value;
            }
        }

        public Material InteractingMaterial
        {
            get
            {
                return interactingMaterial;
            }

            set
            {
                interactingMaterial = value;
            }
        }

        public void Activate()
        {
            ShowRig = true;
        }

        public void Deactivate()
        {
            ShowRig = false;
        }

        public void FocusOnHandle(GameObject handle)
        {
            if (handle != null)
            {
                for (int i = 0; i < rotateHandles.Length; ++i)
                {
                    rotateHandles[i].SetActive(rotateHandles[i].gameObject == handle);
                }
                for (int i = 0; i < cornerHandles.Length; ++i)
                {
                    cornerHandles[i].SetActive(cornerHandles[i].gameObject == handle);
                }
            }
            else
            {
                for (int i = 0; i < rotateHandles.Length; ++i)
                {
                    rotateHandles[i].SetActive(true);
                }
                for (int i = 0; i < cornerHandles.Length; ++i)
                {
                    cornerHandles[i].SetActive(true);
                }
            }
        }

        private void Start()
        {
            objectToBound = this.gameObject;

            boxInstance = Instantiate(BoundingBoxPrefab) as BoundingBox;
            boxInstance.Target = objectToBound;
            boxInstance.FlattenPreference = flattenedAxis;

            BuildRig();

            appBarInstance = Instantiate(appBarPrefab) as AppBar;
            appBarInstance.BoundingBox = boxInstance;

            boxInstance.IsVisible = false;
        }

        private void Update()
        {
            if (destroying == false && ShowRig)
            {
                UpdateBoundsPoints();
                UpdateHandles();
            }
        }

        private void OnDestroy()
        {
            destroying = true;
            ShowRig = false;
            ClearHandles();
        }

        private void UpdateBoundsPoints()
        {
            handleCentroids = GetBounds();
        }

        private void CreateHandles()
        {
            ClearHandles();
            UpdateCornerHandles();
            UpdateRotateHandles();
            ParentHandles();
            UpdateHandles();
        }

        private void UpdateCornerHandles()
        {
            if (handleCentroids != null)
            {
                GetBounds();
            }

            if (cornerHandles == null)
            {
                cornerHandles = new GameObject[handleCentroids.Count];
                rigScaleGizmoHandles = new BoundingBoxGizmoHandle[handleCentroids.Count];
                for (int i = 0; i < cornerHandles.Length; ++i)
                {
                    cornerHandles[i] = GameObject.CreatePrimitive(PrimitiveType.Cube);
                    cornerHandles[i].GetComponent<Renderer>().material = scaleHandleMaterial;
                    cornerHandles[i].transform.localScale = scaleHandleSize;
                    cornerHandles[i].name = "Corner " + i.ToString();
                    rigScaleGizmoHandles[i] = cornerHandles[i].AddComponent<BoundingBoxGizmoHandle>();
                    rigScaleGizmoHandles[i].Rig = this;
                    rigScaleGizmoHandles[i].ScaleRate = scaleRate;
                    rigScaleGizmoHandles[i].MaxScale = maxScale;
                    rigScaleGizmoHandles[i].TransformToAffect = objectToBound.transform;
                    rigScaleGizmoHandles[i].Axis = BoundingBoxGizmoHandle.AxisToAffect.Y;
                    rigScaleGizmoHandles[i].AffineType = BoundingBoxGizmoHandle.TransformType.Scale;
                }
            }

            for (int i = 0; i < cornerHandles.Length; ++i)
            {
                cornerHandles[i].transform.position = handleCentroids[i];
                cornerHandles[i].transform.localRotation = objectToBound.transform.rotation;
            }
        }

        private void UpdateRotateHandles()
        {
            if (handleCentroids != null)
            {
                GetBounds();
            }

            if (rotateHandles == null)
            {
                rotateHandles = new GameObject[12];
                rigRotateGizmoHandles = new BoundingBoxGizmoHandle[12];
                for (int i = 0; i < rotateHandles.Length; ++i)
                {
                    rotateHandles[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    rotateHandles[i].GetComponent<Renderer>().material = rotateHandleMaterial;
                    rotateHandles[i].transform.localScale = rotateHandleSize;
                    rotateHandles[i].name = "Middle " + i.ToString();
                    rigRotateGizmoHandles[i] = rotateHandles[i].AddComponent<BoundingBoxGizmoHandle>();
                    rigRotateGizmoHandles[i].Rig = this;
                    rigRotateGizmoHandles[i].HandMotionForRotation = handMotionToRotate;
                    rigRotateGizmoHandles[i].RotationCoordinateSystem = rotationType;
                    rigRotateGizmoHandles[i].TransformToAffect = objectToBound.transform;
                    rigRotateGizmoHandles[i].AffineType = BoundingBoxGizmoHandle.TransformType.Rotation;

                }

                //set axis to affect
                rigRotateGizmoHandles[0].Axis = BoundingBoxGizmoHandle.AxisToAffect.Y;
                rigRotateGizmoHandles[1].Axis = BoundingBoxGizmoHandle.AxisToAffect.Y;
                rigRotateGizmoHandles[2].Axis = BoundingBoxGizmoHandle.AxisToAffect.Y;
                rigRotateGizmoHandles[3].Axis = BoundingBoxGizmoHandle.AxisToAffect.Y;

                rigRotateGizmoHandles[4].Axis = BoundingBoxGizmoHandle.AxisToAffect.Z;
                rigRotateGizmoHandles[5].Axis = BoundingBoxGizmoHandle.AxisToAffect.Z;
                rigRotateGizmoHandles[6].Axis = BoundingBoxGizmoHandle.AxisToAffect.Z;
                rigRotateGizmoHandles[7].Axis = BoundingBoxGizmoHandle.AxisToAffect.Z;

                rigRotateGizmoHandles[8].Axis  = BoundingBoxGizmoHandle.AxisToAffect.X;
                rigRotateGizmoHandles[9].Axis  = BoundingBoxGizmoHandle.AxisToAffect.X;
                rigRotateGizmoHandles[10].Axis = BoundingBoxGizmoHandle.AxisToAffect.X;
                rigRotateGizmoHandles[11].Axis = BoundingBoxGizmoHandle.AxisToAffect.X;

                //set lefthandedness
                rigRotateGizmoHandles[0].IsLeftHandedRotation = false;
                rigRotateGizmoHandles[1].IsLeftHandedRotation = false;
                rigRotateGizmoHandles[2].IsLeftHandedRotation = false;
                rigRotateGizmoHandles[3].IsLeftHandedRotation = false;

                rigRotateGizmoHandles[4].IsLeftHandedRotation = false;
                rigRotateGizmoHandles[5].IsLeftHandedRotation = false;
                rigRotateGizmoHandles[6].IsLeftHandedRotation = true;
                rigRotateGizmoHandles[7].IsLeftHandedRotation = true;

                rigRotateGizmoHandles[8].IsLeftHandedRotation = false;
                rigRotateGizmoHandles[9].IsLeftHandedRotation = true;
                rigRotateGizmoHandles[10].IsLeftHandedRotation = false;
                rigRotateGizmoHandles[11].IsLeftHandedRotation = true;
            }

            rotateHandles[0].transform.localPosition = (handleCentroids[2] + handleCentroids[0]) * 0.5f;
            rotateHandles[1].transform.localPosition = (handleCentroids[3] + handleCentroids[1]) * 0.5f;
            rotateHandles[2].transform.localPosition = (handleCentroids[6] + handleCentroids[4]) * 0.5f;
            rotateHandles[3].transform.localPosition = (handleCentroids[7] + handleCentroids[5]) * 0.5f;
            rotateHandles[4].transform.localPosition = (handleCentroids[0] + handleCentroids[1]) * 0.5f;
            rotateHandles[5].transform.localPosition = (handleCentroids[2] + handleCentroids[3]) * 0.5f;
            rotateHandles[6].transform.localPosition = (handleCentroids[4] + handleCentroids[5]) * 0.5f;
            rotateHandles[7].transform.localPosition = (handleCentroids[6] + handleCentroids[7]) * 0.5f;
            rotateHandles[8].transform.localPosition = (handleCentroids[0] + handleCentroids[4]) * 0.5f;
            rotateHandles[9].transform.localPosition = (handleCentroids[1] + handleCentroids[5]) * 0.5f;
            rotateHandles[10].transform.localPosition = (handleCentroids[2] + handleCentroids[6]) * 0.5f;
            rotateHandles[11].transform.localPosition = (handleCentroids[3] + handleCentroids[7]) * 0.5f;
        }

        private void ParentHandles()
        {
            transformRig.transform.position = boxInstance.transform.position;
            transformRig.transform.rotation = boxInstance.transform.rotation;

            Vector3 invScale = objectToBound.transform.localScale;

            transformRig.transform.localScale = new Vector3(0.5f / invScale.x, 0.5f / invScale.y, 0.5f / invScale.z);
            transformRig.transform.parent = objectToBound.transform;
        }

        private void UpdateHandles()
        {
            UpdateCornerHandles();
            UpdateRotateHandles();
        }

        private void ClearCornerHandles()
        {
            if (cornerHandles != null)
            {
                for (int i = 0; i < cornerHandles.Length; ++i)
                {
                    GameObject.Destroy(cornerHandles[i]);
                }
                cornerHandles = null;
                handleCentroids = null;
            }

            cornerHandles = null;
            handleCentroids = null;
        }

        private void ClearRotateHandles()
        {
            if (rotateHandles != null && rotateHandles.Length > 0 && rotateHandles[0] != null)
            {
                for (int i = 0; i < rotateHandles.Length; ++i)
                {
                    if (rotateHandles[i] != null)
                    {
                        Destroy(rotateHandles[i]);
                        rotateHandles[i] = null;
                    }
                }
            }

            rotateHandles = null;
        }

        private void ClearHandles()
        {
            ClearCornerHandles();
            ClearRotateHandles();
        }

        private GameObject BuildRig()
        {
            Vector3 scale = objectToBound.transform.localScale;

            GameObject rig = new GameObject();
            rig.name = "center";
            rig.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
            rig.transform.localScale = new Vector3(1.0f / scale.x, 1.0f / scale.y, 1.0f / scale.z);

            GameObject upperLeftFront = new GameObject();
            upperLeftFront.name = "upperleftfront";
            upperLeftFront.transform.SetPositionAndRotation(new Vector3(0.5f, 0.5f, 0.5f), Quaternion.identity);
            upperLeftFront.transform.localScale = new Vector3(1, 1, 1);
            upperLeftFront.transform.parent = rig.transform;

            GameObject upperLeftBack = new GameObject();
            upperLeftBack.name = "upperleftback";
            upperLeftBack.transform.SetPositionAndRotation(new Vector3(0.5f, 0.5f, -0.5f), Quaternion.identity);
            upperLeftBack.transform.localScale = new Vector3(1, 1, 1);
            upperLeftBack.transform.parent = rig.transform;

            GameObject lowerLeftFront = new GameObject();
            lowerLeftFront.name = "lowerleftfront";
            lowerLeftFront.transform.SetPositionAndRotation(new Vector3(0.5f, -0.5f, 0.5f), Quaternion.identity);
            lowerLeftFront.transform.localScale = new Vector3(1, 1, 1);
            lowerLeftFront.transform.parent = rig.transform;

            GameObject lowerLeftBack = new GameObject();
            lowerLeftBack.name = "lowerleftback";
            lowerLeftBack.transform.SetPositionAndRotation(new Vector3(0.5f, -0.5f, -0.5f), Quaternion.identity);
            lowerLeftBack.transform.localScale = new Vector3(1, 1, 1);
            lowerLeftBack.transform.parent = rig.transform;

            GameObject upperRightFront = new GameObject();
            upperRightFront.name = "upperrightfront";
            upperRightFront.transform.SetPositionAndRotation(new Vector3(-0.5f, 0.5f, 0.5f), Quaternion.identity);
            upperRightFront.transform.localScale = new Vector3(1, 1, 1);
            upperRightFront.transform.parent = rig.transform;

            GameObject upperRightBack = new GameObject();
            upperRightBack.name = "upperrightback";
            upperRightBack.transform.SetPositionAndRotation(new Vector3(-0.5f, 0.5f, -0.5f), Quaternion.identity);
            upperRightBack.transform.localScale = new Vector3(1, 1, 1);
            upperRightBack.transform.parent = rig.transform;

            GameObject lowerRightFront = new GameObject();
            lowerRightFront.name = "lowerrightfront";
            lowerRightFront.transform.SetPositionAndRotation(new Vector3(-0.5f, -0.5f, 0.5f), Quaternion.identity);
            lowerRightFront.transform.localScale = new Vector3(1, 1, 1);
            lowerRightFront.transform.parent = rig.transform;

            GameObject lowerRightBack = new GameObject();
            lowerRightBack.name = "lowerrightback";
            lowerRightBack.transform.SetPositionAndRotation(new Vector3(-0.5f, -0.5f, -0.5f), Quaternion.identity);
            lowerRightBack.transform.localScale = new Vector3(1, 1, 1);
            lowerRightBack.transform.parent = rig.transform;

            transformRig = rig;

            return rig;
        }

        private bool ShowRig
        {
            get
            {
                return showRig;
            }
            set
            {
                if (destroying == false)
                {
                    if (value == true)
                    {
                        UpdateBoundsPoints();
                        UpdateHandles();
                    }

                    if (boxInstance != null)
                    {
                        boxInstance.IsVisible = value;
                    }

                    if (cornerHandles != null && rotateHandles != null)
                    {
                        foreach (GameObject handle in cornerHandles)
                        {
                            handle.SetActive(value);
                        }
                        foreach (GameObject handle in rotateHandles)
                        {
                            handle.SetActive(value);
                        }
                    }

                    showRig = value;
                }
            }
        }

        private List<Vector3> GetBounds()
        {
            if (objectToBound != null)
            {
                List<Vector3> bounds = new List<Vector3>();
                LayerMask mask = new LayerMask();

                GameObject clone = GameObject.Instantiate(boxInstance.gameObject);
                clone.transform.localRotation = Quaternion.identity;
                clone.transform.position = Vector3.zero;
                BoundingBox.GetMeshFilterBoundsPoints(clone, bounds, mask);
                Vector3 centroid = boxInstance.TargetBoundsCenter;
                GameObject.Destroy(clone);
                Matrix4x4 m = Matrix4x4.Rotate(objectToBound.transform.rotation);
                for (int i = 0; i < bounds.Count; ++i)
                {
                    bounds[i] = m.MultiplyPoint(bounds[i]);
                    bounds[i] += boxInstance.TargetBoundsCenter;
                }

                return bounds;
            }

            return null;
        }

        private BoundingBox.FlattenModeEnum GetBestAxisToFlatten()
        {
            int index = handleCentroids.Count - 8;
            float width = (handleCentroids[index + 0] - handleCentroids[index + 4]).magnitude;
            float height = (handleCentroids[index + 0] - handleCentroids[index + 2]).magnitude;
            float depth = (handleCentroids[index + 0] - handleCentroids[index + 1]).magnitude;

            if (width < height && width < depth)
            {
                return BoundingBox.FlattenModeEnum.FlattenX;
            }
            else if (height < width && height < depth)
            {
                return BoundingBox.FlattenModeEnum.FlattenY;
            }
            else if (depth < height && depth < width)
            {
                return BoundingBox.FlattenModeEnum.FlattenZ;
            }

            return BoundingBox.FlattenModeEnum.DoNotFlatten;
        }
    }
}


text:
import datetime
import logging
import os
import os.path
import urlparse
import sys
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn

from libs import scraper
from libs import daemon

def touch(path):
  with open(path, 'a'):
    os.utime(path, None)

class Daemon(daemon.MasterDaemon):
  def run(self):
    try:
      HOST = ''
      PORT = 6969
      server = ThreadedHTTPServer((HOST, PORT), Handler)
      global s
      s = scraper.Scraper()
      server.serve_forever()
      raise Exception
    except (KeyboardInterrupt, Exception):
      self.logger.exception('Excepcion en run. Exiting...')
      self.stop()

class Handler(BaseHTTPRequestHandler):
  def log_message(self, sformat, *args):
    self.server.logger.info(sformat % args)

  def do_GET(self):
    p = urlparse.urlparse(self.path)
    if p.path == '/transantiago/api':
      self.server.logger.debug('query aceptada')
      self.send_response(200)
      self.end_headers()
      self.server.logger.debug('headers enviados')
      param = dict(urlparse.parse_qsl(p.query))
      self.server.logger.info('Agregando query a consulta')
      init_time = datetime.datetime.now()
      response = s.scrap(param['pid'])
      end_time = datetime.datetime.now()
      totdur = end_time - init_time
      self.wfile.write(response)
      self.server.logger.info('%s [OK] Completado en %f segundos' % \
              (param['pid'], totdur.total_seconds()))
    else:
      self.send_response(404)
      self.end_headers()
      self.wfile.write('0')

class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
    """Handle requests in a separate thread."""
    def __init__(self, *args, **kwargs):
        self.logger = logging.getLogger('server.handler')
        HTTPServer.__init__(self, *args, **kwargs)

if __name__ == '__main__':
  devnull = os.devnull
  daemon = Daemon(devnull, 'log/stdout.log', 'log/stderr.log')
  if len(sys.argv) == 2:
    if 'start' == sys.argv[1]:
      paths = ['log/service.log', 'log/stdout.log', 'log/stderr.log']
      for p in paths:
        if not os.path.isfile('log/service.log'):
          touch('log/service.log')
      #set conf here because os.chdir generates an error
      logging.basicConfig(
        level=logging.DEBUG,
        format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
        datefmt='%m-%d %H:%M',
        filename='log/service.log',
        filemode='a')
      daemon.start()
    elif 'stop' == sys.argv[1]:
      daemon.stop()
    elif 'restart' == sys.argv[1]:
      daemon.restart()
    else:
      print "Unknown command"
      sys.exit(2)
    sys.exit(0)
  else:
    print "usage: %s start|stop|restart" % sys.argv[0]
    sys.exit(2)

redpajama_set_name: RedPajamaGithub


text:
/*
 * Created by SharpDevelop.
 * User: Charles Weld
 * Date: 4/22/2011
 * Time: 10:05 AM
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Linq;

using Airion.Persist.Provider;
using Airion.Persist.Tests.Support.Domain;
using ConfOrm;
using ConfOrm.NH;
using ConfOrm.Patterns;
using NHibernate.Cfg.MappingSchema;

namespace Airion.Persist.Tests.Support
{
	/// <summary>
	/// Description of DomainMapping.
	/// </summary>
	public class DomainMapping : IDomainMapping
	{
		public DomainMapping()
		{
		}

		public void DomainDefinition(ObjectRelationalMapper orm)
		{
			orm.TablePerClass<Person>();
			orm.Patterns.PoidStrategies.Add(new GuidPoidPattern());
		}

		public void RegisterPatterns(Mapper mapper)
		{

		}

		public void Customize(Mapper mapper)
		{

		}
		public IEnumerable<Type> GetEntities()
		{
			return new Type[] { typeof(Person) };
		}
	}
}


text:
const path = require('path');
const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default;

function pickerGenerator(module) {
  const tester = new RegExp(`^docs/${module}`);
  return (markdownData) => {
    const filename = markdownData.meta.filename;
    if (tester.test(filename) &&
        !/\/demo$/.test(path.dirname(filename))) {
      return {
        meta: markdownData.meta,
      };
    }
  };
}

module.exports = {
  port: 8001,
  source: [
    './components',
    './docs',
    'CHANGELOG.zh-CN.md', // TODO: fix it in bisheng
    'CHANGELOG.en-US.md',
  ],
  lazyLoad(nodePath, nodeValue) {
    if (typeof nodeValue === 'string') {
      return true;
    }
    return nodePath.endsWith('/demo');
  },
  pick: {
    components(markdownData) {
      const filename = markdownData.meta.filename;
      if (!/^components/.test(filename) ||
          /\/demo$/.test(path.dirname(filename))) return;

      return {
        meta: markdownData.meta,
      };
    },
    changelog(markdownData) {
      if (/CHANGELOG/.test(markdownData.meta.filename)) {
        return {
          meta: markdownData.meta,
        };
      }
    },
    'docs/pattern': pickerGenerator('pattern'),
    'docs/practice': pickerGenerator('practice'),
    'docs/react': pickerGenerator('react'),
    'docs/resource': pickerGenerator('resource'),
    'docs/spec': pickerGenerator('spec'),
  },
  theme: './site/theme',
  htmlTemplate: './site/theme/static/template.html',
  plugins: [
    'bisheng-plugin-description',
    'bisheng-plugin-toc?maxDepth=2&keepElem',
    'bisheng-plugin-react?lang=__react',
    'bisheng-plugin-antd',
  ],
  doraConfig: {
    verbose: true,
    plugins: ['dora-plugin-upload'],
  },
  webpackConfig(config) {
    config.resolve.alias = {
      'antd/lib': path.join(process.cwd(), 'components'),
      antd: process.cwd(),
      site: path.join(process.cwd(), 'site'),
      'react-router': 'react-router/umd/ReactRouter',
    };
    config.plugins.push(new CSSSplitWebpackPlugin({ preserve: true }));

    config.babel.plugins.push([
      require.resolve('babel-plugin-transform-runtime'),
      {
        polyfill: false,
        regenerator: true,
      },
    ]);

    config.babel.plugins.push([
      require.resolve('babel-plugin-import'),
      {
        style: true,
        libraryName: 'antd',
        libraryDirectory: 'components',
      },
    ]);

    return config;
  },
};


text:
<?php

namespace ionmvc\packages\image\libraries;

class image extends \ionmvc\packages\image\classes\image {}

?>


text:
package util

import (
	"crypto/sha256"
	"crypto/sha512"
	"encoding/hex"
	"errors"
	"fmt"
	"hash"
	"strings"

	"github.com/coreos/ignition/v2/config/v3_4_experimental/types"
)

var (
	ErrHashMalformed    = errors.New("malformed hash specifier")
	ErrHashUnrecognized = errors.New("unrecognized hash function")
)

// ErrHashMismatch is returned when the calculated hash for a fetched object
// doesn't match the expected sum of the object.
type ErrHashMismatch struct {
	Calculated string
	Expected   string
}

func (e ErrHashMismatch) Error() string {
	return fmt.Sprintf("hash verification failed (calculated %s but expected %s)",
		e.Calculated, e.Expected)
}

// HashParts will return the sum and function (in that order) of the hash stored
// in this Verification, or an error if there is an issue during parsing.
func HashParts(v types.Verification) (string, string, error) {
	if v.Hash == nil {
		// The hash can be nil
		return "", "", nil
	}
	parts := strings.SplitN(*v.Hash, "-", 2)
	if len(parts) != 2 {
		return "", "", ErrHashMalformed
	}

	return parts[0], parts[1], nil
}

func AssertValid(verify types.Verification, data []byte) error {
	if hash := verify.Hash; hash != nil {
		hashFunc, hashSum, err := HashParts(verify)
		if err != nil {
			return err
		}

		var sum []byte
		switch hashFunc {
		case "sha512":
			rawSum := sha512.Sum512(data)
			sum = rawSum[:]
		case "sha256":
			rawSum := sha256.Sum256(data)
			sum = rawSum[:]
		default:
			return ErrHashUnrecognized
		}

		encodedSum := make([]byte, hex.EncodedLen(len(sum)))
		hex.Encode(encodedSum, sum)
		if string(encodedSum) != hashSum {
			return ErrHashMismatch{
				Calculated: string(encodedSum),
				Expected:   hashSum,
			}
		}
	}

	return nil
}

func GetHasher(verify types.Verification) (hash.Hash, error) {
	if verify.Hash == nil {
		return nil, nil
	}

	function, _, err := HashParts(verify)
	if err != nil {
		return nil, err
	}

	switch function {
	case "sha512":
		return sha512.New(), nil
	case "sha256":
		return sha256.New(), nil
	default:
		return nil, ErrHashUnrecognized
	}
}


text:
<?php

namespace LearnZF2Themes\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

/**
 * @author Stanimir Dimitrov <stanimirdim92@gmail.com>
 */
class IndexController extends AbstractActionController
{
    /**
     * @var array
     */
    private $themesConfig = [];

    /**
     * @var mixed
     */
    private $reloadService = null;

    /**
     * @method __construct
     *
     * @param array $themesConfig
     * @param mixed $reloadService
     */
    public function __construct(array $themesConfig = [], $reloadService)
    {
        $this->themesConfig = $themesConfig;
        $this->reloadService = $reloadService;
    }

    /**
     * This action shows the list of all themes.
     *
     * @method indexAction
     *
     * @return ViewModel
     */
    public function indexAction()
    {
        $request = $this->getRequest();
        if ($request->isPost()) {
            $filename = __DIR__.'/../../../config/module.config.php';
            $settings = include $filename;
            $themeName = $request->getPost()['themeName'];
            $settings['theme']['name'] = $themeName;
            file_put_contents($filename, '<?php return '.var_export($settings, true).';');
            $this->reloadService->reload();
        }

        return new ViewModel([
            'themes' => $this->themesConfig,
        ]);
    }
}


text:
title: Devotions
subtitle: Devotional Blog
layout: default
modal-id: 2
date: 2014-07-17
img: notes.jpg
thumbnail: notes-thumbnail.jpg
alt: image-alt
project-date:
description: A place for for devotions.

---


text:
using System;
using System.IO;

namespace PowerLib.System.IO
{
	public class StreamWriteException : Exception
	{
    private int _total;

    public StreamWriteException(int total, Exception exception)
      : this(exception.Message, total, exception)
    {
    }

    public StreamWriteException(string message, int total, Exception exception)
			: base(message, exception)
		{
      _total = total;
		}

    public int Total
    {
      get { return _total; }
    }
	}
}


text:
package idx.contacts.api.model;

import idx.contacts.api.converter.LocalDateXMLAdapter;
import idx.contacts.api.converter.PeriodXMLAdapter;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.Period;

@XmlRootElement
public class Person implements Serializable {

    private Long id;
    private String firstName;
    private String lastName;
    private Gender gender;
    private LocalDate dateOfBirth;

    public Person() {
        //
    }

    public Person(String firstName, String lastName, Gender gender, LocalDate dateOfBirth) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.gender = gender;
        this.dateOfBirth = dateOfBirth;
    }

    @XmlElement(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @XmlElement(name = "first_name")
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @XmlElement(name = "last_name")
    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @XmlElement(name = "gender")
    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    @XmlElement(name = "birth_date")
    @XmlJavaTypeAdapter(LocalDateXMLAdapter.class)
    public LocalDate getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(LocalDate dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + "#" + id;
    }
}


text:
<?php
if ( ! defined( 'ABSPATH' ) ) {
        exit; // Exit if accessed directly
}

/**
 * TinyMCE Shortcode Integration
 */
if ( !class_exists('Animate_TinyMCE') ) {

class Animate_TinyMCE {

	function __construct() {
		// Init
                add_action( 'admin_init', array( $this, 'init' ) );

                // wp_ajax_... is only run for logged users.
                add_action( 'wp_ajax_animate_check_url_action', array( $this, 'ajax_action_check_url' ) );
                add_action( 'wp_ajax_animate_nonce', array( $this, 'ajax_action_generate_nonce' ) );

                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 99 );

                // Output the markup in the footer.
                add_action( 'admin_footer', array( $this, 'output_dialog_markup' ) );
	}

	// get everything started
        function init() {
                global $pagenow;

                if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) == 'true' && ( in_array( $pagenow, array( 'post.php', 'post-new.php', 'page-new.php', 'page.php' ) ) ) )  {

                       	// Add the tinyMCE buttons and plugins.
                       	add_filter( 'mce_buttons', array( $this, 'filter_mce_buttons' ) );
                       	add_filter( 'mce_external_plugins', array( $this, 'filter_mce_external_plugins' ) );

                       	wp_enqueue_style( 'animate-tinymce-shortcodes', ANIMATE_URL . 'admin/css/tinymce-shortcodes.css', false, ANIMATE_VERSION, 'all' );

			// main plugin css
	                wp_register_style( 'animate-plugin', ANIMATE_URL.'stylesheets/app.css', array(),  ANIMATE_VERSION, 'all' ) ;
                	wp_enqueue_style( 'animate-plugin' );

	                // main plugin js
        	        wp_register_script( 'animate-plugin',  ANIMATE_URL.'js/app.js', array('jquery'), ANIMATE_VERSION, true );
                	wp_enqueue_script( 'animate-plugin' );

			// admin js
			wp_register_script( 'animate-plugin-admin',  ANIMATE_URL.'admin/js/admin.js', array('jquery'), ANIMATE_VERSION, true );
                        wp_enqueue_script( 'animate-plugin-admin' );

	                add_action( 'in_admin_footer', Array(__CLASS__, 'script_in_footer'), 100 );
                }
        }

	// add new button to the tinyMCE editor
        function filter_mce_buttons( $buttons ) {
	        array_push( $buttons, '|', 'animate_button' );
                return $buttons;
        }

	// add functionality to the tinyMCE editor as an external plugin
        function filter_mce_external_plugins( $plugins ) {
 	       global $wp_version;
               $plugins['ANIMATETinyMCE'] = wp_nonce_url( esc_url( ANIMATE_URL . 'admin/shortcodes/editor.js?v=0.2' ), 'animate-tinymce' );
               return $plugins;
        }

	// checks if a given url (via GET or POST) exists
        function ajax_action_check_url() {
	        $hadError = true;
                $url = isset( $_REQUEST['url'] ) ? $_REQUEST['url'] : '';
                if ( strlen( $url ) > 0  && function_exists( 'get_headers' ) ) {
		        $url = esc_url( $url );
                        $file_headers = @get_headers( $url );
                        $exists = $file_headers && $file_headers[0] != 'HTTP/1.1 404 Not Found';
                        $hadError = false;
                }
                echo '{ "exists": '. ($exists ? '1' : '0') . ($hadError ? ', "error" : 1 ' : '') . ' }';
                die();
        }

	// generate a nonce
        function ajax_action_generate_nonce() {
	        echo wp_create_nonce( 'animate-tinymce' );
                die();
        }

        function enqueue_scripts() {
	        wp_register_script( 'animate-tinymce-dialog-script', plugins_url( 'admin/shortcodes/dialog.js', __FILE__ ), array( 'jquery' ), ANIMATE_VERSION, true );
                wp_enqueue_script( 'animate-tinymce-dialog-script' );
                $plugin_data = array(
         	       	'url' => ANIMATE_URL,
			'error_loading_details_for_shortcode' => __('Error loading details for shortcode', 'animate'),
			'animation_style_label' => __('Animation Style','animate'),
			'duration_label' => __('Duration','animate'),
			'duration_help' => __('Animation duration in seconds. (e.g. 0.15)','animate'),
			'delay_label' => __('Delay','animate'),
			'delay_help' => __('Delay before the animation starts in seconds. (e.g. 0.5)','animate'),
			'offset_label' => __('Offset','animate'),
			'offset_help' => __('Distance to start the animation in pixels (related to the browser bottom). (e.g. 10)','animate'),
			'iteration_label' => __('Iteration','animate'),
			'iteration_help' => __('Number of times the animation is repeated. (e.g. 5)','animate'),
			'animate_infinitely_label' => __('Animate Infinitely','animate'),
			'custom_class_label' => __('Custom Class','animate'),
			'custom_class_help' => __('Any CSS classes you want to add.','animate')
                );
	        wp_localize_script( 'animate-tinymce-dialog-script', 'animate_plugin_data', $plugin_data );
        }

        // Output the HTML markup for the dialog box.
        function output_dialog_markup () {
	        // URL to TinyMCE plugin folder
                $plugin_url = ANIMATE_URL . '/includes/shortcodes/'; ?>

                               <input type="button" id="animatedialog-cancel-button" class="button alignleft" name="cancel" value="<?php _e('Cancel', 'animate') ?>" accesskey="C" />
                 	       <input type="button" id="animatedialog-insert-button" class="button-primary alignright" name="insert" value="<?php _e('Insert', 'animate') ?>" accesskey="I" />

<img src='<?php echo ANIMATE_URL ;?>images/round200x200.png' width='200' height='200' alt=''>

				<button><?php _e('Animate it', 'animate'); ?></button>

<?php _e('Shortcode Options', 'animate') ?>

                                <input type="hidden" id="animatedialog-selected-shortcode" value="">

        <?php }

	public static function script_in_footer(){
                $code = "";
                echo $code;
        }
}
}


text:
#ifndef __MPOTOOLS_COMMON_H
#define __MPOTOOLS_COMMON_H

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "writers.h"

struct binary_s {
    size_t size;
    size_t offset;
    unsigned char data[];
};
typedef struct binary_s binary_t;

int get_bytes_per_tag_value(uint16_t tag_type,    // TAG_TYPE_*
                            uint32_t tag_count);

char *read_entire_file(FILE *fp, size_t unit, size_t *bytes_read);

#define ERROR(...) { printf( "ERROR: " __VA_ARGS__); return; }
#define WARNING(...) { printf( "WARNING: " __VA_ARGS__); }

#define min(a, b) (((a)>(b))?(b):(a))
#define max(a, b) (((a)<(b))?(b):(a))

#define FOR_CHILDREN(variable, parent) mxml_node_t *variable = parent->child; \
                                       for( ; variable != NULL; variable = variable -> next)
#define IS_ELEMENT(node, namep) ((node->type == MXML_ELEMENT) && (strcmp(node->value.element.name, namep)==0))
#define IS_ELEMENT_ATTR(node, attrname, attrvalue) ((node->type == MXML_ELEMENT) && (mxmlElementGetAttr(node, attrname)!=NULL) && (strcmp(mxmlElementGetAttr(node, attrname), attrvalue)==0))
#define IS_ELEMENT_ATTR_NULL(node, attrname) ((node->type == MXML_ELEMENT) && (mxmlElementGetAttr(node, attrname)==NULL))
#define ERROR_DUMPNODE(node, ...) { printf( "ERROR: " __VA_ARGS__);                                      \
                                    if (node->type==MXML_ELEMENT) {                                      \
                                        printf(" (current element: %s)\n", node->value.element.name);    \
                                    } else if (node->type==MXML_TEXT) {                                  \
                                        printf(" (current string node: %s)\n", node->value.text.string); \
                                    } else if (node->type==MXML_OPAQUE) {                                \
                                        printf(" (current opaque node: %s)\n", node->value.opaque);      \
                                    } else if (node->type==MXML_INTEGER) {                               \
                                        printf(" (current integer node: %d)\n", node->value.integer);    \
                                    } else if (node->type==MXML_CUSTOM) {                                \
                                        printf(" (I found a custom node)\n");                            \
                                    } else printf(" (node type: %d)\n", node->type);                     \
                                    return;                                                              \
                                  }

#define CONCP(dest, pat, s, ...) {                   \
    int maxb = strlen(pat) + strlen(s) + 1 + 10;     \
    (dest) = (char *) malloc(maxb);                  \
    snprintf((dest), maxb, (pat), (s), __VA_ARGS__); \
}
#define CONCS(dest, a, b) {                    \
    int maxb = strlen(a) + strlen(b) + 1 + 1;  \
    (dest) = (char *) malloc(maxb);            \
    snprintf((dest), maxb, "%s/%s", a, b);     \
}

typedef struct pointer_s {
    enum pointertype_e {
        p_writer,
        p_memory
    } type;
    union pointer_u {
        struct writer_and_pos_s {
            writer_t *writer;
            size_t pos;
        } writer;
        void *memory;
    } value;
} pointer_t;

void set_pointer(pointer_t *pointer, uint32_t set_to, int le);
pointer_t *mem_pointer(void *p);
pointer_t *writer_pointer(writer_t *wr, size_t pos);

void write_uint32(void *dest, uint32_t value, int le);
void write_uint16(void *dest, uint16_t value, int le);

typedef struct name_and_offset_s {
	char *full_name;
	int offset;
} name_and_offset_t;

typedef struct data_object_s {
    char *full_name;    // full name of the object
    int written;        // has it been written to an outside storage?
    pointer_t *pointer; // where is the pointer that points to this data object? (the parent)
    size_t size;        // number of bytes in buffer
    void *buffer;       // the in-memory buffer that stores the given data.
    int nr_my_offsets;
    name_and_offset_t *my_offsets; // will contain later-modifiable data offsets
    int nr_my_pointers;
    pointer_t *my_pointers[]; // these are the pointers in the data object to other children
} data_object_t;

void add_offset(data_object_t *o, char *full_name, int offset);

#define STORE_OBJECT(objdb, object) objdb->writebytes(objdb, &object, sizeof(data_object_t *))
#define FREE_OBJECT(object) {      \
        free((object)->buffer);    \
        free((object)->full_name); \
        free((object)->pointer);   \
        free((object));            \
        while ((object)->nr_my_offsets>0) {  \
            (object)->nr_my_offsets --;      \
            free((object)->my_offsets[(object)->nr_my_offsets].full_name); \
        } \
        }

#endif


text:
<link rel="shortcut icon"  href="/favicon.ico"/><title>Eastern District of New York - LIVE Database 1.7 (Revision 1.7.1)</title>
<link rel="stylesheet" type="text/css" href="/css/default.css">

Document Selection Menu

<big>Multiple Documents</big>

To view the main document and its attachments without incurring a PACER fee,
				click on the hyperlinks displayed on this menu.  You may incur a PACER fee
				to view CM/ECF documents from hyperlinks within the documents.

Select the document you wish to view.

			<form>

				Document Number:
				<input type="checkbox" name="document_16_0" onchange="update_sizes(this)" autocomplete="off" value="19137279-205962-4" />
				16
				4 pages
				201.1 KB

				Attachment
				Description
				Pages
				Size

				<input type="checkbox" name="document_16_1" onchange="update_sizes(this)" autocomplete="off" value="19137280-175910-3" />
				1
				Proposed Order Proposed Case Management Plan (as discussed in the letter)
				3 pages
				171.8 KB

				<input type="checkbox" name="document_16_2" onchange="update_sizes(this)" autocomplete="off" value="19137281-193288-3" />
				2
				Exhibit Ex 1 - Sample Coordination Order
				3 pages
				188.8 KB

				<input type="checkbox" name="document_16_3" onchange="update_sizes(this)" autocomplete="off" value="19137282-48143-2" />
				3
				Exhibit Ex 2 - Order in Britvec and Casablanca
				2 pages
				47.0 KB

				<input type="checkbox" name="document_16_4" onchange="update_sizes(this)" autocomplete="off" value="19137283-158761-2" />
				4
				Exhibit Ex 3 - Order 1 (Dkt 14) in Rodriguez
				2 pages
				155.0 KB

				<input type="checkbox" name="document_16_5" onchange="update_sizes(this)" autocomplete="off" value="19137284-118437-2" />
				5
				Exhibit Ex 4 - Order 2 (Dkt 17) in Rodriguez
				2 pages
				115.7 KB

				<input type="checkbox" name="document_16_6" onchange="update_sizes(this)" autocomplete="off" value="19137285-455957-3" />
				6
				Exhibit Ex 5 - Order in Hernandez
				3 pages
				445.3 KB

				<input type="checkbox" name="document_16_7" onchange="update_sizes(this)" autocomplete="off" value="19137286-193288-3" />
				7
				Exhibit Ex 6 - Order in Sukana
				3 pages
				188.8 KB

				<input type="checkbox" name="document_16_8" onchange="update_sizes(this)" autocomplete="off" value="19137287-128211-2" />
				8
				Exhibit Ex 7 - Order in Sharma
				2 pages
				125.2 KB

				<input type="checkbox" name="document_16_9" onchange="update_sizes(this)" autocomplete="off" value="19137288-81423-1" />
				9
				Exhibit Ex 8 - Order in Margolies
				1 page
				79.5 KB


text:
using System;

namespace git.jedinja.monomyo.SDK.Notifications
{
	public class NotificationAutoConfigurableValues
	{
		public EmgMode Emg  { get; private set; }
		public ImuMode Imu  { get; private set; }
		public MyoPoseMode Pose  { get; private set; }

		public NotificationAutoConfigurableValues (EmgMode emg, ImuMode imu, MyoPoseMode pose)
		{
			this.Emg = emg;
			this.Imu = imu;
			this.Pose = pose;
		}

		public static NotificationAutoConfigurableValues All {
			get {
				return new NotificationAutoConfigurableValues (EmgMode.Send, ImuMode.SendAll, MyoPoseMode.Enabled);
			}
		}

		public static NotificationAutoConfigurableValues PoseOnly {
			get {
				return new NotificationAutoConfigurableValues (EmgMode.None, ImuMode.None, MyoPoseMode.Enabled);
			}
		}
	}
}


text:
from .. import var, ini
from .. import simpledb

# This command uses a database.
def ins_db ():
    global access_db, rm_entry
    global mod_entry

    var.data["gits"] = ini.fill_dict("gits.ini", "Gits")

    # Pick first and only element in list.
    for entry in var.data["gits"]:
        var.data["gits"][entry] = var.data["gits"][entry][0]

    namespace = simpledb.namespace(
        string_dictionary = var.data["gits"],
        dictionary_name   = "git",
        section_name      = "Gits",
        filename          = "gits.ini"
    )

    access_db = namespace.access_function
    mod_entry = namespace.modify_function
    rm_entry  = namespace.remove_function

# Fill commands dictionary.
def ins_command ():
    var.commands["git"] = type("command", (object,), {})()
    var.commands["git"].method = read
    var.commands["git"].tags = ["databases", "simpledb"]
    var.commands["git"].aliases = [".git"]
    var.commands["git"].usage = [line.format("{}", n="git") \
                                    for line in simpledb.command_usage]

# Grab ident function from simpledb.
ident = simpledb.ident

# Command method.
def read (user, channel, word):
    if len(word) > 2 and word[1] in simpledb.mod_strings:
        mod_entry(user, channel, word)
    elif len(word) > 1 and word[1] in simpledb.del_strings:
        rm_entry(user, channel, word)
    else:
        access_db(user, channel, word)

# Functions filled by ins_db(). Start as None.
access_db = None
mod_entry = None
rm_entry = None


text:
package org.apache.arrow.memory;

/**
 * Manages a list of {@link ArrowBuf}s that can be reallocated as needed. Upon
 * re-allocation the old buffer will be freed. Managing a list of these buffers
 * prevents some parts of the system from needing to define a correct location
 * to place the final call to free them.
 */
public interface BufferManager extends AutoCloseable {

  /**
   * Replace an old buffer with a new version at least of the provided size. Does not copy data.
   *
   * @param old     Old Buffer that the user is no longer going to use.
   * @param newSize Size of new replacement buffer.
   * @return A new version of the buffer.
   */
  ArrowBuf replace(ArrowBuf old, long newSize);

  /**
   * Get a managed buffer of indeterminate size.
   *
   * @return A buffer.
   */
  ArrowBuf getManagedBuffer();

  /**
   * Get a managed buffer of at least a certain size.
   *
   * @param size The desired size
   * @return A buffer
   */
  ArrowBuf getManagedBuffer(long size);

  void close();
}


text:
<?php
/* @var $this CommentController */
/* @var $model Comment */
/* @var $form CActiveForm */
?>

<?php $form=$this->beginWidget('CActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>

		<?php echo $form->label($model,'id'); ?>
		<?php echo $form->textField($model,'id'); ?>

		<?php echo $form->label($model,'user_id'); ?>
		<?php echo $form->textField($model,'user_id'); ?>

		<?php echo $form->label($model,'task_id'); ?>
		<?php echo $form->textField($model,'task_id'); ?>

		<?php echo $form->label($model,'created'); ?>
		<?php echo $form->textField($model,'created'); ?>

		<?php echo $form->label($model,'updated'); ?>
		<?php echo $form->textField($model,'updated'); ?>

		<?php echo $form->label($model,'body'); ?>
		<?php echo $form->textArea($model,'body',array('rows'=>6, 'cols'=>50)); ?>

		<?php echo CHtml::submitButton('Search'); ?>

<?php $this->endWidget(); ?>


text:
package question_451;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;

public class Q496_Next_Greater_Element_I {
    public int[] nextGreaterElement(int[] findNums, int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();
        Deque<Integer> stack = new ArrayDeque<>();

        // put 1st element into stack
        stack.addLast(nums[0]);
        for(int i=1; i< nums.length; i++) {
            while(!stack.isEmpty() && stack.peek()<nums[i]) {
                map.put(stack.removeFirst(), nums[i]);
            }
            stack.addFirst(nums[i]);
        }
        while(!stack.isEmpty()) {
        	map.put(stack.removeFirst(), -1);
        }

        for(int i =0; i< findNums.length; i++){
        	findNums[i] = map.get(findNums[i]);
        }

        return findNums;
    }
}


text:
<title>Vector Extensions - Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C-Extensions.html#C-Extensions" title="C Extensions">
<link rel="prev" href="Return-Address.html#Return-Address" title="Return Address">
<link rel="next" href="Offsetof.html#Offsetof" title="Offsetof">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Offsetof,
Previous: Return Address,
Up: C Extensions

6.49 Using Vector Instructions through Built-in Functions

On some targets, the instruction set contains SIMD vector instructions which
operate on multiple values contained in one large register at the same time.
For example, on the i386 the MMX, 3DNow! and SSE extensions can be used
this way.

The first step in using these extensions is to provide the necessary data
types.  This should be done using an appropriate typedef:

     typedef int v4si __attribute__ ((vector_size (16)));

The int type specifies the base type, while the attribute specifies
the vector size for the variable, measured in bytes.  For example, the
declaration above causes the compiler to set the mode for the v4si
type to be 16 bytes wide and divided into int sized units.  For
a 32-bit int this means a vector of 4 units of 4 bytes, and the
corresponding mode of foo is <acronym>V4SI</acronym>.

The vector_size attribute is only applicable to integral and
float scalars, although arrays, pointers, and function return values
are allowed in conjunction with this construct. Only sizes that are
a power of two are currently allowed.

All the basic integer types can be used as base types, both as signed
and as unsigned: char, short, int, long,
long long.  In addition, float and double can be
used to build floating-point vector types.

Specifying a combination that is not valid for the current architecture
causes GCC to synthesize the instructions using a narrower mode.
For example, if you specify a variable of type V4SI and your
architecture does not allow for this specific SIMD type, GCC
produces code that uses 4 SIs.

The types defined in this manner can be used with a subset of normal C
operations.  Currently, GCC allows using the following operators
on these types: +, -, *, /, unary minus, ^, |, &, ~, %.

The operations behave like C++ valarrays.  Addition is defined as
the addition of the corresponding elements of the operands.  For
example, in the code below, each of the 4 elements in <var>a</var> is
added to the corresponding 4 elements in <var>b</var> and the resulting
vector is stored in <var>c</var>.

     typedef int v4si __attribute__ ((vector_size (16)));

     v4si a, b, c;

     c = a + b;

Subtraction, multiplication, division, and the logical operations
operate in a similar manner.  Likewise, the result of using the unary
minus or complement operators on a vector type is a vector whose
elements are the negative or complemented values of the corresponding
elements in the operand.

It is possible to use shifting operators <<, >> on
integer-type vectors. The operation is defined as following: {a0,
a1, ..., an} >> {b0, b1, ..., bn} == {a0 >> b0, a1 >> b1,
..., an >> bn}. Vector operands must have the same number of
elements.

For convenience, it is allowed to use a binary vector operation
where one operand is a scalar. In that case the compiler transforms
the scalar operand into a vector where each element is the scalar from
the operation. The transformation happens only if the scalar could be
safely converted to the vector-element type.
Consider the following code.

     typedef int v4si __attribute__ ((vector_size (16)));

     v4si a, b, c;
     long l;

     a = b + 1;    /* a = b + {1,1,1,1}; */
     a = 2 * b;    /* a = {2,2,2,2} * b; */

     a = l + a;    /* Error, cannot convert long to int. */

Vectors can be subscripted as if the vector were an array with
the same number of elements and base type.  Out of bound accesses
invoke undefined behavior at run time.  Warnings for out of bound
accesses for vector subscription can be enabled with
<samp>-Warray-bounds</samp>.

Vector comparison is supported with standard comparison
operators: ==, !=, <, <=, >, >=. Comparison operands can be
vector expressions of integer-type or real-type. Comparison between
integer-type vectors and real-type vectors are not supported.  The
result of the comparison is a vector of the same width and number of
elements as the comparison operands with a signed integral element
type.

Vectors are compared element-wise producing 0 when comparison is false
and -1 (constant of the appropriate type where all bits are set)
otherwise. Consider the following example.

     typedef int v4si __attribute__ ((vector_size (16)));

     v4si a = {1,2,3,4};
     v4si b = {3,2,1,4};
     v4si c;

     c = a >  b;     /* The result would be {0, 0,-1, 0}  */
     c = a == b;     /* The result would be {0,-1, 0,-1}  */

In C++, the ternary operator ?: is available. a?b:c, where
b and c are vectors of the same type and a is an
integer vector with the same number of elements of the same size as b
and c, computes all three arguments and creates a vector
{a[0]?b[0]:c[0], a[1]?b[1]:c[1], ...}.  Note that unlike in
OpenCL, a is thus interpreted as a != 0 and not a < 0.
As in the case of binary operations, this syntax is also accepted when
one of b or c is a scalar that is then transformed into a
vector. If both b and c are scalars and the type of
true?b:c has the same size as the element type of a, then
b and c are converted to a vector type whose elements have
this type and with the same number of elements as a.

Vector shuffling is available using functions
__builtin_shuffle (vec, mask) and
__builtin_shuffle (vec0, vec1, mask).
Both functions construct a permutation of elements from one or two
vectors and return a vector of the same type as the input vector(s).
The <var>mask</var> is an integral vector with the same width (<var>W</var>)
and element count (<var>N</var>) as the output vector.

The elements of the input vectors are numbered in memory ordering of
<var>vec0</var> beginning at 0 and <var>vec1</var> beginning at <var>N</var>.  The
elements of <var>mask</var> are considered modulo <var>N</var> in the single-operand
case and modulo 2*<var>N</var> in the two-operand case.

Consider the following example,

     typedef int v4si __attribute__ ((vector_size (16)));

     v4si a = {1,2,3,4};
     v4si b = {5,6,7,8};
     v4si mask1 = {0,1,1,3};
     v4si mask2 = {0,4,2,5};
     v4si res;

     res = __builtin_shuffle (a, mask1);       /* res is {1,2,2,4}  */
     res = __builtin_shuffle (a, b, mask2);    /* res is {1,5,3,6}  */

Note that __builtin_shuffle is intentionally semantically
compatible with the OpenCL shuffle and shuffle2 functions.

You can declare variables and use them in function calls and returns, as
well as in assignments and some casts.  You can specify a vector type as
a return type for a function.  Vector types can also be used as function
arguments.  It is possible to cast from one vector type to another,
provided they are of the same size (in fact, you can also cast vectors
to and from other datatypes of the same size).

You cannot operate between vectors of different lengths or different
signedness without a cast.


text:
var config = require('./webpack.config.js');

config.output.filename = 'webstomp.min.js';

module.exports = config;


text:
package de.mickare.xserver.commands.XServerSubCommands;

import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

import de.mickare.xserver.BukkitXServerPlugin;
import de.mickare.xserver.commands.SubCommand;
import de.mickare.xserver.net.XServer;

public class PackageCommand extends SubCommand {

	public PackageCommand(BukkitXServerPlugin plugin) {
		super(plugin, "package", "[Servername]", "Shows package speed to all servers, or the one as given.");
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

		if(args.length > 0) {
			XServer s = getPlugin().getManager().getServer(args[0]);
			if(s == null) {
				sender.sendMessage(ChatColor.RED + "Server \"" + args[0] + "\" not found!");
				return true;
			}

			StringBuilder sb = new StringBuilder();
			appendHeaderLine(sb);
			appendSpeedLine(sb.append("\n"), s);
			sender.sendMessage(sb.toString());

		} else {

			List<XServer> servers = new LinkedList<XServer>(getPlugin().getManager().getServers());

			Collections.sort(servers, new Comparator<XServer>() {
				@Override
				public int compare(XServer o1, XServer o2)
				{
					return o1.getName().compareTo(o2.getName());
				}
			});

			StringBuilder sb = new StringBuilder();
			appendHeaderLine(sb);
			for(XServer s : servers) {
				appendSpeedLine(sb.append("\n"), s);
			}
			sender.sendMessage(sb.toString());
		}

		return true;
	}

	private StringBuilder appendHeaderLine(StringBuilder sb) {
		sb.append(ChatColor.GRAY).append("Packages per second\n")
		.append("Name  ").append("Sending").append(":").append("Receiving").append(" (").append("RecordSending").append(":").append("RecordReceiving").append(")");
		return sb;
	}

	private StringBuilder appendSpeedLine(StringBuilder sb, XServer s) {
		sb.append(s.isConnected() ? ChatColor.GREEN : ChatColor.RED).append(s.getName()).append("  ");

		if (s.isConnected()) {

			sb.append(ChatColor.GOLD).append(s.getSendinglastSecondPackageCount()).append(ChatColor.GRAY).append(":")
					.append(ChatColor.GOLD).append(s.getReceivinglastSecondPackageCount())

					.append(ChatColor.GRAY).append("  (").append(ChatColor.AQUA)
					.append(s.getSendingRecordSecondPackageCount()).append(ChatColor.GRAY).append(":")
					.append(ChatColor.AQUA).append(s.getReceivingRecordSecondPackageCount()).append(ChatColor.GRAY)
					.append(")");
		} else {
			sb.append(ChatColor.GRAY).append(" - not connected!");
		}
		return sb;
	}

}


text:
package brooklyn.location.docker.strategy;

import java.util.List;

import brooklyn.config.ConfigKey;
import brooklyn.entity.Entity;
import brooklyn.entity.container.docker.DockerInfrastructure;
import brooklyn.location.docker.DockerHostLocation;
import brooklyn.location.docker.DockerVirtualLocation;
import brooklyn.util.flags.SetFromFlag;

/**
 * Placement strategy for Docker containers in host clusters.
 */
public interface DockerAwarePlacementStrategy {

    @SetFromFlag("infrastructure")
    ConfigKey<DockerInfrastructure> DOCKER_INFRASTRUCTURE = DockerVirtualLocation.INFRASTRUCTURE;

    DockerInfrastructure getDockerInfrastructure();

    /**
     * Filters a list of {@link DockerHostLocation locations} to determine if the given {@link Entity} can be
     * deployed into a new container there.
     */
    List<DockerHostLocation> filterLocations(List<DockerHostLocation> locations, Entity context);

}


text:
package org.avantssar.aslan.xml;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.jar.Attributes.Name;

import javax.jws.WebService;

import org.avantssar.aslan.ASLanErrorMessages;
import org.avantssar.aslan.ASLanSpecificationBuilder;
import org.avantssar.aslan.IASLanSpec;
import org.avantssar.aslan.IASLanSpecificationBuilder;
import org.avantssar.aslan.ISymbolsProvider;
import org.avantssar.commons.ErrorGatherer;
import org.avantssar.commons.Utils;

@WebService(endpointInterface = "org.avantssar.aslan.xml.ASLanXMLConverter")
public class ASLanXMLConverterImpl implements ASLanXMLConverter {

	private String title;
	private String version;
	private String vendor;
	private String titleLine;

	private final IASLanSpecificationBuilder builder;
	private final ISymbolsProvider[] extraDefaults;

	public ASLanXMLConverterImpl(ISymbolsProvider... extraDefaults) {
		loadTitleVersionAndVendor();
		builder = ASLanSpecificationBuilder.instance();
		this.extraDefaults = extraDefaults;
	}

	public String getTitle() {
		return title;
	}

	public String getVersion() {
		return version;
	}

	public String getVendor() {
		return vendor;
	}

	public String getFullTitleLine() {
		return titleLine;
	}

	@Override
	public ConverterOutput aslan2xml(String aslan) {
		ErrorGatherer err = new ErrorGatherer(ASLanErrorMessages.DEFAULT);
		IASLanSpec spec = builder.loadFromPlainText(aslan, err, extraDefaults);
		ConverterOutput co = new ConverterOutput();
		if (spec != null) {
			co.setSpecification(spec.toXML());
			transfer(spec.getErrorGatherer(), co);
		} else {
			transfer(err, co);
		}
		return co;
	}

	@Override
	public ConverterOutput xml2aslan(String xml) {
		ErrorGatherer err = new ErrorGatherer(ASLanErrorMessages.DEFAULT);
		IASLanSpec spec = builder.loadFromXML(xml, err, extraDefaults);
		ConverterOutput co = new ConverterOutput();
		if (spec != null) {
			co.setSpecification(spec.toPlainText());
			transfer(spec.getErrorGatherer(), co);
		} else {
			transfer(err, co);
		}
		return co;
	}

	@Override
	public ConverterOutput check(String aslan) {
		ErrorGatherer err = new ErrorGatherer(ASLanErrorMessages.DEFAULT);
		IASLanSpec spec = builder.loadFromPlainText(aslan, err, extraDefaults);
		ConverterOutput co = new ConverterOutput();
		if (spec != null) {
			co.setSpecification(spec.toPlainText());
			transfer(spec.getErrorGatherer(), co);
		} else {
			transfer(err, co);
		}
		return co;
	}

	private void transfer(ErrorGatherer err, ConverterOutput co) {
		co.setErrors(err.getErrors());
		co.setWarnings(err.getWarnings());
	}

	private void loadTitleVersionAndVendor() {
		// Try to load the info directly through the API.
		title = getClass().getPackage().getImplementationTitle();
		version = getClass().getPackage().getImplementationVersion();
		vendor = getClass().getPackage().getImplementationVendor();

		// If failed, try from web manifest.
		if (title == null) {
			try {
				URL u = Main.class.getResource("/"
						+ getClass().getCanonicalName().replace('.', '/')
						+ ".class");
				if (u.getFile().contains("WEB-INF")) {
					int index = u.getFile().indexOf("WEB-INF");
					String path = u.getFile().substring(0, index)
							+ "META-INF/MANIFEST.MF";
					Manifest mf = new Manifest(new FileInputStream(path));
					Attributes attr = mf.getMainAttributes();
					title = attr.getValue(Name.IMPLEMENTATION_TITLE);
					version = attr.getValue(Name.IMPLEMENTATION_VERSION);
					vendor = attr.getValue(Name.IMPLEMENTATION_VENDOR);
				}
			} catch (IOException e) {
				// TODO: report error somehow, take Web services into account
			}
		}

		// If still failed, put in some default values.
		if (title == null) {
			title = "ASLan to XML Converter";
		}
		if (version == null) {
			version = "Unknown";
		}
		if (vendor == null) {
			vendor = "AVANTSSAR";
		}

		// Build the title line.
		titleLine = vendor + " " + title + " " + version;
	}

	public static void main(String[] args) throws Exception {
		ASLanXMLConverterImpl converter = new ASLanXMLConverterImpl();
		InputStream input;
		input = new FileInputStream("/tmp/a.aslan");
		String inputSpec = null;
		inputSpec = Utils.stream2string(input);
		ConverterOutput outputSpec;
		outputSpec = converter.aslan2xml(inputSpec);
		outputSpec = converter.xml2aslan(outputSpec.getSpecification());
		System.out.print(outputSpec.getSpecification());
	}
}


text:
<title>Uninitialized Data - GNU Compiler Collection (GCC) Internals</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Assembler-Format.html#Assembler-Format" title="Assembler Format">
<link rel="prev" href="Data-Output.html#Data-Output" title="Data Output">
<link rel="next" href="Label-Output.html#Label-Output" title="Label Output">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Label Output,
Previous: Data Output,
Up: Assembler Format

18.20.3 Output of Uninitialized Variables

Each of the macros in this section is used to do the whole job of
outputting a single uninitialized variable.

— Macro: ASM_OUTPUT_COMMON (<var>stream, name, size, rounded</var>)<var></var>

A C statement (sans semicolon) to output to the stdio stream
<var>stream</var> the assembler definition of a common-label named
<var>name</var> whose size is <var>size</var> bytes.  The variable <var>rounded</var>
is the size rounded up to whatever alignment the caller wants.  It is
possible that <var>size</var> may be zero, for instance if a struct with no
other member than a zero-length array is defined.  In this case, the
backend must output a symbol definition that allocates at least one
byte, both so that the address of the resulting object does not compare
equal to any other, and because some object formats cannot even express
the concept of a zero-sized common symbol, as that is how they represent
an ordinary undefined external.

Use the expression assemble_name (<var>stream</var>, <var>name</var>) to
output the name itself; before and after that, output the additional
assembler syntax for defining the name, and a newline.

This macro controls how the assembler definitions of uninitialized
common global variables are output.

— Macro: ASM_OUTPUT_ALIGNED_COMMON (<var>stream, name, size, alignment</var>)<var></var>

Like ASM_OUTPUT_COMMON except takes the required alignment as a
separate, explicit argument.  If you define this macro, it is used in
place of ASM_OUTPUT_COMMON, and gives you more flexibility in
handling the required alignment of the variable.  The alignment is specified
as the number of bits.

— Macro: ASM_OUTPUT_ALIGNED_DECL_COMMON (<var>stream, decl, name, size, alignment</var>)<var></var>

Like ASM_OUTPUT_ALIGNED_COMMON except that <var>decl</var> of the
variable to be output, if there is one, or NULL_TREE if there
is no corresponding variable.  If you define this macro, GCC will use it
in place of both ASM_OUTPUT_COMMON and
ASM_OUTPUT_ALIGNED_COMMON.  Define this macro when you need to see
the variable's decl in order to chose what to output.

— Macro: ASM_OUTPUT_ALIGNED_BSS (<var>stream, decl, name, size, alignment</var>)<var></var>

A C statement (sans semicolon) to output to the stdio stream
<var>stream</var> the assembler definition of uninitialized global <var>decl</var> named
<var>name</var> whose size is <var>size</var> bytes.  The variable <var>alignment</var>
is the alignment specified as the number of bits.

Try to use function asm_output_aligned_bss defined in file
<samp>varasm.c</samp> when defining this macro.  If unable, use the expression
assemble_name (<var>stream</var>, <var>name</var>) to output the name itself;
before and after that, output the additional assembler syntax for defining
the name, and a newline.

There are two ways of handling global BSS.  One is to define this macro.
The other is to have TARGET_ASM_SELECT_SECTION return a
switchable BSS section (see TARGET_HAVE_SWITCHABLE_BSS_SECTIONS).
You do not need to do both.

Some languages do not have common data, and require a
non-common form of global BSS in order to handle uninitialized globals
efficiently.  C++ is one example of this.  However, if the target does
not support global BSS, the front end may choose to make globals
common in order to save space in the object file.

— Macro: ASM_OUTPUT_LOCAL (<var>stream, name, size, rounded</var>)<var></var>

A C statement (sans semicolon) to output to the stdio stream
<var>stream</var> the assembler definition of a local-common-label named
<var>name</var> whose size is <var>size</var> bytes.  The variable <var>rounded</var>
is the size rounded up to whatever alignment the caller wants.

Use the expression assemble_name (<var>stream</var>, <var>name</var>) to
output the name itself; before and after that, output the additional
assembler syntax for defining the name, and a newline.

This macro controls how the assembler definitions of uninitialized
static variables are output.

— Macro: ASM_OUTPUT_ALIGNED_LOCAL (<var>stream, name, size, alignment</var>)<var></var>

Like ASM_OUTPUT_LOCAL except takes the required alignment as a
separate, explicit argument.  If you define this macro, it is used in
place of ASM_OUTPUT_LOCAL, and gives you more flexibility in
handling the required alignment of the variable.  The alignment is specified
as the number of bits.

— Macro: ASM_OUTPUT_ALIGNED_DECL_LOCAL (<var>stream, decl, name, size, alignment</var>)<var></var>

Like ASM_OUTPUT_ALIGNED_DECL except that <var>decl</var> of the
variable to be output, if there is one, or NULL_TREE if there
is no corresponding variable.  If you define this macro, GCC will use it
in place of both ASM_OUTPUT_DECL and
ASM_OUTPUT_ALIGNED_DECL.  Define this macro when you need to see
the variable's decl in order to chose what to output.


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

  <title>Description of tpsInterpolateIm</title>
  <meta name="keywords" content="tpsInterpolateIm">
  <meta name="description" content="Interpolate Isrc according to the warp from Isrc->Idst.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html © 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">

tpsInterpolateIm

PURPOSE

Interpolate Isrc according to the warp from Isrc->Idst.

SYNOPSIS

function [IR,boundX,boundY] = tpsInterpolateIm( Isrc, warp, holeVal )

DESCRIPTION

 Interpolate Isrc according to the warp from Isrc->Idst.

 Use tpsGetWarp to obtain the warp.

 USAGE
  IR = tpsInterpolateIm( Isrc, warp, [holeVal] )

 INPUTS
  Isrc        - image to interpolate
  warp        - [see tpsGetWarp] bookstein warping parameters
  holeVal     - [0] Value of the empty warps

 OUTPUTS
  IR          - warped image

 EXAMPLE
  xsS=[0 0 1 1 2 2]; ysS=[0 2 0 2 0 2]; ysD=[0 2 .5 1.5 0 2];
  warp = tpsGetWarp(0,xsS*100,ysS*100,xsS*100,ysD*100);
  load clown; I=padarray(X,[1 1],0,'both'); clear X caption map;
  IR = tpsInterpolateIm( I, warp );
  figure(1); clf; im(I); figure(2); clf; im(IR);

 See also TPSGETWARP, TEXTUREMAP

 Piotr's Image&Video Toolbox      Version 2.0
 Copyright 2012 Piotr Dollar.  [pdollar-at-caltech.edu]
 Please email me if you find bugs, or have suggestions or questions!
 Licensed under the Simplified BSD License [see external/bsd.txt]

CROSS-REFERENCE INFORMATION

This function calls:

textureMap	Maps texture in I according to rsDst and csDst.

tpsInterpolate	Apply warp (obtained by tpsGetWarp) to a set of new points.

This function is called by:

<address>Generated by m2html © 2003</address>


text:
#include <aws/ec2/model/IpamPoolCidr.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

#include <utility>

using namespace Aws::Utils::Xml;
using namespace Aws::Utils;

namespace Aws
{
namespace EC2
{
namespace Model
{

IpamPoolCidr::IpamPoolCidr() :
    m_cidrHasBeenSet(false),
    m_state(IpamPoolCidrState::NOT_SET),
    m_stateHasBeenSet(false),
    m_failureReasonHasBeenSet(false)
{
}

IpamPoolCidr::IpamPoolCidr(const XmlNode& xmlNode) :
    m_cidrHasBeenSet(false),
    m_state(IpamPoolCidrState::NOT_SET),
    m_stateHasBeenSet(false),
    m_failureReasonHasBeenSet(false)
{
  *this = xmlNode;
}

IpamPoolCidr& IpamPoolCidr::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode cidrNode = resultNode.FirstChild("cidr");
    if(!cidrNode.IsNull())
    {
      m_cidr = Aws::Utils::Xml::DecodeEscapedXmlText(cidrNode.GetText());
      m_cidrHasBeenSet = true;
    }
    XmlNode stateNode = resultNode.FirstChild("state");
    if(!stateNode.IsNull())
    {
      m_state = IpamPoolCidrStateMapper::GetIpamPoolCidrStateForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(stateNode.GetText()).c_str()).c_str());
      m_stateHasBeenSet = true;
    }
    XmlNode failureReasonNode = resultNode.FirstChild("failureReason");
    if(!failureReasonNode.IsNull())
    {
      m_failureReason = failureReasonNode;
      m_failureReasonHasBeenSet = true;
    }
  }

  return *this;
}

void IpamPoolCidr::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
  if(m_cidrHasBeenSet)
  {
      oStream << location << index << locationValue << ".Cidr=" << StringUtils::URLEncode(m_cidr.c_str()) << "&";
  }

  if(m_stateHasBeenSet)
  {
      oStream << location << index << locationValue << ".State=" << IpamPoolCidrStateMapper::GetNameForIpamPoolCidrState(m_state) << "&";
  }

  if(m_failureReasonHasBeenSet)
  {
      Aws::StringStream failureReasonLocationAndMemberSs;
      failureReasonLocationAndMemberSs << location << index << locationValue << ".FailureReason";
      m_failureReason.OutputToStream(oStream, failureReasonLocationAndMemberSs.str().c_str());
  }

}

void IpamPoolCidr::OutputToStream(Aws::OStream& oStream, const char* location) const
{
  if(m_cidrHasBeenSet)
  {
      oStream << location << ".Cidr=" << StringUtils::URLEncode(m_cidr.c_str()) << "&";
  }
  if(m_stateHasBeenSet)
  {
      oStream << location << ".State=" << IpamPoolCidrStateMapper::GetNameForIpamPoolCidrState(m_state) << "&";
  }
  if(m_failureReasonHasBeenSet)
  {
      Aws::String failureReasonLocationAndMember(location);
      failureReasonLocationAndMember += ".FailureReason";
      m_failureReason.OutputToStream(oStream, failureReasonLocationAndMember.c_str());
  }
}

} // namespace Model
} // namespace EC2
} // namespace Aws