text:
Command build tool for [Arduino][arduino] development built using
[Node.js][nodejs]. Allows installing library dependencies using the wonderful
package manager [Npm][npm].

Inspiration taken from the [Ino][ino] project.

## Installation

`$ npm install -g leo`

## Basic Usage

Create a new example Blink project

`$ leo new Blink`

Move into project directory

`$ cd Blink`

Build hex file

`$ leo build -b yun`

`$ leo build -b uno`

## Usage

```
$ leo -h

  Usage: leo [options] [command]

  Commands:

    boards                 List boards available.
    build [options]        Build firmware for the project in the current directory.
    preproc [options] <sketch> Compile sketch to valid c++ source
    *

  Options:

    -h, --help     output usage information
    -V, --version  output the version number
```

## License

MIT

[nodejs]: http://nodejs.org/ "Node.js"
[arduino]: http://arduino.cc/ "Arduino"
[ino]: http://inotool.org/ "Ino Build Tool"
[npm]: http://npmjs.org/ "Node Package Manager"

redpajama_set_name: RedPajamaGithub


text:
namespace FlubuCore.Context
{
    public static class BuildProps
    {
        public const string OSPlatform = "os_platform";
        public const string BuildVersion = "build_version";

        public const string BuildConfiguration = "build_configuration";

        public const string ProductId = "product_id";

        public const string ProductRootDir = "product_root_dir";

        public const string DotNetExecutable = "dotnet_executable";

        public const string NodeExecutablePath = "node_executable_path";

        public const string UserProfileFolder = "user_profile_folder";
        public const string NpmPath = "npm_path";

        public const string SolutionFileName = "solution_file_name";
        public const string Solution = "solution";
        public const string NUnitConsolePath = "nunit_console_path";
        public const string XUnitConsolePath = "xunit_console_path";

        public const string FlubuWebApiBaseUrl = "webapi_url";

        public const string IsWebApi = "is_webapi";

        public const string SqlCmdExecutable = "sqlcmd_executable";

        internal const string LastWebApiBaseUrl = "LastWebApiBaseUrl";
    }
}


text:
package com.offbynull.portmapper.gateways.network.internalmessages;

/**
 * Kill the network gateway. There is no response to this message, the network gateway closes all sockets and shuts down after receiving
 * this message.
 * @author Kasra Faghihi
 */
public final class KillNetworkRequest implements NetworkRequest {

    public String toString() {
        return "KillNetworkRequest{" + '}';
    }

}


text:
#ifndef NETSI_MAC_ASSIGNER_H
#define NETSI_MAC_ASSIGNER_H

#include <map>
#include "protocols/ethernet/MAC_Address.h"

namespace de {
namespace njsm {
namespace netsi {

/**
 * @brief Generator for random unique MAC_Address es
 *
 * Provides a function for guaranteed unique (wrt this object)
 * MAC_Addresses.
 */
class MAC_Assigner {

  private:
    std::map<MAC_Address, int> m_address_table; /**< Map to remember already assigned addresses */
    std::uint64_t m_number_of_addresses = 0x1000000000000;        /**< The number of addresses the Assigner should give at most */

  public:

    std::uint64_t get_number_of_addresses() const noexcept;
    void set_number_of_addresses(std::uint64_t);

    bool is_address_used(MAC_Address) const noexcept;
    MAC_Address get_new_address();

    void clear() noexcept;

};

}
}
}

#endif //NETSI_MAC_ASSIGNER_H


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

// This library
#include <k4ainternal/image.h>
#include <k4ainternal/allocator.h>

// Dependent libraries
#include <azure_c_shared_utility/lock.h>
#include <azure_c_shared_utility/refcount.h>

// System dependencies
#include <stdlib.h>
#include <assert.h>

#ifndef _WIN32
#include <time.h>
#endif

typedef struct _image_context_t
{
    volatile long ref_count;
    LOCK_HANDLE lock;

    uint8_t *buffer;
    size_t buffer_size;

    k4a_image_format_t format;   /** capture type */
    int width_pixels;            /** width in pixels */
    int height_pixels;           /** height in pixels */
    int stride_bytes;            /** stride in bytes */
    uint64_t dev_timestamp_usec; /** device timestamp in microseconds */
    uint64_t sys_timestamp_nsec; /** system timestamp in nanoseconds */
    uint64_t exposure_time_usec; /** image exposure duration */
    size_t size_allocated;       /** size of the raw memory allocation */

    image_destroy_cb_t *memory_free_cb;
    void *memory_free_cb_context;

    union
    {
        struct
        {
            uint32_t white_balance;
            uint32_t iso_speed;
        } color;
    } metadata;

} image_context_t;

K4A_DECLARE_CONTEXT(k4a_image_t, image_context_t);

k4a_result_t image_create_from_buffer(k4a_image_format_t format,
                                      int width_pixels,
                                      int height_pixels,
                                      int stride_bytes,
                                      uint8_t *buffer,
                                      size_t buffer_size,
                                      image_destroy_cb_t *buffer_destroy_cb,
                                      void *buffer_destroy_cb_context,
                                      k4a_image_t *image_handle)
{
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, image_handle == NULL);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, format < K4A_IMAGE_FORMAT_COLOR_MJPG || format > K4A_IMAGE_FORMAT_CUSTOM);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, width_pixels <= 0 || width_pixels > 20000);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, height_pixels <= 0 || height_pixels > 20000);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, buffer == NULL);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, buffer_size == 0);

    image_context_t *image;
    k4a_result_t result;

    result = K4A_RESULT_FROM_BOOL((image = k4a_image_t_create(image_handle)) != NULL);

    if (K4A_SUCCEEDED(result))
    {
        image->format = format;
        image->width_pixels = width_pixels;
        image->height_pixels = height_pixels;
        image->stride_bytes = stride_bytes;
        image->buffer_size = buffer_size;
        image->buffer = buffer;
        image->ref_count = 1;
        image->memory_free_cb = buffer_destroy_cb;
        image->memory_free_cb_context = buffer_destroy_cb_context;
        image->lock = Lock_Init();
        result = K4A_RESULT_FROM_BOOL(image->lock != NULL);
    }

    //
    // NOTE: Contract is that if we fail this function, buffer is still valid and that caller needs to free the memory.
    // No failure in this function should result in buffer being freed.
    //
    if (K4A_FAILED(result) && *image_handle)
    {
        if (image)
        {
            // Don't free memory caller needs to do that if we fail
            image->buffer = NULL;
        }
        k4a_image_t_destroy(*image_handle);
        *image_handle = NULL;
    }

    return result;
}

static void image_default_free_function(void *buffer, void *context)
{
    (void)context;
    allocator_free(buffer);
}

static k4a_result_t image_create_empty_image(allocation_source_t source, size_t size, k4a_image_t *image_handle)
{
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, image_handle == NULL);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, size == 0);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, source < ALLOCATION_SOURCE_USER || source > ALLOCATION_SOURCE_USB_IMU);

    k4a_result_t result;
    image_context_t *image = NULL;

    result = K4A_RESULT_FROM_BOOL((image = k4a_image_t_create(image_handle)) != NULL);

    if (K4A_SUCCEEDED(result))
    {
        result = K4A_RESULT_FROM_BOOL((image->buffer = allocator_alloc(source, size)) != NULL);
    }

    if (K4A_SUCCEEDED(result))
    {
        image->ref_count = 1;
        image->buffer_size = size;
        image->memory_free_cb = image_default_free_function;
        image->memory_free_cb_context = NULL;
        image->lock = Lock_Init();
        result = K4A_RESULT_FROM_BOOL(image->lock != NULL);
    }

    if (K4A_FAILED(result))
    {
        image_dec_ref(*image_handle);
        *image_handle = NULL;
    }
    return result;
}

k4a_result_t image_create_empty_internal(allocation_source_t source, size_t size, k4a_image_t *image_handle)
{
    // User is special and only allowed to be used by the user through a public API.
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, image_handle == NULL);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, source == ALLOCATION_SOURCE_USER);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, size == 0);

    return image_create_empty_image(source, size, image_handle);
}

k4a_result_t image_create(k4a_image_format_t format,
                          int width_pixels,
                          int height_pixels,
                          int stride_bytes,
                          allocation_source_t source,
                          k4a_image_t *image_handle)
{
    // User is special and only allowed to be used by the user through a public API.
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, image_handle == NULL);
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED,
                        !(format >= K4A_IMAGE_FORMAT_COLOR_MJPG && format <= K4A_IMAGE_FORMAT_CUSTOM));
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, !(width_pixels > 0 && width_pixels < 20000));
    RETURN_VALUE_IF_ARG(K4A_RESULT_FAILED, !(height_pixels > 0 && height_pixels < 20000));

    image_context_t *image = NULL;
    k4a_result_t result;
    size_t size = 0;

    *image_handle = NULL;

    switch (format)
    {
    case K4A_IMAGE_FORMAT_COLOR_MJPG:
    {
        LOG_ERROR("K4A_IMAGE_FORMAT_COLOR_MJPG does not have a constant stride. Buffer size cannot be calculated.", 0);
        result = K4A_RESULT_FAILED;
        break;
    }

    case K4A_IMAGE_FORMAT_COLOR_NV12:
    {
        if (stride_bytes == 0)
        {
            // If stride isn't specified, assume the minimum stride
            stride_bytes = width_pixels;
        }

        if (height_pixels % 2 != 0)
        {
            LOG_ERROR("NV12 requires an even number of lines. Height %d is invalid.", height_pixels);
            result = K4A_RESULT_FAILED;
        }
        else if (width_pixels % 2 != 0)
        {
            LOG_ERROR("NV12 requires an even number of pixels per line. Width of %d is invalid.", width_pixels);
            result = K4A_RESULT_FAILED;
        }
        else if (stride_bytes < 1 * width_pixels)
        {
            LOG_ERROR("Insufficient stride (%d bytes) to represent image width (%d pixels).",
                      stride_bytes,
                      width_pixels);
            result = K4A_RESULT_FAILED;
        }
        else
        {
            // Calculate correct size for NV12 (extra color lines follow Y samples)
            size = 3 * (size_t)height_pixels * (size_t)stride_bytes / 2;
            result = K4A_RESULT_SUCCEEDED;
        }
        break;
    }

    // 1 Byte per pixel
    case K4A_IMAGE_FORMAT_CUSTOM8:
    {
        if (stride_bytes == 0)
        {
            // If stride isn't specified, assume the minimum stride
            stride_bytes = width_pixels;
        }

        if (stride_bytes < 1 * width_pixels)
        {
            LOG_ERROR("Insufficient stride (%d bytes) to represent image width (%d pixels).",
                      stride_bytes,
                      width_pixels);
            result = K4A_RESULT_FAILED;
        }
        else
        {
            size = (size_t)height_pixels * (size_t)stride_bytes;
            result = K4A_RESULT_SUCCEEDED;
        }
        break;
    }

    // 2 Bytes per pixel
    case K4A_IMAGE_FORMAT_DEPTH16:
    case K4A_IMAGE_FORMAT_IR16:
    case K4A_IMAGE_FORMAT_CUSTOM16:
    {
        if (stride_bytes == 0)
        {
            // If stride isn't specified, assume the minimum stride
            stride_bytes = width_pixels * 2;
        }

        if (stride_bytes < 2 * width_pixels)
        {
            LOG_ERROR("Insufficient stride (%d bytes) to represent image width (%d pixels).",
                      stride_bytes,
                      width_pixels);
            result = K4A_RESULT_FAILED;
        }
        else
        {
            size = (size_t)height_pixels * (size_t)stride_bytes;
            result = K4A_RESULT_SUCCEEDED;
        }
        break;
    }

    // 2 Bytes per pixel
    case K4A_IMAGE_FORMAT_COLOR_YUY2:
    {
        if (stride_bytes == 0)
        {
            // If stride isn't specified, assume the minimum stride
            stride_bytes = width_pixels * 2;
        }

        if (width_pixels % 2 != 0)
        {
            LOG_ERROR("YUY2 requires an even number of pixels per line. Width of %d is invalid.", width_pixels);
            result = K4A_RESULT_FAILED;
        }
        else if (stride_bytes < 2 * width_pixels)
        {
            LOG_ERROR("Insufficient stride (%d bytes) to represent image width (%d pixels).",
                      stride_bytes,
                      width_pixels);
            result = K4A_RESULT_FAILED;
        }
        else
        {
            size = (size_t)height_pixels * (size_t)stride_bytes;
            result = K4A_RESULT_SUCCEEDED;
        }
        break;
    }

    // 4 Bytes per pixel
    case K4A_IMAGE_FORMAT_COLOR_BGRA32:
    {
        if (stride_bytes == 0)
        {
            // If stride isn't specified, assume the minimum stride
            stride_bytes = width_pixels * 4;
        }

        if (stride_bytes < 4 * width_pixels)
        {
            LOG_ERROR("Insufficient stride (%d bytes) to represent image width (%d pixels).",
                      stride_bytes,
                      width_pixels);
            result = K4A_RESULT_FAILED;
        }
        else
        {
            size = (size_t)height_pixels * (size_t)stride_bytes;
            result = K4A_RESULT_SUCCEEDED;
        }
        break;
    }

    // Unknown
    case K4A_IMAGE_FORMAT_CUSTOM:
    default:
    {
        size = (size_t)height_pixels * (size_t)stride_bytes;
        result = K4A_RESULT_SUCCEEDED;
        break;
    }
    }

    if (K4A_SUCCEEDED(result))
    {
        result = TRACE_CALL(image_create_empty_image(source, size, image_handle));
    }

    if (K4A_SUCCEEDED(result))
    {
        result = K4A_RESULT_FROM_BOOL((image = k4a_image_t_get_context(*image_handle)) != NULL);
    }
    if (K4A_SUCCEEDED(result))
    {
        image->format = format;
        image->width_pixels = width_pixels;
        image->height_pixels = height_pixels;
        image->stride_bytes = stride_bytes;
    }

    if (K4A_FAILED(result) && *image_handle)
    {
        image_dec_ref(*image_handle);
        *image_handle = NULL;
        image = NULL;
    }

    return result;
}

void image_dec_ref(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);

    long count = DEC_REF_VAR(image->ref_count);

    if (count == 0)
    {
        if (image->memory_free_cb)
        {
            image->memory_free_cb(image->buffer, image->memory_free_cb_context);
        }
        Lock_Deinit(image->lock);
        k4a_image_t_destroy(image_handle);
    }
}

void image_inc_ref(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);

    INC_REF_VAR(image->ref_count);
}

uint8_t *image_get_buffer(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(NULL, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->buffer;
}

size_t image_get_size(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->buffer_size;
}

void image_set_size(k4a_image_t image_handle, size_t size)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);

    // We should only be reducing the size
    assert(image->buffer_size >= size);
    image->buffer_size = size;
}

k4a_image_format_t image_get_format(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(K4A_IMAGE_FORMAT_CUSTOM, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->format;
}

int image_get_width_pixels(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->width_pixels;
}

int image_get_height_pixels(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->height_pixels;
}

int image_get_stride_bytes(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->stride_bytes;
}

uint64_t image_get_device_timestamp_usec(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->dev_timestamp_usec;
}

uint64_t image_get_system_timestamp_nsec(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->sys_timestamp_nsec;
}

uint64_t image_get_exposure_usec(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->exposure_time_usec;
}

uint32_t image_get_white_balance(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->metadata.color.white_balance;
}

uint32_t image_get_iso_speed(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(0, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    return image->metadata.color.iso_speed;
}

void image_set_device_timestamp_usec(k4a_image_t image_handle, uint64_t timestamp_usec)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    image->dev_timestamp_usec = timestamp_usec;
}

void image_set_system_timestamp_nsec(k4a_image_t image_handle, uint64_t timestamp_nsec)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    image->sys_timestamp_nsec = timestamp_nsec;
}

k4a_result_t image_apply_system_timestamp(k4a_image_t image_handle)
{
    RETURN_VALUE_IF_HANDLE_INVALID(K4A_RESULT_FAILED, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    k4a_result_t result;

#ifdef _WIN32
    LARGE_INTEGER qpc = { 0 }, freq = { 0 };
    result = K4A_RESULT_FROM_BOOL(QueryPerformanceCounter(&qpc) != 0);
    if (K4A_SUCCEEDED(result))
    {
        result = K4A_RESULT_FROM_BOOL(QueryPerformanceFrequency(&freq) != 0);
    }

    if (K4A_SUCCEEDED(result))
    {
        // Calculate seconds in such a way we minimize overflow.
        // Rollover happens, for a 1MHz Freq, when qpc.QuadPart > 0x003F FFFF FFFF FFFF; ~571 Years after boot.
        image->sys_timestamp_nsec = qpc.QuadPart / freq.QuadPart * 1000000000;
        image->sys_timestamp_nsec += qpc.QuadPart % freq.QuadPart * 1000000000 / freq.QuadPart;
    }
#else
    struct timespec ts_time;
    result = K4A_RESULT_FROM_BOOL(clock_gettime(CLOCK_MONOTONIC, &ts_time) == 0);
    if (K4A_SUCCEEDED(result))
    {
        // Rollover happens about ~136 years after boot.
        image->sys_timestamp_nsec = (uint64_t)ts_time.tv_sec * 1000000000 + (uint64_t)ts_time.tv_nsec;
    }
#endif

    return result;
}

void image_set_exposure_usec(k4a_image_t image_handle, uint64_t exposure_usec)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    image->exposure_time_usec = exposure_usec;
}

void image_set_white_balance(k4a_image_t image_handle, uint32_t white_balance)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    image->metadata.color.white_balance = white_balance;
}

void image_set_iso_speed(k4a_image_t image_handle, uint32_t iso_speed)
{
    RETURN_VALUE_IF_HANDLE_INVALID(VOID_VALUE, k4a_image_t, image_handle);
    image_context_t *image = k4a_image_t_get_context(image_handle);
    image->metadata.color.iso_speed = iso_speed;
}


text:
from subprocess import *
import re
from datetime import datetime
import dateutil.parser
import sys
import requests

def parseIssues(message):
    issuesRet = []
    issues = re.findall('[#][0-9]+',message)
    if issues != None:
        for issue in issues:
            issuesRet.append(issue[1:])
    return issuesRet

def f4(seq):
   # order preserving
   noDupes = []
   [noDupes.append(i) for i in seq if not noDupes.count(i)]
   return noDupes

headers = {'Authorization':'token ' + sys.argv[2]}

GIT_COMMIT_FIELDS = ['id', 'author_name', 'author_email', 'date', 'message']
GIT_LOG_FORMAT = ['%H', '%an', '%ae', '%ai', '%s']
GIT_LOG_FORMAT = '%x1f'.join(GIT_LOG_FORMAT) + '%x1e'

#print repo.git.log(p=False)

allIssues = []

p = Popen('git log --format="%s" ' % GIT_LOG_FORMAT, shell=True, stdout=PIPE)
(logb, _) = p.communicate()
log = str(logb,"utf-8")
log = log.strip('\n\x1e')

log = log.split("\x1e")
log = [row.strip().split("\x1f") for row in log]
log = [dict(zip(GIT_COMMIT_FIELDS, row)) for row in log]

notbefore = dateutil.parser.parse(sys.argv[1] + ' 00:00:00 -0400')

for commit in log:
    created = dateutil.parser.parse(commit['date'])
    if created > notbefore:
        message = commit['message']
        allIssues.extend(parseIssues(message))

allIssues = f4(allIssues)

bylabels = {}

for issue in allIssues:
    issueURL = 'https://api.github.com/repos/TremoloSecurity/MyVirtualDirectory/issues/' + issue
    r = requests.get(issueURL,headers=headers)
    json = r.json();
    for label in json['labels']:
        if not (label['name'] in bylabels):
            labelGroup = []
            bylabels[label["name"]] = labelGroup
        labelGroup = bylabels[label['name']]
        labelGroup.append(json)

for label in bylabels:
    print('**' + label + 's:**')
    for issue in bylabels[label]:
        print(' - ' + issue['title'] + ' [\\#' + str(issue['number']) + '](' + issue['html_url'] + ')')
    print()


text:
const {Readable} = require('stream');
const formatters = require('../../src/formatters');
const moment = require('moment');

describe('Formatters', () => {
  const elements = [{
    name: 'Rey',
    alignment: 'Light',
    born: moment('1990-07-31')
  }, {
    name: 'Kylo',
    alignment: 'Dark',
    born: moment('1990-08-02')
  }];

  const schema = {
    name: 'String',
    alignment: 'String',
    born: 'Date'
  };

  describe('itemDetails', () => {
    it('lists all properties for an element', () => {
      const formatter = formatters.itemDetailFormatter(undefined, schema);
      formatter.write(elements[0]);
      expect(String(formatter.read())).toBe('name: Rey\nalignment: Light\nborn: 1990-07-31\n');
    });
    it('lists only specified keys for an element', () => {
      const formatter = formatters.itemDetailFormatter(['alignment'], schema);
      formatter.write(elements[0]);
      expect(String(formatter.read())).toBe('alignment: Light\n');
    });
    it('respects formatting configuration', () => {
      const formatter = formatters.itemDetailFormatter([{key: 'born', format: 'MM-DD'}], schema);
      formatter.write(elements[0]);
      expect(String(formatter.read())).toBe('born: 07-31\n');
    });
  });

  describe('itemSummary', () => {
    it('lists items in tab-delimited rows', () => {
      const formatter = formatters.itemSummaryFormatter(undefined, schema);
      formatter.write(elements[1]);
      expect(String(formatter.read())).toBe('Kylo\tDark\t1990-08-02\n');
    });
    it('lists only specified keys for each element', () => {
      const formatter = formatters.itemSummaryFormatter(['name'], schema);
      formatter.write(elements[1]);
      expect(String(formatter.read())).toBe('Kylo\n');
    });
  });
});


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Linnaea 4: 118 (1829)

#### Original name
Rhytisma psidii F. Rudolphi

### Remarks
null


text:
<!DOCTYPE html>

    <title>Heartysoft Solutions Limited</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="utf-8">
    <meta name="description" content="Twitter bootstrap theme">
    <meta name="author" content="prettystrap">

    <link id="the-story-css-file" href="/css/the-story.min.css" rel="stylesheet" media="screen">
    <link id="the-story-css-file" href="/css/hsft.css" rel="stylesheet" media="screen">

    <link rel="shortcut icon" href="/favicon.ico">

    <meta http-equiv=X-UA-Compatible content=IE=edge>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    Toggle navigation

                </button>
                Heartysoft Solutions Limited
                Heartysoft

HSFT

Services

Technology

            Community

                Blog

Ashic's Blog

ramblings of a technologist...standing on the shoulders of giants and all that...

                Blog Archive

Setting Timeouts for Session and Authentication

                    ASP.NET

            29 Sep, 2008

        Tweet

Setting the timeouts for Session and Authentication can be a bit tricky. If not set properly, your user may be logged in when the Session expires. If you’re app depends on Session specific to the logged in user, you’ll have problems. By default, the Authentication timeout is 30 minutes while for that of Session is 20 minutes. Here’s how you can change that on a site wise basis:

Session

Under <system.web>, add this node:

<sessionState timeout="30"></sessionState>

Authentication

Under <system.web>, have this node:

<authentication mode="Forms">
      <forms timeout="20"></forms>
</authentication>

For both, the timeout is in minutes. Also, note that there are a host of other settings you can change for Authentication, which you can set within the <forms> tag. Intellisense does work.

A lot of people think setting the Session timeout will ensure that the user gets logged out after the Session expires. This is probably because of the fact that there’s no timeout in the <authentication> node. The reason that there isn’t one is because there are two types of authentication accessible in the <authentication> section: 1) Forms and 2) Passport. There can be different settings for each, and hence the timeout needs to be set in the <forms> tag under the <authentication> tags.

Hope that helps.

Please enable JavaScript to view the comments powered by Disqus.
comments powered by Disqus

                © 2014 heartysoft.com | all rights reserved | To top

                    Heartysoft Solutions Limited is registered in England & Wales
                    Company Number 07420608 | VAT Number GB 103 3162 72


text:
namespace Ramble
{

}


text:
package hex.deeplearning;

import hex.genmodel.algos.deeplearning.DeeplearningMojoModel;
import hex.genmodel.easy.RowData;
import hex.genmodel.easy.exception.PredictException;
import hex.genmodel.easy.prediction.AutoEncoderModelPrediction;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import water.*;
import water.fvec.*;
import water.parser.BufferedString;
import water.parser.ParseDataset;
import water.util.Log;
import hex.deeplearning.DeepLearningModel.DeepLearningParameters;
import hex.genmodel.easy.EasyPredictModelWrapper;

import java.io.IOException;
import java.util.HashSet;

public class DeepLearningAutoEncoderTest extends TestUtil {
  /*
    Visualize outliers with the following R code (from smalldata/anomaly dir):

    train <- scan("ecg_discord_train.csv", sep=",")
    test  <- scan("ecg_discord_test.csv",  sep=",")
    plot.ts(train)
    plot.ts(test)
  */

  static final String PATH = "smalldata/anomaly/ecg_discord_train.csv"; //first 20 points
  static final String PATH2 = "smalldata/anomaly/ecg_discord_test.csv"; //first 22 points

  @BeforeClass() public static void setup() { stall_till_cloudsize(1); }

  @Test
  public void run() {
    long seed = 0xDECAF;

    Frame train=null, test=null;

    try {

      NFSFileVec  nfs = TestUtil.makeNfsFileVec(PATH);
      train = ParseDataset.parse(Key.make("train.hex"), nfs._key);
      NFSFileVec  nfs2 = TestUtil.makeNfsFileVec(PATH2);
      test = ParseDataset.parse(Key.make("test.hex"), nfs2._key);

      for (float sparsity_beta : new float[]{0, 0.1f}) {
        DeepLearningParameters p = new DeepLearningParameters();
        p._train = train._key;
        p._valid = test._key;
        p._autoencoder = true;
        p._response_column = train.names()[train.names().length-1];
        p._seed = seed;
        p._hidden = new int[]{37, 12};
        p._adaptive_rate = true;
        p._train_samples_per_iteration = -1;
        p._sparsity_beta = sparsity_beta;
        p._average_activation = -0.7;
        p._l1 = 1e-4;
        p._activation = DeepLearningParameters.Activation.TanhWithDropout;
        p._loss = DeepLearningParameters.Loss.Absolute;
        p._epochs = 13.3;
        p._force_load_balance = true;
        p._elastic_averaging = false;
        DeepLearning dl = new DeepLearning(p);
        DeepLearningModel mymodel = dl.trainModel().get();

        Frame l2_frame_train=null, l2_frame_test=null;

        // Verification of results
        StringBuilder sb = new StringBuilder();
        try {

          sb.append("Verifying results.\n");

          // Training data

          // Reconstruct data using the same helper functions and verify that self-reported MSE agrees
          double quantile = 0.95;

          l2_frame_test = mymodel.scoreAutoEncoder(test, Key.make(), true);
          sb.append("Reconstruction error per feature (test): ").append(l2_frame_test.toString()).append("\n");
          l2_frame_test.remove();

          l2_frame_test = mymodel.scoreAutoEncoder(test, Key.make(), false);
          Vec l2_test = l2_frame_test.anyVec();
          sb.append("Mean reconstruction error (test): ").append(l2_test.mean()).append("\n");
          Assert.assertEquals(l2_test.mean(), mymodel.mse(), 1e-7);
          Assert.assertTrue("too big a reconstruction error: " + l2_test.mean(), l2_test.mean() < 2.0);
          l2_test.remove();

          // manually compute L2
          Frame reconstr = mymodel.score(train); //this creates real values in original space
          Assert.assertTrue(mymodel.testJavaScoring(train,reconstr,1e-6));

          l2_frame_train = mymodel.scoreAutoEncoder(train, Key.make(), false);
          final Vec l2_train = l2_frame_train.anyVec();
          double mean_l2 = 0;
          for (int r = 0; r < reconstr.numRows(); ++r) {
            double my_l2 = 0;
            for (int c = 0; c < reconstr.numCols(); ++c) {
              my_l2 += Math.pow((reconstr.vec(c).at(r) - train.vec(c).at(r)) * mymodel.model_info().data_info()._normMul[c], 2); //undo normalization here
            }
            my_l2 /= reconstr.numCols();
            mean_l2 += my_l2;
          }
          mean_l2 /= reconstr.numRows();
          reconstr.delete();
          sb.append("Mean reconstruction error (train): ").append(l2_train.mean()).append("\n");
          Assert.assertEquals(mymodel._output.errors.scored_train._mse, mean_l2, 1e-7);

          // print stats and potential outliers
          sb.append("The following training points are reconstructed with an error above the ").append(quantile * 100).append("-th percentile - check for \"goodness\" of training data.\n");
          double thresh_train = mymodel.calcOutlierThreshold(l2_train, quantile);
          for (long i = 0; i < l2_train.length(); i++) {
            if (l2_train.at(i) > thresh_train) {
              sb.append(String.format("row %d : l2_train error = %5f\n", i, l2_train.at(i)));
            }
          }

          // Test data

          // Reconstruct data using the same helper functions and verify that self-reported MSE agrees
          l2_frame_test.remove();
          l2_frame_test = mymodel.scoreAutoEncoder(test, Key.make(), false);
          l2_test = l2_frame_test.anyVec();
          double mult = 10;
          double thresh_test = mult * thresh_train;
          sb.append("\nFinding outliers.\n");
          sb.append("Mean reconstruction error (test): ").append(l2_test.mean()).append("\n");

          Frame df1 = mymodel.scoreDeepFeatures(test, 0);
          Assert.assertTrue(df1.numCols() == 37);
          Assert.assertTrue(df1.numRows() == test.numRows());
          df1.delete();

          Frame df2 = mymodel.scoreDeepFeatures(test, 1);
          Assert.assertTrue(df2.numCols() == 12);
          Assert.assertTrue(df2.numRows() == test.numRows());
          df2.delete();

          // print stats and potential outliers
          sb.append("The following test points are reconstructed with an error greater than ").append(mult)
                  .append(" times the mean reconstruction error of the training data:\n");
          HashSet<Long> outliers = new HashSet<>();
          for (long i = 0; i < l2_test.length(); i++) {
            if (l2_test.at(i) > thresh_test) {
              outliers.add(i);
              sb.append(String.format("row %d : l2 error = %5f\n", i, l2_test.at(i)));
            }
          }

          // check that the all outliers are found (and nothing else)
          Assert.assertTrue(outliers.contains(new Long(20)));
          Assert.assertTrue(outliers.contains(new Long(21)));
          Assert.assertTrue(outliers.contains(new Long(22)));
          Assert.assertTrue(outliers.size() == 3);

          // check if reconstruction error is the same from model and mojo model too. Testcase for PUBDEV-6030.
          try {
            DeeplearningMojoModel mojoModel = (DeeplearningMojoModel) mymodel.toMojo();
            EasyPredictModelWrapper model = new EasyPredictModelWrapper(mojoModel);
            AutoEncoderModelPrediction tmpPrediction;
            double calcNormMse = 0;
            for (int r = 0; r < train.numRows(); r++) {
              RowData tmpRow = new RowData();
              BufferedString bStr = new BufferedString();
              for (int c = 0; c < train.numCols(); c++) {
                if (train.vec(c).isCategorical()) {
                  tmpRow.put(train.names()[c], train.vec(c).atStr(bStr, r).toString());
                } else {
                  tmpRow.put(train.names()[c],  train.vec(c).at(r));
                }
              }
              tmpPrediction = model.predictAutoEncoder(tmpRow);
              calcNormMse += tmpPrediction.mse;
            }
            double mojoMeanError = calcNormMse/train.numRows();
            sb.append("Mojo mean reconstruction error (train): ").append(mojoMeanError).append("\n");
            sb.append("Mean reconstruction error should be the same from model compare to mojo model " +
                    "reconstruction error: ");
            sb.append(mean_l2).append(" == ").append(mojoMeanError).append("\n");
            Assert.assertEquals( mean_l2, mojoMeanError, 1e-7);
          } catch (IOException error) {
            Assert.fail("IOException when testing mojo mean reconstruction error: "+error.toString());
          } catch (PredictException error){
            Assert.fail("PredictException when testing mojo mean reconstruction error: "+error.toString());
          }
        } finally {
          Log.info(sb);
          // cleanup
          if (mymodel != null) mymodel.delete();
          if (l2_frame_train != null) l2_frame_train.delete();
          if (l2_frame_test != null) l2_frame_test.delete();
        }
      }
    } finally {
      if (train!=null) train.delete();
      if (test!=null) test.delete();
    }
  }
}


text:
num: "lect05"
desc: "Chapter 2.4- 2.5 Friend functions, review of references, gdb"
ready: true
pdfurl: /lectures/CS24_Lecture5.pdf
annotatedpdfurl: /lectures/CS24_Lecture5_ann.pdf
annotatedready: true
lecture_date: 2017-04-17
---

# Topics

* Wrap up of chapter 2: friend functions, more on operator overloading
* Intro to gdb


text:
package org.ros.internal.message.new_style;

import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;

import java.nio.ByteBuffer;
import java.util.List;

/**
 * @author damonkohler@google.com (Damon Kohler)
 *
 * @param <T>
 *          the value type
 */
public class ListField<T> extends Field {

  private List<T> value;

  static <T> ListField<T> newConstant(String name, FieldType type, List<T> value) {
    return new ListField<T>(name, type, value, true);
  }

  static <T> ListField<T> newValue(String name, FieldType type) {
    // TODO(damonkohler): All values should have a default.
    return new ListField<T>(name, type, null, false);
  }

  private ListField(String name, FieldType type, List<T> value, boolean isConstant) {
    super(name, type, isConstant);
    this.value = value;
  }

  @SuppressWarnings("unchecked")
  @Override
  public List<T> getValue() {
    return value;
  }

  @SuppressWarnings("unchecked")
  @Override
  public void setValue(Object value) {
    Preconditions.checkState(!isConstant);
    this.value = (List<T>) value;
  }

  @Override
  public void serialize(ByteBuffer buffer) {
    buffer.putInt(value.size());
    for (T v : value) {
      type.serialize(v, buffer);
    }
  }

  @Override
  public void deserialize(ByteBuffer buffer) {
    int size = buffer.getInt();
    value = Lists.newArrayList();
    for (int i = 0; i < size; i++) {
      value.add(type.<T>deserialize(buffer));
    }
  }

  @SuppressWarnings("unchecked")
  @Override
  public int getSerializedSize() {
    Preconditions.checkNotNull(value);
    // Reserve 4 bytes for the length.
    int size = 4;
    if (type instanceof MessageFieldType) {
      for (Message message : (List<Message>) value) {
        size += message.getSerializedSize();
      }
    } else if (type == PrimitiveFieldType.STRING) {
      for (String string : (List<String>) value) {
        // We only support ASCII strings and reserve 4 bytes for the length.
        size += string.length() + 4;
      }
    } else {
      size += type.getSerializedSize() * ((List<?>) value).size();
    }
    return size;
  }

  @Override
  public String toString() {
    return "ListField<" + name + ", " + type + ">";
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + (isConstant ? 1231 : 1237);
    result = prime * result + ((name == null) ? 0 : name.hashCode());
    result = prime * result + ((type == null) ? 0 : type.hashCode());
    result = prime * result + ((value == null) ? 0 : value.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    ListField<?> other = (ListField<?>) obj;
    if (isConstant != other.isConstant) return false;
    if (name == null) {
      if (other.name != null) return false;
    } else if (!name.equals(other.name)) return false;
    if (type == null) {
      if (other.type != null) return false;
    } else if (!type.equals(other.type)) return false;
    if (value == null) {
      if (other.value != null) return false;
    } else if (!value.equals(other.value)) return false;
    return true;
  }
}


text:
class LEDControl;
struct BOINCTask;

class BOINCData
{
  public:
    BOINCData(LEDControl *led_control);
    ~BOINCData() {};

    void update();
    void display();

  private:
    LEDControl *led;

    std::map<std::string, std::shared_ptr<BOINCTask>> tasks;

    std::shared_ptr<BOINCTask> parse_boinc_data(std::ifstream& boinc_info);
    void boinc_skip_lines(std::ifstream& boinc_info, uint32_t num_lines);
    void boinc_skip_to_value(std::ifstream& boinc_info);

    void update_leds();
};

#endif //__BOINCDATA_H__


text:
package de.taimos.dvalin.test.inject;

/*-
 * #%L
 * Test support for dvalin
 * %%
 * Copyright (C) 2016 - 2017 Taimos GmbH
 * %%
 * 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.
 * #L%
 */

import org.junit.Assert;
import org.junit.Test;

import de.taimos.dvalin.test.AbstractMockitoTest;

public class InjectionUtilsTest extends AbstractMockitoTest {

	@Test
	public void injectSingle() throws Exception {
		BeanA a = new BeanA();
		BeanB b = new BeanB();

		MyBean bean = new MyBean();
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, a);
		Assert.assertTrue(bean.getaField() == a);
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, b);
		Assert.assertTrue(bean.getaField() == a);
		Assert.assertTrue(bean.getbField() == b);
		Assert.assertNull(bean.getcField());
	}

	@Test
	public void injectMulti() throws Exception {
		BeanA a = new BeanA();
		BeanB b = new BeanB();

		MyBean bean = new MyBean();
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, a, b);

		Assert.assertTrue(bean.getaField() == a);
		Assert.assertTrue(bean.getbField() == b);
		Assert.assertNull(bean.getcField());
	}

    @Test
    public void injectAll() throws Exception {
        MyBean bean = new MyBean();
        Assert.assertNull(bean.getaField());
        Assert.assertNull(bean.getbField());
        Assert.assertNull(bean.getcField());

        InjectionMock mocks = InjectionUtils.injectMocks(bean);
        Assert.assertNotNull(bean.getaField());
        Assert.assertNotNull(bean.getbField());
        Assert.assertNotNull(bean.getcField());
        Assert.assertNull(bean.getoField());
        Assert.assertNull(bean.getValue1());
        Assert.assertNull(bean.getValue2());
        Assert.assertNull(bean.getValue3());

        Assert.assertSame(bean.getaField(), mocks.getMock("aField"));
        Assert.assertSame(bean.getaField(), mocks.getMock(BeanA.class));
        Assert.assertSame(bean.getbField(), mocks.getMock("bField"));
        Assert.assertSame(bean.getbField(), mocks.getMock(BeanB.class));
        Assert.assertSame(bean.getcField(), mocks.getMock("cField"));
        Assert.assertSame(bean.getcField(), mocks.getMock(BeanC.class));
        Assert.assertSame(bean.getcField(), mocks.getMock(BeanC.class, "specialBean"));
        Assert.assertNull(mocks.getMock(BeanC.class, "invalidQualifier"));

        Assert.assertNull(mocks.getMock(BeanA.class, "invalidQualifier"));
        Assert.assertNull(mocks.getMock(Object.class));
        Assert.assertNull(mocks.getMock("oField"));
        Assert.assertNull(mocks.getMock("nonExisting"));
    }

	@Test
	public void injectWithQualifier() throws Exception {
		BeanC c = new BeanC();

		MyBean bean = new MyBean();
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, "specialBean", c);
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertTrue(bean.getcField() == c);
	}

	@Test
	public void injectUnqualifiedFieldWithQualifier() throws Exception {
		BeanB b = new BeanB();

		MyBean bean = new MyBean();
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, "myQualifier", b);
		Assert.assertNull(bean.getaField());
		Assert.assertTrue(bean.getbField() == b);
		Assert.assertNull(bean.getcField());
	}

	@Test(expected = RuntimeException.class)
	public void injectWithWrongQualifier() throws Exception {
		BeanC c = new BeanC();

		MyBean bean = new MyBean();
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, "wrongQualifier", c);
	}

	@Test(expected = RuntimeException.class)
	public void injectWithoutQualifier() throws Exception {
		BeanC c = new BeanC();

		MyBean bean = new MyBean();
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, c);
	}

	@Test(expected = RuntimeException.class)
	public void injectNonwiredDependency() throws Exception {
		Object o = new Object();

		MyBean bean = new MyBean();
		Assert.assertNull(bean.getaField());
		Assert.assertNull(bean.getbField());
		Assert.assertNull(bean.getcField());

		InjectionUtils.inject(bean, o);
	}

	@Test
	public void injectValue() throws Exception {
		MyBean bean = new MyBean();
		Assert.assertNull(bean.getValue1());
		Assert.assertNull(bean.getValue2());

		InjectionUtils.injectValue(bean, "value2", "foobar");
		Assert.assertNull(bean.getValue1());
		Assert.assertEquals("foobar", bean.getValue2());
	}

	@Test(expected = RuntimeException.class)
	public void injectValueIntoNonannotatedField() throws Exception {
		MyBean bean = new MyBean();
		Assert.assertNull(bean.getValue1());
		Assert.assertNull(bean.getValue2());

		InjectionUtils.injectValue(bean, "value1", "foobar");
	}

	@Test(expected = RuntimeException.class)
	public void injectValueIntoNonStringField() throws Exception {
		MyBean bean = new MyBean();
		Assert.assertNull(bean.getValue1());
		Assert.assertNull(bean.getValue2());

		InjectionUtils.injectValue(bean, "oField", "foobar");
	}

	@Test(expected = RuntimeException.class)
	public void injectValueIntoNonStringField2() throws Exception {
		MyBean bean = new MyBean();
		Assert.assertNull(bean.getValue1());
		Assert.assertNull(bean.getValue2());

		InjectionUtils.injectValue(bean, "value3", "foobar");
	}

	@Test(expected = RuntimeException.class)
	public void injectValueIntoNonExistingField() throws Exception {
		MyBean bean = new MyBean();
		Assert.assertNull(bean.getValue1());
		Assert.assertNull(bean.getValue2());

		InjectionUtils.injectValue(bean, "nonExisting", "foobar");
	}
}


text:
import rgbimg, os, uu

from test_support import verbose, unlink, findfile

class error(Exception):
        pass

print 'RGBimg test suite:'

def testimg(rgb_file, raw_file):
        rgb_file = findfile(rgb_file)
        raw_file = findfile(raw_file)
        width, height = rgbimg.sizeofimage(rgb_file)
        rgb = rgbimg.longimagedata(rgb_file)
        if len(rgb) != width * height * 4:
                raise error, 'bad image length'
        raw = open(raw_file, 'rb').read()
        if rgb != raw:
                raise error, \
                      'images don\'t match for '+rgb_file+' and '+raw_file
        for depth in [1, 3, 4]:
                rgbimg.longstoimage(rgb, width, height, depth, '@.rgb')
        os.unlink('@.rgb')

table = [
    ('testrgb.uue', 'test.rgb'),
    ('testimg.uue', 'test.rawimg'),
    ('testimgr.uue', 'test.rawimg.rev'),
    ]
for source, target in table:
    source = findfile(source)
    target = findfile(target)
    if verbose:
        print "uudecoding", source, "->", target, "..."
    uu.decode(source, target)

if verbose:
    print "testing..."

ttob = rgbimg.ttob(0)
if ttob != 0:
        raise error, 'ttob should start out as zero'

testimg('test.rgb', 'test.rawimg')

ttob = rgbimg.ttob(1)
if ttob != 0:
        raise error, 'ttob should be zero'

testimg('test.rgb', 'test.rawimg.rev')

ttob = rgbimg.ttob(0)
if ttob != 1:
        raise error, 'ttob should be one'

ttob = rgbimg.ttob(0)
if ttob != 0:
        raise error, 'ttob should be zero'

for source, target in table:
    unlink(findfile(target))


text:
namespace reporting {

class AudioEventsObserver
    : public reporting::CrosHealthdEventsObserverBase<
          chromeos::cros_healthd::mojom::CrosHealthdAudioObserver>,
      public chromeos::cros_healthd::mojom::CrosHealthdAudioObserver {
 public:
  AudioEventsObserver();

  AudioEventsObserver(const AudioEventsObserver& other) = delete;
  AudioEventsObserver& operator=(const AudioEventsObserver& other) = delete;

  ~AudioEventsObserver() override;

  // chromeos::cros_healthd::mojom::CrosHealthdAudioObserver:
  void OnUnderrun() override;

  void OnSevereUnderrun() override;

 protected:
  // CrosHealthdEventsObserverBase
  void AddObserver() override;
};
}  // namespace reporting

#endif  // CHROME_BROWSER_ASH_POLICY_REPORTING_METRICS_REPORTING_AUDIO_AUDIO_EVENTS_OBSERVER_H_


text:
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

This is the PHP API client for [Aardwarq.com](http://aardwarq.com).

## Install

Via Composer

``` bash
$ composer require aardwarq/aardwarq-php
```

## Usage

``` php
// Configure Aardwarq API Client
$provider = new Aardwarq\Api\OAuth2Provider([
    'clientId'     => 'CLIENT_ID',
    'clientSecret' => 'CLIENT_SECRET',
    'redirectUri'  => 'http://aardwarq.com/'
]);

$token = $provider->getAccessToken('clientCredentials');
$api = new Aardwarq\Api\Client($token->accessToken);

// You can set defaults for every event
\Aardwarq\Api\Event\Event::setDefaults([
    'context' => 'CLI', //
    'environment' => 'development',
    'version' => 'v0.1.1', // Version of your app
]);

// Register exception handler
set_exception_handler(function (\Exception $exception) use ($api) {
    echo 'Handling!';
    $apiException = new \Aardwarq\Api\Event\Exception();
    $apiException
        ->setMessage($exception->getMessage())
        ->setStackTrace($exception->getTrace())
    ;

    $result = $api->send($apiException);
});

```

## Credits

- [Marin Crnković](https://github.com/anorgan)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.


text:
class CreateStyles < ActiveRecord::Migration
  def change
    create_table :styles do |t|
      t.string :name
      t.string :style
      t.string :abv

      t.references :beer
    end
  end
end


text:
/**************************************************************************
 * FILE NAME
 *
 *       remoteproc_loader.h
 *
 * COMPONENT
 *
 *         OpenAMP stack.
 *
 * DESCRIPTION
 *
 *       This file provides definitions for remoteproc loader
 *
 *
 **************************************************************************/
#ifndef REMOTEPROC_LOADER_H_
#define REMOTEPROC_LOADER_H_

#include <openamp/remoteproc.h>

#if defined __cplusplus
extern "C" {
#endif

/**
 * enum loader_type - dynamic name service announcement flags
 *
 * @ELF_LOADER: an ELF loader
 * @FIT_LOADER: a loader for Flattened Image Trees
 */
enum loader_type {
	ELF_LOADER = 0, FIT_LOADER = 1, LAST_LOADER = 2,
};

/* Loader structure definition. */

struct remoteproc_loader {
	enum loader_type type;
	void *remote_firmware;
	/* Pointer to firmware decoded info control block */
	void *fw_decode_info;

	/* Loader callbacks. */
	void *(*retrieve_entry) (struct remoteproc_loader * loader);
	void *(*retrieve_rsc) (struct remoteproc_loader * loader,
			       unsigned int *size);
	int (*load_firmware) (struct remoteproc_loader * loader);
	int (*attach_firmware) (struct remoteproc_loader * loader,
				void *firmware);
	int (*detach_firmware) (struct remoteproc_loader * loader);
	void *(*retrieve_load_addr) (struct remoteproc_loader * loader);

};

/* RemoteProc Loader functions. */
struct remoteproc_loader *remoteproc_loader_init(enum loader_type type);
int remoteproc_loader_delete(struct remoteproc_loader *loader);
int remoteproc_loader_attach_firmware(struct remoteproc_loader *loader,
				      void *firmware_image);
void *remoteproc_loader_retrieve_entry_point(struct remoteproc_loader *loader);
void *remoteproc_loader_retrieve_resource_section(struct remoteproc_loader
						  *loader, unsigned int *size);
int remoteproc_loader_load_remote_firmware(struct remoteproc_loader *loader);
void *remoteproc_get_load_address(struct remoteproc_loader *loader);

/* Supported loaders */
extern int elf_loader_init(struct remoteproc_loader *loader);

#if defined __cplusplus
}
#endif

#endif				/* REMOTEPROC_LOADER_H_ */


text:
title:  "Getting closure variable's data from lambda expression in C#"
description: "How to get closure variable's data from lambda expression with reflection"
modified: 2017-05-21T22:14:00-03:00
tags:
  - unit-tests
  - reflection
---
Hi everyone! Today I want to talk about closures and extracting their values from lamda expression.

### The problem
One of my project has a lot of `Action` and `Func` delegates as parameters for methods. It has them everyevere and I got a task to write some unit-tests for some of these methods.
Let's imagine that there is a method that take `Action` like a parameter.

```csharp
        public void Execute(Action action)
        {
            //... Some code
            action();
            //... Some code
        }
```

The delegate can be initialised with lambda expression.

```csharp
        var thisIsClosure = "ThisIsClosure";
        Action actionWithClosure = () =>
        {
            Сonsole.WriteLine(thisIsClosure);
        };
```

So, we call them in a way like in a snippet below.

```csharp
	Execute(actionWithClosure);
```

### What I did

Because I was writing unit-tests I had to get some values from `Action` for `Asserts`.
But It tended to be a real problem, because I couldn't use `Expression`, because code smells when you change it for testing reasons.

**Please Note:**  If you change your code, due to some unit-tests reasons, it's the awful practice. Please, don't do this.
{: .notice--info}

So, I decided to write a simple parser with using of `Reflection`.

```csharp
    public static class LambdaVariableExtractor
    {
        public static TValue ExtractValue<TValue>(
		this Delegate lambda,
		string variableName)
            where TValue : class
        {
            if (lambda == null)
                throw new NullReferenceException("Empty lambda");

            var field = lambda.Method.DeclaringType?.GetFields
                (
                    BindingFlags.NonPublic |
                    BindingFlags.Instance |
                    BindingFlags.Public |
                    BindingFlags.Static
                )
                .Single(x => x.Name == name);

            if (field == null)
                throw new NullReferenceException("There isn't a variable with this name");

            return field.GetValue(lambda.Target) as TValue;
        }
    }
```

In this code, first of all we check lambda expression for exisiting and then do some magic.
What is a `DeclaringType` in this context? For uderstanding this, we should take a short look on some parts of C# specification.

As we all know, lambda expressions are just sugar.

**7.15 Anonymous function expressions**
An anonymous function is an expression that represents an "in-line" method definition.
An anonymous function does not have a value or type in and of itself, but is convertible to a compatible delegate or expression tree type.
The evaluation of an anonymous function conversion depends on the target type of the conversion:
If it is a delegate type, the conversion evaluates to a delegate value referencing the method which the anonymous function defines.
specification
{: .notice--info}

In this context lambda is some kind of anonymous function. Let's take a look, how compilator doing some job for us.

Generated class

There is a class named the strange name `<>c__DisplayClass0_0` in the picture. And this is a class which was generated by compilator.
Usually this class contains only your lambda as a method. But sometimes, when you have closures it starts to contain some variable.
In example, you can see that there is `thisIsClosure` variable there.

So, `DeclaringType` returns `Type` for this generated class. After that it's easy to fetch fields of this class.
And the last thing, If you want to get values from these fields you should pass `Target` as the parameter to the `GetValue` function.
`Target` keeps reference to the object of the generated class and we need to pass it for right working of `Reflection`.

You can find this example's code on github.
{: .notice--info}

### Conclusion

That's all. I'll be happy, If this article helps you.


text:
from django.conf import settings
from django.test import TransactionTestCase

from panda.models import Category, Notification, SearchSubscription
from panda.tasks import RunSubscriptionsTask
from panda.tests import utils

class TestSearchSubscriptions(TransactionTestCase):
    fixtures = ['init_panda.json', 'test_users.json']

    def setUp(self):
        settings.CELERY_ALWAYS_EAGER = True

        utils.setup_test_solr()

        self.user = utils.get_panda_user()
        self.dataset = utils.get_test_dataset(self.user)
        self.dataset2 = utils.get_test_dataset(self.user)
        self.upload = utils.get_test_data_upload(self.user, self.dataset)

    def test_subscription_dataset(self):
        # TODO: FAILING ITERMITTENTLY
        self.dataset.import_data(self.user, self.upload)

        sub = SearchSubscription.objects.create(
            user=self.user,
            dataset=self.dataset,
            query='*'
        )

        last_run = sub.last_run

        RunSubscriptionsTask.apply_async()

        # Refresh from database
        sub = SearchSubscription.objects.get(pk=sub.pk)

        self.assertNotEqual(last_run, sub.last_run)

        self.assertEqual(Notification.objects.filter(recipient=self.user).count(), 2)

    def test_subscription_category(self):
        self.dataset.import_data(self.user, self.upload)
        category = Category.objects.get(slug="politics")
        category.datasets.add(self.dataset)

        sub = SearchSubscription.objects.create(
            user=self.user,
            category=category,
            query='*'
        )

        last_run = sub.last_run

        RunSubscriptionsTask.apply_async()

        # Refresh from database
        sub = SearchSubscription.objects.get(pk=sub.pk)

        self.assertNotEqual(last_run, sub.last_run)

        self.assertEqual(Notification.objects.filter(recipient=self.user).count(), 2)

    def test_subscription_global(self):
        self.dataset.import_data(self.user, self.upload)

        sub = SearchSubscription.objects.create(
            user=self.user,
            dataset=None,
            query='*'
        )

        last_run = sub.last_run

        RunSubscriptionsTask.apply_async()

        # Refresh from database
        sub = SearchSubscription.objects.get(pk=sub.pk)

        self.assertNotEqual(last_run, sub.last_run)

        self.assertEqual(Notification.objects.filter(recipient=self.user).count(), 2)


text:
<?php

namespace Ds\Component\Parameter\Repository;

use Ds\Component\Entity\Repository\EntityRepository;

/**
 * Class ParameterRepository
 *
 * @package Ds\Component\Parameter
 */
final class ParameterRepository extends EntityRepository
{
}


text:
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.16.3...v0.16.4)

**Merged pull requests:**

- Add generated circe `Encoder` for GraphQL unions [\#99](https://github.com/muuki88/sbt-graphql/pull/99) ([felixbr](https://github.com/felixbr))

## [v0.16.0](https://github.com/muuki88/sbt-graphql/tree/v0.16.0)

## [v0.14.0](https://github.com/muuki88/sbt-graphql/tree/v0.14.0) (2019-08-30)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.13.2...v0.14.0)

**Merged pull requests:**

- Use graphql-compliant schema filter for schema gen [\#78](https://github.com/muuki88/sbt-graphql/pull/78) ([lunaryorn](https://github.com/lunaryorn))
- Fix setting scope [\#77](https://github.com/muuki88/sbt-graphql/pull/77) ([lunaryorn](https://github.com/lunaryorn))

## [v0.13.2](https://github.com/muuki88/sbt-graphql/tree/v0.13.2) (2019-08-23)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.13.1...v0.13.2)

**Merged pull requests:**

- Write an utf-8 file in SchemaGen instead of relying on system defaults [\#75](https://github.com/muuki88/sbt-graphql/pull/75) ([felixbr](https://github.com/felixbr))

## [v0.13.1](https://github.com/muuki88/sbt-graphql/tree/v0.13.1) (2019-07-22)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.13.0...v0.13.1)

**Closed issues:**

- Fix .scalafmt.conf [\#73](https://github.com/muuki88/sbt-graphql/issues/73)
- Yet another trouble getting codegen to work  [\#67](https://github.com/muuki88/sbt-graphql/issues/67)
- jawn parser library incompatibility [\#61](https://github.com/muuki88/sbt-graphql/issues/61)

**Merged pull requests:**

- FIX \#73 update scalafmt and name .scalafmt.conf properly [\#74](https://github.com/muuki88/sbt-graphql/pull/74) ([muuki88](https://github.com/muuki88))

## [v0.13.0](https://github.com/muuki88/sbt-graphql/tree/v0.13.0) (2019-07-13)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.12.0...v0.13.0)

**Implemented enhancements:**

- Generate circe Encoder for query Variables [\#35](https://github.com/muuki88/sbt-graphql/issues/35)

**Fixed bugs:**

- Additional imports are quoted and therefore broken [\#57](https://github.com/muuki88/sbt-graphql/issues/57)

**Closed issues:**

- Missing Sangria Custom Scalars In Schema Generation [\#69](https://github.com/muuki88/sbt-graphql/issues/69)
- Code generation - The output directory for generated files should be configurable. [\#68](https://github.com/muuki88/sbt-graphql/issues/68)
- codegen support for 'URI' scalar type [\#65](https://github.com/muuki88/sbt-graphql/issues/65)
- Allow loading schema from either \*.graphql or \*.json [\#63](https://github.com/muuki88/sbt-graphql/issues/63)
- Not available on maven? [\#55](https://github.com/muuki88/sbt-graphql/issues/55)

**Merged pull requests:**

- Update circe to 0.11.1 while replacing jawn with jackson [\#72](https://github.com/muuki88/sbt-graphql/pull/72) ([felixbr](https://github.com/felixbr))
- fixed stackoverflow error, running in tests, json encoding [\#71](https://github.com/muuki88/sbt-graphql/pull/71) ([Krever](https://github.com/Krever))
- Provide configurable filters for schema generation [\#70](https://github.com/muuki88/sbt-graphql/pull/70) ([nickhudkins](https://github.com/nickhudkins))
- Fixes \#63 [\#64](https://github.com/muuki88/sbt-graphql/pull/64) ([NicolasRouquette](https://github.com/NicolasRouquette))

## [v0.12.0](https://github.com/muuki88/sbt-graphql/tree/v0.12.0) (2018-11-20)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.11.0...v0.12.0)

**Merged pull requests:**

- Use sourceManaged in Compile config for generated renderer [\#59](https://github.com/muuki88/sbt-graphql/pull/59) ([ches](https://github.com/ches))

## [v0.11.0](https://github.com/muuki88/sbt-graphql/tree/v0.11.0) (2018-11-08)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.10.1...v0.11.0)

**Merged pull requests:**

- Fix custom imports [\#58](https://github.com/muuki88/sbt-graphql/pull/58) ([muuki88](https://github.com/muuki88))
- sbt 1.2.6 [\#56](https://github.com/muuki88/sbt-graphql/pull/56) ([sullis](https://github.com/sullis))
- Update scalameta to 4.0.0 [\#54](https://github.com/muuki88/sbt-graphql/pull/54) ([ngbinh](https://github.com/ngbinh))

## [v0.10.1](https://github.com/muuki88/sbt-graphql/tree/v0.10.1) (2018-09-17)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.10.0...v0.10.1)

**Closed issues:**

- Implement magic \#import like apollo-graphql [\#48](https://github.com/muuki88/sbt-graphql/issues/48)

**Merged pull requests:**

- Update scalameta to 4.0.0 RC1 [\#53](https://github.com/muuki88/sbt-graphql/pull/53) ([ngbinh](https://github.com/ngbinh))
- Update sangria and cats dependencies [\#52](https://github.com/muuki88/sbt-graphql/pull/52) ([ngbinh](https://github.com/ngbinh))
- Use cats to make some of the document wrangling a bit simpler [\#51](https://github.com/muuki88/sbt-graphql/pull/51) ([felixbr](https://github.com/felixbr))

## [v0.10.0](https://github.com/muuki88/sbt-graphql/tree/v0.10.0) (2018-09-12)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.9.0...v0.10.0)

**Implemented enhancements:**

- FIX \#48 Implement magic \#import like apollo-graphql [\#50](https://github.com/muuki88/sbt-graphql/pull/50) ([muuki88](https://github.com/muuki88))

**Closed issues:**

- Fix generation of interfaces [\#32](https://github.com/muuki88/sbt-graphql/issues/32)

**Merged pull requests:**

- Add imports to interfaces [\#46](https://github.com/muuki88/sbt-graphql/pull/46) ([muuki88](https://github.com/muuki88))

## [v0.9.0](https://github.com/muuki88/sbt-graphql/tree/v0.9.0) (2018-08-10)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.9.1...v0.9.0)

## [v0.9.1](https://github.com/muuki88/sbt-graphql/tree/v0.9.1) (2018-08-10)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.8.2...v0.9.1)

**Implemented enhancements:**

- Add setting for additional imports in generated code [\#29](https://github.com/muuki88/sbt-graphql/issues/29)

**Closed issues:**

- Generate code and decoders for `enum` type [\#44](https://github.com/muuki88/sbt-graphql/issues/44)

**Merged pull requests:**

- FIX \#44 Generate code and decoders for `enum` type [\#45](https://github.com/muuki88/sbt-graphql/pull/45) ([muuki88](https://github.com/muuki88))

## [v0.8.2](https://github.com/muuki88/sbt-graphql/tree/v0.8.2) (2018-07-26)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.8.1...v0.8.2)

## [v0.8.1](https://github.com/muuki88/sbt-graphql/tree/v0.8.1) (2018-07-26)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.8.0...v0.8.1)

**Implemented enhancements:**

- Remove `Document` type from `GraphQLQuery` trait [\#42](https://github.com/muuki88/sbt-graphql/issues/42)

**Merged pull requests:**

- FIX \#42 remove Document` type from `GraphQLQuery` trait [\#43](https://github.com/muuki88/sbt-graphql/pull/43) ([muuki88](https://github.com/muuki88))
- Enable post requests for introspection [\#41](https://github.com/muuki88/sbt-graphql/pull/41) ([muuki88](https://github.com/muuki88))

## [v0.8.0](https://github.com/muuki88/sbt-graphql/tree/v0.8.0) (2018-07-24)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.7.0...v0.8.0)

**Fixed bugs:**

- Add `Data` encoder for `GraphQLQuery` trait [\#38](https://github.com/muuki88/sbt-graphql/issues/38)
- Add `document` to GraphQLQuery trait [\#34](https://github.com/muuki88/sbt-graphql/issues/34)

**Merged pull requests:**

- Fix \#38 data decoder [\#40](https://github.com/muuki88/sbt-graphql/pull/40) ([muuki88](https://github.com/muuki88))
- Fix shadowing warning due to redundant import [\#39](https://github.com/muuki88/sbt-graphql/pull/39) ([felixbr](https://github.com/felixbr))
- Fix \#34 Add document val to GraphQLQuery trait [\#37](https://github.com/muuki88/sbt-graphql/pull/37) ([muuki88](https://github.com/muuki88))
- Added user defined imports to codegen \#29 / \#33 [\#36](https://github.com/muuki88/sbt-graphql/pull/36) ([muuki88](https://github.com/muuki88))

## [v0.7.0](https://github.com/muuki88/sbt-graphql/tree/v0.7.0) (2018-07-23)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.6.0...v0.7.0)

**Implemented enhancements:**

- Support Input-Object-Values in Apollo Style [\#25](https://github.com/muuki88/sbt-graphql/issues/25)

**Closed issues:**

- Upgrade to scalameta 3.x [\#27](https://github.com/muuki88/sbt-graphql/issues/27)
- codegen not generating custom scalar types. [\#26](https://github.com/muuki88/sbt-graphql/issues/26)

**Merged pull requests:**

- Improve README [\#31](https://github.com/muuki88/sbt-graphql/pull/31) ([jonas](https://github.com/jonas))
- Upgrade to Scalameta 3.7.4 [\#30](https://github.com/muuki88/sbt-graphql/pull/30) ([muuki88](https://github.com/muuki88))

## [v0.6.0](https://github.com/muuki88/sbt-graphql/tree/v0.6.0) (2018-05-31)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.5.0...v0.6.0)

**Closed issues:**

- Trouble getting codegen to work [\#21](https://github.com/muuki88/sbt-graphql/issues/21)
- Remove the IntegrationTest scope from the GraphQLQueryPlugin [\#18](https://github.com/muuki88/sbt-graphql/issues/18)

**Merged pull requests:**

- FIX \#25 Add more documentation and a test for nested input types [\#28](https://github.com/muuki88/sbt-graphql/pull/28) ([muuki88](https://github.com/muuki88))
- Initial draft for json codec code generation [\#23](https://github.com/muuki88/sbt-graphql/pull/23) ([muuki88](https://github.com/muuki88))
- FIX \#18 Remove the IntegrationTest scope from the GraphQLQueryPlugin [\#20](https://github.com/muuki88/sbt-graphql/pull/20) ([muuki88](https://github.com/muuki88))

## [v0.5.0](https://github.com/muuki88/sbt-graphql/tree/v0.5.0) (2018-03-17)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.4.1...v0.5.0)

**Implemented enhancements:**

- Generate code from queries [\#4](https://github.com/muuki88/sbt-graphql/issues/4)

**Merged pull requests:**

- Fix \#4: Add code generator [\#15](https://github.com/muuki88/sbt-graphql/pull/15) ([jonas](https://github.com/jonas))
- Deploy snapshot branch [\#14](https://github.com/muuki88/sbt-graphql/pull/14) ([jonas](https://github.com/jonas))
- Extract the release notes generator [\#13](https://github.com/muuki88/sbt-graphql/pull/13) ([muuki88](https://github.com/muuki88))

## [v0.4.1](https://github.com/muuki88/sbt-graphql/tree/v0.4.1) (2017-12-01)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.4.0...v0.4.1)

**Merged pull requests:**

- Deploy tags as well [\#12](https://github.com/muuki88/sbt-graphql/pull/12) ([muuki88](https://github.com/muuki88))
- Move publishing build steps to the deploy phase [\#10](https://github.com/muuki88/sbt-graphql/pull/10) ([jonas](https://github.com/jonas))
- Update sbt, Scala and Sangria versions [\#9](https://github.com/muuki88/sbt-graphql/pull/9) ([jonas](https://github.com/jonas))

## [v0.4.0](https://github.com/muuki88/sbt-graphql/tree/v0.4.0) (2017-10-30)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.3.0...v0.4.0)

**Implemented enhancements:**

- Scripted tests [\#3](https://github.com/muuki88/sbt-graphql/issues/3)

**Merged pull requests:**

- Fix graphql typos [\#7](https://github.com/muuki88/sbt-graphql/pull/7) ([jonas](https://github.com/jonas))
- Add scripted tests [\#6](https://github.com/muuki88/sbt-graphql/pull/6) ([muuki88](https://github.com/muuki88))
- Use the introspection query provided by Sangria [\#2](https://github.com/muuki88/sbt-graphql/pull/2) ([jonas](https://github.com/jonas))
- Minor fixes [\#1](https://github.com/muuki88/sbt-graphql/pull/1) ([jonas](https://github.com/jonas))

## [v0.3.0](https://github.com/muuki88/sbt-graphql/tree/v0.3.0) (2017-10-25)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.2.0...v0.3.0)

## [v0.2.0](https://github.com/muuki88/sbt-graphql/tree/v0.2.0) (2017-10-22)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.1.4...v0.2.0)

## [v0.1.4](https://github.com/muuki88/sbt-graphql/tree/v0.1.4) (2017-09-21)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.1.3...v0.1.4)

## [v0.1.3](https://github.com/muuki88/sbt-graphql/tree/v0.1.3) (2017-09-21)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.1.2...v0.1.3)

## [v0.1.2](https://github.com/muuki88/sbt-graphql/tree/v0.1.2) (2017-09-21)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.1.1...v0.1.2)

## [v0.1.1](https://github.com/muuki88/sbt-graphql/tree/v0.1.1) (2017-09-19)
[Full Changelog](https://github.com/muuki88/sbt-graphql/compare/v0.1.0...v0.1.1)

## [v0.1.0](https://github.com/muuki88/sbt-graphql/tree/v0.1.0) (2017-09-17)

\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*


text:
@interface LocationViewController : UIViewController

@end


text:
module Jekyll
  class Youtube < Liquid::Tag
    @url = nil

    VIDEO_URL = /(\S+)/i

    def initialize(tag_name, markup, tokens)
      super

      if markup =~ VIDEO_URL
        @url = $1
      end
    end

    def render(context)
      source = "
"
      source += "
"
      source += ""
      source += "
"
      source += "
"
      source
    end
  end
end

Liquid::Template.register_tag('youtube', Jekyll::Youtube)


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mem. Amer. Acad. Arts 16: 212 (1931)

#### Original name
Corethromyces recurvatus Thaxt.

### Remarks
null


text:
<!-- Copyright 2011 Square, Inc. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.squareup.keywhiz</groupId>
    <artifactId>keywhiz-parent</artifactId>
    <version>0.10.2-SNAPSHOT</version>
  </parent>

  <artifactId>keywhiz-cli</artifactId>
  <name>Keywhiz CLI</name>

  <dependencies>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <groupId>com.beust</groupId>
      <artifactId>jcommander</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp-urlconnection</artifactId>
    </dependency>

    <dependency>
      <groupId>com.squareup.keywhiz</groupId>
      <artifactId>keywhiz-client</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- JSON deserialization/serialization with java8 features. -->
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jdk8</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
    </dependency>

    <!-- TEST DEPENDENCIES -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Class-Path>lib-signed/bcprov-jdk15on.jar</Class-Path>
                    <Main-Class>keywhiz.cli.CliMain</Main-Class>
                  </manifestEntries>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.skife.maven</groupId>
        <artifactId>really-executable-jar-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>really-executable-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Do not deploy this as an artifact to Maven central. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
package com.baidu.palo.analysis;

import com.baidu.palo.common.AnalysisException;
import com.baidu.palo.common.InternalException;
import com.baidu.palo.mysql.privilege.MockedAuth;
import com.baidu.palo.mysql.privilege.PaloAuth;
import com.baidu.palo.qe.ConnectContext;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import mockit.Mocked;
import mockit.internal.startup.Startup;

public class ShowCreateDbStmtTest {

    @Mocked
    private PaloAuth auth;
    @Mocked
    private ConnectContext ctx;

    static {
        Startup.initializeIfPossible();
    }

    @Before
    public void setUp() {
        MockedAuth.mockedAuth(auth);
        MockedAuth.mockedConnectContext(ctx, "root", "192.168.1.1");
    }

    @Test
    public void testNormal() throws AnalysisException, InternalException {
        ShowCreateDbStmt stmt = new ShowCreateDbStmt("testDb");
        stmt.analyze(AccessTestUtil.fetchAdminAnalyzer(true));
        Assert.assertEquals("testCluster:testDb", stmt.getDb());
        Assert.assertEquals(2, stmt.getMetaData().getColumnCount());
        Assert.assertEquals("SHOW CREATE DATABASE `testCluster:testDb`", stmt.toString());
    }

    @Test(expected = AnalysisException.class)
    public void testEmptyDb() throws AnalysisException, InternalException {
        ShowCreateDbStmt stmt = new ShowCreateDbStmt("");
        stmt.analyze(AccessTestUtil.fetchAdminAnalyzer(false));
        Assert.fail("No exception throws.");
    }
}