text:
Output colorized string in terminal.

#### `bold`
``` purescript
bold :: String -> String
```

#### `dim`
``` purescript
dim :: String -> String
```

#### `italic`
``` purescript
italic :: String -> String
```

#### `underlined`
``` purescript
underlined :: String -> String
```

#### `blink`
``` purescript
blink :: String -> String
```

#### `overline`
``` purescript
overline :: String -> String
```

#### `reverse`
``` purescript
reverse :: String -> String
```

#### `hidden`
``` purescript
hidden :: String -> String
```

#### `strikeout`
``` purescript
strikeout :: String -> String
```

#### `black`
``` purescript
black :: String -> String
```

#### `red`
``` purescript
red :: String -> String
```

#### `green`
``` purescript
green :: String -> String
```

#### `yellow`
``` purescript
yellow :: String -> String
```

#### `blue`
``` purescript
blue :: String -> String
```

#### `magenta`
``` purescript
magenta :: String -> String
```

#### `cyan`
``` purescript
cyan :: String -> String
```

#### `lightGray`
``` purescript
lightGray :: String -> String
```

#### `darkGray`
``` purescript
darkGray :: String -> String
```

#### `lightRed`
``` purescript
lightRed :: String -> String
```

#### `lightGreen`
``` purescript
lightGreen :: String -> String
```

#### `lightYellow`
``` purescript
lightYellow :: String -> String
```

#### `lightBlue`
``` purescript
lightBlue :: String -> String
```

#### `lightMagenta`
``` purescript
lightMagenta :: String -> String
```

#### `lightCyan`
``` purescript
lightCyan :: String -> String
```

#### `white`
``` purescript
white :: String -> String
```

#### `bgBlack`
``` purescript
bgBlack :: String -> String
```

#### `bgRed`
``` purescript
bgRed :: String -> String
```

#### `bgGreen`
``` purescript
bgGreen :: String -> String
```

#### `bgYellow`
``` purescript
bgYellow :: String -> String
```

#### `bgBlue`
``` purescript
bgBlue :: String -> String
```

#### `bgMagenta`
``` purescript
bgMagenta :: String -> String
```

#### `bgCyan`
``` purescript
bgCyan :: String -> String
```

#### `bgLightGray`
``` purescript
bgLightGray :: String -> String
```

#### `bgDarkGray`
``` purescript
bgDarkGray :: String -> String
```

#### `bgLightRed`
``` purescript
bgLightRed :: String -> String
```

#### `bgLightGreen`
``` purescript
bgLightGreen :: String -> String
```

#### `bgLightYellow`
``` purescript
bgLightYellow :: String -> String
```

#### `bgLightBlue`
``` purescript
bgLightBlue :: String -> String
```

#### `bgLightMagenta`
``` purescript
bgLightMagenta :: String -> String
```

#### `bgLightCyan`
``` purescript
bgLightCyan :: String -> String
```

#### `bgWhite`
``` purescript
bgWhite :: String -> String
```

#### `color256`
``` purescript
color256 :: Int -> String -> String
```

#### `bg256`
``` purescript
bg256 :: Int -> String -> String
```


text:
package dk.statsbiblioteket.doms.updatetracker.improved;

import java.io.File;
import java.util.Properties;

public class UpdateTrackingConfig {
    /**
     * URL to fedora web frontend, ala http://localhost:7880/fedora/objects
     */
    protected static final String FEDORA_UPDATETRACKER_WEB_URL = "fedora.updatetracker.web.URL";
    /**
     * Username to the fedora web frontend. Do not need to change stuff, but must be able to read all
     * @see #FEDORA_UPDATETRACKER_WEB_PASSWORD
     */
    protected static final String FEDORA_UPDATETRACKER_WEB_USERNAME = "fedora.updatetracker.web.username";
    /**
     * Password to the fedora web frontend. Do not need to change stuff, but must be able to read all
     * * @see #FEDORA_UPDATETRACKER_WEB_USERNAME
     */
    protected static final String FEDORA_UPDATETRACKER_WEB_PASSWORD = "fedora.updatetracker.web.password";
    /**
     * The database driver to use when talking the worklog database
     * @see #FEDORA_WORKLOG_DATABASE_URL
     */
    protected static final String FEDORA_WORKLOG_DATABASE_DRIVER = "fedora.worklog.database.driver";
    /**
     * The jdbc url to fedoras fieldSearchDB, where the worklog is stored per default.
     */
    protected static final String FEDORA_WORKLOG_DATABASE_URL = "fedora.worklog.database.URL";
    /**
     * Readonly account to the fedora worklog database
     * @see #FEDORA_WORKLOG_DATABASE_URL
     */
    protected static final String FEDORA_WORKLOG_DATABASE_USERNAME = "fedora.worklog.database.username";
    /**
     * Readonly account to the fedora worklog database
     * @see #FEDORA_WORKLOG_DATABASE_URL
     */
    protected static final String FEDORA_WORKLOG_DATABASE_PASSWORD = "fedora.worklog.database.password";
    /**
     * The delay in starting polling the worklog when starting this service, in
     * milliseconds. Default 1000ms. Also the minimum age of events to work on.
     */
    protected static final String FEDORA_UPDATETRACKER_DELAY = "fedora.updatetracker.delay";
    /**
     * The frequency in milliseconds, which the worklog should be polled. Default 1000ms
     */
    protected static final String FEDORA_UPDATETRACKER_PERIOD = "fedora.updatetracker.period";
    /**
     * The pagesize to get from the worklog. Default 1000
     */
    protected static final String FEDORA_UPDATETRACKER_LIMIT = "fedora.updatetracker.limit";
    /**
     * The hibernate config file for the update tracker database
     */
    protected static final String FEDORA_UPDATETRACKER_HIBERNATE_CONFIG_FILE
            = "fedora.updatetracker.hibernateConfigFile";
    /**
     * The time a view bundle should remain cached. This is solely a memory issue, as the cache keys involve the view bundle timestamp
     */
    private static final java.lang.String FEDORA_UPDATETRACKER_VIEWBUNDLE_CACHETIME
            = "fedora.updatetracker.viewbundleCacheTime";
    /**
     * The hibernate mappings file for the update tracker database. It is this file that defines the indexes we use
     */
    private static final java.lang.String FEDORA_UPDATETRACKER_HIBERNATE_MAPPINGS_FILE
            = "fedora.updatetracker.hibernateMappingsFile";
    /**
     * The max number of threads to use when recalculating views.
     */
    private static final java.lang.String FEDORA_UPDATETRACKER_VIEWBUNDLE_MAXTHREADS
            = "fedora.updatetracker.viewbundleMaxThreads";

    private final String fedoraWebUrl;
    private final String fedoraWebUsername;
    private final String fedoraWebPassword;

    private final String fedoraDatabaseDriver;
    private final String fedoraDatabaseURL;
    private final String fedoraDatabaseUsername;
    private final String fedoraDatabasePassword;

    private final int fedoraUpdatetrackerDelay;
    private final int fedoraUpdatetrackerPeriod;
    private final int fedoraUpdatetrackerLimit;
    private final File updatetrackerHibernateConfig;
    private final long viewBundleCacheTime;
    private final File updatetrackerHibernateMappings;
    private Integer viewBundleMaxThreads;

    /**
     * Create a Config object from a java properties.
     *
     * As it stands, the listener will take at most "limit" workunits from the worklog, and play these against the update tracker for each "period". That means that if doms, on average, do more than limit / period (operations / second), the update tracker will never catch up.
     * @param properties
     * @see #FEDORA_UPDATETRACKER_WEB_URL
     * @see #FEDORA_UPDATETRACKER_WEB_USERNAME
     * @see #FEDORA_WORKLOG_DATABASE_PASSWORD
     * @see #FEDORA_WORKLOG_DATABASE_DRIVER
     * @see #FEDORA_WORKLOG_DATABASE_URL
     * @see #FEDORA_WORKLOG_DATABASE_USERNAME
     * @see #FEDORA_WORKLOG_DATABASE_PASSWORD
     * @see #FEDORA_UPDATETRACKER_HIBERNATE_CONFIG_FILE
     * @see #FEDORA_UPDATETRACKER_DELAY
     * @see #FEDORA_UPDATETRACKER_PERIOD
     * @see #FEDORA_UPDATETRACKER_LIMIT
     */
    public UpdateTrackingConfig(Properties properties) {

        this.fedoraWebUrl = properties.getProperty(FEDORA_UPDATETRACKER_WEB_URL);
        this.fedoraWebUsername = properties.getProperty(FEDORA_UPDATETRACKER_WEB_USERNAME);
        this.fedoraWebPassword = properties.getProperty(FEDORA_UPDATETRACKER_WEB_PASSWORD);
        this.fedoraDatabaseDriver = properties.getProperty(FEDORA_WORKLOG_DATABASE_DRIVER);
        this.fedoraDatabaseURL = properties.getProperty(FEDORA_WORKLOG_DATABASE_URL);
        this.fedoraDatabaseUsername = properties.getProperty(FEDORA_WORKLOG_DATABASE_USERNAME);
        this.fedoraDatabasePassword = properties.getProperty(FEDORA_WORKLOG_DATABASE_PASSWORD);
        this.fedoraUpdatetrackerDelay = Integer.parseInt(properties.getProperty(FEDORA_UPDATETRACKER_DELAY, "1000"));
        this.fedoraUpdatetrackerPeriod = Integer.parseInt(properties.getProperty(FEDORA_UPDATETRACKER_PERIOD,"1000"));
        this.fedoraUpdatetrackerLimit = Integer.parseInt(properties.getProperty(FEDORA_UPDATETRACKER_LIMIT,"1000"));
        this.updatetrackerHibernateConfig = new File(properties.getProperty(FEDORA_UPDATETRACKER_HIBERNATE_CONFIG_FILE));
        this.updatetrackerHibernateMappings = new File(properties
                                                             .getProperty(FEDORA_UPDATETRACKER_HIBERNATE_MAPPINGS_FILE));
        this.viewBundleCacheTime = Long.parseLong(
                properties.getProperty(FEDORA_UPDATETRACKER_VIEWBUNDLE_CACHETIME, "10000"));
        this.viewBundleMaxThreads = Integer.parseInt(properties.getProperty(FEDORA_UPDATETRACKER_VIEWBUNDLE_MAXTHREADS));
    }

    public String getFedoraWebUrl() {
        return fedoraWebUrl;
    }

    public String getFedoraWebUsername() {
        return fedoraWebUsername;
    }

    public String getFedoraWebPassword() {
        return fedoraWebPassword;
    }

    public String getFedoraDatabaseURL() {
        return fedoraDatabaseURL;
    }

    public String getFedoraDatabaseUsername() {
        return fedoraDatabaseUsername;
    }

    public String getFedoraDatabasePassword() {
        return fedoraDatabasePassword;
    }

    public int getFedoraUpdatetrackerDelay() {
        return fedoraUpdatetrackerDelay;
    }

    public int getFedoraUpdatetrackerPeriod() {
        return fedoraUpdatetrackerPeriod;
    }

    public int getFedoraUpdatetrackerLimit() {
        return fedoraUpdatetrackerLimit;
    }

    public String getFedoraDatabaseDriver() {
        return fedoraDatabaseDriver;
    }

    public File getUpdatetrackerHibernateConfig() {
        return updatetrackerHibernateConfig;
    }

    public Long getViewBundleCacheTime() {
        return viewBundleCacheTime;
    }

    public File getUpdatetrackerHibernateMappings() {
        return updatetrackerHibernateMappings;
    }

    public Integer getViewBundleMaxThreads() {
        return viewBundleMaxThreads;
    }
}

redpajama_set_name: RedPajamaGithub


text:
/** @file
    @brief Implementation

    @date 2015

    @author
    Russ Taylor working through ReliaSolve for Sensics.
    Sensics, Inc.
    <http://sensics.com/osvr>
*/

// Copyright 2015 Sensics, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Internal Includes
#include <osvr/Util/WideToUTF8.h>
#include "directx_camera_server.h"
#include "WinVariant.h"

// Library/third-party includes
// - none

// Standard includes
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <cmath>
#include <iostream>

// Uncomment to get a full device name and path listing in enumeration, instead
// of silently enumerating and early-exiting when we find one we like.
//#define VERBOSE_ENUM

//#define HACK_TO_REOPEN
//#define	DEBUG

/// @brief Checks something to see if it's false-ish, printing a message and
/// throwing an exception if it is.
template <typename T>
inline void checkForConstructionError(T const &ptr, const char objName[]) {
    if (!ptr) {
        fprintf(stderr, "directx_camera_server: Can't create %s\n", objName);
        throw ConstructionError(objName);
    }
}

/// @brief Computes bytes required for an UNCOMPRESSED RGB DIB
inline DWORD dibsize(BITMAPINFOHEADER const &bi) {
    // cf:
    // https://msdn.microsoft.com/en-us/library/windows/desktop/dd318229(v=vs.85).aspx
    auto stride = ((((bi.biWidth * bi.biBitCount) + 31) & ~31) >> 3);
    return stride * std::abs(bi.biHeight);
}

ComInit::ComInit() {
    auto hr = CoInitialize(nullptr);
    if (FAILED(hr)) {
        throw std::runtime_error("Could not initialize COM!");
    }
}

ComInit::~ComInit() { CoUninitialize(); }

// This class is used to handle callbacks from the SampleGrabber filter.  It
// grabs each sample and holds onto it until the camera server that is
// associated with the object comes and gets it.  The callback method in this
// class is called in another thread, so its methods need to be guarded with
// semaphores.

class directx_samplegrabber_callback : public ISampleGrabberCB {
  public:
    directx_samplegrabber_callback(void);
    ~directx_samplegrabber_callback(void);

    void shutdown(void) {
        _stayAlive = false;
        Sleep(100);
    }

    // Boolean flag telling whether there is a sample in the image
    // buffer ready for the application thread to consume.  Set to
    // true by the callback when there is an image there, and back
    // to false by the application thread when it reads the image.
    // XXX This should be done using a semaphore to avoid having
    // to poll in the application.
    bool imageReady; //< true when there is an image ready to be processed

    // Boolean flag telling whether the app is done processing the image
    // buffer so that the callback thread can return it to the filter graph.
    // Set to true by the application when it finishes, and back
    // to false by the callback thread when it gets a new image.
    // XXX This should be done using a semaphore to avoid having
    // to poll in the callback thread.
    bool imageDone; //< true when the app has finished processing an image

    // A pointer to the image sample that has been passed to the sample
    // grabber callback handler.
    IMediaSample *imageSample;

    // These three methods must be defined because of the IUnknown parent class.
    // XXX The first two are a hack to pretend that we are doing reference
    // counting; this object must last longer than the sample grabber it is
    // connected to in order to avoid segmentations faults.
    STDMETHODIMP_(ULONG) AddRef(void) { return 1; }
    STDMETHODIMP_(ULONG) Release(void) { return 2; }
    STDMETHOD(QueryInterface)
    (REFIID interfaceRequested, void **handleToInterfaceRequested);

    // One of the following two methods must be defined do to the
    // ISampleGraberCB parent class; this is the way we hear from the grabber.
    // We implement the one that gives us unbuffered access.  Be sure to turn
    // off buffering in the SampleGrabber that is associated with this callback
    // handler.
    STDMETHODIMP BufferCB(double, BYTE *, long) { return E_NOTIMPL; }
    STDMETHOD(SampleCB)(double time, IMediaSample *sample);

  protected:
    BITMAPINFOHEADER _bitmapInfo; //< Describes format of the bitmap
    bool _stayAlive;              //< Tells all threads to exit
};

//-----------------------------------------------------------------------
// Helper functions for editing the filter graph:

static WinPtr<IPin> GetPin(IBaseFilter &pFilter, PIN_DIRECTION const PinDir) {
    auto pEnum = WinPtr<IEnumPins>{};
    pFilter.EnumPins(AttachPtr(pEnum));
    auto pPin = WinPtr<IPin>{};
    while (pEnum->Next(1, AttachPtr(pPin), nullptr) == S_OK) {
        PIN_DIRECTION PinDirThis;
        pPin->QueryDirection(&PinDirThis);
        if (PinDir == PinDirThis) {
            return pPin;
        }
    }
    return WinPtr<IPin>{};
}

static HRESULT ConnectTwoFilters(IGraphBuilder &pGraph, IBaseFilter &pFirst,
                                 IBaseFilter &pSecond) {
    auto pOut = GetPin(pFirst, PINDIR_OUTPUT);
    auto pIn = GetPin(pSecond, PINDIR_INPUT);
    return pGraph.Connect(pOut.get(), pIn.get());
}

//-----------------------------------------------------------------------

/** The first time we are called, start the filter graph running in continuous
    mode and grab the first image that comes out.  Later times, grab each new
    image as it comes.  The "mode" parameter tells what mode we are in:
      Mode 0 = Run()
      Mode 1 = Pause()
    */
bool directx_camera_server::read_one_frame(unsigned minX, unsigned maxX,
                                           unsigned minY, unsigned maxY,
                                           unsigned exposure_millisecs) {
    HRESULT hr;

    if (!_status) {
        return false;
    };

#ifdef HACK_TO_REOPEN
    open_and_find_parameters();
    _started_graph = false;
#endif

    // If we have not yet started the media graph running, set up the callback
    // handler for the sample grabber filter so that we will hear about each
    // frame
    // as it comes in.  Then set the filter graph running.
    if (!_started_graph) {
        // Set the grabber do not do one-shot mode because that would cause
        // it to stop the filter graph after a single frame is captured.
        _pGrabber->SetOneShot(FALSE);

        // Set the grabber to not do buffering mode, because we've not
        // implemented
        // the handler for buffered callbacks.
        _pGrabber->SetBufferSamples(FALSE);

        // Run the graph and wait until it captures a frame into its buffer
        switch (_mode) {
        case 0: // Case 0 = run
            hr = _pMediaControl->Run();
            break;
        case 1: // Case 1 = paused
            hr = _pMediaControl->Pause();
            break;
        default:
            fprintf(
                stderr,
                "directx_camera_server::read_one_frame(): Unknown mode (%d)\n",
                _mode);
            _status = false;
            return false;
        }
        if ((hr != S_OK) && (hr != S_FALSE)) {
            fprintf(stderr, "directx_camera_server::read_one_frame(): Can't "
                            "run filter graph\n");
            _status = false;
            return false;
        }

        _started_graph = true;
    }

    // XXX Should the app be allowed to set the timeout period?
    const int TIMEOUT_MSECS = 500;

    // Wait until there is a sample ready in the callback handler.  If there is,
    // copy it into our buffer and then tell it we are done processing the
    // sample.
    // If it takes too long, time out.
    BYTE *imageLocation;
    if (!_pCallback->imageReady) {
        for (int i = 0; i < TIMEOUT_MSECS; i++) {
            vrpn_SleepMsecs(1);
            if (_pCallback->imageReady) {
                break;
            } // Break out of the wait if its ready
        }
        if (!_pCallback->imageReady) {
#ifdef DEBUG
            fprintf(stderr, "directx_camera_server::read_one_frame(): Timeout "
                            "when reading image\n");
#endif
            return false;
        }
    }

    // If we are in mode 2, then we pause the graph after we captured one image.
    if (_mode == 2) {
        _pMediaControl->Pause();
        _mode = 1;
    }

    if (_pCallback->imageReady) {
        _pCallback->imageReady = false;
        if (FAILED(_pCallback->imageSample->GetPointer(&imageLocation))) {
            fprintf(
                stderr,
                "directx_camera_server::read_one_frame(): Can't get buffer\n");
            _status = false;
            _pCallback->imageDone = true;
            return false;
        }
        // Step through each line of the video and copy it into the buffer.  We
        // do one line at a time here because there can be padding at the end of
        // each line on some video formats.
        for (DWORD iRow = 0; iRow < _num_rows; iRow++) {
            memcpy(_buffer + _num_columns * 3 * iRow,
                   imageLocation + _stride * iRow, _num_columns * 3);
        }
        _pCallback->imageDone = true;
    }

#ifdef HACK_TO_REOPEN
    close_device();
#endif

// Capture timing information and print out how many frames per second
// are being received.

#if 0
  { static struct timeval last_print_time;
    struct timeval now;
    static bool first_time = true;
    static int frame_count = 0;

    if (first_time) {
      gettimeofday(&last_print_time, nullptr);
      first_time = false;
    } else {
      static	unsigned  last_r = 10000;
      frame_count++;
      gettimeofday(&now, nullptr);
      double timesecs = 0.001 * vrpn_TimevalMsecs(vrpn_TimevalDiff(now, last_print_time));
      if (timesecs >= 5) {
	double frames_per_sec = frame_count / timesecs;
	frame_count = 0;
	printf("Received frames per second = %lg\n", frames_per_sec);
	last_print_time = now;
      }
    }
  }
#endif

    return true;
}

inline std::string getProperty(IMoniker &mon, const wchar_t *propName) {

    auto pPropBag = WinPtr<IPropertyBag>{};
    mon.BindToStorage(nullptr, nullptr, IID_IPropertyBag, AttachPtr(pPropBag));

    auto ret = std::string{};
    if (!pPropBag) {
#ifdef DEBUG
        std::cerr << "Could not get the property bag" << std::endl;
#endif
        return ret;
    }
    auto val = WinVariant{};
    pPropBag->Read(propName, AttachVariant(val), nullptr);
    if (!contains<std::wstring>(val)) {
#ifdef DEBUG
        std::cerr << "!contains<std::wstring>(val) for property "
                  << osvr::util::wideToUTF8String(propName) << std::endl;
#endif
        return ret;
    }
    return osvr::util::wideToUTF8String(get<std::wstring>(val));
}

inline std::string getDevicePath(IMoniker &mon) {
    return getProperty(mon, L"DevicePath");
}

inline std::string getDeviceHumanDesc(IMoniker &mon) {
    auto desc = getProperty(mon, L"Description");
    if (desc.empty()) {
        desc = getProperty(mon, L"FriendlyName");
    }
    return desc;
}

bool directx_camera_server::start_com_and_graphbuilder() {
    HRESULT hr;
//-------------------------------------------------------------------
// Create COM and DirectX objects needed to access a video stream.

// Initialize COM.  This must have a matching uninitialize somewhere before
// the object is destroyed.
#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "CoInitialize\n");
#endif

    _com = ComInit::init();
// Create the filter graph manager
#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "CoCreateInstance FilterGraph\n");
#endif
    CoCreateInstance(CLSID_FilterGraph, nullptr, CLSCTX_INPROC_SERVER,
                     IID_IGraphBuilder, AttachPtr(_pGraph));
    checkForConstructionError(_pGraph, "graph manager");

    _pGraph->QueryInterface(IID_IMediaControl, AttachPtr(_pMediaControl));
    _pGraph->QueryInterface(IID_IMediaEvent, AttachPtr(_pEvent));

// Create the Capture Graph Builder.
#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "CoCreateInstance CaptureGraphBuilder2\n");
#endif
    CoCreateInstance(CLSID_CaptureGraphBuilder2, nullptr, CLSCTX_INPROC,
                     IID_ICaptureGraphBuilder2, AttachPtr(_pBuilder));
    checkForConstructionError(_pBuilder, "graph builder");

// Associate the graph with the builder.
#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "SetFilterGraph\n");
#endif
    _pBuilder->SetFiltergraph(_pGraph.get());
    return true;
}

// Enumerates the capture devices available, returning the first one where the
// passed functor (taking IMoniker& as a param) returns true.
template <typename F>
inline WinPtr<IMoniker> find_first_capture_device_where(F &&f) {
    auto ret = WinPtr<IMoniker>{};
// Create the system device enumerator.
#ifdef DEBUG
    printf("find_first_capture_device_where(): Before "
           "CoCreateInstance SystemDeviceEnum\n");
#endif
    auto pDevEnum = WinPtr<ICreateDevEnum>{};
    CoCreateInstance(CLSID_SystemDeviceEnum, nullptr, CLSCTX_INPROC,
                     IID_ICreateDevEnum, AttachPtr(pDevEnum));
    checkForConstructionError(pDevEnum, "device enumerator");

// Create an enumerator for video capture devices.
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd407292(v=vs.85).aspx
#ifdef DEBUG
    printf("find_first_capture_device_where(): Before "
           "CreateClassEnumerator\n");
#endif
    auto pClassEnum = WinPtr<IEnumMoniker>{};
    pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
                                    AttachPtr(pClassEnum), 0);
    checkForConstructionError(pClassEnum, "video enumerator (no cameras?)");

#ifdef DEBUG
    printf("find_first_capture_device_where(): Before Loop "
           "over enumerators\n");
#endif
// see
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd377566(v=vs.85).aspx
// for how to choose a camera
#ifdef VERBOSE_ENUM
    printf("\ndirectx_camera_server find_first_capture_device_where(): "
           "Beginning enumeration of video capture devices.\n\n");
#endif
    auto pMoniker = WinPtr<IMoniker>{};
    while (pClassEnum->Next(1, AttachPtr(pMoniker), nullptr) == S_OK) {

#ifdef VERBOSE_ENUM
        printf("- '%s' at path:\n  '%s'\n\n", getDeviceHumanDesc(*pMoniker).c_str(),
               getDevicePath(*pMoniker).c_str());
#endif // VERBOSE_ENUM

        if (!ret && f(*pMoniker)) {
            ret = pMoniker;
#ifdef VERBOSE_ENUM
            printf("^^ Accepted that device! (Would have exited "
                   "enumeration here if VERBOSE_ENUM were not defined)\n\n");
#else // !VERBOSE_ENUM
            return ret; // Early out if we find it and we're not in verbose enum
                        // mode.
#endif
        }
    }

#ifdef VERBOSE_ENUM
    printf("\ndirectx_camera_server find_first_capture_device_where(): End enumeration.\n\n");
#endif

    if (!ret) {
        fprintf(stderr,
                "directx_camera_server find_first_capture_device_where(): "
                "No device satisfied the predicate.\n");
    }
    return ret;
}

//---------------------------------------------------------------------
// Open the camera specified and determine its available features and
// parameters.

bool directx_camera_server::open_and_find_parameters(const int which,
                                                     unsigned width,
                                                     unsigned height) {
    auto graphbuilderRet = start_com_and_graphbuilder();
    if (!graphbuilderRet) {
        return false;
    }
    std::size_t i = 0;

    auto pMoniker = find_first_capture_device_where([&i, which](IMoniker &) {
        if (i == which) {
            return true;
        }
        ++i;
        return false;
    });

    if (!pMoniker) {
        fprintf(stderr, "directx_camera_server::open_and_find_parameters(): "
                        "Could not get the device requested - not enough "
                        "cameras?\n");
        return false;
    }
#ifdef DEBUG
    std::cout << "directx_camera_server::open_and_find_parameters(): Accepted!"
              << std::endl;
#endif
    return open_moniker_and_finish_setup(pMoniker, width, height);
}

bool directx_camera_server::open_and_find_parameters(
    std::string const &pathPrefix, unsigned width, unsigned height) {
    auto graphbuilderRet = start_com_and_graphbuilder();
    if (!graphbuilderRet) {
        return false;
    }

    auto pMoniker =
        find_first_capture_device_where([&pathPrefix](IMoniker &mon) {
            auto path = getDevicePath(mon);
            if (path.length() < pathPrefix.length()) {
                return false;
            }
            return (path.substr(0, pathPrefix.length()) == pathPrefix);
        });

    if (!pMoniker) {
        fprintf(stderr, "directx_camera_server::open_and_find_parameters(): "
                        "Could not get the device requested - not enough "
                        "cameras?\n");
        return false;
    }

#ifdef DEBUG
    std::cout << "directx_camera_server::open_and_find_parameters(): Accepted!"
              << std::endl;
#endif
    return open_moniker_and_finish_setup(pMoniker, width, height);
}

bool directx_camera_server::open_moniker_and_finish_setup(
    WinPtr<IMoniker> pMoniker, unsigned width, unsigned height) {

    if (!pMoniker) {
        fprintf(stderr,
                "directx_camera_server::open_moniker_and_finish_setup(): "
                "Null device moniker passed: no device found?\n");
        return false;
    }

    printf("directx_camera_server: Using capture device '%s' at path '%s'\n",
           getDeviceHumanDesc(*pMoniker).c_str(),
           getDevicePath(*pMoniker).c_str());

    // Bind the chosen moniker to a filter object.
    auto pSrc = WinPtr<IBaseFilter>{};
    pMoniker->BindToObject(0, 0, IID_IBaseFilter, AttachPtr(pSrc));

    //-------------------------------------------------------------------
    // Construct the sample grabber callback handler that will be used
    // to receive image data from the sample grabber.
    _pCallback.reset(new directx_samplegrabber_callback());

//-------------------------------------------------------------------
// Construct the sample grabber that will be used to snatch images from
// the video stream as they go by.  Set its media type and callback.

// Create the Sample Grabber.
#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "CoCreateInstance SampleGrabber\n");
#endif
    CoCreateInstance(CLSID_SampleGrabber, nullptr, CLSCTX_INPROC_SERVER,
                     IID_IBaseFilter, AttachPtr(_pSampleGrabberFilter));
    checkForConstructionError(_pSampleGrabberFilter,
                              "SampleGrabber filter (not DirectX 8.1+?)");

#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "QueryInterface\n");
#endif
    _pSampleGrabberFilter->QueryInterface(IID_ISampleGrabber,
                                          AttachPtr(_pGrabber));

// Set the media type to video
#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "SetMediaType\n");
#endif
    AM_MEDIA_TYPE mt = {0};
    // Ask for video media producers that produce 8-bit RGB
    mt.majortype = MEDIATYPE_Video;  // Ask for video media producers
    mt.subtype = MEDIASUBTYPE_RGB24; // Ask for 8 bit RGB
    _pGrabber->SetMediaType(&mt);

    //-------------------------------------------------------------------
    // Ask for the video resolution that has been passed in.
    // This code is based on
    // intuiting that we need to use the SetFormat call on the IAMStreamConfig
    // interface; this interface is described in the help pages.
    // If the width and height are specified as 0, then they are not set
    // in the header, letting them use whatever is the default.
    if ((width != 0) && (height != 0)) {
        _pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,
                                 pSrc.get(), IID_IAMStreamConfig,
                                 AttachPtr(_pStreamConfig));
        checkForConstructionError(_pStreamConfig, "StreamConfig interface");

        ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
        mt.majortype = MEDIATYPE_Video;  // Ask for video media producers
        mt.subtype = MEDIASUBTYPE_RGB24; // Ask for 8 bit RGB
        VIDEOINFOHEADER vih = {0};
        mt.pbFormat = reinterpret_cast<BYTE *>(&vih);
        auto pVideoHeader = &vih;
        pVideoHeader->bmiHeader.biBitCount = 24;
        pVideoHeader->bmiHeader.biWidth = width;
        pVideoHeader->bmiHeader.biHeight = height;
        pVideoHeader->bmiHeader.biPlanes = 1;
        pVideoHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
        pVideoHeader->bmiHeader.biSizeImage = dibsize(pVideoHeader->bmiHeader);

        // Set the format type and size.
        mt.formattype = FORMAT_VideoInfo;
        mt.cbFormat = sizeof(VIDEOINFOHEADER);

        // Set the sample size.
        mt.bFixedSizeSamples = TRUE;
        mt.lSampleSize = dibsize(pVideoHeader->bmiHeader);

        // Make the call to actually set the video type to what we want.
        if (_pStreamConfig->SetFormat(&mt) != S_OK) {
            fprintf(stderr, "directx_camera_server::open_and_find_parameters():"
                            " Can't set resolution to %dx%d using uncompressed "
                            "24-bit video\n",
                    pVideoHeader->bmiHeader.biWidth,
                    pVideoHeader->bmiHeader.biHeight);
            return false;
        }
    }

//-------------------------------------------------------------------
// Create a null renderer that will be used to discard the video frames
// on the output pin of the sample grabber

#ifdef DEBUG
    printf("directx_camera_server::open_and_find_parameters(): Before "
           "CoCreateInstance nullptrRenderer\n");
#endif
    auto pNullRender = WinPtr<IBaseFilter>{};
    CoCreateInstance(CLSID_NullRenderer, nullptr, CLSCTX_INPROC_SERVER,
                     IID_IBaseFilter, AttachPtr(pNullRender));

    //-------------------------------------------------------------------
    // Build the filter graph.  First add the filters and then connect them.

    // pSrc is the capture filter for the video device we found above.
    _pGraph->AddFilter(pSrc.get(), L"Video Capture");

    // Add the sample grabber filter
    _pGraph->AddFilter(_pSampleGrabberFilter.get(), L"SampleGrabber");

    // Add the null renderer filter
    _pGraph->AddFilter(pNullRender.get(), L"NullRenderer");

    // Connect the output of the video reader to the sample grabber input
    ConnectTwoFilters(*_pGraph, *pSrc, *_pSampleGrabberFilter);

    // Connect the output of the sample grabber to the null renderer input
    ConnectTwoFilters(*_pGraph, *_pSampleGrabberFilter, *pNullRender);

    //-------------------------------------------------------------------
    // XXX See if this is a video tuner card by querying for that interface.
    // Set it to read the video channel if it is one.
    auto pTuner = WinPtr<IAMTVTuner>{};
    auto hr = _pBuilder->FindInterface(nullptr, nullptr, pSrc.get(),
                                       IID_IAMTVTuner, AttachPtr(pTuner));
    if (pTuner) {
#ifdef DEBUG
        printf("directx_camera_server::open_and_find_parameters(): Found a TV "
               "Tuner!\n");
#endif

        // XXX Put code here.
        // Set the first input pin to use the cable as input
        hr = pTuner->put_InputType(0, TunerInputCable);
        if (FAILED(hr)) {
            fprintf(stderr, "directx_camera_server::open_and_find_parameters():"
                            " Can't set input to cable\n");
        }

        // Set the channel on the video to be baseband (is this channel zero?)
        hr = pTuner->put_Channel(0, -1, -1);
        if (FAILED(hr)) {
            fprintf(stderr, "directx_camera_server::open_and_find_parameters():"
                            " Can't set channel\n");
        }
    }

    //-------------------------------------------------------------------
    // Find _num_rows and _num_columns in the video stream.
    _pGrabber->GetConnectedMediaType(&mt);
    VIDEOINFOHEADER *pVih;
    if (mt.formattype == FORMAT_VideoInfo ||
        mt.formattype == FORMAT_VideoInfo2) {
        pVih = reinterpret_cast<VIDEOINFOHEADER *>(mt.pbFormat);
    } else {
        fprintf(stderr, "directx_camera_server::open_and_find_parameters(): "
                        "Can't get video header type\n");
        fprintf(stderr, "  (Expected %x or %x, got %x)\n", FORMAT_VideoInfo,
                FORMAT_VideoInfo2, mt.formattype);
        fprintf(stderr, "  (GetConnectedMediaType is not valid for DirectX "
                        "headers later than version 7)\n");
        fprintf(stderr, "  (We need to re-implement reading video in some "
                        "other interface)\n");
        return false;
    }

    // Number of rows and columns.  This is different if we are using a target
    // rectangle (rcTarget) than if we are not.
    if (IsRectEmpty(&pVih->rcTarget)) {
        _num_columns = pVih->bmiHeader.biWidth;
        _num_rows = pVih->bmiHeader.biHeight;
    } else {
        _num_columns = pVih->rcTarget.right;
        _num_rows = pVih->bmiHeader.biHeight;
        printf("XXX directx_camera_server::open_and_find_parameters(): "
               "Warning: may not work correctly with target rectangle\n");
    }
#ifdef DEBUG
    printf("Got %dx%d video\n", _num_columns, _num_rows);
#endif

    // Make sure that the image is not compressed and that we have 8 bits
    // per pixel.
    if (pVih->bmiHeader.biCompression != BI_RGB) {
        fprintf(stderr, "directx_camera_server::open_and_find_parameters(): "
                        "Compression not RGB\n");
        switch (pVih->bmiHeader.biCompression) {
        case BI_RLE8:
            fprintf(stderr, "  (It is BI_RLE8)\n");
            break;
        case BI_RLE4:
            fprintf(stderr, "  (It is BI_RLE4)\n");
        case BI_BITFIELDS:
            fprintf(stderr, "  (It is BI_BITFIELDS)\n");
            break;
        default:
            fprintf(stderr, "  (Unknown compression type)\n");
        }
        return false;
    }
    int BytesPerPixel = pVih->bmiHeader.biBitCount / 8;
    if (BytesPerPixel != 3) {
        fprintf(stderr, "directx_camera_server::open_and_find_parameters(): "
                        "Not 3 bytes per pixel (%d)\n",
                pVih->bmiHeader.biBitCount);
        return false;
    }

    // A negative height indicates that the images are stored non-inverted in Y
    // Not sure what to do with images that have negative height -- need to
    // read the book some more to find out.
    if (_num_rows < 0) {
        fprintf(stderr, "directx_camera_server::open_and_find_parameters(): "
                        "Num Rows is negative (internal error)\n");
        return false;
    }

    // Find the stride to take when moving from one row of video to the
    // next.  This is rounded up to the nearest DWORD.
    _stride = (_num_columns * BytesPerPixel + 3) & ~3;

    // Set the callback, where '0' means 'use the SampleCB callback'
    _pGrabber->SetCallback(_pCallback.get(), 0);

    return true;
}

/// Construct but do not open a camera
directx_camera_server::directx_camera_server() {
    // No image in memory yet.
    _minX = _maxX = _minY = _maxY = 0;
}

/// Open nth available camera with specified resolution.
directx_camera_server::directx_camera_server(int which, unsigned width,
                                             unsigned height) {
    //---------------------------------------------------------------------
    if (!open_and_find_parameters(which, width, height)) {
        fprintf(stderr, "directx_camera_server::directx_camera_server(): "
                        "Cannot open camera\n");
        _status = false;
        return;
    }

    //---------------------------------------------------------------------
    // Allocate a buffer that is large enough to read the maximum-sized
    // image with no binning.
    _buflen =
        (unsigned)(_num_rows * _num_columns * 3); // Expect B,G,R; 8-bits each.
    if ((_buffer = new unsigned char[_buflen]) == nullptr) {
        fprintf(stderr, "directx_camera_server::directx_camera_server(): Out "
                        "of memory for buffer\n");
        _status = false;
        return;
    }
    // No image in memory yet.
    _minX = _maxX = _minY = _maxY = 0;

#ifdef HACK_TO_REOPEN
    close_device();
#endif

    _status = true;
}

directx_camera_server::directx_camera_server(std::string const &pathPrefix,
                                             unsigned width, unsigned height) {
    //---------------------------------------------------------------------
    if (!open_and_find_parameters(pathPrefix, width, height)) {
        fprintf(stderr, "directx_camera_server::directx_camera_server(): "
                        "Cannot open camera\n");
        _status = false;
        return;
    }

    //---------------------------------------------------------------------
    // Allocate a buffer that is large enough to read the maximum-sized
    // image with no binning.
    /// @todo replace with a vector that gets sized here!
    _buflen =
        (unsigned)(_num_rows * _num_columns * 3); // Expect B,G,R; 8-bits each.
    if ((_buffer = new unsigned char[_buflen]) == nullptr) {
        fprintf(stderr, "directx_camera_server::directx_camera_server(): Out "
                        "of memory for buffer\n");
        _status = false;
        return;
    }
    // No image in memory yet.
    _minX = _maxX = _minY = _maxY = 0;

#ifdef HACK_TO_REOPEN
    close_device();
#endif

    _status = true;
}

//---------------------------------------------------------------------
// Close the camera and the system.  Free up memory.

void directx_camera_server::close_device() {
    // Clean up.
    _pGraph.reset();
    _pMediaControl.reset();
    _pEvent.reset();
    _pBuilder.reset();
    _pSampleGrabberFilter.reset();
    _pGrabber.reset();
    _pStreamConfig.reset();
    _com.reset();
}

directx_camera_server::~directx_camera_server() {
    // Get the callback device to immediately return all samples
    // it has queued up, then shut down the filter graph.
    if (_pCallback) {
        _pCallback->shutdown();
    }
    close_device();

    if (_buffer != nullptr) {
        delete[] _buffer;
    }

    // Delete the callback object, so that it can clean up and
    // make sure all of its threads exit.
    _pCallback.reset();
}

bool directx_camera_server::read_image_to_memory(unsigned minX, unsigned maxX,
                                                 unsigned minY, unsigned maxY,
                                                 double exposure_millisecs) {
    if (!_status) {
        fprintf(stderr,
                "directx_camera_server::read_image_to_memory(): broken\n");
        return false;
    };

    //---------------------------------------------------------------------
    // In case we fail, clear these
    _minX = _minY = _maxX = _maxY = 0;

    //---------------------------------------------------------------------
    // If the maxes are greater than the mins, set them to the size of
    // the image.
    if (maxX < minX) {
        minX = 0;
        maxX = _num_columns - 1;
    }
    if (maxY < minY) {
        minY = 0;
        maxY = _num_rows - 1;
    }

    //---------------------------------------------------------------------
    // Clip collection range to the size of the sensor on the camera.
    if (minX < 0) {
        minX = 0;
    };
    if (minY < 0) {
        minY = 0;
    };
    if (maxX >= _num_columns) {
        maxX = _num_columns - 1;
    };
    if (maxY >= _num_rows) {
        maxY = _num_rows - 1;
    };

    //---------------------------------------------------------------------
    // Store image size for later use
    _minX = minX;
    _minY = minY;
    _maxX = maxX;
    _maxY = maxY;

    //---------------------------------------------------------------------
    // Set up and read one frame, if we can.
    if (!read_one_frame(_minX, _maxX, _minY, _maxY, (int)exposure_millisecs)) {
        fprintf(stderr, "directx_camera_server::read_image_to_memory(): "
                        "read_one_frame() failed\n");
        return false;
    }

    return true;
}

bool directx_camera_server::get_pixel_from_memory(unsigned X, unsigned Y,
                                                  vrpn_uint8 &val,
                                                  int RGB) const {
    if (!_status) {
        return false;
    };

    // Switch red and blue, since they are backwards in the record (blue is
    // first).
    RGB = 2 - RGB;

    // XXX This will depend on what kind of pixels we have!
    if ((_maxX <= _minX) || (_maxY <= _minY)) {
        fprintf(stderr, "directx_camera_server::get_pixel_from_memory(): No "
                        "image in memory\n");
        return false;
    }
    if ((X < _minX) || (X > _maxX) || (Y < _minY) || (Y > _maxY)) {
        return false;
    }
    unsigned cols = _num_columns;
    val = _buffer[(Y * cols + X) * 3 + RGB];
    return true;
}

bool directx_camera_server::get_pixel_from_memory(unsigned X, unsigned Y,
                                                  vrpn_uint16 &val,
                                                  int RGB) const {
    if (!_status) {
        return false;
    };

    // Switch red and blue, since they are backwards in the record (blue is
    // first).
    RGB = 2 - RGB;

    // XXX This will depend on what kind of pixels we have!
    if ((_maxX <= _minX) || (_maxY <= _minY)) {
        fprintf(stderr, "directx_camera_server::get_pixel_from_memory(): No "
                        "image in memory\n");
        return false;
    }
    if ((X < _minX) || (X > _maxX) || (Y < _minY) || (Y > _maxY)) {
        return false;
    }
    unsigned cols = _num_columns;
    val = _buffer[(Y * cols + X) * 3 + RGB];
    return true;
}

//--------------------------------------------------------------------------------------------
// This section implements the callback handler that gets frames from the
// SampleGrabber filter.

directx_samplegrabber_callback::directx_samplegrabber_callback()
    : imageReady(false), imageDone(false), imageSample(nullptr),
      _stayAlive(true) {}

directx_samplegrabber_callback::~directx_samplegrabber_callback() {
    // Make sure the other thread knows that it is okay to return the
    // buffer and wait until it has had time to do so.
    _stayAlive = false;
    Sleep(100);
};

HRESULT directx_samplegrabber_callback::QueryInterface(
    REFIID interfaceRequested, void **handleToInterfaceRequested) {
    if (handleToInterfaceRequested == nullptr) {
        return E_POINTER;
    }
    if (interfaceRequested == IID_IUnknown) {
        *handleToInterfaceRequested = static_cast<IUnknown *>(this);
    } else if (interfaceRequested == IID_ISampleGrabberCB) {
        *handleToInterfaceRequested = static_cast<ISampleGrabberCB *>(this);
    } else {
        return E_NOINTERFACE;
    }
    AddRef();
    return S_OK;
}

// This is the routine that processes each sample.  It gets the information
// about
// the sample (one frame) from the SampleGrabber, then marks itself as being
// ready
// to process the sample.  It then blocks until the sample has been processed by
// the associated camera server.
// The hand-off is handled by using two booleans acting as semaphores.
// The first semaphore (imageReady)
// controls access to the callback handler's buffer so that the application
// thread
// will only read it when it is full.  The second sempaphore (imageDone)
// controls when
// the handler routine can release a sample; it makes sure that the sample is
// not
// released before the application thread is done processing it.
// The directx camera must be sure to free an open sample (if any) after
// changing
// the state of the filter graph, so that this doesn't block indefinitely.  This
// means
// that the destructor for any object using this callback object has to destroy
// this object.  The destructor sets _stayAlive to false to make sure this
// thread terminates.

HRESULT directx_samplegrabber_callback::SampleCB(double time,
                                                 IMediaSample *sample) {
    // Point the image sample to the media sample we have and then set the flag
    // to tell the application it can process it.
    imageSample = sample;
    imageReady = true;

    // Wait until the image has been processed and then return the buffer to the
    // filter graph
    while (!imageDone && _stayAlive) {
        vrpn_SleepMsecs(1);
    }
    if (_stayAlive) {
        imageDone = false;
    }

    return S_OK;
}


text:
<?php

/*
 *
 * Emailer component configuration file
 *
 */

return [
    'driverClass' => 'PhpMailer',
    'driverConfig' => [
        // Which method to use to send mail: smtp, sendmail, mail (PHP's mail() function)
        'mailer' => 'mail',
        // The path to the sendmail program.
        'sendmail' => '/usr/sbin/sendmail',
        /**
         * SMTP hosts.
         * Either a single hostname or multiple semicolon-delimited hostnames.
         * You can also specify a different port
         * for each host by using this format: [hostname:port]
         * (e.g. "smtp1.example.com:25;smtp2.example.com").
         * You can also specify encryption type, for example:
         * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
         * Hosts will be tried in order.
         */
        'host' => 'localhost',
        /**
         * Set the SMTP port number - likely to be 25, 465 or 587
         * The SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
         */
        'port' => 25,
        /**
         * Whether to keep SMTP connection open after each message.
         * If this is set to TRUE then to close the connection
         * requires an explicit call to smtpClose().
         */
        'smtpKeepAlive' => FALSE,
        // Whether to use SMTP authentication. Uses the Username and Password properties.
        'smtpAuth' => TRUE,
        // Username to use for SMTP authentication - use full email address for gmail
        'smtpUsername' => "username@example.com",
        // Password to use for SMTP authentication
        'smtpPassword' => "yourpassword",
        // Options array passed to stream_context_create when connecting via SMTP.
        'smtpOptions' => [],
        // SMTP auth type: LOGIN (default), PLAIN, NTLM, CRAM-MD5
        'smtpAuthType' => 'LOGIN',
        // The SMTP server timeout in seconds. Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
        'smtpTimeout' => 300,
        // SMTP realm. Used for NTLM auth
        'smtpRealm' => '',
        // SMTP workstation. Used for NTLM auth
        'smtpWorkstation' => '',
        // The From email address for the message.
        'fromAddress' => 'zeageorge@pfp.com', // 'root@localhost',
        // The From name of the message.
        'fromName' => 'Zeakis George', // 'Root User',
        //
        'replyToAddress' => '',
        //
        'replyToName' => '',
        // The character set of the message.
        'charset' => 'utf-8',
        // The MIME Content-type of the message.
        'contentType' => 'text/plain',
        // The message encoding: "8bit", "7bit", "binary", "base64", and "quoted-printable".
        'encoding' => '8bit',
        /**
         * Word-wrap the message body to this number of chars.
         * Set to 0 to not wrap.
         * A useful value here is 78, for RFC2822 section 2.1.1 compliance.
         */
        'bodyWordWrap' => 78,
        // The email address that a reading confirmation should be sent to.
        'confirmReadingTo' => '',
        /**
         * The hostname to use in Message-Id and Received headers
         * and as default HELO string.
         * If empty, the value returned
         * by SERVER_NAME is used or 'localhost.localdomain'.
         */
        'hostName' => '',
        // What to put in the X-Mailer header: An empty string for PHPMailer default, whitespace for none, or a string to use
        'XMailer' => '',
    ],
];


text:
PUPPET_DIR=/etc/puppet/

# NB: librarian-puppet might need git installed. If it is not already installed
# in your basebox, this will manually install it at this point using apt or yum

$(which git > /dev/null 2>&1)
FOUND_GIT=$?
if [ "$FOUND_GIT" -ne '0' ]; then
  echo 'Attempting to install git.'
  $(which apt-get > /dev/null 2>&1)
  FOUND_APT=$?
  $(which yum > /dev/null 2>&1)
  FOUND_YUM=$?

  if [ "${FOUND_YUM}" -eq '0' ]; then
    yum -q -y makecache
    yum -q -y install git
    echo 'git installed.'
  elif [ "${FOUND_APT}" -eq '0' ]; then
    apt-get -q -y update
    apt-get -q -y install git-core
    echo 'git installed.'
  else
    echo 'No package installer available. You may need to install git manually.'
  fi
fi

if [ ! -d "$PUPPET_DIR" ]; then
  mkdir -p $PUPPET_DIR
fi
cp /vagrant/puppet/Puppetfile $PUPPET_DIR

apt-get install -y build-essential ruby-dev

OS=$(/bin/bash /vagrant/shell/os-detect.sh ID)

if [ "$OS" == 'ubuntu' ]; then
  apt-get install -y libgemplugin-ruby
fi

if [ "$(gem search -i librarian-puppet)" = "false" ]; then
  gem install librarian-puppet
  cd $PUPPET_DIR && librarian-puppet install --clean
else
  cd $PUPPET_DIR && librarian-puppet update
fi


text:
export * from './fixed-size-virtual-scroll';
export * from './scroll-dispatcher';
export * from './scrollable';
export * from './scrolling-module';
export * from './viewport-ruler';
export * from './virtual-for-of';
export * from './virtual-scroll-strategy';
export * from './virtual-scroll-viewport';
export * from './virtual-scroll-repeater';
export * from './virtual-scrollable';
export * from './virtual-scrollable-element';
export * from './virtual-scrollable-window';


text:
package bits

import (
	"bufio"
	"bytes"
	"context"
	"crypto/aes"
	"crypto/cipher"
	"crypto/sha256"
	"encoding/hex"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strconv"
	"strings"
	"sync"
	"time"

	"github.com/VividCortex/ewma"
	"github.com/boltdb/bolt"
	"github.com/dustin/go-humanize"
	"github.com/restic/chunker"
)

//RemoteChunk indicates a certain chunk is know but stored remotely
var RemoteChunk = []byte{}

var (
	ErrAlreadyPushed = fmt.Errorf("chunk is already pushed to the remote")
)

var (
	//ChunkBufferSize determines the size of the buffer that wil hold each chunk
	ChunkBufferSize = 8 * 1024 * 1024 //8MiB

	//RemoteBranchSuffix identifies the specialty branches used for persisting remote information
	RemoteBranchSuffix = "bits-remote"
)

var (
	//IndexBucket holds remotely whether chunks are stored remotely
	IndexBucket = []byte("index")
)

//Repository provides an abstraction on top of a Git repository for a
//certain directory that is queried by git commands
type Repository struct {
	//Path the to the Git executable we're using
	exe string

	//Path to the Git database directory (.git)
	gitDir string

	//Path to the local chunk storage
	chunkDir string

	//Path to the root of the root of the git projet
	rootDir string

	//stderr from executions will be written here
	output io.Writer

	//Header key allows us to recognize the start of a key listing
	header []byte

	//Footer Key allows us to recognize the end of a key listing
	footer []byte

	//remotes hold the remote chunk store we're using
	remote Remote

	//bits specific configuration
	conf *Conf

	//this channel receives any chunk Key that is hanled in an any operation
	keyProgressCh chan KeyOp

	//is called when a chunk was handled in any operation, can be called
	//concurrently
	KeyProgressFn func(KeyOp, float64)
}

//NewRepository sets up an interface on top of a Git repository in the
//provided directory. It will fail if the get executable is not in
//the shells PATH or if the directory doesnt seem to be a Git repository
func NewRepository(dir string, output io.Writer) (repo *Repository, err error) {
	repo = &Repository{}
	repo.exe, err = exec.LookPath("git")
	if err != nil {
		return nil, fmt.Errorf("git executable couldn't be found in your PATH: %v, make sure git it installed", err)
	}

	//ask git for the root directory
	repo.rootDir = dir
	buf := bytes.NewBuffer(nil)
	err = repo.Git(nil, nil, buf, "rev-parse", "--show-toplevel")
	repo.rootDir = strings.TrimSpace(buf.String())
	if err != nil || repo.rootDir == "" {
		return nil, fmt.Errorf("couldn't get git repo root, are you in a git repository?")
	}

	//we store the git directory seperately
	buf = bytes.NewBuffer(nil)
	err = repo.Git(nil, nil, buf, "rev-parse", "--git-dir")
	repo.gitDir = filepath.Join(repo.rootDir, strings.TrimSpace(buf.String()))
	if err != nil {
		return nil, fmt.Errorf("couldn't get git directory, are you in a git repository?")
	}

	//make sure command output is visible
	repo.output = output
	if repo.output == nil {
		repo.output = os.Stderr
	}

	//for now, store chunks in the .git directory
	repo.chunkDir = filepath.Join(repo.gitDir, "chunks")
	err = os.MkdirAll(repo.chunkDir, 0777)
	if err != nil {
		return nil, fmt.Errorf("couldnt setup chunk directory at '%s': %v", repo.chunkDir, err)
	}

	//setup header and footers
	repo.header = []byte("--- to use this file decode it with the 'git-bits' extension ---\n")
	repo.footer = []byte("----------------------- end of chunks --------------------------\n")
	if len(repo.header) != (hex.EncodedLen(KeySize)+1) || len(repo.footer) != (hex.EncodedLen(KeySize)+1) {
		return nil, fmt.Errorf("repository header and footer size are not '%d': header: %d, footer: %d", hex.EncodedLen(KeySize)+1, len(repo.header), len(repo.footer))
	}

	//setup configuration
	repo.conf = DefaultConf()
	err = repo.conf.OverwriteFromGit(repo)
	if err != nil {
		return nil, fmt.Errorf("failed to load bits configuration from git: %v", err)
	}

	//if a bucket is configured we will attempt to configured
	if repo.conf.AWSS3BucketName != "" {
		repo.remote, err = NewS3Remote(
			repo,
			"origin",
			repo.conf.AWSS3BucketName,
			repo.conf.AWSAccessKeyID,
			repo.conf.AWSSecretAccessKey,
		)

		if err != nil {
			return nil, fmt.Errorf("unable to setup chunk remote: %v", err)
		}
	}

	//default output function will do basic logging of key progress
	indexBucketMax := 500
	indexedTotalKeys := 0
	repo.KeyProgressFn = func(kop KeyOp, tp float64) {
		if kop.Op == IndexOp {
			indexedTotalKeys++
			if indexedTotalKeys%indexBucketMax == 0 {
				fmt.Fprintf(repo.output, "indexed %d remote chunks, total: ~%s\n", indexBucketMax, humanize.FormatInteger("#.", indexedTotalKeys))
			}

			return
		}

		if kop.Op != IndexOp && indexedTotalKeys > 0 {
			fmt.Fprintf(repo.output, "indexing of remote chunks ended, total: ~%s\n", humanize.FormatInteger("#.", indexedTotalKeys))
			indexedTotalKeys = 0
		}

		if kop.Skipped {
			fmt.Fprintf(repo.output, "%x (skip: already %s)\n", kop.K, strings.Replace(fmt.Sprintf("%sed", string(kop.Op)), "ee", "e", 1))
		} else {
			fmt.Fprintf(repo.output, "%x (%s) %s/s\n", kop.K, string(kop.Op), humanize.Bytes(uint64(tp)))
		}
	}

	//we start handling key events while keeping a moving
	//average for the number of bytes moving through
	repo.keyProgressCh = make(chan KeyOp, 1)
	go func() {
		lastT := time.Now()
		e := ewma.NewMovingAverage()
		for kop := range repo.keyProgressCh {
			nowT := time.Now()
			diffD := nowT.Sub(lastT)
			if kop.CopyN > 0 {
				tp := float64(kop.CopyN) / diffD.Seconds()
				e.Add(tp)
			}

			repo.KeyProgressFn(kop, e.Value())
			lastT = nowT
		}
	}()

	return repo, nil
}

//Git runs the git executable with the working directory set to the repository director
func (repo *Repository) Git(ctx context.Context, in io.Reader, out io.Writer, args ...string) (err error) {
	if ctx == nil {
		ctx = context.Background()
	}

	cmd := exec.CommandContext(ctx, repo.exe, args...)
	cmd.Dir = repo.rootDir
	cmd.Stderr = repo.output
	cmd.Stdin = in
	cmd.Stdout = out

	err = cmd.Run()
	if err != nil {
		return fmt.Errorf("failed to run `git %v`: %v", strings.Join(args, " "), err)
	}

	return nil
}

//Install will prepare a git repository for usage with git bits, it configures
//filters, installs hooks and pulls chunks to write files in the current
//working tree. A configuration struct can be provided to populate local
//git configuration got future bits commands
func (repo *Repository) Install(w io.Writer, conf *Conf) (err error) {
	ctx := context.Background()

	//configure filter
	gconf := map[string]string{
		"filter.bits.clean":    "git bits split",
		"filter.bits.smudge":   "git bits fetch | git bits combine",
		"filter.bits.required": "true",
	}

	//add bits configuration
	if conf != nil {
		if conf.AWSS3BucketName != "" {
			gconf["bits.aws-s3-bucket-name"] = conf.AWSS3BucketName
		}

		if conf.AWSAccessKeyID != "" {
			gconf["bits.aws-access-key-id"] = conf.AWSAccessKeyID
		}

		if conf.AWSSecretAccessKey != "" {
			gconf["bits.aws-secret-access-key"] = conf.AWSSecretAccessKey
		}

		if conf.DeduplicationScope != 0 {
			gconf["bits.deduplication-scope"] = strconv.FormatUint(conf.DeduplicationScope, 10)
		}

		repo.conf = conf

		//@TODO init can complete remote configuration
		//@TODO obvious code duplication with constructor
		repo.remote, err = NewS3Remote(
			repo,
			"origin",
			repo.conf.AWSS3BucketName,
			repo.conf.AWSAccessKeyID,
			repo.conf.AWSSecretAccessKey,
		)

		if err != nil {
			return fmt.Errorf("unable to setup default chunk remote: %v", err)
		}
	}

	//write configuration
	for k, val := range gconf {
		err := repo.Git(ctx, nil, nil, "config", "--local", k, val)
		if err != nil {
			return fmt.Errorf("failed to configure filter: %v", err)
		}
	}

	//write hook if doesnt exist yet
	hookp := filepath.Join(repo.gitDir, "hooks", "pre-push")
	f, err := os.OpenFile(hookp, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0777)
	if err != nil {
		if os.IsExist(err) {
			fmt.Fprintf(repo.output, "a file already exists at '%s' already, skip writing git-bits hook\n", hookp)
		} else {
			return fmt.Errorf("couldnt setup hook: %v", err)
		}
	} else {
		defer f.Close()
		_, err = f.WriteString(`#!/bin/sh
			command -v git-bits >/dev/null 2>&1 || { echo >&2 "This project was setup with git-bits but it can (no longer) be found in your PATH: $PATH."; exit 0; }
			git-bits scan | git-bits push
	`)

		if err != nil {
			return fmt.Errorf("failed to git hook: %v", err)
		}
	}

	err = repo.Pull("HEAD", w)
	if err != nil {
		return fmt.Errorf("failed to pull chunks for HEAD: %v", err)
	}

	return nil
}

//ForEach is a convenient method for running logic for each chunk
//key in stream 'r', it will skip the chunk header and footer
func (repo *Repository) ForEach(r io.Reader, fn func(K) error) error {
	s := bufio.NewScanner(r)
	for s.Scan() {

		//and in any case skip it
		if bytes.Equal(s.Bytes(), repo.header[:len(repo.header)-1]) ||
			bytes.Equal(s.Bytes(), repo.footer[:len(repo.footer)-1]) {
			continue
		}

		//decode the actual keys
		data := make([]byte, hex.DecodedLen(len(s.Bytes())))
		_, err := hex.Decode(data, s.Bytes())
		if err != nil {
			return fmt.Errorf("failed to decode '%x' as hex: %v", s.Bytes(), err)
		}

		//check key length
		k := K{}
		if len(k) != len(data) {
			return fmt.Errorf("decoded chunk key '%x' has an invalid length %d, expected %d", data, len(data), len(k))
		}

		//fill K and hand it over
		copy(k[:], data[:KeySize])
		err = fn(k)
		if err != nil {
			return fmt.Errorf("failed to handle key '%x': %v", k, err)
		}
	}

	if err := s.Err(); err != nil {
		return fmt.Errorf("failed to scan chunk keys: %v", err)
	}

	return nil
}

//Push takes a list of chunk keys on reader 'r' and moves each chunk from
//the local storage to the remote store with name 'remote'. Prior to pushing
//the local index of the remote is updated so chunks are not uploaded twice.
func (repo *Repository) Push(store *bolt.DB, r io.Reader, remoteName string) (err error) {
	if repo.remote == nil {
		return fmt.Errorf("unable to push, no remote configured")
	}

	//err handling
	errs := []string{}
	errCh := make(chan error)
	defer close(errCh)
	go func() {
		for err := range errCh {
			errs = append(errs, fmt.Sprintf("%v", err))
		}
	}()

	//ask the remote to fetch all chunk keys
	pr, pw := io.Pipe()
	go func() {
		err = repo.remote.ListChunks(pw)
		defer pw.Close()
		if err != nil {
			errCh <- fmt.Errorf("failed to list remote chunk keys: %v", err)
		}
	}()

	//stream remote keys 500 at a time and write to local index concurrently
	//allowing some to be oppertunisticly combined to increase performance
	var wg sync.WaitGroup
	repo.ForEach(pr, func(k K) error {
		go func() {
			err = store.Batch(func(tx *bolt.Tx) error {
				wg.Add(1)
				defer wg.Done()
				b := tx.Bucket(IndexBucket)
				err = b.Put(k[:], RemoteChunk)
				if err != nil {
					return fmt.Errorf("failed to put '%x': %v", k, err)
				}

				repo.keyProgressCh <- KeyOp{IndexOp, k, false, 0}
				return nil
			})

			if err != nil {
				errCh <- fmt.Errorf("failed to batch indexed remote keys: %v", err)
			}
		}()

		return nil
	})

	//wait for all concurrent batch transactions to complete
	wg.Wait()
	if len(errs) > 0 {
		return fmt.Errorf("there were errors while indexing: \n %s", strings.Join(errs, "\n\t"))
	}

	//scan for chunk keys
	err = repo.ForEach(r, func(k K) (ferr error) {
		err = store.View(func(tx *bolt.Tx) error {
			b := tx.Bucket(IndexBucket)
			c := b.Get(k[:])
			if c == nil {
				return nil //doesnt exist
			}

			if bytes.Equal(c, RemoteChunk) {
				return ErrAlreadyPushed
			}

			return nil
		})

		//already pushed err is a good think, we can skip uploading this chunk!
		if err == ErrAlreadyPushed {
			repo.keyProgressCh <- KeyOp{PushOp, k, true, 0}
			return nil
		}

		if err != nil {
			return fmt.Errorf("failed to read index: %v", err)
		}

		//open local chunk file
		p, _ := repo.Path(k, false)
		f, err := os.OpenFile(p, os.O_RDONLY, 0666)
		if err != nil {
			return fmt.Errorf("failed to open chunk '%x' at '%s' for pushing: %v", k, p, err)
		}

		//get remote writer
		defer f.Close()
		wc, err := repo.remote.ChunkWriter(k)
		if err != nil {
			return fmt.Errorf("failed to get chunk writer: %v", err)
		}

		//start upload
		defer wc.Close()
		n, err := io.Copy(wc, f)
		if err != nil {
			return fmt.Errorf("failed to copy file '%s' to remote writer after %d bytes: %v", f.Name(), n, err)
		}

		//indicate we pushed the chunk
		repo.keyProgressCh <- KeyOp{PushOp, k, false, n}
		return nil
	})

	if err != nil {
		return fmt.Errorf("failed to loop over each key: %v", err)
	}

	return nil
}

//Fetch takes a list of chunk keys on reader 'r' and will try to fetch chunks
//that are not yet stored locally. Chunks that are already stored locally should
//result in a no-op, all keys (fetched or not) will be written to 'w'.
func (repo *Repository) Fetch(r io.Reader, w io.Writer) (err error) {
	printk := func(k K) error {
		_, err := fmt.Fprintf(w, "%x\n", k)
		return err
	}

	return repo.ForEach(r, func(k K) error {

		//setup chunk path
		p, err := repo.Path(k, true)
		if err != nil {
			return fmt.Errorf("failed to create chunk path for key '%x': %v", k, err)
		}

		//attempt to open, if its already assume it was written concurrently
		f, err := os.OpenFile(p, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0666)
		if err != nil {
			if os.IsExist(err) {
				repo.keyProgressCh <- KeyOp{FetchOp, k, true, 0}
				return printk(k)
			}

			return fmt.Errorf("failed to open chunk file '%s' for writing: %v", p, err)
		}

		if repo.remote == nil {
			return fmt.Errorf("key '%x' isn't stored locally, but no remote is configured", k)
		}

		rc, err := repo.remote.ChunkReader(k)
		if err != nil {
			return fmt.Errorf("failed to get chunk reader for key '%x': %v", k, err)
		}

		defer rc.Close()
		n, err := io.Copy(f, rc)
		if err != nil {
			return fmt.Errorf("failed to clone chunk '%x' from remote: %v", err)
		}

		//indicate we fetched a key
		repo.keyProgressCh <- KeyOp{FetchOp, k, false, n}
		return printk(k)
	})
}

//Path returns the local path to the chunk file based on the key, it can
//create required directories when 'mkdir' is set to true, in that case
//err might container directory creation failure.
func (repo *Repository) Path(k K, mkdir bool) (p string, err error) {
	dir := filepath.Join(repo.chunkDir, fmt.Sprintf("%x", k[:2]))
	if mkdir {
		err = os.MkdirAll(dir, 0777)
		if err != nil {
			return "", fmt.Errorf("failed to create chunk dir '%s': %v", dir, err)
		}
	}

	return filepath.Join(dir, fmt.Sprintf("%x", k[2:])), nil
}

//LocalStore will return the local chunk store, creating it in the
//repositories chunk directory if it doesnt exist yet. It creates
//the necessary buckets if they dont exist yet
func (repo *Repository) LocalStore() (db *bolt.DB, err error) {
	dbpath := filepath.Join(repo.chunkDir, "a.chunks")
	db, err = bolt.Open(dbpath, 0666, &bolt.Options{Timeout: 1 * time.Second})
	if err != nil {
		return nil, fmt.Errorf("failed to open chunks database '%s': %v", dbpath, err)
	}

	err = db.Update(func(tx *bolt.Tx) error {
		_, err := tx.CreateBucketIfNotExists(IndexBucket)
		if err != nil {
			return fmt.Errorf("failed to create bucket: %s", err)
		}
		return nil
	})

	if err != nil {
		return nil, fmt.Errorf("failed to create bucket '%s': %v", string(IndexBucket), err)
	}

	return db, nil
}

//Pull get all file paths of blobs that hold chunk keys in the provided ref
//and combine the chunks in them into their original file, fetching any chunks
//not currently available in the local store
func (repo *Repository) Pull(ref string, w io.Writer) (err error) {

	// ls-tree -r -l | f1 | f2 | git update-index -q --refresh --stdin
	ctx := context.Background()
	r1, w1 := io.Pipe()
	r2, w2 := io.Pipe()
	r3, w3 := io.Pipe()

	errs := []string{}
	errCh := make(chan error)
	defer close(errCh)
	go func() {
		for err := range errCh {
			errs = append(errs, fmt.Sprintf("%v", err))
		}
	}()

	go func() {
		defer w1.Close()
		err = repo.Git(ctx, nil, w1, "ls-tree", "-r", "-l", ref)
		if err != nil {
			//@TODO this will error if the repository is empty (no commits yet)
			//probaly throw a warning instead
			// errCh <- err
		}
	}()

	go func() {
		defer w2.Close()
		s := bufio.NewScanner(r1)
		for s.Scan() {

			//@see https://git-scm.com/docs/git-ls-tree
			//line : <mode> SP <type> SP <object> TAB <file>, we use the
			//tab to be able to clearly seperate the file name as it may contain
			//field seperating characters
			tfields := bytes.SplitN(s.Bytes(), []byte("\t"), 2)
			fields := bytes.Fields(s.Bytes())
			if len(fields) < 5 || len(tfields) != 2 || !bytes.Equal(fields[1], []byte("blob")) {
				continue
			}

			objSize, err := strconv.ParseInt(string(fields[3]), 10, 64)
			if err != nil {
				errCh <- err
				continue
			}

			//all key files have a size that is the exact multiple of
			//33 bytes: 32 bytes hex encoded hashes with a newline character
			if objSize%int64(hex.EncodedLen(KeySize)+1) != 0 {
				continue
			}

			fmt.Fprintf(w2, "%s\n", tfields[1])
		}

		if err = s.Err(); err != nil {
			errCh <- err
		}
	}()

	go func() {
		defer w3.Close()
		s := bufio.NewScanner(r2)
		for s.Scan() {
			err = func() error {
				fpath := filepath.Join(repo.rootDir, s.Text())
				tmpfpath := ""

				err = func() error {
					f, err := os.OpenFile(fpath, os.O_RDWR|os.O_CREATE, 0666)
					if err != nil {
						return err
					}

					defer f.Close()
					hdr := make([]byte, hex.EncodedLen(KeySize))
					_, err = f.Read(hdr)
					if err != nil {
						//if we cant even read a complete header, its not gonna contain chunks
						return nil
					}

					offs, err := f.Seek(0, 0)
					if err != nil || offs != 0 {
						return fmt.Errorf("failed to seek files: %v", err)
					}

					if !bytes.Equal(hdr, repo.header[:len(repo.header)-1]) {
						return nil
					}

					//We know its a chunks file that needs filling
					tmpf, err := ioutil.TempFile("", "bits_tmp_")
					if err != nil {
						return err
					}

					tmpfpath = tmpf.Name()
					defer tmpf.Close()
					fi, err := f.Stat()
					if err != nil {
						return fmt.Errorf("failed to stat original file for permissions: %v", err)
					}

					//mod the tempfile as the original
					err = os.Chmod(tmpfpath, fi.Mode())
					if err != nil {
						return fmt.Errorf("failed to modify temp file permissions: %v", err)
					}

					pr, pw := io.Pipe()
					go func() {
						defer pw.Close()
						err = repo.Fetch(f, pw)
						if err != nil {
							errCh <- err
						}
					}()

					err = repo.Combine(pr, tmpf)
					if err != nil {
						return fmt.Errorf("failed to combine: %v", err)
					}

					return nil
				}()

				if err != nil {
					return err
				}

				//no tmpfpath means we have no files to move, wer're done here
				if tmpfpath == "" {
					return nil
				}

				err = os.Remove(fpath)
				if err != nil {
					return fmt.Errorf("failed to remove original file '%s': %v", fpath, err)
				}

				err = os.Rename(tmpfpath, fpath)
				if err != nil {
					return fmt.Errorf("failed to move '%s' to '%s'", tmpfpath, s.Text())
				}

				fmt.Fprintf(w3, "%s\n", fpath)
				return nil
			}()

			if err != nil {
				errCh <- fmt.Errorf("failed to check file '%s' for header content: %v", err)
			}
		}
	}()

	err = repo.Git(ctx, r3, nil, "update-index", "-q", "--refresh", "--stdin")
	if err != nil {
		return fmt.Errorf("failed to update index: %v", err)
	}

	if len(errs) > 0 {
		return fmt.Errorf("there were scanning errors: \n %s", strings.Join(errs, "\n\t"))
	}

	return nil
}

func (repo *Repository) ScanEach(r io.Reader, w io.Writer) (err error) {
	s := bufio.NewScanner(r)
	for s.Scan() {
		fields := bytes.Fields(s.Bytes())
		left := ""
		right := ""

		switch len(fields) {
		case 4: //push hook format
			right = string(fields[1])
			left = string(fields[3])
			if left == "0000000000000000000000000000000000000000" {
				left = ""
			}
		case 1: //scan refs (left empty)
			right = string(fields[0])
		case 2: //scan refs
			right = string(fields[0])
			left = string(fields[1])
		default: //error
			return fmt.Errorf("unexpected input for scanning: %s", s.Text())
		}

		return repo.Scan(left, right, w)
	}

	return s.Err()
}

//Scan will traverse git objects between commit 'left' and 'right', it will
//look for blobs larger then 32 bytes that are also in the clean log. These
//blobs should contain keys that are written to writer 'w'
func (repo *Repository) Scan(left, right string, w io.Writer) (err error) {

	// rev-list --objects <right> ^<left> | f1 | cat-file --batch-check | f2 | cat-file --batch | f3
	ctx := context.Background()
	r1, w1 := io.Pipe()
	r2, w2 := io.Pipe()
	r3, w3 := io.Pipe()
	r4, w4 := io.Pipe()
	r5, w5 := io.Pipe()

	errs := []string{}
	errCh := make(chan error)
	defer close(errCh)
	go func() {
		for err := range errCh {
			errs = append(errs, fmt.Sprintf("%v", err))
		}
	}()

	go func() {
		defer w1.Close()
		args := []string{"rev-list", "--objects", right}
		if left != "" {
			args = append(args, "^"+left)
		}

		err = repo.Git(ctx, nil, w1, args...)
		if err != nil {
			errCh <- err
		}
	}()

	go func() {
		defer w2.Close()
		s := bufio.NewScanner(r1)
		for s.Scan() {
			fields := bytes.Fields(s.Bytes())
			if len(fields) < 1 {
				continue
			}

			fmt.Fprintf(w2, "%s\n", fields[0])
		}

		if err = s.Err(); err != nil {
			errCh <- err
		}
	}()

	go func() {
		defer w3.Close()
		err = repo.Git(ctx, r2, w3, "cat-file", "--batch-check")
		if err != nil {
			errCh <- err
		}
	}()

	go func() {
		defer w4.Close()
		s := bufio.NewScanner(r3)
		for s.Scan() {
			fields := bytes.Fields(s.Bytes())

			//dont consider non-blobs
			if len(fields) < 3 || !bytes.Equal(fields[1], []byte("blob")) {
				continue
			}

			//parse object size for filtering by blob size
			objSize, err := strconv.ParseInt(string(fields[2]), 10, 64)
			if err != nil {
				errCh <- err
				continue
			}

			//all key files have a size that is the exact multiple of
			//33 bytes: 32 bytes hex encoded hashes with a newline character
			if objSize%int64(hex.EncodedLen(KeySize)+1) != 0 {
				continue
			}

			fmt.Fprintf(w4, "%s\n", string(fields[0]))
		}

		if err = s.Err(); err != nil {
			errCh <- err
		}
	}()

	go func() {
		defer w5.Close()
		err = repo.Git(ctx, r4, w5, "cat-file", "--batch")
		if err != nil {
			errCh <- err
		}
	}()

	scanned := map[string]struct{}{}
	recording := false
	s := bufio.NewScanner(r5)
	for s.Scan() {
		if bytes.Equal(s.Bytes(), repo.header[:len(repo.header)-1]) {
			recording = true
			continue
		}

		if bytes.Equal(s.Bytes(), repo.footer[:len(repo.footer)-1]) {
			recording = false
			continue
		}

		//if we found keys, output each key on a new line
		//but only if we didn't output it before
		if recording {
			if _, ok := scanned[s.Text()]; !ok {
				fmt.Fprintf(w, "%s\n", s.Text())
				scanned[s.Text()] = struct{}{}
			}
		}
	}

	if err = s.Err(); err != nil {
		return fmt.Errorf("failed to scan key blobs: %v", err)
	}

	if len(errs) > 0 {
		return fmt.Errorf("there were scanning errors: \n %s", strings.Join(errs, "\n\t"))
	}

	return nil
}

//Split turns a plain bytes from 'r' into encrypted, deduplicated and persisted chunks
//while outputting keys for those chunks on writer 'w'. Chunks are written to a local chunk
//space, pushing these to a remote store happens at a later time (pre-push hook)
func (repo *Repository) Split(r io.Reader, w io.Writer) (err error) {
	if repo.conf.DeduplicationScope == 0 {
		return fmt.Errorf("no deduplication scope configured, please run init", err)
	}

	//create a buffer that allows us to peek if this is a file that
	//is already spit, if so: simply copy over the bytes, nothing to split
	bufr := bufio.NewReader(r)
	hdr, _ := bufr.Peek(hex.EncodedLen(KeySize) + 1)
	if bytes.Equal(hdr, repo.header) {
		_, err := io.Copy(w, bufr)
		if err != nil {
			return fmt.Errorf("failed to copy already chunked file content: %v", err)
		}

		return nil
	}

	//it is a feel that needs splitting, start
	//writing header and footer
	w.Write(repo.header)
	defer w.Write(repo.footer)

	//write actual chunks
	chunkr := chunker.New(bufr, chunker.Pol(repo.conf.DeduplicationScope))
	buf := make([]byte, ChunkBufferSize)
	for {
		chunk, err := chunkr.Next(buf)
		if err == io.EOF {
			break
		}

		if err != nil {
			return fmt.Errorf("Failed to write chunk (%d bytes) to buffer (size %d bytes): %v", chunk.Length, ChunkBufferSize, err)
		}

		//@TODO use hmac(SHA256) with the deduplication scope as a key
		k := sha256.Sum256(chunk.Data)
		printk := func(k K) error {
			_, err = fmt.Fprintf(w, "%x\n", k)
			if err != nil {
				return fmt.Errorf("failed to write key to output: %v", err)
			}

			return nil
		}

		err = func() error {

			//formulate path
			p, err := repo.Path(k, true)
			if err != nil {
				return fmt.Errorf("failed to create chunk dir for '%x': %v", k, err)
			}

			//attempt to open, create if nont existing
			f, err := os.OpenFile(p, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0666)
			if err != nil {

				//if its already written, all good; output key
				if os.IsExist(err) {
					repo.keyProgressCh <- KeyOp{StageOp, k, true, 0}
					return printk(k)
				}

				return fmt.Errorf("Failed to open chunk file '%s' for writing: %v", p, err)
			}

			//aes encryption with
			block, err := aes.NewCipher(k[:])
			if err != nil {
				return fmt.Errorf("failed to create cipher for key '%x': %v", k, err)
			}

			//create encrypt writer
			//@TODO use GCM cipher mode
			//@TODO	If the key is unique for each ciphertext, then it's ok to use a zero IV.
			defer f.Close()
			var iv [aes.BlockSize]byte
			stream := cipher.NewOFB(block, iv[:])
			encryptw := &cipher.StreamWriter{S: stream, W: f}

			//encrypt and write to file
			n, err := encryptw.Write(chunk.Data)
			if err != nil {
				return fmt.Errorf("Failed to write chunk '%x' (wrote %d bytes): %v", k, n, err)
			}

			//report staging and output key
			repo.keyProgressCh <- KeyOp{StageOp, k, false, int64(n)}
			return printk(k)
		}()

		if err != nil {
			return fmt.Errorf("Failed to split chunk '%x': %v", k, err)
		}
	}

	return nil
}

//Combine turns a newline seperated list of chunk keys from 'r' by reading the the
//projects local store. Chunks are then decrypted and combined in the original
//file and written to writer 'w'
func (repo *Repository) Combine(r io.Reader, w io.Writer) (err error) {
	err = repo.ForEach(r, func(k K) error {

		//open chunk file
		p, _ := repo.Path(k, false)
		f, err := os.OpenFile(p, os.O_RDONLY, 0666)
		if err != nil {
			return fmt.Errorf("failed to open chunk '%x' locally at '%s': %v", k, p, err)
		}

		//setup aes cipher
		block, err := aes.NewCipher(k[:])
		if err != nil {
			return fmt.Errorf("failed to create cipher: %v", err)
		}

		//setup the read stream
		//@TODO use GCM cipher mode
		//@TODO	If the key is unique for each ciphertext, then it's ok to use a zero IV.
		var iv [aes.BlockSize]byte
		stream := cipher.NewOFB(block, iv[:])
		decryptr := &cipher.StreamReader{S: stream, R: f}

		//copy chunk bytes to output
		defer f.Close()
		n, err := io.Copy(w, decryptr)
		if err != nil {
			return fmt.Errorf("failed to copy chunk '%x' content after %d bytes: %v", k, n, err)
		}

		return nil
	})

	if err != nil {
		return fmt.Errorf("failed to loop over keys: %v", err)
	}

	return nil
}


text:
using System;
using NSubstitute.Exceptions;
using NSubstitute.Experimental;
using NUnit.Framework;

namespace NSubstitute.Acceptance.Specs
{
    [TestFixture]
    public class ExceptionsWhenCheckingSequencesOfCalls
    {
        public interface IFoo
        {
            void Bar();
            void Zap();
        }

        public interface IBaz
        {
            void Gloop(int i);
            void Slop(object o, string s);
        }

        public interface IBar
        {
            int Huh();
        }

        [Test]
        public void When_missing_a_call()
        {
            var sub = Substitute.For<IFoo>();
            sub.Bar();

            Action action = () =>
                            {
                                sub.Bar();
                                sub.Zap();
                            };
            ExpectMessageFromQuery(action, @"
Expected to receive these calls in order:

    Bar()
    Zap()

Actually received matching calls in this order:

    Bar()");
        }

        [Test]
        public void When_non_matching_args()
        {
            var anObject = new object();
            var sub = Substitute.For<IBaz>();
            sub.Gloop(2);
            sub.Slop(anObject, "hello");
            sub.Gloop(3);

            Action action = () =>
                            {
                                sub.Gloop(2);
                                sub.Slop(anObject, "hi");
                                sub.Gloop(123);
                            };
            ExpectMessageFromQuery(action, @"Expected to receive these calls in order:

    Gloop(2)
    Slop(Object, ""hi"")
    Gloop(123)

Actually received matching calls in this order:

    Gloop(2)");
        }

        [Test]
        public void When_extra_call()
        {
            var sub = Substitute.For<IFoo>();
            sub.Bar();
            sub.Bar();
            sub.Zap();

            Action action = () =>
                            {
                                sub.Bar();
                                sub.Zap();
                            };

            ExpectMessageFromQuery(action, @"Expected to receive these calls in order:

    Bar()
    Zap()

Actually received matching calls in this order:

    Bar()
    Bar()
    Zap()
");
        }

        [Test]
        public void When_checking_across_multiple_subs_with_same_type()
        {
            var sub0 = Substitute.For<IFoo>();
            var sub1 = Substitute.For<IFoo>();

            sub0.Bar();
            sub1.Bar();
            sub0.Zap();
            sub1.Zap();

            Action action = () =>
                            {
                                sub0.Bar();
                                sub1.Bar();
                                sub1.Bar();
                                sub1.Zap();
                                sub0.Zap();
                            };

            ExpectMessageFromQuery(action, @"Expected to receive these calls in order:

    1@IFoo.Bar()
    2@IFoo.Bar()
    2@IFoo.Bar()
    2@IFoo.Zap()
    1@IFoo.Zap()

Actually received matching calls in this order:

    1@IFoo.Bar()
    2@IFoo.Bar()
    1@IFoo.Zap()
    2@IFoo.Zap()");
        }

        [Test]
        public void When_checking_across_multiple_subs_including_delegates()
        {
            var sub0 = Substitute.For<IFoo>();
            var sub1 = Substitute.For<Func<int, string>>();
            var sub2 = Substitute.For<IFoo>();

            sub0.Bar();
            sub1(2);
            sub0.Zap();
            sub2.Zap();

            Action action = () =>
                            {
                                sub0.Bar();
                                sub1(2);
                                sub2.Zap();
                                sub0.Zap();
                            };

            ExpectMessageFromQuery(action, @"Expected to receive these calls in order:

    1@IFoo.Bar()
    2@Func<Int32, String>.Invoke(2)
    3@IFoo.Zap()
    1@IFoo.Zap()

Actually received matching calls in this order:

    1@IFoo.Bar()
    2@Func<Int32, String>.Invoke(2)
    1@IFoo.Zap()
    3@IFoo.Zap()");
        }

        [Test]
        public void Do_not_number_instances_when_types_are_sufficient_to_identify_calls()
        {
            var a = Substitute.For<IFoo>();
            var b = Substitute.For<IBaz>();
            var c = Substitute.For<IBar>();

            a.Zap();
            c.Huh();
            b.Gloop(1);
            a.Bar();

            Action query = () =>
                             {
                                 a.Zap();
                                 b.Gloop(1);
                                 c.Huh();
                                 a.Bar();
                             };

            ExpectMessageFromQuery(query, @"Expected to receive these calls in order:

    IFoo.Zap()
    IBaz.Gloop(1)
    IBar.Huh()
    IFoo.Bar()

Actually received matching calls in this order:

    IFoo.Zap()
    IBar.Huh()
    IBaz.Gloop(1)
    IFoo.Bar()");
        }

        private void ExpectMessageFromQuery(Action query, string message)
        {
            var actualMessage = Assert.Throws<CallSequenceNotFoundException>(() => Received.InOrder(query)).Message;

            Assert.That(TrimAndFixLineEndings(actualMessage), Is.StringStarting(TrimAndFixLineEndings(message)));
        }

        private string TrimAndFixLineEndings(string s)
        {
            return s.Trim().Replace("\r\n", "\n");
        }
    }
}


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Package at.ac.tuwien.infosys.jcloudscale.messaging (JCloudScale 0.4.1-SNAPSHOT API)</title>
<meta name="date" content="2014-02-05">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
at.ac.tuwien.infosys.jcloudscale.messaging

Packages that use at.ac.tuwien.infosys.jcloudscale.messaging

Package
Description

at.ac.tuwien.infosys.jcloudscale.configuration

at.ac.tuwien.infosys.jcloudscale.management

at.ac.tuwien.infosys.jcloudscale.messaging

at.ac.tuwien.infosys.jcloudscale.server

at.ac.tuwien.infosys.jcloudscale.server.messaging

at.ac.tuwien.infosys.jcloudscale.vm

at.ac.tuwien.infosys.jcloudscale.vm.bursting

at.ac.tuwien.infosys.jcloudscale.vm.ec2

at.ac.tuwien.infosys.jcloudscale.vm.localVm

at.ac.tuwien.infosys.jcloudscale.vm.openstack

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.configuration

Class and Description

IMQWrapper

MessageQueueConfiguration

TimeoutException

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.management

Class and Description

IMQWrapper

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.messaging

Class and Description

IMQWrapper

MessageQueueConfiguration

TimeoutException

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.server

Class and Description

IMQWrapper

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.server.messaging

Class and Description

IMQWrapper

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.vm

Class and Description

IMQWrapper

MessageQueueConfiguration

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.vm.bursting

Class and Description

IMQWrapper

MessageQueueConfiguration

TimeoutException

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.vm.ec2

Class and Description

MessageQueueConfiguration

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.vm.localVm

Class and Description

MessageQueueConfiguration

Classes in at.ac.tuwien.infosys.jcloudscale.messaging used by at.ac.tuwien.infosys.jcloudscale.vm.openstack

Class and Description

MessageQueueConfiguration

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2014. All Rights Reserved.


text:
const documents = require('../documents');

const {
    defaultDocument,
    defPointSetbacks,
    roofType,
    structureType
} = documents;

module.exports = {
    ahj: defaultDocument,
    definitions:{
        rules:{
            defPointSetbacks
        },
        conditions:{
            roofType,
            structureType
        }
    }
}


text:
import shelve
import re
import string
import collections
import ner
from flask import Flask, jsonify, request, render_template
from os import path
from cPickle import HIGHEST_PROTOCOL
from nltk.tokenize import word_tokenize, sent_tokenize
from nltk.tag.stanford import POSTagger
from onetfreq import top10k, top5k, top1k
import random
import code
import datetime

SHELVE_DB = 'shelve.db'

app = Flask(__name__)
app.config.from_object(__name__)

db = shelve.open(path.join(app.root_path, app.config['SHELVE_DB']),
                 protocol=HIGHEST_PROTOCOL, writeback=True)

nerify = ner.SocketNER(host='localhost', port=9000)

st = POSTagger('../stanford-postagger-2013-06-20/models/english-bidirectional-distsim.tagger',
               '../stanford-postagger-2013-06-20/stanford-postagger-3.2.0.jar')
punct = re.compile('[%s]' % re.escape(string.punctuation))

# Note that these are in reverse order of use for pop() later

# Replacements for NER ... this used to try harder
altperson = collections.deque(['[person]'])
altloc = collections.deque(['[location]'])
altorg = collections.deque(['[organization]'])

# Replacements for POS Tagger ... this used to try harder
altnoun = collections.deque(['[thing]'])
altnoun_plural = collections.deque(['[things]'])
altverb = collections.deque(['[action]'])
altverb_past = collections.deque(['[past action]'])

@app.route("/test")
def test():
    return render_template("test.html")

@app.route("/get_progress")
def get_progress():
    return jsonify({"progress":db["progress"]})

@app.route("/named_entities", methods=['POST'])
def ner_process():
    text = request.form["text"].encode("utf-8")
    return jsonify(stanfordner(text))

def stanfordner(text):
    return nerify.get_entities(text)

@app.route("/abstractify",  methods=['POST'])
def abstractify():
    text = request.form["text"].encode("utf-8")
    return abstract(text)

def abstract(text):

    date = str(datetime.datetime.now())

    with open("nth_log_" + date + ".orig.txt", 'w') as myFile:
        myFile.write(text)

    db.setdefault('progress', 0) # Default progress is 0
    count = 0 # Just starting
    db['progress'] = count # Set current progress

    ne = stanfordner(text)
    transformations = {}

    if 'PERSON' in ne:
        people = ne['PERSON']
        for p in people:
            print p
            print "person"
            transformations[p] = get_replacement(p, altperson)

    if 'LOCATION' in ne:
        places = ne['LOCATION']
        for l in places:
            print l
            print "location"
            transformations[l] = get_replacement(l, altloc)

    if 'ORGANIZATION' in ne:
        orgs = ne['ORGANIZATION']
        for o in orgs:
            print o
            print "object"
            transformations[o] = get_replacement(o, altorg)

    count = 50 # Half way done

    #tokenize for tagger
    wordlists = [word_tokenize(s) for s in sent_tokenize(text)]

    # flatten the word lists
    words = [item for sublist in wordlists for item in sublist]

    increment = 50.0/len(words) # Calculate increment for progress bar

    # Randomly reduce wordlists, we want to make this faster
    # wordlists = random.sample(wordlists, len(wordlists)/2)

    ascii_word_list = []
    for word in words:
        try:
            word.decode('ascii')
            ascii_word_list.append(word)
        except UnicodeDecodeError:
            print "it was not a ascii-encoded unicode string"
            print word

    pos = st.tag(ascii_word_list)

    for pair in pos:
        count += increment
        db['progress'] = count # Update value for progress bar
        word = pair[0]
        postag = pair[1]
        if not re.match(punct, word) and word.lower() not in top1k:
            if not part_of_word_in_list(transformations, word):
                if postag.startswith('NNP'):
                    print word
                    print 'NNP'
                    transformations[word] = get_replacement(word, altnoun)
                elif postag.startswith('NNPS'):
                    print word
                    print 'NNPS'
                    transformations[word] = get_replacement(word, altnoun_plural)
                elif postag.startswith('VB'):
                    print word
                    print 'VB'
                    transformations[word] = get_replacement(word, altverb)
                elif postag.startswith('VBD'):
                    print word
                    print 'VBD'
                    transformations[word] = get_replacement(word, altverb_past)

    db['progress'] = 0 # Reset value for next run

    vague_message = ""
    for w in words:
        try:
            t = transformations[w]
            vague_message += " " + t
        except:
            vague_message += " " + w

    with open("nth_log_" + date + ".vague.txt", 'w') as myFile:
        myFile.write(vague_message)

    return jsonify(transformations)

def part_of_word_in_list(list, word):
    for w in list:
        if word in w:
            return True

    return False

def proper_case(original, replacement):
    if original[0].isupper():
        return  replacement[0].upper() + replacement[1:]
    else:
        return replacement

def get_next_alt(alt_list):
    element = alt_list.pop()
    alt_list.appendleft(element)

    return element

def get_replacement(original, alt_list):
    alt = get_next_alt(alt_list)
    # replacement = proper_case(original, alt)

    return alt

if __name__ == "__main__":
    app.run(debug=True, threaded=True)


text:
export class Game {
    _id: string;
    pgn: string;
    analysis: {
        moves: [
                {
                    bestMove: string,
                    score: {
                        cp: string,
                        mate: string
                    }
                }
        ],
        status: string,
        progress: number
    };
    white: string;
    black: string;
    whiteElo: string;
    blackElo: string;
    round: string;
    result: string;
    event: string;
    site: string;
    datePlayed: string;
    dateUploaded: Date;
    uploadedByUserId: string;
}


text:
public class Solution {
    public ArrayList<String> generateParenthesis(int n) {
        ArrayList<String> result = new ArrayList<String>();
        generate(n, 0, 0, new char[2 * n], result);
        return result;
    }

    private void generate(int n, int left, int right, char[] array,
            ArrayList<String> result) {
        int k = left + right;
        if (k == n * 2) {
            result.add(new String(array));
            return;
        }
        if (left < n) {
            array[k] = '(';
            generate(n, left + 1, right, array, result);
        }
        if (right < left) {
            array[k] = ')';
            generate(n, left, right + 1, array, result);
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Global Variables</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen_style.css" rel="stylesheet" type="text/css" />

MTB CAT1 Peripheral driver library

Variables

Global Variables
Startup » Startup CAT1A

General Description

Variables

uint32_t 	cy_BleEcoClockFreqHz

 	Holds the Alternate high frequency clock in Hz.  More...

Variable Documentation

◆ cy_BleEcoClockFreqHz

          uint32_t cy_BleEcoClockFreqHz

Holds the Alternate high frequency clock in Hz.

Updated by Cy_BLE_EcoConfigure().