text:
<link rel="import" href="../../bower_components/polymer/polymer.html">

<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-icons/maps-icons.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../bower_components/paper-item/paper-icon-item.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-item/paper-item-body.html">
<link rel="import" href="../../bower_components/paper-listbox/paper-listbox.html">

<link rel="import" href="../../bower_components/google-apis/google-maps-api.html">

<dom-module id="forest-search-panel">
  <template>

    <google-maps-api id="api" on-api-load="initPlacesApi_"></google-maps-api>

    <paper-material elevation="1" class="layout vertical" stretch>

        <paper-icon-button id="close" icon="chevron-left" on-tap="close"></paper-icon-button>

Search

        <paper-input tabindex="0"
                     type="search"
                     always-float-label=true
                     label="Zoom to a location on the map"
                     on-value-changed="handleQuery_"
                     on-keydown="handleInputKeyDown_">
        </paper-input>

          <template is="dom-repeat" items="{{results}}">
            <paper-item on-tap="handleResultTapped_" on-keydown="handleItemKeyDown_">
              {{item.name}}
            </paper-item>
          </template>

    </paper-material>
  </template>

</dom-module>

redpajama_set_name: RedPajamaGithub


text:
angular.module("bmComponents").directive("bmPager", [
    function () {
        return {
            replace: false,
            restrict: "A",
            link: function (scope, elem, attrs) {

                function redraw(items) {

                    var totalCount, barWidth, barPercentageWidth, barContainerWidth,
                        getMore, leftValue, rightValue, bar, getMorePosition;

                    items = items || scope.$eval(attrs.bmPager);
                    totalCount = scope.$eval(attrs.bmPagerTotal);
                    bar = angular.element(".loading-bar", elem);
                    barContainerWidth = angular.element(".loading-bar-container", elem).width();
                    barPercentageWidth = (items.length * 100) / totalCount;
                    barWidth = barContainerWidth * barPercentageWidth / 100;
                    getMore = angular.element(".get-more", elem);
                    leftValue = angular.element(".values.left", elem);
                    rightValue = angular.element(".values.right", elem);

//                        angular.element(".loading-bar", elem).css("width", barLength + "%");
//                        angular.element(".get-more", elem).css("left", barLength + "%");
                    angular.element(".loading-bar", elem).animate({
                        width: barPercentageWidth + "%"
                    }, 400, "swing", function () {
                        var newBarWidth = bar.width();
                        if (newBarWidth + bar.position().left > (leftValue.outerWidth() / 2) + leftValue.position().left) {
                            leftValue.addClass("inverse");
                        } else {
                            leftValue.removeClass("inverse");
                        }
                        if (newBarWidth + bar.position().left > (rightValue.outerWidth() / 2) + rightValue.position().left) {
                            rightValue.addClass("inverse");
                        } else {
                            rightValue.removeClass("inverse");
                        }
                    });

                    if ((barWidth - getMore.outerWidth() / 2 ) * 100 / barContainerWidth < 50) {

                        if (barWidth < leftValue.outerWidth() + leftValue.position().left + 10) {
                            getMorePosition = (leftValue.outerWidth() + leftValue.position().left + 10) + "px";
                        } else {
                            getMorePosition = barPercentageWidth + "%";
                        }
                        getMore.animate({
                            left: getMorePosition
                        }, 400, "swing").removeClass("inverse");
                    } else {
                        if (barWidth > rightValue.position().left) {
                            getMorePosition = (rightValue.position().left - getMore.outerWidth() - 10) + "px";
                        } else {
                            getMorePosition = ((barWidth - getMore.outerWidth() - 5) * 100 / barContainerWidth) + "%"
                        }
                        getMore.animate({
//                                left: ((barContainerWidth / 2 - getMore.outerWidth() / 2) * 100 / barContainerWidth) + "%",
                            left: getMorePosition
                        }, 400, "swing").addClass("inverse");
                    }
                }

                scope.$watch(attrs.bmPager, function (newVal) {
                    if (newVal && newVal.length) {
                        redraw(newVal);
                    }
                }, true);

                scope.$watch(attrs.bmPagerTotal, function (newVal, oldVal) {
                    if (!angular.equals(newVal, oldVal)) {
                        redraw();
                    }
                });
            }
        }
    }
]);


text:
package javax.faces.view;

/**
 * A marker interface for PDL tags that represent <composite:editableValueHolder/> for use by the
 * composite component page author.
 *
 * @since 2.0
 */
public interface EditableValueHolderAttachedObjectTarget extends ValueHolderAttachedObjectTarget
{

}


text:
<?php

namespace AppBundle\Traits;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 *
 * @author Alsciende <alsciende@icloud.com>
 */
trait TimestampableEntity
{
    /**
     * @var \DateTime
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime",nullable=false)
     */
    protected $createdAt;

    /**
     * @var \DateTime
     * @Gedmo\Timestampable(on="update")
     * @ORM\Column(type="datetime",nullable=false)
     */
    protected $updatedAt;

    /**
     * Sets createdAt.
     *
     * @param  \DateTime $createdAt
     * @return $this
     */
    public function setCreatedAt(\DateTime $createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Returns createdAt.
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Sets updatedAt.
     *
     * @param  \DateTime $updatedAt
     * @return $this
     */
    public function setUpdatedAt(\DateTime $updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Returns updatedAt.
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }
}


text:
<h4> Primitives </h4>

The Terraformer Primitives are classes that map directly to their GeoJSON equivalents, adding convenience methods, geometric tools such as `within`, and `intersects` and spatial reference conversion methods.

<h4> Tools </h4>

Terraformer also exposes many generic tools for working with geographic data.


text:
namespace device {

ArCoreAnchorManager::ArCoreAnchorManager(util::PassKey<ArCoreImpl> pass_key,
                                         ArSession* arcore_session)
    : arcore_session_(arcore_session) {
  DCHECK(arcore_session_);

  ArAnchorList_create(
      arcore_session_,
      internal::ScopedArCoreObject<ArAnchorList*>::Receiver(arcore_anchors_)
          .get());
  DCHECK(arcore_anchors_.is_valid());

  ArPose_create(
      arcore_session_, nullptr,
      internal::ScopedArCoreObject<ArPose*>::Receiver(ar_pose_).get());
  DCHECK(ar_pose_.is_valid());
}

ArCoreAnchorManager::~ArCoreAnchorManager() = default;

mojom::XRAnchorsDataPtr ArCoreAnchorManager::GetAnchorsData() const {
  DVLOG(3) << __func__ << ": anchor_id_to_anchor_info_.size()="
           << anchor_id_to_anchor_info_.size()
           << ", updated_anchor_ids_.size()=" << updated_anchor_ids_.size();

  std::vector<uint64_t> all_anchors_ids;
  all_anchors_ids.reserve(anchor_id_to_anchor_info_.size());
  for (const auto& anchor_id_and_object : anchor_id_to_anchor_info_) {
    all_anchors_ids.push_back(anchor_id_and_object.first.GetUnsafeValue());
  }

  std::vector<mojom::XRAnchorDataPtr> updated_anchors;
  updated_anchors.reserve(updated_anchor_ids_.size());
  for (const auto& anchor_id : updated_anchor_ids_) {
    const device::internal::ScopedArCoreObject<ArAnchor*>& anchor =
        anchor_id_to_anchor_info_.at(anchor_id).anchor;

    if (anchor_id_to_anchor_info_.at(anchor_id).tracking_state ==
        AR_TRACKING_STATE_TRACKING) {
      // pose
      ArAnchor_getPose(arcore_session_, anchor.get(), ar_pose_.get());
      mojom::Pose pose =
          GetMojomPoseFromArPose(arcore_session_, ar_pose_.get());

      DVLOG(3) << __func__ << ": anchor_id: " << anchor_id.GetUnsafeValue()
               << ", position=" << pose.position.ToString()
               << ", orientation=" << pose.orientation.ToString();

      updated_anchors.push_back(mojom::XRAnchorData::New(
          anchor_id.GetUnsafeValue(), device::mojom::Pose::New(pose)));
    } else {
      DVLOG(3) << __func__ << ": anchor_id: " << anchor_id.GetUnsafeValue()
               << ", position=untracked, orientation=untracked";

      updated_anchors.push_back(
          mojom::XRAnchorData::New(anchor_id.GetUnsafeValue(), nullptr));
    }
  }

  return mojom::XRAnchorsData::New(std::move(all_anchors_ids),
                                   std::move(updated_anchors));
}

template <typename FunctionType>
void ArCoreAnchorManager::ForEachArCoreAnchor(ArAnchorList* arcore_anchors,
                                              FunctionType fn) {
  DCHECK(arcore_anchors);

  int32_t anchor_list_size;
  ArAnchorList_getSize(arcore_session_, arcore_anchors, &anchor_list_size);

  for (int i = 0; i < anchor_list_size; i++) {
    internal::ScopedArCoreObject<ArAnchor*> anchor;
    ArAnchorList_acquireItem(
        arcore_session_, arcore_anchors, i,
        internal::ScopedArCoreObject<ArAnchor*>::Receiver(anchor).get());

    ArTrackingState tracking_state;
    ArAnchor_getTrackingState(arcore_session_, anchor.get(), &tracking_state);

    if (tracking_state == ArTrackingState::AR_TRACKING_STATE_STOPPED) {
      // Skip all anchors that are not currently tracked.
      continue;
    }

    fn(std::move(anchor), tracking_state);
  }
}

void ArCoreAnchorManager::Update(ArFrame* ar_frame) {
  // First, ask ARCore about all Anchors updated in the current frame.
  ArFrame_getUpdatedAnchors(arcore_session_, ar_frame, arcore_anchors_.get());

  // Collect the IDs of updated anchors.
  std::set<AnchorId> updated_anchor_ids;
  ForEachArCoreAnchor(arcore_anchors_.get(), [this, &updated_anchor_ids](
                                                 device::internal::
                                                     ScopedArCoreObject<
                                                         ArAnchor*> ar_anchor,
                                                 ArTrackingState
                                                     tracking_state) {
    // ID
    AnchorId anchor_id;
    bool created;
    std::tie(anchor_id, created) = CreateOrGetAnchorId(ar_anchor.get());

    DVLOG(3) << __func__
             << ": anchor updated, anchor_id=" << anchor_id.GetUnsafeValue()
             << ", tracking_state=" << tracking_state;

    DCHECK(!created)
        << "Anchor creation is app-initiated - we should never encounter an "
           "anchor that was created outside of `ArCoreImpl::CreateAnchor()`.";

    updated_anchor_ids.insert(anchor_id);
  });

  DVLOG(3) << __func__
           << ": updated_anchor_ids.size()=" << updated_anchor_ids.size();

  // Then, ask about all Anchors that are still tracked.
  ArSession_getAllAnchors(arcore_session_, arcore_anchors_.get());

  // Collect the objects of all currently tracked anchors.
  // |ar_plane_address_to_id_| should *not* grow.
  std::map<AnchorId, AnchorInfo> new_anchor_id_to_anchor_info;
  ForEachArCoreAnchor(arcore_anchors_.get(), [this,
                                              &new_anchor_id_to_anchor_info,
                                              &updated_anchor_ids](
                                                 device::internal::
                                                     ScopedArCoreObject<
                                                         ArAnchor*> anchor,
                                                 ArTrackingState
                                                     tracking_state) {
    // ID
    AnchorId anchor_id;
    bool created;
    std::tie(anchor_id, created) = CreateOrGetAnchorId(anchor.get());

    DVLOG(3) << __func__
             << ": anchor present, anchor_id=" << anchor_id.GetUnsafeValue()
             << ", tracking state=" << tracking_state;

    DCHECK(!created)
        << "Anchor creation is app-initiated - we should never encounter an "
           "anchor that was created outside of `ArCoreImpl::CreateAnchor()`.";

    // Inspect the tracking state of this anchor in the previous frame. If it
    // changed, mark the anchor as updated.
    if (base::Contains(anchor_id_to_anchor_info_, anchor_id) &&
        anchor_id_to_anchor_info_.at(anchor_id).tracking_state !=
            tracking_state) {
      updated_anchor_ids.insert(anchor_id);
    }

    AnchorInfo new_anchor_info = AnchorInfo(std::move(anchor), tracking_state);

    new_anchor_id_to_anchor_info.emplace(anchor_id, std::move(new_anchor_info));
  });

  DVLOG(3) << __func__ << ": new_anchor_id_to_anchor_info.size()="
           << new_anchor_id_to_anchor_info.size();

  // Shrink |ar_plane_address_to_id_|, removing all planes that are no longer
  // tracked or were subsumed - if they do not show up in
  // |plane_id_to_plane_object| map, they are no longer tracked.
  base::EraseIf(
      ar_anchor_address_to_id_,
      [&new_anchor_id_to_anchor_info](const auto& anchor_address_and_id) {
        return !base::Contains(new_anchor_id_to_anchor_info,
                               anchor_address_and_id.second);
      });
  anchor_id_to_anchor_info_.swap(new_anchor_id_to_anchor_info);
  updated_anchor_ids_.swap(updated_anchor_ids);
}

std::pair<AnchorId, bool> ArCoreAnchorManager::CreateOrGetAnchorId(
    void* anchor_address) {
  auto it = ar_anchor_address_to_id_.find(anchor_address);
  if (it != ar_anchor_address_to_id_.end()) {
    return std::make_pair(it->second, false);
  }

  CHECK(next_id_ != std::numeric_limits<uint64_t>::max())
      << "preventing ID overflow";

  uint64_t current_id = next_id_++;
  ar_anchor_address_to_id_.emplace(anchor_address, current_id);

  return std::make_pair(AnchorId(current_id), true);
}

base::Optional<AnchorId> ArCoreAnchorManager::CreateAnchor(
    const device::mojom::Pose& pose) {
  auto ar_pose = GetArPoseFromMojomPose(arcore_session_, pose);

  device::internal::ScopedArCoreObject<ArAnchor*> ar_anchor;
  ArStatus status = ArSession_acquireNewAnchor(
      arcore_session_, ar_pose.get(),
      device::internal::ScopedArCoreObject<ArAnchor*>::Receiver(ar_anchor)
          .get());

  if (status != AR_SUCCESS) {
    return base::nullopt;
  }

  AnchorId anchor_id;
  bool created;
  std::tie(anchor_id, created) = CreateOrGetAnchorId(ar_anchor.get());

  DCHECK(created) << "This should always be a new anchor, not something we've "
                     "seen previously.";

  // Mark new anchor as updated to ensure we send its information over to blink:
  updated_anchor_ids_.insert(anchor_id);

  ArTrackingState tracking_state;
  ArAnchor_getTrackingState(arcore_session_, ar_anchor.get(), &tracking_state);

  anchor_id_to_anchor_info_.emplace(
      anchor_id, AnchorInfo(std::move(ar_anchor), tracking_state));

  return anchor_id;
}

base::Optional<AnchorId> ArCoreAnchorManager::CreateAnchor(
    ArCorePlaneManager* plane_manager,
    const device::mojom::Pose& pose,
    PlaneId plane_id) {
  DCHECK(plane_manager);

  DVLOG(2) << __func__ << ": plane_id=" << plane_id;

  auto ar_anchor = plane_manager->CreateAnchor(
      util::PassKey<ArCoreAnchorManager>(), plane_id, pose);
  if (!ar_anchor.is_valid()) {
    return base::nullopt;
  }

  AnchorId anchor_id;
  bool created;
  std::tie(anchor_id, created) = CreateOrGetAnchorId(ar_anchor.get());

  DCHECK(created) << "This should always be a new anchor, not something we've "
                     "seen previously.";

  // Mark new anchor as updated to ensure we send its information over to blink:
  updated_anchor_ids_.insert(anchor_id);

  ArTrackingState tracking_state;
  ArAnchor_getTrackingState(arcore_session_, ar_anchor.get(), &tracking_state);

  anchor_id_to_anchor_info_.emplace(
      anchor_id, AnchorInfo(std::move(ar_anchor), tracking_state));

  return anchor_id;
}

void ArCoreAnchorManager::DetachAnchor(AnchorId anchor_id) {
  auto it = anchor_id_to_anchor_info_.find(anchor_id);
  if (it == anchor_id_to_anchor_info_.end()) {
    return;
  }

  ArAnchor_detach(arcore_session_, it->second.anchor.get());

  anchor_id_to_anchor_info_.erase(it);
}

bool ArCoreAnchorManager::AnchorExists(AnchorId id) const {
  return base::Contains(anchor_id_to_anchor_info_, id);
}

base::Optional<gfx::Transform> ArCoreAnchorManager::GetMojoFromAnchor(
    AnchorId id) const {
  auto it = anchor_id_to_anchor_info_.find(id);
  if (it == anchor_id_to_anchor_info_.end()) {
    return base::nullopt;
  }

  ArAnchor_getPose(arcore_session_, it->second.anchor.get(), ar_pose_.get());
  mojom::Pose mojo_pose =
      GetMojomPoseFromArPose(arcore_session_, ar_pose_.get());

  return mojo::ConvertTo<gfx::Transform>(mojo_pose);
}

ArCoreAnchorManager::AnchorInfo::AnchorInfo(
    device::internal::ScopedArCoreObject<ArAnchor*> anchor,
    ArTrackingState tracking_state)
    : anchor(std::move(anchor)), tracking_state(tracking_state) {}

ArCoreAnchorManager::AnchorInfo::AnchorInfo(AnchorInfo&& other) = default;
ArCoreAnchorManager::AnchorInfo::~AnchorInfo() = default;

}  // namespace device


text:
using namespace af;

#define Export __declspec(dllexport)

namespace ArrayFireOperations {
	extern "C" { Export void autoSetBackend(); }
	extern "C" { Export int getCurrentDevice(); }
	extern "C" { Export int getDeviceCount(); }
	extern "C" { Export const char * infoString(const bool verboseInfo = true); }
	extern "C" { Export void setDevice(const int device); }
	extern "C" { Export int getAvailableBackends(); }
	extern "C" { Export float * SMA(float *priceArray, int len, int period); }
	extern "C" { Export float * EMA(float *priceArray, int len, int period); }
		array EMA(array Prices, int period);
	extern "C" { Export float * Max(float *priceArray, int len, int period); }
	extern "C" { Export float * Min(float *priceArray, int len, int period); }
	extern "C" { Export float * ATR(float *closeArray, float *highArray, float *lowArray, int len, int period); }
		array ATR(array Close, array High, array Low, int len, int period);
	extern "C" { Export float * ADX(float *closeArray, float *highArray, float *lowArray, int len, int period); }
};


text:
/**
 * Extensible decoder and its common implementations which deal with the
 * packet fragmentation and reassembly issue found in a stream-based transport
 * such as TCP/IP.
 *
 * @apiviz.exclude OneToOne(Encoder|Decoder)$
 * @apiviz.exclude \.(Simple)?Channel[A-Za-z]*Handler$
 * @apiviz.exclude \.codec\.[a-eg-z][a-z0-9]*\.
 * @apiviz.exclude \.ssl\.
 */
package com.codefollower.douyu.netty.handler.codec.frame;


text:
package bnfc.abs.Absyn; // Java Package generated by the BNF Converter.

public class ListAnnDecl extends java.util.LinkedList<AnnDecl> {
}


text:
package com.android.camera.ui;

public interface Rotatable {
    public void setOrientation(int orientation);
}


text:
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

//
// UsingUnicodeExtensions.xaml.h
// Declaration of the UsingUnicodeExtensions class
//

#pragma once

#include "pch.h"
#include "Scenario5_UsingUnicodeExtensions.g.h"
#include "MainPage.xaml.h"

namespace SDKSample
{
    namespace DateTimeFormatting
    {
        /// <summary>
        /// An empty page that can be used on its own or navigated to within a Frame.
        /// </summary>
        [Windows::Foundation::Metadata::WebHostHidden]
        public ref class UsingUnicodeExtensions sealed
        {
        public:
            UsingUnicodeExtensions();

        protected:
            virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
        private:
            MainPage^ rootPage;
            void Display_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
        };
    }
}


text:
import {
  Button,
  Classes,
  Dialog,
  FormGroup,
  InputGroup,
  Intent,
  TextArea,
} from '@blueprintjs/core';
import React from 'react';

import { BasicQueryExplanation, SemiJoinQueryExplanation } from '../../utils';

import './query-plan-dialog.scss';

export interface QueryPlanDialogProps {
  explainResult?: BasicQueryExplanation | SemiJoinQueryExplanation | string;
  explainError?: string;
  onClose: () => void;
  setQueryString: (queryString: string) => void;
}

export const QueryPlanDialog = React.memo(function QueryPlanDialog(props: QueryPlanDialogProps) {
  const { explainResult, explainError, onClose, setQueryString } = props;

  let content: JSX.Element;
  let queryString: string | undefined;

  if (explainError) {
    content =
{explainError}
;
  } else if (!explainResult) {
    content =
;
  } else if ((explainResult as BasicQueryExplanation).query) {
    let signature: JSX.Element | undefined;
    if ((explainResult as BasicQueryExplanation).signature) {
      const signatureContent = (explainResult as BasicQueryExplanation).signature || '';
      signature = (
        <FormGroup label="Signature">
          <InputGroup defaultValue={signatureContent} readOnly />
        </FormGroup>
      );
    }

    queryString = JSON.stringify((explainResult as BasicQueryExplanation).query[0], undefined, 2);
    content = (

        <FormGroup label="Query">
          <TextArea readOnly value={queryString} />
        </FormGroup>
        {signature}

    );
  } else if (
    (explainResult as SemiJoinQueryExplanation).mainQuery &&
    (explainResult as SemiJoinQueryExplanation).subQueryRight
  ) {
    let mainSignature: JSX.Element | undefined;
    let subSignature: JSX.Element | undefined;
    if ((explainResult as SemiJoinQueryExplanation).mainQuery.signature) {
      const signatureContent =
        (explainResult as SemiJoinQueryExplanation).mainQuery.signature || '';
      mainSignature = (
        <FormGroup label="Signature">
          <InputGroup defaultValue={signatureContent} readOnly />
        </FormGroup>
      );
    }
    if ((explainResult as SemiJoinQueryExplanation).subQueryRight.signature) {
      const signatureContent =
        (explainResult as SemiJoinQueryExplanation).subQueryRight.signature || '';
      subSignature = (
        <FormGroup label="Signature">
          <InputGroup defaultValue={signatureContent} readOnly />
        </FormGroup>
      );
    }

    content = (

        <FormGroup label="Main query">
          <TextArea
            readOnly
            value={JSON.stringify(
              (explainResult as SemiJoinQueryExplanation).mainQuery.query,
              undefined,
              2,
            )}
          />
        </FormGroup>
        {mainSignature}
        <FormGroup label="Sub query">
          <TextArea
            readOnly
            value={JSON.stringify(
              (explainResult as SemiJoinQueryExplanation).subQueryRight.query,
              undefined,
              2,
            )}
          />
        </FormGroup>
        {subSignature}

    );
  } else {
    content =
{explainResult}
;
  }

  return (
    <Dialog className="query-plan-dialog" isOpen onClose={onClose} title="Query plan">

{content}

          <Button text="Close" onClick={onClose} />
          {queryString && (
            <Button
              text="Open query"
              intent={Intent.PRIMARY}
              onClick={() => {
                if (queryString) setQueryString(queryString);
                onClose();
              }}
            />
          )}

    </Dialog>
  );
});


text:
[![npm version](https://badge.fury.io/js/sequelize-embed.svg)](https://www.npmjs.com/package/sequelize-embed)
[![Build Status](https://travis-ci.org/Wsiegenthaler/sequelize-embed.svg?branch=master)](https://travis-ci.org/Wsiegenthaler/sequelize-embed)
[![dependencies Status](https://david-dm.org/wsiegenthaler/sequelize-embed/status.svg)](https://david-dm.org/wsiegenthaler/sequelize-embed)
[![Coverage Status](https://coveralls.io/repos/github/Wsiegenthaler/sequelize-embed/badge.svg?branch=master)](https://coveralls.io/github/Wsiegenthaler/sequelize-embed?branch=master)
[![Known Vulnerabilities](https://snyk.io/test/github/wsiegenthaler/sequelize-embed/badge.svg)](https://snyk.io/test/github/wsiegenthaler/sequelize-embed)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FWsiegenthaler%2Fsequelize-embed.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FWsiegenthaler%2Fsequelize-embed?ref=badge_shield)

*Easily insert and update sequelize models with deeply nested associations*

While Sequelize will retrieve nested assocations via the `include` option, it does not provide the ability to write them. This module allows for easy synchronization of nested associations by recursively inserting new, updating existing, or deleting removed association values.

* Synchronizes nested associations in a single atomic operation
* Prunes redundant foreign keys and later infers them
* Works with optimistic locking in *Sequelize v4*
* Includes *Epilogue* middleware for document-oriented PUT/POST

# API

### Operations

#### `insert(model, values, include, options)`

Inserts a new record given `values` and synchronizes nested associations specified by `include`.

#### `update(model, values, include, options)`

Updates the record corresponding to `values` and synchronizes nested associations specified by `include`.

### Parameters

#### model

The sequelize model of the root of the structure.

#### values

Object representing the values to be written, including any nested structure.

#### include

Array specifying the nested associations to be embedded. The `include` parameter is recursive and is usually a subset of those passed to `Model.findById/One/All`.

#### options

> ##### transaction
>
> The transaction to be used. When provided, invoking `commit` or `rollback` is the resonsibility of the caller. Otherwise, a transaction will be created automatically and committed when done.
>
> ##### reload
>
> Whether to reload and return the full instance after success. May also be an object specifying further options:
> >
> > ##### include
> >
> > The nested associations to be read and returned. Defaults to the `include` parameter used in the write.
> >
> > ##### plain
> >
> > Return plain object instead of Sequelize instances. (default `true`)
> >
> > ##### prune
> >
> > Whether to prune redundant foreign keys. (default `true`)

# Getting Started

### Install

```javascript
npm install --save sequelize-embed
```

### Basic Example

Import `sequelize-embed` and initialize with `sequelize`:

```javascript
const embed = require('sequelize-embed')(sequelize)
```

Setup an example schema - an *Order* can have *Items*, each of which is assigned a *Department*:

```javascript
const Order = sequelize.define('Order', {})
const Item = sequelize.define('Item', { quantity: Sequelize.STRING })
const Department = sequelize.define('Department', { name: Sequelize.STRING })

Order.Items = Order.hasMany(Item, { as: 'items', foreignKey: 'orderId' })
Item.Department = Item.belongsTo(Department, { as: 'department', foreignKey: 'deptId' })`
```

Use the `mkInclude` helper to define the associations we wish to include. Here `itemsOnly` will update `Items` while `itemsAndDept` will update `Items` *and* `Departments`.

```javascript
const { mkInclude } = embed.util.helpers

const itemsAndDept = [ mkInclude(Order.Items, mkInclude(Item.Department)) ]
const itemsOnly = [ mkInclude(Order.Items) ]
```

Insert an order, it's items, and departments by including `itemsAndDept`:

```javascript
const order = {
  items: [ { quantity: 1, department: { name: 'produce' } } ]
}

embed.insert(Order, order, itemsAndDept)

// id: 1,
// items: [ { id: 1, quantity: '1', department: { id: 1, name: 'produce' } } ]
```

Change the quantity and department of our existing item:

```javascript
const order = {
  id: 1,
  items: [ { id: 1, quantity: 2, department: { name: 'dairy' } } ]
}

embed.update(Order, order, itemsAndDept)

// id: 1,
// items: [ { id: 1, quantity: '2', department: { id: 2, name: 'dairy' } } ]
```

For the purposes of demonstration we've included `Departments` in our update, but since a `Department` is shared between orders we probably wouldn't want to include them when updating an order. Let's add another item, this time including just `itemsOnly` and being sure to specify a department known to exist:

```javascript
const order = {
  id: 1,
  items: [
    { id: 1, quantity: 2, department: { id: 2, name: 'dairy' } },
    { quantity: 3, department: { id: 1 } } ]
}

embed.update(Order, order, itemsOnly, { reload: { include: itemsAndDept } })

// id: 1,
// items: [
//   { id: 1, quantity: '2', department: { id: 2, name: 'dairy' } },
//   { id: 2, quantity: '3', department: { id: 1, name: 'produce' } } ]
```
Notice that the new item was correctly assigned to the `produce` department despite `Departments` not being included in the update. Since *belongs to* foreign keys are on the source, they are always mapped back from any embedded values, even if a value isn't included for update itself. Also, we now pass `itemsAndDept` as the `reload.include` option which will include the `department` field in the result despite it not being updated.

Finally, remove the first item and reassign the second to the `dairy` department:

```javascript
const order = {
  id: 1,
  items: [ { id: 2, quantity: 3, department: { id: 2 } } ]
}

embed.update(Order, order, itemsOnly, { reload: { include: itemsAndDept } })

// id: 1,
// items: [
//   { id: 2, quantity: '3', department: { id: 2, name: 'dairy' } } ]
```

### Performance

Since the underlying data is normalized, completing an `update` or `insert` operation requires many reads and writes to synchronize the entire structure. For applications where performance is critical, be sure to restrict the total number of embedded associations and only embed those with reasonably low-cardinality.

# Epilogue Middleware

*Sequelize Embed* also provides *Epilogue* middleware for automatically updating associations during PUT and POST operations. This can greatly simplify client development by giving your REST api the feel of a document-oriented database.

```javascript
const embed = require('sequelize-embed')(sequelize)

const includeOnRead = ...  // include for get
const includeOnWrite = ... // include for put/post

// setup resource like normal
const resource = epilogue.resource({
  model: Model,
  include: includeOnRead,
  associations: false,
  ...
});

// add middleware to the resource, specifying includes
const middleware = embed.Epilogue(epilogue)
resource.use(middleware(includeOnWrite))
```

## License

Everything in this repo is BSD License unless otherwise specified

sequelize-embed (c) 2017 Weston Siegenthaler

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FWsiegenthaler%2Fsequelize-embed.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FWsiegenthaler%2Fsequelize-embed?ref=badge_large)


text:
EPD stands for Entity Parameter Data and contains all the stats related to the character stats.

The format consists on the following structures in order:
[Header](#Header)
[General Parameters](#General-Parameters)
[Animation List](#Animation-List)
[Other Parameters](#Other-Parameters)
[Technique Parameters](#Technique-Parameters)
[Drop Items](#Drop-Items)
[Extra Parameters](#Extra-Parameters)

## Header

| Offset | Type  | Description
|--------|-------|------------
| 0x0     | string   | File identifier, always `@EPD`
| 0x4     | int   | Version, `9`

## General Parameters

| Offset | Type  | Description
|--------|-------|------------
| 0x0     | uint  | [Status Ailments](#Status-Ailments) flag
| 0x4     | float | Max HP (Bosses) Health Multiplier (Enemies)
| 0x8     | float | Experience Multiplier
| 0xC     | uint  | iSize (Unknown)
| 0x10     | float  | Physical Damage Multiplier
| 0x14     | float  | Fire Damage Multiplier
| 0x18     | float  | Ice Damage Multiplier
| 0x1C     | float  | Thunder Damage Multiplier
| 0x20     | float  | Darkness Damage Multiplier
| 0x24     | float  | Non-Elemental Damage Multiplier

### Status Ailments

| Bit | Count | Description
|-----|-------|-------------
|  0 | 1 | Fly
|  1 | 1 | Small Damage Reaction
|  2 | 1 | Small Damage Reaction Only
|  3 | 1 | Hitback
|  4 | 1 | dummy4
|  5 | 1 | dummy5
|  6 | 1 | dummy6
|  7 | 1 | dummy7
|  8 | 1 | dummy8
|  9 | 1 | dummy9
| 10 | 1 | Poison
| 11 | 1 | Slow
| 12 | 1 | Stop
| 13 | 1 | Bind
| 14 | 1 | Faint
| 15 | 1 | Freeze
| 16 | 1 | Burn
| 17 | 1 | Confuse
| 18 | 1 | Blind
| 19 | 1 | Death
| 20 | 1 | Zero Gravity
| 21 | 1 | Minimum
| 22 | 1 | Magnet
| 23 | 1 | Degen
| 24 | 1 | Sleep
| 25 | 1 | dummy25
| 26 | 1 | dummy26
| 27 | 1 | dummy27
| 28 | 1 | dummy28
| 29 | 1 | dummy29
| 30 | 1 | dummy30
| 31 | 1 | dummy31

## Animation List

| Offset | Type  | Description
|--------|-------|------------
| 0x0     | char[4]  | Animation List (mnDamageMotion)

Animation List has 20 instances and 8 filler bytes.

## Other Parameters

| Offset | Type  | Description
|--------|-------|------------
| 0x0     | ushort  | Damage Ceiling
| 0x2     | ushort  | Damage Floor
| 0x4     | float  | fWeight
| 0x8     | uint    | [Effectiveness Flag](#Effectiveness-Flag)
| 0xC     | char    | Prize Box probability.
| 0xD     | char[3] | padding
| 0x10     | uint    | Number of [Technique Parameters](#Technique-Parameters).
| 0x14     | uint    | Offset to [Technique Parameters](#Technique-Parameters).
| 0x18     | uint    | Number of [Drop Items](#Drop-Items).
| 0x1C     | uint    | Offset to [Drop Items](#Drop-Items).
| 0x20     | uint    | Number of [Extra Parameters](#Extra-Parameters).
| 0x24     | uint    | Offset to [Extra Parameters](#Extra-Parameters).

### Effectiveness Flag

| Bit | Count | Description
|-----|-------|-------------
|  0 | 2 | Effective Poison
|  2 | 2 | Effective Stop
|  4 | 2 | Effective Bind
|  6 | 2 | Effective Faint
|  8 | 2 | Effective Blind
| 10 | 2 | Effective Minimum
| 12 | 20| padding

## Technique Parameters

This structures repeats for as many animations need their parameters set.

| Offset | Type  | Description
|--------|-------|------------
| 0x0     | float  | Technique Damage Multiplier
| 0x4     | byte  | Technique Number
| 0x5     | byte  | [Attack Kind](#Attack-Kind)
| 0x6     | byte  | [Attack Attribute](#Attack-Attribute)
| 0x7     | byte  | Success Rate (Usually 0x64 [100])

## Drop Parameters

Items dropped by enemies.

| Offset | Type  | Description
|--------|-------|------------
| 0x0     | uint  | Value for [Drop Kind](#Drop-Kind)
| 0x4     | ushort  | Number
| 0x6     | ushort  | Probability

### Drop Kind

| Id | Kind  | Description
|--------|-------|------------
| 0x0     | ITEM_KIND_HP_SMALL  | Small HP orb.
| 0x1     | ITEM_KIND_HP_BIG  | Big HP orb.
| 0x2     | ITEM_KIND_MUNNY_SMALL  | Small Munny orb.
| 0x3     | ITEM_KIND_MUNNY_MIDDEL  | Middle Munny orb.
| 0x4     | ITEM_KIND_MUNNY_BIG  | Big Munny orb.
| 0x5     | ITEM_KIND_FOCUS_SMALL  | Small Focus orb.
| 0x6     | ITEM_KIND_FOCUS_BIG  | Big Focus orb.
| 0x7     | ITEM_KIND_DRAINMIST  |
| 0x8     | ITEM_KIND_D_LINK  |
| 0x9     | ITEM_KIND_MANDORAKE1  |
| 0xA     | ITEM_KIND_MANDORAKE2  |
| 0xB     | ITEM_KIND_JERRYBALL1  |
| 0xC     | ITEM_KIND_JERRYBALL2  |
| 0xD     | ITEM_KIND_JERRYBALL3  |
| 0xE     | ITEM_KIND_JERRYBALL4  |
| 0xF     | ITEM_KIND_JERRYBALL5  |
| 0x10    | ITEM_KIND_JERRYBALL6  |
| 0x11    | ITEM_KIND_JERRYBALL7  |
| 0x12    | ITEM_KIND_JERRYBALL8  |

## Extra Parameters

This structure contains AI parameters that can change the values in variables used in the enemy's LUA.

| Offset | Type  | Description
|--------|-------|------------
| 00     | char[0xC]  | Parameter Name
| 0C     | float  | Parameter Value

#### Attack Kind

| Id | Kind | Description |
|----|-------|-----------|
| 0x01 | Small Damage |
| 0x02 | Big Damage |
| 0x03 | Blow Damage |
| 0x04 | Toss Damage |
| 0x05 | Beat Damage |
| 0x06 | Flick Damage |
| 0x07 | Poison |
| 0x08 | Slow |
| 0x09 | Stop |
| 0x0A | Bind |
| 0x0B | Stun |
| 0x0C | Freeze |
| 0x0D | Burn |
| 0x0E | Confu |
| 0x0F | Blind |
| 0x10 | Death |
| 0x11 | Kill |
| 0x12 | Capture |
| 0x13 | Magnet |
| 0x14 | Zero Gravity |
| 0x15 | Aero | Fly in circles.
| 0x16 | Tornado | More violent version of Aero
| 0x17 | Degenerator | No effect on player.
| 0x18 | Without | Long launch backwards.
| 0x19 | Eat | No effect on player.
| 0x1A | Treasure Raid | Bound by attack (MF Doom for example) Infinite loop
| 0x1B | Sleeping Death | Long launch backwards.
| 0x1C | Sleep | No Zs appear.
| 0x1D | Magnet Munny | Same as sleep but Zs appear on top of the character.
| 0x1E | Magnet HP | No effect on player.
| 0x1F | Magnet Focus | No effect on player.
| 0x20 | Mini | No effect on player.
| 0x21 | Quake | Mini.
| 0x22 | Recover | Normal hit.
| 0x23 | Discommand | Doesn't work on player.
| 0x24 | Disprize_M | Blow away commands?
| 0x25 | Disprize_H | Normal hit.
| 0x26 | Disprize_F | Normal hit.
| 0x27 | Detone | Long launch backwards.
| 0x28 | GM_BLOW | Blown upwards and stunned on landing.
| 0x29 | Blast | Long launch backwards and stunned on landing.
| 0x2A | Magnet Spiral | Character goes crazy moving around the whole arena.
| 0x2B | Glacial Arts | Long launch backwards.
| 0x2C | Transcendence | Long launch backwards.
| 0x2D | Vengeance | Same as "Blind".
| 0x2E | Magnet Breaker | Long launch backwards.
| 0x2F | Magic Impulse CF | Casts Confu or Freeze.
| 0x30 | Magic Impulse CFB | Casts Confu.
| 0x31 | Magic Impulse CFBB | Casts Confu, Freeze or Bind.
| 0x32 | Rise Damage | Launch forces you to be in the air.
| 0x33 | Stumble | Forced to be in Idle animation for 8 seconds.
| 0x34 | Mount | Forced to be in Idle animation while "Press O/X" appears on screen for a few seconds.
| 0x35 | Imprisonment | Character is attached to enemy's position.
| 0x36 | Slow Stop | Can result in Slow or Stop.
| 0x37 | Gathering | Freezes character for a long time.
| 0x38 | Exhausted | 1HP, No Focus, No D-Link, All Commands in cooldown.

#### Attack Attribute

| Id | Kind
|----|-------
| 0x0 | Non/Elemental
| 0x1 | Physical
| 0x2 | Fire
| 0x3 | Ice
| 0x4 | Thunder
| 0x5 | Darkness
| 0x6 | Zero
| 0x7 | Special
| 0x8 | MAX


text:
package com.amazonaws.services.config.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * An object with the name of the retention configuration and the retention period in days. The object stores the
 * configuration for data retention in AWS Config.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RetentionConfiguration implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The name of the retention configuration object.
     *

     */
    private String name;
    /**
     *

     * Number of days AWS Config stores your historical information.
     *

     * <note>
     *

     * Currently, only applicable to the configuration item history.
     *

     * </note>
     */
    private Integer retentionPeriodInDays;

    /**
     *

     * The name of the retention configuration object.
     *

     *
     * @param name
     *        The name of the retention configuration object.
     */

    public void setName(String name) {
        this.name = name;
    }

    /**
     *

     * The name of the retention configuration object.
     *

     *
     * @return The name of the retention configuration object.
     */

    public String getName() {
        return this.name;
    }

    /**
     *

     * The name of the retention configuration object.
     *

     *
     * @param name
     *        The name of the retention configuration object.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public RetentionConfiguration withName(String name) {
        setName(name);
        return this;
    }

    /**
     *

     * Number of days AWS Config stores your historical information.
     *

     * <note>
     *

     * Currently, only applicable to the configuration item history.
     *

     * </note>
     *
     * @param retentionPeriodInDays
     *        Number of days AWS Config stores your historical information.
 <note>
     *

     *        Currently, only applicable to the configuration item history.
     *

     */

    public void setRetentionPeriodInDays(Integer retentionPeriodInDays) {
        this.retentionPeriodInDays = retentionPeriodInDays;
    }

    /**
     *

     * Number of days AWS Config stores your historical information.
     *

     * <note>
     *

     * Currently, only applicable to the configuration item history.
     *

     * </note>
     *
     * @return Number of days AWS Config stores your historical information.
 <note>
     *

     *         Currently, only applicable to the configuration item history.
     *

     */

    public Integer getRetentionPeriodInDays() {
        return this.retentionPeriodInDays;
    }

    /**
     *

     * Number of days AWS Config stores your historical information.
     *

     * <note>
     *

     * Currently, only applicable to the configuration item history.
     *

     * </note>
     *
     * @param retentionPeriodInDays
     *        Number of days AWS Config stores your historical information.
 <note>
     *

     *        Currently, only applicable to the configuration item history.
     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public RetentionConfiguration withRetentionPeriodInDays(Integer retentionPeriodInDays) {
        setRetentionPeriodInDays(retentionPeriodInDays);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getName() != null)
            sb.append("Name: ").append(getName()).append(",");
        if (getRetentionPeriodInDays() != null)
            sb.append("RetentionPeriodInDays: ").append(getRetentionPeriodInDays());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof RetentionConfiguration == false)
            return false;
        RetentionConfiguration other = (RetentionConfiguration) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getRetentionPeriodInDays() == null ^ this.getRetentionPeriodInDays() == null)
            return false;
        if (other.getRetentionPeriodInDays() != null && other.getRetentionPeriodInDays().equals(this.getRetentionPeriodInDays()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getRetentionPeriodInDays() == null) ? 0 : getRetentionPeriodInDays().hashCode());
        return hashCode;
    }

    @Override
    public RetentionConfiguration clone() {
        try {
            return (RetentionConfiguration) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.config.model.transform.RetentionConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
from neutron_lib import exceptions

from networking_plumgrid._i18n import _
from networking_plumgrid.neutron.plugins.common import (l2_exceptions
     as l2gw_exc)
from networking_plumgrid.neutron.plugins.common import constants
from networking_plumgrid.neutron.plugins.common import l2gw_validators
from networking_plumgrid.neutron.plugins.db.l2gateway import (l2gateway_models
     as models)
from networking_plumgrid.neutron.plugins.db.l2gateway import db_query
from oslo_log import log as logging
from oslo_utils import uuidutils
import six
from sqlalchemy.orm import exc as sa_orm_exc

LOG = logging.getLogger(__name__)

class L2GatewayMixin(db_query.L2GatewayCommonDbMixin):
    """Class L2GatewayMixin for handling l2_gateway resource."""
    gateway_resource = constants.GATEWAY_RESOURCE_NAME
    connection_resource = constants.CONNECTION_RESOURCE_NAME

    def _get_l2_gateway(self, context, gw_id):
        try:
            gw = context.session.query(models.PGL2Gateway).get(gw_id)
        except sa_orm_exc.NoResultFound:
            raise l2gw_exc.L2GatewayNotFound(gateway_id=gw_id)
        return gw

    def _get_l2_gateways(self, context):
        return context.session.query(models.PGL2Gateway).all()

    def _get_l2_gw_interfaces(self, context, id):
        return context.session.query(models.PGL2GatewayInterface).filter_by(
            device_id=id).all()

    def _is_vlan_configured_on_any_interface_for_l2gw(self,
                                                      context,
                                                      l2gw_id, vlan_id):
        result = {}
        match = False
        devices_db = self._get_l2_gateway_devices(context, l2gw_id)
        for device_model in devices_db:
            interfaces_db = self._get_l2_gw_interfaces(context,
                                                       device_model.id)
            for int_model in interfaces_db:
                query = context.session.query(models.PGL2GatewayInterface)
                int_db = query.filter_by(id=int_model.id).first()
                seg_id = int_db[constants.SEG_ID]
                if str(seg_id) == str(vlan_id):
                    result[device_model.id] = True
                    break
                else:
                    result[device_model.id] = False
        if match in result.values():
            return False
        else:
            return True

    def _get_l2_gateway_devices(self, context, l2gw_id):
        return context.session.query(models.PGL2GatewayDevice).filter_by(
            l2_gateway_id=l2gw_id).all()

    def _get_l2gw_devices_by_name_andl2gwid(self, context, device_name,
                                            l2gw_id):
        return context.session.query(models.PGL2GatewayDevice).filter_by(
            device_name=device_name, l2_gateway_id=l2gw_id).all()

    def _get_l2_gateway_connection(self, context, cn_id):
        try:
            con = context.session.query(
                  models.PGL2GatewayConnection).get(cn_id)
        except sa_orm_exc.NoResultFound:
            raise l2gw_exc.L2GatewayConnectionNotFound(id=cn_id)
        return con

    def _make_l2gw_connections_dict(self, gw_conn, fields=None):
        if gw_conn is None:
            raise l2gw_exc.L2GatewayConnectionNotFound(id="")
        segmentation_id = gw_conn['segmentation_id']
        if segmentation_id == 0:
            segmentation_id = ""
        res = {'id': gw_conn['id'],
               'network_id': gw_conn['network_id'],
               'l2_gateway_id': gw_conn['l2_gateway_id'],
               'tenant_id': gw_conn['tenant_id'],
               'segmentation_id': segmentation_id
               }
        return self._fields(res, fields)

    def _make_l2_gateway_dict(self, l2_gateway, fields=None):
        device_list = []
        for d in l2_gateway.devices:
            interface_list = []
            for interfaces_db in d.interfaces:
                seg_id = interfaces_db[constants.SEG_ID]
                if seg_id == 0:
                    seg_id = ""
                interface_list.append({'name':
                                       interfaces_db['interface_name'],
                                       constants.SEG_ID:
                                       seg_id})
            aligned_int__list = self._align_interfaces_list(interface_list)
            device_list.append({'device_name': d['device_name'],
                                'device_ip': d['device_ip'],
                                'id': d['id'],
                                'interfaces': aligned_int__list})
        res = {'id': l2_gateway['id'],
               'name': l2_gateway['name'],
               'vtep_ifc': l2_gateway['vtep_ifc'],
               'vtep_ip': l2_gateway['vtep_ip'],
               'devices': device_list,
               'tenant_id': l2_gateway['tenant_id']}
        return self._fields(res, fields)

    def _set_mapping_info_defaults(self, mapping_info):
        if not mapping_info.get(constants.SEG_ID):
            mapping_info[constants.SEG_ID] = 0

    def _retrieve_gateway_connections(self, context, gateway_id,
                                      mapping_info={}, only_one=False):
        filters = {'l2_gateway_id': [gateway_id]}
        for k, v in six.iteritems(mapping_info):
            if v and k != constants.SEG_ID:
                filters[k] = [v]
        query = self._get_collection_query(context,
                                           models.PGL2GatewayConnection,
                                           filters)
        return query.one() if only_one else query.all()

    def create_l2_gateway(self, context, l2_gateway):
        """Create a logical gateway."""
        self._admin_check(context, 'CREATE')
        gw = l2_gateway[self.gateway_resource]
        vtep_ip = gw.get('vtep_ip')
        l2gw_validators.is_valid_cidr(vtep_ip)
        tenant_id = self._get_tenant_id_for_create(context, gw)
        devices = gw['devices']
        self._validate_any_seg_id_empty_in_interface_dict(devices)
        gw_db = models.PGL2Gateway(
                    id=gw.get('id', uuidutils.generate_uuid()),
                    tenant_id=tenant_id,
                    name=gw.get('name'),
                    vtep_ifc=gw.get('vtep_ifc'),
                    vtep_ip=vtep_ip)
        context.session.add(gw_db)
        l2gw_device_dict = {}
        for device in devices:
            l2gw_device_dict['l2_gateway_id'] = id
            device_name = device['device_name']
            device_ip = device['device_ip']
            l2gw_device_dict['device_name'] = device_name
            l2gw_device_dict['device_ip'] = device_ip
            l2gw_device_dict['id'] = uuidutils.generate_uuid()
            uuid = self._generate_uuid()
            dev_db = models.PGL2GatewayDevice(id=uuid,
                                              l2_gateway_id=gw_db.id,
                                              device_name=device_name,
                                              device_ip=device_ip)
            context.session.add(dev_db)
            for interface_list in device['interfaces']:
                int_name = interface_list.get('name')
                if constants.SEG_ID in interface_list:
                    seg_id_list = interface_list.get(constants.SEG_ID)
                    for seg_ids in seg_id_list:
                        uuid = self._generate_uuid()
                        interface_db = self._get_int_model(uuid,
                                                           int_name,
                                                           dev_db.id,
                                                           seg_ids)
                        context.session.add(interface_db)
                else:
                    raise l2gw_exc.L2GatewaySegmentationRequired()
                context.session.query(models.PGL2GatewayDevice).all()
        return self._make_l2_gateway_dict(gw_db)

    def update_l2_gateway(self, context, id, l2_gateway):
        """Update l2 gateway."""
        self._admin_check(context, 'UPDATE')
        gw = l2_gateway[self.gateway_resource]
        if 'devices' in gw:
            devices = gw['devices']
        l2gw_db = self._get_l2_gateway(context, id)
        if l2gw_db.network_connections:
            raise l2gw_exc.L2GatewayInUse(gateway_id=id)
        dev_db = self._get_l2_gateway_devices(context, id)
        if not gw.get('devices'):
            raise l2gw_exc.L2GatewayDeviceRequired()
        for device in devices:
            dev_name = device['device_name']
            dev_db = self._get_l2gw_devices_by_name_andl2gwid(context,
                                                              dev_name,
                                                              id)
            if not dev_db:
                raise l2gw_exc.L2GatewayDeviceNotFound(device_id="")
            interface_db = self._get_l2_gw_interfaces(context,
                                                      dev_db[0].id)
            self._delete_l2_gateway_interfaces(context, interface_db)
            interface_dict_list = []
            self.validate_device_name(context, dev_name, id)
            for interfaces in device['interfaces']:
                interface_dict_list.append(interfaces)
            self._update_interfaces_db(context, interface_dict_list,
                                       dev_db)
        if gw.get('name'):
            l2gw_db.name = gw.get('name')
        return self._make_l2_gateway_dict(l2gw_db)

    def _update_interfaces_db(self, context, interface_dict_list, device_db):
        for interfaces in interface_dict_list:
            int_name = interfaces.get('name')
            if constants.SEG_ID in interfaces:
                seg_id_list = interfaces.get(constants.SEG_ID)
                for seg_ids in seg_id_list:
                    uuid = self._generate_uuid()
                    int_db = self._get_int_model(uuid,
                                                 int_name,
                                                 device_db[0].id,
                                                 seg_ids)
                    context.session.add(int_db)
            else:
                uuid = self._generate_uuid()
                interface_db = self._get_int_model(uuid,
                                                   int_name,
                                                   device_db[0].id,
                                                   0)
                context.session.add(interface_db)

    def get_l2_gateway(self, context, id, fields=None):
        """get the l2 gateway by id."""
        self._admin_check(context, 'GET')
        gw_db = self._get_l2_gateway(context, id)
        if gw_db:
            return self._make_l2_gateway_dict(gw_db, fields)
        else:
            return []

    def delete_l2_gateway(self, context, id):
        """delete the l2 gateway  by id."""
        self._admin_check(context, 'DELETE')
        gw_db = self._get_l2_gateway(context, id)
        if gw_db is None:
            raise l2gw_exc.L2GatewayNotFound(gateway_id=id)
        if gw_db.network_connections:
            raise l2gw_exc.L2GatewayInUse(gateway_id=id)
        context.session.delete(gw_db)
        LOG.debug("l2 gateway '%s' was deleted.", id)

    def get_l2_gateways(self, context, filters=None, fields=None,
                        sorts=None,
                        limit=None,
                        marker=None,
                        page_reverse=False):
        """list the l2 gateways available in the neutron DB."""
        self._admin_check(context, 'GET')
        marker_obj = self._get_marker_obj(
            context, 'l2_gateway', limit, marker)
        return self._get_collection(context, models.PGL2Gateway,
                                    self._make_l2_gateway_dict,
                                    filters=filters, fields=fields,
                                    sorts=sorts, limit=limit,
                                    marker_obj=marker_obj,
                                    page_reverse=page_reverse)

    def _update_segmentation_id(self, context, l2gw_id, segmentation_id):
        """Update segmentation id for interfaces."""
        device_db = self._get_l2_gateway_devices(context, l2gw_id)
        for device_model in device_db:
            interface_db = self._get_l2_gw_interfaces(context,
                                                      device_model.id)
            for interface_model in interface_db:
                interface_model.segmentation_id = segmentation_id

    def _delete_l2_gateway_interfaces(self, context, int_db_list):
        """delete the l2 interfaces  by id."""
        for interfaces in int_db_list:
            context.session.delete(interfaces)
        LOG.debug("l2 gateway interfaces was deleted.")

    def create_l2_gateway_connection(self, context, l2_gateway_connection):
        """Create l2 gateway connection."""
        self._admin_check(context, 'CREATE')
        gw_connection = l2_gateway_connection[self.connection_resource]
        l2_gw_id = gw_connection.get('l2_gateway_id')
        network_id = gw_connection.get('network_id')
        nw_map = {}
        nw_map['network_id'] = network_id
        nw_map['l2_gateway_id'] = l2_gw_id
        segmentation_id = ""
        if constants.SEG_ID in gw_connection:
            segmentation_id = gw_connection.get(constants.SEG_ID)
            nw_map[constants.SEG_ID] = segmentation_id
        is_vlan = self._is_vlan_configured_on_any_interface_for_l2gw(context,
                                                              l2_gw_id,
                                                              segmentation_id)
        network_id = l2gw_validators.validate_network_mapping_list(nw_map,
                                                                   is_vlan)
        if not is_vlan:
            raise l2gw_exc.L2GatewaySegmentationRequired()
        gw_db = self._get_l2_gateway(context, l2_gw_id)
        tenant_id = self._get_tenant_id_for_create(context, gw_db)
        if self._retrieve_gateway_connections(context,
                                              l2_gw_id,
                                              nw_map):
            raise l2gw_exc.L2GatewayConnectionExists(mapping=nw_map,
                                                     gateway_id=l2_gw_id)
        nw_map['tenant_id'] = tenant_id
        connection_id = uuidutils.generate_uuid()
        nw_map['id'] = connection_id
        if not segmentation_id:
            raise l2gw_exc.L2GatewaySegmentationRequired()
        gw_db.network_connections.append(
                models.PGL2GatewayConnection(**nw_map))
        gw_db = models.PGL2GatewayConnection(id=connection_id,
                                             tenant_id=tenant_id,
                                             network_id=network_id,
                                             l2_gateway_id=l2_gw_id,
                                             segmentation_id=segmentation_id)
        return self._make_l2gw_connections_dict(gw_db)

    def get_l2_gateway_connections(self, context, filters=None,
                                   fields=None,
                                   sorts=None, limit=None, marker=None,
                                   page_reverse=False):
        """List l2 gateway connections."""
        self._admin_check(context, 'GET')
        marker_obj = self._get_marker_obj(
            context, 'l2_gateway_connection', limit, marker)
        return self._get_collection(context, models.PGL2GatewayConnection,
                                    self._make_l2gw_connections_dict,
                                    filters=filters, fields=fields,
                                    sorts=sorts, limit=limit,
                                    marker_obj=marker_obj,
                                    page_reverse=page_reverse)

    def get_l2_gateway_connection(self, context, id, fields=None):
        """Get l2 gateway connection."""
        self._admin_check(context, 'GET')
        """Get the l2 gateway  connection  by id."""
        gw_db = self._get_l2_gateway_connection(context, id)
        return self._make_l2gw_connections_dict(gw_db, fields)

    def delete_l2_gateway_connection(self, context, id):
        """Delete the l2 gateway connection by id."""
        self._admin_check(context, 'DELETE')
        gw_db = self._get_l2_gateway_connection(context, id)
        context.session.delete(gw_db)
        LOG.debug("l2 gateway '%s' was destroyed.", id)

    def _admin_check(self, context, action):
        """Admin role check helper."""
        if not context.is_admin:
            reason = _('Cannot %s resource for non admin tenant') % action
            raise exceptions.AdminRequired(reason=reason)

    def _generate_uuid(self):
        """Generate uuid helper."""
        uuid = uuidutils.generate_uuid()
        return uuid

    def _get_int_model(self, uuid, interface_name, dev_id, seg_id):
        return models.PGL2GatewayInterface(id=uuid,
                                         interface_name=interface_name,
                                         device_id=dev_id,
                                         segmentation_id=seg_id)

    def get_l2gateway_devices_by_gateway_id(self, context, l2_gateway_id):
        """Get l2gateway_devices_by id."""
        session = context.session
        with session.begin():
            return session.query(models.PGL2GatewayDevice).filter_by(
                l2_gateway_id=l2_gateway_id).all()

    def get_l2gateway_interfaces_by_device_id(self, context, device_id):
        """Get all l2gateway_interfaces_by device_id."""
        session = context.session
        with session.begin():
            return session.query(models.PGL2GatewayInterface).filter_by(
                device_id=device_id).all()

    def validate_device_name(self, context, device_name, l2gw_id):
        if device_name:
            devices_db = self._get_l2gw_devices_by_name_andl2gwid(context,
                                                                  device_name,
                                                                  l2gw_id)
        if not devices_db:
            raise l2gw_exc.L2GatewayDeviceNameNotFound(device_name=device_name)

    def _validate_any_seg_id_empty_in_interface_dict(self, devices):
        """Validate segmentation_id for consistency."""
        for device in devices:
            interface_list = device['interfaces']
            if not interface_list:
                raise l2gw_exc.L2GatewayInterfaceRequired()
            if constants.SEG_ID in interface_list[0]:
                for interfaces in interface_list[1:len(interface_list)]:
                    if constants.SEG_ID not in interfaces:
                        raise l2gw_exc.L2GatewaySegmentationRequired()
            if constants.SEG_ID not in interface_list[0]:
                for interfaces in interface_list[1:len(interface_list)]:
                    if constants.SEG_ID in interfaces:
                        raise l2gw_exc.L2GatewaySegmentationRequired()

    def _align_interfaces_list(self, interface_list):
        """Align interfaces list based on input dict for multiple seg ids."""
        interface_dict = {}
        aligned_interface_list = []
        for interfaces in interface_list:
            actual__name = interfaces.get('name')
            if actual__name in interface_dict:
                interface_name = interface_dict.get(actual__name)
                seg_id_list = interfaces.get(constants.SEG_ID)
                interface_name.append(str(seg_id_list))
                interface_dict.update({actual__name: interface_name})
            else:
                seg_id = str(interfaces.get(constants.SEG_ID)).split()
                interface_dict.update({actual__name: seg_id})
        for name in interface_dict:
            aligned_interface_list.append({'segmentation_id':
                                           interface_dict[name],
                                           'name': name})
        return aligned_interface_list

    def _get_l2_gateway_connections(self, context):
        """Get l2 gateway connections."""
        try:
            con = context.session.query(models.PGL2GatewayConnection).all()
        except sa_orm_exc.NoResultFound:
            raise l2gw_exc.L2GatewayConnectionNotFound(
                id="")
        return con

    def _get_l2gw_ids_by_interface_switch(self, context, interface_name,
                                          switch_name):
        """Get l2 gateway ids by interface and switch."""
        connections = self._get_l2_gateway_connections(context)
        l2gw_id_list = []
        if connections:
            for connection in connections:
                l2gw_id = connection.l2_gateway_id
                devices = self._get_l2_gateway_device_by_name_id(context,
                                                                 switch_name,
                                                                 l2gw_id)
                if devices:
                    for device in devices:
                        interfaces = self._get_l2_gw_interfaces(context,
                                                                device.id)
                        for interface in interfaces:
                            if interface_name == interface.interface_name:
                                l2gw_id_list.append(l2gw_id)
                else:
                    LOG.debug("l2 gateway devices are empty")
        else:
            LOG.debug("l2 gateway connections are empty")
        return l2gw_id_list

    def _delete_connection_by_l2gw_id(self, context, l2gw_id):
        """Delete the l2 gateway connection by l2gw id."""
        con_db = self._get_l2_gateway_connection_by_l2gw_id(context,
                                                            l2gw_id)
        if con_db:
            context.session.delete(con_db[0])
            LOG.debug("l2 gateway connection was destroyed.")

    def _get_l2_gateway_connection_by_l2gw_id(self, context, l2gw_id):
        """Get the l2 gateway connection by l2gw id."""
        try:
            con = context.session.query(
                  models.PGL2GatewayConnection).filter_by(
                  l2_gateway_id=l2gw_id).all()
        except sa_orm_exc.NoResultFound:
            raise l2gw_exc.L2GatewayConnectionNotFound(
                id=l2gw_id)
        return con

    def _get_l2_gateway_device_by_name_id(self, context, device_name, l2gw_id):
        """Get the l2 gateway device by name and id."""
        try:
            gw = context.session.query(models.PGL2GatewayDevice).filter_by(
                device_name=device_name, l2_gateway_id=l2gw_id).all()
        except sa_orm_exc.NoResultFound:
            raise l2gw_exc.L2GatewayDeviceNotFound(
                device_id=device_name)
        return gw


text:
.taglib-discussion table.tree-walker {
  width: 100%; }
  .taglib-discussion table.tree-walker td {
    padding: 4px; }
.taglib-discussion .lfr-discussion {
  border-bottom: 1px solid transparent;
  margin: 0 0 5px;
  padding: 5px 0 5px 0;
  position: relative;
  width: auto; }
  .taglib-discussion .lfr-discussion:after {
    clear: both;
    content: ".";
    display: block;
    height: 0;
    visibility: hidden; }
  .taglib-discussion .lfr-discussion.last {
    border-bottom-width: 0; }
.taglib-discussion .lfr-discussion-details {
  width: 15%; }
  .taglib-discussion .lfr-discussion-details .column-content {
    padding: 0; }
  .taglib-discussion .lfr-discussion-details .taglib-user-display {
    padding-bottom: 0;
    padding-top: 0; }
    .taglib-discussion .lfr-discussion-details .taglib-user-display .user-details .user-name {
      line-height: 1em; }
    .taglib-discussion .lfr-discussion-details .taglib-user-display .user-details .user-name, .taglib-discussion .lfr-discussion-details .taglib-user-display .user-profile-image {
      clear: none;
      vertical-align: top;
      text-align: center; }
    .taglib-discussion .lfr-discussion-details .taglib-user-display .user-profile-image img {
      width: 50px; }
.taglib-discussion .lfr-discussion-body {
  width: 85%; }
  .taglib-discussion .lfr-discussion-body .lfr-discussion-controls .taglib-ratings .rating-label-element {
    padding-left: 0; }
.taglib-discussion .lfr-discussion-body-content {
  padding: 5px 0 0 0.5em; }
.taglib-discussion .lfr-discussion-posted-on {
  clear: both;
  float: right;
  padding-top: 0.5em; }
.taglib-discussion .lfr-discussion-message {
  padding-bottom: 1em;
  -ms-word-break: break-all;
  word-break: break-all;
  word-break: break-word; }
.taglib-discussion .taglib-ratings {
  display: inline-block;
  margin-right: 1em; }
.taglib-discussion .lfr-discussion-actions {
  float: right;
  margin: 0; }
  .taglib-discussion .lfr-discussion-actions li, .taglib-discussion .lfr-discussion-actions li a {
    display: inline-block;
    list-style: none;
    vertical-align: top; }
  .taglib-discussion .lfr-discussion-actions li a {
    clip: rect(0 0 0 0);
    position: absolute; }
  .taglib-discussion .lfr-discussion-actions a.rating-element {
    margin: 0 1px; }
.taglib-discussion .lfr-discussion:hover .lfr-discussion-actions li a, .taglib-discussion .lfr-discussion .lfr-discussion-actions li a:focus {
  clip: rect(auto auto auto auto);
  position: static; }
.taglib-discussion .lfr-discussion-form-container {
  clear: both; }
  .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form {
    display: inline-block;
    padding: 5px 5px 5px 50px;
    position: relative; }
    .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form.lfr-discussion-form-edit, .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form.lfr-discussion-form-reply {
      left: 0;
      margin-left: 0;
      padding: 5px; }
      .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form.lfr-discussion-form-edit textarea, .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form.lfr-discussion-form-reply textarea {
        max-width: 100%;
        width: 100%;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box; }
    .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form .taglib-user-display .user-profile-image {
      left: 5px;
      position: absolute;
      top: 5px; }
      .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form .taglib-user-display .user-profile-image .avatar {
        width: 40px; }
    .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form .taglib-user-display .user-details .user-name {
      display: none; }
    .taglib-discussion .lfr-discussion-form-container .lfr-discussion-form .button-holder {
      margin: 5px 0 0; }

.lfr-discussion-reply.popover {
  max-width: none; }
  .lfr-discussion-reply.popover .lfr-discussion-reply-user-avatar {
    float: left;
    margin-right: 15px;
    margin-top: 3px; }
  .lfr-discussion-reply.popover .lfr-discussion-reply-user-name {
    font-weight: bold; }
  .lfr-discussion-reply.popover .lfr-discussion-reply-content {
    margin-top: 5px; }

.lfr-discussion-controls:after {
  clear: both;
  content: "";
  display: block;
  height: 0; }

.ie6 .taglib-discussion .lfr-discussion, .ie7 .taglib-discussion .lfr-discussion {
  zoom: 1; }

/* Skin */
.taglib-discussion table.tree-walker {
  border-width: 0;
  border-collapse: collapse; }
.taglib-discussion .lfr-discussion {
  border-bottom-color: #DDD; }
.taglib-discussion .lfr-discussion-details .taglib-user-display {
  word-wrap: break-word; }
  .taglib-discussion .lfr-discussion-details .taglib-user-display .user-details .user-name {
    font-weight: bold;
    text-decoration: none; }
    .taglib-discussion .lfr-discussion-details .taglib-user-display .user-details .user-name:hover {
      text-decoration: underline; }
.taglib-discussion .lfr-discussion-posted-on {
  color: #999;
  font-size: .9em; }
  .taglib-discussion .lfr-discussion-posted-on .lfr-discussion-parent-link {
    cursor: pointer; }
.taglib-discussion .lfr-discussion-actions li a, .taglib-discussion .lfr-discussion-actions li a span {
  text-decoration: none; }
.taglib-discussion .lfr-discussion-actions li a:hover span, .taglib-discussion .lfr-discussion-actions li a:focus span {
  text-decoration: underline; }
.taglib-discussion .lfr-discussion-form-container .lfr-discussion-form {
  background: #DDD;
  border-radius: 4px; }


text:
<?xml version='1.0' encoding='UTF-8'?>
<DescribeLoadBalancersResponse>
	<LoadBalancers>
		<LoadBalancer>
			<CreateTimeStamp>1452403099000</CreateTimeStamp>
			<SlaveZoneId>cn-hangzhou-b</SlaveZoneId>
			<NetworkType>classic</NetworkType>
			<MasterZoneId>cn-hangzhou-d</MasterZoneId>
			<RegionIdAlias>cn-hangzhou</RegionIdAlias>
			<CreateTime>2016-01-10T13:18Z</CreateTime>
			<RegionId>cn-hangzhou-dg-a01</RegionId>
			<Address>120.27.186.149</Address>
			<AddressType>internet</AddressType>
			<LoadBalancerId>15229f88562-cn-hangzhou-dg-a01</LoadBalancerId>
			<LoadBalancerName>abc</LoadBalancerName>
			<LoadBalancerStatus>active</LoadBalancerStatus>
		</LoadBalancer>
	</LoadBalancers>
	<RequestId>A0DAF856-B181-4098-B507-6CE9E40420E8</RequestId>
</DescribeLoadBalancersResponse>


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import com.itextpdf.text.DocumentException;
import java.beans.PropertyVetoException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import util.Alert;
import util.GeneratorPDF;
import util.Internal;
import view.cliente.ViewConsultaCliente;
import view.venda.ViewConsultaVenda;

/**
 *
 * @author Paulo Soza
 */
public class ViewPrincipal extends javax.swing.JFrame {

    ViewConsultaCliente viewConsultaCliente = new ViewConsultaCliente();
    ViewConsultaVenda viewConsultaVenda = new ViewConsultaVenda();

    /**
     * Creates new form view_principal
     */
    public ViewPrincipal() {
        initComponents();
        iniciarTelas();
        setLocationRelativeTo(this);
        Internal.retiraBotao(viewConsultaCliente);

        this.setTitle("Venda a Prazo");
    }

    public void iniciarTelas() {

        desktop.add(viewConsultaCliente);
        desktop.add(viewConsultaVenda);

        try {
            viewConsultaCliente.setMaximum(true);
            viewConsultaVenda.setMaximum(true);

        } catch (PropertyVetoException e) {
            System.err.println(" Exception maximizar internal\n " + e);
        }
    }

    public void trocarTelas(JInternalFrame jInternalFrame) {

        viewConsultaCliente.setVisible(false);
        viewConsultaVenda.setVisible(false);

        if (jInternalFrame != null)
            jInternalFrame.setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktop = new javax.swing.JDesktopPane();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout desktopLayout = new javax.swing.GroupLayout(desktop);
        desktop.setLayout(desktopLayout);
        desktopLayout.setHorizontalGroup(
            desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 670, Short.MAX_VALUE)
        );
        desktopLayout.setVerticalGroup(
            desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 392, Short.MAX_VALUE)
        );

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/cliente.png"))); // NOI18N
        jButton1.setText("Cliente");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/vendas.png"))); // NOI18N
        jButton2.setText("Vendas ");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/pdf-icon.png"))); // NOI18N
        jButton3.setText("Exportar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktop)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton3)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2)
                    .addComponent(jButton3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(desktop))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        trocarTelas(viewConsultaCliente);
        viewConsultaCliente.showTable();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        trocarTelas(viewConsultaVenda);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        String DEST;
        JFileChooser chooserDiretorio = new JFileChooser();
        chooserDiretorio.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooserDiretorio.setDialogTitle("Escolha a pasta onde desejar salvar.");
        chooserDiretorio.showSaveDialog(getParent());
        DEST = chooserDiretorio.getSelectedFile().getAbsolutePath();
        DEST += "/Relatório Popular Gás.pdf";

        try {
            new GeneratorPDF().createPdf(DEST);
            Alert.sucess("Arquivo exportado com sucesso!", "Relatório Vendas");
        } catch (IOException ex) {
            Logger.getLogger(ViewPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        } catch (DocumentException ex) {
            Logger.getLogger(ViewPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_jButton3ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ViewPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ViewPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ViewPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ViewPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ViewPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane desktop;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    // End of variables declaration//GEN-END:variables
}


text:
/*	$OpenBSD: ssherr.h,v 1.8 2020/01/25 23:13:09 djm Exp $	*/
/*
 * Copyright (c) 2011 Damien Miller
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _SSHERR_H
#define _SSHERR_H

/* XXX are these too granular? not granular enough? I can't decide - djm */

/* Error codes */
#define SSH_ERR_SUCCESS				0
#define SSH_ERR_INTERNAL_ERROR			-1
#define SSH_ERR_ALLOC_FAIL			-2
#define SSH_ERR_MESSAGE_INCOMPLETE		-3
#define SSH_ERR_INVALID_FORMAT			-4
#define SSH_ERR_BIGNUM_IS_NEGATIVE		-5
#define SSH_ERR_STRING_TOO_LARGE		-6
#define SSH_ERR_BIGNUM_TOO_LARGE		-7
#define SSH_ERR_ECPOINT_TOO_LARGE		-8
#define SSH_ERR_NO_BUFFER_SPACE			-9
#define SSH_ERR_INVALID_ARGUMENT		-10
#define SSH_ERR_KEY_BITS_MISMATCH		-11
#define SSH_ERR_EC_CURVE_INVALID		-12
#define SSH_ERR_KEY_TYPE_MISMATCH		-13
#define SSH_ERR_KEY_TYPE_UNKNOWN		-14 /* XXX UNSUPPORTED? */
#define SSH_ERR_EC_CURVE_MISMATCH		-15
#define SSH_ERR_EXPECTED_CERT			-16
#define SSH_ERR_KEY_LACKS_CERTBLOB		-17
#define SSH_ERR_KEY_CERT_UNKNOWN_TYPE		-18
#define SSH_ERR_KEY_CERT_INVALID_SIGN_KEY	-19
#define SSH_ERR_KEY_INVALID_EC_VALUE		-20
#define SSH_ERR_SIGNATURE_INVALID		-21
#define SSH_ERR_LIBCRYPTO_ERROR			-22
#define SSH_ERR_UNEXPECTED_TRAILING_DATA	-23
#define SSH_ERR_SYSTEM_ERROR			-24
#define SSH_ERR_KEY_CERT_INVALID		-25
#define SSH_ERR_AGENT_COMMUNICATION		-26
#define SSH_ERR_AGENT_FAILURE			-27
#define SSH_ERR_DH_GEX_OUT_OF_RANGE		-28
#define SSH_ERR_DISCONNECTED			-29
#define SSH_ERR_MAC_INVALID			-30
#define SSH_ERR_NO_CIPHER_ALG_MATCH		-31
#define SSH_ERR_NO_MAC_ALG_MATCH		-32
#define SSH_ERR_NO_COMPRESS_ALG_MATCH		-33
#define SSH_ERR_NO_KEX_ALG_MATCH		-34
#define SSH_ERR_NO_HOSTKEY_ALG_MATCH		-35
#define SSH_ERR_NO_HOSTKEY_LOADED		-36
#define SSH_ERR_PROTOCOL_MISMATCH		-37
#define SSH_ERR_NO_PROTOCOL_VERSION		-38
#define SSH_ERR_NEED_REKEY			-39
#define SSH_ERR_PASSPHRASE_TOO_SHORT		-40
#define SSH_ERR_FILE_CHANGED			-41
#define SSH_ERR_KEY_UNKNOWN_CIPHER		-42
#define SSH_ERR_KEY_WRONG_PASSPHRASE		-43
#define SSH_ERR_KEY_BAD_PERMISSIONS		-44
#define SSH_ERR_KEY_CERT_MISMATCH		-45
#define SSH_ERR_KEY_NOT_FOUND			-46
#define SSH_ERR_AGENT_NOT_PRESENT		-47
#define SSH_ERR_AGENT_NO_IDENTITIES		-48
#define SSH_ERR_BUFFER_READ_ONLY		-49
#define SSH_ERR_KRL_BAD_MAGIC			-50
#define SSH_ERR_KEY_REVOKED			-51
#define SSH_ERR_CONN_CLOSED			-52
#define SSH_ERR_CONN_TIMEOUT			-53
#define SSH_ERR_CONN_CORRUPT			-54
#define SSH_ERR_PROTOCOL_ERROR			-55
#define SSH_ERR_KEY_LENGTH			-56
#define SSH_ERR_NUMBER_TOO_LARGE		-57
#define SSH_ERR_SIGN_ALG_UNSUPPORTED		-58
#define SSH_ERR_FEATURE_UNSUPPORTED		-59
#define SSH_ERR_DEVICE_NOT_FOUND		-60

/* Translate a numeric error code to a human-readable error string */
const char *ssh_err(int n);

#endif /* _SSHERR_H */


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

	<title>Test dojox.grid.Grid Basic</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>

dojox.grid.Grid Basic Test

	<button onclick="openDialog()">open</button>

				<button dojoType="dijit.form.Button" type="submit">close</button>


text:
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge">

BingSpeech.js using silences detection

Microsoft Cognitive Services

            Subscription:
            <input id="key" type="text" size="40" value="YOUR_BING_SPEECH_API_KEY">

                <select id="languageoptions">
                    <option value="zh-CN">Chinese - CN</option>
                    <option value="en-GB">English - GB</option>
                    <option value="en-US" selected="selected">English - US</option>
                    <option value="fr-FR">French - FR</option>
                    <option value="de-DE">German - DE</option>
                    <option value="it-IT">Italian - IT</option>
                    <option value="es-ES">Spanish - ES</option>
                </select>

            <button id="createBtn" onclick="createAndSetupClient()">Create</button><button id="startBtn" disabled="disabled" onclick="start()">Start</button><button id="stopBtn" disabled="disabled" onclick="stop()">Stop</button>

                <textarea id="output" style='width:400px;height:200px'></textarea>


text:
export class HttpError extends Error {

  constructor(message = 'Unknown error', httpCode = 400, restParams = {}) {
    super(message);
    this.description = message;
    this.httpCode = httpCode;
    this.restParams = restParams;
  }
}


text:
software-development-curriculum
===============================

The goal of this repository is to aggregate all of the course materials I've developed in the first four Nashville Software School cohorts.

## The Plan:

This is the unified repository of all information we have/do cover in the software development fundamentals course at [Nashville Software School](http://nashvillesoftwareschool.com).  It is used by the [courseware](http://coursewareofthefuture.herokuapp.com) to populate the course materials.

## Contributions:

Contributions are quite welcome!

We have a ton of articles that you can contribute to documented in the Github issues for this repo.

## Notes:

Files with the ".markdown" extension are purposely ignored by the courseware, so that we can use that extension for non-curriculum notes and markdown files.

## Contributors:

* Giovanni Delaqua (@JohnOfTheWater)
* Jeremy Ideus (@HeIsIdeus)
* Matt Lummus (@mattLumus)
* James Nix (@JamesNix)
* Aimee Knight (@AimeeKnight)
* Tyler Malone (@rtmalone)
* Mitchell Hollander (@MitchellSH)
* Matt Knicos (@mknicos)
* Steven Finley (@finleysa)
* Robert Fryman (@RJFryman)
* Nat Webb (@natwebb)
* Spencer Anastasio (@SpencerAnastasio)
* Peder Schacht (@PederSchacht)
* Adam Thede (@adamthese)
* Stephen Yeargim (@stephenyeargin)

### Note to Contributors:

I (Eliza) have rewritten the repository history to remove the large files that caused the repository to bloat to 400+Mb.  Pro: this means pulling down the repository no longer involves half a gig of data transfer.  Con: this means that the history in your local repositories no longer remotely matches anything you may have in your local repositories.


text:
<?php
namespace App\AdminBundle\Business\Staff;

class Constants
{

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Tubercularia leucoloma Durieu & Mont.

### Remarks
null


text:
Portfolio
=========

A portfolio website of past project for a CS 242 assignments.


text:
<dataStore>
  <id>DataStoreInfoImpl--63fe40c7:1426c385d2f:-74a0</id>
  <name>GeologyUnitStore</name>
  <type>PostGIS</type>
  <enabled>true</enabled>
  <workspace>
    <id>WorkspaceInfoImpl--1ad68c68:14258951e5c:-8000</id>
  </workspace>
  <connectionParameters>
    <entry key="dbtype">app-schema</entry>
    <entry key="url">file:workspaces/gsmlp/GeologyUnitStore/GeologicUnit.xml</entry>
    <entry key="namespace">http://xmlns.geosciml.org/geosciml-portrayal/2.0</entry>
  </connectionParameters>
  <__default>false</__default>
</dataStore>


text:
\chapter{Projektmanagement}

In diesem Kapitel sollten organisatorische Punkte beschrieben und
festgelegt werden.

\section{Prozess}

Legen Sie den Prozess fest, nach dem Sie das Projekt umsetzen wollen.
Geben Sie ggf. grobe Schritte an, wie Planungsrunden, Sprints, oder
ähnliches.

\section{PSP/Zeitplan/Tracking}

Projektstrukturplan, Ressourcenplan, Zeitplan, Abhängigkeiten von
Arbeitspaketen, eventueller Zeitverzug, Visualisierung des
Projektstandes, etc.

\section{Qualitätssicherung}

Überlegen sie, wie sie Qualität in ihrem Projekt sicher stellen wollen.
Listen sie die Maßnahmen hier auf. Beachten sie, dass diese Maßnahmen
für die unterschiedlichen Artefakte und Ebenen entsprechend
unterschiedlich sein können.


text:
// This file is automatically generated.

package adila.db;

/*
 * Motorola Moto G (3rd Gen)
 *
 * DEVICE: osprey_udstv
 * MODEL: MotoG3
 */
final class osprey5fudstv {
    public static final String DATA = "Motorola|Moto G (3rd Gen)|";
}