text:
using System;
using ReactiveWebsocket.Model;
using ReactiveWebsocket.Portable.Public;
using ReactiveWebsocket.Public;
using ReactiveWebsocket.Samples.Model;

namespace ReactiveWebsocket.Samples
{
    internal class JsonPayloadExample
    {
        private const string Uri = "ws://reactivewebsocket.azurewebsites.net/ReactiveWebSocketServer/jsondemo";

        public async void RunAsync()
        {
            var factory = new WebsocketClientFactory(PlatformName.Desktop);
            var socket = factory.CreateGeneric(new JsonConnectionProfile(), new WebSocketClientSettings(new Uri(Uri)));

            socket.StatusStream.Subscribe(value =>
            {
                Console.WriteLine(value.ConnectionState != ConnectionState.Disconnected
                    ? $"Status: {value.ConnectionState}; {value.Message}"
                    : $"Status: {value.ConnectionState}; {value.Error?.Message}");
            });

            var success = await socket.ConnectAsync();
            if (!success) return;

            var inputData = new Data()
            {
                Id = Guid.NewGuid().ToString(),
                Number1 = 100,
                Number2 = 200
            };
            Console.WriteLine("Sending request to server: ");

            var result = await socket.GetResponse<Data, Result>(inputData, result1 => result1.Id.Equals(inputData.Id));

            socket.GetObservable<Data, Result>(inputData, result1 => result1.Id.Equals(inputData.Id))
                .Subscribe(resultReceived =>
                    {
                        Console.WriteLine($"Result received from server {resultReceived.Value}");
                    },
                    exception =>
                    {
                        Console.WriteLine($"Error: {exception.Message}");
                    });
        }
    }
}


text:
require 'test_helper'
require 'action_view/test_case'

class WickedPdfHelperTest < ActionView::TestCase
  if Rails::VERSION::MAJOR == 2
    test 'wicked_pdf_stylesheet_link_tag should inline the stylesheets passed in' do
      assert_equal "<style type='text/css'>/* Wicked styles */\n</style>",
                   wicked_pdf_stylesheet_link_tag('../../../fixtures/wicked')
    end

    test 'wicked_pdf_image_tag should return the same as image_tag when passed a full path' do
      assert_equal image_tag("file:///#{Rails.root.join('public', 'images', 'pdf')}"),
                   wicked_pdf_image_tag('pdf')
    end

    test 'wicked_pdf_javascript_src_tag should return the same as javascript_src_tag when passed a full path' do
      assert_equal javascript_src_tag("file:///#{Rails.root.join('public', 'javascripts', 'pdf')}", {}),
                   wicked_pdf_javascript_src_tag('pdf')
    end

    test 'wicked_pdf_include_tag should return many wicked_pdf_javascript_src_tags' do
      assert_equal [wicked_pdf_javascript_src_tag('foo'), wicked_pdf_javascript_src_tag('bar')].join("\n"),
                   wicked_pdf_javascript_include_tag('foo', 'bar')
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title></title>

    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <meta name="description" content="">

    <meta name="twitter:card" content="summary">
    <meta name="twitter:title" content="">
    <meta name="twitter:description" content="">

    <meta property="og:type" content="article">
    <meta property="og:title" content="">
    <meta property="og:description" content="">

    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon">
    <link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon">

    <link rel="stylesheet" type="text/css" href="//eduardo76609.github.io/themes/uno/assets/css/uno.css?v=1.0.0" />

    <link rel="canonical" href="https://eduardo76609.github.ioundefined" />
    <meta name="generator" content="Ghost ?" />
    <link rel="alternate" type="application/rss+xml" title="Eduardo76609" href="https://eduardo76609.github.io/rss" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">

Eduardo76609

Sofware developer, ruby on rails, javascript, java (android) and more!!

Blog

                      Facebook

                      Twitter

                      Github

                      Email

    Page 0 of 0

                © 2016. All rights reserved.
                Uno theme by Dale-Anthony
                Proudly published with Hubpress


text:
#include <aws/core/utils/Outcome.h>
#include <aws/core/auth/AWSAuthSigner.h>
#include <aws/core/client/CoreErrors.h>
#include <aws/core/client/RetryStrategy.h>
#include <aws/core/http/HttpClient.h>
#include <aws/core/http/HttpResponse.h>
#include <aws/core/http/HttpClientFactory.h>
#include <aws/core/auth/AWSCredentialsProviderChain.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/utils/threading/Executor.h>
#include <aws/lambda/LambdaClient.h>
#include <aws/lambda/LambdaEndpoint.h>
#include <aws/lambda/LambdaErrorMarshaller.h>
#include <aws/lambda/model/AddPermissionRequest.h>
#include <aws/lambda/model/CreateEventSourceMappingRequest.h>
#include <aws/lambda/model/CreateFunctionRequest.h>
#include <aws/lambda/model/DeleteEventSourceMappingRequest.h>
#include <aws/lambda/model/DeleteFunctionRequest.h>
#include <aws/lambda/model/GetEventSourceMappingRequest.h>
#include <aws/lambda/model/GetFunctionRequest.h>
#include <aws/lambda/model/GetFunctionConfigurationRequest.h>
#include <aws/lambda/model/GetPolicyRequest.h>
#include <aws/lambda/model/InvokeRequest.h>
#include <aws/lambda/model/ListEventSourceMappingsRequest.h>
#include <aws/lambda/model/ListFunctionsRequest.h>
#include <aws/lambda/model/RemovePermissionRequest.h>
#include <aws/lambda/model/UpdateEventSourceMappingRequest.h>
#include <aws/lambda/model/UpdateFunctionCodeRequest.h>
#include <aws/lambda/model/UpdateFunctionConfigurationRequest.h>

using namespace Aws;
using namespace Aws::Auth;
using namespace Aws::Client;
using namespace Aws::Lambda;
using namespace Aws::Lambda::Model;
using namespace Aws::Http;
using namespace Aws::Utils::Json;

static const char* SERVICE_NAME = "lambda";
static const char* ALLOCATION_TAG = "LambdaClient";

LambdaClient::LambdaClient(const Client::ClientConfiguration& clientConfiguration) :
  BASECLASS(Aws::MakeShared<HttpClientFactory>(ALLOCATION_TAG), clientConfiguration,
    Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG),
        SERVICE_NAME, clientConfiguration.authenticationRegion.empty() ? RegionMapper::GetRegionName(clientConfiguration.region) : clientConfiguration.authenticationRegion),
    Aws::MakeShared<LambdaErrorMarshaller>(ALLOCATION_TAG)),
    m_executor(clientConfiguration.executor)
{
  init(clientConfiguration);
}

LambdaClient::LambdaClient(const AWSCredentials& credentials, const Client::ClientConfiguration& clientConfiguration) :
  BASECLASS(Aws::MakeShared<HttpClientFactory>(ALLOCATION_TAG), clientConfiguration,
    Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG, credentials),
         SERVICE_NAME, clientConfiguration.authenticationRegion.empty() ? RegionMapper::GetRegionName(clientConfiguration.region) : clientConfiguration.authenticationRegion),
    Aws::MakeShared<LambdaErrorMarshaller>(ALLOCATION_TAG)),
    m_executor(clientConfiguration.executor)
{
  init(clientConfiguration);
}

LambdaClient::LambdaClient(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
  const Client::ClientConfiguration& clientConfiguration, const std::shared_ptr<HttpClientFactory const>& httpClientFactory) :
  BASECLASS(httpClientFactory != nullptr ? httpClientFactory : Aws::MakeShared<HttpClientFactory>(ALLOCATION_TAG), clientConfiguration,
    Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, credentialsProvider,
         SERVICE_NAME, clientConfiguration.authenticationRegion.empty() ? RegionMapper::GetRegionName(clientConfiguration.region) : clientConfiguration.authenticationRegion),
    Aws::MakeShared<LambdaErrorMarshaller>(ALLOCATION_TAG)),
    m_executor(clientConfiguration.executor)
{
  init(clientConfiguration);
}

LambdaClient::~LambdaClient()
{
}

void LambdaClient::init(const ClientConfiguration& config)
{
  Aws::StringStream ss;
  ss << SchemeMapper::ToString(config.scheme) << "://";

  if(config.endpointOverride.empty() && config.authenticationRegion.empty())
  {
    ss << LambdaEndpoint::ForRegion(config.region);
  }
  else
  {
    ss << config.endpointOverride;
  }

  m_uri = ss.str();
}
AddPermissionOutcome LambdaClient::AddPermission(const AddPermissionRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/versions/HEAD/policy";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_POST);
  if(outcome.IsSuccess())
  {
    return AddPermissionOutcome(AddPermissionResult(outcome.GetResult()));
  }
  else
  {
    return AddPermissionOutcome(outcome.GetError());
  }
}

AddPermissionOutcomeCallable LambdaClient::AddPermissionCallable(const AddPermissionRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::AddPermission, this, request);
}

void LambdaClient::AddPermissionAsync(const AddPermissionRequest& request, const AddPermissionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::AddPermissionAsyncHelper, this, request, handler, context);
}

void LambdaClient::AddPermissionAsyncHelper(const AddPermissionRequest& request, const AddPermissionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, AddPermission(request), context);
}

CreateEventSourceMappingOutcome LambdaClient::CreateEventSourceMapping(const CreateEventSourceMappingRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/event-source-mappings/";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_POST);
  if(outcome.IsSuccess())
  {
    return CreateEventSourceMappingOutcome(CreateEventSourceMappingResult(outcome.GetResult()));
  }
  else
  {
    return CreateEventSourceMappingOutcome(outcome.GetError());
  }
}

CreateEventSourceMappingOutcomeCallable LambdaClient::CreateEventSourceMappingCallable(const CreateEventSourceMappingRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::CreateEventSourceMapping, this, request);
}

void LambdaClient::CreateEventSourceMappingAsync(const CreateEventSourceMappingRequest& request, const CreateEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::CreateEventSourceMappingAsyncHelper, this, request, handler, context);
}

void LambdaClient::CreateEventSourceMappingAsyncHelper(const CreateEventSourceMappingRequest& request, const CreateEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, CreateEventSourceMapping(request), context);
}

CreateFunctionOutcome LambdaClient::CreateFunction(const CreateFunctionRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_POST);
  if(outcome.IsSuccess())
  {
    return CreateFunctionOutcome(CreateFunctionResult(outcome.GetResult()));
  }
  else
  {
    return CreateFunctionOutcome(outcome.GetError());
  }
}

CreateFunctionOutcomeCallable LambdaClient::CreateFunctionCallable(const CreateFunctionRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::CreateFunction, this, request);
}

void LambdaClient::CreateFunctionAsync(const CreateFunctionRequest& request, const CreateFunctionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::CreateFunctionAsyncHelper, this, request, handler, context);
}

void LambdaClient::CreateFunctionAsyncHelper(const CreateFunctionRequest& request, const CreateFunctionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, CreateFunction(request), context);
}

DeleteEventSourceMappingOutcome LambdaClient::DeleteEventSourceMapping(const DeleteEventSourceMappingRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/event-source-mappings/";
  ss << request.GetUUID();

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_DELETE);
  if(outcome.IsSuccess())
  {
    return DeleteEventSourceMappingOutcome(DeleteEventSourceMappingResult(outcome.GetResult()));
  }
  else
  {
    return DeleteEventSourceMappingOutcome(outcome.GetError());
  }
}

DeleteEventSourceMappingOutcomeCallable LambdaClient::DeleteEventSourceMappingCallable(const DeleteEventSourceMappingRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::DeleteEventSourceMapping, this, request);
}

void LambdaClient::DeleteEventSourceMappingAsync(const DeleteEventSourceMappingRequest& request, const DeleteEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::DeleteEventSourceMappingAsyncHelper, this, request, handler, context);
}

void LambdaClient::DeleteEventSourceMappingAsyncHelper(const DeleteEventSourceMappingRequest& request, const DeleteEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, DeleteEventSourceMapping(request), context);
}

DeleteFunctionOutcome LambdaClient::DeleteFunction(const DeleteFunctionRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_DELETE);
  if(outcome.IsSuccess())
  {
    return DeleteFunctionOutcome(NoResult());
  }
  else
  {
    return DeleteFunctionOutcome(outcome.GetError());
  }
}

DeleteFunctionOutcomeCallable LambdaClient::DeleteFunctionCallable(const DeleteFunctionRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::DeleteFunction, this, request);
}

void LambdaClient::DeleteFunctionAsync(const DeleteFunctionRequest& request, const DeleteFunctionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::DeleteFunctionAsyncHelper, this, request, handler, context);
}

void LambdaClient::DeleteFunctionAsyncHelper(const DeleteFunctionRequest& request, const DeleteFunctionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, DeleteFunction(request), context);
}

GetEventSourceMappingOutcome LambdaClient::GetEventSourceMapping(const GetEventSourceMappingRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/event-source-mappings/";
  ss << request.GetUUID();

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_GET);
  if(outcome.IsSuccess())
  {
    return GetEventSourceMappingOutcome(GetEventSourceMappingResult(outcome.GetResult()));
  }
  else
  {
    return GetEventSourceMappingOutcome(outcome.GetError());
  }
}

GetEventSourceMappingOutcomeCallable LambdaClient::GetEventSourceMappingCallable(const GetEventSourceMappingRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::GetEventSourceMapping, this, request);
}

void LambdaClient::GetEventSourceMappingAsync(const GetEventSourceMappingRequest& request, const GetEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::GetEventSourceMappingAsyncHelper, this, request, handler, context);
}

void LambdaClient::GetEventSourceMappingAsyncHelper(const GetEventSourceMappingRequest& request, const GetEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, GetEventSourceMapping(request), context);
}

GetFunctionOutcome LambdaClient::GetFunction(const GetFunctionRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/versions/HEAD";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_GET);
  if(outcome.IsSuccess())
  {
    return GetFunctionOutcome(GetFunctionResult(outcome.GetResult()));
  }
  else
  {
    return GetFunctionOutcome(outcome.GetError());
  }
}

GetFunctionOutcomeCallable LambdaClient::GetFunctionCallable(const GetFunctionRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::GetFunction, this, request);
}

void LambdaClient::GetFunctionAsync(const GetFunctionRequest& request, const GetFunctionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::GetFunctionAsyncHelper, this, request, handler, context);
}

void LambdaClient::GetFunctionAsyncHelper(const GetFunctionRequest& request, const GetFunctionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, GetFunction(request), context);
}

GetFunctionConfigurationOutcome LambdaClient::GetFunctionConfiguration(const GetFunctionConfigurationRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/versions/HEAD/configuration";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_GET);
  if(outcome.IsSuccess())
  {
    return GetFunctionConfigurationOutcome(GetFunctionConfigurationResult(outcome.GetResult()));
  }
  else
  {
    return GetFunctionConfigurationOutcome(outcome.GetError());
  }
}

GetFunctionConfigurationOutcomeCallable LambdaClient::GetFunctionConfigurationCallable(const GetFunctionConfigurationRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::GetFunctionConfiguration, this, request);
}

void LambdaClient::GetFunctionConfigurationAsync(const GetFunctionConfigurationRequest& request, const GetFunctionConfigurationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::GetFunctionConfigurationAsyncHelper, this, request, handler, context);
}

void LambdaClient::GetFunctionConfigurationAsyncHelper(const GetFunctionConfigurationRequest& request, const GetFunctionConfigurationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, GetFunctionConfiguration(request), context);
}

GetPolicyOutcome LambdaClient::GetPolicy(const GetPolicyRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/versions/HEAD/policy";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_GET);
  if(outcome.IsSuccess())
  {
    return GetPolicyOutcome(GetPolicyResult(outcome.GetResult()));
  }
  else
  {
    return GetPolicyOutcome(outcome.GetError());
  }
}

GetPolicyOutcomeCallable LambdaClient::GetPolicyCallable(const GetPolicyRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::GetPolicy, this, request);
}

void LambdaClient::GetPolicyAsync(const GetPolicyRequest& request, const GetPolicyResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::GetPolicyAsyncHelper, this, request, handler, context);
}

void LambdaClient::GetPolicyAsyncHelper(const GetPolicyRequest& request, const GetPolicyResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, GetPolicy(request), context);
}

InvokeOutcome LambdaClient::Invoke(const InvokeRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/invocations";

  StreamOutcome outcome = MakeRequestWithUnparsedResponse(ss.str(), request, HttpMethod::HTTP_POST);
  if(outcome.IsSuccess())
  {
    return InvokeOutcome(InvokeResult(outcome.GetResultWithOwnership()));
  }
  else
  {
    return InvokeOutcome(outcome.GetError());
  }
}

InvokeOutcomeCallable LambdaClient::InvokeCallable(const InvokeRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::Invoke, this, request);
}

void LambdaClient::InvokeAsync(const InvokeRequest& request, const InvokeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::InvokeAsyncHelper, this, request, handler, context);
}

void LambdaClient::InvokeAsyncHelper(const InvokeRequest& request, const InvokeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, Invoke(request), context);
}

ListEventSourceMappingsOutcome LambdaClient::ListEventSourceMappings(const ListEventSourceMappingsRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/event-source-mappings/";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_GET);
  if(outcome.IsSuccess())
  {
    return ListEventSourceMappingsOutcome(ListEventSourceMappingsResult(outcome.GetResult()));
  }
  else
  {
    return ListEventSourceMappingsOutcome(outcome.GetError());
  }
}

ListEventSourceMappingsOutcomeCallable LambdaClient::ListEventSourceMappingsCallable(const ListEventSourceMappingsRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::ListEventSourceMappings, this, request);
}

void LambdaClient::ListEventSourceMappingsAsync(const ListEventSourceMappingsRequest& request, const ListEventSourceMappingsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::ListEventSourceMappingsAsyncHelper, this, request, handler, context);
}

void LambdaClient::ListEventSourceMappingsAsyncHelper(const ListEventSourceMappingsRequest& request, const ListEventSourceMappingsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, ListEventSourceMappings(request), context);
}

ListFunctionsOutcome LambdaClient::ListFunctions(const ListFunctionsRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_GET);
  if(outcome.IsSuccess())
  {
    return ListFunctionsOutcome(ListFunctionsResult(outcome.GetResult()));
  }
  else
  {
    return ListFunctionsOutcome(outcome.GetError());
  }
}

ListFunctionsOutcomeCallable LambdaClient::ListFunctionsCallable(const ListFunctionsRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::ListFunctions, this, request);
}

void LambdaClient::ListFunctionsAsync(const ListFunctionsRequest& request, const ListFunctionsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::ListFunctionsAsyncHelper, this, request, handler, context);
}

void LambdaClient::ListFunctionsAsyncHelper(const ListFunctionsRequest& request, const ListFunctionsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, ListFunctions(request), context);
}

RemovePermissionOutcome LambdaClient::RemovePermission(const RemovePermissionRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/versions/HEAD/policy/";
  ss << request.GetStatementId();

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_DELETE);
  if(outcome.IsSuccess())
  {
    return RemovePermissionOutcome(NoResult());
  }
  else
  {
    return RemovePermissionOutcome(outcome.GetError());
  }
}

RemovePermissionOutcomeCallable LambdaClient::RemovePermissionCallable(const RemovePermissionRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::RemovePermission, this, request);
}

void LambdaClient::RemovePermissionAsync(const RemovePermissionRequest& request, const RemovePermissionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::RemovePermissionAsyncHelper, this, request, handler, context);
}

void LambdaClient::RemovePermissionAsyncHelper(const RemovePermissionRequest& request, const RemovePermissionResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, RemovePermission(request), context);
}

UpdateEventSourceMappingOutcome LambdaClient::UpdateEventSourceMapping(const UpdateEventSourceMappingRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/event-source-mappings/";
  ss << request.GetUUID();

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_PUT);
  if(outcome.IsSuccess())
  {
    return UpdateEventSourceMappingOutcome(UpdateEventSourceMappingResult(outcome.GetResult()));
  }
  else
  {
    return UpdateEventSourceMappingOutcome(outcome.GetError());
  }
}

UpdateEventSourceMappingOutcomeCallable LambdaClient::UpdateEventSourceMappingCallable(const UpdateEventSourceMappingRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::UpdateEventSourceMapping, this, request);
}

void LambdaClient::UpdateEventSourceMappingAsync(const UpdateEventSourceMappingRequest& request, const UpdateEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::UpdateEventSourceMappingAsyncHelper, this, request, handler, context);
}

void LambdaClient::UpdateEventSourceMappingAsyncHelper(const UpdateEventSourceMappingRequest& request, const UpdateEventSourceMappingResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, UpdateEventSourceMapping(request), context);
}

UpdateFunctionCodeOutcome LambdaClient::UpdateFunctionCode(const UpdateFunctionCodeRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/versions/HEAD/code";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_PUT);
  if(outcome.IsSuccess())
  {
    return UpdateFunctionCodeOutcome(UpdateFunctionCodeResult(outcome.GetResult()));
  }
  else
  {
    return UpdateFunctionCodeOutcome(outcome.GetError());
  }
}

UpdateFunctionCodeOutcomeCallable LambdaClient::UpdateFunctionCodeCallable(const UpdateFunctionCodeRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::UpdateFunctionCode, this, request);
}

void LambdaClient::UpdateFunctionCodeAsync(const UpdateFunctionCodeRequest& request, const UpdateFunctionCodeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::UpdateFunctionCodeAsyncHelper, this, request, handler, context);
}

void LambdaClient::UpdateFunctionCodeAsyncHelper(const UpdateFunctionCodeRequest& request, const UpdateFunctionCodeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, UpdateFunctionCode(request), context);
}

UpdateFunctionConfigurationOutcome LambdaClient::UpdateFunctionConfiguration(const UpdateFunctionConfigurationRequest& request) const
{
  Aws::StringStream ss;
  ss << m_uri << "/2015-03-31/functions/";
  ss << request.GetFunctionName();
  ss << "/versions/HEAD/configuration";

  JsonOutcome outcome = MakeRequest(ss.str(), request, HttpMethod::HTTP_PUT);
  if(outcome.IsSuccess())
  {
    return UpdateFunctionConfigurationOutcome(UpdateFunctionConfigurationResult(outcome.GetResult()));
  }
  else
  {
    return UpdateFunctionConfigurationOutcome(outcome.GetError());
  }
}

UpdateFunctionConfigurationOutcomeCallable LambdaClient::UpdateFunctionConfigurationCallable(const UpdateFunctionConfigurationRequest& request) const
{
  return std::async(std::launch::async, &LambdaClient::UpdateFunctionConfiguration, this, request);
}

void LambdaClient::UpdateFunctionConfigurationAsync(const UpdateFunctionConfigurationRequest& request, const UpdateFunctionConfigurationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  m_executor->Submit(&LambdaClient::UpdateFunctionConfigurationAsyncHelper, this, request, handler, context);
}

void LambdaClient::UpdateFunctionConfigurationAsyncHelper(const UpdateFunctionConfigurationRequest& request, const UpdateFunctionConfigurationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
  handler(this, request, UpdateFunctionConfiguration(request), context);
}


text:
using System.Runtime.InteropServices;

namespace System.Drawing.Imaging
{
    // sdkinc\imaging.h
    public sealed class ImageCodecInfo
    {
        private Guid _clsid;
        private Guid _formatID;
        private string _codecName;
        private string _dllName;
        private string _formatDescription;
        private string _filenameExtension;
        private string _mimeType;
        private ImageCodecFlags _flags;
        private int _version;
        private byte[][] _signaturePatterns;
        private byte[][] _signatureMasks;

        internal ImageCodecInfo()
        {
        }

        public Guid Clsid
        {
            get { return _clsid; }
            set { _clsid = value; }
        }

        public Guid FormatID
        {
            get { return _formatID; }
            set { _formatID = value; }
        }

        public string CodecName
        {
            get { return _codecName; }
            set { _codecName = value; }
        }

        public string DllName
        {
            get
            {
                return _dllName;
            }
            set
            {
                _dllName = value;
            }
        }

        public string FormatDescription
        {
            get { return _formatDescription; }
            set { _formatDescription = value; }
        }

        public string FilenameExtension
        {
            get { return _filenameExtension; }
            set { _filenameExtension = value; }
        }

        public string MimeType
        {
            get { return _mimeType; }
            set { _mimeType = value; }
        }

        public ImageCodecFlags Flags
        {
            get { return _flags; }
            set { _flags = value; }
        }

        public int Version
        {
            get { return _version; }
            set { _version = value; }
        }

        [CLSCompliant(false)]
        public byte[][] SignaturePatterns
        {
            get { return _signaturePatterns; }
            set { _signaturePatterns = value; }
        }

        [CLSCompliant(false)]
        public byte[][] SignatureMasks
        {
            get { return _signatureMasks; }
            set { _signatureMasks = value; }
        }

        // Encoder/Decoder selection APIs

        public static ImageCodecInfo[] GetImageDecoders()
        {
            ImageCodecInfo[] imageCodecs;
            int numDecoders;
            int size;

            int status = SafeNativeMethods.Gdip.GdipGetImageDecodersSize(out numDecoders, out size);

            if (status != SafeNativeMethods.Gdip.Ok)
            {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            IntPtr memory = Marshal.AllocHGlobal(size);

            try
            {
                status = SafeNativeMethods.Gdip.GdipGetImageDecoders(numDecoders, size, memory);

                if (status != SafeNativeMethods.Gdip.Ok)
                {
                    throw SafeNativeMethods.Gdip.StatusException(status);
                }

                imageCodecs = ImageCodecInfo.ConvertFromMemory(memory, numDecoders);
            }
            finally
            {
                Marshal.FreeHGlobal(memory);
            }

            return imageCodecs;
        }

        public static ImageCodecInfo[] GetImageEncoders()
        {
            ImageCodecInfo[] imageCodecs;
            int numEncoders;
            int size;

            int status = SafeNativeMethods.Gdip.GdipGetImageEncodersSize(out numEncoders, out size);

            if (status != SafeNativeMethods.Gdip.Ok)
            {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            IntPtr memory = Marshal.AllocHGlobal(size);

            try
            {
                status = SafeNativeMethods.Gdip.GdipGetImageEncoders(numEncoders, size, memory);

                if (status != SafeNativeMethods.Gdip.Ok)
                {
                    throw SafeNativeMethods.Gdip.StatusException(status);
                }

                imageCodecs = ImageCodecInfo.ConvertFromMemory(memory, numEncoders);
            }
            finally
            {
                Marshal.FreeHGlobal(memory);
            }

            return imageCodecs;
        }

        private static ImageCodecInfo[] ConvertFromMemory(IntPtr memoryStart, int numCodecs)
        {
            ImageCodecInfo[] codecs = new ImageCodecInfo[numCodecs];

            int index;

            for (index = 0; index < numCodecs; index++)
            {
                IntPtr curcodec = (IntPtr)((long)memoryStart + (int)Marshal.SizeOf(typeof(ImageCodecInfoPrivate)) * index);
                ImageCodecInfoPrivate codecp = new ImageCodecInfoPrivate();
                UnsafeNativeMethods.PtrToStructure(curcodec, codecp);

                codecs[index] = new ImageCodecInfo();
                codecs[index].Clsid = codecp.Clsid;
                codecs[index].FormatID = codecp.FormatID;
                codecs[index].CodecName = Marshal.PtrToStringUni(codecp.CodecName);
                codecs[index].DllName = Marshal.PtrToStringUni(codecp.DllName);
                codecs[index].FormatDescription = Marshal.PtrToStringUni(codecp.FormatDescription);
                codecs[index].FilenameExtension = Marshal.PtrToStringUni(codecp.FilenameExtension);
                codecs[index].MimeType = Marshal.PtrToStringUni(codecp.MimeType);

                codecs[index].Flags = (ImageCodecFlags)codecp.Flags;
                codecs[index].Version = (int)codecp.Version;

                codecs[index].SignaturePatterns = new byte[codecp.SigCount][];
                codecs[index].SignatureMasks = new byte[codecp.SigCount][];

                for (int j = 0; j < codecp.SigCount; j++)
                {
                    codecs[index].SignaturePatterns[j] = new byte[codecp.SigSize];
                    codecs[index].SignatureMasks[j] = new byte[codecp.SigSize];

                    Marshal.Copy((IntPtr)((long)codecp.SigMask + j * codecp.SigSize), codecs[index].SignatureMasks[j], 0, codecp.SigSize);
                    Marshal.Copy((IntPtr)((long)codecp.SigPattern + j * codecp.SigSize), codecs[index].SignaturePatterns[j], 0, codecp.SigSize);
                }
            }

            return codecs;
        }
    }
}


text:
using System;
using Castle.DynamicProxy;
using Castle.MicroKernel;
using Codestellation.DarkFlow.Database;
using Codestellation.DarkFlow.Execution;
using Codestellation.DarkFlow.Matchers;
using Newtonsoft.Json;

namespace Codestellation.DarkFlow.CastleWindsor.Impl
{
    public class WindsorPersister : PersisterBase
    {
        public WindsorPersister(IDatabase database, IKernel kernel, IMatcher matcher) : base(database, matcher)
        {
            if (kernel == null)
            {
                throw new ArgumentNullException("kernel");
            }

            var converter = new WindsorConverter(kernel);
            Settings.Converters = new[] {converter};
        }

        private Type ExtractType(string serialized)
        {
            const string typebegin = "\"$type\": \"";
            var startIndex = serialized.IndexOf(typebegin, StringComparison.OrdinalIgnoreCase) + typebegin.Length;
            var endIndex = serialized.IndexOf("\",", startIndex, StringComparison.OrdinalIgnoreCase);

            var typename = serialized.Substring(startIndex, endIndex - startIndex);

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug("Extraced type '{0}'", typename);
            }

            var type = Type.GetType(typename);
            return type;
        }

        protected override string Serialize(ITask task)
        {
            var unproxiedTask = ProxyUtil.GetUnproxiedInstance(task);

            var serialized = JsonConvert.SerializeObject(unproxiedTask, Settings);

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug("Task {0} serialized to {1}", task, serialized);
            }

            return serialized;
        }

        protected override ITask Deserialize(string serialized)
        {
            var type = ExtractType(serialized);
            var result = (ITask) JsonConvert.DeserializeObject(serialized, type, Settings);

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug("Task {0} deserialized from {1}", result, serialized);
            }

            return result;
        }
    }
}


text:
module.exports = function(grunt) {

  grunt.initConfig({

    // Project configuration
    pkg: grunt.file.readJSON('package.json'),

    // Compile Sass
    sass: {
      options: {
        sourceMap: true,
        sourceComments: false
      },
      dist: {
        files: {
          'css/bedrock.css': 'sass/bedrock.scss'
        }
      }
    },

    // Minify compiled CSS
    cssmin: {
      options: {
        shorthandCompacting: false,
        roundingPrecision: -1
      },
      target: {
        files: {
          'css/bedrock.min.css': ['css/bedrock.css']
        }
      }
    },

    // SCSS Lint
    scsslint: {
      options: {
        bundleExec: true,
        config: '.scss-lint.yml',
        reporterOutput: 'scss-lint-report.xml',
        colorizeOutput: true
      },
      src: ['sass/**/*.scss', '!sass/partials/_base.scss']
    },

    // Runs CSS reporting
    parker: {
      options: {
        metrics: [
          'TotalStylesheets',
          'TotalStylesheetSize',
          'TotalRules',
          'TotalSelectors',
          'TotalIdentifiers',
          'TotalDeclarations',
          'SelectorsPerRule',
          'IdentifiersPerSelector',
          'SpecificityPerSelector',
          'TopSelectorSpecificity',
          'TopSelectorSpecificitySelector',
          'TotalIdSelectors',
          'TotalUniqueColours',
          'TotalImportantKeywords',
          'TotalMediaQueries'
        ],
        file: "./stats.md",
        usePackage: true
      },
      src: [
        'css/*.css'
      ],
    },

    // Watch and build
    watch: {
      sass: {
        files: 'sass/**/*.scss',
        tasks: ['sass', 'cssmin', 'parker']
      }
    }

  });

  // Load dependencies
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-scss-lint');
  grunt.loadNpmTasks('grunt-parker');
  grunt.loadNpmTasks('grunt-sass');

  // Run tasks
  grunt.registerTask('default', ['sass', 'cssmin', 'scsslint', 'parker']);

};


text:
WHYIS_IMAGE="${1:-tetherlessworld/whyis:latest}"

mkdir -p test-results/py

# docker run -e "CI=$CI" $WHYIS_IMAGE bash -c "python3 manage.py test"
# docker run -e "CI=$CI" $WHYIS_IMAGE bash -c "python3 manage.py test --ci && cat test-results/py/results.xml"

echo "`date` Running Python tests in $WHYIS_IMAGE"
docker run -e "CI=$CI" $WHYIS_IMAGE bash -c "mkdir -p test-results/py && python3 manage.py test --ci >test-results/py/test.out 2>test-results/py/test.err; tar cf test-results-py.tar test-results/py && cat test-results-py.tar" >test-results-py.tar
tar xf test-results-py.tar
echo "`date` Python test stdout:"
cat test-results/py/test.out
echo "`date` Python test stderr:"
cat test-results/py/test.err
if [ ! -f "test-results/py/results.xml" ]; then
    echo "Python test results.xml does not exist, exiting abnormally"
    exit 1
fi
if [ "$(grep -c 'failure ' test-results/py/results.xml)" -ge 1 ]; then
    echo "Python test results.xml has failures, exiting abnormally"
    exit 1
fi

echo "`date` Exiting normally"
exit 0


text:
package com.greatsec.demo.common.utils;

import com.greatsec.demo.common.mapper.JsonMapper;
import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

public class CommonUtil {
	// header 常量定义//
	private static final String ENCODING_PREFIX = "encoding";
	private static final String NOCACHE_PREFIX = "no-cache";
	private static final String ENCODING_DEFAULT = "UTF-8"; //
	private static final boolean NOCACHE_DEFAULT = true;

	// content-type 定义 //
	private static final String TEXT = "text/plain";
	private static final String JSON = "application/json";
	private static final String XML = "text/xml";
	private static final String HTML = "text/html";

	// 绕过jsp/freemaker直接输出文本的函数 //

	/**
	 * 直接输出内容的简便函数.kkkkkkk
	 *
	 * eg. render("text/plain", "hello", "encoding:GBK"); render("text/plain",
	 * "hello", "no-cache:false"); render("text/plain", "hello", "encoding:GBK",
	 * "no-cache:false");
	 *
	 * @param headers
	 *            可变的header数组,目前接受的值为"encoding:"或"no-cache:",默认值分别为UTF-8和true.
	 */
	public static void render(final HttpServletResponse response, final String contentType, final String content,
			final String... headers) {
		try {
			// 分析headers参数
			String encoding = ENCODING_DEFAULT;
			boolean noCache = NOCACHE_DEFAULT;
			for (String header : headers) {
				String headerName = StringUtils.substringBefore(header, ":");
				String headerValue = StringUtils.substringAfter(header, ":");

				if (StringUtils.equalsIgnoreCase(headerName, ENCODING_PREFIX)) {
					encoding = headerValue;
				} else if (StringUtils.equalsIgnoreCase(headerName, NOCACHE_PREFIX)) {
					noCache = Boolean.parseBoolean(headerValue);
				} else
					throw new IllegalArgumentException(headerName + "不是一个合法的header类型");
			}

			// 设置headers参数
			String fullContentType = contentType + ";charset=" + encoding;

			response.setContentType(fullContentType);
			if (noCache) {
				response.setHeader("Pragma", "No-cache");
				response.setHeader("Cache-Control", "no-cache");
				response.setDateHeader("Expires", 0);
			}

			PrintWriter writer = response.getWriter();
			writer.write(content);
			response.getWriter().flush();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 直接输出文本.
	 *
	 */
	public static void renderText(final HttpServletResponse response, final String text, final String... headers) {
		render(response, TEXT, text, headers);
	}

	/**
	 * 直接输出HTML.
	 *
	 */
	public static void renderHtml(final HttpServletResponse response, final String html, final String... headers) {
		render(response, HTML, html, headers);
	}

	/**
	 * 直接输出XML.
	 *
	 */
	public static void renderXml(final HttpServletResponse response, final String xml, final String... headers) {
		render(response, XML, xml, headers);
	}

	/**
	 * 直接输出JSON.
	 *
	 *            json字符串.
	 */
	public static void renderJson(final HttpServletResponse response, final String jsonString, final String... headers) {
		render(response, JSON, jsonString, headers);
	}

	/**
	 * 直接输出JSON.
	 *
	 * @param map
	 *            Map对象,将被转化为json字符串.
	 */
	public static void renderJson(final HttpServletResponse response, @SuppressWarnings("rawtypes") final Map map,
			final String... headers) {
		String jsonString = JsonMapper.getInstance().toJson(map);
		render(response, JSON, jsonString, headers);
	}

	/**
	 * 直接输出JSON.
	 *
	 * @param object
	 *            Java对象,将被转化为json字符串.
	 */
	public static void renderJson(final HttpServletResponse response, final Object object, final String... headers) {
        String jsonString = JsonMapper.getInstance().toJson(object);
		render(response, JSON, jsonString, headers);
	}

	/**
	 * 直接输出JSON.
	 *
	 * @param response
	 * @param list
	 * @param headers
	 */
	public static void renderJson(final HttpServletResponse response, final List<?> list, final String... headers) {
        String jsonString = JsonMapper.getInstance().toJson(list);
        render(response, JSON, jsonString, headers);
	}

	/**
	 * 直接输出JSON.含有java.sql.date数据类型
	 *
	 * @param response
	 * @param object
	 * @param headers
	 */
	public static void renderJsonForSqlDate(final HttpServletResponse response, final Object object,
			final String... headers) {
		//JsDateJsonBeanProcessor beanProcessor = new JsDateJsonBeanProcessor();
		//JsonConfig config = new JsonConfig();
		//config.registerJsonBeanProcessor(java.sql.Date.class, beanProcessor);
		//JSONObject json = JSONObject.fromObject(object, config);
		//render(response, JSON, json.toString(), headers);
	}

	public static void main(String args[]) {

	}

	/**
	 * 直接输出内容与转发
	 *
	 * @param rep
	 * @param message
	 * @param headers
	 */
	public static void renderScript(final HttpServletResponse rep, final String message, final String... headers) {
		PrintWriter printer = null;
		try {
			rep.setContentType("text/html;charset=UTF-8");
			printer = rep.getWriter();
			printer.write("<script language = 'javascript'>");
			printer.write("alert('" + message + "'),");
			printer.write("window.history.go(-1)");
			printer.write("</script>");
		} catch (IOException e) {
			System.err.println(e.getLocalizedMessage());
		} finally {
			if (printer != null) {
				printer.close();
			}
		}
	}

	/**
	 * json To List<?>
	 *
	 * @param jsonStr
	 * @param objClass
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public static List<?> toList(final String jsonStr, Class<?> objClass) {
        //JsonMapper.getInstance().fromJson(jsonStr,objClass);
		//JSONArray jsArray = JSONArray.fromObject(jsonStr);
		//List<?> list = JSONArray.toList(jsArray, objClass);
		//return list;
        return null;
	}

	/**
	 * json to object
	 *
	 * @param jsonStr
	 * @param objClass
	 * @return
	 */
	public static Object toObject(final String jsonStr, Class<?> objClass) {
		//JSONObject jsObject = JSONObject.fromObject(jsonStr);
		//return JSONObject.toBean(jsObject, objClass);
        return JsonMapper.getInstance().fromJson(jsonStr,objClass);
	}
}


text:
/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"

/** @addtogroup STM32H7xx_HAL_Driver
  * @{
  */

/** @defgroup RAMECC RAMECC
  * @brief RAMECC HAL module driver
  * @{
  */

#ifdef HAL_RAMECC_MODULE_ENABLED

/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/* Exported functions ---------------------------------------------------------*/
/** @addtogroup RAMECC_Exported_Functions
  * @{
  */

/** @addtogroup RAMECC_Exported_Functions_Group1
  *
@verbatim
 ===============================================================================
             ##### Initialization and de-initialization functions  #####
 ===============================================================================
    [..]
    This section provides functions allowing to initialize the RAMECC Monitor.
    [..]
    The HAL_RAMECC_Init() function follows the RAMECC configuration procedures
    as described in reference manual.
    The HAL_RAMECC_DeInit() function allows to deinitialize the RAMECC monitor.

@endverbatim
  * @{
  */

/**
  * @brief  Initialize the RAMECC by clearing flags and disabling interrupts.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_Init(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  /* Change RAMECC peripheral state */
  hramecc->State = HAL_RAMECC_STATE_BUSY;

  /* Disable RAMECC monitor */
  hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;

  /* Disable all global interrupts */
  ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER &= \
    ~(RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE);

  /* Disable all interrupts monitor  */
  hramecc->Instance->CR &= ~(RAMECC_CR_ECCSEIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCDEBWIE);

  /* Clear RAMECC monitor flags */
  __HAL_RAMECC_CLEAR_FLAG(hramecc, RAMECC_FLAGS_ALL);

  /* Update the RAMECC state */
  hramecc->State = HAL_RAMECC_STATE_READY;

  /* Clean callback */
  hramecc->DetectErrorCallback = NULL;

  return HAL_OK;
}

/**
  * @brief  DeInitializes the RAMECC peripheral.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_DeInit(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  /* Disable RAMECC monitor */
  hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;

  /* Disable all global interrupts */
  ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER &= \
    ~(RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE);

  /* Disable all interrupts monitor  */
  hramecc->Instance->CR &= ~(RAMECC_CR_ECCSEIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCDEBWIE);

  /* Clear RAMECC monitor flags */
  __HAL_RAMECC_CLEAR_FLAG(hramecc, RAMECC_FLAGS_ALL);

  /* Change RAMECC peripheral state */
  hramecc->State = HAL_RAMECC_STATE_RESET;

  /* Clean callback */
  hramecc->DetectErrorCallback = NULL;

  return HAL_OK;
}

/**
  * @}
  */

/** @addtogroup RAMECC_Exported_Functions_Group2
  *
@verbatim
 ===============================================================================
                   #####  Monitoring operation functions  #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Configure latching error informations.
      (+) Configure RAMECC Global/Monitor interrupts.
      (+) Register and Unregister RAMECC callbacks
      (+) Handle RAMECC interrupt request

@endverbatim
  * @{
  */

/**
  * @brief  Starts the RAMECC latching error informations.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_StartMonitor(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  if(hramecc->State == HAL_RAMECC_STATE_READY)
  {
    /* Change RAMECC peripheral state */
    hramecc->State = HAL_RAMECC_STATE_BUSY;

    /* Enable RAMECC monitor */
    hramecc->Instance->CR |= RAMECC_CR_ECCELEN;
  }
  else
  {
    /* Change the RAMECC state */
    hramecc->State = HAL_RAMECC_STATE_ERROR;

    return HAL_ERROR;
  }

  return HAL_OK;
}

/**
  * @brief  Stop the RAMECC latching error informations.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_StopMonitor(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  if(hramecc->State == HAL_RAMECC_STATE_BUSY)
  {
    /* Disable RAMECC monitor */
    hramecc->Instance->CR &= ~RAMECC_CR_ECCELEN;
  }
  else
  {
    /* Change the RAMECC state */
    hramecc->State = HAL_RAMECC_STATE_ERROR;

    return HAL_ERROR;
  }

  /* Change RAMECC peripheral state */
  hramecc->State = HAL_RAMECC_STATE_READY;

  return HAL_OK;
}

/**
  * @brief  Enable the RAMECC error interrupts.
  * @param  hramecc       Pointer to a RAMECC_HandleTypeDef structure that contains
  *                       the configuration information for the specified RAMECC
  *                       Monitor.
  * @param  Notifications  Select the notification.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_EnableNotification(RAMECC_HandleTypeDef *hramecc, uint32_t Notifications)
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Get RAMECC monitor state */
  HAL_RAMECC_StateTypeDef state = hramecc->State;

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));
  assert_param(IS_RAMECC_INTERRUPT(Notifications));

  if((state == HAL_RAMECC_STATE_READY) || (state == HAL_RAMECC_STATE_BUSY))
  {
    /* Enable RAMECC interrupts */
    __HAL_RAMECC_ENABLE_IT(hramecc, Notifications);
  }
  else
  {
    /* Change the RAMECC state */
    hramecc->State = HAL_RAMECC_STATE_ERROR;

    return HAL_ERROR;
  }

  return HAL_OK;
}

/**
  * @brief  Disable the RAMECC error interrupts.
  * @param  hramecc       Pointer to a RAMECC_HandleTypeDef structure that contains
  *                       the configuration information for the specified RAMECC
  *                       Monitor.
  * @param  Notifications  Select the notification.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_DisableNotification(RAMECC_HandleTypeDef *hramecc, uint32_t Notifications)
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Get RAMECC monitor state */
  HAL_RAMECC_StateTypeDef state = hramecc->State;

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));
  assert_param(IS_RAMECC_INTERRUPT(Notifications));

  if((state == HAL_RAMECC_STATE_READY) || (state == HAL_RAMECC_STATE_BUSY))
  {
    /* Disable RAMECC interrupts */
    __HAL_RAMECC_DISABLE_IT(hramecc, Notifications);
  }
  else
  {
    /* Change the RAMECC state */
    hramecc->State = HAL_RAMECC_STATE_ERROR;

    return HAL_ERROR;
  }

  return HAL_OK;
}

/**
  * @brief  Register callbacks.
  * @param  hramecc    Pointer to a RAMECC_HandleTypeDef structure that contains
  *                    the configuration information for the specified RAMECC
  *                    Monitor.
  * @param  pCallback  pointer to private callbacsk function which has pointer to
  *                    a RAMECC_HandleTypeDef structure as parameter.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_RegisterCallback(RAMECC_HandleTypeDef *hramecc, void (* pCallback)(RAMECC_HandleTypeDef *_hramecc))
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  if(hramecc->State == HAL_RAMECC_STATE_READY)
  {
    hramecc->DetectErrorCallback = pCallback;
  }
  else
  {
    /* Change the RAMECC state */
    hramecc->State = HAL_RAMECC_STATE_ERROR;

    return HAL_ERROR;
  }

  return HAL_OK;
}

/**
  * @brief  UnRegister callbacks.
  * @param  hramecc    Pointer to a RAMECC_HandleTypeDef structure that contains
  *                    the configuration information for the specified RAMECC
  *                    Monitor.
  * @retval HAL status.
  */
HAL_StatusTypeDef HAL_RAMECC_UnRegisterCallback(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the RAMECC peripheral handle */
  if(hramecc == NULL)
  {
    return HAL_ERROR;
  }

  /* Get RAMECC monitor state */
  HAL_RAMECC_StateTypeDef state = hramecc->State;

  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  if((state == HAL_RAMECC_STATE_READY) || (state == HAL_RAMECC_STATE_BUSY))
  {
    hramecc->DetectErrorCallback = NULL;
  }
  else
  {
    /* Change the RAMECC state */
    hramecc->State = HAL_RAMECC_STATE_ERROR;

    return HAL_ERROR;
  }

  return HAL_OK;
}

/**
  * @brief  Handles RAMECC interrupt request.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval None.
  */
void HAL_RAMECC_IRQHandler(RAMECC_HandleTypeDef *hramecc)
{
  uint32_t ier_reg = ((RAMECC_TypeDef *)((uint32_t)hramecc->Instance & 0xFFFFFF00U))->IER;
  uint32_t cr_reg = hramecc->Instance->CR >> 1U;
  uint32_t sr_reg = hramecc->Instance->SR << 1U;

  /* Update gloabl interrupt variables */
  if((ier_reg & RAMECC_IER_GIE) == RAMECC_IER_GIE)
  {
    ier_reg = RAMECC_IT_GLOBAL_ALL;
  }

  /* Clear active flags */
  __HAL_RAMECC_CLEAR_FLAG(hramecc, (((ier_reg | cr_reg) & sr_reg) >> 1U));

  if(hramecc->DetectErrorCallback != NULL)
  {
    /* Error detection callback */
    hramecc->DetectErrorCallback(hramecc);
  }
}

/** @addtogroup RAMECC_Exported_Functions_Group3
  *
@verbatim
 ===============================================================================
                   #####  Error informations functions  #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Get failing address.
      (+) Get failing data low.
      (+) Get failing data high.
      (+) Get Hamming bits injected.

@endverbatim
  * @{
  */

/**
  * @brief  Return the RAMECC failing address.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval Failing address offset.
  */
uint32_t HAL_RAMECC_GetFailingAddress(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  return hramecc->Instance->FAR;
}

/**
  * @brief  Return the RAMECC data low.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval Failing data low.
  */
uint32_t HAL_RAMECC_GetFailingDataLow(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  return hramecc->Instance->FDRL;
}

/**
  * @brief  Return the RAMECC data high.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval Failing data high.
  */
uint32_t HAL_RAMECC_GetFailingDataHigh(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  return hramecc->Instance->FDRH;
}

/**
  * @brief  Return the RAMECC Hamming bits injected.
  * @param  hramecc  Pointer to a RAMECC_HandleTypeDef structure that contains
  *                  the configuration information for the specified RAMECC
  *                  Monitor.
  * @retval Hamming bits injected.
  */
uint32_t HAL_RAMECC_GetHammingErrorCode(RAMECC_HandleTypeDef *hramecc)
{
  /* Check the parameters */
  assert_param(IS_RAMECC_MONITOR_ALL_INSTANCE(hramecc->Instance));

  return hramecc->Instance->FECR;
}

/**
  * @}
  */

#endif /* HAL_RAMECC_MODULE_ENABLED */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
package net.md_5.bungee.protocol.packet.protocolhack;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.protocol.packet.AbstractPacketHandler;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
@EqualsAndHashCode(callSuper = false)
public class PacketKick extends Defined172Packet
{
    private String reason;

    public PacketKick(String reason)
    {
        super( 0x00 );
        this.reason = reason;
    }

    @Override
    public void read(ByteBuf buf)
    {
    }

    @Override
    public void write(ByteBuf buf)
    {
        writeString( "{text:\"" + reason + "\"}", buf, true );
    }

    @Override
    public void handle(AbstractPacketHandler handler) throws Exception
    {
    }
}


text:
module ShowHelper
  def filter!(collection)
    if params.has_key?(:date)
      collection.where(date: date)
    end
  end
end


text:
package kr.djsch.dsmhs.beinone.materialcalendar;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

import java.util.Date;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        CalendarView calendarView = (CalendarView) findViewById(R.id.calendarview);
        calendarView.setOnSelectedDayChangedListener(new CalendarView.OnSelectedDayChangedListener() {
            @Override
            public void onSelectedDayChanged(Date date) {
                Toast.makeText(MainActivity.this, date.toString(), Toast.LENGTH_SHORT).show();
            }
        });
    }

}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Eremostachys gypsacea Popov

### Remarks
null


text:
layout: post
title: "Free starbucks wi-fi keeps log..."
---
Free starbucks wi-fi keeps logging me out. Is annoying but free. Espresso is tasty.


text:
.btn-file {
  position: relative;
  overflow: hidden;
  vertical-align: middle;
}
.btn-file > input {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  font-size: 23px;
  cursor: pointer;
  filter: alpha(opacity=0);
  opacity: 0;

  direction: ltr;
}
.fileinput {
  display: inline-block;
  margin-bottom: 9px;
}
.fileinput .form-control {
  display: inline-block;
  padding-top: 7px;
  padding-bottom: 5px;
  margin-bottom: 0;
  vertical-align: middle;
  cursor: text;
}
.fileinput .thumbnail {
  display: inline-block;
  margin-bottom: 5px;
  overflow: hidden;
  text-align: center;
  vertical-align: middle;
}
.fileinput .thumbnail > img {
  max-height: 100%;
}
.fileinput .btn {
  vertical-align: middle;
}
.fileinput-exists .fileinput-new,
.fileinput-new .fileinput-exists {
  display: none;
}
.fileinput-inline .fileinput-controls {
  display: inline;
}
.fileinput-filename {
  display: inline-block;
  overflow: hidden;
  vertical-align: middle;
}
.form-control .fileinput-filename {
  vertical-align: bottom;
}
.fileinput.input-group {
  display: table;
}
.fileinput.input-group > * {
  position: relative;
  z-index: 2;
}
.fileinput.input-group > .btn-file {
  z-index: 1;
}
.fileinput-new.input-group .btn-file,
.fileinput-new .input-group .btn-file {
  border-radius: 0 4px 4px 0;
}
.fileinput-new.input-group .btn-file.btn-xs,
.fileinput-new .input-group .btn-file.btn-xs,
.fileinput-new.input-group .btn-file.btn-sm,
.fileinput-new .input-group .btn-file.btn-sm {
  border-radius: 0 3px 3px 0;
}
.fileinput-new.input-group .btn-file.btn-lg,
.fileinput-new .input-group .btn-file.btn-lg {
  border-radius: 0 6px 6px 0;
}
.form-group.has-warning .fileinput .fileinput-preview {
  color: #8a6d3b;
}
.form-group.has-warning .fileinput .thumbnail {
  border-color: #faebcc;
}
.form-group.has-error .fileinput .fileinput-preview {
  color: #a94442;
}
.form-group.has-error .fileinput .thumbnail {
  border-color: #ebccd1;
}
.form-group.has-success .fileinput .fileinput-preview {
  color: #3c763d;
}
.form-group.has-success .fileinput .thumbnail {
  border-color: #d6e9c6;
}


text:
#include "ShaderManager.h"
#include <cassert>
#include <fstream>
#include <vector>
#include <D3DX11.h>

using namespace std;

ShaderManager *ShaderManager::INSTANCE = nullptr;
const std::string ShaderManager::SHADER_FOLDER = "./shaders/";

/**
 Compiles and adds a new Shader from file.
 The included vertex shader should have the name VxShader,
 the included pixel shader should have the name PxShader.
**/
ShaderManager::Item ShaderManager::add(const std::string& name, const D3D11_INPUT_ELEMENT_DESC inputElementDesc[], size_t numElements)
{
	std::string completeName = SHADER_FOLDER + name;

#ifdef _DEBUG
	auto iter = mShaders.find(completeName);
	if(iter != mShaders.cend())
		assert(iter->first != name && "Shader already added");
#endif

	ShaderManager::Item newShaderItem;

// If in debug mode, we compile the shaders all the time
#ifdef _DEBUG
	com_ptr<ID3D10Blob> vx, px, error;

	// Compile shader
	if(FAILED(D3DX11CompileFromFile(completeName.c_str(), NULL, 0, "VxShader", "vs_5_0", 0, 0, 0, &vx, &error, NULL)))
	{
		TCHAR* errMsg = static_cast<TCHAR*>(error->GetBufferPointer());
		throw std::runtime_error("Failed to compile vertex shader in file " + completeName + errMsg);
	}

	if(FAILED(D3DX11CompileFromFile(completeName.c_str(), NULL, 0, "PxShader", "ps_5_0", 0, 0, 0, &px, &error, NULL)))
	{
		TCHAR* errMsg = static_cast<TCHAR*>(error->GetBufferPointer());
		throw std::runtime_error("Failed to compile pixel shader in file " + completeName);
	}

	if(FAILED(mDev->CreateVertexShader(vx->GetBufferPointer(), vx->GetBufferSize(), NULL, &(newShaderItem.vertexShader))))
	{
		TCHAR* errMsg = static_cast<TCHAR*>(error->GetBufferPointer());
		throw std::runtime_error("Failed to create vertex shader in file " + completeName);
	}

	if(FAILED(mDev->CreatePixelShader(px->GetBufferPointer(), px->GetBufferSize(), NULL, &(newShaderItem.pixelShader))))
	{
		TCHAR* errMsg = static_cast<TCHAR*>(error->GetBufferPointer());
		throw std::runtime_error("Failed to create pixel shader in file " + completeName);
	}

	// Create input layout
	if(FAILED(mDev->CreateInputLayout(inputElementDesc, numElements, vx->GetBufferPointer(), vx->GetBufferSize(), &(newShaderItem.inputLayout))))
		throw std::runtime_error("Failed to create inputlayout at file " + completeName);
#else
	// Load already compiled shader. Their name is of the form "<shader_folder>/<name>(_ps|_vs).hlslx"
	const string baseName = completeName.substr(0, completeName.length() - 5); // cut off 5 signs ".hlsl"
	const string compiledVS = loadCompiledShader(baseName + ".vsh");
	const string compiledPS = loadCompiledShader(baseName + ".psh");

	// Create shader
	if(FAILED(mDev->CreateVertexShader(compiledVS.c_str(), compiledVS.length(), NULL, &(newShaderItem.vertexShader))))
		throw std::runtime_error("Failed to create vertex shader in file " + completeName);

	if(FAILED(mDev->CreatePixelShader(compiledPS.c_str(), compiledPS.length(), NULL, &(newShaderItem.pixelShader))))
		throw std::runtime_error("Failed to create pixel shader in file " + completeName);

	// Create input layout
	if(FAILED(mDev->CreateInputLayout(inputElementDesc, numElements, compiledVS.c_str(), compiledVS.length(), &(newShaderItem.inputLayout))))
		throw std::runtime_error("Failed to create inputlayout at file " + completeName);

#endif

	// TODO return the reference
	mShaders[name] = newShaderItem;
	return newShaderItem;
}

void ShaderManager::addDirectory(const std::string& dirname, const D3D11_INPUT_ELEMENT_DESC inputElementDesc[], size_t numElements)
{
	assert(false && "Not implemented");
}

/**
Removes the item with the associated texture. Will remove only one item.
To remove all items, call this method until it returns false.
**/
bool ShaderManager::remove(const com_ptr<ID3D11PixelShader>& pixelShader)
{
	for(auto it = mShaders.cbegin(); it != mShaders.cend(); ++it)
	{
		if(it->second.pixelShader == pixelShader)
		{
			mShaders.erase(it);
			return true;
		}
	}

	return false;
}

/**
Removes the item with the associated texture. Will remove only one item.
To remove all items, call this method until it returns false.
**/
bool ShaderManager::remove(const com_ptr<ID3D11VertexShader>& vertexShader)
{
	for(auto it = mShaders.cbegin(); it != mShaders.cend(); ++it)
	{
		if(it->second.vertexShader == vertexShader)
		{
			mShaders.erase(it);
			return true;
		}
	}

	return false;
}

bool ShaderManager::remove(const std::string& name)
{
	return mShaders.erase(name) == 1;
}

const com_ptr<ID3D11VertexShader>& ShaderManager::getVertexShader(const std::string& name) const
{
	return getShader(name).vertexShader;
}

const com_ptr<ID3D11PixelShader>& ShaderManager::getPixelShader(const std::string& name) const
{
	return getShader(name).pixelShader;
}

const ShaderManager::Item& ShaderManager::getShader(const std::string& name) const
{
	auto iter = mShaders.find(name);
	if(iter != mShaders.cend())
	{
		return iter->second;
	}
	else
	{
		throw std::invalid_argument("No item with key " + name + " found.");
	}
}

const std::string ShaderManager::loadCompiledShader(const std::string& name)
{
	ifstream in(name, ios::in | ios::binary);

	in.seekg(0, ios::end);
	size_t length = static_cast<size_t>(in.tellg());
	in.seekg(0, ios::beg);

	std::string strBuffer;
	strBuffer.resize(length);

	in.read(&strBuffer[0], length);

	return strBuffer;
}


text:
=pod

=head1 NAME

X509_STORE_CTX_get_error, X509_STORE_CTX_set_error,
X509_STORE_CTX_get_error_depth, X509_STORE_CTX_set_error_depth,
X509_STORE_CTX_get_current_cert, X509_STORE_CTX_set_current_cert,
X509_STORE_CTX_get0_cert, X509_STORE_CTX_get1_chain,
X509_verify_cert_error_string - get or set certificate verification status
information

=head1 SYNOPSIS

 #include <openssl/x509.h>

 int   X509_STORE_CTX_get_error(const X509_STORE_CTX *ctx);
 void  X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s);
 int   X509_STORE_CTX_get_error_depth(const X509_STORE_CTX *ctx);
 void  X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth);
 X509 *X509_STORE_CTX_get_current_cert(const X509_STORE_CTX *ctx);
 void  X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x);
 X509 *X509_STORE_CTX_get0_cert(const X509_STORE_CTX *ctx);

 STACK_OF(X509) *X509_STORE_CTX_get1_chain(const X509_STORE_CTX *ctx);

 const char *X509_verify_cert_error_string(long n);

=head1 DESCRIPTION

These functions are typically called after certificate or chain verification
using L<X509_verify_cert(3)> or L<X509_STORE_CTX_verify(3)> has indicated
an error or in a verification callback to determine the nature of an error.

X509_STORE_CTX_get_error() returns the error code of I<ctx>.
See the L</ERROR CODES> section for a full description of all error codes.
It may return a code != X509_V_OK even if X509_verify_cert() did not indicate
an error, likely because a verification callback function has waived the error.

X509_STORE_CTX_set_error() sets the error code of I<ctx> to I<s>. For example
it might be used in a verification callback to set an error based on additional
checks.

X509_STORE_CTX_get_error_depth() returns the I<depth> of the error. This is a
nonnegative integer representing where in the certificate chain the error
occurred. If it is zero it occurred in the end entity certificate, one if
it is the certificate which signed the end entity certificate and so on.

X509_STORE_CTX_set_error_depth() sets the error I<depth>.
This can be used in combination with X509_STORE_CTX_set_error() to set the
depth at which an error condition was detected.

X509_STORE_CTX_get_current_cert() returns the certificate in I<ctx> which
caused the error or NULL if no certificate is relevant.

X509_STORE_CTX_set_current_cert() sets the certificate I<x> in I<ctx> which
caused the error.
This value is not intended to remain valid for very long, and remains owned by
the caller.
It may be examined by a verification callback invoked to handle each error
encountered during chain verification and is no longer required after such a
callback.
If a callback wishes the save the certificate for use after it returns, it
needs to increment its reference count via L<X509_up_ref(3)>.
Once such a I<saved> certificate is no longer needed it can be freed with
L<X509_free(3)>.

X509_STORE_CTX_get0_cert() retrieves an internal pointer to the
certificate being verified by the I<ctx>.

X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous
verification is successful. Otherwise the returned chain may be incomplete or
invalid.  The returned chain persists after the I<ctx> structure is freed.
When it is no longer needed it should be free up using:

 OSSL_STACK_OF_X509_free(chain);

X509_verify_cert_error_string() returns a human readable error string for
verification error I<n>.

=head1 RETURN VALUES

X509_STORE_CTX_get_error() returns B<X509_V_OK> or an error code.

X509_STORE_CTX_get_error_depth() returns a nonnegative error depth.

X509_STORE_CTX_get_current_cert() returns the certificate which caused the
error or NULL if no certificate is relevant to the error.

X509_verify_cert_error_string() returns a human readable error string for
verification error I<n>.

=head1 ERROR CODES

A list of error codes and messages is shown below.  Some of the
error codes are defined but currently never returned: these are described as
"unused".

=over 4

=item B<X509_V_OK: ok>

The operation was successful.

=item B<X509_V_ERR_UNSPECIFIED: unspecified certificate verification error>

Unspecified error; should not happen.

=item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate>

The issuer certificate of a locally looked up certificate could not be found.
This normally means the list of trusted certificates is not complete.
To allow any certificate (not only a self-signed one) in the trust store
to terminate the chain the B<X509_V_FLAG_PARTIAL_CHAIN> flag may be set.

=item B<X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL>

The CRL of a certificate could not be found.

=item B<X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE:
unable to decrypt certificate's signature>

The certificate signature could not be decrypted. This means that the actual
signature value could not be determined rather than it not matching the
expected value, this is only meaningful for RSA keys.

=item B<X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE:
unable to decrypt CRL's signature>

The CRL signature could not be decrypted: this means that the actual signature
value could not be determined rather than it not matching the expected value.
Unused.

=item B<X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY:
unable to decode issuer public key>

The public key in the certificate C<SubjectPublicKeyInfo> field could
not be read.

=item B<X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure>

The signature of the certificate is invalid.

=item B<X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure>

The signature of the CRL is invalid.

=item B<X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid>

The certificate is not yet valid: the C<notBefore> date is after the
current time.

=item B<X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired>

The certificate has expired: that is the C<notAfter> date is before the
current time.

=item B<X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid>

The CRL is not yet valid.

=item B<X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired>

The CRL has expired.

=item B<X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
format error in certificate's notBefore field>

The certificate C<notBefore> field contains an invalid time.

=item B<X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
format error in certificate's notAfter field>

The certificate C<notAfter> field contains an invalid time.

=item B<X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD:
format error in CRL's lastUpdate field>

The CRL B<lastUpdate> field contains an invalid time.

=item B<X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD:
format error in CRL's nextUpdate field>

The CRL C<nextUpdate> field contains an invalid time.

=item B<X509_V_ERR_OUT_OF_MEM: out of memory>

An error occurred trying to allocate memory.

=item B<X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self-signed certificate>

The passed certificate is self-signed and the same certificate cannot be found
in the list of trusted certificates.

=item B<X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
self-signed certificate in certificate chain>

The certificate chain could be built up using the untrusted certificates
but no suitable trust anchor (which typically is a self-signed root certificate)
could be found in the trust store.

=item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
unable to get local issuer certificate>

The issuer certificate could not be found: this occurs if the issuer certificate
of an untrusted certificate cannot be found.

=item B<X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
unable to verify the first certificate>

No signatures could be verified because the chain contains only one certificate
and it is not self-signed and the B<X509_V_FLAG_PARTIAL_CHAIN> flag is not set.

=item B<X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long>

The certificate chain length is greater than the supplied maximum depth.

=item B<X509_V_ERR_CERT_REVOKED: certificate revoked>

The certificate has been revoked.

=item B<X509_V_ERR_INVALID_CA: invalid CA certificate>

A CA certificate is invalid. Either it is not a CA or its extensions are not
consistent with the supplied purpose.

=item B<X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded>

The basicConstraints path-length parameter has been exceeded.

=item B<X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose>

The target certificate cannot be used for the specified purpose.

=item B<X509_V_ERR_CERT_UNTRUSTED: certificate not trusted>

The root CA is not marked as trusted for the specified purpose.

=item B<X509_V_ERR_CERT_REJECTED: certificate rejected>

The root CA is marked to reject the specified purpose.

=item B<X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch>

The current candidate issuer certificate was rejected because its subject name
did not match the issuer name of the current certificate.

=item B<X509_V_ERR_AKID_SKID_MISMATCH:
authority and subject key identifier mismatch>

The current candidate issuer certificate was rejected because its subject key
identifier was present and did not match the authority key identifier current
certificate.

=item B<X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH:
authority and issuer serial number mismatch>

The current candidate issuer certificate was rejected because its issuer name
and serial number was present and did not match the authority key identifier of
the current certificate.

=item B<X509_V_ERR_KEYUSAGE_NO_CERTSIGN:
key usage does not include certificate signing>

The current candidate issuer certificate was rejected because its C<keyUsage>
extension does not permit certificate signing.

=item B<X509_V_ERR_INVALID_EXTENSION:
invalid or inconsistent certificate extension>

A certificate extension had an invalid value (for example an incorrect
encoding) or some value inconsistent with other extensions.

=item B<X509_V_ERR_INVALID_POLICY_EXTENSION:
invalid or inconsistent certificate policy extension>

A certificate policies extension had an invalid value (for example an incorrect
encoding) or some value inconsistent with other extensions. This error only
occurs if policy processing is enabled.

=item B<X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy>

The verification flags were set to require and explicit policy but none was
present.

=item B<X509_V_ERR_DIFFERENT_CRL_SCOPE: different CRL scope>

The only CRLs that could be found did not match the scope of the certificate.

=item B<X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension feature>

Some feature of a certificate extension is not supported. Unused.

=item B<X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation>

A name constraint violation occurred in the permitted subtrees.

=item B<X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation>

A name constraint violation occurred in the excluded subtrees.

=item B<X509_V_ERR_SUBTREE_MINMAX:
name constraints minimum and maximum not supported>

A certificate name constraints extension included a minimum or maximum field:
this is not supported.

=item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE:
unsupported name constraint type>

An unsupported name constraint type was encountered. OpenSSL currently only
supports directory name, DNS name, email and URI types.

=item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX:
unsupported or invalid name constraint syntax>

The format of the name constraint is not recognised: for example an email
address format of a form not mentioned in RFC3280. This could be caused by
a garbage extension or some new feature not currently supported.

=item B<X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error>

An error occurred when attempting to verify the CRL path. This error can only
happen if extended CRL checking is enabled.

=item B<X509_V_ERR_APPLICATION_VERIFICATION: application verification failure>

An application specific error. This will never be returned unless explicitly
set by an application callback.

=item B<X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: unable to get CRL issuer certificate>

Unable to get CRL issuer certificate.

=item B<X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: unhandled critical extension>

Unhandled critical extension.

=item B<X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: key usage does not include CRL signing>

Key usage does not include CRL signing.

=item B<X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: unhandled critical CRL extension>

Unhandled critical CRL extension.

=item B<X509_V_ERR_INVALID_NON_CA: invalid non-CA certificate (has CA markings)>

Invalid non-CA certificate has CA markings.

=item B<X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED: proxy path length constraint exceeded>

Proxy path length constraint exceeded.

=item B<X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: key usage does not include digital signature>

Key usage does not include digital signature, and therefore cannot sign
certificates.

=item B<X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED: proxy certificates not allowed, please set the appropriate flag>

Proxy certificates not allowed unless the B<X509_V_FLAG_ALLOW_PROXY_CERTS> flag
is set.

=item B<X509_V_ERR_UNNESTED_RESOURCE: RFC 3779 resource not subset of parent's resources>

See RFC 3779 for details.

=item B<X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: unsupported or invalid name syntax>

Unsupported or invalid name syntax.

=item B<X509_V_ERR_PATH_LOOP: path loop>

Path loop.

=item B<X509_V_ERR_HOSTNAME_MISMATCH: hostname mismatch>

Hostname mismatch.

=item B<X509_V_ERR_EMAIL_MISMATCH: email address mismatch>

Email address mismatch.

=item B<X509_V_ERR_IP_ADDRESS_MISMATCH: IP address mismatch>

IP address mismatch.

=item B<X509_V_ERR_DANE_NO_MATCH: no matching DANE TLSA records>

DANE TLSA authentication is enabled, but no TLSA records matched the
certificate chain.
This error is only possible in L<openssl-s_client(1)>.

=item B<X509_V_ERR_EE_KEY_TOO_SMALL: EE certificate key too weak>

EE certificate key too weak.

=item B<X509_V_ERR_CA_KEY_TOO_SMALL: CA certificate key too weak>

CA certificate key too weak.

=item B<X509_V_ERR_CA_MD_TOO_WEAK: CA signature digest algorithm too weak>

CA signature digest algorithm too weak.

=item B<X509_V_ERR_INVALID_CALL: invalid certificate verification context>

Invalid certificate verification context.

=item B<X509_V_ERR_STORE_LOOKUP: issuer certificate lookup error>

Issuer certificate lookup error.

=item B<X509_V_ERR_NO_VALID_SCTS: certificate transparency required, but no valid SCTs found>

Certificate Transparency required, but no valid SCTs found.

=item B<X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION: proxy subject name violation>

Proxy subject name violation.

=item B<X509_V_ERR_OCSP_VERIFY_NEEDED: OCSP verification needed>

Returned by the verify callback to indicate an OCSP verification is needed.

=item B<X509_V_ERR_OCSP_VERIFY_FAILED: OCSP verification failed>

Returned by the verify callback to indicate OCSP verification failed.

=item B<X509_V_ERR_OCSP_CERT_UNKNOWN: OCSP unknown cert>

Returned by the verify callback to indicate that the certificate is not
recognized by the OCSP responder.

=item B<X509_V_ERR_NO_ISSUER_PUBLIC_KEY: issuer certificate doesn't have a public key>

The issuer certificate does not have a public key.

=item B<X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH: subject signature algorithm and issuer public key algorithm mismatch>

The issuer's public key is not of the type required by the signature in
the subject's certificate.

=back

=head1 NOTES

The above functions should be used instead of directly referencing the fields
in the B<X509_VERIFY_CTX> structure.

In versions of OpenSSL before 1.0 the current certificate returned by
X509_STORE_CTX_get_current_cert() was never NULL. Applications should
check the return value before printing out any debugging information relating
to the current certificate.

If an unrecognised error code is passed to X509_verify_cert_error_string() the
numerical value of the unknown code is returned in a static buffer. This is not
thread safe but will never happen unless an invalid code is passed.

=head1 BUGS

Previous versions of this documentation swapped the meaning of the
B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT> and
B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY> error codes.

=head1 SEE ALSO

L<X509_verify_cert(3)>, L<X509_STORE_CTX_verify(3)>,
L<X509_up_ref(3)>,
L<X509_free(3)>.

=head1 COPYRIGHT

Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License").  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.

=cut


text:
<?php
namespace Aws\Api\Serializer;

use Aws\Api\Shape;
use Aws\Api\ListShape;

/**
 * @internal
 */
class Ec2ParamBuilder extends QueryParamBuilder
{
    protected function queryName(Shape $shape, $default = null)
    {
        return ($shape['queryName']
            ?: ucfirst($shape['locationName']))
                ?: $default;
    }

    protected function isFlat(Shape $shape)
    {
        return false;
    }

    protected function format_list(
        ListShape $shape,
        array $value,
        $prefix,
        &$query
    ) {
        // Handle empty list serialization
        if (!$value) {
            $query[$prefix] = false;
        } else {
            $items = $shape->getMember();
            foreach ($value as $k => $v) {
                $this->format($items, $v, $prefix . '.' . ($k + 1), $query);
            }
        }
    }
}