text:
package gest

import (
	"os"
	"testing"

	"log"

	"fmt"

	"github.com/stretchr/testify/require"
)

const (
	setupMsg    = "SETUP WAS HIT"
	testMsg     = "TEST WAS HIT"
	TearDownMsg = "TEARDOWN WAS HIT"
)

var (
	testSignature      = ""
	benchmarkSignature = 0
	exampleSignature   = ""
)

func TestMain(m *testing.M) {
	code := New("TestTest").
		TestSetUp(testSetUp).
		TestTearDown(testTearDown).
		BenchmarkSetUp(benchmarkSetUp).
		BenchmarkTearDown(benchmarkTearDown).
		ExampleSetUp(exampleSetUp).
		ExampleTearDown(exampleTearDown).
		Run(m)

	//verify teardown msgs
	if testSignature != "" {
		if testSignature != TearDownMsg {
			log.Printf("TestTearDown failed to bind : expected [%v] but got [%v]", TearDownMsg, testSignature)
			code--
		}
	}
	if benchmarkSignature != 0 {
		if benchmarkSignature%3 != 0 {
			log.Printf("BenchmarkTearDown failed to bind : expected [%v] but got [%v]", 0, benchmarkSignature%3)
			code--
		}
	}
	if exampleSignature != "" {
		if exampleSignature != TearDownMsg {
			log.Printf("ExampleTearDown failed to bind : expected [%v] but got [%v]", TearDownMsg, exampleSignature)
			code--
		}
	}

	os.Exit(code)
}

//===================================================
func TestSample(t *testing.T) {
	require.Equal(t, setupMsg, testSignature)
	testSignature = testMsg
}

func testSetUp(t *testing.T, name string) {
	log.Printf("SETUP:%v", name)
	require.Equal(t, "", testSignature)
	testSignature = setupMsg
}

func testTearDown(t *testing.T, name string) {
	log.Printf("TEARDOWN:%v", name)
	require.Equal(t, testMsg, testSignature)
	testSignature = TearDownMsg
}

//===================================================
func BenchmarkSample(b *testing.B) {
	require.True(b, (benchmarkSignature-1)%3 == 0, "BenchmarkSample was not correct : [%v]", benchmarkSignature)
	benchmarkSignature++
}

func benchmarkSetUp(b *testing.B, name string) {
	log.Printf("SETUP:%v", name)
	require.True(b, benchmarkSignature%3 == 0, "BenchmarkSample was not correct : [%v]", benchmarkSignature)
	benchmarkSignature++
}

func benchmarkTearDown(b *testing.B, name string) {
	log.Printf("TEARDOWN:%v", name)
	require.True(b, (benchmarkSignature-2)%3 == 0, "BenchmarkSample was not correct : [%v]", benchmarkSignature)
	benchmarkSignature++
}

//===================================================
func ExampleSample() {
	exampleSignature = testMsg
	fmt.Printf("During Test : %s\n", exampleSignature)
	// Output:
	// During SetUp : SETUP WAS HIT
	// During Test : TEST WAS HIT
	// During TearDown : TEARDOWN WAS HIT
}

func exampleSetUp(name string) {
	log.Printf("SETUP:%v", name)
	exampleSignature = setupMsg
	fmt.Printf("During SetUp : %s\n", exampleSignature)
}

func exampleTearDown(name string) {
	log.Printf("TEARDOWN:%v", name)
	exampleSignature = TearDownMsg
	fmt.Printf("During TearDown : %s\n", exampleSignature)
}


text:
package me.dommi2212.BungeeBridge.packets;

import java.io.Serializable;

import me.dommi2212.BungeeBridge.BungeePacket;
import me.dommi2212.BungeeBridge.BungeePacketType;

/**
 * Packet used to resolve the uuid of all players.
 *
 * Returned: List (UUID) uuids
 */
@SuppressWarnings("serial")
public class PacketGetPlayersGlobal extends BungeePacket implements Serializable {

	/**
	 * Instantiates a PacketGetPlayersGlobal.
	 */
	public PacketGetPlayersGlobal() {
		super(BungeePacketType.GETPLAYERSGLOBAL, true);
	}

}

redpajama_set_name: RedPajamaGithub


text:
namespace ModernMewgibot.Models
{
    class Regular
    {
        public string Username { get; set; }
    }
}


text:
.class Landroid/support/v4/media/MediaBrowserServiceCompat$ConnectionRecord;
.super Ljava/lang/Object;
.source "MediaBrowserServiceCompat.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/media/MediaBrowserServiceCompat;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "ConnectionRecord"
.end annotation

# instance fields
.field callbacks:Landroid/support/v4/media/MediaBrowserServiceCompat$ServiceCallbacks;

.field pkg:Ljava/lang/String;

.field root:Landroid/support/v4/media/MediaBrowserServiceCompat$BrowserRoot;

.field rootHints:Landroid/os/Bundle;

.field subscriptions:Ljava/util/HashSet;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashSet",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field final synthetic this$0:Landroid/support/v4/media/MediaBrowserServiceCompat;

# direct methods
.method private constructor <init>(Landroid/support/v4/media/MediaBrowserServiceCompat;)V
    .locals 1
    .param p1, "this$0"    # Landroid/support/v4/media/MediaBrowserServiceCompat;

    .prologue
    .line 191
    iput-object p1, p0, Landroid/support/v4/media/MediaBrowserServiceCompat$ConnectionRecord;->this$0:Landroid/support/v4/media/MediaBrowserServiceCompat;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 196
    new-instance v0, Ljava/util/HashSet;

    invoke-direct {v0}, Ljava/util/HashSet;-><init>()V

    iput-object v0, p0, Landroid/support/v4/media/MediaBrowserServiceCompat$ConnectionRecord;->subscriptions:Ljava/util/HashSet;

    .line 191
    return-void
.end method

.method synthetic constructor <init>(Landroid/support/v4/media/MediaBrowserServiceCompat;Landroid/support/v4/media/MediaBrowserServiceCompat$ConnectionRecord;)V
    .locals 0
    .param p1, "this$0"    # Landroid/support/v4/media/MediaBrowserServiceCompat;

    .prologue
    invoke-direct {p0, p1}, Landroid/support/v4/media/MediaBrowserServiceCompat$ConnectionRecord;-><init>(Landroid/support/v4/media/MediaBrowserServiceCompat;)V

    return-void
.end method


text:
Jaeger-operator-docker
============

Jaeger Operator is a Kubernetes Operator which provides installation of Jaeger.

# Upstream
Build instruction for docker containers partially copied from:
https://github.com/jaegertracing/jaeger-operator

# Disclaimer
This is not an official Google product.

# About

This image contains an installation of Jaeger Operator.

For more information, see the:

- [Official Image Marketplace Page](https://console.cloud.google.com/marketplace/details/google/jaeger-operator1).
- [Jaeger Operator Documentation](https://github.com/GoogleCloudPlatform/click-to-deploy/tree/master/k8s/jaeger-operator).

Dockerfile for this image can be found [here](https://github.com/GoogleCloudPlatform/click-to-deploy/tree/master/docker/jaeger-operator/1/debian10/1.25/).


text:
secret-octo-nemesis
===================

KiLL ALL YOU SEE People ALL TYPES AnD Say HellO I n Between 0800 hours


text:
title: About
permalink: /about/
---
![ahnaf]({{ site.url }}/assets/img/ahnaf.jpg)

{% include social.html %}


text:
using System.Web.Http;
using System.Net.Http.Formatting;
using JsonAPI.Net;

namespace JsonAPI.Net.WebAPI
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            config.ConfigureJsonAPI(c => {
                c.TemplateDirectory = "Templates";
                c.RegisterTypeBuilder(new ComplexBuilder());
            });
        }
    }
}


text:
package garden.soil.mathphysics;

import static org.junit.Assert.*;

import org.junit.Test;

public class UnsignedIntegerTest {

	@Test
	public void testMaxIntValue()
	{
		UnsignedInteger toTest = new UnsignedInteger(0xffffffffffL);
		assertEquals("Max positive int value expected",
				0x7fffffff, toTest.intValue());
	}

	@Test
	public void testMaxLongValue()
	{
		UnsignedInteger toTest = new UnsignedInteger(0xffffffffffL);
		assertEquals("Max positive long value expected",
				0xffffffffL, toTest.longValue());
	}

	@Test
	public void testAssignPositiveNumber()
	{
		UnsignedInteger toTest = new UnsignedInteger(0);
		toTest.assign(789);
		assertEquals("Error in positive assignment",
				789, toTest.intValue());
	}

	@Test public void testAssignNegativeNumber()
	{
		UnsignedInteger toTest = new UnsignedInteger(0);
		toTest.assign(-1);
		assertEquals("Error assigning negative number",
				0x7fffffff, toTest.intValue());
	}

	@Test
	public void testAdd() {
		UnsignedInteger lhs = new UnsignedInteger(465);
		UnsignedInteger rhs = new UnsignedInteger(789);
		assertEquals("Error in adding two positive numbers",
				465 + 789, lhs.add(rhs));
	}

	@Test
	public void testAddOverflow()
	{
		UnsignedInteger toTest = new UnsignedInteger(0xffffffff);
		toTest.assign(toTest.add(1));
		assertEquals(0, toTest.longValue());
	}

	@Test
	public void testSubtract() {
		UnsignedInteger rhs = new UnsignedInteger(465);
		UnsignedInteger lhs = new UnsignedInteger(789);
		assertEquals("Error in subtracting two positive numbers",
				789 - 465, lhs.subtract(rhs));
	}

	@Test
	public void testSubtractUnderflow()
	{
		UnsignedInteger lhs = new UnsignedInteger(0);
		assertEquals(0xffffffff, lhs.subtract(1));
	}

	@Test
	public void testMultiply() {
		UnsignedInteger lhs = new UnsignedInteger(465);
		UnsignedInteger rhs = new UnsignedInteger(789);
		assertEquals("Error in multiplying two positive numbers",
				465 * 789, lhs.multiply(rhs));
	}

	@Test
	public void testMultiplyOverflow()
	{
		UnsignedInteger lhs = new UnsignedInteger(0xffffffff);
		UnsignedInteger rhs = new UnsignedInteger(2);
		assertEquals(0xfffffffeL, lhs.multiply(rhs));
	}

	@Test
	public void testDivide() {
		UnsignedInteger top = new UnsignedInteger(45*98);
		UnsignedInteger bottom = new UnsignedInteger(45);
		assertEquals(98, top.divide(bottom));
	}

	@Test
	public void testDivideBy0()
	{
		UnsignedInteger top = new UnsignedInteger(45*98);
		assertEquals(0, top.divide(0));
	}

	@Test
	public void testModulus() {
		UnsignedInteger top = new UnsignedInteger(10);
		assertEquals(1, top.modulus(3));
	}

	@Test
	public void testModulusWith0()
	{
		UnsignedInteger top = new UnsignedInteger(45);
		assertEquals(45, top.modulus(0));
	}

	@Test
	public void testLHSisGreaterThan() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertTrue(toTest.greaterThan(5));
	}

	@Test
	public void testLHSisNotGreaterThan()
	{
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertFalse(toTest.greaterThan(500));
		assertFalse(toTest.greaterThan(123));
	}

	@Test
	public void testLHSisGreaterThanOrEqual() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertTrue(toTest.greaterThanOrEqual(2));
		assertTrue(toTest.greaterThanOrEqual(123));
	}

	@Test
	public void testLHSisNotGreaterThanOrEqual() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertFalse(toTest.greaterThan(500));
	}

	@Test
	public void testLHSisLessThan() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertTrue(toTest.lessThan(500));
	}

	@Test
	public void testLHSisNotLessThan() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertFalse(toTest.lessThan(123));
		assertFalse(toTest.lessThan(0));
	}

	@Test
	public void testLHSisLessThanOrEqual() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertTrue(toTest.lessThanOrEqual(500));
		assertTrue(toTest.lessThanOrEqual(123));
	}

	@Test
	public void testLHSisNotLessThanOrEqual() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertFalse(toTest.lessThanOrEqual(3));
	}

	@Test
	public void testLHSdoesEqual() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertTrue(toTest.Equals(123));
	}

	@Test
	public void testLHSdoesNotEqual() {
		UnsignedInteger toTest = new UnsignedInteger(123);
		assertFalse(toTest.Equals(-55));
		assertFalse(toTest.Equals(500));
	}

	@Test
	public void testShiftRightWithPositiveNumber() {
		UnsignedInteger toTest = new UnsignedInteger(15);
		assertEquals(3, toTest.shiftRight(2));
	}

	@Test
	public void testShiftRightWithNegativeNumber() {
		UnsignedInteger toTest = new UnsignedInteger(15);
		assertEquals(60, toTest.shiftRight(-2));
	}

	@Test
	public void testShiftLeftWithPositiveNumber() {
		UnsignedInteger toTest = new UnsignedInteger(15);
		assertEquals(60, toTest.shiftLeft(2));
	}

	@Test
	public void testShiftLeftWithNegativeNumber() {
		UnsignedInteger toTest = new UnsignedInteger(15);
		assertEquals(3, toTest.shiftLeft(-2));
	}

	@Test
	public void testLogicAND() {
		UnsignedInteger toTest = new UnsignedInteger(0xffffffff);
		assertEquals("Logic AND error",
				0xffff, toTest.logicAND(0xffff));
	}

	@Test
	public void testLogicOR() {
		UnsignedInteger toTest = new UnsignedInteger(0x0);
		assertEquals("Logic AND error",
				0xffff, toTest.logicOR(0xffff));
	}

	@Test
	public void testLogicXOR() {
		UnsignedInteger toTest = new UnsignedInteger(0x101);
		assertEquals("Logic AND error",
				0x1010, toTest.logicXOR(0x1111));
	}

	@Test
	public void testToString() {
		UnsignedInteger toTest = new UnsignedInteger(1236);
		assertEquals("toString error", "1236", toTest.toString());
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="shortcut icon" href="http://vipokna63.ru/misc/favicon.ico" type="image/vnd.microsoft.icon"/>
    <meta content="Главная" about="/main" property="dc:title"/>
    <link rel="canonical" href="/index.html"/>
    <link rel="shortlink" href="/node/8"/>
    <title><?php wp_title('|', true, 'right'); ?></title>
    <style type="text/css" media="all"> @import url("<?php bloginfo('template_url'); ?>/assets/css/system.base.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/system.menus.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/system.messages.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/system.theme.css");</style>
    <style type="text/css" media="all">
        @import url("<?php bloginfo('template_url'); ?>/assets/css/field.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/node.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/search.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/user.css?");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/views.css");</style>
    <style type="text/css" media="all">
        @import url("<?php bloginfo('template_url'); ?>/assets/css/ckeditor.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/colorbox_style.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/ctools.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/webform.css");</style>
    <style type="text/css" media="all">
        @import url("<?php bloginfo('template_url'); ?>/assets/css/calculator.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/pfold.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/demo1.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/local-tasks.css");
        @import url("<?php bloginfo('template_url'); ?>/assets/css/fonts.css");
    </style>

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/style.css"/>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/demo.css"/>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/custom.css"/>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/owl.carousel.css"/>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/animate.css"/>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/owl.theme.default.min.css"/>

    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/jquery.once.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/drupal.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/admin_devel.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/ru_13BVCpNT71z7067b2hM0SkXyZ514TFv9Rw80CCBSUBo.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/webform.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/modernizr.custom.34807.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/modernizr.custom.79639.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/jquery.slitslider.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/jquery.pfold.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/jquery.ba-cond.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/custom.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/owl.carousel.min.js"></script>
    <!-- Bootstrap -->
    <!--<link href="css/bootstrap.min.css" rel="stylesheet">-->
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>.
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <?php wp_head(); ?>
</head>
<body class="html front not-logged-in no-sidebars page-node page-node- page-node-8 node-type-page">
<div class="wrapper">


text:
from __future__ import print_function
from vtk import *

if __name__ == "__main__":
    """ Main entry point of this python script """
    #
    # Load our table from a CSV file (covered in table2.py)
    #
    csv_source = vtkDelimitedTextReader()
    csv_source.SetFieldDelimiterCharacters(",")
    csv_source.SetHaveHeaders(True)
    csv_source.SetDetectNumericColumns(True)
    csv_source.SetFileName("table_data.csv")
    csv_source.Update()

    T = csv_source.GetOutput()

    print("Table loaded from CSV file:")
    T.Dump(6)

    #
    # Add a new row to the table
    #
    new_row = [8, "Luis", 68]
    for i in range( T.GetNumberOfColumns()):
        T.GetColumn(i).InsertNextValue( new_row[i] )

    print("\nTable with new row appended:")
    T.Dump(6)

    #
    # Extract row 3 out of the table into a Python list.
    #
    row = []
    row_number = 3
    for icol in range( T.GetNumberOfColumns() ):
        row.append( T.GetColumn(icol).GetValue( row_number ) )

    print("\nExtracted row 3:")
    print(row)


text:
import { IExtractor, ExtractResult, StringUtility, Match, RegExpUtility } from "recognizers-text-number";
import { IDateTimeExtractor } from "../baseDateTime"
import { Constants, TimeTypeConstants } from "../constants"
import { Token } from "../utilities";

export interface DateTimeExtra<T> {
    dataType: T;
    namedEntity(key: string): { value: string, index: number, length: number, captures: string[] }
}

export class TimeResult {
    hour: number;
    minute: number;
    second: number;
    lowBound: number;

    constructor(hour: number, minute: number, second: number, lowBound?: number) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
        this.lowBound = lowBound ? lowBound : -1;
    }
}

export abstract class BaseDateTimeExtractor<T> implements IDateTimeExtractor {
    protected abstract readonly extractorName: string;
    private readonly regexesDictionary: Map<RegExp, T>;

    constructor(regexesDictionary: Map<RegExp, T>) {
        this.regexesDictionary = regexesDictionary;
    }

    extract(source: string, refDate: Date): Array<ExtractResult> {
        if (!refDate) refDate = new Date();
        let referenceDate = refDate;

        let results = new Array<ExtractResult>();
        if (StringUtility.isNullOrEmpty(source)) {
            return results;
        }

        let matchSource = new Map<Match, T>();
        let matched = new Array<boolean>(source.length);
        for (let i = 0; i < source.length; i++) {
            matched[i] = false;
        }

        let collections: Array<{ matches: Match[], value: T}> = [];
        this.regexesDictionary.forEach((value, regex) => {
            let matches = RegExpUtility.getMatches(regex, source);
            if (matches.length > 0) {
                collections.push({ matches: matches, value: value});
            }
        });

        collections.forEach(collection => {
            collection.matches.forEach(m => {
                for (let j = 0; j < m.length; j++) {
                    matched[m.index + j] = true;
                }

                // Keep Source Data for extra information
                matchSource.set(m, collection.value);
            });
        });

        let last = -1;
        for (let i = 0; i < source.length; i++) {
            if (matched[i]) {
                if (i + 1 === source.length || !matched[i + 1]) {
                    let start = last + 1;
                    let length = i - last;
                    let substr = source.substring(start, start + length).trim();
                    let srcMatch = Array.from(matchSource.keys()).find(m => m.index === start && m.length === length);
                    if (srcMatch) {
                        results.push({
                            start: start,
                            length: length,
                            text: substr,
                            type: this.extractorName,
                            data: matchSource.has(srcMatch)
                                ? { dataType: matchSource.get(srcMatch), namedEntity: (key: string) => srcMatch.groups(key) } as DateTimeExtra<T>
                                : null
                        });
                    }
                }
            }
            else {
                last = i;
            }
        }

        return results;
    }
}

export class TimeResolutionUtils {
    static addDescription(lowBoundMap: ReadonlyMap<string, number>, timeResult: TimeResult, description: string) {
        if (lowBoundMap.has(description) && timeResult.hour < lowBoundMap.get(description)) {
            timeResult.hour += 12;
            timeResult.lowBound = lowBoundMap.get(description);
        } else {
            timeResult.lowBound = 0;
        }
    }

    static matchToValue(onlyDigitMatch: RegExp, numbersMap: ReadonlyMap<string, number>, source: string): number {
        if (StringUtility.isNullOrEmpty(source)) {
            return -1;
        }

        if (RegExpUtility.isMatch(onlyDigitMatch, source)) {
            return Number.parseInt(source);
        }

        if (source.length === 1) {
            return numbersMap.get(source);
        }

        let value = 1;
        for (let index = 0; index < source.length; index++) {
            let char = source.charAt(index);
            if (char === '十') {
                value *= 10;
            } else if (index === 0) {
                value *= numbersMap.get(char);
            } else {
                value += numbersMap.get(char);
            }
        }

        return value;
    }
}


text:
package org.apache.flink.api.common.operators;

import static org.junit.Assert.*;

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

import org.apache.flink.api.common.functions.RichCrossFunction;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.java.CollectionEnvironment;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.io.LocalCollectionOutputFormat;
import org.apache.flink.configuration.Configuration;
import org.junit.Test;

@SuppressWarnings("serial")
public class CollectionExecutionWithBroadcastVariableTest {

	private static final String BC_VAR_NAME = "BC";

	private final String[] TEST_DATA = { "A", "B", "C", "D" };
	private final String SUFFIX = "-suffixed";

	@Test
	public void testUnaryOp() {
		try {
			ExecutionEnvironment env = new CollectionEnvironment();

			DataSet<String> bcData = env.fromElements(SUFFIX);

			List<String> result = new ArrayList<String>();

			env.fromElements(TEST_DATA)
					.map(new SuffixAppender()).withBroadcastSet(bcData, BC_VAR_NAME)
					.output(new LocalCollectionOutputFormat<String>(result));

			env.execute();

			assertEquals(TEST_DATA.length, result.size());
			for (String s : result) {
				assertTrue(s.indexOf(SUFFIX) > 0);
			}
		}
		catch (Exception e) {
			e.printStackTrace();
			fail(e.getMessage());
		}
	}

	@Test
	public void testBinaryOp() {
		try {
			ExecutionEnvironment env = new CollectionEnvironment();

			DataSet<String> bcData = env.fromElements(SUFFIX);
			DataSet<String> inData = env.fromElements(TEST_DATA);

			List<String> result = new ArrayList<String>();

			inData.cross(inData).with(new SuffixCross()).withBroadcastSet(bcData, BC_VAR_NAME)
					.output(new LocalCollectionOutputFormat<String>(result));

			env.execute();

			assertEquals(TEST_DATA.length * TEST_DATA.length, result.size());
			for (String s : result) {
				assertTrue(s.indexOf(SUFFIX) == 2);
			}
		}
		catch (Exception e) {
			e.printStackTrace();
			fail(e.getMessage());
		}
	}

	public static final class SuffixAppender extends RichMapFunction<String, String> {

		private String suffix;

		@Override
		public void open(Configuration parameters) {
			suffix = getRuntimeContext().<String>getBroadcastVariable(BC_VAR_NAME).get(0);
		}

		@Override
		public String map(String value) {
			return value + suffix;
		}
	}

	public static final class SuffixCross extends RichCrossFunction<String, String, String> {

		private String suffix;

		@Override
		public void open(Configuration parameters) {
			suffix = getRuntimeContext().<String>getBroadcastVariable(BC_VAR_NAME).get(0);
		}

		@Override
		public String cross(String s1, String s2) {
			return s1 + s2 + suffix;
		}
	}
}


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

namespace ServiceStack.Text.Common
{
    internal static class DeserializeSpecializedCollections<T, TSerializer>
        where TSerializer : ITypeSerializer
    {
        private static readonly ParseStringSpanDelegate CacheFn;

        static DeserializeSpecializedCollections()
        {
            CacheFn = GetParseStringSpanFn();
        }

        public static ParseStringDelegate Parse => v => CacheFn(v.AsSpan());

        public static ParseStringSpanDelegate ParseStringSpan => CacheFn;

        public static ParseStringDelegate GetParseFn() => v => GetParseStringSpanFn()(v.AsSpan());

        public static ParseStringSpanDelegate GetParseStringSpanFn()
        {
            if (typeof(T).HasAnyTypeDefinitionsOf(typeof(Queue<>)))
            {
                if (typeof(T) == typeof(Queue<string>))
                    return ParseStringQueue;

                if (typeof(T) == typeof(Queue<int>))
                    return ParseIntQueue;

                return GetGenericQueueParseFn();
            }

            if (typeof(T).HasAnyTypeDefinitionsOf(typeof(Stack<>)))
            {
                if (typeof(T) == typeof(Stack<string>))
                    return ParseStringStack;

                if (typeof(T) == typeof(Stack<int>))
                    return ParseIntStack;

                return GetGenericStackParseFn();
            }

            var fn = PclExport.Instance.GetSpecializedCollectionParseStringSpanMethod<TSerializer>(typeof(T));
            if (fn != null)
                return fn;

            if (typeof(T) == typeof(IEnumerable) || typeof(T) == typeof(ICollection))
            {
                return GetEnumerableParseStringSpanFn();
            }

            return GetGenericEnumerableParseStringSpanFn();
        }

        public static Queue<string> ParseStringQueue(string value) => ParseStringQueue(value.AsSpan());

        public static Queue<string> ParseStringQueue(ReadOnlySpan<char> value)
        {
            var parse = (IEnumerable<string>)DeserializeList<List<string>, TSerializer>.ParseStringSpan(value);
            return new Queue<string>(parse);
        }

        public static Queue<int> ParseIntQueue(string value) => ParseIntQueue(value.AsSpan());

        public static Queue<int> ParseIntQueue(ReadOnlySpan<char> value)
        {
            var parse = (IEnumerable<int>)DeserializeList<List<int>, TSerializer>.ParseStringSpan(value);
            return new Queue<int>(parse);
        }

        internal static ParseStringSpanDelegate GetGenericQueueParseFn()
        {
            var enumerableInterface = typeof(T).GetTypeWithGenericInterfaceOf(typeof(IEnumerable<>));
            var elementType = enumerableInterface.GetGenericArguments()[0];
            var genericType = typeof(SpecializedQueueElements<>).MakeGenericType(elementType);
            var mi = genericType.GetStaticMethod("ConvertToQueue");
            var convertToQueue = (ConvertObjectDelegate)mi.MakeDelegate(typeof(ConvertObjectDelegate));

            var parseFn = DeserializeEnumerable<T, TSerializer>.GetParseStringSpanFn();

            return x => convertToQueue(parseFn(x));
        }

        public static Stack<string> ParseStringStack(string value) => ParseStringStack(value.AsSpan());

        public static Stack<string> ParseStringStack(ReadOnlySpan<char> value)
        {
            var parse = (IEnumerable<string>)DeserializeList<List<string>, TSerializer>.ParseStringSpan(value);
            return new Stack<string>(parse);
        }

        public static Stack<int> ParseIntStack(string value) => ParseIntStack(value.AsSpan());

        public static Stack<int> ParseIntStack(ReadOnlySpan<char> value)
        {
            var parse = (IEnumerable<int>)DeserializeList<List<int>, TSerializer>.ParseStringSpan(value);
            return new Stack<int>(parse);
        }

        internal static ParseStringSpanDelegate GetGenericStackParseFn()
        {
            var enumerableInterface = typeof(T).GetTypeWithGenericInterfaceOf(typeof(IEnumerable<>));

            var elementType = enumerableInterface.GetGenericArguments()[0];
            var genericType = typeof(SpecializedQueueElements<>).MakeGenericType(elementType);
            var mi = genericType.GetStaticMethod("ConvertToStack");
            var convertToQueue = (ConvertObjectDelegate)mi.MakeDelegate(typeof(ConvertObjectDelegate));

            var parseFn = DeserializeEnumerable<T, TSerializer>.GetParseStringSpanFn();

            return x => convertToQueue(parseFn(x));
        }

        public static ParseStringDelegate GetEnumerableParseFn() => DeserializeListWithElements<TSerializer>.ParseStringList;

        public static ParseStringSpanDelegate GetEnumerableParseStringSpanFn() => DeserializeListWithElements<TSerializer>.ParseStringList;

        public static ParseStringDelegate GetGenericEnumerableParseFn() => v => GetGenericEnumerableParseStringSpanFn()(v.AsSpan());

        public static ParseStringSpanDelegate GetGenericEnumerableParseStringSpanFn()
        {
            var enumerableInterface = typeof(T).GetTypeWithGenericInterfaceOf(typeof(IEnumerable<>));
            if (enumerableInterface == null) return null;
            var elementType = enumerableInterface.GetGenericArguments()[0];
            var genericType = typeof(SpecializedEnumerableElements<,>).MakeGenericType(typeof(T), elementType);
            var fi = genericType.GetPublicStaticField("ConvertFn");

            var convertFn = fi.GetValue(null) as ConvertObjectDelegate;
            if (convertFn == null) return null;

            var parseFn = DeserializeEnumerable<T, TSerializer>.GetParseStringSpanFn();

            return x => convertFn(parseFn(x));
        }
    }

    internal class SpecializedQueueElements<T>
    {
        public static Queue<T> ConvertToQueue(object enumerable)
        {
            if (enumerable == null) return null;
            return new Queue<T>((IEnumerable<T>)enumerable);
        }

        public static Stack<T> ConvertToStack(object enumerable)
        {
            if (enumerable == null) return null;
            return new Stack<T>((IEnumerable<T>)enumerable);
        }
    }

    internal class SpecializedEnumerableElements<TCollection, T>
    {
        public static ConvertObjectDelegate ConvertFn;

        static SpecializedEnumerableElements()
        {
            foreach (var ctorInfo in typeof(TCollection).GetConstructors())
            {
                var ctorParams = ctorInfo.GetParameters();
                if (ctorParams.Length != 1) continue;
                var ctorParam = ctorParams[0];

                if (typeof(IEnumerable).IsAssignableFrom(ctorParam.ParameterType)
                    || ctorParam.ParameterType.IsOrHasGenericInterfaceTypeOf(typeof(IEnumerable<>)))
                {
                    ConvertFn = fromObject =>
                    {
                        var to = Activator.CreateInstance(typeof(TCollection), fromObject);
                        return to;
                    };
                    return;
                }
            }

            if (typeof(TCollection).IsOrHasGenericInterfaceTypeOf(typeof(ICollection<>)))
            {
                ConvertFn = ConvertFromCollection;
            }
        }

        public static object Convert(object enumerable)
        {
            return ConvertFn(enumerable);
        }

        public static object ConvertFromCollection(object enumerable)
        {
            var to = (ICollection<T>)typeof(TCollection).CreateInstance();
            var from = (IEnumerable<T>)enumerable;
            foreach (var item in from)
            {
                to.Add(item);
            }
            return to;
        }
    }
}


text:
from __future__ import annotations

import unittest
from unittest import mock

import pytest

from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.sagemaker import SageMakerHook
from airflow.providers.amazon.aws.operators import sagemaker
from airflow.providers.amazon.aws.operators.sagemaker import SageMakerTransformOperator

EXPECTED_INTEGER_FIELDS: list[list[str]] = [
    ['Transform', 'TransformResources', 'InstanceCount'],
    ['Transform', 'MaxConcurrentTransforms'],
    ['Transform', 'MaxPayloadInMB'],
]

CREATE_TRANSFORM_PARAMS: dict = {
    'TransformJobName': 'job_name',
    'ModelName': 'model_name',
    'MaxConcurrentTransforms': '12',
    'MaxPayloadInMB': '6',
    'BatchStrategy': 'MultiRecord',
    'TransformInput': {'DataSource': {'S3DataSource': {'S3DataType': 'S3Prefix', 'S3Uri': 's3_uri'}}},
    'TransformOutput': {'S3OutputPath': 'output_path'},
    'TransformResources': {'InstanceType': 'ml.m4.xlarge', 'InstanceCount': '3'},
}

CREATE_MODEL_PARAMS: dict = {
    'ModelName': 'model_name',
    'PrimaryContainer': {'Image': 'test_image', 'ModelDataUrl': 'output_path'},
    'ExecutionRoleArn': 'arn:aws:iam:role/test-role',
}

CONFIG: dict = {'Model': CREATE_MODEL_PARAMS, 'Transform': CREATE_TRANSFORM_PARAMS}

class TestSageMakerTransformOperator(unittest.TestCase):
    def setUp(self):
        self.sagemaker = SageMakerTransformOperator(
            task_id='test_sagemaker_operator',
            aws_conn_id='sagemaker_test_id',
            config=CONFIG,
            wait_for_completion=False,
            check_interval=5,
        )

    @mock.patch.object(SageMakerHook, 'get_conn')
    @mock.patch.object(SageMakerHook, 'create_model')
    @mock.patch.object(SageMakerHook, 'create_transform_job')
    @mock.patch.object(sagemaker, 'serialize', return_value="")
    def test_integer_fields(self, serialize, mock_transform, mock_model, mock_client):
        mock_transform.return_value = {
            'TransformJobArn': 'test_arn',
            'ResponseMetadata': {'HTTPStatusCode': 200},
        }
        self.sagemaker.execute(None)
        assert self.sagemaker.integer_fields == EXPECTED_INTEGER_FIELDS
        for (key1, key2, *key3) in EXPECTED_INTEGER_FIELDS:
            if key3:
                (key3,) = key3
                assert self.sagemaker.config[key1][key2][key3] == int(self.sagemaker.config[key1][key2][key3])
            else:
                self.sagemaker.config[key1][key2] == int(self.sagemaker.config[key1][key2])

    @mock.patch.object(SageMakerHook, 'get_conn')
    @mock.patch.object(SageMakerHook, 'create_model')
    @mock.patch.object(SageMakerHook, 'create_transform_job')
    @mock.patch.object(sagemaker, 'serialize', return_value="")
    def test_execute(self, serialize, mock_transform, mock_model, mock_client):
        mock_transform.return_value = {
            'TransformJobArn': 'test_arn',
            'ResponseMetadata': {'HTTPStatusCode': 200},
        }
        self.sagemaker.execute(None)
        mock_model.assert_called_once_with(CREATE_MODEL_PARAMS)
        mock_transform.assert_called_once_with(
            CREATE_TRANSFORM_PARAMS, wait_for_completion=False, check_interval=5, max_ingestion_time=None
        )

    @mock.patch.object(SageMakerHook, 'get_conn')
    @mock.patch.object(SageMakerHook, 'create_model')
    @mock.patch.object(SageMakerHook, 'create_transform_job')
    def test_execute_with_failure(self, mock_transform, mock_model, mock_client):
        mock_transform.return_value = {
            'TransformJobArn': 'test_arn',
            'ResponseMetadata': {'HTTPStatusCode': 404},
        }
        with pytest.raises(AirflowException):
            self.sagemaker.execute(None)

    @mock.patch.object(SageMakerHook, 'get_conn')
    @mock.patch.object(SageMakerHook, 'create_transform_job')
    @mock.patch.object(sagemaker, 'serialize', return_value="")
    def test_execute_with_check_if_job_exists(self, serialize, mock_transform, mock_client):
        mock_transform.return_value = {
            'TransformJobArn': 'test_arn',
            'ResponseMetadata': {'HTTPStatusCode': 200},
        }
        self.sagemaker._check_if_transform_job_exists = mock.MagicMock()
        self.sagemaker.execute(None)
        self.sagemaker._check_if_transform_job_exists.assert_called_once()
        mock_transform.assert_called_once_with(
            CREATE_TRANSFORM_PARAMS,
            wait_for_completion=False,
            check_interval=5,
            max_ingestion_time=None,
        )

    @mock.patch.object(SageMakerHook, 'get_conn')
    @mock.patch.object(SageMakerHook, 'create_transform_job')
    @mock.patch.object(sagemaker, 'serialize', return_value="")
    def test_execute_without_check_if_job_exists(self, serialize, mock_transform, mock_client):
        mock_transform.return_value = {
            'TransformJobArn': 'test_arn',
            'ResponseMetadata': {'HTTPStatusCode': 200},
        }
        self.sagemaker.check_if_job_exists = False
        self.sagemaker._check_if_transform_job_exists = mock.MagicMock()
        self.sagemaker.execute(None)
        self.sagemaker._check_if_transform_job_exists.assert_not_called()
        mock_transform.assert_called_once_with(
            CREATE_TRANSFORM_PARAMS,
            wait_for_completion=False,
            check_interval=5,
            max_ingestion_time=None,
        )

    @mock.patch.object(SageMakerHook, 'get_conn')
    @mock.patch.object(SageMakerHook, 'list_transform_jobs')
    def test_check_if_job_exists_increment(self, mock_list_transform_jobs, mock_client):
        self.sagemaker.check_if_job_exists = True
        self.sagemaker.action_if_job_exists = 'increment'
        mock_list_transform_jobs.return_value = [{'TransformJobName': 'job_name'}]
        self.sagemaker._check_if_transform_job_exists()

        expected_config = CONFIG.copy()
        # Expect to see TransformJobName suffixed with "-2" because we return one existing job
        expected_config["Transform"]['TransformJobName'] = 'job_name-2'
        assert self.sagemaker.config == expected_config

    @mock.patch.object(SageMakerHook, 'get_conn')
    @mock.patch.object(SageMakerHook, 'list_transform_jobs')
    def test_check_if_job_exists_fail(self, mock_list_transform_jobs, mock_client):
        self.sagemaker.check_if_job_exists = True
        self.sagemaker.action_if_job_exists = 'fail'
        mock_list_transform_jobs.return_value = [{'TransformJobName': 'job_name'}]
        with pytest.raises(AirflowException):
            self.sagemaker._check_if_transform_job_exists()


text:
A GCD backed Objective-C state machine. Released as open source under the MIT license.

## Step 1

A state is a class that conforms to the SMState protocol. There are four class
methods that handle the state transitions.

```
@interface MyInitialState : NSObject <SMState>
@end

@implementation MyInitialState

+ (void)willExitWithTransition:(SMTransition *)transition {
	NSLog(@"%s", __func__);
}

+ (void)willEnterWithTransition:(SMTransition *)transition {
	NSLog(@"%s", __func__);
}

+ (void)didEnterWithTransition:(SMTransition *)transition {
	NSLog(@"%s", __func__);
}

+ (SMState)didFireEvent:(id<SMEvent>)event stateContext:(id<SMState>)stateContext {
	MyInitialState *context = (MyInitialState *)stateContext;
	if (SMEvent(event) == SMEvent(MyStartEvent)) {
		return SMState(MyNextEvent);
	}
	return nil;
}
@end
```

## Step 2

Create an event to trigger a transition.

```
@interface MyStartEvent : NSObject <SMEvent>
@property (nonatomic, copy, readonly) NSString *message;
- (instancetype)initWithMessage:(NSString *)message;
@end

@implementation MyStartEvent
- (instancetype)initWithMessage:(NSString *)message {
	self = [super init];
	if (self) {
		_message = [message copy];
	}
	return self;
}
@end
```

## Step 3

Create an array of valid transitions that may occur in the state machine. This is for runtime validation of transitions.

```
NSArray *transitions = @[SMTransition(MyInitialState, MyNextState),
                         SMTransition(MyNextState, MyThirdState),
                         SMTransition(MyThirdState, MyNextState)];
```

## Step 4

Create the state machine. Feed it the array of valid transitions and the initial state that the state machine should start in.

```
SMStateMachine *stateMachine = [SMStateMachine stateMachineWithTransitions:transitions
                                                              initialState:SMState(MyInitialState)];
```

## Step 5

Fire an event.

```
MyStartEvent *event = [[MyStartEvent alloc] initWithMessage:@"Hello, World!"];
[stateMachine fireEvent:event];
```

It's possible to fire events from within the `willEnterWithTransition:` and `didEnterWithTransition:` methods to trigger transitions.

## Full Example

See Example.m for a full example.


text:
(function () {
	'use strict';
	// Load in our dependencies
	var expect = require('chai').expect;
	var AppDispatcher = require('../app/dispatchers/app');
	var _TeamStore = require('../app/stores/team');

	// Fallback console.debug to a noop
	console.debug = function () {};

	// Define test utilities
	var testUtils = {
		session: {
			start: function () {
				before(function localizeTeamStore () {
					this.store = _TeamStore;
				});
				after(function cleanup () {
					_TeamStore.reset();
					delete this.store;
				});
			},
			startWithInitializedStore: function () {
				this.start();
				before(function initializeStore () {
					this.store.init();
				});
			}
		}
	};

	// Define our test cases
	describe('A fresh team store', function () {
		testUtils.session.start();

		it('has no teams', function () {
			var teams = this.store.getTeams();
			expect(teams).to.have.length(0);
		});
	});

	describe.only('An initialized team store', function () {
		testUtils.session.start();
		before(function initializeStore () {
			AppDispatcher.dispatch({
				type: AppDispatcher.ActionTypes.APPLICATION_INIT
			});
		});

		it('has a placeholder team at the login URL', function () {
			var teams = this.store.getTeams();
			expect(teams).to.have.length(1);
			expect(teams[0]).to.have.property('team_id', '_plaidchat-placeholder-0');
			expect(teams[0]).to.have.property('team_url', 'https://slack.com/signin');
		});
	});

	describe('A team store initialized with a given URL', function () {
		testUtils.session.start();
		before(function initializeStoreWithUrl () {
			AppDispatcher.dispatch({
				type: AppDispatcher.ActionTypes.APPLICATION_INIT,
				url: 'https://plaidchat-test.slack.com/'
			});
		});

		it('has a placeholder team at the given URL', function () {
			var teams = this.store.getTeams();
			expect(teams).to.have.length(1);
			expect(teams[0]).to.have.property('team_id', '_plaidchat-placeholder-0');
			expect(teams[0]).to.have.property('team_url', 'https://plaidchat-test.slack.com/');
		});
	});

	describe('An initialized team store', function () {
		testUtils.session.startWithInitializedStore();

		it('marks the placeholder team as the active team', function () {
			var activeTeamId = this.store.getActiveTeamId();
			expect(activeTeamId).to.equal('_plaidchat-placeholder-0');
		});

		it('has a placeholder team at a numerical index', function () {
			var indicies = this.store.getTeamIndicies();
			expect(indicies).to.have.property('_plaidchat-placeholder-0', 0);
		});

		describe('when we log into our placeholder team', function () {
			before(function loginTeam () {
				AppDispatcher.dispatch({
					type: AppDispatcher.ActionTypes.TEAMS_UPDATE,
					alias: {
						srcTeamId: '_plaidchat-placeholder-0',
						targetTeamId: 'U1234'
					},
					allTeams: [{
						team_id: 'U1234',
						team_url: 'https://U1234.slack.com/'
					}]
				});
			});

			it('marks the new team as the active team', function () {
				var activeTeamId = this.store.getActiveTeamId();
				expect(activeTeamId).to.equal('U1234');
			});

			it('has the new team\'s info', function () {
				var teams = this.store.getTeams();
				expect(teams).to.have.length(1);
				expect(teams[0]).to.have.property('team_id', 'U1234');
				expect(teams[0]).to.have.property('team_url', 'https://U1234.slack.com/');
			});

			it('maintains the same numerical index', function () {
				var indicies = this.store.getTeamIndicies();
				expect(indicies).to.have.property('U1234', 0);
			});
		});
	});

	describe.only('An initialized team store', function () {
		testUtils.session.startWithInitializedStore();

		describe('when we log into multiple teams', function () {
			before(function loginTeam () {
				AppDispatcher.dispatch({
					type: AppDispatcher.ActionTypes.TEAMS_UPDATE,
					alias: {
						srcTeamId: '_plaidchat-placeholder-0',
						targetTeamId: 'U1234'
					},
					allTeams: [{
						team_id: 'U1234',
						team_url: 'https://U1234.slack.com/'
					}, {
						team_id: 'U5678',
						team_url: 'https://U5678.slack.com/'
					}]
				});
			});

			it('has the placeholder replacement team as the active team', function () {
				var activeTeamId = this.store.getActiveTeamId();
				expect(activeTeamId).to.equal('U1234');
			});

			it('has multiple team information', function () {
				var teams = this.store.getTeams();
				expect(teams).to.have.length(2);
				expect(teams[0]).to.have.property('team_id', 'U1234');
				expect(teams[1]).to.have.property('team_id', 'U5678');
			});

			it('has a new numerical index for the new team', function () {
				var indicies = this.store.getTeamIndicies();
				expect(indicies).to.have.property('U5678', 1);
			});

			describe('when we log out of the active team', function () {
				before(function loginTeam () {
					AppDispatcher.dispatch({
						type: AppDispatcher.ActionTypes.TEAMS_UPDATE,
						allTeams: [{
							team_id: 'U5678',
							team_url: 'https://U5678.slack.com/'
						}]
					});
				});

				it('has 1 team remaining', function () {
					var teams = this.store.getTeams();
					expect(teams).to.have.length(1);
					expect(teams[0]).to.have.property('team_id', 'U5678');
				});

				it('marks the remaining team as the active team', function () {
					var activeTeamId = this.store.getActiveTeamId();
					expect(activeTeamId).to.equal('U5678');
				});
			});
		});
	});
})();


text:
package org.snmp4j.agent.io;

import java.io.*;
import org.snmp4j.smi.OctetString;

public class Context implements Serializable {

  static final long serialVersionUID = -6616464416265180630L;

  private OctetString context;

  public Context(OctetString context) {
    this.context = context;
  }

  public OctetString getContext() {
    return context;
  }

  public boolean equals(Object obj) {
    if (obj instanceof Context) {
      return context.equals(((Context)obj).context);
    }
    return false;
  }

  public int hashCode() {
    return context.hashCode();
  }

}


text:
#include "CImageDB.h"

#include <iostream>
#include <cv.h>
#include <math.h>

using namespace std;

CImageDB::CImageDB()
{
    for( int i=0; i < CFG_IMGBUFFER_SIZE; i++ )
    {
        imagebuffer_inuse[i] = false;
        imagebuffer[i] = NULL;
        imagebuffer_gray[i] = NULL;
    }
    db_filled = false;
    actptr = 0;
    addedptr = 0;
}

CImageDB::~CImageDB()
{
    reset_imagebuffer();
}

// clean imagebuffer
void CImageDB::reset_imagebuffer()
{
    for( int i=0; i < CFG_IMGBUFFER_SIZE; i++ )
    {
        // we have an allocated object
        if( imagebuffer[i] != NULL )
        {
            cvReleaseImage( &imagebuffer[i]);
            imagebuffer[i] = NULL;
        }

        if( imagebuffer_gray[i] != NULL )
        {
            cvReleaseImage( &imagebuffer_gray[i]);
            imagebuffer[i] = NULL;
        }

        imagebuffer_inuse[i] = false;
    }
    db_filled = false;
    actptr = 0;
    addedptr = 0;
}

// initialize the buffer with an image template
void CImageDB::init( IplImage* imgtemplate )
{
    // first, we reset the buffer
    reset_imagebuffer();

    imagesize = cvGetSize( imgtemplate);

    for( int i=0; i < CFG_IMGBUFFER_SIZE; i++ )
    {
        // allocate image buffers for grayscale image copys
        imagebuffer_gray[i] =
            cvCreateImage(imagesize, IPL_DEPTH_8U, 1);

    }

}

void CImageDB::add( IplImage* img)
{
    if( imagebuffer[actptr] != NULL )
    {
        cvReleaseImage( &imagebuffer[actptr] );
    }

    imagebuffer[actptr] = cvCloneImage( img );

    cvCvtColor( img, imagebuffer_gray[actptr], CV_BGR2GRAY);

    addedptr = actptr;

    actptr++;

    if( actptr >= CFG_IMGBUFFER_SIZE)
    {
        db_filled = true;
        actptr = 0;
    }

}

bool CImageDB::is_filled()
{
   return db_filled;
}

IplImage* CImageDB::get_actual_image()
{
    IplImage* imgptr;

    if( db_filled == false )
    {
        imgptr = NULL;
    }
    else
    {
        imgptr = imagebuffer[addedptr];
    }

    return imgptr;
}

IplImage* CImageDB::get_actual_image_gray()
{
    IplImage* imgptr;

    if( db_filled == false )
    {
        imgptr = NULL;
    }
    else
    {
        imgptr = imagebuffer_gray[addedptr];
    }

    return imgptr;
}

IplImage* CImageDB::get_older_image( unsigned int histindex )
{
    IplImage* imgptr;

    if( (db_filled == false) || (histindex > IMAGEDB_OLDEST))
    {
        imgptr = NULL;
    }
    else
    {
        int idxdiff = addedptr - (CFG_IMGBUFFER_SIZE-1);
        int modidx = 0;

        if( idxdiff < 0 )
        {
            modidx = CFG_IMGBUFFER_SIZE-abs(idxdiff);
        }
        else
        {
            modidx = idxdiff;
        }

        imgptr = imagebuffer[modidx];
    }

    return imgptr;

}

IplImage* CImageDB::get_older_image_gray( unsigned int histindex )
{
    IplImage* imgptr;

    if( (db_filled == false) || (histindex > IMAGEDB_OLDEST))
    {
        imgptr = NULL;
    }
    else
    {
        int idxdiff = addedptr - (CFG_IMGBUFFER_SIZE-1);
        int modidx = 0;

        if( idxdiff < 0 )
        {
            modidx = CFG_IMGBUFFER_SIZE-abs(idxdiff);
        }
        else
        {
            modidx = idxdiff;
        }

        imgptr = imagebuffer_gray[modidx];
    }

    return imgptr;

}

IplImage* CImageDB::get_oldest_image()
{
    return (get_older_image(IMAGEDB_OLDEST));
}

IplImage* CImageDB::get_oldest_image_gray()
{
    return (get_older_image_gray(IMAGEDB_OLDEST));
}

CvSize CImageDB::getImageSize()
{
    return imagesize;
}


text:
<!DOCTYPE html>

		<title>Yamada-kun to 7-nin no Majo - Série (2015) - Yoshikawa Miki</title>

				<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
							<meta name="description" content="Ryu Yamada est un lycéen âgé d'une quinzaine année qui est considéré par ses pairs comme étant un adolescent peu fréquentable.... Anime de Yoshikawa Miki. Fantastique." />
									<meta property="og:image" content="http://media.senscritique.com/media/000009936849/1200/Yamada_kun_to_7_nin_no_Majo.jpg" />

		<link rel="publisher" href="https://plus.google.com/+senscritique">

		<link rel="apple-touch-icon" sizes="57x57" href="http://static.senscritique.com/img/favicon/apple-touch-icon-57x57.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="60x60" href="http://static.senscritique.com/img/favicon/apple-touch-icon-60x60.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="72x72" href="http://static.senscritique.com/img/favicon/apple-touch-icon-72x72.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="76x76" href="http://static.senscritique.com/img/favicon/apple-touch-icon-76x76.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="114x114" href="http://static.senscritique.com/img/favicon/apple-touch-icon-114x114.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="120x120" href="http://static.senscritique.com/img/favicon/apple-touch-icon-120x120.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="144x144" href="http://static.senscritique.com/img/favicon/apple-touch-icon-144x144.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="152x152" href="http://static.senscritique.com/img/favicon/apple-touch-icon-152x152.png?v=eELP384vde">
		<link rel="apple-touch-icon" sizes="180x180" href="http://static.senscritique.com/img/favicon/apple-touch-icon-180x180.png?v=eELP384vde">
		<link rel="icon" type="image/png" href="http://static.senscritique.com/img/favicon/favicon-32x32.png?v=eELP384vde" sizes="32x32">
		<link rel="icon" type="image/png" href="http://static.senscritique.com/img/favicon/favicon-194x194.png?v=eELP384vde" sizes="194x194">
		<link rel="icon" type="image/png" href="http://static.senscritique.com/img/favicon/favicon-96x96.png?v=eELP384vde" sizes="96x96">
		<link rel="icon" type="image/png" href="http://static.senscritique.com/img/favicon/android-chrome-192x192.png?v=eELP384vde" sizes="192x192">
		<link rel="icon" type="image/png" href="http://static.senscritique.com/img/favicon/favicon-16x16.png?v=eELP384vde" sizes="16x16">
		<link rel="manifest" href="http://static.senscritique.com/img/favicon/manifest.json?v=eELP384vde">
		<link rel="shortcut icon" href="http://static.senscritique.com/img/favicon/favicon.ico?v=eELP384vde">

						<link rel="stylesheet" type="text/css" href="http://static.senscritique.com/lib/optimized_ln/7ab3b18d6080a19c9bbe308986fbd666.css"/>

	<link rel="stylesheet" type="text/css" href="http://static.senscritique.com/lib/optimized_ln/3e3a8c511a1e9473c18488d78492b39c.css"/>

		<link rel="apple-touch-icon" href="/img/favicon/57.png">
		<link rel="apple-touch-icon" sizes="72x72" href="/img/favicon/72.png">
		<link rel="apple-touch-icon" sizes="114x114" href="/img/favicon/114.png">
		<link rel="publisher" href="https://plus.google.com/+senscritique">

							<button type="button" data-rel="btn-register" data-scmodal-type="login" class="d-link-alt">Déjà inscrit</button> ?
							<form action="/" method="POST" class="lahe-userSubmenu lahe-signin" data-rel="sc-headerSignin">

Connectez-vous avec

								Facebook
								Twitter

ou

								<input type="text" class="lahe-signin-field" name="email" placeholder="Adresse email" data-rel="sc-headerSignin-email" />
								<input type="password" class="lahe-signin-field" name="password" placeholder="Mot de passe" data-rel="sc-headerSignin-password" />
								Mot de passe oublié ?
								<fieldset class="lahe-signin-clear">

									<input type="submit" class="d-button lahe-signin-confirm" value="Connexion" />
								</fieldset>
							</form>

						<button type="button" data-rel="btn-register" data-scmodal-type="register" class="lahe-userMenu-connect">Créer mon compte</button>

					SensCritique

							Films

Au cinéma

																																														Sorties de la semaine
															À l'affiche
															Mes cinémas
															Meilleurs films 2015

TV / VOD

																																														EveryMovie
															A la télé
															En VOD

Guide

																																														Vos films préférés
															Top 111 films
															Sondages

							Séries

Actualité

																																														Séries du moment
															Meilleures séries 2015

Guide

																																														Vos séries préférées
															Top 111 séries
															Sondages

							Jeux

Actualité

																																														Jeux du moment
															Agenda
															Jeux les plus attendus
															Meilleurs jeux 2015

Guide

																																														Vos jeux préférés
															Top 111 jeux
															Sondages

							Livres

Actualité

																																														Livres du moment
															Meilleures ventes
															Meilleurs livres 2015
															Prix littéraires 2014

Guide

																																														Vos livres préférés
															Top 111 livres
															Sondages

							BD

Actualité

																																														Franco-belge
															Comics
															Mangas
															Meilleures BD 2015

Guide

																																														Vos BD préférées
															Top 111 BD
															Sondages

							Musique

Actualité

																																														Albums du moment
															Prochaines sorties
															Meilleurs albums 2015

Guide

																																														Vos albums préférés
															Top 111 albums
															Sondages

						Posts

			<form action="/recherche?" method="GET" class="lahe-searchBar-content" data-rel="sc-headerSearch">

					 Chercher une œuvre, un artiste, une liste, un cinéma ou un membre

						Tout

Tout

Films

Séries

Livres

BD

Jeux vidéo

Albums de musique

Morceaux de musique

Listes d'oeuvres

Sondages

Sagas

Artistes et sociétés

Membres

Cinémas

					<input type="text" name="query" value="" class="unfocus lahe-searchBar-query" data-rel="sc-headerSearch-query" />
					<button type="button" class="lahe-searchBar-close" data-rel="sc-headerSearch-close">

					</button>

			</form>

SensCritique

Séries

Fantastique

Yamada-kun to 7-nin no Majo

							Yamada-kun to 7-nin no Majo

																								(2015)

12345678910

																															<button type="button" data-sc-action="current"
									data-sc-product-id="15881445"
									data-sc-tooltip="true"
									title="Je suis cette série"
									class="d-button pvi-product-scaction ">

								En cours
							</button>

												<button type="button" data-sc-action="recommend"
								data-sc-product-id="15881445"
								class="d-button pvi-product-scaction "
								style="display:none;">
							 Coup de coeur
						</button>
																			<button type="button" data-rel="bt-review sc-button-modal-sc"
									data-sc-product-id="15881445"
									data-scmodal-type="review"
									class="d-button pvi-product-scaction"
									style="display:none;">
								 Critiquer
							</button>

												<button type="button" data-sc-action="wish-list"
								data-sc-product-id="15881445"
								class="d-button pvi-product-scaction "
								>

								Envie de la voir

						</button>

												<button type="button" data-rel="sc-button"
								data-sc-product-id="15881445"
								class="d-button pvi-product-contextmenu">

						</button>

															6.5

							10
							1
							100
							2

0

0

1

5

7

21

36

21

5

4

					0

0

					1

					0

0

					2

					1

1

					3

					5

5

					4

					7

7

					5

					21

21

					6

					36

36

					7

					21

21

					8

					5

5

					9

					4

4

					10

									100

									9

									26

										13

					<button type="button" class="pco-social-action" data-rel="sc-share-tooltip" data-sc-product-id="15881445">Partager</button>

					<button type="button" class="pco-social-action" data-rel="sc-buy-tooltip" data-sc-product-id="15881445">Acheter</button>

					Accueil

					Saisons

					Critiques

					Listes

				Casting

					Photos

Anime

					 de   Yoshikawa Miki

							Fantastique,

							comédie,

							drame

																(arrêté)

					Tokyo MX

					25 min

<time datetime="2015-03-14" >14 mars 2015</time>

Ryu Yamada est un lycéen âgé d'une quinzaine année qui est considéré par ses pairs comme étant un adolescent peu fréquentable.

En effet, il est grossier, vulgaire, stupide, bref, c'est un mauvais garçon !

De ce fait, personne ne désire le fréquenter et notre héros se sent bien seul.

Sa vie est...					<button type="button" class="d-link" data-rel="sc-btn-more-storyline" data-sc-product-id="15881445">Lire la suite</button>

					<button type="button" class="d-link" data-rel="sc-btn-close-storyline" data-sc-product-id="15881445">Fermer</button>

			Premiers épisodes

								S01E01

																					Je me suis transformé en elle !

								S01E04

																					On dirait bien qu'on en pince pour toi, Yamada !

								S01E03

																					Tu acceptes ou tu refuses ?

																			Dernier épisode diffusé : S01E12

					PostsYamada-kun to 7-nin no Majo

				Vous avez une anecdote, une vidéo/photo ou une simple question sur cette série ?

				<button type="button" data-rel="js-link" data-sc-link="/post/15881445" class="d-button-success-xl d-more pvi-emptyTopic-btn">
					Créer un post
				</button>
				<button type="button" data-rel="js-link" data-sc-link="/posts" class="d-button-xl d-more pvi-emptyTopic-btn">
					Tous les posts
				</button>

Critiques : avis d'internautes (2)
 Yamada-kun to 7-nin no Majo

Tri :

recommandées

positives

négatives

plus récentes

	<button type="button" data-rel="review-overview" data-sc-review-id="60473449" class="ere-review-overview"></button>

	Le fond

				Yamada-kun to 7-nin no Majo

Voila une œuvre original, le graphisme est correct
le scénario n' est pas exceptionnel cependant il est justement original

cela peut paraitre bizarre de voir les protagonistes s'embrasser si simplement
l'humour est plutôt bon dans l'ensemble.

Un sentiments de malaise peut naitre lorsque l'on voit  certaine scène et le coter romantique...
									Lire la critique de Yamada-kun to 7-nin no Majo

						1

					6

							Sibonza Boivin

											· <time  datetime="2015-06-30 03:00:30+02:00" >30 juin 2015</time>

													Découverte

	<button type="button" data-rel="review-overview" data-sc-review-id="63423955" class="ere-review-overview"></button>

	Critique de Yamada-kun to 7-nin no Majo par Gendar

				Une série sans prétention qui dévoile son intrigue assez tardivement. Intrigue qui m'a un peu déçu quand j'ai découvert la vraie nature des sorcières. Ca se suit tout de même agréablement avec des pointes d'humoure réussie. Lefan service est assez peu présent et ne parasite pas l'intrigue.

J'ai rajouté un point pour le travail des doubleurs qui est vraiment bluffant et qui confère un...
									Lire la critique de Yamada-kun to 7-nin no Majo

							<meta itemprop="bestRating" content="10" />

					6

							Gendar

											· <time itemprop="datePublished" datetime="2015-08-01 21:58:07+02:00" > 1 août 2015</time>

			 Toutes les critiques de l'anime Yamada-kun to 7-nin no Majo (2)

			<button type="button" class="d-button d-more" data-rel="sc-btn-more" style="display:none;" data-rel-related="blockReviewsProduct15881445" data-sc-limit="5">
				Critiques suivantes
			</button>

				InfosYamada-kun to 7-nin no Majo

										Scénaristes

								Yokote Michiko

			Vous pourriez également aimer...

		6.9

					Dungeon ni Deai o Motomeru no wa Machigatte Iru Darouka: Familia Myth (2015)

		7.0

					Noragami (2014)

		7.2

					No Game No Life (2014)

		6.4

					Sword Art Online (2012)

		6.3

					Nisekoi (2014)

		6.4

					Btooom! (2012)

		6.4

					Plastic Memories (2015)

		6.1

					Sword Art Online II (2014)

		6.7

					Tokyo Ghoul (2014)

		8.3

					Shigatsu wa Kimi no Uso (2014)

				Dernières actions sur cet anime

			Yamada-kun to 7-nin no Majo

		 Plus d'actualité

				Le bouche à oreille

L'avis de vos amis en 1 clic

				S'inscrire avec FB

										Saisons

						Saison 1

						-

							-

-

										Dans les Tops

							#13
							Les meilleurs animes adaptés de mangas

					Présent dans 1 tops 10

										Sélection de listes

											2015 - Les 4 saisons de la japanimation commentées : Liste des animes 2015

											Manga - Animation ( Vus + Envie )

											Animés Awards 2015

											Liste des Meilleurs Animés de 2015

											Japanimation mon amour ? Version 2015

				 Toutes les listes (42)

										Statuts d'humeurs

Tri :

recommandés

derniers

					Très beau opening.
																<time datetime="2015-04-25 22:15:05+02:00"
							  >
							25 avril 2015
						</time>

							Dio_Brando

				<button type="button" class="esmi-share facebook"

			data-rel="btn-share" data-sc-type="facebook" data-sc-description="Yamada-kun to 7-nin no Majo - Série" data-sc-title="Très beau opening." data-sc-label="Statut par Dio_Brando" data-sc-url="http://www.senscritique.com/activity/67882644"

					data-sc-tooltip="true" title="Partager sur Facebook">Facebook</button>
			<button type="button" class="esmi-share twitter"

			data-rel="btn-share" data-sc-type="twitter" data-sc-without-hashtag="true" data-sc-label="Très beau opening." data-sc-url="http://www.senscritique.com/activity/67882644"

					data-sc-tooltip="true" title="Partager sur Twitter">Twitter</button>

					Très Bon début ! A voir pour la suite !
																<time datetime="2015-04-22 18:23:17+02:00"
							  >
							22 avril 2015
						</time>

							ニコラ 25

				<button type="button" class="esmi-share facebook"

			data-rel="btn-share" data-sc-type="facebook" data-sc-description="Yamada-kun to 7-nin no Majo - Série" data-sc-title="Très Bon début ! A voir pour la suite !" data-sc-label="Statut par ニコラ 25" data-sc-url="http://www.senscritique.com/activity/67669450"

					data-sc-tooltip="true" title="Partager sur Facebook">Facebook</button>
			<button type="button" class="esmi-share twitter"

			data-rel="btn-share" data-sc-type="twitter" data-sc-without-hashtag="true" data-sc-label="Très Bon début ! A voir pour la suite !" data-sc-url="http://www.senscritique.com/activity/67669450"

					data-sc-tooltip="true" title="Partager sur Twitter">Twitter</button>

					 Tous les statuts

				Lab

				Changelog

				À propos

				Aide

				Blog

				Publicité

				Emploi

				Conditions d'utilisation

Séances de cinéma

Programme TV ce soir

Programme TV aujourd'hui

Programme TV demain

Programme TV cette semaine

					Avis films

					Avis séries

					Avis livres

					Avis BD

					Avis jeux vidéo

					Avis musique

		© 2015 SensCritique


text:
#pragma once

#include <memory>
#include <string>
#include <vector>

#include "Eigen/Eigen"

// Eigen 3.3.7: #define ALIVE (0)
// fastrtps: enum ChangeKind_t { ALIVE, ... };
#if defined(ALIVE)
#   undef ALIVE
#endif

#include "cyber/cyber.h"
#include "modules/drivers/proto/pointcloud.pb.h"
#include "modules/drivers/velodyne/proto/config.pb.h"
#include "modules/transform/buffer.h"

namespace apollo {
namespace drivers {
namespace velodyne {

using apollo::cyber::Component;
using apollo::cyber::Reader;
using apollo::cyber::Writer;
using apollo::drivers::PointCloud;

class PriSecFusionComponent : public Component<PointCloud> {
 public:
  bool Init() override;
  bool Proc(const std::shared_ptr<PointCloud>& point_cloud) override;

 private:
  bool Fusion(std::shared_ptr<PointCloud> target,
              std::shared_ptr<PointCloud> source);
  bool IsExpired(const std::shared_ptr<PointCloud>& target,
                 const std::shared_ptr<PointCloud>& source);
  bool QueryPoseAffine(const std::string& target_frame_id,
                       const std::string& source_frame_id,
                       Eigen::Affine3d* pose);
  void AppendPointCloud(std::shared_ptr<PointCloud> point_cloud,
                        std::shared_ptr<PointCloud> point_cloud_add,
                        const Eigen::Affine3d& pose);

  FusionConfig conf_;
  apollo::transform::Buffer* buffer_ptr_ = nullptr;
  std::shared_ptr<Writer<PointCloud>> fusion_writer_;
  std::vector<std::shared_ptr<Reader<PointCloud>>> readers_;
};

CYBER_REGISTER_COMPONENT(PriSecFusionComponent)
}  // namespace velodyne
}  // namespace drivers
}  // namespace apollo


text:
_.templateSettings = {
    interpolate: /<@=(.+?)@>/g,
    escape: /<@-(.+?)@>/g,
    evaluate: /<@(.+?)@>/g
};

var flapjack = {

  module: function() {
    // Internal module cache.
    var modules = {};

    // Create a new module reference scaffold or load an
    // existing module.
    return function(name) {
      // If this module has already been created, return it.
      if (modules[name]) {
        return modules[name];
      }

      // Create a module and save it under this name
      return modules[name] = { Views: {} };
    };
  }()
};

$(document).ready(function() {

  flapjack.ActionsView = Backbone.View.extend({
    initialize: function() {
      this.template = _.template($('#contact-actions-template').html());
    },
    tagName: 'div',
    className: 'actions',
    events: {
      "click button#addContact" : "addContact",
    },
    render: function() {
      this.$el.html(this.template({}));
      return this;
    },
    addContact: function() {
      // skip if modal showing
      if ( $('#contactModal').hasClass('in') ) { return; }

      var contact = new (Contact.Model)();
      contact.setPersisted(false);
      contact.set('id', toolbox.generateUUID());

      var contactDetailsView = new (Contact.Views.ContactDetails)({model: contact});
      contactDetailsView.render();

      $('div.modal-dialog').append(contactDetailsView.$el);
      $('#contactModal').modal('show');
    }
  });

  flapjack['api_url'] = $('div#data-api-url').data('api-url');

  var Contact = flapjack.module("contact");

  var actionsView = new flapjack.ActionsView();

  flapjack.contactList = new Contact.List();

  flapjack.contactList.fetch({
    success: function(collection, response, options) {
      var contactListView = new (Contact.Views.List)({collection: collection});
      contactListView.render();
      $('tbody#contactList').replaceWith(contactListView.$el);

      $('#contactModal').on('hidden.bs.modal', function (e) {
        e.stopImmediatePropagation();
        $('div.modal-dialog').empty();
      });

      $('#container').append(actionsView.render().el);
    }
  });

});


text:
#include <climits>
#include <limits>
#include <vector>

#include "native_client/src/include/nacl_string.h"
#include "native_client/src/include/portability.h"
#include "native_client/src/shared/platform/nacl_check.h"
#include "native_client/src/shared/platform/nacl_log.h"
#include "native_client/src/trusted/service_runtime/nacl_config.h"
#include "native_client/src/trusted/validator_arm/cpuid_arm.h"
#include "native_client/src/trusted/validator_arm/model.h"
#include "native_client/src/trusted/validator_arm/validator.h"
#include "native_client/src/trusted/validator/ncvalidate.h"

using nacl_arm_val::SfiValidator;
using nacl_arm_val::CodeSegment;
using nacl_arm_dec::Register;
using nacl_arm_dec::RegisterList;
using std::vector;

class EarlyExitProblemSink : public nacl_arm_val::ProblemSink {
 private:
  bool problems_;
 public:
  EarlyExitProblemSink() : nacl_arm_val::ProblemSink(), problems_(false) {}
  virtual bool should_continue() {
    return !problems_;
  }

 protected:
  virtual void ReportProblemInternal(
      uint32_t vaddr,
      nacl_arm_val::ValidatorProblem problem,
      nacl_arm_val::ValidatorProblemMethod method,
      nacl_arm_val::ValidatorProblemUserData user_data) {
    UNREFERENCED_PARAMETER(vaddr);
    UNREFERENCED_PARAMETER(problem);
    UNREFERENCED_PARAMETER(method);
    UNREFERENCED_PARAMETER(user_data);

    problems_ = true;
  }
};

static inline bool IsAligned(intptr_t value) {
  return (value & (NACL_BLOCK_SHIFT - 1)) == 0;
}

static inline bool IsAlignedPtr(void* ptr) {
  return IsAligned(reinterpret_cast<intptr_t>(ptr));
}

static const uintptr_t kBytesPerBundle = 1 << NACL_BLOCK_SHIFT;
static const uintptr_t kBytesOfCodeSpace = 1U * 1024 * 1024 * 1024;
static const uintptr_t kBytesOfDataSpace = 1U * 1024 * 1024 * 1024;

// The following checks should have been checked at a higher level, any error
// here is a break of the validator's preconditions. Don't try to recover.
static inline void CheckAddressOverflow(uint8_t* ptr, size_t size) {
  CHECK(ptr < std::numeric_limits<uint8_t *>::max() - size);
}

static inline void CheckAddressAlignAndOverflow(uint8_t* ptr, size_t size) {
  CHECK(IsAlignedPtr(ptr));
  CHECK(IsAligned(size));
  CheckAddressOverflow(ptr, size);
}

static NaClValidationStatus ValidatorCopyArm(
    uintptr_t guest_addr,
    uint8_t *data_old,
    uint8_t *data_new,
    size_t size,
    const NaClCPUFeatures *cpu_features,
    NaClCopyInstructionFunc copy_func) {
  UNREFERENCED_PARAMETER(cpu_features);
  CheckAddressAlignAndOverflow((uint8_t *) guest_addr, size);
  CheckAddressOverflow(data_old, size);
  CheckAddressOverflow(data_new, size);

  CodeSegment dest_code(data_old, guest_addr, size);
  CodeSegment source_code(data_new, guest_addr, size);
  EarlyExitProblemSink sink;
  SfiValidator validator(
      kBytesPerBundle,
      kBytesOfCodeSpace,
      kBytesOfDataSpace,
      RegisterList(Register::Tp()),
      RegisterList(Register::Sp()));

  bool success = validator.CopyCode(source_code, dest_code, copy_func,
                                    &sink);
  return success ? NaClValidationSucceeded : NaClValidationFailed;
}

static NaClValidationStatus ValidatorCodeReplacementArm(
    uintptr_t guest_addr,
    uint8_t *data_old,
    uint8_t *data_new,
    size_t size,
    const NaClCPUFeatures *cpu_features) {
  UNREFERENCED_PARAMETER(cpu_features);
  CheckAddressAlignAndOverflow((uint8_t *) guest_addr, size);
  CheckAddressOverflow(data_old, size);
  CheckAddressOverflow(data_new, size);

  CodeSegment new_code(data_new, guest_addr, size);
  CodeSegment old_code(data_old, guest_addr, size);
  EarlyExitProblemSink sink;
  SfiValidator validator(
      kBytesPerBundle,
      kBytesOfCodeSpace,
      kBytesOfDataSpace,
      RegisterList(Register::Tp()),
      RegisterList(Register::Sp()));

  bool success = validator.ValidateSegmentPair(old_code, new_code,
                                               &sink);
  return success ? NaClValidationSucceeded : NaClValidationFailed;
}

EXTERN_C_BEGIN

static int NCValidateSegment(uint8_t *mbase, uint32_t vbase, size_t size) {
  SfiValidator validator(
      kBytesPerBundle,
      kBytesOfCodeSpace,
      kBytesOfDataSpace,
      RegisterList(Register::Tp()),
      RegisterList(Register::Sp()));

  EarlyExitProblemSink sink;

  vector<CodeSegment> segments;
  segments.push_back(CodeSegment(mbase, vbase, size));

  bool success = validator.validate(segments, &sink);
  if (!success) return 2;  // for compatibility with old validator
  return 0;
}

static NaClValidationStatus ApplyValidatorArm(
    uintptr_t guest_addr,
    uint8_t *data,
    size_t size,
    int stubout_mode,
    int readonly_text,
    const NaClCPUFeatures *cpu_features,
    struct NaClValidationCache *cache) {
  UNREFERENCED_PARAMETER(cpu_features);
  /* The ARM validator is currently unsafe w.r.t. caching. */
  UNREFERENCED_PARAMETER(cache);
  CheckAddressAlignAndOverflow((uint8_t *) guest_addr, size);
  CheckAddressOverflow(data, size);
  CheckAddressOverflow(data, size);

  if (stubout_mode)
    return NaClValidationFailedNotImplemented;
  if (readonly_text)
    return NaClValidationFailedNotImplemented;

  return ((0 == NCValidateSegment(data, guest_addr, size))
           ? NaClValidationSucceeded : NaClValidationFailed);
}

static struct NaClValidatorInterface validator = {
  ApplyValidatorArm,
  ValidatorCopyArm,
  ValidatorCodeReplacementArm,
};

const struct NaClValidatorInterface *NaClValidatorCreateArm() {
  return &validator;
}

/*
 * It should be moved to be part of sel_ldr, not the validator.
 */
int NaClCopyInstruction(uint8_t *dst, uint8_t *src, uint8_t sz) {
  CHECK(sz == nacl_arm_dec::kArm32InstSize / CHAR_BIT);
  *(volatile uint32_t*) dst = *(volatile uint32_t*) src;
  // Don't invalidate i-cache on every instruction update.
  // CPU executing partially updated code doesn't look like a problem,
  // as we know for sure that both old and new instructions are safe,
  // so is their mix (single instruction update is atomic).
  // We just have to make sure that unintended fallthrough doesn't
  // happen, and we don't change position of guard instructions.
  // Problem is that code is mapped for execution at different address
  // that one we use here, and ARM usually use virtually indexed caches,
  // so we couldn't invalidate correctly anyway.
  return 0;
}

EXTERN_C_END


text:
require 'spec_helper'
require 'plaintweet/repository'

RSpec.describe 'Tweets Repository', integration: true do
  subject(:repository) { Plaintweet::Repository.new }

  it 'provides the tweet' do
    tweet = repository.tweet('https://twitter.com/dcxxx187/status/891545131417030656')
    expect(tweet).to be
  end

  it "provides the tweet's text" do
    tweet = repository.tweet('https://twitter.com/dcxxx187/status/891545131417030656')
    expect(tweet.text).to_not be_empty
  end

  it "provides the tweet's author and her screen name" do
    tweet = repository.tweet('https://twitter.com/dcxxx187/status/891545131417030656')
    expect(tweet.user).to be
    expect(tweet.user.screen_name).to eq('dcxxx187')
  end
end


text:
package com.github.gigurra

import java.util.concurrent.TimeUnit

import akka.actor.{Actor, ActorSystem, PoisonPill, Props, SupervisorStrategy}
import akka.pattern.{Backoff, BackoffSupervisor}
import akka.routing.BalancingPool
import com.github.gigurra.WorkerActor.DoWork

import scala.concurrent.duration.FiniteDuration
import scala.concurrent.ExecutionContext.Implicits.global

object ChainSupervisors {
  implicit class RichPfSupervisor(supervisorCtor: (Props, String) => Props) {
    def around(another: (Props, String) => Props): RichPfSupervisor = {
      (props: Props, name: String) => supervisorCtor(another(props, name), "supervision-layer")
    }
    def apply(props: Props, name: String): Props = {
      supervisorCtor(props, name)
    }
  }
}

class MasterActor extends Actor {
  case object Tick

  private val tickInterval = FiniteDuration(1, TimeUnit.SECONDS)

  println(s"Starting $this:${self.path} with tick interval")

  import ChainSupervisors._

  private val failureRestartingSupervisor = (props: Props, name: String) => BackoffSupervisor.props(Backoff.onFailure(
    childProps = props,
    childName = name,
    minBackoff = FiniteDuration(1, TimeUnit.SECONDS),
    maxBackoff = FiniteDuration(60, TimeUnit.SECONDS),
    randomFactor = 0.2
  ))

  private val stopRestartingSupervisor = (props: Props, name: String) => BackoffSupervisor.props(Backoff.onStop(
    childProps = props,
    childName = name,
    minBackoff = FiniteDuration(1, TimeUnit.SECONDS),
    maxBackoff = FiniteDuration(60, TimeUnit.SECONDS),
    randomFactor = 0.2
  ))

  private val combinedSupervision = stopRestartingSupervisor around failureRestartingSupervisor

  private val loop = context.system.scheduler.schedule(FiniteDuration(0, TimeUnit.SECONDS), interval = tickInterval)(self ! Tick)

  // Restart on failure with backoff
  private val workers = context.actorOf(combinedSupervision(BalancingPool(5).props(Props[WorkerActor]), "pool"))

  // Restart on failure without backoff - Need to explicitly tell the pool to only restart the failing actor - not all of them!
  //private val workers = context.actorOf(RoundRobinPool(5, supervisorStrategy = MasterActor.this.supervisorStrategy).props(Props[WorkerActor]))

  override def supervisorStrategy: SupervisorStrategy = super.supervisorStrategy

  override def receive: Receive = {
    case Tick =>
      println("Master actor Tick!")
      if (math.random < 0.008) {
        workers ! DoWork(success = true)
      } else {
        workers ! DoWork(success = false)
      }
  }

  override def postStop(): Unit ={
    println(s"$this died")
    loop.cancel()
  }
}

class WorkerActor extends Actor {

  println(s"Starting $this")

  override def receive: Receive = {
    case DoWork(success) =>
      if (success) {
        println(s"$this did successful work")
      } else {
        println(s"Oh no - $this is failing")
        throw new RuntimeException(s"$this failed")
      }
  }
}

object WorkerActor {
  case class DoWork(success: Boolean)
}

object FunWithAkka {
  def main(args: Array[String]): Unit = {
    val actorSystem = ActorSystem("my-system")
    val masterActor = actorSystem.actorOf(Props[MasterActor], name = "the-instance")
    val masterActor2 = actorSystem.actorSelection("akka://my-system/user/the-instance")

    actorSystem.scheduler.scheduleOnce(FiniteDuration(50, TimeUnit.SECONDS))(masterActor2 ! PoisonPill)

  }
}


text:
<?php

/**
 *       \file       htdocs/webservices/client.php
 *       \brief      Demo page to make a client call to Dolibarr WebServices "server_invoice"
 *       \version    $Id: demo_wsclient_invoice.php,v 1.2.2.2 2011/03/18 09:54:01 eldy Exp $
 */

// This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');

require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php');		// Include SOAP

$WS_DOL_URL = $dolibarr_main_url_root.'/webservices/server_invoice.php';
$WS_METHOD1  = 'getInvoice';
$WS_METHOD2  = 'getInvoicesForThirdParty';
$ns='http://www.dolibarr.org/ns/';

// Set the WebService URL
dol_syslog("Create nusoap_client for URL=".$WS_DOL_URL);
$soapclient1 = new nusoap_client($WS_DOL_URL);
if ($soapclient1)
{
	$soapclient1->soap_defencoding='UTF-8';
	$soapclient1->decodeUTF8(false);
}
$soapclient2 = new nusoap_client($WS_DOL_URL);
if ($soapclient2)
{
    $soapclient2->soap_defencoding='UTF-8';
	$soapclient2->decodeUTF8(false);
}

// Call the WebService method and store its result in $result.
$authentication=array(
    'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
    'sourceapplication'=>'DEMO',
    'login'=>'admin',
    'password'=>'changeme',
    'entity'=>'');

$parameters = array('authentication'=>$authentication,'id'=>1,'ref'=>'');
dol_syslog("Call method ".$WS_METHOD1);
$result1 = $soapclient1->call($WS_METHOD1,$parameters,$ns,'');
if (! $result1)
{
	print $soapclient1->error_str;
	exit;
}

$parameters = array('authentication'=>$authentication,'idthirdparty'=>'1');
dol_syslog("Call method ".$WS_METHOD2);
$result2 = $soapclient2->call($WS_METHOD2,$parameters,$ns,'');
if (! $result2)
{
    print $soapclient2->error_str;
    exit;
}

/*
 * View
 */

header("Content-type: text/html; charset=utf8");
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
echo ''."\n";
echo '';
echo '<title>WebService Test: '.$WS_METHOD1.'</title>';
echo ''."\n";

echo ''."\n";

echo "
Request:
";
echo '
Function
';
echo $WS_METHOD1;
echo '
SOAP Message
';
echo '
' . htmlspecialchars($soapclient1->request, ENT_QUOTES) . '
';
echo '
';
echo "
Response:
";
echo '
Result
';
echo '
';
print_r($result1);
echo '
';
echo '
SOAP Message
';
echo '
' . htmlspecialchars($soapclient1->response, ENT_QUOTES) . '
';

print '
';

echo "
Request:
";
echo '
Function
';
echo $WS_METHOD2;
echo '
SOAP Message
';
echo '
' . htmlspecialchars($soapclient2->request, ENT_QUOTES) . '
';
echo '
';
echo "
Response:
";
echo '
Result
';
echo '
';
print_r($result2);
echo '
';
echo '
SOAP Message
';
echo '
' . htmlspecialchars($soapclient2->response, ENT_QUOTES) . '
';

echo ''."\n";;
echo ''."\n";;
?>


text:
<?php

namespace KuzniaIt\Bundle\SecurityBundle\Twig\Extension;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Doctrine\ORM\EntityManager;

class MailerGlobalsExtension extends \Twig_Extension \Controller
{

   protected $em;

   public function __construct(EntityManager $em)
   {
      $this->em = $em;
   }

   public function getGlobals()
   {
      return array (
              "mail_counter" =>
              $this->em->getRepository('KuzniaItSecurityBundle:Message')
              ->findByGetter(
                        $this
                       ->get('security.token_storage')
                       ->getToken()
                       ->getUser()
                       ->getUsername())
              ->findByUnread(1)
              ->count(),
      );
   }

   public function getName()
   {
      return "KuzniaItSecurityBundle:MessageCounter";
   }

}


text:
#ifndef TEST_SN_NSDL_H
#define TEST_SN_NSDL_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>

bool test_sn_nsdl_destroy();

bool test_sn_nsdl_init();

bool test_sn_nsdl_register_endpoint();

bool test_sn_nsdl_unregister_endpoint();

bool test_sn_nsdl_update_registration();

bool test_sn_nsdl_set_endpoint_location();

bool test_sn_nsdl_nsp_lost();

bool test_sn_nsdl_is_ep_registered();

bool test_sn_nsdl_send_observation_notification();

bool test_sn_nsdl_send_observation_notification_with_uri_path();

bool test_sn_nsdl_oma_bootstrap();

bool test_sn_nsdl_get_certificates();

bool test_sn_nsdl_update_certificates();

bool test_sn_nsdl_create_oma_device_object();

bool test_sn_nsdl_get_version();

bool test_sn_nsdl_process_coap();

bool test_sn_nsdl_exec();

bool test_sn_nsdl_get_resource();

bool test_set_NSP_address();

bool test_sn_nsdl_list_resource();

bool test_sn_nsdl_free_resource_list();

bool test_sn_nsdl_update_resource();

bool test_sn_nsdl_send_coap_message();

bool test_sn_nsdl_create_resource();

bool test_sn_nsdl_put_resource();

bool test_sn_nsdl_delete_resource();

bool test_sn_nsdl_get_first_resource();

bool test_sn_nsdl_get_next_resource();

bool test_sn_nsdl_build_response();

bool test_sn_nsdl_release_allocated_coap_msg_mem();

bool test_sn_nsdl_set_retransmission_parameters();

bool test_sn_nsdl_set_retransmission_buffer();

bool test_sn_nsdl_set_block_size();

bool test_sn_nsdl_set_duplicate_buffer_size();

bool test_sn_nsdl_set_context();

bool test_sn_nsdl_get_context();

#ifdef __cplusplus
}
#endif

#endif // TEST_SN_NSDL_H


text:
from dnrm import wsgi

class VersionController(wsgi.Controller):
    def __init__(self):
        super(VersionController, self).__init__()

    def _get_versions(self):
        return ["v1"]

    def index(self, request):
        """Return a summary list of API versions."""
        return {'versions': self._get_versions()}

def create_resource():
    return wsgi.Resource(VersionController())


text:
package org.java_websocket.issues;

import java.net.InetSocketAddress;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.java_websocket.WebSocket;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.handshake.ServerHandshake;
import org.java_websocket.server.WebSocketServer;
import org.java_websocket.util.SocketUtil;
import org.java_websocket.util.ThreadCheck;
import org.junit.Assert;
import org.junit.Test;

public class Issue666Test {

  private CountDownLatch countServerDownLatch = new CountDownLatch(1);

  @Test
  public void testServer() throws Exception {
    Map<Long, Thread> mapBefore = ThreadCheck.getThreadMap();
    int port = SocketUtil.getAvailablePort();
    WebSocketServer server = new WebSocketServer(new InetSocketAddress(port)) {
      @Override
      public void onOpen(WebSocket conn, ClientHandshake handshake) {
      }

      @Override
      public void onClose(WebSocket conn, int code, String reason, boolean remote) {

      }

      @Override
      public void onMessage(WebSocket conn, String message) {

      }

      @Override
      public void onError(WebSocket conn, Exception ex) {

      }

      @Override
      public void onStart() {
        countServerDownLatch.countDown();
      }
    };
    server.start();
    countServerDownLatch.await();
    Map<Long, Thread> mapAfter = ThreadCheck.getThreadMap();
    for (long key : mapBefore.keySet()) {
      mapAfter.remove(key);
    }
    for (Thread thread : mapAfter.values()) {
      String name = thread.getName();
      if (!name.startsWith("WebSocketSelector-") && !name.startsWith("WebSocketWorker-") && !name
          .startsWith("connectionLostChecker-")) {
        Assert.fail("Thread not correctly named! Is: " + name);
      }
    }
    server.stop();
  }

  @Test
  public void testClient() throws Exception {
    int port = SocketUtil.getAvailablePort();
    WebSocketClient client = new WebSocketClient(new URI("ws://localhost:" + port)) {
      @Override
      public void onOpen(ServerHandshake handshakedata) {

      }

      @Override
      public void onMessage(String message) {

      }

      @Override
      public void onClose(int code, String reason, boolean remote) {
      }

      @Override
      public void onError(Exception ex) {

      }
    };
    WebSocketServer server = new WebSocketServer(new InetSocketAddress(port)) {
      @Override
      public void onOpen(WebSocket conn, ClientHandshake handshake) {
      }

      @Override
      public void onClose(WebSocket conn, int code, String reason, boolean remote) {

      }

      @Override
      public void onMessage(WebSocket conn, String message) {

      }

      @Override
      public void onError(WebSocket conn, Exception ex) {

      }

      @Override
      public void onStart() {
        countServerDownLatch.countDown();
      }
    };
    server.start();
    countServerDownLatch.await();
    Map<Long, Thread> mapBefore = ThreadCheck.getThreadMap();
    client.connectBlocking();
    Map<Long, Thread> mapAfter = ThreadCheck.getThreadMap();
    for (long key : mapBefore.keySet()) {
      mapAfter.remove(key);
    }
    for (Thread thread : mapAfter.values()) {
      String name = thread.getName();
      if (!name.startsWith("connectionLostChecker-") && !name.startsWith("WebSocketWriteThread-")
          && !name.startsWith("WebSocketConnectReadThread-")) {
        Assert.fail("Thread not correctly named! Is: " + name);
      }
    }
    client.close();
    server.stop();
  }
}


text:
/**
 * ipc main
 */

const {
  ipcMain,
  app,
  BrowserWindow,
  dialog,
  powerMonitor,
  globalShortcut,
  shell
} = require('electron')
const { dbAction } = require('./nedb')
const { listItermThemes } = require('./iterm-theme')
const installSrc = require('./install-src')
const { getConfig } = require('./get-config')
const loadSshConfig = require('./ssh-config')
const {
  toCss,
  clearCssCache
} = require('./style')
const initServer = require('./init-server')
const {
  getLang,
  loadLocales
} = require('./locales')
const openNewInstance = require('./open-new-instance')
const { saveUserConfig } = require('./user-config-controller')
const { changeHotkeyReg, initShortCut } = require('./shortcut')
const lastStateManager = require('./last-state')
const {
  packInfo,
  appPath,
  isTest,
  isMac
} = require('../common/app-props')
const {
  getScreenSize,
  maximize,
  unmaximize
} = require('./window-control')
const { loadFontList } = require('./font-list')
const { checkDbUpgrade, doUpgrade } = require('../upgrade')
const { listSerialPorts } = require('./serial-port')
const initApp = require('./init-app')
const { encryptAsync, decryptAsync } = require('./enc')
const { initCommandLine } = require('./command-line')
const { watchFile, unwatchFile } = require('./watch-file')

function initIpc () {
  global.win.on('move', () => {
    global.win.webContents.send('window-move', null)
  })
  powerMonitor.on('resume', () => {
    global.win.webContents.send('power-resume', null)
  })
  async function init () {
    const {
      config
    } = await getConfig(global.et.serverInited)
    const {
      langs,
      langMap,
      sysLocale
    } = await loadLocales()
    const language = getLang(config, sysLocale, langs)
    config.language = language
    if (!global.et.serverInited) {
      const child = await initServer(config, {
        ...process.env,
        appPath
      }, sysLocale)
      child.on('message', (m) => {
        if (m && m.showFileInFolder) {
          if (!isMac) {
            shell.showItemInFolder(m.showFileInFolder)
          }
        }
      })
      global.et.serverInited = true
    }
    global.et.config = config
    const globs = {
      config,
      langs,
      langMap,
      installSrc,
      appPath
    }
    initApp(langMap, config)
    initShortCut(globalShortcut, global.win, config)
    return globs
  }
  const isMaximized = () => {
    const {
      width: widthMax,
      height: heightMax,
      x: sx,
      y: sy
    } = getScreenSize()
    const { width, height, x, y } = global.win.getBounds()
    return widthMax === width &&
      heightMax === height &&
      x === sx &&
      y === sy
  }
  const syncFuncs = {
    getArgs: () => {
      return global.rawArgs
    },
    getLoadTime: () => {
      return global.loadTime
        ? { loadTime: global.loadTime }
        : { initTime: global.initTime }
    },
    setLoadTime: (loadTime) => {
      global.loadTime = loadTime
    },
    isMaximized,
    isSencondInstance: () => {
      return isTest ? false : global.app.isSencondInstance
    }
  }
  ipcMain.on('sync-func', (event, { name, args }) => {
    event.returnValue = syncFuncs[name](...args)
  })
  const asyncGlobals = {
    loadSshConfig,
    openNewInstance,
    init,
    listSerialPorts,
    toCss,
    clearCssCache,
    loadFontList,
    doUpgrade,
    checkDbUpgrade,
    isMaximized,
    getExitStatus: () => global.et.exitStatus,
    setExitStatus: (status) => {
      global.et.exitStatus = status
    },
    encryptAsync,
    decryptAsync,
    dbAction,
    getScreenSize,
    closeApp: () => {
      global.win && global.win.close()
    },
    restart: () => {
      global.win.close()
      app.relaunch()
    },
    minimize: () => {
      global.win.minimize()
    },
    listItermThemes,
    maximize,
    unmaximize,
    openDevTools: () => {
      global.win.webContents.openDevTools()
    },
    lastStateManager,
    setWindowSize: (update) => {
      lastStateManager.set('windowSize', update)
    },
    saveUserConfig,
    setTitle: (title) => {
      global.win && global.win.setTitle(packInfo.name + ' - ' + title)
    },
    changeHotkey: changeHotkeyReg(globalShortcut, global.win),
    initCommandLine,
    watchFile,
    unwatchFile
  }
  ipcMain.handle('async', (event, { name, args }) => {
    return asyncGlobals[name](...args)
  })
  ipcMain.handle('show-open-dialog-sync', async (event, ...args) => {
    const win = BrowserWindow.fromWebContents(event.sender)
    return dialog.showOpenDialogSync(win, ...args)
  })
}

module.exports = initIpc


text:
package com.dms.oauth.inf.client.svc;

import com.dms.oauth.domain.client.Client;
import com.dms.oauth.inf.client.cmd.CheckClientIdCmd;
import com.dms.oauth.inf.client.cmd.CheckClientSecretCmd;
import com.dms.oauth.inf.client.cmd.CreateClientCmd;
import com.dms.oauth.inf.client.cmd.DeleteClientCmd;
import com.dms.oauth.inf.client.cmd.LoadClientCmd;
import com.dms.oauth.inf.client.cmd.UpdateClientCmd;

public interface ClientService {

	public void createClient(CreateClientCmd cmd);
    public void updateClient(UpdateClientCmd cmd);
    public void deleteClient(DeleteClientCmd cmd);
    public boolean isExist(LoadClientCmd cmd);
	public boolean checkClientSecret(CheckClientSecretCmd cmd);
	public boolean checkClientId(CheckClientIdCmd cmd);
	public Client load(LoadClientCmd loadClientCmd);
}


text:
#pragma once

#include <cstddef>
#include <utility>

/***********************************************************************************/
// Forward Declarations
namespace pugi {
class xml_node;
}
class Engine;
struct GLFWwindow;

/***********************************************************************************/
class WindowSystem {
	friend class Engine;
public:
	WindowSystem() noexcept = default;

	WindowSystem(WindowSystem&&) = default;
	WindowSystem(const WindowSystem&) = delete;
	WindowSystem& operator=(WindowSystem&&) = default;
	WindowSystem& operator=(const WindowSystem&) = delete;

	~WindowSystem() = default;

	GLFWwindow* Init(const pugi::xml_node& windowNode);
	void Update();
	void Shutdown() const;

	void SetWindowPos(const std::size_t x, const std::size_t y) const;
	void SwapBuffers() const;

	void EnableCursor() const;
	void DisableCursor() const;

	void SetVsync(const bool vsync) const;

	auto ShouldClose() const noexcept { return m_shouldWindowClose; }
	auto IsCursorVisible() const noexcept { return m_showCursor; }

	// Returns the window's framebuffer dimensions in pixels {width, height}.
	std::pair<int, int> GetFramebufferDims() const;

private:
	GLFWwindow* m_window{ nullptr };

	bool m_shouldWindowClose{ false };
	bool m_showCursor{ false };
};