text:
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "symbol.h"
#include "table.h"

struct S_symbol_ {string name; S_symbol next;};

static S_symbol mksymbol(string name, S_symbol next)
{S_symbol s=checked_malloc(sizeof(*s));
 s->name=name;
 s->next=next;
 return s;
}

#define SIZE 109  /* should be prime */

static S_symbol hashtable[SIZE];

static unsigned int hash(char *s0)
{unsigned int h=0; char *s;
 for(s=s0; *s; s++)
       h = h*65599 + *s;
 return h;
}

static int streq(string a, string b)
{
 return !strcmp(a,b);
}

S_symbol S_Symbol(string name)
{int index= hash(name) % SIZE;
 S_symbol syms = hashtable[index], sym;
 for(sym=syms; sym; sym=sym->next)
   if (streq(sym->name,name)) return sym;
 sym = mksymbol(name,syms);
 hashtable[index]=sym;
 return sym;
}

string S_name(S_symbol sym)
{
 return sym->name;
}

S_table S_empty(void)
{
 return TAB_empty();
}

void S_enter(S_table t, S_symbol sym, void *value) {
  TAB_enter(t,sym,value);
}

void *S_look(S_table t, S_symbol sym) {
  return TAB_look(t,sym);
}

static struct S_symbol_ marksym = {"<mark>",0};

void S_beginScope(S_table t)
{ S_enter(t,&marksym,NULL);
}

void S_endScope(S_table t)
{S_symbol s;
  do s=TAB_pop(t);
  while (s != &marksym);
}

void S_dump(S_table t, void (*show)(S_symbol sym, void *binding)) {
  TAB_dump(t, (void (*)(void *, void *)) show);
}


text:
"""Support for Risco alarms."""
from __future__ import annotations

from collections.abc import Callable
import logging
from typing import Any

from pyrisco.common import Partition

from homeassistant.components.alarm_control_panel import (
    AlarmControlPanelEntity,
    AlarmControlPanelEntityFeature,
    CodeFormat,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
    CONF_PIN,
    STATE_ALARM_ARMED_AWAY,
    STATE_ALARM_ARMED_CUSTOM_BYPASS,
    STATE_ALARM_ARMED_HOME,
    STATE_ALARM_ARMED_NIGHT,
    STATE_ALARM_ARMING,
    STATE_ALARM_DISARMED,
    STATE_ALARM_TRIGGERED,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import LocalData, RiscoDataUpdateCoordinator, is_local
from .const import (
    CONF_CODE_ARM_REQUIRED,
    CONF_CODE_DISARM_REQUIRED,
    CONF_HA_STATES_TO_RISCO,
    CONF_RISCO_STATES_TO_HA,
    DATA_COORDINATOR,
    DEFAULT_OPTIONS,
    DOMAIN,
    RISCO_ARM,
    RISCO_GROUPS,
    RISCO_PARTIAL_ARM,
)
from .entity import RiscoEntity

_LOGGER = logging.getLogger(__name__)

STATES_TO_SUPPORTED_FEATURES = {
    STATE_ALARM_ARMED_AWAY: AlarmControlPanelEntityFeature.ARM_AWAY,
    STATE_ALARM_ARMED_CUSTOM_BYPASS: AlarmControlPanelEntityFeature.ARM_CUSTOM_BYPASS,
    STATE_ALARM_ARMED_HOME: AlarmControlPanelEntityFeature.ARM_HOME,
    STATE_ALARM_ARMED_NIGHT: AlarmControlPanelEntityFeature.ARM_NIGHT,
}

async def async_setup_entry(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    async_add_entities: AddEntitiesCallback,
) -> None:
    """Set up the Risco alarm control panel."""
    options = {**DEFAULT_OPTIONS, **config_entry.options}
    if is_local(config_entry):
        local_data: LocalData = hass.data[DOMAIN][config_entry.entry_id]
        async_add_entities(
            RiscoLocalAlarm(
                local_data.system.id,
                partition_id,
                partition,
                local_data.partition_updates,
                config_entry.data[CONF_PIN],
                options,
            )
            for partition_id, partition in local_data.system.partitions.items()
        )
    else:
        coordinator: RiscoDataUpdateCoordinator = hass.data[DOMAIN][
            config_entry.entry_id
        ][DATA_COORDINATOR]
        async_add_entities(
            RiscoCloudAlarm(
                coordinator, partition_id, config_entry.data[CONF_PIN], options
            )
            for partition_id in coordinator.data.partitions
        )

class RiscoAlarm(AlarmControlPanelEntity):
    """Representation of a Risco cloud partition."""

    _attr_code_format = CodeFormat.NUMBER

    def __init__(
        self,
        *,
        partition_id: int,
        partition: Partition,
        code: str,
        options: dict[str, Any],
        **kwargs: Any,
    ) -> None:
        """Init the partition."""
        super().__init__(**kwargs)
        self._partition_id = partition_id
        self._partition = partition
        self._code = code
        self._attr_code_arm_required = options[CONF_CODE_ARM_REQUIRED]
        self._code_disarm_required = options[CONF_CODE_DISARM_REQUIRED]
        self._risco_to_ha = options[CONF_RISCO_STATES_TO_HA]
        self._ha_to_risco = options[CONF_HA_STATES_TO_RISCO]
        self._attr_supported_features = 0
        self._attr_has_entity_name = True
        self._attr_name = None
        for state in self._ha_to_risco:
            self._attr_supported_features |= STATES_TO_SUPPORTED_FEATURES[state]

    @property
    def state(self) -> str | None:
        """Return the state of the device."""
        if self._partition.triggered:
            return STATE_ALARM_TRIGGERED
        if self._partition.arming:
            return STATE_ALARM_ARMING
        if self._partition.disarmed:
            return STATE_ALARM_DISARMED
        if self._partition.armed:
            return self._risco_to_ha[RISCO_ARM]
        if self._partition.partially_armed:
            for group, armed in self._partition.groups.items():
                if armed:
                    return self._risco_to_ha[group]

            return self._risco_to_ha[RISCO_PARTIAL_ARM]

        return None

    def _validate_code(self, code):
        """Validate given code."""
        return code == self._code

    async def async_alarm_disarm(self, code: str | None = None) -> None:
        """Send disarm command."""
        if self._code_disarm_required and not self._validate_code(code):
            _LOGGER.warning("Wrong code entered for disarming")
            return
        await self._call_alarm_method("disarm")

    async def async_alarm_arm_home(self, code: str | None = None) -> None:
        """Send arm home command."""
        await self._arm(STATE_ALARM_ARMED_HOME, code)

    async def async_alarm_arm_away(self, code: str | None = None) -> None:
        """Send arm away command."""
        await self._arm(STATE_ALARM_ARMED_AWAY, code)

    async def async_alarm_arm_night(self, code: str | None = None) -> None:
        """Send arm night command."""
        await self._arm(STATE_ALARM_ARMED_NIGHT, code)

    async def async_alarm_arm_custom_bypass(self, code: str | None = None) -> None:
        """Send arm custom bypass command."""
        await self._arm(STATE_ALARM_ARMED_CUSTOM_BYPASS, code)

    async def _arm(self, mode, code):
        if self.code_arm_required and not self._validate_code(code):
            _LOGGER.warning("Wrong code entered for %s", mode)
            return

        if not (risco_state := self._ha_to_risco[mode]):
            _LOGGER.warning("No mapping for mode %s", mode)
            return

        if risco_state in RISCO_GROUPS:
            await self._call_alarm_method("group_arm", risco_state)
        else:
            await self._call_alarm_method(risco_state)

    async def _call_alarm_method(self, method: str, *args: Any) -> None:
        raise NotImplementedError

class RiscoCloudAlarm(RiscoAlarm, RiscoEntity):
    """Representation of a Risco partition."""

    def __init__(
        self,
        coordinator: RiscoDataUpdateCoordinator,
        partition_id: int,
        code: str,
        options: dict[str, Any],
    ) -> None:
        """Init the partition."""
        super().__init__(
            partition_id=partition_id,
            partition=coordinator.data.partitions[partition_id],
            coordinator=coordinator,
            code=code,
            options=options,
        )
        self._attr_unique_id = f"{self._risco.site_uuid}_{partition_id}"
        self._attr_device_info = DeviceInfo(
            identifiers={(DOMAIN, self._attr_unique_id)},
            name=f"Risco {self._risco.site_name} Partition {partition_id}",
            manufacturer="Risco",
        )

    def _get_data_from_coordinator(self) -> None:
        self._partition = self.coordinator.data.partitions[self._partition_id]

    async def _call_alarm_method(self, method, *args):
        alarm = await getattr(self._risco, method)(self._partition_id, *args)
        self._partition = alarm.partitions[self._partition_id]
        self.async_write_ha_state()

class RiscoLocalAlarm(RiscoAlarm):
    """Representation of a Risco local, partition."""

    _attr_should_poll = False

    def __init__(
        self,
        system_id: str,
        partition_id: int,
        partition: Partition,
        partition_updates: dict[int, Callable[[], Any]],
        code: str,
        options: dict[str, Any],
    ) -> None:
        """Init the partition."""
        super().__init__(
            partition_id=partition_id, partition=partition, code=code, options=options
        )
        self._system_id = system_id
        self._partition_updates = partition_updates
        self._attr_unique_id = f"{system_id}_{partition_id}_local"
        self._attr_device_info = DeviceInfo(
            identifiers={(DOMAIN, self._attr_unique_id)},
            name=partition.name,
            manufacturer="Risco",
        )

    async def async_added_to_hass(self) -> None:
        """Subscribe to updates."""
        self._partition_updates[self._partition_id] = self.async_write_ha_state

    async def _call_alarm_method(self, method: str, *args: Any) -> None:
        await getattr(self._partition, method)(*args)

redpajama_set_name: RedPajamaGithub


text:
#ifndef BINJGB_EMULATOR_DEBUG_H_
#define BINJGB_EMULATOR_DEBUG_H_

#include "common.h"
#include "emulator.h"

#ifdef __cplusplus
extern "C" {
#endif

#define FOREACH_LOG_SYSTEM(V) \
  V(A, apu, APU)              \
  V(H, host, HOST)            \
  V(I, io, IO)                \
  V(N, interrupt, INTERRUPT)  \
  V(M, memory, MEMORY)        \
  V(P, ppu, PPU)

#define V(SHORT_NAME, name, NAME) \
  LOG_SYSTEM_##NAME, LOG_SYSTEM_##SHORT_NAME = LOG_SYSTEM_##NAME,
typedef enum LogSystem {
  FOREACH_LOG_SYSTEM(V)
  NUM_LOG_SYSTEMS,
} LogSystem;
#undef V

typedef enum LogLevel {
  LOG_LEVEL_QUIET = 0,
  LOG_LEVEL_INFO = 1,
  LOG_LEVEL_DEBUG = 2,
  LOG_LEVEL_VERBOSE = 3,
} LogLevel;

typedef enum SetLogLevelError {
  SET_LOG_LEVEL_ERROR_NONE = 0,
  SET_LOG_LEVEL_ERROR_INVALID_FORMAT = 1,
  SET_LOG_LEVEL_ERROR_UNKNOWN_LOG_SYSTEM = 2,
} SetLogLevelError;

typedef enum CgbPaletteType {
  CGB_PALETTE_TYPE_BGCP,
  CGB_PALETTE_TYPE_OBCP,
} CgbPaletteType;

typedef enum LayerType {
  LAYER_TYPE_BG,
  LAYER_TYPE_WINDOW,
} LayerType;

typedef enum {
  ROM_USAGE_CODE = 1,
  ROM_USAGE_DATA = 2,
  ROM_USAGE_CODE_START = 4, /* Start of an opcode. */
} RomUsage;

#define TILE_DATA_TEXTURE_WIDTH 256
#define TILE_DATA_TEXTURE_HEIGHT 192
typedef u8 TileData[TILE_DATA_TEXTURE_WIDTH * TILE_DATA_TEXTURE_HEIGHT];

#define TILE_MAP_WIDTH 32
#define TILE_MAP_HEIGHT 32
#define TILE_MAP_SIZE (TILE_MAP_WIDTH * TILE_MAP_HEIGHT)
typedef u8 TileMap[TILE_MAP_SIZE];

#if 0
typedef struct EmulatorHookContext {
  Emulator* e;
  void* user_data;
} EmulatorHookContext;

typedef struct EmulatorHooks {
  void* user_data;
  void (*message)(LogSystem, LogLevel, const char* message);
} EmulatorHooks;

void emulator_set_hooks(Emulator*, EmulatorHooks*);
#endif

typedef struct {
  int id;
  Address addr;
  u8 bank;
  unsigned valid : 1;
  unsigned enabled : 1;
  unsigned hit : 1;
} Breakpoint;

void emulator_set_log_level(LogSystem, LogLevel);
SetLogLevelError emulator_set_log_level_from_string(const char*);
Bool emulator_get_trace();
void emulator_set_trace(Bool trace);
void emulator_push_trace(Bool trace);
void emulator_pop_trace();
const char* emulator_get_log_system_name(LogSystem);
LogLevel emulator_get_log_level(LogSystem);
void emulator_print_log_systems();

Bool emulator_is_cgb(Emulator*);
Bool emulator_is_sgb(Emulator*);

int emulator_get_rom_size(Emulator*);
Bool emulator_get_rom_usage_enabled(void);
void emulator_set_rom_usage_enabled(Bool enable);
u8* emulator_get_rom_usage(void);
void emulator_clear_rom_usage(void);

Bool emulator_get_opcode_count_enabled(void);
void emulator_set_opcode_count_enabled(Bool enable);
u32* emulator_get_opcode_count(void);
u32* emulator_get_cb_opcode_count(void);

Bool emulator_get_profiling_enabled(void);
void emulator_set_profiling_enabled(Bool enable);
u32* emulator_get_profiling_counters(void);

void emulator_get_opcode_mnemonic(u16 opcode, char* buffer, size_t size);
int emulator_disassemble(Emulator*, Address, char* buffer, size_t size);
void emulator_disassemble_rom(Emulator*, u32 rom_addr, char* buffer,
                              size_t size);
Registers emulator_get_registers(Emulator*);

int emulator_get_max_breakpoint_id(void);
Breakpoint emulator_get_breakpoint(int id);
Breakpoint emulator_get_breakpoint_by_address(Emulator*, Address addr);
int emulator_add_empty_breakpoint(void);
int emulator_add_breakpoint(Emulator*, Address, Bool enabled);
void emulator_set_breakpoint_address(Emulator*, int id, Address);
void emulator_enable_breakpoint(int id, Bool enabled);
void emulator_remove_breakpoint(int id);

int emulator_get_rom_bank(Emulator*, Address);

u8 emulator_read_u8_raw(Emulator*, Address);
void emulator_write_u8_raw(Emulator*, Address, u8);

TileDataSelect emulator_get_tile_data_select(Emulator*);
TileMapSelect emulator_get_tile_map_select(Emulator*, LayerType);
Palette emulator_get_palette(Emulator*, PaletteType);
PaletteRGBA emulator_get_palette_rgba(Emulator*, PaletteType);
PaletteRGBA emulator_get_cgb_palette_rgba(Emulator*, CgbPaletteType, int index);
PaletteRGBA emulator_get_sgb_palette_rgba(Emulator*, int index);
void emulator_get_tile_data(Emulator*, TileData);
void emulator_get_tile_map(Emulator*, TileMapSelect, TileMap);
void emulator_get_tile_map_attr(Emulator*, TileMapSelect, TileMap);
void emulator_get_sgb_attr_map(Emulator*, u8[90]);
void emulator_get_bg_scroll(Emulator*, u8* x, u8* y);
void emulator_get_window_scroll(Emulator*, u8* x, u8* y);

Bool emulator_get_display(Emulator*);
Bool emulator_get_bg_display(Emulator*);
Bool emulator_get_window_display(Emulator*);
Bool emulator_get_obj_display(Emulator*);

ObjSize emulator_get_obj_size(Emulator*);
Obj emulator_get_obj(Emulator*, int index);
Bool obj_is_visible(const Obj* obj);

PaletteRGBA palette_to_palette_rgba(Emulator* e, PaletteType, Palette);

int opcode_bytes(u8 opcode);

#ifdef __cplusplus
}
#endif

#endif /* BINJGB_EMULATOR_DEBUG_H_ */


text:
/*
 * $Id: maildirstorage.h,v 1.7 2006/06/02 15:44:29 smarinier Exp $
 */

#ifndef MAILDIRSTORAGE_H

#define MAILDIRSTORAGE_H

#include <libetpan/maildirdriver_types.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
  maildir_mailstorage_init is the constructor for a maildir storage.

  @param storage this is the storage to initialize.

  @param pathname is the directory that contains the mailbox.

  @param cached if this value is != 0, a persistant cache will be
    stored on local system.

  @param cache_directory is the location of the cache

  @param flags_directory is the location of the flags
*/

LIBETPAN_EXPORT
int maildir_mailstorage_init(struct mailstorage * storage,
    const char * md_pathname, int md_cached,
    const char * md_cache_directory, const char * md_flags_directory);

#ifdef __cplusplus
}
#endif

#endif


text:
/* global require, exports */

const EventEmitter = require('events').EventEmitter;
const Helpers = require('./Helpers');
const logger = require('./../../common/logger').logger;

const log = logger.getLogger('Node');

const WARN_PRECOND_FAILED = 412;

class Node extends EventEmitter {
  constructor(clientId, streamId, options = {}) {
    super();
    this.clientId = clientId;
    this.streamId = streamId;
    this.label = options.label;
    this.erizoStreamId = Helpers.getErizoStreamId(clientId, streamId);
    this.options = options;
  }

  getStats(label, stats) {
    const promise = new Promise((resolve) => {
      if (!this.mediaStream || !this.connection) {
        resolve();
        return;
      }
      this.mediaStream.getStats((statsString) => {
        const unfilteredStats = JSON.parse(statsString);
        unfilteredStats.metadata = this.connection.metadata;
        // eslint-disable-next-line no-param-reassign
        stats[label] = unfilteredStats;
        resolve();
      });
    });
    return promise;
  }

  _onMonitorMinVideoBWCallback(type, message) {
    this.emit(type, message);
  }

  initMediaStream() {
    if (!this.mediaStream) {
      return;
    }
    const mediaStream = this.mediaStream;
    if (mediaStream.minVideoBW) {
      let monitorMinVideoBw = {};
      if (mediaStream.scheme) {
        try {
          // eslint-disable-next-line import/no-dynamic-require, global-require
          monitorMinVideoBw = require(`../adapt_schemes/${mediaStream.scheme}`)
            .MonitorSubscriber(log);
        } catch (e) {
          log.warn('message: could not find custom adapt scheme, ' +
                   `code: ${WARN_PRECOND_FAILED}, ` +
                   `id:${this.clientId}, ` +
                   `scheme: ${mediaStream.scheme},`,
                   logger.objectToLog(this.options.metadata));
        }
      } else {
        // eslint-disable-next-line global-require
        monitorMinVideoBw = require('../adapt_schemes/notify').MonitorSubscriber(log);
      }
      monitorMinVideoBw(mediaStream, this._onMonitorMinVideoBWCallback.bind(this), this.clientId);
    }

    if (global.config.erizoController.report.rtcp_stats) {
      log.debug('message: RTCP Stat collection is active');
      mediaStream.getPeriodicStats((newStats) => {
        this.emit('periodic_stats', newStats);
      });
    }
  }
}

exports.Node = Node;


text:
<form action="<?php echo $action;?>" method="POST" accept-charset="UTF-8" role="form">
	<fieldset>

			<input class="form-control" placeholder="<?php echo UTF8::ucfirst(__('username'));?>" name="username" type="text" value="<?php echo $username;?>">

			<input class="form-control" placeholder="<?php echo UTF8::ucfirst(__('email'));?>" name="email" type="email" value="<?php echo $email;?>">

			<input class="form-control" placeholder="<?php echo UTF8::ucfirst(__('password'));?>" name="password" type="password" value="">

			<input class="form-control" placeholder="<?php echo UTF8::ucfirst(__('password confirm'));?>" name="password_confirm" type="password" value="">

		<?php if($captcha_view):?>

			<?php echo $captcha_view;?>
			<input class="form-control" placeholder="<?php echo UTF8::ucfirst(__('answer'));?>" name="captcha" type="text" value="">

		<?php endif;?>
		<?php echo Form::hidden('csrf', $csrf);?>
		<button type="submit" class="btn btn-primary btn-block"><?php echo UTF8::ucfirst(__('sign up'));?></button>
	</fieldset>
</form>


text:
package renderEngine;

import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.ContextAttribs;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.PixelFormat;

import engineTester.Settings;

public class DisplayManager {

	private static long lastFrameTime;
	private static float delta;
	public final static String WINDOWNAME = "Mystic Bastion!";

	// frames per second
	static int fps;
	static boolean SHOWFPS = Settings.SHOW_FPS;
	/** last fps time */
	static long lastFPS;
	static int fpsCountRefreshRate = Settings.FPS_REFRESH_TIME;

	public static void createDisplay() {
		ContextAttribs attribs = new ContextAttribs(3, 3).withForwardCompatible(true).withProfileCore(true);

		try {
			//Display.setResizable(true); // whether our window is resizable
			Display.setDisplayMode(new DisplayMode(Settings.WINDOW_WIDTH, Settings.WINDOW_HEIGHT));
			Display.setVSyncEnabled(Settings.VSYNC); // whether hardware VSync
														// is enabled
			Display.setFullscreen(Settings.FULL_SCREEN); // whether fullscreen
															// is
															// enabled
			if (Settings.ENABLE_ANTIALIASING) {
				Display.create(new PixelFormat().withDepthBits(24), attribs);
				System.out.println(GL11.glGetInteger(GL11.GL_DEPTH_BITS));
				GL11.glEnable(GL13.GL_MULTISAMPLE);
			} else {
				Display.create(new PixelFormat(), attribs);
			}
			Display.setTitle(WINDOWNAME);
		} catch (LWJGLException e) {
			e.printStackTrace();
		}

		GL11.glViewport(0, 0, Settings.WINDOW_WIDTH, Settings.WINDOW_HEIGHT);
		lastFrameTime = getCurrentTime();
		lastFPS = lastFrameTime;
	}

	public static void updateDisplay() {
		Display.sync(Settings.FPS_CAP);
		Display.update();
		long currentFrameTime = getCurrentTime();
		delta = (currentFrameTime - lastFrameTime) / 1000f;
		lastFrameTime = currentFrameTime;
		if (SHOWFPS) {
			updateFPS(); // update FPS Counter
		}
	}

	public static float getFrameTimeSeconds() {
		return delta;
	}

	public static void closeDisplay() {
		Display.destroy();
	}

	private static long getCurrentTime() {
		return Sys.getTime() * 1000 / Sys.getTimerResolution();
	}

	/**
	 * Calculate the FPS
	 */
	public static void updateFPS() {
		if (getCurrentTime() - lastFPS > fpsCountRefreshRate) {
			Display.setTitle(WINDOWNAME + " FPS: " + fps);
			fps = 0;
			lastFPS += 1000;
		}
		fps++;
	}
}


text:
// Copyright 2017 Istio Authors. All Rights Reserved.
//
// 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.

package env

import (
	"fmt"
	"log"
	"os"
	"os/exec"
	"path/filepath"
	"strconv"
	"time"

	"istio.io/istio/tests/util"
)

// Envoy stores data for Envoy process
type Envoy struct {
	cmd   *exec.Cmd
	ports *Ports
}

// NewEnvoy creates a new Envoy struct and starts envoy.
func (s *TestSetup) NewEnvoy() (*Envoy, error) {
	confPath := filepath.Join(util.IstioOut, fmt.Sprintf("config.conf.%v.yaml", s.ports.AdminPort))
	log.Printf("Envoy config: in %v\n", confPath)
	if err := s.CreateEnvoyConf(confPath); err != nil {
		return nil, err
	}

	debugLevel := os.Getenv("ENVOY_DEBUG")
	if len(debugLevel) == 0 {
		debugLevel = "info"
	}

	// Don't use hot-start, each Envoy re-start use different base-id
	args := []string{"-c", confPath,
		"--v2-config-only",
		"--drain-time-s", "1",
		// base id is shared between restarted envoys
		"--base-id", strconv.Itoa(int(s.testName))}
	if s.stress {
		args = append(args, "--concurrency", "10")
	} else {
		// debug is far too verbose.
		args = append(args, "-l", debugLevel, "--concurrency", "1")
	}
	if s.disableHotRestart {
		args = append(args, "--disable-hot-restart")
	} else {
		args = append(args,
			"--parent-shutdown-time-s", "1",
			"--restart-epoch", strconv.Itoa(s.epoch))
	}
	if s.EnvoyParams != nil {
		args = append(args, s.EnvoyParams...)
	}
	/* #nosec */
	envoyPath := filepath.Join(util.IstioBin, "envoy")
	if path, exists := os.LookupEnv("ENVOY_PATH"); exists {
		envoyPath = path
	}
	cmd := exec.Command(envoyPath, args...)
	cmd.Stderr = os.Stderr
	cmd.Stdout = os.Stdout
	return &Envoy{
		cmd:   cmd,
		ports: s.ports,
	}, nil
}

// Start starts the envoy process
func (s *Envoy) Start() error {
	err := s.cmd.Start()
	if err != nil {
		return err
	}

	url := fmt.Sprintf("http://localhost:%v/server_info", s.ports.AdminPort)
	WaitForHTTPServer(url)

	return nil
}

// Stop stops the envoy process
func (s *Envoy) Stop() error {
	log.Printf("stop envoy ...\n")
	_, _, _ = HTTPPost(fmt.Sprintf("http://127.0.0.1:%v/quitquitquit", s.ports.AdminPort), "", "")
	done := make(chan error, 1)
	go func() {
		done <- s.cmd.Wait()
	}()

	select {
	case <-time.After(3 * time.Second):
		log.Println("envoy killed as timeout reached")
		if err := s.cmd.Process.Kill(); err != nil {
			return err
		}
	case err := <-done:
		log.Printf("stop envoy ... done\n")
		return err
	}

	return nil
}


text:
package com.freshplanet.ane.AirFacebook.functions;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;
//import com.facebook.AppEventsLogger;
//import com.facebook.AppLinkData;

public class OpenDeferredAppLinkFunction implements FREFunction
{
	@Override
	public FREObject call(FREContext context, FREObject[] args)
	{
   	 /* Facebook Docs
   	  * https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads-engagement#measure
   	  */
//		AppLinkData.fetchDeferredAppLinkData(context.getActivity(), new AppLinkData.CompletionHandler() {
//			@Override
//			public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
//
//			// TODO: Implement - 12/12/2014 - Nigam
//
//			/* NOTE: Per post in stackoverflow, this doesn't work in Android
//
//			http://stackoverflow.com/questions/26695003/how-to-get-facebook-app-link-if-app-wasnt-installed
//			"As of Dec 2, 2014 facebook deferred app links are broken on Android.
//			I can get my app links to work when the app is already installed, but
//			when the app is NOT already installed the app link is never sent to the app after it's installed.
//			I'm in touch with facebook, I'll post any updates here."
//
//			 */
//
//			}
//		});

		return null;
	}
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.carobotics.main;

import edu.wpi.first.wpilibj.IterativeRobot;

import org.carobotics.hardware.Talon;
import org.carobotics.logic.RobotTriangleDriveMappingThread;
import org.carobotics.logic.ThreadManager;
import org.carobotics.logic.actions.TimeMovementAction;
import org.carobotics.networking.Networking;
import org.carobotics.subsystems.FourStickDriverStation;
import org.carobotics.subsystems.RobotTriangleBase;
/**
 *
 * @author Student
 */
public class TriangleRobot2014 extends IterativeRobot {

    FourStickDriverStation driverStation;
    RobotTriangleBase driveBase;
    ThreadManager threadManager = new ThreadManager();
    RobotTriangleDriveMappingThread driveThread;
    TimeMovementAction forwardAction;
    Networking network;
    Talon leftDrive, rightDrive, backDrive;

    public void robotInit() {
        System.out.println("\n");// shows code is working
        System.out.println("//////////////////////////////////////////////////////");
        System.out.println("// Cavalier Robotics                     TEAM 619   //");
        System.out.println("// 2014 Triangle Robot                              //");
        System.out.println("//////////////////////////////////////////////////////\n");

        // Create all robot subsystems (i.e. stuff from org.carobotics.subsystems)
        // If you are creating something not from org.carobotics.subsystems, YER DOING IT WRONG

        //driver station
        driverStation = new FourStickDriverStation(1, 2, 3, 4);

        rightDrive = new Talon(1);
        leftDrive = new Talon(2);
        backDrive = new Talon(3);

        driveBase = new RobotTriangleBase(leftDrive, rightDrive, backDrive);
    }

    public void autonomousInit() {

        threadManager.killAllThreads(); // DO NOT REMOVE!!!
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {
    }

    public void teleopInit() {
        threadManager.killAllThreads(); // DO NOT REMOVE!!!

        //initialize the threads
        //thwackerThread = new ThwackerMappingThread(thwacker, comp, driverStation, 10, threadManager);
        driveThread = new RobotTriangleDriveMappingThread(driveBase, driverStation, 10, threadManager);

        //start the threads
        //thwackerThread.start();//starts thread for thwacker shooter
        driveThread.start();//starts thread for driving

    }

    public void teleopPeriodic() {
    }

    public void teleopContinuous() {
    }

    public void disabledInit() {
        threadManager.killAllThreads(); // DO NOT REMOVE!!!
    }

    public void disabledPeriodic() {
    }

    public void disabledContinuous() {
    }
}


text:
require_relative "empty_directory"

class Thor
  module Actions
    # Injects the given content into a file. Different from gsub_file, this
    # method is reversible.
    #
    # ==== Parameters
    # destination<String>:: Relative path to the destination root
    # data<String>:: Data to add to the file. Can be given as a block.
    # config<Hash>:: give :verbose => false to not log the status and the flag
    #                for injection (:after or :before) or :force => true for
    #                insert two or more times the same content.
    #
    # ==== Examples
    #
    #   insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
    #
    #   insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
    #     gems = ask "Which gems would you like to add?"
    #     gems.split(" ").map{ |gem| "  config.gem :#{gem}" }.join("\n")
    #   end
    #
    WARNINGS = { unchanged_no_flag: 'File unchanged! The supplied flag value not found!' }

    def insert_into_file(destination, *args, &block)
      data = block_given? ? block : args.shift

      config = args.shift || {}
      config[:after] = /\z/ unless config.key?(:before) || config.key?(:after)

      action InjectIntoFile.new(self, destination, data, config)
    end
    alias_method :inject_into_file, :insert_into_file

    class InjectIntoFile < EmptyDirectory #:nodoc:
      attr_reader :replacement, :flag, :behavior

      def initialize(base, destination, data, config)
        super(base, destination, {:verbose => true}.merge(config))

        @behavior, @flag = if @config.key?(:after)
          [:after, @config.delete(:after)]
        else
          [:before, @config.delete(:before)]
        end

        @replacement = data.is_a?(Proc) ? data.call : data
        @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp)
      end

      def invoke!
        content = if @behavior == :after
          '\0' + replacement
        else
          replacement + '\0'
        end

        if exists?
          if replace!(/#{flag}/, content, config[:force])
            say_status(:invoke)
          else
            say_status(:unchanged, warning: WARNINGS[:unchanged_no_flag], color: :red)
          end
        else
          unless pretend?
            raise Thor::Error, "The file #{ destination } does not appear to exist"
          end
        end
      end

      def revoke!
        say_status :revoke

        regexp = if @behavior == :after
          content = '\1\2'
          /(#{flag})(.*)(#{Regexp.escape(replacement)})/m
        else
          content = '\2\3'
          /(#{Regexp.escape(replacement)})(.*)(#{flag})/m
        end

        replace!(regexp, content, true)
      end

    protected

      def say_status(behavior, warning: nil, color: nil)
        status = if behavior == :invoke
          if flag == /\A/
            :prepend
          elsif flag == /\z/
            :append
          else
            :insert
          end
        elsif warning
          warning
        else
          :subtract
        end

        super(status, (color || config[:verbose]))
      end

      # Adds the content to the file.
      #
      def replace!(regexp, string, force)
        return if pretend?
        content = File.read(destination)
        if force || !content.include?(replacement)
          success = content.gsub!(regexp, string)

          File.open(destination, "wb") { |file| file.write(content) }
          success
        end
      end
    end
  end
end


text:
{-# LANGUAGE TupleSections, OverloadedStrings #-}
module Handler.Home where

import Import
import Yesod.Form.Bootstrap3
    ( BootstrapFormLayout (..), renderBootstrap3, withSmallInput )

-- This is a handler function for the GET request method on the HomeR
-- resource pattern. All of your resource patterns are defined in
-- config/routes
--
-- The majority of the code you will write in Yesod lives in these handler
-- functions. You can spread them across multiple files if you are so
-- inclined, or create a single monolithic file.
getHomeR :: Handler Html
getHomeR = do
    defaultLayout $ do
        setTitle "Welcome to terrelln.me"
        $(widgetFile "homepage")


text:
server ENV.fetch("CAPISTRANO_APP_NAME"), roles: [:app, :db, :web], :primary => true

set :unicorn_workers, "2"
set :nginx_server_name, ENV.fetch("CAPISTRANO_APP_SERVER_NAME")

set :environment, "production"
set :branch, ENV.fetch("branch", "master")

set :linked_files, fetch(:linked_files, []).push('.env.production')
set :linked_dirs, fetch(:linked_dirs, []).push("public/rates")


text:
"""
A simple client that allows idiomatic access to the Niddel Magnet v2 REST API
(https://api.niddel.com/v2). Uses the wonderful requests (http://docs.python-requests.org/)
package to perform the requests.
"""

__version__ = '1.6.6'

# set up package logger
import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())

# import Connection class into namespace, but handle failure during setup if
# dependencies are not present yet
try:
    from magnetsdk2.connection import Connection
except ImportError:
    pass


text:
package uk.co.reliquia.healthapp;

/*
 * ExerciseInfo - Represents information about a single exercise
 */
public class ExerciseInfo
{
    /*
     * Duration - The duration of this exercise in minutes
     */
    public final int Duration;

    /*
     * Calories - The calories burned per minute by this exercise type
     */
    public final int Calories;

    /*
     * Name - The name of this exercise type
     */
    public final String Name;

    /*
     * ExerciseInfo - The constructor
     */
    public ExerciseInfo(int duration, int calories, String name)
    {
        // Initialise
        Duration = duration;
        Calories = calories;
        Name = name;
    }

    @Override
    public String toString()
    {
        return String.format("%s - %d mins", Name, Duration);
    }

}


text:
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"

PLATFORM=x86
BUILD_TYPE=Debug

# Detect number of processor cores
# default is 4 jobs
if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]]
then
	JOBS=$(sysctl -n hw.ncpu)
	PLATFORM=osx
elif [[ "$TRAVIS_OS_NAME" == 'linux' ]]
then
	JOBS=$(nproc)
fi

# compile prepare
mkdir build || exit 1
cd build

# Compile hyperion for tags
[ -n "${TRAVIS_TAG:-}" ] && BUILD_TYPE=Release

# Compile hyperion for cron - take default settings

# Compile for PR (no tag and no cron)
[ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev

cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2

echo "compile jobs: ${JOBS:=4}"
make -j ${JOBS} || exit 3

# Build the package on Linux
if [[ $TRAVIS_OS_NAME == 'linux' ]]
then
	make -j ${JOBS} package || exit 4
fi


text:
server-push-demo
================

A demo for server push.

This is a App Engine demo uses the following technologies: Apache wink, Guice.


text:
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_exception

from nssrc.com.citrix.netscaler.nitro.util.nitro_util import nitro_util

class vpnsessionpolicy(base_resource) :
	""" Configuration for VPN session policy resource. """
	def __init__(self) :
		self._name = ""
		self._rule = ""
		self._action = ""
		self._builtin = []
		self.___count = 0

	@property
	def name(self) :
		"""Name for the new session policy that is applied after the user logs on to NetScaler Gateway.
Minimum length =  1.
		"""
		try :
			return self._name
		except Exception as e:
			raise e

	@name.setter
	def name(self, name) :
		"""Name for the new session policy that is applied after the user logs on to NetScaler Gateway.
Minimum length =  1
		"""
		try :
			self._name = name
		except Exception as e:
			raise e

	@property
	def rule(self) :
		"""Expression, or name of a named expression, specifying the traffic that matches the policy. Can be written in either default or classic syntax.
		Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'
		The following requirements apply only to the NetScaler CLI:
		* If the expression includes one or more spaces, enclose the entire expression in double quotation marks.
		* If the expression itself includes double quotation marks, escape the quotations by using the \ character.
		* Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.
		"""
		try :
			return self._rule
		except Exception as e:
			raise e

	@rule.setter
	def rule(self, rule) :
		"""Expression, or name of a named expression, specifying the traffic that matches the policy. Can be written in either default or classic syntax.
		Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'
		The following requirements apply only to the NetScaler CLI:
		* If the expression includes one or more spaces, enclose the entire expression in double quotation marks.
		* If the expression itself includes double quotation marks, escape the quotations by using the \ character.
		* Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.
		"""
		try :
			self._rule = rule
		except Exception as e:
			raise e

	@property
	def action(self) :
		"""Action to be applied by the new session policy if the rule criteria are met.
Minimum length =  1.
		"""
		try :
			return self._action
		except Exception as e:
			raise e

	@action.setter
	def action(self, action) :
		"""Action to be applied by the new session policy if the rule criteria are met.
Minimum length =  1
		"""
		try :
			self._action = action
		except Exception as e:
			raise e

	@property
	def builtin(self) :
		"""Indicates that a variable is a built-in (SYSTEM INTERNAL) type.
Possible values = MODIFIABLE, DELETABLE, IMMUTABLE, PARTITION_ALL.
		"""
		try :
			return self._builtin
		except Exception as e:
			raise e

	def _get_nitro_response(self, service, response) :
		""" converts nitro response into object and returns the object array in case of get request.
		"""
		try :
			result = service.payload_formatter.string_to_resource(vpnsessionpolicy_response, response, self.__class__.__name__)
			if(result.errorcode != 0) :
				if (result.errorcode == 444) :
					service.clear_session(self)
				if result.severity :
					if (result.severity == "ERROR") :
						raise nitro_exception(result.errorcode, str(result.message), str(result.severity))
				else :
					raise nitro_exception(result.errorcode, str(result.message), str(result.severity))
			return result.vpnsessionpolicy
		except Exception as e :
			raise e

	def _get_object_name(self) :
		""" Returns the value of object identifier argument
		"""
		try :
			if (self.name) :
				return str(self.name)
			return None
		except Exception as e :
			raise e

	@classmethod
	def add(cls, client, resource) :
		""" Use this API to add vpnsessionpolicy.
		"""
		try :
			if type(resource) is not list :
				addresource = vpnsessionpolicy()
				addresource.name = resource.name
				addresource.rule = resource.rule
				addresource.action = resource.action
				return addresource.add_resource(client)
			else :
				if (resource and len(resource) > 0) :
					addresources = [ vpnsessionpolicy() for _ in range(len(resource))]
					for i in range(len(resource)) :
						addresources[i].name = resource[i].name
						addresources[i].rule = resource[i].rule
						addresources[i].action = resource[i].action
				result = cls.add_bulk_request(client, addresources)
			return result
		except Exception as e :
			raise e

	@classmethod
	def delete(cls, client, resource) :
		""" Use this API to delete vpnsessionpolicy.
		"""
		try :
			if type(resource) is not list :
				deleteresource = vpnsessionpolicy()
				if type(resource) !=  type(deleteresource):
					deleteresource.name = resource
				else :
					deleteresource.name = resource.name
				return deleteresource.delete_resource(client)
			else :
				if type(resource[0]) != cls :
					if (resource and len(resource) > 0) :
						deleteresources = [ vpnsessionpolicy() for _ in range(len(resource))]
						for i in range(len(resource)) :
							deleteresources[i].name = resource[i]
				else :
					if (resource and len(resource) > 0) :
						deleteresources = [ vpnsessionpolicy() for _ in range(len(resource))]
						for i in range(len(resource)) :
							deleteresources[i].name = resource[i].name
				result = cls.delete_bulk_request(client, deleteresources)
			return result
		except Exception as e :
			raise e

	@classmethod
	def update(cls, client, resource) :
		""" Use this API to update vpnsessionpolicy.
		"""
		try :
			if type(resource) is not list :
				updateresource = vpnsessionpolicy()
				updateresource.name = resource.name
				updateresource.rule = resource.rule
				updateresource.action = resource.action
				return updateresource.update_resource(client)
			else :
				if (resource and len(resource) > 0) :
					updateresources = [ vpnsessionpolicy() for _ in range(len(resource))]
					for i in range(len(resource)) :
						updateresources[i].name = resource[i].name
						updateresources[i].rule = resource[i].rule
						updateresources[i].action = resource[i].action
				result = cls.update_bulk_request(client, updateresources)
			return result
		except Exception as e :
			raise e

	@classmethod
	def unset(cls, client, resource, args) :
		""" Use this API to unset the properties of vpnsessionpolicy resource.
		Properties that need to be unset are specified in args array.
		"""
		try :
			if type(resource) is not list :
				unsetresource = vpnsessionpolicy()
				if type(resource) !=  type(unsetresource):
					unsetresource.name = resource
				else :
					unsetresource.name = resource.name
				return unsetresource.unset_resource(client, args)
			else :
				if type(resource[0]) != cls :
					if (resource and len(resource) > 0) :
						unsetresources = [ vpnsessionpolicy() for _ in range(len(resource))]
						for i in range(len(resource)) :
							unsetresources[i].name = resource[i]
				else :
					if (resource and len(resource) > 0) :
						unsetresources = [ vpnsessionpolicy() for _ in range(len(resource))]
						for i in range(len(resource)) :
							unsetresources[i].name = resource[i].name
				result = cls.unset_bulk_request(client, unsetresources, args)
			return result
		except Exception as e :
			raise e

	@classmethod
	def get(cls, client, name="", option_="") :
		""" Use this API to fetch all the vpnsessionpolicy resources that are configured on netscaler.
		"""
		try :
			if not name :
				obj = vpnsessionpolicy()
				response = obj.get_resources(client, option_)
			else :
				if type(name) != cls :
					if type(name) is not list :
						obj = vpnsessionpolicy()
						obj.name = name
						response = obj.get_resource(client, option_)
					else :
						if name and len(name) > 0 :
							response = [vpnsessionpolicy() for _ in range(len(name))]
							obj = [vpnsessionpolicy() for _ in range(len(name))]
							for i in range(len(name)) :
								obj[i] = vpnsessionpolicy()
								obj[i].name = name[i]
								response[i] = obj[i].get_resource(client, option_)
			return response
		except Exception as e :
			raise e

	@classmethod
	def get_filtered(cls, client, filter_) :
		""" Use this API to fetch filtered set of vpnsessionpolicy resources.
		filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
		"""
		try :
			obj = vpnsessionpolicy()
			option_ = options()
			option_.filter = filter_
			response = obj.getfiltered(client, option_)
			return response
		except Exception as e :
			raise e

	@classmethod
	def count(cls, client) :
		""" Use this API to count the vpnsessionpolicy resources configured on NetScaler.
		"""
		try :
			obj = vpnsessionpolicy()
			option_ = options()
			option_.count = True
			response = obj.get_resources(client, option_)
			if response :
				return response[0].__dict__['___count']
			return 0
		except Exception as e :
			raise e

	@classmethod
	def count_filtered(cls, client, filter_) :
		""" Use this API to count filtered the set of vpnsessionpolicy resources.
		Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
		"""
		try :
			obj = vpnsessionpolicy()
			option_ = options()
			option_.count = True
			option_.filter = filter_
			response = obj.getfiltered(client, option_)
			if response :
				return response[0].__dict__['___count']
			return 0
		except Exception as e :
			raise e

	class Builtin:
		MODIFIABLE = "MODIFIABLE"
		DELETABLE = "DELETABLE"
		IMMUTABLE = "IMMUTABLE"
		PARTITION_ALL = "PARTITION_ALL"

class vpnsessionpolicy_response(base_response) :
	def __init__(self, length=1) :
		self.vpnsessionpolicy = []
		self.errorcode = 0
		self.message = ""
		self.severity = ""
		self.sessionid = ""
		self.vpnsessionpolicy = [vpnsessionpolicy() for _ in range(length)]


text: export { default } from 'client/components/Forms/MarketplaceApp/CreateForm/Steps'


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<entity-engine-xml>

    <!-- SCIPIO: Unneeded
    <Party partyId="BLOGUSER_ADMIN" partyTypeId="PERSON" createdDate="2004-03-27 09:37:40.989" createdByUserLogin="admin" lastModifiedDate="2004-03-27 09:37:40.989" lastModifiedByUserLogin="admin"/>
    <Person partyId="BLOGUSER_ADMIN" lastName="Blog" firstName="Admin"/>
    <UserLogin userLoginId="blog_admin" partyId="BLOGUSER_ADMIN" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266"/>
    <PartyRole partyId="BLOGUSER_ADMIN" roleTypeId="CONTENT_ADMIN"/>
    <ContentRole partyId="BLOGUSER_ADMIN" roleTypeId="CONTENT_ADMIN" contentId="BLOGROOT" fromDate="2004-03-27 09:37:40.989"/>
    <UserLoginSecurityGroup userLoginId="blog_admin" groupId="FULLADMIN" fromDate="2004-09-15 00:00:00.000"/>

    <Party partyId="BLOGUSER_EDITOR" partyTypeId="PERSON" createdDate="2004-03-27 09:37:40.989" createdByUserLogin="admin" lastModifiedDate="2004-03-27 09:37:40.989" lastModifiedByUserLogin="admin"/>
    <Person partyId="BLOGUSER_EDITOR" lastName="Blog" firstName="Editor"/>
    <UserLogin userLoginId="blog_editor" partyId="BLOGUSER_EDITOR" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266"/>
    <PartyRole partyId="BLOGUSER_EDITOR" roleTypeId="CONTENT_ADMIN"/>
    <ContentRole partyId="BLOGUSER_EDITOR" roleTypeId="CONTENT_ADMIN" contentId="BLOGROOT" fromDate="2004-03-27 09:37:40.989"/>
    <UserLoginSecurityGroup userLoginId="blog_editor" groupId="FULLADMIN"  fromDate="2004-09-15 00:00:00.000"/>

    <Party partyId="BLOGUSER_USER" partyTypeId="PERSON" createdDate="2004-03-27 09:37:40.989" createdByUserLogin="admin" lastModifiedDate="2004-03-27 09:37:40.989" lastModifiedByUserLogin="admin"/>
    <Person partyId="BLOGUSER_USER" lastName="Blog" firstName="User"/>
    <UserLogin userLoginId="blog_user" partyId="BLOGUSER_USER" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266"/>
    <PartyRole partyId="BLOGUSER_USER" roleTypeId="CONTENT_ADMIN"/>
    <PartyRole partyId="BLOGUSER_USER" roleTypeId="CONTENT_AUTHOR"/>

    <Party partyId="BLOGUSER_GUEST" partyTypeId="PERSON" createdDate="2004-10-20 09:37:40.989" createdByUserLogin="admin" lastModifiedDate="2004-10-20 09:37:40.989" lastModifiedByUserLogin="admin"/>
    <Person partyId="BLOGUSER_GUEST" lastName="Blog" firstName="Guest"/>
    <UserLogin userLoginId="blog_guest" partyId="BLOGUSER_GUEST" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266"/>

    <Party partyId="AUTHOR_BIGAL" partyTypeId="PERSON" createdDate="2004-03-27 09:37:40.989" createdByUserLogin="admin" lastModifiedDate="2004-03-27 09:37:40.989" lastModifiedByUserLogin="admin"/>
    <Person partyId="AUTHOR_BIGAL" lastName="Al" firstName="Big"/>
    <UserLogin userLoginId="bigal" partyId="AUTHOR_BIGAL" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266"/>
    <PartyRole partyId="AUTHOR_BIGAL" roleTypeId="CONTENT_AUTHOR"/>
    <ContentRole partyId="AUTHOR_BIGAL" roleTypeId="CONTENT_AUTHOR" contentId="BLOGROOTBIGAL" fromDate="2004-03-27 09:37:40.989"/>
    <ContentPurpose contentId="BLOGROOTBIGAL" contentPurposeTypeId="ARTICLE"/>
    <UserLoginSecurityGroup userLoginId="bigal" groupId="CONTENT_USER"  fromDate="2004-09-15 00:00:00.000"/>
    -->
    <!-- Updating BLOGROOTBIGAL with bigal as creator so that he will be found as "owner" for subrecords.
         This is used in a screen permission test.
         -->
    <!-- SCIPIO: Unneeded
    <Party partyId="BLOG_USERS" partyTypeId="PARTY_GROUP"/>
    <Party partyId="BLOG_EDITORS" partyTypeId="PARTY_GROUP"/>
    <Party partyId="BLOG_ADMINS" partyTypeId="PARTY_GROUP"/>
    <Party partyId="BLOG_AUTHORS" partyTypeId="PARTY_GROUP"/>
    <Party partyId="BLOG_PUBLISHERS" partyTypeId="PARTY_GROUP"/>

    <DataSource dataSourceId="BLOG_SITE" dataSourceTypeId="WEBSITE_ENTRY" description="Blog Site"/>

    <PartyRole partyId="BLOG_USERS" roleTypeId="CONTENT_USER"/>
    <PartyRole partyId="BLOG_EDITORS" roleTypeId="CONTENT_EDITOR"/>
    <PartyRole partyId="BLOG_AUTHORS" roleTypeId="CONTENT_AUTHOR"/>
    <PartyRole partyId="BLOG_ADMINS" roleTypeId="CONTENT_ADMIN"/>
    <PartyRole partyId="BLOG_PUBLISHERS" roleTypeId="CONTENT_ADMIN"/>

    <UserLogin userLoginId="blog_guest" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266" passwordHint=""/>
    <UserLogin userLoginId="blog_admin" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266" passwordHint=""/>
    <UserLogin userLoginId="blog_author" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266" passwordHint=""/>
    <UserLogin userLoginId="blog_editor" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266" passwordHint=""/>

    <Content contentId="BLOGROOTBIGAL"
     createdByUserLogin="bigal"
     lastModifiedByUserLogin="bigal"
     createdDate="2004-10-16 17:32:31.285"
     lastModifiedDate="2004-10-16 17:32:31.291"/>

    <Party partyId="AUTHOR_MADMAX" partyTypeId="PERSON" createdDate="2004-03-27 09:37:40.989" createdByUserLogin="admin" lastModifiedDate="2004-03-27 09:37:40.989" lastModifiedByUserLogin="admin"/>
    <Person partyId="AUTHOR_MADMAX" lastName="Max" firstName="Mad"/>
    <UserLogin userLoginId="madmax" partyId="AUTHOR_MADMAX" currentPassword="{SHA}4afca3ceb9bb4b053efaf77766b5323163bd2266"/>
    <PartyRole partyId="AUTHOR_MADMAX" roleTypeId="CONTENT_AUTHOR"/>
    <ContentRole partyId="AUTHOR_MADMAX" roleTypeId="CONTENT_AUTHOR" contentId="BLOGROOTMADMAX" fromDate="2004-03-27 09:37:40.989"/>
    <ContentPurpose contentId="BLOGROOTMADMAX" contentPurposeTypeId="ARTICLE"/>
    <UserLoginSecurityGroup userLoginId="madmax" groupId="CONTENT_USER"  fromDate="2004-09-15 00:00:00.000"/>
    -->
    <!-- Updating biBLOGROOTMADMAXgal with madmax as creator so that he will be found as "owner" for subrecords.
         This is used in a screen permission test.
         -->
    <!-- SCIPIO: Unneeded
    <Content contentId="BLOGROOTMADMAX"
     createdByUserLogin="madmax"
     lastModifiedByUserLogin="madmax"
     createdDate="2004-10-16 17:32:31.285"
     lastModifiedDate="2004-10-16 17:32:31.291"/>
    -->

</entity-engine-xml>


text:
using System;
using System.Linq;
using System.Threading.Tasks;
using Zombus.IntegrationTests.Extensions;
using NUnit.Framework;
using Shouldly;
using Zombus.IntegrationTests.Tests.SimplePubSubTests.EventHandlers;
using Zombus.IntegrationTests.Tests.SimplePubSubTests.MessageContracts;
using Zombus.Tests.Common;

#pragma warning disable 4014

namespace Zombus.IntegrationTests.Tests.SimplePubSubTests
{
    [TestFixture]
    public class WhenPublishingAnEventThatWeOnlyHandleViaCompetition : TestForBus
    {
        protected override async Task When()
        {
            var myEvent = new SomeEventWeOnlyHandleViaCompetition();
            await Bus.PublishAsync(myEvent);

            await TimeSpan.FromSeconds(5).WaitUntil(() => MethodCallCounter.AllReceivedMessages.Any());
        }

        [Test]
        public async Task TheCompetingEventBrokerShouldReceiveTheEvent()
        {
            MethodCallCounter.ReceivedCallsWithAnyArg<SomeCompetingEventHandler>(mb => mb.Handle((SomeEventWeOnlyHandleViaCompetition) null))
                             .Count()
                             .ShouldBe(1);
        }

        [Test]
        public async Task TheCorrectNumberOfEventsOfThisTypeShouldHaveBeenObserved()
        {
            MethodCallCounter.AllReceivedMessages
                             .OfType<SomeEventWeOnlyHandleViaCompetition>()
                             .Count()
                             .ShouldBe(1);
        }

        [Test]
        public async Task TheCorrectNumberOfTotalMessagesShouldHaveBeenObserved()
        {
            ;

            MethodCallCounter.AllReceivedMessages
                             .Count()
                             .ShouldBe(1);
        }
    }
}