text:
package llsm.interpreters

import java.lang.{Integer, Math}
import java.nio.file.{Files, FileSystems, Path, Paths}
import java.util.{ArrayList, UUID}
import java.util.stream.Collectors

import scala.collection.JavaConverters._

import bdv.export.{ProposeMipmaps, ProgressWriterConsole}
import bdv.export.WriteSequenceToHdf5
import bdv.export.WriteSequenceToHdf5.{AfterEachPlane, DefaultLoopbackHeuristic}
import bdv.img.hdf5.{Hdf5ImageLoader, Partition}
import bdv.spimdata.{
  SequenceDescriptionMinimal,
  SpimDataMinimal,
  XmlIoSpimDataMinimal
}
import cats.{~>, MonadError}
import cats.free.Free
import ch.systemsx.cisd.hdf5.HDF5Factory
import io.scif.{DefaultMetadata, SCIFIO}
import io.scif.config.SCIFIOConfig
import io.scif.codec.CompressionType
import io.scif.img.{ImgSaver, SCIFIOImgPlus}
import io.scif.formats.TIFFFormat
import llsm.Deskew
import llsm.algebras.{
  ImgWriterAPI,
  ImgWriterF,
  LowWriterAPI,
  LowWriterF,
  WriteOMETIFF,
  WriteHDF5,
  WriteError
}
import llsm.formats.OMETIFFCustom
import llsm.fp._
import llsm.io.LLSMImg
import llsm.io.metadata.{FileMetadata, MetadataUtils}
import loci.formats.ome.OMEXMLMetadataImpl
import mpicbg.spim.data.generic.sequence.BasicViewSetup
import mpicbg.spim.data.registration.{ViewRegistration, ViewRegistrations}
import mpicbg.spim.data.sequence.{
  Channel,
  FinalVoxelDimensions,
  TimePoint,
  TimePoints
}
import net.imglib2.FinalDimensions
import net.imglib2.realtransform.AffineTransform3D
import org.scijava.Context

sealed trait LLSMWriterError
case class HDF5Error(message: String, err: Throwable) extends LLSMWriterError

trait ImgWriterInterpreters {

  private[this] def createAffine3D(pw: Double,
                                   ph: Double,
                                   pd: Double): AffineTransform3D = {
    val sourceTransform = new AffineTransform3D
    sourceTransform.set(pw, 0, 0, 0, 0, ph, 0, 0, 0, 0, pd, 0)
    sourceTransform
  }

  def imgWriterInterpreter[M[_]](
      context: Context
  )(
      implicit
      me: MonadError[M, Throwable]
  ): ImgWriterF ~> M =
    new (ImgWriterF ~> M) {
      def apply[B](fa: ImgWriterF[B]): M[B] =
        imgWriterToLowWriterTranslator(fa)
          .foldMap(imgLowWriterInterpreter[M](context))
    }

  val imgWriterToLowWriterTranslator: ImgWriterF ~< LowWriterF =
    new (ImgWriterF ~< LowWriterF) {
      def apply[A](fa: ImgWriterF[A]): Free[LowWriterF, A] =
        fa match {
          case ImgWriterAPI.WriteImg(path, img, next) =>
            if (path.toString.endsWith(".h5"))
              LowWriterAPI.writeHDF5(path, img).map(next)
            else if (path.toString.endsWith(".ome.tif"))
              LowWriterAPI.writeOMETIFF(path, img).map(next)
            else
              LowWriterAPI
                .writeError(new Exception(
                  "Unsupported output format. Only .h5 and .ome.tif are supported at this time."))
                .map(next)
        }
    }

  def imgLowWriterInterpreter[M[_]](context: Context)(
      implicit M: MonadError[M, Throwable]): LowWriterF ~> M =
    new (LowWriterF ~> M) {
      def apply[B](fa: LowWriterF[B]): M[B] =
        fa match {
          case WriteOMETIFF(path,
                            limg @ LLSMImg(img,
                                           fm @ FileMetadata(file,
                                                             wave @ _,
                                                             cam @ _,
                                                             sample @ _,
                                                             config @ _))) => {
            val conf = new SCIFIOConfig()
              .writerSetCompression(CompressionType.LZW.getCompression)
              .imgSaverSetWriteRGB(false)

            val (name, ext) =
              WriterUtils.splitExtension(path.getFileName.toString)
            val outputName = s"${name}_C${file.channel}_T${file.stack}.$ext"
            val outputPath = Paths.get(path.getParent.toString, outputName)

            val scifio = new SCIFIO(context)

            val omexml = new OMEXMLMetadataImpl()
            omexml.setUUID(file.id.toString)
            omexml.setBinaryOnlyMetadataFile(s"${name}.companion.ome")
            omexml.setBinaryOnlyUUID(
              UUID.nameUUIDFromBytes(name.getBytes).toString)

            // Create ImageMetadata
            val imeta = MetadataUtils.createImageMetadata(limg)
            val meta  = new TIFFFormat.Metadata()
            val success = scifio
              .translator()
              .translate(new DefaultMetadata(List(imeta).asJava), meta, false)

            if (success) {
              val writer = new OMETIFFCustom.Writer()
              writer.setContext(context)
              writer.setMetadata(meta)
              writer.setDest(outputPath.toString, 0)
              writer.setOMEXMLMeta(omexml)

              val imgPlus = new SCIFIOImgPlus(img, outputName)

              val saver = new ImgSaver(context)

              M.map(M.catchNonFatal(saver.saveImg(writer, imgPlus, conf)))(
                _ => {
                  val filenameMeta = file.copy(name = outputName)
                  fm.copy(filename = filenameMeta)
                })
            } else
              M.raiseError(
                new Exception(
                  "Unable to translate ImageMetadata to OMEXML metadata."))
          }
          case WriteHDF5(
              path,
              LLSMImg(
                img,
                meta @ FileMetadata(file, wave, cam @ _, sample, config))) =>
            M.catchNonFatal {
              if (!Files.exists(path))
                WriterUtils.createHDF5(path)

              val dims = Array.ofDim[Long](img.numDimensions)
              img.dimensions(dims)
              val size = new FinalDimensions(dims: _*)
              val (units, vw, vh, vd) = (
                "um",
                config.xVoxelSize,
                config.yVoxelSize,
                Deskew.calcZInterval(wave.sPZTInterval,
                                     wave.zPZTInterval,
                                     sample.angle)
              )
              val voxelSize = new FinalVoxelDimensions(units, vw, vh, vd)
              val c: Int    = wave.channels.size
              val t: Int    = wave.nFrames
              val mipmaps = ProposeMipmaps.proposeMipmaps(
                new BasicViewSetup(0, "", size, voxelSize))
              val transform = createAffine3D(vw, vh, vd)
              val channels: Map[Integer, BasicViewSetup] = (0 until c)
                .map(n => {
                  val setup =
                    new BasicViewSetup(n, s"channel ${n + 1}", size, voxelSize)
                  setup.setAttribute(new Channel(n + 1))
                  Integer.valueOf(n) -> setup
                })
                .toMap
              val timePoints: List[TimePoint] =
                (0 until t).map(n => new TimePoint(n)).toList
              val lookback = new DefaultLoopbackHeuristic
              val afterEachPlane = new AfterEachPlane() {
                override def afterEachPlane(usedLoopBack: Boolean): Unit = {}
              }
              val partition = new Partition(
                path.toString,
                timePoints
                  .map(t =>
                    Integer.valueOf(t.getId) -> Integer.valueOf(t.getId))
                  .toMap
                  .asJava,
                channels
                  .map {
                    case (_, c) =>
                      Integer.valueOf(c.getId) -> Integer.valueOf(c.getId)
                  }
                  .toMap
                  .asJava
              )
              val cores = Runtime.getRuntime().availableProcessors()
              val numCellCreatorThreads =
                Math.min(if (cores > 1) cores - 1 else 1, 4)
              val progress = new ProgressWriterConsole

              WriteSequenceToHdf5.writeViewToHdf5PartitionFile(
                img,
                partition,
                file.stack,
                file.channel,
                mipmaps,
                true,
                true,
                lookback,
                afterEachPlane,
                numCellCreatorThreads,
                progress)

              val outputDir = path.getParent
              val name: String =
                s"${WriterUtils.removeExtension(path.getFileName.toString)}.xml"
              val seqPath: Path = Paths.get(outputDir.toString, name)

              WriterUtils.writeSeqDescription(path,
                                              seqPath,
                                              partition,
                                              timePoints,
                                              channels,
                                              transform)

              val filenameMeta = file.copy(name = path.getFileName.toString)
              meta.copy(filename = filenameMeta)
            }
          case WriteError(t) => M.raiseError(t)
        }

    }
}

object WriterUtils {
  def removeExtension(name: String): String = {
    val sepIndex = name.lastIndexOf(".") match {
      case -1 => name.length
      case i  => i
    }

    name.substring(0, sepIndex)
  }

  def splitExtension(name: String): Tuple2[String, String] = {
    if (name.endsWith(".ome.tif")) {
      (name.substring(0, name.lastIndexOf(".ome.tif")), "ome.tif")
    } else {
      val sepIndex = name.lastIndexOf(".") match {
        case -1 => name.length
        case i  => i
      }

      (name.substring(0, sepIndex), name.substring(sepIndex + 1, name.length))
    }
  }

  def outputExists(outputPath: Path): Boolean = {
    val parent: Path = outputPath.getParent
    val (name, _)    = splitExtension(outputPath.toString)
    val matcher      = FileSystems.getDefault().getPathMatcher(s"glob:$name*")
    Files
      .list(parent)
      .collect(Collectors.toList[Path])
      .asScala
      .exists(matcher.matches(_))
  }

  def createHDF5(path: Path): Unit = synchronized {
    if (!Files.exists(path)) {
      val w = HDF5Factory.open(path.toFile)
      w.close()
    }
  }

  def writeSeqDescription(hdf5Path: Path,
                          seqPath: Path,
                          partition: Partition,
                          timepoints: List[TimePoint],
                          channels: Map[Integer, BasicViewSetup],
                          transform: AffineTransform3D): Unit = synchronized {

    val parts = new ArrayList[Partition](List(partition).asJava)

    @SuppressWarnings(Array("org.wartremover.warts.Null"))
    val hdf5Loader = new Hdf5ImageLoader(hdf5Path.toFile, parts, null, false)

    @SuppressWarnings(Array("org.wartremover.warts.Null"))
    val seq = new SequenceDescriptionMinimal(new TimePoints(timepoints.asJava),
                                             channels.asJava,
                                             hdf5Loader,
                                             null)

    val regs: List[ViewRegistration] = for {
      t      <- timepoints
      (i, _) <- channels
    } yield new ViewRegistration(t.getId, i, transform)

    val sdm = new SpimDataMinimal(seqPath.getParent.toFile,
                                  seq,
                                  new ViewRegistrations(regs.asJava))
    val writer = new XmlIoSpimDataMinimal()
    writer.save(sdm, seqPath.toString)
  }
}


text:
const one = new Promise((res, rej) => {
    setTimeout(res, Math.random() * 100);
});
const two = new Promise((res, rej) => {
    setTimeout(res, Math.random() * 100);
});
const three = new Promise((res, rej) => {
    setTimeout(res, Math.random() * 100);
});

Promise.all([one, two, three]).then(() => {
    console.log('Done!');
})

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Fyb\Bundle\AttributeBundle\Controller;

use Sylius\Bundle\AttributeBundle\Controller\AttributeController as BaseAttributeController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Fyb\Component\Attribute\Model\Archetype;
use Fyb\Component\Attribute\Model\Attribute;
use Fyb\Component\Attribute\Model\AttributeWidget;

class AttributeController extends BaseAttributeController
{
    /**
     * @param Request $request
     *
     * @return Response
     */
    public function renderAttributeValueFormsAction(Request $request)
    {
        $attributeRepository = $this->get('sylius.repository.product_attribute');
        $forms = array();

        $choices = ($request->query->has('sylius_product_attribute_choice')) ? $request->query->get('sylius_product_attribute_choice') : array();
        /** @var  $attributes Attribute[] */
        $attributes = $attributeRepository->findBy(array('id' => $choices));
        foreach ($attributes as $attribute) {
            $attributeForm = sprintf('sylius_attribute_type_%s_%s', $attribute->getType(), $attribute->getBackendWidget());
            $options = array(
                'label' => $attribute->getName(),
            );

            $form = $this->get('form.factory')->createNamed('value', $attributeForm, null, $options);
            $forms[$attribute->getId()] = $form->createView();
        }

        return $this->render('FybAttributeBundle::attributeValueForms.html.twig', array('forms' => $forms, 'count' => $request->query->get('count')));
    }

    /**
     * @return Response
     */
    public function renderAttributesAction()
    {
        $form = $this->get('form.factory')->create(
            'sylius_product_attribute_choice',
            null,
            array(
                'expanded' => true,
                'multiple' => true,
            )
        );

        $view = $this->get('request_stack')->getCurrentRequest()->get('widget', 'SyliusAttributeBundle::attributeChoice.html.twig');

        return $this->render($view, array('form' => $form->createView()));
    }

    /**
     * @param Request $request
     * @return Response
     */
    public function renderAttributeWidgetFormsAction(Request $request)
    {
        $attributeRepository = $this->get('sylius.repository.product_attribute');
        /** @var Archetype $archetype */
        $archetype = $this->get('sylius.repository.product_archetype')->find($request->query->get('archetype_parent', 0));
        $forms = array();
        $choices = ($request->query->has('sylius_product_attribute_choice')) ? $request->query->get('sylius_product_attribute_choice') : 0;
        /** @var  $attributes Attribute[] */
        $attributes = $attributeRepository->findBy(array('id' => $choices));

        if ($archetype && !$choices) {
            $attributes  = array_merge($archetype->getAttributes()->toArray(), $attributes);
        }
        foreach ($attributes as $attribute) {
            $attributeWidget = $this->getAttributeWidget($attribute, $archetype);
            $options = array(
                'label' => $attribute->getName(),
            );

            $form = $this->get('form.factory')->createNamed('widgets', 'sylius_product_archetype_attribute_widget', $attributeWidget, $options);
            $forms[$attribute->getId()] = $form->createView();
        }

        return $this->render('FybAttributeBundle::attributeWidgetForms.html.twig', array('forms' => $forms, 'count' => $request->query->get('count')));
    }

    /**
     * @param Attribute $attribute
     * @param Archetype|null $parentArchetype
     * @return AttributeWidget
     */
    private function getAttributeWidget(Attribute $attribute, Archetype $parentArchetype = null)
    {
        $attributeWidget = new AttributeWidget();
        $attributeWidget->setAttribute($attribute);
        $repository = $this->get('fyb.repository.attribte_widget');

        /** @var AttributeWidget $parentAttributeWidget */
        if ($parentAttributeWidget = $repository->getAttributeWidget($attribute, $parentArchetype)) {
            $attributeWidget->setFrontendWidget($parentAttributeWidget->getFrontendWidget());
            $attributeWidget->setBackendWidget($parentAttributeWidget->getBackendWidget());
        } else {
            $attributeWidget->setFrontendWidget($attribute->getFrontendWidget());
            $attributeWidget->setBackendWidget($attribute->getBackendWidget());
        }

        return $attributeWidget;
    }
}


text:
Asciidoctor for Wordpress

## Description

This Plugin is Asciidoc markups plugin for wordpress.

## Installation

1. Upload `asciidoctor-wp` to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress

## Changelog

#### 1.2.1 (2016-03-03)
+ add Without paragraph in the tables cell
+ Fix code

#### 1.2.0 (2016-02-29)
+ add setting of asciidoctor css format
+ Bug fix

#### 1.1.0 (2016-02-23)
+ add setting of asciidoctor image format
+ fix activation hook

#### 1.0.2 (2016-02-22)
Bug fix

#### 1.0 (2016-02-21)
First release version.

## Arbitrary section

#### About basic setting.

This plugin have 2 mode.

1. Individual posts (If you want to set in each posts and pages, Please check here.)
2. All posts (If you want use with "Front end editor" or "wordpress.com", must be check here.)

#### About Extra settings:

1. Use Asciidoctor css format (If you want use Asciidoc css, please check here.)
2. Use Asciidoctor images format (If you want use Asciidoctor images format, please check here.)
3. highlight.js (If you want use highlight.js, please check here.)
4. Without paragraph in the tables cell (If you want without paragraph in the tables cell, please check here.)


text:
// <XAspect>
// XACExtensions.h
//
// Copyright (c) 2015 Xaree Lee (Kang-Yu Lee)
// Released under the MIT license (see below)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#ifndef XAspect_C_Extensions
#define XAspect_C_Extensions

#import <objc/runtime.h>
#import <objc/NSObjCRuntime.h>
#import "XAFoundation.h"
#include <stdio.h>
#include <stdbool.h>

typedef NS_ENUM(NSInteger, XAOriginImpType) {
  XAOriginImpTypeUndetermined,
  XAOriginImpTypeNotExists,
  XAOriginImpTypeExists,
  XAOriginImpTypeExistsInSuperclass,
};

// -----------------------------------------------------------------------------
#pragma mark - C String
// -----------------------------------------------------------------------------
/*
 The prefix 'xace' stands for XAspect C Extensions.
 */

/// Whether a string starts with a specific prefix.
OBJC_EXTERN BOOL xace_isPrefixedCString(const char *str, const char *prefix);

/// Whether a string ends with a specific suffix.
OBJC_EXTERN BOOL xace_isSuffixedCString(const char *str, const char *suffix);

/// @param len If len is 0, return the tail string.
/// @warning You should free the string after using.
OBJC_EXTERN const char *xace_createSubstring(const char* input, size_t offset, size_t len);

/// Return a string which removes the prefix
OBJC_EXTERN const char *xace_prefixRemovedString(const char *str, const char *prefix);

/// @warning You should free the string after using.
OBJC_EXTERN const char *xace_concat(int count, ...);

// -----------------------------------------------------------------------------
#pragma mark - XAspect Prefix
// -----------------------------------------------------------------------------
/// @warning You should free the string after using.
OBJC_EXTERN const char *createAspectMethodPrefix(Class patchClass);

/// @warning You should free the string after using.
OBJC_EXTERN const char *createSupercallerMethodPrefix(Class targetClass);

// -----------------------------------------------------------------------------
#pragma mark - Cleanup
// -----------------------------------------------------------------------------
OBJC_EXTERN void free_methods(Method **methods);
OBJC_EXTERN void free_const_char(const char **str);  // Using as __attribute__((cleanup(free_const_char)))

// -----------------------------------------------------------------------------
#pragma mark - Objc Runtime
// -----------------------------------------------------------------------------
// Method Swizzling
OBJC_EXTERN void makeSelectorChain(Class cls, SEL headSelector, SEL addOnSelector);

OBJC_EXTERN Class classForName(const char *className);

OBJC_EXTERN Class superclassForName(const char *className);

OBJC_EXTERN Class metaclassForName(const char *className);

OBJC_EXTERN XAOriginImpType originImplementationType(Class cls, SEL selector);

// -----------------------------------------------------------------------------
#pragma mark - For Test and Debug
// -----------------------------------------------------------------------------

OBJC_EXTERN void printMethodsForClass(Class cls);

#endif // XAspect_C_Extensions


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace WebQQ.Im.Bean.Discussion
{
    public class DiscussionMember
    {
        [JsonProperty("mem_uin")]
        public long Uin { get; set; }

        [JsonProperty("ruin")]
        public long QQNumber { get; set; }

        public string Nick { get; set; }

        public int ClientType { get; set; }

        public virtual QQStatusType Status { get; set; }
    }
}


text:
using Ets.Mobile.Entities.Signets;
using Ets.Mobile.ViewModel.Content.Main;
using ReactiveUI;
using ReactiveUI.Xaml.Controls.Core;
using System.Collections.Generic;

namespace Ets.Mobile.ViewModel.Contracts.Main
{
    public interface IMainPageViewModel
    {
        ReactivePresenterCommand<ScheduleVm[]> LoadCoursesForToday { get; }
        IReactiveDerivedList<ScheduleVm> Today { get; }
        ReactiveList<ScheduleVm> TodayItems { get; }
        ReactivePresenterCommand<List<GradeSummaryViewModelGroup>> LoadCoursesSummaries { get; }
        IReactiveDerivedList<GradeSummaryViewModelGroup> Grades { get; }
        ReactiveList<GradeSummaryViewModelGroup> GradesItems { get; }

    }
}


text:
#include "microbe/Normalizer.hpp"

namespace microbe {
    Normalizer::Normalizer(const double minInput, const double maxInput, const double minOutput, const double maxOutput)
    {
        this->minInput = minInput;
        this->maxInput = maxInput;

        this->minOutput = minOutput;
        this->maxOutput = maxOutput;
    }

    double Normalizer::normalize(const double value)
    {
        return minOutput + (((value - minInput) / (maxInput - minInput)) * (maxOutput - minOutput));
    }

    std::vector<double> Normalizer::normalize(std::vector<double> values)
    {
        std::vector<double> result;

        for (double value : values) {
            result.push_back(normalize(value));
        }

        return result;
    }
}


text:
module Drudgery
  module Extractors
    class CSVExtractor
      attr_reader :name

      def initialize(filepath, options={})
        @filepath = filepath
        @options = { :headers => true }.merge(options)

        @name = "csv:#{File.basename(@filepath)}"
      end

      def col_sep
        @options[:col_sep]
      end

      def col_sep=(char)
        @options[:col_sep] = char
      end

      def extract
        index = 0

        CSV.foreach(@filepath, @options) do |row|
          yield [row.to_hash, index]

          index += 1
        end
      end

      def record_count
        @record_count ||= calculate_record_count
      end

      private
      def calculate_record_count
        record_count = 0

        extract do |data, index|
          record_count += 1
        end

        record_count
      end
    end
  end
end


text:
describe :array_length, shared: true do
  it "returns the number of elements" do
    [].send(@method).should == 0
    [1, 2, 3].send(@method).should == 3
  end

  it "properly handles recursive arrays" do
    ArraySpecs.empty_recursive_array.send(@method).should == 1
    ArraySpecs.recursive_array.send(@method).should == 8
  end
end


text:
package com.gotwo.parser;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by florian on 03/12/15.
 *
 * A node representing a scope in our program.
 * Scopes consist out of a variable count of statements.
 *
 * Special statements to look for include variable definitions
 * and variable use(to determine local variables) and
 * other scopes that will be sub-scopes.
 */
public class ScopeNode extends Node {
    private Map<String, IntegerDeclaration> integerDeclarations;
    private List<LabelNode> labelNodes;
    private ScopeNode parentScope; //Needed for variable lookup
    private ParsingContext context;
    private List<Node> childNodes;
    private int id;
    private int height;

    public ScopeNode(ScopeNode parentScope, ParsingContext context) {
        super(TYPE.SCOPE);
        this.parentScope = parentScope;
        this.integerDeclarations = new HashMap<>();
        this.context = context;
        this.id = context.getNextScopeId();
        this.childNodes = new ArrayList<>();
        this.labelNodes = new ArrayList<>();

        if(parentScope == null) {
            height = 0;
        } else {
            height = parentScope.getHeight() + 1;
        }
    }

    public boolean addInteger(String name, int value) {
        if(integerDeclarations.containsKey(name)) {
            //We already defined this in the symbol table...
            //Usually only one declaration is allowed
            return false;
        }

        IntegerDeclaration integer = new IntegerDeclaration(name, value, context.getNextIntegerId());
        integerDeclarations.put(name, integer);

        return true;
    }

    public void addChildNode(Node newChild) {
        childNodes.add(newChild);
        if(newChild instanceof LabelNode) {
            labelNodes.add((LabelNode)newChild);
        }
    }

    public void addFirstChildNode(Node newChild) {
        childNodes.add(0, newChild);
        for(Node child : childNodes) {
            if(child instanceof  LabelNode) {
                LabelNode labelNode = (LabelNode)child;
                labelNode.getLabelDeclaration().incrementPosition();
            }
        }
    }

    public List<Node> getChildNodes() {
        return childNodes;
    }
    public Map<String, IntegerDeclaration> getIntegerDeclarations() {
        return integerDeclarations;
    }

    /**
     * For now we do not care too much about the performance.
     * Simply get it implemented for now.
     *
     * @param name The identifier name that we search an integer for.
     * @return The Integer Declaration or NULL if not found.
     */
    public IntegerDeclaration getIntegerDeclaration(String name) {
        IntegerDeclaration integerDeclaration = integerDeclarations.get(name);
        if(integerDeclaration != null) {
            return integerDeclaration;
        }

        if(parentScope == null) {
            return null;
        }

        return parentScope.getIntegerDeclaration(name);
    }

    public IntegerDeclaration getLocalIntegerDeclaration(String name) {
        return integerDeclarations.get(name);
    }

    public int getId() {
        return id;
    }

    public int getHeight() {
        return height;
    }

    public ScopeNode getParentScope() {
        return parentScope;
    }

    //TODO: better hash code and equals implementations
    @Override
    public boolean equals(Object other) {
        if(!other.getClass().equals(this.getClass())) {
            return false;
        }

        ScopeNode otherNode = (ScopeNode) other;

        return otherNode.id == this.id;
    }

    @Override
    public int hashCode() {
        return id;
    }

    public List<LabelNode> getLabelNodes() {
        return labelNodes;
    }
}


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

        <meta content="text/html; charset=UTF-8" http-equiv="content-type">
        <title>FD8 flow accumulation</title>
        <link rel="stylesheet" type="text/css" href="Help.css">

FD8 flow accumulation

This tool is used to generate a flow accumulation grid (i.e. contributing
            area) using the FD8 algorithm (Freeman, 1991). This algorithm is an examples of
            a multiple-flow-direction (MFD) method because the flow entering each grid cell
            is routed to each downslope neighbour, i.e. flow divergence is permitted. The
            user must specify the name of the input digital elevation model(DEM). Notice that
            unlike the other flow-accumulation tools, this tool does not require an input flow-pointer
            grid. The DEM should be hydrologically corrected to remove all spurious depressions
            and flat areas before being input to this tool. DEM pre-processing is usually achieved
            using the Fill Depressions tool. A
            value must also be specified for the exponent parameter, a number
            that controls the degree of dispersion in the resulting flow-accumulation grid.
            A lower value yields greater apparent flow dispersion across divergent
            hillslopes. Some experimentation suggests that a value of 1.1 is appropriate,
            though this is almost certainly landscape-dependent.

In addition to the input DEM grid name and exponent, the user must
            specify the output type. The output flow-accumulation can be 1) specific
            catchment area (SCA), which is the upslope contributing area divided by the
            contour length (taken as the grid resolution), 2) total catchment area in
            square-metres, or 3) the number of upslope grid cells. The user must also
            specify whether the output flow-accumulation grid should be log-tranformed,
            i.e. the output, if this option is selected, will be the natural-logarithm of
            the accumulated area. This is a transformation that is often performed to
            better visualize the contributing area distribution. Because contributing areas
            tend to be very high along valley bottoms and relatively low on hillslopes,
            when a flow-accumulation image is displayed, the distribution of values on
            hillslopes tends to be 'washed out' because the palette is stretched out to
            represent the highest values. Log-transformation provides a means of
            compensating for this phenomenon. Importantly, however, log-transformed
            flow-accumulation grids must not be used to estimate other secondary terrain
            indices, such as the wetness index, or relative stream power index. Perhaps a
            better alternative to log-transformation of flow-accumulation values is to
            increase the 'Palette non-linearity' value under the Layer
                    Properties tab.

The non-dispersive threshold is a flow-accumulation value
            (measured in upslope grid cells, which is directly proportional to area) above
            which flow dispersion is not longer permited. Grid cells with flow-accumulation
            values above this threshold will have their flow routed in a manner that is
            similar to the D8
            single-flow-direction algorithm, directing all flow towards the steepest
            downslope neighbour. This is usually done under the assumption that flow
            dispersion, whilst appropriate on hillslope areas, is not realistic once flow
            becomes channelized.

Grid cells possessing the NoData value in the input
            flow-pointer grid are assigned the NoData value in the output
            flow-accumulation image. The output raster is of the float data type and
            continuous data scale.

See Also:

Other flow modelling tools

FD8 flow pointer (direction)

D8 flow pointer (direction)

Fill depressions

Scripting:

The following is an example of a Python script that uses this tool:

                wd = pluginHost.getWorkingDirectory()

                demFile = wd + "DEM.dep"

                outputFile = wd + "output.dep"

                exponent = "1.0"

                outputType = "specific catchment area (sca)"

                logTransformOutput = "false"

                threshold = "1000"

                args = [demFile, outputFile, exponent, outputType, logTransformOutput, threshold]

                pluginHost.runPlugin("FlowAccumFD8", args, False)

This is a Groovy script also using this tool:

                def wd = pluginHost.getWorkingDirectory()

                def demFile = wd + "DEM.dep"

                def outputFile = wd + "output.dep"

                def exponent = "1.0"

                def outputType = "number of upslope grid cells"

                def logTransformOutput = "true"

                def threshold = "not specified"

                String[] args = [demFile, outputFile, exponent, outputType, logTransformOutput, threshold]

                pluginHost.runPlugin("FlowAccumFD8", args, false)

Credits:

John Lindsay (2012) email: jlindsay@uoguelph.ca


text:
'use strict';

angular.module('xims.incident')
  .controller('IncidentInvestigationNewCtrl', ['$scope', 'IncidentStepsService', 'IncidentService', 'CauseService',
    function($scope, IncidentStepsService, IncidentService, CauseService) {
      $scope.IncidentStepsService = IncidentStepsService;
      $scope.IncidentService = IncidentService;
      $scope.CauseService = CauseService;

      $scope.accidentTypeByNorm = IncidentService.getAccidentTypeByNorm();
      $scope.accidentTypeByLaw = IncidentService.getAccidentTypeByLaw();
      $scope.incident = {
        type: 1,
        subStandardFacts: [
          {}, {}, {}, {}
        ],
        employees:  [
          {id_number: 45996135, name: 'Chris Ramón'},
          {id_number: 55667788, name: 'Luis Rodriguez'},
          {id_number: 99900113, name: 'Carlos Dominguez'}
        ]
      };
      $scope.risks = [
        {
          name: "Caida de personas al mismo nivel",
          color: "#1f77b4",
          y: 4
        },
        {
          name: "Golpes por objetos/herramientas ",
          color: "#aec7e8",
          y: 1
        },
        {
          name: "Contactos térmicos",
          color: "#ff7f0e",
          y: 0
        },
        {
          name: "Atropellos o golpes con vehiculos",
          color: "#ffbb78",
          y: 0
        },
        {
          name: "Colisión de vehiculos",
          color: "#2ca02c",
          y: 2
        }
      ];
      $scope.substandardActs = [
        {id: 1, name: 'Manejo de equipo sin autorización'},
        {id: 2, name: 'Falta de advertencias'},
        {id: 3, name: 'Falta de asegurar'},
        {id: 4, name: 'Manejo a velocidad inadecuada'},
        {id: 5, name: 'Hacer inoperable los instrumentos de seguridad'},
        {id: 6, name: 'Uso de equipo defectuoso'},
        {id: 7, name: 'Uso inapropiado del EPP'},
        {id: 8, name: 'Carga inadecuada'},
        {id: 9, name: 'Almacenamiento inadecuado'},
        {id: 10, name: 'Levantamiento inadecuado'},
        {id: 11, name: 'Posición de tarea inadecuada'},
        {id: 13, name: 'Bromas'},
        {id: 14, name: 'Bajo influencia del alcohol /u otras drogas'},
        {id: 15, name: 'Uso inapropiado del equipo'},
        {id: 16, name: 'No seguir procedimientos'}
      ];

    }]);


text:
template: about
---

			Home

 /

			Groups

 /

			#

 /

			Update

Edit your Group's profile

Update your Group's profile by editing the fields below. Your listing will be live on the site as soon as you click 'Save'

Have a question? Don't see your industry category listed? Let us know via the contact form in the lower right.


text:
/**
 * @file
 * Declares ignite::impl::compute::ComputeJobResult class template.
 */

#ifndef _IGNITE_IMPL_COMPUTE_COMPUTE_JOB_RESULT
#define _IGNITE_IMPL_COMPUTE_COMPUTE_JOB_RESULT

#include <memory>
#include <sstream>

#include <ignite/common/promise.h>
#include <ignite/impl/binary/binary_reader_impl.h>
#include <ignite/impl/binary/binary_writer_impl.h>

namespace ignite
{
    namespace impl
    {
        namespace compute
        {
            struct ComputeJobResultPolicy
            {
                enum Type
                {
                    /**
                    * Wait for results if any are still expected. If all results have been received -
                    * it will start reducing results.
                    */
                    WAIT = 0,

                    /**
                    * Ignore all not yet received results and start reducing results.
                    */
                    REDUCE = 1,

                    /**
                    * Fail-over job to execute on another node.
                    */
                    FAILOVER = 2
                };
            };

            /**
             * Used to hold compute job result.
             */
            template<typename R>
            class ComputeJobResult
            {
            public:
                typedef R ResultType;
                /**
                 * Default constructor.
                 */
                ComputeJobResult() :
                    res(),
                    err()
                {
                    // No-op.
                }

                /**
                 * Set result value.
                 *
                 * @param val Value to set as a result.
                 */
                void SetResult(const ResultType& val)
                {
                    res = val;
                }

                /**
                 * Get result value.
                 *
                 * @return Result.
                 */
                const ResultType& GetResult() const
                {
                    return res;
                }

                /**
                 * Set error.
                 *
                 * @param error Error to set.
                 */
                void SetError(const IgniteError& error)
                {
                    err = error;
                }

                /**
                 * Get error.
                 *
                 * @return Error.
                 */
                const IgniteError& GetError() const
                {
                    return err;
                }

                /**
                 * Set promise to a state which corresponds to result.
                 *
                 * @param promise Promise, which state to set.
                 */
                void SetPromise(common::Promise<ResultType>& promise)
                {
                    if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
                        promise.SetError(err);
                    else
                        promise.SetValue(std::auto_ptr<ResultType>(new ResultType(res)));
                }

                /**
                 * Write using writer.
                 *
                 * @param writer Writer.
                 */
                void Write(binary::BinaryWriterImpl& writer)
                {
                    if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
                    {
                        // Fail
                        writer.WriteBool(false);

                        // Native Exception
                        writer.WriteBool(true);

                        writer.WriteObject<IgniteError>(err);
                    }
                    else
                    {
                        // Success
                        writer.WriteBool(true);

                        writer.WriteObject<ResultType>(res);
                    }
                }

                /**
                 * Read using reader.
                 *
                 * @param reader Reader.
                 */
                void Read(binary::BinaryReaderImpl& reader)
                {
                    bool success = reader.ReadBool();

                    if (success)
                    {
                        res = reader.ReadObject<ResultType>();

                        err = IgniteError();
                    }
                    else
                    {
                        bool native = reader.ReadBool();

                        if (native)
                            err = reader.ReadObject<IgniteError>();
                        else
                        {
                            std::stringstream buf;

                            buf << reader.ReadObject<std::string>() << " : ";
                            buf << reader.ReadObject<std::string>() << ", ";
                            buf << reader.ReadObject<std::string>();

                            std::string msg = buf.str();

                            err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, msg.c_str());
                        }
                    }
                }

            private:
                /** Result. */
                ResultType res;

                /** Erorr. */
                IgniteError err;
            };

            /**
             * Used to hold compute job result.
             */
            template<>
            class ComputeJobResult<void>
            {
            public:
                /**
                 * Default constructor.
                 */
                ComputeJobResult() :
                    err()
                {
                    // No-op.
                }

                /**
                 * Mark as complete.
                 */
                void SetResult()
                {
                    err = IgniteError();
                }

                /**
                 * Set error.
                 *
                 * @param error Error to set.
                 */
                void SetError(const IgniteError error)
                {
                    err = error;
                }

                /**
                 * Get error.
                 *
                 * @return Error.
                 */
                const IgniteError& GetError() const
                {
                    return err;
                }

                /**
                 * Set promise to a state which corresponds to result.
                 *
                 * @param promise Promise, which state to set.
                 */
                void SetPromise(common::Promise<void>& promise)
                {
                    if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
                        promise.SetError(err);
                    else
                        promise.SetValue();
                }

                /**
                 * Write using writer.
                 *
                 * @param writer Writer.
                 */
                void Write(binary::BinaryWriterImpl& writer)
                {
                    if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
                    {
                        // Fail
                        writer.WriteBool(false);

                        // Native Exception
                        writer.WriteBool(true);

                        writer.WriteObject<IgniteError>(err);
                    }
                    else
                    {
                        // Success
                        writer.WriteBool(true);

                        writer.WriteNull();
                    }
                }

                /**
                 * Read using reader.
                 *
                 * @param reader Reader.
                 */
                void Read(binary::BinaryReaderImpl& reader)
                {
                    bool success = reader.ReadBool();

                    if (success)
                        err = IgniteError();
                    else
                    {
                        bool native = reader.ReadBool();

                        if (native)
                            err = reader.ReadObject<IgniteError>();
                        else
                        {
                            std::stringstream buf;

                            buf << reader.ReadObject<std::string>() << " : ";
                            buf << reader.ReadObject<std::string>() << ", ";
                            buf << reader.ReadObject<std::string>();

                            std::string msg = buf.str();

                            err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, msg.c_str());
                        }
                    }
                }

            private:
                /** Erorr. */
                IgniteError err;
            };
        }
    }
}

#endif //_IGNITE_IMPL_COMPUTE_COMPUTE_JOB_RESULT


text:
require 'honeybadger/cli/deploy'
require 'honeybadger/cli/exec'
require 'honeybadger/cli/heroku'
require 'honeybadger/cli/install'
require 'honeybadger/cli/notify'
require 'honeybadger/cli/test'
require 'honeybadger/config'
require 'honeybadger/config/defaults'
require 'honeybadger/ruby'
require 'honeybadger/util/http'
require 'honeybadger/version'
require 'logger'

module Honeybadger
  module CLI
    BLANK = /\A\s*\z/

    NOTIFIER = {
      name: 'honeybadger-ruby (cli)'.freeze,
      url: 'https://github.com/honeybadger-io/honeybadger-ruby'.freeze,
      version: VERSION,
      language: nil
    }.freeze

    class Main < Thor
      def self.project_options
        option :api_key,         required: false, aliases: :'-k', type: :string, desc: 'Api key of your Honeybadger application'
        option :environment,     required: false, aliases: [:'-e', :'-env'], type: :string, desc: 'Environment this command is being executed in (i.e. "production", "staging")'
        option :skip_rails_load, required: false, type: :boolean, desc: 'Flag to skip rails initialization'
      end

      def help(*args, &block)
        if args.size == 0
          say(<<-WELCOME)
⚡  Honeybadger v#{VERSION}

Honeybadger is your favorite error tracker for Ruby. When your app raises an
exception we notify you with all the context you need to fix it.

The Honeybadger CLI provides tools for interacting with Honeybadger via the
command line.

If you need support, please drop us a line: support@honeybadger.io

WELCOME
        end
        super
      end

      desc 'install API_KEY', 'Install Honeybadger into a new project'
      def install(api_key)
        Install.new(options, api_key).run
      rescue => e
        log_error(e)
        exit(1)
      end

      desc 'test', 'Send a test notification from Honeybadger'
      option :dry_run, type: :boolean, aliases: :'-d', default: false, desc: 'Skip sending data to Honeybadger'
      option :file,    type: :string,  aliases: :'-f', default: nil, desc: 'Write the output to FILE'
      def test
        Test.new(options).run
      rescue => e
        log_error(e)
        exit(1)
      end

      desc 'deploy', 'Notify Honeybadger of deployment'
      project_options
      option :repository, required: true, type: :string, aliases: :'-r', desc: 'The address of your repository'
      option :revision,   required: true, type: :string, aliases: :'-s', desc: 'The revision/sha that is being deployed'
      option :user,       required: true, type: :string, aliases: :'-u', default: ENV['USER'] || ENV['USERNAME'], desc: 'The local user who is deploying'
      def deploy
        config = build_config(options)

        if config.get(:api_key).to_s =~ BLANK
          say("No value provided for required options '--api-key'")
          exit(1)
        end

        Deploy.new(options, [], config).run
      rescue => e
        log_error(e)
        exit(1)
      end

      desc 'notify', 'Notify Honeybadger of an error'
      project_options
      option :class,       required: true, type: :string, aliases: :'-c', default: 'CLI Notification', desc: 'The class name of the error. (Default: CLI Notification)'
      option :message,     required: true, type: :string, aliases: :'-m', desc: 'The error message.'
      option :action,      required: false, type: :string, aliases: :'-a', desc: 'The action.'
      option :component,   required: false, type: :string, aliases: :'-C', desc: 'The component.'
      option :fingerprint, required: false, type: :string, aliases: :'-f', desc: 'The fingerprint.'
      option :tags,        required: false, type: :string, aliases: :'-t', desc: 'The tags.'
      option :url,         required: false, type: :string, aliases: :'-u', desc: 'The URL.'
      def notify
        config = build_config(options)

        if config.get(:api_key).to_s =~ BLANK
          say("No value provided for required options '--api-key'")
          exit(1)
        end

        Notify.new(options, [], config).run
      rescue => e
        log_error(e)
        exit(1)
      end

      desc 'exec', 'Execute a command. If the exit status is not 0, report the result to Honeybadger'
      project_options
      option :quiet, required: false, type: :boolean, aliases: :'-q', default: false, desc: 'Suppress all output unless notification fails.'
      def exec(*args)
        if args.size == 0
          say("honeybadger: exec needs a command to run", :red)
          exit(1)
        end

        config = build_config(options)

        if config.get(:api_key).to_s =~ BLANK
          say("No value provided for required options '--api-key'", :red)
          exit(1)
        end

        Exec.new(options, args, config).run
      rescue => e
        log_error(e)
        exit(1)
      end

      desc 'heroku SUBCOMMAND ...ARGS', 'Manage Honeybadger on Heroku'
      subcommand 'heroku', Heroku

      private

      def fetch_value(options, key)
        options[key] == key ? nil : options[key]
      end

      def build_config(options)
        load_env(options)

        config = Honeybadger.config
        config.set(:report_data, true)
        config.set(:api_key, fetch_value(options, 'api_key')) if options.has_key?('api_key')
        config.set(:env, fetch_value(options, 'environment')) if options.has_key?('environment')

        config
      end

      def load_env(options)
        # Initialize Rails when running from Rails root.
        environment_rb = File.join(Dir.pwd, 'config', 'environment.rb')
        if File.exist?(environment_rb)
          load_rails_env_if_allowed(environment_rb, options)
        end
        # Ensure config is loaded (will be skipped if initialized by Rails).
        Honeybadger.config.load!
      end

      def load_rails_env_if_allowed(environment_rb, options)
        # Skip Rails initialization according to option flag
        if options.has_key?('skip_rails_load') && fetch_value(options, 'skip_rails_load')
          say("Skipping Rails initialization.")
        else
          load_rails_env(environment_rb)
        end
      end

      def load_rails_env(environment_rb)
        begin
          require 'rails'
        rescue LoadError
          # No Rails, so skip loading Rails environment.
          return
        end
        require environment_rb
      end

      def log_error(e)
        case e
        when *Util::HTTP::ERRORS
          say(<<-MSG, :red)
!! --- Failed to notify Honeybadger ------------------------------------------- !!

# What happened?

  We encountered an HTTP error while contacting our service. Issues like this are
  usually temporary.

# Error details

  #{e.class}: #{e.message}\n    at #{e.backtrace && e.backtrace.first}

# What can I do?

  - Retry the command.
  - Make sure you can connect to api.honeybadger.io (`curl https://api.honeybadger.io/v1/notices`).
  - If you continue to see this message, email us at support@honeybadger.io
    (don't forget to attach this output!)

!! --- End -------------------------------------------------------------------- !!
MSG
        else
          say(<<-MSG, :red)
!! --- Honeybadger command failed --------------------------------------------- !!

# What did you try to do?

  You tried to execute the following command:
  `honeybadger #{ARGV.join(' ')}`

# What actually happend?

  We encountered a Ruby exception and were forced to cancel your request.

# Error details

  #{e.class}: #{e.message}
    #{e.backtrace && e.backtrace.join("\n    ")}

# What can I do?

  - If you're calling the `install` or `test` command in a Rails app, make sure
    you can boot the Rails console: `bundle exec rails console`.
  - Retry the command.
  - If you continue to see this message, email us at support@honeybadger.io
    (don't forget to attach this output!)

!! --- End -------------------------------------------------------------------- !!
MSG
        end
      end
    end
  end
end


text:
require "manageable"
require "manageable_content"

module ManageableContentUI
  class Engine < Rails::Engine
  end
end


text:
function Resolve-DbaPath
{
<#
    .SYNOPSIS
        Resolves a path.

    .DESCRIPTION
        Resolves a path.
        Will try to resolve to paths including some basic path validation and resolution.
        Will fail if the path cannot be resolved (so an existing path must be reached at).

    .PARAMETER Path
        The path to validate.

    .PARAMETER Provider
        Ensure the path is of the expected provider.
        Allows ensuring one does not operate in the wrong provider.
        Common providers include the filesystem, the registry or the active directory.

    .PARAMETER SingleItem
        Ensure the path should resolve to a single path only.
        This may - intentionally or not - trip up wildcard paths.

    .PARAMETER NewChild
        Assumes one wishes to create a new child item.
        The parent path will be resolved and must validate true.
        The final leaf will be treated as a leaf item that does not exist yet.

    .EXAMPLE
        PS C:\> Resolve-DbaPath -Path report.log -Provider FileSystem -NewChild -SingleItem

        Ensures the resolved path is a FileSystem path.
        This will resolve to the current folder and the file report.log.
        Will not ensure the file exists or doesn't exist.
        If the current path is in a different provider, it will throw an exception.

    .EXAMPLE
        PS C:\> Resolve-DbaPath -Path ..\*

        This will resolve all items in the parent folder, whatever the current path or drive might be.
#>
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
        [string[]]
        $Path,

        [string]
        $Provider,

        [switch]
        $SingleItem,

        [switch]
        $NewChild
    )

    process
    {
        foreach ($inputPath in $Path)
        {
            if ($inputPath -eq ".")
            {
                $inputPath = (Get-Location).Path
            }
            if ($NewChild)
            {
                $parent = Split-Path -Path $inputPath
                $child = Split-Path -Path $inputPath -Leaf

                try
                {
                    if (-not $parent) { $parentPath = Get-Location -ErrorAction Stop }
                    else { $parentPath = Resolve-Path $parent -ErrorAction Stop }
                }
                catch { Stop-Function -Message "Failed to resolve path" -ErrorRecord $_ -EnableException $true }

                if ($SingleItem -and (($parentPath | Measure-Object).Count -gt 1))
                {
                    Stop-Function -Message "Could not resolve to a single parent path!" -EnableException $true
                }

                if ($Provider -and ($parentPath.Provider.Name -ne $Provider))
                {
                    Stop-Function -Message "Resolved provider is $($parentPath.Provider.Name) when it should be $($Provider)" -EnableException $true
                }

                foreach ($parentItem in $parentPath)
                {
                    Join-Path $parentItem.ProviderPath $child
                }
            }
            else
            {
                try { $resolvedPaths = Resolve-Path $inputPath -ErrorAction Stop }
                catch { Stop-Function -Message "Failed to resolve path" -ErrorRecord $_ -EnableException $true }

                if ($SingleItem -and (($resolvedPaths | Measure-Object).Count -gt 1))
                {
                    Stop-Function -Message "Could not resolve to a single parent path!" -EnableException $true
                }

                if ($Provider -and ($resolvedPaths.Provider.Name -ne $Provider))
                {
                    Stop-Function -Message "Resolved provider is $($resolvedPaths.Provider.Name) when it should be $($Provider)" -EnableException $true
                }

                $resolvedPaths.ProviderPath
            }
        }
    }
}


text:
package com.workingtheory.csf.messaging.jms;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.io.Closeable;
import java.io.IOException;
import java.io.Serializable;

/**
 * This class demonstrates a single-class implementation of simple ActiveMQ message consumers.
 *
 * @param <T> Generic type argument for ActiveMQ messages consumed by this consumer implementation.
 *            Type T must be an instance of {@link Serializable}.
 */
public class SimpleActiveMQConsumer<T extends Serializable>
		implements Closeable
{
	private static final Logger logger = LogManager.getLogger(SimpleActiveMQConsumer.class);

	private final String brokerURL;
	private final String queueName;

	private ActiveMQConnection connection;
	private Session            session;
	private MessageConsumer    consumer;

	// private Thread consumerThread;

	/**
	 * Refer following documentation for valid broker URL formats -
	 *
	 * 1. Configuring transports
	 * 2. Failover transports
	 *
	 * @param brokerURL A valid URL to connect to ActiveMQ broker.
	 * @param queueName An alpha-numeric name of the ActiveMQ queue, on which consumer will be listening.
	 */
	public SimpleActiveMQConsumer(String brokerURL, String queueName)
	{
		this.brokerURL = brokerURL;
		this.queueName = queueName;
	}

	/**
	 * Initializes connection factory, connection, session, message queue and message producer instances.
	 *
	 * @throws JMSException when -
	 *                      1. The broker URL format is incorrect.
	 *                      2. The broker is started without 'failover' option and server is not running.
	 *                      3. The connection factory is unable to create a connection.
	 */
	private void initialize() throws JMSException
	{
		// Creating connection factory instance
		ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerURL);

		// Creating connection
		connection = (ActiveMQConnection) factory.createConnection();

		/**
		 * @since version 5.13.1, ActiveMQ requires trusted packages to be explicitly specified,
		 * while sending serializable classes as object message. This can be very annoying,
		 * if you are deploying in a controlled environment.
		 *
		 * It is better to 'set trust all packages' to true so that all classes are trusted,
		 * by default.
		 */
		// Marking all packages as trusted
		connection.setTrustAllPackages(true);

		// Starting the connection to ActiveMQ server
		connection.start();

		/**
		 * This option enables batched delivery of message acknowledgement,
		 * significantly improving message delivery performance.
		 */
		// Setting policy to send message acknowledgements in optimized manner
		connection.setOptimizeAcknowledge(true);

		/**
		 * A session can have several acknowledgement modes based on use case requirements.
		 *
		 * 1. Use {@link Session.AUTO_ACKNOWLEDGE} to let ActiveMQ broker handle the message acknowledgements.
		 * The message acknowledgements are sent as soon as the message is received by the broker,
		 * irrespective of whether the broker succeeds in processing the message.
		 *
		 * 2. Use {@link Session.CLIENT_ACKNOWLEDGE} to allow the consumer to explicitly send message acknowledgements.
		 * This option allows the consumer to process the message before sending the acknowledgement.
		 * In case the message processing fails for some reason, the message can be redelivered to some another consumer.
		 * Use this option with little caution considering unacknowledged message will be redelivered which might cause
		 * unexpected behaviour if duplicate messages are not properly handled.
		 *
		 * 3. Option {@link Session.DUPS_OK_ACKNOWLEDGE} is similar to {@link Session.AUTO_ACKNOWLEDGE} but the acknowledgements
		 * are batched to improve performance. This option is suitable for most of the common use cases.
		 *
		 * 4. Use {@link Session.SESSION_TRANSACTED} option while working in a container based transactions e.g. JTA or XA
		 */
		// Creating session
		session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);

		// Creating queue instance corresponding to queueName
		Queue queue = session.createQueue(queueName);

		// Creating consumer instance
		consumer = session.createConsumer(queue);

		// Creating thread for reading
		// consumerThread = new Thread(this::run);
	}

	/**
	 * Initializes and starts the message consumer.
	 *
	 * @throws JMSException when initialization, of the message consumer, is not successful.
	 */
	public void start() throws JMSException
	{
		// Initializing consumer
		this.initialize();

		// Starting reading
		// consumerThread.start();
	}

	/*private void run()
	{
		while (!consumerThread.isInterrupted())
		{
			try
			{
				final Message message = consumer.receiveNoWait();

				if (message == null)
				{
					// No message in queue; waiting for message
					Thread.sleep(5000);
					continue;
				}

				if (message instanceof TextMessage)
				{
					final TextMessage textMessage = (TextMessage) message;
					logger.info("Received :: {}", textMessage.getText());
				}
			}
			catch (IllegalStateException e)
			{
				break;
			}
			catch (Exception e)
			{
				logger.error(e.getMessage(), e);
			}
		}
	}*/

	/**
	 * Tries to receive a message from the consumer without waiting for one in case of an empty queue.
	 *
	 * @return object of type T by transforming {@link Message} according to its underlying implementation.
	 *
	 * @throws JMSException when -
	 *                      1. The consumer or its corresponding session is closed.
	 *                      2. The broker is down and connection factory is not configured with 'failover' option.
	 */
	public T nextMessageNoWait() throws JMSException
	{
		return transform(consumer.receiveNoWait());
	}

	/**
	 * Tries to receive a message from the consumer, if one is readily available.
	 * If not, consumer will wait for the amount of time specified by the 'timeout' parameter.
	 *
	 * @param timeout in milliseconds for which a broker will wait for a message to arrive,
	 *                in case when one is not readily available in the queue.
	 *
	 * @return object of type T by transforming {@link Message} according to its underlying implementation.
	 *
	 * @throws JMSException when -
	 *                      1. The consumer or its corresponding session is closed.
	 *                      2. The broker is down and connection factory is not configured with 'failover' option.
	 */
	public T nextMessage(long timeout) throws JMSException
	{
		return transform(consumer.receive(timeout));
	}

	/**
	 * Transforms {@link Message} according to its underlying implementation.
	 * {@link TextMessage} is transformed into {@link String} object,
	 * while {@link ObjectMessage} is transformed to its embedded object.
	 *
	 * @param message to transformed.
	 *
	 * @return object of type T as the result of transformation of 'message' parameter.
	 *
	 * @throws JMSException when transformation is not possible.
	 */
	@SuppressWarnings("unchecked")
	private T transform(Message message) throws JMSException
	{
		if (message == null)
		{
			return null;
		}

		return (T) (message instanceof ActiveMQTextMessage ? ((ActiveMQTextMessage) message).getText() : ((ObjectMessage) message).getObject());
	}

	/**
	 * Closes all the resources held by this instance of message consumer.
	 */
	public void close() throws IOException
	{
		JMSUtil.close(consumer);
		JMSUtil.close(session);
		JMSUtil.close(connection);
	}
}