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

class Forget extends CI_Controller {

	private $current_date_obj = null;

	public function __construct(){
		parent::__construct();

		$this->current_date_obj = new DateTime();
		$this->template->set_template('layout/layout');
		$this->load->helper('default/Default');
		$this->load->model('default/login_model');
	}
	public function createpassword($ID1=NULL)
	{
		   if(!isset($this->session->adminuser['id']))
		   {
		 		  $data = array();
		   if($this->input->post())
		   {
		   		 $this->form_validation->set_rules('npass', 'New password', 'required');
				 $this->form_validation->set_rules('cpass', 'Confirm password', 'required');
				 if ($this->form_validation->run() == true)
				{
				    $npass = $this->input->post('npass');
					$cpass = $this->input->post('cpass');
					if($npass == $cpass)
					{

					    	$this->load->model('default/login_model');
						    $changepassword = $this->login_model->changepassword($npass,$ID1);
							redirect('login');
					}
					else
					{
						$data['loginmsg'] = 'Confirm Password not match';
					}

	             }
		   }
	  $this->template->content->view('login/createpassword_view', $data);
		   $this->template->publish();
		}
		else{
			redirect('/admin/dashboard');
		}

	}

	public function index()
	{
		$data = array();
		if(isset($this->session->user['id']))
		{
			redirect('/default/myaccount/dashboard');
		}
		else
		{
			if($this->input->post())
			{
				$this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean');
				if ($this->form_validation->run() == true)
				{
					$user = $this->login_model->check_login($this->input->post('email_login'), $this->input->post('password'));

				    $email = $this->input->post('email');
					$this->load->model('default/login_model');
			        $adminuser = $this->login_model->check_user($email);
					if($adminuser =='S')
			        {
						 $data['rndurl'] = md5( sha1( time() + rand(0, time()) ) );
						 $data['email'] = $email;
						 $userID = $this->login_model->getID($email);
						 $data['userid']= $userID->id;
						 $ses="admin@gemstone.com";
                        $body = $this->load->view('email-format/reset-password', $data, true);
						$headers = "From: ".$ses."\r\n";
						$headers .= "CC:umeshsamal3@gmail.com\r\n";
						$headers .= "BCC:umeshsamal070@gmail.com\r\n";
						$headers .= "MIME-Version: 1.0\r\n";
						$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
						$header .="Dear";
						$header .="To initiate the password reset process for your Gemstone Account.";
						$header .="click the link below:";
					echo	$message = $body; die;
						$to=$email;
						$subject="Forget Password";
						$set=mail($to,$subject,$message,$headers);
						$data['msg'] ="";

					}
					else
					{
						$data['loginmsg'] = 'Email Not Found';
					}

				}
				else
				{
					$data['ofo_loginmsg'] = 'Invalid email or password!';
				}
			}
			$this->template->content->view('login/forget_view', $data);
			$this->template->publish();
		}

	}

	public function register()
	{
		$data = array();

		if(isset($this->session->user['id']))
		{
			redirect('/default/myaccount/dashboard');
		}
		else
		{
			if($this->input->post())
			{
				$this->form_validation->set_error_delimiters('', '');
				$this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean');
				$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|xss_clean|callback_is_unique_email');
				$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[6]|xss_clean');
				$this->form_validation->set_rules('confpassword', 'Confirm Password', 'trim|required|min_length[6]|matches[password]|xss_clean');
				if ($this->form_validation->run() == true)
				{
					$data['name'] = $this->input->post('name');
					$data['email'] = $this->input->post('email');
					$data['password'] = $this->input->post('password');
					$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
					$data['token'] = md5($data['email'].time().$this->config->item('email_token'));
					$data['created_at'] = $this->current_date_obj->format('Y-m-d H:i:s');
					$userid = $this->login_model->save_user($data);
					if($userid > 0){
						//Send Comfirmation E-mail
						$link = base_url().'default/login/activate/'.$userid.'/'.$data['token'];
						$html_body = '

Hi,

Please activate your account by clicking below link.

'.$link.'

Thanks
oforornament Team

';
						send_mail($data['email'], 'Confirmation Email - '.$this->config->item('from_name'), $html_body);
						redirect('/default/login/confirmemail/'.$userid.'/'.md5($userid));
					}
				}
				else
				{
					$data['name'] = html_escape($this->input->post('name'));
					$data['email'] = html_escape($this->input->post('email'));
				}
			}
		}
		$this->template->content->view('login/register_view', $data);
        $this->template->publish();
	}
	public function is_unique_email($value)
	{
		$result = is_unique_value("ofo_users", array("email" => $value));
		if(!$result)
		{
			$this->form_validation->set_message('is_unique_email', 'This {field} already exists.');
			return false;
		}
		else
		{
			return true;
		}
	}

	public function logout()
	{
		unset($this->session->user);
		$this->session->sess_destroy();
		redirect('/login');
	}

	public function confirmemail($userid, $token, $is_resend = false)
	{
		$data = array();
		$userid = (int) $userid;
		if(md5($userid) == $token)
		{
			$this->template->content->view('login/confirmemail_view', $data);
			$this->template->publish();
		}
		else
		{
			redirect('/');
		}
	}

	public function activate($userid, $token)
	{
		$userid = (int) $userid;
		$user = $this->login_model->get_user($userid, 0, $token);

		if(count($user) > 0)
		{
			$data = array();
			$data['status'] = 1;
			$data['updated_at'] = $this->current_date_obj->format('Y-m-d H:i:s');
			$userid = $this->login_model->save_user($data, $userid);
			if($userid > 0)
			{
				$this->session->set_flashdata('user_msg', 'Your account has been activated successfully. Please login!');
			}
			else
			{
				$this->session->set_flashdata('user_msg', 'Your account is not activated. Please try again or contact us.');
			}
		}
		else
		{
			$this->session->set_flashdata('user_msg', 'Your account does not exist or already register. If you have any problem please contact us.');
		}
		redirect('/login');
	}

}

redpajama_set_name: RedPajamaGithub


text:
(function() {
  var handleSentiment, ws;

  ws = void 0;

  $(document).ready(function() {
    var host;
    host = location.origin.replace(/^http/, 'ws');
    ws = new WebSocket(host);
    $("#myForm").submit(function(e) {
      return e.preventDefault();
    });
    ws.onmessage = function(msg) {
      $(".spinner").removeClass("show");
      $(".spinner").addClass("hide");
      msg = JSON.parse(msg.data);
      return handleSentiment(msg);
    };
    return $('#submit').on("click", function() {
      var msg, style, text;
      style = "display:inline;";
      $(".spinner").removeClass("hide");
      $(".spinner").addClass("show");
      $('#sentiment').text("");
      $('#symbols').text("");
      text = $("#inText").val();
      msg = {
        type: "message",
        text: text
      };
      msg = JSON.stringify(msg);
      return ws.send(msg);
    });
  });

  handleSentiment = function(sentiment) {
    var i, n, _i, _results;
    console.log(sentiment.opinion);
    $('#sentiment').text("Sentiment: " + sentiment.opinion);
    $('#symbols').text("");
    n = (Math.abs(sentiment.opinion) - (Math.abs(sentiment.opinion) % 10)) / 10;
    n++;
    _results = [];
    for (i = _i = 0; _i < n; i = _i += 1) {
      if (sentiment.opinion > 0) {
        _results.push($('#symbols').append(' '));
      } else {
        _results.push($('#symbols').append(' '));
      }
    }
    return _results;
  };

}).call(this);


text:
/*
 * ngView triggers three animation events: enter, leave and move.
 */
.view-container {
  height:500px;
  position:relative;
      margin-top: 100px;
}

.view-animation.ng-enter {
  -webkit-animation: enter_animation 1s;
  animation: enter_animation 1s;

  /*
   * ng-animate has a slight starting delay for optimization purposes
   * so if you see a flicker effect then you'll need to put some extra
   * styles to "shim" the animation.
   */
  left:100%;
}

.view-animation.ng-leave {
  -webkit-animation: leave_animation 1s;
  animation: leave_animation 1s;
  left:0%;
}

.view-animation.ng-leave,
.view-animation.ng-enter {
  position:absolute;
  top:0;
  width:100%;
}

/* Have to set height explicity on ui-view
to prevent collapsing during animation*/
.ui-view-container {
  position: relative;
  height: 65px;
}

[ui-view].ng-enter, [ui-view].ng-leave {
  position: absolute;
  left: 0;
  right: 0;
  -webkit-transition:all .5s ease-in-out;
    -moz-transition:all .5s ease-in-out;
    -o-transition:all .5s ease-in-out;
    transition:all .5s ease-in-out;
}

[ui-view].ng-enter {
  opacity: 0;
  -webkit-transform:scale3d(0.5, 0.5, 0.5);
  -moz-transform:scale3d(0.5, 0.5, 0.5);
  transform:scale3d(0.5, 0.5, 0.5);
}

[ui-view].ng-enter-active {
  opacity: 1;
  -webkit-transform:scale3d(1, 1, 1);
  -moz-transform:scale3d(1, 1, 1);
  transform:scale3d(1, 1, 1);
}

[ui-view].ng-leave {
  opacity: 1;
  -webkit-transform:translate3d(0, 0, 0);
  -moz-transform:translate3d(0, 0, 0);
  transform:translate3d(0, 0, 0);
}

[ui-view].ng-leave-active {
  opacity: 0;
  -webkit-transform:translate3d(100px, 0, 0);
  -moz-transform:translate3d(100px, 0, 0);
  transform:translate3d(100px, 0, 0);
}

.slide.ng-leave {
  position: relative;
}
.slide.ng-enter {
  position: absolute;
}
.slide.ng-enter, .slide.ng-leave {
  -webkit-transition: -webkit-transform 0.3s ease-in, opacity 0.3s ease-in;
     -moz-transition: -moz-transform 0.3s ease-in, opacity 0.3s ease-in;
       -o-transition: -o-transform 0.3s ease-in, opacity 0.3s ease-in;
          transition: transform 0.3s ease-in, opacity 0.3s ease-in;
}
.slide.ng-enter, .slide.ng-leave.ng-leave-active {
  -webkit-transform: scaleX(0.0001);
       -o-transform: scaleX(0.0001);
          transform: scaleX(0.0001);
  opacity: 0;
}
.slide, .slide.ng-enter.ng-enter-active {
  -webkit-transform: scaleX(1);
       -o-transform: scaleX(1);
          transform: scaleX(1);
  opacity: 1;
}

/*
 * the animation below will move enter in the view from the right side of the screen
 * and move the current (expired) view from the center of the screen to the left edge
 */
@keyframes enter_animation {
  from { left:100%; }
  to { left:0; }
}

@-webkit-keyframes enter_animation {
  from { left:100%; }
  to { left:0; }
}

@keyframes leave_animation {
  from { left:0; }
  to { left:-100%; }
}

@-webkit-keyframes leave_animation {
  from { left:0; }
  to { left:-100%; }
}


text:
    <legend>{{ title }}</legend>

            {% if warnings %}{% endif %}
                Machines with errors in last 28 days

                    {{ warnings }}

                {% if warnings %}{% endif %}

                {% if errors %}{% endif %}
                Machines with errors in last 7 days

                    {{ errors }}


text:
package com.sksamuel.elastic4s.handlers.common

import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
import com.sksamuel.elastic4s.requests.common.FetchSourceContext

// takes a FetchSourceContext and returns the appropriate json
// https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-source-filtering.html
object FetchSourceContextBuilderFn {
  def apply(builder: XContentBuilder, context: FetchSourceContext) = {
    if (context.fetchSource)
      if (context.includes.nonEmpty || context.excludes.nonEmpty) {
        builder.startObject("_source")
        context.includes.toList match {
          case Nil =>
          case includes => builder.array("includes", includes.toArray)
        }
        context.excludes.toList match {
          case Nil =>
          case excludes => builder.array("excludes", excludes.toArray)
        }
        builder.endObject()
      } else
        builder.field("_source", true)
    else
      builder.field("_source", false)
    builder.value
  }
}


text:
package org.apache.flink.runtime.testutils;

import org.apache.flink.api.common.JobID;
import org.apache.flink.api.common.JobStatus;
import org.apache.flink.api.common.time.Deadline;
import org.apache.flink.core.execution.JobClient;
import org.apache.flink.runtime.execution.ExecutionState;
import org.apache.flink.runtime.executiongraph.AccessExecutionGraph;
import org.apache.flink.runtime.executiongraph.AccessExecutionVertex;
import org.apache.flink.runtime.executiongraph.ErrorInfo;
import org.apache.flink.runtime.jobgraph.JobVertexID;
import org.apache.flink.runtime.minicluster.MiniCluster;
import org.apache.flink.runtime.rest.messages.job.JobDetailsInfo;
import org.apache.flink.util.FileUtils;
import org.apache.flink.util.function.SupplierWithException;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Predicate;
import java.util.stream.Stream;

import static java.lang.String.format;
import static org.junit.jupiter.api.Assertions.fail;

/** This class contains auxiliary methods for unit tests. */
public class CommonTestUtils {

    private static final long RETRY_INTERVAL = 100L;

    /**
     * Gets the classpath with which the current JVM was started.
     *
     * @return The classpath with which the current JVM was started.
     */
    public static String getCurrentClasspath() {
        RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
        return bean.getClassPath();
    }

    /** Create a temporary log4j configuration for the test. */
    public static File createTemporaryLog4JProperties() throws IOException {
        File log4jProps = File.createTempFile(FileUtils.getRandomFilename(""), "-log4j.properties");
        log4jProps.deleteOnExit();
        CommonTestUtils.printLog4jDebugConfig(log4jProps);

        return log4jProps;
    }

    /**
     * Tries to get the java executable command with which the current JVM was started. Returns
     * null, if the command could not be found.
     *
     * @return The java executable command.
     */
    public static String getJavaCommandPath() {
        File javaHome = new File(System.getProperty("java.home"));

        String path1 = new File(javaHome, "java").getAbsolutePath();
        String path2 = new File(new File(javaHome, "bin"), "java").getAbsolutePath();

        try {
            ProcessBuilder bld = new ProcessBuilder(path1, "-version");
            Process process = bld.start();
            if (process.waitFor() == 0) {
                return path1;
            }
        } catch (Throwable t) {
            // ignore and try the second path
        }

        try {
            ProcessBuilder bld = new ProcessBuilder(path2, "-version");
            Process process = bld.start();
            if (process.waitFor() == 0) {
                return path2;
            }
        } catch (Throwable tt) {
            // no luck
        }
        return null;
    }

    public static void printLog4jDebugConfig(File file) throws IOException {
        try (PrintWriter writer = new PrintWriter(new FileWriter(file))) {
            writer.println("rootLogger.level = DEBUG");
            writer.println("rootLogger.appenderRef.console.ref = ConsoleAppender");
            writer.println("appender.console.name = ConsoleAppender");
            writer.println("appender.console.type = CONSOLE");
            writer.println("appender.console.target = SYSTEM_ERR");
            writer.println("appender.console.layout.type = PatternLayout");
            writer.println(
                    "appender.console.layout.pattern = %d{HH:mm:ss,SSS} %-4r [%t] %-5p %c %x - %m%n");
            writer.println("logger.jetty.name = org.eclipse.jetty.util.log");
            writer.println("logger.jetty.level = OFF");
            writer.println("logger.zookeeper.name = org.apache.zookeeper");
            writer.println("logger.zookeeper.level = OFF");
            writer.flush();
        }
    }

    public static void waitUntilCondition(
            SupplierWithException<Boolean, Exception> condition, Deadline timeout)
            throws Exception {
        waitUntilCondition(condition, timeout, RETRY_INTERVAL);
    }

    public static void waitUntilCondition(
            SupplierWithException<Boolean, Exception> condition,
            Deadline timeout,
            long retryIntervalMillis)
            throws Exception {
        waitUntilCondition(
                condition, timeout, retryIntervalMillis, "Condition was not met in given timeout.");
    }

    public static void waitUntilCondition(
            SupplierWithException<Boolean, Exception> condition, Deadline timeout, String errorMsg)
            throws Exception {
        waitUntilCondition(condition, timeout, RETRY_INTERVAL, errorMsg);
    }

    public static void waitUntilCondition(
            SupplierWithException<Boolean, Exception> condition,
            Deadline timeout,
            long retryIntervalMillis,
            String errorMsg)
            throws Exception {
        while (timeout.hasTimeLeft() && !condition.get()) {
            final long timeLeft = Math.max(0, timeout.timeLeft().toMillis());
            Thread.sleep(Math.min(retryIntervalMillis, timeLeft));
        }

        if (!timeout.hasTimeLeft()) {
            throw new TimeoutException(errorMsg);
        }
    }

    public static void waitForAllTaskRunning(
            MiniCluster miniCluster, JobID jobId, boolean allowFinished) throws Exception {
        waitForAllTaskRunning(() -> getGraph(miniCluster, jobId), allowFinished);
    }

    private static AccessExecutionGraph getGraph(MiniCluster miniCluster, JobID jobId)
            throws InterruptedException, java.util.concurrent.ExecutionException, TimeoutException {
        return miniCluster.getExecutionGraph(jobId).get(60, TimeUnit.SECONDS);
    }

    public static void waitForAllTaskRunning(
            SupplierWithException<AccessExecutionGraph, Exception> executionGraphSupplier,
            boolean allowFinished)
            throws Exception {
        waitForAllTaskRunning(
                executionGraphSupplier,
                Deadline.fromNow(Duration.of(1, ChronoUnit.MINUTES)),
                allowFinished);
    }

    public static void waitForAllTaskRunning(
            SupplierWithException<AccessExecutionGraph, Exception> executionGraphSupplier,
            Deadline timeout,
            boolean allowFinished)
            throws Exception {
        Predicate<AccessExecutionVertex> subtaskPredicate =
                task -> {
                    switch (task.getExecutionState()) {
                        case RUNNING:
                            return true;
                        case FINISHED:
                            if (allowFinished) {
                                return true;
                            } else {
                                throw new RuntimeException("Sub-Task finished unexpectedly" + task);
                            }
                        default:
                            return false;
                    }
                };
        waitUntilCondition(
                () -> {
                    final AccessExecutionGraph graph = executionGraphSupplier.get();
                    if (graph.getState().isGloballyTerminalState()) {
                        final ErrorInfo failureInfo = graph.getFailureInfo();
                        fail(
                                format(
                                        "Graph is in globally terminal state (%s)",
                                        graph.getState()),
                                failureInfo != null ? failureInfo.getException() : null);
                    }
                    return graph.getState() == JobStatus.RUNNING
                            && graph.getAllVertices().values().stream()
                                    .allMatch(
                                            jobVertex ->
                                                    Arrays.stream(jobVertex.getTaskVertices())
                                                            .allMatch(subtaskPredicate));
                },
                timeout);
    }

    public static void waitForAllTaskRunning(
            SupplierWithException<JobDetailsInfo, Exception> jobDetailsSupplier, Deadline timeout)
            throws Exception {
        waitUntilCondition(
                () -> {
                    final JobDetailsInfo jobDetailsInfo = jobDetailsSupplier.get();
                    final Collection<JobDetailsInfo.JobVertexDetailsInfo> vertexInfos =
                            jobDetailsInfo.getJobVertexInfos();
                    if (vertexInfos.size() == 0) {
                        return false;
                    }
                    for (JobDetailsInfo.JobVertexDetailsInfo vertexInfo : vertexInfos) {
                        final Integer numRunningTasks =
                                vertexInfo.getTasksPerState().get(ExecutionState.RUNNING);
                        if (numRunningTasks == null
                                || numRunningTasks != vertexInfo.getParallelism()) {
                            return false;
                        }
                    }
                    return true;
                },
                timeout,
                "Some tasks are not running until timeout");
    }

    public static void waitForNoTaskRunning(
            SupplierWithException<JobDetailsInfo, Exception> jobDetailsSupplier, Deadline timeout)
            throws Exception {
        waitUntilCondition(
                () -> {
                    final Map<ExecutionState, Integer> state =
                            jobDetailsSupplier.get().getJobVerticesPerState();
                    final Integer numRunningTasks = state.get(ExecutionState.RUNNING);
                    return numRunningTasks == null || numRunningTasks.equals(0);
                },
                timeout,
                "Some tasks are still running until timeout");
    }

    public static void waitUntilJobManagerIsInitialized(
            SupplierWithException<JobStatus, Exception> jobStatusSupplier) throws Exception {
        waitUntilJobManagerIsInitialized(
                jobStatusSupplier, Deadline.fromNow(Duration.of(1, ChronoUnit.MINUTES)));
    }

    public static void waitUntilJobManagerIsInitialized(
            SupplierWithException<JobStatus, Exception> jobStatusSupplier, Deadline timeout)
            throws Exception {
        waitUntilCondition(() -> jobStatusSupplier.get() != JobStatus.INITIALIZING, timeout, 20L);
    }

    public static void waitForJobStatus(
            JobClient client, List<JobStatus> expectedStatus, Deadline deadline) throws Exception {
        waitUntilCondition(
                () -> {
                    final JobStatus currentStatus = client.getJobStatus().get();

                    // Entered an expected status
                    if (expectedStatus.contains(currentStatus)) {
                        return true;
                    }

                    // Entered a terminal status but not expected
                    if (currentStatus.isTerminalState()) {
                        try {
                            // Exception will be exposed here if job failed
                            client.getJobExecutionResult().get();
                        } catch (Exception e) {
                            throw new IllegalStateException(
                                    format(
                                            "Job has entered %s state, but expecting %s",
                                            currentStatus, expectedStatus),
                                    e);
                        }
                        throw new IllegalStateException(
                                format(
                                        "Job has entered a terminal state %s, but expecting %s",
                                        currentStatus, expectedStatus));
                    }

                    // Continue waiting for expected status
                    return false;
                },
                deadline);
    }

    public static void terminateJob(JobClient client) throws Exception {
        client.cancel().get();
    }

    public static void waitForSubtasksToFinish(
            MiniCluster miniCluster, JobID job, JobVertexID id, boolean allSubtasks)
            throws Exception {
        Predicate<AccessExecutionVertex> subtaskPredicate =
                subtask -> {
                    ExecutionState state = subtask.getExecutionState();
                    if (state == ExecutionState.FINISHED) {
                        return true;
                    } else if (state.isTerminal()) {
                        throw new RuntimeException(
                                format(
                                        "Sub-Task %s is already in a terminal state %s",
                                        subtask, state));
                    } else {
                        return false;
                    }
                };
        waitUntilCondition(
                () -> {
                    AccessExecutionGraph graph = getGraph(miniCluster, job);
                    if (graph.getState() != JobStatus.RUNNING) {
                        return false;
                    }
                    Stream<AccessExecutionVertex> vertexStream =
                            Arrays.stream(
                                    graph.getAllVertices().values().stream()
                                            .filter(jv -> jv.getJobVertexId().equals(id))
                                            .findAny()
                                            .orElseThrow(
                                                    () ->
                                                            new RuntimeException(
                                                                    "Vertex not found " + id))
                                            .getTaskVertices());
                    return allSubtasks
                            ? vertexStream.allMatch(subtaskPredicate)
                            : vertexStream.anyMatch(subtaskPredicate);
                },
                Deadline.fromNow(Duration.of(1, ChronoUnit.MINUTES)));
    }

    /** Utility class to read the output of a process stream and forward it into a StringWriter. */
    public static class PipeForwarder extends Thread {

        private final StringWriter target;
        private final InputStream source;

        public PipeForwarder(InputStream source, StringWriter target) {
            super("Pipe Forwarder");
            setDaemon(true);

            this.source = source;
            this.target = target;

            start();
        }

        @Override
        public void run() {
            try {
                int next;
                while ((next = source.read()) != -1) {
                    target.write(next);
                }
            } catch (IOException e) {
                // terminate
            }
        }
    }

    public static boolean isStreamContentEqual(InputStream input1, InputStream input2)
            throws IOException {

        if (!(input1 instanceof BufferedInputStream)) {
            input1 = new BufferedInputStream(input1);
        }
        if (!(input2 instanceof BufferedInputStream)) {
            input2 = new BufferedInputStream(input2);
        }

        int ch = input1.read();
        while (-1 != ch) {
            int ch2 = input2.read();
            if (ch != ch2) {
                return false;
            }
            ch = input1.read();
        }

        int ch2 = input2.read();
        return (ch2 == -1);
    }
}


text:
define(function (require, exports, module) {
    "use strict";

    var Immutable = require("immutable"),
        _ = require("lodash");

    var objUtil = require("js/util/object"),
        nls = require("js/util/nls");

    /**
     * Possible statuses of exports asset in the state machine
     *
     * @enum {string}
     */
    var STATUS = {
        NEW: "new",
        REQUESTED: "requested",
        STABLE: "stable",
        ERROR: "error"
    };

    /**
     * Supported formats of export assets
     *
     * @type {Imutable.List.<string>}
     */
    var FORMATS_OPTIONS = Immutable.List([
        { format: "png", quality: 32, label: "PNG" },
        { format: "png", quality: 24, label: "PNG 24" },
        { format: "png", quality: 8, label: "PNG 8" },
        { format: "jpg", quality: 100, label: "JPG 100%" },
        { format: "jpg", quality: 85, label: "JPG 85%" },
        { format: "jpg", quality: 75, label: "JPG 75%" },
        { format: "jpg", quality: 50, label: "JPG 50%" },
        { format: "jpg", quality: 25, label: "JPG 25%" },
        { format: "svg", quality: 100, label: "SVG" },
        { format: "pdf", quality: 100, label: "PDF" }
    ]);

    /**
     * A lazily computed reverse index of asset format+quality to its index within FORMATS_OPTIONS
     *
     * @private
     * @param {string} format
     * @param {number} quality
     * @return {number}
     */
    var _findFormatOptionIndex = _.memoize(
        function (format, quality) {
            return FORMATS_OPTIONS.findIndex(function (formatOption) {
                return formatOption.format === format && formatOption.quality === quality;
            });
        },
        function (format, quality) {
            return format + quality;
        });

    /**
     * Supported scales of export assets
     *
     * @type {Imutable.List.<number>}
     */
    var SCALES = Immutable.List([1, 2, 3, 4, 5, 0.33, 0.5, 0.67, 0.75, 1.5]);

    /**
     * @constructor
     * @param {object} model
     */
    var ExportAsset = Immutable.Record({
        /**
         * @type {number}
         */
        scale: 1,

        /**
         * @type {string}
         */
        suffix: "@1x",

        /**
         * @type {string}
         */
        format: "png",

        /**
         * @type {number}
         */
        quality: 32,

        /**
         * The status of this asset in the state machine
         * @type {string}
         */
        status: STATUS.NEW,

        /**
         * @type {string}
         */
        filePath: null

    });

    /**
     * Merge in a set of properties, and additionally
     * derive a new suffix IF the scale is changing AND the suffix was not previously customized
     *
     * @param {object} props ExportAsset-like properties
     * @return {ExportAsset}
     */
    ExportAsset.prototype.mergeProps = function (props) {
        if (!this.suffixCustomized && (props.scale && (props.scale !== this.scale) ||
            props.quality && (props.quality !== this.quality))) {
            return this.merge(props).deriveSuffix();
        } else {
            return this.merge(props);
        }
    };

    /**
     * Set the status to the "requested" status
     * @return {ExportAsset}
     */
    ExportAsset.prototype.setStatusRequested = function () {
        return this.set("status", STATUS.REQUESTED);
    };

    /**
     * Set the status to the "stable" status
     * @return {ExportAsset}
     */
    ExportAsset.prototype.setStatusStable = function () {
        return this.set("status", STATUS.STABLE);
    };

    Object.defineProperties(ExportAsset.prototype, objUtil.cachedGetSpecs({
        /**
         * Derive a standardized suffix based on the scale and quality
         * @private
         * @type {string}
         */
        derivedSuffix: function () {
            var qualitySuffix = (this.quality === 32 || this.quality === 100) ? "" : "-" + this.quality.toString(),
                scaleSuffix = "@" + nls.formatDecimal(this.scale) + "x";

            return scaleSuffix + qualitySuffix;
        },

        /**
         * Determine if the suffix has been customized (not equal to the derived suffix)
         * @private
         * @type {boolean}
         */
        suffixCustomized: function () {
            return this.suffix !== this.derivedSuffix;
        },

        /**
         * Determine the index of the "format option" for this asset
         * @private
         * @return {number}
         */
        formatOptionIndex: function () {
            return _findFormatOptionIndex(this.format, this.quality);
        }
    }));

    /**
     * Update this record with the derived suffix
     *
     * @return {ExportAsset}
     */
    ExportAsset.prototype.deriveSuffix = function () {
        return this.set("suffix", this.derivedSuffix);
    };

    /**
     * Returns true if the provided ExportAsset has all the same core properties as this
     * This simply requires equality of scale, suffix, and format
     *
     * @param {ExportAsset} otherAsset
     * @return {boolean}
     */
    ExportAsset.prototype.similarTo = function (otherAsset) {
        return this.scale === otherAsset.scale &&
            this.suffix === otherAsset.suffix &&
            this.format === otherAsset.format;
    };

    /**
     * Compare two Export Assets for similarity.
     * This simply requires equality of scale, suffix, and format
     *
     * @param {ExportAsset} a
     * @param {ExportAsset} b
     * @return {boolean}
     */
    ExportAsset.similar = function (a, b) {
        return a && b && a.similarTo(b);
    };

    /**
     * Attach some enums to the export
     */
    ExportAsset.STATUS = STATUS;
    ExportAsset.FORMATS_OPTIONS = FORMATS_OPTIONS;
    ExportAsset.SCALES = SCALES;

    /**
     * Predefined sets of assets that can be quickly added
     *
     * @type {Map.<string, Array.<object>>}
     */
    ExportAsset.PRESET_ASSETS = {
        IOS: [
            { scale: 1, suffix: "" },
            { scale: 2 },
            { scale: 3 },
            { scale: 1, suffix: "", format: "svg", quality: 100 }
        ],
        HDPI: [
            { scale: 0.75, suffix: "ldpi" },
            { scale: 1, suffix: "mdpi" },
            { scale: 1.5, suffix: "hdpi" },
            { scale: 2, suffix: "xhdpi" },
            { scale: 3, suffix: "xxhdpi" },
            { scale: 4, suffix: "xxxhdpi" },
            { scale: 1, suffix: "", format: "svg", quality: 100 }
        ]
    };

    module.exports = ExportAsset;
});


text:
(function (exports) {
  var powerOf2 = function (x) { return ((x !== 0) && !(x & (x - 1))); }
  //  WebVRCommmon provides a simplified API to WebGL, reducing boilerplate.
  //
  //  init can optionally be an object with the following properties
  //  clearDepth <boolean> true if the depth should be cleared
  //  clearColor <object> an object with r,g,b,a attributes in the 0 - 1 range
  //  fallbackToMono <boolean> true if mono rendering is supported when VRDevice is not found.
  //  monoFOV <number> the field of view (in degrees) for the mono camera.
  //  monoNear <number> the depth of the near clipping plane for the mono camera.
  //  monoFar <number> the depth of the far clipping plane for the mono camera.
  //  monoCameraYaw <number> the initial yaw of the mono camera.
  //  monoCameraPitch <number> the initial pitch of the mono camera.
  //  layerSource <Canvas> the canvas that will provide vr layerSource
  //  layerSourceId <string> the id of the element that will provide a layerSource
  //  messageElement <Element> the dom element to put error messages in
  //  messageElementId <string> the id of the dom element to put messages in
  //  gl <WebGLRenderingContext> the rendering context to use for drawing, if not specified a  context will be created from the layerSource
  //  inspector <object> an initialization object that will be used to construct a WebVRInspector
  var WebVRCommon = function (init) {
    // clear color and depth by default
    this.clearDepth = init.clearDepth || true;
    this.clearColor = init.clearColor || { r: 0, g: 0, b: 0, a: 1 };

    // mono fallback
    this.fallbackToMono = init.fallbackToMono || true;
    this.monoFOV = (init.monoFOV || 90) * Math.PI / 180;
    this.monoNear = (init.monoNear || 0.01);
    this.monoFar = (init.monoFar || 10000);

    // setup a projection for mono
    this.monoProjectionMatrix = mat4.create();
    mat4.perspective(this.monoProjectionMatrix, 1, this.monoFOV, this.monoNear, this.monoFar);

    // setup a view for mono
    this.monoCameraYaw = init.monoCameraYaw || 0;
    this.monoCameraPitch = init.monoCameraPitch || 0;
    this.yawAxis = [0, 1, 0];
    this.pitchAxis = [1, 0, 0];
    this.monoCameraRotationYaw = quat.create();
    this.monoCameraRotationPitch = quat.create();
    this.monoCameraRotation = quat.create();
    this.monoViewMatrix = mat4.create();
    this.inputDragging = false;
    this.inputLastX = 0;
    this.inputLastY = 0;
    this.inputScale = 0.001;
    this._initMonoCameraInput();

    this.hasWebVRSupport = !!navigator.getVRDisplays;
    this.layerSource = init.layerSource || document.getElementById(init.layerSourceId);
    this.messageElement = init.messageElement || document.getElementById(init.messageElementId);
    this.gl = init.gl || this._initWebGL();
    if (typeof WebVRShim === 'function') {
        this.shim = new WebVRShim(this.gl);
    }
    if (typeof WebVRInspector === 'function') {
      // Create an inspector and replace the frame loop with the inspector version
      this.inspector = new WebVRInspector(init.inspector);
      this._onAnimationFrame = this.inspector.createFrame(
        this._preUpdate.bind(this),
        this._update.bind(this),
        this._render.bind(this)
      );
    }
  };

  WebVRCommon.prototype._initMonoCameraInput = function () {
    var self = this;
    var startDrag = function (target, x, y) {
      if (target === self.layerSource) {
        self.inputDragging = true;
        self.inputLastX = x;
        self.inputLastY = y;
        return true;
      }
    };

    var moveDrag = function (x, y) {
      if (self.inputDragging) {
        var deltaX = (x - self.inputLastX) * self.inputScale;
        var deltaY = (y - self.inputLastY) * self.inputScale;

        self.monoCameraYaw += Math.PI * deltaX;
        self.monoCameraPitch += Math.PI * deltaY;

        // Limit/normalized the camera angles
        while (self.monoCameraYaw < -Math.PI) self.monoCameraYaw += Math.PI * 2;
        while (self.monoCameraYaw >  Math.PI) self.monoCameraYaw -= Math.PI * 2;
        self.monoCameraPitch = Math.max(-Math.PI / 2.001, Math.min(self.monoCameraPitch, Math.PI / 2.001));

        self.inputLastX = x;
        self.inputLastY = y;
      }
    };

    var endDrag = function () {
      self.inputDragging = false;
    };

    document.body.addEventListener("touchstart", function (event) {
      if (startDrag(event.target, event.changedTouches[0].clientX, event.changedTouches[0].clientY)) {
        event.preventDefault();
      }
    }, false);
    document.body.addEventListener("touchmove", function (event) {
      moveDrag(event.changedTouches[0].clientX, event.changedTouches[0].clientY);
    }, false);
    document.body.addEventListener("touchend", function (event) {
      endDrag();
    }, false);
    document.body.addEventListener("touchend", function (event) {
      endDrag();
    }, false);
    document.body.addEventListener("mousedown", function (event) {
      if (startDrag(event.target, event.clientX, event.clientY)) {
        event.preventDefault();
      }
    }, false);
    document.body.addEventListener("mousemove", function (event) {
      moveDrag(event.clientX, event.clientY);
    }, false);
    document.body.addEventListener("mouseup", function (event) {
      endDrag();
    }, false);
  };

  WebVRCommon.prototype._initWebGL = function () {
    var glAttribs = {
      alpha: false,                   // The canvas will not contain an alpha channel
      antialias: true,                // We want the canvas to perform anti-aliasing
      preserveDrawingBuffer: false    // We don't want our drawing to be retained between frames, we will fully rerender each frame.
    };

    return this.layerSource.getContext("webgl", glAttribs) ||
           this.layerSource.getContext("experimental-webgl", glAttribs); // Edge currently requires this
  };

  // Given strings for the vertex and fragment shader, it compiles and links them into a program.
  // Returns a 'programInfo' that combines the program and reflected information about it.
  WebVRCommon.prototype.loadProgram = function (vs, fs) {
    var gl = this.gl;
    var program = gl.createProgram();

    // Compile vertex shader
    var vertShader = this._loadShader(vs, gl.VERTEX_SHADER)
    gl.attachShader(program, vertShader);

    // Compile fragment shader
    var fragShader = this._loadShader(fs, gl.FRAGMENT_SHADER);
    gl.attachShader(program, fragShader);

    // Link the vertex and fragment shader together.
    gl.linkProgram(program);
    if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
      const error = gl.getProgramInfoLog(program);
      gl.deleteProgram(program);
      throw new Error(error);
    }

    return {
      program: program,
      vertexFormat: this.getVertexFormatFromProgram(program),
      uniforms: this.getUniformsFromProgram(program),
    };
  };

  WebVRCommon.prototype._loadShader = function (src, type) {
    var gl = this.gl;
    var shader = gl.createShader(type);
    gl.shaderSource(shader, src);
    gl.compileShader(shader);
    if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
      const error = gl.getShaderInfoLog(shader);
      gl.deleteShader(shader);
      throw new Error(error);
    }
    return shader;
  };

  // Takes in a dictionary of uniform values and sets them on the program.
  WebVRCommon.prototype.setUniforms = function (programInfo, values) {
    var gl = this.gl;
    var uniforms = programInfo.uniforms;
    for (var key in values) {
      uniforms[key].setter(values[key]);
    }
  };

  // Unfortunately some api's such as vertexAttribPointer only understand primitive data types, and not 'complex' types
  // such as FLOAT_VEC3 even though getActiveAttrib will give us these.  This method extracts information about complex types.
  WebVRCommon.prototype.getInfoForType = function (type, arraySize) {
    var gl = this.gl;
    var components = arraySize || 1;
    if (type === gl.BYTE || type === gl.UNSIGNED_BYTE) {
      return { type: type, arraySize: arraySize, byteSize: 1 * components, dataType: type, components: components };
    }
    if (type === gl.SHORT || type === gl.UNSIGNED_SHORT) {
      return { type: type, arraySize: arraySize, byteSize: 2 * components, dataType: type, components: components };
    }
    if (type === gl.INT || type === gl.UNSIGNED_INT || type === gl.FLOAT) {
      return { type: type, arraySize: arraySize, byteSize: 4 * components, dataType: type, components: components };
    }
    if (type === gl.INT_VEC2 || type === gl.INT_VEC3 || type === gl.INT_VEC4) {
      components *= 2 + (type - gl.INT_VEC2);
      return { type: type, arraySize: arraySize, byteSize: 4 * components , dataType: gl.INT, components: components };
    }
    if (type === gl.FLOAT_VEC2 || type === gl.FLOAT_VEC3 || type === gl.FLOAT_VEC4) {
      components *= 2 + (type - gl.FLOAT_VEC2);
      return { type: type, arraySize: arraySize, byteSize: 4 * components , dataType: gl.FLOAT, components: components };
    }
    if (type === gl.BOOL || type === gl.BOOL_VEC2 || type === gl.BOOL_VEC3 || type === gl.BOOL_VEC4) {
      components *= 1 + (type - gl.BOOL);
      return { type: type, arraySize: arraySize, byteSize: 1 * components , dataType: gl.BOOL, components: components };
    }
    if (type === gl.FLOAT_MAT2 || type === gl.FLOAT_MAT3 || type === gl.FLOAT_MAT4) {
      components *= Math.pow(2 + (type - gl.FLOAT_MAT2), 2);
      return { type: type, arraySize: arraySize, byteSize: 4 * components , dataType: gl.FLOAT, components: components };
    }
    if (type === gl.SAMPLER_2D) {
      return { type: type, arraySize: arraySize, byteSize: null , dataType: null, components: components };
    }
    if (type === gl.SAMPLER_CUBE) {
      return { type: type, arraySize: arraySize, byteSize: null , dataType: null, components: components };
    }
  };

  WebVRCommon.prototype._getUniformSetter = function (type, location) {
    var gl = this.gl;
    if (type === gl.FLOAT) {
      return gl.uniform1f.bind(gl, location);
    }
    if (type === gl.FLOAT_VEC2) {
      return gl.uniform2fv.bind(gl, location);
    }
    if (type === gl.FLOAT_VEC3) {
      return gl.uniform3fv.bind(gl, location);
    }
    if (type === gl.FLOAT_VEC4) {
      return gl.uniform4fv.bind(gl, location);
    }

    if (type === gl.SAMPLER_2D || type === gl.SAMPLER_CUBE || type === gl.INT || type === gl.BOOL ||
        type === gl.SHORT || type === gl.BYTE || type === gl.UNSIGNED_BYTE || type === gl.UNSIGNED_SHORT || type === gl.UNSIGNED_INT) {
      return gl.uniform1i.bind(gl, location);
    }
    if (type === gl.INT_VEC2 || type === gl.BOOL_VEC2) {
      return gl.uniform2iv.bind(gl, location);
    }
    if (type === gl.INT_VEC3 || type === gl.BOOL_VEC3) {
      return gl.uniform3iv.bind(gl, location);
    }
    if (type === gl.INT_VEC4 || type === gl.BOOL_VEC4) {
      return gl.uniform4iv.bind(gl, location);
    }

    if (type === gl.FLOAT_MAT2) {
      return gl.uniformMatrix2fv.bind(gl, location, false);
    }
    if (type === gl.FLOAT_MAT3) {
      return gl.uniformMatrix3fv.bind(gl, location, false);
    }
    if (type === gl.FLOAT_MAT4) {
      return gl.uniformMatrix4fv.bind(gl, location, false);
    }

    throw new Error("Unknown uniform type: " + type);
  };

  // Relects on the program to extract vertex attribute information.
  WebVRCommon.prototype.getVertexFormatFromProgram = function (program) {
    var gl = this.gl;
    var activeAttribs = gl.getProgramParameter(program, this.gl.ACTIVE_ATTRIBUTES);
    var vertexFormat = {
      stride: 0,
      attribs: {}
    };
    for (var i = 0; i < activeAttribs; ++i) {
      var attrib = gl.getActiveAttrib(program, i);
      var typeInfo = this.getInfoForType(attrib.type, attrib.size);
      vertexFormat.attribs[attrib.name] = {
        index: i,
        name: attrib.name,
        location: gl.getAttribLocation(program, attrib.name),
        typeInfo: typeInfo,
      };
      vertexFormat.stride += typeInfo.byteSize;
    }

    return vertexFormat;
  };

  // Reflects on the program to extract uniform information.
  WebVRCommon.prototype.getUniformsFromProgram = function (program) {
    var gl = this.gl;
    var activeUniforms = gl.getProgramParameter(program, this.gl.ACTIVE_UNIFORMS);
    var uniforms = {};
    for (var i = 0; i < activeUniforms; ++i) {
      var uniform = gl.getActiveUniform(program, i);
      var location = gl.getUniformLocation(program, uniform.name);
      var typeInfo = this.getInfoForType(uniform.type, uniform.size);
      var setter = this._getUniformSetter(uniform.type, location);
      uniforms[uniform.name] = {
        index: i,
        name: uniform.name,
        location: location,
        typeInfo: typeInfo,
        setter: setter,
      };
    }
    return uniforms;
  };

  WebVRCommon.prototype.loadGeometry = function (config) {
    var self = this;
    var geometryInfo = {
      src: config.src,
      promise: null,
      loaded: false,
      geometry: null,
    };
    geometryInfo.promise = fetch(geometryInfo.src).then(function (response) {
      return response.json().then(function (geometryJson) {
        geometryInfo.geometry = self.createGeometry(geometryJson);
        geometryInfo.loaded = true;
        return geometryInfo.geometry;
      });
    });
    return geometryInfo;
  };

  // Given a vertexArray and a description of the vertex format, this creates a gl buffer and uploads
  // the vertex data.
  WebVRCommon.prototype.createGeometry = function (config) {
    var gl = this.gl;
    var vertices = config.vertices;
    var primitiveType = config.primitiveType || gl.TRIANGLES;
    var indices = config.indices;

    if (!vertices) {
      throw new Error("config.vertices is required.");
    }
    if (!Array.isArray(vertices)) {
      vertices = [vertices];
    }

    if (vertices.length < 1) {
      throw new Error("At least one vertices is required.");
    }

    // create/upload vertex buffers
    var vertexBuffers = [];
    for (var i = 0; i < vertices.length; ++i) {
      vertexBuffers.push(this._createVertexBuffer(vertices[i]));
    }

    // optionally create/upload index buffer
    var indexBuffer, indexType, indexCount
    if (indices) {
      indexType = gl.UNSIGNED_SHORT;
      indexCount = indices.length;
      indexBuffer = gl.createBuffer();
      gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
      gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
    }

    // package it all up for later
    return {
      primitiveType: primitiveType,
      vertexBuffers: vertexBuffers,
      vertexCount: vertices[0].array.length / (vertexBuffers[0].format.stride / 4),
      indexBuffer: indexBuffer,
      indexType: indexType,
      indexCount: indexCount,
    };
  };

  WebVRCommon.prototype._createVertexBuffer = function(vertexBufferInfo) {
    var gl = this.gl;
    // create/upload vertex buffer
    var vertexBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexBufferInfo.array), gl.STATIC_DRAW);

    return {
      format: this._convertVertexFormat(vertexBufferInfo.format),
      buffer: vertexBuffer,
    };
  };

  // Converts from a shorthand array format to a map format that is used internally
  WebVRCommon.prototype._convertVertexFormat = function (vertexFormatArray) {
    var vertexFormat = {
      stride: 0,
      attribs: {}
    };
    for (var i = 0; i < vertexFormatArray.length; ++i) {
      var shortFormat = vertexFormatArray[i];
      var typeInfo = this.getInfoForType(shortFormat.type, shortFormat.size);
      vertexFormat.attribs[shortFormat.name] = {
        index: i,
        name: shortFormat.name,
        location: vertexFormat.stride, // the offset to this element so far
        typeInfo: typeInfo,
      };
      vertexFormat.stride += typeInfo.byteSize;
    }
    return vertexFormat;
  }

  // Uses the program and enables vertex attribs. Optionally binds indexBuffer.
  WebVRCommon.prototype.useGeometry = function (geometry, programInfo) {
    var gl = this.gl;
    gl.useProgram(programInfo.program);

    // apply vertex buffers
    var vertexBuffers = geometry.vertexBuffers;
    for (var i = 0; i < vertexBuffers.length; ++i) {
      this._enableVertexBuffer(i, programInfo.vertexFormat, vertexBuffers[i]);
    }

    // optionally apply index buffer
    if (geometry.indexBuffer) {
      gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer);
    }
  };

  // Helper to bind a vertex buffer and enable the associated attributes
  WebVRCommon.prototype._enableVertexBuffer = function (arrayIndex, programVertexFormat, vertexBuffer) {
    var gl = this.gl;
    var bufferVertexFormat = vertexBuffer.format;
    gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer.buffer);
    for (var key in bufferVertexFormat.attribs) {
      var bufferAttrib = bufferVertexFormat.attribs[key];
      var programAttrib = programVertexFormat.attribs[key];
      if (programAttrib) {
        gl.enableVertexAttribArray(programAttrib.location);
        gl.vertexAttribPointer(programAttrib.location,
                              bufferAttrib.typeInfo.components,
                              bufferAttrib.typeInfo.dataType,
                              bufferAttrib.normalize || false,
                              bufferVertexFormat.stride,
                              bufferAttrib.location);
      }
    }
  };

  // Draws the given geometry
  WebVRCommon.prototype.drawGeometry = function (geometry) {
    var gl = this.gl;
    if (geometry.indexBuffer) {
      gl.drawElements(geometry.primitiveType, geometry.indexCount, geometry.indexType, 0);
    } else {
      gl.drawArrays(geometry.primitiveType, 0, geometry.vertexCount);
    }
  };

  // Loads an image and uploads it into a texture.
  // Returns a 'textureInfo' that contains a promise that will be fulfilled when the texture is loaded.
  WebVRCommon.prototype.loadTexture2D = function (config) {
    if (!config.src) {
      throw new Error("config.src is required");
    }

    const textureInfo = this._createTexture(config);
    textureInfo.target = this.gl.TEXTURE_2D;
    textureInfo.promise = this._loadTexture2D(config.src, textureInfo);

    return textureInfo;
  };

  // Loads an image and uploads it into a texture.
  // Returns a 'textureInfo' that contains a promise that will be fulfilled when the texture is loaded.
  WebVRCommon.prototype.loadTextureCube = function (config) {
    if (!config.pos_x) {
      throw new Error("config.pos_x is required");
    }

    const textureInfo = this._createTexture(config);
    textureInfo.target = this.gl.TEXTURE_CUBE_MAP;
    textureInfo.promise = this._loadTextureCube(config, textureInfo);

    return textureInfo;
  };

  // Returns a 'textureInfo' that contains a promise that will be fulfilled with a canvas2D attached
  WebVRCommon.prototype.loadCanvasTexture = function (config) {
    const textureInfo = this._createTexture(config);
    textureInfo.canvas = window.document.createElement("canvas");
    textureInfo.canvas.width = config.width;
    textureInfo.canvas.height = config.height;
    textureInfo.target = this.gl.TEXTURE_2D;
    textureInfo.promise = this._loadTextureCanvas(textureInfo);

    return textureInfo;
  };

  WebVRCommon.prototype._createTexture = function (config) {
    var gl = this.gl;
    var texture = gl.createTexture();
    var genMips = config.generateMipmaps === undefined ? true : !!config.generateMipmaps;
    var textureInfo = {
      wrap_s: config.clamp_s || gl.REPEAT,
      wrap_t: config.clamp_t || gl.REPEAT,
      min_filter: config.min_filter || (genMips ? gl.LINEAR_MIPMAP_NEAREST : gl.LINEAR),
      mag_filter: config.mag_filter || gl.LINEAR,
      generateMipmaps: genMips,
      texture: texture,
    };

    return textureInfo;
  };

  WebVRCommon.prototype._loadImage = function (src) {
    var self = this;
    return new Promise(function (fulfill, reject) {
      var image = new Image();

      var load = function () {
        removeHandlers();
        fulfill(image);
      };

      var error = function () {
        removeHandlers();
        reject("failed to load image: " + src);
      };

      var removeHandlers = function () {
        image.removeEventListener('load', load);
        image.removeEventListener('error', error);
      };

      image.addEventListener("load", load, false);
      image.addEventListener("error", error, false);
      image.src = src;
    });
  };

  WebVRCommon.prototype._loadTexture2D = function (src, textureInfo) {
    var self = this;
    return this._loadImage(src).then(function(image) {
      var gl = self.gl;

      gl.activeTexture(gl.TEXTURE0);
      gl.bindTexture(gl.TEXTURE_2D, textureInfo.texture);
      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);

      textureInfo.loaded = true;
      textureInfo.width = image.naturalWidth;
      textureInfo.height = image.naturalHeight;

      self._completeTextureLoad(textureInfo);

      // To avoid bad aliasing artifacts we will generate mip maps to use when rendering this texture at various distances
      if (textureInfo.generateMipmaps) {
        gl.generateMipmap(gl.TEXTURE_2D);
      }

      return textureInfo.texture;
    });
  };

  WebVRCommon.prototype._loadTextureCube = function (config, textureInfo) {
    var self = this;
    return Promise.all([
      this._loadImage(config.pos_x),
      this._loadImage(config.neg_x),
      this._loadImage(config.pos_y),
      this._loadImage(config.neg_y),
      this._loadImage(config.pos_z),
      this._loadImage(config.neg_z),
    ]).then(function(images) {
      var gl = self.gl;

      gl.activeTexture(gl.TEXTURE0);
      gl.bindTexture(gl.TEXTURE_CUBE_MAP, textureInfo.texture);
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[0]);
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[1]);
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[2]);
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[3]);
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[4]);
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[5]);

      textureInfo.loaded = true;
      textureInfo.width = images[0].naturalWidth;
      textureInfo.height = images[0].naturalHeight;

      self._completeTextureLoad(textureInfo);

      // To avoid bad aliasing artifacts we will generate mip maps to use when rendering this texture at various distances
      if (textureInfo.generateMipmaps) {
        gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
      }

      return textureInfo.texture;
    });
  };

   WebVRCommon.prototype._loadTextureCanvas = function (textureInfo) {
    var self = this;
    return new Promise(function (fulfill, reject) {
      textureInfo.loaded = true;
      textureInfo.width = textureInfo.canvas.width;
      textureInfo.height = textureInfo.canvas.height;

      self._completeTextureLoad(textureInfo);

      fulfill(textureInfo.texture);
    });
  };

  WebVRCommon.prototype._completeTextureLoad = function (textureInfo) {
    var gl = this.gl;
    // turn off mips/filtering/wrapping for non-power-of-2 textures
    if (!powerOf2(textureInfo.width) || !powerOf2(textureInfo.height)) {
      textureInfo.wrap_s = gl.CLAMP_TO_EDGE;
      textureInfo.wrap_t = gl.CLAMP_TO_EDGE;
      textureInfo.min_filter = gl.LINEAR;
      textureInfo.mag_filter = gl.LINEAR;
      textureInfo.generateMipmaps = false;
    }
  };

  // Enables a texture and binds it to the given texture unit.
  WebVRCommon.prototype.useTexture = function(textureInfo, textureUnit) {
    var gl = this.gl;
    if (textureInfo.loaded) {
      var target = textureInfo.target;
      gl.activeTexture(gl.TEXTURE0 + textureUnit);
      gl.bindTexture(target, textureInfo.texture);

      gl.texParameteri(target, gl.TEXTURE_WRAP_S, textureInfo.wrap_s);
      gl.texParameteri(target, gl.TEXTURE_WRAP_T, textureInfo.wrap_t);
      gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, textureInfo.min_filter);
      gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, textureInfo.mag_filter);
    }
  };

  // Applications should call this to kick off the render loop.
  WebVRCommon.prototype.start = function () {
    // Get the first VRDisplay that is available and try to requestPresent.
    // If VR is unavailable or we aren't able to present, we will simply display an HTML message in the page.
    var self = this;
    if (self.hasWebVRSupport) {
      navigator.getVRDisplays().then(function (displays) {
        if (displays.length > 0) {
          // We reuse this every frame to avoid generating garbage
          self.frameData = new VRFrameData();

          self.vrDisplay = displays[0];

          // We must adjust the canvas (our VRLayer source) to match the VRDisplay
          var leftEye = self.vrDisplay.getEyeParameters("left");
          var rightEye = self.vrDisplay.getEyeParameters("right");

          // This layer source is a canvas so we will update its width and height based on the eye parameters.
          // For simplicity we will render each eye at the same resolution
          self.layerSource.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;
          self.layerSource.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);

          // This can normally only be called in response to a user gesture.
          // In Carmel, we can begin presenting the VR scene right away.
          self.vrDisplay.requestPresent([{ source: self.layerSource }]).then(function () {
            // Start our render loop, which is synchronized with the VRDisplay refresh rate
            self.requestAnimationFrame();
          }).catch(function (err) {
            // The Carmel Developer preview allows entry into VR at any time because it is a VR first experience.
            // Other browsers will only allow this to succeed if called in response to user interaction, such as a click or tap though.
            // We expect this to fail outside of Carmel and would present the user with an "Enter VR" button of some sort instead.
            self.addHTMLMessage("Failed to requestPresent.");
          });
        } else {
          // Usually you would want to hook the vrdisplayconnect event and only try to request present then.
          self.addHTMLMessage("There are no VR displays connected.");
        }
      }).catch(function (err) {
        self.addHTMLMessage("VR Displays are not accessible in this context.  Perhaps you are in an iframe without the allowvr attribute specified.");
      });
    } else {
      if (self.fallbackToMono) {
        self.requestAnimationFrame();
      } else {
        self.addHTMLMessage("WebVR is not supported on this browser.");
        self.addHTMLMessage("To support progressive enhancement your fallback code should render a normal Canvas based WebGL experience for the user.");
      }
    }
  };

  // Request another animation frame.  Falls back to the window if vrDisplay isn't available.
  WebVRCommon.prototype.requestAnimationFrame = function () {
    if (!this._onAnimationFrameCallback) {
      this._onAnimationFrameCallback = this._onAnimationFrame.bind(this);
    }
    if (this.vrDisplay) {
      this.vrDisplay.requestAnimationFrame(this._onAnimationFrameCallback);
    } else {
      requestAnimationFrame(this._onAnimationFrameCallback);
    }
  };

  WebVRCommon.prototype._preUpdate = function (timestamp) {
    // Continue to request frames to keep the render loop going
    this.requestAnimationFrame();
    if (this.shim) {
      this.shim.beginFrame();
    }
    if (this.preUpdate) {
      this.preUpdate(timestamp);
    }
  };

  WebVRCommon.prototype._update = function (timestamp) {
    if (this.vrDisplay) {
      // Get the current pose data
      this.vrDisplay.getFrameData(this.frameData);

      if (this.update) {
        this.update(timestamp, this.frameData.leftProjectionMatrix, this.frameData.leftViewMatrix);
      }
    } else if (this.fallbackToMono) {

        quat.setAxisAngle(this.monoCameraRotationYaw, this.yawAxis, this.monoCameraYaw);
        quat.setAxisAngle(this.monoCameraRotationPitch, this.pitchAxis, this.monoCameraPitch);
        quat.multiply(this.monoCameraRotation, this.monoCameraRotationPitch, this.monoCameraRotationYaw);
        mat4.fromQuat(this.monoViewMatrix, this.monoCameraRotation);

        // Ensure canvas size matches element size
        var width = this.layerSource.clientWidth;
        var height = this.layerSource.clientHeight;
        this.layerSource.width = width;
        this.layerSource.height = height;

        mat4.perspective(this.monoProjectionMatrix, this.monoFOV, width / height, this.monoNear, this.monoFar);

        if (this.update) {
          this.update(timestamp, this.monoProjectionMatrix, this.monoViewMatrix);
        }
    }
  };

  WebVRCommon.prototype._render = function () {
    var gl = this.gl;

    // Clear canvas - we do this outside of render to avoid clearing twice
    this._clear();

    if (this.render) {
      if (this.vrDisplay) {
        // Render the left eye
        var layerSource = this.layerSource;
        gl.viewport(0, 0, layerSource.width * 0.5, layerSource.height);
        this.render(this.frameData.leftProjectionMatrix, this.frameData.leftViewMatrix, "left");

        // Render the right eye
        gl.viewport(layerSource.width * 0.5, 0, layerSource.width * 0.5, layerSource.height);
        this.render(this.frameData.rightProjectionMatrix, this.frameData.rightViewMatrix, "right");

        // Submit the newly rendered layer to be presented by the VRDisplay
        this.vrDisplay.submitFrame();
      } else if (this.fallbackToMono) {
        // Render mono
        gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
        this.render(this.monoProjectionMatrix, this.monoViewMatrix, "mono");
      }
    }
  };

  WebVRCommon.prototype._clear = function () {
    var gl = this.gl;
    var clearFlags = 0;

    if (this.clearDepth) {
      clearFlags |= gl.DEPTH_BUFFER_BIT;
    }

    if (this.clearColor) {
      gl.clearColor(this.clearColor.r, this.clearColor.g, this.clearColor.b, this.clearColor.a);
      clearFlags |= gl.COLOR_BUFFER_BIT;
    }

    if (clearFlags) {
      gl.clear(clearFlags);
    }
  };

  WebVRCommon.prototype._onAnimationFrame = function (timestamp) {
    this._preUpdate(timestamp);
    this._update(timestamp);
    this._render(timestamp);
  }

  WebVRCommon.prototype.addHTMLMessage = function (msgText) {
      if (this.messageElement) {
        var message = document.createElement("div");
        message.innerHTML = msgText;
        this.messageElement.appendChild(message);
      }
  };

  exports.WebVRCommon = WebVRCommon;
})(window);


text:
require 'active_support'
require 'solandra_object'
require 'solandra_object/base'
module SolandraObject
  class Base
    class_attribute :recorded_classes

    def save_with_record_class(*args)
      SolandraObject::Base.recorded_classes[self.class] = nil
      save_without_record_class(*args)
    end
    alias_method_chain :save, :record_class
  end
end


text:
from flask.ext.appbuilder import Model

"""

You can use the extra Flask-AppBuilder fields and Mixin's

AuditMixin will add automatic timestamp of created and modified by who

"""


text:
include_recipe 'rbenv'
include_recipe 'rbenv::ruby_build'

ruby_ver = '2.1.2'

ENV['LD_LIBRARY_PATH'] = '/usr/local/lib'

# Install qt
yum_package 'qtwebkit-devel.x86_64'

link '/usr/bin/qmake' do
    to '/usr/lib64/qt4/bin/qmake'
end

# Install ruby
rbenv_ruby ruby_ver

# Install bundler
rbenv_gem 'bundler' do
    ruby_version ruby_ver
end

# TODO: This may be unnecessary
# execute "set ruby global version to #{ruby_ver}" do
#     command "rbenv global #{ruby_ver}"
# end

# TODO: This may be unnecessary
# execute 'open up rbenv directory for jenkins to use' do
#     command 'chmod -R 777 /opt/rbenv'
#     user 'root'
# end

# TODO: This may be unnecessary
# TODO: Remove bash profile appending
execute 'add LD_LIBRARY_PATH to vagrant bash profile' do
    command "echo 'export LD_LIBRARY_PATH=/usr/local/lib' >> /home/ec2-user/.bash_profile"
end


text:
package com.taobao.weex.common;

import android.widget.ImageView;

import java.util.Map;

public class WXImageStrategy {

  /**
   * Never!
   * Never!
   * Never!
   * Never use this flag, ImageView has done all the job of clipping!
   * There is no method to read this flag any more.
   * This field will be removed when it's appropriate.
   */
  @Deprecated
  public boolean isClipping;

  /**
   * Whether to sharp the image. The default is false.
   */
  public boolean isSharpen;

  /**
   * The blur radius of the image. 0 means no blur.
   * */
  public int blurRadius;

  public String placeHolder;

  public ImageListener getImageListener() {
    return imageListener;
  }

  public void setImageListener(ImageListener imageListener) {
    this.imageListener = imageListener;
  }

  ImageListener imageListener;

  public interface ImageListener{
    public void onImageFinish(String url,ImageView imageView,boolean  result,Map extra);
  }
}


text:
<?php

namespace TestBundle\Tests\Gateway\CriterionType;

use PHPUnit_Framework_MockObject_MockObject;
use TestBundle\Gateway\CriterionType\TransactionPeriodTotalsCriterionType;
use TestBundle\Entity\Gateway;
use TestBundle\Entity\GatewayCriterion;
use TestBundle\Entity\GatewayCriterionOperator;
use TestBundle\Entity\GatewayCriterionValue;
use TestBundle\Entity\OperatorType;
use TestBundle\Entity\PeriodType;
use TestBundle\Entity\Transaction;
use TestBundle\Service\MathService;
use TestBundle\Tests\BaseTestCase;
use TestBundle\Repository\TransactionRepository;

class TransactionPeriodTotalsCriterionTypeTest extends BaseTestCase
{
    /** @var TransactionPeriodTotalsCriterionType */
    private $criterionType;
    /** @var PHPUnit_Framework_MockObject_MockObject|TransactionRepository */
    private $mTransactionRepository;
    /** @var GatewayCriterion */
    private $gatewayCriterion;
    /** @var Transaction */
    private $transaction;

    public function setUp()
    {
        parent::setUp();

        $this->mTransactionRepository = $this->getMockEntityRepository('Transaction', ['getTotalsByPeriodType']);
        $this->criterionType = new TransactionPeriodTotalsCriterionType(new MathService(), $this->mTransactionRepository);

        $operatorType = new OperatorType();
        $operatorType->setName(OperatorType::LESS_THAN_OR_EQUAL);

        $criterionOperator = new GatewayCriterionOperator();
        $criterionOperator->setOperatorType($operatorType);

        $criterionValue = new GatewayCriterionValue();
        $criterionValue->setValue(123.00);

        $periodType = new PeriodType();
        $periodType->setName(PeriodType::DAY);

        $this->gatewayCriterion = new GatewayCriterion();
        $this->gatewayCriterion
            ->setPeriodType($periodType)
            ->setGateway(new Gateway())
            ->setGatewayCriterionOperator($criterionOperator)
            ->setGatewayCriterionValue($criterionValue);

        $this->transaction = new Transaction();
        $this->transaction->setAmount(123.00);
    }

    /** @test */
    public function evaluate_true()
    {
        $this->mTransactionRepository
            ->expects($this->once())
            ->method('getTotalsByPeriodType')
            ->willReturn(0.00);

        $this->assertTrue($this->criterionType->evaluate($this->gatewayCriterion, $this->transaction));
    }

    /** @test */
    public function evaluate_false()
    {
        $this->mTransactionRepository
            ->expects($this->once())
            ->method('getTotalsByPeriodType')
            ->willReturn(124.00);

        $this->assertFalse($this->criterionType->evaluate($this->gatewayCriterion, $this->transaction));
    }
}


text:
package org.slc.sli.ingestion.csv;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.Mongo;

import org.slc.sli.ingestion.NeutralRecord;

/**
 * POC code for Csv ingestion strategy
 *
 * @author jtully, dshaw
 *
 */
public class CsvCombine {

    private Mongo mongo;
    private DB db;

    private static final PrintStream PRINT_STREAM = System.out;

    public CsvCombine() {
        try {
            mongo = new Mongo();
            db = mongo.getDB("StagingDB");
        } catch (Exception e) {
        }
    }

    public List<NeutralRecord> getNeutralRecordsFromCollection(String entityName) {
        PRINT_STREAM.println("importing from collection " + entityName);

        List<NeutralRecord> records = new ArrayList<NeutralRecord>();

        // Get a list of all the collections in the staging DB
        Set<String> allCollections = db.getCollectionNames();
        List<DBCollection> dbSupportingCollections = new ArrayList<DBCollection>();
        Iterator<String> it = allCollections.iterator();
        while (it.hasNext()) {
            dbSupportingCollections.add(db.getCollection(it.next().toString()));
        }

        // Get the data in the primary (entityName) collection.
        DBCollection dbCollection = db.getCollection(entityName);
        DBCursor cursor = dbCollection.find();

        // Create the neutral record on a entry-by-entry basis
        while (cursor.hasNext()) {
            records.add(createNeutralRecord(cursor.next(), entityName, dbSupportingCollections));
        }

        return records;
    }

    /**
     * Create a neutral record from a dbElement of a base collection.
     * Initiates recursive parsing of sub tables filling the neutralRecord map.
     */
    private NeutralRecord createNeutralRecord(DBObject dbElement, String entityName,
            List<DBCollection> supportingCollections) {

        NeutralRecord record = new NeutralRecord();
        record.setRecordType(entityName);

        int joinKey = Integer.parseInt(dbElement.get("JoinKey").toString());
        try {
            Map<String, Object> attributes = parseDbElement(dbElement, joinKey, entityName, supportingCollections);
            record.setAttributes(attributes);
        } catch (Exception e) {
            e.printStackTrace();
            PRINT_STREAM.println("invalid collection format for entity type " + entityName);
        }

        return record;
    }

    /**
     * Parse an element (table row) representing a complex type and return the associated NR map.
     */
    private Map<String, Object> parseDbElement(DBObject dbElement, int joinKey, String entityName,
            List<DBCollection> supportingCollections) {
        Map<String, Object> result = new HashMap<String, Object>();

        Set<String> keySet = dbElement.keySet();

        // add all entries from this table rowprefix
        for (Iterator<String> it = keySet.iterator(); it.hasNext();) {
            String curKey = it.next();
            if (curKey.equals("_id") || curKey.equals("JoinKey") || curKey.equals("ParentJoinKey")) {
                continue;
            }

            String curVal = "" + dbElement.get(curKey);
            addMapEntry(curKey, curVal, result);

            /**
             * Now pick up the supporting list of list files.
             * The outer 'if' statement ensures this is only called if
             * further levels of hierarchy exist
             */
            for (Iterator<DBCollection> iter = supportingCollections.iterator(); iter.hasNext();) {
                String collectionName = iter.next().toString();
                if (collectionName.lastIndexOf('_') == entityName.length()) {
                    String listName = collectionName.substring(entityName.length() + 1);
                    addMapEntry(listName,
                            getListFromCollection(collectionName, joinKey, supportingCollections), result);
                }
            }
        }
        return result;
    }

    /**
     * Get a list from elements in collection "collectionName" with matching ParentJoinKeys.
     * Note that it is possible to have a list of simple types (strings) as opposed to a list
     * of complex types (maps). This is defined by the column name "SimpleType".
     */
    private List<Object> getListFromCollection(String collectionName, int parentJoinKey,
            List<DBCollection> supportingCollections) {
        List<Object> result = new ArrayList<Object>();

        DBCollection dbCollection = db.getCollection(collectionName);

        BasicDBObject query = new BasicDBObject();
        query.put("ParentJoinKey", parentJoinKey);
        DBCursor cursor = dbCollection.find(query);

        while (cursor.hasNext()) {
            DBObject dbElement = cursor.next();
            Object simpleTypeVal = dbElement.get("SimpleType");
            if (simpleTypeVal != null) {
                result.add(simpleTypeVal);
            } else {
                int newJoinKey = Integer.parseInt(dbElement.get("JoinKey").toString());
                result.add(parseDbElement(dbElement, newJoinKey, collectionName, supportingCollections));
            }
        }

        return result;
    }

    /**
     * Resolve and build the required map structure from the column names and adds the entry
     */
    @SuppressWarnings("unchecked")
    private void addMapEntry(String key, Object val, Map<String, Object> baseNode) {
        Map<String, Object> targetNode = baseNode;
        String[] mapNames = key.split("\\.");
        int numMaps = mapNames.length;

        for (int i = 0; i < numMaps; ++i) {

            if (i == numMaps - 1) {
                targetNode.put(mapNames[i], val);
            } else if (!targetNode.containsKey(mapNames[i])) {
                Map<String, Object> newNode = new HashMap<String, Object>();
                targetNode.put(mapNames[i], newNode);
                targetNode = newNode;
            } else {
                targetNode = (Map<String, Object>) targetNode.get(mapNames[i]);
            }
        }
    }

    /**
     * Main method to test run the combiner. Note requires local mongodb instance to be running with
     * Student csv table collections loaded.
     *
     */
    public static void main(String[] args) {
        /**
         * It would be nicer to auto-generate the entities and associations below using
         * the Ed-Fi schema, but I don't know if that's possible at this time. -dshaw 13MAR12
         */
        int numEntities = 53;
        numEntities = 1;
        String[] entities = new String[numEntities];
        entities[0] = "Student";

        int numAssociations = 16;
        numAssociations = 1;
        String[] associations = new String[numAssociations];

        associations[0] = "EducationalOrgReferenceType";

        CsvCombine combiner = new CsvCombine();

        /**
         * Currently, we are just looking at one entity type. One possibility for the
         * full solution is to simply loop over these top level files at this level.
         * This should be the same list of Entities and Associations as are used to
         * generate the CSV templates from the XSD file.
         */
        List<NeutralRecord> records = null;
        for (int iEntity = 0; iEntity < numEntities; iEntity++) {
            records = combiner.getNeutralRecordsFromCollection(entities[iEntity]);

            /**
             * Currently, we are just writing out the neutral record for debugging purposes.
             * TA2167 is the requirement to integrate this with our existing ingestion framework
             * and probably marries up here.
             */
            for (Iterator<NeutralRecord> it = records.iterator(); it.hasNext();) {
                PRINT_STREAM.println(it.next());
            }
        }

        for (int iAssociation = 0; iAssociation < numAssociations; iAssociation++) {
            records = combiner.getNeutralRecordsFromCollection(associations[iAssociation]);

            /**
             * Currently, we are just writing out the neutral record for debugging purposes.
             * TA2167 is the requirement to integrate this with our existing ingestion framework
             * and probably marries up here.
             */
            for (Iterator<NeutralRecord> it = records.iterator(); it.hasNext();) {
                PRINT_STREAM.println(it.next());
            }
        }

    }
}


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

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetSlotTypeVersionsResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one for
     * the $LATEST version.
     *

     */
    private java.util.List<SlotTypeMetadata> slotTypes;
    /**
     *

     * A pagination token for fetching the next page of slot type versions. If the response to this call is truncated,
     * Amazon Lex returns a pagination token in the response. To fetch the next page of versions, specify the pagination
     * token in the next request.
     *

     */
    private String nextToken;

    /**
     *

     * An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one for
     * the $LATEST version.
     *

     *
     * @return An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus
     *         one for the $LATEST version.
     */

    public java.util.List<SlotTypeMetadata> getSlotTypes() {
        return slotTypes;
    }

    /**
     *

     * An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one for
     * the $LATEST version.
     *

     *
     * @param slotTypes
     *        An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one
     *        for the $LATEST version.
     */

    public void setSlotTypes(java.util.Collection<SlotTypeMetadata> slotTypes) {
        if (slotTypes == null) {
            this.slotTypes = null;
            return;
        }

        this.slotTypes = new java.util.ArrayList<SlotTypeMetadata>(slotTypes);
    }

    /**
     *

     * An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one for
     * the $LATEST version.
     *

     *

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

     *
     * @param slotTypes
     *        An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one
     *        for the $LATEST version.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetSlotTypeVersionsResult withSlotTypes(SlotTypeMetadata... slotTypes) {
        if (this.slotTypes == null) {
            setSlotTypes(new java.util.ArrayList<SlotTypeMetadata>(slotTypes.length));
        }
        for (SlotTypeMetadata ele : slotTypes) {
            this.slotTypes.add(ele);
        }
        return this;
    }

    /**
     *

     * An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one for
     * the $LATEST version.
     *

     *
     * @param slotTypes
     *        An array of SlotTypeMetadata objects, one for each numbered version of the slot type plus one
     *        for the $LATEST version.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetSlotTypeVersionsResult withSlotTypes(java.util.Collection<SlotTypeMetadata> slotTypes) {
        setSlotTypes(slotTypes);
        return this;
    }

    /**
     *

     * A pagination token for fetching the next page of slot type versions. If the response to this call is truncated,
     * Amazon Lex returns a pagination token in the response. To fetch the next page of versions, specify the pagination
     * token in the next request.
     *

     *
     * @param nextToken
     *        A pagination token for fetching the next page of slot type versions. If the response to this call is
     *        truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of versions,
     *        specify the pagination token in the next request.
     */

    public void setNextToken(String nextToken) {
        this.nextToken = nextToken;
    }

    /**
     *

     * A pagination token for fetching the next page of slot type versions. If the response to this call is truncated,
     * Amazon Lex returns a pagination token in the response. To fetch the next page of versions, specify the pagination
     * token in the next request.
     *

     *
     * @return A pagination token for fetching the next page of slot type versions. If the response to this call is
     *         truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of versions,
     *         specify the pagination token in the next request.
     */

    public String getNextToken() {
        return this.nextToken;
    }

    /**
     *

     * A pagination token for fetching the next page of slot type versions. If the response to this call is truncated,
     * Amazon Lex returns a pagination token in the response. To fetch the next page of versions, specify the pagination
     * token in the next request.
     *

     *
     * @param nextToken
     *        A pagination token for fetching the next page of slot type versions. If the response to this call is
     *        truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of versions,
     *        specify the pagination token in the next request.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetSlotTypeVersionsResult withNextToken(String nextToken) {
        setNextToken(nextToken);
        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 (getSlotTypes() != null)
            sb.append("SlotTypes: ").append(getSlotTypes()).append(",");
        if (getNextToken() != null)
            sb.append("NextToken: ").append(getNextToken());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof GetSlotTypeVersionsResult == false)
            return false;
        GetSlotTypeVersionsResult other = (GetSlotTypeVersionsResult) obj;
        if (other.getSlotTypes() == null ^ this.getSlotTypes() == null)
            return false;
        if (other.getSlotTypes() != null && other.getSlotTypes().equals(this.getSlotTypes()) == false)
            return false;
        if (other.getNextToken() == null ^ this.getNextToken() == null)
            return false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getSlotTypes() == null) ? 0 : getSlotTypes().hashCode());
        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
        return hashCode;
    }

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

}


text:
package org.headlessintrace.client.connection;

public class DisconnectionException extends RuntimeException {

	private String m_message;

	public DisconnectionException(String disconnectionMessage) {
		m_message = disconnectionMessage;
	}
	@Override public String getMessage() {
		return m_message;
	}

}


text:
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#if ARFOUNDATION_PRESENT
using UnityEngine.SpatialTracking;
#endif // ARFOUNDATION_PRESENT

namespace Microsoft.MixedReality.Toolkit.Experimental.UnityAR
{
    /// <summary>
    /// Class that performs conversions between Unity's AR enum values and the provider's
    /// custom enums.
    /// </summary>
    public static class ArEnumConversion
    {
#if ARFOUNDATION_PRESENT
        /// <summary>
        /// Converts from an <see cref="ArTrackedPose"/> to a Unity tracked pose value.
        /// </summary>
        /// <param name="pose">Value to convert.</param>
        /// <returns>
        /// Unity tracked pose equivalent of the <see cref="ArTrackedPose"/>.
        /// </returns>
        public static TrackedPoseDriver.TrackedPose ToUnityTrackedPose(ArTrackedPose pose)
        {
            switch (pose)
            {
                case ArTrackedPose.Center:
                    return TrackedPoseDriver.TrackedPose.Center;
                case ArTrackedPose.ColorCamera:
                    return TrackedPoseDriver.TrackedPose.ColorCamera;
                case ArTrackedPose.Head:
                    return TrackedPoseDriver.TrackedPose.Head;
                case ArTrackedPose.LeftEye:
                    return TrackedPoseDriver.TrackedPose.LeftEye;
                case ArTrackedPose.LeftPose:
                    return TrackedPoseDriver.TrackedPose.LeftPose;
                case ArTrackedPose.RightEye:
                    return TrackedPoseDriver.TrackedPose.RightEye;
                case ArTrackedPose.RightPose:
                    return TrackedPoseDriver.TrackedPose.RightPose;
                default:
                    // Unknown pose, pass the value through.
                    return (TrackedPoseDriver.TrackedPose)((int)pose);
            }
        }

        /// <summary>
        /// Converts from an <see cref="ArTrackingType"/> to a Unity tracking type value.
        /// </summary>
        /// <param name="trackingType">Value to convert.</param>
        /// <returns>
        /// Unity tracking type equivalent of the <see cref="ArTrackingType"/>.
        /// </returns>
        public static TrackedPoseDriver.TrackingType ToUnityTrackingType(ArTrackingType trackingType)
        {
            switch (trackingType)
            {
                case ArTrackingType.Position:
                    return TrackedPoseDriver.TrackingType.PositionOnly;
                case ArTrackingType.Rotation:
                    return TrackedPoseDriver.TrackingType.RotationOnly;
                case ArTrackingType.RotationAndPosition:
                    return TrackedPoseDriver.TrackingType.RotationAndPosition;
                default:
                    // Unknown type, pass the value through.
                    return (TrackedPoseDriver.TrackingType)((int)trackingType);
            }
        }

        /// <summary>
        /// Converts from an <see cref="ArUpdateType"/> to a Unity update type value.
        /// </summary>
        /// <param name="updateType">Value to convert.</param>
        /// <returns>
        /// Unity update type equivalent of the <see cref="ArUpdateType"/>.
        /// </returns>
        public static TrackedPoseDriver.UpdateType ToUnityUpdateType(ArUpdateType updateType)
        {
            switch (updateType)
            {
                case ArUpdateType.BeforeRender:
                    return TrackedPoseDriver.UpdateType.BeforeRender;
                case ArUpdateType.Update:
                    return TrackedPoseDriver.UpdateType.Update;
                case ArUpdateType.UpdateAndBeforeRender:
                    return TrackedPoseDriver.UpdateType.UpdateAndBeforeRender;
                default:
                    // Unknown type, pass the value through.
                    return (TrackedPoseDriver.UpdateType)((int)updateType);
            }
        }
#endif // ARFOUNDATION_PRESENT
    }
}