text:
/**
 */
package edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository;

import edu.kit.ipd.sdq.kamp4aps.model.aPS.ComponentRepository.TurningTable;

import edu.kit.ipd.sdq.kamp4aps.model.aPS.MechanicalComponents.Arm;

import edu.kit.ipd.sdq.kamp4aps.model.aPS.ModuleRepository.VacuumGripperModule;

/**
 *
 * A representation of the model object 'Crane'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.Crane#getArm Arm}

 *
{@link edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.Crane#getMountedOn Mounted On}

 *
{@link edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.Crane#getVacuumgripper Vacuumgripper}

 *

 *
 * @see edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.StructureRepositoryPackage#getCrane()
 * @model
 * @generated
 */
public interface Crane extends Structure {
	/**
	 * Returns the value of the 'Arm' reference.
	 * It is bidirectional and its opposite is '{@link edu.kit.ipd.sdq.kamp4aps.model.aPS.MechanicalComponents.Arm#getMountedTo Mounted To}'.
	 *
	 *

	 * If the meaning of the 'Arm' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Arm' reference.
	 * @see #setArm(Arm)
	 * @see edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.StructureRepositoryPackage#getCrane_Arm()
	 * @see edu.kit.ipd.sdq.kamp4aps.model.aPS.MechanicalComponents.Arm#getMountedTo
	 * @model opposite="mountedTo" required="true"
	 * @generated
	 */
	Arm getArm();

	/**
	 * Sets the value of the '{@link edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.Crane#getArm Arm}' reference.
	 *
	 *
	 * @param value the new value of the 'Arm' reference.
	 * @see #getArm()
	 * @generated
	 */
	void setArm(Arm value);

	/**
	 * Returns the value of the 'Mounted On' reference.
	 *
	 *

	 * If the meaning of the 'Mounted On' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Mounted On' reference.
	 * @see #setMountedOn(TurningTable)
	 * @see edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.StructureRepositoryPackage#getCrane_MountedOn()
	 * @model required="true"
	 * @generated
	 */
	TurningTable getMountedOn();

	/**
	 * Sets the value of the '{@link edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.Crane#getMountedOn Mounted On}' reference.
	 *
	 *
	 * @param value the new value of the 'Mounted On' reference.
	 * @see #getMountedOn()
	 * @generated
	 */
	void setMountedOn(TurningTable value);

	/**
	 * Returns the value of the 'Vacuumgripper' reference.
	 *
	 *

	 * If the meaning of the 'Vacuumgripper' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Vacuumgripper' reference.
	 * @see #setVacuumgripper(VacuumGripperModule)
	 * @see edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.StructureRepositoryPackage#getCrane_Vacuumgripper()
	 * @model required="true"
	 * @generated
	 */
	VacuumGripperModule getVacuumgripper();

	/**
	 * Sets the value of the '{@link edu.kit.ipd.sdq.kamp4aps.model.aPS.StructureRepository.Crane#getVacuumgripper Vacuumgripper}' reference.
	 *
	 *
	 * @param value the new value of the 'Vacuumgripper' reference.
	 * @see #getVacuumgripper()
	 * @generated
	 */
	void setVacuumgripper(VacuumGripperModule value);

} // Crane


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="search.css"/>

Loading...

  PDO_DSN
  PDOOAuth2.inc

  PDO_PASS
  PDOOAuth2.inc

  PDO_USER
  PDOOAuth2.inc

  PDOOAuth2

  PDOOAuth2.inc

  protected_resource.php

  protected_resource.php

Searching...

No Matches

redpajama_set_name: RedPajamaGithub


text:
import React, { PropTypes as T } from 'react'
import R from 'ramda'
import { reject } from 'when'
import DefaultRenderer from './DefaultRenderer'
import subscribeToPromise from '../utils/subscribeToPromise'

function fixCurPage(untrustedCurPage, count, perPage) {
  return Math.min(untrustedCurPage, Math.ceil(Math.max(count, 1) / perPage))
}

export default React.createClass({

  displayName: 'EntityList',

  propTypes: {
    endpoint: T.string,
    pagination: T.bool,
    Renderer: T.func
  },

  contextTypes: {
    fetch: T.func.isRequired
  },

  getDefaultProps() {
    return {
      pagination: true,
      Renderer: DefaultRenderer
    }
  },

  getInitialState() {
    return {
      loading: true,
      updating: false,
      items: null,
      error: null,
      perPage: 100,
      count: null,
      curPage: 1
    }
  },

  componentWillMount() {
    this.loadItems(this.props.endpoint)
  },

  componentWillReceiveProps(nextProps) {
    // This may happen when user transition to another page, which has exact same markup,
    // so component not unmounted, but props changed instead.
    if (nextProps.endpoint !== this.props.endpoint) {
      // FIXME:
      //   We should probably check here if an `handleUpdateRequest` is currently running.
      //   But what to do then? Note: It's quite unlikely that endpoint will change during an update.
      this.loadItems(nextProps.endpoint)
    }
  },

  componentWillUnmount() {
    this.unsub()
  },

  handleChangePageRequest(changes) {
    const { count, loading, updating } = this.state

    if (count === null || loading || updating) {
      return
    }

    const perPage = changes.perPage || this.state.perPage
    const curPage = fixCurPage(changes.curPage || this.state.curPage, count, perPage)

    this.setState({ perPage, curPage }, () => this.loadItems(this.props.endpoint))
  },

  unsub() {
    if (this._unsub) {
      this._unsub()
      this._unsub = null
    }
  },

  handleUpdateRequest(updater) {
    const { loading, updating, items } = this.state
    const { fetch } = this.context

    if (loading || updating) {
      return reject('Вылолняется другое действие')
    }

    this.setState({ updating: true })
    return updater(items, fetch)
      .then(nextItems => {
        this.setState({ items: nextItems })
        return nextItems
      })
      .finally(() => this.setState({ updating: false }))
  },

  handleReloadRequest() {
    const { loading, updating } = this.state
    if (loading || updating) {
      return
    }
    this.loadItems(this.props.endpoint)
  },

  handleLoadSuccess(resp) {
    if (!this.props.pagination) {
      this.setState({
        items: resp.entity,
        loading: false
      })
      return
    }

    const { results: items, count } = resp.entity
    const { curPage, perPage } = this.state
    this.setState({
      items,
      count,
      loading: false,
      curPage: fixCurPage(curPage, count, perPage)
    })
  },

  handleLoadFailure(error) {
    this.setState({ loading: false, error, count: null })
  },

  loadItems(endpoint) {
    const { fetch } = this.context
    const { perPage, curPage } = this.state
    this.unsub()
    this.setState({ loading: true, items: null, error: null })
    this._unsub = subscribeToPromise(fetch({ path: endpoint, params: { page_size: perPage, page: curPage } }), {
      success: this.handleLoadSuccess,
      failure: this.handleLoadFailure
    })
  },

  render() {
    const { Renderer, ...otherProps } = R.omit(['endpoint'], this.props)
    return <Renderer
      {...this.state} {...otherProps}
      onChangePageReq={this.handleChangePageRequest}
      onReloadReq={this.handleReloadRequest}
      onUpdateReq={this.handleUpdateRequest}
    />
  }

})


text:
/**
 * Given a JS error, returns an object with `reason` and `details` fields.
 * @param  {Error} err
 * @return {Object}
 */
function formatErrorForSwf(err) {
    let reason;
    let details;

    if (err && err.code) {
        reason = String(err.code);
    } else if (err && err.constructor && err.constructor.name) {
        reason = String(err.constructor.name);
    }

    if (err && err.message) {
        details = String(err.message);
    }

    const result = {};

    if (reason !== undefined) {
        result.reason = reason;
    }

    if (details !== undefined) {
        result.details = details;
    }

    return result;
}

module.exports = {
    formatErrorForSwf,
};


text:
module ActionController
  class Base
    def render_with_plist(options = nil, extra_options = {}, &block)

      if options and options.is_a?(Hash) and plist = options.delete(:plist)

        response.headers["Location"] = options[:location] unless options[:location].blank?
        options[:content_type] ||= Mime::PLIST
        options[:disposition] ||= "inline"

        if options[:plist_filename].blank?
          if plist.is_a? Array
            options[:plist_filename] = plist.first.class.name.pluralize + ".plist"
          elsif plist.respond_to?(:id)
            options[:plist_filename] = "#{plist.class.name}-#{plist.id}.plist"
          else
            options[:plist_filename] = "#{plist.class.name}-data.plist"
          end
        end

        if plist.is_a? Array
          plist.each do |entry|
            if entry.respond_to? :plist_item_options=
              entry.plist_item_options = options
            end
          end
        end

        data = plist
        unless plist.is_a?(CFPropertyList::List)
          plist_options = {
            :converter_method => :to_plist_item,
            :convert_unknown_to_string => true
          }
          data = plist.to_plist(plist_options)
        end

        send_data(
          data,
          :type => options[:content_type],
          :filename => options[:plist_filename],
          :disposition => options[:disposition],
          :status => options[:status]
        )

      else
        render_without_plist(options, extra_options, &block)
      end
    end

    alias_method_chain :render, :plist
  end
end


text:
package sourcemap // import "gopkg.in/sourcemap.v1"

import (
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"net/url"
	"path"
	"sort"
	"strconv"
	"strings"

	"gopkg.in/sourcemap.v1/base64vlq"
)

type Consumer struct {
	sourceRootURL *url.URL
	smap          *sourceMap
	mappings      []mapping
}

func Parse(mapURL string, b []byte) (*Consumer, error) {
	smap := new(sourceMap)
	err := json.Unmarshal(b, smap)
	if err != nil {
		return nil, err
	}

	if smap.Version != 3 {
		return nil, errors.New("sourcemap: only 3rd version is supported")
	}

	var sourceRootURL *url.URL
	if smap.SourceRoot != "" {
		u, err := url.Parse(smap.SourceRoot)
		if err != nil {
			return nil, err
		}
		if u.IsAbs() {
			sourceRootURL = u
		}
	} else if mapURL != "" {
		u, err := url.Parse(mapURL)
		if err != nil {
			return nil, err
		}
		if u.IsAbs() {
			u.Path = path.Dir(u.Path)
			sourceRootURL = u
		}
	}

	mappings, err := parseMappings(smap.Mappings)
	if err != nil {
		return nil, err
	}
	// Free memory.
	smap.Mappings = ""

	return &Consumer{
		sourceRootURL: sourceRootURL,
		smap:          smap,
		mappings:      mappings,
	}, nil
}

func (c *Consumer) File() string {
	return c.smap.File
}

func (c *Consumer) Source(genLine, genCol int) (source, name string, line, col int, ok bool) {
	i := sort.Search(len(c.mappings), func(i int) bool {
		m := &c.mappings[i]
		if m.genLine == genLine {
			return m.genCol >= genCol
		}
		return m.genLine >= genLine
	})

	// Mapping not found.
	if i == len(c.mappings) {
		return
	}

	match := &c.mappings[i]

	// Fuzzy match.
	if match.genCol > genCol && i > 0 {
		match = &c.mappings[i-1]
	}

	if match.sourcesInd >= 0 {
		source = c.absSource(c.smap.Sources[match.sourcesInd])
	}
	if match.namesInd >= 0 {
		iv := c.smap.Names[match.namesInd]
		switch v := iv.(type) {
		case string:
			name = v
		case float64:
			name = strconv.FormatFloat(v, 'f', -1, 64)
		default:
			name = fmt.Sprint(iv)
		}
	}
	line = match.sourceLine
	col = match.sourceCol
	ok = true
	return
}

func (c *Consumer) absSource(source string) string {
	if path.IsAbs(source) {
		return source
	}

	if u, err := url.Parse(source); err == nil && u.IsAbs() {
		return source
	}

	if c.sourceRootURL != nil {
		u := *c.sourceRootURL
		u.Path = path.Join(c.sourceRootURL.Path, source)
		return u.String()
	}

	if c.smap.SourceRoot != "" {
		return path.Join(c.smap.SourceRoot, source)
	}

	return source
}

func (c *Consumer) SourceName(genLine, genCol int, genName string) (name string, ok bool) {
	ind := sort.Search(len(c.mappings), func(i int) bool {
		m := c.mappings[i]
		if m.genLine == genLine {
			return m.genCol >= genCol
		}
		return m.genLine >= genLine
	})

	// Mapping not found.
	if ind == len(c.mappings) {
		return "", false
	}

	for i := ind; i >= 0; i-- {
		m := c.mappings[i]
		if m.namesInd == -1 {
			continue
		}
		if c.smap.Names[m.namesInd] == "" {

		}
	}

	return
}

type fn func() (fn, error)

type sourceMap struct {
	Version    int           `json:"version"`
	File       string        `json:"file"`
	SourceRoot string        `json:"sourceRoot"`
	Sources    []string      `json:"sources"`
	Names      []interface{} `json:"names"`
	Mappings   string        `json:"mappings"`
}

type mapping struct {
	genLine    int
	genCol     int
	sourcesInd int
	sourceLine int
	sourceCol  int
	namesInd   int
}

type mappings struct {
	rd  *strings.Reader
	dec *base64vlq.Decoder

	genLine    int
	genCol     int
	sourcesInd int
	sourceLine int
	sourceCol  int
	namesInd   int

	value  mapping
	values []mapping
}

func parseMappings(s string) ([]mapping, error) {
	rd := strings.NewReader(s)
	m := &mappings{
		rd:  rd,
		dec: base64vlq.NewDecoder(rd),

		genLine:    1,
		sourceLine: 1,
	}
	m.zeroValue()
	err := m.parse()
	if err != nil {
		return nil, err
	}
	return m.values, nil
}

func (m *mappings) parse() error {
	next := m.parseGenCol
	for {
		c, err := m.rd.ReadByte()
		if err == io.EOF {
			m.pushValue()
			return nil
		} else if err != nil {
			return err
		}

		switch c {
		case ',':
			m.pushValue()
			next = m.parseGenCol
		case ';':
			m.pushValue()

			m.genLine++
			m.genCol = 0

			next = m.parseGenCol
		default:
			m.rd.UnreadByte()

			var err error
			next, err = next()
			if err != nil {
				return err
			}
		}
	}
}

func (m *mappings) parseGenCol() (fn, error) {
	n, err := m.dec.Decode()
	if err != nil {
		return nil, err
	}
	m.genCol += n
	m.value.genCol = m.genCol
	return m.parseSourcesInd, nil
}

func (m *mappings) parseSourcesInd() (fn, error) {
	n, err := m.dec.Decode()
	if err != nil {
		return nil, err
	}
	m.sourcesInd += n
	m.value.sourcesInd = m.sourcesInd
	return m.parseSourceLine, nil
}

func (m *mappings) parseSourceLine() (fn, error) {
	n, err := m.dec.Decode()
	if err != nil {
		return nil, err
	}
	m.sourceLine += n
	m.value.sourceLine = m.sourceLine
	return m.parseSourceCol, nil
}

func (m *mappings) parseSourceCol() (fn, error) {
	n, err := m.dec.Decode()
	if err != nil {
		return nil, err
	}
	m.sourceCol += n
	m.value.sourceCol = m.sourceCol
	return m.parseNamesInd, nil
}

func (m *mappings) parseNamesInd() (fn, error) {
	n, err := m.dec.Decode()
	if err != nil {
		return nil, err
	}
	m.namesInd += n
	m.value.namesInd = m.namesInd
	return m.parseGenCol, nil
}

func (m *mappings) zeroValue() {
	m.value = mapping{
		genLine:    m.genLine,
		genCol:     0,
		sourcesInd: -1,
		sourceLine: 0,
		sourceCol:  0,
		namesInd:   -1,
	}
}

func (m *mappings) pushValue() {
	m.values = append(m.values, m.value)
	m.zeroValue()
}


text:
description: This template creates a new DevTest Lab / DTL instance. More Azure Resource Manager Quickstart Templates for Azure DevTestlab available at https://github.com/Azure/azure-devtestlab/tree/master/ARMTemplates
page_type: sample
products:
- azure
- azure-resource-manager
urlFragment: dtl-create-lab
languages:
- json
---
# Create a new lab in Azure DevTest Labs

![Azure Public Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.devtestlab/dtl-create-lab/PublicLastTestDate.svg)
![Azure Public Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.devtestlab/dtl-create-lab/PublicDeployment.svg)

![Azure US Gov Last Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.devtestlab/dtl-create-lab/FairfaxLastTestDate.svg)
![Azure US Gov Last Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.devtestlab/dtl-create-lab/FairfaxDeployment.svg)

![Best Practice Check](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.devtestlab/dtl-create-lab/BestPracticeResult.svg)
![Cred Scan Check](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.devtestlab/dtl-create-lab/CredScanResult.svg)

[![Deploy to Azure](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.svg?sanitize=true)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.devtestlab%2Fdtl-create-lab%2Fazuredeploy.json)
[![Deploy To Azure US Gov](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazuregov.svg?sanitize=true)](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.devtestlab%2Fdtl-create-lab%2Fazuredeploy.json)
[![Visualize](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.svg?sanitize=true)](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.devtestlab%2Fdtl-create-lab%2Fazuredeploy.json)

This template creates a new DevTestLab instance.

More Azure Resource Manger Quickstart Templates for Azure DevTestLab can be found at: https://github.com/Azure/azure-devtestlab

`Tags: Microsoft.DevTestLab/labs`


text:
![TF](https://img.shields.io/badge/Supports%20Terraform%20Version-%3E%3D0.11.10-blue.svg)
[![License](https://img.shields.io/badge/license-Apache--2.0-brightgreen.svg)](LICENSE)

This is my [terraform](https://www.terraform.io/) workflow for every terraform project that I use personally/professionaly. If you've never heard of Terraform, may I suggest [checking out my Ansible role](https://github.com/pgporada/ansible-role-terraform) to download, verify, and install Terraform for you!

- - - -
# Usage

* Keeps state in S3 and utilizes DynamoDB for locking.

**Note - this could be out of date.**

View a description of Makefile targets with help via the [self-documenting makefile](https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html).

    $ make
    apply                          Have terraform do the things. This will cost money.
    destroy-backend                Destroy S3 bucket and DynamoDB table
    destroy                        Destroy the things
    destroy-target                 Destroy a specific resource. Caution though, this destroys chained resources.
    plan-destroy                   Creates a destruction plan.
    plan                           Show what terraform thinks it will do
    plan-target                    Shows what a plan looks like for applying a specific resource
    prep                           Prepare a new workspace (environment) if needed, configure the tfstate backend, update any modules, and switch to the workspace

* Before each target, several private Makefile functions run to configure the remote state backend, `validate`,`set-env`, and `init`. You should never have to run these yourself.

Show a plan from the remote state

    $ ENV=qa make plan
	Removing existing ENV.tfvars from local directory

	Pulling fresh qa.tfvars from s3://qa-useast1-terraform-state/bastion/
	download: s3://qa-useast1-terraform-state/bastion/qa.tfvars to ./qa.tfvars
	Initialized blank state with remote state enabled!
	Remote state configured and pulled.
	Local and remote state in sync
	Refreshing Terraform state in-memory prior to plan...
	The refreshed state will be used to calculate this plan, but
	will not be persisted to local or remote state storage.

	-/+ module.bastion.aws_instance.bastion
    ami:                               "ami-61ce6c77" => "ami-35ab0823" (forces new resource)
    associate_public_ip_address:       "true" => "<computed>"
    availability_zone:                 "us-east-1a" => "<computed>"
    ebs_block_device.#:                "0" => "<computed>"
    ephemeral_block_device.#:          "0" => "<computed>"
    iam_instance_profile:              "qa-bastion-instance-profile" => "qa-bastion-instance-profile"
    instance_state:                    "running" => "<computed>"
    instance_type:                     "t2.micro" => "t2.micro"
    ipv6_addresses.#:                  "0" => "<computed>"
    key_name:                          "qa_useast1_ec2key_bastion" => "qa_useast1_ec2key_bastion"
    network_interface_id:              "eni-d00c2017" => "<computed>"
    placement_group:                   "" => "<computed>"
    private_dns:                       "ip-10-10-10-24.ec2.internal" => "<computed>"
    private_ip:                        "10.10.10.24" => "<computed>"
    public_dns:                        "ec2-52.52.52.52.compute-1.amazonaws.com" => "<computed>"
    public_ip:                         "52.52.52.52" => "<computed>"
    root_block_device.#:               "1" => "<computed>"
    security_groups.#:                 "0" => "<computed>"
    source_dest_check:                 "true" => "true"
    subnet_id:                         "subnet-184a8440" => "subnet-184a8440"
    tags.%:                            "6" => "6"
    tags.ENV:                          "qa" => "qa"
    tags.Name:                         "qa_useast1_bastion" => "qa_useast1_bastion"
    tags.ROLES:                        "bastion" => "bastion"
    tags.TERRAFORM:                    "true" => "true"
    tags.TYPE:                         "bastion" => "bastion"
    tenancy:                           "default" => "<computed>"
    user_data:                         "1d902c0382fe19b53225a527fdc7bc95cfed875T" => "1d902c0382fe19b53225a527fdc7bc95cfed875T"
    vpc_security_group_ids.#:          "1" => "1"
    vpc_security_group_ids.1449472535: "sg-305ea24b" => "sg-305ea24b"

	~ module.bastion.aws_route53_record.bastion-priv
    records.#: "" => "<computed>"

	~ module.bastion.aws_route53_record.bastion-pub
    records.#: "" => "<computed>"

	Plan: 1 to add, 2 to change, 1 to destroy.

Show root level output

    ENV=qa make output
	# Alternatively once you've run the make output, you can just run
	terraform output

Output a module

    MODULE=network ENV=qa make output

Output a nested module

    MODULE=network.nat ENV=qa make output

Plan a specific module

	ENV=prod make plan-target

Plan it all

	ENV=prod make plan

- - - -
# Example Terraform project layout

Tree output of a Terraform module I create

    $ tree -F -l
    terraform-bastion
    ├── variables/
    │   ├── prod-us-east-2.tfvars
    │   └── qa-us-east-1.tfvars
    ├── main.tf
    ├── Makefile
    ├── .gitignore
    ├── .git/
    ├── modules/
    │   └── bastion/
    │       ├── bastion.tf
    │       └── init.sh
    ├── README.md
    └── LICENSE

            5 directories, 10 files

Example `main.tf` inside the tree

    variable "region" {}

    variable "env" {
      default = "qa"
    }
    variable "key_path" {}
    variable "key_name" {}
    variable "ec2_bastion_instance_type" {}
    variable "ec2_bastion_user" {}
    variable "accountid" {}
    variable "profile" {}

    terraform {
      required_version = ">= 0.11.10"
    }

    provider "aws" {
      region              = "${var.region}"
      profile             = "${var.env}"
      allowed_account_ids = ["${var.accountid}"]
    }

    data "terraform_remote_state" "vpc" {
      backend = "s3"

      // This must map to the workspace from the Makefile
      workspace = "${var.env}-${var.region}"

      // This must map to the bucket and key from the Makefile
      config {
        region         = "${var.region}"
        acl            = "private"
        profile        = "${var.profile}"
        bucket         = "${var.env}-${var.region}-yourCompany-terraform"
        key            = "${var.env}/vpc/terraform.tfstate"
        dynamodb_table = "${var.env}-${var.region}-yourCompany-terraform"
      }
    }

    module "bastion" {
      source           = "modules/bastion"
      env              = "${var.env}"
      region           = "${var.region}"
      instance_type    = "${var.ec2_bastion_instance_type}"
      bastion_key_name = "${var.key_name}"
      bastion_key_path = "${var.key_path}"
      vpc_id           = "${data.terraform_remote_state.vpc.vpc_id}"
      vpc_cidr         = "${data.terraform_remote_state.vpc.vpc_cidr}"
      subnet_ids       = "${data.terraform_remote_state.vpc.public_subnet_ids}"
      shell_username   = "${var.ec2_bastion_user}"
    }

    output "environment" {
      value = "${var.env}"
    }

    output "bastion_public_ip" {
      value = "${module.bastion.public_ip}"
    }

    output "bastion_private_ip" {
      value = "${module.bastion.private_ip}"
    }

    output "bastion_user" {
      value = "${var.ec2_bastion_user}"
    }

- - - -
# Considerations

* Each time this makefile is used, the remote state will be pulled from the backend onto your machine. This can result in slightly longer iteration times.
* The makefile uses `.ONESHELL` which is a feature of gmake. OSX users may need to `brew install gmake`.
* To use `ENV=qa make graph`, you will need to install `dot` via your systems package manager.
* You should configure [remote state encryption for S3 via KMS](https://www.terraform.io/docs/state/remote/s3.html) via `encrypt` and `kms_key_id`. This is a `TODO` and should be automated by the Makefile.

- - - -
# Author Info and License

![Apache-2.0](LICENSE)

(C) [Philip Porada](https://github.com/pgporada/) - philporada@gmail.com


text:
import os
from sklearn.externals import joblib
from sklearn.ensemble import RandomForestClassifier
from gensim import corpora, matutils
from modules.LanguageUnderstanding.utils.utils import *

class DialogueActTypePredictor(object):

    def __init__(self, file_name='model.pkl'):
        try:
            file_path = os.path.join(os.path.dirname(__file__), file_name)
            self.estimator = joblib.load(file_path)
        except FileNotFoundError:
            self.estimator = RandomForestClassifier()

    def train(self, train_x, train_y, file_name='model.pkl'):
        self.estimator.fit(train_x, train_y)
        joblib.dump(self.estimator, file_name)

    def predict(self, X):
        return self.estimator.predict(X)[0]

    def evaluate(self, test_x, test_y):
        print(self.estimator.score(test_x, test_y))

def sent2features_(sent):
    from training_data_generator.scripts.analyzer import analyze_morph
    dic_path = os.path.join(os.path.dirname(__file__), 'dic.txt')
    surfaces, _ = analyze_morph(sent)
    dictionary = corpora.Dictionary.load_from_text(dic_path)
    features = to_features(dictionary, surfaces)

    return features

if __name__ == '__main__':
    import os
    import pickle
    import random

    f = lambda path: os.path.dirname(path)

    root_dir = f(f(f(f(__file__))))
    training_data_dir = os.path.join(root_dir, 'training_data')
    sents = []
    labels = []

    for file_name in os.listdir(training_data_dir):
        if not file_name.endswith('.pkl'):
            continue
        category = file_name.split('.')[0]
        file_path = os.path.join(training_data_dir, file_name)
        with open(file_path, 'rb') as rf:
            tmp_data = pickle.load(rf)
            sents.extend(tmp_data)
            labels.extend([category] * len(tmp_data))

    # shuffle
    for i in range(len(sents)):
        j = random.randint(i, len(sents) - 1)
        sents[i], sents[j] = sents[j], sents[i]
        labels[i], labels[j] = labels[j], labels[i]

    train_num = int(len(sents) * 0.9)
    train_sents = sents[:train_num]
    test_sents = sents[train_num:]

    words = get_words(sents)

    dic_name = 'dic.txt'
    try:
        dictionary = corpora.Dictionary.load_from_text(dic_name)
    except FileNotFoundError:
        dictionary = create_dictionary(words)
        dictionary.save_as_text(dic_name)

    train_x = [to_features(dictionary, words) for words in get_words(train_sents)]
    train_y = labels[:train_num]

    test_x = [to_features(dictionary, words) for words in get_words(test_sents)]
    test_y = labels[train_num:]

    predictor = DialogueActTypePredictor()
    predictor.train(train_x, train_y)
    predictor.evaluate(test_x, test_y)


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

<TITLE>
L-Index (PureMVC API Documentation)
</TITLE>

<META NAME="date" CONTENT="2012-01-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C D E F G H I L M N O P R S T V

L

listNotificationInterests() -
Method in interface org.puremvc.java.interfaces.IMediator

List INotification interests.

listNotificationInterests() -
Method in class org.puremvc.java.patterns.mediator.Mediator

List the INotification names this Mediator
 is interested in being notified of.

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C D E F G H I L M N O P R S T V


text:
/**
 * @file heater_params.c
 * Heater parameters.
 *
 * @author Mark Sauder <mcsauder@gmail.com>
 * @author Alex Klimaj <alexklimaj@gmail.com>
 * @author Jake Dahl <dahl.jakejacob@gmail.com>
 */

/**
 * Target IMU device ID to regulate temperature.
 *
 * @category system
 * @group Sensors
 */
PARAM_DEFINE_INT32(SENS_TEMP_ID, 0);

/**
 * Target IMU temperature.
 *
 * @category system
 * @group Sensors
 * @unit celcius
 * @min 0
 * @max 85.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(SENS_IMU_TEMP, 55.0f);

/**
 * IMU heater controller integrator gain value.
 *
 * @category system
 * @group Sensors
 * @unit us/C
 * @min 0
 * @max 1.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(SENS_IMU_TEMP_I, 0.025f);

/**
 * IMU heater controller proportional gain value.
 *
 * @category system
 * @group Sensors
 * @unit us/C
 * @min 0
 * @max 2.0
 * @decimal 3
 */
PARAM_DEFINE_FLOAT(SENS_IMU_TEMP_P, 1.0f);


text:
        <md-card class="register-card">
            <form name="registrationForm" ng-enter="register.submit(registrationForm.$valid)">

Register as new user

                    <md-input-container>
                        <input placeholder="Username"
                               name="username"
                               aria-label="username"
                               ng-model="register.username"
                               ng-pattern="/^[a-zA-Z0-9]*$/"
                               required>

Username required!

Username invalid!

                    </md-input-container>

                    <md-input-container class="left-input">
                        <input placeholder="Email"
                               type="email"
                               name="email"
                               aria-label="email"
                               ng-model="register.email"
                               required>

Email required!

Email is not valid!

                    </md-input-container>

                    <md-input-container>
                        <input placeholder="Name"
                               name="firstName"
                               aria-label="firstName"
                               ng-model="register.firstName">
                    </md-input-container>
                    <md-input-container class="left-input">
                        <input placeholder="Surname"
                               name="surName"
                               aria-label="surName"
                               ng-model="register.surName">
                    </md-input-container>

                    <md-input-container>
                        <input placeholder="Password"
                               type="password"
                               name="password"
                               aria-label="password"
                               ng-model="register.password"
                               minlength="8"
                               required>

Password required!

Password too short!

                    </md-input-container>
                    <md-input-container class="left-input">
                        <input placeholder="Confirm Password"
                               type="password" name="passwordConfirm"
                               aria-label="passwordConfirm"
                               ng-model="register.passwordConfirm"
                               required
                               same-as="register.password">

Password required!

Password not equal!

                    </md-input-container>

                    <md-button ng-disabled="registrationForm.$invalid"
                               class="md-primary md-raised"
                               ng-click="register.submit(registrationForm.$valid)">
                        Register
                    </md-button>

                    Already a member?

            </form>
        </md-card>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class Token
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class Token
   ">
    <meta name="generator" content="docfx 2.43.2.0">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Class Token

Represents a user token.

Inheritance

System.Object

Token

Implements

IToken

IRefreshable

IBatchRefreshable

ICacheable

Inherited Members

      System.Object.Equals(System.Object)

      System.Object.Equals(System.Object, System.Object)

      System.Object.GetHashCode()

      System.Object.GetType()

      System.Object.MemberwiseClone()

      System.Object.ReferenceEquals(System.Object, System.Object)

Namespace: Manatee.Trello

Assembly: Manatee.Trello.dll

Syntax

public class Token : IToken, IRefreshable, IMergeJson<IJsonToken>, IBatchRefresh, IBatchRefreshable, ICacheable, IHandleSynchronization

Constructors

    |
    Improve this Doc

    View Source

Token(String, TrelloAuthorization)

Creates a new instance of the Token object.

Declaration

public Token(string id, TrelloAuthorization auth = null)

Parameters

        Type
        Name
        Description

        System.String
        id

The token's ID.

        TrelloAuthorization
        auth

(Optional) Custom authorization parameters. When not provided, Default will be used.

Remarks

The supplied ID can be either the full ID or the token itself.

Properties

    |
    Improve this Doc

    View Source

AppName

Gets the name of the application associated with the token.

Declaration

public string AppName { get; }

Property Value

        Type
        Description

        System.String

    |
    Improve this Doc

    View Source

BoardPermissions

Gets the permissions on boards granted by the token.

Declaration

public ITokenPermission BoardPermissions { get; }

Property Value

        Type
        Description

        ITokenPermission

    |
    Improve this Doc

    View Source

CreationDate

Gets the creation date of the token.

Declaration

public DateTime CreationDate { get; }

Property Value

        Type
        Description

        System.DateTime

    |
    Improve this Doc

    View Source

DateCreated

Gets the date and time the token was created.

Declaration

public DateTime? DateCreated { get; }

Property Value

        Type
        Description

        System.Nullable<System.DateTime>

    |
    Improve this Doc

    View Source

DateExpires

Gets the date and time the token expires, if any.

Declaration

public DateTime? DateExpires { get; }

Property Value

        Type
        Description

        System.Nullable<System.DateTime>

    |
    Improve this Doc

    View Source

DownloadedFields

Specifies which fields should be downloaded.

Declaration

public static Token.Fields DownloadedFields { get; set; }

Property Value

        Type
        Description

        Token.Fields

    |
    Improve this Doc

    View Source

Id

Gets the token's ID.

Declaration

public string Id { get; }

Property Value

        Type
        Description

        System.String

    |
    Improve this Doc

    View Source

Member

Gets the member for which the token was issued.

Declaration

public IMember Member { get; }

Property Value

        Type
        Description

        IMember

    |
    Improve this Doc

    View Source

MemberPermissions

Gets the permissions on members granted by the token.

Declaration

public ITokenPermission MemberPermissions { get; }

Property Value

        Type
        Description

        ITokenPermission

    |
    Improve this Doc

    View Source

OrganizationPermissions

Gets the permissions on organizations granted by the token.

Declaration

public ITokenPermission OrganizationPermissions { get; }

Property Value

        Type
        Description

        ITokenPermission

Methods

    |
    Improve this Doc

    View Source

Delete(CancellationToken)

Deletes the token.

Declaration

public Task Delete(CancellationToken ct = default(CancellationToken))

Parameters

        Type
        Name
        Description

        System.Threading.CancellationToken
        ct

(Optional) A cancellation token for async processing.

Returns

        Type
        Description

        System.Threading.Tasks.Task

Remarks

This permanently deletes the token from Trello's server, however, this object will remain in memory and all properties will remain accessible.

    |
    Improve this Doc

    View Source

Refresh(Boolean, CancellationToken)

Refreshes the token data.

Declaration

public Task Refresh(bool force = false, CancellationToken ct = default(CancellationToken))

Parameters

        Type
        Name
        Description

        System.Boolean
        force

Indicates that the refresh should ignore the value in RefreshThrottle and make the call to the API.

        System.Threading.CancellationToken
        ct

(Optional) A cancellation token for async processing.

Returns

        Type
        Description

        System.Threading.Tasks.Task

    |
    Improve this Doc

    View Source

ToString()

Returns a string that represents the current object.

Declaration

public override string ToString()

Returns

        Type
        Description

        System.String

A string that represents the current object.

Overrides

System.Object.ToString()

Implements

      IToken

      IRefreshable

      IBatchRefreshable

      ICacheable

                    Improve this Doc

                    View Source

              Back to top

            Generated by DocFX


text:
package com.orbital.lead.logic;

import android.content.Context;
import android.os.Bundle;

import com.facebook.AccessToken;
import com.facebook.AccessTokenTracker;
import com.facebook.CallbackManager;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.facebook.Profile;
import com.facebook.ProfileTracker;
import com.orbital.lead.Parser.Parser;
import com.orbital.lead.Parser.ParserFacebook;
import com.orbital.lead.controller.Activity.PictureActivity;
import com.orbital.lead.logic.Asynchronous.AsyncFacebookAllAlbum;
import com.orbital.lead.logic.Asynchronous.AsyncFacebookGetAlbumPictures;
import com.orbital.lead.model.AlbumList;
import com.orbital.lead.model.Constant;
import com.orbital.lead.model.EnumFacebookQueryType;
import com.orbital.lead.model.PictureList;

import org.json.JSONObject;

/**
 * Created by joseph on 6/7/2015.
 */
public class FacebookLogic {

    private static FacebookLogic mFacebookLogic = new FacebookLogic();

    private final String TAG = this.getClass().getSimpleName();
    private CustomLogging mLogging;
    private Parser mParser;

    private CallbackManager callbackManager;
    private ProfileTracker profileTracker;
    private AccessTokenTracker accessTokenTracker;
    private Profile pendingUpdateForUser;

    private AlbumList facebookAlbumList;
    private PictureList facebookPictureList;
    private boolean isFacebookLogin = false;

    private FacebookLogic() {}

    public static FacebookLogic getInstance() {
        mFacebookLogic.initLogging();
        mFacebookLogic.initParser();
        return mFacebookLogic;
    }

    public void setIsFacebookLogin(boolean val) {
        this.isFacebookLogin = val;
    }

    public boolean getIsFacebookLogin() {
        return this.isFacebookLogin;
    }

    public String getCurrentFacebookAccessTokenString() {
        try {
            return AccessToken.getCurrentAccessToken().getToken();
        }catch(NullPointerException e){
            return "";
        }
    }

    public AccessToken getCurrentFacebookAccessToken() {
        try {
            return AccessToken.getCurrentAccessToken();
        }catch(NullPointerException e){
            return null;
        }
    }

    public void sendGraphRequest(Context context, EnumFacebookQueryType type, String albumID) {
        mLogging.debug(TAG, "sendGraphRequest " + type.toString());

        switch(type){
            case GET_ALL_ALBUM:
                this.initFacebookAlbumList();
                this.getFacebookAllAlbum(context, Constant.FACEBOOK_GRAPH_ALBUM_QUERY);
                break;
            case GET_ALL_ALBUM_PICTURES:
                this.initFacebookPictureList();
                this.getFacebookAlbumPictures(context, albumID, Constant.FACEBOOK_GRAPH_ALBUM_PICTURES_QUERY);
                break;
        }
    }

    private void getFacebookAllAlbum(final Context context, String param) {
        mLogging.debug(TAG, "getFacebookAllAlbum");

        this.getFacebookAlbumList().clearAll();

        GraphRequest request = GraphRequest.newMeRequest(
                this.getCurrentFacebookAccessToken(),
                new GraphRequest.GraphJSONObjectCallback() {
                    @Override
                    public void onCompleted(
                            JSONObject object,
                            GraphResponse response) {

                        //mLogging.debug(TAG, "response getRawResponse -> " + response.getRawResponse());

                        String data = response.getRawResponse();
                        if(!mParser.isStringEmpty(data)){

                            AlbumList currentAlbumList = ParserFacebook.getFacebookAlbumList(data);

                            String pageNextUrl = ParserFacebook.getFacebookAlbumListNextPageUrl(data); // include access token and after id

                            getFacebookAlbumList().addAlbum(currentAlbumList);

                            //mLogging.debug(TAG, "pageNextUrl -> " + pageNextUrl);

                            if(mParser.isStringEmpty(pageNextUrl)){ //means no next page
                                mLogging.debug(TAG, "no next page!!!");
                                returnFacebookAlbumListToContext(context);

                            }else{
                                mLogging.debug(TAG, "go to next page........");

                                new HttpAsyncFacebookAllAbumNextPage(context, EnumFacebookQueryType.GET_ALL_ALBUM)
                                        .execute(EnumFacebookQueryType.GET_ALL_ALBUM.toString(),
                                                pageNextUrl);

                            }

                        }else{
                            mLogging.debug(TAG, "unable to get respose data. get error -> " + response.getError().toString());
                        }

                    }

                });

        Bundle parameters = new Bundle();
        parameters.putString("fields", param);
        request.setParameters(parameters);
        request.executeAsync();

    }

    private void getFacebookAlbumPictures(final Context context, final String albumID, String param) {
        if(mParser.isStringEmpty(albumID)) {
            mLogging.debug(TAG, "getFacebookAlbumPictures album ID is empty or null.");
            return;
        }

        mLogging.debug(TAG, "getFacebookAlbumPictures album ID => " + albumID);

        this.getFacebookPictureList().clearAll();

        GraphRequest request = new GraphRequest(
                AccessToken.getCurrentAccessToken(),
                "/" + albumID + "/photos",
                null,
                HttpMethod.GET,
                new GraphRequest.Callback() {
                    public void onCompleted(GraphResponse response) {

                        mLogging.debug(TAG, "getFacebookAlbumPictures getRawResponse -> " + response.getRawResponse());
                        String data = response.getRawResponse();

                        if(!mParser.isStringEmpty(data)) {

                            PictureList list = ParserFacebook.getFacebookPictureList(albumID, data);
                            String pageNextUrl = ParserFacebook.getFacebookPictureListNextPageUrl(data); // include access token and after id

                            getFacebookPictureList().addPicture(list);

                            mLogging.debug(TAG, "pageNextUrl -> " + pageNextUrl);

                            if (mParser.isStringEmpty(pageNextUrl)) { //means no next page
                                mLogging.debug(TAG, "no next page!!!");
                                returnFacebookPictureListToContext(context);

                            } else {
                                mLogging.debug(TAG, "go to next page........");

                                new HttpAsyncFacebookGetAlbumPicturesNextPage(context, albumID)
                                        .execute(pageNextUrl);

                            }

                        }

                    }
                });

        Bundle parameters = new Bundle();
        parameters.putString("fields", param);
        request.setParameters(parameters);
        request.executeAsync();

    }

    private void initLogging(){
        this.mLogging = CustomLogging.getInstance();
    }

    private void initParser() {
        this.mParser = Parser.getInstance();
    }

    private void initFacebookAlbumList() {
        this.facebookAlbumList = new AlbumList();
    }

    private void initFacebookPictureList() {
        this.facebookPictureList = new PictureList();
    }

    private AlbumList getFacebookAlbumList() {
        return this.facebookAlbumList;
    }

    private PictureList getFacebookPictureList() {
        return this.facebookPictureList;
    }

    private void returnFacebookAlbumListToContext(Context context) {
        mLogging.debug(TAG, "returnFacebookAlbumListToContext");
        if(context instanceof PictureActivity) {
            if(getFacebookAlbumList() != null){
                mLogging.debug(TAG, "updateFragmentAlbumGridAdapter !!!!");
                ((PictureActivity) context).updateFragmentAlbumGridAdapter(getFacebookAlbumList());
            }else {
                mLogging.debug(TAG, "facebookAlbumList is null");

            }

        }//end if
    }

    private void returnFacebookPictureListToContext(Context context) {
        mLogging.debug(TAG, "returnFacebookPictureListToContext");
        if(context instanceof PictureActivity) {

            if(getFacebookPictureList() != null){
                mLogging.debug(TAG, "updateFragmentPicturesGridAdapter !!!!");
                ((PictureActivity) context).updateFragmentPicturesGridAdapter(getFacebookPictureList());
            }else {
                mLogging.debug(TAG, "facebookAlbumList is null");

            }

        }//end if
    }

    private class HttpAsyncFacebookAllAbumNextPage extends AsyncFacebookAllAlbum {
        private Context mContext;
        private EnumFacebookQueryType mType;

        public HttpAsyncFacebookAllAbumNextPage(Context c, EnumFacebookQueryType type){
            this.mContext = c;
            this.mType = type;
        }

        @Override
        protected void onPreExecute() {
        }

        @Override
        protected void onPostExecute(final String result) {
            mLogging.debug(TAG, "HttpAsyncFacebookAllAbumNextPage onPostExecute result => " + result);

            //if(mContext instanceof MainActivity){ // calling from mainactivity

            switch (this.mType) {
                case GET_ALL_ALBUM:

                    if(mParser.isStringEmpty(result)) { // result
                        mLogging.debug(TAG, "HttpAsyncFacebookAllAbumNextPage no result!!!!!!");
                        returnFacebookAlbumListToContext(this.mContext);
                    }else{
                        AlbumList currentAlbumList = ParserFacebook.getFacebookNextPageAlbumList(result);
                        String pageNextUrl = ParserFacebook.getFacebookNextPageAlbumListNextPageUrl(result);

                        getFacebookAlbumList().addAlbum(currentAlbumList);

                        mLogging.debug(TAG, "HttpAsyncFacebookAllAbumNextPage pageNextUrl -> " + pageNextUrl);

                        if(mParser.isStringEmpty(pageNextUrl)){ //means no next page
                            mLogging.debug(TAG, "HttpAsyncFacebookAllAbumNextPage no next page!!!");
                            returnFacebookAlbumListToContext(this.mContext);

                        }else{
                            mLogging.debug(TAG, "HttpAsyncFacebookAllAbumNextPage go to next page........");
                            new HttpAsyncFacebookAllAbumNextPage(this.mContext, EnumFacebookQueryType.GET_ALL_ALBUM)
                                    .execute(EnumFacebookQueryType.GET_ALL_ALBUM.toString(),
                                            pageNextUrl);
                        }
                    }

                    break;
            }
        }//end onPostExecute

    }//end HttpAsyncFacebookAllAbumNextPage

    private class HttpAsyncFacebookGetAlbumPicturesNextPage extends AsyncFacebookGetAlbumPictures{
        private Context mContext;
        private String albumID;
        public HttpAsyncFacebookGetAlbumPicturesNextPage(Context context, String albumID){
            this.mContext = context;
            this.albumID = albumID;
        }

        @Override
        protected void onPreExecute() {
        }

        @Override
        protected void onPostExecute(final String result) {
            mLogging.debug(TAG, "HttpAsyncFacebookGetAlbumPicturesNextPage onPostExecute result => " + result);

            if(mParser.isStringEmpty(result)) { // result
                mLogging.debug(TAG, "HttpAsyncFacebookGetAlbumPicturesNextPage no result!!!!!!");

                returnFacebookPictureListToContext(this.mContext);
            }else {

                PictureList list = ParserFacebook.getFacebookPictureList(albumID, result);
                String pageNextUrl = ParserFacebook.getFacebookPictureListNextPageUrl(result); // include access token and after id

                getFacebookPictureList().addPicture(list);

                if (mParser.isStringEmpty(pageNextUrl)) { //means no next page
                    mLogging.debug(TAG, "HttpAsyncFacebookGetAlbumPicturesNextPage no next page!!!");

                    returnFacebookPictureListToContext(this.mContext);

                } else {
                    mLogging.debug(TAG, "HttpAsyncFacebookGetAlbumPicturesNextPage go to next page........");
                    new HttpAsyncFacebookGetAlbumPicturesNextPage(this.mContext, this.albumID)
                            .execute(pageNextUrl);
                }
            }

        }//end onPostExecute

    }//end HttpAsyncFacebookAllAbumNextPage

}


text:
from broca import Pipe

class Tokenizer(Pipe):
    input = Pipe.type.docs
    output = Pipe.type.tokens

    def __call__(self, docs):
        return self.tokenize(docs)

    def tokenize(self, docs):
        raise NotImplementedError

from .lemma import LemmaTokenizer


text:
import * as common from 'rfxtrx'
import * as rfy from 'rfxtrx/dist/rfy'
import assert = require('assert');

(async function (cmd: rfy.Internal.Commands)
{
    var s = await common.Rfxtrx.listEligibleSerials()
    assert.notEqual(s.length, 0, 'no eligible device found');
    if (s.length)
    {
        var gw = await common.Rfxtrx.getSerial(s[0].comName)
        await gw.start()
        console.log(await gw.send(common.Type.RFY.Standard, { command: cmd, unitCode: rfy.Internal.RfyStandard.UnitCode.Unit3, id1: 0, id2: 0, id3: 3 }))
    }
})(rfy.Internal.Commands[process.argv[2] || 'up'])


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Server.Infrastructure.Network.Packets;

namespace Server.Game.Network.Packets.Client
{
    public enum StorageType
    {
        Inventory
    }

    public struct ClientStorageMoveSlotPacket : IPacket
    {
        public ClientStorageMoveSlotPacket(long sourceSlot, long destSlot, StorageType storageType) : this()
        {
            SourceSlot = sourceSlot;
            DestSlot = destSlot;
            StorageType = storageType;
        }

        public OpCodes OpCode
        {
            get { return OpCodes.CMSG_STORAGE_MOVE_SLOT; }
        }

        public long SourceSlot { get; set; }
        public long DestSlot { get; set; }

        public StorageType StorageType {  get; set;}

    }
}


text:
<?php

namespace Acme\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Entity\User as BaseUser;

/**
 * Acme\UserBundle\Entity\User
 *
 * @ORM\Table()
 * @ORM\Entity
 */
class User extends BaseUser
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

        public function __construct()
    {
        parent::__construct();
        // your own logic
    }
}

namespace Acme\UserBundle\Entity;


text:
<component name="libraryTable">
  <library name="Maven: com.vaadin.external.atmosphere:atmosphere-runtime:2.4.11.vaadin1">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/atmosphere/atmosphere-runtime/2.4.11.vaadin1/atmosphere-runtime-2.4.11.vaadin1.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/atmosphere/atmosphere-runtime/2.4.11.vaadin1/atmosphere-runtime-2.4.11.vaadin1-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/atmosphere/atmosphere-runtime/2.4.11.vaadin1/atmosphere-runtime-2.4.11.vaadin1-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
 ~ Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved.
 ~
 ~ Licensed under the Apache License, Version 2.0 (the "License");
 ~ you may not use this file except in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~      http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing, software
 ~ distributed under the License is distributed on an "AS IS" BASIS,
 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ~ See the License for the specific language governing permissions and
 ~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.wso2.carbon</groupId>
        <artifactId>carbon-kernel</artifactId>
        <version>4.3.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <groupId>org.wso2.carbon</groupId>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.application.deployer</artifactId>
    <version>4.3.0-SNAPSHOT</version>
    <packaging>bundle</packaging>
    <name>WSO2 Carbon - Application Deployer</name>
    <description>Application Deployer</description>
    <url>http://wso2.org</url>

    <dependencies>
        <dependency>
            <groupId>org.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi.services</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.registry.core</artifactId>
            <version>4.3.0-SNAPSHOT</version>
        </dependency>
        <!--dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.core</artifactId>
            <version>4.3.0-SNAPSHOT</version>
        </dependency-->
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.logging</artifactId>
            <version>4.3.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.feature.mgt.core</artifactId>
            <version>4.3.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
            <version>4.3.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.roles.mgt</artifactId>
            <version>4.3.0-SNAPSHOT</version>
             <exclusions>
                <exclusion>
                    <groupId>org.wso2.carbon</groupId>
                    <artifactId>org.wso2.carbon.core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-scr-plugin</artifactId>
                    <version>1.0.10</version>
                    <executions>
                        <execution>
                            <id>generate-scr-scrdescriptor</id>
                            <goals>
                                <goal>scr</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-Vendor>WSO2 Inc</Bundle-Vendor>
                        <Bundle-SymbolicName>org.wso2.carbon.application.deployer</Bundle-SymbolicName>
                        <ListenerManager-RequiredServices>
                            org.wso2.carbon.application.deployer.service.CappDeploymentService
                        </ListenerManager-RequiredServices>
                        <Private-Package>
                            org.wso2.carbon.application.deployer.internal
                        </Private-Package>
                        <Export-Package>
                            !org.wso2.carbon.application.deployer.internal,
                            org.wso2.carbon.application.deployer.*
                        </Export-Package>
                        <Import-Package>
                            org.apache.axis2.*,
                            org.apache.commons.logging.*,
                            org.osgi.framework.*,
                            *;resolution:=optional
                        </Import-Package>
                        <Axis2Deployer>CappDeployer</Axis2Deployer>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
"""Implementation of model part in Qt Model-View architecture.

"""
import numpy.linalg as npl
from nibabel.affines import apply_affine
from nibabel import aff2axcodes
import numpy as np
from PyQt4.QtCore import *

from ..base.bpdataset import VolumeDataset

class VolumeListModel(QAbstractListModel):
    """Definition of class VolumeListModel."""
    # customized signal
    repaint_slices = pyqtSignal(int, name='repaint_slices')
    scale_changed = pyqtSignal()
    time_changed = pyqtSignal()
    cross_pos_changed = pyqtSignal()
    undo_stack_changed = pyqtSignal()
    redo_stack_changed = pyqtSignal()

    # new image order
    new_no = 1

    def __init__(self, data_list, label_config_center, parent=None):
        """Initialize an instance."""
        super(VolumeListModel, self).__init__(parent)
        self._data = data_list
        self._affine = None
        self._ras_space = None
        self._ras_unit = None
        self._axcodes = None
        self._current_index = None
        self._selected_indexes = []
        self._grid_scale_factor = 1.0
        self._orth_scale_factor = 1.0
        # The current position is an index of 3D space.
        self._cross_pos = [0, 0, 0]
        self._display_cross = True
        self._connect_undo_redo()
        self._label_config_center = label_config_center
        self._label_config_center.single_roi_view_update_for_model.connect(
                self.update_all_rgba)

    def get_cross_pos(self):
        """Get current cursor position."""
        return self._cross_pos

    def get_space_pos(self):
        """Get current cursor position in RAS space."""
        return apply_affine(self._affine, self._cross_pos)

    def set_cross_pos(self, new_coord):
        """Set current cursor position."""
        self._cross_pos = new_coord
        self.update_orth_rgba()
        self.cross_pos_changed.emit()

    def set_space_pos(self, new_space_coord):
        """Set current cursor position based on RAS coordinates."""
        new_coord = apply_affine(npl.inv(self._affine), new_space_coord)
        new_coord = np.floor(new_coord)
        new_coord = [int(item) for item in new_coord]
        if self.is_valid_coord(new_coord):
            self.set_cross_pos(new_coord)

    def is_valid_coord(self, coord):
        """Filter valid coordinate."""
        data_shape = self._data[0].get_data_shape()
        if coord[0]>=0 and coord[0]<data_shape[0]:
            if coord[1]>=0 and coord[1]<data_shape[1]:
                if coord[2]>=0 and coord[2]<data_shape[2]:
                    return True
        else:
            False

    def get_axcodes(self):
        """Get codes for voxel axis derived from affine.

        i.e., ('R', 'A', 'S')
        """
        if isinstance(self._affine, np.ndarray):
            return aff2axcodes(self._affine)
        else:
            return None

    def update_orth_rgba(self):
        """Update RGBA data for OrthView."""
        for data in self._data:
            data.set_cross_pos(self.get_cross_pos())

    def display_cross(self):
        """Return the status of current position indicator."""
        return self._display_cross

    def set_cross_status(self, status):
        """Set the status of current position indicator."""
        if isinstance(status, bool) and not status == self.display_cross():
            self._display_cross = status
            self.cross_pos_changed.emit()

    def rowCount(self, parent=QModelIndex()):
        """ Return the item numbers in the list."""
        return len(self._data)

    def data(self, index, role):
        """Return the data stored under the given role for the item referred to by the index."""
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return QVariant()

        row = index.row()
        if role == Qt.DisplayRole or role == Qt.EditRole:
            return self._data[row].get_name()
        elif role == Qt.CheckStateRole:
            if self._data[row].is_visible():
                return Qt.Checked
            else:
                return Qt.Unchecked
        elif role == Qt.UserRole:
            return self._data[row].get_view_min()
        elif role == Qt.UserRole + 1:
            return self._data[row].get_view_max()
        elif role == Qt.UserRole + 2:
            return self._data[row].get_alpha()
        elif role == Qt.UserRole + 3:
            return self._data[row].get_colormap()
        elif role == Qt.UserRole + 4:
            return self._data[row].get_lthr_data()
        elif role == Qt.UserRole + 5:
            return self._data[row].get_lthr_raw_data()
        elif role == Qt.UserRole + 6:
            return self._data[row].get_raw_data()
        elif role == Qt.UserRole + 7:
            # get label config
            return self._label_config_center.get_current_label_config(), self._label_config_center.get_current_list_view_index()
        elif role == Qt.UserRole + 8:
            return self._data[row].is_4d()
        elif role == Qt.UserRole + 9:
            return self._data[row].get_time_point()
        elif role == Qt.UserRole + 10:
            return self._data[row].get_data_shape()[3]
        elif role == Qt.UserRole + 11:
            return self._data[0].get_header()

        return QVariant()

    def setData(self, index, value, role):
        """Set data according to the data role and item index."""
        if not index.isValid() or not 0 <= index.row() < self.rowCount():
            return False

        row = index.row()
        if role == Qt.EditRole:
            value_str = value.toPyObject()
            if not value_str == '':
                if not self._data[row].get_name() == value_str:
                    self._data[row].set_name(str(value_str))
                else:
                    return False
            else:
                return False
        elif role == Qt.CheckStateRole:
            if not self._data[row].is_visible() == value.toBool():
                self._data[row].set_visible(value.toBool())
            else:
                return False
        elif role == Qt.UserRole:
            if not str(self._data[row].get_view_min()) == value:
                self._data[row].set_view_min(value)
            else:
                return False
        elif role == Qt.UserRole + 1:
            if not str(self._data[row].get_view_max()) == value:
                self._data[row].set_view_max(value)
            else:
                return False
        elif role == Qt.UserRole + 2:
            if not self._data[row].get_alpha() == value:
                self._data[row].set_alpha(value)
            else:
                return False
        elif role == Qt.UserRole + 3:
            if not self._data[row].get_colormap() == value:
                self._data[row].set_colormap(value)
            else:
                return False
        # FIXME Following argument should be checked out.
        elif role == Qt.UserRole + 4:
            if value in self._data[row].get_roi_index().items():
                return False
            else:
                self._data[row].set_roi_name([value])
        elif role == Qt.UserRole + 5:
            self._data[row]._data  = np.rot90(value)
        elif role == Qt.UserRole + 9:
            if not self._data[row].get_time_point() == value:
                self._data[row].set_time_point(value)
            else:
                return False

        # Update RGBA list after setting
        #self._data[row].update_rgba()
        self.dataChanged.emit(index, index)
        self.repaint_slices.emit(-1)
        return True

    def flags(self, index):
        """Set item flag."""
        flag = super(VolumeListModel, self).flags(index)
        return flag | Qt.ItemIsEditable | Qt.ItemIsUserCheckable

    def insertRow(self, row, vol, parent=QModelIndex()):
        """Insert a new item to the list. """
        return self.insertRows(row, 1, [vol], parent)

    def insertRows(self, row, count, vol_list, parent=QModelIndex()):
        """Insert new items to the list."""
        self.beginInsertRows(parent, row, (row + (count - 1)))
        for index in range(count):
            try:
                vol = vol_list[index]
                self._data.insert(row + index, vol)
                vol.connect_undo(self.undo_stack_changed)
                vol.connect_redo(self.redo_stack_changed)
            except:
                raise
                print 'Insert new item failed!'
                return False
        self.endInsertRows()
        return True

    def removeRow(self, row, parent=QModelIndex()):
        """Remove one item from the list."""
        return self.removeRows(row, 1, parent)

    def removeRows(self, row, count, parent=QModelIndex()):
        """Remove items from the list."""
        #print type(row),'----------------------',type(count)
        self.beginRemoveRows(parent, row, (row + count - 1))
        for index in range(count):
            self._data.pop(row)
        self.endRemoveRows()
        return True

    def addItem(self, source, label_config=None, name=None, header=None,
                view_min=None, view_max=None, alpha=255, colormap='gray'):
        """Add a new item.

        Example:
        --------

        >>> model.addItem(filepath)

        """
        if self.rowCount():
            vol = VolumeDataset(source, self._label_config_center, name, header,
                                view_min, view_max, alpha, colormap,
                                [0, 0, 0])
            if self._data[0].get_data_shape()[0:3] == vol.get_data_shape()[0:3]:
                vol = VolumeDataset(source, self._label_config_center, name,
                                    header, view_min, view_max, alpha,
                                    colormap, [self._cross_pos[0],
                                               self._cross_pos[1],
                                               self._cross_pos[2]])
                ok = self.insertRow(0, vol)
                if ok:
                    self.repaint_slices.emit(-1)
                    return True
                else:
                    return False
            else:
                print 'Mismatch data size!'
                return False
        else:
            vol = VolumeDataset(source, self._label_config_center, name, header,
                                view_min, view_max, alpha, colormap,
                                [self._cross_pos[0],
                                 self._cross_pos[1],
                                 self._cross_pos[2]])
            ok = self.insertRow(0, vol)
            if ok:
                self._get_sapce_info(vol)
                self.repaint_slices.emit(-1)
                return True
            else:
                return False

    def delItem(self, row):
        """Delete a item.

        Example:
        --------
        >>> model.delItem(3)   # delete the 4th item
        """
        ok = self.removeRow(row)
        if ok:
            self.repaint_slices.emit(-1)
            return True
        else:
            return False

    def new_image(self, data=None, name=None, label_config=None, colormap=None):
        """
        Add a new item.

        """
        if data is None:
            new_data = np.zeros(self._data[0].get_data_shape()[0:3], dtype=np.int_)
        else:
            new_data = data
        new_header = self._data[0].get_header().copy()
        new_header.set_data_shape(new_data.shape)
        if colormap is None:
            colormap = self._label_config_center.get_first_label_config()
        if name is None:
            self.addItem(new_data, label_config, 'new_image_%s' % self.new_no,
                         new_header, 0, 100, 255, colormap)
            self.new_no += 1
        else:
            self.addItem(new_data, label_config, name,
                         new_header, 0, 100, 255, colormap)

    def moveUp(self, row, parent=QModelIndex()):
        """Move the specific row up for one step. """
        if row != 0:
            self.beginMoveRows(parent, row, row, parent, row - 1)
            self._data[row], self._data[row - 1] = \
                    self._data[row - 1], self._data[row]
            self.endMoveRows()
            self.repaint_slices.emit(-1)
        else:
            raise ValueError("Input must be non-zero integer.")

    def moveDown(self, row, parent=QModelIndex()):
        """
        Move the specific row down for one step.

        """
        if row != (self.rowCount() - 1):
            self.beginMoveRows(parent, row + 1, row + 1, parent, row)
            self._data[row], self._data[row + 1] = \
                    self._data[row + 1], self._data[row]
            self.endMoveRows()
            self.repaint_slices.emit(-1)
        else:
            raise ValueError("Index out of range!")

    def currentIndex(self):
        """Return current index."""
        return self._current_index

    def setCurrentIndex(self, index):
        """Set current row."""
        if index.row() >= 0 and index.row() <= self.rowCount():
            self._current_index = index
        else:
            raise ValueError('Invalid value.')

    def setSelectedIndexes(self):
        """Return all selected items and save into _selected_indexes."""
        self._selected_indexes = []
        for row in range(self.rowCount()):
            idx = self.index(row)
            if self.data(idx, Qt.CheckStateRole) == Qt.Checked:
                self._selected_indexes.insert(0, idx)

    def getItemList(self):
        """Return whole items' name."""
        item_list = []
        for row in range(self.rowCount()):
            idx = self.index(row)
            item_list.append(self.data(idx, Qt.DisplayRole))
        return item_list

    def selectedIndexes(self):
        """ Get selected items."""
        self.setSelectedIndexes()
        return self._selected_indexes

    def set_scale_factor(self, value, type):
        """Set scale factor."""
        if type == 'grid':
            self._grid_scale_factor = value
        elif type == 'orth':
            self._orth_scale_factor = value
        #self.repaint_slices.emit(-1)
        self.scale_changed.emit()

    def get_scale_factor(self, type):
        """Get scale factor."""
        if type == 'grid':
            return self._grid_scale_factor
        elif type == 'orth':
            return self._orth_scale_factor

    def modify_voxels(self, coord_list=None, value=None, roi=None,
                      target_row=None, ignore=True):
        """Set (x, y, z) voxel's value on specific layer."""
        if value is None:
            return

        if coord_list is not None:
            row = self.currentIndex().row()
            x = [item[0] for item in coord_list]
            y = [item[1] for item in coord_list]
            z = [item[2] for item in coord_list]
            self._data[row].set_voxel(x, y, z, value, ignore)
            self.repaint_slices.emit(coord_list[0][2])
        elif roi is not None:
            row = self.currentIndex().row()
            if target_row is None:
                target_row = row
            coords = self._data[row].get_roi_coords(roi)
            x, y, z = list(coords[0]), list(coords[1]), list(coords[2])
            self._data[target_row].set_voxel(x, y, z, value, ignore)
            for s in range(min(z), max(z)+1):
                self.repaint_slices.emit(s)
        else:
            return

    def get_current_roi_val(self, x, y, z):
        row = self.currentIndex().row()
        return self._data[row].get_coord_val(x, y, z)

    def get_current_time_point(self):
        row = self.currentIndex().row()
        if self._data[row].is_4d():
            return self._data[row].get_time_point()
        else:
            return False

    def rgba_list(self, index):
        """ Get RGBA array for `index`th label."""
        return [self._data[idx.row()].get_rgba(index) for
                idx in self.selectedIndexes()]

    def getX(self):
        """Get the height of the picture."""
        return self._data[0].get_data_shape()[1]

    def getY(self):
        """Get width of the picture."""
        return self._data[0].get_data_shape()[0]

    def getZ(self):
        """Get layer index."""
        return self._data[0].get_data_shape()[2]

    def set_time_point(self, tpoint):
        """Set time point for every volume."""
        if isinstance(tpoint, int) and not tpoint < 0:
            for data in self._data:
                data.set_time_point(tpoint)
        self.time_changed.emit()
        self.repaint_slices.emit(-1)

    def get_current_label_config(self):
        row = self.currentIndex().row()
        return self._data[row].get_label_config()

    def _connect_undo_redo(self):
        for data in self._data:
            data.connect_undo(self.undo_stack_changed)
            data.connect_redo(self.redo_stack_changed)

    def undo_current_image(self):
        row = self.currentIndex().row()
        s = self._data[row].undo()
        if s is not None:
            for s_ in range(min(s), max(s)+1):
                self.repaint_slices.emit(s_)

    def redo_current_image(self):
        row = self.currentIndex().row()
        s = self._data[row].redo()
        if s is not None:
            for s_ in range(min(s), max(s)+1):
                self.repaint_slices.emit(s_)

    def current_undo_available(self):
        row = self.currentIndex().row()
        return self._data[row].undo_stack_not_empty()

    def current_redo_available(self):
        row = self.currentIndex().row()
        return self._data[row].redo_stack_not_empty()

    def get_current_value(self, xyz, time_course=False):
        row = self.currentIndex().row()
        return self._data[row].get_value(xyz, time_course)

    def get_row_value(self, xyz, row):
        return self._data[row].get_value(xyz)

    def get_current_value_label(self, value):
        return self._label_config_center.get_current_index_label(value)

    def update_current_rgba(self):
        row = self.currentIndex().row()
        self._data[row].update_rgba()
        self.repaint_slices.emit(-1)

    def update_all_rgba(self):
        self.repaint_slices.emit(-1)

    def get_sagital_rgba_list(self):
        """Get RGBA array for sagital direction in OrthView."""
        return [self._data[idx.row()].get_sagital_rgba() for
                idx in self.selectedIndexes()]

    def get_axial_rgba_list(self):
        """get RGBA array for axial direction in OrthView. """
        return [self._data[idx.row()].get_axial_rgba() for
                idx in self.selectedIndexes()]

    def get_coronal_rgba_list(self):
        """get RGBA array for axial direction in OrthView."""
        return [self._data[idx.row()].get_coronal_rgba() for
                idx in self.selectedIndexes()]

    def set_cur_label(self, label_config):
        row = self.currentIndex().row()
        self._data[row].set_label(label_config)

    def set_global_label(self, label_config):
        for bp_data in self._data:
            if bp_data.is_label_global():
                bp_data.set_label(label_config)

    def get_label_config_center(self):
        return self._label_config_center

    def _get_sapce_info(self, vol):
        """Get affine and corresponding RAS sapce from the first volume."""
        header = vol.get_header()
        self._ras_unit = header.get_xyzt_units()[0]
        space_list = ['unknown', 'Scanner', 'Aligned', 'Talairach', 'MNI']
        if header['sform_code']:
            self._ras_space = space_list[header['sform_code'].item()]
            self._affine = header.get_sform()
        elif header['qform_code']:
            self._ras_space = space_list[header['qform_code'].item()]
            self._affine = header.get_qform()

    def get_affine(self):
        """ Get affine matrix."""
        return self._affine

    def get_space_name(self):
        """ Get RAS space name."""
        return self._ras_space

    def is_mni_space(self):
        if self._ras_space is "MNI":
            return True
        else:
            return False


text:
/*!
 * Angular Material Design
 * https://github.com/angular/material
 * @license MIT
 * v0.8.2
 */
@-webkit-keyframes sliderFocusThumb {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
            transform: scale(0); }

  50% {
    -webkit-transform: scale(1);
            transform: scale(1);
    opacity: 1; }

  100% {
    opacity: 0; } }

@keyframes sliderFocusThumb {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
            transform: scale(0); }

  50% {
    -webkit-transform: scale(1);
            transform: scale(1);
    opacity: 1; }

  100% {
    opacity: 0; } }

md-slider {
  height: 48px;
  position: relative;
  display: block;
  margin-left: 4px;
  margin-right: 4px;
  padding: 0;
  /**
   * Track
   */
  /**
   * Slider thumb
   */
  /* The sign that's focused in discrete mode */
  /**
   * The border/background that comes in when focused in non-discrete mode
   */
  /* Don't animate left/right while panning */ }
  md-slider .md-slider-wrapper {
    position: relative; }
  md-slider .md-track-container {
    width: 100%;
    position: absolute;
    top: 23px;
    height: 2px; }
  md-slider .md-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 100%; }
  md-slider .md-track-fill {
    transition: width 0.05s linear; }
  md-slider .md-track-ticks {
    position: absolute;
    left: 0;
    right: 0;
    height: 100%; }
  md-slider .md-thumb-container {
    position: absolute;
    left: 0;
    top: 50%;
    -webkit-transform: translate3d(-50%, -50%, 0);
            transform: translate3d(-50%, -50%, 0);
    transition: left 0.1s linear; }
  md-slider .md-thumb {
    z-index: 1;
    position: absolute;
    left: -19px;
    top: 5px;
    width: 38px;
    height: 38px;
    border-radius: 38px;
    -webkit-transform: scale(0.5);
            transform: scale(0.5);
    transition: all 0.1s linear; }
    md-slider .md-thumb:after {
      content: '';
      position: absolute;
      left: 3px;
      top: 3px;
      width: 32px;
      height: 32px;
      border-radius: 32px;
      border: 3px solid; }
  md-slider .md-sign {
    /* Center the children (slider-thumb-text) */
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-align-items: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-justify-content: center;
        -ms-flex-pack: center;
            justify-content: center;
    position: absolute;
    left: -14px;
    top: -20px;
    width: 28px;
    height: 28px;
    border-radius: 28px;
    -webkit-transform: scale(0.4) translate3d(0, 70px, 0);
            transform: scale(0.4) translate3d(0, 70px, 0);
    transition: all 0.2s ease-in-out;
    /* The arrow pointing down under the sign */ }
    md-slider .md-sign:after {
      position: absolute;
      content: '';
      left: 0px;
      border-radius: 16px;
      top: 19px;
      border-left: 14px solid transparent;
      border-right: 14px solid transparent;
      border-top: 16px solid;
      opacity: 0;
      -webkit-transform: translate3d(0, -8px, 0);
              transform: translate3d(0, -8px, 0);
      transition: all 0.2s ease-in-out; }
    md-slider .md-sign .md-thumb-text {
      z-index: 1;
      font-size: 12px;
      font-weight: bold; }
  md-slider .md-focus-thumb {
    position: absolute;
    left: -24px;
    top: 0px;
    width: 48px;
    height: 48px;
    border-radius: 48px;
    display: none;
    opacity: 0;
    background-color: #C0C0C0;
    -webkit-animation: sliderFocusThumb 0.4s linear;
            animation: sliderFocusThumb 0.4s linear; }
  md-slider .md-focus-ring {
    position: absolute;
    left: -24px;
    top: 0px;
    width: 48px;
    height: 48px;
    border-radius: 48px;
    border: 2px solid #D6D6D6;
    background-color: transparent;
    -webkit-transform: scale(0);
            transform: scale(0);
    transition: all 0.2s linear; }
  md-slider .md-disabled-thumb {
    position: absolute;
    left: -22px;
    top: 2px;
    width: 44px;
    height: 44px;
    border-radius: 44px;
    -webkit-transform: scale(0.35);
            transform: scale(0.35);
    border: 6px solid;
    display: none; }
  md-slider.md-min .md-thumb:after {
    background-color: white; }
  md-slider.md-min .md-sign {
    opacity: 0; }
  md-slider:focus {
    outline: none; }
  md-slider.dragging .md-thumb-container, md-slider.dragging .md-track-fill {
    transition: none; }
  md-slider:not([md-discrete]) {
    /* Hide the sign and ticks in non-discrete mode */ }
    md-slider:not([md-discrete]) .md-track-ticks, md-slider:not([md-discrete]) .md-sign {
      display: none; }
    md-slider:not([md-discrete]):not([disabled]):hover .md-thumb {
      -webkit-transform: scale(0.6);
              transform: scale(0.6); }
    md-slider:not([md-discrete]):not([disabled]):focus .md-focus-thumb, md-slider:not([md-discrete]):not([disabled]).active .md-focus-thumb {
      display: block; }
    md-slider:not([md-discrete]):not([disabled]):focus .md-focus-ring, md-slider:not([md-discrete]):not([disabled]).active .md-focus-ring {
      -webkit-transform: scale(1);
              transform: scale(1); }
    md-slider:not([md-discrete]):not([disabled]):focus .md-thumb, md-slider:not([md-discrete]):not([disabled]).active .md-thumb {
      -webkit-transform: scale(0.85);
              transform: scale(0.85); }
  md-slider[md-discrete] {
    /* Hide the focus thumb in discrete mode */ }
    md-slider[md-discrete] .md-focus-thumb, md-slider[md-discrete] .md-focus-ring {
      display: none; }
    md-slider[md-discrete]:not([disabled]):focus .md-sign, md-slider[md-discrete]:not([disabled]):focus .md-sign:after, md-slider[md-discrete]:not([disabled]).active .md-sign, md-slider[md-discrete]:not([disabled]).active .md-sign:after {
      opacity: 1;
      -webkit-transform: translate3d(0, 0, 0) scale(1);
              transform: translate3d(0, 0, 0) scale(1); }
  md-slider[disabled] .md-track-fill {
    display: none; }
  md-slider[disabled] .md-sign {
    display: none; }
  md-slider[disabled] .md-thumb {
    -webkit-transform: scale(0.35);
            transform: scale(0.35); }
  md-slider[disabled] .md-disabled-thumb {
    display: block; }


text:
package org.kie.workbench.common.dmn.client.editors.expressions.types.invocation;

import java.util.stream.Collectors;

import org.kie.workbench.common.dmn.api.definition.model.Binding;
import org.kie.workbench.common.dmn.api.definition.model.InformationItem;
import org.kie.workbench.common.dmn.api.definition.model.Invocation;
import org.kie.workbench.common.dmn.api.property.dmn.Name;
import org.kie.workbench.common.dmn.client.property.dmn.DefaultValueUtilities;

public class InvocationDefaultValueUtilities {

    public static final String PREFIX = "p-";

    public static String getNewParameterName(final Invocation invocation) {
        return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(invocation.getBinding().stream()
                                                                        .map(Binding::getParameter)
                                                                        .filter(informationItem -> informationItem != null)
                                                                        .map(InformationItem::getName)
                                                                        .filter(name -> name != null)
                                                                        .map(Name::getValue)
                                                                        .collect(Collectors.toList()),
                                                                PREFIX);
    }
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Products extends MY_Controller {

    public function __construct(){
        parent::__construct();
        $this->load->model('products_model');
    }

    public function index() {

        //$this->load->view('contracts/index');
    }

    public function roofing_bended_panels() {
        $this->load->view('products/roofing_bended_panels');
    }

    public function hardware_accessories() {
        $this->load->view('products/hardware_accessories');
    }

    public function getProductsByCategoryComboBox( $cat_id = null) {

        $products = $this->products_model->getProductByCategory($cat_id);

        $products_data = array();

        foreach ($products as $p) {

            $temp = array(
                'id' => $p->p_id,
                'text' => $p->p_name
            );

            $products_data[] = $temp;
        }

        $this->output
            ->set_content_type('application/json')
            ->set_output(json_encode($products_data) );
    }

    public function getProductThicknessComboBox( $cat_id = null) {}
    public function getProductWidthComboBox( $cat_id = null) {}
    public function getProductsLengthComboBox( $cat_id = null) {}

    public function getRoofingBendedPanels() {

        $roofingBendedPanels = $this->products_model->getRoofingBendedPanels();

        $resultSet['rows'] = $roofingBendedPanels;
        $resultSet['total'] = count($roofingBendedPanels);

        $this->output
            ->set_content_type('application/json')
            ->set_output(json_encode($resultSet));
    }

    public function getRoofingBendedPanelsCategory() {

        $roofingBendedPanelsCategory = $this->products_model->getRoofingBendedPanelsCategory();

        $roofingBendedPanelsCategory_data = array();

        foreach ($roofingBendedPanelsCategory as $p) {

            $temp = array(
                'id' => $p->cat_id,
                'text' => $p->cat_name
            );

            $roofingBendedPanelsCategory_data[] = $temp;
        }

        $this->output
            ->set_content_type('application/json')
            ->set_output(json_encode($roofingBendedPanelsCategory_data) );
    }

    public function saveProduct() {

        $post = $_POST;

        $rbp = $this->products_model->save( $post['data'] );

        if ( $rbp ) {
            $this->output
                ->set_content_type('application/json')
                ->set_output( json_encode( array( 'status' => 'success' ) ) );
        }
    }

    public function deleteByProductId() {

        $post = $_POST;

        $deleteRoofingBendedPanel = $this->products_model->deleteByProductId( $post );

        if( $deleteRoofingBendedPanel ) {
            $this->output
                ->set_content_type('application/json')
                ->set_output( json_encode( array( 'status' => 'success' ) ) );
        }

    }

    public function getHardwareAccessories() {

        $hardwareAccessories = $this->products_model->getHardwareAccessories();

        $resultSet['rows'] = $hardwareAccessories;
        $resultSet['total'] = count($hardwareAccessories);

        $this->output
            ->set_content_type('application/json')
            ->set_output(json_encode($resultSet));
    }

}