text:
import {IMessage} from "./message";
import {IUser} from "./user";

export interface IRoom {
    $key?:string;
    lastMessage?:IMessage;
    name:string;
    user_id?:string;
    user?:IUser;
}

export class Room implements IRoom {
    $key:string;
    name:string = "";
    user_id:string;
    user:IUser;

    public lastMessage:IMessage;

    constructor(name:string) {
        this.name = name;
    }
}


text:
using System;
using Xunit;

namespace Popsql.Tests
{
	public class SqlParameterTests
	{
		[Theory]
		[InlineData(null)]
		[InlineData("")]
		[InlineData(" ")]
		[InlineData("\t")]
		public void Ctor_WithNullOrWhiteSpaceParameterName_ThrowsArgumentNull(string parameterName)
		{
			var ex = Assert.Throws<ArgumentNullException>(() => new SqlParameter(null, null));
			Assert.Equal(nameof(parameterName), ex.ParamName);
		}

		[Fact]
		public void Ctor_WithParameterNameAndValue_SetsPropertyValues()
		{
			var value = Guid.NewGuid();
			var parameter = new SqlParameter("Id", value);

			Assert.NotNull(parameter.ParameterName);
			Assert.Equal("Id", parameter.ParameterName);
			Assert.NotNull(parameter.Value);
			Assert.Equal(value, parameter.Value);
		}

		[Fact]
		public void ExpressionType_ReturnsParameter()
		{
			var parameter = new SqlParameter("Id", 5);
			Assert.Equal(SqlExpressionType.Parameter, parameter.ExpressionType);
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (C) 2022 Fievus
//
// This software may be modified and distributed under the terms
// of the MIT license.  See the LICENSE file for details.
using Carna.Runner.Step;

namespace Carna.Runner;

/// <summary>
/// Provides the function to run a fixture.
/// </summary>
public interface IFixture
{
    /// <summary>
    /// Occurs when a fixture is ready.
    /// </summary>
    event FixtureRunEventHandler? FixtureReady;

    /// <summary>
    /// Occurs when to start running a fixture.
    /// </summary>
    event FixtureRunEventHandler? FixtureRunning;

    /// <summary>
    /// Occurs when to complete running a fixture.
    /// </summary>
    event FixtureRunEventHandler? FixtureRun;

    /// <summary>
    /// Occurs when to start running a fixture step.
    /// </summary>
    event FixtureStepRunEventHandler? FixtureStepRunning;

    /// <summary>
    /// Occurs when to complete running a fixture step.
    /// </summary>
    event FixtureStepRunEventHandler? FixtureStepRun;

    /// <summary>
    /// Gets a descriptor of a fixture.
    /// </summary>
    FixtureDescriptor FixtureDescriptor { get; }

    /// <summary>
    /// Gets or sets a parent of a fixture.
    /// </summary>
    IFixture? ParentFixture { get; set; }

    /// <summary>
    /// Gets the parameters in a fixture.
    /// </summary>
    IDictionary<string, object?> Parameters { get; }

    /// <summary>
    /// Gets the value that indicates whether to run a fixture in a single thread apartment.
    /// </summary>
    bool IsStaFixture { get; }

    /// <summary>
    /// Ensures a parent.
    /// </summary>
    /// <returns>The instance of the <see cref="IFixture"/>.</returns>
    IFixture EnsureParent();

    /// <summary>
    /// Readies a fixture state.
    /// </summary>
    void Ready();

    /// <summary>
    /// Gets a value that indicates whether to be able to run a fixture.
    /// </summary>
    /// <param name="filter">
    /// The filter that determines whether to run a fixture.
    /// </param>
    /// <returns>
    /// <c>true</c> if a fixture can be run; otherwise, <c>false</c>.
    /// </returns>
    bool CanRun(IFixtureFilter? filter);

    /// <summary>
    /// Runs a fixture with the specified filter, step runner factory,
    /// and a value that indicates whether to run a fixture in parallel.
    /// </summary>
    /// <param name="filter">
    /// The filter that determines whether to run a fixture.
    /// </param>
    /// <param name="stepRunnerFactory">
    /// The factory to create a step runner.
    /// </param>
    /// <param name="parallel">
    /// <c>true</c> if a fixture is run in parallel; otherwise, <c>false</c>.
    /// </param>
    /// <returns>
    /// The result of a fixture running if a fixture can be run; otherwise, <c>null</c>.
    /// </returns>
    FixtureResult? Run(IFixtureFilter? filter, IFixtureStepRunnerFactory stepRunnerFactory, bool parallel = false);
}


text:
@class ZCTableDataController;

@protocol ZCTableDataControllerDelegate <NSObject>

@optional
- (void)ZCTableView:(UITableView *)tableView didSelectRowAtIndex:(NSIndexPath *)indexPath;
- (CGFloat)ZCTableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- (UIView *)ZCTableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;
- (UIView *)ZCTableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;
- (CGFloat)ZCTableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
- (CGFloat)ZCTableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;
- (UITableViewCellEditingStyle)ZCTableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;

- (void)ZCScrollViewDidScroll:(UIScrollView *)scrollView;

-(void) ZCTableDataController:(ZCTableDataController *) dataController cell:(ZCTableViewCell *) cell doAction:(id<IZCAction>) action;

-(void) ZCTableDataControllerScrollViewWillBeginDragging:(ZCTableDataController *) dataController;

-(void) ZCTableDataControllerScrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;

-(void) ZCTableDataControllerScrollVIewWillBeginDecelerating:(UIScrollView *)scrollView;

-(void) ZCTableDataControllerScrollViewDidEndDecelerating:(UIScrollView *)scrollView;

-(void) ZCTableDataController:(ZCTableDataController *) dataController didSelectRowAtIndexPath:(NSIndexPath *) indexPath;

-(void)ZCTableDataControllerRefreshData:(ZCTableDataController *) dataController;

-(void)ZCTableDataControllerLoadMoreData:(ZCTableDataController *) dataController;

@end

@protocol ZCTableViewDataSource <NSObject>
@optional
- (UITableViewCell *)ZCTableView:(UITableView *)tableView tabeViewCell:(UITableViewCell *)cell cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSInteger)ZCNumberOfSectionsInTableView:(UITableView *)tableView;
- (NSInteger)ZCTableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
- (BOOL)ZCTableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)ZCTableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)ZCTableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
- (BOOL)ZCTableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
@end

@interface ZCTableDataController : ZCDataController<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,retain) IBOutlet UITableView * tableView;
@property(nonatomic,retain) NSString * reusableCellIdentifier;
@property(nonatomic,retain) NSString * itemViewNib;
@property(nonatomic,retain) NSBundle * itemViewBundle;
@property(nonatomic,retain) IBOutlet ZCDragLoadingView * topLoadingView;
@property(nonatomic,retain) IBOutlet ZCDragLoadingView * bottomLoadingView;
@property(nonatomic,retain) IBOutlet UIView * notFoundDataView;
@property(nonatomic,retain) IBOutletCollection(UIView) NSArray * autoHiddenViews;
@property(nonatomic,retain) IBOutletCollection(UITableViewCell) NSArray * headerCells;
@property(nonatomic,retain) IBOutletCollection(UITableViewCell) NSArray * footerCells;

@property(nonatomic, strong)NSMutableArray * dataObjects;
@property(nonatomic, weak)IBOutlet id <ZCTableDataControllerDelegate> delegate;
@property(nonatomic, weak)IBOutlet id <ZCTableViewDataSource> dataSource;
@property(nonatomic, assign)NSInteger pageIndex;
@property(nonatomic, assign)NSInteger pageSize;
@property(nonatomic, assign)BOOL hasMoreData;

@property(nonatomic, assign)CGFloat cellHeight;

@property(nonatomic, assign)BOOL isLoading;
@property(nonatomic, assign)BOOL isLoaded;

-(void)restoreTableView:(id)obj;

-(void) startLoading;

-(void) stopLoading;

-(id) dataObjectByIndexPath:(NSIndexPath *) indexPath;

-(void)reloadData;

@end


text:
package org.assertj.core.api;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.OptionalInt;

/**
 * Tests for <code>{@link org.assertj.core.api.Assertions#assertThat(java.util.OptionalInt)}</code>.
 *
 * @author Alex Ruiz
 * @author Mikhail Mazursky
 * @author Alexander Bischof
 */
class Assertions_assertThat_with_OptionalInt_Test {

    private OptionalInt actual;

    @BeforeEach
    void before(){
        actual = OptionalInt.of(10);
    }

    @Test
    void should_create_Assert() {
        assertThat(Assertions.assertThat(actual)).isNotNull();
    }

    @Test
    void should_pass_actual() {
      assertThat(actual).isSameAs(Assertions.assertThat(actual).actual);
    }
}


text:
interface A {
}

class B implements A {
    public static void foo() {
      System.out.println();
    }
}


text:
package net.sourceforge.squirrel_sql.client.session.action;

import java.sql.Connection;
import java.sql.SQLException;

import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.fw.util.ICommand;

import javax.swing.*;

/**
 * This command will convert the current SQL into native
 * format and append it to the SQL entry area.
 *
 * @author Colin Bell
 */
public class ShowNativeSQLCommand implements ICommand
{
	/** Current panel. */
	private final ISQLPanelAPI _panel;

	/**
	 * Ctor.
	 *
	 * @param	panel
	 *
	 * @throws	IllegalArgumentException
	 *			Thrown if a <TT>null</TT> <TT>ISQLPanelAPI</TT> passed.
	 */
	public ShowNativeSQLCommand(ISQLPanelAPI panel)
	{
		super();
		if (panel == null)
		{
			throw new IllegalArgumentException("ISQLPanelAPI == null");
		}

		_panel = panel;
	}

	public void execute()
	{
		final ISession session = _panel.getSession();
		final Connection conn = session.getSQLConnection().getConnection();
		try
		{
			final String sql = conn.nativeSQL(_panel.getSQLScriptToBeExecuted());
			if (sql.length() > 0)
			{
				_panel.appendSQLScript("\n" + sql, true);
			}
		}
		catch (SQLException ex)
		{
			session.showErrorMessage(ex);
		}
	}
}


text:
//// [global.ts]
namespace n {
    function id<T>(x: T): T {
        return x;
    }

    function templateObjectFactory() {
        return id`hello world`;
    }
    let result = templateObjectFactory() === templateObjectFactory();
}
//// [module.ts]
export { }
function id<T>(x: T): T {
    return x;
}

function templateObjectFactory() {
    return id`hello world`;
}
let result = templateObjectFactory() === templateObjectFactory();

//// [global.js]
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var n;
(function (n) {
    function id(x) {
        return x;
    }
    function templateObjectFactory() {
        return id(__makeTemplateObject(["hello world"], ["hello world"]));
    }
    var result = templateObjectFactory() === templateObjectFactory();
})(n || (n = {}));
//// [module.js]
"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
function id(x) {
    return x;
}
function templateObjectFactory() {
    return id(templateObject_1 || (templateObject_1 = __makeTemplateObject(["hello world"], ["hello world"])));
}
var result = templateObjectFactory() === templateObjectFactory();
var templateObject_1;


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

<title>org.apache.nutch.protocol.httpclient (apache-nutch 2.3.1 API)</title>
<meta name="date" content="2016-01-10">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package org.apache.nutch.protocol.httpclient

Protocol plugin which supports retrieving documents via the HTTP and
HTTPS protocols, optionally with Basic, Digest and NTLM authentication
schemes for web server as well as proxy server.

See: Description

Interface Summary

Interface
Description

HttpAuthentication

The base level of services required for Http Authentication

Class Summary

Class
Description

DummySSLProtocolSocketFactory

DummyX509TrustManager

Http

This class is a protocol plugin that configures an HTTP client for Basic,
 Digest and NTLM authentication schemes for web server as well as proxy
 server.

HttpAuthenticationFactory

Provides the Http protocol implementation with the ability to authenticate
 when prompted.

HttpBasicAuthentication

Implementation of RFC 2617 Basic Authentication.

HttpResponse

An HTTP response.

Exception Summary

Exception
Description

HttpAuthenticationException

Can be used to identify problems during creation of Authentication objects.

Package org.apache.nutch.protocol.httpclient Description

Protocol plugin which supports retrieving documents via the HTTP and
HTTPS protocols, optionally with Basic, Digest and NTLM authentication
schemes for web server as well as proxy server. It handles cookies
within a single fetch operation. This plugin is based on Jakarta
Commons HttpClient library.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Copyright © 2015 The Apache Software Foundation


text:
import subprocess
import sys
import setup_util
import os

def start(args, logfile, errfile):
  if os.name == 'nt':
    return 1

  setup_util.replace_text("aspnet/src/Web.config", "localhost", args.database_host)

  try:
    subprocess.check_call("rm -rf bin obj", shell=True, cwd="aspnet/src", stderr=errfile, stdout=logfile)
    subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="aspnet/src", stderr=errfile, stdout=logfile)
    subprocess.check_call("sudo chown -R ubuntu:ubuntu /usr/local/etc/mono", shell=True, stderr=errfile, stdout=logfile)
    subprocess.Popen("MONO_OPTIONS=--gc=sgen xsp4 --nonstop", shell=True, cwd="aspnet/src", stderr=errfile, stdout=logfile)
    return 0
  except subprocess.CalledProcessError:
    return 1

def stop(logfile, errfile):
  if os.name == 'nt':
    return 0

  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  out, err = p.communicate()
  for line in out.splitlines():
    if 'xsp4' in line:
      pid = int(line.split(None, 2)[1])
      try:
        os.kill(pid, 9)
      except OSError:
        pass
  return 0


text:
require_relative 'spec_helper'

require 'ixtlan/datamapper/modified_by'

class D
  include DataMapper::Resource

  property :id, Serial
  property :name, String

  modified_by D
end

DataMapper.finalize
DataMapper.auto_migrate!

describe Ixtlan::DataMapper::ModifiedBy do

  subject do
    unless d = D.get( 1 )
      d = D.new :name => 'huffalump', :id => 1, :modified_by_id => 1
      d.save!
    end
    d
  end

  it 'is valid per default' do
    subject.current_user.must_be_nil
    subject.persistence_state?.must_equal true
    subject.dirty?.must_equal false
    subject.valid?.must_equal true
  end

  it 'is not valid when dirty' do
    subject.name = 'asd'
    subject.current_user.must_be_nil
    subject.dirty?.must_equal true
    subject.valid?.must_equal false
  end

  it 'is valid when dirty and current_user set' do
    subject.name = 'asd'
    subject.current_user = subject
    subject.dirty?.must_equal true
    subject.valid?.must_equal true
  end

  it 'is valid after setting current user' do
    subject.current_user = subject
    subject.dirty?.must_equal false
    subject.valid?.must_equal true
  end

end


text:
var cdb = require('cartodb.js-v3');
var TabItemView = require('../../../../../../javascripts/cartodb/common/dialogs/georeference/tab_item_view');

describe('common/dialog/georeference/tab_item_view', function() {
  beforeEach(function() {
    this.model = new cdb.core.Model({
    });
    this.model.TAB_LABEL = 'my-tab';
    this.view = new TabItemView({
      model: this.model
    });
    this.view.render();
  });

  it('should not have leaks', function() {
    expect(this.view).toHaveNoLeaks();
  });

  it('should be rendered with defaults', function() {
    expect(this.innerHTML()).toContain('my-tab');
    expect(this.innerHTML()).not.toContain('disabled');
    expect(this.innerHTML()).not.toContain('selected');
  });

  describe('when selected', function() {
    beforeEach(function() {
      this.model.set('selected', true);
    });

    it('should change visual accordingly', function() {
      expect(this.innerHTML()).toContain('selected');
    });
  });

  describe('when disabled is set', function() {
    beforeEach(function() {
      this.model.set('disabled', 'some reason');
      this.view.render();
    });

    it('should disable the tab', function() {
      expect(this.innerHTML()).toContain('disabled');
    });
  });

  afterEach(function() {
    this.view.clean();
  });
});


text:
![boomstick](https://cloud.githubusercontent.com/assets/2590422/21485582/7067ab3c-cb73-11e6-82b0-20654c4f28f1.jpg)

# boomstick
Describes the process of creating a Raspberry Pi-powered arcade console.

# Components
- [x] [Raspberry Pi Model 3](https://www.adafruit.com/products/3055)
- [x] [9x Small Translucent Red Arcade Buttons](https://www.adafruit.com/products/473)
- [x] [8x Arcade/Button Quick-Connect Wire Pair](https://www.adafruit.com/products/1152)
- [x] [1x 16mm Red Illuminated Pushbutton](https://www.adafruit.com/products/1439)
- [x] [1x Small Arcade Joystick](https://www.adafruit.com/products/480)
- [x] [Walnut Hollow Cornice Box](https://www.amazon.com/gp/product/B000YQEMHW/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1)

# OS
- [x] [Lakka](http://www.lakka.tv/) (Lakka doesn't currently support GPIO inputs. RetroPie has more support/precedent for this)
- [x] [RetroPie](https://retropie.org.uk/)

# Case Design References
- [Slagcoin](http://www.slagcoin.com/joystick.html) Lots of good general information.
  - [Layout](http://www.slagcoin.com/joystick/layout.htm)
  - [Detailed Build](http://www.slagcoin.com/joystick/example3.html)

# Prior Art
- [Hacker House YT Raspberry Pi Portable Arcade](https://github.com/HackerHouseYT/Portable-Arcade/blob/master/README.md)
- [Retro Gaming with Raspberry Pi](https://learn.adafruit.com/retro-gaming-with-raspberry-pi)
- [Adafruit Bluetooth Controller](https://learn.adafruit.com/bluetooth-arcade-stick/) Related project. Describes how to use parts ordered from Adafruit listed above.

# Layout Requirements
![sega1_l](https://cloud.githubusercontent.com/assets/2590422/21487656/a8a40d32-cb9c-11e6-82db-816dd6999120.png)
- Should be based on Astro City (Player One), which is pretty standard for Arcade cabinets.
- Should include all buttons necessary to play NES/SNES/Genesis games.
- Should have a dedicated menu button.


text: URLProcessing module rewritten.


text:
using System;
using System.Collections.Generic;
using FluentMigrator.Infrastructure;

namespace FluentMigrator
{
    public interface IMigrationConventions
    {
        Func<Model.ForeignKeyDefinition, string> GetForeignKeyName { get; set; }
        Func<Model.IndexDefinition, string> GetIndexName { get; set; }
        Func<string, string> GetPrimaryKeyName { get; set; }
        Func<Type, bool> TypeIsMigration { get; set; }
        Func<Type, bool> TypeIsProfile { get; set; }
        Func<Type, MigrationStage?> GetMaintenanceStage { get; set; }
        Func<Type, bool> TypeIsVersionTableMetaData { get; set; }
        Func<string> GetWorkingDirectory { get; set; }
        Func<Type, IMigrationInfo> GetMigrationInfo { get; set; }
        Func<Model.ConstraintDefinition, string> GetConstraintName { get; set; }
        Func<Type, bool> TypeHasTags { get; set; }
        Func<Type, IEnumerable<string>, bool> TypeHasMatchingTags { get; set; }
        Func<Type,string,string> GetAutoScriptUpName {get;set;}
        Func<Type, string, string> GetAutoScriptDownName { get; set; }
        Func<string> GetDefaultSchema { get; set; }
    }
}


text:
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on October 30, 2015 */

@font-face {
    font-family: 'sphereographic_penbold';
    src: url('bridgefall_font_bold-webfont.eot');
    src: url('bridgefall_font_bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('bridgefall_font_bold-webfont.woff2') format('woff2'),
         url('bridgefall_font_bold-webfont.woff') format('woff'),
         url('bridgefall_font_bold-webfont.ttf') format('truetype'),
         url('bridgefall_font_bold-webfont.svg#sphereographic_penbold') format('svg');
    font-weight: normal;
    font-style: normal;

}


text:
module ArgsParser

  class Parser
    attr_reader :argv, :params, :aliases

    public
    def first
      argv.first
    end

    def initialize(config, &block)
      raise ArgumentError, 'initialize block was not given' unless block_given?

      @config = config
      @argv = []
      @params = Hash.new{|h,k|
        h[k] = {
          :default => nil,
          :description => nil,
          :value => nil,
          :alias => nil,
          :index => -1
        }
      }
      @aliases = {}
      @filter = Filter.new
      @validator = Validator.new
      @ons = []

      filter do |v|
        (v.kind_of? String and v =~ /^-?\d+$/) ? v.to_i : v
      end
      filter do |v|
        (v.kind_of? String and v =~ /^-?\d+\.\d+$/) ? v.to_f : v
      end
      on_filter_error do |err, name, value|
        raise err
      end
      on_validate_error do |err, name, value|
        STDERR.puts "Error: #{err.message} (--#{name} #{value})"
        exit 1
      end

      instance_eval &block
    end

    private
    def arg(name, description, opts={})
      name = name.to_sym
      params[name][:default] = opts[:default]
      params[name][:description] = description
      params[name][:index] = params.keys.size
      params[name][:alias] = opts[:alias]
      aliases[opts[:alias]] = name if opts[:alias]
    end

    def filter(name=nil, &block)
      @filter.add name, block if block_given?
    end

    def on_filter_error(err=nil, name=nil, value=nil, &block)
      if block_given?
        @on_filter_error = block
      elsif @on_filter_error.kind_of? Proc
        @on_filter_error.call(err, name, value)
      end
    end

    def validate(name, message, &block)
      @validator.add name, message, block if block_given?
    end

    def on_validate_error(err=nil, name=nil, value=nil, &block)
      if block_given?
        @on_validate_error = block
      elsif @on_validate_error.kind_of? Proc
        @on_validate_error.call(err, name, value)
      end
    end

    def on(name, &block)
      name = name.to_sym
      if block_given?
        @ons.push :name => name, :callback => block
      else
        @ons.each do |event|
          event[:callback].call(self[name]) if event[:name] == name
        end
      end
    end

    def default(key)
      d = params[key.to_sym][:default]
      d.kind_of?(Proc) ? d.call : d
    end

    public
    def args
      params.keys
    end

    def parse(argv)
      send "parse_style_#{@config[:style]}", argv
      params.each do |name, param|
        next if [nil, true].include? param[:value]
        begin
          param[:value] = @filter.filter name, param[:value]
        rescue => e
          on_filter_error e, name, param[:value]
        end
        begin
          msg = @validator.validate name, param[:value]
        rescue => e
          on_validate_error e, name, param[:value]
        end
        if msg
          on_validate_error ValidationError.new(msg), name, param[:value]
        end
      end
      params.keys.each do |name|
        on name if has_option? name or has_param? name
      end
    end

    def [](key)
      params[key.to_sym][:value] || default(key)
    end

    def []=(key, value)
      params[key.to_sym][:value] = value
    end

    def has_option?(*opts)
      !opts.flatten.find{|i| self[i] != true}
    end

    def has_param?(*params)
      !params.flatten.find{|i| self[i] == nil or self[i] == true }
    end

    def inspect
      h = Hash.new
      params.each do |k,v|
        h[k] = v[:value]
      end
      h.inspect
    end

    def help
      params_ = Array.new
      params.each do |k,v|
        v[:name] = k
        params_.push v
      end
      params_ = params_.reject{|i| i[:index] < 0 }.sort{|a,b| a[:index] <=> b[:index] }

      len = params_.map{|i|
        (i[:alias] ?
         " -#{i[:name]} (-#{i[:alias]})" :
         " -#{i[:name]}").size
      }.max

      "options:\n" + params_.map{|i|
        line = (i[:alias] ?
                " -#{i[:name]} (-#{i[:alias]})" :
                " -#{i[:name]}").ljust(len+2)
        line += i[:description].to_s
        line += " : default - #{default i[:name]}" if i[:default]
        line
      }.join("\n")
    end

  end
end


text: .. include:: ../../../en/api-reference/system/inc/show-efuse-table_ESP32-S2.rst


text:
from mrjob.job import MRJob
import json

class MRWordCountUtility(MRJob):

    def __init__(self, *args, **kwargs):
        super(MRWordCountUtility, self).__init__(*args, **kwargs)
        self.chars = 0
        self.words = 0
        self.lines = 0

    def mapper(self, _, line):
        if False:
            yield  # I'm a generator!

        self.chars += len(line) + 1  # +1 for newline
        self.words += sum(1 for word in line.split() if word.strip())
        self.lines += 1

    def mapper_final(self):
        yield('chars', self.chars)
        yield('words', self.words)
        yield('lines', self.lines)

    def reducer(self, key, values):
        yield(key, sum(values))

if __name__ == '__main__':
    MRWordCountUtility.run()


text:
package org.allseen.timeservice.sample.server.ui;

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

import org.allseen.timeservice.sample.server.logic.PreferencesManager;
import org.allseen.timeservice.sample.server.logic.ProtocolManager;

import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;

/**
 * TimeServiceSampleServerApplication listen to incoming messages via broadcast receiver and updates the messageItemsList with them.
 *
 *
 */
public class TimeSampleServer extends Application {

    private static final String TAG = "TimeServiceSampleServerApplication";

    public static final String TIMER_EVENT_ACTION = "TimerEvent";
    public static final String ALARM_EVENT_ACTION = "AlarmEvent";
    public static final String CLOCK_EVENT_ACTION = "ClockEvent";
    public static final String GENERAL_ACTION = "GeneralEvent";

    public static final String MESSAGE_KEY = "message";
    public static final String OBJECT_PATH_KEY = "objectpath";

    public static class MessageItem {
        public long timestamp;
        public String type;
        public String objectPath;
        public String message;
    }

    private final ProtocolManager protocolManager = new ProtocolManager();
    static {
        try {
            System.loadLibrary("alljoyn_java");
        } catch (Exception e) {
            Log.d("TimeServiceSampleServerApplication", "Failed to load alljoyn_java.so", e);
        }
    }

    @Override
    public void onCreate() {
        super.onCreate();
        IntentFilter filter = new IntentFilter();
        filter.addAction(TIMER_EVENT_ACTION);
        filter.addAction(ALARM_EVENT_ACTION);
        filter.addAction(CLOCK_EVENT_ACTION);
        filter.addAction(GENERAL_ACTION);
        LocalBroadcastManager.getInstance(this).registerReceiver(messagesReceiver, filter);
        PreferencesManager.getInstance().init(this);
        protocolManager.init(this);

    }

    private final BroadcastReceiver messagesReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            synchronized (TAG) {
                Bundle bundle = intent.getExtras();
                if (bundle != null) {
                    MessageItem item = new MessageItem();
                    item.message = bundle.getString(MESSAGE_KEY);
                    item.objectPath = bundle.getString(OBJECT_PATH_KEY);
                    item.type = intent.getAction();
                    item.timestamp = System.currentTimeMillis();
                    Log.d(TAG, intent.getAction() + "  received from [" + item.objectPath + "] " + item.message);
                    messageItemsList.add(item);
                }
            }
        }
    };

    private final List<MessageItem> messageItemsList = new ArrayList<MessageItem>();

    public List<MessageItem> getMessagesList() {
        synchronized (TAG) {
            return messageItemsList;
        }
    }

    public static void sendMessage(Context context, String type, String ObjectPath, String message) {
        Intent intent = new Intent(type);
        intent.putExtra(TimeSampleServer.MESSAGE_KEY, message);
        intent.putExtra(TimeSampleServer.OBJECT_PATH_KEY, ObjectPath);
        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
    }

    public ProtocolManager getProtocolManager() {
        return protocolManager;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.wherecamp.hackathon.phumblr">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <application
        android:name=".managers.MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name=".activities.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
@interface LJBaseViewController ()

@end

@implementation LJBaseViewController

#pragma mark - View Lifecycle
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}

@end


text:
package org.springframework.boot.cli.compiler.grape;

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

import org.eclipse.aether.repository.Proxy;
import org.eclipse.aether.repository.ProxySelector;
import org.eclipse.aether.repository.RemoteRepository;

/**
 * Composite {@link ProxySelector}.
 *
 * @author Dave Syer
 * @since 1.1.0
 */
public class CompositeProxySelector implements ProxySelector {

	private List<ProxySelector> selectors = new ArrayList<>();

	public CompositeProxySelector(List<ProxySelector> selectors) {
		this.selectors = selectors;
	}

	@Override
	public Proxy getProxy(RemoteRepository repository) {
		for (ProxySelector selector : this.selectors) {
			Proxy proxy = selector.getProxy(repository);
			if (proxy != null) {
				return proxy;
			}
		}
		return null;
	}

}


text:
import { Component, Inject, AfterViewInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

@Component({
	selector : 'form-dialog',
    templateUrl: './form-dialog.component.html',
    styleUrls : [ './form-dialog.component.scss' ]
})

export class FormDialog implements AfterViewInit{

    private formGroup : FormGroup;
    private _formTitle : string  = 'Eintrag erstellen';
    private _anonimityEnabled : boolean = false;
    private _data;
    private _anonym;
    private _editorContent : string = '';
    private _content : string = '';
    private _options = {
    	description : {
    		required : false,
    		enabled : false
    	},
    	title : {
    		required: true,
    		enabled : true
    	}
    };

    constructor(private formBuilder : FormBuilder, private dialogRef: MatDialogRef<FormDialog>, @Inject(MAT_DIALOG_DATA) public dialogData: any){}

    ngOnInit() : void {
    	this._formTitle  = this.dialogData.formTitle || 'Eintrag erstellen';
    	this._data = this.dialogData.data || { settings : { enableAnonimity : true}};
    	this._options = this.dialogData.options || this._options;

    	this._anonimityEnabled = this._data.settings.enableAnonimity || true;
        const title = this._data.title || '';
        const desc = this._data.description || '';
        const anonym = this._data.anonym || true;
        this._anonym = anonym;
    	this.formGroup = this.formBuilder.group({
	        title: [title],
	        description : [desc],
	        anonym : [anonym]
	    });
    }
    ngAfterViewInit(){
        this._content = this._data.body || '';
    }
    closeDialog(){
    	this.dialogRef.close();
    }
    submit(event){
    	let data = this.formGroup.value;
        if(this._editorContent !== '') data.body = this._editorContent;
        else data.body = this._content;
        this.dialogRef.close(data);
    }
    updateEditorContent(content) : void{
    	this._editorContent = content;
    }
}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class move : MonoBehaviour {

    public Rigidbody rb;

    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update () {

    }

    void OnMouseDown()
    {
        rb.freezeRotation = true;
        rb.useGravity = false;
        rb.velocity = Vector3.zero;
        rb.isKinematic = true;
    }

    void OnMouseUp()
    {
        rb.freezeRotation = false;
        rb.useGravity = true;
        rb.isKinematic = false;
    }

    void OnMouseDrag()
    {
        Vector3 mousePostition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10);
        Vector3 objPosition = Camera.main.ScreenToWorldPoint(mousePostition);
        rb.position = objPosition;
    }

    void OnCollisionEnter(Collision collision)
    {
        rb.velocity = Vector3.zero;
    }

    void OnCollisionExit(Collision collision)
    {
        rb.velocity = Vector3.zero;
    }
}


text:
module Azure::CDN::Mgmt::V2020_09_01
  module Models
    #
    # Defines values for OriginGroupResourceState
    #
    module OriginGroupResourceState
      Creating = "Creating"
      Active = "Active"
      Deleting = "Deleting"
    end
  end
end


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Helix: Helix::Logic::admin::DeleteSQLWork Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

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

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

Helix

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

Public Member Functions |
Static Private Attributes |
List of all members

Helix::Logic::admin::DeleteSQLWork Class Reference

#include <DeleteSQLWork.h>

Inheritance diagram for Helix::Logic::admin::DeleteSQLWork:

  <map id="Helix::Logic::admin::DeleteSQLWork_map" name="Helix::Logic::admin::DeleteSQLWork_map">
<area href="classHelix_1_1Glob_1_1ActionClass.html" alt="Helix::Glob::ActionClass" shape="rect" coords="0,0,212,24"/>
</map>

Public Member Functions

 	DeleteSQLWork (xmlNodePtr action)

 	Standard Constructor.  More...

 	DeleteSQLWork (const DeleteSQLWork &c)

 	Standard Copy Constructor.  More...

DeleteSQLWork & 	operator= (const DeleteSQLWork &c)

 	Standard Copy operator.  More...

virtual 	~DeleteSQLWork ()

 	Standard Destructor.  More...

virtual void 	ExecuteRequest (IOConn &ioc)

 	We implement the ExecuteRequest method.  More...

 Public Member Functions inherited from Helix::Glob::ActionClass

virtual 	~ActionClass ()

virtual bool 	isLongRunning ()

virtual twine 	lrTaskName ()

Static Private Attributes

static ActionClassRegister< DeleteSQLWork > 	reg

Additional Inherited Members

 Public Attributes inherited from Helix::Glob::ActionClass

twine 	m_name

twine 	m_license_group

bool 	m_requires_session

bool 	m_delete_required

Constructor & Destructor Documentation

          DeleteSQLWork::DeleteSQLWork
          (
          xmlNodePtr
          action	)

Standard Constructor.

          DeleteSQLWork::DeleteSQLWork
          (
          const DeleteSQLWork &
          c	)

Standard Copy Constructor.

          DeleteSQLWork::~DeleteSQLWork
          (
          	)

virtual

Standard Destructor.

Member Function Documentation

          void DeleteSQLWork::ExecuteRequest
          (
          IOConn &
          ioc	)

virtual

We implement the ExecuteRequest method.

Implements Helix::Glob::ActionClass.

          DeleteSQLWork & DeleteSQLWork::operator=
          (
          const DeleteSQLWork &
          c	)

Standard Copy operator.

Member Data Documentation

          ActionClassRegister< DeleteSQLWork > DeleteSQLWork::reg

staticprivate

The documentation for this class was generated from the following files:

logic/admin/DeleteSQLWork.h

logic/admin/DeleteSQLWork.cpp

Helix

Logic

admin

DeleteSQLWork

Generated on Wed Jan 14 2015 12:23:31 for Helix by

     1.8.9.1


text:
import {Component, EventEmitter} from '@angular/core'
import {ROUTER_DIRECTIVES} from '@angular/router'

@Component({
    selector: 'user-comment-item',
    templateUrl: './user-comment-item.component.html',
    styleUrls: ['./comment-item.component.css'],
    directives: [ROUTER_DIRECTIVES],
    inputs: ['comment']
})

export class UserCommentItemComponent {
    constructor(){

    }
}


text:
from copy import copy
from collections.abc import (
    ItemsView,
    KeysView,
    ValuesView,
    # MappingView,
)

class LevelItems(ItemsView):
    __slots__ = [
        '_db',
        '_args',
    ]

    def __init__(self, db, key_from=None, key_to=None, **kwargs):
        self._db = db
        self._args = kwargs
        self._args.update({
            'key_from': key_from,
            'key_to': key_to,
        })

    def __iter__(self):
        kwargs = copy(self._args)
        kwargs['reverse'] = False
        kwargs['include_value'] = True
        for k, v in self._db.RangeIter(**kwargs):
            yield self.key_transform(k), self._db.decode(v)

    def __reversed__(self):
        kwargs = copy(self._args)
        kwargs['reverse'] = True
        kwargs['include_value'] = True
        for k, v in self._db.RangeIter(**kwargs):
            yield self.key_transform(k), self._db.decode(v)

    @staticmethod
    def key_transform(key):
        return bytes(key)

    def __repr__(self):                                     # pragma: no cover
        return "<LevelItems @%x>" % id(self)

class LevelKeys(KeysView):
    __slots__ = [
        '_db',
        '_args',
    ]

    def __init__(self, db, key_from=None, key_to=None, **kwargs):
        self._db = db
        self._args = kwargs
        self._args.update({
            'key_from': key_from,
            'key_to': key_to,
        })

    def __iter__(self):
        kwargs = copy(self._args)
        kwargs['reverse'] = False
        kwargs['include_value'] = False
        for k in self._db.RangeIter(**kwargs):
            print("hai")
            yield self.key_transform(k)

    def __reversed__(self):
        kwargs = copy(self._args)
        kwargs['reverse'] = True
        kwargs['include_value'] = False
        for k in self._db.RangeIter(**kwargs):
            yield self.key_transform(k)

    @staticmethod
    def key_transform(key):
        return bytes(key)

    def __repr__(self):                                     # pragma: no cover
        return "<LevelKeys @%x>" % id(self)

class LevelValues(ValuesView):
    __slots__ = [
        '_db',
        '_args',
    ]

    def __init__(self, db, key_from=None, key_to=None, **kwargs):
        self._db = db
        self._args = kwargs
        self._args.update({
            'key_from': key_from,
            'key_to': key_to,
        })

    def __iter__(self):
        kwargs = copy(self._args)
        kwargs['reverse'] = False
        kwargs['include_value'] = True
        for k, v in self._db.RangeIter(**kwargs):
            yield self._db.decode(v)

    def __reversed__(self):
        kwargs = copy(self._args)
        kwargs['reverse'] = True
        kwargs['include_value'] = True
        for k, v in self._db.RangeIter(**kwargs):
            yield self._db.decode(v)

    def __repr__(self):                                     # pragma: no cover
        return "<LevelValues @%x>" % id(self)


text:
Twitter Accounts

Home

Accounts

			Account:
			<select ng-model="activeTwitterAccount"
				ng-options="account.username for account in socialAccounts"
				>
			</select>

				New Keys (social login)

Account for {{ ta.name }}


text:
from __future__ import absolute_import

import six

from collections import Iterable

from sentry.mediators import Mediator, Param
from sentry.mediators.param import if_param
from sentry.mediators.service_hooks.creator import expand_events

class Updater(Mediator):
    service_hook = Param("sentry.models.ServiceHook")
    application = Param("sentry.models.ApiApplication", required=False)
    actor = Param("sentry.models.User", required=False)
    project = Param("sentry.models.Project", required=False)
    events = Param(Iterable, required=False)
    url = Param(six.string_types, required=False)

    def call(self):
        self._update_application()
        self._update_actor()
        self._update_events()
        self._update_url()
        self.service_hook.save()
        return self.service_hook

    @if_param("application")
    def _update_application(self):
        self.service_hook.application = self.application

    @if_param("actor")
    def _update_actor(self):
        self.service_hook.actor_id = self.actor.id

    @if_param("events")
    def _update_events(self):
        self.service_hook.events = expand_events(self.events)

    @if_param("url")
    def _update_url(self):
        self.service_hook.url = self.url


text:
/**
 * @file dev_serial_mac.c
 * @author Ram Kumar {ram@ee.ucla.edu}
 * @brief Serial IO for MAC OS X
 */

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <paths.h>
#include <termios.h>
#include <sysexits.h>
#include <sys/param.h>
#include <sys/select.h>
#include <sys/time.h>
#include <time.h>

#ifdef __MWERKS__
#define __CF_USE_FRAMEWORK_INCLUDES__
#endif

#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/serial/IOSerialKeys.h>
#include <IOKit/IOBSD.h>

#include <stdlib.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <dev_serial.h>
#include <sossrv.h>

// Function prototypes
static kern_return_t FindModems(io_iterator_t *matchingServices);
static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPath, CFIndex maxPathSize, char* dev);

int getspeedconstant(int speed); //! The mapping from speed to the constant identifier
int dev_serial_fd;               //! File descriptor of the serial device
struct termios oldtio,newtio;    //! Termios Structure for configuring the serial data

int open_serial_device(char* dev, int speed, int* fd)
{
  int realspeed;
  int fileDescriptor;
  kern_return_t	kernResult; // on PowerPC this is an int (4 bytes)
  /*
   *	error number layout as follows (see mach/error.h):
   *
   *	hi		 		       lo
   *	| system(6) | subsystem(12) | code(14) |
   */

  io_iterator_t	serialPortIterator;
  char		bsdPath[MAXPATHLEN];

  realspeed = getspeedconstant(speed);
  kernResult = FindModems(&serialPortIterator);
  kernResult = GetModemPath(serialPortIterator, bsdPath, sizeof(bsdPath), dev);
  IOObjectRelease(serialPortIterator);	// Release the iterator.

  // Now open the modem port we found, initialize the modem, then close it
  if (!bsdPath[0]){
    printf("No modem port found.\n");
    exit(EXIT_FAILURE);
  }

  dev_serial_fd = open(bsdPath, O_RDWR | O_NOCTTY | O_NONBLOCK);    //! Open serial device in a non-blocking mode
  if (dev_serial_fd <0) {
	perror("open_serial_device: open");
	exit(EXIT_FAILURE);
  }

  if (ioctl(dev_serial_fd, TIOCEXCL) == -1){
    printf("Error setting TIOCEXCL on %s - %s(%d).\n",
	   bsdPath, strerror(errno), errno);
    exit(EXIT_FAILURE);
  }

  // Now that the device is open, clear the O_NONBLOCK flag so subsequent I/O will block.
  // See fcntl(2) ("man 2 fcntl") for details.

  if (fcntl(dev_serial_fd, F_SETFL, 0) == -1){
    printf("Error clearing O_NONBLOCK %s - %s(%d).\n",
	   bsdPath, strerror(errno), errno);
    exit(EXIT_FAILURE);
  }

  tcgetattr(dev_serial_fd,&oldtio);                                 //! Save current port settings
  bzero(&newtio, sizeof(newtio));                                   //! Initialize the new termios structure
  newtio.c_cflag = CS8 | CLOCAL | CREAD | HUPCL;                    //! Control mode flags - 8 N 1
  newtio.c_iflag = IGNBRK | IGNPAR;                                 //! Input mode flags - Ignore break condition, Ignore parity errors
  newtio.c_oflag = 0;                                               //! Output mode flags
  newtio.c_lflag = 0;                                               //! Local mode flags - Non Canonical, No Echo
  newtio.c_cc[VTIME]    = 0;                                        //! No inter-character timer unused
  newtio.c_cc[VMIN]     = 1;                                        //! Blocking read until 1 char is received
  cfsetispeed(&newtio, realspeed);                                  //! Baudrate setting
  cfsetospeed(&newtio, realspeed);                                  //! Baudrate setting
  tcflush(dev_serial_fd, TCIFLUSH);                                 //! Flush the serial device
  tcsetattr(dev_serial_fd,TCSANOW,&newtio);                         //! Set the new serial attributes
  *(fd) = dev_serial_fd;                                            //! Copy the file descriptor to the application
  DEBUG("Connected to SOS_NIC @ serial port: %s\n", dev);
  DEBUG("Connected to SOS_NIC @ baud rate: %d\n", speed);
  return 0;
}

int close_serial_device()
{
  tcsetattr(dev_serial_fd,TCSANOW,&oldtio);
}

int getspeedconstant(int speed)
{
	switch (speed){
		case 2400:
			return B2400;
		case 4800:
			return B4800;
		case 9600:
			return B9600;
		case 19200:
			return B19200;
		case 38400:
			return B38400;
		case 57600:
			return B57600;
		case 115200:
			return B115200;
		case 230400:
			return B230400;
		default:
			printf("Unsupported baudrate. Exiting ...\n");
			exit(EXIT_FAILURE);
	}
	return 0;
}

// Returns an iterator across all known modems. Caller is responsible for
// releasing the iterator when iteration is complete.
static kern_return_t FindModems(io_iterator_t *matchingServices)
{
    kern_return_t		kernResult;
    mach_port_t			masterPort;
    CFMutableDictionaryRef	classesToMatch;

/*! @function IOMasterPort
    @abstract Returns the mach port used to initiate communication with IOKit.
    @discussion Functions that don't specify an existing object require the IOKit master port to be passed. This function obtains that port.
    @param bootstrapPort Pass MACH_PORT_NULL for the default.
    @param masterPort The master port is returned.
    @result A kern_return_t error code. */

    kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
    if (KERN_SUCCESS != kernResult)
    {
        printf("IOMasterPort returned %d\n", kernResult);
	goto exit;
    }

/*! @function IOServiceMatching
    @abstract Create a matching dictionary that specifies an IOService class match.
    @discussion A very common matching criteria for IOService is based on its class. IOServiceMatching will create a matching dictionary that specifies any IOService of a class, or its subclasses. The class is specified by C-string name.
    @param name The class name, as a const C-string. Class matching is successful on IOService's of this class or any subclass.
    @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */

    // Serial devices are instances of class IOSerialBSDClient
    classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
    if (classesToMatch == NULL)
    {
        printf("IOServiceMatching returned a NULL dictionary.\n");
    }
    else {
/*!
	@function CFDictionarySetValue
	Sets the value of the key in the dictionary.
	@param theDict The dictionary to which the value is to be set. If this
		parameter is not a valid mutable CFDictionary, the behavior is
		undefined. If the dictionary is a fixed-capacity dictionary and
		it is full before this operation, and the key does not exist in
		the dictionary, the behavior is undefined.
	@param key The key of the value to set into the dictionary. If a key
		which matches this key is already present in the dictionary, only
		the value is changed ("add if absent, replace if present"). If
		no key matches the given key, the key-value pair is added to the
		dictionary. If added, the key is retained by the dictionary,
		using the retain callback provided
		when the dictionary was created. If the key is not of the sort
		expected by the key retain callback, the behavior is undefined.
	@param value The value to add to or replace into the dictionary. The value
		is retained by the dictionary using the retain callback provided
		when the dictionary was created, and the previous value if any is
		released. If the value is not of the sort expected by the
		retain or release callbacks, the behavior is undefined.
*/
        CFDictionarySetValue(classesToMatch,
                             CFSTR(kIOSerialBSDTypeKey),
                             CFSTR(kIOSerialBSDRS232Type));
        // Each serial device object has a property with key
        // kIOSerialBSDTypeKey and a value that is one of kIOSerialBSDAllTypes,
        // kIOSerialBSDModemType, or kIOSerialBSDRS232Type. You can experiment with the
        // matching by changing the last parameter in the above call to CFDictionarySetValue.

        // As shipped, this sample is only interested in modems,
        // so add this property to the CFDictionary we're matching on.
        // This will find devices that advertise themselves as modems,
        // such as built-in and USB modems. However, this match won't find serial modems.
    }

    /*! @function IOServiceGetMatchingServices
        @abstract Look up registered IOService objects that match a matching dictionary.
        @discussion This is the preferred method of finding IOService objects currently registered by IOKit. IOServiceAddNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
        @param masterPort The master port obtained from IOMasterPort().
        @param matching A CF dictionary containing matching information, of which one reference is consumed by this function. IOKitLib can contruct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOOpenFirmwarePathMatching.
        @param existing An iterator handle is returned on success, and should be released by the caller when the iteration is finished.
        @result A kern_return_t error code. */

    kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch, matchingServices);
    if (KERN_SUCCESS != kernResult)
    {
        printf("IOServiceGetMatchingServices returned %d\n", kernResult);
	goto exit;
    }

exit:
    return kernResult;
}

// Given an iterator across a set of modems, return the BSD path to the first one.
// If no modems are found the path name is set to an empty string.
static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPath, CFIndex maxPathSize, char* dev)
{
    io_object_t		modemService;
    kern_return_t	kernResult = KERN_FAILURE;
    Boolean		modemFound = false;
    printf("Scanning IO ports ...\n");
    // Initialize the returned path
    *bsdPath = '\0';

    // Iterate across all modems found. In this example, we bail after finding the first modem.

    while ((modemService = IOIteratorNext(serialPortIterator)) && !modemFound)
    {
        CFTypeRef	bsdPathAsCFString;

	// Get the callout device's path (/dev/cu.xxxxx). The callout device should almost always be
	// used: the dialin device (/dev/tty.xxxxx) would be used when monitoring a serial port for
	// incoming calls, e.g. a fax listener.

	bsdPathAsCFString = IORegistryEntryCreateCFProperty(modemService,
                                                            CFSTR(kIOCalloutDeviceKey),
                                                            kCFAllocatorDefault,
                                                            0);
        if (bsdPathAsCFString)
        {
            Boolean result;

            // Convert the path from a CFString to a C (NUL-terminated) string for use
	    // with the POSIX open() call.

	    result = CFStringGetCString(bsdPathAsCFString,
                                        bsdPath,
                                        maxPathSize,
                                        kCFStringEncodingASCII);
            CFRelease(bsdPathAsCFString);

            if (result)
	    {
	      printf("BSD path: %s ...", bsdPath);
	      if (0 == strcmp(bsdPath, dev)){
                modemFound = true;
                kernResult = KERN_SUCCESS;
		printf("Match\n");
	      }
	      else{
		*bsdPath = '\0';
		printf("No Match\n");
	      }
	    }
        }

        printf("\n");

        // Release the io_service_t now that we are done with it.

	(void) IOObjectRelease(modemService);
    }

    return kernResult;
}


text:
;(function($, window, document, undefined) {

"use strict";

/*******************************************************************************
 * Private functions and variables
 */

// Allow these navigation keys even when input controls are focused

var	KC = $.ui.keyCode,
	// which keys are *not* handled by embedded control, but passed to tree
	// navigation handler:
	NAV_KEYS = {
		"text": [KC.UP, KC.DOWN],
		"checkbox": [KC.UP, KC.DOWN, KC.LEFT, KC.RIGHT],
		"radiobutton": [KC.UP, KC.DOWN, KC.LEFT, KC.RIGHT],
		"select-one": [KC.LEFT, KC.RIGHT],
		"select-multiple": [KC.LEFT, KC.RIGHT]
	};

/* Calculate TD column index (considering colspans).*/
function getColIdx($tr, $td) {
	var colspan,
		td = $td.get(0),
		idx = 0;

	$tr.children().each(function () {
		if( this === td ) {
			return false;
		}
		colspan = $(this).prop("colspan");
		idx += colspan ? colspan : 1;
	});
	return idx;
}

/* Find TD at given column index (considering colspans).*/
function findTdAtColIdx($tr, colIdx) {
	var colspan,
		res = null,
		idx = 0;

	$tr.children().each(function () {
		if( idx >= colIdx ) {
			res = $(this);
			return false;
		}
		colspan = $(this).prop("colspan");
		idx += colspan ? colspan : 1;
	});
	return res;
}

/* Find adjacent cell for a given direction. Skip empty cells and consider merged cells */
function findNeighbourTd($target, keyCode){
	var $tr, colIdx,
		$td = $target.closest("td"),
		$tdNext = null;

	switch( keyCode ){
		case KC.LEFT:
			$tdNext = $td.prev();
			break;
		case KC.RIGHT:
			$tdNext = $td.next();
			break;
		case KC.UP:
		case KC.DOWN:
			$tr = $td.parent();
			colIdx = getColIdx($tr, $td);
			while( true ) {
				$tr = (keyCode === KC.UP) ? $tr.prev() : $tr.next();
				if( !$tr.length ) {
					break;
				}
				// Skip hidden rows
				if( $tr.is(":hidden") ) {
					continue;
				}
				// Find adjacent cell in the same column
				$tdNext = findTdAtColIdx($tr, colIdx);
				// Skip cells that don't conatain a focusable element
				if( $tdNext && $tdNext.find(":input").length ) {
					break;
				}
			}
			break;
	}
	return $tdNext;
}

/*******************************************************************************
 * Extension code
 */
$.ui.fancytree.registerExtension({
	name: "gridnav",
	version: "0.0.1",
	// Default options for this extension.
	options: {
		autofocusInput:   false,  // Focus first embedded input if node gets activated
		handleCursorKeys: true   // Allow UP/DOWN in inputs to move to prev/next node
	},

	treeInit: function(ctx){
		// gridnav requires the table extension to be loaded before itself
		this._requireExtension("table", true, true);
		this._super(ctx);

		this.$container.addClass("fancytree-ext-gridnav");

		// Activate node if embedded input gets focus (due to a click)
		this.$container.on("focusin", function(event){
			var ctx2,
				node = $.ui.fancytree.getNode(event.target);

			if( node && !node.isActive() ){
				// Call node.setActive(), but also pass the event
				ctx2 = ctx.tree._makeHookContext(node, event);
				ctx.tree._callHook("nodeSetActive", ctx2, true);
			}
		});
	},
	nodeSetActive: function(ctx, flag) {
		var $outer,
			opts = ctx.options.gridnav,
			node = ctx.node,
			event = ctx.originalEvent || {},
			triggeredByInput = $(event.target).is(":input");

		flag = (flag !== false);

		this._super(ctx, flag);

		if( flag ){
			if( ctx.options.titlesTabbable ){
				if( !triggeredByInput ) {
					$(node.span).find("span.fancytree-title").focus();
					node.setFocus();
				}
				// If one node is tabbable, the container no longer needs to be
				ctx.tree.$container.attr("tabindex", "-1");
				// ctx.tree.$container.removeAttr("tabindex");
			} else if( opts.autofocusInput && !triggeredByInput ){
				// Set focus to input sub input (if node was clicked, but not
				// when TAB was pressed )
				$outer = $(node.tr || node.span);
				$outer.find(":input:enabled:first").focus();
			}
		}
	},
	nodeKeydown: function(ctx) {
		var inputType, handleKeys, $td,
			opts = ctx.options.gridnav,
			event = ctx.originalEvent,
			$target = $(event.target);

		// jQuery
		inputType = $target.is(":input:enabled") ? $target.prop("type") : null;
//		ctx.tree.debug("ext-gridnav nodeKeydown", event, inputType);

		if( inputType && opts.handleCursorKeys ){
			handleKeys = NAV_KEYS[inputType];
			if( handleKeys && $.inArray(event.which, handleKeys) >= 0 ){
				$td = findNeighbourTd($target, event.which);
				// ctx.node.debug("ignore keydown in input", event.which, handleKeys);
				if( $td && $td.length ) {
					$td.find(":input:enabled").focus();
					// Prevent Fancytree default navigation
					return false;
				}
			}
			return true;
		}
		ctx.tree.debug("ext-gridnav NOT HANDLED", event, inputType);
		return this._super(ctx);
	}
});
}(jQuery, window, document));


text:
const config    = require('../../config')

module.exports = (server) => {
    server.post({ path: config.basePath('/register'),
        version: '1.0.0' }, require('./v1'))
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Russula columbaria var. columbaria

### Remarks
null


text:
package zcldec

// Verify that all of our spec types implement the necessary interfaces
var objectSpecAsSpec Spec = ObjectSpec(nil)
var tupleSpecAsSpec Spec = TupleSpec(nil)
var attrSpecAsSpec Spec = (*AttrSpec)(nil)
var literalSpecAsSpec Spec = (*LiteralSpec)(nil)
var exprSpecAsSpec Spec = (*ExprSpec)(nil)
var blockSpecAsSpec Spec = (*BlockSpec)(nil)
var blockListSpecAsSpec Spec = (*BlockListSpec)(nil)
var blockSetSpecAsSpec Spec = (*BlockSetSpec)(nil)
var blockMapSpecAsSpec Spec = (*BlockMapSpec)(nil)
var blockLabelSpecAsSpec Spec = (*BlockLabelSpec)(nil)


text:
package com.mapswithme.maps.maplayer.isolines;

import android.app.Application;

import androidx.annotation.NonNull;
import com.mapswithme.maps.base.Detachable;

class OnIsolinesChangedListenerImpl implements OnIsolinesChangedListener, Detachable<IsolinesErrorDialogListener>
{
  @NonNull
  private final Application mApp;
  private IsolinesErrorDialogListener mListener;

  OnIsolinesChangedListenerImpl(@NonNull Application app)
  {
    mApp = app;
  }

  @Override
  public void onStateChanged(int type)
  {
    IsolinesState state = IsolinesState.values()[type];
    if (mListener == null)
    {
      state.activate(mApp, null, null);
      return;
    }

    mListener.onStateChanged(state);
  }

  @Override
  public void attach(@NonNull IsolinesErrorDialogListener listener)
  {
    mListener = listener;
  }

  @Override
  public void detach()
  {
    mListener = null;
  }
}


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
com.hazelcast.replicatedmap.impl.operation (Hazelcast Root 3.4.2 API)
</TITLE>

<META NAME="date" CONTENT="2015-03-26">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Package com.hazelcast.replicatedmap.impl.operation

This package contains some remote operations to execute on remote nodes

See:

          Description

Class Summary

AbstractReplicatedMapOperation
Base class for replicated map remote operations

ReplicatedMapClearOperation
This operation will execute the remote clear on replicated map if
 ReplicatedMap.clear() is called.

ReplicatedMapDataSerializerHook
This class contains all the ID hooks for IdentifiedDataSerializable classes used inside the replicated map.

ReplicatedMapInitChunkOperation
Class for requesting an initial chunk of data from another node to pre-provision newly joining members

ReplicatedMapPostJoinOperation
The replicated map post join operation to execute on remote nodes

ReplicatedMapPostJoinOperation.MemberMapPair
A mapping for replicated map names and the assigned provisioning member

Package com.hazelcast.replicatedmap.impl.operation Description

This package contains some remote operations to execute on remote nodes

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.


text:
file(REMOVE_RECURSE
  "CMakeFiles/dontalign_1.dir/dontalign.cpp.o"
  "dontalign_1.pdb"
  "dontalign_1"
)

# Per-language clean rules from dependency scanning.
foreach(lang CXX)
  include(CMakeFiles/dontalign_1.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2017 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<resources>

    <style name="Base.Theme.AppCompat" parent="Base.V28.Theme.AppCompat" />
    <style name="Base.Theme.AppCompat.Light" parent="Base.V28.Theme.AppCompat.Light" />

    <style name="Base.V28.Theme.AppCompat" parent="Base.V26.Theme.AppCompat">
        <!-- We can use the platform styles on API 28+ -->
        <item name="dialogCornerRadius">?android:attr/dialogCornerRadius</item>
    </style>

    <style name="Base.V28.Theme.AppCompat.Light" parent="Base.V26.Theme.AppCompat.Light">
        <!-- We can use the platform styles on API 28+ -->
        <item name="dialogCornerRadius">?android:attr/dialogCornerRadius</item>
    </style>

</resources>


text:
var http = require('http');

var errorsContext = '/errors';
var devicesContext = '/connectedDevices';

module.exports = function(api, config) {

	/**
	 * Connect to service. Also store device info for other API usage.
	 */
	api.connect = function(userId, deviceId, done) {
		api.post(devicesContext, {
			userId : userId,
			deviceId : deviceId
		}, function(info, error) {
			config.deviceInfo = info;
			done(info, error);
			if (error) {
				api.error(error);
			}
		});
	};

	/**
	 * Get latest device info and save into config
	 */
	api.status = function(done) {
		api.put(devicesContext, config.deviceInfo, function(info, error) {
			if (info) {
				config.deviceInfo = info;
			}
			done(info, error);
			if (error) {
				api.error(error);
			}
		});
	};

	/**
	 * Report error to service
	 */
	api.error = function(errorObj) {

		if (config.isDebug) {
			console.log("Error:");
			console.log(errorObj);
		}

		var connectId = config.deviceInfo? config.deviceInfo.connectId : null;
		api.post(errorsContext, {
			connectId : connectId,
			error : errorObj
		}, function(info, error) {
			if (error && config.isDebug) {
				console.log("Could not log error: ");
				console.log(error);
			}
		});
	};
};


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

        <LinearLayout android:layout_width="fill_parent"
        android:layout_height="60dp"
        android:orientation="horizontal">

        <Button android:id="@+id/btnUme"
        android:layout_width="fill_parent"
        android:layout_height="60dp"
        android:layout_weight="1"/>

    	<TextView
    	android:id="@+id/obsahKosika"
	    android:gravity="center"
        android:layout_weight="1"
        android:textSize="17sp"
    	android:visibility="invisible"
    	android:layout_width="match_parent"
    	android:layout_height="60dp" />

    	<Button android:id="@+id/btninfo"
        android:layout_width="fill_parent"
        android:layout_height="60dp"
        android:visibility="invisible"
        android:text="@string/popisbtninfo"
        android:layout_weight="1"/>

     </LinearLayout>

    <Button android:id="@+id/btnPenden1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/popisbtnpenden"
        android:layout_marginTop="5dip"/>

    <Button android:id="@+id/btnPenden"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/popisbtnpenden2"
        android:layout_marginTop="5dip"/>

    <Button android:id="@+id/btnPrivyd"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/popisbtnprivyd"
        android:layout_marginTop="5dip"/>

    <Button android:id="@+id/btnMajzav"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/popisbtnmajzav"
        android:layout_marginTop="5dip"/>

    <Button android:id="@+id/btnKniOdb"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/popisbtnkniodb"
        android:layout_marginTop="5dip"/>

    <Button android:id="@+id/btnKniDod"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/popisbtnknidod"
        android:layout_marginTop="5dip"/>

</LinearLayout>


text:
package org.apache.commons.scxml2.env.jexl;

import org.apache.commons.scxml2.Builtin;

/**
 * Global JEXL namespace functor, providing the standard SCXML In() predicate.
 */
public final class JexlBuiltin {
    /**
     * The context currently in use for evaluation.
     */
    private final JexlContext context;

    /**
     * Creates a new instance, wraps the context.
     * @param ctxt the context in use
     */
    public JexlBuiltin(final JexlContext ctxt) {
        context = ctxt;
    }

    /**
     * Provides the SCXML standard In() predicate for SCXML documents.
     * @param state The State ID to compare with
     * @return true if this state is currently active
     */
    public boolean In(final String state) {
        return Builtin.isMember(context, state);
    }
}


text:
package evaluation

/**
 * @author Philipp
 */
object RestService {

	val host = "jsonplaceholder.typicode.com"

	val postUrl = s"$host/posts"

}


text:
namespace
{

using namespace armnnUtils;

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchNormTestImpl(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory,
    const armnn::TensorShape& inputOutputTensorShape,
    const std::vector<float>& inputValues,
    const std::vector<float>& expectedOutputValues,
    float qScale,
    int32_t qOffset,
    armnn::DataLayout dataLayout)
{
    IgnoreUnused(memoryManager);
    armnn::TensorInfo inputTensorInfo(inputOutputTensorShape, ArmnnType);
    armnn::TensorInfo outputTensorInfo(inputOutputTensorShape, ArmnnType);

    armnnUtils::DataLayoutIndexed dataLayoutIndexed(dataLayout);

    armnn::TensorInfo tensorInfo({ inputOutputTensorShape[dataLayoutIndexed.GetChannelsIndex()] },
                                 ArmnnType);

    // Set quantization parameters if the requested type is a quantized type.
    if (armnn::IsQuantizedType<T>())
    {
        inputTensorInfo.SetQuantizationScale(qScale);
        inputTensorInfo.SetQuantizationOffset(qOffset);
        outputTensorInfo.SetQuantizationScale(qScale);
        outputTensorInfo.SetQuantizationOffset(qOffset);
        tensorInfo.SetQuantizationScale(qScale);
        tensorInfo.SetQuantizationOffset(qOffset);
    }

    auto inputTensor = QuantizedVector<T>(inputValues, qScale, qOffset);

    // These values are per-channel of the input.
    auto mean     = QuantizedVector<T>({ 3, -2 }, qScale, qOffset);
    auto variance = QuantizedVector<T>({ 4,  9 }, qScale, qOffset);
    auto beta     = QuantizedVector<T>({ 3,  2 }, qScale, qOffset);
    auto gamma    = QuantizedVector<T>({ 2,  1 }, qScale, qOffset);

    std::vector<T> actualOutput(outputTensorInfo.GetNumElements());
    std::vector<T> expectedOutput = QuantizedVector<T>(expectedOutputValues, qScale, qOffset);

    std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo);
    std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo);

    armnn::ScopedTensorHandle meanTensor(tensorInfo);
    armnn::ScopedTensorHandle varianceTensor(tensorInfo);
    armnn::ScopedTensorHandle betaTensor(tensorInfo);
    armnn::ScopedTensorHandle gammaTensor(tensorInfo);

    armnn::BatchNormalizationQueueDescriptor descriptor;
    descriptor.m_Mean                    = &meanTensor;
    descriptor.m_Variance                = &varianceTensor;
    descriptor.m_Beta                    = &betaTensor;
    descriptor.m_Gamma                   = &gammaTensor;
    descriptor.m_Parameters.m_Eps        = 0.0f;
    descriptor.m_Parameters.m_DataLayout = dataLayout;
    armnn::WorkloadInfo info;

    AllocateAndCopyDataToITensorHandle(&meanTensor, mean.data());
    AllocateAndCopyDataToITensorHandle(&varianceTensor, variance.data());
    AllocateAndCopyDataToITensorHandle(&betaTensor, beta.data());
    AllocateAndCopyDataToITensorHandle(&gammaTensor, gamma.data());

    AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get());
    AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get());

    std::unique_ptr<armnn::IWorkload> workload
            = workloadFactory.CreateWorkload(armnn::LayerType::BatchNormalization, descriptor, info);

    inputHandle->Allocate();
    outputHandle->Allocate();

    CopyDataToITensorHandle(inputHandle.get(), inputTensor.data());

    workload->Execute();

    CopyDataFromITensorHandle(actualOutput.data(), outputHandle.get());

    return LayerTestResult<T, 4>(actualOutput,
                                 expectedOutput,
                                 outputHandle->GetShape(),
                                 outputTensorInfo.GetShape());
}

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T,4> BatchNormTestNhwcImpl(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory,
    float qScale,
    int32_t qOffset)
{
    IgnoreUnused(memoryManager);

    const unsigned int width    = 2;
    const unsigned int height   = 3;
    const unsigned int channels = 2;
    const unsigned int num      = 1;

    armnn::TensorInfo inputTensorInfo({num, height, width, channels}, ArmnnType);
    armnn::TensorInfo outputTensorInfo({num, height, width, channels}, ArmnnType);
    armnn::TensorInfo tensorInfo({channels}, ArmnnType);

    // Set quantization parameters if the requested type is a quantized type.
    if(armnn::IsQuantizedType<T>())
    {
        inputTensorInfo.SetQuantizationScale(qScale);
        inputTensorInfo.SetQuantizationOffset(qOffset);
        outputTensorInfo.SetQuantizationScale(qScale);
        outputTensorInfo.SetQuantizationOffset(qOffset);
        tensorInfo.SetQuantizationScale(qScale);
        tensorInfo.SetQuantizationOffset(qOffset);
    }

    auto input = QuantizedVector<T>(
        {
            1.f, 1.f, 4.f, 1.f,
            4.f, 4.f, 2.f, 1.f,
            1.f, -2.f, 6.f, 4.f
        },
        qScale, qOffset);

    // These values are per-channel of the input.
    auto mean     = QuantizedVector<T>({ 3, -2 }, qScale, qOffset);
    auto variance = QuantizedVector<T>({ 4,  9 }, qScale, qOffset);
    auto beta     = QuantizedVector<T>({ 3,  2 }, qScale, qOffset);
    auto gamma    = QuantizedVector<T>({ 2,  1 }, qScale, qOffset);

    std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo);
    std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo);

    armnn::BatchNormalizationQueueDescriptor data;
    armnn::WorkloadInfo info;
    armnn::ScopedTensorHandle meanTensor(tensorInfo);
    armnn::ScopedTensorHandle varianceTensor(tensorInfo);
    armnn::ScopedTensorHandle betaTensor(tensorInfo);
    armnn::ScopedTensorHandle gammaTensor(tensorInfo);

    AllocateAndCopyDataToITensorHandle(&meanTensor, &mean[0]);
    AllocateAndCopyDataToITensorHandle(&varianceTensor, &variance[0]);
    AllocateAndCopyDataToITensorHandle(&betaTensor, &beta[0]);
    AllocateAndCopyDataToITensorHandle(&gammaTensor, &gamma[0]);

    AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
    AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
    data.m_Mean             = &meanTensor;
    data.m_Variance         = &varianceTensor;
    data.m_Beta             = &betaTensor;
    data.m_Gamma            = &gammaTensor;
    data.m_Parameters.m_Eps = 0.0f;
    data.m_Parameters.m_DataLayout = armnn::DataLayout::NHWC;

    std::vector<T> actualOutput(outputTensorInfo.GetNumElements());

    // For each channel:
    // substract mean, divide by standard deviation (with an epsilon to avoid div by 0),
    // multiply by gamma and add beta
    std::vector<T> expectedOutput = QuantizedVector<T>(
        {
            1.f, 3.f, 4.f, 3.f,
            4.f, 4.f, 2.f, 3.f,
            1.f, 2.f, 6.f, 4.f
        },
        qScale, qOffset);

    std::unique_ptr<armnn::IWorkload> workload
            = workloadFactory.CreateWorkload(armnn::LayerType::BatchNormalization, data, info);

    inputHandle->Allocate();
    outputHandle->Allocate();

    CopyDataToITensorHandle(inputHandle.get(), input.data());

    workload->Execute();

    CopyDataFromITensorHandle(actualOutput.data(), outputHandle.get());

    return LayerTestResult<T, 4>(actualOutput,
                                 expectedOutput,
                                 outputHandle->GetShape(),
                                 outputTensorInfo.GetShape());
}

} // anonymous namespace

LayerTestResult<float, 4> BatchNormFloat32Test(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Channels: 2
    // Height: 3
    // Width: 2

    const armnn::TensorShape inputOutputShape{ 1, 2, 3, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
         1.f, 4.f,
         4.f, 2.f,
         1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
         1.f, 1.f,
         4.f, 1.f,
        -2.f, 4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
        1.f, 4.f,
        4.f, 2.f,
        1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
        3.f, 3.f,
        4.f, 3.f,
        2.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::Float32>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape,
        inputValues,
        expectedOutputValues,
        0.f,
        0,
        armnn::DataLayout::NCHW);
}

LayerTestResult<float, 4> BatchNormFloat32NhwcTest(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Height: 3
    // Width: 2
    // Channels: 2

    const armnn::TensorShape inputOutputShape{ 1, 3, 2, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f,  1.f,
        4.f,  1.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f,  4.f,
        2.f,  1.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, -2.f,
        6.f,  4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f, 3.f,
        4.f, 3.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f, 4.f,
        2.f, 3.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, 2.f,
        6.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::Float32>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape,
        inputValues,
        expectedOutputValues,
        0.f,
        0,
        armnn::DataLayout::NHWC);
}

LayerTestResult<armnn::Half, 4> BatchNormFloat16Test(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Channels: 2
    // Height: 3
    // Width: 2

    const armnn::TensorShape inputOutputShape{ 1, 2, 3, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
         1.f, 4.f,
         4.f, 2.f,
         1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
         1.f, 1.f,
         4.f, 1.f,
        -2.f, 4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
        1.f, 4.f,
        4.f, 2.f,
        1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
        3.f, 3.f,
        4.f, 3.f,
        2.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::Float16>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape,
        inputValues,
        expectedOutputValues,
        0.f,
        0,
        armnn::DataLayout::NCHW);
}

LayerTestResult<armnn::Half, 4> BatchNormFloat16NhwcTest(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Height: 3
    // Width: 2
    // Channels: 2

    const armnn::TensorShape inputOutputShape{ 1, 3, 2, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f,  1.f,
        4.f,  1.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f,  4.f,
        2.f,  1.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, -2.f,
        6.f,  4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f, 3.f,
        4.f, 3.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f, 4.f,
        2.f, 3.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, 2.f,
        6.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::Float16>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape,
        inputValues,
        expectedOutputValues,
        0.f,
        0,
        armnn::DataLayout::NHWC);
}

LayerTestResult<uint8_t, 4> BatchNormUint8Test(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Channels: 2
    // Height: 3
    // Width: 2

    const armnn::TensorShape inputOutputShape{ 1, 2, 3, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
         1.f, 4.f,
         4.f, 2.f,
         1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
         1.f, 1.f,
         4.f, 1.f,
        -2.f, 4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
        1.f, 4.f,
        4.f, 2.f,
        1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
        3.f, 3.f,
        4.f, 3.f,
        2.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::QAsymmU8>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape,
        inputValues,
        expectedOutputValues,
        1.f / 20.f,
        50,
        armnn::DataLayout::NCHW);
}

LayerTestResult<uint8_t, 4> BatchNormUint8NhwcTest(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Height: 3
    // Width: 2
    // Channels: 2

    const armnn::TensorShape inputOutputShape{ 1, 3, 2, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f,  1.f,
        4.f,  1.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f,  4.f,
        2.f,  1.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, -2.f,
        6.f,  4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f, 3.f,
        4.f, 3.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f, 4.f,
        2.f, 3.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, 2.f,
        6.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::QAsymmU8>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape, inputValues, expectedOutputValues,
         1.f/20.f, 50, armnn::DataLayout::NHWC);
}

LayerTestResult<int16_t, 4> BatchNormInt16Test(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Channels: 2
    // Height: 3
    // Width: 2

    const armnn::TensorShape inputOutputShape{ 1, 2, 3, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
         1.f, 4.f,
         4.f, 2.f,
         1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
         1.f, 1.f,
         4.f, 1.f,
        -2.f, 4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Channel 0, Height (3) x Width (2)
        1.f, 4.f,
        4.f, 2.f,
        1.f, 6.f,

        // Batch 0, Channel 1, Height (3) x Width (2)
        3.f, 3.f,
        4.f, 3.f,
        2.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::QSymmS16>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape,
        inputValues,
        expectedOutputValues,
        1.f / 20.f,
        50,
        armnn::DataLayout::NCHW);
}

LayerTestResult<int16_t, 4> BatchNormInt16NhwcTest(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    const armnn::ITensorHandleFactory& tensorHandleFactory)
{
    // BatchSize: 1
    // Height: 3
    // Width: 2
    // Channels: 2

    const armnn::TensorShape inputOutputShape{ 1, 3, 2, 2 };
    std::vector<float> inputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f,  1.f,
        4.f,  1.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f,  4.f,
        2.f,  1.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, -2.f,
        6.f,  4.f
    };
    std::vector<float> expectedOutputValues
    {
        // Batch 0, Height 0, Width (2) x Channel (2)
        1.f, 3.f,
        4.f, 3.f,

        // Batch 0, Height 1, Width (2) x Channel (2)
        4.f, 4.f,
        2.f, 3.f,

        // Batch 0, Height 2, Width (2) x Channel (2)
        1.f, 2.f,
        6.f, 4.f
    };

    return BatchNormTestImpl<armnn::DataType::QSymmS16>(
        workloadFactory,
        memoryManager,
        tensorHandleFactory,
        inputOutputShape,
        inputValues,
        expectedOutputValues,
        1.f / 20.f,
        50,
        armnn::DataLayout::NHWC);
}

LayerTestResult<float,4> CompareBatchNormTest(
    armnn::IWorkloadFactory& workloadFactory,
    const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
    armnn::IWorkloadFactory& refWorkloadFactory,
    const armnn::ITensorHandleFactory& tensorHandleFactory,
    const armnn::ITensorHandleFactory& refTensorHandleFactory)
{
    IgnoreUnused(memoryManager);
    const unsigned int width     = 2;
    const unsigned int height    = 3;
    const unsigned int channels  = 5;
    const unsigned int batchSize = 3;

    armnn::TensorInfo inputTensorInfo;
    armnn::TensorInfo outputTensorInfo;
    armnn::TensorInfo tensorInfo;

    constexpr unsigned int shape[]       = {batchSize, channels, height, width};
    constexpr unsigned int tensorShape[] = {channels};

    inputTensorInfo = armnn::TensorInfo(4, shape, armnn::DataType::Float32);
    outputTensorInfo = armnn::TensorInfo(4, shape, armnn::DataType::Float32);
    tensorInfo = armnn::TensorInfo(1, tensorShape, armnn::DataType::Float32);

    auto input = MakeRandomTensor<float>(inputTensorInfo, 21312);

    auto mean     = MakeRandomTensor<float>(tensorInfo, 123);
    auto variance = MakeRandomTensor<float>(tensorInfo, 234, 0.0f);
    auto beta     = MakeRandomTensor<float>(tensorInfo, 123);
    auto gamma    = MakeRandomTensor<float>(tensorInfo, 345);

    std::vector<float> actualOutput(outputTensorInfo.GetNumElements());
    std::vector<float> expectedOutput(outputTensorInfo.GetNumElements());

    std::unique_ptr<armnn::ITensorHandle> inputHandle  = tensorHandleFactory.CreateTensorHandle(inputTensorInfo);
    std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo);

    std::unique_ptr<armnn::ITensorHandle> inputHandleRef  = refTensorHandleFactory.CreateTensorHandle(inputTensorInfo);
    std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refTensorHandleFactory.CreateTensorHandle(outputTensorInfo);

    armnn::BatchNormalizationQueueDescriptor data;
    armnn::WorkloadInfo info;
    armnn::ScopedTensorHandle meanTensor(tensorInfo);
    armnn::ScopedTensorHandle varianceTensor(tensorInfo);
    armnn::ScopedTensorHandle betaTensor(tensorInfo);
    armnn::ScopedTensorHandle gammaTensor(tensorInfo);

    AllocateAndCopyDataToITensorHandle(&meanTensor, &mean[0]);
    AllocateAndCopyDataToITensorHandle(&varianceTensor, &variance[0]);
    AllocateAndCopyDataToITensorHandle(&betaTensor, &beta[0]);
    AllocateAndCopyDataToITensorHandle(&gammaTensor, &gamma[0]);

    AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
    AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
    data.m_Mean             = &meanTensor;
    data.m_Variance         = &varianceTensor;
    data.m_Beta             = &betaTensor;
    data.m_Gamma            = &gammaTensor;
    data.m_Parameters.m_Eps = 0.01f;

    armnn::BatchNormalizationQueueDescriptor refData = data;
    armnn::WorkloadInfo refInfo = info;
    SetWorkloadInput(refData, refInfo, 0, inputTensorInfo, inputHandleRef.get());
    SetWorkloadOutput(refData, refInfo, 0, outputTensorInfo, outputHandleRef.get());

    std::unique_ptr<armnn::IWorkload> workload
            = workloadFactory.CreateWorkload(armnn::LayerType::BatchNormalization, data, info);
    std::unique_ptr<armnn::IWorkload> workloadRef
            = refWorkloadFactory.CreateWorkload(armnn::LayerType::BatchNormalization, refData, refInfo);

    inputHandle->Allocate();
    outputHandle->Allocate();
    inputHandleRef->Allocate();
    outputHandleRef->Allocate();

    CopyDataToITensorHandle(inputHandle.get(), input.data());
    CopyDataToITensorHandle(inputHandleRef.get(), input.data());

    workload->PostAllocationConfigure();
    workload->Execute();
    workloadRef->PostAllocationConfigure();
    workloadRef->Execute();

    CopyDataFromITensorHandle(actualOutput.data(), outputHandle.get());
    CopyDataFromITensorHandle(expectedOutput.data(), outputHandleRef.get());

    return LayerTestResult<float, 4>(actualOutput,
                                     expectedOutput,
                                     outputHandle->GetShape(),
                                     outputTensorInfo.GetShape());
}


text:
package org.springframework.cloud.stream.binder.redis;

import static org.junit.Assert.assertEquals;

import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import org.springframework.cloud.stream.binder.BinderTestUtils;
import org.springframework.cloud.stream.test.junit.redis.RedisTestSupport;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.Topic;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
import org.springframework.data.redis.serializer.GenericToStringSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.integration.redis.outbound.RedisPublishingMessageHandler;
import org.springframework.integration.support.MessageBuilder;

/**
 * Temporary copy of SI RedisPublishingMessageHandlerTests that adds tests that publish messages with data types other
 * than String
 *
 * @author Mark Fisher
 * @author Jennifer Hickey
 * @author Gary Russell
 */
public class RedisPublishingMessageHandlerTests {

	private static final String TOPIC = "si.test.channel";

	private static final int NUM_MESSAGES = 10;

	private RedisConnectionFactory connectionFactory;

	private RedisMessageListenerContainer container;

	private CountDownLatch latch = new CountDownLatch(NUM_MESSAGES);

	@Rule
	public RedisTestSupport redisAvailableRule = new RedisTestSupport();

	@Before
	public void setUp() {
		this.connectionFactory = redisAvailableRule.getResource();
	}

	@Test
	public void testWithDefaultSerializer() throws Exception {
		setupListener(new StringRedisSerializer());
		final RedisPublishingMessageHandler handler = new RedisPublishingMessageHandler(connectionFactory);
		handler.setBeanFactory(BinderTestUtils.MOCK_BF);
		handler.setTopic(TOPIC);
		handler.afterPropertiesSet();
		for (int i = 0; i < NUM_MESSAGES; i++) {
			handler.handleMessage(MessageBuilder.withPayload("test-" + i).build());
		}
		latch.await(3, TimeUnit.SECONDS);
		assertEquals(0, latch.getCount());
		container.stop();
	}

	@Test
	public void testWithNoSerializer() throws Exception {
		setupListener(null);
		final RedisPublishingMessageHandler handler = new RedisPublishingMessageHandler(connectionFactory);
		handler.setBeanFactory(BinderTestUtils.MOCK_BF);
		handler.setTopic(TOPIC);
		handler.afterPropertiesSet();
		for (int i = 0; i < NUM_MESSAGES; i++) {
			handler.handleMessage(MessageBuilder.withPayload(new String("test-" + i).getBytes()).build());
		}
		latch.await(3, TimeUnit.SECONDS);
		assertEquals(0, latch.getCount());
		container.stop();
	}

	@Test
	public void testWithCustomSerializer() throws Exception {
		GenericToStringSerializer<Long> serializer = new GenericToStringSerializer<Long>(Long.class);
		setupListener(serializer);
		final RedisPublishingMessageHandler handler = new RedisPublishingMessageHandler(connectionFactory);
		handler.setBeanFactory(BinderTestUtils.MOCK_BF);
		handler.setTopic(TOPIC);
		handler.setSerializer(serializer);
		handler.afterPropertiesSet();
		for (long i = 0; i < NUM_MESSAGES; i++) {
			handler.handleMessage(MessageBuilder.withPayload(i).build());
		}
		latch.await(3, TimeUnit.SECONDS);
		assertEquals(0, latch.getCount());
		container.stop();
	}

	private void setupListener(RedisSerializer<?> listenerSerializer) throws InterruptedException {
		MessageListenerAdapter listener = new MessageListenerAdapter();
		listener.setDelegate(new Listener(latch));
		listener.setSerializer(listenerSerializer);
		listener.afterPropertiesSet();

		this.container = new RedisMessageListenerContainer();
		container.setConnectionFactory(connectionFactory);
		container.afterPropertiesSet();
		container.addMessageListener(listener, Collections.<Topic> singletonList(new ChannelTopic(TOPIC)));
		container.start();
		Thread.sleep(1000);
	}

	private static class Listener {

		private final CountDownLatch latch;

		private Listener(CountDownLatch latch) {
			this.latch = latch;
		}

		@SuppressWarnings("unused")
		public void handleMessage(Object s) {
			this.latch.countDown();
		}
	}

}