text:
/*! service.util.js
 *************************************/
(function (angular) {
   "use strict";

   var appUtils = angular.module('myApp.utils', ['firebase', 'firebase.utils']);

   /**
    * A utility to store variables in local storage, with a fallback to cookies if localStorage isn't supported.
    */
   appUtils.factory('localStorage', ['$log', function($log) {
      //todo should handle booleans and integers more intelligently?
      var loc = {
         /**
          * @param {string} key
          * @param value  objects are converted to json strings, undefined is converted to null (removed)
          * @returns {localStorage}
          */
         set: function(key, value) {
//               $log.debug('localStorage.set', key, value);
            var undefined;
            if( value === undefined || value === null ) {
               // storing a null value returns "null" (a string) when get is called later
               // so to make it actually null, just remove it, which returns null
               loc.remove(key);
            }
            else {
               value = angular.toJson(value);
               if( typeof(localStorage) === 'undefined' ) {
                  cookie(key, value);
               }
               else {
                  localStorage.setItem(key, value);
               }
            }
            return loc;
         },
         /**
          * @param {string} key
          * @returns {*} the value or null if not found
          */
         get: function(key) {
            var v = null;
            if( typeof(localStorage) === 'undefined' ) {
               v = cookie(key);
            }
            else {
               //todo should reconstitute json values upon retrieval
               v = localStorage.getItem(key);
            }
            return angular.fromJson(v);
         },
         /**
          * @param {string} key
          * @returns {localStorage}
          */
         remove: function(key) {
            if( typeof(localStorage) === 'undefined' ) {
               cookie(key, null);
            }
            else {
               localStorage.removeItem(key);
            }
            return loc;
         }
      };

      //debug just a temporary tool for debugging and testing
      angular.resetLocalStorage = function() {
         $log.info('resetting localStorage values');
         _.each(['authUser', 'authProvider', 'sortBy'], loc.remove);
      };

      return loc;
   }]);

   appUtils.factory('articlesUrl', ['firebaseRef', 'FB_DEMO_LIMIT', 'FB_LIVE_LIMIT', 'encodeFirebaseKey', function(firebaseRef, FB_DEMO_LIMIT, FB_LIVE_LIMIT, encodeFirebaseKey) {
      return function(feedUrl, isDemo) {
         var limit = isDemo? FB_DEMO_LIMIT : FB_LIVE_LIMIT;
         return firebaseRef('articles', encodeFirebaseKey(feedUrl), 'entries').endAt().limit(limit);
      }
   }]);

   appUtils.factory('articlesMetaUrl', ['firebaseRef', 'encodeFirebaseKey', function(firebaseRef, encodeFirebaseKey) {
      return function(feedUrl) {
         return firebaseRef('articles_meta', encodeFirebaseKey(feedUrl));
      }
   }]);

   appUtils.factory('articlesIndexUrl', ['firebaseRef', 'encodeFirebaseKey', function(firebaseRef, encodeFirebaseKey) {
      return function(feedUrl) {
         return firebaseRef('articles', encodeFirebaseKey(feedUrl), 'index');
      }
   }]);

   appUtils.factory('feedUrl', ['firebaseRef', function(firebaseRef) {
      return function(feedId) {
         return firebaseRef('feeds', feedId);
      }
   }]);

   appUtils.factory('readUrl', ['FIREBASE_URL', 'Firebase', '$rootScope', function(URL, Firebase, $rootScope) {
      return function(feedId, isDemo) {
         if( isDemo ) { return null; }
         var path = URL + ['user', $rootScope.auth.provider, $rootScope.auth.user, 'read', feedId].join('/');
         return new Firebase(path).endAt().limit(250);
      }
   }]);

   appUtils.factory('updateScope', ['$timeout', '$parse', function($timeout, $parse) {
      return function(scope, name, val, cb) {
         $timeout(function() {
            $parse(name).assign(scope, val);
            cb && cb();
         });
      }
   }]);

   function cookie(key, value, options) {
      // key and at least value given, set cookie...
      if (arguments.length > 1 && String(value) !== "[object Object]") {
         options = angular.extend({ path: '/', expires: 365 }, options);

         if (value === null || value === undefined) {
            options.expires = -1;
         }

         if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
         }

         value = String(value);

         return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
         ].join(''));
      }

      // key and possibly options given, get cookie...
      options = value || {};
      var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
      return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
   }

})(angular);


text:
using System.Diagnostics;

namespace ExpressionEvaluator.Parsers.Lexing.Tokens
{
    [DebuggerDisplay("{" + nameof(Lexeme) + "}")]
    public abstract class Token
    {
        protected Token(string lexeme, Location location)
        {
            Lexeme = lexeme;
            Location = location ?? Location.Empty;
        }

        public string Lexeme { get; }

        public Location Location { get; }

        public static bool operator ==(Token left, Token right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(Token left, Token right)
        {
            return !Equals(left, right);
        }

        protected virtual bool Equals(Token other)
        {
            return string.Equals(Lexeme, other.Lexeme);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != GetType()) return false;
            return Equals((Token) obj);
        }

        public override int GetHashCode()
        {
            return Lexeme.GetHashCode();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/*
 * This file is part of GImage.
 *
 * (c) Jose Quintana <https://joseluisq.net>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

/**
 * Rendering an image from a `resource` or `GdImage`.
 *
 * @author Jose Quintana <https://joseluisq.net>
 */

namespace GImage\Examples;

use GImage\Image;

require __DIR__ . '/_config.php';
require __DIR__ . '/../tests/bootstrap.php';

// Create a 240x100 image
$width = 240;
$height = 100;
$rectangle = imagecreatetruecolor($width, $height);
$green = imagecolorallocate($rectangle, 0, 255, 0);
imagefilledrectangle($rectangle, 0, 0, $width, $height, $green);

// Load and process the rectangle image resource
$img = new Image();
$img
    ->load($rectangle)
    // we need to indicate GImage about the image type in this case
    ->toPNG()
    // scale to 50%
    ->scale(0.5)
    // let's change again the image type just for fun
    ->toJPG()
    ->save('rectangle.jpg');


text:
package me.zhouzhuo810.zzapidoc.todolist.entity;

import me.zhouzhuo810.zzapidoc.common.entity.BaseEntity;
import org.hibernate.annotations.Formula;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by zz on 2018/5/9.
 */
@Entity
@Table(name = "todo_list")
public class TodoListEntity extends BaseEntity{
    @Column(name = "HandlePersonId", length = 50)
    private String handlePersonId;
    @Formula("(SELECT u.Name from user u WHERE u.ID = HandlePersonId)")
    private String handlePersonName;
    @Column(name = "Progress")
    private Integer progress;
    @Column(name = "Content")
    private String content;
    @Column(name = "Note")
    private String note;
    @Column(name = "Finish")
    private Boolean isFinish = false;

    public Boolean getFinish() {
        return isFinish;
    }

    public void setFinish(Boolean finish) {
        isFinish = finish;
    }

    public String getHandlePersonId() {
        return handlePersonId;
    }

    public void setHandlePersonId(String handlePersonId) {
        this.handlePersonId = handlePersonId;
    }

    public String getHandlePersonName() {
        return handlePersonName;
    }

    public void setHandlePersonName(String handlePersonName) {
        this.handlePersonName = handlePersonName;
    }

    public Integer getProgress() {
        return progress;
    }

    public void setProgress(Integer progress) {
        this.progress = progress;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }
}


text:
extern void ExitSample();

using namespace DirectX;
using namespace PlayFab;
using namespace PlayFab::ClientModels;
using namespace Windows::Xbox::System;

using Microsoft::WRL::ComPtr;

Sample::Sample() :
    m_frame(0)
{
    m_deviceResources = std::make_unique<DX::DeviceResources>();

    m_liveResources = std::make_shared<ATG::LiveResources>();
    m_liveInfoHUD = std::make_unique<ATG::LiveInfoHUD>(L"Simple PlayFab Auth Sample");
}

// Initialize the Direct3D resources required to run.
void Sample::Initialize(IUnknown* window)
{
    m_gamePad = std::make_unique<GamePad>();

    m_deviceResources->SetWindow(window);

    m_deviceResources->CreateDeviceResources();
    CreateDeviceDependentResources();

    m_deviceResources->CreateWindowSizeDependentResources();
    CreateWindowSizeDependentResources();

    m_liveResources->SetUserChangedCallback([this](ATG::XboxLiveUser)
    {
        m_liveInfoHUD->SetUser(m_liveResources->GetLiveContext());
    });

    m_liveResources->SetUserSignOutCompletedCallback([this](ATG::XboxLiveUser)
    {
        m_liveInfoHUD->SetUser(m_liveResources->GetLiveContext());
    });

    m_liveResources->Initialize();
    m_liveInfoHUD->Initialize(m_liveResources->GetLiveContext());

    User::UserAdded +=
        ref new Windows::Foundation::EventHandler<UserAddedEventArgs^>([this](Platform::Object^ sender, UserAddedEventArgs^ args)
    {
        m_console->Write(L"UserAdded event fired\n");
        m_users = User::Users;
    });

    User::UserRemoved +=
        ref new Windows::Foundation::EventHandler<UserRemovedEventArgs^>([this](Platform::Object^ sender, UserRemovedEventArgs^ args)
    {
        m_console->Write(L"UserRemoved event fired\n");
        if (m_currentUser == nullptr || m_currentUser->Id == args->User->Id)
        {
            SetCurrentUser(nullptr);
        }

        m_users = User::Users;
    });

    m_playFabLoggedIn = false;
    m_playFabDisplayName[0] = '\0';

    // This must be set for PlayFab APIs to work. It can be found in your PlayFab developer dashboard.
    PlayFabSettings::titleId = L"DC0";

    auto user = Windows::Xbox::ApplicationModel::Core::CoreApplicationContext::CurrentUser;
    m_users = User::Users;

    if (user == nullptr &&m_users->Size > 0)
        user = m_users->GetAt(0);

    SetCurrentUser(user);
}

void Sample::OnPlayFabError(const PlayFab::PlayFabError& error, void* custom)
{
    DX::TextConsole* console = reinterpret_cast<DX::TextConsole*>(custom);
    console->Write(L"An error occurred with a PlayFab API\n");
    wchar_t buffer[2000] = {};
    swprintf_s(buffer, L"PlayFab error code: %i\n%S\n%S\n%S\nHTTP error: %i\n%S\n",
        error.ErrorCode,
        error.ErrorName.c_str(),
        error.ErrorMessage.c_str(),
        error.UrlPath.c_str(),
        error.HttpCode,
        error.HttpStatus.c_str());

    console->Write(buffer);
}

// Link an Xbox account to a signed in PlayFab account. If a new PlayFab account is created it is not associated
//  with an Xbox account until this is called.
void Sample::LinkWithExistingPlayFabAccount(IUser^ xboxUser)
{
    auto async = Windows::Xbox::UI::SystemUI::ShowVirtualKeyboardAsync(L"PlayFab ID", L"Login name", L"Provide a login ID for PlayFab. Must be 3-20 characters long", Windows::Xbox::UI::VirtualKeyboardInputScope::Alphanumeric);
    concurrency::create_task(async).then([=](concurrency::task<Platform::String^> task)
    {
        try
        {
            Platform::String^ userName = task.get();
            auto async = Windows::Xbox::UI::SystemUI::ShowVirtualKeyboardAsync(L"", L"Password", L"Provide a password for PlayFab. Must be 6-100 characters long", Windows::Xbox::UI::VirtualKeyboardInputScope::Password);
            concurrency::create_task(async).then([=](concurrency::task<Platform::String^> task)
            {
                try
                {
                    Platform::String^ password = task.get();

                    // Now that we have the user's login name and password, login with the PlayFab API, then link
                    //  that to the logged in Xbox account. Once the account is linked, then the LoginWithXbox
                    //  API can be used with the Xbox token and manual input will no longer be needed.
                    ClientModels::LoginWithPlayFabRequest loginRequest;
                    loginRequest.Password = ShortenString(password->Data());
                    loginRequest.Username = ShortenString(userName->Data());

                    PlayFabClientAPI::LoginWithPlayFab(loginRequest, [=](const LoginResult&, void*)
                    {
                        auto async = xboxUser->GetTokenAndSignatureAsync("POST", "https://playfabapi.com", "");
                        m_playFabLoggedIn = true;

                        concurrency::create_task(async).then([=](concurrency::task<Windows::Xbox::System::GetTokenAndSignatureResult^> task)
                        {
                            try
                            {
                                auto xboxTokenResult = task.get();

                                LinkXboxAccountRequest linkRequest;
                                linkRequest.XboxToken = ShortenString(xboxTokenResult->Token->Data());

                                PlayFabClientAPI::LinkXboxAccount(linkRequest, [this](const LinkXboxAccountResult&, void*)
                                {
                                    m_console->Write(L"Account link successful\n");
                                }, OnPlayFabError, m_console.get());
                            }
                            catch (Platform::Exception^ Ex)
                            {
                                Sample::HandleException(Ex, __FUNCTIONW__);
                            }
                        }); // create_task for GetTokenAndSignatureAsync

                    }, Sample::OnPlayFabError, m_console.get()); // LoginWithPlayFab

                }
                catch (Platform::Exception^ Ex)
                {
                    Sample::HandleException(Ex, __FUNCTIONW__);
                }

            }); // create_task for ShowVirtualKeyboardAsync

        }
        catch (Platform::Exception^ Ex)
        {
            Sample::HandleException(Ex, __FUNCTIONW__);
        }

    });// create_task for ShowVirtualKeyboardAsync
}

// Register a new PlayFab user. PlayFab enforces length requirements for all input strings. The flow for this
//  function is to show the virtual keyboard three times to get a display name, a login username, and a login
//  password, then use that information to create the PlayFab account. Once the account is created, then get
//  the Xbox token for the player with GetTokenAndSignatureAsync and use that to link the new account to their
//  Xbox profile. This is useful because it allows the player to choose a display name for their account at
//  the time it is created.
void Sample::RegisterForPlayFab(IUser^ xboxUser)
{
    auto gamerTag = xboxUser->DisplayInfo->Gamertag;
    auto async = Windows::Xbox::UI::SystemUI::ShowVirtualKeyboardAsync(gamerTag, L"Display Name", L"Provide a display name for your PlayFab account. Must be 3-25 characters long", Windows::Xbox::UI::VirtualKeyboardInputScope::Alphanumeric);
    concurrency::create_task(async).then([=](concurrency::task<Platform::String^> task)
    {
        try
        {
            Platform::String^ displayName = task.get();
            auto async = Windows::Xbox::UI::SystemUI::ShowVirtualKeyboardAsync(gamerTag, L"Login name", L"Provide a login ID for PlayFab. Must be 3-20 characters long", Windows::Xbox::UI::VirtualKeyboardInputScope::Alphanumeric);
            concurrency::create_task(async).then([=](concurrency::task<Platform::String^> task)
            {
                try
                {
                    Platform::String^ signinName = task.get();
                    auto async = Windows::Xbox::UI::SystemUI::ShowVirtualKeyboardAsync(L"", L"Password", L"Provide a password for PlayFab. Must be 6-100 characters long", Windows::Xbox::UI::VirtualKeyboardInputScope::Password);
                    concurrency::create_task(async).then([=](concurrency::task<Platform::String^> task)
                    {
                        try
                        {
                            Platform::String^ password = task.get();

                            RegisterPlayFabUserRequest regRequest;
                            regRequest.DisplayName = ShortenString(displayName->Data());    // Must be 3-25 characters
                            regRequest.Username = ShortenString(signinName->Data());        // Must be 3-20 characters
                            regRequest.Password = ShortenString(password->Data());          // Must be 6-100 characters
                            regRequest.RequireBothUsernameAndEmail = false;

                            if (displayName->Length() < 3 || displayName->Length() > 25)
                            {
                                m_console->Write(L"User Name must be 3-25 characters long\n");
                                return;
                            }

                            if (signinName->Length() < 3 || signinName->Length() > 20)
                            {
                                m_console->Write(L"Login ID must be 3-20 characters long\n");
                                return;
                            }

                            if (password->Length() < 6 || password->Length() > 100)
                            {
                                m_console->Write(L"Password must be 6-100 characters long\n");
                                return;
                            }

                            PlayFabClientAPI::RegisterPlayFabUser(regRequest, [=](const RegisterPlayFabUserResult&, void*)
                            {
                                m_console->Write(L"PlayFabClientAPI::RegisterPlayFabUser completed successfully\n");

                                // Now that a new PlayFab account has been registered, link to with with the logged in Xbox user
                                auto async = xboxUser->GetTokenAndSignatureAsync("POST", "https://playfabapi.com", "");

                                concurrency::create_task(async).then([=](concurrency::task<Windows::Xbox::System::GetTokenAndSignatureResult^> task)
                                {
                                    try
                                    {
                                        auto result = task.get();

                                        LinkXboxAccountRequest linkRequest;
                                        linkRequest.XboxToken = ShortenString(result->Token->Data());

                                        PlayFabClientAPI::LinkXboxAccount(linkRequest, [this,displayName](const LinkXboxAccountResult&, void*)
                                        {
                                            m_console->Write(L"Account link successful\n");
                                            wcscpy_s(m_playFabDisplayName, displayName->Data());

                                        }, OnPlayFabError, m_console.get()); // LinkXboxAccount

                                    }
                                    catch (Platform::Exception^ Ex)
                                    {
                                        Sample::HandleException(Ex, __FUNCTIONW__);
                                    }
                                }); // create_task for GetTokenAndSignatureAsync

                            }, Sample::OnPlayFabError, m_console.get()); // RegisterPlayFabUser
                        }
                        catch (Platform::Exception^ Ex)
                        {
                            Sample::HandleException(Ex, __FUNCTIONW__);
                        }
                    }); // create_task for ShowVirtualKeyboardAsync

                }
                catch (Platform::Exception^ Ex)
                {
                    Sample::HandleException(Ex, __FUNCTIONW__);
                }
            }); // create_task for ShowVirtualKeyboardAsync

        }
        catch (Platform::Exception^ Ex)
        {
            Sample::HandleException(Ex, __FUNCTIONW__);
        }
    }); // create_task for ShowVirtualKeyboardAsync
}

// This logs a player in to PlayFab. Once LoginWithXbox is executed, a PlayFab token will be stored in
//  the PlayFab settings until another user is logged in. Tokens for multiple players can be managed by
//  client code to allow multiple PlayFab logins at once by setting PlayFabSettings::clientSessionTicket
//  with the token associated with the correct user before making PlayFab API calls. These tokens
//  must expire after 4 hours and must be refreshed by client code. There is no need to log a PlayFab
//  user out once a play session is over.
void Sample::RefreshPlayFabToken(IUser^ xboxUser)
{
    auto async = xboxUser->GetTokenAndSignatureAsync("POST", "https://playfabapi.com", "");

    concurrency::create_task(async).then([this](concurrency::task<Windows::Xbox::System::GetTokenAndSignatureResult^> task)
    {
        try
        {
            auto result = task.get();

            LoginWithXboxRequest request;
            auto token = result->Token;
            request.XboxToken = ShortenString(token->Data());

            // This sample will only log someone in to PlayFab if they already have an account
            //  associated with their Xbox account. Setting this to 'true' will automaticalle
            //  create a new PlayFab account if one does not already exist for your Xbox account.
            request.CreateAccount = false;

            PlayFabClientAPI::LoginWithXbox(request, [this](const LoginResult& result, void*)
            {
                m_console->Write(L"PlayFab signin successful\n");
                m_playFabLoggedIn = true;

                GetPlayerProfileRequest request;
                request.PlayFabId = result.PlayFabId;

                PlayFabClientAPI::GetPlayerProfile(request, [this](const GetPlayerProfileResult& result, void*)
                {
                    m_console->Write(L"PlayFabClientAPI::GetPlayerProfile successful\n");
                    swprintf_s(m_playFabDisplayName, L"%S", result.PlayerProfile->DisplayName.c_str());
                }, Sample::OnPlayFabError, m_console.get());
            }, OnPlayFabError, m_console.get()); // LoginWithXbox

        }
        catch (Platform::Exception^ Ex)
        {
            Sample::HandleException(Ex, __FUNCTIONW__);
        }
    }); // create_task for GetTokenAndSignatureAsync
}

// PlayFab allows a title to save a unique display name for every game a user plays. Each display name is distinct in
//  each title. This can later be queried from the user's info with GetAccountInfo or GetPlayerProfile.
void Sample::UpdatePlayFabDisplayName()
{
    auto async = Windows::Xbox::UI::SystemUI::ShowVirtualKeyboardAsync(m_currentUser->DisplayInfo->Gamertag, L"Display Name", L"Choose the name you would like to use for this game", Windows::Xbox::UI::VirtualKeyboardInputScope::Alphanumeric);
    concurrency::create_task(async).then([=](concurrency::task<Platform::String^> task)
    {
        try
        {
            Platform::String^ displayName = task.get();
            UpdateUserTitleDisplayNameRequest request;
            request.DisplayName = ShortenString(displayName->Data());

            PlayFabClientAPI::UpdateUserTitleDisplayName(request, [=](const UpdateUserTitleDisplayNameResult&, void*)
            {
                m_console->Write(L"Display name successfully updated: ");
                m_console->WriteLine(displayName->Data());
                wcscpy_s(m_playFabDisplayName, displayName->Data());
            }, OnPlayFabError, m_console.get());
        }
        catch (Platform::Exception^ Ex)
        {
            Sample::HandleException(Ex, __FUNCTIONW__);
        }
    });
}

void Sample::SetCurrentUser(IUser^ xboxUser)
{
    // If the current user has changed, mark this user as signed out of PlayFab until a new token has been retrieved
    if (m_currentUser != nullptr && xboxUser != nullptr &&
        m_currentUser->Id != xboxUser->Id)
    {
        m_playFabLoggedIn = false;
    }

    m_currentUser = xboxUser;
    if (m_currentUser == nullptr)
    {
        m_playFabDisplayName[0] = '\0';
        m_playFabLoggedIn = false;
    }
    else
    {
        RefreshPlayFabToken(m_currentUser);
    }
}

void Sample::ChangeAccount()
{
    auto async = Windows::Xbox::UI::SystemUI::ShowAccountPickerAsync(nullptr, Windows::Xbox::UI::AccountPickerOptions::None);

    concurrency::create_task(async).then([this](concurrency::task<Windows::Xbox::UI::AccountPickerResult^> task)
    {
        try
        {
            auto result = task.get();
            SetCurrentUser(result->User);
        }
        catch (Platform::Exception^ Ex)
        {
            Sample::HandleException(Ex, __FUNCTIONW__);
        }
    });
}

void Sample::HandleException(Platform::Exception^ Ex, Platform::String^ sender)
{
    wchar_t buffer[1000] = {};
    swprintf_s(buffer, L"There was a problem with %s\nError: 0x%X\n%s\n", sender->Data(), Ex->HResult, Ex->Message->Data());
    OutputDebugString(buffer);
}

#pragma region Frame Update
// Executes basic render loop.
void Sample::Tick()
{
    PIXBeginEvent(PIX_COLOR_DEFAULT, L"Frame %I64u", m_frame);

    m_timer.Tick([&]()
    {
        Update(m_timer);
    });

    Render();

    PIXEndEvent();
    m_frame++;
}

// Updates the world.
void Sample::Update(DX::StepTimer const&)
{
    PIXBeginEvent(PIX_COLOR_DEFAULT, L"Update");

    PlayFabClientAPI::Update();

    auto pad = m_gamePad->GetState(0);
    if (pad.IsConnected())
    {
        m_gamePadButtons.Update(pad);

        if (pad.IsViewPressed())
        {
            ExitSample();
        }

        {
            if (pad.IsAPressed())
            {
                if (m_currentUser != nullptr)
                    UpdatePlayFabDisplayName();
                else
                    ChangeAccount();
            }

            // If there is no one signed in on the console, open the account picker instead. An Xbox account should be linked
            //  with the new PlayFab account upon creation.
            else if (pad.IsBPressed())
            {
                if (m_currentUser != nullptr)
                    RegisterForPlayFab(m_currentUser);
                else
                    ChangeAccount();
                //framesSinceLastInput = 0;
            }

            // A signed in Xbox account is required for getting a PlayFab token so open the
            //  account picker if no user is logged in.
            // Note: Using ButtonState::PRESSED to prevent this from firing on back to back frames
            else if (m_gamePadButtons.x == DirectX::GamePad::ButtonStateTracker::ButtonState::PRESSED)
            {
                if (m_currentUser != nullptr)
                    RefreshPlayFabToken(m_currentUser);
                else
                    ChangeAccount();
            }

            // If a new PlayFab user was created, you can link it to the signed in Xbox account
            //  with the LinkXboxAccount API.
            else if (pad.IsYPressed())
            {
                if (m_currentUser != nullptr)
                    LinkWithExistingPlayFabAccount(m_currentUser);
                else
                    ChangeAccount();
            }

            else if (pad.IsMenuPressed())
            {
                ChangeAccount();
            }
        }
    }
    else
    {
        m_gamePadButtons.Reset();
    }

    PIXEndEvent();
}
#pragma endregion

#pragma region Frame Render
// Draws the scene.
void Sample::Render()
{
    // Don't try to render anything before the first Update.
    if (m_timer.GetFrameCount() == 0)
    {
        return;
    }

    // Prepare the render target to render a new frame.
    m_deviceResources->Prepare();
    Clear();

    auto context = m_deviceResources->GetD3DDeviceContext();
    PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Render");

    m_liveInfoHUD->Render();

    m_batch->Begin();

    if (m_currentUser != nullptr)
    {
        if (!m_playFabLoggedIn)
        {
            m_font->DrawString(m_batch.get(), L"No PlayFab account available...", DirectX::XMFLOAT2(100, 100), DirectX::Colors::Red);
        }
        else
        {
            m_font->DrawString(m_batch.get(), L"PlayFab Display Name:", DirectX::XMFLOAT2(100, 100), DirectX::Colors::Green);
            if(wcslen(m_playFabDisplayName) == 0)
                m_font->DrawString(m_batch.get(), L"[Anonymous account]", DirectX::XMFLOAT2(480, 100), DirectX::Colors::Green);
            else
                m_font->DrawString(m_batch.get(), m_playFabDisplayName, DirectX::XMFLOAT2(480, 100), DirectX::Colors::Green);
        }
    }

    DX::DrawControllerString(m_batch.get(), m_font.get(), m_ctrlFont.get(), L"[Menu] Open account picker\n[A] Update display name\n[B] Create new PlayFab account\n[X] Login to existing PlayFab account\n[Y] Link Xbox and PlayFab accounts", DirectX::XMFLOAT2(100, 200));

    m_console->Render();

    m_batch->End();

    PIXEndEvent(context);

    // Show the new frame.
    PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Present");
    m_deviceResources->Present();
    m_graphicsMemory->Commit();
    PIXEndEvent(context);
}

// Helper method to clear the back buffers.
void Sample::Clear()
{
    auto context = m_deviceResources->GetD3DDeviceContext();
    PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Clear");

    // Clear the views.
    auto renderTarget = m_deviceResources->GetRenderTargetView();
    auto depthStencil = m_deviceResources->GetDepthStencilView();

    context->ClearRenderTargetView(renderTarget, ATG::Colors::Background);
    context->ClearDepthStencilView(depthStencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);

    context->OMSetRenderTargets(1, &renderTarget, depthStencil);

    // Set the viewport.
    auto viewport = m_deviceResources->GetScreenViewport();
    context->RSSetViewports(1, &viewport);

    PIXEndEvent(context);
}
#pragma endregion

#pragma region Message Handlers
// Message handlers
void Sample::OnSuspending()
{
    auto context = m_deviceResources->GetD3DDeviceContext();
    context->Suspend(0);
}

void Sample::OnResuming()
{
    auto context = m_deviceResources->GetD3DDeviceContext();
    context->Resume();
    m_timer.ResetElapsedTime();
    m_gamePadButtons.Reset();
}
#pragma endregion

#pragma region Direct3D Resources
// These are the resources that depend on the device.
void Sample::CreateDeviceDependentResources()
{
    auto device = m_deviceResources->GetD3DDevice();
    auto context = m_deviceResources->GetD3DDeviceContext();

    m_liveInfoHUD->RestoreDevice(context);

    m_graphicsMemory = std::make_unique<GraphicsMemory>(device, m_deviceResources->GetBackBufferCount());
    m_batch = std::make_unique<SpriteBatch>(context);
    m_font = std::make_unique<SpriteFont>(device, L"SegoeUI_24.spritefont");

    m_console = std::make_unique<DX::TextConsole>(context, L"Courier_16.spritefont");
    m_ctrlFont = std::make_unique<SpriteFont>(device, L"XboxOneController.spritefont");
    m_console->SetDebugOutput(true);
}

// Allocate all memory resources that change on a window SizeChanged event.
void Sample::CreateWindowSizeDependentResources()
{
    auto vp = m_deviceResources->GetScreenViewport();
    m_batch->SetViewport(vp);

    RECT console = {};

    console.top = 547;
    console.left = 795;
    console.bottom = console.top + 341;
    console.right = console.left + 626;

    m_console->SetWindow(console);
}
#pragma endregion


text:
class RenameRealEstateAdsToRealEstateAdEntries < ActiveRecord::Migration
  def change
    rename_table :real_estate_ads, :ad_entries
  end
end


text:
    /**
     * @ngdoc service
     * @name merchello.models.invoiceDisplayBuilder
     *
     * @description
     * A utility service that builds InvoiceDisplay models
     */
    angular.module('merchello.models')
        .factory('invoiceDisplayBuilder',
        ['genericModelBuilder', 'invoiceStatusDisplayBuilder', 'invoiceLineItemDisplayBuilder',
            'orderDisplayBuilder', 'currencyDisplayBuilder', 'noteDisplayBuilder', 'InvoiceDisplay',
            function(genericModelBuilder, invoiceStatusDisplayBuilder, invoiceLineItemDisplayBuilder,
                     orderDisplayBuilder, currencyDisplayBuilder, noteDisplayBuilder, InvoiceDisplay) {
                var Constructor = InvoiceDisplay;

                return {
                    createDefault: function() {
                        var invoice = new Constructor();
                        invoice.invoiceStatus = invoiceStatusDisplayBuilder.createDefault();
                        invoice.currency = currencyDisplayBuilder.createDefault();
                        return invoice;
                    },
                    transform: function(jsonResult) {
                        var invoices = genericModelBuilder.transform(jsonResult, Constructor);
                        if (angular.isArray(invoices)) {
                            for (var i = 0; i < invoices.length; i++) {
                                if (invoices[i].key !== "") {
                                    invoices[i].invoiceStatus = invoiceStatusDisplayBuilder.transform(jsonResult[i].invoiceStatus);
                                    invoices[i].items = invoiceLineItemDisplayBuilder.transform(jsonResult[i].items);
                                    invoices[i].orders = orderDisplayBuilder.transform(jsonResult[i].orders);
                                    invoices[i].currency = currencyDisplayBuilder.transform(jsonResult[i].currency);
                                    invoices[i].notes = noteDisplayBuilder.transform(jsonResult[i].notes);
                                }
                            }
                        } else {
                            //jsonResult = JSON.stringify(jsonResult);
                            invoices.invoiceStatus = invoiceStatusDisplayBuilder.transform(jsonResult.invoiceStatus);
                            invoices.items = invoiceLineItemDisplayBuilder.transform(jsonResult.items);
                            invoices.orders = orderDisplayBuilder.transform(jsonResult.orders);
                            invoices.currency = currencyDisplayBuilder.transform(jsonResult.currency);
                            invoices.notes = noteDisplayBuilder.transform(jsonResult.notes);
                        }
                        return invoices;
                    }
                };
            }]);


text:
layout: postag
title: 'INTJ'
shortdef: 'interjection'
---

### Definition

An interjection is a word that is used most often as an exclamation or
part of an exclamation.

### Examples

- _Tack!_ "Thanks!"
- _Aj!_ "Ouch!"
- _Pang!_ "Bam!"
<!-- Interlanguage links updated Po lis 14 15:34:32 CET 2022 -->


text:
'use strict';

const models = require('./index');

/**
 * @class
 * Initializes a new instance of the Foo class.
 * @constructor
 * The URIs that are used to perform a retrieval of a public blob, queue or
 * table object.
 *
 * @member {object} [barPoint] Bar point
 *
 * @member {object} [barPoint.recursivePoint] Recursive Endpoints
 *
 * @member {string} [barPoint.recursivePoint.blob] Gets the blob endpoint.
 *
 * @member {string} [barPoint.recursivePoint.queue] Gets the queue endpoint.
 *
 * @member {string} [barPoint.recursivePoint.table] Gets the table endpoint.
 *
 * @member {object} [barPoint.recursivePoint.dummyEndPoint] Dummy EndPoint
 *
 * @member {object} [barPoint.recursivePoint.fooPoint] Foo point
 *
 */
class Foo {
  constructor() {
  }

  /**
   * Defines the metadata of Foo
   *
   * @returns {object} metadata of Foo
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Foo',
      type: {
        name: 'Composite',
        className: 'Foo',
        modelProperties: {
          barPoint: {
            required: false,
            serializedName: 'Bar\\.Point',
            type: {
              name: 'Composite',
              className: 'Bar'
            }
          }
        }
      }
    };
  }
}

module.exports = Foo;


text:
package org.diorite.material.blocks.stony;

import java.util.Map;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import org.diorite.DyeColor;
import org.diorite.cfg.magic.MagicNumbers;
import org.diorite.material.BlockMaterialData;
import org.diorite.material.ColorableMat;
import org.diorite.utils.collections.maps.CaseInsensitiveMap;

import gnu.trove.map.TByteObjectMap;
import gnu.trove.map.hash.TByteObjectHashMap;

/**
 * Class representing block "StainedHardenedClay" and all its subtypes.
 */
public class StainedHardenedClayMat extends BlockMaterialData implements ColorableMat
{
    /**
     * Sub-ids used by diorite/minecraft by default
     */
    public static final byte  USED_DATA_VALUES = 16;
    /**
     * Blast resistance of block, can be changed only before server start.
     * Final copy of blast resistance from {@link MagicNumbers} class.
     */
    public static final float BLAST_RESISTANCE = MagicNumbers.MATERIAL__STAINED_HARDENED_CLAY__BLAST_RESISTANCE;
    /**
     * Hardness of block, can be changed only before server start.
     * Final copy of hardness from {@link MagicNumbers} class.
     */
    public static final float HARDNESS         = MagicNumbers.MATERIAL__STAINED_HARDENED_CLAY__HARDNESS;

    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_WHITE      = new StainedHardenedClayMat();
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_ORANGE     = new StainedHardenedClayMat(DyeColor.ORANGE);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_MAGENTA    = new StainedHardenedClayMat(DyeColor.MAGENTA);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_LIGHT_BLUE = new StainedHardenedClayMat(DyeColor.LIGHT_BLUE);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_YELLOW     = new StainedHardenedClayMat(DyeColor.YELLOW);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_LIME       = new StainedHardenedClayMat(DyeColor.LIME);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_PINK       = new StainedHardenedClayMat(DyeColor.PINK);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_GRAY       = new StainedHardenedClayMat(DyeColor.GRAY);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_SILVER     = new StainedHardenedClayMat(DyeColor.SILVER);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_CYAN       = new StainedHardenedClayMat(DyeColor.CYAN);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_PURPLE     = new StainedHardenedClayMat(DyeColor.PURPLE);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_BLUE       = new StainedHardenedClayMat(DyeColor.BLUE);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_BROWN      = new StainedHardenedClayMat(DyeColor.BROWN);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_GREEN      = new StainedHardenedClayMat(DyeColor.GREEN);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_RED        = new StainedHardenedClayMat(DyeColor.RED);
    public static final StainedHardenedClayMat STAINED_HARDENED_CLAY_BLACK      = new StainedHardenedClayMat(DyeColor.BLACK);

    private static final Map<String, StainedHardenedClayMat>    byName = new CaseInsensitiveMap<>(USED_DATA_VALUES, SMALL_LOAD_FACTOR);
    private static final TByteObjectMap<StainedHardenedClayMat> byID   = new TByteObjectHashMap<>(USED_DATA_VALUES, SMALL_LOAD_FACTOR);

    protected final DyeColor color;

    @SuppressWarnings("MagicNumber")
    protected StainedHardenedClayMat()
    {
        super("STAINED_HARDENED_CLAY", 159, "minecraft:stained_hardened_clay", "WHITE", (byte) 0x00);
        this.color = DyeColor.WHITE;
    }

    protected StainedHardenedClayMat(final DyeColor color)
    {
        super(STAINED_HARDENED_CLAY_WHITE.name(), STAINED_HARDENED_CLAY_WHITE.ordinal(), STAINED_HARDENED_CLAY_WHITE.getMinecraftId(), color.name(), color.getBlockFlag());
        this.color = color;
    }

    protected StainedHardenedClayMat(final String enumName, final int id, final String minecraftId, final int maxStack, final String typeName, final byte type, final DyeColor color)
    {
        super(enumName, id, minecraftId, maxStack, typeName, type);
        this.color = color;
    }

    @Override
    public float getBlastResistance()
    {
        return BLAST_RESISTANCE;
    }

    @Override
    public float getHardness()
    {
        return HARDNESS;
    }

    @Override
    public StainedHardenedClayMat getType(final String name)
    {
        return getByEnumName(name);
    }

    @Override
    public StainedHardenedClayMat getType(final int id)
    {
        return getByID(id);
    }

    @Override
    public String toString()
    {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString()).append("color", this.color).toString();
    }

    @Override
    public DyeColor getColor()
    {
        return this.color;
    }

    @Override
    public StainedHardenedClayMat getColor(final DyeColor color)
    {
        return getByID(color.getBlockFlag());
    }

    /**
     * Returns one of StainedHardenedClay sub-type based on sub-id, may return null
     *
     * @param id sub-type id
     *
     * @return sub-type of StainedHardenedClay or null
     */
    public static StainedHardenedClayMat getByID(final int id)
    {
        return byID.get((byte) id);
    }

    /**
     * Returns one of StainedHardenedClay sub-type based on name (selected by diorite team), may return null
     * If block contains only one type, sub-name of it will be this same as name of material.
     *
     * @param name name of sub-type
     *
     * @return sub-type of StainedHardenedClay or null
     */
    public static StainedHardenedClayMat getByEnumName(final String name)
    {
        return byName.get(name);
    }

    /**
     * Returns one of StainedHardenedClay sub-type based on {@link DyeColor}.
     * It will never return null;
     *
     * @param color color of StainedHardenedClay
     *
     * @return sub-type of StainedHardenedClay
     */
    public static StainedHardenedClayMat getStainedHardenedClay(final DyeColor color)
    {
        return getByID(color.getBlockFlag());
    }

    /**
     * Register new sub-type, may replace existing sub-types.
     * Should be used only if you know what are you doing, it will not create fully usable material.
     *
     * @param element sub-type to register
     */
    public static void register(final StainedHardenedClayMat element)
    {
        byID.put((byte) element.getType(), element);
        byName.put(element.name(), element);
    }

    @Override
    public StainedHardenedClayMat[] types()
    {
        return StainedHardenedClayMat.stainedHardenedClayTypes();
    }

    /**
     * @return array that contains all sub-types of this block.
     */
    public static StainedHardenedClayMat[] stainedHardenedClayTypes()
    {
        return byID.values(new StainedHardenedClayMat[byID.size()]);
    }

    static
    {
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_WHITE);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_ORANGE);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_MAGENTA);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_LIGHT_BLUE);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_YELLOW);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_LIME);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_PINK);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_GRAY);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_SILVER);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_CYAN);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_PURPLE);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_BLUE);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_BROWN);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_GREEN);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_RED);
        StainedHardenedClayMat.register(STAINED_HARDENED_CLAY_BLACK);
    }
}


text: docker exec -it dropwizard-hello-world bash


text:
package com.github.br.ecs.simple.fsm;

/**
 * Created by user on 09.04.2017.
 */
public abstract class StateScript {

    private FSM fsm;

    void setFsm(FSM fsm) {
        this.fsm = fsm;
    }

    public FsmContext getContext() {
        return fsm.context;
    }

    public String getCurrentState(){
        return fsm.currentState.getName();
    }

    public abstract void initialize();
    public abstract void update();
    public abstract void dispose();

    public void fireEvent(FsmStateEvent event){
        event.script = this;
        fsm.fireEvent(event);
    }
}


text:
/* Generated by ./xlat/gen.sh from ./xlat/bsg_subprotocol.in; do not edit. */

#ifdef IN_MPERS

# error static const struct xlat bsg_subprotocol in mpers mode

#else

static
const struct xlat bsg_subprotocol[] = {
#if defined(BSG_SUB_PROTOCOL_SCSI_CMD) || (defined(HAVE_DECL_BSG_SUB_PROTOCOL_SCSI_CMD) && HAVE_DECL_BSG_SUB_PROTOCOL_SCSI_CMD)
  XLAT(BSG_SUB_PROTOCOL_SCSI_CMD),
#endif
#if defined(BSG_SUB_PROTOCOL_SCSI_TMF) || (defined(HAVE_DECL_BSG_SUB_PROTOCOL_SCSI_TMF) && HAVE_DECL_BSG_SUB_PROTOCOL_SCSI_TMF)
  XLAT(BSG_SUB_PROTOCOL_SCSI_TMF),
#endif
#if defined(BSG_SUB_PROTOCOL_SCSI_TRANSPORT) || (defined(HAVE_DECL_BSG_SUB_PROTOCOL_SCSI_TRANSPORT) && HAVE_DECL_BSG_SUB_PROTOCOL_SCSI_TRANSPORT)
  XLAT(BSG_SUB_PROTOCOL_SCSI_TRANSPORT),
#endif
 XLAT_END
};

#endif /* !IN_MPERS */


text:
typedef struct {
	volatile unsigned long lock;
} raw_spinlock_t;

#define __RAW_SPIN_LOCK_UNLOCKED	{ 1 }

#include <asm/atomic.h>

typedef struct {
	raw_spinlock_t lock;
	atomic_t counter;
} raw_rwlock_t;

#define RW_LOCK_BIAS			0x01000000
#define __RAW_RW_LOCK_UNLOCKED		{ { 0 }, { RW_LOCK_BIAS } }

#endif


text:
package cern.accsoft.steering.aloha.analyzer;

import cern.jdve.viewer.DVView;

/**
 * This interface defines the methods for a general Analyzer to be plugged in
 * into Aloha
 *
 * @author kfuchsbe
 *
 */
public interface Analyzer {

	/**
	 * @return the dataviews which can be displayed in a dataviewerPanel.
	 */
	public DVView getDVView();

	/**
	 * displays the new data in the views
	 */
	public void refresh();

}


text:
import { makeTest, TestBedConfig, ItFuncConfig } from './scaffolding/runner';
import { Misc } from './miscellaneous/misc';
import { ItemsCounter, testItemsCounter } from './miscellaneous/itemsCounter';

const fixedItemSizeConfigList: TestBedConfig[] = [{
  datasourceSettings: { startIndex: 1, padding: 2, itemSize: 15 },
  templateSettings: { viewportHeight: 20, itemHeight: 15 }
}, {
  datasourceSettings: { startIndex: 1, padding: 0.5, itemSize: 20 },
  templateSettings: { viewportHeight: 120, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: -99, padding: 0.3, itemSize: 25 },
  templateSettings: { viewportHeight: 200, itemHeight: 25 }
}, {
  datasourceSettings: { startIndex: -77, padding: 0.62, itemSize: 100, horizontal: true },
  templateSettings: { viewportWidth: 450, itemWidth: 100, horizontal: true }
}, {
  datasourceSettings: { startIndex: 1, padding: 0.5, itemSize: 20, windowViewport: true },
  templateSettings: { noViewportClass: true, viewportHeight: 0, itemHeight: 20 }
}];

const fixedItemSizeAndBigBufferSizeConfigList: TestBedConfig[] = [{
  datasourceSettings: { startIndex: 100, padding: 0.1, itemSize: 20, bufferSize: 20 },
  templateSettings: { viewportHeight: 100, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: -50, padding: 0.1, itemSize: 100, bufferSize: 10, horizontal: true },
  templateSettings: { viewportWidth: 200, itemWidth: 100, horizontal: true }
}];

const tunedItemSizeConfigList: TestBedConfig[] = [{
  datasourceSettings: { startIndex: 1, bufferSize: 1, padding: 0.5, itemSize: 40 },
  templateSettings: { viewportHeight: 100, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: -50, bufferSize: 2, padding: 0.5, itemSize: 30 },
  templateSettings: { viewportHeight: 120, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: -77, padding: 0.82, itemSize: 200, horizontal: true },
  templateSettings: { viewportWidth: 450, itemWidth: 100, horizontal: true }
}, {
  datasourceSettings: { startIndex: -47, padding: 0.3, itemSize: 60, windowViewport: true },
  templateSettings: { noViewportClass: true, viewportHeight: 0, itemHeight: 40 }
}];

const tunedItemSizeAndBigBufferSizeConfigList: TestBedConfig[] = [{
  datasourceSettings: { startIndex: -50, bufferSize: 7, padding: 0.5, itemSize: 30 },
  templateSettings: { viewportHeight: 120, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: 50, padding: 0.33, itemSize: 35, bufferSize: 20, windowViewport: true },
  templateSettings: { noViewportClass: true, viewportHeight: 0, itemHeight: 20 }
}];

const noItemSizeConfigList = tunedItemSizeConfigList.map(
  ({ datasourceSettings: { itemSize: _, ...restDatasourceSettings }, ...config }) => ({
    ...config, datasourceSettings: { ...restDatasourceSettings }
  })
);

const noItemSizeAndBigBufferConfigList = tunedItemSizeAndBigBufferSizeConfigList.map(
  ({ datasourceSettings: { itemSize: _, ...restDatasourceSettings }, ...config }) => ({
    ...config, datasourceSettings: { ...restDatasourceSettings }
  })
);

const lackOfItemsOnFirstFetchConfigList: TestBedConfig[] = [{
  datasourceSettings: { startIndex: 100, padding: 0.5, bufferSize: 10, minIndex: 1 },
  templateSettings: { viewportHeight: 300, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: -70, padding: 0.5, bufferSize: 2, minIndex: -75 },
  templateSettings: { viewportHeight: 200, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: 1, padding: 0.1, bufferSize: 12, minIndex: -9, windowViewport: true },
  templateSettings: { noViewportClass: true, viewportHeight: 0, itemHeight: 20 }
}, {
  datasourceSettings: { startIndex: -99, padding: 0.3, bufferSize: 4, minIndex: -120, horizontal: true },
  templateSettings: { horizontal: true, viewportWidth: 300, itemWidth: 40 }
}];

const getSetItemSizeCounter = (settings: TestBedConfig, misc: Misc, itemSize: number): ItemsCounter => {
  const { bufferSize, startIndex, padding } = misc.scroller.settings;
  const viewportSize = misc.getViewportSize();

  const backwardLimit = viewportSize * padding;
  const forwardLimit = viewportSize + backwardLimit;
  const itemsCounter = new ItemsCounter();
  const { backward, forward } = itemsCounter;

  backward.count = Math.ceil(backwardLimit / itemSize);
  forward.count = Math.ceil(forwardLimit / itemSize);

  // when bufferSize is big enough
  const bwdDiff = bufferSize - backward.count;
  if (bwdDiff > 0) {
    backward.count += bwdDiff;
  }
  const fwdDiff = bufferSize - forward.count;
  if (fwdDiff > 0) {
    forward.count += fwdDiff;
  }

  backward.index = startIndex - backward.count;
  forward.index = startIndex + forward.count - 1;
  return itemsCounter;
};

const getNotSetItemSizeCounter =
  (settings: TestBedConfig, misc: Misc, itemSize: number, previous?: ItemsCounter): ItemsCounter => {
    const { bufferSize, startIndex, padding } = misc.scroller.settings;
    const viewportSize = misc.getViewportSize();
    const backwardLimit = viewportSize * padding;
    const forwardLimit = viewportSize + backwardLimit;
    const itemsCounter = new ItemsCounter();
    const { backward, forward } = itemsCounter;
    const countB = previous ? previous.backward.count : 0;
    const countF = previous ? previous.forward.count : 0;
    let bwd, fwd;

    // 1) fetch only in forward direction if this is the first fetch
    // 2) fetch bufferSize items if Settings.itemSize value hasn't been set up
    backward.count = previous ? (itemSize ? Math.ceil(backwardLimit / itemSize) : bufferSize) : 0;
    forward.count = itemSize ? Math.ceil(forwardLimit / itemSize) : bufferSize;
    if (previous) {
      backward.count = Math.max(backward.count, countB);
      forward.count = Math.max(forward.count, countF);
    }

    // when bufferSize is big enough
    bwd = backward.count - (previous ? countB : 0);
    fwd = forward.count - (previous ? countF : 0);
    const bwdDiff = bwd > 0 ? bufferSize - bwd : 0;
    const fwdDiff = fwd > 0 ? bufferSize - fwd : 0;
    if (bwdDiff > 0 && bwd > fwd) {
      backward.count += bwdDiff;
      forward.count = previous ? countF : forward.count;
    }
    if (fwdDiff > 0 && fwd >= bwd) {
      forward.count += fwdDiff;
      backward.count = previous ? countB : backward.count;
    }

    if (previous) {
      bwd = backward.count - countB;
      fwd = forward.count - countF;
      if (bwd > 0 && bwd > fwd) {
        backward.count = countB + bwd;
        forward.count = fwd > 0 ? countF : forward.count;
      }
      if (fwd > 0 && fwd >= bwd) {
        forward.count = countF + fwd;
        backward.count = bwd > 0 ? countB : backward.count;
      }
    }

    backward.index = startIndex - backward.count;
    forward.index = startIndex + forward.count - 1;

    const { defaultSize } = misc.scroller.buffer;
    backward.padding = 0;
    forward.padding = Math.max(0, viewportSize - forward.count * defaultSize);

    return itemsCounter;
  };

const testSetItemSizeCase: ItFuncConfig = settings => misc => done =>
  misc.scroller.state.cycle.busy.on(pending => {
    if (pending) {
      return;
    }
    const { fetch, clip } = misc.scroller.state;
    expect(misc.workflow.cyclesDone).toEqual(1);
    expect(fetch.callCount).toEqual(2);
    expect(misc.innerLoopCount).toEqual(3);
    expect(clip.callCount).toEqual(0);
    expect(misc.padding.backward.getSize()).toEqual(0);
    expect(misc.padding.forward.getSize()).toEqual(0);

    const startIndex = settings.datasourceSettings.startIndex as number;
    const tplSettings = settings.templateSettings || {};
    const itemSize = tplSettings[misc.horizontal ? 'itemWidth' : 'itemHeight'] as number;
    const itemsCounter = getSetItemSizeCounter(settings, misc, itemSize);
    testItemsCounter(startIndex, misc, itemsCounter);
    done();
  });

const testNotSetItemSizeCase: ItFuncConfig = settings => misc => done =>
  misc.scroller.state.cycle.innerLoop.busy.on(loopPending => {
    if (loopPending) {
      return;
    }
    const loopCount = misc.innerLoopCount;
    if (loopCount === 4) {
      expect(misc.workflow.cyclesDone).toEqual(0);
      expect(misc.scroller.state.fetch.callCount).toEqual(3);
      expect(misc.scroller.state.clip.callCount).toEqual(0);
      done();
      return;
    }
    let itemsCounter;
    const initialItemSize = settings.datasourceSettings.itemSize as number;
    const startIndex = settings.datasourceSettings.startIndex as number;
    const tplSettings = settings.templateSettings || {};
    const itemSize = tplSettings[misc.horizontal ? 'itemWidth' : 'itemHeight'] as number;
    if (loopCount === 1) {
      itemsCounter = getNotSetItemSizeCounter(settings, misc, initialItemSize);
    } else {
      itemsCounter = getNotSetItemSizeCounter(settings, misc, itemSize, misc.shared.itemsCounter as ItemsCounter);
    }
    testItemsCounter(startIndex, misc, itemsCounter);
    misc.shared.itemsCounter = itemsCounter;
  });

const testLackOfItemsOnFirstFetchCase: ItFuncConfig = config => misc => async done => {
  const unsubscribe = misc.scroller.state.cycle.innerLoop.busy.on(loopPending => {
    if (loopPending) {
      return;
    }
    unsubscribe();
    // when the first inner loop is done, the first visible item should not be shifted
    expect(misc.getScrollPosition()).toBe(misc.padding.backward.getSize());
    expect(misc.adapter.firstVisible.$index).toEqual(config.datasourceSettings.startIndex as number);
  });
  misc.scroller.state.cycle.busy.on(cyclePending => {
    if (cyclePending) {
      return;
    }
    expect(misc.adapter.firstVisible.$index).toEqual(config.datasourceSettings.startIndex as number);
    done();
  });
};

describe('Initial Load Spec', () => {

  describe('Fixed itemSize', () => {
    fixedItemSizeConfigList.forEach(config =>
      makeTest({
        config,
        title: 'should make 2 fetches to satisfy padding limits',
        it: testSetItemSizeCase(config)
      })
    );
    fixedItemSizeAndBigBufferSizeConfigList.forEach(config =>
      makeTest({
        config,
        title: 'should make 2 fetches to overflow padding limits (bufferSize is big enough)',
        it: testSetItemSizeCase(config)
      })
    );
  });

  describe('Tuned itemSize', () => {
    tunedItemSizeConfigList.forEach(config =>
      makeTest({
        config,
        title: 'should make 3 fetches to satisfy padding limits',
        it: testNotSetItemSizeCase(config)
      })
    );
    tunedItemSizeAndBigBufferSizeConfigList.forEach(config =>
      makeTest({
        config,
        title: 'should make 3 fetches to overflow padding limits (bufferSize is big enough)',
        it: testNotSetItemSizeCase(config)
      })
    );
  });

  describe('No itemSize', () => {
    noItemSizeConfigList.forEach(config =>
      makeTest({
        config,
        title: 'should make 3 fetches to satisfy padding limits',
        it: testNotSetItemSizeCase(config)
      })
    );
    noItemSizeAndBigBufferConfigList.forEach(config =>
      makeTest({
        config,
        title: 'should make 3 fetches to overflow padding limits (bufferSize is big enough)',
        it: testNotSetItemSizeCase(config)
      })
    );
  });

  describe('Lack of items after the 1st fetch', () =>
    lackOfItemsOnFirstFetchConfigList.forEach((config, i) =>
      makeTest({
        config,
        title: `should stretch the forward padding element (${i})`,
        it: testLackOfItemsOnFirstFetchCase(config)
      })
    )
  );

});


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Yagi Design</title>

Yagi Design

	Back to Designing and building a GSM antenna - Monopole Design

Yagi design

		A Yagi-Uda (Yagi) antenna is a directional antenna which is made up of of a dipole element with a reflector and one or more director elements.

Image ?: Main parts of yagi antenna.

		The Driven Element is a dipole which consists of two 1/4 wavelength elements.
		The Reflector is slightly bigger then the driven element and reflects the signal back towards the driven element.
		The Directors are slightly smaller then the driven element with each one being slightly smaller again as they move away from the driven element, the directors help to focus the signal giving it a higher gain.
		The main gain is directed in the same direction as the arrow.

		The design of a yagi antenna is much more complex and requires a lot more experimentation then a monopole antenna.
		I don't believe there is any known simple mathematical formula that can be used to design a yagi antenna.
		Am I correct?

		What we do have is a rule of thumb which gives a start pointing when designing a yagi antenna.
		The idea is to scale up the reflector element by about 5% over the driven element, and to scale down the first director elements by about 5%, and to scale down again by about 5% for each extra director.
		The spacing between each of the elements would be about 20% of a wavelength, these can also be scaled down for each director.

		Using this starting point you can adjusted each of the elements lengths and there offsets until you find the best preforming design.
		These adjustments can be easily and quickly made using antenna design software.

		The result of a number of days of tweaking lengths and offsets can be found in the following nec file, gsm-900_6element_yagi.nec.
		I also have other nec files for the different gsm bands, gsm-550_6element_yagi.nec, gsm-1800_6element_yagi.nec and gsm-1900_6element_yagi.nec.

		The animated image shows the radiation pattern of the antenna, the gain varies from just under 9 dB to over 10 dB over the frequency range 876 MHz to 960 MHz, covering the three main GSM-900 bands.
		The design also shows good VSWR (Voltage standing wave ratio) and F/B (Front to back) Ratio.

Image ?: Animated GSM-900 Yagi Radiation Pattern (876 MHz to 960 MHz).

		Some other useful sites with information on yagi design include, W4RNL - Antenna Articles,
		GM3SEK - VHF/UHF Long Yagi Workshop and
		K7MEM - VHF/UHF Yagi Antenna Design (design software written in JavaScript).

Construction

		There is room for flexibility in the construction techniques you can use.
		I experimented with different options for the beam including, drilling holes for the elements in wood and plastic (I was disappointed with the accuracy), using a custom printed circuit board (this worked for the prototype but would not be suitable for others to build).

		The technique I will show here uses solid brass rods of the elements and a wooden beam made in two half's.
		The two half's have small recesses which help hold the elements in place, and everything is permanently held together with strong glue.

Image ?: Yagi antenna showing each elements label.

Element details and lengths from GSM 900 antenna design

			Element Label
			Offset from Ref
			Element Length

			Ref
			0 mm
			171 mm

			DE
			41 mm
			149 mm (2 * 74.5 mm)

			D1
			79 mm
			132 mm

			D2
			144 mm
			127 mm

			D3
			204 mm
			120 mm

			D4
			258 mm
			114 mm

Materials (Image)

			1 @ 3 mm diameter Brass Road 850 mm in length (thick copper wire would be a suitable alternative)

			2 @ 10 mm rectangular Wooden Batten 400 mm in length

			1 @ 500 mm length of 50 Ohm coax cable and suitable SMA or N connector (I used Times Microwave LMR-195)

			1 @ GSM 900 template

			Adhesive tape

			Epoxy resin adhesive

			Cable ties

Tools (Image)

			Hacksaw

			Soldering iron and solder

			Drill with bits

			Selection of hand-file's

			Craft knife

			Rule and pencil

			(I would suggest these as the minimum tools but extra would be helpful such as a vice, etc)

Step 1

			To make the elements mark and cut the brass rod into seven pieces the required lengths are given in the table above and on the template sheet.
			Cut the elements slightly longer then needed and then file the ends down to the correct length.

Step 2

			Use the adhesive tape to stick each of the elements in the correct location on the template sheet.
			The two rods that make up the driven element need to have a small gap between them.

Step 3

			The next step is to make the beam which will hold all the element in the correct position.
			The idea is to make a recess for each of the elements and then glue them into position.

			Mark a line for each element, you can use the template as a guide.
			Saw into the wood about 1 mm in depth.
			Use a small round file to form a semicircle recess of the element.
			By making two half's the element can be tightly held in place.

Step 4

			Drill a hole in the driven element recess in one of the beam parts the same size as the coax cable diameter.
			Then Feed the coax through the hole.

			Using the craft knife trim about 15 mm of the plastic insulation from the coax.
			Unwrap the metal braid, twist and pull to one side, trim the excess and cut away the metal foil layer.
			Bend the center conductor to the opposite side.
			Make sure the center conductor doesn't touch the metal braid or metal foil.

Step 5

			File two flat surfaces about 5 mm long at the center of the drive element.
			Trim the twisted braid and center conductor to the correct length.
			Solder the twisted braid to one of the drive element rods and the center conductor to the other.
			Check to made sure that there is no bridged joint between the rods.

Step 6

			Mix up a small quaintly of the epoxy resin adhesive (follow the manufactures instructions for mixing and setting times).
			Place some of the adhesive into and coat each of the recesses on the drilled half of the beam.
			Place extra adhesive around the joint between the drive element rods.
			With the template on a flat surface, carefully place the drilled half of the beam onto template, use heavy objects to apply pressure while setting.
			Check that all the elements and beam are correctly positioned and leave to set.

Step 7

			Once the adhesive is set, remove the template and carefully remove any extra adhesive which may have accumulated around the elements.

Step 8

			Mix up a larger batch of the epoxy resin adhesive.
			This time apply a layer of the adhesive to the recesses and the two surfaces of the beams.
			Apply pressure using heavy objects or clamps, check the positioning and leave to set.

Step 9

			Once the adhesive is set use the cable ties to secure the coax cable.
			This forms a strain relief and protects the drive element joints from fatigue.

Image ?: The finished GSM-900 6 element yagi.

Antenna testing

		The following image (from a USRP) shows the difference between the monopole antenna and the yagi antenna for a weak BTS signal at 937.8 MHz.
		The monopole is on the left and the yagi on the right.

Image ?: Monopole vs Yagi, 937.8 MHz.

		From looking at the image I would suggest that in this test the yagi has between 4 and 6 dB gain over the monopole antenna.
		I think the main improvement is shown in the directionality.
		In the upper left a large signal is shown at about 1.2 MHz above the center frequency, in the upper right image this BTS signal is attenuated by about 15 dB.
		Though the signal at about 1.6 MHz seems to have had an increase in gain with the yagi antenna.

Image ?: Monopole vs Yagi, 941 MHz.

		The test in Image ? shows a local strong BTS signal but there is no noticeable improvement in the signal strength.

Image ?: Monopole vs Yagi, 953.6 MHz.

		The test in Image ? shows another BTS with a small improvement in signal gain, but quite a marked improvement with 4 BTS signals being significantly attenuated.

		For an absolute gain test you would need a signal generator, field strength meter and an RF shielded environment, which I don't have access to.
		Another option would be to do a test outside with clear light of sight between the test antenna and the BTS, I might look into this at some point.

Templates for other frequency's

		Europe, Middle East, Africa and most of Asia

		GSM 900 template

		GSM 1800 template

		Americas

		GSM 850 template

		GSM 1900 template

		All templates should print fine on ISO A4 or US Legal sized paper.

Conclusion

		The construction is relatively straight forward requiring only minimal materials and tools.
		I think this yagi antenna design offers some real advantages over the monopole antenna design or simple wire antenna.

	Back to Designing and building a GSM antenna - Monopole Design

	Last updated 2007-07-26.  Copyright © 2007 Robert Fitzsimons.  robfitz at 273k dot net


text:
'use strict';
var MACROUTILS = require( 'osg/Utils' );
var StateAttribute = require( 'osg/StateAttribute' );
var Vec4 = require( 'osg/Vec4' );
var Uniform = require( 'osg/Uniform' );
var Map = require( 'osg/Map' );

// Define a material attribute
var Material = function () {
    StateAttribute.call( this );
    this._ambient = [ 0.2, 0.2, 0.2, 1.0 ];
    this._diffuse = [ 0.8, 0.8, 0.8, 1.0 ];
    this._specular = [ 0.0, 0.0, 0.0, 1.0 ];
    this._emission = [ 0.0, 0.0, 0.0, 1.0 ];
    this._shininess = 12.5;
};

Material.prototype = MACROUTILS.objectLibraryClass( MACROUTILS.objectInherit( StateAttribute.prototype, {

    attributeType: 'Material',

    cloneType: function () {
        return new Material();
    },

    getParameterName: function ( name ) {
        return this.getType() + '_uniform_' + name;
    },

    getOrCreateUniforms: function () {
        var obj = Material;
        if ( obj.uniforms ) return obj.uniforms;

        var uniformList = {
            'ambient': Uniform.createFloat4( [ 0, 0, 0, 0 ], 'MaterialAmbient' ),
            'diffuse': Uniform.createFloat4( [ 0, 0, 0, 0 ], 'MaterialDiffuse' ),
            'specular': Uniform.createFloat4( [ 0, 0, 0, 0 ], 'MaterialSpecular' ),
            'emission': Uniform.createFloat4( [ 0, 0, 0, 0 ], 'MaterialEmission' ),
            'shininess': Uniform.createFloat1( [ 0 ], 'MaterialShininess' )
        };

        obj.uniforms = new Map( uniformList );
        return obj.uniforms;
    },

    setEmission: function ( a ) {
        Vec4.copy( a, this._emission );
        this._dirty = true;
    },

    getEmission: function () {
        return this._emission;
    },

    setAmbient: function ( a ) {
        Vec4.copy( a, this._ambient );
        this._dirty = true;
    },

    getAmbient: function () {
        return this._ambient;
    },

    setSpecular: function ( a ) {
        Vec4.copy( a, this._specular );
        this._dirty = true;
    },

    getSpecular: function () {
        return this._specular;
    },

    setDiffuse: function ( a ) {
        Vec4.copy( a, this._diffuse );
        this._dirty = true;
    },

    getDiffuse: function () {
        return this._diffuse;
    },

    setShininess: function ( a ) {
        this._shininess = a;
        this._dirty = true;
    },

    getShininess: function () {
        return this._shininess;
    },

    setTransparency: function ( a ) {
        this._diffuse[ 3 ] = 1.0 - a;
        this._dirty = true;
    },

    getTransparency: function () {
        return this._diffuse[ 3 ];
    },

    apply: function ( /*state*/) {
        var uniforms = this.getOrCreateUniforms();

        uniforms.ambient.set( this._ambient );
        uniforms.diffuse.set( this._diffuse );
        uniforms.specular.set( this._specular );
        uniforms.emission.set( this._emission );
        uniforms.shininess.set( [ this._shininess ] );

        this.setDirty( false );
    }

} ), 'osg', 'Material' );

module.exports = Material;


text:
<?php

namespace mpt\ShowsBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Httpfoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use JMS\SecurityExtraBundle\Annotation\Secure;
use mpt\ShowsBundle\Entity\Spectators;
use mpt\ShowsBundle\Form\Type\SpectatorType;
use mpt\ShowsBundle\Pagination\Paginator;
use Symfony\Component\HttpFoundation\Session\Session;

/**
 * Spectator controller.
 *
 */
class SpectatorController extends Controller {

    /**
     *
     * @Secure(roles="ROLE_USER")
     *
     */
    public function indexAction() {
        //var_dump($this);die;
        $em = $this->getDoctrine()->getManager();
        $entitiesLength = $em->getRepository('mptShowsBundle:Spectators')->counter();
        // $cities = $em->getRepository('mptShowsBundle:Person')->getCities();

        return $this->render('mptShowsBundle:Person:index.html.twig', array(
                    'entitiesLength' => $entitiesLength,
                    'create'=>false
                   ));
    }

    /**
     * Spectators list using ajax
     * @Secure(roles="ROLE_USER")
     */
    public function ajaxListAction(Request $request) {
        $em = $this->getDoctrine()->getManager();
        $searchParam = $request->get('searchParam');
        $entities = $em->getRepository('mptShowsBundle:Spectators')->search($searchParam);
        $pagination = (new Paginator())->setItems(count($entities), $searchParam['perPage'])->setPage($searchParam['page'])->toArray();
        return $this->render('mptShowsBundle:Person:ajax_list.html.twig', array(
                    'entities' => $entities,
                    'pagination' => $pagination,
        ));
    }

    /**
     * Creates a new Spectator entity.
     * @Secure(roles="ROLE_USER")
     */
    public function createAction(Request $request) {
        $entity = new Spectators();
        $form = $this->createForm(new SpectatorType(), $entity);
        $form->handleRequest($request);
        $em = $this->getDoctrine()->getManager();

        if ($form->isValid()) {
            $em->persist($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('info', "Le spectateur ".$entity->getAllName()." a été ajouté avec succès.");
            //return $this->redirect($this->generateUrl('spectator_view', array('id' => $entity->getId())));
            return $this->render('mptShowsBundle:Person:index.html.twig', array(
                                'create'=>true,
                                'entity'=>$entity

        ));
        }
        // $cities = $em->getRepository('mptShowsBundle:Person')->getCities();

        $this->get('session')->getFlashBag()->add('danger', "Les champs renseignés sont incorrects ");
        return $this->render('mptShowsBundle:Person:new.html.twig', array(
                    'entity' => $entity,
                    'form' => $form->createView(),
                    'create'=>true,
        ));
    }

    /**
     * Displays a form to create a new Spectator entity.
     * @Secure(roles="ROLE_USER")
     *
     */
    public function newAction() {
        $entity = new Spectators();
        $form = $this->createForm(new SpectatorType(), $entity);
        $em = $this->getDoctrine()->getManager();
        // $cities = $em->getRepository('mptShowsBundle:Person')->getCities();

        return $this->render('mptShowsBundle:Person:new.html.twig', array(
                    'entity' => $entity,
                    'form' => $form->createView(),
        ));
    }

    /**
     *
     * @Secure(roles="ROLE_USER")
     *
     */
    public function viewAction($id) {
        $session = new Session();
        $session->set('bookingRedirect', 'false');
        $cultural = $session->get('cultural');

        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('mptShowsBundle:Spectators')->find($id);

        $commands = $em
                ->getRepository('mptShowsBundle:CommandBooking')
                ->findBy(array('spectator' => $entity));

        $commandlines = $em
                ->getRepository('mptShowsBundle:CommandLine')
                ->searchAll($id, $cultural);

        $commandlinesSub = $em
                ->getRepository('mptShowsBundle:CommandLine')
                ->searchAllSub($id, $cultural);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Person entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return $this->render('mptShowsBundle:Person:view.html.twig', array(
                    'entity' => $entity,
                    'delete_form' => $deleteForm->createView(),
                    'commands' => $commands,
                    'perflines' => $commandlines,
                    'perflinessub' => $commandlinesSub,
                    'subscription'=> false
        ));
    }

    /**
     *
     * @Secure(roles="ROLE_USER")
     *
     */
    public function editAction($id) {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('mptShowsBundle:Spectators')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Spectator entity.');
        }
        $editForm = $this->createForm(new SpectatorType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        return $this->render('mptShowsBundle:Person:edit.html.twig', array(
                    'entity' => $entity,
                    'form' => $editForm->createView(),
                    'delete_form' => $deleteForm->createView(),

        ));
    }

    /**
     *
     * @Secure(roles="ROLE_USER")
     *
     */
    public function updateAction(Request $request, $id) {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('mptShowsBundle:Spectators')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Spectators entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createForm(new SpectatorType(), $entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            $this->get('session')->getFlashBag()->add('info', "Le spectateur a bien été modifié.");
            return $this->redirect($this->generateUrl('spectator', array('id' => $id)));
        }

        $this->get('session')->getFlashBag()->add('danger', "Il y a des erreurs dans le formulaire soumis !");
        return $this->render('mptShowsBundle:Person:edit.html.twig', array(
                    'entity' => $entity,
                    'form' => $editForm->createView(),
                    'delete_form' => $deleteForm->createView(),

        ));
    }

    /**
     * Deletes a Person entity.
     * @Secure(roles="ROLE_USER")
     *
     */
    public function deleteAction(Request $request, $id) {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('mptShowsBundle:Spectators')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Person entity.');
            }

            $em->remove($entity);
            $em->flush();
            $this->get('session')->getFlashBag()->add('info', "Le spectateur a bien été supprimé");
        }

        return $this->redirect($this->generateUrl('spectator'));
    }

    /*
     * @Secure(roles="ROLE_USER")
     *
     */
    public function duplicateAction($id) {
        $spectator = new Spectators();
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('mptShowsBundle:Spectators')->find($id);
        $spectator->setLastname($entity->getLastname())
                ->setFirstname($entity->getFirstname())
                ->setAddress($entity->getAddress())
                ->setCity($entity->getCity())
                ->setZipcode($entity->getZipcode())
                ->setMail($entity->getMail())
                ->setPhone($entity->getPhone())
                ->setMail($entity->getMail());

        $em->persist($spectator);
        $em->flush();

        $this->get('session')->getFlashBag()->add('info', "Le spectateur a été dupliqué avec succès.");
        return $this->redirect($this->generateUrl('spectator'));
    }

    /**
     * Creates a form to delete a Person entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id) {
        return $this->createFormBuilder(array('id' => $id))
                        ->add('id', 'hidden')
                        ->getForm()
        ;
    }

    /**
     * Deletes multiple entities
     * @Secure(roles="ROLE_USER")
     */
    public function removeAction(Request $request) {
        $ids = $request->get('entities');
        $em = $this->getDoctrine()->getManager();
        $entities = $em->getRepository('mptShowsBundle:Spectators')->search(array('ids' => $ids));
        foreach ($entities as $entity) {
            $em->remove($entity);
        }
        $em->flush();

        return new Response('1');
    }

    /**
     * Delete
     * @Secure(roles="ROLE_USER")
     */
    public function removeOneAction(Request $request) {
        //$session = new Session();
        $id = $request->get('id');
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('mptShowsBundle:Spectators')->find($id);

        $em->remove($entity);
        $em->flush();

        return $this->redirect($this->generateUrl('spectator'));
    }

}


text:
using System;
using System.Runtime.InteropServices;

namespace NAudio.Wave.Compression
{
    /// <summary>
    ///     Interop structure for ACM stream headers.
    ///     ACMSTREAMHEADER
    ///     http://msdn.microsoft.com/en-us/library/dd742926%28VS.85%29.aspx
    /// </summary>
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Size = 128)] // explicit size to make it work for x64
    internal class AcmStreamHeaderStruct
    {
        public int cbStruct;
        public AcmStreamHeaderStatusFlags fdwStatus = 0;
        public IntPtr userData;
        public IntPtr sourceBufferPointer;
        public int sourceBufferLength;
        public int sourceBufferLengthUsed;
        public IntPtr sourceUserData;
        public IntPtr destBufferPointer;
        public int destBufferLength;
        public int destBufferLengthUsed = 0;
        public IntPtr destUserData;

        // 10 reserved values follow this, we don't need to declare them
        // since we have set the struct size explicitly and don't
        // need to access them in client code (thanks Brian)
        /*public int reserved0;
        public int reserved1;
        public int reserved2;
        public int reserved3;
        public int reserved4;
        public int reserved5;
        public int reserved6;
        public int reserved7;
        public int reserved8;
        public int reserved9;*/
    }
}


text:
> A simple nginx configuration.

[![Build Status](http://ci.ldk.io/logankoester/chef-nginx/badge)](http://ci.ldk.io/logankoester/chef-nginx/)
[![Gittip](http://img.shields.io/gittip/logankoester.png)](https://www.gittip.com/logankoester/)

## Installation

Using [Berkshelf](http://berkshelf.com/), add the nginx cookbook to your Berksfile.

```ruby
cookbook 'nginx', github: 'logankoester/chef-nginx', branch: 'master'
```

Then run `berks` to install it.

## default recipe

Installs and starts nginx service.

### Usage

Add `recipe[nginx::default]` to your run list.

## php_fpm recipe

Installs php and php-fpm for nginx.

### Usage

Add `recipe[nginx::php_fpm]` to your run list.

## Attributes

Refer to `attributes/default.rb` for details.

## Development

You should have Ruby and Rubygems already installed.

    # Clone the repository
    $ git clone git@github.com:logankoester/chef-nginx.git
    $ cd chef-nginx

    # Install Ruby gem dependencies
    $ bundle install

    # Install with Berkshelf
    $ berks install

    # Start the Guard watcher
    $ bundle exec guard start

    # Edit files...
    # Spec and Foodcritic will verify your changes when a file is modified

## Author

Copyright (c) 2014-2016 [Logan Koester](http://logankoester.com). Released under the MIT license. See `LICENSE` for details.


text:
"use strict";
let datafire = require('datafire');
let openapi = require('./openapi.json');
module.exports = datafire.Integration.fromOpenAPI(openapi, "azure_resources_policydefinitions");


text:
package de.gishmo.gwt.example.module0801.client.widgets;

public interface ReverseView<T> {

  T getPresenter();

  void setPresenter(T presenter);

}


text:
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;

namespace Server.Guilds
{
	public class WarDeclarationGump : BaseGuildGump
	{
		private Guild m_Other;

		public WarDeclarationGump( PlayerMobile pm, Guild g, Guild otherGuild ) : base( pm, g )
		{
			m_Other = otherGuild;
			WarDeclaration war = g.FindPendingWar( otherGuild );

			AddPage( 0 );

			AddBackground( 0, 0, 500, 340, 0x24AE );
			AddBackground( 65, 50, 370, 30, 0x2486 );
			AddHtmlLocalized( 75, 55, 370, 26, 1062979, 0x3C00, false, false ); //
Declaration of War

			AddImage( 410, 45, 0x232C );
			AddHtmlLocalized( 65, 95, 200, 20, 1063009, 0x14AF, false, false ); // Duration of War
			AddHtmlLocalized( 65, 120, 400, 20, 1063010, 0x0, false, false ); // Enter the number of hours the war will last.
			AddBackground( 65, 150, 40, 30, 0x2486 );
			AddTextEntry( 70, 154, 50, 30, 0x481, 10, (war != null) ? war.WarLength.Hours.ToString() : "0" );
			AddHtmlLocalized( 65, 195, 200, 20, 1063011, 0x14AF, false, false ); // Victory Condition
			AddHtmlLocalized( 65, 220, 400, 20, 1063012, 0x0, false, false ); // Enter the winning number of kills.
			AddBackground( 65, 250, 40, 30, 0x2486 );
			AddTextEntry( 70, 254, 50, 30, 0x481, 11, (war != null) ? war.MaxKills.ToString() : "0" );
			AddBackground( 190, 270, 130, 26, 0x2486 );
			AddButton( 195, 275, 0x845, 0x846, 0, GumpButtonType.Reply, 0 );
			AddHtmlLocalized( 220, 273, 90, 26, 1006045, 0x0, false, false ); // Cancel
			AddBackground( 330, 270, 130, 26, 0x2486 );
			AddButton( 335, 275, 0x845, 0x846, 1, GumpButtonType.Reply, 0 );
			AddHtmlLocalized( 360, 273, 90, 26, 1062989, 0x5000, false, false ); // Declare War!
		}

		public override void OnResponse( NetState sender, RelayInfo info )
		{

			PlayerMobile pm = sender.Mobile as PlayerMobile;

			if( !IsMember( pm, guild ) )
				return;

			RankDefinition playerRank = pm.GuildRank;

			switch( info.ButtonID )
			{
				case 1:
				{
					AllianceInfo alliance = guild.Alliance;
					AllianceInfo otherAlliance = m_Other.Alliance;

					if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
					{
						pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
					}
					else if( alliance != null && alliance.Leader != guild )
					{
						pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
						pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
					}
					else if( otherAlliance != null && otherAlliance.Leader != m_Other )
					{
						pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", m_Other.Name, otherAlliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
						pm.SendLocalizedMessage( 1070707, otherAlliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
					}
					else
					{
						WarDeclaration activeWar = guild.FindActiveWar( m_Other );

						if( activeWar == null )
						{
							WarDeclaration war = guild.FindPendingWar( m_Other );
							WarDeclaration otherWar = m_Other.FindPendingWar( guild );

							//Note: OSI differs from what it says on website.  unlimited war = 0 kills/ 0 hrs.  Not > 999.  (sidenote: they both cap at 65535, 7.5 years, but, still.)
							TextRelay tKills = info.GetTextEntry( 11 );
							TextRelay tWarLength = info.GetTextEntry( 10 );

							int maxKills = (tKills == null)? 0 : Math.Max( Math.Min( Utility.ToInt32( info.GetTextEntry( 11 ).Text ), 0xFFFF ), 0 );
							TimeSpan warLength = TimeSpan.FromHours( (tWarLength == null) ? 0 : Math.Max( Math.Min( Utility.ToInt32( info.GetTextEntry( 10 ).Text ), 0xFFFF ), 0 ) );

							if( war != null )
							{
								war.MaxKills = maxKills;
								war.WarLength = warLength;
								war.WarRequester = true;
							}
							else
							{
								guild.PendingWars.Add( new WarDeclaration( guild, m_Other, maxKills, warLength, true ) );
							}

							if( otherWar != null )
							{
								otherWar.MaxKills = maxKills;
								otherWar.WarLength = warLength;
								otherWar.WarRequester = false;
							}
							else
							{
								m_Other.PendingWars.Add( new WarDeclaration( m_Other, guild, maxKills, warLength, false ) );
							}

							if( war != null )
							{
								pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated.
								//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal.
							}
							else
								m_Other.GuildMessage( 1070781, ((guild.Alliance != null ) ? guild.Alliance.Name : guild.Name ) ); // ~1_val~ has proposed a war.

							pm.SendLocalizedMessage( 1070751, ((m_Other.Alliance != null ) ? m_Other.Alliance.Name : m_Other.Name ) ); // War proposal has been sent to ~1_val~.
						}
					}
					break;
				}
				default:
				{
					pm.SendGump( new OtherGuildInfo( pm, guild, m_Other ) );
					break;
				}
			}
		}
	}
}


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Windows;
using System.Windows.Media;

namespace Cet.UI.Chart
{
    public abstract class ChartModelBase
        : ChartBaseVM
    {
        protected ChartModelBase()
        {
            this._plots = new ChartPlotCollection(this);
            this._axes = new ChartAxisCollection(this);
        }

        #region PROP IsValid

        private bool _isValid;

        public bool IsValid
        {
            get { return this._isValid; }
            private set
            {
                if (this._isValid != value)
                {
                    this._isValid = value;
                    this.OnPropertyChanged("IsValid");
                }
            }
        }

        #endregion

        #region PROP Plots

        private readonly ChartPlotCollection _plots;

        public ChartPlotCollection Plots
        {
            get { return this._plots; }
        }

        #endregion

        #region PROP Axes

        private readonly ChartAxisCollection _axes;

        public ChartAxisCollection Axes
        {
            get { return this._axes; }
        }

        #endregion

    }
}