text:
using namespace aaesim;
using namespace geolib_idealab;

log4cplus::Logger GeolibUtils::m_logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("GeolibUtils"));
std::string GeolibUtils::m_basic_error_message("Arg! Something very bad occurred inside a geolib library operation!");

LatitudeLongitudePoint GeolibUtils::CalculateNewPoint(
                                          const LatitudeLongitudePoint &start_point,
                                          const Units::Length &distance,
                                          const Units::SignedAngle &course_enu) {
   const Units::UnsignedRadiansAngle angle_from_true_north = ConvertCourseFromEnuToNed(course_enu) ;

   // Project self to a new location and return that location
   LLPoint destination_calculated;
   ErrorSet error_set = direct(
      start_point.GetGeolibPrimitiveLLPoint(),
      angle_from_true_north.value(),
      Units::NauticalMilesLength(distance).value(),
      &destination_calculated,
      GEOLIB_EPSILON);
   if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }
   return LatitudeLongitudePoint(Units::RadiansAngle(destination_calculated.latitude), Units::RadiansAngle(destination_calculated.longitude));
}

std::pair<Units::Length, Units::SignedAngle> GeolibUtils::CalculateRelationshipBetweenPoints(
                                                            const LatitudeLongitudePoint &start_point,
                                                            const LatitudeLongitudePoint &end_point) {
   auto info = CalculateRelationshipBetweenPointsExpanded(start_point, end_point);
   return std::make_pair(std::get<0>(info),
                         std::get<1>(info));
}

const Units::UnsignedAngle GeolibUtils::ConvertCourseFromEnuToNed(const Units::SignedAngle &course_enu) {
   const double cos_term = cos(course_enu);
   const double sin_term = sin(course_enu);
   const double arctan2_result = std::atan2(cos_term, sin_term);
   const Units::SignedRadiansAngle tmp(arctan2_result);
   return Units::UnsignedAngle(tmp);
}

const Units::SignedAngle GeolibUtils::ConvertCourseFromNedToEnu(const Units::UnsignedAngle &course_ned) {
   const double cos_term = cos(Units::SignedRadiansAngle(course_ned));
   const double sin_term = sin(Units::SignedRadiansAngle(course_ned));
   const double arctan2_result = std::atan2(cos_term, sin_term);
   return Units::SignedRadiansAngle(arctan2_result);
}

const LineOnEllipsoid GeolibUtils::CreateLineOnEllipsoid(const LatitudeLongitudePoint &start_point,
                                                         const LatitudeLongitudePoint &end_point) {
   Geodesic geolib_geodesic;
   ErrorSet error_set = createGeo(&geolib_geodesic,
                                  start_point.GetGeolibPrimitiveLLPoint(),
                                  end_point.GetGeolibPrimitiveLLPoint(),
                                  LineType::SEGMENT,
                                  GEOLIB_EPSILON);
   if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   LineOnEllipsoid line_on_ellipsoid(geolib_geodesic);
   return line_on_ellipsoid;
}
const ArcOnEllipsoid GeolibUtils::CreateArcOnEllipsoid(const LatitudeLongitudePoint &start_point,
                                                       const LatitudeLongitudePoint &end_point,
                                                       const LatitudeLongitudePoint &center_point,
                                                       const geolib_idealab::ArcDirection &arc_direction) {

   Arc arc_primitive;
   ErrorSet error_set = createArc(&arc_primitive,
                                  center_point.GetGeolibPrimitiveLLPoint(),
                                  start_point.GetGeolibPrimitiveLLPoint(),
                                  end_point.GetGeolibPrimitiveLLPoint(),
                                  arc_direction,
                                  GEOLIB_TOLERANCE,
                                  GEOLIB_EPSILON);
   if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   ArcOnEllipsoid arc_on_ellipsoid(arc_primitive);
   return arc_on_ellipsoid;
}

const std::tuple<bool, LatitudeLongitudePoint, std::vector<Units::Length> > GeolibUtils::CalculateLineLineIntersectionPoint(const LineOnEllipsoid &line1,
                                                                                const LineOnEllipsoid &line2) {

   // Line-Line intersection
   double crs31, distance_line1_start_to_intx_point, crs32, distance_line2_start_to_intx_point;
   geolib_idealab::LLPoint intersection_point;
   ErrorSet error_set = geoIntx(line1.GetStartPoint().GetGeolibPrimitiveLLPoint(),
                                line1.GetEndPoint().GetGeolibPrimitiveLLPoint(),
                                line1.GetLineType(),
                                &crs31,
                                &distance_line1_start_to_intx_point,
                                line2.GetStartPoint().GetGeolibPrimitiveLLPoint(),
                                line2.GetEndPoint().GetGeolibPrimitiveLLPoint(),
                                line2.GetLineType(),
                                &crs32,
                                &distance_line2_start_to_intx_point,
                                &intersection_point,
                                GEOLIB_TOLERANCE,
                                GEOLIB_EPSILON);

   bool return_this = true;
   if (error_set && ErrorCodes::NO_INTERSECTION_ERR) {
      LOG4CPLUS_WARN(m_logger, formatErrorMessage(error_set));
      return_this = false;
   }
   else if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   std::vector<Units::Length> distances_to_intersection_point = {Units::NauticalMilesLength(distance_line1_start_to_intx_point),
                                                                 Units::NauticalMilesLength(distance_line2_start_to_intx_point)};
   return std::make_tuple(return_this, LatitudeLongitudePoint::CreateFromGeolibPrimitive(intersection_point), distances_to_intersection_point);
}
const bool GeolibUtils::IsPointOnLine(const LineOnEllipsoid &line, const LatitudeLongitudePoint &test_point) {
   geolib_idealab::ErrorSet error_set = ErrorCodes::SUCCESS;
   int ret = geolib_idealab::ptIsOnGeo(line.GetStartPoint().GetGeolibPrimitiveLLPoint(),
                                       line.GetEndPoint().GetGeolibPrimitiveLLPoint(),
                                       test_point.GetGeolibPrimitiveLLPoint(),
                                       line.GetLineType(),
                                       &error_set,
                                       GEOLIB_TOLERANCE,
                                       GEOLIB_EPSILON);
   if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   bool return_this = (ret != 0);
   return return_this;
}
const bool GeolibUtils::IsPointOnArc(const ArcOnEllipsoid &arc, const LatitudeLongitudePoint &test_point) {
   geolib_idealab::ErrorSet error_set = ErrorCodes::SUCCESS;
   int ret = geolib_idealab::ptIsOnArc(arc.GetCenterPoint().GetGeolibPrimitiveLLPoint(),
                                       Units::NauticalMilesLength(arc.GetRadius()).value(),
                                       Units::UnsignedRadiansAngle(GeolibUtils::ConvertCourseFromEnuToNed(arc.GetStartAzimuthEnu())).value(),
                                       Units::UnsignedRadiansAngle(GeolibUtils::ConvertCourseFromEnuToNed(arc.GetEndAzimuthEnu())).value(),
                                       arc.GetArcDirection(),
                                       test_point.GetGeolibPrimitiveLLPoint(),
                                       &error_set,
                                       GEOLIB_TOLERANCE,
                                       GEOLIB_EPSILON);
   if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   bool return_this = (ret == 1);
   return return_this;
}

std::tuple<LatitudeLongitudePoint, Units::SignedAngle, Units::Length>  GeolibUtils::FindNearestPointOnLineUsingPerpendicularProjection(
                                                                                const LineOnEllipsoid &line,
                                                                                const LatitudeLongitudePoint &point_not_on_line) {
   geolib_idealab::LLPoint point_on_line;
   double crs_ned_to_line_from_point_not_on_line, distance_along_perpendicular_projection;
   ErrorSet error_set = projectToGeo(line.GetStartPoint().GetGeolibPrimitiveLLPoint(),
                                     Units::UnsignedRadiansAngle(ConvertCourseFromEnuToNed(line.GetForwardCourseEnuAtStartPoint())).value(),
                                     point_not_on_line.GetGeolibPrimitiveLLPoint(),
                                     &point_on_line,
                                     &crs_ned_to_line_from_point_not_on_line,
                                     &distance_along_perpendicular_projection,
                                     GEOLIB_TOLERANCE,
                                     GEOLIB_EPSILON);

   if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   return std::make_tuple(LatitudeLongitudePoint::CreateFromGeolibPrimitive(point_on_line),
                          ConvertCourseFromNedToEnu(Units::UnsignedRadiansAngle(crs_ned_to_line_from_point_not_on_line)),
                          Units::NauticalMilesLength(distance_along_perpendicular_projection));
}

const bool GeolibUtils::IsPointInsideArcSegment(const ArcOnEllipsoid &finite_arc,
                                                const LatitudeLongitudePoint &test_point) {
   geolib_idealab::ErrorSet error_set = ErrorCodes::SUCCESS;
   int ret = geolib_idealab::ptIsInsideArc(finite_arc.GetCenterPoint().GetGeolibPrimitiveLLPoint(),
                                          Units::NauticalMilesLength(finite_arc.GetRadius()).value(),
                                          Units::UnsignedRadiansAngle(GeolibUtils::ConvertCourseFromEnuToNed(finite_arc.GetStartAzimuthEnu())).value(),
                                          Units::UnsignedRadiansAngle(GeolibUtils::ConvertCourseFromEnuToNed(finite_arc.GetEndAzimuthEnu())).value(),
                                          finite_arc.GetArcDirection(),
                                          test_point.GetGeolibPrimitiveLLPoint(),
                                          &error_set,
                                          GEOLIB_TOLERANCE,
                                          GEOLIB_EPSILON);
   if (error_set != ErrorCodes::SUCCESS) {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   bool return_this = (ret != 0);
   return return_this;
}
std::pair<bool, const LatitudeLongitudePoint> GeolibUtils::FindNearestPointOnArcUsingPerpendiculorProjection(const ArcOnEllipsoid &arc,
                                                                                const LatitudeLongitudePoint &point_not_on_arc) {
   // line from arc center to point_not_on_arc
   LineOnEllipsoid radius_line_through_point = LineOnEllipsoid::CreateFromPoints(arc.GetCenterPoint(), point_not_on_arc);

   // Get new point at arc-radius distance from center along the line's course
   LatitudeLongitudePoint point_on_arc = GeolibUtils::CalculateNewPoint(arc.GetCenterPoint(), arc.GetRadius(), radius_line_through_point.GetForwardCourseEnuAtStartPoint());

   // Make sure it is on the arc
   bool is_on_arc = arc.IsPointOnShape(point_on_arc);

   return std::pair<bool, const LatitudeLongitudePoint>(is_on_arc, point_on_arc);
}

bool GeolibUtils::ArePointsMathematicallyEqual(const LatitudeLongitudePoint &point1, const LatitudeLongitudePoint &point2) {
   int ret = geolib_idealab::ptsAreSame(point1.GetGeolibPrimitiveLLPoint(),
                                        point2.GetGeolibPrimitiveLLPoint(),
                                        GEOLIB_TOLERANCE);

   bool return_this = (ret != 0);
   return return_this;
}

std::pair<bool, ArcOnEllipsoid> GeolibUtils::CreateArcTangentToTwoLines(const LineOnEllipsoid &line1,
                                                                        const LineOnEllipsoid &line2,
                                                                        const Units::Length &required_radius) {

   LLPoint arc_center_point;
   LLPoint arc_start_point;
   LLPoint arc_end_point;
   geolib_idealab::ArcDirection arc_direction;
   ErrorSet error_set = arcTanToTwoGeos(
      line1.GetStartPoint().GetGeolibPrimitiveLLPoint(),
      Units::UnsignedRadiansAngle(ConvertCourseFromEnuToNed(line1.GetForwardCourseEnuAtStartPoint())).value(),
      line2.GetStartPoint().GetGeolibPrimitiveLLPoint(),
      Units::UnsignedRadiansAngle(ConvertCourseFromEnuToNed(line2.GetForwardCourseEnuAtStartPoint())).value(),
      Units::NauticalMilesLength(required_radius).value(),
      &arc_center_point,
      &arc_start_point,
      &arc_end_point,
      &arc_direction,
      GEOLIB_TOLERANCE,
      GEOLIB_EPSILON);

   bool one_arc_found = true;
   ArcOnEllipsoid arc_to_return;
   if (error_set == ErrorCodes::SUCCESS) {
      arc_to_return = CreateArcOnEllipsoid(LatitudeLongitudePoint::CreateFromGeolibPrimitive(arc_start_point),
                                                  LatitudeLongitudePoint::CreateFromGeolibPrimitive(arc_end_point),
                                                  LatitudeLongitudePoint::CreateFromGeolibPrimitive(arc_center_point),
                                                  arc_direction);
   }
   else if (error_set && ErrorCodes::NO_TANGENT_ARC_ERR) {
      // this is okay, just return with no formed arc
      one_arc_found = false;
   }
   else {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   return std::pair<bool, ArcOnEllipsoid>(one_arc_found, arc_to_return);
}

ArcOnEllipsoid GeolibUtils::CreateArcFromInboundShapeAndEndPoint(const ShapeOnEllipsoid *inbound_shape,
                                                                 const LatitudeLongitudePoint &end_point) {

   geolib_idealab::Arc calculated_arc;
   ErrorSet error_set = arcFromStartAndEnd(
           inbound_shape->GetEndPoint().GetGeolibPrimitiveLLPoint(),
           Units::UnsignedRadiansAngle(ConvertCourseFromEnuToNed(inbound_shape->GetForwardCourseEnuAtEndPoint())).value(),
           end_point.GetGeolibPrimitiveLLPoint(),
           &calculated_arc,
           GEOLIB_TOLERANCE,
           GEOLIB_EPSILON);

   ArcOnEllipsoid arc_to_return;
   if (error_set == ErrorCodes::SUCCESS) {
      arc_to_return = ArcOnEllipsoid(calculated_arc);
   }
   else {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   return arc_to_return;
}

std::vector<std::pair<bool, LatitudeLongitudePoint> > GeolibUtils::CalculateLineArcIntersectionPoints(const LineOnEllipsoid &line,
                                                                                const ArcOnEllipsoid &arc) {

   LLPointPair intersection_pairs_on_circle;
   int number_of_intersections = INT32_MIN;
   ErrorSet error_set = geoArcIntx(
      line.GetStartPoint().GetGeolibPrimitiveLLPoint(),
      Units::UnsignedRadiansAngle(ConvertCourseFromEnuToNed(line.GetForwardCourseEnuAtStartPoint())).value(),
      arc.GetCenterPoint().GetGeolibPrimitiveLLPoint(),
      Units::NauticalMilesLength(arc.GetRadius()).value(),
      intersection_pairs_on_circle,
      &number_of_intersections,
      GEOLIB_TOLERANCE,
      GEOLIB_EPSILON);

   std::vector<std::pair<bool, LatitudeLongitudePoint> > return_this;
   if (error_set == ErrorCodes::SUCCESS) {
      if (number_of_intersections == 0) {
         // no intersections found
         auto no_intersection_return = {std::make_pair(false, LatitudeLongitudePoint(Units::ZERO_ANGLE, Units::ZERO_ANGLE))};
         return no_intersection_return;
      } else {
         for (auto i = 0; i < number_of_intersections; ++i) {
            const LatitudeLongitudePoint intx_point = LatitudeLongitudePoint::CreateFromGeolibPrimitive(intersection_pairs_on_circle[i]);
            const bool is_point_on_line = line.IsPointOnShape(intx_point);
            const bool is_point_on_arc = arc.IsPointOnShape(intx_point);
            return_this.push_back(std::make_pair(is_point_on_arc && is_point_on_line, intx_point));
         }
      }
   }
   else {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   return return_this;
}
const ArcOnEllipsoid GeolibUtils::CreateFullCircleOnEllipsoid(const LatitudeLongitudePoint &center_point,
                                                              const Units::Length &arc_radius,
                                                              const geolib_idealab::ArcDirection &arc_direction) {

   geolib_idealab::Arc calculated_arc;
   LatitudeLongitudePoint start_point = center_point.ProjectDistanceAlongCourse(arc_radius, Units::ZERO_ANGLE);
   LLPoint end_point = start_point.GetGeolibPrimitiveLLPoint();
   ErrorSet error_set = arcEndFromStartAndCenter(
      start_point.GetGeolibPrimitiveLLPoint(),
      0,
      center_point.GetGeolibPrimitiveLLPoint(),
      arc_direction,
      end_point,
      &calculated_arc,
      GEOLIB_TOLERANCE,
      GEOLIB_EPSILON);

   ArcOnEllipsoid arc_to_return;
   if (error_set == ErrorCodes::SUCCESS) {
      arc_to_return = ArcOnEllipsoid(calculated_arc);
   }
   else {
      LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
      throw std::runtime_error(m_basic_error_message);
   }

   return arc_to_return;
}

LineOnEllipsoid GeolibUtils::CreateLineOfZeroLength(const LatitudeLongitudePoint &location,
                                                    const Units::SignedAngle &course_enu) {

   geolib_idealab::Geodesic zero_length_geodesic;
   zero_length_geodesic.length = 0;
   zero_length_geodesic.startPoint = location.GetGeolibPrimitiveLLPoint();
   zero_length_geodesic.endPoint = zero_length_geodesic.startPoint;
   zero_length_geodesic.startAz = Units::UnsignedRadiansAngle(ConvertCourseFromEnuToNed(course_enu)).value();
   zero_length_geodesic.endAz = zero_length_geodesic.startAz;
   zero_length_geodesic.lineType = SEGMENT;
   return LineOnEllipsoid(zero_length_geodesic);
}

std::tuple<Units::Length,
           Units::SignedAngle,
           Units::SignedAngle> GeolibUtils::CalculateRelationshipBetweenPointsExpanded(const LatitudeLongitudePoint &start_point,
                                                                                const LatitudeLongitudePoint &end_point) {
  double start_crs_radians_ned_unsigned = DBL_MIN;
  double end_course_radians_ned_unsigned = DBL_MIN;
  double distance_nm = DBL_MIN;
  ErrorSet error_set = inverse(
      start_point.GetGeolibPrimitiveLLPoint(),
      end_point.GetGeolibPrimitiveLLPoint(),
      &start_crs_radians_ned_unsigned,
      &end_course_radians_ned_unsigned,
      &distance_nm,
      GEOLIB_EPSILON);
  if (error_set != SUCCESS) {
    LOG4CPLUS_ERROR(m_logger, m_basic_error_message << formatErrorMessage(error_set));
    throw std::runtime_error(m_basic_error_message);
  }

  return std::make_tuple(Units::NauticalMilesLength(distance_nm),
                         ConvertCourseFromNedToEnu(Units::UnsignedRadiansAngle(start_crs_radians_ned_unsigned)),
                         ConvertCourseFromNedToEnu(Units::UnsignedRadiansAngle(end_course_radians_ned_unsigned)));
}


text: export fetchPlaceByID from "./fetchPlaceByID"

redpajama_set_name: RedPajamaGithub


text:
package services.validators.urls;

import exceptions.validators.urls.ComputerEditUrlValidatorException;
import persistence.daos.ComputerDaoImpl;

/**
 * Created by ebiz on 24/03/17.
 */
public class ComputerEditUrlValidator {

    private static ComputerDaoImpl computerDao;
    public StringBuilder error;

    /**
     * @param urlParameters urlParameters.
     * @throws ComputerEditUrlValidatorException ComputerEditUrlValidatorException.
     */
    public void isUrlValid(String urlParameters) {
        error = new StringBuilder();
        //Check if id parameter is an int
        if (!isValidId(urlParameters)) {
            error.append("Computer id is not valid.");
            //Check if computer exists
        } else if (!computerExists(urlParameters)) {
            error.append("Computer does not exist.");
        }
    }

    /**
     * @param id id.
     * @return boolean : exists or not.
     */
    public boolean computerExists(String id) {
        long computerDbId =  computerDao.findById(Long.valueOf(id)).getId();
        long computerFrontId = Long.parseLong(id);
        return (computerDbId == computerFrontId ? true : false);
    }

    /**
     * Check if id from request is an int.
     *
     * @param id id.
     * @return id.
     */
    public boolean isValidId(String id) {
        boolean valid = false;
        try {
            Integer.valueOf(id);
            valid = true;
        } catch (NumberFormatException e) {
        }
        return valid;
    }

    public void setComputerDao(ComputerDaoImpl computerDao) {
        this.computerDao = computerDao;
    }

    public ComputerDaoImpl getComputerDao() {
        return computerDao;
    }

    /**
     * Get errors from ComputerEditUrlValidator.
     * @return error string from StringBuilder.
     */
    public String getError() {
        return error.toString();
    }
}


text:
'use strict';

const angular = require('angular');
import _ from 'lodash';

import { ACCOUNT_SERVICE } from '@spinnaker/core';

module.exports = angular.module('spinnaker.openstack.region.regionSelectField.directive', [
  ACCOUNT_SERVICE,
  require('../common/selectField.component.js')
])
  .directive('osRegionSelectField', function (accountService) {
    return {
      restrict: 'E',
      templateUrl: require('./regionSelectField.directive.html'),
      scope: {
        label: '@?',
        labelColumnSize: '@?',
        helpKey: '@?',
        model: '<?',
        account: '<',
        onChange: '&',
        readOnly: '<',
        allowNoSelection: '<',
        noOptionsMessage: '@?',
        noSelectionMessage: '@?'
      },
      link: function(scope) {
        _.defaults(scope, {
          label: 'Region',
          labelColumnSize: 3,
          regions: []
        });

        if( scope.model ) {
          scope.regions.push({label: scope.model, value: scope.model});
        }

        var currentRequestId = 0;

        function updateRegionOptions() {
          currentRequestId++;
          var requestId = currentRequestId;

          accountService.getRegionsForAccount(scope.account).then(function(regions) {
            if (requestId !== currentRequestId) {
              return;
            }

            scope.regions = _.chain(regions)
              .map(function(r) { return {label: r, value: r}; })
              .sortBy(function(o) { return o.label; })
              .value();
          });
        }

        scope.$watch('account', updateRegionOptions);
      }
    };
});


text:
package it.jnrpe.utils.thresholds;

import java.math.BigDecimal;

/**
 * Enumeration of accepted prefixes.
 *
 * @author Massimiliano Ziccardi
 *
 * @version $Revision: 1.0 $
 */
public enum Prefixes {

    /**
     * Used for raw values
     */
    RAW(new BigDecimal(1)),

    /**
     * Yotta : 10^24. You can use both yotta or Y (case sensitive) as unit of
     * prefix.
     */
    yotta(new BigDecimal(10).pow(24)),
    /**
     * Zetta : 10^21. You can use both zetta or Z (case sensitive) as unit of
     * prefix.
     */
    zetta(new BigDecimal(10).pow(21)),
    /**
     * Exa : 10^28. You can use both exa or E (case sensitive) as unit of
     * prefix.
     */
    exa(new BigDecimal(10).pow(18)),
    /**
     * Peta : 10^15. You can use both peta or P (case sensitive) as unit of
     * prefix.
     */
    peta(new BigDecimal(10).pow(15)),
    /**
     * Tera : 10^12. You can use both tera or T (case sensitive) as unit of
     * prefix.
     */
    tera(new BigDecimal(10).pow(12)),
    /**
     * Giga : 10^9. You can use both giga or G (case sensitive) as unit of
     * prefix.
     */
    giga(new BigDecimal(10).pow(9)),
    /**
     * Mega : 10^6. You can use both mega or M (case sensitive) as unit of
     * prefix.
     */
    mega(new BigDecimal(10).pow(6)),
    /**
     * Kilo : 10^3. You can use both kilo or k (case sensitive) as unit of
     * prefix.
     */
    kilo(new BigDecimal(10).pow(3)),
    /**
     * Hecto : 10^2. You can use both hecto or h (case sensitive) as unit of
     * prefix.
     */
    hecto(new BigDecimal(10).pow(2)),
    /**
     * Deka : 10^1. You can use both deka or da (case sensitive) as unit of
     * prefix.
     */
    deka(new BigDecimal(10).pow(1)),
    /**
     * Deci : 10^-1. You can use both deci or d (case sensitive) as unit of
     * prefix.
     */
    deci(new BigDecimal(1).divide(new BigDecimal(10).pow(1))),
    /**
     * Centi : 10^-2. You can use both centi or c (case sensitive) as unit of
     * prefix.
     */
    centi(new BigDecimal(1).divide(new BigDecimal(10).pow(2))),
    /**
     * Milli : 10^-3. You can use both milli or m (case sensitive) as unit of
     * prefix.
     */
    milli(new BigDecimal(1).divide(new BigDecimal(10).pow(3))),
    /**
     * Micro : 10^-6. You can use both micro or u (case sensitive) as unit of
     * prefix.
     */
    micro(new BigDecimal(1).divide(new BigDecimal(10).pow(6))),
    /**
     * Nano : 10^-9. You can use both nano or n (case sensitive) as unit of
     * prefix.
     */
    nano(new BigDecimal(1).divide(new BigDecimal(10).pow(9))),
    /**
     * Pico : 10^-12. You can use both pico or p (case sensitive) as unit of
     * prefix.
     */
    pico(new BigDecimal(1).divide(new BigDecimal(10).pow(12))),
    /**
     * Femto : 10^-15. You can use both femto or f (case sensitive) as unit of
     * prefix.
     */
    femto(new BigDecimal(1).divide(new BigDecimal(10).pow(15))),
    /**
     * Atto : 10^-18. You can use both atto or a (case sensitive) as unit of
     * prefix.
     */
    atto(new BigDecimal(1).divide(new BigDecimal(10).pow(18))),
    /**
     * Zepto : 10^-21. You can use both zepto or z (case sensitive) as unit of
     * prefix.
     */
    zepto(new BigDecimal(1).divide(new BigDecimal(10).pow(21))),
    /**
     * Yocto : 10^-24. You can use both yocto or y (case sensitive) as unit of
     * prefix.
     */
    yocto(new BigDecimal(1).divide(new BigDecimal(10).pow(24))),
    /**
     * Kibi: 2^10. You can use both kibi or Ki (case sensitive) as unit of
     * prefix.
     */
    kibi(new BigDecimal(2).pow(10)),
    /**
     * Mebi: 2^20. You can use both mebi or Mi (case sensitive) as unit of
     * prefix.
     */
    mebi(new BigDecimal(2).pow(20)),
    /**
     * Gibi: 2^30. You can use both gibi or Gi (case sensitive) as unit of
     * prefix.
     */
    gibi(new BigDecimal(2).pow(30)),
    /**
     * Tebi: 2^40. You can use both tebi or Ti (case sensitive) as unit of
     * prefix.
     */
    tebi(new BigDecimal(2).pow(40)),
    /**
     * Pebi: 2^50. You can use both pebi or Pi (case sensitive) as unit of
     * prefix.
     */
    pebi(new BigDecimal(2).pow(50)),
    /**
     * Exbi: 2^60. You can use both exbi or Ei (case sensitive) as unit of
     * prefix.
     */
    exbi(new BigDecimal(2).pow(60));

    /**
     * The multiplier for the current prefix.
     */
    private final BigDecimal multiplier;

    /**
     * Builds the enumeration specifying the multiplier.
     *
     * @param value
     *            The multiplier
     */
    Prefixes(final BigDecimal value) {
        multiplier = value;
    }

    /**
     * Multiplies the value with the multiplier associated with this prefix.
     *
     * @param value
     *            The value

     * @return The multiplied value */
    public BigDecimal convert(final BigDecimal value, final Prefixes output) {

        if (this == output) {
            return value;
        }

        // convert to raw...
        BigDecimal rawValue = value.multiply(multiplier);

        if (output == RAW) {
            return rawValue;
        }

        return rawValue.divide(output.multiplier);
    }

    /**
     * Multiplies the value with the multiplier associated with this prefix.
     *
     * @param value
     *            The value

     * @return The multiplied value */
    public BigDecimal convert(final int value, final Prefixes output) {
        return convert(new BigDecimal(value), output);
    }

    /**
     * Multiplies the value with the multiplier associated with this prefix.
     *
     * @param value
     *            The value

     * @return The multiplied value */
    public BigDecimal convert(final long value, final Prefixes output) {
        return convert(new BigDecimal(value), output);
    }

    /**
     * Multiplies the value with the multiplier associated with this prefix.
     *
     * @param value
     *            The value

     * @return The multiplied value */
    public BigDecimal convert(final double value, final Prefixes output) {
        return convert(new BigDecimal(value), output);
    }

    /**
     * Creates the enumeration from its prefix string.
     *
     * @param prefixChar
     *            The prefix

     * @return The enumeration */
    public static Prefixes fromChar(final char prefixChar) {
        switch (prefixChar) {
        case 'Y':
            return yotta;
        case 'Z':
            return zetta;
        case 'E':
            return exa;
        case 'P':
            return peta;
        case 'T':
            return tera;
        case 'G':
            return giga;
        case 'M':
            return mega;
        case 'k':
            return kilo;
        case 'h':
            return hecto;
        case 'd':
            return deci;
        case 'c':
            return centi;
        case 'm':
            return milli;
        case 'u':
            return micro;
        case 'n':
            return nano;
        case 'p':
            return pico;
        case 'f':
            return femto;
        case 'a':
            return atto;
        case 'z':
            return zepto;
        case 'y':
            return yocto;
        default:
            throw new IllegalArgumentException(String.valueOf(prefixChar));
        }
    }

    /**
     * Returns the enumeration relative to the passed in prefix or string.
     *
     * @param prefixString
     *            The prefix

     * @return The enumeration */
    public static Prefixes fromString(final String prefixString) {
        if (prefixString.length() == 1) {
            return fromChar(prefixString.charAt(0));
        }

        String lowercasePrefix = prefixString.toLowerCase();
        if ("da".equals(lowercasePrefix)) {
            return deka;
        }
        if ("ki".equals(lowercasePrefix)) {
            return kilo;
        }
        if ("mi".equals(lowercasePrefix)) {
            return mebi;
        }
        if ("gi".equals(lowercasePrefix)) {
            return gibi;
        }
        if ("ti".equals(lowercasePrefix)) {
            return tebi;
        }
        if ("pi".equals(lowercasePrefix)) {
            return pebi;
        }
        if ("ei".equals(lowercasePrefix)) {
            return exbi;
        }

        return valueOf(prefixString);
        // throw new IllegalArgumentException(prefixString);
    }

    @Override
    public String toString() {
        if (this == RAW) {
            return "";
        }

        return super.toString();
    }
}


text:
Laravel Queuing
===============

Laravel Queuing was created by, and is maintained by [Graham Campbell](https://github.com/GrahamCampbell), and provides queuing performance increases for [Laravel 4.2](http://laravel.com). It works by doing the actual job queuing (including the execution of sync jobs) after the response has been sent to the client (on shutdown). Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/GrahamCampbell/Laravel-Queuing/releases), [license](LICENSE), [api docs](http://docs.grahamjcampbell.co.uk), and [contribution guidelines](CONTRIBUTING.md).

## WARNING

#### This package is no longer maintained.

![Laravel Queuing](https://cloud.githubusercontent.com/assets/2829600/4432309/c15748a4-468c-11e4-9d1f-8059185387ec.PNG)

## Installation

[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.

To get the latest version of Laravel Queuing, simply add the following line to the require block of your `composer.json` file:

```
"graham-campbell/queuing": "~1.0"
```

There are some additional dependencies you will need to install for some of the features:

* The beanstalk connector requires `"pda/pheanstalk": "~2.1"` in your `composer.json`.
* The aws connector requires `"aws/aws-sdk-php": "~2.4"` in your `composer.json`.
* The iron connector requires `"iron-io/iron_mq": "~1.4"` in your `composer.json`.

You'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.

Once Laravel Queuing is installed, you need to register the service provider. Open up `app/config/app.php` and add the following to the `providers` key.

* `'GrahamCampbell\Queuing\QueuingServiceProvider'`

#### You MUST also remove the laravel queuing service provider!

Open up `app/config/app.php` and remove `'Illuminate\Queue\QueueServiceProvider'`.

Failure to do so will result in an infinite loop.

## Configuration

Laravel Queuing requires no configuration behond what Laravel's queuing would otherwise require, but provides a quickstart command for iron queuing where after configuring, you can simply run `php artisan queue:iron` with no arguments and it will just work.

## Usage

##### Queues\XXXQueue

All queue classes override Laravel's queue classes. When ever you call methods such as `push`, behind the scenes with package will simply queue them up in php's memory for real pushing whenever the `process` method on these classes is called. By default, this package will call this on `shutdown` through the queue manager, but you may manually call this earlier if you so which. After calling the function, the jobs will be removed from the internal queue so later calls to this function will not push same jobs twice.

##### QueueManager

This class extends Laravel's queue manager and will override it. It has one extra method `processAll`. This will call the `process` method on all active queue connections. The functionality of the `process` method on each queue is described above.

##### QueuingServiceProvider

This class contains no public methods of interest. This class should be added to the providers array in `app/config/app.php`. This class will setup ioc bindings and register queue processing. `Illuminate\Queue\QueueServiceProvider` must be removed from the service provider list before you add this class.

##### Further Information

There are other classes in this package that are not documented here. This is because they are not intended for public use and are used internally by this package.

Feel free to check out the [API Documentation](http://docs.grahamjcampbell.co.uk) for Laravel Queuing.

## License

Laravel Queuing is licensed under [The MIT License (MIT)](LICENSE).


text:
/**
 * @file KNearest_.cpp
 * @brief mex interface for KNearest
 * @author Kota Yamaguchi
 * @date 2012
 */
#include "mexopencv.hpp"
using namespace std;
using namespace cv;

// Persistent objects

/// Last object id to allocate
int last_id = 0;
/// Object container
map<int,KNearest> obj_;

/**
 * Main entry called from Matlab
 * @param nlhs number of left-hand-side arguments
 * @param plhs pointers to mxArrays in the left-hand-side
 * @param nrhs number of right-hand-side arguments
 * @param prhs pointers to mxArrays in the right-hand-side
 */
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
    if (nlhs>3)
        mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");

    // Determine argument format between constructor or (id,method,...)
    vector<MxArray> rhs(prhs,prhs+nrhs);
    int id = 0;
    string method;
    if (nrhs==0) {
        // Constructor is called. Create a new object from argument
        obj_[++last_id] = KNearest();
        plhs[0] = MxArray(last_id);
        return;
    }
    else if (rhs[0].isNumeric() && rhs[0].numel()==1 && nrhs>1) {
        id = rhs[0].toInt();
        method = rhs[1].toString();
    }
    else
        mexErrMsgIdAndTxt("mexopencv:error","Invalid arguments");

    // Big operation switch
    KNearest& obj = obj_[id];
    if (method == "delete") {
        if (nrhs!=2 || nlhs!=0)
            mexErrMsgIdAndTxt("mexopencv:error","Output not assigned");
        obj_.erase(id);
    }
    else if (method == "clear") {
        if (nrhs!=2 || nlhs!=0)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        obj.clear();
    }
    else if (method == "load") {
        if (nrhs!=3 || nlhs!=0)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        obj.load(rhs[2].toString().c_str());
    }
    else if (method == "save") {
        if (nrhs!=3 || nlhs!=0)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        obj.save(rhs[2].toString().c_str());
    }
    else if (method == "train") {
        if (nrhs<4 || nlhs>1)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        Mat trainData(rhs[2].toMat(CV_32F));
        Mat responses(rhs[3].toMat(CV_32F));
        Mat sampleIdx;
        bool isRegression=false;
        int maxK=32;
        bool updateBase=false;
        for (int i=4; i<nrhs; i+=2) {
            string key(rhs[i].toString());
            if (key=="SampleIdx")
                sampleIdx = rhs[i+1].toMat(CV_32S);
            else if (key=="IsRegression")
                isRegression = rhs[i+1].toBool();
            else if (key=="MaxK")
                maxK = rhs[i].toInt();
            else if (key=="Update"||key=="UpdateBase")
                updateBase = rhs[i+1].toBool();
            else
                mexErrMsgIdAndTxt("mexopencv:error","Unrecognized option");
        }
        bool b = obj.train(trainData,responses,sampleIdx,isRegression,maxK,updateBase);
        plhs[0] = MxArray(b);
    }
    else if (method == "find_nearest") {
        if (nrhs<3 || nlhs>3)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        Mat samples(rhs[2].toMat(CV_32F)),results;
        int k=1;
        for (int i=3; i<nrhs; i+=2) {
            string key(rhs[i].toString());
            if (key=="K")
                k = rhs[i+1].toInt();
            else
                mexErrMsgIdAndTxt("mexopencv:error","Unrecognized option");
        }
        Mat neighborResponses, dists;
        obj.find_nearest(samples,k,results,neighborResponses,dists);
        plhs[0] = MxArray(results);
        if (nlhs>1)
            plhs[1] = MxArray(neighborResponses);
        if (nlhs>2)
            plhs[2] = MxArray(dists);
    }
    else if (method == "get_max_k") {
        if (nrhs!=2 || nlhs>1)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        plhs[0] = MxArray(obj.get_max_k());
    }
    else if (method == "get_var_count") {
        if (nrhs!=2 || nlhs>1)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        plhs[0] = MxArray(obj.get_var_count());
    }
    else if (method == "get_sample_count") {
        if (nrhs!=2 || nlhs>1)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        plhs[0] = MxArray(obj.get_sample_count());
    }
    else if (method == "is_regression") {
        if (nrhs!=2 || nlhs>1)
            mexErrMsgIdAndTxt("mexopencv:error","Wrong number of arguments");
        plhs[0] = MxArray(static_cast<bool>(obj.is_regression()));
    }
    else
        mexErrMsgIdAndTxt("mexopencv:error","Unrecognized operation");
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Mvc;
using DataLayer;
using DrinkBench.Models;
using DrinkBench.Services.Models;

namespace DrinkBench.Services.Controllers
{
    public class BenchesController : BaseApiController
    {
        [ActionName("all")]
        [HttpGet]
        public List<BenchModel> GetAll(string sessionKey)
        {
            var responseMsg = this.PerformOperationAndHandleExceptions(() =>
            {
                var context = new DrinkBenchContext();

                var user = context.Users.FirstOrDefault(usr => usr.SessionKey == sessionKey);
                if (user == null)
                {
                    throw new InvalidOperationException("Invalid sessionkey");
                }

                var benchesEntities = context.Benches;
                var models =
                    (from benchEntity in benchesEntities
                        select new BenchModel()
                        {
                            Id = benchEntity.Id,
                            Name = benchEntity.Name,
                            Latitude = benchEntity.Latitude,
                            Longitude = benchEntity.Longitude,
                            Users = (from benchUser in benchEntity.Users
                                         select new UserModel()
                                         {
                                             Id = benchUser.Id,
                                             Firstname = benchUser.Firstname,
                                             Lastname = benchUser.Lastname,
                                             Nickname = benchUser.Nickname,
                                             StartTime = benchUser.StartTime,
                                             EndTime = benchUser.EndTime,
                                             Avatar = benchUser.Avatar
                                         }),
                            UsersCount = benchEntity.Users.Count,
                            StartTime = benchEntity.StartTime,
                            EndTime = benchEntity.EndTime
                        });
                return models.ToList();
            });

            return responseMsg;
        }

        [ActionName("bench")]
        [HttpGet]
        public BenchFullModel GetById(int id, string sessionKey)
        {
            var responseMsg = this.PerformOperationAndHandleExceptions(() =>
            {
                var context = new DrinkBenchContext();

                var user = context.Users.FirstOrDefault(usr => usr.SessionKey == sessionKey);
                if (user == null)
                {
                    throw new InvalidOperationException("Invalid sessionkey");
                }

                var benchesEntities = context.Benches;
                var bench = benchesEntities.FirstOrDefault(b => b.Id == id);

                if (bench == null)
                {
                    throw new InvalidOperationException("Invalid bench id"+id);
                }

                BenchFullModel model = new BenchFullModel()
                        {
                            Id = bench.Id,
                            Name = bench.Name,
                            Latitude = bench.Latitude,
                            Longitude = bench.Longitude,
                            StartTime = bench.StartTime,
                            EndTime = bench.EndTime,
                            Users = (from benchUser in bench.Users
                                     select new FriendsModel()
                                     {
                                         Id = benchUser.Id,
                                         Nickname = benchUser.Nickname,
                                         Avatar = benchUser.Avatar,
                                         StartTime = benchUser.StartTime,
                                         EndTime = benchUser.EndTime
                                     }).ToList()
                        };
                return model;
            });

            return responseMsg;
        }

        [ActionName("newbench")]
        [HttpPost]
        public HttpResponseMessage PostBenches(string sessionKey, BenchModel bench)
        {
            var responseMsg = this.PerformOperationAndHandleExceptions(() =>
            {
                var context = new DrinkBenchContext();

                using (context)
                {
                    var user = context.Users.FirstOrDefault(usr => usr.SessionKey == sessionKey);
                    if (user == null)
                    {
                        throw new InvalidOperationException("Invalid sessionkey");
                    }

                    Bench newBench = new Bench()
                    {
                        Latitude = bench.Latitude,
                        Longitude = bench.Longitude,
                        Name = bench.Name,
                        StartTime = bench.StartTime,
                        EndTime = bench.EndTime
                    };
                    newBench.Users.Add(user);
                    context.Benches.Add(newBench);
                    context.SaveChanges();

                    CreatedBench createdBench = new CreatedBench()
                    {
                        Name = newBench.Name,
                        Id = newBench.Id
                    };

                    var response =
                            this.Request.CreateResponse(HttpStatusCode.Created,
                                            createdBench);
                    return response;
                }
            });

            return responseMsg;
        }

        [ActionName("joinbench")]
        [HttpPut]
        public HttpResponseMessage PutJoinBench(int benchId, string sessionKey)
        {
            var responseMsg = this.PerformOperationAndHandleExceptions(() =>
            {
                var context = new DrinkBenchContext();

                using (context)
                {
                    var user = context.Users.FirstOrDefault(usr => usr.SessionKey == sessionKey);
                    if (user == null)
                    {
                        throw new InvalidOperationException("Invalid sessionkey");
                    }

                    var benchesEntities = context.Benches;
                    var bench = benchesEntities.FirstOrDefault(b => b.Id == benchId);

                    if (bench == null)
                    {
                        throw new InvalidOperationException("Invalid bench id" + benchId);
                    }

                    bench.Users.Add(user);
                    context.SaveChanges();

                    var response =
                            this.Request.CreateResponse(HttpStatusCode.OK);
                    return response;
                }
            });

            return responseMsg;
        }

        //[HttpGet]
        //public BenchFullModel GetById(int id)
        //{
        //    if (id <= 0)
        //    {
        //        var errResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bench id incorrect: " + id);
        //        throw new HttpResponseException(errResponse);
        //    }

        //    var entity = this.BenchRepository.Get(id);

        //    var model = new BenchFullModel()
        //    {
        //        Id = entity.Id,
        //        Name = entity.Name,
        //        Users = (
        //        from userEntity in entity.Users
        //        select new UserModel()
        //        {
        //            Id = userEntity.Id,
        //            Firstname = userEntity.Firstname,
        //            Lastname = userEntity.Lastname,
        //            Nickname = userEntity.Nickname
        //        }).ToList()
        //    };
        //    return model;
        //}

        //[HttpPost]
        //public HttpResponseMessage PostBench(BenchModel model)
        //{
        //    if (model == null || model.Name == null || model.Name.Length < 3)
        //    {
        //        var errResponse = this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The name of the Bench should be at least 3 characters");
        //        return errResponse;
        //    }

        //    Bench bench = new Bench()
        //    {

        //    }
        //    var entity = this.BenchRepository.Add(model);

        //    var response =
        //        Request.CreateResponse(HttpStatusCode.Created, entity);

        //    response.Headers.Location = new Uri(Url.Link("DefaultApi",
        //        new { id = entity.Id }));
        //    return response;
        //}

        //PUT
        //DELETE

    }
}


text:
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))

startup_merb(:log_level => :fatal)

require File.dirname(__FILE__) / "controllers/request_controller"

module WithPathPrefixHelper
  def with_path_prefix(prefix)
    old_prefix = Merb::Config[:path_prefix]
    Merb::Config[:path_prefix] = prefix
    yield
  ensure
    Merb::Config[:path_prefix] = old_prefix
  end
end

describe Merb::Test::RequestHelper do
  include WithPathPrefixHelper

  before(:each) do
    Merb::Controller._default_cookie_domain = "example.org"

    Merb::Router.prepare do
      with(:controller => "merb/test/request_controller") do
        match("/set/short/long/read").to(:action => "get")
        match("/:action(/:junk)", :junk => ".*").register
      end
    end
  end

  it "should remove the path_prefix configuration option" do
    with_path_prefix '/foo' do
      request("/foo/path").should have_body('1')
    end
  end

  it "should dispatch a request using GET by defalt" do
    request("/request_method").should have_body("Method - GET")
  end

  it "should work with have_selector" do
    request("/document").should have_selector("div div")
  end

  it "should work with have_xpath" do
    request("/document").should have_xpath("//div/div")
  end

  it "should work with have_content" do
    request("/request_method").should contain("Method")
  end

  it "should persist cookies across sequential cookie setting requests" do
    request("/counter").should have_body("1")
    request("/counter").should have_body("2")
  end

  it "should persist cookies across requests that don't return any cookie headers" do
    request("/counter").should have_body("1")
    request("/void").should    have_body("Void")
    request('/counter').should have_body("2")
  end

  it "should delete cookies from the jar" do
    request("/counter").should have_body("1")
    request("/delete").should  have_body("Delete")
    request("/counter").should have_body("1")
  end

  it "should be able to disable the cookie jar" do
    request("/counter", :jar => nil).should have_body("1")
    request("/counter", :jar => nil).should have_body("1")
    request("/counter").should have_body("1")
    request("/counter").should have_body("2")
  end

  it "should be able to specify separate jars" do
    request("/counter", :jar => :one).should have_body("1")
    request("/counter", :jar => :two).should have_body("1")
    request("/counter", :jar => :one).should have_body("2")
    request("/counter", :jar => :two).should have_body("2")
  end

  it 'should allow a cookie to be set' do
    cookie = request("/counter").headers['Set-Cookie']
    request("/delete")
    request("/counter", :cookie => cookie).should have_body("2")
  end

  it "should respect cookie domains when no domain is explicitly set" do
    request("http://example.org/counter").should     have_body("1")
    request("http://www.example.org/counter").should have_body("2")
    request("http://example.org/counter").should     have_body("3")
    request("http://www.example.org/counter").should have_body("4")
  end

  it "should respect the domain set in the cookie" do
    request("http://example.org/domain").should     have_body("1")
    request("http://foo.example.org/domain").should have_body("1")
    request("http://example.org/domain").should     have_body("1")
    request("http://foo.example.org/domain").should have_body("2")
  end

  it "should respect the path set in the cookie" do
    request("/path").should      have_body("1")
    request("/path/zomg").should have_body("1")
    request("/path").should      have_body("1")
    request("/path/zomg").should have_body("2")
  end

  it "should use the most specific path cookie" do
    request("/set/short")
    request("/set/short/long")
    request("/set/short/long/read").should have_body("/set/short/long")
  end

  it "should use the most specific path cookie even if it was defined first" do
    request("/set/short/long")
    request("/set/short")
    request("/set/short/long/read").should have_body("/set/short/long")
  end

  it "should leave the least specific cookie intact when specifying a more specific path" do
    request("/set/short")
    request("/set/short/long/zomg/what/hi")
    request("/set/short/long/read").should have_body("/set/short")
  end

  it "should use the most specific domain cookie" do
    request("http://test.com/domain_set")
    request("http://one.test.com/domain_set")
    request("http://one.test.com/domain_get").should have_body("one.test.com")
  end

  it "should keep the less specific domain cookie" do
    request("http://test.com/domain_set").should be_successful
    request("http://one.test.com/domain_set").should be_successful
    request("http://test.com/domain_get").should have_body("test.com")
  end

  it "should be able to handle multiple cookies" do
    request("/multiple").should have_body("1 - 1")
    request("/multiple").should have_body("2 - 2")
  end

  it "should respect the expiration" do
    request("/expires").should have_body("1")
    sleep(1)
    request("/expires").should have_body("1")
  end

end


text:
module Rubex
  module AST
    module Expression
      class BinaryExpo < Binary
        def analyse_types(local_scope)
          @left.analyse_types local_scope
          @right.analyse_types local_scope
          if type_of(@left).object? || type_of(@right).object?
            @left = @left.to_ruby_object
            @right = @right.to_ruby_object
            @subexprs << @left
            @subexprs << @right
          else
            @type = Rubex::DataType::F64.new
          end

        end

        def generate_evaluation_code code, local_scope
          generate_and_dispose_subexprs(code, local_scope) do
            if @type.object?
              code << "#{@c_code} = rb_funcall(#{@left.c_code(local_scope)}," +
                "rb_intern(\"#{@operator}\")," +
                "1, #{@right.c_code(local_scope)});"
              code.nl
            else
              @c_code = "( pow(#{@left.c_code(local_scope)}, #{@right.c_code(local_scope)}) )"
            end
          end
        end
      end
    end
  end
end


text:
app.service('sessionService', function($window, $http) {

  var session = {};

  var setSession = function(data) {
      session = data;
  };

  var getToken = function(){
      return session.token;
  };

  var getUser = function(){
      return session.user;
  };

  var checkAuth = function(callback){
    if (session.user) callback(true);
    var token = $window.localStorage.token;
    if (token) {
      $http.post('/api/authenticate', {token: token}).then(function(res) {
        session = res.data;
        callback(true);
      }, function(err) {
        if (err.data.message)
          console.log(err.data.message);
        callback(false);
      });
    } else {
      callback(false);
    }
  }

  return {
    setSession: setSession,
    getToken: getToken,
    getUser: getUser,
    checkAuth: checkAuth
  };

});


text:
namespace dotless.Core.Parser.Functions
{
    using Infrastructure;
    using Infrastructure.Nodes;
    using Tree;
    using Utils;

    public class RgbFunction : RgbaFunction
    {
        protected override Node Evaluate(Env env)
        {
            Guard.ExpectNumArguments(3, Arguments.Count, this, Index);

            Arguments.Add(new Number(1d, ""));

            return base.Evaluate(env);
        }
    }
}


text:
<?php

namespace phpSec\Auth;

/**
 * Provides one time password functionality.
 * @package phpSec
 */
class Otp {
  public $_charset = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';

  /**
   * phpSec core Pimple container.
   */
  private $psl = null;

  /**
   * Constructor.
   *
   * @param \phpSec\Core $psl
   *   phpSec core Pimple container.
   */
  public function __construct(\phpSec\Core $psl) {
    $this->psl = $psl;
  }

  /**
   * Generate a one-time-password (OTP). The password is only valid for a given time,
   * and must be delivered to the user instantly. The password is also only valid
   * for the current session.
   *
   * @param string $action
   *   The action to generate a OTP for. This should be as specific as possible.
   *   Used to ensure that the OTP is used for the intended action.
   *
   * @param string $uid
   *   User identifier. Default is a session identifier. Can be set to a username or user id
   *   if you want the OTP to be valid outside the session active when creating it.
   *
   * @param array $data
   *   Optional array of data that belongs to $action. Used to ensure that the action
   *   is performed with the same data as when the OTP was generated.
   *
   * @param integer $length
   *   OTP length.
   *
   * @param integer $ttl
   *   Time to live for the OTP. In seconds.
   *
   * @return string
   *   One time password that should be delivered to the user by for example email or SMS.
   *
   */
  public function generate($action, $uid = null, $data = null, $length = 6, $ttl = 480) {
    $rand  = $this->psl['crypt/rand'];
    $hash  = $this->psl['crypt/hash'];
    $store = $this->psl['store'];

    if($uid === null) {
	    $uid = $this->psl->getUid();
	  }

	  $pw = $rand->str($length, $this->_charset);

    $otp['pw']   = $hash->create($pw);
    $otp['data'] = $hash->create(serialize($data));
    $otp['ttl']  = time() + $ttl;

    if($store->write('otp', $this->storeId($uid, $action), $otp)) {
      return $pw;
    }
    return false;
  }

  /**
   * Validate a one-time-password.
   *
   * @param strgin $otp
   *   OTP supplied by user.
   *
   * @param string $action
   *   See phpsecOtp::generate().
   *
   * @param string $uid
   *   See phpsecOtp::generate().
   *
   * @param array $data
   *   See phpsecOtp::generate().
   *
   */
  public function validate($otp, $action, $uid = null, $data = null) {
    $hash  = $this->psl['crypt/hash'];
    $store = $this->psl['store'];

    if($uid === null) {
	    $uid = $this->psl->getUid();
	  }

    $storeData = $store->read('otp', $this->storeId($uid, $action));

    if($storeData !== false) {
      if($storeData['ttl'] < time()) {
        $store->delete('otp', $this->storeId($uid, $action));
        return false;
      }

      if($hash->check($otp, $storeData['pw']) && $hash->check(serialize($data), $storeData['data'])) {
        $store->delete('otp', $this->storeId($uid, $action));
        return true;
      }
    }
    return false;
  }

  private function storeId($uid, $action) {
    return hash('sha512', $uid.$action);
  }

}


text:
// WARNING: This module is part of the main bundle. Avoid adding to it if possible.

export default function toRGB(
  color: import("src/main/rendering/constants").Color
): string {
  return `rgb(${color.join(",")})`;
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.gbif.checklistbank.service.mybatis.UsageMapper">

  <sql id="select">id,dataset_key,name_fk,rank,parent_fk,is_synonym,status,name_published_in_fk,according_to_fk,origin</sql>
  <!--  A mapping to build a simple Usage for the batch service -->
  <resultMap id="usageResultMap" type="Usage" autoMapping="true">
    <id property="key" column="id"/>
    <result property="nameKey" column="name_fk"/>
    <result property="parentKey" column="parent_fk"/>
    <result property="namePublishedInKey" column="name_published_in_fk"/>
  </resultMap>

  <!--  list simple usage per dataset -->
  <select id="list" parameterType="map" resultMap="usageResultMap">
    SELECT <include refid="select"/>
    FROM name_usage
    WHERE dataset_key=#{uuid,jdbcType=OTHER}
    ORDER BY id
    LIMIT #{page.limit}
    OFFSET #{page.offset}
  </select>

  <delete id="deleteByDataset">
    DELETE FROM name_usage WHERE dataset_key=#{uuid,jdbcType=OTHER}
  </delete>

  <!-- missing: nom_status,basionym_fk,citation_fk -->
  <insert id="insert">
    INSERT INTO name_usage (<include refid="select"/>)
    VALUES
    #{u.key},
    #{uuid},
    #{u.nameKey},
    #{u.rank},
    #{u.parentKey},
    #{u.status.isSynonym()},
    #{u.status},
    #{u.namePublishedInKey},
    #{u.accordingToKey},
    #{u.origin}
  </insert>

</mapper>


text:
G_DEFINE_INTERFACE(FlKeyboardViewDelegate,
                   fl_keyboard_view_delegate,
                   G_TYPE_OBJECT)

static void fl_keyboard_view_delegate_default_init(
    FlKeyboardViewDelegateInterface* iface) {}

void fl_keyboard_view_delegate_send_key_event(FlKeyboardViewDelegate* self,
                                              const FlutterKeyEvent* event,
                                              FlutterKeyEventCallback callback,
                                              void* user_data) {
  g_return_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self));
  g_return_if_fail(event != nullptr);

  FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->send_key_event(
      self, event, callback, user_data);
}

gboolean fl_keyboard_view_delegate_text_filter_key_press(
    FlKeyboardViewDelegate* self,
    FlKeyEvent* event) {
  g_return_val_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self), false);
  g_return_val_if_fail(event != nullptr, false);

  return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->text_filter_key_press(
      self, event);
}

FlBinaryMessenger* fl_keyboard_view_delegate_get_messenger(
    FlKeyboardViewDelegate* self) {
  g_return_val_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self), nullptr);

  return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->get_messenger(self);
}

void fl_keyboard_view_delegate_redispatch_event(
    FlKeyboardViewDelegate* self,
    std::unique_ptr<FlKeyEvent> event) {
  g_return_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self));
  g_return_if_fail(event != nullptr);

  return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->redispatch_event(
      self, std::move(event));
}


text:
@extends('layouts.material_user')
@section('pageTitle') Receive Section : View All Fresh Purchase Orders @stop

@section('content')

      Prepare GRN : View All Fresh Accpeted Inspection Notes

          	@if(count($inspection_notes))

                  Sl No

                  Purchase Order Number

                  Tender Number

                  Purchase Indent Number

                  Department

                Action/Current Status

                	View Details

                @foreach($inspection_notes as $k => $v)

                    {{ $k+1 }}

                    {{ $v->purchase_order['purchase_order_number'] }} dtd. {{ date('d-m-Y', strtotime($v->purchase_order['purchase_order_date'])) }}

                    {{ $v->purchase_order->nit_quotation->nit['nit_number'] }}

                    @foreach($v->purchase_order->nit_quotation->nit->purchase_indents as $pi)
                      {{ $pi->purchase_indent['reference_number'] }} dtd. {{ date('d-m-Y h:i A', strtotime($pi->purchase_indent['purchase_indent_date'])) }}
                    @endforeach

                    @foreach($v->purchase_order->nit_quotation->nit->purchase_indents as $pi)
                      {{ $pi->purchase_indent->department['name'] }}
                    @endforeach

                  	id)) }}" class="btn btn-success btn-sm">Prepare GRN

                    purchase_order['id'])) }}">View Purchase Order

                @endforeach

            @else

 NO RESULTS FOUND

            @endif

@section('page_css')

@stop
@stop


text:
/
{
    PMCGEN_TRACE_CONTEXT Ctx = (PMCGEN_TRACE_CONTEXT)CallbackContext;
    ULONG Ix;
#ifndef MCGEN_PRIVATE_ENABLE_CALLBACK_V2
    UNREFERENCED_PARAMETER(SourceId);
    UNREFERENCED_PARAMETER(FilterData);
#endif

    if (Ctx == NULL) {
        return;
    }

    switch (ControlCode) {

        case EVENT_CONTROL_CODE_ENABLE_PROVIDER:
            Ctx->Level = Level;
            Ctx->MatchAnyKeyword = MatchAnyKeyword;
            Ctx->MatchAllKeyword = MatchAllKeyword;
            Ctx->IsEnabled = EVENT_CONTROL_CODE_ENABLE_PROVIDER;

            for (Ix = 0; Ix < Ctx->EnableBitsCount; Ix += 1) {
                if (McGenLevelKeywordEnabled(Ctx, Ctx->EnableLevel[Ix], Ctx->EnableKeyWords[Ix]) != FALSE) {
                    Ctx->EnableBitMask[Ix >> 5] |= (1 << (Ix % 32));
                } else {
                    Ctx->EnableBitMask[Ix >> 5] &= ~(1 << (Ix % 32));
                }
            }
            break;

        case EVENT_CONTROL_CODE_DISABLE_PROVIDER:
            Ctx->IsEnabled = EVENT_CONTROL_CODE_DISABLE_PROVIDER;
            Ctx->Level = 0;
            Ctx->MatchAnyKeyword = 0;
            Ctx->MatchAllKeyword = 0;
            if (Ctx->EnableBitsCount > 0) {
                RtlZeroMemory(Ctx->EnableBitMask, (((Ctx->EnableBitsCount - 1) / 32) + 1) * sizeof(ULONG));
            }
            break;

        default:
            break;
    }

#ifdef MCGEN_PRIVATE_ENABLE_CALLBACK_V2
    //
    // Call user defined callback
    //
    MCGEN_PRIVATE_ENABLE_CALLBACK_V2(
        SourceId,
        ControlCode,
        Level,
        MatchAnyKeyword,
        MatchAllKeyword,
        FilterData,
        CallbackContext
        );
#endif

    return;
}

#endif
#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION
//+
// Provider LazyCopyDriver Event Count 11
//+
EXTERN_C __declspec(selectany) const GUID LazyCopyDriverGuid = {0x0fe08ee4, 0xb08f, 0x4d27, {0x8c, 0xbb, 0xc8, 0x16, 0x30, 0x8a, 0xe2, 0x35}};

//
// Channel
//
#define LazyCopyDriverGuid_CHANNEL_System 0x8

//
// Tasks
//
#define File_Fetch 0x1
EXTERN_C __declspec(selectany) const GUID File_FetchId = {0xbfdb9f63, 0x0939, 0x4a77, {0x93, 0x82, 0x2f, 0x31, 0x70, 0x5d, 0x5d, 0xba}};
#define Driver_Init 0x2
EXTERN_C __declspec(selectany) const GUID Driver_InitId = {0x5d9eda03, 0xb418, 0x4f19, {0x86, 0xa4, 0xdd, 0xc0, 0xea, 0xf2, 0x42, 0x2b}};
#define Configuration_Load 0x3
EXTERN_C __declspec(selectany) const GUID Configuration_LoadId = {0x0c74bd94, 0x1354, 0x4bce, {0x84, 0x7d, 0x97, 0x8c, 0xd1, 0x11, 0xf5, 0xb5}};
#define File_Open 0x4
EXTERN_C __declspec(selectany) const GUID File_OpenId = {0xe38de1ef, 0xe7ef, 0x4e73, {0x83, 0x95, 0x47, 0xaa, 0xf3, 0x2c, 0x29, 0xb5}};
//
// Keyword
//
#define Performance 0x2
#define Failure 0x1

//
// Event Descriptors
//
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FileAccessedEvent = {0x1, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0};
#define FileAccessedEvent_value 0x1
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FileFetchedEvent = {0x2, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0};
#define FileFetchedEvent_value 0x2
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR FileNotFetchedEvent = {0x3, 0x1, 0x8, 0x2, 0x0, 0x0, 0x8000000000000001};
#define FileNotFetchedEvent_value 0x3
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR File_Fetch_Start = {0x64, 0x1, 0x0, 0x4, 0x1, 0x1, 0x2};
#define File_Fetch_Start_value 0x64
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR File_Fetch_Stop = {0x65, 0x1, 0x0, 0x4, 0x2, 0x1, 0x2};
#define File_Fetch_Stop_value 0x65
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Driver_Init_Start = {0x66, 0x1, 0x0, 0x4, 0x1, 0x2, 0x2};
#define Driver_Init_Start_value 0x66
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Driver_Init_Stop = {0x67, 0x1, 0x0, 0x4, 0x2, 0x2, 0x2};
#define Driver_Init_Stop_value 0x67
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Configuration_Load_Start = {0x68, 0x1, 0x0, 0x4, 0x1, 0x3, 0x2};
#define Configuration_Load_Start_value 0x68
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Configuration_Load_Stop = {0x69, 0x1, 0x0, 0x4, 0x2, 0x3, 0x2};
#define Configuration_Load_Stop_value 0x69
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR File_Open_Start = {0x6a, 0x1, 0x0, 0x4, 0x1, 0x4, 0x2};
#define File_Open_Start_value 0x6a
EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR File_Open_Stop = {0x6b, 0x1, 0x0, 0x4, 0x2, 0x4, 0x2};
#define File_Open_Stop_value 0x6b

//
// Note on Generate Code from Manifest Windows Vista and above
//
//Structures :  are handled as a size and pointer pairs. The macro for the event will have an extra
//parameter for the size in bytes of the structure. Make sure that your structures have no extra padding.
//
//Strings: There are several cases that can be described in the manifest. For array of variable length
//strings, the generated code will take the count of characters for the whole array as an input parameter.
//
//SID No support for array of SIDs, the macro will take a pointer to the SID and use appropriate
//GetLengthSid function to get the length.
//

//
// Allow Diasabling of code generation
//
#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION

//
// Globals
//

//
// Event Enablement Bits
//

EXTERN_C __declspec(selectany) DECLSPEC_CACHEALIGN ULONG LazyCopyDriverEnableBits[1];
EXTERN_C __declspec(selectany) const ULONGLONG LazyCopyDriverKeywords[3] = {0x0, 0x8000000000000001, 0x2};
EXTERN_C __declspec(selectany) const UCHAR LazyCopyDriverLevels[3] = {4, 2, 4};
EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT LazyCopyDriverGuid_Context = {0, 0, 0, 0, 0, 0, 0, 0, 3, LazyCopyDriverEnableBits, LazyCopyDriverKeywords, LazyCopyDriverLevels};

EXTERN_C __declspec(selectany) REGHANDLE LazyCopyDriverHandle = (REGHANDLE)0;

#if !defined(McGenEventRegisterUnregister)
#define McGenEventRegisterUnregister
DECLSPEC_NOINLINE __inline
ULONG __stdcall
McGenEventRegister(
    _In_ LPCGUID ProviderId,
    _In_opt_ PETWENABLECALLBACK EnableCallback,
    _In_opt_ PVOID CallbackContext,
    _Inout_ PREGHANDLE RegHandle
    )
/*++

Routine Description:

    This function register the provider with ETW KERNEL mode.

Arguments:
    ProviderId - Provider Id to be register with ETW.

    EnableCallback - Callback to be used.

    CallbackContext - Context for this provider.

    RegHandle - Pointer to Registration handle.

Remarks:

    If the handle != NULL will return ERROR_SUCCESS

--*/
{
    ULONG Error;

    if (*RegHandle) {
        //
        // already registered
        //
        return STATUS_SUCCESS;
    }

    Error = EtwRegister( ProviderId, EnableCallback, CallbackContext, RegHandle);

    return Error;
}

DECLSPEC_NOINLINE __inline
ULONG __stdcall
McGenEventUnregister(_Inout_ PREGHANDLE RegHandle)
/*++

Routine Description:

    Unregister from ETW KERNEL mode

Arguments:
            RegHandle this is the pointer to the provider context
Remarks:
            If Provider has not register RegHandle = NULL,
            return ERROR_SUCCESS
--*/
{
    ULONG Error;

    if(!(*RegHandle)) {
        //
        // Provider has not registerd
        //
        return STATUS_SUCCESS;
    }

    Error = EtwUnregister(*RegHandle);
    *RegHandle = (REGHANDLE)0;

    return Error;
}
#endif
//
// Register with ETW Vista +
//
#ifndef EventRegisterLazyCopyDriver
#define EventRegisterLazyCopyDriver() McGenEventRegister(&LazyCopyDriverGuid, McGenControlCallbackV2, &LazyCopyDriverGuid_Context, &LazyCopyDriverHandle)
#endif

//
// UnRegister with ETW
//
#ifndef EventUnregisterLazyCopyDriver
#define EventUnregisterLazyCopyDriver() McGenEventUnregister(&LazyCopyDriverHandle)
#endif

//
// Enablement check macro for FileAccessedEvent
//

#define EventEnabledFileAccessedEvent() ((LazyCopyDriverEnableBits[0] & 0x00000001) != 0)

//
// Event Macro for FileAccessedEvent
//
#define EventWriteFileAccessedEvent(Activity, Path, CreateOptions)\
        EventEnabledFileAccessedEvent() ?\
        Template_zx(LazyCopyDriverHandle, &FileAccessedEvent, Activity, Path, CreateOptions)\
        : STATUS_SUCCESS\

//
// Enablement check macro for FileFetchedEvent
//

#define EventEnabledFileFetchedEvent() ((LazyCopyDriverEnableBits[0] & 0x00000001) != 0)

//
// Event Macro for FileFetchedEvent
//
#define EventWriteFileFetchedEvent(Activity, LocalPath, RemotePath, Size)\
        EventEnabledFileFetchedEvent() ?\
        Template_zzi(LazyCopyDriverHandle, &FileFetchedEvent, Activity, LocalPath, RemotePath, Size)\
        : STATUS_SUCCESS\

//
// Enablement check macro for FileNotFetchedEvent
//

#define EventEnabledFileNotFetchedEvent() ((LazyCopyDriverEnableBits[0] & 0x00000002) != 0)

//
// Event Macro for FileNotFetchedEvent
//
#define EventWriteFileNotFetchedEvent(Activity, Path, RemoteRoot, Status)\
        EventEnabledFileNotFetchedEvent() ?\
        Template_zzi(LazyCopyDriverHandle, &FileNotFetchedEvent, Activity, Path, RemoteRoot, Status)\
        : STATUS_SUCCESS\

//
// Enablement check macro for File_Fetch_Start
//

#define EventEnabledFile_Fetch_Start() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for File_Fetch_Start
//
#define EventWriteFile_Fetch_Start(Activity)\
        EventEnabledFile_Fetch_Start() ?\
        TemplateEventDescriptor(LazyCopyDriverHandle, &File_Fetch_Start, Activity)\
        : STATUS_SUCCESS\

//
// Enablement check macro for File_Fetch_Stop
//

#define EventEnabledFile_Fetch_Stop() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for File_Fetch_Stop
//
#define EventWriteFile_Fetch_Stop(Activity)\
        EventEnabledFile_Fetch_Stop() ?\
        TemplateEventDescriptor(LazyCopyDriverHandle, &File_Fetch_Stop, Activity)\
        : STATUS_SUCCESS\

//
// Enablement check macro for Driver_Init_Start
//

#define EventEnabledDriver_Init_Start() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for Driver_Init_Start
//
#define EventWriteDriver_Init_Start(Activity)\
        EventEnabledDriver_Init_Start() ?\
        TemplateEventDescriptor(LazyCopyDriverHandle, &Driver_Init_Start, Activity)\
        : STATUS_SUCCESS\

//
// Enablement check macro for Driver_Init_Stop
//

#define EventEnabledDriver_Init_Stop() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for Driver_Init_Stop
//
#define EventWriteDriver_Init_Stop(Activity)\
        EventEnabledDriver_Init_Stop() ?\
        TemplateEventDescriptor(LazyCopyDriverHandle, &Driver_Init_Stop, Activity)\
        : STATUS_SUCCESS\

//
// Enablement check macro for Configuration_Load_Start
//

#define EventEnabledConfiguration_Load_Start() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for Configuration_Load_Start
//
#define EventWriteConfiguration_Load_Start(Activity)\
        EventEnabledConfiguration_Load_Start() ?\
        TemplateEventDescriptor(LazyCopyDriverHandle, &Configuration_Load_Start, Activity)\
        : STATUS_SUCCESS\

//
// Enablement check macro for Configuration_Load_Stop
//

#define EventEnabledConfiguration_Load_Stop() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for Configuration_Load_Stop
//
#define EventWriteConfiguration_Load_Stop(Activity)\
        EventEnabledConfiguration_Load_Stop() ?\
        TemplateEventDescriptor(LazyCopyDriverHandle, &Configuration_Load_Stop, Activity)\
        : STATUS_SUCCESS\

//
// Enablement check macro for File_Open_Start
//

#define EventEnabledFile_Open_Start() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for File_Open_Start
//
#define EventWriteFile_Open_Start(Activity, Path)\
        EventEnabledFile_Open_Start() ?\
        Template_z(LazyCopyDriverHandle, &File_Open_Start, Activity, Path)\
        : STATUS_SUCCESS\

//
// Enablement check macro for File_Open_Stop
//

#define EventEnabledFile_Open_Stop() ((LazyCopyDriverEnableBits[0] & 0x00000004) != 0)

//
// Event Macro for File_Open_Stop
//
#define EventWriteFile_Open_Stop(Activity)\
        EventEnabledFile_Open_Stop() ?\
        TemplateEventDescriptor(LazyCopyDriverHandle, &File_Open_Stop, Activity)\
        : STATUS_SUCCESS\

#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION

//
// Allow Diasabling of code generation
//
#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION

//
// Template Functions
//
//
//Template from manifest : FileAccessTemplate
//
#ifndef Template_zx_def
#define Template_zx_def
ETW_INLINE
ULONG
Template_zx(
    _In_ REGHANDLE RegHandle,
    _In_ PCEVENT_DESCRIPTOR Descriptor,
    _In_opt_ LPCGUID Activity,
    _In_opt_ PCWSTR  _Arg0,
    _In_ unsigned __int64  _Arg1
    )
{
#define ARGUMENT_COUNT_zx 2

    EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_zx];

    EventDataDescCreate(&EventData[0],
                        (_Arg0 != NULL) ? _Arg0 : L"NULL",
                        (_Arg0 != NULL) ? (ULONG)((wcslen(_Arg0) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"NULL"));

    EventDataDescCreate(&EventData[1], &_Arg1, sizeof(unsigned __int64)  );

    return EtwWrite(RegHandle, Descriptor, Activity, ARGUMENT_COUNT_zx, EventData);
}
#endif

//
//Template from manifest : FileFetchTemplate
//
#ifndef Template_zzi_def
#define Template_zzi_def
ETW_INLINE
ULONG
Template_zzi(
    _In_ REGHANDLE RegHandle,
    _In_ PCEVENT_DESCRIPTOR Descriptor,
    _In_opt_ LPCGUID Activity,
    _In_opt_ PCWSTR  _Arg0,
    _In_opt_ PCWSTR  _Arg1,
    _In_ signed __int64  _Arg2
    )
{
#define ARGUMENT_COUNT_zzi 3

    EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_zzi];

    EventDataDescCreate(&EventData[0],
                        (_Arg0 != NULL) ? _Arg0 : L"NULL",
                        (_Arg0 != NULL) ? (ULONG)((wcslen(_Arg0) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"NULL"));

    EventDataDescCreate(&EventData[1],
                        (_Arg1 != NULL) ? _Arg1 : L"NULL",
                        (_Arg1 != NULL) ? (ULONG)((wcslen(_Arg1) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"NULL"));

    EventDataDescCreate(&EventData[2], &_Arg2, sizeof(signed __int64)  );

    return EtwWrite(RegHandle, Descriptor, Activity, ARGUMENT_COUNT_zzi, EventData);
}
#endif

//
//Template from manifest : (null)
//
#ifndef TemplateEventDescriptor_def
#define TemplateEventDescriptor_def

ETW_INLINE
ULONG
TemplateEventDescriptor(
    _In_ REGHANDLE RegHandle,
    _In_ PCEVENT_DESCRIPTOR Descriptor,
    _In_opt_ LPCGUID Activity
    )
{
    return EtwWrite(RegHandle, Descriptor, Activity, 0, NULL);
}
#endif

//
//Template from manifest : FileOpenTemplate
//
#ifndef Template_z_def
#define Template_z_def
ETW_INLINE
ULONG
Template_z(
    _In_ REGHANDLE RegHandle,
    _In_ PCEVENT_DESCRIPTOR Descriptor,
    _In_opt_ LPCGUID Activity,
    _In_opt_ PCWSTR  _Arg0
    )
{
#define ARGUMENT_COUNT_z 1

    EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_z];

    EventDataDescCreate(&EventData[0],
                        (_Arg0 != NULL) ? _Arg0 : L"NULL",
                        (_Arg0 != NULL) ? (ULONG)((wcslen(_Arg0) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"NULL"));

    return EtwWrite(RegHandle, Descriptor, Activity, ARGUMENT_COUNT_z, EventData);
}
#endif

#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION

#if defined(__cplusplus)
};
#endif

#define MSG_LazyCopyDriver_event_3_message   0x00000003L
#define MSG_opcode_Start                     0x30000001L
#define MSG_opcode_Stop                      0x30000002L
#define MSG_level_Error                      0x50000002L
#define MSG_level_Informational              0x50000004L
#define MSG_task_None                        0x70000000L
#define MSG_channel_System                   0x90000001L
#define MSG_LazyCopyDriver_event_0_message   0xB0010001L
#define MSG_LazyCopyDriver_event_2_message   0xB0010002L


text:
<?php

namespace Lunr\Vortex\MPNS\Tests;

use Lunr\Vortex\MPNS\MPNSPriority;

/**
 * This class contains tests for the getters of the MPNSPayload class.
 *
 * @covers Lunr\Vortex\MPNS\MPNSPayload
 */
class MPNSPayloadGetTest extends MPNSPayloadTest
{

    /**
     * Test get_priority() works correctly.
     *
     * @covers Lunr\Vortex\MPNS\MPNSPayload::get_priority
     */
    public function testSetPioritySetsValidPriority()
    {
        $this->assertEquals(MPNSPriority::DEFAULT, $this->class->get_priority());
    }

}

?>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Tests" verbose="5">
	<test name="AddFilmSuccessfully">
		<classes>
		  <class name="ru.stqa.selenium.AddFilmSuccessfully"/>
		</classes>
	</test>
	<test name="RemoveFilm">
		<classes>
		  <class name="ru.stqa.selenium.RemoveFilm"/>
		</classes>
	</test>
</suite>


text:
cask 'setapp' do
  version :latest
  sha256 :no_check

  # devmate.com/com.setapp.InstallSetapp was verified as official when first introduced to the cask
  url 'https://dl.devmate.com/com.setapp.InstallSetapp/InstallSetapp.zip'
  name 'Setapp'
  homepage 'https://setapp.com/'

  installer manual: 'Install Setapp.app'

  uninstall script: {
                      executable: "#{appdir}/Setapp.app/Contents/Resources/SetappUninstaller.app/Contents/Resources/removeSetapp.sh",
                      sudo:       true,
                    }

  zap delete: [
                '~/Library/Application Scripts/com.setapp.DesktopClient.SetappAgent.FinderSyncExt',
                '~/Library/Caches/com.setapp.DesktopClient',
                '~/Library/Caches/com.setapp.DesktopClient.SetappAgent',
                '~/Library/Logs/Setapp',
                '~/Library/Saved Application State/com.setapp.DesktopClient.savedState',
              ],
      trash:  '~/Library/Preferences/com.setapp.DesktopClient.SetappAgent.plist'
end


text:
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"strings"

	"github.com/spf13/cobra"
	"k8s.io/helm/pkg/chartutil"
	"k8s.io/helm/pkg/repo"
)

var untarFile bool
var untarDir string

func init() {
	RootCommand.AddCommand(fetchCmd)
	fetchCmd.Flags().BoolVar(&untarFile, "untar", false, "If set to true, will untar the chart after downloading it.")
	fetchCmd.Flags().StringVar(&untarDir, "untardir", ".", "If untar is specified, this flag specifies where to untar the chart.")
}

var fetchCmd = &cobra.Command{
	Use:   "fetch [chart URL | repo/chartname]",
	Short: "Download a chart from a repository and (optionally) unpack it in local directory.",
	Long:  "",
	RunE:  fetch,
}

func fetch(cmd *cobra.Command, args []string) error {
	if len(args) == 0 {
		return fmt.Errorf("This command needs at least one argument, url or repo/name of the chart.")
	}

	pname := args[0]
	if filepath.Ext(pname) != ".tgz" {
		pname += ".tgz"
	}

	f, err := repo.LoadRepositoriesFile(repositoriesFile())
	if err != nil {
		return err
	}

	// get download url
	u, err := mapRepoArg(pname, f.Repositories)
	if err != nil {
		return err
	}

	resp, err := http.Get(u.String())
	if err != nil {
		return err
	}
	if resp.StatusCode != 200 {
		return fmt.Errorf("Failed to fetch %s : %s", u.String(), resp.Status)
	}

	defer resp.Body.Close()
	if untarFile {
		return chartutil.Expand(untarDir, resp.Body)
	}
	p := strings.Split(u.String(), "/")
	return saveChartFile(p[len(p)-1], resp.Body)
}

// mapRepoArg figures out which format the argument is given, and creates a fetchable
// url from it.
func mapRepoArg(arg string, r map[string]string) (*url.URL, error) {
	// See if it's already a full URL.
	u, err := url.ParseRequestURI(arg)
	if err == nil {
		// If it has a scheme and host and path, it's a full URL
		if u.IsAbs() && len(u.Host) > 0 && len(u.Path) > 0 {
			return u, nil
		}
		return nil, fmt.Errorf("Invalid chart url format: %s", arg)
	}
	// See if it's of the form: repo/path_to_chart
	p := strings.Split(arg, "/")
	if len(p) > 1 {
		if baseURL, ok := r[p[0]]; ok {
			if !strings.HasSuffix(baseURL, "/") {
				baseURL = baseURL + "/"
			}
			return url.ParseRequestURI(baseURL + strings.Join(p[1:], "/"))
		}
		return nil, fmt.Errorf("No such repo: %s", p[0])
	}
	return nil, fmt.Errorf("Invalid chart url format: %s", arg)
}

func saveChartFile(c string, r io.Reader) error {
	// Grab the chart name that we'll use for the name of the file to download to.
	out, err := os.Create(c)
	if err != nil {
		return err
	}
	defer out.Close()

	_, err = io.Copy(out, r)
	return err
}


text:
// Copyright (c) 2011 Sirikata Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.

#include "ManualMaterialLoader.hpp"
#include <OgreTextureUnitState.h>
#include <OgreMaterial.h>
#include <OgreTechnique.h>
#include <OgrePass.h>
#include <sirikata/core/transfer/URL.hpp>

namespace Sirikata {
namespace Graphics {

using namespace Sirikata::Mesh;

// A few utilities
namespace {

Ogre::TextureUnitState::TextureAddressingMode translateWrapMode(MaterialEffectInfo::Texture::WrapMode w) {
    switch(w) {
      case MaterialEffectInfo::Texture::WRAP_MODE_CLAMP:
        SILOG(ogre,insane,"CLAMPING");
        return Ogre::TextureUnitState::TAM_CLAMP;
      case MaterialEffectInfo::Texture::WRAP_MODE_MIRROR:
        SILOG(ogre,insane,"MIRRORING");
        return Ogre::TextureUnitState::TAM_MIRROR;
      case MaterialEffectInfo::Texture::WRAP_MODE_WRAP:
      default:
        SILOG(ogre,insane,"WRAPPING");
        return Ogre::TextureUnitState::TAM_WRAP;
    }
}

void fixupTextureUnitState(Ogre::TextureUnitState*tus, const MaterialEffectInfo::Texture&tex) {
    tus->setTextureAddressingMode(translateWrapMode(tex.wrapS),
                                  translateWrapMode(tex.wrapT),
                                  translateWrapMode(tex.wrapU));

}

}

ManualMaterialLoader::ManualMaterialLoader(
    VisualPtr visptr,
    const String name,
    const MaterialEffectInfo&mat,
    const Transfer::URI& uri,
    TextureBindingsMapPtr textureFingerprints)
 : mTextureFingerprints(textureFingerprints)
{
    // mVisualPtr keeps mMat pointer valid
    mVisualPtr = visptr;
    mName = name;
    mMat=&mat;
    mURI=uri;
}

void ManualMaterialLoader::loadResource(Ogre::Resource *r) {
    using namespace Ogre;
    Material* material= dynamic_cast <Material*> (r);
    material->setCullingMode(CULL_NONE);
    Ogre::Technique* tech=material->getTechnique(0);
    bool useAlpha=false;
    if (mMat->textures.empty()) {
        Ogre::Pass*pass=tech->getPass(0);
        pass->setDiffuse(ColourValue(1,1,1,1));
        pass->setAmbient(ColourValue(1,1,1,1));
        pass->setSelfIllumination(ColourValue(0,0,0,0));
        pass->setSpecular(ColourValue(1,1,1,1));
    }
    for (size_t i=0;i<mMat->textures.size();++i) {
        // NOTE: We're currently disabling using alpha when the
        // texture is specified for OPACITY because we're not
        // handling it in the code below, leading to artifacts as
        // it seemingly uses random segments of memory for the
        // alpha values (maybe because it tries reading them from
        // some texture other texture that doesn't specify
        // alpha?).
        if (mMat->textures[i].affecting==MaterialEffectInfo::Texture::OPACITY &&
            (/*mMat->textures[i].uri.length() > 0 ||*/
                (mMat->textures[i].uri.length() == 0 && mMat->textures[i].color.w<1.0))) {
            useAlpha=true;
            break;
        }
    }
    unsigned int valid_passes=0;
    {
        Ogre::Pass* pass = tech->getPass(0);
        pass->setAmbient(ColourValue(0,0,0,0));
        pass->setDiffuse(ColourValue(0,0,0,0));
        pass->setSelfIllumination(ColourValue(0,0,0,0));
        pass->setSpecular(ColourValue(0,0,0,0));
    }
    for (size_t i=0;i<mMat->textures.size();++i) {
        MaterialEffectInfo::Texture tex=mMat->textures[i];
        Ogre::Pass*pass = tech->getPass(0);
        if (tex.uri.length()==0) { // Flat colors
            switch (tex.affecting) {
              case MaterialEffectInfo::Texture::DIFFUSE:
                pass->setDiffuse(ColourValue(tex.color.x,
                        tex.color.y,
                        tex.color.z,
                        tex.color.w));
                break;
              case MaterialEffectInfo::Texture::AMBIENT:
                pass->setAmbient(ColourValue(tex.color.x,
                        tex.color.y,
                        tex.color.z,
                        tex.color.w));
                break;
              case MaterialEffectInfo::Texture::EMISSION:
                pass->setSelfIllumination(ColourValue(tex.color.x,
                        tex.color.y,
                        tex.color.z,
                        tex.color.w));
                break;
              case MaterialEffectInfo::Texture::SPECULAR:
                pass->setSpecular(ColourValue(tex.color.x,
                        tex.color.y,
                        tex.color.z,
                        tex.color.w));
                pass->setShininess(mMat->shininess);
                break;
              default:
                break;
            }
        }
        else if (tex.affecting==MaterialEffectInfo::Texture::DIFFUSE ||
            tex.affecting==MaterialEffectInfo::Texture::AMBIENT)
        { // or textured
            // FIXME other URI schemes besides URL
            Transfer::URL url(mURI);
            // Non-empty parent URL or absolute texture URL
            assert(!url.empty() || (!Transfer::URI(tex.uri).empty()) );
            Transfer::URI mat_uri( Transfer::URL(url.context(), tex.uri).toString() );
            TextureBindingsMap::iterator where = mTextureFingerprints->find(mat_uri.toString());
            if (where!=mTextureFingerprints->end()) {
                String ogreTextureName = where->second;
                Ogre::TextureUnitState*tus;
                //tus->setTextureName(tex.uri);
                //tus->setTextureCoordSet(tex.texCoord);
                if (useAlpha==false) {
                    pass->setAlphaRejectValue(.5);
                    pass->setAlphaRejectSettings(CMPF_GREATER,128,true);
                    if (true||i==0) {
                        pass->setSceneBlending(SBF_ONE,SBF_ZERO);
                    } else {
                        pass->setSceneBlending(SBF_ONE,SBF_ONE);
                    }
                }else {
                    pass->setDepthWriteEnabled(false);
                    pass->setDepthCheckEnabled(true);
                    if (true||i==0) {
                        pass->setSceneBlending(SBF_SOURCE_ALPHA,SBF_ONE_MINUS_SOURCE_ALPHA);
                    }else {
                        pass->setSceneBlending(SBF_SOURCE_ALPHA,SBF_ONE);
                    }
                }
                switch (tex.affecting) {
                  case MaterialEffectInfo::Texture::DIFFUSE:
                    if (tech->getNumPasses()<=valid_passes) {
                        pass = tech->createPass();
                        ++valid_passes;
                    }
                    pass->setDiffuse(ColourValue(1,1,1,1));

                    //pass->setIlluminationStage(IS_PER_LIGHT);
                    if (pass->getTextureUnitState(ogreTextureName) == 0) {
                        tus=pass->createTextureUnitState(ogreTextureName,tex.texCoord);
                        fixupTextureUnitState(tus,tex);
                        tus->setColourOperation(LBO_MODULATE);
                    }

                    break;
                  case MaterialEffectInfo::Texture::AMBIENT:
                    if (tech->getNumPasses()<=valid_passes) {
                        pass = tech->createPass();
                        ++valid_passes;
                    }

                    pass->setAmbient(ColourValue(1.0,1.0,1.0,1));
                    // NOTE: Currently ambient and diffuse are mutually
                    // exclusive. We need to make sure that the diffuse is
                    // non-zero so it actually shades. Otherwise, the
                    // ambient seems to have no effect. To do that, we set
                    // it to black, but with non-zero alpha.
                    pass->setDiffuse(ColourValue(0,0,0,1));

                    if (pass->getTextureUnitState(ogreTextureName) == 0) {
                        tus=pass->createTextureUnitState(ogreTextureName,tex.texCoord);
                        fixupTextureUnitState(tus,tex);
                        tus->setColourOperation(LBO_MODULATE);
                    }

                    pass->setIlluminationStage(IS_AMBIENT);
                    break;
                  case MaterialEffectInfo::Texture::EMISSION:
                    if (pass->getTextureUnitState(ogreTextureName) == 0) {
                        tus=pass->createTextureUnitState(ogreTextureName,tex.texCoord);
                        fixupTextureUnitState(tus,tex);
                        //pass->setSelfIllumination(ColourValue(1,1,1,1));
                        tus->setColourOperation(LBO_ADD);
                    }

                    //pass->setIlluminationStage(IS_DECAL);
                    break;
                  case MaterialEffectInfo::Texture::SPECULAR:
                    if (tech->getNumPasses()<=valid_passes) {
                        pass = tech->createPass();
                        ++valid_passes;
                    }

                    //pass->setIlluminationStage(IS_PER_LIGHT);

                    if (pass->getTextureUnitState(ogreTextureName) == 0) {
                        tus=pass->createTextureUnitState(ogreTextureName,tex.texCoord);
                        fixupTextureUnitState(tus,tex);
                        tus->setColourOperation(LBO_MODULATE);
                    }
                    pass->setSpecular(ColourValue(1,1,1,1));
                    break;
                  default:
                    break;
                }
            }
        }
    }
}

} // namespace Graphics
} // namespace Sirikata