text:
// Local VOTCA includes
#include "votca/xtp/cudapipeline.h"
#include <stdexcept>
#include <string>

namespace votca {
namespace xtp {

CudaPipeline::~CudaPipeline() {

  // destroy handle
  cublasDestroy(handle_);
  // destroy stream
  cudaStreamDestroy(stream_);
}

void CudaPipeline::axpy(const CudaMatrix &A, CudaMatrix &B,
                        double alpha) const {

  if (A.rows() != B.rows() || A.cols() != B.cols()) {
    throw std::runtime_error("Shape mismatch in cuda axpy");
  }

  cublasSetStream(handle_, stream_);
  cublasStatus_t status =
      cublasDaxpy(handle_, int(A.size()), &alpha, A.data(), 1, B.data(), 1);

  if (status != CUBLAS_STATUS_SUCCESS) {
    throw std::runtime_error("axpy failed on gpu " + std::to_string(deviceID_) +
                             " with errorcode:" + cudaGetErrorEnum(status));
  }
}

}  // namespace xtp
}  // namespace votca


text:
WiFiUDP udp;
uint8_t packetbuf[256];
static uint8_t scratch_raw[32];
static coap_rw_buffer_t scratch_buf = {scratch_raw, sizeof(scratch_raw)};

void setupCoapServer(const coap_endpoint_t *endpoints) {
  udp.begin(PORT);

  coap_setup();
  endpointSetup(endpoints);
}

void udpSend(const uint8_t *buf, int buflen){
    udp.beginPacket(udp.remoteIP(), udp.remotePort());
    while(buflen--) {
        udp.write(*buf++);
    }
    udp.endPacket();
}

void listenCoapServer(void) {

      int sz;
      int rc;
      coap_packet_t pkt;
      int i;

      if ((sz = udp.parsePacket()) > 0) {
          udp.read(packetbuf, sizeof(packetbuf));

          if (0 != (rc = coap_parse(&pkt, packetbuf, sz))) {
              Serial.print("Bad packet rc=");
              Serial.println(rc, DEC);
          } else {
              size_t rsplen = sizeof(packetbuf);
              coap_packet_t rsppkt;
              coap_handle_req(&scratch_buf, &pkt, &rsppkt);

              if (0 != (rc = coap_build(packetbuf, &rsplen, &rsppkt))) {
                  Serial.print("coap_build failed rc=");
                  Serial.println(rc, DEC);
              } else {
                  udpSend(packetbuf, rsplen);
              }
          }
      }
}

redpajama_set_name: RedPajamaGithub


text: export * from './comment.service';


text:
drop if exists tb1,tb2,foo,t1;
create class tb1 ( a set(char(2)));
create class tb2 ( b set(nchar(2)));
insert into tb1 values({'a1'});
insert into tb2 values({n'a1'});
select a,b from tb1, tb2 where a seteq b order by 1,2;
create table foo as WITH cte AS
(
select a,b from tb1, tb2 where a setneq b order by 1,2
)
select * from cte;
select * from foo;
drop table foo;
select cast(NULL as numeric(38,10));
create table foo as WITH cte AS
(
select cast(cast('' as char(10)) as numeric(38,10)) as [ cast( cast('' as char(10)) as numeric(38,10))]
)
select * from cte;
describe foo;
drop table foo;
create table foo as WITH cte AS
(
select cast(NULL as numeric(38,10)) as [ cast(null as numeric(38,10))]
)
select * from cte;
describe foo;

drop table foo;
create table foo as select * from
(
select cast(cast('' as char(10)) as numeric(38,10))
) cte;
describe foo;

drop table foo;
create table t1(
c_short short,
c_int int,
c_bigint bigint,
c_date date,
c_time time,
c_timestamp timestamp,
c_datetime datetime,
c_timestampltz timestamp with local time zone,
c_timestamptz timestamp with time zone,
c_datetimeltz datetime with local time zone,
c_datetimetz datetime with time zone
);

insert into t1 values(
10, 99, 123456789,
date'2020-12-12', time'23:59:59', timestamp'1999-04-23 14:35:56', datetime'1999-04-23 14:35:56.789',
timestampltz'2033-10-01 12:13:14 -12:00', timestamptz'2033-10-01 12:13:14 Europe/Riga',
datetimeltz'1823-12-31 23:59:59 +14:00', datetimetz'2099-11-23 12:00:00 AM Australia/Eucla'
);

select REPEAT( c_date, c_bigint ) from t1;

drop table if exists foo;
create table foo as WITH cte AS
(
select REPEAT( c_time, c_bigint ) as a from t1
)
select * from cte;
describe foo;

drop table if exists foo;
create table foo as select * from (select REPEAT( c_time, c_bigint ) as a from t1) cte;
describe foo;

drop table if exists foo;
create table foo as WITH cte AS
(
select REPEAT( c_time, c_int ) as [repeat( cast(t1.c_time as varchar), t1.c_int)] from t1
)
select * from cte;
select * from foo order by 1;
drop if exists tb1,tb2,foo,t1;


text:
@extends('back.template')

@section('main')

	@include('back.partials.entete', ['title' => trans('back/objects.dashboard'), 'icone' => 'file', 'fil' => link_to('specialty', trans('back/objects.dashboard')) . ' / ' . trans('back/objects.creation')])

	<div class="col-sm-12">
		{!! Form::open(['url' => 'objects', 'method' => 'post', 'class' => 'form-horizontal panel']) !!}
		{!! Form::control('text', 0, 'name', $errors, trans('back/objects.name')) !!}
		{!! Form::selection('specialty_id', $select, null, trans('back/objects.specialty')) !!}
		{!! Form::selection('user_id', $select_user, null, trans('back/objects.user')) !!}
		{!! Form::control('textarea', 0, 'description', $errors, trans('back/objects.description')) !!}

		{!! Form::submit(trans('front/form.send')) !!}
		{!! Form::close() !!}
	</div>

@stop

@section('scripts')

	{!! HTML::script('ckeditor/ckeditor.js') !!}

	<script>

		var config = {
			codeSnippet_theme: 'kama',
			language: '{{ config('app.locale') }}',
			height: 600,
			filebrowserBrowseUrl: '{!! url($url) !!}',
			toolbarGroups: [
				{ name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
				{ name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
				{ name: 'links' },
				{ name: 'insert' },
				{ name: 'forms' },
				{ name: 'tools' },
				{ name: 'document',	   groups: [ 'mode', 'document', 'doctools' ] },
				{ name: 'others' },
				//'/',
				{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
				{ name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
				{ name: 'styles' },
				{ name: 'colors' }
			]
		};

		CKEDITOR.replace( 'description', config);

	</script>

@stop


text:
package priv.valueyouth.rhymemusic.dependence;

/**
 * Created by gergun on 13/05/15.
 */
public interface OnBlurCompleteListener {

    public void onBlurComplete();
}


text:
package main

import (
	"fmt"
	"github.com/docopt/docopt-go"
)

func main() {
	usage := `Usage: counted_example --help
       counted_example -v...
       counted_example go [go]
       counted_example (--path=<path>)...
       counted_example <file> <file>

Try: counted_example -vvvvvvvvvv
     counted_example go go
     counted_example --path ./here --path ./there
     counted_example this.txt that.txt`

	arguments, _ := docopt.Parse(usage, nil, true, "", false)
	fmt.Println(arguments)
}


text:
/**
 * @node isn't quite ready yet... recess isn't 100% ready for linting
 */
var fs   = require('fs'),
    temp = require('temp'),
    test = require('recess-tap'),

    ds   = require('../../index.js');

temp.track();

temp.mkdir('diy-core-styles-test', function (err, dirPath) {
    ds.css(function (err, css) {
        fs.writeFileSync(dirPath + '/index.css', css);

        test(dirPath + '/index.css');
    });
});


text:
<?php

namespace AppBundle\Form;

use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class EditConnectionRequestType extends ConnectionRequestType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $builder
            ->add('wantToLearn', ChoiceType::class, [
                'expanded' => true,
                'label' => 'user.form.want_to_learn',
                'choices' => [
                    'user.form.want_to_learn.choice.learn' => true,
                    'user.form.want_to_learn.choice.teach' => false,
                ],
                'choice_value' => function ($currentChoiceKey) {
                    return $currentChoiceKey ? 'true' : 'false';
                }
            ])
        ;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);
    }

    public function getName()
    {
        return 'edit_connection_request';
    }
}


text:
package mobi.cangol.mobile.service.analytics;

import java.util.Map;

/**
 * @author Cangol
 */

abstract class ITrackerHandler {
    abstract void send(ITracker iTracker, String url, Map<String, String> paramMap);
}


text:
package org.mybatis.generator.codegen.mybatis3.xmlmapper.elements;

import java.util.List;

import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.codegen.mybatis3.ListUtilities;
import org.mybatis.generator.codegen.mybatis3.MyBatis3FormattingUtilities;
import org.mybatis.generator.internal.util.SetIgnoreUtil;

/**
 *
 * @author Jeff Butler
 *
 */
public class UpdateByPrimaryKeySelectiveElementGenerator extends
        AbstractXmlElementGenerator {

    public UpdateByPrimaryKeySelectiveElementGenerator() {
        super();
    }

    @Override
    public void addElements(XmlElement parentElement) {
        XmlElement answer = new XmlElement("update"); //$NON-NLS-1$

        answer.addAttribute(new Attribute(
                "id", introspectedTable.getUpdateByPrimaryKeySelectiveStatementId())); //$NON-NLS-1$

        String parameterType;

        if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
            parameterType = introspectedTable.getRecordWithBLOBsType();
        } else {
            parameterType = introspectedTable.getBaseRecordType();
        }

        answer.addAttribute(new Attribute("parameterType", //$NON-NLS-1$
                parameterType));

        context.getCommentGenerator().addComment(answer);

        StringBuilder sb = new StringBuilder();

        sb.append("UPDATE "); //$NON-NLS-1$
        sb.append(introspectedTable.getFullyQualifiedTableNameAtRuntime());
        answer.addElement(new TextElement(sb.toString()));

        XmlElement dynamicElement = new XmlElement("set"); //$NON-NLS-1$
        answer.addElement(dynamicElement);
        List<String> iicList = SetIgnoreUtil.getInsertIgnoreColumns(context);
        for (IntrospectedColumn introspectedColumn : ListUtilities.removeGeneratedAlwaysColumns(introspectedTable
                .getNonPrimaryKeyColumns(), iicList)) {
            sb.setLength(0);
            sb.append(introspectedColumn.getJavaProperty());
            sb.append(getCheckPrimitiveString(introspectedColumn));
            XmlElement isNotNullElement = new XmlElement("if"); //$NON-NLS-1$
            isNotNullElement.addAttribute(new Attribute("test", sb.toString())); //$NON-NLS-1$
            dynamicElement.addElement(isNotNullElement);

            sb.setLength(0);
            sb.append(MyBatis3FormattingUtilities
                    .getEscapedColumnName(introspectedColumn));
            sb.append(" = "); //$NON-NLS-1$
            sb.append(MyBatis3FormattingUtilities
                    .getParameterClause(introspectedColumn));
            sb.append(',');

            isNotNullElement.addElement(new TextElement(sb.toString()));
        }

        boolean and = false;
        for (IntrospectedColumn introspectedColumn : introspectedTable
                .getPrimaryKeyColumns()) {
            sb.setLength(0);
            if (and) {
                sb.append("  AND "); //$NON-NLS-1$
            } else {
                sb.append("WHERE "); //$NON-NLS-1$
                and = true;
            }

            sb.append(MyBatis3FormattingUtilities
                    .getEscapedColumnName(introspectedColumn));
            sb.append(" = "); //$NON-NLS-1$
            sb.append(MyBatis3FormattingUtilities
                    .getParameterClause(introspectedColumn));
            answer.addElement(new TextElement(sb.toString()));
        }

        if (context.getPlugins()
                .sqlMapUpdateByPrimaryKeySelectiveElementGenerated(answer,
                        introspectedTable)) {
            parentElement.addElement(answer);
        }
    }
}


text:
git pull origin master
g++ ktsGenerator.cpp -o ktsGenerator && ./ktsGenerator -f GCA_001500185.1_NA12878_merac_PE_genomic.fna -k 23


text:
@class RVRotationView;
@protocol RVRotationViewDelegate <NSObject>

@optional

-(void)rotationViewDidStartDecelerating:(RVRotationView *)rotationView;
-(void)rotationViewDidStopDecelerating:(RVRotationView *)rotationView;

-(void)rotationViewDidStartAnimating:(RVRotationView *)rotationView;
-(void)rotationViewDidStopAnimating:(RVRotationView *)rotationView;

@end


text:
import {Component, OnInit} from '@angular/core';
import {CrisisService} from '../crisis.service';
import {ActivatedRoute, ParamMap} from '@angular/router';
import {Observable} from 'rxjs/Observable';
import {Crisis} from '../crisis';
import 'rxjs/add/operator/switchMap';

@Component({
  selector: 'app-crisis-list',
  templateUrl: './crisis-list.component.html',
  styleUrls: ['./crisis-list.component.css']
})
export class CrisisListComponent implements OnInit {

  crises$: Observable<Crisis[]>;

  selectedId: number;

  constructor(private service: CrisisService, private route: ActivatedRoute) {
  }

  ngOnInit() {
    this.crises$ = this.route.paramMap.switchMap((params: ParamMap) => {
      this.selectedId = +params.get('id');
      return this.service.getCrises();
    });
  }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Stateless.WorkflowEngine.WebConsole.ViewModels.Store
{
    public class WorkflowListModel
    {
        public Guid ConnectionId { get; set; }

        public int WorkflowCount { get; set; }
    }
}


text:
package com.puresoltechnologies.ductiledb.tinkerpop.features;

import org.apache.tinkerpop.gremlin.structure.Graph.Features.VariableFeatures;

public class DuctileVariableFeatures implements VariableFeatures {

    @Override
    public boolean supportsVariables() {
	return true;
    }

    @Override
    public boolean supportsBooleanValues() {
	return true;
    }

    @Override
    public boolean supportsByteValues() {
	return true;
    }

    @Override
    public boolean supportsDoubleValues() {
	return true;
    }

    @Override
    public boolean supportsFloatValues() {
	return true;
    }

    @Override
    public boolean supportsIntegerValues() {
	return true;
    }

    @Override
    public boolean supportsLongValues() {
	return true;
    }

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

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

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

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

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

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

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

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

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

    @Override
    public boolean supportsSerializableValues() {
	return true;
    }

    @Override
    public boolean supportsStringValues() {
	return true;
    }

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

}


text:
package server

// Counter is the metric interface used by this package
type Counter interface {
	Inc(i int64)
}

type nopCounter struct{}

func (nopCounter) Inc(_ int64) {}

var (
	StatsForwardCount     Counter = nopCounter{}
	StatsStubForwardCount Counter = nopCounter{}
	StatsLookupCount      Counter = nopCounter{}
	StatsRequestCount     Counter = nopCounter{}
	StatsDnssecOkCount    Counter = nopCounter{}
	StatsNameErrorCount   Counter = nopCounter{}
	StatsNoDataCount      Counter = nopCounter{}

	StatsDnssecCacheMiss Counter = nopCounter{}

	StatsCacheMiss Counter = nopCounter{}
	StatsCacheHit  Counter = nopCounter{}
)


text:
module Data.BinaryTree where

import Data.Interface.Sequence

data BinTree a
  = Empty
  | Leaf  a
  | Node (BinTree a) (BinTree a)

instance Sequence BinTree where
  empty = Empty
  singleton c = Leaf c
  (.><) = Node
  viewl Empty = EmptyL
  viewl (Leaf c) = c :< Empty
  viewl (Node (Node l m) r) = viewl (Node l (Node m r))
  viewl (Node (Leaf c) r)   = c :< r
  viewl (Node Empty r)      = viewl r


text:
<phpunit
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd"
    executionOrder="duration"
>
    <testsuites>
        <testsuite name="order-by-duration">
            <file>./TestWithDifferentDurations.php</file>
        </testsuite>
    </testsuites>
</phpunit>


text:
require "#{Rails.root}/app/services/node_change_event.rb"
require "#{Rails.root}/app/services/node_change_history.rb"

class ChangeHistory < ChangeHistoryUuids
  extend RedisHelper

  def self.log(uuid:, author:, data:, batch_id: nil)
    if batch_id.nil?
      NodeChangeHistory.new(uuid).log(author, data)
    else
      @waiting ||= {}
      @waiting[batch_id] ||= []
      @waiting[batch_id] << { uuid: uuid, author: author, data: data }
    end
  end

  def self.commit_batch(batch_id)
    return if @waiting.nil? || @waiting[batch_id].nil?

    @waiting[batch_id].each do |commit|
      log(uuid: commit[:uuid], author: commit[:author], data: commit[:data])
    end
    delete_batch(batch_id)
  end

  def self.delete_batch(batch_id)
    return if @waiting.nil? || @waiting[batch_id].nil?

    @waiting.delete(batch_id)
  end

  def self.get(*args)
    NodeChangeHistory.new(args[0]).get(args[1])
  end

  def self.get_complete(uuid)
    NodeChangeHistory.new(uuid).get_complete
  end

  def self.create_batch_id; SecureRandom.uuid; end

  def self.upload_all
    uuids.each { |uuid| NodeChangeHistory.new(uuid).upload }
  end

  def self.purge_all(limit)
    uuids.each { |uuid| NodeChangeHistory.new(uuid).purge(limit) }
  end

  def self.erase_all
    uuids.each { |uuid| NodeChangeHistory.new(uuid).erase }
  end
end


text:
using OneBoxDeployment.Api.Dtos;
using OneBoxDeployment.IntegrationTests.HttpClients;
using Microsoft.Extensions.DependencyInjection;
using System.Net;
using System.Threading.Tasks;
using Xunit;
using Xunit.Extensions.Ordering;

namespace OneBoxDeployment.IntegrationTests.Tests
{
    /// <summary>
    /// Tests reading and writing Content-Security-Policy (CSP) reports.
    /// </summary>
    public sealed class CspReportTests: IAssemblyFixture<IntegrationTestFixture>
    {

        /// <summary>
        /// The preconfigured client to call the specifically constructed, faulty route.
        /// </summary>
        private CspClient CspClient { get; }

        /// <summary>
        /// A default constructor.
        /// </summary>
        /// <param name="fixture">The fixture that holds the testing setup.</param>
        public CspReportTests(IntegrationTestFixture fixture)
        {
            CspClient = fixture.ServicesProvider.GetService<CspClient>();
        }

        /// <summary>
        /// Tries to report a CSP violation.
        /// </summary>
        [Fact]
        public async Task ReportCspViolation()
        {
            var insertedCspReportRaw = await CspClient.ReportAsync(new CspReportRequest
            {
                CspReport = new CspReportDto
                {
                    DocumentUri = nameof(CspReportDto.DocumentUri),
                    Referrer = nameof(CspReportDto.Referrer),
                    ViolatedDirective = nameof(CspReportDto.Referrer),
                    EffectiveDirective = nameof(CspReportDto.EffectiveDirective),
                    OriginalPolicy = nameof(CspReportDto.OriginalPolicy),
                    BlockedUri = nameof(CspReportDto.BlockedUri),
                    StatusCode = 0
                }
            }).ConfigureAwait(false);

            Assert.Equal(HttpStatusCode.OK, insertedCspReportRaw.StatusCode);
        }
    }
}


text:
import {tile} from '../../ops/tile';
import {getGlobalTensorClass, Tensor} from '../../tensor';
import {Rank} from '../../types';

declare module '../../tensor' {
  interface Tensor<R extends Rank = Rank> {
    tile<T extends Tensor>(b: number[]): T;
  }
}

getGlobalTensorClass().prototype.tile = function<T extends Tensor>(
    reps: number[]): T {
  this.throwIfDisposed();
  return tile(this, reps) as T;
};


text:
// This file is part of the dune-gdt project:
//   http://users.dune-project.org/projects/dune-gdt
// Copyright holders: Felix Schindler
// License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)

#ifndef DUNE_GDT_ASSEMLBER_LOCAL_CODIM0_HH
#define DUNE_GDT_ASSEMLBER_LOCAL_CODIM0_HH

#include <vector>

#include <dune/common/dynmatrix.hh>
#include <dune/common/dynvector.hh>

#include <dune/stuff/common/memory.hh>
#include <dune/stuff/common/exceptions.hh>
#include <dune/stuff/common/parallel/threadstorage.hh>
#include <dune/stuff/common/tmp-storage.hh>
#include <dune/stuff/functions/interfaces.hh>
#include <dune/stuff/grid/walker/functors.hh>
#include <dune/stuff/la/container/interfaces.hh>

#include <dune/gdt/localoperator/interface.hh>
#include <dune/gdt/localfunctional/interface.hh>
#include <dune/gdt/spaces/interface.hh>

namespace Dune {
namespace GDT {
namespace LocalAssembler {

template< class LocalOperatorImp >
class Codim0Matrix
{
  static_assert(std::is_base_of< LocalOperator::Codim0Interface< typename LocalOperatorImp::Traits >,
                                 LocalOperatorImp >::value,
                "LocalOperatorImp has to be derived from LocalOperator::Codim0Interface!");
public:
  typedef LocalOperatorImp LocalOperatorType;

  explicit Codim0Matrix(const LocalOperatorType& op)
    : localOperator_(op)
  {}

  const LocalOperatorType& localOperator() const
  {
    return localOperator_;
  }

private:
  static const size_t numTmpObjectsRequired_ = 1;

public:
  std::vector< size_t > numTmpObjectsRequired() const
  {
    return { numTmpObjectsRequired_, localOperator_.numTmpObjectsRequired() };
  }

  /**
   *  \tparam T           Traits of the SpaceInterface implementation, representing the type of testSpace
   *  \tparam A           Traits of the SpaceInterface implementation, representing the type of ansatzSpace
   *  \tparam *d          dimDomain of testSpace (* == T) or ansatzSpace (* == A)
   *  \tparam *r          dimRange of testSpace (* == T) or ansatzSpace (* == A)
   *  \tparam *rC         dimRangeCols of testSpace (* == T) or ansatzSpace (* == A)
   *  \tparam EntityType  A model of Dune::Entity< 0 >
   *  \tparam M           Traits of the Dune::Stuff::LA::Container::MatrixInterface implementation, representing the type of systemMatrix
   *  \tparam R           RangeFieldType, i.e. double
   */
  template< class T, size_t Td, size_t Tr, size_t TrC, class A, size_t Ad, size_t Ar, size_t ArC, class EntityType, class M, class R >
  void assembleLocal(const SpaceInterface< T, Td, Tr, TrC >& testSpace,
                     const SpaceInterface< A, Ad, Ar, ArC >& ansatzSpace,
                     const EntityType& entity,
                     Dune::Stuff::LA::MatrixInterface< M, R >& systemMatrix,
                     std::vector< std::vector< Dune::DynamicMatrix< R > > >& tmpLocalMatricesContainer,
                     std::vector< Dune::DynamicVector< size_t > >& tmpIndicesContainer) const
  {
    // check
    assert(tmpLocalMatricesContainer.size() >= 1);
    assert(tmpLocalMatricesContainer[0].size() >= numTmpObjectsRequired_);
    assert(tmpLocalMatricesContainer[1].size() >= localOperator_.numTmpObjectsRequired());
    assert(tmpIndicesContainer.size() >= 2);
    // get and clear matrix
    auto& localMatrix = tmpLocalMatricesContainer[0][0];
    localMatrix *= 0.0;
    auto& tmpOperatorMatrices = tmpLocalMatricesContainer[1];
    // apply local operator (result is in localMatrix)
    localOperator_.apply(testSpace.base_function_set(entity),
                         ansatzSpace.base_function_set(entity),
                         localMatrix,
                         tmpOperatorMatrices);
    // write local matrix to global
    auto& globalRows = tmpIndicesContainer[0];
    auto& globalCols = tmpIndicesContainer[1];
    const size_t rows = testSpace.mapper().numDofs(entity);
    const size_t cols = ansatzSpace.mapper().numDofs(entity);
    assert(globalRows.size() >= rows);
    assert(globalCols.size() >= cols);
    testSpace.mapper().globalIndices(entity, globalRows);
    ansatzSpace.mapper().globalIndices(entity, globalCols);
    for (size_t ii = 0; ii < rows; ++ii) {
      const auto& localRow = localMatrix[ii];
      const size_t globalII = globalRows[ii];
      for (size_t jj = 0; jj < cols; ++jj) {
        const size_t globalJJ = globalCols[jj];
        systemMatrix.add_to_entry(globalII, globalJJ, localRow[jj]);
      }
    } // write local matrix to global
  } // ... assembleLocal(...)

private:
  const LocalOperatorType& localOperator_;
}; // class Codim0Matrix

template< class LocalFunctionalImp >
class Codim0Vector
{
  static_assert(std::is_base_of< LocalFunctional::Codim0Interface< typename LocalFunctionalImp::Traits >,
                                 LocalFunctionalImp >::value,
                "LocalFunctionalImp has to be derived from LocalFunctional::Codim0Interface!");
public:
  typedef LocalFunctionalImp LocalFunctionalType;

  explicit Codim0Vector(const LocalFunctionalType& func)
    : localFunctional_(func)
  {}

  const LocalFunctionalType& localFunctional() const
  {
    return localFunctional_;
  }

private:
  static const size_t numTmpObjectsRequired_ = 1;

public:
  std::vector< size_t > numTmpObjectsRequired() const
  {
    return { numTmpObjectsRequired_, localFunctional_.numTmpObjectsRequired() };
  }

  /**
   *  \tparam T           Traits of the SpaceInterface implementation, representing the type of testSpace
   *  \tparam d           dimDomain of testSpace
   *  \tparam r           dimRange of testSpace
   *  \tparam rC          dimRangeCols of testSpace
   *  \tparam EntityType  A model of Dune::Entity< 0 >
   *  \tparam V           Traits of the Dune::Stuff::LA::Container::VectorInterface implementation, representing the type of systemVector
   *  \tparam R           RangeFieldType, i.e. double
   */
  template< class T, size_t d, size_t r, size_t rC, class EntityType, class V, class R >
  void assembleLocal(const SpaceInterface< T, d, r, rC >& testSpace,
                     const EntityType& entity,
                     Dune::Stuff::LA::VectorInterface< V, R >& systemVector,
                     std::vector< std::vector< Dune::DynamicVector< R > > >& tmpLocalVectorContainer,
                     Dune::DynamicVector< size_t >& tmpIndices) const
  {
    // check
    assert(tmpLocalVectorContainer.size() >= 2);
    assert(tmpLocalVectorContainer[0].size() >= numTmpObjectsRequired_);
    assert(tmpLocalVectorContainer[1].size() >= localFunctional_.numTmpObjectsRequired());
    // get and clear vector
    auto& localVector = tmpLocalVectorContainer[0][0];
    localVector *= 0.0;
    auto& tmpFunctionalVectors = tmpLocalVectorContainer[1];
    // apply local functional (result is in localVector)
    localFunctional_.apply(testSpace.base_function_set(entity),
                           localVector,
                           tmpFunctionalVectors);
    // write local vector to global
    const size_t size = testSpace.mapper().numDofs(entity);
    assert(tmpIndices.size() >= size);
    testSpace.mapper().globalIndices(entity, tmpIndices);
    for (size_t ii = 0; ii < size; ++ii) {
      systemVector.add_to_entry(tmpIndices[ii], localVector[ii]);
    } // write local matrix to global
  } // ... assembleLocal(...)

private:
  const LocalFunctionalType& localFunctional_;
}; // class Codim0Vector

template< class GridViewImp, class LocalOperatorType, class TestFunctionType, class AnsatzFunctionType, class FieldType >
class Codim0OperatorAccumulateFunctor
  : public Stuff::Grid::Functor::Codim0< GridViewImp >
{
  static_assert(std::is_base_of< LocalOperator::Codim0Interface< typename LocalOperatorType::Traits >,
                                 LocalOperatorType >::value,
                "LocalOperatorType has to be derived from LocalOperator::Codim0Interface!");
  static_assert(Stuff::is_localizable_function< TestFunctionType >::value,
                "TestFunctionType has to be derived from Stuff::LocalizableFunctionInterface!");
  static_assert(Stuff::is_localizable_function< AnsatzFunctionType >::value,
                "AnsatzFunctionType has to be derived from Stuff::LocalizableFunctionInterface!");

  typedef Codim0OperatorAccumulateFunctor
      < GridViewImp, LocalOperatorType, TestFunctionType, AnsatzFunctionType, FieldType > ThisType;
  typedef Stuff::Grid::Functor::Codim0< GridViewImp >                                     BaseType;
  typedef DSC::TmpMatricesStorage< FieldType >                                            TmpMatricesProviderType;
public:
  typedef typename BaseType::GridViewType GridViewType;
  typedef typename BaseType::EntityType   EntityType;

  Codim0OperatorAccumulateFunctor(const GridViewType& grd_vw,
                                  const LocalOperatorType& local_op,
                                  const TestFunctionType& test_function,
                                  const AnsatzFunctionType& ansatz_function)
    : grid_view_(grd_vw)
    , local_operator_(local_op)
    , test_function_(test_function)
    , ansatz_function_(ansatz_function)
    , result_(0)
    , tmp_storage_(new TmpMatricesProviderType({1, local_operator_.numTmpObjectsRequired()}, 1, 1))
    , finalized_(false)
  {}

  Codim0OperatorAccumulateFunctor(const ThisType& other)
    : grid_view_(other.grid_view_)
    , local_operator_(other.local_operator_)
    , test_function_(other.test_function_)
    , ansatz_function_(other.ansatz_function_)
    , result_(other.result_)
    , tmp_storage_(new TmpMatricesProviderType({1, local_operator_.numTmpObjectsRequired()}, 1, 1))
    , finalized_(other.finalized_)
  {}

  virtual ~Codim0OperatorAccumulateFunctor() = default;

  FieldType compute_locally(const EntityType& entity)
  {
    assert(tmp_storage_->matrices().size() >= 2);
    assert(tmp_storage_->matrices()[0].size() >= 1);
    auto& local_operator_result = tmp_storage_->matrices()[0][0];
    auto& tmp_matrices          = tmp_storage_->matrices()[1];
    // get the local functions
    const auto local_test_function    = test_function_.local_function(entity);
    const auto local_ansatz_function = ansatz_function_.local_function(entity);
    // apply the local operator
    this->local_operator_.apply(*local_test_function, *local_ansatz_function, local_operator_result, tmp_matrices);
    assert(local_operator_result.rows() >= 1);
    assert(local_operator_result.cols() >= 1);
    return local_operator_result[0][0];
  } // ... compute_locally(...)

  virtual void apply_local(const EntityType& entity) override
  {
    *result_ += compute_locally(entity);
  }

  virtual void finalize() override
  {
    if (!finalized_) {
      finalized_result_ = result_.sum();
      finalized_result_ = grid_view_.comm().sum(finalized_result_);
      finalized_ = true;
    }
  } // ... finalize(...)

  FieldType result() const
  {
    if (!finalized_)
      DUNE_THROW(Stuff::Exceptions::you_are_using_this_wrong, "Call finalize() first!");
    return finalized_result_;
  }

private:
  const GridViewType& grid_view_;
  const LocalOperatorType& local_operator_;
  const TestFunctionType& test_function_;
  const AnsatzFunctionType& ansatz_function_;
  DS::PerThreadValue< FieldType > result_;
  std::unique_ptr< TmpMatricesProviderType > tmp_storage_;
  bool finalized_;
  FieldType finalized_result_;
}; // class Codim0OperatorAccumulateFunctor

} // namespace LocalAssembler
} // namespace GDT
} // namespace Dune

#endif // DUNE_GDT_ASSEMLBER_LOCAL_CODIM0_HH


text:
{% extends "sentry/group/details.html" %}

{% load sentry_helpers %}

{% block inner %}

Site List

    {% paginate group.unique_sites from request as site_list per_page 25 %}

            {{ site_list.paging }}

        {% for site, times_seen in site_list.objects %}

{{ times_seen|small_count }} {{ site }}

        {% endfor %}

            {{ site_list.paging }}

{% endblock %}


text:
<?xml version="1.0" encoding="UTF-8" ?>

<CodeXL>
    <Tests>
	        <TestResultsDirectory>GoldMasters_APPSDK_2_9</TestResultsDirectory>
        <LogFilesDirectory>C:\TEMP\testResults\</LogFilesDirectory>
		<Test>
            <ExecutablePath>samples\opencl\bin\x86\SimpleMultiDevice.exe</ExecutablePath>
            <WorkingDirectory>samples\opencl\bin\x86</WorkingDirectory>
            <TestName>SimpleMultiDevice_WorkItemsTest</TestName>
            <TestType>WorkItemsTest</TestType>
            <Kernels>
                <Kernel>
                    <KernelName>multiDeviceKernel</KernelName>
					<WorkItemId>0,0,0</WorkItemId>
					<KernelVariables>
						<Variable name="a" line="26" x="0" y="0" z="0"></Variable>
                    </KernelVariables>
                </Kernel>
            </Kernels>
        </Test>
	</Tests>
</CodeXL>


text:
features to implement.
- caching service
- speech recognation
- cloud support

To use this project, copy the files from this repository into a local folder and install dependencies using the ionic cli.

### Ionic CLI:

```bash
$ sudo npm install
```

Then, to run it, cd into the folder and run:

```bash
$ ionic cordova platform add ios
$ ionic cordova run ios
```

Substitute ios for android if not on a Mac.


text:
<?php

declare(strict_types=1);

namespace Keystone\Queue\Driver\Sqs;

use Keystone\Queue\Envelope;
use Keystone\Queue\Message;

class SqsEnvelope extends Envelope
{
    /**
     * The result from SQS containing the message attributes.
     *
     * @var array
     */
    private $result;

    /**
     * @param string $queueName
     * @param string $receipt
     * @param Message $message
     * @param array $result
     */
    public function __construct(string $queueName, string $receipt, Message $message, array $result)
    {
        parent::__construct($queueName, $receipt, $message);

        $this->result = $result;
    }

    /**
     * @return int
     */
    public function getAttempts(): int
    {
        return (int) $this->getAttribute('ApproximateReceiveCount');
    }

    /**
     * Returns the approximate first receive timestamp as epoch time in seconds.
     *
     * @return int
     */
    public function getFirstReceiveTimestamp(): int
    {
        return (int) ($this->getAttribute('ApproximateFirstReceiveTimestamp') / 1000);
    }

    /**
     * @param string $name
     *
     * @return bool
     */
    public function hasAttribute(string $name): bool
    {
        return isset($this->result['Attributes'][$name]);
    }

    /**
     * @param string $name
     *
     * @return string
     */
    public function getAttribute(string $name): string
    {
        if ($this->hasAttribute($name)) {
            return $this->result['Attributes'][$name];
        }
    }
}


text:
<!DOCTYPE html>

	<title>Pattern Lab Pattern</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width" />

	<meta http-equiv="cache-control" content="max-age=0" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
	<meta http-equiv="pragma" content="no-cache" />

	<link rel="stylesheet" href="../../styleguide/css/styleguide.css" media="all">

	<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="../../css/style.css" media="all" />

Headline: Lorem Ipsum Dolor Amet Sit

<time datetime="2013-04-06T12:32+00:00">2 weeks ago</time>

<time datetime="2013-04-06T12:32+00:00">5/4/14</time>


text:
using base::android::ScopedJavaGlobalRef;

namespace offline_pages {
namespace android {

namespace {

// C++ callback that delegates to Java callback.
void ProcessingDoneCallback(
    const ScopedJavaGlobalRef<jobject>& j_callback_obj, jboolean result) {
  JNIEnv* env = base::android::AttachCurrentThread();
  Java_ProcessingDoneCallback_onProcessingDone(
      env, j_callback_obj.obj(), result);
}

}  // namespace

// JNI call to start request processing.
static jboolean StartProcessing(
    JNIEnv* env,
    const JavaParamRef<jclass>& jcaller,
    const JavaParamRef<jobject>& j_profile,
    const JavaParamRef<jobject>& j_callback_obj) {
  ScopedJavaGlobalRef<jobject> j_callback_ref;
  j_callback_ref.Reset(env, j_callback_obj);
  base::Bind(&ProcessingDoneCallback, j_callback_ref);
  // TODO(dougarnett): lookup/create RequestCoordinator KeyedService
  // and call StartProcessing on it with bound j_callback_obj.
  return false;
}

BackgroundSchedulerBridge::BackgroundSchedulerBridge() {
}

BackgroundSchedulerBridge::~BackgroundSchedulerBridge() {
}

void BackgroundSchedulerBridge::Schedule(
    const TriggerCondition& trigger_condition) {
  JNIEnv* env = base::android::AttachCurrentThread();
  // TODO(dougarnett): pass trigger_condition.
  Java_BackgroundSchedulerBridge_schedule(env);
}

void BackgroundSchedulerBridge::Unschedule() {
  JNIEnv* env = base::android::AttachCurrentThread();
  Java_BackgroundSchedulerBridge_unschedule(env);
}

bool RegisterBackgroundSchedulerBridge(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

}  // namespace android
}  // namespace offline_pages


text:
namespace System.Web.Mvc {
    using System;
    using System.Globalization;
    using System.Text;
    using System.Web.Mvc.Resources;

    public class PartialViewResult : ViewResultBase {

        protected override ViewEngineResult FindView(ControllerContext context) {
            ViewEngineResult result = ViewEngineCollection.FindPartialView(context, ViewName);
            if (result.View != null) {
                return result;
            }

            // we need to generate an exception containing all the locations we searched
            StringBuilder locationsText = new StringBuilder();
            foreach (string location in result.SearchedLocations) {
                locationsText.AppendLine();
                locationsText.Append(location);
            }
            throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture,
                MvcResources.Common_PartialViewNotFound, ViewName, locationsText));
        }
    }
}


text:
// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by Akka.Interfaced CodeGenerator.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

using System;
using System.Threading.Tasks;
using Akka.Interfaced;
using Akka.Actor;
using ProtoBuf;
using TypeAlias;
using System.ComponentModel;

#region Domain.IOccupant

namespace Domain
{
    [PayloadTable(typeof(IOccupant), PayloadTableKind.Request)]
    public static class IOccupant_PayloadTable
    {
        public static Type[,] GetPayloadTypes()
        {
            return new Type[,] {
                { typeof(GetHistory_Invoke), typeof(GetHistory_Return) },
                { typeof(Invite_Invoke), null },
                { typeof(Say_Invoke), null },
            };
        }

        [ProtoContract, TypeAlias]
        public class GetHistory_Invoke
            : IInterfacedPayload, IAsyncInvokable, IPayloadTagOverridable
        {
            public Type GetInterfaceType()
            {
                return typeof(IOccupant);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                var __v = await ((IOccupant)__target).GetHistory();
                return (IValueGetable)(new GetHistory_Return { v = __v });
            }

            void IPayloadTagOverridable.SetTag(object value)
            {
            }
        }

        [ProtoContract, TypeAlias]
        public class GetHistory_Return
            : IInterfacedPayload, IValueGetable
        {
            [ProtoMember(1)] public System.Collections.Generic.IList<Domain.ChatItem> v;

            public Type GetInterfaceType()
            {
                return typeof(IOccupant);
            }

            public object Value
            {
                get { return v; }
            }
        }

        [ProtoContract, TypeAlias]
        public class Invite_Invoke
            : IInterfacedPayload, IAsyncInvokable, IPayloadTagOverridable
        {
            [ProtoMember(1)] public string targetUserId;
            [ProtoMember(2)] public string senderUserId;

            public Type GetInterfaceType()
            {
                return typeof(IOccupant);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IOccupant)__target).Invite(targetUserId, senderUserId);
                return null;
            }

            void IPayloadTagOverridable.SetTag(object value)
            {
                senderUserId = (string)value;
            }
        }

        [ProtoContract, TypeAlias]
        public class Say_Invoke
            : IInterfacedPayload, IAsyncInvokable, IPayloadTagOverridable
        {
            [ProtoMember(1)] public string msg;
            [ProtoMember(2)] public string senderUserId;

            public Type GetInterfaceType()
            {
                return typeof(IOccupant);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IOccupant)__target).Say(msg, senderUserId);
                return null;
            }

            void IPayloadTagOverridable.SetTag(object value)
            {
                senderUserId = (string)value;
            }
        }
    }

    public interface IOccupant_NoReply
    {
        void GetHistory();
        void Invite(string targetUserId, string senderUserId = null);
        void Say(string msg, string senderUserId = null);
    }

    public class OccupantRef : InterfacedActorRef, IOccupant, IOccupant_NoReply
    {
        public override Type InterfaceType => typeof(IOccupant);

        public OccupantRef() : base(null)
        {
        }

        public OccupantRef(IRequestTarget target) : base(target)
        {
        }

        public OccupantRef(IRequestTarget target, IRequestWaiter requestWaiter, TimeSpan? timeout = null) : base(target, requestWaiter, timeout)
        {
        }

        public IOccupant_NoReply WithNoReply()
        {
            return this;
        }

        public OccupantRef WithRequestWaiter(IRequestWaiter requestWaiter)
        {
            return new OccupantRef(Target, requestWaiter, Timeout);
        }

        public OccupantRef WithTimeout(TimeSpan? timeout)
        {
            return new OccupantRef(Target, RequestWaiter, timeout);
        }

        public Task<System.Collections.Generic.IList<Domain.ChatItem>> GetHistory()
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IOccupant_PayloadTable.GetHistory_Invoke {  }
            };
            return SendRequestAndReceive<System.Collections.Generic.IList<Domain.ChatItem>>(requestMessage);
        }

        public Task Invite(string targetUserId, string senderUserId = null)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IOccupant_PayloadTable.Invite_Invoke { targetUserId = targetUserId, senderUserId = senderUserId }
            };
            return SendRequestAndWait(requestMessage);
        }

        public Task Say(string msg, string senderUserId = null)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IOccupant_PayloadTable.Say_Invoke { msg = msg, senderUserId = senderUserId }
            };
            return SendRequestAndWait(requestMessage);
        }

        void IOccupant_NoReply.GetHistory()
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IOccupant_PayloadTable.GetHistory_Invoke {  }
            };
            SendRequest(requestMessage);
        }

        void IOccupant_NoReply.Invite(string targetUserId, string senderUserId)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IOccupant_PayloadTable.Invite_Invoke { targetUserId = targetUserId, senderUserId = senderUserId }
            };
            SendRequest(requestMessage);
        }

        void IOccupant_NoReply.Say(string msg, string senderUserId)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IOccupant_PayloadTable.Say_Invoke { msg = msg, senderUserId = senderUserId }
            };
            SendRequest(requestMessage);
        }
    }

    [ProtoContract]
    public class SurrogateForIOccupant
    {
        [ProtoMember(1)] public IRequestTarget Target;

        [ProtoConverter]
        public static SurrogateForIOccupant Convert(IOccupant value)
        {
            if (value == null) return null;
            return new SurrogateForIOccupant { Target = ((OccupantRef)value).Target };
        }

        [ProtoConverter]
        public static IOccupant Convert(SurrogateForIOccupant value)
        {
            if (value == null) return null;
            return new OccupantRef(value.Target);
        }
    }

    [AlternativeInterface(typeof(IOccupant))]
    public interface IOccupantSync : IInterfacedActorSync
    {
        System.Collections.Generic.IList<Domain.ChatItem> GetHistory();
        void Invite(string targetUserId, string senderUserId = null);
        void Say(string msg, string senderUserId = null);
    }
}

#endregion
#region Domain.IRoom

namespace Domain
{
    [PayloadTable(typeof(IRoom), PayloadTableKind.Request)]
    public static class IRoom_PayloadTable
    {
        public static Type[,] GetPayloadTypes()
        {
            return new Type[,] {
                { typeof(Enter_Invoke), typeof(Enter_Return) },
                { typeof(Exit_Invoke), null },
            };
        }

        [ProtoContract, TypeAlias]
        public class Enter_Invoke
            : IInterfacedPayload, IAsyncInvokable, IPayloadObserverUpdatable
        {
            [ProtoMember(1)] public string userId;
            [ProtoMember(2)] public Domain.IRoomObserver observer;

            public Type GetInterfaceType()
            {
                return typeof(IRoom);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                var __v = await ((IRoom)__target).Enter(userId, observer);
                return (IValueGetable)(new Enter_Return { v = __v });
            }

            void IPayloadObserverUpdatable.Update(Action<IInterfacedObserver> updater)
            {
                if (observer != null)
                {
                    updater(observer);
                }
            }
        }

        [ProtoContract, TypeAlias]
        public class Enter_Return
            : IInterfacedPayload, IValueGetable
        {
            [ProtoMember(1)] public Domain.RoomInfo v;

            public Type GetInterfaceType()
            {
                return typeof(IRoom);
            }

            public object Value
            {
                get { return v; }
            }
        }

        [ProtoContract, TypeAlias]
        public class Exit_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            [ProtoMember(1)] public string userId;

            public Type GetInterfaceType()
            {
                return typeof(IRoom);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IRoom)__target).Exit(userId);
                return null;
            }
        }
    }

    public interface IRoom_NoReply
    {
        void Enter(string userId, Domain.IRoomObserver observer);
        void Exit(string userId);
    }

    public class RoomRef : InterfacedActorRef, IRoom, IRoom_NoReply
    {
        public override Type InterfaceType => typeof(IRoom);

        public RoomRef() : base(null)
        {
        }

        public RoomRef(IRequestTarget target) : base(target)
        {
        }

        public RoomRef(IRequestTarget target, IRequestWaiter requestWaiter, TimeSpan? timeout = null) : base(target, requestWaiter, timeout)
        {
        }

        public IRoom_NoReply WithNoReply()
        {
            return this;
        }

        public RoomRef WithRequestWaiter(IRequestWaiter requestWaiter)
        {
            return new RoomRef(Target, requestWaiter, Timeout);
        }

        public RoomRef WithTimeout(TimeSpan? timeout)
        {
            return new RoomRef(Target, RequestWaiter, timeout);
        }

        public Task<Domain.RoomInfo> Enter(string userId, Domain.IRoomObserver observer)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IRoom_PayloadTable.Enter_Invoke { userId = userId, observer = (RoomObserver)observer }
            };
            return SendRequestAndReceive<Domain.RoomInfo>(requestMessage);
        }

        public Task Exit(string userId)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IRoom_PayloadTable.Exit_Invoke { userId = userId }
            };
            return SendRequestAndWait(requestMessage);
        }

        void IRoom_NoReply.Enter(string userId, Domain.IRoomObserver observer)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IRoom_PayloadTable.Enter_Invoke { userId = userId, observer = (RoomObserver)observer }
            };
            SendRequest(requestMessage);
        }

        void IRoom_NoReply.Exit(string userId)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IRoom_PayloadTable.Exit_Invoke { userId = userId }
            };
            SendRequest(requestMessage);
        }
    }

    [ProtoContract]
    public class SurrogateForIRoom
    {
        [ProtoMember(1)] public IRequestTarget Target;

        [ProtoConverter]
        public static SurrogateForIRoom Convert(IRoom value)
        {
            if (value == null) return null;
            return new SurrogateForIRoom { Target = ((RoomRef)value).Target };
        }

        [ProtoConverter]
        public static IRoom Convert(SurrogateForIRoom value)
        {
            if (value == null) return null;
            return new RoomRef(value.Target);
        }
    }

    [AlternativeInterface(typeof(IRoom))]
    public interface IRoomSync : IInterfacedActorSync
    {
        Domain.RoomInfo Enter(string userId, Domain.IRoomObserver observer);
        void Exit(string userId);
    }
}

#endregion
#region Domain.IUser

namespace Domain
{
    [PayloadTable(typeof(IUser), PayloadTableKind.Request)]
    public static class IUser_PayloadTable
    {
        public static Type[,] GetPayloadTypes()
        {
            return new Type[,] {
                { typeof(CreateBot_Invoke), null },
                { typeof(EnterRoom_Invoke), typeof(EnterRoom_Return) },
                { typeof(ExitFromRoom_Invoke), null },
                { typeof(GetId_Invoke), typeof(GetId_Return) },
                { typeof(GetRoomList_Invoke), typeof(GetRoomList_Return) },
                { typeof(Whisper_Invoke), null },
            };
        }

        [ProtoContract, TypeAlias]
        public class CreateBot_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            [ProtoMember(1)] public string roomName;
            [ProtoMember(2)] public string botType;

            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IUser)__target).CreateBot(roomName, botType);
                return null;
            }
        }

        [ProtoContract, TypeAlias]
        public class EnterRoom_Invoke
            : IInterfacedPayload, IAsyncInvokable, IPayloadObserverUpdatable
        {
            [ProtoMember(1)] public string name;
            [ProtoMember(2)] public Domain.IRoomObserver observer;

            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                var __v = await ((IUser)__target).EnterRoom(name, observer);
                return (IValueGetable)(new EnterRoom_Return { v = __v });
            }

            void IPayloadObserverUpdatable.Update(Action<IInterfacedObserver> updater)
            {
                if (observer != null)
                {
                    updater(observer);
                }
            }
        }

        [ProtoContract, TypeAlias]
        public class EnterRoom_Return
            : IInterfacedPayload, IValueGetable, IPayloadActorRefUpdatable
        {
            [ProtoMember(1)] public System.Tuple<Domain.IOccupant, Domain.RoomInfo> v;

            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public object Value
            {
                get { return v; }
            }

            void IPayloadActorRefUpdatable.Update(Action<object> updater)
            {
                if (v != null)
                {
                    if (v.Item1 != null) updater(v.Item1);
                }
            }
        }

        [ProtoContract, TypeAlias]
        public class ExitFromRoom_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            [ProtoMember(1)] public string name;

            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IUser)__target).ExitFromRoom(name);
                return null;
            }
        }

        [ProtoContract, TypeAlias]
        public class GetId_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                var __v = await ((IUser)__target).GetId();
                return (IValueGetable)(new GetId_Return { v = __v });
            }
        }

        [ProtoContract, TypeAlias]
        public class GetId_Return
            : IInterfacedPayload, IValueGetable
        {
            [ProtoMember(1)] public string v;

            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public object Value
            {
                get { return v; }
            }
        }

        [ProtoContract, TypeAlias]
        public class GetRoomList_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                var __v = await ((IUser)__target).GetRoomList();
                return (IValueGetable)(new GetRoomList_Return { v = __v });
            }
        }

        [ProtoContract, TypeAlias]
        public class GetRoomList_Return
            : IInterfacedPayload, IValueGetable
        {
            [ProtoMember(1)] public System.Collections.Generic.IList<string> v;

            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public object Value
            {
                get { return v; }
            }
        }

        [ProtoContract, TypeAlias]
        public class Whisper_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            [ProtoMember(1)] public string targetUserId;
            [ProtoMember(2)] public string message;

            public Type GetInterfaceType()
            {
                return typeof(IUser);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IUser)__target).Whisper(targetUserId, message);
                return null;
            }
        }
    }

    public interface IUser_NoReply
    {
        void CreateBot(string roomName, string botType);
        void EnterRoom(string name, Domain.IRoomObserver observer);
        void ExitFromRoom(string name);
        void GetId();
        void GetRoomList();
        void Whisper(string targetUserId, string message);
    }

    public class UserRef : InterfacedActorRef, IUser, IUser_NoReply
    {
        public override Type InterfaceType => typeof(IUser);

        public UserRef() : base(null)
        {
        }

        public UserRef(IRequestTarget target) : base(target)
        {
        }

        public UserRef(IRequestTarget target, IRequestWaiter requestWaiter, TimeSpan? timeout = null) : base(target, requestWaiter, timeout)
        {
        }

        public IUser_NoReply WithNoReply()
        {
            return this;
        }

        public UserRef WithRequestWaiter(IRequestWaiter requestWaiter)
        {
            return new UserRef(Target, requestWaiter, Timeout);
        }

        public UserRef WithTimeout(TimeSpan? timeout)
        {
            return new UserRef(Target, RequestWaiter, timeout);
        }

        public Task CreateBot(string roomName, string botType)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.CreateBot_Invoke { roomName = roomName, botType = botType }
            };
            return SendRequestAndWait(requestMessage);
        }

        public Task<System.Tuple<Domain.IOccupant, Domain.RoomInfo>> EnterRoom(string name, Domain.IRoomObserver observer)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.EnterRoom_Invoke { name = name, observer = (RoomObserver)observer }
            };
            return SendRequestAndReceive<System.Tuple<Domain.IOccupant, Domain.RoomInfo>>(requestMessage);
        }

        public Task ExitFromRoom(string name)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.ExitFromRoom_Invoke { name = name }
            };
            return SendRequestAndWait(requestMessage);
        }

        public Task<string> GetId()
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.GetId_Invoke {  }
            };
            return SendRequestAndReceive<string>(requestMessage);
        }

        public Task<System.Collections.Generic.IList<string>> GetRoomList()
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.GetRoomList_Invoke {  }
            };
            return SendRequestAndReceive<System.Collections.Generic.IList<string>>(requestMessage);
        }

        public Task Whisper(string targetUserId, string message)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.Whisper_Invoke { targetUserId = targetUserId, message = message }
            };
            return SendRequestAndWait(requestMessage);
        }

        void IUser_NoReply.CreateBot(string roomName, string botType)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.CreateBot_Invoke { roomName = roomName, botType = botType }
            };
            SendRequest(requestMessage);
        }

        void IUser_NoReply.EnterRoom(string name, Domain.IRoomObserver observer)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.EnterRoom_Invoke { name = name, observer = (RoomObserver)observer }
            };
            SendRequest(requestMessage);
        }

        void IUser_NoReply.ExitFromRoom(string name)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.ExitFromRoom_Invoke { name = name }
            };
            SendRequest(requestMessage);
        }

        void IUser_NoReply.GetId()
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.GetId_Invoke {  }
            };
            SendRequest(requestMessage);
        }

        void IUser_NoReply.GetRoomList()
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.GetRoomList_Invoke {  }
            };
            SendRequest(requestMessage);
        }

        void IUser_NoReply.Whisper(string targetUserId, string message)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUser_PayloadTable.Whisper_Invoke { targetUserId = targetUserId, message = message }
            };
            SendRequest(requestMessage);
        }
    }

    [ProtoContract]
    public class SurrogateForIUser
    {
        [ProtoMember(1)] public IRequestTarget Target;

        [ProtoConverter]
        public static SurrogateForIUser Convert(IUser value)
        {
            if (value == null) return null;
            return new SurrogateForIUser { Target = ((UserRef)value).Target };
        }

        [ProtoConverter]
        public static IUser Convert(SurrogateForIUser value)
        {
            if (value == null) return null;
            return new UserRef(value.Target);
        }
    }

    [AlternativeInterface(typeof(IUser))]
    public interface IUserSync : IInterfacedActorSync
    {
        void CreateBot(string roomName, string botType);
        System.Tuple<Domain.IOccupant, Domain.RoomInfo> EnterRoom(string name, Domain.IRoomObserver observer);
        void ExitFromRoom(string name);
        string GetId();
        System.Collections.Generic.IList<string> GetRoomList();
        void Whisper(string targetUserId, string message);
    }
}

#endregion
#region Domain.IUserLogin

namespace Domain
{
    [PayloadTable(typeof(IUserLogin), PayloadTableKind.Request)]
    public static class IUserLogin_PayloadTable
    {
        public static Type[,] GetPayloadTypes()
        {
            return new Type[,] {
                { typeof(Login_Invoke), typeof(Login_Return) },
            };
        }

        [ProtoContract, TypeAlias]
        public class Login_Invoke
            : IInterfacedPayload, IAsyncInvokable, IPayloadObserverUpdatable
        {
            [ProtoMember(1)] public string id;
            [ProtoMember(2)] public string password;
            [ProtoMember(3)] public Domain.IUserEventObserver observer;

            public Type GetInterfaceType()
            {
                return typeof(IUserLogin);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                var __v = await ((IUserLogin)__target).Login(id, password, observer);
                return (IValueGetable)(new Login_Return { v = __v });
            }

            void IPayloadObserverUpdatable.Update(Action<IInterfacedObserver> updater)
            {
                if (observer != null)
                {
                    updater(observer);
                }
            }
        }

        [ProtoContract, TypeAlias]
        public class Login_Return
            : IInterfacedPayload, IValueGetable, IPayloadActorRefUpdatable
        {
            [ProtoMember(1)] public Domain.IUser v;

            public Type GetInterfaceType()
            {
                return typeof(IUserLogin);
            }

            public object Value
            {
                get { return v; }
            }

            void IPayloadActorRefUpdatable.Update(Action<object> updater)
            {
                if (v != null)
                {
                    updater(v);
                }
            }
        }
    }

    public interface IUserLogin_NoReply
    {
        void Login(string id, string password, Domain.IUserEventObserver observer);
    }

    public class UserLoginRef : InterfacedActorRef, IUserLogin, IUserLogin_NoReply
    {
        public override Type InterfaceType => typeof(IUserLogin);

        public UserLoginRef() : base(null)
        {
        }

        public UserLoginRef(IRequestTarget target) : base(target)
        {
        }

        public UserLoginRef(IRequestTarget target, IRequestWaiter requestWaiter, TimeSpan? timeout = null) : base(target, requestWaiter, timeout)
        {
        }

        public IUserLogin_NoReply WithNoReply()
        {
            return this;
        }

        public UserLoginRef WithRequestWaiter(IRequestWaiter requestWaiter)
        {
            return new UserLoginRef(Target, requestWaiter, Timeout);
        }

        public UserLoginRef WithTimeout(TimeSpan? timeout)
        {
            return new UserLoginRef(Target, RequestWaiter, timeout);
        }

        public Task<Domain.IUser> Login(string id, string password, Domain.IUserEventObserver observer)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUserLogin_PayloadTable.Login_Invoke { id = id, password = password, observer = (UserEventObserver)observer }
            };
            return SendRequestAndReceive<Domain.IUser>(requestMessage);
        }

        void IUserLogin_NoReply.Login(string id, string password, Domain.IUserEventObserver observer)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUserLogin_PayloadTable.Login_Invoke { id = id, password = password, observer = (UserEventObserver)observer }
            };
            SendRequest(requestMessage);
        }
    }

    [ProtoContract]
    public class SurrogateForIUserLogin
    {
        [ProtoMember(1)] public IRequestTarget Target;

        [ProtoConverter]
        public static SurrogateForIUserLogin Convert(IUserLogin value)
        {
            if (value == null) return null;
            return new SurrogateForIUserLogin { Target = ((UserLoginRef)value).Target };
        }

        [ProtoConverter]
        public static IUserLogin Convert(SurrogateForIUserLogin value)
        {
            if (value == null) return null;
            return new UserLoginRef(value.Target);
        }
    }

    [AlternativeInterface(typeof(IUserLogin))]
    public interface IUserLoginSync : IInterfacedActorSync
    {
        Domain.IUser Login(string id, string password, Domain.IUserEventObserver observer);
    }
}

#endregion
#region Domain.IUserMessasing

namespace Domain
{
    [PayloadTable(typeof(IUserMessasing), PayloadTableKind.Request)]
    public static class IUserMessasing_PayloadTable
    {
        public static Type[,] GetPayloadTypes()
        {
            return new Type[,] {
                { typeof(Invite_Invoke), null },
                { typeof(Whisper_Invoke), null },
            };
        }

        [ProtoContract, TypeAlias]
        public class Invite_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            [ProtoMember(1)] public string invitorUserId;
            [ProtoMember(2)] public string roomName;

            public Type GetInterfaceType()
            {
                return typeof(IUserMessasing);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IUserMessasing)__target).Invite(invitorUserId, roomName);
                return null;
            }
        }

        [ProtoContract, TypeAlias]
        public class Whisper_Invoke
            : IInterfacedPayload, IAsyncInvokable
        {
            [ProtoMember(1)] public Domain.ChatItem chatItem;

            public Type GetInterfaceType()
            {
                return typeof(IUserMessasing);
            }

            public async Task<IValueGetable> InvokeAsync(object __target)
            {
                await ((IUserMessasing)__target).Whisper(chatItem);
                return null;
            }
        }
    }

    public interface IUserMessasing_NoReply
    {
        void Invite(string invitorUserId, string roomName);
        void Whisper(Domain.ChatItem chatItem);
    }

    public class UserMessasingRef : InterfacedActorRef, IUserMessasing, IUserMessasing_NoReply
    {
        public override Type InterfaceType => typeof(IUserMessasing);

        public UserMessasingRef() : base(null)
        {
        }

        public UserMessasingRef(IRequestTarget target) : base(target)
        {
        }

        public UserMessasingRef(IRequestTarget target, IRequestWaiter requestWaiter, TimeSpan? timeout = null) : base(target, requestWaiter, timeout)
        {
        }

        public IUserMessasing_NoReply WithNoReply()
        {
            return this;
        }

        public UserMessasingRef WithRequestWaiter(IRequestWaiter requestWaiter)
        {
            return new UserMessasingRef(Target, requestWaiter, Timeout);
        }

        public UserMessasingRef WithTimeout(TimeSpan? timeout)
        {
            return new UserMessasingRef(Target, RequestWaiter, timeout);
        }

        public Task Invite(string invitorUserId, string roomName)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUserMessasing_PayloadTable.Invite_Invoke { invitorUserId = invitorUserId, roomName = roomName }
            };
            return SendRequestAndWait(requestMessage);
        }

        public Task Whisper(Domain.ChatItem chatItem)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUserMessasing_PayloadTable.Whisper_Invoke { chatItem = chatItem }
            };
            return SendRequestAndWait(requestMessage);
        }

        void IUserMessasing_NoReply.Invite(string invitorUserId, string roomName)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUserMessasing_PayloadTable.Invite_Invoke { invitorUserId = invitorUserId, roomName = roomName }
            };
            SendRequest(requestMessage);
        }

        void IUserMessasing_NoReply.Whisper(Domain.ChatItem chatItem)
        {
            var requestMessage = new RequestMessage {
                InvokePayload = new IUserMessasing_PayloadTable.Whisper_Invoke { chatItem = chatItem }
            };
            SendRequest(requestMessage);
        }
    }

    [ProtoContract]
    public class SurrogateForIUserMessasing
    {
        [ProtoMember(1)] public IRequestTarget Target;

        [ProtoConverter]
        public static SurrogateForIUserMessasing Convert(IUserMessasing value)
        {
            if (value == null) return null;
            return new SurrogateForIUserMessasing { Target = ((UserMessasingRef)value).Target };
        }

        [ProtoConverter]
        public static IUserMessasing Convert(SurrogateForIUserMessasing value)
        {
            if (value == null) return null;
            return new UserMessasingRef(value.Target);
        }
    }

    [AlternativeInterface(typeof(IUserMessasing))]
    public interface IUserMessasingSync : IInterfacedActorSync
    {
        void Invite(string invitorUserId, string roomName);
        void Whisper(Domain.ChatItem chatItem);
    }
}

#endregion
#region Domain.IRoomObserver

namespace Domain
{
    [PayloadTable(typeof(IRoomObserver), PayloadTableKind.Notification)]
    public static class IRoomObserver_PayloadTable
    {
        public static Type[] GetPayloadTypes()
        {
            return new Type[] {
                typeof(Enter_Invoke),
                typeof(Exit_Invoke),
                typeof(Say_Invoke),
            };
        }

        [ProtoContract, TypeAlias]
        public class Enter_Invoke : IInterfacedPayload, IInvokable
        {
            [ProtoMember(1)] public string userId;

            public Type GetInterfaceType()
            {
                return typeof(IRoomObserver);
            }

            public void Invoke(object __target)
            {
                ((IRoomObserver)__target).Enter(userId);
            }
        }

        [ProtoContract, TypeAlias]
        public class Exit_Invoke : IInterfacedPayload, IInvokable
        {
            [ProtoMember(1)] public string userId;

            public Type GetInterfaceType()
            {
                return typeof(IRoomObserver);
            }

            public void Invoke(object __target)
            {
                ((IRoomObserver)__target).Exit(userId);
            }
        }

        [ProtoContract, TypeAlias]
        public class Say_Invoke : IInterfacedPayload, IInvokable
        {
            [ProtoMember(1)] public Domain.ChatItem chatItem;

            public Type GetInterfaceType()
            {
                return typeof(IRoomObserver);
            }

            public void Invoke(object __target)
            {
                ((IRoomObserver)__target).Say(chatItem);
            }
        }
    }

    public class RoomObserver : InterfacedObserver, IRoomObserver
    {
        public RoomObserver()
            : base(null, 0)
        {
        }

        public RoomObserver(INotificationChannel channel, int observerId = 0)
            : base(channel, observerId)
        {
        }

        public void Enter(string userId)
        {
            var payload = new IRoomObserver_PayloadTable.Enter_Invoke { userId = userId };
            Notify(payload);
        }

        public void Exit(string userId)
        {
            var payload = new IRoomObserver_PayloadTable.Exit_Invoke { userId = userId };
            Notify(payload);
        }

        public void Say(Domain.ChatItem chatItem)
        {
            var payload = new IRoomObserver_PayloadTable.Say_Invoke { chatItem = chatItem };
            Notify(payload);
        }
    }

    [ProtoContract]
    public class SurrogateForIRoomObserver
    {
        [ProtoMember(1)] public INotificationChannel Channel;
        [ProtoMember(2)] public int ObserverId;

        [ProtoConverter]
        public static SurrogateForIRoomObserver Convert(IRoomObserver value)
        {
            if (value == null) return null;
            var o = (RoomObserver)value;
            return new SurrogateForIRoomObserver { Channel = o.Channel, ObserverId = o.ObserverId };
        }

        [ProtoConverter]
        public static IRoomObserver Convert(SurrogateForIRoomObserver value)
        {
            if (value == null) return null;
            return new RoomObserver(value.Channel, value.ObserverId);
        }
    }

    [AlternativeInterface(typeof(IRoomObserver))]
    public interface IRoomObserverAsync : IInterfacedObserverSync
    {
        Task Enter(string userId);
        Task Exit(string userId);
        Task Say(Domain.ChatItem chatItem);
    }
}

#endregion
#region Domain.IUserEventObserver

namespace Domain
{
    [PayloadTable(typeof(IUserEventObserver), PayloadTableKind.Notification)]
    public static class IUserEventObserver_PayloadTable
    {
        public static Type[] GetPayloadTypes()
        {
            return new Type[] {
                typeof(Invite_Invoke),
                typeof(Whisper_Invoke),
            };
        }

        [ProtoContract, TypeAlias]
        public class Invite_Invoke : IInterfacedPayload, IInvokable
        {
            [ProtoMember(1)] public string invitorUserId;
            [ProtoMember(2)] public string roomName;

            public Type GetInterfaceType()
            {
                return typeof(IUserEventObserver);
            }

            public void Invoke(object __target)
            {
                ((IUserEventObserver)__target).Invite(invitorUserId, roomName);
            }
        }

        [ProtoContract, TypeAlias]
        public class Whisper_Invoke : IInterfacedPayload, IInvokable
        {
            [ProtoMember(1)] public Domain.ChatItem chatItem;

            public Type GetInterfaceType()
            {
                return typeof(IUserEventObserver);
            }

            public void Invoke(object __target)
            {
                ((IUserEventObserver)__target).Whisper(chatItem);
            }
        }
    }

    public class UserEventObserver : InterfacedObserver, IUserEventObserver
    {
        public UserEventObserver()
            : base(null, 0)
        {
        }

        public UserEventObserver(INotificationChannel channel, int observerId = 0)
            : base(channel, observerId)
        {
        }

        public void Invite(string invitorUserId, string roomName)
        {
            var payload = new IUserEventObserver_PayloadTable.Invite_Invoke { invitorUserId = invitorUserId, roomName = roomName };
            Notify(payload);
        }

        public void Whisper(Domain.ChatItem chatItem)
        {
            var payload = new IUserEventObserver_PayloadTable.Whisper_Invoke { chatItem = chatItem };
            Notify(payload);
        }
    }

    [ProtoContract]
    public class SurrogateForIUserEventObserver
    {
        [ProtoMember(1)] public INotificationChannel Channel;
        [ProtoMember(2)] public int ObserverId;

        [ProtoConverter]
        public static SurrogateForIUserEventObserver Convert(IUserEventObserver value)
        {
            if (value == null) return null;
            var o = (UserEventObserver)value;
            return new SurrogateForIUserEventObserver { Channel = o.Channel, ObserverId = o.ObserverId };
        }

        [ProtoConverter]
        public static IUserEventObserver Convert(SurrogateForIUserEventObserver value)
        {
            if (value == null) return null;
            return new UserEventObserver(value.Channel, value.ObserverId);
        }
    }

    [AlternativeInterface(typeof(IUserEventObserver))]
    public interface IUserEventObserverAsync : IInterfacedObserverSync
    {
        Task Invite(string invitorUserId, string roomName);
        Task Whisper(Domain.ChatItem chatItem);
    }
}

#endregion


text:
package me.thenightmancodeth.classi.views.custom;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;

import me.thenightmancodeth.classi.R;

/**
 * Created by thenightman on 1/8/17.
 **/

public class CircleView extends android.support.v7.widget.AppCompatTextView {
    private int backgroundColor = ContextCompat.getColor(getContext(), R.color.colorAccent);
    private int textColor;
    private Paint circlePaint;

    public CircleView(Context ctx, AttributeSet attrs) {
        super(ctx, attrs);

        TypedArray a = ctx.getTheme().obtainStyledAttributes(
                attrs,
                R.styleable.CircleView,
                0, 0);

        try {
            textColor = a.getColor(R.styleable.CircleView_text_color, ContextCompat.getColor(getContext(), R.color.colorAccent));
        } finally {
            a.recycle();
        }

        init();
    }

    private void init() {
        Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        textPaint.setColor(textColor);

        circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        circlePaint.setStyle(Paint.Style.FILL);
        circlePaint.setColor(backgroundColor);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        int h = this.getHeight();
        int w = this.getWidth();

        int diameter = ((h > w) ? h : w);
        int radius = diameter/2;

        this.setHeight(diameter);
        this.setWidth(diameter);

        canvas.drawCircle(diameter/2, diameter/2, radius, circlePaint);

        super.onDraw(canvas);
    }

    public void setBackgroundColor(int bgColor) {
        circlePaint.setColor(bgColor);
        invalidate();
        requestLayout();
    }
}