text:
////////////////////////////////////////////////////////////////////////////////
// Directory Walker
//
// Walks directories recursively and executes handlers on each object.
// Only synchronous walking is supported because async can only be done
// with CPS (continuation-passing style), which is complicated and adds
// restrictions to the callbacks.
////////////////////////////////////////////////////////////////////////////////
/*global require, exports, process, console */
var	$fs = require('fs'),

// - dirHandler: called for each directory
// - fileHandler: called for each file
// - options:
//   - filter: regex for filtering file names
walker = function (dirHandler, fileHandler, options) {
	// defaults
	dirHandler = dirHandler || function () { };
	fileHandler = fileHandler || function () { };
	options = options || { filter: new RegExp('^.+\\.(wmv|avi|mov|mp4|mkv|webm|flv|ogv|mpeg|3gp|divx)$', 'ig'), hidden: false };

	var self = {
		// synchronous directory walking
		// when the function returns, the whole process has completed
		// - root: root path
		// - maxDepth: maximum depth
		walkSync: function (root, maxDepth) {
			var	fileCount = 0,
					hasMaxDepth = typeof maxDepth !== 'undefined';

			// recursive inner function
			// - relative: path relative to root
			console.log("WALKER - walking path: " + root + (hasMaxDepth ?  ", max depth: " + maxDepth : ""));

			(function walk(relative, depth) {
				if (++fileCount % 16 === 0) {
					process.stdout.write(".");
				}

				var	i,
						files,
						path = root + relative,
						stats;

				// obtaining file stats
				try {
					stats = $fs.lstatSync(path);
				} catch (e_exist) {
					throw "The specified path: " + path + " doesn't exist or is inaccessible.";
				}

				if (stats.isDirectory()) {
					// listing directory
					try {
						files = $fs.readdirSync(path);
					} catch (e_perm) {
						// returning on insufficient permissions
						return;
					}

					// calling directory callback
					dirHandler(relative, stats);

					// processing directory contents
					for (i = 0; i < files.length; i++) {
						// optionally excluding hidden files
						if ((options.hidden || files[i][0] !== '.') &&
							(!hasMaxDepth || depth < maxDepth)) {
							walk(relative + '/' + files[i], depth + 1);
						}
					}
				} else if (stats.isFile()) {
					// calling file handler
					if (path.match(options.filter)) {
						fileHandler(relative, stats);
					}
				}
			})('', 0);

			if (fileCount > 16) {
				process.stdout.write("\n");
			}

			return self;
		}
	};

	return self;
};

// exports
exports.walker = walker;


text:
using System;
using System.Linq;
using Microsoft.ServiceBus.Messaging;
using Nimbus.Extensions;
using Nimbus.InfrastructureContracts;

namespace Nimbus.Infrastructure.RequestResponse
{
    public class ResponseMessagePump : MessagePump
    {
        private readonly MessagingFactory _messagingFactory;
        private readonly string _replyQueueName;
        private readonly RequestResponseCorrelator _requestResponseCorrelator;

        private MessageReceiver _receiver;

        internal ResponseMessagePump(MessagingFactory messagingFactory, string replyQueueName, RequestResponseCorrelator requestResponseCorrelator, ILogger logger, int batchSize)
            : base(logger, batchSize)
        {
            _messagingFactory = messagingFactory;
            _replyQueueName = replyQueueName;
            _requestResponseCorrelator = requestResponseCorrelator;
        }

        public override void Start()
        {
            _receiver = _messagingFactory.CreateMessageReceiver(_replyQueueName);

            base.Start();
        }

        public override void Stop()
        {
            if (_receiver != null) _receiver.Close();

            base.Stop();
        }

        protected override BrokeredMessage[] ReceiveMessages()
        {
            return _receiver.ReceiveBatch(BatchSize, BatchTimeout).ToArray();
        }

        protected override void PumpMessage(BrokeredMessage message)
        {
            var correlationId = Guid.Parse(message.CorrelationId);
            var responseCorrelationWrapper = _requestResponseCorrelator.TryGetWrapper(correlationId);
            if (responseCorrelationWrapper == null)
            {
                Logger.Debug("Could not find correlation wrapper for reply {0} ({1}", correlationId, message.Properties[MessagePropertyKeys.MessageType]);
                return;
            }

            var success = (bool) message.Properties[MessagePropertyKeys.RequestSuccessfulKey];
            if (success)
            {
                Logger.Debug("Request {0} was successful. Dispatching reply to correlation wrapper.", correlationId);

                var responseType = responseCorrelationWrapper.ResponseType;
                var response = message.GetBody(responseType);
                responseCorrelationWrapper.Reply(response);

                Logger.Debug("Response {0} dispatched.", correlationId);
            }
            else
            {
                var exceptionMessage = (string) message.Properties[MessagePropertyKeys.ExceptionMessageKey];
                var exceptionStackTrace = (string) message.Properties[MessagePropertyKeys.ExceptionStackTraceKey];

                Logger.Debug("Request {0} failed. Dispatching exception to correlation wrapper: {1} {2}", correlationId, exceptionMessage, exceptionStackTrace);

                responseCorrelationWrapper.Throw(exceptionMessage, exceptionStackTrace);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
(function (UIME, context) {
	"use strict";

	UIME.controller("ImportExportBindingsController", ["$scope", "bindingsFileConverter", "controllerBindings", "fileDownload", function ($scope, yamlConverter, controllerBindings, fileDownload) {
		$scope.source = "test";

		$scope.onSourceLoad = function (source) {
			var parsed = yamlConverter.parse(source);
			controllerBindings.refreshBindings(parsed);
		};

		$scope.exportBindings = function () {
			var bindings = controllerBindings.getRawBindings();
			var yaml = yamlConverter.convert(bindings);

			fileDownload.download(yaml, "InputManager.asset");
		};
	}]);
}(UIME, this));


text:
<?xml version="1.0" encoding="UTF-8"?>
<PolicySet
      xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
        access_control-xacml-2.0-policy-schema-os.xsd"
      PolicySetId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset"
      PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:deny-overrides">
    <Description>
        PolicySet for Conformance Test IIIA016.
    </Description>
    <Target />
    <Policy
          PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1"
          RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides">
        <Description>
            Policy1 for Conformance Test IIIA016.
        </Description>
        <Target />
        <Rule
              RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:rule1"
              Effect="Deny">
            <Description>
                A subject whose name is J. Hibbert may not
                perform any action on any resource.  NOTAPPLICABLE
            </Description>
            <Target>
                <Subjects>
                    <Subject>
                        <SubjectMatch
                              MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                            <AttributeValue
                                  DataType="http://www.w3.org/2001/XMLSchema#string">J. Hibbert</AttributeValue>
                            <SubjectAttributeDesignator
                                  AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
                                  DataType="http://www.w3.org/2001/XMLSchema#string"/>
                        </SubjectMatch>
                    </Subject>
                </Subjects>
            </Target>
        </Rule>

    <Obligations>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:obligation-1"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:obligation-2"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:obligation-3"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:obligation-4"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy1:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
    </Obligations>

    </Policy>
    <Policy
          PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2"
          RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides">
        <Description>
            Policy2 for Conformance Test IIIA016.
        </Description>
        <Target />
        <Rule
              RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:rule2"
              Effect="Permit">
            <Description>
                A subject who is at least 55 years older than Bart
                Simpson may perform any action on any resource. NOT-APPLICABLE.
            </Description>
            <Condition>
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than-or-equal">
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-subtract">
                    <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
                        <SubjectAttributeDesignator
                              AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age"
                              DataType="http://www.w3.org/2001/XMLSchema#integer"/>
                    </Apply>
                    <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
                        <EnvironmentAttributeDesignator
                              AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:bart-simpson-age"
                              DataType="http://www.w3.org/2001/XMLSchema#integer"/>
                    </Apply>
                </Apply>
                <AttributeValue
                      DataType="http://www.w3.org/2001/XMLSchema#integer">55</AttributeValue>
                </Apply>
            </Condition>
        </Rule>

    <Obligations>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:obligation-1"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:obligation-2"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:obligation-3"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:obligation-4"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy2:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
    </Obligations>

    </Policy>
    <Policy
          PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3"
          RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides">
        <Description>
            Policy3 for Conformance Test IIIA016.
        </Description>
        <Target />
        <Rule
              RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:rule3"
              Effect="Deny">
            <Description>
                A subject whose "test" attribute is Zaphod Beedlebrox may not
                perform any action on any resource.  INDETERMINATE.
            </Description>
            <Condition>
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                    <SubjectAttributeDesignator
                          AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:test"
                          DataType="http://www.w3.org/2001/XMLSchema#string"/>
                </Apply>
                <AttributeValue
                      DataType="http://www.w3.org/2001/XMLSchema#string">Zaphod Beedlebrox</AttributeValue>
                </Apply>
            </Condition>
        </Rule>

    <Obligations>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:obligation-1"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:obligation-2"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:obligation-3"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:obligation-4"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policy3:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
    </Obligations>

    </Policy>

    <Obligations>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:obligation-1"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:obligation-2"
            FulfillOn="Permit">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:obligation-3"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
        <Obligation
            ObligationId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:obligation-4"
            FulfillOn="Deny">
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment1"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment1</AttributeAssignment>
            <AttributeAssignment
                AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIIA016:policyset:assignment2"
                DataType="http://www.w3.org/2001/XMLSchema#string">assignment2</AttributeAssignment>
        </Obligation>
    </Obligations>

</PolicySet>


text:
module Draisine
  class SoapController < ApplicationController
    protect_from_forgery with: :null_session

    before_filter :validate_ip

    def update
      message = incoming_xml
      if Draisine.sync_soap_operations?
        Draisine::SoapUpdateJob.perform_now(message)
      else
        Draisine::SoapUpdateJob.perform_later(message)
      end

      render xml: xml_response, status: :created
    end

    def delete
      message = incoming_xml
      if Draisine.sync_soap_operations?
        Draisine::SoapDeleteJob.perform_now(message)
      else
        Draisine::SoapDeleteJob.perform_later(message)
      end

      render xml: xml_response, status: :created
    end

    protected

    def validate_ip
      ip_checker = IpChecker.new(Draisine.allowed_ip_ranges)
      unless ip_checker.check(request.remote_ip)
        render nothing: true, status: :forbidden
      end
    end

    def xml_response
      <<-EOF
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notificationsResponse><Ack>true</Ack></notificationsResponse>
</soapenv:Body>
</soapenv:Envelope>
EOF
    end

    def incoming_xml
      Draisine::Encoding.convert_to_utf_and_sanitize(request.body.read)
    end
  end
end


text:
#ifndef VDPAU_PRIVATE_H
#define VDPAU_PRIVATE_H

#include <assert.h>

#include <vdpau/vdpau.h>
#include <vdpau/vdpau_x11.h>

#include "pipe/p_compiler.h"
#include "pipe/p_video_decoder.h"

#include "util/u_debug.h"
#include "util/u_rect.h"
#include "os/os_thread.h"

#include "vl/vl_compositor.h"
#include "vl/vl_csc.h"
#include "vl/vl_matrix_filter.h"
#include "vl/vl_median_filter.h"
#include "vl/vl_winsys.h"

/* Full VDPAU API documentation available at :
 * ftp://download.nvidia.com/XFree86/vdpau/doxygen/html/index.html */

#define INFORMATION G3DVL VDPAU Driver Shared Library version VER_MAJOR.VER_MINOR
#define QUOTEME(x) #x
#define TOSTRING(x) QUOTEME(x)
#define INFORMATION_STRING TOSTRING(INFORMATION)
#define VL_HANDLES

static inline enum pipe_video_chroma_format
ChromaToPipe(VdpChromaType vdpau_type)
{
   switch (vdpau_type) {
      case VDP_CHROMA_TYPE_420:
         return PIPE_VIDEO_CHROMA_FORMAT_420;
      case VDP_CHROMA_TYPE_422:
         return PIPE_VIDEO_CHROMA_FORMAT_422;
      case VDP_CHROMA_TYPE_444:
         return PIPE_VIDEO_CHROMA_FORMAT_444;
      default:
         assert(0);
   }

   return -1;
}

static inline VdpChromaType
PipeToChroma(enum pipe_video_chroma_format pipe_type)
{
   switch (pipe_type) {
      case PIPE_VIDEO_CHROMA_FORMAT_420:
         return VDP_CHROMA_TYPE_420;
      case PIPE_VIDEO_CHROMA_FORMAT_422:
         return VDP_CHROMA_TYPE_422;
      case PIPE_VIDEO_CHROMA_FORMAT_444:
         return VDP_CHROMA_TYPE_444;
      default:
         assert(0);
   }

   return -1;
}

static inline enum pipe_format
FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
{
   switch (vdpau_format) {
      case VDP_YCBCR_FORMAT_NV12:
         return PIPE_FORMAT_NV12;
      case VDP_YCBCR_FORMAT_YV12:
         return PIPE_FORMAT_YV12;
      case VDP_YCBCR_FORMAT_UYVY:
         return PIPE_FORMAT_UYVY;
      case VDP_YCBCR_FORMAT_YUYV:
         return PIPE_FORMAT_YUYV;
      case VDP_YCBCR_FORMAT_Y8U8V8A8:
         return PIPE_FORMAT_R8G8B8A8_UNORM;
      case VDP_YCBCR_FORMAT_V8U8Y8A8:
         return PIPE_FORMAT_B8G8R8A8_UNORM;
      default:
         assert(0);
   }

   return PIPE_FORMAT_NONE;
}

static inline VdpYCbCrFormat
PipeToFormatYCBCR(enum pipe_format p_format)
{
   switch (p_format) {
      case PIPE_FORMAT_NV12:
         return VDP_YCBCR_FORMAT_NV12;
      case PIPE_FORMAT_YV12:
         return VDP_YCBCR_FORMAT_YV12;
      case PIPE_FORMAT_UYVY:
         return VDP_YCBCR_FORMAT_UYVY;
      case PIPE_FORMAT_YUYV:
         return VDP_YCBCR_FORMAT_YUYV;
      case PIPE_FORMAT_R8G8B8A8_UNORM:
        return VDP_YCBCR_FORMAT_Y8U8V8A8;
      case PIPE_FORMAT_B8G8R8A8_UNORM:
         return VDP_YCBCR_FORMAT_V8U8Y8A8;
      default:
         assert(0);
   }

   return -1;
}

static inline enum pipe_format
FormatRGBAToPipe(VdpRGBAFormat vdpau_format)
{
   switch (vdpau_format) {
      case VDP_RGBA_FORMAT_A8:
         return PIPE_FORMAT_A8_UNORM;
      case VDP_RGBA_FORMAT_B10G10R10A2:
         return PIPE_FORMAT_B10G10R10A2_UNORM;
      case VDP_RGBA_FORMAT_B8G8R8A8:
         return PIPE_FORMAT_B8G8R8A8_UNORM;
      case VDP_RGBA_FORMAT_R10G10B10A2:
         return PIPE_FORMAT_R10G10B10A2_UNORM;
      case VDP_RGBA_FORMAT_R8G8B8A8:
         return PIPE_FORMAT_R8G8B8A8_UNORM;
      default:
         assert(0);
   }

   return PIPE_FORMAT_NONE;
}

static inline VdpRGBAFormat
PipeToFormatRGBA(enum pipe_format p_format)
{
   switch (p_format) {
      case PIPE_FORMAT_A8_UNORM:
         return VDP_RGBA_FORMAT_A8;
      case PIPE_FORMAT_B10G10R10A2_UNORM:
         return VDP_RGBA_FORMAT_B10G10R10A2;
      case PIPE_FORMAT_B8G8R8A8_UNORM:
         return VDP_RGBA_FORMAT_B8G8R8A8;
      case PIPE_FORMAT_R10G10B10A2_UNORM:
         return VDP_RGBA_FORMAT_R10G10B10A2;
      case PIPE_FORMAT_R8G8B8A8_UNORM:
         return VDP_RGBA_FORMAT_R8G8B8A8;
      default:
         assert(0);
   }

   return -1;
}

static inline enum pipe_format
FormatIndexedToPipe(VdpRGBAFormat vdpau_format)
{
   switch (vdpau_format) {
      case VDP_INDEXED_FORMAT_A4I4:
         return PIPE_FORMAT_A4R4_UNORM;
      case VDP_INDEXED_FORMAT_I4A4:
         return PIPE_FORMAT_R4A4_UNORM;
      case VDP_INDEXED_FORMAT_A8I8:
         return PIPE_FORMAT_A8R8_UNORM;
      case VDP_INDEXED_FORMAT_I8A8:
         return PIPE_FORMAT_R8A8_UNORM;
      default:
         assert(0);
   }

   return PIPE_FORMAT_NONE;
}

static inline enum pipe_format
FormatColorTableToPipe(VdpColorTableFormat vdpau_format)
{
   switch(vdpau_format) {
      case VDP_COLOR_TABLE_FORMAT_B8G8R8X8:
         return PIPE_FORMAT_B8G8R8X8_UNORM;
      default:
         assert(0);
   }

   return PIPE_FORMAT_NONE;
}

static inline enum pipe_video_profile
ProfileToPipe(VdpDecoderProfile vdpau_profile)
{
   switch (vdpau_profile) {
      case VDP_DECODER_PROFILE_MPEG1:
         return PIPE_VIDEO_PROFILE_MPEG1;
      case VDP_DECODER_PROFILE_MPEG2_SIMPLE:
         return PIPE_VIDEO_PROFILE_MPEG2_SIMPLE;
      case VDP_DECODER_PROFILE_MPEG2_MAIN:
         return PIPE_VIDEO_PROFILE_MPEG2_MAIN;
      case VDP_DECODER_PROFILE_H264_BASELINE:
         return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE;
      case VDP_DECODER_PROFILE_H264_MAIN:
         return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN;
      case VDP_DECODER_PROFILE_H264_HIGH:
         return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;
      case VDP_DECODER_PROFILE_MPEG4_PART2_SP:
         return PIPE_VIDEO_PROFILE_MPEG4_SIMPLE;
      case VDP_DECODER_PROFILE_MPEG4_PART2_ASP:
         return PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE;
      case VDP_DECODER_PROFILE_VC1_SIMPLE:
         return PIPE_VIDEO_PROFILE_VC1_SIMPLE;
      case VDP_DECODER_PROFILE_VC1_MAIN:
         return PIPE_VIDEO_PROFILE_VC1_MAIN;
      case VDP_DECODER_PROFILE_VC1_ADVANCED:
         return PIPE_VIDEO_PROFILE_VC1_ADVANCED;
      default:
         return PIPE_VIDEO_PROFILE_UNKNOWN;
   }
}

static inline VdpDecoderProfile
PipeToProfile(enum pipe_video_profile p_profile)
{
   switch (p_profile) {
      case PIPE_VIDEO_PROFILE_MPEG1:
         return VDP_DECODER_PROFILE_MPEG1;
      case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
         return VDP_DECODER_PROFILE_MPEG2_SIMPLE;
      case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
         return VDP_DECODER_PROFILE_MPEG2_MAIN;
      case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
         return VDP_DECODER_PROFILE_H264_BASELINE;
      case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
         return VDP_DECODER_PROFILE_H264_MAIN;
      case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
         return VDP_DECODER_PROFILE_H264_HIGH;
      case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
         return VDP_DECODER_PROFILE_MPEG4_PART2_SP;
      case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
         return VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
      case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
         return VDP_DECODER_PROFILE_VC1_SIMPLE;
      case PIPE_VIDEO_PROFILE_VC1_MAIN:
         return VDP_DECODER_PROFILE_VC1_MAIN;
      case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
         return VDP_DECODER_PROFILE_VC1_ADVANCED;
      default:
         assert(0);
         return -1;
   }
}

static inline struct u_rect *
RectToPipe(const VdpRect *src, struct u_rect *dst)
{
   if (src) {
      dst->x0 = src->x0;
      dst->y0 = src->y0;
      dst->x1 = src->x1;
      dst->y1 = src->y1;
      return dst;
   }
   return NULL;
}

static inline struct pipe_box
RectToPipeBox(const VdpRect *rect, struct pipe_resource *res)
{
   struct pipe_box box;

   box.x = 0;
   box.y = 0;
   box.z = 0;
   box.width = res->width0;
   box.height = res->height0;
   box.depth = 1;

   if (rect) {
      box.x = MIN2(rect->x0, rect->x1);
      box.y = MIN2(rect->y0, rect->y1);
      box.width = abs(rect->x1 - rect->x0);
      box.height = abs(rect->y1 - rect->y0);
   }

   return box;
}

typedef struct
{
   struct vl_screen *vscreen;
   struct pipe_context *context;
   struct vl_compositor compositor;
   pipe_mutex mutex;

   struct {
      struct vl_compositor_state *cstate;
      VdpOutputSurface surface;
   } delayed_rendering;
} vlVdpDevice;

typedef struct
{
   vlVdpDevice *device;
   Drawable drawable;
} vlVdpPresentationQueueTarget;

typedef struct
{
   vlVdpDevice *device;
   Drawable drawable;
   struct vl_compositor_state cstate;
} vlVdpPresentationQueue;

typedef struct
{
   vlVdpDevice *device;
   struct vl_compositor_state cstate;

   struct {
      bool supported, enabled;
      unsigned level;
      struct vl_median_filter *filter;
   } noise_reduction;

   struct {
      bool supported, enabled;
      float value;
      struct vl_matrix_filter *filter;
   } sharpness;

   unsigned video_width, video_height;
   enum pipe_video_chroma_format chroma_format;
   unsigned max_layers, skip_chroma_deint;
   float luma_key_min, luma_key_max;

   bool custom_csc;
   vl_csc_matrix csc;
} vlVdpVideoMixer;

typedef struct
{
   vlVdpDevice *device;
   struct pipe_video_buffer templat, *video_buffer;
} vlVdpSurface;

typedef struct
{
   vlVdpDevice *device;
   struct pipe_sampler_view *sampler_view;
} vlVdpBitmapSurface;

typedef uint64_t vlVdpTime;

typedef struct
{
   vlVdpTime timestamp;
   vlVdpDevice *device;
   struct pipe_surface *surface;
   struct pipe_sampler_view *sampler_view;
   struct pipe_fence_handle *fence;
   struct vl_compositor_state cstate;
   struct u_rect dirty_area;
} vlVdpOutputSurface;

typedef struct
{
   vlVdpDevice *device;
   struct pipe_video_decoder *decoder;
} vlVdpDecoder;

typedef uint32_t vlHandle;

boolean vlCreateHTAB(void);
void vlDestroyHTAB(void);
vlHandle vlAddDataHTAB(void *data);
void* vlGetDataHTAB(vlHandle handle);
void vlRemoveDataHTAB(vlHandle handle);

boolean vlGetFuncFTAB(VdpFuncId function_id, void **func);

/* Public functions */
VdpDeviceCreateX11 vdp_imp_device_create_x11;
VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11;

void vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_resource *res);

/* Delayed rendering funtionality */
void vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, struct u_rect *dirty_area);
void vlVdpSave4DelayedRendering(vlVdpDevice *dev, VdpOutputSurface surface, struct vl_compositor_state *cstate);

/* Internal function pointers */
VdpGetErrorString vlVdpGetErrorString;
VdpDeviceDestroy vlVdpDeviceDestroy;
VdpGetProcAddress vlVdpGetProcAddress;
VdpGetApiVersion vlVdpGetApiVersion;
VdpGetInformationString vlVdpGetInformationString;
VdpVideoSurfaceQueryCapabilities vlVdpVideoSurfaceQueryCapabilities;
VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities;
VdpDecoderQueryCapabilities vlVdpDecoderQueryCapabilities;
VdpOutputSurfaceQueryCapabilities vlVdpOutputSurfaceQueryCapabilities;
VdpOutputSurfaceQueryGetPutBitsNativeCapabilities vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities;
VdpOutputSurfaceQueryPutBitsIndexedCapabilities vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities;
VdpOutputSurfaceQueryPutBitsYCbCrCapabilities vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities;
VdpBitmapSurfaceQueryCapabilities vlVdpBitmapSurfaceQueryCapabilities;
VdpVideoMixerQueryFeatureSupport vlVdpVideoMixerQueryFeatureSupport;
VdpVideoMixerQueryParameterSupport vlVdpVideoMixerQueryParameterSupport;
VdpVideoMixerQueryParameterValueRange vlVdpVideoMixerQueryParameterValueRange;
VdpVideoMixerQueryAttributeSupport vlVdpVideoMixerQueryAttributeSupport;
VdpVideoMixerQueryAttributeValueRange vlVdpVideoMixerQueryAttributeValueRange;
VdpVideoSurfaceCreate vlVdpVideoSurfaceCreate;
VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy;
VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters;
VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr;
VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr;
void vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf);
VdpDecoderCreate vlVdpDecoderCreate;
VdpDecoderDestroy vlVdpDecoderDestroy;
VdpDecoderGetParameters vlVdpDecoderGetParameters;
VdpDecoderRender vlVdpDecoderRender;
VdpOutputSurfaceCreate vlVdpOutputSurfaceCreate;
VdpOutputSurfaceDestroy vlVdpOutputSurfaceDestroy;
VdpOutputSurfaceGetParameters vlVdpOutputSurfaceGetParameters;
VdpOutputSurfaceGetBitsNative vlVdpOutputSurfaceGetBitsNative;
VdpOutputSurfacePutBitsNative vlVdpOutputSurfacePutBitsNative;
VdpOutputSurfacePutBitsIndexed vlVdpOutputSurfacePutBitsIndexed;
VdpOutputSurfacePutBitsYCbCr vlVdpOutputSurfacePutBitsYCbCr;
VdpOutputSurfaceRenderOutputSurface vlVdpOutputSurfaceRenderOutputSurface;
VdpOutputSurfaceRenderBitmapSurface vlVdpOutputSurfaceRenderBitmapSurface;
VdpBitmapSurfaceCreate vlVdpBitmapSurfaceCreate;
VdpBitmapSurfaceDestroy vlVdpBitmapSurfaceDestroy;
VdpBitmapSurfaceGetParameters vlVdpBitmapSurfaceGetParameters;
VdpBitmapSurfacePutBitsNative vlVdpBitmapSurfacePutBitsNative;
VdpPresentationQueueTargetDestroy vlVdpPresentationQueueTargetDestroy;
VdpPresentationQueueCreate vlVdpPresentationQueueCreate;
VdpPresentationQueueDestroy vlVdpPresentationQueueDestroy;
VdpPresentationQueueSetBackgroundColor vlVdpPresentationQueueSetBackgroundColor;
VdpPresentationQueueGetBackgroundColor vlVdpPresentationQueueGetBackgroundColor;
VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime;
VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay;
VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle;
VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus;
VdpPreemptionCallback vlVdpPreemptionCallback;
VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister;
VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables;
VdpVideoMixerCreate vlVdpVideoMixerCreate;
VdpVideoMixerRender vlVdpVideoMixerRender;
VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues;
VdpVideoMixerGetFeatureSupport vlVdpVideoMixerGetFeatureSupport;
VdpVideoMixerGetFeatureEnables vlVdpVideoMixerGetFeatureEnables;
VdpVideoMixerGetParameterValues vlVdpVideoMixerGetParameterValues;
VdpVideoMixerGetAttributeValues vlVdpVideoMixerGetAttributeValues;
VdpVideoMixerDestroy vlVdpVideoMixerDestroy;
VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix;

#define VDPAU_OUT   0
#define VDPAU_ERR   1
#define VDPAU_WARN  2
#define VDPAU_TRACE 3

static inline void VDPAU_MSG(unsigned int level, const char *fmt, ...)
{
   static int debug_level = -1;

   if (debug_level == -1) {
      debug_level = MAX2(debug_get_num_option("VDPAU_DEBUG", 0), 0);
   }

   if (level <= debug_level) {
      va_list ap;
      va_start(ap, fmt);
      _debug_vprintf(fmt, ap);
      va_end(ap);
   }
}

#endif /* VDPAU_PRIVATE_H */


text:
            <button type="button" class="btn btn-danger pull-right" ng-disabled="!providerTemplate || isRemoving" ng-click="removeResource()" ng-if="!resourceHasComposerResources(resource)">Remove resource</button>
            <button type="button" class="btn btn-danger pull-right" ng-disabled="true" ng-if="resourceHasComposerResources(resource)">Cannot be removed</button>
            <button type="button" ng-if="(providerTemplate | agCanManage:'resource_methods')" class="btn btn-default pull-right" ng-click="manageResourceActions()" style="margin-right: 10px;" ng-disabled="!providerTemplate || isRemoving">Customize HTTP actions</button>
            <button type="button" class="btn btn-primary pull-right" ng-click="manageResource()" ng-disabled="!providerTemplate || isRemoving" style="margin-right: 10px;">Manage resource</button>
            <ag-ui-spinner size="22" color="black" style="vertical-align: top; margin-top: 3px; margin-right: 10px; float: right;" ng-show="columnsMeta.loading || columnsSaving || isRemoving"></ag-ui-spinner>

              Some Composer 2 resources
depend on this resource.

{{resource.name}} (resource)

Cloud Mesh configuration

        Open configurator in new window

            <button type="button" class="btn btn-primary" ng-click="fetchColumns()" ng-if="providerTemplate.uid != 6" ng-disabled="columnsMeta.loading || columnsSaving" style="margin-right: 10px;">Reload resource configuration from API</button>

Resource fields

        This seems to be a new or partially configured resource. If there is an error or the response isn't quite what you expected, try configuring the resource method details with "Customize HTTP actions" above. There you can configure query parameters, root keys and headers for each individual HTTP action.

          <ag-ui-spinner size="22" color="white" style="vertical-align: top;"></ag-ui-spinner>Loading resource fields.

          Oops! Unable to load resource's fields.

Is the data source's base URL and resource's URL path (class UID) correct?

Have you added the necessary authentication details to the data source?

Do you have data in your resource?

 0)">
          Important! Choose the unique identifier by selecting one of the radio buttons below and save the resource. Without an identifier key your resource won't work.

          Note!

You have configured this resource ({{composerContentSource.title}}) to be available in Composer.

We have automatically refreshed the fields on the Composer resource to match the fields in the external data source.

You can edit the fields in the Composer resource editor.

        <ag-data-model is-saving="columnsSaving" column-types="availableColumnTypes" hide-required="{{hideRequired}}" hide-example="{{hideExample}}" columns="columns" columns-editable="{{providerTemplate && (providerTemplate | agCanManage:'resource_columns_edit')}}" identifier-key="resource.identifierKey" identifier-key-editable="{{providerTemplate && (providerTemplate | agCanManage:'resource_identifier_key')}}" ng-if="!columnsMeta.loading && (!columnsMeta.error || (providerTemplate | agCanManage:'resource_columns_edit'))"></ag-data-model>


text:
<?xml version="1.0" encoding="utf-8"?><resources>
    <style name="Holo.Demo"/>
    <style name="Holo.Demo.FontViewer">
        <item name="android:gravity">center</item>
        <item name="android:layout_height">?listPreferredItemHeightSmall</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:textAppearance">?android:textAppearanceMedium</item>
    </style>
    <style name="Holo.Demo.ListRowView">
        <item name="android:background">?selectableItemBackground</item>
    </style>
    <style name="Holo.Demo.Theme" parent="Holo.Theme">
        <!--Include block: DemoThemeDark-->
        <!--Include block: DemoTheme-->
        <item name="android:homeAsUpIndicator">?homeAsUpIndicator</item>
        <item name="demoListRowViewStyle">@style/Holo.Demo.ListRowView</item>
        <item name="homeAsUpIndicator">@drawable/home_as_up_indicator</item>
        <!--End of block DemoTheme-->
        <!--End of block DemoThemeDark-->
        <!--Include block: DemoThemeBarDark-->
        <!--Include block: DemoThemeBar-->
        <!--End of block DemoThemeBar-->
        <item name="menuBackground">#dd222222</item>
        <!--End of block DemoThemeBarDark-->
    </style>
    <style name="Holo.Demo.Theme.Fullscreen">
        <!--Include block: Fullscreen-->
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowFullscreen">true</item>
        <item name="windowContentOverlay">@null</item>
        <!--End of block Fullscreen-->
    </style>
    <style name="Holo.Demo.Theme.Light" parent="Holo.Theme.Light">
        <!--Include block: DemoThemeLight-->
        <!--Include block: DemoTheme-->
        <item name="android:homeAsUpIndicator">?homeAsUpIndicator</item>
        <item name="demoListRowViewStyle">@style/Holo.Demo.ListRowView</item>
        <item name="homeAsUpIndicator">@drawable/home_as_up_indicator</item>
        <!--End of block DemoTheme-->
        <!--End of block DemoThemeLight-->
        <!--Include block: DemoThemeBarLight-->
        <!--Include block: DemoThemeBar-->
        <!--End of block DemoThemeBar-->
        <item name="menuBackground">#dddddddd</item>
        <!--End of block DemoThemeBarLight-->
    </style>
    <style name="Holo.Demo.Theme.Light.DarkActionBar" parent="Holo.Theme.Light.DarkActionBar">
        <!--Include block: DemoThemeLight-->
        <!--Include block: DemoTheme-->
        <item name="android:homeAsUpIndicator">?homeAsUpIndicator</item>
        <item name="demoListRowViewStyle">@style/Holo.Demo.ListRowView</item>
        <item name="homeAsUpIndicator">@drawable/home_as_up_indicator</item>
        <!--End of block DemoTheme-->
        <!--End of block DemoThemeLight-->
        <!--Include block: DemoThemeBarDark-->
        <!--Include block: DemoThemeBar-->
        <!--End of block DemoThemeBar-->
        <item name="menuBackground">#dd222222</item>
        <!--End of block DemoThemeBarDark-->
    </style>
    <style name="Holo.Demo.Theme.Light.DarkActionBar.Fullscreen">
        <!--Include block: Fullscreen-->
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowFullscreen">true</item>
        <item name="windowContentOverlay">@null</item>
        <!--End of block Fullscreen-->
    </style>
    <style name="Holo.Demo.Theme.Light.Fullscreen">
        <!--Include block: Fullscreen-->
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowFullscreen">true</item>
        <item name="windowContentOverlay">@null</item>
        <!--End of block Fullscreen-->
    </style>
</resources>


text:
"use strict";

var _ = require('lodash'),
  chai = require('chai'),
  co = require('co'),
  mongoose = require('mongoose'),
  path = require('path'),
  Q = require('bluebird'),
  sinon = require('sinon'),
  waigo = require('waigo');

exports.appFolder = path.join(__dirname, '..', 'src');

chai.use(require('sinon-chai'));

exports.assert = chai.assert;
exports.expect = chai.expect;
exports.should = chai.should();

exports.sinon = sinon;

/**
 * Wait for given no. of milliseconds
 * @param  {Number} ms milliseconds.
 * @return {Promise}
 */
exports.waitFor = function(ms) {
  return new Q(function(resolve) {
    setTimeout(resolve, ms);
  });
}

var runGen = exports.runGen = function(genFn, arg1) {
  var fn = Q.promisify(co(genFn));
  return fn.apply(fn, _.toArray(arguments).slice(1));
}

/**
 * Reset test db.
 *
 * @return {Promise}
 */
exports.resetDb = function() {
  var url = 'mongodb://127.0.0.1:27017/ansijet-test';
  var db = mongoose.createConnection(url);

  var promise = new Q(function(resolve, reject) {
    db.on('error', function(err) {
      reject(err);
    });
    db.once('open', function() {
      db.removeListener('error', reject);
      resolve(db);
    });
  });

  return promise.then(function emptyAllCollections() {
    return Q.all(
      _.map(['logs', 'playbooks', 'jobs', 'triggers'], function(colName) {
        var collection = db.collection(colName);

        var fn = Q.promisify(collection.remove, collection);

        return fn();
      })
    );
  });
};

/**
 * Start Ansijet server to test against.
 *
 * This will call `resetDb` before starting the server.
 *
 * @param {Object} [customConfig] App configuration settings to set.
 *
 * @return {Promise}
 */
exports.startAnsijet = function(customConfig) {
  return runGen(function*() {
    yield exports.resetDb();

    yield waigo.init({
      appFolder: exports.appFolder
    })

    var Application = waigo.load('application');

    yield Application.shutdown();  // shutdown current instance

    yield Application.start({
      postConfig: function(config) {
        config.port = parseInt(10000 + Math.random() * 20000);

        config.baseURL = 'http://localhost:' + config.port;

        config.playbooks = path.join(__dirname, 'data', 'playbooks');

        config.db = {
          mongo: {
            host: '127.0.0.1',
            port: '27017',
            db: 'ansijet-test'
          }
        };

        _.extend(config, {
          // for testing we want instant job gratification
          jobProcessingIntervalMs: 0
        }, customConfig);
      }
    });

    return Application;
  });
};

/**
 * Stop Ansijet server to test against.
 *
 * @return {Promise}
 */
exports.stopAnsijet = function() {
  return runGen(function*() {
    yield exports.resetDb();
    var Application = waigo.load('application');

    yield Application.shutdown();  // shutdown current instance
  });
};

/**
 * Close all db connections
 *
 * @return {Promise}
 */
exports.closeAllDbConnections = function() {
  return Q.promisify(mongoose.disconnect, mongoose)();
};


text:
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch-theme-algolia.min.css">


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.fusesource</groupId>
    <artifactId>fusesource-pom</artifactId>
    <version>1.3</version>
  </parent>

  <groupId>org.fusesource.scalamd</groupId>
  <artifactId>scalamd_2.9</artifactId>
  <version>1.6-SNAPSHOT</version>
  <packaging>bundle</packaging>

  <name>${project.artifactId}</name>
  <description>ScalaMD: A Scala Markdown Processor</description>

  <inceptionYear>2010</inceptionYear>

  <properties>
    <forge-project-id>scalamd</forge-project-id>
    <release-altGitURL>scm:git:ssh://git@github.com:chirino/scalamd.git</release-altGitURL>

    <scala-version>2.8.1</scala-version>
    <maven-scala-plugin-version>2.15.0</maven-scala-plugin-version>
    <maven-surefire-plugin-version>2.4.3</maven-surefire-plugin-version>
    <bundle-plugin-version>2.3.4</bundle-plugin-version>

  </properties>

  <dependencies>

    <!-- Scala Support: this needs to be copied into every scala project -->
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <scope>provided</scope>
      <version>${scala-version}</version>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-compiler</artifactId>
      <version>${scala-version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Testing Deps -->
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scala-tools.testing</groupId>
      <artifactId>specs_2.8.1</artifactId>
      <version>1.6.6</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <url>http://${forge-project-id}.fusesource.com/maven/${project.version}</url>
  <scm>
    <connection>scm:git:git://github.com/chirino/scalamd.git</connection>
    <!-- Work around for issue: http://jira.codehaus.org/browse/SCM-444 -->
    <developerConnection>${release-altGitURL}</developerConnection>
    <url>http://github.com/chirino/scalamd/tree/master</url>
  </scm>
  <distributionManagement>
    <site>
      <id>website.fusesource.org</id>
      <name>website</name>
      <url>dav:http://fusesource.com/forge/dav/${forge-project-id}/maven/${project.version}</url>
    </site>
  </distributionManagement>

  <build>
    <defaultGoal>install</defaultGoal>
    <sourceDirectory>src/main/scala</sourceDirectory>
    <testSourceDirectory>src/test/scala</testSourceDirectory>

    <resources>
      <resource>
        <directory>target/schema</directory>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
        <version>${maven-scala-plugin-version}</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <scaladocClassName>scala.tools.nsc.ScalaDoc</scaladocClassName>
          <jvmArgs>
            <jvmArg>-Xmx1024m</jvmArg>
            <jvmArg>-Xss8m</jvmArg>
          </jvmArgs>
          <args>
            <arg>-deprecation</arg>
          </args>
          <scalaVersion>${scala-version}</scalaVersion>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin-version}</version>

        <configuration>
          <!-- we must turn off the use of system class loader so our tests can find stuff - otherwise ScalaSupport compiler can't find stuff -->
          <useSystemClassLoader>false</useSystemClassLoader>
          <!--forkMode>pertest</forkMode-->
          <childDelegation>false</childDelegation>
          <useFile>true</useFile>
          <failIfNoTests>false</failIfNoTests>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${bundle-plugin-version}</version>
        <extensions>true</extensions>
        <inherited>true</inherited>
        <configuration>
          <instructions>
            <Implementation-Title>${project.description}</Implementation-Title>
            <Implementation-Version>${project.version}</Implementation-Version>
            <Bundle-Name>${project.artifactId}</Bundle-Name>
            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Export-Package>{local-packages};version=${project.version};-noimport:=true</Export-Package>
            <Import-Package>*</Import-Package>
            <Private-Package>!*</Private-Package>
            <_versionpolicy-impl>[$(version;==;$(@)),$(version;=+;$(@)))</_versionpolicy-impl>
            <_versionpolicy-uses>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy-uses>
            <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
            <_failok>false</_failok>
          </instructions>
        </configuration>
      </plugin>

    </plugins>
  </build>
  <profiles>

    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- Generate the Scala Docs so that they can be included in the javadoc artifact -->
          <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <version>${maven-scala-plugin-version}</version>
            <executions>
              <execution>
                <id>doc</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>doc</goal>
                </goals>
                <configuration>
                  <reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
                  <outputDirectory>apidocs</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>


text:
package de.longri.cachebox3.utils;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Net;
import com.badlogic.gdx.files.FileHandle;
import de.longri.cachebox3.CB;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Created by Longri on 26.06.2017.
 */
public class NetUtils {
    private final static Logger log = LoggerFactory.getLogger(NetUtils.class);

    public static Object postAndWait(final ResultType type, final Net.HttpRequest request, final ICancel icancel) {
        log.debug("Send Post request");
        final AtomicBoolean WAIT = new AtomicBoolean(true);
        final Object[] result = new Object[1];
        if (icancel != null) {
            CB.postAsync(new NamedRunnable("NetUtils:postAndWait1") {
                @Override
                public void run() {
                    while (WAIT.get()) {
                        if (icancel.cancel()) {
                            Gdx.net.cancelHttpRequest(request);
                        }
                        try {
                            Thread.sleep(20);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
            });
        }

        final AtomicBoolean isRedirection = new AtomicBoolean(false);
        Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() {
            @Override
            public void handleHttpResponse(Net.HttpResponse httpResponse) {
                if (httpResponse.getStatus().getStatusCode() >= 301 && httpResponse.getStatus().getStatusCode() <= 302) {
                    log.debug("redirection");
                    final String redirection = httpResponse.getHeader("Location");
                    if (redirection != null) {
                        CB.postAsync(new NamedRunnable("NetUtils:postAndWait2") {
                            @Override
                            public void run() {
                                isRedirection.set(true);
                                Gdx.net.cancelHttpRequest(request);
                                Net.HttpRequest httpGet = new Net.HttpRequest(request.getMethod());
                                httpGet.setUrl(redirection);
                                result[0] = postAndWait(type, httpGet, icancel);
                                WAIT.set(false);
                            }
                        });
                    }
                    return;
                }

                log.debug("Handle Response");
                final AtomicBoolean HANDEL_WAIT = new AtomicBoolean(true);
                switch (type) {

                    case STRING:
                        result[0] = httpResponse.getResultAsString();
                        HANDEL_WAIT.set(false);
                        break;
                    case STREAM:
                        result[0] = new StreamHandleObject() {
                            @Override
                            public void handled() {
                                HANDEL_WAIT.set(false);
                            }
                        };
                        ((StreamHandleObject) result[0]).stream = httpResponse.getResultAsStream();
                        break;
                }
                WAIT.set(false);
                CB.wait(HANDEL_WAIT);
                log.debug("returned stream handled, close connection");
            }

            @Override
            public void failed(Throwable t) {
                log.error("Request failed", t);
                WAIT.set(false);
            }

            @Override
            public void cancelled() {
                log.debug("Request cancelled");
                if (!isRedirection.get()) WAIT.set(false);
            }
        });

        CB.wait(WAIT);
        return result[0];
    }

    public static Boolean download(String uri, String local) {
        FileHandle localFile = Gdx.files.absolute(local);
        try {
            new Downloader(new URL(uri), localFile).run();
        } catch (MalformedURLException e) {
            log.error("download: " + uri + " to " + local, e);
        }
        return localFile.exists();
    }

    public enum ResultType {
        STRING, STREAM
    }

    public abstract static class StreamHandleObject {
        public InputStream stream;

        public abstract void handled();
    }
}


text:
(function(){'use strict';})();
/*jslint browser: true*/
/*global $, jQuery, $snaphy, angular, browser, console*/

/**
 * JUST CHANGE THIS REDIRECT TO CHANGE THE DEFAULT REDIRECT.
 * @type {string}
 */
var redirectOtherWise = $snaphy.loadSettings('login', 'onLoginRedirectState');
var notPermittedState = $snaphy.loadSettings('login', '403ErrorPageState');
var loginState        = $snaphy.loadSettings('login', "loginState");
var registerState     = $snaphy.loadSettings('login', "registerState");
var forgotPassState   = $snaphy.loadSettings('login', "forgotPassState");
var adminRole         = $snaphy.loadSettings('login', "adminRole");
var employeeRole      = $snaphy.loadSettings('login', "employeeRole");

angular.module($snaphy.getModuleName())

    /**
     Employee Role
     */
    .run(['Permission', 'LoginServices', '$q', '$rootScope', function (Permission, LoginServices,  $q, $rootScope)  {
        //Define admin role with promise..
        //For more info https://github.com/Narzerus/angular-permission
        Permission.defineRole(employeeRole, function (stateParams) {
            //using promise..
            var deferred = $q.defer();
            LoginServices.authenticatePage(function(){
                deferred.resolve();
            },function(){
                console.log('Failure getting authorization');
                deferred.reject();
            });
            return deferred.promise;
        }); // END Permission

        //TODO Add admin role later..
        Permission.defineRole(adminRole, function (stateParams) {
            //using promise..
            var deferred = $q.defer();
            LoginServices.isAdmin(function(){
                deferred.resolve();
            },function(){
                console.log('Failure getting authorization');
                deferred.reject();
            });
            return deferred.promise;
        }); // END Permission

        //Now storing previous state parameters..
        $rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) {
            //assign the "from" parameter to something
            //console.log("Changing state from ", from, "To", to);
            //Now storing the previously accesed paths..
            $rootScope.previousState = from;
            $rootScope.currentState = to;
        });

    }]) //End Run

    //Routes are defined using ui.routes
    .config(['$locationProvider', '$stateProvider', '$urlRouterProvider', '$injector', '$httpProvider',
        function ($locationProvider, $stateProvider, $urlRouterProvider, $injector, $httpProvider) {
        $locationProvider.html5Mode(false);

        //https://github.com/Narzerus/angular-permission
        $urlRouterProvider.otherwise( function($injector) {
            var $state = $injector.get("$state");
            $state.go(redirectOtherWise);
        });

        $stateProvider
            //Provide routes in this way..
            .state(loginState, {
                url: '/login',
                templateUrl: '/login/views/login.html',
                controller: 'loginControl',
                //Only allow anonym users here
                data: {
                    permissions: {
                        except: [employeeRole],
                        redirectTo: redirectOtherWise
                    }
                }
            })

            //Provide routes in this way..
            .state(registerState, {
                url: '/register',
                templateUrl: '/login/views/register.html',
                controller: 'registerControl',
                //Only allow anonym users here
                data: {
                    permissions: {
                        only: [adminRole],
                        redirectTo: notPermittedState
                    }
                }
            })

            //Provide routes in this way..
            .state(forgotPassState, {
                url: '/forgotPass',
                templateUrl: '/login/views/forgotPass.html',
                controller: 'forgotPassControl',
                //Only allow anonym users here
                data: {
                    permissions: {
                        except: [employeeRole],
                        redirectTo: redirectOtherWise
                    }
                }
            });

        //interceptors area..
        //http://stackoverflow.com/questions/25876559/loopback-protected-routes-ensure-login
        $httpProvider.interceptors.push(['$q', 'LoopBackAuth', '$injector',
            function ($q, LoopBackAuth, $injector) {
                return {
                    responseError: function (rejection) {
                        if (rejection.status === 401) {
                            console.log("Got 401 error");
                            //Now clearing the loopback values..
                            LoopBackAuth.clearUser();
                            LoopBackAuth.clearStorage();
                            //$location.nextAfterLogin = $location.path();
                            //Storing the state..

                            var $state = $injector.get("$state");
                            $state.go(loginState);
                        }
                        return $q.reject(rejection);
                    }
                };
            }]);

    }]); //config