text:
import tensorflow as tf
import configuration

from LSTM_model import LSTM_model

def main():
  config = configuration.ModelConfig(data_filename="input_seqs_train")
  train(config)

def train(config):
  with tf.Graph().as_default():
    model = LSTM_model(config)
    inputs_seqs_batch, outputs_batch = model.reader.read()
    init_op = tf.group(tf.initialize_all_variables(),
                       tf.initialize_local_variables())

    sess = tf.Session()
    sess.run(init_op)
    saver = tf.train.Saver(tf.all_variables())
    global_steps = 0

    coord = tf.train.Coordinator()
    threads = tf.train.start_queue_runners(sess=sess, coord=coord)

    train_writer = tf.train.SummaryWriter("./log/LSTM/train", sess.graph)
    validation_writer = tf.train.SummaryWriter("./log/LSTM/validation", sess.graph)
    try:
      while not coord.should_stop():
        input_data, targets = sess.run([inputs_seqs_batch, outputs_batch])
        cost, _, summary= sess.run([model.cost, model.train_op, model.summary_all], {model.input_data: input_data,
                                                                                model.targets: targets})
        print("Step %d: cost:%f" % (global_steps,  cost))
        train_writer.add_summary(summary, global_steps)

        global_steps += 1
        if global_steps % 1000 == 0:
          (accuracy, summary) = sess.run([model.accuracy, model.summary_accuracy], {model.input_data: model.validation_inputs,
                                                   model.targets: model.validation_targets})
          validation_writer.add_summary(summary, global_steps)
          print("Accuracy: %f" % accuracy)
          print(saver.save(sess, "./save/LSTM/save", global_step=global_steps))

        if global_steps > 60000:
          break
    except tf.errors.OutOfRangeError:
      print("Error")
    finally:
      # When done, ask the threads to stop.
      coord.request_stop()
    coord.join(threads)
    sess.close()
    train_writer.close()
    validation_writer.close()

if __name__ == "__main__":
  main()


text:
<?php

namespace TijsVerkoyen\VoipCenter\Tests\Collections;

use TijsVerkoyen\VoipCenter\Collections\SipAccounts;

class SipAccountsTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var SipAccounts
     */
    protected $sipAccounts;

    public function setUp()
    {
        $this->sipAccounts = new SipAccounts();
    }

    public function tearDown()
    {
        $this->sipAccounts = null;
    }

    public function testGetItemClass()
    {
        $this->assertEquals(
            '\TijsVerkoyen\\VoipCenter\\Objects\\SipAccount',
            $this->sipAccounts->getItemClass()
        );
    }

    public function testValidFromApi()
    {
        $response = $this->sipAccounts->fromAPI(
            array(
                'id_1' => array(
                    'logname' => 'John Doe',
                    'SIPusername' => 'username0',
                ),
                'id_2' => array(
                    'logname' => 'Foo Bar',
                    'SIPusername' => 'username0',
                ),
            )
        );

        foreach ($response as $row) {
            $this->assertInstanceOf('\TijsVerkoyen\VoipCenter\Objects\SipAccount', $row);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import requests
import sys
import urllib

def get_openstack_irc_daily_page(channel, date):
    """Retrieve postings for irc channel on specified date

       :param: channel the openstack channel of interest
       :param: date the date of postings to retrieve
       :returns: HTML page on success or None on error
    """

    url = 'http://eavesdrop.openstack.org/irclogs/%s/%s.%s.log.html' % \
        (urllib.quote(channel), urllib.quote(channel), date)
    response = requests.get(url)
    if 200 == response.status_code:
        return response.content
    else:
        return None

def html_decode(s):
    """Decode HTML page

       :param: s the HTML fragment to decode
       :returns: the decoded HTML fragment
    """

    if s.find('"') > -1:
        s = s.replace('"', '"')
    if s.find('>') > -1:
        s = s.replace('>', '>')
    if s.find('<') > -1:
        s = s.replace('<', '<')
    if s.find('&') > -1:
        s = s.replace('&', '&')
    if s.find(' ') > -1:
        s = s.replace(' ', ' ')

    return s

def parse_page(page_source, exclude_nicks=None, exclude_posts=None):
    """This is a hacked-up pile of rubbish -- thrown together

       :param: page_source the HTML response page of IRC postings
       :param: exclude_nicks irc nicknames to exclude
       :param: exclude_posts irc post substrings to exclude
       :returns: list of parsed IRC postings or None on error
    """

    log_entries = []
    start_table_marker = '
'
    end_table_marker = '
'
    pos_start_table = page_source.find(start_table_marker)
    if pos_start_table > 0:
        pos_end_table = page_source.find(end_table_marker, pos_start_table)
        if pos_end_table > 0:
            pos_start_entries = pos_start_table + len(start_table_marker)
            markup_entries = page_source[pos_start_entries:pos_end_table]
            pos = 0
            parsing = True
            while parsing:
                timestamp = None
                nick = None
                irc_post = None
                pos_row_start = markup_entries.find('
', pos_row_start)
                pos_row_end = markup_entries.find('
', pos_row_start)
                if pos_row_start > -1 and \
                   pos_end_tr_start_decl > -1 and \
                   pos_row_end > -1:
                    pos_id_start = markup_entries.find(' id="', pos)
                    if pos_id_start > 0:
                        pos_id_end = markup_entries.find('"', pos_id_start+5)
                        if pos_id_end > -1:
                            pos_ts_start = pos_id_start + 5
                            timestamp = markup_entries[pos_ts_start:pos_id_end]
                            timestamp = timestamp[1:]
                    pos_start_tr_text = pos_end_tr_start_decl + 1
                    tr_text = markup_entries[pos_start_tr_text:pos_row_end]
                    exclude_post = False
                    if exclude_posts:
                        for exclusion in exclude_posts:
                            if tr_text.find(exclusion) != -1:
                                exclude_post = True
                                break
                    if not exclude_post:
                        tr_text = tr_text.strip()
                        if tr_text:
                            pos_start_th = tr_text.find(' -1 and pos_end_th > -1:
                                pos_gt = tr_text.find('>', pos_start_th)
                                if pos_gt > -1:
                                    nick = tr_text[pos_gt+1:pos_end_th].strip()
                                    if nick:
                                        pos_start_td = tr_text.find('',
                                                              pos_end_th+5)
                                        if pos_start_td > -1 and \
                                           pos_end_td > -1 and \
                                           pos_gt > -1:
                                            b = pos_gt + 1
                                            e = pos_end_td
                                            irc_post = tr_text[b:e].strip()
                    if timestamp and nick and irc_post:
                        exclude_nick = exclude_nicks and nick in exclude_nicks
                        if not exclude_nick:
                            irc_post = html_decode(irc_post)
                            log_entries.append((timestamp, nick, irc_post))
                    pos = pos_row_end + 5
                else:
                    parsing = False

    return log_entries

def get_channel_entries(channel, date, exclude_nicks=None, exclude_posts=None):
    """Retrieve list of irc channel postings

       :param: channel the irc channel
       :param: the date of retrieved postings
       :return: list of postings or None
    """

    page = get_openstack_irc_daily_page(channel, date)
    if page is not None:
        log_entries = parse_page(page, exclude_nicks, exclude_posts)
        if log_entries:
            return log_entries
        else:
            print('warning: no entries found')
            return None
    else:
        print('warning: page not found %s %s' % (channel, date))
        return None

def print_irc_entries(log_entries):
    """Print out irc entries to stdout

       :param: log_entries list of entries to print
    """
    for log_entry in log_entries:
        print('%s %s %s' % (log_entry[0], log_entry[1], log_entry[2]))

if __name__ == '__main__':
    if len(sys.argv) < 3:
        print('usage: python %s irc_channel date' % sys.argv[0])
        sys.exit(1)
    channel = sys.argv[1]
    date = sys.argv[2]
    irc_log_entries = get_channel_entries(channel, date)
    if irc_log_entries:
        print_irc_entries(irc_log_entries)


text:
"""Utility for train/test split based on hash value."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import hashlib

def is_train(value):
  """Returns whether `value` should be used in a training question."""
  value_as_string = str(value).encode('utf-8')
  return int(hashlib.md5(value_as_string).hexdigest(), 16) % 2 == 0


text:
// See LICENSE for license details.

#ifndef _CHIPYARD_PLATFORM_H
#define _CHIPYARD_PLATFORM_H

#include "const.h"
#include "devices/clint.h"
#include "devices/gpio.h"
#include "devices/plic.h"
#include "devices/spi.h"
#include "devices/uart.h"

 // Some things missing from the official encoding.h
#if __riscv_xlen == 32
  #define MCAUSE_INT         0x80000000UL
  #define MCAUSE_CAUSE       0x7FFFFFFFUL
#else
   #define MCAUSE_INT         0x8000000000000000UL
   #define MCAUSE_CAUSE       0x7FFFFFFFFFFFFFFFUL
#endif

/****************************************************************************
 * Platform definitions
 *****************************************************************************/

// CPU info
#define NUM_CORES 1
#define GLOBAL_INT_SIZE 38
#define GLOBAL_INT_MAX_PRIORITY 7

// Memory map
#define CLINT_CTRL_ADDR _AC(0x2000000,UL)
#define CLINT_CTRL_SIZE _AC(0x10000,UL)
#define DEBUG_CTRL_ADDR _AC(0x0,UL)
#define DEBUG_CTRL_SIZE _AC(0x1000,UL)
#define ERROR_MEM_ADDR _AC(0x3000,UL)
#define ERROR_MEM_SIZE _AC(0x1000,UL)
#define GPIO_CTRL_ADDR _AC(0x64002000,UL)
#define GPIO_CTRL_SIZE _AC(0x1000,UL)
#define MASKROM_MEM_ADDR _AC(0x10000,UL)
#define MASKROM_MEM_SIZE _AC(0x10000,UL)
#define MEMORY_MEM_ADDR _AC(0x80000000,UL)
#define MEMORY_MEM_SIZE _AC(0x10000000,UL)
#define PLIC_CTRL_ADDR _AC(0xc000000,UL)
#define PLIC_CTRL_SIZE _AC(0x4000000,UL)
#define SPI_CTRL_ADDR _AC(0x64001000,UL)
#define SPI_CTRL_SIZE _AC(0x1000,UL)
#define SPI1_CTRL_ADDR _AC(0x64004000,UL)
#define SPI1_CTRL_SIZE _AC(0x1000,UL)
#define TEST_CTRL_ADDR _AC(0x4000,UL)
#define TEST_CTRL_SIZE _AC(0x1000,UL)
#define UART_CTRL_ADDR _AC(0x64000000,UL)
#define UART_CTRL_SIZE _AC(0x1000,UL)
#define UART1_CTRL_ADDR _AC(0x64003000,UL)
#define UART1_CTRL_SIZE _AC(0x1000,UL)
#define I2C_CTRL_ADDR _AC(0x64005000,UL)
#define I2C_CTRL_SIZE _AC(0x1000,UL)

// IOF masks

// Interrupt numbers
#define UART_INT_BASE 1
#define UART1_INT_BASE 2
#define I2C_INT_BASE 3
#define GPIO_INT_BASE 4
#define SPI_INT_BASE 36
#define SPI1_INT_BASE 37

// Helper functions
#define _REG64(p, i) (*(volatile uint64_t *)((p) + (i)))
#define _REG32(p, i) (*(volatile uint32_t *)((p) + (i)))
#define _REG16(p, i) (*(volatile uint16_t *)((p) + (i)))
// Bulk set bits in `reg` to either 0 or 1.
// E.g. SET_BITS(MY_REG, 0x00000007, 0) would generate MY_REG &= ~0x7
// E.g. SET_BITS(MY_REG, 0x00000007, 1) would generate MY_REG |= 0x7
#define SET_BITS(reg, mask, value) if ((value) == 0) { (reg) &= ~(mask); } else { (reg) |= (mask); }
#define AXI_PCIE_HOST_1_00_A_REG(offset) _REG32(AXI_PCIE_HOST_1_00_A_CTRL_ADDR, offset)
#define CLINT_REG(offset) _REG32(CLINT_CTRL_ADDR, offset)
#define DEBUG_REG(offset) _REG32(DEBUG_CTRL_ADDR, offset)
#define ERROR_REG(offset) _REG32(ERROR_CTRL_ADDR, offset)
#define GPIO_REG(offset) _REG32(GPIO_CTRL_ADDR, offset)
#define MASKROM_REG(offset) _REG32(MASKROM_CTRL_ADDR, offset)
#define MEMORY_REG(offset) _REG32(MEMORY_CTRL_ADDR, offset)
#define PLIC_REG(offset) _REG32(PLIC_CTRL_ADDR, offset)
#define SPI_REG(offset) _REG32(SPI_CTRL_ADDR, offset)
#define TEST_REG(offset) _REG32(TEST_CTRL_ADDR, offset)
#define UART_REG(offset) _REG32(UART_CTRL_ADDR, offset)
#define AXI_PCIE_HOST_1_00_A_REG64(offset) _REG64(AXI_PCIE_HOST_1_00_A_CTRL_ADDR, offset)
#define CLINT_REG64(offset) _REG64(CLINT_CTRL_ADDR, offset)
#define DEBUG_REG64(offset) _REG64(DEBUG_CTRL_ADDR, offset)
#define ERROR_REG64(offset) _REG64(ERROR_CTRL_ADDR, offset)
#define GPIO_REG64(offset) _REG64(GPIO_CTRL_ADDR, offset)
#define MASKROM_REG64(offset) _REG64(MASKROM_CTRL_ADDR, offset)
#define MEMORY_REG64(offset) _REG64(MEMORY_CTRL_ADDR, offset)
#define PLIC_REG64(offset) _REG64(PLIC_CTRL_ADDR, offset)
#define SPI_REG64(offset) _REG64(SPI_CTRL_ADDR, offset)
#define SPI1_REG64(offset) _REG64(SPI1_CTRL_ADDR, offset)
#define TEST_REG64(offset) _REG64(TEST_CTRL_ADDR, offset)
#define UART_REG64(offset) _REG64(UART_CTRL_ADDR, offset)
#define UART1_REG64(offset) _REG64(UART1_CTRL_ADDR, offset)
#define I2C_REG64(offset) _REG64(I2C_CTRL_ADDR, offset)

// Misc

#endif /* _CHIPYARD_PLATFORM_H */


text:
Hi Rohit,

I thought it would be better if webtop throw an error like safe sender, and UI will pop up the message.
Also, I found other two problems:

If there was a contact had one email address, and user added the email address to block sender list, should we remove the contact?

If there was a contact has multiple email addresses, and user added one of these email addresses to block sender list, should we remove the contact or remove the added address?

Hi Rohit,

When user opens safe senders page for the first time, UI will call "mail.allowedSender.load()" api, and save the response to client as whiteListStore. If user tried to add an email address, UI would check whether the email address is already existed in whiteListStore or not. If yes, it would popup the following message. It doesn't need to call any webtop api.

So I need the response of "mail.allowedSender.load()" to be correct.


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Stemonitis sphaerocarpa Schrad.

### Remarks
null


text:
package org.elasticsearch.search.aggregations.metrics;

import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder;

public abstract class AbstractNumericMetricTestCase<AF extends ValuesSourceAggregationBuilder.LeafOnly<ValuesSource.Numeric, AF>>
        extends BaseAggregationTestCase<AF> {

    @Override
    protected final AF createTestAggregatorBuilder() {
        AF factory = doCreateTestAggregatorFactory();
        String field = randomNumericField();
        randomFieldOrScript(factory, field);
        if (randomBoolean()) {
            factory.missing("MISSING");
        }
        return factory;
    }

    protected abstract AF doCreateTestAggregatorFactory();
}


text:
#ifndef glibc_sysdeps_llamaos_fd_to_filename_h
#define glibc_sysdeps_llamaos_fd_to_filename_h

#include_next <fd_to_filename.h>

#endif	// glibc_sysdeps_llamaos_fd_to_filename_h


text:
"""Support for X10 lights."""
from __future__ import annotations

import logging
from subprocess import STDOUT, CalledProcessError, check_output
from typing import Any

import voluptuous as vol

from homeassistant.components.light import (
    ATTR_BRIGHTNESS,
    PLATFORM_SCHEMA,
    ColorMode,
    LightEntity,
)
from homeassistant.const import CONF_DEVICES, CONF_ID, CONF_NAME
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

_LOGGER = logging.getLogger(__name__)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_DEVICES): vol.All(
            cv.ensure_list,
            [{vol.Required(CONF_ID): cv.string, vol.Required(CONF_NAME): cv.string}],
        )
    }
)

def x10_command(command):
    """Execute X10 command and check output."""
    return check_output(["heyu"] + command.split(" "), stderr=STDOUT)

def get_unit_status(code):
    """Get on/off status for given unit."""
    output = check_output(["heyu", "onstate", code])
    return int(output.decode("utf-8")[0])

def setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up the x10 Light platform."""
    is_cm11a = True
    try:
        x10_command("info")
    except CalledProcessError as err:
        _LOGGER.info("Assuming that the device is CM17A: %s", err.output)
        is_cm11a = False

    add_entities(X10Light(light, is_cm11a) for light in config[CONF_DEVICES])

class X10Light(LightEntity):
    """Representation of an X10 Light."""

    _attr_color_mode = ColorMode.BRIGHTNESS
    _attr_supported_color_modes = {ColorMode.BRIGHTNESS}

    def __init__(self, light, is_cm11a):
        """Initialize an X10 Light."""
        self._name = light["name"]
        self._id = light["id"]
        self._brightness = 0
        self._state = False
        self._is_cm11a = is_cm11a

    @property
    def name(self):
        """Return the display name of this light."""
        return self._name

    @property
    def brightness(self):
        """Return the brightness of the light."""
        return self._brightness

    @property
    def is_on(self):
        """Return true if light is on."""
        return self._state

    def turn_on(self, **kwargs: Any) -> None:
        """Instruct the light to turn on."""
        if self._is_cm11a:
            x10_command(f"on {self._id}")
        else:
            x10_command(f"fon {self._id}")
        self._brightness = kwargs.get(ATTR_BRIGHTNESS, 255)
        self._state = True

    def turn_off(self, **kwargs: Any) -> None:
        """Instruct the light to turn off."""
        if self._is_cm11a:
            x10_command(f"off {self._id}")
        else:
            x10_command(f"foff {self._id}")
        self._state = False

    def update(self) -> None:
        """Fetch update state."""
        if self._is_cm11a:
            self._state = bool(get_unit_status(self._id))
        else:
            # Not supported on CM17A
            pass


text:
Tables

Tables

				Head cell
				Head cell
				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

	Tip: You can align cells on top with a mod-alignTop class on table.

Parents

				Head cell
				Head cell
				Head cell

				Parent

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Parent

				Body cell
				Body cell
				Body cell

				Parent

Selectable

						<input class="checkbox-input" type="checkbox" id="rowAll" />

				Head cell
				Head cell
				Head cell

						<input class="checkbox-input" type="checkbox" id="row0" checked />

				Body cell
				Body cell
				Body cell

						<input class="checkbox-input" type="checkbox" id="row1" checked />

				Body cell
				Body cell
				Body cell

						<input class="checkbox-input" type="checkbox" id="row2" />

				Body cell
				Body cell
				Body cell

Zebra table

				Head cell
				Head cell
				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

Clickable lines

				Head cell
				Head cell
				Head cell

					 Body cell

				Body cell
				Body cell

					 Body cell

				Body cell
				Body cell

					 Body cell

					 Body cell

				Body cell

Sortable table

					<button type="button" class="table-head-row-cell-sortableButton">Sortable column</button>

					<button type="button" class="table-head-row-cell-sortableButton">Sortable column</button>

					<button type="button" class="table-head-row-cell-sortableButton">Sortable column</button>

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

Right align table

					<button type="button" class="table-head-row-cell-sortableButton">Sortable column</button>

					<button type="button" class="table-head-row-cell-sortableButton">Sortable column</button>

					<button type="button" class="table-head-row-cell-sortableButton">Sortable column</button>

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

Two lines header

					Main line
					Second line

						Sortable main line
						Second line

				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

No offset table

				Head Cell
				Head Cell
				Head Cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

Table actions

				Table cell
				Table cell

					<button class="actionIcon" type="button">
						editEdit
					</button>
					<button class="actionIcon" type="button">
						trashDelete
					</button>

				Table cell
				Table cell

					<button type="button" class="actionIcon">
						editEdit
					</button>
					<button type="button" class="actionIcon">
						trashDelete
					</button>

				Table cell
				Table cell

					<button type="button" class="actionIcon">
						editEdit
					</button>
					<button type="button" class="actionIcon">
						trashDelete
					</button>

Draggable rows

				Sortable column
				Sortable column
				Sortable column

					Table cell

				Table cell
				Table cell

					Table cell

				Table cell
				Table cell

					Table cell

				Table cell
				Table cell

Table in card

		You can use a table inside a card. To do it, put it outside card-content and add a
		mod-card to it.

					Table head
					Table head

					Table cell
					Table cell

					Table cell
					Table cell

					Table cell
					Table cell

Table filters

You can use a mod-filters on the first row of your table body to use it as a filter row.

					Head cell

						<input class="textfield-input" type="text" placeholder="Search" />

					Head cell

						<input class="textfield-input" type="text" placeholder="Search" />

					Head cell

						<input class="textfield-input" type="text" placeholder="Search" />

				Body cell
				Body cell
				Body cell

Users table

				User Name
				Some data

				User Name
				Some data

				User Name
				Some data

Tables borderless

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

Sticky Header

				Head cell
				Head cell
				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

	Tip: You can align on top with a mod-stickyHeader class or
		mod-stickyHeader-withBanner.

Sticky Header with shadow on scroll

				Head cell
				Head cell
				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

	Tip: The value of --sticky-header-shadow-offset-top on
		.table-body-row.mod-stickyHeader-shadow must be equal to the table header height

Fixed layout columns

				Head cell
				Head cell
				Head cell

				Cell with mod-layoutFixed-8
				Cell with mod-layoutFixed-12
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

Fixed layout columns starting at breakpoint

				Head cell
				Head cell
				Head cell

				Cell with mod-layoutFixed-8
				Cell with mod-layoutFixed-12
				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell

	Tip: the numeric value used in the class will be calculated in rem. Ex
		.mod-layoutFixed-8 means a cell width of 8 rem

Sticky columns

				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell

				fixed width: 8 // offset 0
				fixed width: 7 // offset 8
				fixed width: 5 // offset 8 + 7 = 15
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				fixed width: 5 // offset 0

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

Sticky columns starting at breakpoint

				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell

				fixed width: 8 // offset 0
				fixed width: 7 // offset 8
				fixed width: 5 // offset 8 + 7 = 15
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				fixed width: 5 // offset 0

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

	Tip: each cell must have a class .mod-stickyColumn-leftOffsetX or
		.mod-stickyColumn-righOffsetX with X equal to the cumulative size of
		previous cells in the specified axis (from left or from right)

Sticky columns with shadow on overflow

				Head cell
				Head cell
				Head cell

				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell

				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

Sticky Column with shadow on overflow, starting at breakpoint

				Head cell
				Head cell
				Head cell

				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell

				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

Sticky header + sticky column, with shadow on overflow

				Head cell
				Head cell
				Head cell

				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell

				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

Sticky header + sticky column starting at breakpoint, with shadow on overflow

				Head cell
				Head cell
				Head cell

				Head cell
				Head cell
				Head cell
				Head cell
				Head cell
				Head cell

				Head cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell

				Body cell
				Body cell
				Body cell

				Body cell
				Body cell
				Body cell
				Body cell
				Body cell
				Body cell

				Body cell


text:
module GlobalRegistryModels
  module Entity
    class MinistryBrand < EnumValueBase
    end
  end
end


text:
from .trex_general_test import CTRexGeneral_Test, CTRexScenario
from CPlatform import CStaticRouteConfig, CNatConfig
from .tests_exceptions import *
#import sys
import time
import copy
from nose.tools import nottest
import traceback

class CTRexRx_Test(CTRexGeneral_Test):
    """This class defines the rx testcase of the TRex traffic generator"""
    def __init__(self, *args, **kwargs):
        CTRexGeneral_Test.__init__(self, *args, **kwargs)
        self.unsupported_modes = ['virt_nics', 'vf_nics'] # TODO: fix (-k argument does not work)

    def setUp(self):
        CTRexGeneral_Test.setUp(self)

    def check_rx_errors(self, trex_res, allow_error_tolerance = True):
        try:
            # counters to check

            latency_counters_display = {'m_unsup_prot': 0, 'm_no_magic': 0, 'm_no_id': 0, 'm_seq_error': 0, 'm_length_error': 0, 'm_no_ipv4_option': 0, 'm_tx_pkt_err': 0}
            rx_counters = {'m_err_drop': 0, 'm_err_aged': 0, 'm_err_no_magic': 0, 'm_err_wrong_pkt_id': 0, 'm_err_fif_seen_twice': 0, 'm_err_open_with_no_fif_pkt': 0, 'm_err_oo_dup': 0, 'm_err_oo_early': 0, 'm_err_oo_late': 0, 'm_err_flow_length_changed': 0}

            # get relevant TRex results

            try:
                ports_names = trex_res.get_last_value('trex-latecny-v2.data', 'port\-\d+')
                if not ports_names:
                    raise AbnormalResultError('Could not find ports info in TRex results, path: trex-latecny-v2.data.port-*')
                for port_name in ports_names:
                    path = 'trex-latecny-v2.data.%s.stats' % port_name
                    port_result = trex_res.get_last_value(path)
                    if not port_result:
                        raise AbnormalResultError('Could not find port stats in TRex results, path: %s' % path)
                    for key in latency_counters_display:
                        latency_counters_display[key] += port_result[key]

                # using -k flag in TRex produces 1 error per port in latency counter m_seq_error, allow it until issue resolved. For comparing use dict with reduces m_seq_error number.
                latency_counters_compare = copy.deepcopy(latency_counters_display)
                latency_counters_compare['m_seq_error'] = max(0, latency_counters_compare['m_seq_error'] - len(ports_names))

                path = 'rx-check.data.stats'
                rx_check_results = trex_res.get_last_value(path)
                if not rx_check_results:
                    raise AbnormalResultError('No TRex results by path: %s' % path)
                for key in rx_counters:
                    rx_counters[key] = rx_check_results[key]

                path = 'rx-check.data.stats.m_total_rx'
                total_rx = trex_res.get_last_value(path)
                if total_rx is None:
                    raise AbnormalResultError('No TRex results by path: %s' % path)
                elif not total_rx:
                    raise AbnormalResultError('Total rx_check (%s) packets is zero.' % path)

                print('Total packets checked: %s' % total_rx)
                print('Latency counters: %s' % latency_counters_display)
                print('rx_check counters: %s' % rx_counters)

            except KeyError as e:
                self.fail('Expected key in TRex result was not found.\n%s' % traceback.print_exc())

            # the check. in loopback expect 0 problems, at others allow errors <error_tolerance>% of total_rx

            total_errors = sum(rx_counters.values()) + sum(latency_counters_compare.values())
            error_tolerance = self.get_benchmark_param('error_tolerance')
            if not error_tolerance:
                if not allow_error_tolerance:
                    error_tolerance = 0
                else:
                    error_tolerance = 0.1
            error_percentage = total_errors * 100.0 / total_rx

            if total_errors > 0:
                if error_percentage > error_tolerance:
                    self.fail('Too much errors in rx_check. (~%s%% of traffic)' % error_percentage)
                else:
                    print('There are errors in rx_check (%f%%), not exceeding allowed limit (%s%%)' % (error_percentage, error_tolerance))
            else:
                print('No errors in rx_check.')
        except Exception as e:
            print(traceback.print_exc())
            self.fail('Errors in rx_check: %s' % e)

    def test_rx_check_sfr(self):
        if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
            self.router.configure_basic_interfaces()
            self.router.config_pbr(mode = 'config')

        core  = self.get_benchmark_param('cores')
        mult  = self.get_benchmark_param('multiplier')
        sample_rate = self.get_benchmark_param('rx_sample_rate')

        ret = self.trex.start_trex(
            c = core,
            m = mult,
            p = True,
            nc = True,
            rx_check = sample_rate,
            d = 100,
            f = 'avl/sfr_delay_10_1g_no_bundeling.yaml',
            l = 1000,
            k = 10,
            learn_verify = True,
            l_pkt_mode = 2)

        trex_res = self.trex.sample_to_run_finish()

        print("\nLATEST RESULT OBJECT:")
        print(trex_res)
        #print ("\nLATEST DUMP:")
        #print trex_res.get_latest_dump()

        self.check_general_scenario_results(trex_res)
        self.check_CPU_benchmark(trex_res)
        self.check_rx_errors(trex_res)

    def test_rx_check_http(self):
        if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
            # TODO: skip as test_rx_check_http_negative will cover it
            #self.skip('This test is covered by test_rx_check_http_negative')
            self.router.configure_basic_interfaces()
            self.router.config_pbr(mode = "config")

        core  = self.get_benchmark_param('cores')
        mult  = self.get_benchmark_param('multiplier')
        sample_rate = self.get_benchmark_param('rx_sample_rate')

        ret = self.trex.start_trex(
            c = core,
            m = mult,
            p  = True,
            nc = True,
            rx_check = sample_rate,
            d = 100,
            f = 'cap2/http_simple.yaml',
            l = 1000,
            k = 10,
            learn_verify = True,
            l_pkt_mode = 2)

        trex_res = self.trex.sample_to_run_finish()

        print("\nLATEST RESULT OBJECT:")
        print(trex_res)

        self.check_general_scenario_results(trex_res)
        self.check_CPU_benchmark(trex_res)
        self.check_rx_errors(trex_res)

    def test_rx_check_sfr_ipv6(self):
        if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
            self.router.configure_basic_interfaces()
            self.router.config_pbr(mode = 'config')
            self.router.config_ipv6_pbr(mode = "config")

        core  = self.get_benchmark_param('cores')
        mult  = self.get_benchmark_param('multiplier')
        sample_rate = self.get_benchmark_param('rx_sample_rate')

        ret = self.trex.start_trex(
            cfg = '/etc/trex_cfg_mac.yaml',
            c = core,
            m = mult,
            p = True,
            nc = True,
            rx_check = sample_rate,
            d = 100,
            f = 'avl/sfr_delay_10_1g_no_bundeling.yaml',
            l = 1000,
            k = 10,
            ipv6 = True)

        trex_res = self.trex.sample_to_run_finish()

        print("\nLATEST RESULT OBJECT:")
        print(trex_res)
        #print ("\nLATEST DUMP:")
        #print trex_res.get_latest_dump()

        self.check_general_scenario_results(trex_res)
        self.check_CPU_benchmark(trex_res)
        self.check_rx_errors(trex_res)

    def test_rx_check_http_ipv6(self):
        if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
            self.router.configure_basic_interfaces()
            self.router.config_pbr(mode = "config")
            self.router.config_ipv6_pbr(mode = "config")

        core  = self.get_benchmark_param('cores')
        mult  = self.get_benchmark_param('multiplier')
        sample_rate = self.get_benchmark_param('rx_sample_rate')

        ret = self.trex.start_trex(
            cfg = '/etc/trex_cfg_mac.yaml',
            c = core,
            m = mult,
            p  = True,
            nc = True,
            rx_check = sample_rate,
            d = 100,
            f = 'cap2/http_simple.yaml',
            l = 1000,
            k = 10,
            ipv6 = True)

        trex_res = self.trex.sample_to_run_finish()

        print("\nLATEST RESULT OBJECT:")
        print(trex_res)

        self.check_general_scenario_results(trex_res)
        self.check_CPU_benchmark(trex_res)
        self.check_rx_errors(trex_res)

    #@nottest
    def test_rx_check_http_negative(self):
        if self.is_loopback:
            self.skip('This test uses NAT, not relevant for loopback')

        if not CTRexScenario.router_cfg['no_dut_config']:
            self.router.configure_basic_interfaces()
            self.router.config_pbr(mode = "config")

        core  = self.get_benchmark_param('cores')
        mult  = self.get_benchmark_param('multiplier')
        sample_rate = self.get_benchmark_param('rx_sample_rate')

        ret = self.trex.start_trex(
            c = core,
            m = mult,
            p = True,
            rx_check = sample_rate,
            d = 60,
            f = 'cap2/http_simple.yaml',
            l = 1000,
            k = 10,
            learn_verify = True,
            l_pkt_mode = 2)

        print('Run for 40 seconds, expect no errors')
        trex_res = self.trex.sample_x_seconds(40)
        print("\nLATEST RESULT OBJECT:")
        print(trex_res)
        self.check_general_scenario_results(trex_res)
        self.check_CPU_benchmark(trex_res)
        self.check_rx_errors(trex_res)

        print('Run until finish, expect errors')
        old_errors = copy.deepcopy(self.fail_reasons)
        nat_dict = self.get_benchmark_param('nat_dict', test_name = 'test_nat_simple_mode1')
        nat_obj  = CNatConfig(nat_dict)
        self.router.config_nat(nat_obj)
        self.router.config_zbf()
        trex_res = self.trex.sample_to_run_finish()
        self.router.config_no_zbf()
        self.router.config_no_nat(nat_obj)
        #self.router.clear_nat_translations()
        print("\nLATEST RESULT OBJECT:")
        print(trex_res)
        self.check_rx_errors(trex_res, allow_error_tolerance = False)
        if self.fail_reasons == old_errors:
            self.fail('Expected errors here, got none.')
        else:
            print('Got errors as expected.')
            self.fail_reasons = old_errors

    def tearDown(self):
        CTRexGeneral_Test.tearDown(self)
        pass

if __name__ == "__main__":
    pass


text:
using NUnit.Framework;
using SharpSenses.Gestures;

namespace SharpSenses.Tests {
    public class MovementTests {
        private FakeCamera _camera;
        private Movement _movement;

        [SetUp]
        public void SetUp() {
            _camera = new FakeCamera();
            _movement = new MovementForward(_camera.LeftHand, 5);
            _movement.Activate();
        }

        [Test]
        public void Should_Report_Progress() {
            double progress = 0;
            _movement.Progress += d => progress = d;
            _camera.MoveLeftHandZ(2);
            _camera.MoveLeftHandZ(1);
            Assert.IsTrue(progress > 0);
        }

        [Test]
        public void Should_Restart_when_wrong_direction() {
            bool restarted = false;
            _movement.Restarted += () => restarted = true;
            _camera.MoveLeftHandZ(2);
            _camera.MoveLeftHandZ(1);
            _camera.MoveLeftHandZ(2);
            Assert.AreEqual(MovementStatus.Idle, _movement.Status);
            Assert.IsTrue(restarted);
        }

        [Test]
        public void Should_complete_movement() {
            var completed = true;
            _movement.Completed += () => completed = true;
            _camera.MoveLeftHandZ(1);
            _camera.MoveLeftHandZ(5);
            Assert.IsTrue(completed);
        }
    }
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the MIT license.  See License.txt in the project root for license information.

#if HAS_IOPERATION

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Analyzer.Utilities;

namespace Microsoft.CodeAnalysis.CodeMetrics
{
    public abstract partial class CodeAnalysisMetricData
    {
        private sealed class PropertyMetricData : CodeAnalysisMetricData
        {
            internal PropertyMetricData(
                IPropertySymbol symbol,
                int maintainabilityIndex,
                ComputationalComplexityMetrics computationalComplexityMetrics,
                ImmutableHashSet<INamedTypeSymbol> coupledNamedTypes,
                long linesOfCode,
                int cyclomaticComplexity,
                int? depthOfInheritance,
                ImmutableArray<CodeAnalysisMetricData> children)
                : base(symbol, maintainabilityIndex, computationalComplexityMetrics, coupledNamedTypes,
                      linesOfCode, cyclomaticComplexity, depthOfInheritance, children)
            {
            }

            internal static async Task<PropertyMetricData> ComputeAsync(IPropertySymbol property, CodeMetricsAnalysisContext context)
            {
                var wellKnownTypeProvider = WellKnownTypeProvider.GetOrCreate(context.Compilation);

                var coupledTypesBuilder = ImmutableHashSet.CreateBuilder<INamedTypeSymbol>();
                ImmutableArray<SyntaxReference> declarations = property.DeclaringSyntaxReferences;
                long linesOfCode = await MetricsHelper.GetLinesOfCodeAsync(declarations, property, context).ConfigureAwait(false);
                (int cyclomaticComplexity, ComputationalComplexityMetrics computationalComplexityMetrics) =
                    await MetricsHelper.ComputeCoupledTypesAndComplexityExcludingMemberDeclsAsync(declarations, property, coupledTypesBuilder, context).ConfigureAwait(false);
                MetricsHelper.AddCoupledNamedTypes(coupledTypesBuilder, wellKnownTypeProvider, property.Parameters);
                MetricsHelper.AddCoupledNamedTypes(coupledTypesBuilder, wellKnownTypeProvider, property.Type);

                ImmutableArray<CodeAnalysisMetricData> children = await ComputeAsync(GetAccessors(property), context).ConfigureAwait(false);
                int maintainabilityIndexTotal = 0;
                foreach (CodeAnalysisMetricData child in children)
                {
                    MetricsHelper.AddCoupledNamedTypes(coupledTypesBuilder, wellKnownTypeProvider, child.CoupledNamedTypes);
                    maintainabilityIndexTotal += child.MaintainabilityIndex;
                    cyclomaticComplexity += child.CyclomaticComplexity;
                    computationalComplexityMetrics = computationalComplexityMetrics.Union(child.ComputationalComplexityMetrics);
                }

                int? depthOfInheritance = null;
                int maintainabilityIndex = !children.IsEmpty ? MetricsHelper.GetAverageRoundedMetricValue(maintainabilityIndexTotal, children.Length) : 100;
                MetricsHelper.RemoveContainingTypes(property, coupledTypesBuilder);

                return new PropertyMetricData(property, maintainabilityIndex, computationalComplexityMetrics,
                    coupledTypesBuilder.ToImmutable(), linesOfCode, cyclomaticComplexity, depthOfInheritance, children);
            }

            private static IEnumerable<IMethodSymbol> GetAccessors(IPropertySymbol property)
            {
                if (property.GetMethod != null)
                {
                    yield return property.GetMethod;
                }

                if (property.SetMethod != null)
                {
                    yield return property.SetMethod;
                }
            }
        }
    }
}

#endif


text:
import { Routes, RouterModule } from '@angular/router';

import { TourScheduleAddComponent,TourScheduleComponent} from './index';

const TourScheduleRoutes: Routes = [
	{
		path: '',
		component: TourScheduleComponent,
		children: [
			// {
			// 	path: 'list',
			// 	component: TourScheduleListComponent
			// },
			// {
			// 	path: 'edit/:id',
			// 	component: TourScheduleEditComponent
			// },
			{
				path: 'new',
				component: TourScheduleAddComponent
			}
		]
	}
];
export const routing = RouterModule.forChild(TourScheduleRoutes);


text:
module Glysellin
  module Cart
    class ProductsController < CartController
      def create
        current_cart.add(params[:cart])
        current_cart.products_added!
        @product_added_to_cart = true
        render_cart_partial
      end

      def update
        current_cart.set_quantity(params[:id], params[:quantity], override: true)

        product = current_cart.product(params[:id])
        variant, quantity = product.variant, product.quantity

        render json: {
          quantity: quantity,
          eot_price: number_to_currency(quantity * variant.eot_price),
          price: number_to_currency(quantity * variant.price)
        }.merge(totals_hash)
      end

      def destroy
        current_cart.remove(params[:id])
        redirect_to cart_path
      end

      def validate
        current_cart.update(params[:glysellin_cart_basket])
        current_cart.validated! if current_cart.valid?
        current_cart.customer = current_user
        redirect_to cart_path
      end
    end
  end
end


text:
package main

import (
	"io/ioutil"
	"path/filepath"
	"reflect"
	"syscall"
	"testing"

	"github.com/thbishop/aws-creds/Godeps/_workspace/src/github.com/vaughan0/go-ini"
)

func TestCredItems(t *testing.T) {
	content := `
[default]
aws_access_key_id=foo
aws_secret_access_key=bar
aws_session_token=baz
`
	expected := []string{
		"AWS_ACCESS_KEY_ID=foo",
		"AWS_SECRET_ACCESS_KEY=bar",
		"AWS_SESSION_TOKEN=baz",
	}

	f, err := ioutil.TempFile("", "aws-creds-test")
	if err != nil {
		t.Fatalf("Error creating temp file: %s", err)
	}

	defer syscall.Unlink(f.Name())
	ioutil.WriteFile(f.Name(), []byte(content), 0644)

	path, err := filepath.Abs(f.Name())
	if err != nil {
		t.Fatalf("Error getting temp file path: %s", err)
	}

	ini, err := ini.LoadFile(path)
	if err != nil {
		t.Fatalf("Unable to load ini file: %s", err)
	}

	result := credItems("default", ini)

	if !reflect.DeepEqual(expected, result) {
		t.Fatalf("Excepted '%v' got '%v'", expected, result)
	}
}

var credItemsOutputTcs = []struct {
	items    []string
	opts     *options
	expected string
}{
	{[]string{"FOO=BAR", "BAZ=BLAH"}, &options{Export: false}, "FOO=BAR BAZ=BLAH"},
	{[]string{"FOO=BAR", "BAZ=BLAH"}, &options{Export: true}, "export FOO=BAR\nexport BAZ=BLAH\n"},
}

func TestCredItemsOutput(t *testing.T) {
	for _, tc := range credItemsOutputTcs {
		result := formatCredItems(tc.items, tc.opts)
		if tc.expected != result {
			t.Fatalf("Expected '%v' got '%v' for export %t", tc.expected, result, tc.opts.Export)
		}

	}
}


text:
using System;
using System.Collections.Generic;
using Engine;
using Engine.Game.Controllers;
using UnityEngine;

namespace Engine.Content {

    public class ContentLoader {

    }
}


text:
Export to a spreadsheet

Export requests between two dates for all your users or a balance status of all your users rights on a specific date. The output format is a spreadsheet in the Office Open XML format (.xlsx)

Continue

Export to sage

Export requests for your monthy payroll in sage, only users with the sage registration number set will be exported

Continue


text:
(function($) {
	$.widget('blueimpUIX.fileupload', $.blueimpUI.fileupload, {
		_initTemplates: function() {
			this.options.templateContainer = document.createElement(
					this._files.prop('nodeName')
			);
			this.options.uploadTemplate = window.tmpl(this.options.uploadTemplateName);
			this.options.downloadTemplate = window.tmpl(this.options.downloadTemplateName);
		},
		_enableFileInputButton: function() {
			$.blueimpUI.fileupload.prototype._enableFileInputButton.call(this);
			this.element.find('.ss-uploadfield-addfile').show();
		},
		_disableFileInputButton: function() {
			$.blueimpUI.fileupload.prototype._disableFileInputButton.call(this);
			this.element.find('.ss-uploadfield-addfile').hide();
		},
		_onAdd: function(e, data) {
			// use _onAdd instead of add since we only want it called once for a file set, not for each file
			var result = $.blueimpUI.fileupload.prototype._onAdd.call(this, e, data);
			var firstNewFile = this._files.find('.ss-uploadfield-item').slice(data.files.length*-1).first();
			var top = '+=' + (firstNewFile.position().top - parseInt(firstNewFile.css('marginTop'), 10) || 0 - parseInt(firstNewFile.css('borderTopWidth'), 10) || 0);
			firstNewFile.offsetParent().animate({scrollTop: top}, 1000);

			/* Compute total size of files */
			var fSize = 0;
			for(var i = 0; i < data.files.length; i++){
				if(typeof data.files[i].size === 'number'){
					fSize = fSize + data.files[i].size;
				}
			}

			$('.fileOverview .uploadStatus .details .total').text(data.files.length);
			if(typeof fSize === 'number' && fSize > 0){
				fSize = this._formatFileSize(fSize);
				$('.fileOverview .uploadStatus .details .fileSize').text(fSize);
			}

			//Fixes case where someone uploads a single erroring file
			if(data.files.length == 1 && data.files[0].error !== null){
				$('.fileOverview .uploadStatus .state').text(ss.i18n._t('AssetUploadField.UploadField.UPLOADFAIL', 'Sorry your upload failed'));
				$('.fileOverview .uploadStatus').addClass("bad").removeClass("good").removeClass("notice");
			}else{
				$('.fileOverview .uploadStatus .state').text(ss.i18n._t('AssetUploadField.UPLOADINPROGRESS', 'Please wait… upload in progress'));//.show();
				$('.ss-uploadfield-item-edit-all').hide();
				$('.fileOverview .uploadStatus').addClass("notice").removeClass("good").removeClass("bad");
			}

			return result;
		},
		_onDone: function (result, textStatus, jqXHR, options) {
			// Mark form as dirty on completion of successful upload
			if(this.options.changeDetection) {
				this.element.closest('form').trigger('dirty');
			}

			$.blueimpUI.fileupload.prototype._onDone.call(this, result, textStatus, jqXHR, options);
		},
		_onSend: function (e, data) {
			//check the array of existing files to see if we are trying to upload a file that already exists
			var that = this;
			var config = this.options;
			if (config.overwriteWarning) {
				$.get(
					config['urlFileExists'],
					{'filename': data.files[0].name},
					function(response, status, xhr) {
						if(response.exists) {
							//display the dialogs with the question to overwrite or not
							data.context.find('.ss-uploadfield-item-status')
								.text(config.errorMessages.overwriteWarning)
								.addClass('ui-state-warning-text');
							data.context.find('.ss-uploadfield-item-progress').hide();
							data.context.find('.ss-uploadfield-item-overwrite').show();
							data.context.find('.ss-uploadfield-item-overwrite-warning').on('click', function(e){
								data.context.find('.ss-uploadfield-item-progress').show();
								data.context.find('.ss-uploadfield-item-overwrite').hide();
								data.context.find('.ss-uploadfield-item-status')
									.removeClass('ui-state-warning-text');
								//upload only if the "overwrite" button is clicked
								$.blueimpUI.fileupload.prototype._onSend.call(that, e, data);

								e.preventDefault(); // Avoid a form submit
								return false;
							});
						} else {    //regular file upload
							return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
						}
					}
				);
			} else {
				return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
			}
		},
		_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
			$.blueimpUI.fileupload.prototype._onAlways.call(this, jqXHRorResult, textStatus, jqXHRorError, options);
			if (this._active === 0) {
				$('.fileOverview .uploadStatus .state').text(ss.i18n._t('AssetUploadField.FILEUPLOADCOMPLETED', 'File upload completed!'));//.hide();
				$('.ss-uploadfield-item-edit-all').show();
				$('.fileOverview .uploadStatus').addClass("good").removeClass("notice").removeClass("bad");
			}
		},
		_create: function() {
			$.blueimpUI.fileupload.prototype._create.call(this);
			// Ensures that the visibility of the fileupload dialog is set correctly at initialisation
			this._adjustMaxNumberOfFiles(0);
		},
		attach: function(data) {
			if(this.options.changeDetection) {
				this.element.closest('form').trigger('dirty');
			}

			// Handles attachment of already uploaded files, similar to add
			var self = this,
				files = data.files,
				replaceFileID = data.replaceFileID,
				valid = true;

			// If replacing an element (and it exists), adjust max number of files at this point
			var replacedElement = null;
			if(replaceFileID) {
				replacedElement = $(".ss-uploadfield-item[data-fileid='"+replaceFileID+"']");
				if(replacedElement.length === 0) {
					replacedElement = null;
				} else {
					self._adjustMaxNumberOfFiles(1);
				}
			}

			// Validate each file
			$.each(files, function (index, file) {
				self._adjustMaxNumberOfFiles(-1);
				error = self._validate([file]);
				valid = error && valid;
			});
			data.isAdjusted = true;
			data.files.valid = data.isValidated = valid;

			// Generate new file HTMl, and either append or replace (if replacing
			// an already uploaded file).
			data.context = this._renderDownload(files);
			if(replacedElement) {
				replacedElement.replaceWith(data.context);
			} else {
				data.context.appendTo(this._files);
			}
			data.context.data('data', data);
			// Force reflow:
			this._reflow = this._transition && data.context[0].offsetWidth;
			data.context.addClass('in');
		}
	});

	$.entwine('ss', function($) {

		$('div.ss-upload').entwine({

			Config: null,

			onmatch: function() {

				if(this.is('.readonly,.disabled')) return;

				var fileInput = this.find('.ss-uploadfield-fromcomputer-fileinput');
				var dropZone = this.find('.ss-uploadfield-dropzone');
				var config = fileInput.data('config');

				/* Attach classes to dropzone when element can be dropped*/
				$(document).unbind('dragover');
				$(document).bind('dragover', function (e) {
					timeout = window.dropZoneTimeout;
					var $target = $(e.target);
					if (!timeout) {
						dropZone.addClass('active');
					} else {
						clearTimeout(timeout);
					}
					if ($target.closest('.ss-uploadfield-dropzone').length > 0) {
						dropZone.addClass('hover');
					} else {
						dropZone.removeClass('hover');
					}
					window.dropZoneTimeout = setTimeout(function () {
						window.dropZoneTimeout = null;
						dropZone.removeClass('active hover');
					}, 100);
				});

				//disable default behaviour if file dropped in the wrong area
				$(document).bind('drop dragover', function (e){
					e.preventDefault();
				});

				this.setConfig(config);
				this.fileupload($.extend(true,
					{
						formData: function(form) {
							var idVal = $(form).find(':input[name=ID]').val();
							var data = [{name: 'SecurityID', value: $(form).find(':input[name=SecurityID]').val()}];
							if(idVal) data.push({name: 'ID', value: idVal});

							return data;
						},
						errorMessages: {
							// errorMessages for all error codes suggested from the plugin author, some will be overwritten by the config coming from php
							1: ss.i18n._t('UploadField.PHP_MAXFILESIZE'),
							2: ss.i18n._t('UploadField.HTML_MAXFILESIZE'),
							3: ss.i18n._t('UploadField.ONLYPARTIALUPLOADED'),
							4: ss.i18n._t('UploadField.NOFILEUPLOADED'),
							5: ss.i18n._t('UploadField.NOTMPFOLDER'),
							6: ss.i18n._t('UploadField.WRITEFAILED'),
							7: ss.i18n._t('UploadField.STOPEDBYEXTENSION'),
							maxFileSize: ss.i18n._t('UploadField.TOOLARGESHORT'),
							minFileSize: ss.i18n._t('UploadField.TOOSMALL'),
							acceptFileTypes: ss.i18n._t('UploadField.INVALIDEXTENSIONSHORT'),
							maxNumberOfFiles: ss.i18n._t('UploadField.MAXNUMBEROFFILESSHORT'),
							uploadedBytes: ss.i18n._t('UploadField.UPLOADEDBYTES'),
							emptyResult: ss.i18n._t('UploadField.EMPTYRESULT')
						},
						send: function(e, data) {
								if (data.context && data.dataType && data.dataType.substr(0, 6) === 'iframe') {
										// Iframe Transport does not support progress events.
										// In lack of an indeterminate progress bar, we set
										// the progress to 100%, showing the full animated bar:
										data.total = 1;
										data.loaded = 1;
										$(this).data('fileupload').options.progress(e, data);
								}
						},
						progress: function(e, data) {
									if (data.context) {
										var value = parseInt(data.loaded / data.total * 100, 10) + '%';
										data.context.find('.ss-uploadfield-item-status').html((data.total == 1)?ss.i18n._t('UploadField.LOADING'):value);
										data.context.find('.ss-uploadfield-item-progressbarvalue').css('width', value);
									}
							}
					},
					config,
					{
						fileInput: fileInput,
						dropZone: dropZone,
						form: $(fileInput).closest('form'),
						previewAsCanvas: false,
						acceptFileTypes: new RegExp(config.acceptFileTypes, 'i')
					}
				));

				if (this.data('fileupload')._isXHRUpload({multipart: true})) {
					$('.ss-uploadfield-item-uploador').hide().show();
					dropZone.hide().show();
				}

				this._super();
			},
			onunmatch: function() {
				this._super();
			},
			openSelectDialog: function(uploadedFile) {
				// Create dialog and load iframe
				var self = this, config = this.getConfig(), dialogId = 'ss-uploadfield-dialog-' + this.attr('id'), dialog = jQuery('#' + dialogId);
				if(!dialog.length) dialog = jQuery('
');

				// If user selected 'Choose another file', we need the ID of the file to replace
				var iframeUrl = config['urlSelectDialog'];
				var uploadedFileId = null;
				if (uploadedFile && uploadedFile.attr('data-fileid') > 0){
					uploadedFileId = uploadedFile.attr('data-fileid');
				}

				// Show dialog
				dialog.ssdialog({iframeUrl: iframeUrl, height: 550});

				// TODO Allow single-select
				dialog.find('iframe').bind('load', function(e) {
					var contents = $(this).contents(), gridField = contents.find('.ss-gridfield');
					// TODO Fix jQuery custom event bubbling across iframes on same domain
					// gridField.find('.ss-gridfield-items')).bind('selectablestop', function() {
					// });

					// Remove top margin (easier than including new selectors)
					contents.find('table.ss-gridfield').css('margin-top', 0);

					// Can't use live() in iframes...
					contents.find('input[name=action_doAttach]').unbind('click.openSelectDialog').bind('click.openSelectDialog', function() {
						// TODO Fix entwine method calls across iframe/document boundaries
						var ids = $.map(gridField.find('.ss-gridfield-item.ui-selected'), function(el) {return $(el).data('id');});
						if(ids && ids.length) self.attachFiles(ids, uploadedFileId);

						dialog.ssdialog('close');
						return false;
					});
				});
				dialog.ssdialog('open');
			},
			attachFiles: function(ids, uploadedFileId) {
				var self = this,
					config = this.getConfig(),
					indicator = $('
'),
					target = (uploadedFileId) ? this.find(".ss-uploadfield-item[data-fileid='"+uploadedFileId+"']") : this.find('.ss-uploadfield-addfile');

				target.children().hide();
				target.append(indicator);

				$.ajax({
					type: "POST",
					url: config['urlAttach'],
					data: {'ids': ids},
					complete: function(xhr, status) {
						target.children().show();
						indicator.remove();
					},
					success: function(data, status, xhr) {
						self.fileupload('attach', {
							files: data,
							options: self.fileupload('option'),
							replaceFileID: uploadedFileId
						});
					}
				});
			}
		});
		$('div.ss-upload *').entwine({
			getUploadField: function() {

				return this.parents('div.ss-upload:first');
			}
		});
		$('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item').entwine({
			onmatch: function() {
				this._super();
				this.closest('.ss-upload').find('.ss-uploadfield-addfile').addClass('borderTop');
			},
			onunmatch: function() {
				$('.ss-uploadfield-files:not(:has(.ss-uploadfield-item))').closest('.ss-upload').find('.ss-uploadfield-addfile').removeClass('borderTop');
				this._super();
			}
		});
		$('div.ss-upload .ss-uploadfield-startall').entwine({
			onclick: function(e) {
				this.closest('.ss-upload').find('.ss-uploadfield-item-start button').click();
				e.preventDefault(); // Avoid a form submit
				return false;
			}
		});
		$('div.ss-upload .ss-uploadfield-item-cancelfailed').entwine({
			onclick: function(e) {
				this.closest('.ss-uploadfield-item').remove();
				e.preventDefault(); // Avoid a form submit
				return false;
			}
		});

		$('div.ss-upload .ss-uploadfield-item-remove:not(.ui-state-disabled), .ss-uploadfield-item-delete:not(.ui-state-disabled)').entwine({
			onclick: function(e) {
				var field = this.closest('div.ss-upload'),
					config = field.getConfig('changeDetection'),
					fileupload = field.data('fileupload'),
					item = this.closest('.ss-uploadfield-item'), msg = '';

				if(this.is('.ss-uploadfield-item-delete')) {
					if(confirm(ss.i18n._t('UploadField.ConfirmDelete'))) {
						if(config.changeDetection) {
							this.closest('form').trigger('dirty');
						}
						fileupload._trigger('destroy', e, {
							context: item,
							url: this.data('href'),
							type: 'get',
							dataType: fileupload.options.dataType
						});
					}
				} else {
					// Removed files will be applied to object on save
					if(config.changeDetection) {
						this.closest('form').trigger('dirty');
					}
					fileupload._trigger('destroy', e, {context: item});
				}

				e.preventDefault(); // Avoid a form submit
				return false;
			}
		});

		$('div.ss-upload .ss-uploadfield-item-edit-all').entwine({
			onclick: function(e) {

				if($(this).hasClass('opened')){
					$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon.opened').each(function(i){
						$(this).closest('.ss-uploadfield-item-edit').click();
					});
					$(this).removeClass('opened').find('.toggle-details-icon').removeClass('opened');
				}else{
					$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon').each(function(i){
						if(!$(this).hasClass('opened')){
							$(this).closest('.ss-uploadfield-item-edit').click();
						}
					});
					$(this).addClass('opened').find('.toggle-details-icon').addClass('opened');
				}

				e.preventDefault(); // Avoid a form submit
				return false;
			}
		});
		$( 'div.ss-upload:not(.disabled):not(.readonly) .ss-uploadfield-item-edit').entwine({
			onclick: function(e) {
				var self = this,
					editform = self.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform'),
					itemInfo = editform.prev('.ss-uploadfield-item-info'),
					iframe = editform.find('iframe');

				// Ignore clicks while the iframe is loading
				if (iframe.parent().hasClass('loading')) {
					e.preventDefault();
					return false;
				}

				if (iframe.attr('src') == 'about:blank') {
					// Lazy-load the iframe on editform toggle
					iframe.attr('src', iframe.data('src'));

					// Add loading class, disable buttons while loading is in progress
					// (_prepareIframe() handles re-enabling them when appropriate)
					iframe.parent().addClass('loading');
					disabled=this.siblings();
					disabled.addClass('ui-state-disabled');
					disabled.attr('disabled', 'disabled');

					iframe.on('load', function() {
						iframe.parent().removeClass('loading');

						// This ensures we only call _prepareIframe() on load once - otherwise it'll
						// be superfluously called after clicking 'save' in the editform
						if (iframe.data('src')) {
							self._prepareIframe(iframe, editform, itemInfo);
							iframe.data('src', '');
						}

						if (editform.hasClass('opened')) editform.fitHeight();
					});
				} else {
					self._prepareIframe(iframe, editform, itemInfo);
				}

				e.preventDefault(); // Avoid a form submit
				return false;
			},
			_prepareIframe: function(iframe, editform, itemInfo) {
				var disabled;

				// Mark the row as changed if any of its form fields are edited
				iframe.contents().ready(function() {
					// Need to use the iframe's own jQuery, as custom event triggers
					// (e.g. from TreeDropdownField) can't be captured by the parent jQuery object.
					var iframe_jQuery = iframe.get(0).contentWindow.jQuery;
					iframe_jQuery(iframe_jQuery.find(':input')).bind('change', function(e){
						editform.removeClass('edited');
						editform.addClass('edited');
					});
				});

				if (editform.hasClass('loading')) {
					// TODO Display loading indication, and register an event to toggle edit form
				} else {
					if(this.hasClass('ss-uploadfield-item-edit')){
						disabled=this.siblings();
					}else{
						disabled=this.find('ss-uploadfield-item-edit').siblings();
					}
					editform.parent('.ss-uploadfield-item').removeClass('ui-state-warning');
					editform.toggleEditForm();

					if (itemInfo.find('.toggle-details-icon').hasClass('opened')) {
						disabled.addClass('ui-state-disabled');
						disabled.attr('disabled', 'disabled');
					} else {
						disabled.removeClass('ui-state-disabled');
						disabled.removeAttr('disabled');
					}
				}
			}
		});

		$('div.ss-upload .ss-uploadfield-item-editform').entwine({
			fitHeight: function() {
				var iframe = this.find('iframe'), padding = 32, parentPadding = 2;
				var h = iframe.contents().find('form').height() + padding;

				if(this.hasClass('includeParent')){
					padding=0;
					parentPadding=12;
				}

				/* Set height of body except in IE8. Setting this in IE8 breaks the
				dropdown */
				if(!$.browser.msie && $.browser.version.slice(0,3) != "8.0"){
					iframe.contents().find('body').css({'height':(h-padding)});
				}

				// Set iframe to match its contents height
				iframe.height(h);

				// set container to match the same height
				iframe.parent().animate({height: h+parentPadding}, 500);
				iframe.contents().find('body form').css({'width':'98%'});

			},
			toggleEditForm: function() {
				var itemInfo = this.prev('.ss-uploadfield-item-info'), status = itemInfo.find('.ss-uploadfield-item-status');
				var iframe = this.find('iframe').contents(), saved=iframe.find('#Form_EditForm_error');
				var text="";

				if(this.height() === 0) {
					text = ss.i18n._t('UploadField.Editing', "Editing ...");
					this.fitHeight();
					this.addClass('opened');
					itemInfo.find('.toggle-details-icon').addClass('opened');
					status.removeClass('ui-state-success-text').removeClass('ui-state-warning-text');
					iframe.find('#Form_EditForm_action_doEdit').click(function(){
						itemInfo.find('label .name').text(iframe.find('#Name input').val());
					});
					if($('div.ss-upload  .ss-uploadfield-files .ss-uploadfield-item-actions .toggle-details-icon:not(.opened)').index() < 0){
						$('div.ss-upload .ss-uploadfield-item-edit-all').addClass('opened').find('.toggle-details-icon').addClass('opened');
					}

				} else {
					this.animate({height: 0}, 500);
					this.removeClass('opened');
					itemInfo.find('.toggle-details-icon').removeClass('opened');
					$('div.ss-upload .ss-uploadfield-item-edit-all').removeClass('opened').find('.toggle-details-icon').removeClass('opened');
					if(!this.hasClass('edited')){
						text = ss.i18n._t('UploadField.NOCHANGES', 'No Changes');
						status.addClass('ui-state-success-text');
					}else{
						if(saved.hasClass('good')){
							text = ss.i18n._t('UploadField.CHANGESSAVED', 'Changes Saved');
							this.removeClass('edited').parent('.ss-uploadfield-item').removeClass('ui-state-warning');
							status.addClass('ui-state-success-text');
						}else{
							text = ss.i18n._t('UploadField.UNSAVEDCHANGES', 'Unsaved Changes');
							this.parent('.ss-uploadfield-item').addClass('ui-state-warning');
							status.addClass('ui-state-warning-text');
						}
					}
					saved.removeClass('good').hide();
				}
				status.attr('title',text).text(text);
			}
		});
		$('div.ss-upload .ss-uploadfield-fromfiles').entwine({
			onclick: function(e) {
				this.getUploadField().openSelectDialog(this.closest('.ss-uploadfield-item'));
				e.preventDefault(); // Avoid a form submit
				return false;
			}
		});
	});
}(jQuery));


text:
require 'rails_helper'

RSpec.describe FeedbackController, type: :controller do
  describe "GET /feedback" do
    it "is successful" do
      get :new
      expect(response).to be_successful
    end
  end

  describe "POST /feedback" do
    def do_post(attributes = {})
      perform_enqueued_jobs do
        post :create, params: { feedback: attributes }
      end
    end

    context "with valid input" do
      it "is successful" do
        do_post comment: "This website is great!"
        expect(response).to redirect_to("https://petitions.gov.je/feedback/thanks")
      end

      it "sends an email" do
        expect {
          do_post comment: "This website is great!"
        }.to change{ ActionMailer::Base.deliveries.size }.by(1)
      end
    end

    context "with invalid input" do
      it "does not send an email" do
        expect {
          do_post comment: ""
        }.not_to change{ ActionMailer::Base.deliveries.size }
      end

      it "returns the user to the form" do
        do_post comment: ""
        expect(response).to render_template("feedback/new")
      end
    end
  end

  describe "GET /feedback/thanks" do
    it "is successful" do
      get :thanks
      expect(response).to be_successful
    end
  end
end


text:
package gov.nasa.ensemble.core.plan;

import gov.nasa.ensemble.common.type.IStringifier;
import gov.nasa.ensemble.common.type.StringifierRegistry;
import gov.nasa.ensemble.core.activityDictionary.ParameterDef;
import gov.nasa.ensemble.emf.util.EMFUtils;

import org.eclipse.emf.ecore.EAttribute;

public class ParameterStringifierUtils {

	@SuppressWarnings("unchecked")
	public static <T> IStringifier<T> getStringifier(EAttribute parameterDef) {
		if (parameterDef instanceof ParameterDef) {
			return getStringifier((ParameterDef)parameterDef);
		}
		return (IStringifier<T>) EMFUtils.getStringifier(parameterDef);
	}

	@SuppressWarnings("unchecked")
	public static <T> IStringifier<T> getStringifier(ParameterDef def) {
		if (hasChoices(def)) {
			return new ChoicesStringifier(def);
		}
		return StringifierRegistry.getStringifier(def.getType());
	}

	private static boolean hasChoices(ParameterDef def) {
		return
			def != null
			&& def.getChoices() != null
			&& !def.getChoices().isEmpty();
	}

}


text:
Use the `thPlural` filter to pluralize or singularize a word automatically given a count.

For applications where the word(s) are known ahead of time, you can use a simple
ternary / function as it is a much lighter alternative over a filter.

## Example:

```html
  <span>{{demo.amount}} {{"post" | pluralize: demo.amount}}</span>
```


text:
#define CATCH_CONFIG_MAIN
#include "catch2/catch.hpp"

#include "lluvia/core.h"

using memflags = ll::MemoryPropertyFlagBits;
#ifdef _WIN32
#define __attribute__()
#endif

TEST_CASE("createInitImage", "test_utils")
{

    // Constants
    const auto memoryFlags = memflags::DeviceLocal;

    const auto width  = uint32_t {1080};
    const auto height = uint32_t {1920};

    const ll::ImageUsageFlags imgUsageFlags = {ll::ImageUsageFlagBits::Storage
                                               | ll::ImageUsageFlagBits::Sampled
                                               | ll::ImageUsageFlagBits::TransferDst};

    const auto imgDesc = ll::ImageDescriptor {1, height, width, ll::ChannelCount::C1, ll::ChannelType::Uint8, imgUsageFlags, ll::ImageTiling::Optimal};

    auto session = ll::Session::create(ll::SessionDescriptor().enableDebug(true));
    auto memory  = session->createMemory(memoryFlags, 0);

    // could create several images at the same time
    auto image = ll::createAndInitImage(session, memory, imgDesc, ll::ImageLayout::General);

    REQUIRE_FALSE(session->hasReceivedVulkanWarningMessages());
}

TEST_CASE("configureGraph", "test_utils")
{

    // Constants
    const auto memoryFlags = memflags::DeviceLocal;

    const auto width  = uint32_t {1080};
    const auto height = uint32_t {1920};

    const ll::ImageUsageFlags imgUsageFlags = {ll::ImageUsageFlagBits::Storage
                                               | ll::ImageUsageFlagBits::Sampled
                                               | ll::ImageUsageFlagBits::TransferDst};

    const auto imgDesc = ll::ImageDescriptor {1, height, width, ll::ChannelCount::C1, ll::ChannelType::Uint8, imgUsageFlags, ll::ImageTiling::Optimal};

    auto session = ll::Session::create(ll::SessionDescriptor().enableDebug(true));
    auto memory  = session->createMemory(memoryFlags, 0);

    const auto RGBADesc = ll::ImageDescriptor(imgDesc).setChannelCount(ll::ChannelCount::C4);
    const auto grayDesc = ll::ImageDescriptor(imgDesc).setChannelCount(ll::ChannelCount::C1);

    // TOTHINK: Could initialiaze both images with a single command buffer. More efficient.
    auto RGBA = ll::createAndInitImage(session, memory, RGBADesc, ll::ImageLayout::General);
    auto gray = ll::createAndInitImage(session, memory, grayDesc, ll::ImageLayout::General);

    // auto rgba2GrayNode = session->readComputeNode("/home/jadarve/git/lluvia/local/nodes/RGBA2Gray.json");
    // configureComputeNode(rgba2GrayNode,
    //                      RGBA->getShape(),
    //                      {{0, RGBA}, {1, gray}} // grid
    //                     );

    // {RGBA->getWidth(), RGBA->getHeight(), RGBA->getDepth()}

    REQUIRE_FALSE(session->hasReceivedVulkanWarningMessages());
}


text:
/**
 * This is a utility package which contains all
 * the "custom" functional interfaces. Some of
 * them are not actively used in the current version.
 */
package org.shanerx.faketrollplus.utils.function;


text:
1. Add a global gen_server to hold the default data that is normally used to
   initialize the MSH segment.


text:
using PB.Frameworks.Common.General;
using System;

namespace PB.Frameworks.Types.Interfaces
{
	public interface IDbEntity
	{
		int Id { get; set; }
		DateTime DateCreated { get; set; }
		DateTime DateModified { get; set; }
		void Validate(GlobalEnums.ActionType actionType, params object[] args);
	}
}


text:
using System.Threading.Tasks;

namespace SFA.DAS.EmployerAccounts.Interfaces
{
    public interface IReservationsApiClient
    {
        Task<string> Get(long accountId);
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="keywords" content="Rob Ruana,software engineer,developer,full stack,Linux,iOS,Objective-C,Swift,Python,JavaScript">
  <meta name="author" content="Rob Ruana">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>Rob Ruana Resume</title>

  <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Oswald:400,700" rel="stylesheet">

Rob Ruana

Herndon, VA

540-247-1603

rob@robruana.com

http://robruana.com

Professional Profile

Full stack engineer with years of experience developing software
    and designing systems for the web, mobile, and server.

Accomplished in building for scalability, eliminating
    performance bottlenecks, and developing for security.

Leader able to organize teams that turn ideas into
    requirements into finished products.

Technical Expertise

Client Side

Objective-C, Swift, JavaScript, Node, Webpack, Vue, HTML5, CSS3, AJAX

Server Side

Python 2/3, CherryPy, Django, Flask, SQLAlchemy, WSGI, GraphQL, REST, JSON-RPC, PHP, Java, C#

Tools

Docker, PostgreSQL, MySQL, Redis, SaltStack, Puppet, Jenkins, Travis, Tox, Git, NGINX, HAProxy, Linux

Career

Bracing Effect, LLC – Owner

Jun 2013 – Present

Herndon, VA

          Designed, developed, and marketed entertainment and productivity apps for iOS.
          Created custom animations and UI elements with a priority on tactile interaction and immediate responsiveness.

Swift, Python, OpenGL, imagemagick, SpriteKit, CloudKit, GameKit, iOS

Swift, WatchKit (Apple Watch), iOS

Objective-C, CoreData, Python, OpenCV, Tesseract OCR, PIL, iOS

          Rapidly adopted and integrated new Apple technologies during beta product launches –
          including support for new devices, beta iOS versions, CoreData, CloudKit, WatchKit, and SpriteKit.

MAGFest, Inc. – Director of Software Engineering

Mar 2017 – Aug 2018

Baltimore, MD

          Oversaw volunteer and contract software developers to effectively direct the development of an
          open source event registration system.

          Mentored junior developers into accomplished senior developers via code review, design discussions,
          and personal support.

          Overhauled legacy codebase that was locked into a monolithic single-process, single-server deployment;
          created a distributed multi-server system capable of handling tens of thousands of badge sales during
          the opening moments of MAGFest preregistration launch.

          Redesigned IT and deployment infrastructure,
          moving from a series of manually created servers and ad-hoc scripts to full configuration management,
          following the principle of "Infrastructure as Code".

          Created repeatable, automated, distributed cloud deployments, drastically reducing administration
          overhead and configuration errors.

Vulnerability Research Labs, LLC – Senior Software Engineer

Dec 2012 – Jun 2013

Reston, VA

          Developed service monitoring and reporting front/back-end using Django,
          jQuery, Bootstrap, HTML5, CSS3, and PostgreSQL.

Django, jQuery, Bootstrap, HTML5, CSS3, and PostgreSQL

Applied Security, Inc. – Lead Software Engineer

Jun 2006 – Aug 2012

Reston, VA

          Led teams of up to five direct reports through complete software lifecycle –
          from inception to finished product, using iterative design and prototyping, with automated testing,
          packaging, and deployment.

          Designed and implemented a suite of secure messaging, content management, and account management products.

PHP, Propel ORM, Phing, Ext JS, PostgreSQL

Pylons, SQLAlchemy, Ext JS, Tornado Web Server, Apache Thrift, PostgreSQL, MySQL

CherryPY, SQLAlchemy, jQuery, HTML5, CSS3, OpenLDAP, PostgreSQL, Redis

          Developed an HTTPS based proxy/VPN tunnel powered by a JavaScript
          Firefox Extension communicating through a custom designed proxy server written in Java.

XUL (Firefox Extension), JavaScript, HTTP CONNECT Tunneling

Java/J2EE, Squid Web Proxy, JSON-RPC

          Established company interview style and made department wide hiring
          decisions. Led in-person and phone interviews. On-boarded
          new hires and mentored junior developers.

United States Coast Guard – Software Engineer

Mar 2002 – Dec 2005

Kearneysville, WV

          Developed vessel boarding and safety inspection app for Pocket PC using C# for the interface,
          backed by ASP.Net web services talking to a SQL Server database.

Pocket PC, Tablet PC, C++, C#, Visual Basic.NET, WSDL/SOAP, IIS, SQL Server

          Created geospatial vessel tracking display using Google Earth with an embedded .Net ActiveX control.
          Consumed and correlated real-time vessel positions with historic vessel tracking data using a sharded SQL Server database.

Google Earth, Visual Basic.NET, ASP.NET, WSDL/SOAP, IIS, SQL Server

          Prototyped new security models, including single sign-on via Active Directory and
          intranet data access through corporate firewall.

C#, ASP.NET, WSDL/SOAP, IIS

          Developed Perl scripts to parse vessel position reports, calculate course deviation, and
          predict tracking via dead reckoning. Eliminated significant bugs in mission critical C++ code for vessel tracking program.

Perl, Borland C++, Oracle

      Open Source Projects
      github.com/RobRuana

Napoleon – Author

Sphinx extension to support NumPy and Google style Python docstrings.

Debunked – Author

Native iOS interface for the snopes.com urban legend and rumor debunking website.

Hudsucker – Author

Command line tool to generate Magic: The Gathering proxy card PDF sheets.

Pockets – Author

A collection of helpful Python utilities.

Sideboard – Contributor

Python web app server with support for exposing web services and running background tasks.

Education

Virginia Tech – BS in Computer Engineering

Minor in Computer Science, Minor in Mathematics

rev {{ site.time | date: '%Y%m%d' }}


text:
/*
 * Based on the implementation of Robert I. Pitts
 * ----------------------------------------------------------------
 */

#ifndef _stack_H
#define _stack_H
#include "../parserscanner/kittytree.h"
#include "../symbol/symbol.h"

typedef struct stackElement {
	 void *data;
	 struct stackElement *next;
} stackElement;

typedef struct stackT {
  struct stackElement *top;
} stackT;

int stackIsEmpty(stackT *stackP);
void stackDestroy(stackT *stackP);
stackT *stackInit();

// functions

FUNC *funcStackPeek(stackT *stackP);
void funcStackPush(stackT *stackP, FUNC *element);
FUNC *funcStackPop(stackT *stackP);

// loop statements

STATEMENT *loopStackPeek(stackT *stackP);
void loopStackPush(stackT *stackP, STATEMENT *element);
STATEMENT *loopStackPop(stackT *stackP);

#endif  /* not defined _stack_H */


text:
package de.saxsys.mvvmfx.utils.validation;

/**
 * The severity of validation messages.
 *
 * @author manuel.mauky
 */
public enum Severity {
	WARNING,
	ERROR
}


text:
package it.cnr.isti.zigbee.zcl.library.impl.security_safety.ias_ace;

import it.cnr.isti.zigbee.zcl.library.api.core.ZBSerializer;
import it.cnr.isti.zigbee.zcl.library.api.security_safety.IASACE;
import it.cnr.isti.zigbee.zcl.library.impl.core.AbstractCommand;
import it.cnr.isti.zigbee.zcl.library.impl.core.DefaultSerializer;

public class ArmCommand extends AbstractCommand {

    private byte armMode;

    public ArmCommand(byte armMode){
        super(IASACE.ARM);
        this.armMode = armMode;
    }

    public byte[] getPayload(){
        if( payload == null){
            payload = new byte[1];
            ZBSerializer serializer = new DefaultSerializer(payload,0);
            serializer.appendByte(armMode);
        }
        return payload;
    }
}


text:
Initial release with core functionality.

    TW.share()

Includes passing tests.

Added LICENSE, README & CHANGELOG


text:
package org.ofbiz.order.thirdparty.taxware;

import org.ofbiz.base.util.GeneralException;

/**
 * TaxwareException
 */
public class TaxwareException extends GeneralException {

    public TaxwareException() {
        super();
    }

    public TaxwareException(String str) {
        super(str);
    }

    public TaxwareException(String str, Throwable nested) {
        super(str, nested);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.restnext</groupId>
    <artifactId>restnext</artifactId>
    <version>0.3.6-SNAPSHOT</version>
  </parent>

  <artifactId>restnext-bom</artifactId>
  <packaging>pom</packaging>

  <name>${project.artifactId}</name>
  <description>
    RestNext Bill of Materials to make sure a consistent set of versions is used for the modules.
  </description>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>restnext-security</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>restnext-util</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>restnext-core</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>restnext-server</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>restnext-route</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-codec-http</artifactId>
        <version>${netty.version}</version>
      </dependency>
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-transport-native-epoll</artifactId>
        <version>${netty.version}</version>
        <classifier>linux-x86_64</classifier>
      </dependency>
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-handler</artifactId>
        <version>${netty.version}</version>
      </dependency>
      <dependency>
        <groupId>pl.joegreen</groupId>
        <artifactId>lambda-from-string</artifactId>
        <version>${lambda-string.version}</version>
        <!--
            It has only one external Maven dependency: Eclipse JDT Core Batch Compiler.
            That dependency was added because Java compiler is a part of JDK (located in tools.jar)
            and it's not available in pure JRE. When client applications were running on JRE then no Java
            compiler was available at runtime and the LambdaFromString library failed to compile lambda code.
            Eclipse ECJ makes it possible to use LambdaFromString even in cases when only JRE is available at runtime.
        -->
        <exclusions>
          <exclusion>
            <groupId>org.eclipse.jdt.core.compiler</groupId>
            <artifactId>ecj</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>jsr305</artifactId>
        <version>${jsr305.version}</version>
      </dependency>
      <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
      </dependency>
      <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>${jaxb.version}</version>
      </dependency>
      <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>${jaxb.version}</version>
      </dependency>
      <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>${jaxb.version}</version>
      </dependency>
      <!--<dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <version>${jaxb.version}</version>
        <exclusions>
          <exclusion>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>-->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <properties>
    <netty.version>4.1.71.Final</netty.version>
    <lambda-string.version>1.6</lambda-string.version>
    <slf4j.version>1.7.30</slf4j.version>
    <junit.version>4.13.1</junit.version>
    <jsr305.version>3.0.2</jsr305.version>
    <jaxb.version>2.2.11</jaxb.version>
  </properties>

</project>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;

namespace Kooboo.CMS.Account.Models
{
    [DataContract]
    public class Role : IPersistable
    {
        public Role()
        {
            Permissions = new List<Permission>();
            //Users = new string[0];
        }

        [DataMember(Order = 1)]
        public string Name { get; set; }
        [DataMember(Order = 3)]
        public List<Permission> Permissions { get; set; }
        //public IEnumerable<string> Users { get; set; }

        //public void AddUser(string userName)
        //{
        //    Users = Users.Concat(new[] { userName });
        //}
        //public void RemoveUser(string userName)
        //{
        //    Users = Users.Where(it => string.Compare(it, userName, true) != 0);
        //}
        //public bool IsUserInRole(string userName)
        //{
        //    return this.Users.Any(it => string.Compare(it, userName, true) == 0);
        //}
        public bool HasPermission(Permission permission)
        {
            return this.Permissions.Any(it => permission == it);
        }

        private bool isDummy = true;
        public bool IsDummy
        {
            get { return isDummy; }
            private set { isDummy = value; }
        }

        public void Init(IPersistable source)
        {
            IsDummy = false;
        }

        public void OnSaved()
        {
            isDummy = false;
        }

        public void OnSaving()
        {

        }
    }
}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=constant.EPOLLIN.html">

Redirecting to constant.EPOLLIN.html...


text:
/*************************************************************************/
/*  hinge_joint_bullet.cpp                                               */
/*  Author: AndreaCatania                                                */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                    http://www.godotengine.org                         */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "hinge_joint_bullet.h"
#include "BulletDynamics/ConstraintSolver/btHingeConstraint.h"
#include "bullet_types_converter.h"
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"

HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB)
	: JointBullet() {
	btTransform btFrameA;
	G_TO_B(frameA, btFrameA);

	if (rbB) {
		btTransform btFrameB;
		G_TO_B(frameB, btFrameB);

		hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB));
	} else {

		hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), btFrameA));
	}

	setup(hingeConstraint);
}

HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB)
	: JointBullet() {

	btVector3 btPivotA;
	btVector3 btAxisA;
	G_TO_B(pivotInA, btPivotA);
	G_TO_B(axisInA, btAxisA);

	if (rbB) {
		btVector3 btPivotB;
		btVector3 btAxisB;
		G_TO_B(pivotInB, btPivotB);
		G_TO_B(axisInB, btAxisB);

		hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btPivotA, btPivotB, btAxisA, btAxisB));
	} else {

		hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), btPivotA, btAxisA));
	}

	setup(hingeConstraint);
}

real_t HingeJointBullet::get_hinge_angle() {
	return hingeConstraint->getHingeAngle();
}

void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t p_value) {
	switch (p_param) {
		case PhysicsServer::HINGE_JOINT_BIAS:
			if (0 < p_value) {
				print_line("The Bullet Hinge Joint doesn't support bias, So it's always 0");
			}
			break;
		case PhysicsServer::HINGE_JOINT_LIMIT_UPPER:
			hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), p_value, hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
			break;
		case PhysicsServer::HINGE_JOINT_LIMIT_LOWER:
			hingeConstraint->setLimit(p_value, hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
			break;
		case PhysicsServer::HINGE_JOINT_LIMIT_BIAS:
			hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), p_value, hingeConstraint->getLimitRelaxationFactor());
			break;
		case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS:
			hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), p_value, hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
			break;
		case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION:
			hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), p_value);
			break;
		case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
			hingeConstraint->setMotorTargetVelocity(p_value);
			break;
		case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE:
			hingeConstraint->setMaxMotorImpulse(p_value);
			break;
		default:
			WARN_PRINTS("The Bullet Hinge Joint doesn't support this parameter: " + itos(p_param) + ", value: " + itos(p_value));
	}
}

real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const {
	switch (p_param) {
		case PhysicsServer::HINGE_JOINT_BIAS:
			return 0;
			break;
		case PhysicsServer::HINGE_JOINT_LIMIT_UPPER:
			return hingeConstraint->getUpperLimit();
		case PhysicsServer::HINGE_JOINT_LIMIT_LOWER:
			return hingeConstraint->getLowerLimit();
		case PhysicsServer::HINGE_JOINT_LIMIT_BIAS:
			return hingeConstraint->getLimitBiasFactor();
		case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS:
			return hingeConstraint->getLimitSoftness();
		case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION:
			return hingeConstraint->getLimitRelaxationFactor();
		case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
			return hingeConstraint->getMotorTargetVelocity();
		case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE:
			return hingeConstraint->getMaxMotorImpulse();
		default:
			WARN_PRINTS("The Bullet Hinge Joint doesn't support this parameter: " + itos(p_param));
			return 0;
	}
}

void HingeJointBullet::set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value) {
	switch (p_flag) {
		case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT:
			if (!p_value) {
				hingeConstraint->setLimit(-Math_PI, Math_PI);
			}
			break;
		case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR:
			hingeConstraint->enableMotor(p_value);
			break;
	}
}

bool HingeJointBullet::get_flag(PhysicsServer::HingeJointFlag p_flag) const {
	switch (p_flag) {
		case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT:
			return true;
		case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR:
			return hingeConstraint->getEnableAngularMotor();
		default:
			return false;
	}
}