text:
<?php

namespace Http\Httplug;

use Illuminate\Support\Manager;
use Http\Message\StreamFactory;
use Http\Message\MessageFactory;
use Http\Message\ResponseFactory;
use Illuminate\Foundation\Application;
use GuzzleHttp\Client as GuzzleFiveClient;
use Http\Client\Curl\Client as CurlAdapter;
use Http\Adapter\Buzz\Client as BuzzAdapter;
use Http\Adapter\React\Client as ReactAdapter;
use Http\Client\Socket\Client as SocketAdapter;
use Http\Adapter\Guzzle6\Client as GuzzleSixAdapter;
use Http\Adapter\Guzzle5\Client as GuzzleFiveAdapter;

class HttplugManager extends Manager
{
    /**
     * The application instance.
     *
     * @var \Illuminate\Foundation\Application
     */
    protected $app;

    /**
     * Create a new HttplugManager instance.
     *
     * @param \Illuminate\Foundation\Application $app
     */
    public function __construct(Application $app)
    {
        $this->app = $app;
    }

    /**
     * Get default driver.
     *
     * @return string
     */
    public function getDefaultDriver()
    {
        return $this->app['config']['httplug.default'];
    }

    /**
     * @param string $name
     *
     * @return array
     */
    protected function getConfig($name)
    {
        return $this->app['config']["httplug.adapters.{$name}"];
    }

    /**
     * @return \Http\Adapter\Guzzle6\Client
     */
    public function createGuzzle6Driver()
    {
        return GuzzleSixAdapter::createWithConfig($this->getConfig('guzzle6'));
    }

    /**
     * @return \Http\Adapter\Guzzle5\Client
     */
    public function createGuzzle5Driver()
    {
        return new GuzzleFiveAdapter(
            new GuzzleFiveClient($this->getConfig('guzzle5')),
            $this->app->make(MessageFactory::class)
        );
    }

    /**
     * @return \Http\Client\Curl\Client
     */
    public function createCurlDriver()
    {
        return new CurlAdapter(
            $this->app->make(MessageFactory::class),
            $this->app->make(StreamFactory::class),
            $this->getConfig('curl')
        );
    }

    /**
     * @return \Http\Client\Socket\Client
     */
    public function createSocketDriver()
    {
        return new SocketAdapter(
            $this->app->make(MessageFactory::class),
            $this->getConfig('socket')
        );
    }

    /**
     * @todo  add custom configuration
     *
     * @return \Http\Adapter\Buzz\Client
     */
    public function createBuzzDriver()
    {
        return new BuzzAdapter(
            null,
            $this->app->make(ResponseFactory::class)
        );
    }

    /**
     * @todo  add custom configuration
     *
     * @return \Http\Adapter\React\Client
     */
    public function createReactDriver()
    {
        return new ReactAdapter(
            $this->app->make(ResponseFactory::class)
        );
    }
}


text:
package atomic

import "unsafe"

//go:noescape
func Xadd(ptr *uint32, delta int32) uint32

//go:noescape
func Xadd64(ptr *uint64, delta int64) uint64

//go:noescape
func Xadduintptr(ptr *uintptr, delta uintptr) uintptr

//go:noescape
func Xchg(ptr *uint32, new uint32) uint32

//go:noescape
func Xchg64(ptr *uint64, new uint64) uint64

//go:noescape
func Xchguintptr(ptr *uintptr, new uintptr) uintptr

//go:noescape
func Load(ptr *uint32) uint32

//go:noescape
func Load64(ptr *uint64) uint64

//go:noescape
func Loadp(ptr unsafe.Pointer) unsafe.Pointer

//go:noescape
func And8(ptr *uint8, val uint8)

//go:noescape
func Or8(ptr *uint8, val uint8)

// NOTE: Do not add atomicxor8 (XOR is not idempotent).

//go:noescape
func Cas64(ptr *uint64, old, new uint64) bool

//go:noescape
func Store(ptr *uint32, val uint32)

//go:noescape
func Store64(ptr *uint64, val uint64)

// NO go:noescape annotation; see atomic_pointer.go.
func Storep1(ptr unsafe.Pointer, val unsafe.Pointer)

redpajama_set_name: RedPajamaGithub


text:
function multiSetPlugin(schema, options) {
	schema.methods.multiSet = function(obj, allowedFields, ignoreMissing) {
		if (!allowedFields) {
			return;
		}
		if (typeof ignoreMissing == 'undefined') {
			ignoreMissing = true;
		} else {
			ignoreMissing = !!ignoreMissing;
		}

		if (Object.prototype.toString.call(allowedFields) !== '[object Array]') {
			return;
		}
		var i = allowedFields.indexOf('id');
		if (i !== -1) {
			allowedFields.splice(i, 1);
		}
		i = allowedFields.indexOf('_id');
		if (i !== -1) {
			allowedFields.splice(i, 1);
		}
		var self = this;
		allowedFields.forEach(function(field) {
			if ((typeof obj[field] !== 'undefined' && ignoreMissing) || !ignoreMissing) {
				self[field] = obj[field];
			}
		});
	}
}

module.exports = multiSetPlugin;


text:
using System;
using System.Collections.Generic;
using SimpleXamarinFormsMVVM.Core.Extentions;

namespace SimpleXamarinFormsMVVM.Core.IOC
{
    public sealed class SimpleServiceLocator : ISimpleServiceLocator
    {
        private readonly Dictionary<Type, ServiceInfo> servicesInfos = new Dictionary<Type, ServiceInfo>();
        private readonly object syncObject = new object();

        private SimpleServiceLocator()
        {
        }

        public static ISimpleServiceLocator Instance { get; } = new SimpleServiceLocator();

        public bool CanResolve(Type serviceType)
        {
            lock (syncObject)
            {
                return servicesInfos.ContainsKey(serviceType);
            }
        }

        public bool CanResolve<TInterface>() where TInterface : class
        {
            return CanResolve(typeof(TInterface));
        }

        public object GetService(Type serviceType)
        {
            lock (syncObject)
            {
                if (!CanResolve(serviceType))
                    throw new InvalidOperationException(string.Format("Service with interface {0} not registered.", serviceType));

                var serviceInfo = servicesInfos[serviceType];
                switch (serviceInfo.Behaviour)
                {
                    case ServicesBehaviour.Dynamic:
                        return serviceInfo.LazyConstructor();
                    case ServicesBehaviour.LazySingleton:
                        return serviceInfo.StoredObject ?? (serviceInfo.StoredObject = serviceInfo.LazyConstructor());
                    case ServicesBehaviour.Singleton:
                        return serviceInfo.StoredObject;
                    default:
                        throw new ArgumentOutOfRangeException(string.Format("Unknown ServicesBehaviour {0}", serviceInfo.Behaviour));
                }
            }
        }

        public TInterface Resolve<TInterface>() where TInterface : class
        {
            return (TInterface)GetService(typeof(TInterface));
        }

        public void RegisterType<TInterface, TType>() where TInterface : class where TType : class, TInterface
        {
            lock (syncObject)
            {
                Func<object> makeInstanceFunction = () => typeof(TType).CreateInstance();
                RegisterServiceInfo<TInterface>(ServicesBehaviour.Dynamic, makeInstanceFunction, null);
            }
        }

        public void RegisterType<TInterface>(Func<TInterface> constructor) where TInterface : class
        {
            lock (syncObject)
            {
                RegisterServiceInfo<TInterface>(ServicesBehaviour.Dynamic, constructor, null);
            }
        }

        public void RegisterSingleton<TInterface, TType>() where TInterface : class where TType : class, TInterface
        {
            lock (syncObject)
            {
                Func<object> makeInstanceFunction = () => typeof(TType).CreateInstance();
                RegisterServiceInfo<TInterface>(ServicesBehaviour.Singleton, null, makeInstanceFunction());
            }
        }

        public void RegisterSingleton<TInterface>(Func<TInterface> constructor) where TInterface : class
        {
            lock (syncObject)
            {
                RegisterServiceInfo<TInterface>(ServicesBehaviour.Singleton, null, constructor());
            }
        }

        public void RegisterSingleton<TInterface>(TInterface service) where TInterface : class
        {
            lock (syncObject)
            {
                RegisterServiceInfo<TInterface>(ServicesBehaviour.Singleton, null, service);
            }
        }

        public void LazyRegisterSingleton<TInterface, TType>() where TInterface : class where TType : class, TInterface
        {
            lock (syncObject)
            {
                Func<object> makeInstanceFunction = () => typeof(TType).CreateInstance();
                RegisterServiceInfo<TInterface>(ServicesBehaviour.LazySingleton, makeInstanceFunction, null);
            }
        }

        public void LazyRegisterSingleton<TInterface>(Func<TInterface> constructor) where TInterface : class
        {
            lock (syncObject)
            {
                RegisterServiceInfo<TInterface>(ServicesBehaviour.LazySingleton, constructor, null);
            }
        }

        private void RegisterServiceInfo<TInterface>(ServicesBehaviour behaviour, Func<object> instanceCreator, object service) where TInterface : class
        {
            var interfaceType = typeof(TInterface);
            if (servicesInfos.ContainsKey(interfaceType))
                servicesInfos.Remove(interfaceType);

            servicesInfos.Add(interfaceType, new ServiceInfo(behaviour, instanceCreator, service));
        }

        private struct ServiceInfo
        {
            public ServicesBehaviour Behaviour { get; }

            public Func<object> LazyConstructor { get; }

            public object StoredObject { get; set; }

            public ServiceInfo(ServicesBehaviour behaviour, Func<object> lazyConstructor, object storedObject)
            {
                Behaviour = behaviour;
                LazyConstructor = lazyConstructor;
                StoredObject = storedObject;
            }
        }

        private enum ServicesBehaviour
        {
            Dynamic,
            Singleton,
            LazySingleton
        }
    }
}


text:
package cd.go.contrib.elasticagents.dockerswarm.elasticagent.executors;

import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

public class GoServerURLMetadataTest {
    private final GoServerURLMetadata goServerURLMetadata = new GoServerURLMetadata();

    @Test
    public void shouldCheckBlankInput() {
        String result = goServerURLMetadata.doValidate("");

        assertThat(result, is("Go Server URL must not be blank."));
    }

    @Test
    public void shouldCheckIfStringIsValidUrl() {
        String result = goServerURLMetadata.doValidate("foobar");

        assertThat(result, is("Go Server URL must be a valid URL (http://example.com:8153/go)"));
    }

    @Test
    public void shouldCheckIfSchemeIsValid() {
        String result = goServerURLMetadata.doValidate("example.com");

        assertThat(result, is("Go Server URL must be a valid URL (http://example.com:8153/go)"));
    }

    @Test
    public void shouldCheckIfSchemeIsHTTPS() {
        String result = goServerURLMetadata.doValidate("ftp://example.com");

        assertThat(result, is("Go Server URL must use http or https protocol"));
    }

    @Test
    public void shouldCheckForLocalhost() {
        String result = goServerURLMetadata.doValidate("https://localhost:8154/go");

        assertThat(result, is("Go Server URL must not be localhost, since this gets resolved on the agents"));

        result = goServerURLMetadata.doValidate("https://127.0.0.1:8154/go");

        assertThat(result, is("Go Server URL must not be localhost, since this gets resolved on the agents"));
    }

    @Test
    public void shouldCheckIfUrlEndsWithContextGo() {
        String result = goServerURLMetadata.doValidate("https://example.com:8154/");
        assertThat(result, is("Go Server URL must be a valid URL ending with '/go' (http://example.com:8153/go)"));

        result = goServerURLMetadata.doValidate("http://example.com:8153/crimemastergogo");
        assertThat(result, is("Go Server URL must be a valid URL ending with '/go' (http://example.com:8153/go)"));
    }

    @Test
    public void shouldReturnNullForValidUrls() {
        String result = goServerURLMetadata.doValidate("https://example.com:8154/go");
        assertThat(result, is(nullValue()));

        result = goServerURLMetadata.doValidate("https://example.com:8154/go/");
        assertThat(result, is(nullValue()));

        result = goServerURLMetadata.doValidate("https://example.com:8154/foo/go/");
        assertThat(result, is(nullValue()));
    }
}


text:
describe("Dropdown Plugin", function () {
  beforeEach(function() {
    loadFixtures('dropdown/dropdownFixture.html');
    $('.dropdown-button').dropdown();
  });

  describe("Dropdown", function () {
    var normalDropdown;

    beforeEach(function() {
      // browserSelect = $('select.normal');
    });

    it("should open and close programmatically", function (done) {
      var dropdown1 = $('#dropdown1');
      normalDropdown = $('#dropdownActivator');

      expect(dropdown1).toBeHidden('Should be hidden before dropdown is opened.');

      normalDropdown.dropdown('open');

      setTimeout(function() {
        expect(dropdown1).toBeVisible('Should be shown after dropdown is opened.');
        normalDropdown.dropdown('close');

        setTimeout(function() {
          expect(dropdown1).toBeHidden('Should be hidden after dropdown is closed.');
          done();
        }, 400);
      }, 400);
    });

    it("should close dropdown on document click if programmatically opened", function (done) {
      normalDropdown = $('#dropdownActivator');

      expect(dropdown1).toBeHidden('Should be hidden before dropdown is opened.');

      normalDropdown.dropdown('open');

      setTimeout(function() {
        expect(dropdown1).toBeVisible('Should be shown after dropdown is opened.');
        $(document).click();

        setTimeout(function() {
          expect(dropdown1).toBeHidden('Should be hidden after dropdown is closed.');
          done();
        }, 400);
      }, 400);
    });
  });
});


text:
class Api::V1::GTFSShapesController < Api::V1::GTFSEntityController
    def self.model
      GTFSShape
    end
end


text:
@interface emetteurViewController ()

@end

@implementation emetteurViewController
@synthesize textfield;
@synthesize bouton;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        AudioController *newControlleur=[[AudioController alloc]init];
        myController=newControlleur;
    }
    return self;
}

-(void)loadView
{
    [super loadView];

}

- (IBAction)EnvoieMessage:(id)sender {
    myController->isSafeForWork=TRUE;

    //myMessage = [textfield stringValue];

    //myMessage=@"aaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccc";
    myMessage=@"{type : 1 image_uti : \"http://soudfi.com/images/67531686.jpg\", texte : \"Bonjour, bienvenue sur SoundFi. Ceci est une message de test pour une taille standards en nombre de caracteres. L'objectif est que ce message passe sans erreurs et avec tous les caracteres.\"}";

    NSLog(@"Envoie du message : %@",myMessage);

    myController->myMessage=myMessage;
    [myController startAudioUnit:1];
}
@end


text:
namespace service
{
    class Service
    {
    public:
        static bool exists(
            const ServiceManager&,
            const std::string& name);

        static Service open(
            const ServiceManager&,
            const std::string& name);

        static Service install(
            const ServiceManager&,
            const std::string& name,
            const std::string& bin_path);

        void start() const;
        void stop() const;
        void uninstall() const;

        Service(Service&& other) LIBSERVICE_NOEXCEPT
        {
            swap(other);
        }

        Service& operator=(Service other) LIBSERVICE_NOEXCEPT
        {
            swap(other);
            return *this;
        }

        void swap(Service& other) LIBSERVICE_NOEXCEPT
        {
            using std::swap;
            swap(handle, other.handle);
        }

    private:
        Service(ServiceHandle handle)
            : handle(std::move(handle))
        { }

        ServiceHandle handle;

        Service(const Service&) = delete;
    };

    inline void swap(Service& a, Service& b) LIBSERVICE_NOEXCEPT
    {
        a.swap(b);
    }
}

namespace std
{
    template <>
    inline void swap(
        service::Service& a,
        service::Service& b) LIBSERVICE_NOEXCEPT
    {
        a.swap(b);
    }
}


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

<TITLE>
SoyFileSupplier.Version (Soy Complete)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

com.google.template.soy.base

Interface SoyFileSupplier.Version

Enclosing interface:
SoyFileSupplier

public static interface SoyFileSupplier.Version

An opaque identifier that can be compared for equality with other versions from the same
 resource.

 Instances are not Comparable since a version is not necessarily monotonic ; e.g. a
 cryptographically strong hash function produces a more reliable version identifier than a
 time-stamp but not one that can be said to be newer or older than any other version.

Field Summary

static SoyFileSupplier.Version
STABLE_VERSION

          A version for stable resources : resources that don't change over the life of a JVM.

Method Summary

 boolean
equals(Object o)

          Compares to versions that are equivalent.

Field Detail

STABLE_VERSION

static final SoyFileSupplier.Version STABLE_VERSION

A version for stable resources : resources that don't change over the life of a JVM.

Method Detail

equals

boolean equals(Object o)

Compares to versions that are equivalent.  Meaningless if applied to versions from a
 different resource.

Overrides:
equals in class Object

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                © 2009 Google -
                Privacy Policy -
                Terms and Conditions -
                About Google


text:
package org.apereo.cas.web.flow;

import org.apereo.cas.CentralAuthenticationService;
import org.apereo.cas.authentication.Authentication;
import org.apereo.cas.authentication.AuthenticationException;
import org.apereo.cas.authentication.AuthenticationResult;
import org.apereo.cas.authentication.AuthenticationResultBuilder;
import org.apereo.cas.authentication.AuthenticationSystemSupport;
import org.apereo.cas.authentication.Credential;
import org.apereo.cas.authentication.DefaultAuthenticationSystemSupport;
import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.ticket.InvalidTicketException;
import org.apereo.cas.ticket.ServiceTicket;
import org.apereo.cas.ticket.registry.TicketRegistrySupport;
import org.apereo.cas.web.support.WebUtils;
import org.springframework.web.util.CookieGenerator;
import org.springframework.webflow.action.AbstractAction;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * This is {@link ServiceWarningAction}. Populates the view
 * with the target url of the application after the warning
 * screen is displayed.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
public class ServiceWarningAction extends AbstractAction {

    private CentralAuthenticationService centralAuthenticationService;

    private AuthenticationSystemSupport authenticationSystemSupport = new DefaultAuthenticationSystemSupport();

    private TicketRegistrySupport ticketRegistrySupport;

    private CookieGenerator warnCookieGenerator;

    @Override
    protected Event doExecute(final RequestContext context) throws Exception {
        final HttpServletRequest request = WebUtils.getHttpServletRequest(context);
        final HttpServletResponse response = WebUtils.getHttpServletResponse(context);

        final Service service = WebUtils.getService(context);
        final String ticketGrantingTicket = WebUtils.getTicketGrantingTicketId(context);

        final Authentication authentication = this.ticketRegistrySupport.getAuthenticationFrom(ticketGrantingTicket);
        if (authentication == null) {
            throw new InvalidTicketException(
                    new AuthenticationException("No authentication found for ticket " + ticketGrantingTicket), ticketGrantingTicket);
        }

        final Credential credential = WebUtils.getCredential(context);
        final AuthenticationResultBuilder authenticationResultBuilder =
                this.authenticationSystemSupport.establishAuthenticationContextFromInitial(authentication, credential);
        final AuthenticationResult authenticationResult = authenticationResultBuilder.build(service);

        final ServiceTicket serviceTicketId = this.centralAuthenticationService
                .grantServiceTicket(ticketGrantingTicket, service, authenticationResult);
        WebUtils.putServiceTicketInRequestScope(context, serviceTicketId);

        if (request.getParameterMap().containsKey("ignorewarn")) {
            if (Boolean.valueOf(request.getParameter("ignorewarn"))) {
                this.warnCookieGenerator.removeCookie(response);
            }
        }
        return new Event(this, CasWebflowConstants.STATE_ID_REDIRECT);
    }

    public void setCentralAuthenticationService(final CentralAuthenticationService centralAuthenticationService) {
        this.centralAuthenticationService = centralAuthenticationService;
    }

    public void setAuthenticationSystemSupport(final AuthenticationSystemSupport authenticationSystemSupport) {
        this.authenticationSystemSupport = authenticationSystemSupport;
    }

    public void setTicketRegistrySupport(final TicketRegistrySupport ticketRegistrySupport) {
        this.ticketRegistrySupport = ticketRegistrySupport;
    }

    public void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
        this.warnCookieGenerator = warnCookieGenerator;
    }
}


text:
/*******************************************************************************
* Copyright 2016-2017 Intel Corporation
*
* Licensed 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.
*
* \file mkldnn_base-inl.h
* \brief
* \author young.jin.kim@intel.com
*         ashok.emani@intel.com
*         deepthi.karkada@intel.com
*         louis.feng@intel.com
*         adam.d.straw@intel.com
*         zhengda1936@gmail.com
*
*******************************************************************************/

#ifndef MXNET_OPERATOR_NN_MKLDNN_MKLDNN_BASE_INL_H_
#define MXNET_OPERATOR_NN_MKLDNN_MKLDNN_BASE_INL_H_

#if MXNET_USE_MKLDNN == 1
#include <iterator>
#include <string>
#include <unordered_map>
#include <vector>
#include <utility>
#include <algorithm>
#include <memory>
#include "mkldnn.hpp"
#include "mxnet/ndarray.h"
#include "mxnet/resource.h"
#include "mxnet/op_attr_types.h"
using namespace mkldnn;
namespace mxnet {
extern bool EnableMkldnnWarnGenerated();
// =====  CpuEngine =======================================
// cpu_engine singleton
class CpuEngine {
 public:
  static CpuEngine *Get() {
    // I's thread-safe in C++11.
    // ensure same mkldnn engine is used across threads
    static CpuEngine myInstance;
    return &myInstance;
  }
  CpuEngine(CpuEngine const &) = delete;             // Copy construct
  CpuEngine(CpuEngine &&) = delete;                  // Move construct
  CpuEngine &operator=(CpuEngine const &) = delete;  // Copy assign
  CpuEngine &operator=(CpuEngine &&) = delete;       // Move assign

  mkldnn::engine &get_engine() { return _cpu_engine; }

 protected:
  CpuEngine() : _cpu_engine(mkldnn::engine::cpu, 0) {}
  ~CpuEngine() {}

 private:
  mkldnn::engine _cpu_engine;
};

// type enumerator
template <typename T>
struct data_type_enum {};

template <>
struct data_type_enum<float> {
  enum { type = mkldnn::memory::data_type::f32 };
};

template <>
struct data_type_enum<int32_t> {
  enum { type = mkldnn::memory::data_type::s32 };
};

template <>
struct data_type_enum<int16_t> {
  enum { type = mkldnn::memory::data_type::s16 };
};

template <>
struct data_type_enum<int8_t> {
  enum { type = mkldnn::memory::data_type::s8 };
};

template <>
struct data_type_enum<uint8_t> {
  enum { type = mkldnn::memory::data_type::u8 };
};

static inline bool SupportMKLDNNArray(int dtype, const TShape &shape) {
  int ndim = shape.ndim();
  bool support = ndim == 1 || ndim == 2 || ndim == 4;
  support = support && (dtype == mshadow::kFloat32 || dtype == mshadow::kInt32
                        || dtype == mshadow::kInt8 || dtype == mshadow::kUint8);
  return support;
}

static inline bool SupportStorageMKLDNN(int stype) {
  return stype == kDefaultStorage;
}

static inline bool SupportMKLDNN(int dtype, const TShape &shape) {
  int ndim = shape.ndim();
  return dtype == mshadow::kFloat32 && (ndim == 1 || ndim == 2 || ndim == 4);
}

static inline bool SupportMKLDNN(const NDArray &input) {
  return SupportMKLDNN(input.dtype(), input.shape())
      && SupportStorageMKLDNN(input.storage_type());
}

static inline bool SupportMKLDNNConv(const NDArray &input) {
  return input.dtype() == mshadow::kFloat32 && input.shape().ndim() == 4;
}

/*
 * This is to align address to a certain alignment.
 */
void *AlignMem(void *mem, size_t size, size_t alignment, size_t *space);

namespace op {
struct ActivationParam;
bool SupportMKLDNNAct(const op::ActivationParam& param);
}

static int GetTypeSize(int dtype) {
  int size = -1;
  MSHADOW_TYPE_SWITCH(dtype, DType, {
    size = sizeof(DType);
  });
  return size;
}

static inline size_t GetArraySize(const NDArray &arr) {
  return arr.shape().Size() * GetTypeSize(arr.dtype());
}

static inline mkldnn::memory::data_type get_mkldnn_type(int dtype) {
  switch (dtype) {
    case mshadow::kFloat32:
      return mkldnn::memory::data_type::f32;
    case mshadow::kInt32:
      return mkldnn::memory::data_type::s32;
    case mshadow::kInt8:
      return mkldnn::memory::data_type::s8;
    case mshadow::kUint8:
      return mkldnn::memory::data_type::u8;
    default:
      LOG(FATAL) << "unknown type for MKLDNN";
      return mkldnn::memory::data_type::data_undef;
  }
}

inline static mkldnn::memory::desc GetMemDesc(const NDArray &arr, int ndim) {
  mkldnn::memory::dims dims(ndim);
  for (size_t i = 0; i < dims.size(); i++) dims[i] = arr.shape()[i];
  return mkldnn::memory::desc{dims, get_mkldnn_type(arr.dtype()),
                              mkldnn::memory::format::any};
}

inline static mkldnn::memory::desc GetMemDesc(const NDArray &arr) {
  return GetMemDesc(arr, arr.shape().ndim());
}

inline static mkldnn::memory::desc GetWeightDesc(const NDArray &arr,
                                                 int num_groups) {
  if (num_groups == 1) {
    return GetMemDesc(arr);
  } else {
    CHECK_EQ(arr.shape().ndim(), 4U);
    mkldnn::memory::dims tz = mkldnn::memory::dims{ num_groups,
      static_cast<int>(arr.shape()[0] / num_groups),
      static_cast<int>(arr.shape()[1]),
      static_cast<int>(arr.shape()[2]),
      static_cast<int>(arr.shape()[3])};
    return mkldnn::memory::desc{tz, get_mkldnn_type(arr.dtype()),
                                mkldnn::memory::format::any};
  }
}

typedef std::shared_ptr<mkldnn::memory> mkldnn_mem_ptr;
typedef std::shared_ptr<const mkldnn::memory> mkldnn_mem_const_ptr;

/*
 * This is to manage the temporary memory provided by MXNet for operators.
 * The temp memory is mainly used to keep the reordered data. In an operator, we
 * may need multiple pieces of memory for them. But MXNet can only provide
 * a single piece of memory. This class is to help break the temporary memory
 * from MXNet to store the reordered data.
 * The amount of temporary memory used in an operator depends on the layout of
 * input arrays and the operator. It's difficult to calculate it manually, so
 * the class also estimate the amount of memory automatically.
 */
class TmpMemMgr {
  // This points to the memory buffer where we can allocate temp memory.
  char *curr_mem;
  // The total size of the temp memory.
  size_t mem_size;
  // This contains the current available memory size.
  size_t curr_size;
  // This estimate the required temp memory size in an operator.
  size_t est_size;
  const size_t alignment = kMKLDNNAlign;

 public:
  static TmpMemMgr *Get() {
    static thread_local TmpMemMgr mgr;
    return &mgr;
  }

  TmpMemMgr() {
    Reset();
    est_size = 0;
    mem_size = 0;
  }

  void Reset() {
    curr_mem = nullptr;
    curr_size = 0;
    // We don't reset est_size and mem_size because est_size contains the
    // estimated temp memory size from the last run and mem_size contains the
    // memroy size allocated in the last run.
  }

  void Init(const Resource &r) {
    // If the last time, if we estimate that we need more memory, we should the
    // larger memory size.
    mem_size = std::max(mem_size, est_size);
    if (mem_size > 0) {
      // Let's allocate some extra memory. If we don't use some of them all the time,
      // the OS won't physically allocate pages for them any way.
      this->curr_size = mem_size * 2;
      this->curr_mem = static_cast<char *>(r.get_host_space_internal(this->curr_size));
    }
    // reset est_size, so we can start to estimate the temp memory size.
    this->est_size = 0;
  }

  mkldnn::memory *Alloc(const mkldnn::memory::primitive_desc &pd);
};

class MKLDNNStream {
  std::vector<mkldnn::primitive> net;
  // Here we hold all memory related to the operators in the stream.
  std::vector<std::shared_ptr<const mkldnn::memory> > mem_holder;

 public:
  static MKLDNNStream *Get() {
    static thread_local MKLDNNStream stream;
    return &stream;
  }

  void RegisterPrim(const mkldnn::primitive &prim) { net.push_back(prim); }

  void RegisterMem(std::shared_ptr<const mkldnn::memory> mem) {
    mem_holder.push_back(mem);
  }

  bool HasOps() const {
    return !net.empty();
  }

  void Submit() {
    if (!net.empty())
      mkldnn::stream(mkldnn::stream::kind::eager).submit(net).wait();
    net.clear();
    mem_holder.clear();
    TmpMemMgr::Get()->Reset();
  }
};

enum OutDataOp {
  Noop,
  CopyBack,
  AddBack,
};

typedef std::pair<OutDataOp, mkldnn::memory *> mkldnn_output_t;

/*
 * These two functions try to create MKLDNN memory in an NDArray based on `req'.
 * The difference is that the first function can create MKLDNN memory with
 * special layouts in an NDArray, while the second one can only create MKLDNN
 * memory with default layouts.
 * If these two functions are used, we have to call CommitOutput to write
 * the output back to the output NDArray.
 */
mkldnn_output_t CreateMKLDNNMem(const NDArray &arr,
                                const mkldnn::memory::primitive_desc &desc,
                                OpReqType req);
mkldnn_output_t CreateMKLDNNWeightGrad(const NDArray &arr,
                                       const mkldnn::memory::primitive_desc &desc,
                                       OpReqType req);
/* This function has to be used with one of the functions above. */
void CommitOutput(const NDArray &arr, const mkldnn_output_t &res);

static inline void InvalidateOutputs(const std::vector<NDArray> &arrs,
                                     const std::vector<OpReqType> &reqs) {
  for (size_t i = 0; i < arrs.size(); i++) {
    if (reqs[i] == kWriteTo || reqs[i] == kNullOp) {
      const_cast<NDArray &>(arrs[i]).InvalidateMKLDNNData();
    }
  }
}

const mkldnn::memory *GetWeights(const NDArray &arr,
                                 const mkldnn::memory::primitive_desc &target_pd,
                                 int num_groups);

mkldnn_memory_format_t GetDefaultFormat(const mkldnn::memory::desc &desc);
mkldnn_memory_format_t GetDefaultFormat(int num_dims);
mkldnn::memory::primitive_desc GetPrimitiveDesc(mkldnn::memory::primitive_desc pd,
                                                mkldnn_memory_format_t format);

inline bool same_shape(const TShape &shape, const mkldnn_dims_t dims, int ndims) {
  if (shape.ndim() != (size_t)ndims)
    return false;
  for (int i = 0; i < ndims; i++)
    if (shape[i] != dims[i])
      return false;
  return true;
}

inline bool same_shape(const TShape &shape, int dtype,
                       const mkldnn::memory::desc &desc) {
  return same_shape(shape, desc.data.dims, desc.data.ndims)
      && get_mkldnn_type(dtype) == desc.data.data_type;
}

/*
 * There is a large overhead of getting mkldnn::memory::primitive_desc from
 * mkldnn::memory. This class is created to cache the metadata of mkldnn memory
 * to provide a much more lightweight method to access them.
 */
class MKLDNNMemory {
  std::shared_ptr<mkldnn::memory> mem;
  mkldnn::memory::desc desc;
  size_t size;      // The number of bytes.

 public:
  MKLDNNMemory(mkldnn::memory::primitive_desc pd, void *addr): desc(pd.desc()) {
    mem.reset(new mkldnn::memory(pd, addr));
    size = pd.get_size();
  }

  explicit MKLDNNMemory(std::shared_ptr<mkldnn::memory> mem): desc(
      mem->get_primitive_desc().desc()) {
    this->mem = mem;
    mkldnn::memory::primitive_desc pd = mem->get_primitive_desc();
    size = pd.get_size();
  }

  void SetDataHandle(void *handle) {
    mem->set_data_handle(handle);
  }

  void *GetDataHandle() const {
    return mem->get_data_handle();
  }

  std::shared_ptr<mkldnn::memory> GetMem() const {
    return mem;
  }

  mkldnn::memory *GetRaw() const {
    return mem.get();
  }

  size_t GetSize() const {
    return size;
  }

  mkldnn::memory::primitive_desc GetPrimitiveDesc() const {
    return mem->get_primitive_desc();
  }

  mkldnn::memory::primitive_desc GetPrimitiveDesc(mkldnn_memory_format_t format) const {
    return mxnet::GetPrimitiveDesc(mem->get_primitive_desc(), format);
  }

  mkldnn_memory_format_t GetDefaultFormat() const {
    return mxnet::GetDefaultFormat(desc);
  }

  mkldnn_memory_format_t GetFormat() const {
    return desc.data.format;
  }

  bool IsMKLDNN() const {
    return GetFormat() != GetDefaultFormat();
  }

  bool SameFormat(mkldnn::memory::primitive_desc pd) const {
    return mem->get_primitive_desc() == pd;
  }

  bool SameFormat(const TShape &shape, int dtype) const {
    return same_shape(shape, dtype, desc);
  }

  void ReorderTo(mkldnn::memory *other) const {
    std::vector<mkldnn::primitive> net;
    net.push_back(mkldnn::reorder(*mem, *other));
    mkldnn::stream(mkldnn::stream::kind::eager).submit(net).wait();
  }
};

void FallBackCompute(FCompute fn, const nnvm::NodeAttrs &attrs,
                     const OpContext &ctx,
                     const std::vector<NDArray> &inputs,
                     const std::vector<OpReqType> &req,
                     const std::vector<NDArray> &outputs);

/*
 * This class is used to check the correctness of MKLDNN operators.
 */
class OpCheck {
  std::vector<mxnet::NDArray> inputs;
  std::vector<mxnet::NDArray> outputs;
  bool backward;
  size_t num_checks;

 public:
  OpCheck(bool backward, size_t num_checks) {
    this->backward = backward;
    this->num_checks = num_checks;
  }

  void Init(const std::vector<mxnet::NDArray> &inputs_,
          const std::vector<mxnet::NDArray> &outputs_);

  void Run(mxnet::FCompute fn, const nnvm::NodeAttrs &attrs,
           const mxnet::OpContext &ctx,
           const std::vector<mxnet::NDArray> &inputs_,
           const std::vector<mxnet::OpReqType> &req,
           const std::vector<mxnet::NDArray> &outputs_);
};

#define MKLDNN_OPCHECK_INIT(backward, num_checks, inputs, outputs)  \
    static bool debug = dmlc::GetEnv("MXNET_MKLDNN_DEBUG", false);  \
    OpCheck check(backward, num_checks);                            \
    if (debug) check.Init(inputs, outputs);

#define MKLDNN_OPCHECK_RUN(fn, attrs, ctx, inputs, req, outputs)    \
    if (debug) check.Run(fn, attrs, ctx, inputs, req, outputs);

}  // namespace mxnet
#endif
#endif  // MXNET_OPERATOR_NN_MKLDNN_MKLDNN_BASE_INL_H_


text:
ZE2 Autoload and recursion
--SKIPIF--
<?php
	if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed');
	if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already');
?>
--FILE--
<?php

function __autoload($class_name)
{
	var_dump(class_exists($class_name));
	require_once(__DIR__ . '/' . $class_name . '.p5c');
	echo __FUNCTION__ . '(' . $class_name . ")\n";
}

var_dump(class_exists('autoload_derived'));

?>
===DONE===
--EXPECT--
bool(false)
bool(false)
__autoload(autoload_root)
__autoload(autoload_derived)
bool(true)
===DONE===


text:
package ie.gmit.sw.repository;

import ie.gmit.sw.domain.User;
import org.springframework.data.neo4j.repository.GraphRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRepository extends GraphRepository<User>{

    User findByUsername(String email);
}


text:
opesci
======

Open Performance portablE SeismiC Imaging


text:
namespace litesql {
  class XmlGenerator : public CodeGenerator {
  public:
    XmlGenerator(): CodeGenerator("xml") { };
    virtual void setOutputFilename(const std::string& filename);
    bool generateCode(const ObjectModel* model);

  protected:
    bool generate(const xml::ObjectPtr& object     , std::ostream& os , size_t indent=2);
    bool generate(const xml::Relation::Ptr& relation , std::ostream& os , size_t indent=4);

  private:
    bool generateDatabase(std::ostream& os,const ObjectModel* model);
    std::string m_outputFilename;
  };
}

#endif //#ifndef xmlgenerator_hpp


text:
'use strict';

/**
 * @ngdoc function
 * @name webClientSideApp.controller:AboutCtrl
 * @description
 * # AboutCtrl
 * Controller of the webClientSideApp
 */
angular.module('webClientSideApp')
  .controller('AboutCtrl', [ '$scope', function ($scope) {

    this.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];

    $scope.elts = [];
    $scope.elts.push("elt0");
    $scope.name = 0;

    $scope.handlePedal = function(){
    	console.log($scope.name);
    }

  }]);


text:
package com.joelapenna.foursquared.widget;

import com.joelapenna.foursquare.types.Badge;
import com.joelapenna.foursquared.R;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * @author jlapenna
 */
public class BadgeListAdapter extends BaseBadgeAdapter {

    private LayoutInflater mInflater;
    private int mLayoutToInflate;

    public BadgeListAdapter(Context context) {
        super(context);
        mInflater = LayoutInflater.from(context);
        mLayoutToInflate = R.layout.badge_item;
    }

    public BadgeListAdapter(Context context, int layoutResource) {

        super(context);
        mInflater = LayoutInflater.from(context);
        mLayoutToInflate = layoutResource;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // A ViewHolder keeps references to children views to avoid unnecessary
        // calls to findViewById() on each row.
        ViewHolder holder;

        // When convertView is not null, we can reuse it directly, there is no
        // need to re-inflate it. We only inflate a new View when the
        // convertView supplied by ListView is null.
        if (convertView == null) {
            convertView = mInflater.inflate(mLayoutToInflate, null);

            // Creates a ViewHolder and store references to the two children
            // views we want to bind data to.
            holder = new ViewHolder();
            holder.icon = (ImageView)convertView.findViewById(R.id.icon);
            holder.name = (TextView)convertView.findViewById(R.id.name);
            holder.description = (TextView)convertView.findViewById(R.id.description);

            convertView.setTag(holder);
        } else {
            // Get the ViewHolder back to get fast access to the TextView
            // and the ImageView.
            holder = (ViewHolder)convertView.getTag();
        }

        Badge badge = (Badge)getItem(position);
        holder.name.setText(badge.getName());
        if (holder.description != null) {
            if (!TextUtils.isEmpty(badge.getDescription())) {
                holder.description.setText(badge.getDescription());
            } else {
                holder.description.setText("");
            }
        }

        return convertView;
    }

    static class ViewHolder {
        ImageView icon;
        TextView name;
        TextView description;
    }
}


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

<title>Uses of Class net.sf.jasperreports.engine.type.TabStopAlignEnum (JasperReports 5.6.0 API)</title>
<meta name="date" content="2014-05-27">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
net.sf.jasperreports.engine.type.TabStopAlignEnum

Packages that use TabStopAlignEnum

Package
Description

net.sf.jasperreports.engine

Provides access to the library's main functionality through facade classes for compiling, filling
 and exporting reports and also publishes the library's main interfaces and classes.

net.sf.jasperreports.engine.export.oasis

Provides utility classes for exporting reports to Open Document Format, such as
 ODT and ODS.

net.sf.jasperreports.engine.export.ooxml

Provides utility classes for exporting reports to Office Open XML Format, such as
 DOCX, XLSX and PPTX.

net.sf.jasperreports.engine.type

Contains enum types used by the library's main classes.

Uses of TabStopAlignEnum in net.sf.jasperreports.engine

Methods in net.sf.jasperreports.engine that return TabStopAlignEnum

Modifier and Type
Method and Description

TabStopAlignEnum
TabStop.getAlignment()

Gets the tab stop alignment.

Methods in net.sf.jasperreports.engine with parameters of type TabStopAlignEnum

Modifier and Type
Method and Description

void
TabStop.setAlignment(TabStopAlignEnum alignment)

Sets the tab stop alignment.

Constructors in net.sf.jasperreports.engine with parameters of type TabStopAlignEnum

Constructor and Description

TabStop(int position,
       TabStopAlignEnum alignment)

Uses of TabStopAlignEnum in net.sf.jasperreports.engine.export.oasis

Methods in net.sf.jasperreports.engine.export.oasis with parameters of type TabStopAlignEnum

Modifier and Type
Method and Description

static java.lang.String
ParagraphStyle.getTabStopAlignment(TabStopAlignEnum tabStopAlignment)

Uses of TabStopAlignEnum in net.sf.jasperreports.engine.export.ooxml

Methods in net.sf.jasperreports.engine.export.ooxml with parameters of type TabStopAlignEnum

Modifier and Type
Method and Description

static java.lang.String
DocxParagraphHelper.getTabStopAlignment(TabStopAlignEnum alignment)

Uses of TabStopAlignEnum in net.sf.jasperreports.engine.type

Methods in net.sf.jasperreports.engine.type that return TabStopAlignEnum

Modifier and Type
Method and Description

static TabStopAlignEnum
TabStopAlignEnum.getByName(java.lang.String name)

static TabStopAlignEnum
TabStopAlignEnum.getByValue(byte value)

static TabStopAlignEnum
TabStopAlignEnum.getByValue(java.lang.Byte value)

static TabStopAlignEnum
TabStopAlignEnum.valueOf(java.lang.String name)

Returns the enum constant of this type with the specified name.

static TabStopAlignEnum[]
TabStopAlignEnum.values()

Returns an array containing the constants of this enum type, in
the order they are declared.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com


text:
package com.okq.generalfoodsafe.View;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import android.widget.LinearLayout;

public final class CheckableLinearLayout
        extends LinearLayout
        implements Checkable
{

    private boolean mChecked;

    private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};

    public CheckableLinearLayout(final Context context)
    {
        this(
                context,
                null
            );
    }

    public CheckableLinearLayout(final Context context,
                                 final AttributeSet attrs)
    {
        super(
                context,
                attrs
             );
    }

    @Override
    public boolean isChecked()
    {
        return mChecked;
    }

    @Override
    public void setChecked(final boolean checked)
    {
        if (mChecked != checked)
        {
            mChecked = checked;
            final int n = this.getChildCount();
            View v;
            for (int i = 0; i < n; i++)
            {
                v = this.getChildAt(i);
                if (v instanceof Checkable)
                    ((Checkable) v).setChecked(checked);
            }
            refreshDrawableState();
        }
    }

    @Override
    public void toggle()
    {
        setChecked(!mChecked);
    }

    @Override
    public int[] onCreateDrawableState(final int extraSpace)
    {
        final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
        if (isChecked())
        {
            mergeDrawableStates(
                    drawableState,
                    CHECKED_STATE_SET
                               );
        }
        return drawableState;
    }

}


text:
package org.xillium.gear.auth;

import java.util.*;
import org.xillium.base.beans.Strings;
import org.xillium.data.*;
import org.xillium.data.persistence.Persistence;
import org.xillium.core.*;
import org.xillium.core.management.ManagedComponent;
import org.xillium.core.management.WithCache;

/**
 * An Authorizer that implements a prefix-based authorization policy.
 */
@lombok.extern.log4j.Log4j2
public class StandardAuthorizer extends ManagedComponent implements Authorizer, PlatformAware, WithCache {
    private final Map<String, Permission[]> _roles = new HashMap<String, Permission[]>(); // a map from role name to authorized function names
    private final Authority _authority;
    private final Authenticator _authenticator;

    /**
     * Constructs an StandardAuthorizer.
     *
     * @param authority - The Authority that defines roles and permissions.
     * @param authenticator - The Authenticator that handles client authentication.
     */
    public StandardAuthorizer(Authority authority, Authenticator authenticator) {
        _authority = authority;
        _authenticator = authenticator;
    }

    @Override
    public void configure(String applName, String moduleName) {
    }

    /**
     * Initialization - loads all user roles into memory.
     */
    @Override
    public void initialize(String applName, String moduleName) {
        refresh();
    }

    @Override
    public void terminate(String applName, String moduleName) {
    }

    /**
     * (Re)loads all roles and permissions into memory.
     */
    @Override
    public void refresh() {
        try {
            _roles.clear();

            List<Permission> permissions = new ArrayList<Permission>();
            String name = null;
            for (Permission auth: _authority.loadRolesAndPermissions()) {
                if (name != null && !name.equals(auth.roleId)) {
                    _log.trace("{} with {} authorizations", name, permissions.size());
                    _roles.put(name, permissions.toArray(new Permission[permissions.size()]));
                    permissions.clear();
                }
                name = auth.roleId;
                permissions.add(auth);
            }
            if (name != null) {
                _log.trace("{} with {} authorizations", name, permissions.size());
                _roles.put(name, permissions.toArray(new Permission[permissions.size()]));
            }

            _log.info("Completed loading all roles & permissions");
        } catch (Exception x) {
            throw new ServiceException("***FailureInLoadingRoles", x);
        }
    }

    @Override
    public CacheState getCacheState() {
        return null;
    }

    protected void authorize(String deployment, List<Role> roles) throws AuthorizationException {
        int authorization = -1;
        int prerequisite = -1;

        String required = '/' + deployment;
        _log.trace("target function is {}, # of roles to check: {}", required, roles.size());
        for (Role role: roles) {
            _log.trace("role: {}", role.roleId);
            Permission[] permissions = _roles.get(role.roleId);
            if (permissions != null) {
                for (Permission permission: permissions) {
                    if (required.startsWith(permission.function)) {
                        authorization = Math.max(authorization, role.permission + permission.permission);
                        prerequisite = Math.max(prerequisite, role.prerequisite + permission.permission);
                        _log.trace("authorized function: {}, authorization = {}", permission.function, authorization);
                    }
                }
            }
        }
        _log.trace("final authorization = {}, prerequisite = {}", authorization, prerequisite);
        if (authorization < 0) {
            throw new AuthorizationException("OperationNotAuthorized");
        } else if (authorization < 1) {
            throw new AuthorizationException("PasswordExpired");
        } else if (prerequisite < 1) {
            throw new AuthorizationException("PrerequisiteNotMet");
        }
    }

    @Override
    public void authorize(Service service, String deployment, DataBinder parameters, Persistence persist) throws AuthorizationException {
        try {
            List<Role> roles = _authenticator.authenticate(parameters);
            if (roles.size() > 0) {
                authorize(deployment, roles);
            } else {
                throw new AuthorizationException("InvalidCredential");
            }
        } catch (AuthorizationException x) {
            throw x;
        } catch (Exception x) {
            _log.warn("Unexpected", x);
            throw new AuthorizationException(x.getMessage(), x);
        }
    }
}


text:
namespace Bike.Ast
{
    using System.Collections.Generic;

    public partial class StatementBlock : Statement
    {
        public readonly List<Statement> Statements = new List<Statement>();
    }
}


text:
package org.elasticsearch.xpack.core.transform.transforms;

import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.xcontent.XContentParser;
import org.junit.Before;

import java.io.IOException;
import java.util.function.Predicate;

public class SourceConfigTests extends AbstractSerializingTransformTestCase<SourceConfig> {

    private boolean lenient;

    public static SourceConfig randomSourceConfig() {
        return new SourceConfig(generateRandomStringArray(10, 10, false, false),
            QueryConfigTests.randomQueryConfig());
    }

    public static SourceConfig randomInvalidSourceConfig() {
        // create something broken but with a source
        return new SourceConfig(generateRandomStringArray(10, 10, false, false),
            QueryConfigTests.randomInvalidQueryConfig());
    }

    @Before
    public void setRandomFeatures() {
        lenient = randomBoolean();
    }

    @Override
    protected SourceConfig doParseInstance(XContentParser parser) throws IOException {
        return SourceConfig.fromXContent(parser, lenient);
    }

    @Override
    protected SourceConfig createTestInstance() {
        return lenient ? randomBoolean() ? randomSourceConfig() : randomInvalidSourceConfig() : randomSourceConfig();
    }

    @Override
    protected boolean supportsUnknownFields() {
        return lenient;
    }

    @Override
    protected Predicate<String> getRandomFieldsExcludeFilter() {
        // allow unknown fields in the root of the object only as QueryConfig stores a Map<String, Object>
        return field -> !field.isEmpty();
    }

    @Override
    protected Reader<SourceConfig> instanceReader() {
        return SourceConfig::new;
    }

    public void testRequiresRemoteCluster() {
        assertFalse(new SourceConfig(new String [] {"index1", "index2", "index3"},
                QueryConfigTests.randomQueryConfig()).requiresRemoteCluster());

        assertTrue(new SourceConfig(new String [] {"index1", "remote2:index2", "index3"},
                QueryConfigTests.randomQueryConfig()).requiresRemoteCluster());

        assertTrue(new SourceConfig(new String [] {"index1", "index2", "remote3:index3"},
                QueryConfigTests.randomQueryConfig()).requiresRemoteCluster());

        assertTrue(new SourceConfig(new String [] {"index1", "remote2:index2", "remote3:index3"},
                QueryConfigTests.randomQueryConfig()).requiresRemoteCluster());

        assertTrue(new SourceConfig(new String [] {"remote1:index1"},
                QueryConfigTests.randomQueryConfig()).requiresRemoteCluster());
    }

}


text:
package org.lastaflute.mixer2.view;

import org.dbflute.util.Srl;
import org.lastaflute.mixer2.view.resolver.TypicalMixClsResolver;
import org.lastaflute.mixer2.view.resolver.TypicalMixErrorsResolver;
import org.lastaflute.mixer2.view.resolver.TypicalMixLayoutResolver;
import org.lastaflute.mixer2.view.resolver.TypicalMixStyleResolver;
import org.lastaflute.web.UrlChain;
import org.mixer2.jaxb.xhtml.Html;

/**
 * @author jflute
 */
public abstract class TypicalMixView implements Mixer2View {

    // ===================================================================================
    //                                                                          Definition
    //                                                                          ==========
    static {
        System.setProperty("com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.fastBoot", "true");
    }

    // ===================================================================================
    //                                                                           Attribute
    //                                                                           =========
    protected final TypicalMixClsResolver clsResolver = createTypicalMixClsResolver();
    protected final TypicalMixErrorsResolver errorsResolver = createTypicalMixErrorsResolver();
    protected final TypicalMixLayoutResolver layoutResolver = createTypicalMixLayoutResolver();
    protected final TypicalMixStyleResolver styleResolver = createTypicalMixStyleResolver();

    // ===================================================================================
    //                                                                        Dynamic HTML
    //                                                                        ============
    @Override
    public void beDynamic(Html html, Mixer2Supporter supporter) {
        // #pending now making
        resolveCls(html, supporter);
        resolveErrors(html, supporter);
        resolveLayout(html, supporter);
        resolveStyle(html, supporter);
        render(html, supporter);
        resolveLinkUrl(html, supporter);
    }

    protected abstract void render(Html html, Mixer2Supporter supporter);

    // ===================================================================================
    //                                                                      Classification
    //                                                                      ==============
    protected void resolveCls(Html html, Mixer2Supporter supporter) {
        clsResolver.resolveCls(html, supporter);
    }

    protected TypicalMixClsResolver createTypicalMixClsResolver() {
        return new TypicalMixClsResolver();
    }

    // ===================================================================================
    //                                                                              Errors
    //                                                                              ======
    protected void resolveErrors(Html html, Mixer2Supporter supporter) {
        errorsResolver.resolveErrors(html, supporter);
    }

    protected TypicalMixErrorsResolver createTypicalMixErrorsResolver() {
        return new TypicalMixErrorsResolver();
    }

    // ===================================================================================
    //                                                                              Layout
    //                                                                              ======
    protected void resolveLayout(Html html, Mixer2Supporter supporter) {
        layoutResolver.resolveLayout(html, supporter);
    }

    protected TypicalMixLayoutResolver createTypicalMixLayoutResolver() {
        final TypicalMixLayoutResolver resolver = new TypicalMixLayoutResolver();
        customizeLayout(resolver);
        return resolver;
    }

    protected void customizeLayout(TypicalMixLayoutResolver resolver) { // may be overridden
    }

    // ===================================================================================
    //                                                                               Style
    //                                                                               =====
    protected void resolveStyle(Html html, Mixer2Supporter supporter) {
        styleResolver.resolveStyle(html, supporter);
    }

    protected TypicalMixStyleResolver createTypicalMixStyleResolver() {
        return new TypicalMixStyleResolver();
    }

    // ===================================================================================
    //                                                                            Link URL
    //                                                                            ========
    protected void resolveLinkUrl(Html html, Mixer2Supporter supporter) {
        supporter.resolveLinkUrl(html);
    }

    // ===================================================================================
    //                                                                        Small Helper
    //                                                                        ============
    // -----------------------------------------------------
    //                                        Empty Handling
    //                                        --------------
    protected boolean isEmpty(String str) {
        return Srl.is_Null_or_Empty(str);
    }

    protected boolean isNotEmpty(String str) {
        return Srl.is_NotNull_and_NotEmpty(str);
    }

    // -----------------------------------------------------
    //                                    UrlChain Following
    //                                    ------------------
    /**
     * Set up more URL parts as URL chain.

     * The name and specification of this method is synchronized with UrlChain#moreUrl().
     * @param urlParts The varying array of URL parts. (NotNull)
     * @return The created instance of URL chain. (NotNull)
     */
    protected UrlChain moreUrl(Object... urlParts) {
        assertArgumentNotNull("urlParts", urlParts);
        return newUrlChain().moreUrl(urlParts);
    }

    /**
     * Set up parameters on GET as URL chain.

     * The name and specification of this method is synchronized with UrlChain#params().
     * @param paramsOnGet The varying array of parameters on GET. (NotNull)
     * @return The created instance of URL chain. (NotNull)
     */
    protected UrlChain params(Object... paramsOnGet) {
        assertArgumentNotNull("paramsOnGet", paramsOnGet);
        return newUrlChain().params(paramsOnGet);
    }

    /**
     * Set up hash on URL as URL chain.

     * The name and specification of this method is synchronized with UrlChain#hash().
     * @param hashOnUrl The value of hash on URL. (NotNull)
     * @return The created instance of URL chain. (NotNull)
     */
    protected UrlChain hash(Object hashOnUrl) {
        assertArgumentNotNull("hashOnUrl", hashOnUrl);
        return newUrlChain().hash(hashOnUrl);
    }

    protected UrlChain newUrlChain() {
        return new UrlChain(this);
    }

    // ===================================================================================
    //                                                                      General Helper
    //                                                                      ==============
    private void assertArgumentNotNull(String variableName, Object value) {
        if (variableName == null) {
            throw new IllegalArgumentException("The argument 'variableName' should not be null.");
        }
        if (value == null) {
            throw new IllegalArgumentException("The argument '" + variableName + "' should not be null.");
        }
    }
}


text:
#pragma once

#include <memory>

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>

#include <pcl/filters/filter_indices.h>

// Pipeline needs to be in the `pcl` namespace in order for the instantiation
// macros to work
namespace pcl
{

/** \brief @b Pipeline composes a linear series of PCL operations to be applied to the source point cloud.
* \details TBD
*

* Usage example:
* \code
* pcl::Pipeline<PointType> pipeline (true); // Initializing with true will allow us to extract the removed indices
* pipeline.setInputCloud (cloud_in);
* pipeline.setFilename (filename);
* pipeline.filter (*cloud_out);
* \endcode
* \author Bradley J Chambers
* \ingroup pipeline
*/
template <typename PointT>
class Pipeline : public Filter<PointT>
{
protected:
    typedef typename Filter<PointT>::PointCloud PointCloud;
    typedef typename PointCloud::Ptr PointCloudPtr;
    typedef typename PointCloud::ConstPtr PointCloudConstPtr;
    typedef typename pcl::traits::fieldList<PointT>::type FieldList;

public:

    typedef boost::shared_ptr< Pipeline<PointT> > Ptr;
    typedef boost::shared_ptr< const Pipeline<PointT> > ConstPtr;

    /** \brief Constructor.
      * \param[in] extract_removed_indices Set to true if you want to be able to extract the indices of points being removed (default = false).
      */
    Pipeline()
    {
        filter_name_ = "Pipeline";
        filename_set_ = false;
        json_set_ = false;
    }

    /** \brief Provide the name of the JSON file describing the PCL pipeline.
      * \param[in] filename the name of the JSON file describing the PCL pipeline
      */
    inline void
    setFilename(const std::string &filename)
    {
        filename_set_ = true;
        boost::property_tree::read_json(filename.c_str(), pt_);
        json_set_ = true;
    }

    inline void
    setJSON(const std::string &json)
    {
        if (filename_set_)
            PCL_WARN("Filename and JSON string have both been specified. Using only the string!\n");
        std::stringstream ss(json);
        boost::property_tree::read_json(ss, pt_);
        json_set_ = true;
    }

    /** \brief Set the offsets to the data in the x, y, and z dimension.
      * \param[in] x the x offset
      * \param[in] y the y offset
      * \param[in] z the z offset
      */
    inline void
    setOffsets(const double x, const double y, const double z)
    {
        x_offset_ = x;
        y_offset_ = y;
        z_offset_ = z;
    }

    void dumper(PointCloud &output);

protected:
    using PCLBase<PointT>::input_;
    using PCLBase<PointT>::indices_;
    using Filter<PointT>::filter_name_;
    using Filter<PointT>::getClassName;

    /** \brief Filtered results are stored in a separate point cloud.
      * \param[out] output The resultant point cloud.
      */
    void
    applyFilter(PointCloud &output);

    /** \brief Apply passthrough filter to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    void
    applyPassThrough(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply statistical outlier removal filter to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    void
    applyStatisticalOutlierRemoval(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply radius outlier removal filter to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    void
    applyRadiusOutlierRemoval(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply voxel grid filter to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    void
    applyVoxelGrid(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply grid minimum filter to input cloud, using parameters specified in property tree.
      *  \param[in] cloud The input point cloud.
      *  \param[out] output The resultant point cloud.
      *  \param[in] value_type The parameters.
      */
    void
    applyGridMinimum(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply approximate progressive morphological filter to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    void
    applyApproximateProgressiveMorphologicalFilter(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply progressive morphological filter to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    void
    applyProgressiveMorphologicalFilter(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply normal estimation to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    //void
    //applyNormalEstimation(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply conditional removal filter to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    //void
    //applyConditionalRemoval(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Apply moving least squares to input cloud, using parameters specified in property tree.
     *  \param[in] cloud The input point cloud.
     *  \param[out] output The resultant point cloud.
     *  \param[in] value_type The parameters.
     */
    void
    applyMovingLeastSquares(PointCloudConstPtr cloud, PointCloud &output, boost::property_tree::ptree::value_type &vt);

    /** \brief Generate tile indices for input point cloud at the given resolution.
     *  \param[in] cloud The input point cloud.
     *  \param[in] resolution The tile size (resolution).
     *  \param[out] tile_indices Vector of tile indices for each point in the cloud.
     */
    void
    generateTileIndices(PointCloudConstPtr cloud, const float &resolution, std::vector<PointIndices> &tile_indices);

private:
    bool filename_set_, json_set_;

    boost::property_tree::ptree pt_;

    /** \brief The offsets to the data in the x, y, and z dimension. */
    double x_offset_, y_offset_, z_offset_;
};

} // namespace pcl

#ifdef PCL_NO_PRECOMPILE
#include <pcl/pipeline/impl/pipeline.hpp>
#endif


text:
@implementation UIColor (JSBingding)

@end


text:
describe("package_material_check_connection", function () {
    beforeEach(function () {
        setFixtures("
\n" +
            "    <form class='invalid_form_for_testing'>\n" +
            "        <input id='invalid_input_element' name=\"invalid_input_element\" value=\"FOOOOOO\" />\n" +
            "    </form>\n" +
            "    <form id=\"package_repo\">\n" +
            "
\n" +
            "
\n" +
            "                Some messages\n" +
            "
\n" +
            "
\n" +
            "                fieldName\n" +
            "                <input type=\"text\" value=\"fieldValue\">\n" +
            "\n" +
            "
error message here
\n" +
            "
\n" +
            "
\n" +
            "                <input name=\"field1\" type=\"text\" value=\"field1Value\">\n" +
            "
\n" +
            "
\n" +
            "
\n" +
            "            <fieldset>\n" +
            "
\n" +
            "                    <input id=\"package_repository_configuration_0_configurationKey_name\" name=\"package_repository[configuration][0][configurationKey][name]\" type=\"hidden\" value=\"REPO_URL\">\n" +
            "                    Repository URL*\n" +
            "                    <input id=\"package_repository_configuration_0_configurationValue_value\" name=\"package_repository[configuration][0][configurationValue][value]\" size=\"30\" type=\"text\" value=\"file:///tmp/repo/\">\n" +
            "
\n" +
            "
\n" +
            "                    <input id=\"package_repository_configuration_1_configurationKey_name\" name=\"package_repository[configuration][1][configurationKey][name]\" type=\"hidden\" value=\"USER\">\n" +
            "                    Repository URL*\n" +
            "                    <input id=\"package_repository_configuration_1_configurationValue_value\" name=\"package_repository[configuration][1][configurationValue][value]\" size=\"30\" type=\"text\" value=\"user_name\">\n" +
            "
\n" +
            "            </fieldset>\n" +
            "            <button class=\"submit button\" id=\"check_connection_button\" type=\"button\" value=\"CHECK CONNECTION\">CHECK CONNECTION</button>\n" +
            "            \n" +
            "
\n" +
            "    </form>\n" +
            "\n" +
            "
");
    });
    it("testShouldCheckConnectionAndSetConnectionOkMessage", function () {
        new PackageMaterialCheckConnection("admin/package_repositories/check_connection").bind("#parent_container", "#check_connection_button", "#connection_message");
        var actual_options;
        jQuery.ajax = function (options) {
            actual_options = options;
            var waiting_message_element = jQuery('#connection_message');
            assertEquals('Checking connection...', waiting_message_element.text());
            assertEquals("Waiting message should not have success or error classes", false, waiting_message_element.hasClass("error_message"));
            assertEquals("Waiting message should not have success or error classes", false, waiting_message_element.hasClass("ok_message"));
            options.success('{"success":"Connection OK. Successfully accessed repository metadata at file:///tmp/repo/repodata/repomd.xml"}');
        };
        jQuery("#check_connection_button").click();
        assertEquals("admin/package_repositories/check_connection", actual_options.url);
        assertEquals("GET", actual_options.type);
        assertEquals("text", actual_options.dataType);
        assertEquals(jQuery('form#package_repo').serialize(), actual_options.data);
        assertEquals("Should set ok_message class", true, jQuery("#connection_message").hasClass("ok_message"))
        assertEquals("Connection ok message not showing up", "Connection OK. Successfully accessed repository metadata at file:///tmp/repo/repodata/repomd.xml", jQuery("#connection_message").text())
    });

    it("testShouldCheckConnectionFailureMessage", function () {
        new PackageMaterialCheckConnection("admin/package_repositories/check_connection_button").bind("#parent_container", "#check_connection_button", "#connection_message");
        jQuery.ajax = function (options) {
            options.success('{"error":"Error in connection!!"}');
        };
        jQuery("#check_connection_button").click();
        assertEquals("Should set error_message class", true, jQuery("#connection_message").hasClass("error_message"))
        assertEquals("Error message not showing up", "Error in connection!!", jQuery("#connection_message").text())
    });

    it("testShouldAssertThatOnlyTheRelevantFormIsSerialize", function () {
        var formData = "unknown";
        jQuery.ajax = function (options) {
            formData = options.data;
        };
        var checkConnectionButton = jQuery("#check_connection_button");
        var checkConnection = new PackageMaterialCheckConnection("admin/package_repositories/check_connection");
        checkConnection.bind("#parent_container", "#" + checkConnectionButton.attr('id'), "#connection_message");

        checkConnectionButton.click();

        assertNotEquals("unknown", formData);
        var parseData = parseQueryParams(formData);
        assertEquals("USER", parseData['package_repository[configuration][1][configurationKey][name]']);
        assertEquals("user_name", parseData['package_repository[configuration][1][configurationValue][value]']);
        assertEquals("REPO_URL", parseData['package_repository[configuration][0][configurationKey][name]']);
        assertEquals("file:///tmp/repo/", unescape(parseData['package_repository[configuration][0][configurationValue][value]']));
        assertEquals("undefined", typeof(parseData['invalid_input_element']));
    });

    function parseQueryParams(data) {
        var result = {};
        var allPairs = data.split("&");
        jQuery(allPairs).each(function (i, d) {
            var keyAndValue = d.split("=");
            result[decodeURI(keyAndValue[0])] = decodeURI(keyAndValue[1]);
        });
        return result;
    }
});


text:
<?php

/**
 * Created by PhpStorm.
 * User: user
 * Date: 6/5/2017
 * Time: 10:20 PM
 */

namespace Gossamer\Core\Components\Caching\Managers;

class CacheManager extends \Gossamer\Caching\CacheManager
{

    protected function getCacheDirectory() {
        if (defined('__CACHE_DIRECTORY')) {
            return __CACHE_DIRECTORY;
        }

        if(!is_null($this->request)) {
            return $this->request->getSiteParams()->getCacheDirectory();
        }

        throw new \Exception('Cache Directory not configured');
    }
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _04_ScottPlotUC
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // create some data to plot
            int nPoints = 1000;
            double[] Xs = ScottPlot.Generate.Sequence(nPoints);
            double[] Ys = ScottPlot.Generate.Sine(nPoints, 5);
            Ys = ScottPlot.Generate.Salt(Ys, .2);

            // load the data into the ScottPlot User Control
            scottPlotUC1.SetData(Xs, Ys);
        }
    }
}


text:
@interface Action : NSObject {
	NSString *type, *context, *when;
	NSNumber *delay, *enabled;

    // terrible hack so that an action can
    // have response data from the helper tool
    // but because the helpertool is a category
    // action, it can't define its own ivars
    CFDictionaryRef helperToolResponse;

    NSAppleEventDescriptor *appleScriptResult_;
}

+ (NSString *)typeForClass:(Class)klass;
+ (Class)classForType:(NSString *)type;

+ (Action *)actionFromDictionary:(NSDictionary *)dict;
- (id)init;
- (id)initWithDictionary:(NSDictionary *)dict;
- (void)dealloc;
- (NSMutableDictionary *)dictionary;
+ (NSString *)helpTextForActionOfType:(NSString *)type;
- (void) handleURL:(NSString *)url;

- (NSComparisonResult)compareDelay:(Action *)other;

// To be implemented by descendant classes:
- (NSString *)description;	// (use present-tense imperative)
- (BOOL)execute:(NSString **)errorString;
+ (NSString *)helpText;
+ (NSString *)creationHelpText;
+ (NSString *)friendlyName;
+ (NSString *)menuCategory;

// Actions should override these if they need to wait until
// after the screen saver has quit, the screen has been unlocked
// or both.
+ (BOOL) shouldWaitForScreensaverExit;
+ (BOOL) shouldWaitForScreenUnlock;

// allows an action to define if it is applicable to the current
// system
+ (BOOL) isActionApplicableToSystem;

// Helpers
- (BOOL)executeAppleScript:(NSString *)script;		// returns YES on success, NO on failure
- (NSArray *)executeAppleScriptReturningListOfStrings:(NSString *)script;

@end

@protocol ActionWithLimitedOptions
+ (NSArray *)limitedOptions;		// Returns an array of dictionaries (keys: option, description)
- (id)initWithOption:(NSObject *)option;
@end

@protocol ActionWithFileParameter
- (id)initWithFile:(NSString *)file;
@end

// An action whose creation UI should just prompt for a string (NSTextField)
@protocol ActionWithString
@end

//////////////////////////////////////////////////////////////////////////////////////////

@interface ActionSetController : NSObject {
	IBOutlet NSWindowController *prefsWindowController;
	NSMutableArray *classes;	// array of class objects
    NSDictionary *menuCategories;
}

- (NSArray *)types;

// NSMenu delegates
- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(int)index shouldCancel:(BOOL)shouldCancel;
- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action;
- (NSUInteger)numberOfItemsInMenu:(NSMenu *)menu;

@end


text:
require          'rdf'
require          'rdf/vocab'
require_relative 'namespace'

module BEL
  module Resource
    # Namespaces allows access to all NamespaceConceptScheme RDF Resources
    # available in the resources dataset.
    class Namespaces

      BELV = RDF::Vocabulary.new('http://www.openbel.org/vocabulary/')
      SKOS = RDF::Vocab::SKOS

      def initialize(rdf_repository)
        @rdf_repository = rdf_repository
      end

      def each
        return to_enum(:each) unless block_given?
				@rdf_repository.
					query(
            :predicate => RDF.type,
            :object => BELV.NamespaceConceptScheme) { |solution|

						yield Namespace.new(@rdf_repository, solution.subject)
					}
      end

      def find(*namespaces)
        return to_enum(:find, *namespaces) unless block_given?

        namespaces.flatten.each do |ns|
          yield find_namespace(ns)
				end
			end

      protected

      def find_namespace(namespace)
        # nil input always yield nil
        return nil if namespace == nil

        # empty literals will match in a pattern as if it was nil
        # so return nil if empty string
        nstr = namespace.to_s
        return nil if nstr.empty?

        # URI handled by regex match on string
        return find_namespace_uri(nstr) if nstr =~ FULL_URI_REGEX

        # match input as namespace prefix
				nlit   = RDF::Literal(nstr)
				prefix = namespace_query(
					:predicate => BELV.prefix,
					:object    => nlit
				)
			  return Namespace.new(@rdf_repository, prefix.subject) if prefix

        # match input as namespace prefLabel
				label  = namespace_query(
					:predicate => SKOS.prefLabel,
					:object    => nlit
				)
				return Namespace.new(@rdf_repository, label.subject) if label
      end

      def find_namespace_uri(uri_s)
        subject    = RDF::URI(uri_s)
        type_check = RDF::Statement(subject, RDF.type, BELV.NamespaceConceptScheme)
				if @rdf_repository.has_statement?(type_check)
          return Namespace.new(@rdf_repository, subject)
        end
			end

      def namespace_query(pattern)
				@rdf_repository.query(pattern).find { |solution|
				  @rdf_repository.has_statement?(
						RDF::Statement(solution.subject, RDF.type, BELV.NamespaceConceptScheme)
					)
				}
      end
    end
  end
end


text:
#include "core/indexbuffer.h"
#include "core/rendertarget.h"
#include "core/vertexbuffer.h"

class ShaderProgram;
class RenderState;

namespace grt
{
class Font;
}

struct Mesh
{
	RenderTarget::PrimitiveType type;
	int patch_vertices;
	int instances = 1;
	IndexBuffer::Ptr  ib;
	VertexBuffer::Ptr vb;
	struct Bone
	{
		std::string node_name;
		float44 bone_from_model;
	};
	std::vector< Bone > bones;
	void draw( ShaderProgram &sp, RenderState &rs, RenderTarget &rt );
};

Mesh make_cube();
Mesh make_quad();
Mesh make_text( grt::Font const& font, char const *text );

#endif // MESH_H


text:
package com.poseidon.common.encrypt;

import org.apache.commons.io.Charsets;
import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * 加密相关工具类直接使用Spring util封装,减少jar依赖
 * @author L.cm
 */
public class DigestUtils extends org.springframework.util.DigestUtils {

    /**
     * Calculates the MD5 digest and returns the value as a 32 character hex string.
     *
     * @param data Data to digest
     * @return MD5 digest as a hex string
     */
    public static String md5Hex(final String data) {
        return DigestUtils.md5DigestAsHex(data.getBytes(Charsets.UTF_8));
    }

    /**
     * Return a hexadecimal string representation of the MD5 digest of the given bytes.
     * @param bytes the bytes to calculate the digest over
     * @return a hexadecimal digest string
     */
    public static String md5Hex(final byte[] bytes) {
        return DigestUtils.md5DigestAsHex(bytes);
    }

    /**
     * 使用shiro的hash方式
     * @param algorithmName 算法
     * @param source 源对象
     * @param salt 加密盐
     * @param hashIterations hash次数
     * @return 加密后的字符
     */
    public static String hashByShiro(String algorithmName, Object source, Object salt, int hashIterations) {
    	return new SimpleHash(algorithmName, source, salt, hashIterations).toHex();
    }

}


text: * https://fontawesome.bootstrapcheatsheets.com/


text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "xf86.h"

/* for usleep */
#if HAVE_XF86_ANSIC_H
# include "xf86_ansic.h"
#else
# include <unistd.h>
#endif

#include "rhd.h"
#include "rhd_crtc.h"
#include "rhd_pll.h"
#include "rhd_connector.h"
#include "rhd_output.h"
#include "rhd_crtc.h"
#include "rhd_regs.h"
#if defined (ATOM_BIOS) && defined (ATOM_BIOS_PARSER)
# include "rhd_atombios.h"
# include "rhd_biosscratch.h"

struct atomPLLPrivate {
    enum atomPxclk Pxclk;
    struct atomPixelClockConfig Config;
    struct atomCodeTableVersion Version;

    CARD32 StoreFBDivFrac;
    enum atomDevice StoreDevice;
    enum rhdConnectorType StoreConnectorType;
    enum rhdOutputType StoreOutputType;
    int StoreCrtc;
};

/*
 *
 */
static void
getSetPixelClockParameters(struct rhdPLL *PLL, struct atomPixelClockConfig *Config,
			   enum rhdConnectorType ct, enum rhdOutputType ot, enum atomDevice device)
{
    RHDPtr rhdPtr = RHDPTRI(PLL);
    struct atomPLLPrivate *Private = (struct atomPLLPrivate *)PLL->Private;

    switch (Private->Version.cref) {
	case 1:
	    break;
	case 2:
	    Config->u.v2.Device = device;
	    Config->u.v2.Force = TRUE;
	    break;
	case 3:
	    switch (ct) {
		case RHD_CONNECTOR_VGA:
		    Config->u.v3.EncoderMode = atomNoEncoder;
		    break;
		case RHD_CONNECTOR_DVI:
		case RHD_CONNECTOR_DVI_SINGLE:
		    Config->u.v3.EncoderMode = atomDVI;
		    break;
		case RHD_CONNECTOR_PANEL:
		    Config->u.v3.EncoderMode = atomLVDS;
		    break;
#if 0
		case RHD_CONNECTOR_DP:
		case RHD_CONNECTOR_DP_DUAL:
		    Config->u.v3.EncoderMode = atomDP;
		    break;
		case RHD_CONNECTOR_HDMI_A:
		case RHD_CONNECTOR_HDMI_B:
		    Config->u.v3.EncoderMode = atomHDMI;
		    break;
#endif
		default:
		    xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR, "%s: Unknown connector type: 0x%x\n",__func__,ct);
	    }
	    switch (ot) {
		case RHD_OUTPUT_DACA:
		    Config->u.v3.OutputType = atomOutputDacA;
		    break;
		case RHD_OUTPUT_DACB:
		    Config->u.v3.OutputType = atomOutputDacB;
		    break;
		case RHD_OUTPUT_KLDSKP_LVTMA:
		    Config->u.v3.OutputType = atomOutputKldskpLvtma;
		    break;
		case RHD_OUTPUT_UNIPHYA:
		    Config->u.v3.OutputType = atomOutputUniphyA;
		    break;
		case RHD_OUTPUT_UNIPHYB:
		    Config->u.v3.OutputType = atomOutputUniphyB;
		    break;
		case RHD_OUTPUT_UNIPHYC:
		    Config->u.v3.OutputType = atomOutputUniphyC;
		    break;
		case RHD_OUTPUT_UNIPHYD:
		    Config->u.v3.OutputType = atomOutputUniphyD;
		    break;
		case RHD_OUTPUT_UNIPHYE:
		    Config->u.v3.OutputType = atomOutputUniphyE;
		    break;
		case RHD_OUTPUT_UNIPHYF:
		    Config->u.v3.OutputType = atomOutputUniphyF;
		    break;
		case RHD_OUTPUT_DVO:
		    Config->u.v3.OutputType = atomOutputDvo;
		    break;
		default:
		    xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR, "%s: Unhandled ouptut type\n",__func__);
		    break;
	    }
	    Config->u.v3.Force = TRUE;
	    Config->u.v3.UsePpll = FALSE;
	    break;
	default:
	    xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR, "Unsupported SelectPixelClock version: %i\n",Private->Version.cref);
	    break;
    }
}

/*
 *
 */
static void
rhdAtomPLLSave(struct rhdPLL *PLL, CARD32 PllCntl, CARD32 OwnerVal)
{
    RHDPtr rhdPtr = RHDPTRI(PLL);
    struct atomPLLPrivate *Private = (struct atomPLLPrivate *)PLL->Private;
    CARD32 Crtc1Cntl, Crtc2Cntl;
    enum atomCrtc owner;

    RHDFUNC(PLL);

    Crtc1Cntl = RHDRegRead(PLL, PCLK_CRTC1_CNTL);
    Crtc2Cntl = RHDRegRead(PLL, PCLK_CRTC2_CNTL);

    if (PllCntl & 0x2)
	PLL->StoreActive = FALSE;
    else
	PLL->StoreActive = TRUE;

    if ((Crtc1Cntl & 0x00010000) == OwnerVal)
	owner = atomCrtc1;
    else if ((Crtc2Cntl & 0x00010000) == OwnerVal)
	owner = atomCrtc2;
    else {
	owner = atomCrtc1; /* whatever... */
	PLL->StoreActive = FALSE;
    }

    Private->StoreCrtc = owner;
    Private->StoreDevice = RHDGetDeviceOnCrtc(rhdPtr, owner);

    if (Private->StoreDevice != atomNone)
	RHDFindConnectorAndOutputTypesForDevice(rhdPtr, Private->StoreDevice,
						&Private->StoreOutputType, &Private->StoreConnectorType);
    else
	PLL->StoreActive = FALSE;

    RHDDebug(PLL->scrnIndex, "Saving PLL %i on CRTC: %i %s active - device: 0x%x\n",
	     (PLL->Id == PLL_ID_PLL1) ? 1 : 2,
	     (owner == atomCrtc1) ? 1 : 2,
	     (PLL->StoreActive) ? "" : "not",
	     Private->StoreDevice);

    PLL->Stored = TRUE;

    /* Set parameters found at startup for shutdownInactive(). This is somewhat ugly... */
    Private->Config.Crtc = Private->StoreCrtc;
    Private->Config.Enable = PLL->StoreActive;
    if (Private->StoreDevice != atomNone)
	getSetPixelClockParameters(PLL, &Private->Config, Private->StoreConnectorType,
				   Private->StoreOutputType, Private->StoreDevice);
}

/*
 *
 */
static void
rhdAtomPLL1Save(struct rhdPLL *PLL)
{
    struct atomPLLPrivate *Private = (struct atomPLLPrivate *)PLL->Private;
    CARD32 PllCntl;

    RHDFUNC(PLL);

    PLL->StoreSpreadSpectrum = RHDRegRead(PLL, P1PLL_INT_SS_CNTL);
    PLL->StoreRefDiv   = RHDRegRead(PLL, EXT1_PPLL_REF_DIV) & 0x1FF;
    PLL->StoreFBDiv    = (RHDRegRead(PLL, EXT1_PPLL_FB_DIV) >> 16) & 0x7FF;
    Private->StoreFBDivFrac = RHDRegRead(PLL, EXT1_PPLL_FB_DIV) & 0x7;
    PLL->StorePostDiv  = RHDRegRead(PLL, EXT1_PPLL_POST_DIV) & 0x3F;
    PllCntl = RHDRegRead(PLL, P1PLL_CNTL);
    RHDDebug(PLL->scrnIndex, "Saving %i kHz clock on PLL1\n",
	     ((PLL->StoreFBDiv * PLL->RefClock * 10)
	      / (PLL->StorePostDiv * PLL->StoreRefDiv)));

    rhdAtomPLLSave(PLL, PllCntl, 0x00000000);
}

/*
 *
 */
static void
rhdAtomPLL2Save(struct rhdPLL *PLL)
{
    struct atomPLLPrivate *Private = (struct atomPLLPrivate *)PLL->Private;
    CARD32 PllCntl;

    RHDFUNC(PLL);

    PLL->StoreSpreadSpectrum = RHDRegRead(PLL, P2PLL_INT_SS_CNTL);
    PLL->StoreRefDiv   = RHDRegRead(PLL, EXT2_PPLL_REF_DIV) & 0x1FF;
    PLL->StoreFBDiv    = (RHDRegRead(PLL, EXT2_PPLL_FB_DIV) >> 16) & 0x7FF;
    Private->StoreFBDivFrac = RHDRegRead(PLL, EXT2_PPLL_FB_DIV) & 0x7;
    PLL->StorePostDiv  = RHDRegRead(PLL, EXT2_PPLL_POST_DIV) & 0x3F;
    PllCntl = RHDRegRead(PLL, P2PLL_CNTL);
    RHDDebug(PLL->scrnIndex, "Saving %i kHz clock on PLL2\n",
	     ((PLL->StoreFBDiv * PLL->RefClock * 10)
	      / (PLL->StorePostDiv * PLL->StoreRefDiv)));

    rhdAtomPLLSave(PLL, PllCntl, 0x00010000);
}

/*
 *
 */
static void
rhdAtomPLLRestore(struct rhdPLL *PLL)
{
    RHDPtr rhdPtr = RHDPTRI(PLL);
    struct atomPixelClockConfig Config;
    struct atomPLLPrivate *Private = (struct atomPLLPrivate *)PLL->Private;

    RHDFUNC(PLL);

    if (!PLL->Stored) {
	xf86DrvMsg(PLL->scrnIndex, X_ERROR, "%s: %s: trying to restore "
		   "uninitialized values.\n", __func__, PLL->Name);
	return;
    }
    Config.PixelClock = PLL->StoreActive
	? ((PLL->StoreFBDiv * PLL->RefClock * 10) / (PLL->StorePostDiv * PLL->StoreRefDiv))
	: 0;

    Config.Enable = PLL->StoreActive;
    Config.RefDiv = PLL->StoreRefDiv;
    Config.FbDiv = PLL->StoreFBDiv;
    Config.PostDiv = PLL->StorePostDiv;
    Config.FracFbDiv = Private->StoreFBDivFrac;
    Config.Crtc = Private->StoreCrtc;

    if (Private->StoreDevice != atomNone)
	getSetPixelClockParameters(PLL, &Config, Private->StoreConnectorType,
				   Private->StoreOutputType, Private->StoreDevice);
    RHDDebug(PLL->scrnIndex, "Restoring PixelClock %i with %i kHz, (%i * %i) / ( %i * %i )"
	     " on CRTC %i device: %x\n",
	     Private->Pxclk, Config.PixelClock, PLL->RefClock, PLL->StoreFBDiv, PLL->StorePostDiv,
	     PLL->StoreRefDiv, (Config.Crtc == atomCrtc1) ? 1 : 2, Config.u.v2.Device);

    /* Restore spread spectrum: AtomBIOS doesn't handle this for us */
    RHDRegWrite(PLL, (PLL->Id == PLL_ID_PLL1) ? P1PLL_INT_SS_CNTL : P2PLL_INT_SS_CNTL, PLL->StoreSpreadSpectrum);

    rhdAtomSetPixelClock(rhdPtr->atomBIOS, Private->Pxclk, &Config);
}

/*
 *
 */
static void
rhdAtomPLLPower(struct rhdPLL *PLL, int Power)
{
    RHDPtr rhdPtr = RHDPTRI(PLL);
    struct atomPLLPrivate *Private = (struct atomPLLPrivate *)PLL->Private;
    struct atomPixelClockConfig *config = &Private->Config;

    RHDFUNC(PLL);

    switch (Power) {
	case RHD_POWER_ON:
	    if (config->PixelClock > 0)
		config->Enable = TRUE;
	    else {
		xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR,
			   "%s: cannot enable pixel clock without frequency set\n",__func__);
		config->Enable = FALSE;
	    }
	    break;
	case RHD_POWER_RESET:
	case RHD_POWER_SHUTDOWN:
	    return;
	    config->Enable = FALSE;
	default:
	    break;
    }
    rhdAtomSetPixelClock(rhdPtr->atomBIOS, Private->Pxclk, config);
}

/*
 *
 */
static void
rhdAtomPLLSet(struct rhdPLL *PLL, int PixelClock, CARD16 ReferenceDivider,
	    CARD16 FeedbackDivider, CARD8 PostDivider)
{
    RHDPtr rhdPtr = RHDPTRI(PLL);
    struct atomPLLPrivate *Private = (struct atomPLLPrivate *)PLL->Private;
    struct rhdCrtc *Crtc = NULL;

    RHDFUNC(PLL);
    RHDDebug(rhdPtr->scrnIndex, "%s: %i kHz RefDiv: %x FeedbackDiv: %x PostDiv: %x\n",
	     __func__, PixelClock, ReferenceDivider, FeedbackDivider, PostDivider);

    Private->Config.PixelClock = PixelClock;
    Private->Config.RefDiv = ReferenceDivider;
    Private->Config.FbDiv = FeedbackDivider;
    Private->Config.PostDiv = PostDivider;
    Private->Config.FracFbDiv = 0;
    if (rhdPtr->Crtc[0]->PLL == PLL) {
	Private->Config.Crtc = atomCrtc1;
	Crtc = rhdPtr->Crtc[0];
    } else if (rhdPtr->Crtc[1]->PLL == PLL) {
	Private->Config.Crtc = atomCrtc2;
	Crtc = rhdPtr->Crtc[1];
    } else
	xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR, "Trying to set an unassigned PLL\n");

    if (Crtc && Private->Version.cref > 1) {
	struct rhdOutput *Output;
	for (Output = rhdPtr->Outputs; Output; Output = Output->Next) {
	    if (Output->Crtc == Crtc)
		break;
	}
	if (Output)
	    getSetPixelClockParameters(PLL, &Private->Config,
				      Output->Connector->Type, Output->Id,
				      Output->OutputDriverPrivate->Device);
    }

    /* Disable spread spectrum. AtomBIOS doesn't do this for us */
    RHDRegMask(PLL, (PLL->Id == PLL_ID_PLL1) ? P1PLL_INT_SS_CNTL : P2PLL_INT_SS_CNTL, 0, 0x00000001);

    Private->Config.Enable = TRUE;
    rhdAtomSetPixelClock(rhdPtr->atomBIOS, Private->Pxclk, &Private->Config);
}

/*
 *
 */
Bool
RHDAtomPLLsInit(RHDPtr rhdPtr)
{
    struct rhdPLL *PLL;
    struct atomPLLPrivate *Private;
    CARD32 RefClock, IntMin, IntMax, PixMin, PixMax;
    int i;

    RHDFUNC(rhdPtr);

    RHDSetupLimits(rhdPtr, &RefClock, &IntMin, &IntMax, &PixMin, &PixMax);

    for (i = 0; i < 2; i++) {

	PLL = (struct rhdPLL *) xnfcalloc(sizeof(struct rhdPLL), 1);
	Private = (struct atomPLLPrivate *) xnfcalloc(sizeof(struct atomPLLPrivate),1);
	PLL->Private = Private;

	Private->Version = rhdAtomSetPixelClockVersion(rhdPtr->atomBIOS);
	if (Private->Version.cref > 3) {
	    xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR, "Unsupported SelectPixelClock version; %i\n",
		       Private->Version.cref);
	    xfree(PLL->Private);
	    xfree(PLL);
	    return FALSE;
	}

	PLL->scrnIndex = rhdPtr->scrnIndex;
	if (i == 0) {
	    PLL->Name = PLL_NAME_PLL1;
	    PLL->Id = PLL_ID_PLL1;
	    PLL->Save = rhdAtomPLL1Save;
	    Private->Pxclk = atomPclk1;
	} else {
	    PLL->Name = PLL_NAME_PLL2;
	    PLL->Id = PLL_ID_PLL2;
	    PLL->Save = rhdAtomPLL2Save;
	    Private->Pxclk = atomPclk2;
	}

	PLL->RefClock = RefClock;
	PLL->IntMin = IntMin;
	PLL->IntMax = IntMax;
	PLL->PixMin = PixMin;
	PLL->PixMax = PixMax;

	PLL->Valid = NULL;

	PLL->Set = rhdAtomPLLSet;
	PLL->Power = rhdAtomPLLPower;
	PLL->Restore = rhdAtomPLLRestore;

	rhdPtr->PLLs[i] = PLL;
    }

    return TRUE;
}

#endif /* ATOM_BIOS && ATOM_BIOS_PARSER */


text:
class CTipDlg : public CDialogEx
{
	DECLARE_DYNAMIC(CTipDlg)

public:
	CTipDlg(int iX, int iY, int iDelayTime, const char* szExeFileName, CWnd* pParent = NULL);   // standard constructor
	virtual ~CTipDlg();

// Dialog Data
	enum { IDD = IDD_TIP_DIALOG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()

public:
	CWnd* m_pParent;
	std::string m_szExeFileName;
	int m_iX;
	int m_iY;
	int m_iDelayTime;

public:
	virtual BOOL OnInitDialog();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	CButtonST m_ButtonTip;
};