text:
"""Test the Home Assistant Yellow hardware platform."""
from unittest.mock import patch

import pytest

from homeassistant.components.homeassistant_yellow.const import DOMAIN
from homeassistant.core import HomeAssistant

from tests.common import MockConfigEntry, MockModule, mock_integration

async def test_hardware_info(hass: HomeAssistant, hass_ws_client) -> None:
    """Test we can get the board info."""
    mock_integration(hass, MockModule("hassio"))

    # Setup the config entry
    config_entry = MockConfigEntry(
        data={},
        domain=DOMAIN,
        options={},
        title="Home Assistant Yellow",
    )
    config_entry.add_to_hass(hass)
    with patch(
        "homeassistant.components.homeassistant_yellow.get_os_info",
        return_value={"board": "yellow"},
    ):
        assert await hass.config_entries.async_setup(config_entry.entry_id)
        await hass.async_block_till_done()

    client = await hass_ws_client(hass)

    with patch(
        "homeassistant.components.homeassistant_yellow.hardware.get_os_info",
        return_value={"board": "yellow"},
    ):
        await client.send_json({"id": 1, "type": "hardware/info"})
        msg = await client.receive_json()

    assert msg["id"] == 1
    assert msg["success"]
    assert msg["result"] == {
        "hardware": [
            {
                "board": {
                    "hassio_board_id": "yellow",
                    "manufacturer": "homeassistant",
                    "model": "yellow",
                    "revision": None,
                },
                "dongle": None,
                "name": "Home Assistant Yellow",
                "url": None,
            }
        ]
    }

@pytest.mark.parametrize("os_info", [None, {"board": None}, {"board": "other"}])
async def test_hardware_info_fail(hass: HomeAssistant, hass_ws_client, os_info) -> None:
    """Test async_info raises if os_info is not as expected."""
    mock_integration(hass, MockModule("hassio"))

    # Setup the config entry
    config_entry = MockConfigEntry(
        data={},
        domain=DOMAIN,
        options={},
        title="Home Assistant Yellow",
    )
    config_entry.add_to_hass(hass)
    with patch(
        "homeassistant.components.homeassistant_yellow.get_os_info",
        return_value={"board": "yellow"},
    ):
        assert await hass.config_entries.async_setup(config_entry.entry_id)
        await hass.async_block_till_done()

    client = await hass_ws_client(hass)

    with patch(
        "homeassistant.components.homeassistant_yellow.hardware.get_os_info",
        return_value=os_info,
    ):
        await client.send_json({"id": 1, "type": "hardware/info"})
        msg = await client.receive_json()

    assert msg["id"] == 1
    assert msg["success"]
    assert msg["result"] == {"hardware": []}


text:
<?php namespace Ordercloud\Requests\Products\Handlers;

use Ordercloud\Requests\Handlers\AbstractPutRequestHandler;
use Ordercloud\Requests\Products\UpdateProductTagRequest;

class UpdateProductTagRequestHandler extends AbstractPutRequestHandler
{
    /**
     * @param UpdateProductTagRequest $request
     */
    protected function configure($request)
    {
        $this->setUrl('/resource/product/tag/%d', $request->getTagId())
            ->setBodyParameters([
                'name'             => $request->getName(),
                'description'      => $request->getDescription(),
                'shortDescription' => $request->getShortDescription(),
            ]);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:aspect="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical">

    <me.mattak.aspect_ratio_layout.EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/black"
        android:gravity="center"
        android:text="EditText"
        android:textColor="@android:color/white"
        aspect:aspect_height="1"
        aspect:aspect_width="1"
        aspect:relative_height="0.5"
        aspect:relative_width="0.5" />

</LinearLayout>


text:
function makeinpt(input_file)
%makeinpt(input_file)
%

dummy1==0;
while dummy1==0,
	input_file=input('What is the input file name ([Enter] for new file)? ','s');

	if isempty(input_file)==1;
		input_file=input('Please enter the path and file name for the new input_file. ','s');
		while chekfile(input_file)~=1
			fprintf('The file %s already exists.\n',input_file);
			input_file=input('Please enter the path and file name for the new input_file. ','s');
			end
		makeinpt(input_file);			%Runs through all the questions and returns the needed outputs
		dummy1==1;

	if chekfile(input_file)==1;
		load input_file;
		dummy1==1;
	else
		dummy1==0;
		end
	end


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

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
extern unsigned long _etext;
extern unsigned long _sidata;		/* start address for the initialization values
                                   of the .data section. defined in linker script */
extern unsigned long _sdata;		/* start address for the .data section. defined
                                   in linker script */
extern unsigned long _edata;		/* end address for the .data section. defined in
                                   linker script */

extern unsigned long _sbss;			/* start address for the .bss section. defined
                                   in linker script */
extern unsigned long _ebss;			/* end address for the .bss section. defined in
                                   linker script */

extern void _estack;		/* init value for the stack pointer. defined in linker script */

/* Private typedef -----------------------------------------------------------*/
/* function prototypes -------------------------------------------------------*/
void Reset_Handler(void) __attribute__((__interrupt__));
extern int main(void);

/*******************************************************************************
*
* The minimal vector table for a Cortex M3.  Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
*******************************************************************************/

__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) =
{
  &_estack,            // The initial stack pointer
  Reset_Handler,             // The reset handler
  NMIException,
  HardFaultException,
  MemManageException,
  BusFaultException,
  UsageFaultException,
  0, 0, 0, 0,            /* Reserved */
  SVCHandler,
  DebugMonitor,
  0,                      /* Reserved */
  PendSVC,
  SysTickHandler,
  WWDG_IRQHandler,
  PVD_IRQHandler,
  TAMPER_IRQHandler,
  RTC_IRQHandler,
  FLASH_IRQHandler,
  RCC_IRQHandler,
  EXTI0_IRQHandler,
  EXTI1_IRQHandler,
  EXTI2_IRQHandler,
  EXTI3_IRQHandler,
  EXTI4_IRQHandler,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  ADC1_2_IRQHandler,
  USB_HP_CAN_TX_IRQHandler,
  USB_LP_CAN_RX0_IRQHandler,
  CAN_RX1_IRQHandler,
  CAN_SCE_IRQHandler,
  EXTI9_5_IRQHandler,
  TIM1_BRK_IRQHandler,
  TIM1_UP_IRQHandler,
  TIM1_TRG_COM_IRQHandler,
  TIM1_CC_IRQHandler,
  TIM2_IRQHandler,
  TIM3_IRQHandler,
  TIM4_IRQHandler,
  I2C1_EV_IRQHandler,
  I2C1_ER_IRQHandler,
  I2C2_EV_IRQHandler,
  I2C2_ER_IRQHandler,
  SPI1_IRQHandler,
  SPI2_IRQHandler,
  USART1_IRQHandler,
  USART2_IRQHandler,
  USART3_IRQHandler,
  EXTI15_10_IRQHandler,
  RTCAlarm_IRQHandler,
  USBWakeUp_IRQHandler,
  TIM8_BRK_IRQHandler,
  TIM8_UP_IRQHandler,
  TIM8_TRG_COM_IRQHandler,
  TIM8_CC_IRQHandler,
  ADC3_IRQHandler,
  FSMC_IRQHandler,
  SDIO_IRQHandler,
  TIM5_IRQHandler,
  SPI3_IRQHandler,
  UART4_IRQHandler,
  UART5_IRQHandler,
  TIM6_IRQHandler,
  TIM7_IRQHandler,
  DMA2_Channel1_IRQHandler,
  DMA2_Channel2_IRQHandler,
  DMA2_Channel3_IRQHandler,
  DMA2_Channel4_5_IRQHandler,
  (unsigned short)0xF108F85F //this is a workaround for boot in RAM mode.
};

/*******************************************************************************
* Function Name  : Reset_Handler
* Description    : This is the code that gets called when the processor first
*                  starts execution following a reset event. Only the absolutely
*                  necessary set is performed, after which the application
*                  supplied main() routine is called.
* Input          :
* Output         :
* Return         :
*******************************************************************************/
void Reset_Handler(void)
{
    unsigned long *pulSrc, *pulDest;

    //
    // Copy the data segment initializers from flash to SRAM.
    //
    pulSrc = &_sidata;
    for(pulDest = &_sdata; pulDest < &_edata; )
    {
        *(pulDest++) = *(pulSrc++);
    }

    //
    // Zero fill the bss segment.
    //
    for(pulDest = &_sbss; pulDest < &_ebss; )
    {
        *(pulDest++) = 0;
    }

    //
    // Call the application's entry point.
    //
    main();
}

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


text:
class WebHook < ApplicationRecord
  include Sortable

  attr_encrypted :token,
                 mode:      :per_attribute_iv,
                 algorithm: 'aes-256-gcm',
                 key:       Settings.attr_encrypted_db_key_base_32

  attr_encrypted :url,
                 mode:      :per_attribute_iv,
                 algorithm: 'aes-256-gcm',
                 key:       Settings.attr_encrypted_db_key_base_32

  has_many :web_hook_logs

  validates :url, presence: true
  validates :url, public_url: true, unless: ->(hook) { hook.is_a?(SystemHook) }

  validates :token, format: { without: /\n/ }
  validates :push_events_branch_filter, branch_filter: true

  # rubocop: disable CodeReuse/ServiceClass
  def execute(data, hook_name)
    WebHookService.new(self, data, hook_name).execute
  end
  # rubocop: enable CodeReuse/ServiceClass

  # rubocop: disable CodeReuse/ServiceClass
  def async_execute(data, hook_name)
    WebHookService.new(self, data, hook_name).async_execute
  end
  # rubocop: enable CodeReuse/ServiceClass

  # Allow urls pointing localhost and the local network
  def allow_local_requests?
    Gitlab::CurrentSettings.allow_local_requests_from_web_hooks_and_services?
  end

  def help_path
    'user/project/integrations/webhooks'
  end
end


text:
package Google::Ads::GoogleAds::V10::Enums::AppPaymentModelTypeEnum;

use strict;
use warnings;

use Const::Exporter enums => [
  UNSPECIFIED => "UNSPECIFIED",
  UNKNOWN     => "UNKNOWN",
  PAID        => "PAID"
];

1;


text:
package com.yofc.odn.admin.service;

import java.util.List;

import com.yofc.odn.common.model.Factory;

public interface FactoryService {

	public int addFacotryService(Factory factory);
	public List<Factory> getFactoryAll();
	public Factory getFactoryService(int n);
	public int modifyFactoryService(Factory factory);
	public int deleteFactoryService(int factoryId);
	public List<Factory> getFactoryByNameService(String factoryName);
	public List<Factory> getFactoryByTypeService(int factoryType);
}


text:
package com.ideaknow.api.client.forms.glass;

import android.os.Parcel;
import android.os.Parcelable;
import com.ideaknow.api.client.forms.accounts.AccountMovementsForm;
import com.ideaknow.api.client.forms.session.SessionForm;

public class SessionAccountMovementsForm implements Parcelable {

    private SessionForm session;
    private AccountMovementsForm accountMovements;

    public SessionAccountMovementsForm() {
    }

    public SessionForm getSession() {
        return session;
    }

    public void setSession(SessionForm session) {
        this.session = session;
    }

    public AccountMovementsForm getAccountMovements() {
        return accountMovements;
    }

    public void setAccountMovements(AccountMovementsForm accountMovements) {
        this.accountMovements = accountMovements;
    }

    @Override
    public String toString() {
        return "SessionAccountMovementsForm{" +
                "session=" + session +
                ", accountMovements=" + accountMovements +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.session, 0);
        dest.writeParcelable(this.accountMovements, 0);
    }

    private SessionAccountMovementsForm(Parcel in) {
        this.session = in.readParcelable(SessionForm.class.getClassLoader());
        this.accountMovements = in.readParcelable(AccountMovementsForm.class.getClassLoader());
    }

    public static final Creator<SessionAccountMovementsForm> CREATOR =
            new Creator<SessionAccountMovementsForm>() {
                public SessionAccountMovementsForm createFromParcel(Parcel source) {
                    return new SessionAccountMovementsForm(source);
                }

                public SessionAccountMovementsForm[] newArray(int size) {
                    return new SessionAccountMovementsForm[size];
                }
            };
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import {apiFetch, apiFetchJson} from '../helpers/apiFetchJson';
import Lifecycle from '../components/Lifecycle';

// Show a warning that the user's session is likely to timeout shortly.
// This will be reset by Ajax calls or single-page navigation, so isn't entirely
// accurate and will warn a bit too aggressively.  But it will work well for full-page
// loads without other interactions.
export default class SessionRenewal extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      probeJson: null,
      shouldShowError: false
    };
    this.probeInterval = null;

    this.onProbeInterval = this.onProbeInterval.bind(this);
    this.onProbed = this.onProbed.bind(this);
    this.onProbeRequestFailed = this.onProbeRequestFailed.bind(this);
    this.onRenewClicked = this.onRenewClicked.bind(this);
    this.onRenewCompleted = this.onRenewCompleted.bind(this);
    this.onRenewFailed = this.onRenewFailed.bind(this);
  }

  componentDidMount() {
    this.startProbeInterval();
  }

  componentWillUnmount() {
    this.stopProbeInterval();
  }

  startProbeInterval() {
    const {probeIntervalInSeconds} = this.props;
    this.probeInterval = setInterval(this.onProbeInterval, probeIntervalInSeconds * 1000);
  }

  stopProbeInterval() {
    if (this.probeInterval) clearInterval(this.probeInterval);
  }

  rollbar(shortMsg, err = {}) {
    const msg = `SessionRenewal-v4-${shortMsg}`;
    const {warnFn} = this.props;
    if (warnFn) return warnFn(msg, err);

    if (window.Rollbar && window.Rollbar.info) {
      window.Rollbar.info(msg, err);
    } else {
      // This fallback shouldn't happen, since the Rollbar reporting API should be mocked in
      // local development.  But in case that fails or the lib fails to load, at least log t
      // the console so we know.
      console.log('window.Rollbar not found', msg, err); // eslint-disable-line
    }
  }

  shouldWarn() {
    const {probeIntervalInSeconds, warningDurationInSeconds} = this.props;
    const {probeJson} = this.state;
    if (!probeJson) return false;

    return shouldWarn(probeJson.remaining_seconds, probeIntervalInSeconds, warningDurationInSeconds);
  }

  // Side-effecting.  The intention is to help users who are in another tab see that
  // this tab is close to timing out.  It change the color of the favicon and the
  // document title to indicate there's a kind of notification.
  doUpdateAggressiveWarning(shouldWarn) {
    const {updateAgressiveWarningFn} = this.props;
    if (updateAgressiveWarningFn) {
      updateAgressiveWarningFn(shouldWarn);
    } else {
      updateFaviconAndDocumentTitle(shouldWarn);
    }
  }

  // At this point, any transient data in the browser will be rejected by the server.
  // If the server session has expired, this will redirect to the sign in page, clearing the
  // screen of student data.
  forciblyClearPage() {
    // This usually won't be reported since the request
    // will be aborted by the navigation below.  For debugging issues,
    // look at the server logs for `/?expired-v4` instead.
    this.rollbar('forciblyClearPage');
    this.stopProbeInterval();

    const {forciblyClearPage} = this.props;
    if (forciblyClearPage) {
      forciblyClearPage();
    } else {
      window.location = '/?expired-v4';
    }
  }

  // This uses `fetch` directly to tell the difference
  // between a hard "failure" and a redirection or non-200 status
  // code.
  onProbeInterval() {
    apiFetch('/educators/probe')
      .then(this.onProbed)
      .catch(this.onProbeRequestFailed);
  }

  // If probe fails because user's session has expired, force reload
  // to clear tab.  If it's still valid, store the response with info
  // about how long is left, so we can warn the user.
  onProbed(fetchResponse) {
    // The session already expired, forcibly reload
    if (fetchResponse.status === 401) {
      this.forciblyClearPage();
      return;
    }

    // Store how much time left in the session
    fetchResponse.json().then(probeJson => this.setState({probeJson}));
  }

  // Report to Rollbar, but take no UI action
  onProbeRequestFailed(err) {
    this.rollbar('onProbeFailed', err);
  }

  onRenewClicked(e) {
    this.rollbar('onRenewClicked');
    e.preventDefault();
    apiFetchJson('/educators/reset')
      .then(this.onRenewCompleted)
      .catch(this.onRenewFailed);
  }

  onRenewCompleted(json) {
    this.rollbar('onRenewClicked');
    this.setState({shouldShowError: false});
    this.onProbeInterval(); // for immediate feedback if probeInterval is large
  }

  // If this failed, keep the page open since they just interacted
  // with the page, and the error message is better than navigating away
  // unexpectedly.  This stops the probe interval and so the tab would
  // stay visible, with the expectation that the user is about to take
  // some other action (like reloading, signing out/in or closing the tab).
  onRenewFailed() {
    this.rollbar('onRenewFailed');
    this.setState({shouldShowError: true});
    this.stopProbeInterval();
  }

  render() {
    const {shouldShowError} = this.state;

    if (shouldShowError) {
      return (

There was an error with your session, please sign in again.

      );
    }

    if (this.shouldWarn()) {
      return (

          <Lifecycle
            componentWillMount={this.doUpdateAggressiveWarning.bind(this, true)}
            componentWillUnmount={this.doUpdateAggressiveWarning.bind(this, false)}>
            Please click this link or your session will timeout due to inactivity.
          </Lifecycle>

      );
    }

    return null;
  }
}
SessionRenewal.propTypes = {
  probeIntervalInSeconds: PropTypes.number.isRequired,
  warningDurationInSeconds: PropTypes.number.isRequired,
  forciblyClearPage: PropTypes.func,
  warnFn: PropTypes.func,
  updateAgressiveWarningFn: PropTypes.func
};

const styles = {
  root: {
    position: 'fixed',
    top: 0,
    left: 0,
    right: 0,
    backgroundColor: 'orange',
    color: 'white',
    textAlign: 'center',
    padding: 20,
    zIndex: 9999
  },
  link: {
    color: 'white',
    textDecoration: 'underline',
    fontSize: 16
  }
};

// Allow enough time to so that they are guaranteed to have at least
// `warningDurationInSeconds` to respond (or more, depending on probeInterval).
export function shouldWarn(remainingSeconds, probeIntervalInSeconds, warningDurationInSeconds) {
  return (remainingSeconds - probeIntervalInSeconds <= warningDurationInSeconds);
}

function updateFaviconAndDocumentTitle(shouldWarn) {
  // title
  const actualTitle = window.document.title.replace(/^\(1\) /, '');
  const updatedDocumentTitle = (shouldWarn)
    ? '(1) ' + actualTitle
    : actualTitle;
  window.document.title = updatedDocumentTitle;

  // favicon
  const faviconEl = document.getElementById('favicon');
  const faviconHref = (shouldWarn)
    ? '/favicon-alert-orange-white.ico'
    : '/favicon.ico';
  faviconEl.href = faviconHref;
}


text:
package com.ecollege.prospero.messagegenerator.examples;

import com.ecollege.prospero.messagegenerator.ContextTag;
import com.ecollege.prospero.messagegenerator.Prospero;
import com.ecollege.prospero.messagegenerator.ProsperoPrincipal;
import com.ecollege.prospero.messagegenerator.PublishInput;
import com.ecollege.prospero.messagegenerator.PublishResponse;
import com.ecollege.prospero.messagegenerator.logger.Logger;
import com.ecollege.prospero.messagegenerator.logger.SystemOutLogger;

public class Publisher {
	public interface PayloadSetter
	{
		void setPayload(String payload, PublishInput input);
	}

	public void Publish(PayloadSetter setter)
	{
		String principalId = "ONE";
		String prosperoHost = "localhost";
		int prosperoPort = 4778;
		String sharedKey = "1234567890123456";

		ProsperoPrincipal principal = new ProsperoPrincipal();
		principal.setKey(sharedKey);
		principal.setPrincipalId(principalId);
		principal.setProsperoHost(prosperoHost);
		principal.setProsperoPort(prosperoPort);

		PublishInput input = new PublishInput();
		input.setClient("Client1");
		input.setClientString("ClientOne");
		input.setMessageType("MessageType1");
		input.setRealm("*");
		input.setSystem("Test");
		input.setSubSystem("Generator");
		input.addTag(new ContextTag("UserId", "UserOne"));

		setter.setPayload("Hello", input);

		Logger logger = new SystemOutLogger();

		PublishResponse response = Prospero.publish(input, principal, logger);

		if(response.getException() != null)
		{
			logger.log("An error occurred while attempting to publish!");
			logger.log(response.getException());
			System.exit(1);
		}
		else
		{
			logger.log("Message Id: " + response.getMessageId());
		}
		logger.log("Done");
	}
}


text:
<?php

namespace plato;

function required() {
    return function ($value) {
        return ($value !== null) && ($value !== '');
    };
}

function forbidden() {
    return function($v) {
        return $v === null;
    };
}

function equals($expected) {
    return function($value) use ($expected) {
        return $value === $expected;
    };
}

function whitelist(array $values) {
    return function($v) use ($values) {
        return in_array($v, $values);
    };
}

function blacklist(array $values) {
    return function($v) use ($values) {
        return !in_array($v, $values);
    };
}


text:
BEGIN TRANSACTION;
    UPDATE DB1.dbo.Table1 SET Value = 1;
    UPDATE DB2.dbo.Table2 SET Value = 1;

    BEGIN TRANSACTION;
        UPDATE DB1.dbo.Table1 SET Value = 1;
        UPDATE DB2.dbo.Table2 SET Value = 1;
    COMMIT TRANSACTION;
COMMIT TRANSACTION;


text:
'''
tests/lib/subtest.py
Utility functions for running sub-tests within a test case. Includes additional
logging to add context during sub-test execution.
'''

import logging
import unittest

from tests.lib.decorator import log_function

logger = logging.getLogger('sublime-ycmd.' + __name__)

def _is_args_kwargs(test_case):
    if not isinstance(test_case, (tuple, list)):
        return False
    if len(test_case) != 2:
        return False

    if not isinstance(test_case[1], dict):
        return False

    return True

def map_test_function(test_instance, test_function, test_cases):
    assert isinstance(test_instance, unittest.TestCase), \
        'test instance must be a unittest.TestCase: %r' % (test_instance)
    assert callable(test_function), \
        'test function must be callable: %r' % (test_function)
    assert hasattr(test_cases, '__iter__'), \
        'test cases must be iterable: %r' % (test_cases)

    for test_index, test_case in enumerate(test_cases, start=1):
        is_args_kwargs = _is_args_kwargs(test_case)
        is_kwargs = isinstance(test_case, dict)
        is_args = not (is_args_kwargs or is_kwargs)

        if is_args_kwargs:
            test_args, test_kwargs = test_case
        elif is_kwargs:
            test_args = tuple()
            test_kwargs = test_case
        elif is_args:
            test_args = test_case
            test_kwargs = dict()

        log_args = is_args_kwargs or is_args
        log_kwargs = is_args_kwargs or is_kwargs

        wrapped_test_function = log_function(
            desc='[%d]' % (test_index),
            include_args=log_args, include_kwargs=log_kwargs,
        )(test_function)

        with test_instance.subTest(num=test_index,
                                   args=test_args, kwargs=test_kwargs):
            wrapped_test_function(*test_args, **test_kwargs)


text:
package nettyinaction.selfcodec;

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

import io.netty.buffer.ByteBuf;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.util.CharsetUtil;

public class MemcachedRequestEncoderTest {
	@Test
	public void testMemcachedRequestEncoder() {
		MemcachedRequest request = new MemcachedRequest(Opcode.SET, "key1", "value1");

		EmbeddedChannel channel = new EmbeddedChannel(new MemcachedRequestEncoder());
		channel.writeOutbound(request);

		ByteBuf encoded = channel.readOutbound();

		Assert.assertNotNull(encoded);
		Assert.assertEquals(request.getMagic(), encoded.readUnsignedByte());
		Assert.assertEquals(request.getOpCode(), encoded.readByte());
		Assert.assertEquals(4, encoded.readShort());  //key.length
		Assert.assertEquals((byte) 0x80, encoded.readByte()); //extra
		Assert.assertEquals((byte) 0, encoded.readByte());
		Assert.assertEquals(0, encoded.readShort());
		Assert.assertEquals(4 + 6 + 8, encoded.readInt());
		Assert.assertEquals(request.getId(), encoded.readInt());
		Assert.assertEquals(request.getCas(), encoded.readLong());
		Assert.assertEquals(request.getFlags(), encoded.readInt());
		Assert.assertEquals(request.getExpires(), encoded.readInt());

		byte[] data = new byte[encoded.readableBytes()];
		encoded.readBytes(data);
		Assert.assertArrayEquals((request.getKey() + request.getBody()).getBytes(CharsetUtil.UTF_8),
				data);
		Assert.assertFalse(encoded.isReadable());

		Assert.assertFalse(channel.finish());
		Assert.assertNull(channel.readInbound());
	}
}


text:
package edu.gemini.wdba.server;

import edu.gemini.wdba.exec.ExecXmlRpcHandler;
import edu.gemini.wdba.xmlrpc.IExecXmlRpc;
import edu.gemini.wdba.xmlrpc.ITccXmlRpc;
import edu.gemini.wdba.xmlrpc.ISessionXmlRpc;
import edu.gemini.wdba.tcc.TccXmlRpcHandler;
import edu.gemini.wdba.session.SessionXmlRpcHandler;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
import org.apache.xmlrpc.server.XmlRpcServerConfigImpl;
import org.apache.xmlrpc.webserver.XmlRpcServlet;
import org.apache.xmlrpc.webserver.XmlRpcServletServer;

import javax.servlet.ServletConfig;

/**
 * Gemini Observatory/AURA
 * $Id: WdbaXmlRpcServlet.java 874 2007-06-04 17:06:28Z gillies $
 */
public final class WdbaXmlRpcServlet extends XmlRpcServlet {
    /**
     * Creates a new handler mapping, setting the handler to the Horizons XML-RPC service
     *
     * @return a new XmlRpcHandlerMapping configured with one handler for
     *         the wdba service
     * @throws XmlRpcException if there are problems adding the handler
     */
    protected XmlRpcHandlerMapping newXmlRpcHandlerMapping() throws XmlRpcException {
        PropertyHandlerMapping mapping = new PropertyHandlerMapping();
        System.out.println("Adding mapping: " + IExecXmlRpc.NAME);
        mapping.addHandler(IExecXmlRpc.NAME, ExecXmlRpcHandler.class);
        System.out.println("Adding mapping: " + ITccXmlRpc.NAME);
        mapping.addHandler(ITccXmlRpc.NAME, TccXmlRpcHandler.class);
        System.out.println("Adding mapping: " + ISessionXmlRpc.NAME);
        mapping.addHandler(ISessionXmlRpc.NAME,  SessionXmlRpcHandler.class);
        return mapping;
    }

    /**
     * Creates a new instance of {@link org.apache.xmlrpc.server.XmlRpcServer}, which
     * is being used to process the requests. Uses the base implementation to get
     * the server, and then configures it a bit to use extensions (to allow the service
     * to pass null parameters)
     *
     * @param servletConfig Servlet configuration. Not used
     * @return the XmlRpcServer used to process the request. In this case it's a
     *         XmlRpcServletServer
     * @throws XmlRpcException if there is a problem getting the server
     */
    protected XmlRpcServletServer newXmlRpcServer(ServletConfig servletConfig) throws XmlRpcException {
        XmlRpcServletServer server = super.newXmlRpcServer(servletConfig);
        XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) server.getConfig();
        serverConfig.setEnabledForExtensions(true);
        serverConfig.setContentLengthOptional(false);
        return server;
    }
}


text:
require 'test/unit'

class TestNumeric < Test::Unit::TestCase

  class NumericWithSomeMethods < Numeric
    def initialize(value = 0)
      @value = value
    end

    def expect(arg)
      @expected_arg = arg
    end

    def check(arg)
      raise "Expected #{@expected_arg.inspect}, but received #{arg.inspect}" unless @expected_arg == arg
    end

    def /(arg) check(arg); 543.21 end
    def %(arg) check(arg); 89 end
    def to_f() @value.to_f end
    def <=>(other) @value <=> other end
    def <(other) @value < other end
    def >(other) @value > other end
    def eql?(other) @value.eql?(other) end
    def to_i() @value.to_i end
  end

  def setup
    @a = Numeric.new
    @b = Numeric.new
  end

  def test_unary_plus
    assert_same @a, +@a
  end

  def test_unary_minus_should_raise_if_self_cannot_be_coerced_to_float
    assert_raises(TypeError) { -@a }
  end

  def test_unary_minus_should_coerce_to_float_and_negate_result
    assert_equal 123.45, NumericWithSomeMethods.new(123.45).to_f
    assert_equal -123.45, -NumericWithSomeMethods.new(123.45)
  end

  def test_spaceship_should_return_zero_when_comparting_with_self_and_nil_otherwise
    assert_equal 0, @a <=> @a

    assert_nil @a <=> @b
    assert_nil @a <=> 1
    assert_nil @a <=> ""
    assert_nil @a <=> nil
  end

  def test_abs_should_return_self_if_bigger_than_zero_and_result_of_unitary_minus_on_self_otherwise
    assert_raises(ArgumentError) { @a.abs }

    positive = NumericWithSomeMethods.new(1).abs
    assert positive > 0
    assert_same positive, positive.abs

    negative = NumericWithSomeMethods.new(-2)
    assert negative < 0
    # unitary minus operator effectively returns -(self.to_f)
    assert_equal 2.0, negative.abs
    assert_equal Float, negative.abs.class
  end

  # ceil
  def test_ceil_should_delegate_to_self_to_f
    assert_equal 124, NumericWithSomeMethods.new(123.49).ceil
    assert_equal -123, NumericWithSomeMethods.new(-123.51).ceil
  end

  def test_ceil_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.ceil }
  end

  def test_coerce_should_copy_argument_and_self_if_both_have_the_same_type
    assert_equal [@b, @a], @a.coerce(@b)
    assert_equal [0.9, 0.1], 0.1.coerce(0.9)
    assert_equal [0, 1], 1.coerce(0)
  end

  def test_coerce_should_call_float_on_self_and_arg_if_they_are_of_different_type
    bignum = 100000000000000000000000
    assert bignum.is_a?(Bignum)
    assert_equal [Float(bignum), 0.0], 0.0.coerce(bignum)
    assert 0.0.coerce(bignum).first.is_a?(Float)
    assert 0.0.coerce(bignum).last.is_a?(Float)

    n = NumericWithSomeMethods.new(123.45)
    assert_equal [1.0, 123.45], n.coerce(1.0)
  end

  def test_coerce_should_blow_up_if_self_or_arg_cannot_be_converted_to_float_by_kernel_Float
    assert_raises(TypeError) { @a.coerce(1.0) }
    assert_raises(ArgumentError) { 1.coerce("test") }
    assert_raises(TypeError) { 1.coerce(nil) }
    assert_raises(TypeError) { 1.coerce(false) }
  end

  def test_div_should_raise_if_self_doesnt_implement_divison_operator
    assert_raises(NoMethodError) { @a.div(@b) }
  end

  def test_div_should_call_division_method_and_floor_it
    n = NumericWithSomeMethods.new

    # n / anything returns 543.21
    n.expect(:foo)
    assert_equal 543.21, n / :foo
    n.expect(@a)
    assert_equal 543, n.div(@a)
  end

  def test_divmod_should_return_result_of_div_and_mod_as_array
    n = NumericWithSomeMethods.new
    n.expect(:foo)
    # n.div(anything) returns 543, n % anything returns 89
    assert_equal [543, 89], n.divmod(:foo)
  end

  def test_divmod_should_calculate_div_correctly
    dividends = [-0.58, 0.58, -0.59, 0.59, -0.63, 0.63, -0.66, 0.66, -0.67, 0.67]
    divisor = 1 / 12.0
    expected_divs = [-7, 6, -8, 7, -8, 7, -8, 7, -9, 8]
    dividends.each_with_index { |dividend, idx|
      assert_equal(expected_divs[idx], dividend.divmod(divisor)[0])
    }
  end

  def test_divmod_should_raise_when_self_doesnt_implement_div_or_mod
    assert_raises(NoMethodError) { @a.divmod(@b) }
  end

  def test_eql
    assert_equal true, @a.eql?(@a)
    assert_equal false, @a.eql?(@b)
  end

  def test_floor_should_delegate_to_self_to_f
    assert_equal 123, NumericWithSomeMethods.new(123.51).floor
    assert_equal -124, NumericWithSomeMethods.new(-123.49).floor
  end

  def test_floor_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.floor }
  end

  def test_initialize_copy_should_raise
    assert_raises(TypeError) { @a.instance_eval("initialize_copy(:foo)") }
  end

  def test_initialize_copy_should_be_private
    assert @a.private_methods.include?("initialize_copy")
    assert_equal false, @a.methods.include?("initialize_copy")
  end

  def test_integer
    assert_equal false, @a.integer?
  end

  def test_modulo_should_raise_if_self_doesnt_have_percent_operator
    assert_raises(NoMethodError) { @a.modulo(@b) }
  end

  def test_modulo_should_call_percent_operator
    n = NumericWithSomeMethods.new
    n.expect(:foo)
    # n % anything returns 89
    assert_equal 89, n.modulo(:foo)
  end

  def test_nonzero_should_check_equality_and_returns_self_or_nil
    assert_same @a, @a.nonzero?
    assert_nil NumericWithSomeMethods.new(0).nonzero?
    one = NumericWithSomeMethods.new(1)
    minus_one = NumericWithSomeMethods.new(1)

    assert_same one, one.nonzero?
    assert_same minus_one, minus_one.nonzero?
  end

  def test_quo
    assert_raises(NoMethodError) { @a.quo @b }
  end

  def test_remainder_should_raise_if_self_doesnt_implement_modulo
    assert_raises(NoMethodError) { @a.remainder(@b) }
  end

  def test_remainder_should_return_modulo_if_self_and_arg_have_the_same_sign_and_modulo_minus_arg_otherwise_except_when_modulo_is_zero
    # Float doesn't override Numeric#remainder, so that's what we are testng here
    assert_equal 2.0, 5.0.remainder(3)
    assert_equal 2.0, 5.0.remainder(-3)

    assert_equal -2.0, -5.0.remainder(-3)
    assert_equal -2.0, -5.0.remainder(3)

    # special case, was a bug
    assert_equal 0.0, 4.0.remainder(2)
    assert_equal 0.0, 4.0.remainder(-2)
    assert_equal 0.0, -4.0.remainder(2)
    assert_equal 0.0, -4.0.remainder(-2)
  end

  def test_round_should_delegate_to_self_to_f
    assert_equal 123, NumericWithSomeMethods.new(123.49).round
    assert_equal 124, NumericWithSomeMethods.new(123.51).round
    assert_equal -123, NumericWithSomeMethods.new(-123.49).round
    assert_equal -124, NumericWithSomeMethods.new(-123.51).round
  end

  def test_round_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.round }
  end

  def test_step
    # Fixnum doesn't override Numeric#step()

    # ends exactly at :to
    a = []
    1.step(5, 2) { |x| a << x }
    assert_equal [1, 3, 5], a

    # ends before :to
    a = []
    1.step(4, 2) { |x| a << x }
    assert_equal [1, 3], a

    # step is too big
    a = []
    1.step(4, 10) { |x| a << x }
    assert_equal [1], a

    # step is zero
    assert_raises(ArgumentError) { 1.step(1, 0) }

    # same to and from
    a = []
    1.step(1, 1) { |x| a << x }
    assert_equal [1], a

    # from less than to, positive step value
    a = []
    1.step(0, 1) { |x| a << x }
    assert_equal [], a

    # from less than to, negative step value
    a = []
    1.step(0, 1) { |x| a << x }
    assert_equal [], a

    # default step value of 1
    a = []
    1.step(3) { |x| a << x }
    assert_equal [1, 2, 3], a

  end

  def test_step_should_raise_if_step_is_zero

  end

  def test_to_int_should_call_to_i_or_raise_if_to_i_is_not_implemented
    assert_equal 123, NumericWithSomeMethods.new(123).to_int
    assert_raises(NoMethodError) { @a.to_int }
  end

  def test_truncate_should_delegate_to_self_to_f
    assert_equal 123, NumericWithSomeMethods.new(123.49).truncate
    assert_equal 123, NumericWithSomeMethods.new(123.51).truncate
    assert_equal -123, NumericWithSomeMethods.new(-123.49).truncate
    assert_equal -123, NumericWithSomeMethods.new(-123.51).truncate
  end

  def test_truncate_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.truncate }
  end

  def test_zero_should_check_equality
    assert_equal false, @a.zero?
    assert_equal true, NumericWithSomeMethods.new(0).zero?
    assert_equal false, NumericWithSomeMethods.new(1).zero?
    assert_equal false, NumericWithSomeMethods.new(-1).zero?
  end

end
require 'test/unit'

class TestNumeric < Test::Unit::TestCase

  class NumericWithSomeMethods < Numeric
    def initialize(value = 0)
      @value = value
    end

    def expect(arg)
      @expected_arg = arg
    end

    def check(arg)
      raise "Expected #{@expected_arg.inspect}, but received #{arg.inspect}" unless @expected_arg == arg
    end

    def /(arg) check(arg); 543.21 end
    def %(arg) check(arg); 89 end
    def to_f() @value.to_f end
    def <=>(other) @value <=> other end
    def <(other) @value < other end
    def >(other) @value > other end
    def eql?(other) @value.eql?(other) end
    def to_i() @value.to_i end
  end

  def setup
    @a = Numeric.new
    @b = Numeric.new
  end

  def test_unary_plus
    assert_same @a, +@a
  end

  def test_unary_minus_should_raise_if_self_cannot_be_coerced_to_float
    assert_raises(TypeError) { -@a }
  end

  def test_unary_minus_should_coerce_to_float_and_negate_result
    assert_equal 123.45, NumericWithSomeMethods.new(123.45).to_f
    assert_equal -123.45, -NumericWithSomeMethods.new(123.45)
  end

  def test_spaceship_should_return_zero_when_comparting_with_self_and_nil_otherwise
    assert_equal 0, @a <=> @a

    assert_nil @a <=> @b
    assert_nil @a <=> 1
    assert_nil @a <=> ""
    assert_nil @a <=> nil
  end

  def test_abs_should_return_self_if_bigger_than_zero_and_result_of_unitary_minus_on_self_otherwise
    assert_raises(ArgumentError) { @a.abs }

    positive = NumericWithSomeMethods.new(1).abs
    assert positive > 0
    assert_same positive, positive.abs

    negative = NumericWithSomeMethods.new(-2)
    assert negative < 0
    # unitary minus operator effectively returns -(self.to_f)
    assert_equal 2.0, negative.abs
    assert_equal Float, negative.abs.class
  end

  # ceil
  def test_ceil_should_delegate_to_self_to_f
    assert_equal 124, NumericWithSomeMethods.new(123.49).ceil
    assert_equal -123, NumericWithSomeMethods.new(-123.51).ceil
  end

  def test_ceil_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.ceil }
  end

  def test_coerce_should_copy_argument_and_self_if_both_have_the_same_type
    assert_equal [@b, @a], @a.coerce(@b)
    assert_equal [0.9, 0.1], 0.1.coerce(0.9)
    assert_equal [0, 1], 1.coerce(0)
  end

  def test_coerce_should_call_float_on_self_and_arg_if_they_are_of_different_type
    bignum = 100000000000000000000000
    assert bignum.is_a?(Bignum)
    assert_equal [Float(bignum), 0.0], 0.0.coerce(bignum)
    assert 0.0.coerce(bignum).first.is_a?(Float)
    assert 0.0.coerce(bignum).last.is_a?(Float)

    n = NumericWithSomeMethods.new(123.45)
    assert_equal [1.0, 123.45], n.coerce(1.0)
  end

  def test_coerce_should_blow_up_if_self_or_arg_cannot_be_converted_to_float_by_kernel_Float
    assert_raises(TypeError) { @a.coerce(1.0) }
    assert_raises(ArgumentError) { 1.coerce("test") }
    assert_raises(TypeError) { 1.coerce(nil) }
    assert_raises(TypeError) { 1.coerce(false) }
  end

  def test_div_should_raise_if_self_doesnt_implement_divison_operator
    assert_raises(NoMethodError) { @a.div(@b) }
  end

  def test_div_should_call_division_method_and_floor_it
    n = NumericWithSomeMethods.new

    # n / anything returns 543.21
    n.expect(:foo)
    assert_equal 543.21, n / :foo
    n.expect(@a)
    assert_equal 543, n.div(@a)
  end

  def test_divmod_should_return_result_of_div_and_mod_as_array
    n = NumericWithSomeMethods.new
    n.expect(:foo)
    # n.div(anything) returns 543, n % anything returns 89
    assert_equal [543, 89], n.divmod(:foo)
  end

  def test_divmod_should_raise_when_self_doesnt_implement_div_or_mod
    assert_raises(NoMethodError) { @a.divmod(@b) }
  end

  def test_eql
    assert_equal true, @a.eql?(@a)
    assert_equal false, @a.eql?(@b)
  end

  def test_floor_should_delegate_to_self_to_f
    assert_equal 123, NumericWithSomeMethods.new(123.51).floor
    assert_equal -124, NumericWithSomeMethods.new(-123.49).floor
  end

  def test_floor_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.floor }
  end

  def test_initialize_copy_should_raise
    assert_raises(TypeError) { @a.instance_eval("initialize_copy(:foo)") }
  end

  def test_initialize_copy_should_be_private
    assert @a.private_methods.include?("initialize_copy")
    assert_equal false, @a.methods.include?("initialize_copy")
  end

  def test_integer
    assert_equal false, @a.integer?
  end

  def test_modulo_should_raise_if_self_doesnt_have_percent_operator
    assert_raises(NoMethodError) { @a.modulo(@b) }
  end

  def test_modulo_should_call_percent_operator
    n = NumericWithSomeMethods.new
    n.expect(:foo)
    # n % anything returns 89
    assert_equal 89, n.modulo(:foo)
  end

  def test_nonzero_should_check_equality_and_returns_self_or_nil
    assert_same @a, @a.nonzero?
    assert_nil NumericWithSomeMethods.new(0).nonzero?
    one = NumericWithSomeMethods.new(1)
    minus_one = NumericWithSomeMethods.new(1)

    assert_same one, one.nonzero?
    assert_same minus_one, minus_one.nonzero?
  end

  def test_quo
    assert_raises(NoMethodError) { @a.quo @b }
  end

  def test_remainder_should_raise_if_self_doesnt_implement_modulo
    assert_raises(NoMethodError) { @a.remainder(@b) }
  end

  def test_remainder_should_return_modulo_if_self_and_arg_have_the_same_sign_and_modulo_minus_arg_otherwise_except_when_modulo_is_zero
    # Float doesn't override Numeric#remainder, so that's what we are testng here
    assert_equal 2.0, 5.0.remainder(3)
    assert_equal 2.0, 5.0.remainder(-3)

    assert_equal -2.0, -5.0.remainder(-3)
    assert_equal -2.0, -5.0.remainder(3)

    # special case, was a bug
    assert_equal 0.0, 4.0.remainder(2)
    assert_equal 0.0, 4.0.remainder(-2)
    assert_equal 0.0, -4.0.remainder(2)
    assert_equal 0.0, -4.0.remainder(-2)
  end

  def test_round_should_delegate_to_self_to_f
    assert_equal 123, NumericWithSomeMethods.new(123.49).round
    assert_equal 124, NumericWithSomeMethods.new(123.51).round
    assert_equal -123, NumericWithSomeMethods.new(-123.49).round
    assert_equal -124, NumericWithSomeMethods.new(-123.51).round
  end

  def test_round_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.round }
  end

  def test_step
    # Fixnum doesn't override Numeric#step()

    # ends exactly at :to
    a = []
    1.step(5, 2) { |x| a << x }
    assert_equal [1, 3, 5], a

    # ends before :to
    a = []
    1.step(4, 2) { |x| a << x }
    assert_equal [1, 3], a

    # step is too big
    a = []
    1.step(4, 10) { |x| a << x }
    assert_equal [1], a

    # step is zero
    assert_raises(ArgumentError) { 1.step(1, 0) }

    # same to and from
    a = []
    1.step(1, 1) { |x| a << x }
    assert_equal [1], a

    # from less than to, positive step value
    a = []
    1.step(0, 1) { |x| a << x }
    assert_equal [], a

    # from less than to, negative step value
    a = []
    1.step(0, 1) { |x| a << x }
    assert_equal [], a

    # default step value of 1
    a = []
    1.step(3) { |x| a << x }
    assert_equal [1, 2, 3], a

  end

  def test_step_should_raise_if_step_is_zero

  end

  def test_to_int_should_call_to_i_or_raise_if_to_i_is_not_implemented
    assert_equal 123, NumericWithSomeMethods.new(123).to_int
    assert_raises(NoMethodError) { @a.to_int }
  end

  def test_truncate_should_delegate_to_self_to_f
    assert_equal 123, NumericWithSomeMethods.new(123.49).truncate
    assert_equal 123, NumericWithSomeMethods.new(123.51).truncate
    assert_equal -123, NumericWithSomeMethods.new(-123.49).truncate
    assert_equal -123, NumericWithSomeMethods.new(-123.51).truncate
  end

  def test_truncate_should_raise_if_self_doesnt_implement_to_f
    assert_raises(TypeError) { @a.truncate }
  end

  def test_zero_should_check_equality
    assert_equal false, @a.zero?
    assert_equal true, NumericWithSomeMethods.new(0).zero?
    assert_equal false, NumericWithSomeMethods.new(1).zero?
    assert_equal false, NumericWithSomeMethods.new(-1).zero?
  end

end


text:
let assert = require('assert');
let EventHelper = require('../index');

describe('#method: bindForAll', () => {

    it('#bindForAll(handler) will bind handler for event "__all__"', () => {
        let emmiter = new EventHelper();
        let handler = () => console.log('bindForAll');
        emmiter.bindForAll(handler);
        assert.equal(emmiter._eventEmitter['__all__'].length, 1);
        assert.equal(emmiter._eventEmitter['__all__'][0], handler);
    });

    it('#unbindForAll(handler) will unbind handler for event "__all__"', () => {
        let emmiter = new EventHelper();
        let handler1 = () => console.log('bindForAll');
        let handler2 = () => console.log('bindForAll');
        emmiter.bindForAll(handler1);
        emmiter.bindForAll(handler2);
        assert.equal(emmiter._eventEmitter['__all__'].length, 2);
        assert.equal(emmiter._eventEmitter['__all__'][0], handler1);
        assert.equal(emmiter._eventEmitter['__all__'][1], handler2);
        emmiter.unbindForAll(handler1);
        assert.equal(emmiter._eventEmitter['__all__'].length, 1);
        assert.equal(emmiter._eventEmitter['__all__'][0], handler2);
        emmiter.bindForAll(handler1);
        assert.equal(emmiter._eventEmitter['__all__'].length, 2);
        emmiter.unbindForAll();
        assert.equal(emmiter._eventEmitter['__all__'].length, 0);
    });
});


text:
@interface DOSTripStatsTableViewController ()

@property (nonatomic, strong) NSArray *travelStatTitles;
@property (nonatomic, strong) DOSSecretaryTravelStatsItem *travelStats;

@end

@implementation DOSTripStatsTableViewController

- (void)awakeFromNib
{
    self.title = @"Travel Stats";
    self.navigationItem.title = @"Secretary Kerry's Travel Stats";
    self.tableView.allowsSelection = NO;
    self.travelStatTitles = [NSArray arrayWithObjects:@"HOURS IN FLIGHT",@"MILES FLOWN",@"COUNTRIES VISITED",@"DAYS TRAVELED", nil];

    // Load the background for the tableview
    UIImage *backgroundImage = [UIImage imageNamed:@"CloudBackground"];
    UIImageView *backgroundView = [[UIImageView alloc] initWithImage:backgroundImage];
    self.tableView.backgroundView = backgroundView;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self loadTripStats];
}

- (void)loadTripStats
{
    // Load cached data from disk
    [self loadStatsFromPlist];

    DOSSecretaryTravelDataManager *dataMan = [[DOSSecretaryTravelDataManager alloc] init];
    [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
    [dataMan getSecretaryTravelStatsWithSuccess:^(NSArray *response) {

        if (response[0]) {
            self.travelStats = response[0];
        }

        [self.tableView reloadData];
        [self saveStatsToPlist];
        [MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];

    } failure:^(NSError *error) {
        NSLog(@"API Query failed: %@",error);
        [MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Network Error" message:@"Unable to connect to www.state.gov" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];

        // Reload table to show data saved from plist
        [self.tableView reloadData];
    }];
}

-(void)saveStatsToPlist
{
    // Convert stats object to NSDictionary
    NSMutableDictionary *statsDict = [[NSMutableDictionary alloc] init];
    [statsDict setObject:self.travelStats.flightTimeHours forKey:@"flightTimeHours"];
    [statsDict setObject:self.travelStats.milage forKey:@"milage"];
    [statsDict setObject:self.travelStats.countriesVisited forKey:@"countriesVisited"];
    [statsDict setObject:self.travelStats.travelDays forKey:@"travelDays"];

    // Save to disk
    NSString *statsPath = [self getSavedStatsPath];
    [statsDict writeToFile:statsPath atomically:YES];
}

-(void)loadStatsFromPlist
{
    // Save to disk
    NSString *statsPath = [self getSavedStatsPath];
    NSFileManager *manager = [NSFileManager defaultManager];
    BOOL isExist = [manager fileExistsAtPath:statsPath];

    if (isExist) {
        NSDictionary *statsDict = [NSDictionary dictionaryWithContentsOfFile:statsPath];

        DOSSecretaryTravelStatsItem *stats = [[DOSSecretaryTravelStatsItem alloc] init];
        stats.flightTimeHours = [statsDict objectForKey:@"flightTimeHours"];
        stats.milage = [statsDict objectForKey:@"milage"];
        stats.countriesVisited = [statsDict objectForKey:@"countriesVisited"];
        stats.travelDays = [statsDict objectForKey:@"travelDays"];
        self.travelStats = stats;
        [self.tableView reloadData];
    }
}

-(NSString *)getSavedStatsPath
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir = [paths objectAtIndex:0];
    NSString *documentDirPath = [documentsDir
                                 stringByAppendingPathComponent:@"TravelStats.plist"];
    return documentDirPath;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.travelStatTitles.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"TripStatCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier];
    }

    NSNumberFormatter *hrsFormatter = [[NSNumberFormatter alloc] init];
    [hrsFormatter setMaximumFractionDigits:0];
    [hrsFormatter setRoundingMode:NSNumberFormatterRoundHalfUp];
    [hrsFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
    [hrsFormatter setNumberStyle: NSNumberFormatterDecimalStyle];

    NSNumberFormatter* milageFormatter = [[NSNumberFormatter alloc] init];
    [milageFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
    [milageFormatter setNumberStyle: NSNumberFormatterDecimalStyle];

    UILabel *statValue = (UILabel *)[cell viewWithTag:100];
    UILabel *statTitle = (UILabel *)[cell viewWithTag:101];

    statTitle.text = self.travelStatTitles[indexPath.row];

    if (self.travelStats) {
        switch (indexPath.row) {
            case 0:
                statValue.text = [hrsFormatter stringFromNumber:self.travelStats.flightTimeHours];
                break;
            case 1:
                statValue.text = [milageFormatter stringFromNumber:self.travelStats.milage];
                break;
            case 2:
                statValue.text = [self.travelStats.countriesVisited stringValue];
                break;
            case 3:
                statValue.text = [self.travelStats.travelDays stringValue];
                break;
        }
    }

    return cell;
}

@end


text:
mkdir -p temp
doxygen source.dox
cd temp
xsltproc combine.xslt index.xml > all.xml
xsltproc ../reference.xsl all.xml > ../reference.qbk


text:
namespace Bee
{

struct CreatePositionData
{
	inline CreatePositionData(
		std::vector<PiecePosition>&& pieces,
		Players player_to_move,
		Castle white_castling_options,
		Castle black_castling_options,
		boost::optional<uint32_t> capture_en_passant_column,
		uint16_t fullmove_number,
		uint16_t halfmove_clock)
		:
		m_pieces(pieces),
		m_player_to_move(player_to_move),
		m_white_castling_options(white_castling_options),
		m_black_castling_options(m_black_castling_options),
		m_capture_en_passant_column(capture_en_passant_column),
		m_fullmove_number(fullmove_number),
		m_halfmove_clock(halfmove_clock)
	{
		assert(!capture_en_passant_column.is_initialized()
			|| capture_en_passant_column.value() < 8);
	}

	const std::vector<PiecePosition> m_pieces;
	const Players m_player_to_move;
	const Castle m_white_castling_options;
	const Castle m_black_castling_options;
	const boost::optional<int> m_capture_en_passant_column;
	const uint16_t m_fullmove_number;
	const uint16_t m_halfmove_clock;
};

}


text:
package com.xlg.forkids.polymerization;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ListView;

import com.google.gson.reflect.TypeToken;
import com.xlg.android_support_tools.view.RecyclingImageView;
import com.xlg.forkids.R;
import com.xlg.forkids.activities.OnTitleButtonClick;
import com.xlg.forkids.basefragments.BaseRefreshableFragment;
import com.xlg.forkids.baseitems.BasePolyItem;
import com.xlg.forkids.baseitems.BaseTextWatcher;
import com.xlg.forkids.baseitems.BaseTextWatcher.OnTextChangedListener;
import com.xlg.forkids.chat.holder.GroupItemHolder;
import com.xlg.forkids.db.helpers.PolyDbHelper;
import com.xlg.forkids.favorites.NewsListerFragment;
import com.xlg.forkids.interfaces.News;
import com.xlg.forkids.network.AsyncedTask;
import com.xlg.view.Utils;

/** Ñ¡ÔñÌí¼ÓÎÒµÄ¾ÛºÏ */
public class ChooseNewFragment extends BaseRefreshableFragment {

	private static final String REFRESHABLE_TAG = "_poly_list_";
	private static final String GROUP_CODE = "group_code";
	private ListView mListView;
	private PolyAdapter mAdapter;
	private View mLoading;
	// ËÑË÷¿ò
	private View mSearchContainer;
	private EditText mSearchText;
	private String mSearchingText = "";
	private RecyclingImageView mSearchClear;

	/** µ±Ç°¼ÓÔØÏÔʾµÄÁбí */
	/** Áбí */
	private List<BasePolyItem> mGroupList = new ArrayList<BasePolyItem>();
	private static final String HOT_GROUPS = "hot";
	private String selectedGroup = HOT_GROUPS;
	private int mSearchedColor;

	/** ËÑË÷¿òÎı¾¸Ä±ä'þ´¦Àí¹ý³Ì */
	private BaseTextWatcher mBaseSearchWatcher = new BaseTextWatcher();

	public static ChooseNewFragment newInstance(String code) {
		ChooseNewFragment cnf = new ChooseNewFragment();
		Bundle b = new Bundle();
		b.putString(GROUP_CODE, code);
		cnf.setArguments(b);
		return cnf;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Bundle b = getArguments();
		if (null != b) {
			selectedGroup = b.getString(GROUP_CODE);
			selectedGroup = isEmpty(selectedGroup) ? HOT_GROUPS : selectedGroup;
		}
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		setLayout(R.layout.polymerization_add_list);
		View v = super.onCreateView(inflater, container, savedInstanceState);
		mListView = (ListView) v.findViewById(R.id.polymerization_add_listview);
		mListView.setOnItemClickListener(mOnItemClickListener);
		mLoading = v.findViewById(R.id.base_loading_view);

		mBaseSearchWatcher.setOnTextChangedListener(mOnTextChangedListener);
		mSearchContainer = v.findViewById(R.id.base_search_container);
		mSearchContainer
				.setVisibility(selectedGroup.equals(HOT_GROUPS) ? View.GONE
						: View.VISIBLE);
		mSearchText = (EditText) v.findViewById(R.id.base_search_input_box);
		mSearchText.setHint(R.string.polymerization_search_hint);
		mSearchText.addTextChangedListener(mBaseSearchWatcher);
		mSearchClear = (RecyclingImageView) v
				.findViewById(R.id.base_serach_clear_button);
		mSearchClear.setOnClickListener(mOnClickListener);

		getActivity().setResult(Activity.RESULT_OK);
		return v;
	}

	private OnItemClickListener mOnItemClickListener = new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position,
				long id) {
			BasePolyItem item = mGroupList.get(position);
			if (selectedGroup.equals(HOT_GROUPS)) {
				// Èç¹ûÊÇ´ò¿ªµÄ·Ö×éÁбíÔòÔٵȴý´ò¿ªÏ¼¶×éÁбí
				startContainerActivity(ChooseNewFragment.class.getName(),
						item.getCode());
			} else {
				startContainerActivity(NewsListerFragment.class.getName(),
						String.valueOf(item.getId()));
			}
		}
	};

	private OnClickListener mOnClickListener = new OnClickListener() {

		@Override
		public void onClick(View v) {
			if (v == mSearchClear) {
				mSearchText.setText(null);
			}
		}
	};

	private OnTextChangedListener mOnTextChangedListener = new OnTextChangedListener() {

		@Override
		public void onTextChanged(CharSequence s) {
			hidingInputBoard(mSearchText);
			mSearchingText = s.toString();
			if (null == mSearchingText || mSearchingText.equals("")) {
				mSearchingText = "";
				mSearchClear.setVisibility(View.GONE);
			} else
				mSearchClear.setVisibility(View.VISIBLE);

			new GetPoliesFromDb().exec();
		}
	};

	@Override
	public void onResume() {
		super.onResume();
		baseTitleActivity.showTopTitleBar(true);
		baseTitleActivity.setRightText(0);
		baseTitleActivity.setCustomeTitle(R.string.polymerization_add_title);
		baseTitleActivity.showContentUnderTitleBar(true);
		mSearchedColor = getResources().getColor(R.color.color_d75f5f);
		setClickEvent();
		mLoading.setVisibility(View.VISIBLE);

		if (needRefresh(REFRESHABLE_TAG)) {
			// ´Ó·þÎñÆ÷ÉÏ»ñÈ¡×îеÄÁбí
			new GetPoliesFromServer().exec();
		} else {
			new GetPoliesFromDb().exec();
		}
	}

	private class GetPoliesFromDb extends AsyncedTask<Void, Void, Void> {

		private List<BasePolyItem> tmp;
		private BasePolyItem item = null;

		@Override
		protected Void doInBackground(Void... params) {
			// TODO »ñÈ¡±¾µØDB»º´æÖеľۺÏÁбí
			tmp = selectedGroup.equals(HOT_GROUPS) ? PolyDbHelper.getInstance(
					mContext).get() : PolyDbHelper.getInstance(mContext).get(
					selectedGroup, mSearchingText);
			if (!selectedGroup.equals(HOT_GROUPS)) {
				item = PolyDbHelper.getInstance(mContext).get(selectedGroup,
						false);
			}
			return null;
		}

		@Override
		protected void onPostExecute(Void result) {
			if (null != item) {
				baseTitleActivity.setCustomeTitle(item.getName());
			}
			mGroupList.clear();
			if (tmp.size() < 1) {
				// ´Ó·þÎñÆ÷ÉÏ»ñÈ¡×îеÄÁбí
				new GetPoliesFromServer().exec();
			} else {
				mGroupList.addAll(tmp);
				mAdapter = new PolyAdapter();
				mListView.setAdapter(mAdapter);
				mLoading.setVisibility(View.GONE);
			}
			tmp.clear();
			tmp = null;
			item = null;
			super.onPostExecute(result);
		}
	}

	private class GetPoliesFromServer extends AsyncedTask<Void, Void, Void> {

		@Override
		protected Void doInBackground(Void... params) {
			// TODO »ñÈ¡·þÎñÆ÷ÉϵľۺÏƵµÀÁбí
			String url = getAPIServer() + News.AllChannel(mMe.getCode());
			String json = getJsonState(getRemoteJson(url));
			if (!Utils.isEmpty(json)) {
				List<BasePolyItem> tmp = mGson.fromJson(json,
						new TypeToken<List<BasePolyItem>>() {
						}.getType());
				if (null != tmp && tmp.size() > 0) {
					PolyDbHelper.getInstance(mContext).insert(tmp);
				}
			}
			return null;
		}

		@Override
		protected void onPostExecute(Void result) {
			updateRefreshTime(REFRESHABLE_TAG, (new Date()).getTime());
			new GetPoliesFromDb().exec();
			super.onPostExecute(result);
		}
	}

	private void setClickEvent() {
		baseTitleActivity.onRightButtonClick(new OnTitleButtonClick() {

			@Override
			public void onClick(View v) {
			}
		});
	}

	private class PolyAdapter extends BaseAdapter {

		@Override
		public boolean hasStableIds() {
			return false;
		}

		@Override
		public int getCount() {
			return mGroupList.size();
		}

		@Override
		public Object getItem(int position) {
			return mGroupList.get(position);
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			GroupItemHolder holder;
			if (null == convertView) {
				convertView = View.inflate(mContext, R.layout.chat_group_item,
						null);
				holder = new GroupItemHolder(getActivity(), convertView);
				convertView.setTag(holder);
			} else {
				holder = (GroupItemHolder) convertView.getTag();
			}

			BasePolyItem item = mGroupList.get(position);
			holder.showContent(item, selectedGroup.equals(HOT_GROUPS));
			Spanned spanned = Html.fromHtml(addColor(item.getName(),
					mSearchingText, mSearchedColor));
			holder.Name.setText(spanned);
			return convertView;
		}
	}
}


text:
define(function (require) {
  var Collection = require('streamhub-sdk/collection');
  var View = require('streamhub-wall');
  var $ = require('streamhub-sdk/jquery');

  return function (el) {
    var collection = new Collection({
      network: 'labs.fyre.co',
      environment: 'livefyre.com',
      siteId: '315833',
      articleId: 'livefyre-tweets'
    });
    var view = new View({el: el});

    collection.pipe(view);

        // As streamhub-wall#3 now inserts its own css, when this is run
        // on the app gallery we need to remove the sdk 2.7 css.
        // this is a weird hack. Sorry.
    $(function ($) {
      $('link[href*="sdk.min.css"]').remove();
    });

    return view;
  };
});


text:
package io.gravitee.rest.api.model;

import java.util.Objects;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public class ResourceListItem {

    /**
     * The resource identifier
     */
    private String id;

    /**
     * The resource name
     */
    private String name;

    /**
     * The resource description
     */
    private String description;

    /**
     * The resource version
     */
    private String version;

    private String schema;

    private String icon;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getSchema() {
        return schema;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("ResourceListItem{");
        sb.append("id='").append(id).append('\'');
        sb.append(", name='").append(name).append('\'');
        sb.append(", version='").append(version).append('\'');
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ResourceListItem that = (ResourceListItem) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}


text:
import { Vector3 } from './Vector3';
import { Matrix4 } from './Matrix4';

export class Line3 {
    constructor(start?: Vector3, end?: Vector3);

    /**
     * @default new THREE.Vector3()
     */
    start: Vector3;

    /**
     * @default new THREE.Vector3()
     */
    end: Vector3;

    set(start?: Vector3, end?: Vector3): Line3;
    clone(): this;
    copy(line: Line3): this;
    getCenter(target: Vector3): Vector3;
    delta(target: Vector3): Vector3;
    distanceSq(): number;
    distance(): number;
    at(t: number, target: Vector3): Vector3;
    closestPointToPointParameter(point: Vector3, clampToLine?: boolean): number;
    closestPointToPoint(point: Vector3, clampToLine: boolean, target: Vector3): Vector3;
    applyMatrix4(matrix: Matrix4): Line3;
    equals(line: Line3): boolean;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Grevillea 20(no. 94): 36 (1891)

#### Original name
Coryneum viminale Cooke & Massee

### Remarks
null


text:
require 'redmine'

Rails.configuration.to_prepare do
  require_dependency 'user'
  User.send(:include, RedmineLeaves::Patches::UserPatch)

  require_dependency 'redmine/helpers/calendar'
  Redmine::Helpers::Calendar.send(:include, RedmineLeaves::Patches::LeavesInCalendarPatch)

  require_dependency 'time_entry'
  TimeEntry.send(:include, RedmineLeaves::Patches::TimeRestrictionPatch)
end

require 'wice_grid_config'

Redmine::Plugin.register :redmine_leaves do
  name 'Redmine Leaves Plugin'
  author 'Arkhitech'
  description 'This is a plugin for user check-in/check-out'
  url 'http://github.com/arkhitech/redmine_leaves'
  author_url 'https://github.com/arkhitech'
  version '0.1.0'

  permission :receive_timesheet_email, { }, require: :member

  permission :view_time_reports, user_time_check: :user_time_reporting

  menu :top_menu, :time_check_in, { controller: 'user_time_checks', action: 'check_in' },
    caption: :caption_top_menu_check_in, if: Proc.new {!UserTimeCheck.checked_in?(User.current.id)}, last: true
    menu :top_menu, :time_check_out, { controller: 'user_time_checks', action: 'check_out' },
      caption: :caption_top_menu_check_out, if: Proc.new {UserTimeCheck.checked_in?(User.current.id)}, last: true

      menu :top_menu, :user_leave_reports, { controller: 'user_leave_reports', action: 'index' }, caption: :caption_leave_report

      menu :top_menu, :user_time_checks, { controller: 'user_time_checks', action: 'index' }, caption: :caption_user_time_check

      menu :top_menu, :user_time_reporting, { controller: 'user_time_checks', action: 'user_time_reporting' }, :caption => 'User Time Reports'
      menu :user_time_report_menu, :user_time_report_custom, { :controller => 'user_time_checks', :action => 'user_time_reporting'}, :caption => 'Custom'
      menu :user_time_report_menu, :user_time_report_weekly, { :controller => 'user_time_checks', :action => 'user_time_reporting_weekly'}, :caption => 'Weekly'
      menu :user_time_report_menu, :user_time_report_monthly, { :controller => 'user_time_checks', :action => 'user_time_reporting_monthly'}, :caption => 'Monthly'

      menu :top_menu, :user_time_activity_report, { controller: 'user_time_checks', action: 'user_time_activity_report' }, :caption => 'User Time-Activity Report'
          menu :user_time_analytics_menu, :user_time_activity_report_custom, { :controller => 'user_time_checks', :action => 'user_time_activity_report'}, :caption => 'All Time'
      menu :user_time_analytics_menu, :user_time_activity_report_monthly, { :controller => 'user_time_checks', :action => 'user_time_activity_report_monthly'}, :caption => 'Monthly'
#

      menu :leave_report_menu, :user_leave_reports, { :controller => 'user_leave_reports', :action => 'index' }, :caption => 'Overview'
      menu :leave_report_menu, :user_leaves, { :controller => 'user_leaves', :action => 'new' }, :caption => 'Add Leave'
      menu :leave_report_menu, :user_leave_analytics, { :controller => 'user_leave_analytics', :action => 'report'}, :caption => 'Analytics'

      settings default: {
        'leave_types' => 'Annual, Sick, Unannounced',
        'default_type' => 'Annual',
        'time_loggers_group' => 'Staff',
        'time_log_receivers_group' => 'HR',
        'num_min_working_hours' => '8',
        'max_past_timelog_insert_days' => '7'
      }, partial: 'settings'
    end


text:
var tape = require('tape'),
	weblas = require('../index'),
	loader = require('arrayloader'); // browserify aware file loader (xhr in browser)

weblas.test = require('../lib/test');

/*  run in a browser with testling

		browserify test/*.js | testling -x google-chrome

	on Ubuntu, requires

		sudo apt-get install xvfb
 */

var RTOL = 1e-05,
	ATOL = 1e-12;

var dataDirectory = 'test/data/sgemm/',
	testFile = 'small.json';

var gl = weblas.gpu.gl;

if(window)
	console.log("# User Agent: " + window.navigator.userAgent);

var debugInfo = weblas.gpu.gl.context.getExtension('WEBGL_debug_renderer_info');
if(debugInfo)
	console.log("# Renderer:              \t" + gl.context.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL));

console.log("# OES_float_texture support: \t" + (gl.hasFloat ? "YES" : "NO"));
console.log("# MAX_TEXTURE_SIZE:      \t" + gl.context.getParameter(gl.context.MAX_TEXTURE_SIZE));
console.log("# MAX_RENDERBUFFER_SIZE: \t" + gl.context.getParameter(gl.context.MAX_RENDERBUFFER_SIZE));
console.log("# highp support:         \t" + (gl.hasHighPrecision ? "YES" : "NO"));
console.log("# highp.precision:       \t" + JSON.stringify(gl.highp.precision));

var matrixFiles = ['a.f32', 'b.f32', 'out.f32'];

function generateTestCase(prefix, m, n, k, alpha){
	return function(t){
		t.plan(1);

		var A, B, expected; // typed arrays

		// directory containing matrix data files for current test
		var testDirectory = dataDirectory + prefix + '/';

		// load matrices from files
		weblas.test.load(testDirectory, matrixFiles, function(err, matrices){

			// matrices is an array which matches matrixFiles
			var A = matrices[0],
				B = matrices[1],
				expected = matrices[2];

			if(!(A && A.length && A.length == m * k &&
				B && B.length && B.length == k * n &&
				expected && expected.length && expected.length == m * n)){

				throw new Error("malformed data");
			}

			var beta = 0.0;

			//console.log(m + "x" + k + " times " + k + "x" + n);

			try{
				result = weblas.sgemm(m, n, k, alpha, A, B, beta, null);
			}
			catch(ex){
				t.assert(false, ex);
				return;
			}

			weblas.test.assert.allclose(t, result, expected, null, RTOL, ATOL);
		});
	};
}

var extendedMatrixFiles = ['a.f32', 'b.f32', 'c.f32', 'out.f32'];

function generateExtendedTestCase(prefix, m, n, k, alpha, beta, transposed){
	return function(t){
		t.plan(1);

		var A, B, C, expected; // typed arrays

		// directory containing matrix data files for current test
		var testDirectory = dataDirectory + prefix + '/';

		// load matrices from files
		weblas.test.load(testDirectory, extendedMatrixFiles, function(err, matrices){

			// matrices is an array which matches matrixFiles
			var A = matrices[0],
				B = matrices[1],
				C = matrices[2],
				expected = matrices[3];

			if(!(A && A.length && A.length == m * k &&
				B && B.length && B.length == k * n &&
				expected && expected.length && expected.length == m * n)){

				throw new Error("malformed data");
			}

			if(transposed){
				B = weblas.util.transpose(n, k, B);
			}

			//console.log(m + "x" + k + " times " + k + "x" + n);

			try{
				result = weblas.sgemm(m, n, k, alpha, A, B, beta, C);
			}
			catch(ex){
				t.assert(false, ex);
				return;
			}

			weblas.test.assert.allclose(t, result, expected, null, RTOL, ATOL);
		});
	};
}

loader.load(dataDirectory + testFile, function(err, suite){

	// suite configuration file uses directory name as key
	for(var i = 0; i < suite.length; i++){

		directory = String("0000" + (i + 1)).slice(-4);

		var test = suite[i];

		var input = test['in'],
			arg = test['arg'] || {};

		// get base matrix dimensions
		var m1 = input[0]['shape'][0],
			n1 = input[0]['shape'][1],
			m2 = input[1]['shape'][0],
			n2 = input[1]['shape'][1];

		var m = m1,
			transposed;

		// is the second matrix already transposed?
		if(n1 === m2){
			transposed = false;
			k = m2;
			n = n2;
		} else if(n1 === n2){
			transposed = true;
			k = n2;
			n = m2;
		} else {
			throw new Error("Matrices not compatible");
		}

		var alpha = (arg['alpha'] != null) ? arg['alpha'] : 1.0,
			beta = (arg['beta'] != null) ? arg['beta'] : 1.0;

		var testName = "sgemm: " + m + "x" + k + " . " + k + "x" + n;
		if(input.length == 2){
			tape(testName, generateTestCase(directory, m, n, k, alpha, null, transposed));
		} else {
			testName += " + 1x" + n;
			tape(testName, generateExtendedTestCase(directory, m, n, k, alpha, beta, transposed));
		}
	}

});


text:
package com.xrtb.exchanges;

import java.io.InputStream;

import com.xrtb.pojo.BidRequest;

/**
 * A class to handle Mobile Ad Exchange SSPHwy ad exchange
 * @author Ben M. Faul
 *
 */

public class SSPHwy extends BidRequest {

        public SSPHwy() {
                super();
                parseSpecial();
        }

        /**
         * Make a SSPHwy bid request using a String.
         * @param in String. The JSON bid request for Epom
         * @throws Exception on JSON errors.
         */
        public SSPHwy(String  in) throws Exception  {
                super(in);
                parseSpecial();
    }

        /**
         * Make a SSPHwy bid request using an input stream.
         * @param in InputStream. The contents of a HTTP post.
         * @throws Exception on JSON errors.
         */
        public SSPHwy(InputStream in) throws Exception {
                super(in);
                parseSpecial();
        }

        /**
         * Process special Gotham stuff, sets the exchange name. Setss encoding.
         */
        @Override
        public boolean parseSpecial() {
                setExchange( "ssphwy" );
                usesEncodedAdm = false;
                return true;
        }

    	/**
    	 * Create a new SSPHwy object from this class instance.
    	 * @throws JsonProcessingException on parse errors.
    	 * @throws Exception on stream reading errors
    	 */
    	@Override
    	public SSPHwy copy(InputStream in) throws Exception  {
    		SSPHwy copy = new SSPHwy(in);
    		copy.usesEncodedAdm = usesEncodedAdm;
    		return copy;

    	}
}


text:
var geom = require('pex-geom');
var glu = require('pex-glu');
var materials = require('pex-materials');
var color = require('pex-color');

var Mesh = glu.Mesh;
var Geometry = geom.Geometry;
var SolidColor = materials.SolidColor;
var Color = color.Color;

function EdgeHelper(geometry, color) {
  color = color || Color.Yellow;

  if (!geometry.edges) {
    geometry.computeEdges();
  }

  var g = new Geometry({
    vertices: geometry.vertices.map(function(v) { return v; }),
    edges: geometry.edges.map(function(e) { return e; })
  });

  Mesh.call(this, g, new SolidColor({ color: color, pointSize: 10 }), { lines: true });
}

EdgeHelper.prototype = Object.create(Mesh.prototype);

module.exports = EdgeHelper;


text:
using System.Text;
using GraphQL.Types;

namespace GraphQL.Tests.Bugs;

// https://github.com/graphql-dotnet/graphql-dotnet/issues/956
public class Bug956 : QueryTestBase<Bug956Schema>
{
    [Fact]
    public void base64_should_Convert_to_binary()
    {
        var query = """{ get(base64: "R3JhcGhRTCE=") }""";
        AssertQuerySuccess(query, """{"get": "R3JhcGhRTCE="}""");
    }
}

public sealed class Bug956QueryType : ObjectGraphType
{
    public Bug956QueryType()
    {
        Field<StringGraphType>("get")
            .Argument<StringGraphType>("base64")
            .Resolve(ctx =>
            {
                var asString = ctx.GetArgument<string>("base64");
                asString.ShouldBe("R3JhcGhRTCE="); // GraphQL!

                var asList = ctx.GetArgument<List<byte>>("base64");
                asList.Count.ShouldBe(12);

                var asBinary = ctx.GetArgument<byte[]>("base64");
                Encoding.UTF8.GetString(asBinary).ShouldBe("GraphQL!");

                return asString;
            });
    }
}

public class Bug956Schema : Schema
{
    public Bug956Schema()
    {
        Query = new Bug956QueryType();
    }
}


text:
using System;
using NLog;
using ILogger = Lunchorder.Common.Interfaces.ILogger;

namespace Lunchorder.Api.Infrastructure.Services
{
    public class NLogLogger : ILogger
    {
        private readonly Logger logger;

        public NLogLogger(Type loggerType)
        {
            if (loggerType == null) throw new ArgumentNullException(nameof(loggerType));
            logger = LogManager.GetLogger(loggerType.FullName);
        }

        public void Debug(string message)
        {
            logger.Debug(message);
        }

        public void Trace(string message)
        {
            logger.Trace(message);
        }

        public void Info(string message)
        {
            logger.Info(message);
        }

        public void Warning(string message)
        {
            logger.Warn(message);
        }

        public void Error(string message)
        {
            logger.Error(message);
        }

        public void Error(string message, Exception exception)
        {
            Error(message, exception);
        }

        public void Fatal(string message)
        {
            logger.Fatal(message);
        }

        public void Fatal(string message, Exception exception)
        {
            logger.FatalException(message, exception);
        }
    }
}


text:
// Generated by xsd compiler for android/java
// DO NOT CHANGE!
package com.ebay.shopping.api;

import java.io.Serializable;
import com.leansoft.nano.annotation.*;
import java.util.List;

/**
 *
 * Specifies all feedback summary information (except Score). Contains
 * objects that each convey feedback counts for
 * positive, negative, neutral, and total feedback counts - for various
 * time periods each. Also conveys counts of bid retractions for the
 * predefined time periods.
 *
 */
public class FeedbackHistoryType implements Serializable {

    private static final long serialVersionUID = -1L;

	@Element(name = "BidRetractionFeedbackPeriods")
	@Order(value=0)
	public List<FeedbackPeriodType> bidRetractionFeedbackPeriods;

	@Element(name = "NegativeFeedbackPeriods")
	@Order(value=1)
	public List<FeedbackPeriodType> negativeFeedbackPeriods;

	@Element(name = "NeutralFeedbackPeriods")
	@Order(value=2)
	public List<FeedbackPeriodType> neutralFeedbackPeriods;

	@Element(name = "PositiveFeedbackPeriods")
	@Order(value=3)
	public List<FeedbackPeriodType> positiveFeedbackPeriods;

	@Element(name = "TotalFeedbackPeriods")
	@Order(value=4)
	public List<FeedbackPeriodType> totalFeedbackPeriods;

	@Element(name = "UniqueNegativeFeedbackCount")
	@Order(value=5)
	public Long uniqueNegativeFeedbackCount;

	@Element(name = "UniquePositiveFeedbackCount")
	@Order(value=6)
	public Long uniquePositiveFeedbackCount;

	@Element(name = "AverageRatingDetails")
	@Order(value=7)
	public List<AverageRatingDetailsType> averageRatingDetails;

	@Element(name = "NeutralCommentCountFromSuspendedUsers")
	@Order(value=8)
	public Long neutralCommentCountFromSuspendedUsers;

	@Element(name = "UniqueNeutralFeedbackCount")
	@Order(value=9)
	public Long uniqueNeutralFeedbackCount;

	@AnyElement
	@Order(value=10)
	public List<Object> any;

}


text:
<!doctype html>

		<meta charset="utf-8">
	  <meta http-equiv="X-UA-Compatible" content="IE=edge">
	  <meta name="viewport" content="width=device-width, initial-scale=1">

		<title>FeedFyre</title>

		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

    <link rel="stylesheet" href="css/font-awesome-4.7.0/css/font-awesome.min.css">

    <link href='https://fonts.googleapis.com/css?family=Vollkorn|Roboto+Condensed' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" href="css/main.css">
		<link rel="stylesheet" href="css/profile.css">
		<link rel="stylesheet" href="css/font-awesome-animation.min.css">

					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
						Toggle navigation

					</button>

						FeedFyre

View Profile

View Feed

Configure

Settings

Site Policy

Log out

											&nbsp&nbsp

Following

© 2017 Feed Me


text:
<?php

namespace TlAssetsBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('tl_assets');

        $rootNode->children()
                    ->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
                    ->booleanNode('live_compilation')->defaultValue(false)->end()
                    ->booleanNode('use_cache')->defaultValue(false)->end()

                    ->arrayNode('bundles')
                        ->prototype('scalar')->end()
                    ->end()

                    ->arrayNode('variables')
                        ->prototype('scalar')->end()
                    ->end()

                    ->arrayNode('filters')
                        ->children()
                            ->booleanNode('hash')->end()
                            ->booleanNode('minify')->end()
                            ->booleanNode('concat')->end()
                        ->end()
                    ->end()

                    ->arrayNode('config')
                        ->addDefaultsIfNotSet()
                        ->children()
                            ->booleanNode('web_folder')->defaultValue('%kernel.root_dir%/../web/')->end()
                            ->booleanNode('buffer_folder')->defaultValue('%kernel.cache_dir%/tlassets/buffer/')->end()
                            ->booleanNode('node_folder')->defaultValue('%kernel.root_dir%/../vendor/node_modules')->end()
                            ->booleanNode('public_folder')->defaultValue('/public')->end()
                        ->end()
                    ->end()

            ->end();

        return $treeBuilder;
    }
}


text:
    <title>Yahoo Emoticons</title>

Yahoo Emoticons
    93 emoji

     :angry:
     :anguished: or D:
     :bawling:
     :bee:
     :blush: or :3
     :bow:
     :bring_it:
     :chicken:
     :clap:
     :coffee:
     :confounded: or :s
     :confused: or :\
     :cow:
     :cowboy:
     :cry: or :'(
     :disappointed:
     :dizzy:
     :dog:
     :fearful:
     :flushed:
     :frowning:
     :get_outta_here:
     :giggle:
     :glasses: or 8-)
     :grimacing:
     :grin: or :D
     :hang_loose:
     :heart: or <3
     :heartbreak:
     :how_interesting:
     :hug:
     :hushed:
     :i_dunno:
     :innocent: or o:)
     :jack_o_lantern:
     :joker:
     :joy:
     :kiss:
     :liar:
     :lightbulb:
     :lol:
     :look_at_the_time:
     :loser:
     :lucky:
     :minus_one:
     :money:
     :monkey:
     :mrgreen:
     :murica:
     :naughty:
     :neutral: or :|
     :no_mouth:
     :not_listening:
     :nuh_uh:
     :ohstop:
     :one_finger:
     :open_mouth: or :o
     :peace:
     :pensive:
     :perturbed:
     :pig:
     :pirate:
     :plus_one:
     :prayer:
     :punch:
     :rage: or >_<
     :relaxed:
     :relieved:
     :rock_on:
     :rofl:
     :rose:
     :scream:
     :sick:
     :skull:
     :sleeping:
     :sleepy:
     :smile: or :)
     :smiley: or =)
     :smirk:
     :star:
     :sunglasses: or B)
     :time_out:
     :tired_face:
     :tongue: or :p
     :transformer:
     :triumph:
     :unamused:
     :weary:
     :whistle:
     :who_me:
     :wink: or ;)
     :worried:
     :yin_yang:


text:
:tocdepth: 3

.. _Advanced_Concepts:

Advanced Concepts
*****************

.. toctree::
   :maxdepth: 1

   Internals
   File_Checkpointing
   Multicore_Execution
   FIML_RowFit
   csolnp