text:
import { connect } from 'react-redux';
import React from 'react';
import {  Field, reduxForm } from 'redux-form';

import AdminApi from '../../api/AdminApi';
import { Breadcrumb } from "../Shared/Shared";
import  {renderField, renderSelectField, renderDropzoneInput} from "../Shared/renderReduxForm";

class AddUserPage extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			upload:0,
			errorMessage: "",
			success: false
		};
		this.handleFormSubmit = this.handleFormSubmit.bind(this);
		this.renderAlert = this.renderAlert.bind(this);
		this.fileProgress = this.fileProgress.bind(this);
	}
	handleFormSubmit(values) {
		let FileUploadProgress = (p) => this.fileProgress(p);
		let formData = new FormData();
		formData.append('password', values.password);
		formData.append('email', values.email);
		formData.append('username', values.username);
		formData.append('accessRight', values.accessRight);
		if (values.picture){
			formData.append('upload_picture', values.picture[0]);
		}
		this.setState({upload: 1});

		AdminApi.addUser(formData, FileUploadProgress)
		.then( e => {
			this.setState({	upload: 0, errorMessage:"", success: true});
		}).catch(error => {
			this.setState({	upload: 0, errorMessage: "Process Fail, Error Message: " + error.err, success: false});
		});
	}
	fileProgress(progressEvent) {
		let percentCompleted = Math.round( (progressEvent.loaded * 100) / progressEvent.total );
		this.setState({upload: percentCompleted});
	}
	renderAlert() {
		if (this.state.errorMessage || this.state.success) {
			return (
				<div className={`alert ${this.state.success?"alert-success":"alert-danger"}`}>
				{this.state.success?"Success !!":(
Oops! { this.state.errorMessage} !!
)}

			);
		}
	}
  render() {
    const { handleSubmit, pristine, submitting } = this.props;

    return (

			<Breadcrumb linkPair={[{link:"/home", desc:"Home"},	{link:"/admin/productChange/0", desc:"Administration"},
																	{link:"/admin/addUser", desc:"Add User"}]} />

Add User

						<form onSubmit={handleSubmit(this.handleFormSubmit)}>

								<Field name="picture" component={renderDropzoneInput} label="Add a picture"/>
								<Field name="username" component={renderField} type="text" label="User Name"/>

								<Field name="email" component={renderField} type="email" label="E-Mail" require={true}/>
								<Field name="password" component={renderField} type="password" label="Password"  require={true}/>
								<Field name="passwordConfirm" component={renderField} type="password" label="Confirm Password" require={true}/>
								<Field name="accessRight" component={renderSelectField}  label="User Type"
										options={[{value:"0", text:"Normal User"}, {value:"8", text:"Administrator"}]} />

								{this.renderAlert()}

									<button type="submit" disabled={pristine || submitting} className="btn btn-warning submit-btn">Submit</button>

						</form>

	);}
}

const validate = values => {
	const errors = {};
	if (!values.email) {
		errors.email = 'Required';
	} else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) {
		errors.email = 'Invalid email address';
	}

	if (!values.password) {
		errors.password = 'Please enter a password';
	}

	if (!values.passwordConfirm) {
		errors.passwordConfirm = 'Please enter a password confirmation';
	}

	if (values.password !== values.passwordConfirm) {
		errors.password = 'Passwords must match';
	}
	return errors;
};

AddUserPage.propTypes = {
	handleSubmit: React.PropTypes.func.isRequired,
	submitting: React.PropTypes.bool.isRequired,
	pristine: React.PropTypes.bool.isRequired,
};

export default reduxForm({
  form: 'adduser',
  validate,                // <--- validation function given to redux-form
})(AddUserPage);


text:
<?php

namespace Zettacast\Support;

trait ArrayAccessTrait
{
	/**
	 * Accesses data in object using array notation.
	 * @param mixed $offset Offset to access.
	 * @return mixed Offset value.
	 */
	final public function offsetGet($offset)
	{
		return $this->get($offset);
	}

	/**
	 * Checks whether an offset exists in the object.
	 * @param mixed $offset Offset to check existance.
	 * @return bool Does the offset exist?
	 */
	final public function offsetExists($offset): bool
	{
		return $this->has($offset);
	}

	/**
	 * Sets data in object using array notation.
	 * @param mixed $offset Offset to create or update.
	 * @param mixed $value Data to save.
	 */
	final public function offsetSet($offset, $value): void
	{
		$this->set($offset, $value);
	}

	/**
	 * Deletes data from the object using array notation.
	 * @param mixed $offset Offset to erase.
	 */
	final public function offsetUnset($offset): void
	{
		$this->del($offset);
	}

	/**
	 * Gets an element stored in object.
	 * @param mixed $key Key of requested element.
	 * @return mixed Requested element or default fallback.
	 */
	abstract public function get($key);

	/**
	 * Checks whether element key exists.
	 * @param mixed $key Key to check existance.
	 * @return bool Does key exist?
	 */
	abstract public function has($key): bool;

	/**
	 * Sets a value to given key.
	 * @param mixed $key Key to create or update.
	 * @param mixed $value Value to store in key.
	 */
	abstract public function set($key, $value): void;

	/**
	 * Deletes an element from object.
	 * @param mixed $key Key to remove.
	 */
	abstract public function del($key): void;
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

app.controller('MainCtrl', ['$scope', '$location', 'auth', 'authorize', 'notifier', function ($scope, $location, auth, authorize, notifier) {
    $scope.authorize = authorize;

    $scope.logout = function () {
        auth.logout()
            .then(function () {
                authorize.removeUser();
                notifier.notifySuccess('Logout successful');
                $location.path('/');
            }, function (err) {
                notifier.notifyError('Logout error: ' + JSON.stringify(err.data), {isSticky: true});
            });
    };

    $scope.$on('$routeChangeError', function (event, current, previous, params) {
        if (params.error) {
            notifier.notifyError(params.error, {isSticky: true});
        }
    });

    $scope.$on('$routeChangeSuccess', function (event, params) {
        if (params.locals.middlewares) {
            notifier.notifySuccess(params.locals.middlewares.success);
        }
    });

    $scope.error = function error(err, message) {
        message = message || '';
        if (err.data) {
            for (var i = 0, length = err.data.errors.length; i < length; i += 1) {
                message += err.data.errors[i] + '<br/>';
            }
            notifier.notifyError(message, {isSticky: true});
        } else {
            notifier.notifyError('Internet Connection Error. Server not responding! Check the internet connection and try again later.', {isSticky: true});
        }
    }
}]);


text:
rm -rf lib/

mkdir lib
nvcc -c linear_recurrence.cu -o lib/linear_recurrence.o -O3 --compiler-options '-fPIC'
nvcc lib/linear_recurrence.o -shared -o lib/liblinear_recurrence.so --compiler-options '-fPIC'

# building tensorflow op
export TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
g++ -std=c++11 -shared -o lib/tf_linear_recurrence.so linear_recurrent_net/tensorflow_binding/linear_recurrence_op.cpp lib/linear_recurrence.o -O3 -I $TF_INC -fPIC -lcudart


text:
<?php

use Openbizx\Openbizx;
use Openbizx\Easy\EasyForm;

class MenuForm extends EasyForm
{

    private $_parents = array();
    private $_directParentId = "";

    public function loadStatefullVars($sessCtxt)
    {
        $sessCtxt->loadObjVar($this->objectName, "DirectParent", $this->_directParentId);
        parent::loadStatefullVars($sessCtxt);
    }

    public function saveStatefullVars($sessCtxt)
    {
        $sessCtxt->saveObjVar($this->objectName, "DirectParent", $this->_directParentId);
        parent::saveStatefullVars($sessCtxt);
    }

    public function validateRequest($methodName)
    {
        $methodName = strtolower($methodName);
        if ($methodName == "listchildren")
            return true;
        return parent::validateRequest($methodName);
    }

    /**
     * Render all children records of a given record
     * @param string $id id value
     * @return void
     */
    public function ListChildren($id = '')
    {
        $this->GetParents($id);
        $this->searchRule = "[PId] = '$id'";
        $this->searchRuleBindValues = "";
        $this->clearSearchRule = true;
        return $this->rerender();
    }

    public function render()
    {

        $this->GetParents($this->_directParentId);
        $this->searchRule = "[PId] = '" . $this->_directParentId . "'";
        $this->searchRuleBindValues = "";
        $this->clearSearchRule = true;

        return parent::render();
    }

    protected function GetParents($id)
    {
        $pathArray = array();
        $this->_directParentId = $id;
        $this->fetchNodePath("[Id]='$id'", $pathArray);
        $this->_parents = $pathArray;
    }

    protected function fetchNodePath($nodeSearchRule, &$pathArray)
    {
        $recordList = $this->getDataObj()->directFetch($nodeSearchRule);
        if (count($recordList) >= 1) {

            if ($recordList[0]['PId'] != '' && $recordList[0]['PId'] != '0') {
                $searchRule = "[Id]='" . $recordList[0]['PId'] . "'";
                $this->fetchNodePath($searchRule, $pathArray);
            }
            //$node = new MenuRecord($recordList[0]);
            array_push($pathArray, $recordList[0]);
            return $pathArray;
        }
    }

    public function outputAttrs()
    {
        $output = parent::outputAttrs();
        if ($this->_directParentId && count($this->_parents) == 0)
            $this->GetParents($this->_directParentId);
        $output['parents'] = $this->_parents;
        return $output;
    }

    /**
     * Create a new record by setting correct parent id
     * @return avoid
     */
    public function newRecord()
    {
        $this->SetDisplayMode(MODE_N);
        $recArr = $this->getDataObj()->newRecord();
        if (!$recArr) {
            return $this->processDataObjError();
        }
        // add correct pid
        $recArr['PId'] = $this->_directParentId;
        $this->UpdateActiveRecord($recArr);
        return $this->rerender();
    }

    /**
     * DeleteRecord() - allow delete only if no child node
     * @return avoid
     */
    public function deleteRecord()
    {
        $rec = $this->getActiveRecord();
        if (!$rec)
            return;
        $id = $rec['Id'];
        $recordList = $this->getDataObj()->directFetch("[PId]='$id'");
        if (count($recordList) > 0) {
            $errorMsg = "Unable to delete the record that has 1 or more children nodes.";
            Openbizx::$app->getClientProxy()->showErrorMessage($errorMsg);
            return;
        }
        return parent::deleteRecord();
    }

}


text:
using Lucene.Net.Randomized.Generators;
using Lucene.Net.Support;
using System;
using NUnit.Framework;

namespace Lucene.Net.Index
{
    using Directory = Lucene.Net.Store.Directory;
    using Document = Documents.Document;
    using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;

    using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
    using TestUtil = Lucene.Net.Util.TestUtil;

    /// <summary>
    /// Base test case for <seealso cref="MergePolicy"/>.
    /// </summary>
    public abstract class BaseMergePolicyTestCase : LuceneTestCase
    {
        /// <summary>
        /// Create a new <seealso cref="MergePolicy"/> instance. </summary>
        protected internal abstract MergePolicy MergePolicy();

        [Test]
        public virtual void TestForceMergeNotNeeded()
        {
            Directory dir = NewDirectory();
            AtomicBoolean mayMerge = new AtomicBoolean(true);
            MergeScheduler mergeScheduler = new SerialMergeSchedulerAnonymousInnerClassHelper(this, mayMerge);
            IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(mergeScheduler).SetMergePolicy(MergePolicy()));
            writer.Config.MergePolicy.NoCFSRatio = Random().NextBoolean() ? 0 : 1;
            int numSegments = TestUtil.NextInt(Random(), 2, 20);
            for (int i = 0; i < numSegments; ++i)
            {
                int numDocs = TestUtil.NextInt(Random(), 1, 5);
                for (int j = 0; j < numDocs; ++j)
                {
                    writer.AddDocument(new Document());
                }
                writer.Reader.Dispose();
            }
            for (int i = 5; i >= 0; --i)
            {
                int segmentCount = writer.SegmentCount;
                int maxNumSegments = i == 0 ? 1 : TestUtil.NextInt(Random(), 1, 10);
                mayMerge.Set(segmentCount > maxNumSegments);
                writer.ForceMerge(maxNumSegments);
            }
            writer.Dispose();
            dir.Dispose();
        }

        private class SerialMergeSchedulerAnonymousInnerClassHelper : SerialMergeScheduler
        {
            private readonly BaseMergePolicyTestCase OuterInstance;

            private AtomicBoolean MayMerge;

            public SerialMergeSchedulerAnonymousInnerClassHelper(BaseMergePolicyTestCase outerInstance, AtomicBoolean mayMerge)
            {
                this.OuterInstance = outerInstance;
                this.MayMerge = mayMerge;
            }

            public override void Merge(IndexWriter writer, MergeTrigger trigger, bool newMergesFound)
            {
                lock (this)
                {
                    if (!MayMerge.Get() && writer.NextMerge != null)
                    {
                        throw new InvalidOperationException();
                    }
                    base.Merge(writer, trigger, newMergesFound);
                }
            }
        }
    }
}


text:
#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_ARGUMENT_H_
#define TENSORFLOW_COMPILER_TF2XLA_XLA_ARGUMENT_H_

#include "absl/types/optional.h"
#include "absl/types/span.h"
#include "tensorflow/compiler/tf2xla/host_compute_metadata.pb.h"
#include "tensorflow/compiler/tf2xla/xla_resource.h"
#include "tensorflow/compiler/xla/client/xla_builder.h"
#include "tensorflow/compiler/xla/service/hlo_sharding.h"
#include "tensorflow/core/framework/tensor.h"

namespace tensorflow {

// Describes how to derive the value of each _Arg node in the graph/function
// being compiled. There must be one Argument for each _Arg index.
struct XlaArgument {
  enum Kind {
    // Default value; not a valid kind.
    kInvalid,

    // Argument is a compile-time constant. No associated runtime parameter.
    kConstant,

    // Argument is a Variable, TensorArray, or Stack resource. Has an
    // associated runtime parameter iff `initialized` is true.
    kResource,

    // A resource variable with a constant value known at compile time.
    kConstantResource,

    // Argument is a run-time parameter.
    kParameter,

    // Argument is an XLA token.
    kToken,

    // Argument is a TensorList.
    kTensorList,
  };

  Kind kind = kInvalid;

  // The type of the argument. If the argument is a resource, this
  // is the type of the variable's value, not DT_RESOURCE.
  DataType type = DT_INVALID;

  // The shape of the argument. For:
  // * a parameter: the shape of the parameter. We allow setting the xla shape
  //   if known. This helps avoid conversions to and from TensorShape.
  // * a constant: ignored; the shape given by constant_value is used
  //     instead.
  // * an uninitialized resource: ignored. We don't yet know the shape of an
  //     uninitialized resource (otherwise we would have initialized it!)
  // * an initialized variable: the shape of the variable's value.
  // * an initialized TensorArray or Stack resource: the shape of an entry in
  //   the TensorArray/Stack. Note this is the size of a single entry, not the
  //   XLA data structure that represents the complete stack/array.
  absl::variant<TensorShape, xla::Shape> shape;

  // The value of the argument, if it is a compile-time constant. Must be a
  // host-memory tensor.
  Tensor constant_value;

  // The upper bounds of the value.
  absl::optional<Tensor> value_bound;

  // Indicates whether each value is dynamic or constant.
  absl::optional<Tensor> value_dynamism;

  // The name of this argument, used for debugging.
  string name;

  // The name of TensorFlow _Arg node, used for debugging.
  string node_name;

  // For a kResource, what kind of resource is it?
  XlaResource::Kind resource_kind = XlaResource::kInvalid;

  // For a kResource, has this resource been initialized?
  bool initialized = false;

  // For a kResource, is this resource on Fast Memory.
  bool fast_mem = false;

  // For a TensorArray or Stack resource, what is the array's declared size?
  // (Used for lazy initialization.)
  int64 max_array_size = -1;

  // TensorArray resource parameters are passed as (array, gradient array 0,
  // ..., gradient array k), where the gradient arrays are in the same order
  // as `tensor_array_gradients`.
  std::set<string> tensor_array_gradients;

  // Whether this argument will receive the same data across all replicas.
  bool is_same_data_across_replicas = false;

  bool operator==(const XlaArgument& other) const;

  // Returns a human-readable summary of the argument.
  string HumanString() const;

  // Returns the dimension sizes for either TensorShape or xla::Shape.
  std::vector<int64> DimensionSizes() const;
  absl::InlinedVector<int64, 4> DimensionSizesAsInlinedVector() const;

  // Returns the human-readable string for either TensorShape or xla::Shape.
  string ShapeHumanString() const;

  // Whether to broadcast this parameter to all replicas before use.
  // When true, xla_compiler should input/output alias this arg to prevent
  // unnecessary HBM usage.
  bool requires_broadcast = false;
  absl::optional<ManagedStackTrace> definition_stack_trace;
};

// Returns true if any of `args` is an uninitialized resource variable.
bool AnyUninitializedResourceArg(absl::Span<const XlaArgument> args);

}  // end namespace tensorflow

#endif  // TENSORFLOW_COMPILER_TF2XLA_XLA_ARGUMENT_H_


text:
'use strict';

var LoggerFactory = require('./LoggerFactory');

class Log4jsConfigLoggerFactory extends LoggerFactory {
    get (name) {
        return require('log4js-config').get(name);
    }
}

module.exports = Log4jsConfigLoggerFactory;


text:
package org.omg.IOP;

/**
 *

 * Holds an integer constant of the TAG_ORB_TYPE Component that defines
 * the kind or CORBA implementation of ORB the reference is comming from.
 * This information may be useful to work around problems with that
 * particular ORB, or exploit shared efficiencies. This tag contains
 * a single unsigned long value; these values are managed by OMG group.
 *

 * Anyone may register any ORB types by submitting a one-paragraph
 * description of the ORB type to the OMG, and will receive a new ORB
 * type ID in return. A list of all ORB type descriptions should be
 * available on the OMG web server.
 *

 * TODO Register the GNU Classpath kind of ORB. Not registered at the moment.
 *

 * @see TAG_INTERNET_IOP
 * @see TAG_MULTIPLE_COMPONENTS
 *
 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
 */
public interface TAG_ORB_TYPE
{
  /**
   * Specifies the TAG_ORB_TYPE value, 0.
   */
  int value = 0;
}


text:
package org.activiti.karaf.commands;

import java.io.PrintWriter;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.activiti.engine.HistoryService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.felix.gogo.commands.Argument;
import org.apache.felix.gogo.commands.Command;
import org.apache.felix.gogo.commands.Option;

/**
 * karaf command class that prints the details about the bpmn process inlcuding deployment, definition,
 * instance and process varaible details.
 *
 * @author Srinivasan Chikkala
 */
@Command(scope = "act", name = "info", description = "Provides details about the BPMN process instance")
public class InfoBPMCommand extends BPMCommand {
    private static final Logger LOG = Logger.getLogger(InfoBPMCommand.class.getName());

    @Argument(index = 0, name = "instanceID", description = "Instance ID for which the details should be displayed", required = true, multiValued = false)
    private String instanceID;
    @Option(name = "-v", aliases = "--verbose", description = "Full details of the process instance")
    private boolean verbose;
    @Option(name = "-q", aliases = "--quiet", description = "Show minimun required details of the process instance")
    private boolean quiet;

    private BPMPrintHandler printHandler;

    public boolean isVerbose() {
        return verbose;
    }

    public void setVerbose(boolean verbose) {
        this.verbose = verbose;
    }

    public boolean isQuiet() {
        return quiet;
    }

    public void setQuiet(boolean quiet) {
        this.quiet = quiet;
    }

    public String getInstanceID() {
        return instanceID;
    }

    public void setInstanceID(String instanceID) {
        this.instanceID = instanceID;
    }

    public BPMPrintHandler getPrintHandler() {
        return printHandler;
    }

    public void setPrintHandler(BPMPrintHandler printHandler) {
        this.printHandler = printHandler;
    }

    @Override
    protected Object doExecute() throws Exception {
        Object obj = null;
        try {
            obj = executeCommand();
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            LOG.log(Level.INFO, ex.getMessage(), ex);
        }
        return obj;
    }

    protected Object executeCommand() throws Exception {
        ProcessEngine pe = this.getProcessEngine();
        if (pe == null) {
            System.out.println("Process Engine NOT Found!");
            return null;
        }
        if (this.instanceID == null || this.instanceID.trim().length() == 0) {
            System.out.println("Instance ID required to show the information about the instance");
            return null;
        }

        this.printHandler = this.findBPMPrintHandler();

        printDetails(this.instanceID.trim());
        return null;
    }

    protected BPMPrintHandler findBPMPrintHandler() {
        BPMPrintHandler handler = null;
        List<BPMPrintHandler> hList = null;
        try {
            String filter = null; // add the filter here per process.
            hList = this.getAllServices(BPMPrintHandler.class, filter);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (hList == null || hList.size() == 0) {
            DefaultBPMPrintHandler defHandler = new DefaultBPMPrintHandler();
            defHandler.setProcessEngine(this.getProcessEngine());
            handler = defHandler;
        } else {
            handler = hList.get(0); // first one that matches.
        }
        return handler;
    }

    protected void printDeploymentInfo(Deployment depInfo) {
        LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>();
        nvMap.put("Deployment ID", depInfo.getId());
        nvMap.put("Deployment Name", depInfo.getName());
        nvMap.put("Deployment Time", CmdUtil.UTIL.formatDate(depInfo.getDeploymentTime()));
        CmdUtil.UTIL.printNameValues(new PrintWriter(System.out, true), nvMap);
    }

    protected void printProcessDefinitionInfo(ProcessDefinition pd) {
        LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>();
        nvMap.put("Definition ID", pd.getId());
        nvMap.put("Definition Name", pd.getName());
        nvMap.put("Version", Integer.toString(pd.getVersion()));
        nvMap.put("Resource Name", pd.getResourceName());
        CmdUtil.UTIL.printNameValues(new PrintWriter(System.out, true), nvMap);

    }

    protected void printProcessInstanceInfo(HistoricProcessInstance hpi) {
        LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>();
        nvMap.put("Instance ID", hpi.getId());
        nvMap.put("Start Activity", hpi.getStartActivityId());
        nvMap.put("End Activity", hpi.getEndActivityId());
        nvMap.put("Start Time", CmdUtil.UTIL.formatDate(hpi.getStartTime()));
        nvMap.put("End Time", CmdUtil.UTIL.formatDate(hpi.getEndTime()));
        if (!this.isQuiet()) {
            nvMap.put("Duration", CmdUtil.UTIL.formatDuration(hpi.getDurationInMillis()));
        }

        PrintWriter out = new PrintWriter(System.out, true);
        CmdUtil.UTIL.printNameValues(out, nvMap);
        // print instance data
        this.getPrintHandler().printInstanceData(out, this.isVerbose(), this.isQuiet(), hpi);
    }

    protected void printActivityInstanceInfo(HistoricActivityInstance actInst) {

        LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>();
        nvMap.put("Activity ID", actInst.getActivityId());
        if (!this.isQuiet()) {
            nvMap.put("Activity Type", actInst.getActivityType());
        }
        nvMap.put("Activitiy Name", actInst.getActivityName());
        if (!this.isQuiet()) {
            nvMap.put("Execution ID", actInst.getExecutionId());
        }
        nvMap.put("Start Time", CmdUtil.UTIL.formatDate(actInst.getStartTime()));
        nvMap.put("End Time", CmdUtil.UTIL.formatDate(actInst.getEndTime()));
        if (!this.isQuiet()) {
            nvMap.put("Duration", CmdUtil.UTIL.formatDuration(actInst.getDurationInMillis()));
        }

        PrintWriter out = new PrintWriter(System.out, true);
        CmdUtil.UTIL.printNameValues(out, nvMap);
        // print activity vars
        this.getPrintHandler().printActivityData(out, this.isVerbose(), this.isQuiet(), actInst);
        System.out.println("-------------");
    }

    protected void printDetails(String pid) {
        ProcessEngine pe = this.getProcessEngine();
        RepositoryService repo = pe.getRepositoryService();
        RuntimeService rt = pe.getRuntimeService();
        HistoryService hs = pe.getHistoryService();

        ProcessInstance pi = rt.createProcessInstanceQuery().processInstanceId(pid).singleResult();
        HistoricProcessInstance hpi = hs.createHistoricProcessInstanceQuery().processInstanceId(pid)
                .singleResult();
        if (pi == null && hpi == null) {
            // both null means. no process with that id.
            System.out.printf("No process details found with process id %s \n", pid);
            return;
        }

        String pdId = null;
        if (pi != null) {
            pdId = pi.getProcessDefinitionId();
        } else if (hpi != null) {
            pdId = hpi.getProcessDefinitionId();
        }

        ProcessDefinition pd = repo.createProcessDefinitionQuery().processDefinitionId(pdId).singleResult();
        Deployment depInfo = repo.createDeploymentQuery().deploymentId(pd.getDeploymentId()).singleResult();
        // print
        if (this.isVerbose()) {
            System.out.println("======== Deployment Details");
            printDeploymentInfo(depInfo);
            System.out.println("======== Process Definition Details");
            printProcessDefinitionInfo(pd);
        }

        System.out.println("======== Process Instance Details");
        printProcessInstanceInfo(hpi);

        List<HistoricActivityInstance> actInstList = hs.createHistoricActivityInstanceQuery()
                .processInstanceId(hpi.getId()).orderByHistoricActivityInstanceStartTime().asc().list();
        if (actInstList != null && actInstList.size() > 0) {
            System.out.println("======== Activity Execution Details");
            for (HistoricActivityInstance actInst : actInstList) {
                printActivityInstanceInfo(actInst);
            }
        } else {
            LOG.info("No Activity execution details");
        }
    }

}


text:
goog.require('shaka.asserts.assert');
goog.require('shaka.player.StreamVideoSource');
goog.require('shaka.util.AjaxRequest');
goog.require('shaka.util.EventManager');

describe('Playback', function() {
  var video;
  var player;
  var eventManager;
  var estimator;

  beforeAll(integration.setUp);
  afterAll(integration.tearDown);

  beforeEach(function() {
    // Create a video tag.  This will be visible so that long tests do not
    // create the illusion of the test-runner being hung.
    video = createVideo();
    document.body.appendChild(video);

    player = createPlayer(video);
    eventManager = new shaka.util.EventManager();
  });

  afterEach(function(done) {
    eventManager.destroy();
    eventManager = null;

    player.destroy().then(function() {
      player = null;
      done();
    });

    // Remove the video tag from the DOM.
    document.body.removeChild(video);
  });

  describe('setPlaybackRate', function() {
    it('plays faster for rates above 1', function(done) {
      var timestamp;
      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForMovement(video, eventManager);
      }).then(function() {
        expect(video.currentTime).toBeGreaterThan(0.0);
        timestamp = video.currentTime;
        player.setPlaybackRate(2.0);
        return delay(3.0);
      }).then(function() {
        expect(video.currentTime).toBeGreaterThan(
            timestamp + 6.0 - FUDGE_FACTOR);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('plays in reverse for negative rates', function(done) {
      var timestamp;
      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForTargetTime(video, eventManager, 3.0, 5.0);
      }).then(function() {
        timestamp = video.currentTime;
        player.setPlaybackRate(-1.0);
        return waitForMovement(video, eventManager);
      }).then(function() {
        return delay(2.0);
      }).then(function() {
        expect(video.currentTime).toBeLessThan(timestamp - 2.0 + FUDGE_FACTOR);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('plays in reverse past the buffered area', function(done) {
      var timestamp;
      // Start in the second segment.
      player.setPlaybackStartTime(10);
      player.load(newSource(manifests.plainManifest)).then(function() {
        timestamp = video.currentTime;
        video.play();
        return waitForMovement(video, eventManager);
      }).then(function() {
        expect(video.buffered.length).toBe(1);
        expect(video.buffered.start(0)).toBeGreaterThan(5);
        player.setPlaybackRate(-3.0);
        return waitForMovement(video, eventManager);
      }).then(function() {
        return delay(4.0);
      }).then(function() {
        expect(video.currentTime).toBeLessThan(0.1);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('pauses while rewinding', function(done) {
      var timestamp;
      player.setPlaybackStartTime(45);
      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForTargetTime(video, eventManager, 49, 6);
      }).then(function() {
        player.setPlaybackRate(-1.0);
        return delay(2.0);
      }).then(function() {
        video.pause();
        timestamp = video.currentTime;
        return delay(3.0);
      }).then(function() {
        expect(video.paused).toBe(true);
        expect(video.currentTime).toBe(timestamp);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('does not rewind while paused', function(done) {
      var timestamp;
      player.setPlaybackStartTime(45);
      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForTargetTime(video, eventManager, 49, 6);
      }).then(function() {
        video.pause();
        timestamp = video.currentTime;
        return delay(3.0);
      }).then(function() {
        player.setPlaybackRate(-1.0);
        return delay(2.0);
      }).then(function() {
        expect(video.paused).toBe(true);
        expect(video.currentTime).toBe(timestamp);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('rewinds after pausing', function(done) {
      var timestamp;
      player.setPlaybackStartTime(45);
      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForMovement(video, eventManager);
      }).then(function() {
        player.setPlaybackRate(-1.0);
        return delay(2.0);
      }).then(function() {
        video.pause();
        timestamp = video.currentTime;
        return delay(3.0);
      }).then(function() {
        video.play();
        return delay(2.0);
      }).then(function() {
        expect(video.paused).toBe(false);
        expect(video.currentTime).toBeLessThan(timestamp);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });
  });

  it('plays VP9 WebM', function(done) {
    player.load(newSource(manifests.webmManifest)).then(function() {
      video.play();
      return waitForMovement(video, eventManager);
    }).then(function() {
      expect(video.currentTime).toBeGreaterThan(0.0);
      done();
    }).catch(function(error) {
      fail(error);
      done();
    });
  });

  describe('end-of-stream behavior', function() {
    // The "exact" duration of the content specified by |plainManifest|.
    var plainManifestDuration = 181.43107777777777;

    it('permits looping', function(done) {
      video.loop = true;
      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForMovement(video, eventManager);
      }).then(function() {
        video.currentTime = video.duration - 2;
        return waitFor(30, function() {
          return video.currentTime > 0 && video.currentTime < 5;
        }, function(error) {
          error.message = 'Timeout waiting for loop, currentTime = ' +
                          video.currentTime;
        });
      }).then(function() {
        expect(video.currentTime).toBeGreaterThan(0);
        expect(video.currentTime).toBeLessThan(5);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('permits looping with playbackStartTime', function(done) {
      video.autoplay = true;
      video.loop = true;
      player.setPlaybackStartTime(plainManifestDuration - 1);
      player.load(newSource(manifests.plainManifest)).then(function() {
        // Ensure playback has started near |plainManifestDuration| - 1.
        expect(video.currentTime).toBeGreaterThan(
            plainManifestDuration - 1 - 0.1);
        expect(video.currentTime).toBeLessThan(
            plainManifestDuration - 1 + 0.1);
        return waitFor(30, function() {
          return video.currentTime > 0 && video.currentTime < 5;
        });
      }).then(function() {
        expect(video.currentTime).toBeGreaterThan(0);
        expect(video.currentTime).toBeLessThan(5);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('permits looping without initial buffering', function(done) {
      video.autoplay = true;
      video.loop = true;
      player.load(newSource(manifests.plainManifest)).then(function() {
        // Note: the browser does not immediately set the video's duration.
        video.currentTime = plainManifestDuration;
        return waitFor(30, function() {
          return video.currentTime > 0 && video.currentTime < 5;
        });
      }).then(function() {
        expect(video.currentTime).toBeGreaterThan(0);
        expect(video.currentTime).toBeLessThan(5);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });

    it('permits looping if the playhead is past the duration', function(done) {
      video.loop = true;
      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForMovement(video, eventManager);
      }).then(function() {
        video.currentTime = video.duration + 10;
        return waitFor(30, function() {
          return video.currentTime > 0 && video.currentTime < 5;
        });
      }).then(function() {
        expect(video.currentTime).toBeGreaterThan(0);
        expect(video.currentTime).toBeLessThan(5);
        done();
      }).catch(function(error) {
        fail(error);
        done();
      });
    });
  });

  describe('buffering', function() {
    // Tests that using a streamBufferSize < minBufferTime does not cause
    // the player to hang after re-buffering. Issue #166.
    it('does not stop playback after re-buffering', function(done) {
      // Don't fail from fake errors.
      player.removeEventListener('error', convertErrorToTestFailure, false);
      player.addEventListener(
          'error',
          function(event) {
            if (event.detail.message != 'Fake network failure.') {
              fail(event.detail);
            }
          },
          false);

      // Set the initial streamBufferSize to be less than the default (so we
      // can run the test faster) but larger than minBufferTime (so we don't
      // potentially trigger a separate bug, see the test below).
      player.configure({'streamBufferSize': 8});

      var originalLoad = shaka.player.StreamVideoSource.prototype.load;
      shaka.player.StreamVideoSource.prototype.load = function() {
        expect(this.manifestInfo).not.toBe(null);
        this.manifestInfo.minBufferTime = 2;
        return originalLoad.call(this);
      };

      var originalSend = shaka.util.AjaxRequest.prototype.send;

      player.load(newSource(manifests.plainManifest)).then(function() {
        shaka.player.StreamVideoSource.prototype.load = originalLoad;
        video.play();
        return waitForMovement(video, eventManager);
      }).then(function() {
        player.configure({'streamBufferSize': 2});

        // Start blocking network requests.
        shaka.util.AjaxRequest.prototype.send = function() {
          shaka.asserts.assert(this.xhr_ == null);
          this.xhr_ = new XMLHttpRequest();
          var error = new Error('Fake network failure.');
          error.type = 'net';
          error.status = 0;
          error.url = this.url;
          error.method = this.parameters.method;
          error.body = this.parameters.body;
          error.xhr = this.xhr_;
          this.promise_.reject(error);
          return this.promise_;
        };
        return delay(12);
      }).then(function() {
        // Ensure the player is in a buffering state.
        expect(video.paused).toBe(true);
        // Start allowing network requests again.
        shaka.util.AjaxRequest.prototype.send = originalSend;
        return waitForMovement(video, eventManager);
      }).then(function() {
        expect(video.paused).toBe(false);
        done();
      }).catch(function(error) {
        shaka.player.StreamVideoSource.prototype.load = originalLoad;
        shaka.util.AjaxRequest.prototype.send = originalSend;

        fail(error);
        done();
      });
    });

    // Tests that using a streamBufferSize < minBufferTime does not cause
    // the player to hang during startup. Issue #166.
    it('does not stop playback during startup', function(done) {
      player.configure({'streamBufferSize': 5});

      var originalLoad = shaka.player.StreamVideoSource.prototype.load;
      shaka.player.StreamVideoSource.prototype.load = function() {
        expect(this.manifestInfo).not.toBe(null);
        this.manifestInfo.minBufferTime = 7;
        return originalLoad.call(this);
      };

      player.load(newSource(manifests.plainManifest)).then(function() {
        video.play();
        return waitForMovement(video, eventManager);
      }).then(function() {
        done();
      }).catch(function(error) {
        shaka.player.StreamVideoSource.prototype.load = originalLoad;

        fail(error);
        done();
      });
    });
  });
});