text:
<?php

/**
 * @see Microsoft_AutoLoader
 */
require_once dirname(__FILE__) . '/../../AutoLoader.php';

/**
 * Scaffold commands
 *
 * @category   Microsoft
 * @package    Microsoft_WindowsAzure_CommandLine
 * @copyright  Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
 * @license    http://phpazure.codeplex.com/license
 *
 * @command-handler scaffolder
 * @command-handler-description Windows Azure Package commands
 * @command-handler-header Windows Azure SDK for PHP
 * @command-handler-header Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
 * @command-handler-footer
 * @command-handler-footer All commands support the --ConfigurationFile or -F parameter.
 * @command-handler-footer The parameter file is a simple INI file carrying one parameter
 * @command-handler-footer value per line. It accepts the same parameters as one can
 * @command-handler-footer use from the command line command.
 */
class Microsoft_WindowsAzure_CommandLine_Scaffolder
	extends Microsoft_Console_Command
{
	/**
	 * Runs a scaffolder and creates a Windows Azure project structure which can be customized before packaging.
	 *
	 * @command-name Run
	 * @command-description Runs a scaffolder and creates a Windows Azure project structure which can be customized before packaging.
	 *
	 * @command-parameter-for $path Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --OutputPath|-out Required. The path to create the Windows Azure project structure.
	 * @command-parameter-for $scaffolder Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Scaffolder|-s Optional. The path to the scaffolder to use. Defaults to Scaffolders/DefaultScaffolder.phar
	 */
	public function runCommand($path, $scaffolder, $argv)
	{
		// Default parameter value
		if (is_null($scaffolder) || $scaffolder == '') {
			$scaffolder = 'DefaultScaffolder';
		}

		// Locate scaffolder
		$scaffolderFile = realpath($scaffolder);
		if (!is_file($scaffolderFile)) {
			$scaffolderFile = realpath(dirname(__FILE__) . '/../../../../scaffolders/' . str_replace('.phar', '', $scaffolder) . '.phar');
		}

		// Verify scaffolder
		if (!is_file($scaffolderFile)) {
			throw new Microsoft_Console_Exception('Could not locate the given scaffolder: ' . $scaffolder);
		}

		// Include scaffolder
		require_once $scaffolderFile;
		$scaffolderClass = str_replace('.phar', '', basename($scaffolderFile));
		if (!class_exists($scaffolderClass)) {
			$scaffolderClass = str_replace('-', '_', str_replace('.', '_', $scaffolderClass));
			if (!class_exists($scaffolderClass)) {
				$scaffolderClass = substr($scaffolderClass, 0, strpos($scaffolderClass, '_'));
				if (!class_exists($scaffolderClass)) {
					throw new Microsoft_Console_Exception('Could not locate a class named ' . $scaffolderClass . ' in the given scaffolder: ' . $scaffolder . '. Make sure the scaffolder package contains a file named index.php and contains a class named Scaffolder.');
				}
			}
		}

		// Add command parameters
		array_unshift($argv, '--OutputPath=' . $path);
		array_unshift($argv, '--Phar=' . $scaffolderFile);
		array_unshift($argv, 'Run');
		array_unshift($argv, $scaffolderClass);

		// Run scaffolder
		Microsoft_Console_Command::bootstrap($argv);

		// Echo output path
		echo "$scaffolderClass finished at location: $path\r\n";
	}

	/**
	 * Shows help information for a specific scaffolder.
	 *
	 * @command-name Help
	 * @command-description Shows help information for a specific scaffolder.
	 *
	 * @command-parameter-for $scaffolder Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile|Microsoft_Console_Command_ParameterSource_Env --Scaffolder|-s Optional. The path to the scaffolder to use. Defaults to Scaffolders/DefaultScaffolder.phar
	 */
	public function scaffolderhelpCommand($scaffolder, $argv)
	{
		// Default parameter value
		if (is_null($scaffolder) || $scaffolder == '') {
			$scaffolder = 'DefaultScaffolder';
		}

		// Locate scaffolder
		$scaffolderFile = realpath($scaffolder);
		if (!is_file($scaffolderFile)) {
			$scaffolderFile = realpath(dirname(__FILE__) . '/../../../../scaffolders/' . str_replace('.phar', '', $scaffolder) . '.phar');
		}

		// Verify scaffolder
		if (!is_file($scaffolderFile)) {
			throw new Microsoft_Console_Exception('Could not locate the given scaffolder: ' . $scaffolder);
		}

		// Include scaffolder
		require_once $scaffolderFile;
		$scaffolderClass = str_replace('.phar', '', basename($scaffolderFile));
		if (!class_exists($scaffolderClass)) {
			$scaffolderClass = str_replace('-', '_', str_replace('.', '_', $scaffolderClass));
			if (!class_exists($scaffolderClass)) {
				$scaffolderClass = substr($scaffolderClass, 0, strpos($scaffolderClass, '_'));
				if (!class_exists($scaffolderClass)) {
					throw new Microsoft_Console_Exception('Could not locate a class named ' . $scaffolderClass . ' in the given scaffolder: ' . $scaffolder . '. Make sure the scaffolder package contains a file named index.php and contains a class named Scaffolder.');
				}
			}
		}

		// Add command parameters
		array_unshift($argv, '-h');
		array_unshift($argv, $scaffolderClass);

		// Run scaffolder
		Microsoft_Console_Command::bootstrap($argv);
	}

	/**
	 * Builds a scaffolder from a given path.
	 *
	 * @command-name Build
	 * @command-description Builds a scaffolder from a given path.
	 *
	 * @command-parameter-for $rootPath Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --InputPath|-in Required. The path to package into a scaffolder.
	 * @command-parameter-for $scaffolderFile Microsoft_Console_Command_ParameterSource_Argv|Microsoft_Console_Command_ParameterSource_ConfigFile --OutputFile|-out Required. The filename of the scaffolder.
	 */
	public function buildCommand($rootPath, $scaffolderFile)
	{
		$archive = new Phar($scaffolderFile);
		$archive->buildFromIterator(
			new RecursiveIteratorIterator(
				new SourceControlFilteredRecursiveFilterIterator(
					new RecursiveDirectoryIterator(realpath($rootPath)))),
		realpath($rootPath));

		echo $scaffolderFile;
	}
}
Microsoft_Console_Command::bootstrap($_SERVER['argv']);

class SourceControlFilteredRecursiveFilterIterator
	extends RecursiveFilterIterator {
	public static $filters = array('.svn', '.git');

    public function accept() {
    	return !in_array(
    	$this->current()->getFilename(), self::$filters, true);
    }
}


text:
module Azure::Batch::Mgmt::V2017_05_01
  module Models
    #
    # Defines values for ProvisioningState
    #
    module ProvisioningState
      Invalid = "Invalid"
      Creating = "Creating"
      Deleting = "Deleting"
      Succeeded = "Succeeded"
      Failed = "Failed"
      Cancelled = "Cancelled"
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
> [Introduced][mr-8135] in GitLab 8.15. Currently requires a [Public project][project-settings].

Auto deploy is an easy way to configure GitLab CI for the deployment of your
application. GitLab Community maintains a list of `.gitlab-ci.yml`
templates for various infrastructure providers and deployment scripts
powering them. These scripts are responsible for packaging your application,
setting up the infrastructure and spinning up necessary services (for
example a database).

You can use [project services][project-services] to store credentials to
your infrastructure provider and they will be available during the
deployment.

## Supported templates

The list of supported auto deploy templates is available [here][auto-deploy-templates].

## Configuration

1. Enable a deployment [project service][project-services] to store your
credentials. For example, if you want to deploy to OpenShift you have to
enable [Kubernetes service][kubernetes-service].
1. Configure GitLab Runner to use Docker or Kubernetes executor with
[privileged mode enabled][docker-in-docker].
1. Navigate to the "Project" tab and click "Set up auto deploy" button.
   ![Auto deploy button](img/auto_deploy_button.png)
1. Select a template.
  ![Dropdown with auto deploy templates](img/auto_deploy_dropdown.png)
1. Commit your changes and create a merge request.
1. Test your deployment configuration using a [Review App][review-app] that was
created automatically for you.

[mr-8135]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8135
[project-settings]: https://docs.gitlab.com/ce/public_access/public_access.html
[project-services]: ../../user/project/integrations/project_services.md
[auto-deploy-templates]: https://gitlab.com/gitlab-org/gitlab-ci-yml/tree/master/autodeploy
[kubernetes-service]: ../../user/project/integrations/kubernetes.md
[docker-in-docker]: ../docker/using_docker_build.md#use-docker-in-docker-executor
[review-app]: ../review_apps/index.md


text:
<?php
namespace LSI\CustomerBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class LSICustomerBundle extends Bundle
{

}


text:
import {Component, Inject, Input, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA} from '@angular/material';
import {AngularFireDatabase} from 'angularfire2/database';

@Component({
  selector: 'app-event-edit-calendar-modal',
  templateUrl: './event-edit-calendar-modal.component.html',
  styleUrls: ['./event-edit-calendar-modal.component.css']
})
export class EventEditCalendarModalComponent implements OnInit {

  private _day: string;
  private _events: any[];
  private _id: string;

  constructor(@Inject(MAT_DIALOG_DATA) private data: any, private db: AngularFireDatabase) {
  }

  ngOnInit() {
    this._day = this.data.event.date.toDateString();
    this._events = this.data.event.events;
    this._id = this.data.uid;
  }

  deleteEvent(eventKey): void {
    this.db.object(`calendar/${this._id}/${eventKey}`).remove();
  }

  get day(): string {
    return this._day;
  }

  get events(): any[] {
    return this._events;
  }
}


text:
package org.apache.solr.cloud;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.zookeeper.KeeperException;
import org.junit.Before;

@Slow
public class TestReplicaProperties extends ReplicaPropertiesBase {

  public static final String COLLECTION_NAME = "testcollection";

  public TestReplicaProperties() {
    schemaString = "schema15.xml";      // we need a string id
  }

  @Override
  @Before
  public void setUp() throws Exception {
    fixShardCount = true;
    sliceCount = 2;
    shardCount = 4;
    super.setUp();
  }

  @Override
  public void doTest() throws Exception {
    CloudSolrServer client = createCloudClient(null);
    try {
      // Mix up a bunch of different combinations of shards and replicas in order to exercise boundary cases.
      // shards, replicationfactor, maxreplicaspernode
      int shards = random().nextInt(7);
      if (shards < 2) shards = 2;
      int rFactor = random().nextInt(4);
      if (rFactor < 2) rFactor = 2;
      createCollection(null, COLLECTION_NAME, shards, rFactor, shards * rFactor + 1, client, null, "conf1");
    } finally {
      //remove collections
      client.shutdown();
    }

    waitForCollection(cloudClient.getZkStateReader(), COLLECTION_NAME, 2);
    waitForRecoveriesToFinish(COLLECTION_NAME, false);

    listCollection();

    clusterAssignPropertyTest();
  }

  private void listCollection() throws IOException, SolrServerException {
    CloudSolrServer client = createCloudClient(null);
    try {
      ModifiableSolrParams params = new ModifiableSolrParams();
      params.set("action", CollectionParams.CollectionAction.LIST.toString());
      SolrRequest request = new QueryRequest(params);
      request.setPath("/admin/collections");

      NamedList<Object> rsp = client.request(request);
      List<String> collections = (List<String>) rsp.get("collections");
      assertTrue("control_collection was not found in list", collections.contains("control_collection"));
      assertTrue(DEFAULT_COLLECTION + " was not found in list", collections.contains(DEFAULT_COLLECTION));
      assertTrue(COLLECTION_NAME + " was not found in list", collections.contains(COLLECTION_NAME));
    } finally {
      //remove collections
      client.shutdown();
    }
  }

  private void clusterAssignPropertyTest() throws Exception {
    CloudSolrServer client = createCloudClient(null);
    try {
      client.connect();
      try {
        doPropertyAction(client,
            "action", CollectionParams.CollectionAction.BALANCESLICEUNIQUE.toString(),
            "property", "preferredLeader");
      } catch (SolrException se) {
        assertTrue("Should have seen missing required parameter 'collection' error",
            se.getMessage().contains("Missing required parameter: collection"));
      }

      doPropertyAction(client,
          "action", CollectionParams.CollectionAction.BALANCESLICEUNIQUE.toString(),
          "collection", COLLECTION_NAME,
          "property", "preferredLeader");

      verifyUniqueAcrossCollection(client, COLLECTION_NAME, "property.preferredleader");

      doPropertyAction(client,
          "action", CollectionParams.CollectionAction.BALANCESLICEUNIQUE.toString(),
          "collection", COLLECTION_NAME,
          "property", "property.newunique",
          "sliceUnique", "true");
      verifyUniqueAcrossCollection(client, COLLECTION_NAME, "property.newunique");

      try {
        doPropertyAction(client,
            "action", CollectionParams.CollectionAction.BALANCESLICEUNIQUE.toString(),
            "collection", COLLECTION_NAME,
            "property", "whatever",
            "sliceUnique", "false");
        fail("Should have thrown an exception here.");
      } catch (SolrException se) {
        assertTrue("Should have gotten a specific error message here",
            se.getMessage().contains("Balancing properties amongst replicas in a slice requires that the " +
                "property be pre-defined as a unique property (e.g. 'preferredLeader') or that 'sliceUnique' be set to 'true'"));
      }
      // Should be able to set non-unique-per-slice values in several places.
      Map<String, Slice> slices = client.getZkStateReader().getClusterState().getCollection(COLLECTION_NAME).getSlicesMap();
      List<String> sliceList = new ArrayList<>(slices.keySet());
      String c1_s1 = sliceList.get(0);
      List<String> replicasList = new ArrayList<>(slices.get(c1_s1).getReplicasMap().keySet());
      String c1_s1_r1 = replicasList.get(0);
      String c1_s1_r2 = replicasList.get(1);

      addProperty(client,
          "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
          "collection", COLLECTION_NAME,
          "shard", c1_s1,
          "replica", c1_s1_r1,
          "property", "bogus1",
          "property.value", "true");

      addProperty(client,
          "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
          "collection", COLLECTION_NAME,
          "shard", c1_s1,
          "replica", c1_s1_r2,
          "property", "property.bogus1",
          "property.value", "whatever");

      try {
        doPropertyAction(client,
            "action", CollectionParams.CollectionAction.BALANCESLICEUNIQUE.toString(),
            "collection", COLLECTION_NAME,
            "property", "bogus1",
            "sliceUnique", "false");
        fail("Should have thrown parameter error here");
      } catch (SolrException se) {
        assertTrue("Should have caught specific exception ",
            se.getMessage().contains("Balancing properties amongst replicas in a slice requires that the property be " +
                "pre-defined as a unique property (e.g. 'preferredLeader') or that 'sliceUnique' be set to 'true'"));
      }

      // Should have no effect despite the "sliceUnique" param being set.

      doPropertyAction(client,
          "action", CollectionParams.CollectionAction.BALANCESLICEUNIQUE.toString(),
          "collection", COLLECTION_NAME,
          "property", "property.bogus1",
          "sliceUnique", "true");

      verifyPropertyVal(client, COLLECTION_NAME,
          c1_s1_r1, "property.bogus1", "true");
      verifyPropertyVal(client, COLLECTION_NAME,
          c1_s1_r2, "property.bogus1", "whatever");

      // At this point we've assigned a preferred leader. Make it happen and check that all the nodes that are
      // leaders _also_ have the preferredLeader property set.

      doPropertyAction(client,
          "action", CollectionParams.CollectionAction.REBALANCELEADERS.toString(),
          "collection", COLLECTION_NAME);

      verifyLeaderAssignment(client, COLLECTION_NAME);

    } finally {
      client.shutdown();
    }
  }

  private void verifyLeaderAssignment(CloudSolrServer client, String collectionName)
      throws InterruptedException, KeeperException {
    String lastFailMsg = "";
    for (int idx = 0; idx < 300; ++idx) { // Keep trying while Overseer writes the ZK state for up to 30 seconds.
      lastFailMsg = "";
      client.getZkStateReader().updateClusterState(true);
      ClusterState clusterState = client.getZkStateReader().getClusterState();
      for (Slice slice : clusterState.getSlices(collectionName)) {
        Boolean foundLeader = false;
        Boolean foundPreferred = false;
        for (Replica replica : slice.getReplicas()) {
          Boolean isLeader = replica.getBool("leader", false);
          Boolean isPreferred = replica.getBool("property.preferredleader", false);
          if (isLeader != isPreferred) {
            lastFailMsg = "Replica should NOT have preferredLeader != leader. Preferred: " + isPreferred.toString() +
                " leader is " + isLeader.toString();
          }
          if (foundLeader && isLeader) {
            lastFailMsg = "There should only be a single leader in _any_ shard! Replica " + replica.getName() +
                " is the second leader in slice " + slice.getName();
          }
          if (foundPreferred && isPreferred) {
            lastFailMsg = "There should only be a single preferredLeader in _any_ shard! Replica " + replica.getName() +
                " is the second preferredLeader in slice " + slice.getName();
          }
          foundLeader = foundLeader ? foundLeader : isLeader;
          foundPreferred = foundPreferred ? foundPreferred : isPreferred;
        }
      }
      if (lastFailMsg.length() == 0) return;
      Thread.sleep(100);
    }
    fail(lastFailMsg);
  }

  private void addProperty(CloudSolrServer client, String... paramsIn) throws IOException, SolrServerException {
    assertTrue("paramsIn must be an even multiple of 2, it is: " + paramsIn.length, (paramsIn.length % 2) == 0);
    ModifiableSolrParams params = new ModifiableSolrParams();
    for (int idx = 0; idx < paramsIn.length; idx += 2) {
      params.set(paramsIn[idx], paramsIn[idx + 1]);
    }
    QueryRequest request = new QueryRequest(params);
    request.setPath("/admin/collections");
    client.request(request);

  }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Volumes and Drives</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="pt02.html" title="Part II. API Reference">
<link rel="prev" href="gio-Desktop-file-based-GAppInfo.html" title="Desktop file based GAppInfo">
<link rel="next" href="GVolumeMonitor.html" title="GVolumeMonitor">
<meta name="generator" content="GTK-Doc V1.15 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">

GIO Reference Manual

Volumes and Drives

GVolumeMonitor — Volume Monitor

GVolume — Volume management

GMount — Mount management

GDrive — Drive management

Unix Mounts — UNIX mounts

          Generated by GTK-Doc V1.15


text:
#include <algorithm>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#include "tensorflow/lite/toco/allocate_transient_arrays.h"
#include "tensorflow/lite/toco/model.h"
#include "tensorflow/lite/toco/model_flags.pb.h"
#include "tensorflow/lite/toco/tooling_util.h"
#include "tensorflow/core/platform/logging.h"

namespace toco {
namespace {

// The life span of an array.
struct ArrayLifespan {
  // If true, the array is persistent state (as in a RNN). In that case,
  // its allocation is permanent and the first_op, last_op members are
  // unused. (The term 'transient' is a misnomer and we should think in
  // terms of 'workspace' instead).
  bool persistent = false;
  // Index of the first op addressing that array. The array must be allocated
  // just before executing this op.
  std::size_t first_op = 0;
  // Index of the last op addressing that array. We want to deallocate the array
  // immediately after executing this op.
  std::size_t last_op = 0;
};

bool StartsAt(const ArrayLifespan& lifespan, std::size_t op_index) {
  return !lifespan.persistent && lifespan.first_op == op_index;
}

bool EndsAt(const ArrayLifespan& lifespan, std::size_t op_index) {
  return !lifespan.persistent && lifespan.last_op == op_index;
}

// Helper function for ComputeArrayLifespans: updates one ArrayLifespan for
// one array for one op.
void UpdateArrayLifespan(
    const std::string& array_name, std::size_t op_index,
    std::unordered_map<std::string, ArrayLifespan>* array_lifespans) {
  if (array_lifespans->count(array_name)) {
    auto& lifespan = array_lifespans->at(array_name);
    if (!lifespan.persistent) {
      lifespan.first_op = std::min(lifespan.first_op, op_index);
      lifespan.last_op = std::max(lifespan.last_op, op_index);
    }
  } else {
    ArrayLifespan lifespan;
    lifespan.first_op = op_index;
    lifespan.last_op = op_index;
    (*array_lifespans)[array_name] = lifespan;
  }
}

// Computes the ArrayLifespan for each array.
void ComputeArrayLifespans(
    const Model& model,
    std::unordered_map<std::string, ArrayLifespan>* array_lifespans) {
  CHECK(array_lifespans->empty());
  for (const auto& rnn_state : model.flags.rnn_states()) {
    ArrayLifespan lifespan;
    lifespan.persistent = true;
    (*array_lifespans)[rnn_state.state_array()] = lifespan;
  }
  for (std::size_t op_index = 0; op_index < model.operators.size();
       op_index++) {
    const auto& op = model.operators[op_index];
    for (const auto& input : op->inputs) {
      UpdateArrayLifespan(input, op_index, array_lifespans);
    }
    for (const auto& output : op->outputs) {
      UpdateArrayLifespan(output, op_index, array_lifespans);
    }
  }
}

inline bool operator==(const Alloc& a, const Alloc& b) {
  CHECK(a.start != b.start || a.end == b.end);
  return a.start == b.start;
}

// Helper to keep track of total allocation size and of currently live
// allocations, and containing the core allocation routine.
class Allocator {
 public:
  Allocator() : total_size_(0) {}

  // Core allocation routine.
  void Allocate(std::size_t size, Alloc* result) {
    if (size == 0) {
      // zero-sized arrays get a dummy alloc of (0, 0) that does not
      // need to be kept in the books (no need to insert that into
      // live_allocs_).
      // Note: zero-sized arrays shouldn't exist, but handling that case
      // here allows such pathological cases to get a cleaner error message
      // later instead of generating spurious allocator failures.
      result->start = 0;
      result->end = 0;
      return;
    }
    // Naive algorithm: pick the first gap between live allocations,
    // that is wide enough for the new array.
    std::size_t pos = 0;
    for (const auto& a : live_allocs_) {
      if (a.start >= pos + size) {
        result->start = pos;
        result->end = pos + size;
        live_allocs_.insert(*result);
        return;
      }
      pos = a.end;
    }
    // No sufficiently wide gap was found before an existing live allocation,
    // so we allocate the new array at the end of the allocation space.
    // We may then have to grow total_size_.
    total_size_ = std::max(total_size_, pos + size);
    result->start = pos;
    result->end = pos + size;
    live_allocs_.insert(*result);
  }

  void Deallocate(const Alloc& a) {
    // Special-case dummy allocs for zero-sized arrays.
    if (a.start == 0 && a.end == 0) {
      // Nothing needs to be done, these aren't kept in the books.
      return;
    }
    auto iter = std::lower_bound(live_allocs_.begin(), live_allocs_.end(), a);
    CHECK(iter != live_allocs_.end());
    CHECK(*iter == a);
    live_allocs_.erase(iter);
  }

  std::size_t total_size() const { return total_size_; }

 private:
  std::size_t total_size_;
  std::set<Alloc> live_allocs_;
};

// Returns the required transient allocation size (in bytes) for a given array,
// or 0 if it's not a transient array.
std::size_t TransientArraySize(const Model& model,
                               const std::string& array_name,
                               std::size_t transient_data_alignment) {
  if (!IsAllocatableTransientArray(model, array_name)) {
    return 0;
  }
  const auto& array = &model.GetArray(array_name);
  CHECK(array->has_shape())
      << "Array '" << array_name << "' doesn't have a shape";
  if (array->data_type == ArrayDataType::kNone) {
    // Catch a typical issue at the moment with RNN states
    for (const auto& rnn_state : model.flags.rnn_states()) {
      if (rnn_state.state_array() == array_name) {
        LOG(FATAL)
            << "A RNN state array, " << array_name << ", still does not "
            << "have a known data type after all graph transformations have "
            << "run.";
      }
    }
    LOG(FATAL) << "An array, " << array_name << ", still does not "
               << "have a known data type after all graph transformations have "
               << "run.";
  }
  const std::size_t elem_size = ElementSize(array->data_type);
  const std::size_t raw_size =
      elem_size * RequiredBufferSizeForShape(array->shape());
  const std::size_t rounded_size =
      RoundUpToNextMultipleOf(raw_size, transient_data_alignment);
  return rounded_size;
}

// Allocates an array: call this for every array just before the first
// op where it is used.
void AllocateTransientArray(const Model& model, const std::string& array_name,
                            Allocator* allocator,
                            std::size_t transient_data_alignment) {
  if (!IsAllocatableTransientArray(model, array_name)) {
    return;
  }
  const std::size_t size =
      TransientArraySize(model, array_name, transient_data_alignment);
  const auto& array = &model.GetArray(array_name);
  CHECK(!array->alloc);
  allocator->Allocate(size, &array->GetOrCreateAlloc());
}

// Deallocates an array: call this for every array just after the last
// op where it is used.
void DeallocateTransientArray(const Model& model, const std::string& array_name,
                              Allocator* allocator) {
  if (!IsAllocatableTransientArray(model, array_name)) {
    return;
  }
  const auto& array = &model.GetArray(array_name);
  CHECK(!!array->alloc);
  allocator->Deallocate(*array->alloc);
}

void PushBackIfNotFound(const std::string& s, std::vector<std::string>* v) {
  if (std::find(v->begin(), v->end(), s) == v->end()) {
    v->push_back(s);
  }
}

}  // namespace

void AllocateTransientArrays(Model* model,
                             std::size_t transient_data_alignment) {
  // Precompute the lifespans for all arrays.
  std::unordered_map<std::string, ArrayLifespan> array_lifespans;
  ComputeArrayLifespans(*model, &array_lifespans);

  // In case of variable batch, our convention will be to compute the
  // allocations for batch==1, then let the inference code multiply all
  // the offsets by the actual runtime batch size. Conveniently,
  // the variable_batch and batch flags are mutually exclusive, and the default
  // value of batch is 1, so we have nothing special to do here. Let us
  // just guard this assumption with a CHECK:
  bool batchless_input_shapes = true;
  for (const auto& input_array : model->flags.input_arrays()) {
    if (!input_array.has_shape() || input_array.shape().dims().empty() ||
        input_array.shape().dims(0) != 1) {
      batchless_input_shapes = false;
      break;
    }
  }
  CHECK(!model->flags.variable_batch() || batchless_input_shapes);

  Allocator allocator;

  // Construct a sorted map of array names, so that other layout engines can
  // match exactly.
  std::map<std::string, const Array*> ordered_arrays_map;
  for (const auto& pair : model->GetArrayMap()) {
    ordered_arrays_map[pair.first] = pair.second.get();
  }

  // Allocate persistent arrays (like RNN states). For them, 'transient'
  // is a misnormer, should read 'workspace'.
  for (const auto& array_pair : ordered_arrays_map) {
    const std::string& array_name = array_pair.first;
    auto it = array_lifespans.find(array_name);
    if (it != array_lifespans.end() && it->second.persistent) {
      AllocateTransientArray(*model, array_name, &allocator,
                             transient_data_alignment);
    }
  }

  for (std::size_t op_index = 0; op_index < model->operators.size();
       op_index++) {
    const auto& op = model->operators[op_index];
    // Allocate those arrays whose lifespan starts exactly here.
    std::vector<std::string> arrays_to_allocate;
    for (const auto& input : op->inputs) {
      if (StartsAt(array_lifespans[input], op_index)) {
        PushBackIfNotFound(input, &arrays_to_allocate);
      }
    }
    for (const auto& output : op->outputs) {
      if (StartsAt(array_lifespans[output], op_index)) {
        PushBackIfNotFound(output, &arrays_to_allocate);
      }
    }
    for (const std::string& array : arrays_to_allocate) {
      AllocateTransientArray(*model, array, &allocator,
                             transient_data_alignment);
    }

    // Deallocate those arrays whose lifespan ends exactly here.
    std::vector<std::string> arrays_to_deallocate;
    for (const auto& input : op->inputs) {
      if (EndsAt(array_lifespans[input], op_index)) {
        PushBackIfNotFound(input, &arrays_to_deallocate);
      }
    }
    for (const auto& output : op->outputs) {
      if (EndsAt(array_lifespans[output], op_index)) {
        PushBackIfNotFound(output, &arrays_to_deallocate);
      }
    }
    for (const std::string& array : arrays_to_deallocate) {
      DeallocateTransientArray(*model, array, &allocator);
    }
  }

  // Just out of curiosity (not used in the actual allocation process)
  // evaluate the optimal total allocated size.
  // First, compute the size of persistent arrays.
  std::size_t optimal_transient_alloc_size = 0;
  std::size_t persistent_alloc_size = 0;
  for (const auto& array_pair : ordered_arrays_map) {
    const std::string& array_name = array_pair.first;
    auto it = array_lifespans.find(array_name);
    if (it != array_lifespans.end() && it->second.persistent) {
      persistent_alloc_size +=
          TransientArraySize(*model, array_name, transient_data_alignment);
    }
  }
  for (const auto& op : model->operators) {
    // for each operator, compute the sum of the sizes of the array that must
    // be live during the execution of this operator, plus the size of
    // persistent arrays that must be live at all times.
    std::vector<std::string> non_persistent_edges;
    for (const auto& input : op->inputs) {
      if (!array_lifespans[input].persistent) {
        PushBackIfNotFound(input, &non_persistent_edges);
      }
    }
    for (const auto& output : op->outputs) {
      if (!array_lifespans[output].persistent) {
        PushBackIfNotFound(output, &non_persistent_edges);
      }
    }
    std::size_t size = persistent_alloc_size;
    for (const std::string& edge : non_persistent_edges) {
      size += TransientArraySize(*model, edge, transient_data_alignment);
    }
    // The optimal total size is the maximum of all operator-specific sizes.
    optimal_transient_alloc_size = std::max(optimal_transient_alloc_size, size);
  }

  model->transient_data_size = allocator.total_size();
  model->transient_data_alignment = transient_data_alignment;
  CHECK_GE(model->transient_data_size, optimal_transient_alloc_size);
  LOG(INFO) << "Total transient array allocated size: "
            << model->transient_data_size << " bytes, "
            << "theoretical optimal value: " << optimal_transient_alloc_size
            << " bytes.";
  CheckInvariants(*model);
}
}  // namespace toco


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

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

/**
 *

 * Defines a named input source, called a channel, to be used by an algorithm.
 *

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

    /**
     *

     * The name of the channel.
     *

     */
    private String name;
    /**
     *

     * A brief description of the channel.
     *

     */
    private String description;
    /**
     *

     * Indicates whether the channel is required by the algorithm.
     *

     */
    private Boolean isRequired;
    /**
     *

     * The supported MIME types for the data.
     *

     */
    private java.util.List<String> supportedContentTypes;
    /**
     *

     * The allowed compression types, if data compression is used.
     *

     */
    private java.util.List<String> supportedCompressionTypes;
    /**
     *

     * The allowed input mode, either FILE or PIPE.
     *

     *

     * In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store
     * (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input mode.
     *

     *

     * In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using the
     * EBS volume.
     *

     */
    private java.util.List<String> supportedInputModes;

    /**
     *

     * The name of the channel.
     *

     *
     * @param name
     *        The name of the channel.
     */

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

    /**
     *

     * The name of the channel.
     *

     *
     * @return The name of the channel.
     */

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

    /**
     *

     * The name of the channel.
     *

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

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

    /**
     *

     * A brief description of the channel.
     *

     *
     * @param description
     *        A brief description of the channel.
     */

    public void setDescription(String description) {
        this.description = description;
    }

    /**
     *

     * A brief description of the channel.
     *

     *
     * @return A brief description of the channel.
     */

    public String getDescription() {
        return this.description;
    }

    /**
     *

     * A brief description of the channel.
     *

     *
     * @param description
     *        A brief description of the channel.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ChannelSpecification withDescription(String description) {
        setDescription(description);
        return this;
    }

    /**
     *

     * Indicates whether the channel is required by the algorithm.
     *

     *
     * @param isRequired
     *        Indicates whether the channel is required by the algorithm.
     */

    public void setIsRequired(Boolean isRequired) {
        this.isRequired = isRequired;
    }

    /**
     *

     * Indicates whether the channel is required by the algorithm.
     *

     *
     * @return Indicates whether the channel is required by the algorithm.
     */

    public Boolean getIsRequired() {
        return this.isRequired;
    }

    /**
     *

     * Indicates whether the channel is required by the algorithm.
     *

     *
     * @param isRequired
     *        Indicates whether the channel is required by the algorithm.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ChannelSpecification withIsRequired(Boolean isRequired) {
        setIsRequired(isRequired);
        return this;
    }

    /**
     *

     * Indicates whether the channel is required by the algorithm.
     *

     *
     * @return Indicates whether the channel is required by the algorithm.
     */

    public Boolean isRequired() {
        return this.isRequired;
    }

    /**
     *

     * The supported MIME types for the data.
     *

     *
     * @return The supported MIME types for the data.
     */

    public java.util.List<String> getSupportedContentTypes() {
        return supportedContentTypes;
    }

    /**
     *

     * The supported MIME types for the data.
     *

     *
     * @param supportedContentTypes
     *        The supported MIME types for the data.
     */

    public void setSupportedContentTypes(java.util.Collection<String> supportedContentTypes) {
        if (supportedContentTypes == null) {
            this.supportedContentTypes = null;
            return;
        }

        this.supportedContentTypes = new java.util.ArrayList<String>(supportedContentTypes);
    }

    /**
     *

     * The supported MIME types for the data.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setSupportedContentTypes(java.util.Collection)} or
     * {@link #withSupportedContentTypes(java.util.Collection)} if you want to override the existing values.
     *

     *
     * @param supportedContentTypes
     *        The supported MIME types for the data.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ChannelSpecification withSupportedContentTypes(String... supportedContentTypes) {
        if (this.supportedContentTypes == null) {
            setSupportedContentTypes(new java.util.ArrayList<String>(supportedContentTypes.length));
        }
        for (String ele : supportedContentTypes) {
            this.supportedContentTypes.add(ele);
        }
        return this;
    }

    /**
     *

     * The supported MIME types for the data.
     *

     *
     * @param supportedContentTypes
     *        The supported MIME types for the data.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ChannelSpecification withSupportedContentTypes(java.util.Collection<String> supportedContentTypes) {
        setSupportedContentTypes(supportedContentTypes);
        return this;
    }

    /**
     *

     * The allowed compression types, if data compression is used.
     *

     *
     * @return The allowed compression types, if data compression is used.
     * @see CompressionType
     */

    public java.util.List<String> getSupportedCompressionTypes() {
        return supportedCompressionTypes;
    }

    /**
     *

     * The allowed compression types, if data compression is used.
     *

     *
     * @param supportedCompressionTypes
     *        The allowed compression types, if data compression is used.
     * @see CompressionType
     */

    public void setSupportedCompressionTypes(java.util.Collection<String> supportedCompressionTypes) {
        if (supportedCompressionTypes == null) {
            this.supportedCompressionTypes = null;
            return;
        }

        this.supportedCompressionTypes = new java.util.ArrayList<String>(supportedCompressionTypes);
    }

    /**
     *

     * The allowed compression types, if data compression is used.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setSupportedCompressionTypes(java.util.Collection)} or
     * {@link #withSupportedCompressionTypes(java.util.Collection)} if you want to override the existing values.
     *

     *
     * @param supportedCompressionTypes
     *        The allowed compression types, if data compression is used.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see CompressionType
     */

    public ChannelSpecification withSupportedCompressionTypes(String... supportedCompressionTypes) {
        if (this.supportedCompressionTypes == null) {
            setSupportedCompressionTypes(new java.util.ArrayList<String>(supportedCompressionTypes.length));
        }
        for (String ele : supportedCompressionTypes) {
            this.supportedCompressionTypes.add(ele);
        }
        return this;
    }

    /**
     *

     * The allowed compression types, if data compression is used.
     *

     *
     * @param supportedCompressionTypes
     *        The allowed compression types, if data compression is used.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see CompressionType
     */

    public ChannelSpecification withSupportedCompressionTypes(java.util.Collection<String> supportedCompressionTypes) {
        setSupportedCompressionTypes(supportedCompressionTypes);
        return this;
    }

    /**
     *

     * The allowed compression types, if data compression is used.
     *

     *
     * @param supportedCompressionTypes
     *        The allowed compression types, if data compression is used.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see CompressionType
     */

    public ChannelSpecification withSupportedCompressionTypes(CompressionType... supportedCompressionTypes) {
        java.util.ArrayList<String> supportedCompressionTypesCopy = new java.util.ArrayList<String>(supportedCompressionTypes.length);
        for (CompressionType value : supportedCompressionTypes) {
            supportedCompressionTypesCopy.add(value.toString());
        }
        if (getSupportedCompressionTypes() == null) {
            setSupportedCompressionTypes(supportedCompressionTypesCopy);
        } else {
            getSupportedCompressionTypes().addAll(supportedCompressionTypesCopy);
        }
        return this;
    }

    /**
     *

     * The allowed input mode, either FILE or PIPE.
     *

     *

     * In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store
     * (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input mode.
     *

     *

     * In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using the
     * EBS volume.
     *

     *
     * @return The allowed input mode, either FILE or PIPE.

     *

     *         In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block
     *         Store (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input
     *         mode.
     *

     *

     *         In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without
     *         using the EBS volume.
     * @see TrainingInputMode
     */

    public java.util.List<String> getSupportedInputModes() {
        return supportedInputModes;
    }

    /**
     *

     * The allowed input mode, either FILE or PIPE.
     *

     *

     * In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store
     * (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input mode.
     *

     *

     * In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using the
     * EBS volume.
     *

     *
     * @param supportedInputModes
     *        The allowed input mode, either FILE or PIPE.

     *

     *        In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block
     *        Store (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input
     *        mode.
     *

     *

     *        In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using
     *        the EBS volume.
     * @see TrainingInputMode
     */

    public void setSupportedInputModes(java.util.Collection<String> supportedInputModes) {
        if (supportedInputModes == null) {
            this.supportedInputModes = null;
            return;
        }

        this.supportedInputModes = new java.util.ArrayList<String>(supportedInputModes);
    }

    /**
     *

     * The allowed input mode, either FILE or PIPE.
     *

     *

     * In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store
     * (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input mode.
     *

     *

     * In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using the
     * EBS volume.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setSupportedInputModes(java.util.Collection)} or {@link #withSupportedInputModes(java.util.Collection)}
     * if you want to override the existing values.
     *

     *
     * @param supportedInputModes
     *        The allowed input mode, either FILE or PIPE.

     *

     *        In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block
     *        Store (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input
     *        mode.
     *

     *

     *        In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using
     *        the EBS volume.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see TrainingInputMode
     */

    public ChannelSpecification withSupportedInputModes(String... supportedInputModes) {
        if (this.supportedInputModes == null) {
            setSupportedInputModes(new java.util.ArrayList<String>(supportedInputModes.length));
        }
        for (String ele : supportedInputModes) {
            this.supportedInputModes.add(ele);
        }
        return this;
    }

    /**
     *

     * The allowed input mode, either FILE or PIPE.
     *

     *

     * In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store
     * (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input mode.
     *

     *

     * In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using the
     * EBS volume.
     *

     *
     * @param supportedInputModes
     *        The allowed input mode, either FILE or PIPE.

     *

     *        In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block
     *        Store (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input
     *        mode.
     *

     *

     *        In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using
     *        the EBS volume.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see TrainingInputMode
     */

    public ChannelSpecification withSupportedInputModes(java.util.Collection<String> supportedInputModes) {
        setSupportedInputModes(supportedInputModes);
        return this;
    }

    /**
     *

     * The allowed input mode, either FILE or PIPE.
     *

     *

     * In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store
     * (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input mode.
     *

     *

     * In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using the
     * EBS volume.
     *

     *
     * @param supportedInputModes
     *        The allowed input mode, either FILE or PIPE.

     *

     *        In FILE mode, Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block
     *        Store (Amazon EBS) volumes before starting your training algorithm. This is the most commonly used input
     *        mode.
     *

     *

     *        In PIPE mode, Amazon SageMaker streams input data from the source directly to your algorithm without using
     *        the EBS volume.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see TrainingInputMode
     */

    public ChannelSpecification withSupportedInputModes(TrainingInputMode... supportedInputModes) {
        java.util.ArrayList<String> supportedInputModesCopy = new java.util.ArrayList<String>(supportedInputModes.length);
        for (TrainingInputMode value : supportedInputModes) {
            supportedInputModesCopy.add(value.toString());
        }
        if (getSupportedInputModes() == null) {
            setSupportedInputModes(supportedInputModesCopy);
        } else {
            getSupportedInputModes().addAll(supportedInputModesCopy);
        }
        return this;
    }

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

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

        if (obj instanceof ChannelSpecification == false)
            return false;
        ChannelSpecification other = (ChannelSpecification) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getDescription() == null ^ this.getDescription() == null)
            return false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
            return false;
        if (other.getIsRequired() == null ^ this.getIsRequired() == null)
            return false;
        if (other.getIsRequired() != null && other.getIsRequired().equals(this.getIsRequired()) == false)
            return false;
        if (other.getSupportedContentTypes() == null ^ this.getSupportedContentTypes() == null)
            return false;
        if (other.getSupportedContentTypes() != null && other.getSupportedContentTypes().equals(this.getSupportedContentTypes()) == false)
            return false;
        if (other.getSupportedCompressionTypes() == null ^ this.getSupportedCompressionTypes() == null)
            return false;
        if (other.getSupportedCompressionTypes() != null && other.getSupportedCompressionTypes().equals(this.getSupportedCompressionTypes()) == false)
            return false;
        if (other.getSupportedInputModes() == null ^ this.getSupportedInputModes() == null)
            return false;
        if (other.getSupportedInputModes() != null && other.getSupportedInputModes().equals(this.getSupportedInputModes()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
        hashCode = prime * hashCode + ((getIsRequired() == null) ? 0 : getIsRequired().hashCode());
        hashCode = prime * hashCode + ((getSupportedContentTypes() == null) ? 0 : getSupportedContentTypes().hashCode());
        hashCode = prime * hashCode + ((getSupportedCompressionTypes() == null) ? 0 : getSupportedCompressionTypes().hashCode());
        hashCode = prime * hashCode + ((getSupportedInputModes() == null) ? 0 : getSupportedInputModes().hashCode());
        return hashCode;
    }

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

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


text:
module Sensu
  module Settings
    module Validators
      module Client
        # Validate client subscriptions.
        # Validates: subscriptions
        #
        # @param client [Hash] sensu client definition.
        def validate_client_subscriptions(client)
          if is_an_array?(client[:subscriptions])
            items_must_be_strings(client[:subscriptions]) ||
              invalid(client, "client subscriptions must each be a string")
          else
            invalid(client, "client subscriptions must be an array")
          end
        end

        # Validate client safe mode.
        # Validates: safe_mode
        #
        # @param client [Hash] sensu client definition.
        def validate_client_safe_mode(client)
          must_be_boolean_if_set(client[:safe_mode]) ||
            invalid(client, "client safe_mode must be boolean")
        end

        # Validate client socket.
        # Validates: socket (bind, port)
        #
        # @param client [Hash] sensu client definition.
        def validate_client_socket(client)
          must_be_a_hash_if_set(client[:socket]) ||
            invalid(client, "client socket must be a hash")
          if is_a_hash?(client[:socket])
            must_be_a_string_if_set(client[:socket][:bind]) ||
              invalid(client, "client socket bind must be a string")
            must_be_an_integer_if_set(client[:socket][:port]) ||
              invalid(client, "client socket port must be an integer")
          end
        end

        # Validate client keepalive handlers.
        # Validates: keepalive (handler, handlers)
        #
        # @param client [Hash] sensu client definition.
        def validate_client_keepalive_handlers(client)
          must_be_a_string_if_set(client[:keepalive][:handler]) ||
            invalid(client, "client keepalive handler must be a string")
          must_be_an_array_if_set(client[:keepalive][:handlers]) ||
            invalid(client, "client keepalive handlers must be an array")
          if is_an_array?(client[:keepalive][:handlers])
            items_must_be_strings(client[:keepalive][:handlers]) ||
              invalid(client, "client keepalive handlers must each be a string")
          end
        end

        # Validate client keepalive thresholds.
        # Validates: keepalive (thresholds)
        #
        # @param client [Hash] sensu client definition.
        def validate_client_keepalive_thresholds(client)
          thresholds = client[:keepalive][:thresholds]
          must_be_a_hash_if_set(thresholds) ||
            invalid(client, "client keepalive thresholds must be a hash")
          if is_a_hash?(thresholds)
            must_be_an_integer_if_set(thresholds[:warning]) ||
              invalid(client, "client keepalive warning threshold must be an integer")
            must_be_an_integer_if_set(thresholds[:critical]) ||
              invalid(client, "client keepalive critical threshold must be an integer")
          end
        end

        # Validate client keepalive.
        # Validates: keepalive
        #
        # @param client [Hash] sensu client definition.
        def validate_client_keepalive(client)
          must_be_a_hash_if_set(client[:keepalive]) ||
            invalid(client, "client keepalive must be a hash")
          if is_a_hash?(client[:keepalive])
            validate_client_keepalive_handlers(client)
            validate_client_keepalive_thresholds(client)
          end
        end

        # Validate client redact.
        # Validates: redact
        #
        # @param client [Hash] sensu client definition.
        def validate_client_redact(client)
          must_be_an_array_if_set(client[:redact]) ||
            invalid(client, "client redact must be an array")
          if is_an_array?(client[:redact])
            items_must_be_strings(client[:redact]) ||
              invalid(client, "client redact keys must each be a string")
          end
        end

        # Validate a Sensu client definition.
        # Validates: name, address, safe_mode
        #
        # @param client [Hash] sensu client definition.
        def validate_client(client)
          must_be_a_hash(client) ||
            invalid(client, "client must be a hash")
          if is_a_hash?(client)
            must_be_a_string(client[:name]) ||
              invalid(client, "client name must be a string")
            must_match_regex(/^[\w\.-]+$/, client[:name]) ||
              invalid(client, "client name cannot contain spaces or special characters")
            must_be_a_string(client[:address]) ||
              invalid(client, "client address must be a string")
            validate_client_safe_mode(client)
            validate_client_subscriptions(client)
            validate_client_socket(client)
            validate_client_keepalive(client)
            validate_client_redact(client)
          end
        end
      end
    end
  end
end


text:
from __future__ import unicode_literals

import os
import sys
import logging

from logging import Formatter, getLogger, StreamHandler, DEBUG
from logging.handlers import SMTPHandler

# colorful logging taken from:
# https://github.com/getpelican/pelican/blob/0548b6/pelican/log.py

RESET_TERM = '\033[0;m'

COLOR_CODES = {
    'red': 31,
    'yellow': 33,
    'cyan': 36,
    'white': 37,
    'bgred': 41,
    'bggrey': 100,
}

def ansi(color, text):
    """ Wrap text in an ansi escape sequence."""
    code = COLOR_CODES[color]
    return '\033[1;{0}m{1}{2}'.format(code, text, RESET_TERM)

class EmailFormatter(Formatter):
    """
    Convert a `logging.LogRecord' object into an email.
    """

    def format(self, record):
        return '''
        Message type:       %s
        Location:           %s:%d
        Module:             %s
        Function:           %s

        Message

        %s
        ''' % (record.levelname, record.pathname, record.lineno, record.module,
               record.funcName, record.message)

class ANSIFormatter(Formatter):
    """ Convert a `logging.LogRecord` object into colored text, using ANSI
    escape sequences."""

    def format(self, record):
        msg = record.getMessage()
        if record.levelname == 'INFO':
            return ansi('cyan', '-> ') + msg
        elif record.levelname == 'WARNING':
            return ansi('yellow', record.levelname) + ': ' + msg
        elif record.levelname == 'ERROR':
            return ansi('red', record.levelname) + ': ' + msg
        elif record.levelname == 'CRITICAL':
            return ansi('bgred', record.levelname) + ': ' + msg
        elif record.levelname == 'DEBUG':
            return ansi('bggrey', record.levelname) + ': ' + msg
        else:
            return ansi('white', record.levelname) + ': ' + msg

class TextFormatter(Formatter):
    """
    Convert a `logging.LogRecord' object into text.
    """

    def format(self, record):
        if not record.levelname or record.levelname == 'INFO':
            return record.getMessage()
        else:
            return record.levelname + ': ' + record.getMessage()

def init(level=None, logger=getLogger(), handler=StreamHandler(), development=True):
    logging.basicConfig(level=level, datefmt='%m-%d %H:%M')
    logger = logging.getLogger()

    if (os.isatty(sys.stdout.fileno())
            and not sys.platform.startswith('win')):
        fmt = ANSIFormatter()
    else:
        fmt = TextFormatter()
    handler.setFormatter(fmt)
    logger.addHandler(handler)

    if level:
        logger.setLevel(level)

    if not development:
        logger.info("Setting up email handler for production-mode.")
        fmt = EmailFormatter()
        smtpHandler = SMTPHandler('127.0.0.1', 'docfu@docs.fineuploader.com',
            ['alerts@fineuploader.com'], 'ALERT docfu error!')
        smtpHandler.setFormatter(fmt)
        smtpHandler.setLevel(logging.ERROR)
        logger.addHandler(smtpHandler)

    return logger

# test
if __name__ == '__main__':
    init(level=DEBUG)
    root_logger = logging.getLogger()
    root_logger.debug('debug')
    root_logger.info('info')
    root_logger.warning('warning')
    root_logger.error('error')
    root_logger.critical('critical')


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>modtools/* - for modders — DFHack 0.40.24-r3 documentation</title>

    <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../../_static/dfhack-icon.ico"/>
    <link rel="top" title="DFHack 0.40.24-r3 documentation" href="../../README.html" />
    <link rel="up" title="DFHack Scripts" href="../README.html" />
    <link rel="next" title="modtools/add-syndrome" href="include-all.html" />
    <link rel="prev" title="gui/advfort" href="../gui/include-all.html" />

  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

modtools/* - for modders¶

Scripts which provide tools for modders, often with changes to the raw files.
Not intended to be called manually by end-users.

These scripts are mostly useful for raw modders and scripters.

They all have
standard arguments: arguments are of the form tool -argName1 argVal1
-argName2 argVal2. This is equivalent to tool -argName2 argVal2 -argName1
argVal1. It is not necessary to provide a value to an argument name: tool
-argName3 is fine. Supplying the same argument name multiple times will
result in an error. Argument names are preceded with a dash. The -help
argument will print a descriptive usage string describing the nature of the
arguments. For multiple word argument values, brackets must be used: tool
-argName4 [ sadf1 sadf2 sadf3 ]. In order to allow passing literal braces as
part of the argument, backslashes are used: tool -argName4 [ \] asdf \foo ]
sets argName4 to ] asdf foo. The *-trigger scripts have a similar
policy with backslashes.

modtools/add-syndrome¶

This allows adding and removing syndromes from units.

modtools/anonymous-script¶

This allows running a short simple Lua script passed as an argument instead of
running a script from a file. This is useful when you want to do something too
complicated to make with the existing modtools, but too simple to be worth its
own script file.

modtools/create-item¶

This is mostly the same as the other create item tools, but it uses standard
arguments. The other versions will be phased out in a later version.

modtools/create-unit¶

Creates a unit.

modtools/equip-item¶

Force a unit to equip an item; useful in conjunction with the create
scripts above.

See also forceequip.

modtools/force¶

This tool triggers events like megabeasts, caravans, invaders, and migrants.

modtools/interaction-trigger¶

This triggers events when a unit uses an interaction on another. It works by
scanning the announcements for the correct attack verb, so the attack verb
must be specified in the interaction. It includes an option to suppress this
announcement after it finds it.

modtools/invader-item-destroyer¶

This tool configurably destroys invader items to prevent clutter or to prevent
the player from getting tools exclusive to certain races.

modtools/item-trigger¶

This powerful tool triggers DFHack commands when a unit equips, unequips, or
attacks another unit with specified item types, specified item materials, or
specified item contaminants.

modtools/moddable-gods¶

This is a standardized version of Putnam’s moddableGods script. It allows you
to create gods on the command-line.

modtools/outside-only¶

This allows you to specify certain custom buildings as outside only, or inside
only. If the player attempts to build a building in an inappropriate location,
the building will be destroyed.

modtools/projectile-trigger¶

This triggers dfhack commands when projectiles hit their targets.

modtools/random-trigger¶

This triggers random dfhack commands with specified probabilities.

modtools/reaction-product-trigger¶

This triggers dfhack commands when reaction products are produced, once per
product.

modtools/reaction-trigger-transition¶

Scans raw files and creates a file to help modders transition from
autoSyndrome to reaction-trigger.

modtools/reaction-trigger¶

Triggers dfhack commands when custom reactions complete, regardless of whether
it produced anything, once per completion.

modtools/skill-change¶

Sets or modifies a skill of a unit.

modtools/spawn-flow¶

Creates flows at the specified location.

modtools/syndrome-trigger¶

Triggers dfhack commands when syndromes are applied to units.

modtools/transform-unit¶

Transforms a unit into another unit type, possibly permanently.

Table Of Contents

modtools/* - for modders

modtools/add-syndrome

modtools/anonymous-script

modtools/create-item

modtools/create-unit

modtools/equip-item

modtools/force

modtools/interaction-trigger

modtools/invader-item-destroyer

modtools/item-trigger

modtools/moddable-gods

modtools/outside-only

modtools/projectile-trigger

modtools/random-trigger

modtools/reaction-product-trigger

modtools/reaction-trigger-transition

modtools/reaction-trigger

modtools/skill-change

modtools/spawn-flow

modtools/syndrome-trigger

modtools/transform-unit

Related Topics

Documentation overview

DFHack Scripts

Previous: gui/advfort

Next: modtools/add-syndrome

This Page

Show Source

Quick search

    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

      ©2015, The DFHack Team.

      |
      Powered by Sphinx 1.3.1
      & Alabaster 0.7.6

      |
      Page source


text:
Pattern: Wrong arguments for `to_enum`/`enum_for`

Issue: -

## Description

Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.

## Examples

```ruby
# bad
def method(x, y = 1)
  return to_enum(__method__, x) # `y` is missing
end

# good
def method(x, y = 1)
  return to_enum(__method__, x, y)
end

# bad
def method(required:)
  return to_enum(:method, required: something) # `required` has incorrect value
end

# good
def method(required:)
  return to_enum(:method, required: required)
end
```

## Further Reading

* [RuboCop - Lint/ToEnumArguments](https://docs.rubocop.org/rubocop/cops_lint.html#linttoenumarguments)


text:
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

a.projects-index:link {
  color:#ffffff;
  text-decoration: underline;
}

a.projects-index:hover, a.projects-index:active, a.projects-index:visited {
  color:#cccccc;
  text-decoration: underline;
}
a.user-profile:link {
  color:#ffffff;
  text-decoration: none;
}

a.user-profile:active, a.user-profile:visited {
  color:#cccccc;
  text-decoration: none;
}
a.user-profile:hover {
  color:#000000;
  text-decoration: none;
}
.form {
  background: -webkit-gradient(linear, bottom, left 175px, from(#CCCCCC), to(#EEEEEE));
  background: -moz-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px);
  margin:auto;
  position:relative;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  border-radius: 10px;
  padding:10px;
  text-align:right;
}

.user_form_container{
  border: 1px solid;
  float:left;
}
.input    {
margin: 5px;
display: inline;
border: 1px solid #999;
height: 25px;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
}


text:
<!doctype html>

	<meta charset="UTF-8">
	<title>Test - Browser</title>

	hogehoge

	<map name="hoge">
		<area shape="" coords="" href="hogehoge.html" alt="">
	</map>


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

namespace AecCloud.WebAPI.Client
{
    public static class ApiClientContextExtensions
    {
        public static AuthenticationClient GetAuthClient(this ApiClientContext context)
        {
            return context.GetClient(() => new AuthenticationClient(context.HttpClient));
        }

        public static CloudClient GetCloudClient(this ApiClientContext context)
        {
            return context.GetClient(() => new CloudClient(context.HttpClient));
        }

        public static TokenClient GetTokenClient(this ApiClientContext context)
        {
            return context.GetClient(() => new TokenClient(context.HttpClient));
        }

        public static ProjectClient GetProjectClient(this ApiClientContext context)
        {
            return context.GetClient(() => new ProjectClient(context.HttpClient));
        }

        public static VaultClient GetVaultClient(this ApiClientContext context)
        {
            return context.GetClient(() => new VaultClient(context.HttpClient));
        }

        public static GeneralClient GetGeneralClient(this ApiClientContext context)
        {
            return context.GetClient(() => new GeneralClient(context.HttpClient));
        }

        internal static TClient GetClient<TClient>(this ApiClientContext apiClientContext, Func<TClient> valueFactory)
        {

            return (TClient)apiClientContext.Clients.GetOrAdd(typeof(TClient), k => valueFactory());
        }
    }
}


text:
#pragma once
#include <aws/iotsitewise/IoTSiteWise_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/iotsitewise/model/PortalStatus.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace IoTSiteWise
{
namespace Model
{
  class AWS_IOTSITEWISE_API CreatePortalResult
  {
  public:
    CreatePortalResult();
    CreatePortalResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    CreatePortalResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
The ID of the created portal.

     */
    inline const Aws::String& GetPortalId() const{ return m_portalId; }

    /**
     *
The ID of the created portal.

     */
    inline void SetPortalId(const Aws::String& value) { m_portalId = value; }

    /**
     *
The ID of the created portal.

     */
    inline void SetPortalId(Aws::String&& value) { m_portalId = std::move(value); }

    /**
     *
The ID of the created portal.

     */
    inline void SetPortalId(const char* value) { m_portalId.assign(value); }

    /**
     *
The ID of the created portal.

     */
    inline CreatePortalResult& WithPortalId(const Aws::String& value) { SetPortalId(value); return *this;}

    /**
     *
The ID of the created portal.

     */
    inline CreatePortalResult& WithPortalId(Aws::String&& value) { SetPortalId(std::move(value)); return *this;}

    /**
     *
The ID of the created portal.

     */
    inline CreatePortalResult& WithPortalId(const char* value) { SetPortalId(value); return *this;}

    /**
     *
The ARN
     * of the portal, which has the following format.

     * arn:${Partition}:iotsitewise:${Region}:${Account}:portal/${PortalId}
     *

     */
    inline const Aws::String& GetPortalArn() const{ return m_portalArn; }

    /**
     *
The ARN
     * of the portal, which has the following format.

     * arn:${Partition}:iotsitewise:${Region}:${Account}:portal/${PortalId}
     *

     */
    inline void SetPortalArn(const Aws::String& value) { m_portalArn = value; }

    /**
     *
The ARN
     * of the portal, which has the following format.

     * arn:${Partition}:iotsitewise:${Region}:${Account}:portal/${PortalId}
     *

     */
    inline void SetPortalArn(Aws::String&& value) { m_portalArn = std::move(value); }

    /**
     *
The ARN
     * of the portal, which has the following format.

     * arn:${Partition}:iotsitewise:${Region}:${Account}:portal/${PortalId}
     *

     */
    inline void SetPortalArn(const char* value) { m_portalArn.assign(value); }

    /**
     *
The ARN
     * of the portal, which has the following format.

     * arn:${Partition}:iotsitewise:${Region}:${Account}:portal/${PortalId}
     *

     */
    inline CreatePortalResult& WithPortalArn(const Aws::String& value) { SetPortalArn(value); return *this;}

    /**
     *
The ARN
     * of the portal, which has the following format.

     * arn:${Partition}:iotsitewise:${Region}:${Account}:portal/${PortalId}
     *

     */
    inline CreatePortalResult& WithPortalArn(Aws::String&& value) { SetPortalArn(std::move(value)); return *this;}

    /**
     *
The ARN
     * of the portal, which has the following format.

     * arn:${Partition}:iotsitewise:${Region}:${Account}:portal/${PortalId}
     *

     */
    inline CreatePortalResult& WithPortalArn(const char* value) { SetPortalArn(value); return *this;}

    /**
     *
The URL for the IoT SiteWise Monitor portal. You can use this URL to access
     * portals that use Amazon Web Services SSO for authentication. For portals that
     * use IAM for authentication, you must use the IoT SiteWise console to get a URL
     * that you can use to access the portal.

     */
    inline const Aws::String& GetPortalStartUrl() const{ return m_portalStartUrl; }

    /**
     *
The URL for the IoT SiteWise Monitor portal. You can use this URL to access
     * portals that use Amazon Web Services SSO for authentication. For portals that
     * use IAM for authentication, you must use the IoT SiteWise console to get a URL
     * that you can use to access the portal.

     */
    inline void SetPortalStartUrl(const Aws::String& value) { m_portalStartUrl = value; }

    /**
     *
The URL for the IoT SiteWise Monitor portal. You can use this URL to access
     * portals that use Amazon Web Services SSO for authentication. For portals that
     * use IAM for authentication, you must use the IoT SiteWise console to get a URL
     * that you can use to access the portal.

     */
    inline void SetPortalStartUrl(Aws::String&& value) { m_portalStartUrl = std::move(value); }

    /**
     *
The URL for the IoT SiteWise Monitor portal. You can use this URL to access
     * portals that use Amazon Web Services SSO for authentication. For portals that
     * use IAM for authentication, you must use the IoT SiteWise console to get a URL
     * that you can use to access the portal.

     */
    inline void SetPortalStartUrl(const char* value) { m_portalStartUrl.assign(value); }

    /**
     *
The URL for the IoT SiteWise Monitor portal. You can use this URL to access
     * portals that use Amazon Web Services SSO for authentication. For portals that
     * use IAM for authentication, you must use the IoT SiteWise console to get a URL
     * that you can use to access the portal.

     */
    inline CreatePortalResult& WithPortalStartUrl(const Aws::String& value) { SetPortalStartUrl(value); return *this;}

    /**
     *
The URL for the IoT SiteWise Monitor portal. You can use this URL to access
     * portals that use Amazon Web Services SSO for authentication. For portals that
     * use IAM for authentication, you must use the IoT SiteWise console to get a URL
     * that you can use to access the portal.

     */
    inline CreatePortalResult& WithPortalStartUrl(Aws::String&& value) { SetPortalStartUrl(std::move(value)); return *this;}

    /**
     *
The URL for the IoT SiteWise Monitor portal. You can use this URL to access
     * portals that use Amazon Web Services SSO for authentication. For portals that
     * use IAM for authentication, you must use the IoT SiteWise console to get a URL
     * that you can use to access the portal.

     */
    inline CreatePortalResult& WithPortalStartUrl(const char* value) { SetPortalStartUrl(value); return *this;}

    /**
     *
The status of the portal, which contains a state (CREATING after
     * successfully calling this operation) and any error message.

     */
    inline const PortalStatus& GetPortalStatus() const{ return m_portalStatus; }

    /**
     *
The status of the portal, which contains a state (CREATING after
     * successfully calling this operation) and any error message.

     */
    inline void SetPortalStatus(const PortalStatus& value) { m_portalStatus = value; }

    /**
     *
The status of the portal, which contains a state (CREATING after
     * successfully calling this operation) and any error message.

     */
    inline void SetPortalStatus(PortalStatus&& value) { m_portalStatus = std::move(value); }

    /**
     *
The status of the portal, which contains a state (CREATING after
     * successfully calling this operation) and any error message.

     */
    inline CreatePortalResult& WithPortalStatus(const PortalStatus& value) { SetPortalStatus(value); return *this;}

    /**
     *
The status of the portal, which contains a state (CREATING after
     * successfully calling this operation) and any error message.

     */
    inline CreatePortalResult& WithPortalStatus(PortalStatus&& value) { SetPortalStatus(std::move(value)); return *this;}

    /**
     *
The associated Amazon Web Services SSO application ID, if the portal uses
     * Amazon Web Services SSO.

     */
    inline const Aws::String& GetSsoApplicationId() const{ return m_ssoApplicationId; }

    /**
     *
The associated Amazon Web Services SSO application ID, if the portal uses
     * Amazon Web Services SSO.

     */
    inline void SetSsoApplicationId(const Aws::String& value) { m_ssoApplicationId = value; }

    /**
     *
The associated Amazon Web Services SSO application ID, if the portal uses
     * Amazon Web Services SSO.

     */
    inline void SetSsoApplicationId(Aws::String&& value) { m_ssoApplicationId = std::move(value); }

    /**
     *
The associated Amazon Web Services SSO application ID, if the portal uses
     * Amazon Web Services SSO.

     */
    inline void SetSsoApplicationId(const char* value) { m_ssoApplicationId.assign(value); }

    /**
     *
The associated Amazon Web Services SSO application ID, if the portal uses
     * Amazon Web Services SSO.

     */
    inline CreatePortalResult& WithSsoApplicationId(const Aws::String& value) { SetSsoApplicationId(value); return *this;}

    /**
     *
The associated Amazon Web Services SSO application ID, if the portal uses
     * Amazon Web Services SSO.

     */
    inline CreatePortalResult& WithSsoApplicationId(Aws::String&& value) { SetSsoApplicationId(std::move(value)); return *this;}

    /**
     *
The associated Amazon Web Services SSO application ID, if the portal uses
     * Amazon Web Services SSO.

     */
    inline CreatePortalResult& WithSsoApplicationId(const char* value) { SetSsoApplicationId(value); return *this;}

  private:

    Aws::String m_portalId;

    Aws::String m_portalArn;

    Aws::String m_portalStartUrl;

    PortalStatus m_portalStatus;

    Aws::String m_ssoApplicationId;
  };

} // namespace Model
} // namespace IoTSiteWise
} // namespace Aws


text:
/**
 * FeedbackController
 *
 * @description :: Server-side logic for managing feedback on equations and the equation's components.
 * @help        :: See http://links.sailsjs.org/docs/controllers
 */
var waterfall = require('async-waterfall');
module.exports = {

	create: function(req, res) {
		Feedback.create({
			equation: req.param('equation'),
			comments: req.param('comments'),
			submittedBy: req.user
		}).exec(function(err, feedback) {
			if (typeof req.param('components') != "undefined" && req.param('components').length > 0) {
				var components = typeof req.param('components') == 'string' ? [req.param('components')] : req.param('components');
				components.forEach(function(component,index) {
					feedback.components.add(component);
					feedback.save(function(err) {
						if (err) console.log(err);
						Feedback.findOne(feedback.id).populate('components').exec(function(err, newFeedback) {
							res.json(newFeedback);
						});
					});
				});
			} else {
				res.json(feedback);
			}
		});
	},

	myFeedback: function(req, res) {
		var limit = typeof req.param('per_page') != 'undefined' ? req.param('per_page') : 50;
		var page = typeof req.param('page') != 'undefined' ? req.param('page') : 1;

		waterfall([
			function (callback) {
				Feedback.count({submittedBy: req.user.id}).exec(function(err, numFeedback) {
					callback(err, numFeedback);
				});
			},
			function (numFeedback, callback) {
				Feedback.find({submittedBy: req.user.id, sort: 'createdAt DESC' }).paginate({page: page, limit: limit}).populate('equation').populate('components').exec(function(err, feedback) {
					callback(err, numFeedback, feedback);
				});
			}
		], function (err, numFeedback, feedback) {
			if (err) return res.badRequest(err);
			return res.json({"feedback": feedback, "numFeedback": numFeedback});
		});
	}
};


text:
<!DOCTYPE html>
<html>
<head>
<title>lines and curves</title>

<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

<script type="text/javascript" src="../../src/SQR.js"></script>

<script type="text/javascript" src="../../src/common/Context.js"></script>
<script type="text/javascript" src="../../src/common/Loader.js"></script>
<script type="text/javascript" src="../../src/common/Buffer.js"></script>
<script type="text/javascript" src="../../src/common/Renderer.js"></script>
<script type="text/javascript" src="../../src/common/Shader.js"></script>
<script type="text/javascript" src="../../src/common/Transform.js"></script>

<script type="text/javascript" src="../../src/math/Vector2.js"></script>
<script type="text/javascript" src="../../src/math/Vector3.js"></script>
<script type="text/javascript" src="../../src/math/Matrix33.js"></script>
<script type="text/javascript" src="../../src/math/Matrix44.js"></script>
<script type="text/javascript" src="../../src/math/Quaternion.js"></script>
<script type="text/javascript" src="../../src/math/ProjectionMatrix.js"></script>
<script type="text/javascript" src="../../src/math/Interpolation.js"></script>
<script type="text/javascript" src="../../src/math/Bezier.js"></script>
<script type="text/javascript" src="../../src/math/Spline.js"></script>

<script type="text/javascript" src="../../src/primitives/Face.js"></script>
<script type="text/javascript" src="../../src/primitives/Cube.js"></script>

<script type="text/javascript" src="../../src/dev/Debug.js"></script>

<link rel="stylesheet" type="text/css" href="../base.css">

</head>
<body>

<canvas id="gl-canvas"></canvas>

<script type="text/javascript">

    SQR.Loader.loadAssets([
        'shader.glsl',
        'normal2color.glsl',
    ], function(assets) {

        var w = window.innerWidth, h = window.innerHeight;

        var ctx = SQR.Context('#gl-canvas')
            .create()
            .size(w, h).
            clearColor(0, 0.15, 0.2, 1);

        var renderer = SQR.Renderer(ctx);
        renderer.projection = new SQR.ProjectionMatrix().perspective(70, w/h, 1, 1000);

        var camera = SQR.Transform();
        camera.position.z = 300;
        camera.directMatrixMode = true;

        var camRoot = SQR.Transform();

        var curve = new SQR.Spline()
            .addSegment(100, 100,  -100)
            .addSegment(100, 100,  100)
            .addSegment(0,   -100,   0)
            .addSegment(-100, 100, -100)
            .addSegment(-100, 100,  100)
            .create(0.5);

        var curveResolution = 120;

        var curveBuffer = SQR.Buffer()
            .layout({ aPosition: 3 }, curveResolution)
            .setMode(SQR.gl.LINE_STRIP);

            for(var i = 0; i < curveResolution; i++) {
                curveBuffer.set('aPosition', i, curve.valueAt(i / curveResolution));
            }

            curveBuffer.update();

        var cube = SQR.Transform();
        cube.directMatrixMode = true;
        cube.buffer = SQR.Primitives.createCube(10, 10, 20).update();
        cube.shader = SQR.Shader(assets['normal2color.glsl']);

        var line = SQR.Transform();
        line.buffer = curveBuffer;
        line.shader = SQR.Shader(assets['shader.glsl']);
        line.uniforms = { 'uColor': [1, 1, 1] };

        var root = SQR.Transform();
        root.add(camRoot, line, cube);
        camRoot.add(camera);

        var my = 0, mx = 0, tx = 0, ty = 0;

        var isTouch = 'ontouchstart' in document;
        var mousemove = isTouch ? 'touchmove' : 'mousemove';

        document.addEventListener(mousemove, function(e) {
            e = isTouch ? e.targetTouches[0] : e;
            tx = e.pageX / window.innerWidth;
            ty = e.pageY / window.innerHeight;
        });

        var phase = 0;

        var render = function() {
            requestAnimationFrame(render);
            ctx.clear();

            var p = Math.cos(phase * Math.PI * 2) * 0.5 + 0.5;
            var v = curve.velocityAt(p);
            if(phase % 1 < 0.5) v.neg();
            var d = SQR.V3.dot(v.norm(), SQR.V3.up);
            // console.log(d);

            curve.matrixAt(p, cube.matrix);

            phase += 0.0005 + 0.001 * (2 - (d + 1));

            // cube.rotation.x += 0.01;
            // cube.rotation.y += 0.01;

            // camRoot.rotation.y += 0.005;
            camera.position.z = 200 + my * 200;

            cube.matrix.extractPosition(cube.position);
            camera.matrix.lookAt(cube.position);
            camera.matrix.setTranslation(camera.position.x, camera.position.y, camera.position.z);

            renderer.render(root, camera);

            mx += (tx - mx) * 0.1;
            my += (ty - my) * 0.1;
        }

        render();
    });

</script>

<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35934/livereload.js?snipver=1"></' + 'script>')</script>

</body>
</head>


text:
Landmark::Landmark(){
    setId(0);
    initialId = 0;
}

Landmark::Landmark(int LandId , SufficientStatistics stats, int initialIdz){
    setId(uuid);
    distribution.copy(stats);
    initialId = initialIdz;
}
Landmark::~Landmark()
{
    //dtor
}
int Landmark::getId(){
    return uuid;
}
void Landmark::setId(int id ){
    uuid = id;
}

void Landmark::print(){
    cout << "Landmark id " << uuid << endl;
    cout << " With distribution " << endl << distribution << endl;
}


text:
namespace System.Data
{
    public static class DataRecordExtentions
    {
        public static decimal TryToDecimal(this IDataRecord value, string field, decimal def)
        {
            try
            {
                return value[field].TryToDecimal(def);
            }
            catch
            {
                return def;
            }
        }

        public static Int32 TryToInt32(this IDataRecord value, string field, Int32 def)
        {
            try
            {
                return value[field].TryToInt32(def);
            }
            catch
            {
                return def;
            }
        }

        public static decimal TryToInt64(this IDataRecord value, string field, Int64 def)
        {
            try
            {
                return value[field].TryToInt64(def);
            }
            catch
            {
                return def;
            }
        }

        public static DateTime TryToDateTime(this IDataRecord value, string field, DateTime def)
        {
            try
            {
                return value[field].TryToDateTime(def);
            }
            catch
            {
                return def;
            }
        }

        public static string TryToString(this IDataRecord value, string field, string def)
        {
            try
            {
                return value[field].TryToString(def);
            }
            catch
            {
                return def;
            }
        }
    }
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0" />
<meta name="format-detection" content="telephone=no">
<meta name="apple-itunes-app" content="app-id=976577934">
<meta name="title" content="Home - IKEA">
<meta name="description" content="A world of home furnishings in your phone. Get inspired, create a furniture shopping list, and get directions to your nearest IKEA store."/>

<link rel="stylesheet" href="/irmw-resources/external/jquery.mobile-1.2.0.min.css"/>

<link rel="stylesheet" href="/irmw-resources/css/ikea.mobile.min.css?v=5.20"/>

<link rel="stylesheet" href="/irmw-resources/css/ikea.mobile.us_en.css?v=5.20"/>

<title id="txtHtmlTitle">Home - IKEA</title>
<link rel="shortcut icon" type="image/ico" href="/irmw-resources/img/favicon.ico"/>
<link rel="apple-touch-icon-precomposed" href="/irmw-resources/img/apple-touch-icon-57x57-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/irmw-resources/img/apple-touch-icon-114x114-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/irmw-resources/img/apple-touch-icon-144x144-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="32x32" href="/irmw-resources/img/apple-touch-icon-32x32-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="/irmw-resources/img/apple-touch-icon-57x57-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/irmw-resources/img/apple-touch-icon-72x72-precomposed.png" />

<meta name="msapplication-TileImage" content="/irmw-resources/img/apple-touch-icon-144x144-precomposed.png" />

We use cookies to make sure you get the best experience on our website. If you continue without changing your settings, you're agreeing to receive all cookies on the IKEA website.

Read more about cookies | Privacy policy

0

 Departments

 Offers

 Find your IKEA store

Log in

Log out

More

You are now logged out.

All Offers & Events

Planning Tools

Login or Join IKEA FAMILY

IKEA Services

Buy an IKEA Gift Card

Sign Up for Catalog, Email & Text

Jobs at IKEA

View the IKEA Catalog Online

Go to top

|

|

|

|

IKEA Store App
iPhone
|
Android

IKEA Catalog App
iPhone
|
Android

Sitio Móvil en Español

Full site

Privacy Policy
|
Product Recalls
|
Children's Product Registration

© Inter IKEA Systems B.V. 1999-2016