text:
using System;
using System.Reflection;
using System.Threading;

using Microsoft.VisualStudio.TestTools.UnitTesting;

#pragma warning disable 219
#pragma warning disable 168

namespace MonoTests.System
{
    [TestClass]
    public class LazyTest
	{
		[TestMethod]
		[ExpectedException (typeof (ArgumentNullException))]
		public void Ctor_Null_1 () {
			new Lazy<int> (null);
		}

		[TestMethod]
		[ExpectedException (typeof (ArgumentNullException))]
		public void Ctor_Null_2 () {
			new Lazy<int> (null, false);
		}

		[TestMethod]
		public void IsValueCreated () {
			var l1 = new Lazy<int> ();

			Assert.IsFalse (l1.IsValueCreated);

			int i = l1.Value;

			Assert.IsTrue (l1.IsValueCreated);
		}

		[TestMethod]
		public void DefaultCtor () {
			var l1 = new Lazy<DefaultCtorClass> ();

			var o = l1.Value;
			Assert.AreEqual (5, o.Prop);
		}

		class DefaultCtorClass {
			public DefaultCtorClass () {
				Prop = 5;
			}

			public int Prop {
				get; set;
			}
		}

		[TestMethod]
		public void NoDefaultCtor () {
			var l1 = new Lazy<NoDefaultCtorClass> ();

			try {
				var o = l1.Value;
				Assert.Fail ();
			} catch (MissingMemberException) {
			}
		}

		class NoDefaultCtorClass {
			public NoDefaultCtorClass (int i) {
			}
		}

		[TestMethod]
		public void NotThreadSafe () {
			var l1 = new Lazy<int> ();

			Assert.AreEqual (0, l1.Value);

			var l2 = new Lazy<int> (delegate () { return 42; });

			Assert.AreEqual (42, l2.Value);
		}

		static int counter;

		[TestMethod]
		public void EnsureSingleThreadSafeExecution () {
			counter = 42;

			var l = new Lazy<int> (delegate () { return counter ++; }, true);

			object monitor = new object ();
			var threads = new Thread [10];
			for (int i = 0; i < 10; ++i) {
				threads [i] = new Thread (delegate () {
						lock (monitor) {
							Monitor.Wait (monitor);
						}
						int val = l.Value;
					});
			}
			for (int i = 0; i < 10; ++i)
				threads [i].Start ();
			lock (monitor)
				Monitor.PulseAll (monitor);

			Assert.AreEqual (42, l.Value);
		}

		[TestMethod]
		public void InitRecursion ()
		{
			Lazy<DefaultCtorClass> c = null;
			c = new Lazy<DefaultCtorClass> (() => { Console.WriteLine (c.Value); return null; });

			try {
				var r = c.Value;
				Assert.Fail ();
			} catch (InvalidOperationException) {
			}
		}

		[TestMethod]
		public void ModeNone ()
		{
			int x;
			bool fail = true;
			Lazy<int> lz = new Lazy<int> (() => { if (fail) throw new Exception (); else return 99; }, LazyThreadSafetyMode.None);
			try {
				x = lz.Value;
				Assert.Fail ("#1");
				Console.WriteLine (x);
			} catch (Exception ex) { }

			try {
				x = lz.Value;
				Assert.Fail ("#2");
			} catch (Exception ex) { }

			fail = false;
			try {
				x = lz.Value;
				Assert.Fail ("#3");
			} catch (Exception ex) { }

			bool rec = true;
			lz = new Lazy<int> (() => rec ? lz.Value : 99, LazyThreadSafetyMode.None);

			try {
				x = lz.Value;
				Assert.Fail ("#4");
			} catch (InvalidOperationException ex) { }

			rec = false;
			try {
				x = lz.Value;
				Assert.Fail ("#5");
			} catch (InvalidOperationException ex) { }
		}

		[TestMethod]
		public void ModePublicationOnly () {
			bool fail = true;
			int invoke = 0;
			Lazy<int> lz = new Lazy<int> (() => { ++invoke; if (fail) throw new Exception (); else return 99; }, LazyThreadSafetyMode.PublicationOnly);

			try {
				int x = lz.Value;
				Assert.Fail ("#1");
				Console.WriteLine (x);
			} catch (Exception ex) { }

			try {
				int x = lz.Value;
				Assert.Fail ("#2");
			} catch (Exception ex) { }

			Assert.AreEqual (2, invoke, "#3");
			fail = false;
			Assert.AreEqual (99,  lz.Value, "#4");
			Assert.AreEqual (3, invoke, "#5");

			invoke = 0;
			bool rec = true;
			lz = new Lazy<int> (() => { ++invoke; bool r = rec; rec = false; return r ? lz.Value : 88; }, 	LazyThreadSafetyMode.PublicationOnly);

			Assert.AreEqual (88,  lz.Value, "#6");
			Assert.AreEqual (2, invoke, "#7");
		}

		[TestMethod]
		public void ModeExecutionAndPublication () {
			int invoke = 0;
			bool fail = true;
			Lazy<int> lz = new Lazy<int> (() => { ++invoke; if (fail) throw new Exception (); else return 99; }, LazyThreadSafetyMode.ExecutionAndPublication);

			try {
				int x = lz.Value;
				Assert.Fail ("#1");
				Console.WriteLine (x);
			} catch (Exception ex) { }
			Assert.AreEqual (1, invoke, "#2");

			try {
				int x = lz.Value;
				Assert.Fail ("#3");
			} catch (Exception ex) { }
			Assert.AreEqual (1, invoke, "#4");

			fail = false;
			try {
				int x = lz.Value;
				Assert.Fail ("#5");
			} catch (Exception ex) { }
			Assert.AreEqual (1, invoke, "#6");

			bool rec = true;
			lz = new Lazy<int> (() => rec ? lz.Value : 99, LazyThreadSafetyMode.ExecutionAndPublication);

			try {
				int x = lz.Value;
				Assert.Fail ("#7");
			} catch (InvalidOperationException ex) { }

			rec = false;
			try {
				int x = lz.Value;
				Assert.Fail ("#8");
			} catch (InvalidOperationException ex) { }
		}

		static int Return22 () {
			return 22;
		}

		[TestMethod]
		public void Trivial_Lazy () {
			var x = new Lazy<int> (Return22, false);
			Assert.AreEqual (22, x.Value, "#1");
		}

		[TestMethod]
		public void ConcurrentInitialization ()
		{
			var init = new AutoResetEvent (false);
			var e1_set = new AutoResetEvent (false);

			var lazy = new Lazy<string> (() => {
				init.Set ();
				Thread.Sleep (10);
				throw new ApplicationException ();
			});

			Exception e1 = null;
			var thread = new Thread (() => {
				try {
					string value = lazy.Value;
				} catch (Exception ex) {
					e1 = ex;
					e1_set.Set ();
				}
			});
			thread.Start ();

			Assert.IsTrue (init.WaitOne (3000), "#1");

			Exception e2 = null;
			try {
				string value = lazy.Value;
			} catch (Exception ex) {
				e2 = ex;
			}

			Exception e3 = null;
			try {
				string value = lazy.Value;
			} catch (Exception ex) {
				e3 = ex;
			}

			Assert.IsTrue (e1_set.WaitOne (3000), "#2");
			Assert.AreSame (e1, e2, "#3");
			Assert.AreSame (e1, e3, "#4");
		}

	}
}

#endif


text:
.types {
    font-family: 'Quicksand', sans-serif;
    position: center;
    text-align: center;
}

.types type_label:checked + .button{background:#fff;}

redpajama_set_name: RedPajamaGithub


text:
.include <bsd.own.mk>

PROG=	restore
LINKS=	${BINDIR}/restore ${BINDIR}/rrestore
CPPFLAGS+=-DRRESTORE
SRCS=	main.c interactive.c restore.c dirs.c symtab.c tape.c utilities.c \
	dumprmt.c
MAN=	restore.8
MLINKS+=restore.8 rrestore.8
.PATH:	${NETBSDSRCDIR}/sbin/dump

.include <bsd.prog.mk>


text:
class PagesController < ApplicationController
  def index
  end

  def about

  end

  def lessons

  end
end


text:
set -e

# [1] https://github.com/docker/compose/issues/1393
# [1] http://stackoverflow.com/questions/35022428
readonly WEB_HOME=/cyber-dojo
rm -f ${WEB_HOME}/tmp/pids/server.pid # [1]

export CYBER_DOJO_RUNNER_CLASS=RunnerService
export CYBER_DOJO_SAVER_CLASS=SaverService

rails server \
  --environment=production


text:
<?php defined('SYSPATH') OR die('No Direct Script Access');

/**
 * Cauth controller class.
 */
class Controller_Cauth extends Controller
{
  /**
   * Executes login action.
   */
  public function action_login()
  {
    $post = $this->request->post();
    $success = Auth::instance()->login($post['username'], $post['password']);

    $session = Session::instance();
    if ($success)
    {
      $session->set('login', 'success');
    }
    else
    {
      $session->set('login', 'error');
    }
    Request::current()->redirect('/');
  }

  /**
   * Executes logout action.
   */
  public function action_logout()
  {
    Auth::instance()->logout();
    Request::current()->redirect('/');
  }
}


text:
package com.michaelfotiadis.crossyscore.data.loader;

import android.app.Activity;

import com.michaelfotiadis.crossyscore.common.models.player.Player;
import com.michaelfotiadis.crossyscore.core.CrossyCore;
import com.michaelfotiadis.crossyscore.data.error.UiDataLoadError;
import com.michaelfotiadis.crossyscore.utils.AppLog;

import java.util.List;

/**
 *
 */
public class PlayerLoader extends DataFeedLoaderAbstract<Player> {

    public PlayerLoader(final Activity activity) {
        super(activity);
    }

    @Override
    public void loadData() {

        final List<Player> players = CrossyCore.getDataProvider().getPlayers().getAll();
        if (players == null) {
            notifyError(new UiDataLoadError("Null players found", UiDataLoadError.ErrorKind.NO_DATA, false));
        } else {
            AppLog.d("Loaded " + players.size() + " players");
            notifySuccess(players);
        }

    }
}


text:
function baseswitch(widget_id, url, skin, parameters)
{
    // Will be using "self" throughout for the various flavors of "this"
    // so for consistency ...

    self = this;

    // Initialization

    self.widget_id = widget_id;

    // Store on brightness or fallback to a default

    // Parameters may come in useful later on

    self.parameters = parameters;

    // Toggle needs to be referenced from self for the timeout function

    self.toggle = toggle;

    // Define callbacks for on click events
    // They are defined as functions below and can be any name as long as the
    // 'self'variables match the callbacks array below
    // We need to add them into the object for later reference

    self.OnButtonClick = OnButtonClick;

    if ("enable" in self.parameters && self.parameters.enable === 1)
    {
        var callbacks =
            [
                {"selector": '#' + widget_id + ' > span', "action": "click", "callback": self.OnButtonClick},
            ]
    }
    else
    {
        var callbacks = []
    }
    // Define callbacks for entities - this model allows a widget to monitor multiple entities if needed
    // Initial will be called when the dashboard loads and state has been gathered for the entity
    // Update will be called every time an update occurs for that entity

    self.OnStateAvailable = OnStateAvailable;
    self.OnStateUpdate = OnStateUpdate;

    var monitored_entities =
        [
            {"entity": parameters.entity, "initial": self.OnStateAvailable, "update": self.OnStateUpdate},
        ];

    // Finally, call the parent constructor to get things moving

    WidgetBase.call(self, widget_id, url, skin, parameters, monitored_entities, callbacks);

    // Function Definitions

    // The StateAvailable function will be called when
    // self.state[<entity>] has valid information for the requested entity
    // state is the initial state

    function OnStateAvailable(self, state)
    {
        self.state = state.state;
        set_view(self, self.state)
    }

    // The OnStateUpdate function will be called when the specific entity
    // receives a state update - its new values will be available
    // in self.state[<entity>] and returned in the state parameter

    function OnStateUpdate(self, state)
    {
        if (!("ignore_state" in self.parameters) || self.parameters.ignore_state === 0)
        {
            self.state = state.state;
            set_view(self, self.state)
        }
    }

    function OnButtonClick(self)
    {
        if (self.state === self.parameters.state_active)
        {
            args = self.parameters.post_service_inactive
        }
        else
        {
            args = self.parameters.post_service_active
        }
        args["namespace"] = self.parameters.namespace

        self.call_service(self, args);
        toggle(self);
        if ("momentary" in self.parameters)
        {
            setTimeout(function() { self.toggle(self) }, self.parameters["momentary"])
        }
    }

    function toggle(self)
    {
        if (self.state === self.parameters.state_active)
        {
            self.state = self.parameters.state_inactive;
        }
        else
        {
            self.state = self.parameters.state_active;
        }
        set_view(self, self.state)
    }

    // Set view is a helper function to set all aspects of the widget to its
    // current state - it is called by widget code when an update occurs
    // or some other event that requires a an update of the view

    function set_view(self, state, level)
    {
        if (state === self.parameters.state_active || ("active_map" in self.parameters && self.parameters.active_map.includes(state)))
        {
            self.set_icon(self, "icon", self.icons.icon_on);
            self.set_field(self, "icon_style", self.css.icon_style_active)
        }
        else
        {
            self.set_icon(self, "icon", self.icons.icon_off);
            self.set_field(self, "icon_style", self.css.icon_style_inactive)
        }
        if ("state_text" in self.parameters && self.parameters.state_text === 1)
        {
            self.set_field(self, "state_text", self.map_state(self, state))
        }
    }
}


text:
<?php
use PHPUnit\Framework\TestCase;
use TJM\PHPTimesheet\Sheet;

class SheetTest extends TestCase{
	public function testConstructStrings(){
		$sheets = [
			[
				'file'=> 'period1.txt',
				'hours'=> 14.5,
			],
			[
				'file'=> 'sheet1.txt',
				'hours'=> 39.5,
			],
			[
				'file'=> 'barePeriod.txt',
				'hours'=> 14.5,
			],
		];
		foreach($sheets as $config){
			$sheet = new Sheet(file_get_contents(__DIR__ . '/resources/' . $config['file']));
			$this->assertEquals($config['hours'], $sheet->getHours(), 'Hours must match calculated value based on times parsed from file');
		}
	}
}


text:
package info.dgjones.abora.gold.nkernel;

import info.dgjones.abora.gold.java.AboraSupport;
import info.dgjones.abora.gold.java.missing.smalltalk.Set;
import info.dgjones.abora.gold.nkernel.FeWork;
import info.dgjones.abora.gold.nkernel.RevisionDetectorExecutor;
import info.dgjones.abora.gold.wparray.XnExecutor;
import info.dgjones.abora.gold.xcvr.Rcvr;

/**
 * This class informs its work when its last detector has gone away.
 */
public class RevisionDetectorExecutor extends XnExecutor {

	protected FeWork myWork;
/*
udanax-top.st:44826:
XnExecutor subclass: #RevisionDetectorExecutor
	instanceVariableNames: 'myWork {FeWork}'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Xanadu-nkernel'!
*/
/*
udanax-top.st:44830:
RevisionDetectorExecutor comment:
'This class informs its work when its last detector has gone away.'!
*/
/*
udanax-top.st:44832:
(RevisionDetectorExecutor getOrMakeCxxClassDescription)
	attributes: ((Set new) add: #CONCRETE; add: #NOT.A.TYPE; yourself)!
*/
/*
udanax-top.st:44848:
RevisionDetectorExecutor class
	instanceVariableNames: ''!
*/
/*
udanax-top.st:44851:
(RevisionDetectorExecutor getOrMakeCxxClassDescription)
	attributes: ((Set new) add: #CONCRETE; add: #NOT.A.TYPE; yourself)!
*/
public static void initializeClassAttributes() {
	AboraSupport.findAboraClass(RevisionDetectorExecutor.class).setAttributes( new Set().add("CONCRETE").add("NOTATYPE"));
/*

Generated during transformation: AddMethod
*/
}
public RevisionDetectorExecutor(FeWork work) {
	super();
	myWork = work;
/*
udanax-top.st:44837:RevisionDetectorExecutor methodsFor: 'protected: create'!
create: work {FeWork}
	super create.
	myWork := work!
*/
}
public void execute(int arg) {
	if (arg == 0) {
		myWork.removeLastRevisionDetector();
	}
/*
udanax-top.st:44843:RevisionDetectorExecutor methodsFor: 'execute'!
{void} execute: arg {Int32}
	arg == Int32Zero ifTrue: [
		myWork removeLastRevisionDetector]!
*/
}
public static XnExecutor make(FeWork work) {
	return new RevisionDetectorExecutor(work);
/*
udanax-top.st:44856:RevisionDetectorExecutor class methodsFor: 'create'!
{XnExecutor} make: work {FeWork}
	^ self create: work!
*/
}
public RevisionDetectorExecutor() {
/*

Generated during transformation
*/
}
public RevisionDetectorExecutor(Rcvr receiver) {
	super(receiver);
/*

Generated during transformation
*/
}
}


text:
//-----------------------------------------------------------------------
// <copyright file="jet_snprog.cs" company="Microsoft Corporation">
//     Copyright (c) Microsoft Corporation.
// </copyright>
//-----------------------------------------------------------------------

namespace Microsoft.Isam.Esent.Interop
{
    using System;
    using System.Diagnostics;
    using System.Diagnostics.CodeAnalysis;
    using System.Globalization;
    using System.Runtime.InteropServices;

    /// <summary>
    /// The native version of the JET_SNPROG structure.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules",
        "SA1305:FieldNamesMustNotUseHungarianNotation",
        Justification = "This should match the unmanaged API, which isn't capitalized.")]
    [SuppressMessage(
        "Microsoft.StyleCop.CSharp.NamingRules",
        "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter",
        Justification = "This should match the unmanaged API, which isn't capitalized.")]
    internal struct NATIVE_SNPROG
    {
        /// <summary>
        /// Size of this structure.
        /// </summary>
        public static readonly int Size = Marshal.SizeOf(typeof(NATIVE_SNPROG));

        /// <summary>
        /// Size of the structure.
        /// </summary>
        public uint cbStruct;

        /// <summary>
        /// The number of work units that are already completed during the long
        /// running operation.
        /// </summary>
        public uint cunitDone;

        /// <summary>
        /// The number of work units that need to be completed. This value will
        /// always be bigger than or equal to cunitDone.
        /// </summary>
        public uint cunitTotal;
    }

    /// <summary>
    /// Contains information about the progress of a long-running operation.
    /// </summary>
    [SuppressMessage(
        "Microsoft.StyleCop.CSharp.NamingRules",
        "SA1300:ElementMustBeginWithUpperCaseLetter",
        Justification = "This should match the unmanaged API, which isn't capitalized.")]
    [Serializable]
    public class JET_SNPROG : IEquatable<JET_SNPROG>
    {
        /// <summary>
        /// Number of units of work that have completed.
        /// </summary>
        private int completedUnits;

        /// <summary>
        /// Total number of units of work to be done.
        /// </summary>
        private int totalUnits;

        /// <summary>
        /// Gets the number of work units that are already completed during the long
        /// running operation.
        /// </summary>
        public int cunitDone
        {
            [DebuggerStepThrough]
            get { return this.completedUnits; }
            internal set { this.completedUnits = value; }
        }

        /// <summary>
        /// Gets the number of work units that need to be completed. This value will
        /// always be bigger than or equal to cunitDone.
        /// </summary>
        public int cunitTotal
        {
            [DebuggerStepThrough]
            get { return this.totalUnits; }
            internal set { this.totalUnits = value; }
        }

        /// <summary>
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>True if the two instances are equal.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null || this.GetType() != obj.GetType())
            {
                return false;
            }

            return this.Equals((JET_SNPROG)obj);
        }

        /// <summary>
        /// Generate a string representation of the instance.
        /// </summary>
        /// <returns>The structure as a string.</returns>
        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "JET_SNPROG({0}/{1})", this.cunitDone, this.cunitTotal);
        }

        /// <summary>
        /// Returns the hash code for this instance.
        /// </summary>
        /// <returns>The hash code for this instance.</returns>
        public override int GetHashCode()
        {
            return unchecked(this.cunitDone * 31) ^ this.cunitTotal;
        }

        /// <summary>
        /// Returns a value indicating whether this instance is equal
        /// to another instance.
        /// </summary>
        /// <param name="other">An instance to compare with this instance.</param>
        /// <returns>True if the two instances are equal.</returns>
        public bool Equals(JET_SNPROG other)
        {
            if (null == other)
            {
                return false;
            }

            return this.cunitDone == other.cunitDone && this.cunitTotal == other.cunitTotal;
        }

        /// <summary>
        /// Set the members of this class from a <see cref="NATIVE_SNPROG"/>.
        /// </summary>
        /// <param name="native">The native struct.</param>
        internal void SetFromNative(NATIVE_SNPROG native)
        {
            Debug.Assert(native.cbStruct == NATIVE_SNPROG.Size, "NATIVE_SNPROG is the wrong size");
            this.cunitDone = checked((int)native.cunitDone);
            this.cunitTotal = checked((int)native.cunitTotal);
        }
    }
}


text:
package alien4cloud.tosca.parser;

import lombok.AllArgsConstructor;

import org.yaml.snakeyaml.nodes.Node;

@AllArgsConstructor
public class YamlSimpleParser<T> extends YamlParser<T> {
    private INodeParser<T> nodeParser;

    @Override
    protected INodeParser<T> getParser(Node rootNode, ParsingContextExecution context) throws ParsingException {
        return nodeParser;
    }
}


text:
namespace AtcSimController.SiteReflection.Models
{
    /// <summary>
    /// Flight turn direction
    /// </summary>
    public enum Direction
    {
        LEFT = -3,
        RIGHT = 3,
        NONE = 0
    }
}


text:
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
 *  (C) 2010 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

#include "pmip_pmi.h"
#include "pmip.h"
#include "bsci.h"
#include "demux.h"
#include "topo.h"
#include "hydt_ftb.h"

#define debug(...)                              \
    {                                           \
        if (HYD_pmcd_pmip.user_global.debug)    \
            HYDU_dump(stdout, __VA_ARGS__);     \
    }

/* The number of key values we store has to be one less than the
 * number of PMI arguments allowed.  This is because, when we flush
 * the PMI keyvals upstream, the server will treat it as a single PMI
 * command.  We leave room for one extra argument, cmd=put, that needs
 * to be appended when flushing. */
#define CACHE_PUT_KEYVAL_MAXLEN  (MAX_PMI_ARGS - 1)

static struct {
    char *keyval[CACHE_PUT_KEYVAL_MAXLEN + 1];
    int keyval_len;
} cache_put;

static struct {
    char **key;
    char **val;
    int keyval_len;
} cache_get;

static HYD_status send_cmd_upstream(const char *start, int fd, int num_args, char *args[])
{
    int i, j, sent, closed;
    char **tmp, *buf;
    struct HYD_pmcd_hdr hdr;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    /* We need two slots for each argument (one for the argument
     * itself and one for a space character), one slot for the
     * command, and one for the NULL character at the end. */
    HYDU_MALLOC(tmp, char **, (2 * num_args + 2) * sizeof(char *), status);

    j = 0;
    tmp[j++] = HYDU_strdup(start);
    for (i = 0; i < num_args; i++) {
        tmp[j++] = HYDU_strdup(args[i]);
        if (args[i + 1])
            tmp[j++] = HYDU_strdup(" ");
    }
    tmp[j] = NULL;

    status = HYDU_str_alloc_and_join(tmp, &buf);
    HYDU_ERR_POP(status, "unable to join strings\n");
    HYDU_free_strlist(tmp);
    HYDU_FREE(tmp);

    HYD_pmcd_init_header(&hdr);
    hdr.cmd = PMI_CMD;
    hdr.pid = fd;
    hdr.buflen = strlen(buf);
    hdr.pmi_version = 1;
    status =
        HYDU_sock_write(HYD_pmcd_pmip.upstream.control, &hdr, sizeof(hdr), &sent, &closed,
                        HYDU_SOCK_COMM_MSGWAIT);
    HYDU_ERR_POP(status, "unable to send PMI header upstream\n");
    HYDU_ASSERT(!closed, status);

    debug("forwarding command (%s) upstream\n", buf);

    status = HYDU_sock_write(HYD_pmcd_pmip.upstream.control, buf, hdr.buflen, &sent, &closed,
                             HYDU_SOCK_COMM_MSGWAIT);
    HYDU_ERR_POP(status, "unable to send PMI command upstream\n");
    HYDU_ASSERT(!closed, status);

    HYDU_FREE(buf);

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status send_cmd_downstream(int fd, const char *cmd)
{
    int sent, closed;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    debug("PMI response: %s", cmd);

    status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
    HYDU_ERR_POP(status, "error writing PMI line\n");
    /* FIXME: We cannot abort when we are not able to send data
     * downstream. The upper layer needs to handle this based on
     * whether we want to abort or not.*/
    HYDU_ASSERT(!closed, status);

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status cache_put_flush(int fd)
{
    int i;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    if (cache_put.keyval_len == 0)
        goto fn_exit;

    debug("flushing %d put command(s) out\n", cache_put.keyval_len);

    status = send_cmd_upstream("cmd=put ", fd, cache_put.keyval_len, cache_put.keyval);
    HYDU_ERR_POP(status, "error sending command upstream\n");

    for (i = 0; i < cache_put.keyval_len; i++)
        HYDU_FREE(cache_put.keyval[i]);
    cache_put.keyval_len = 0;

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_init(int fd, char *args[])
{
    int pmi_version, pmi_subversion, i;
    const char *tmp = NULL;
    static int global_init = 1;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    strtok(args[0], "=");
    pmi_version = atoi(strtok(NULL, "="));
    strtok(args[1], "=");
    pmi_subversion = atoi(strtok(NULL, "="));

    if (pmi_version == 1 && pmi_subversion <= 1)
        tmp = HYDU_strdup("cmd=response_to_init pmi_version=1 pmi_subversion=1 rc=0\n");
    else if (pmi_version == 2 && pmi_subversion == 0)
        tmp = HYDU_strdup("cmd=response_to_init pmi_version=2 pmi_subversion=0 rc=0\n");
    else        /* PMI version mismatch */
        HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
                            "PMI version mismatch; %d.%d\n", pmi_version, pmi_subversion);

    status = send_cmd_downstream(fd, tmp);
    HYDU_ERR_POP(status, "error sending PMI response\n");
    HYDU_FREE(tmp);

    /* initialize some structures; these are initialized exactly once,
     * even if the init command is sent once from each process. */
    if (global_init) {
        for (i = 0; i < CACHE_PUT_KEYVAL_MAXLEN + 1; i++)
            cache_put.keyval[i] = NULL;
        cache_put.keyval_len = 0;
        cache_get.keyval_len = 0;
        global_init = 0;
    }

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_initack(int fd, char *args[])
{
    int id, i;
    char *val, *cmd;
    struct HYD_pmcd_token *tokens;
    int token_count;
    struct HYD_string_stash stash;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    status = HYD_pmcd_pmi_args_to_tokens(args, &tokens, &token_count);
    HYDU_ERR_POP(status, "unable to convert args to tokens\n");

    val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "pmiid");
    HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR, "unable to find pmiid token\n");
    id = atoi(val);

    /* Store the PMI_ID to fd mapping */
    for (i = 0; i < HYD_pmcd_pmip.local.proxy_process_count; i++) {
        if (HYD_pmcd_pmip.downstream.pmi_rank[i] == id) {
            HYD_pmcd_pmip.downstream.pmi_fd[i] = fd;
            HYD_pmcd_pmip.downstream.pmi_fd_active[i] = 1;
            break;
        }
    }
    HYDU_ASSERT(i < HYD_pmcd_pmip.local.proxy_process_count, status);

    HYD_STRING_STASH_INIT(stash);
    HYD_STRING_STASH(stash, HYDU_strdup("cmd=initack\ncmd=set size="), status);
    HYD_STRING_STASH(stash, HYDU_int_to_str(HYD_pmcd_pmip.system_global.global_process_count),
                     status);

    HYD_STRING_STASH(stash, HYDU_strdup("\ncmd=set rank="), status);
    HYD_STRING_STASH(stash, HYDU_int_to_str(id), status);

    HYD_STRING_STASH(stash, HYDU_strdup("\ncmd=set debug="), status);
    HYD_STRING_STASH(stash, HYDU_int_to_str(HYD_pmcd_pmip.user_global.debug), status);
    HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);

    HYD_STRING_SPIT(stash, cmd, status);

    status = send_cmd_downstream(fd, cmd);
    HYDU_ERR_POP(status, "error sending PMI response\n");
    HYDU_FREE(cmd);

  fn_exit:
    HYD_pmcd_pmi_free_tokens(tokens, token_count);
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_get_maxes(int fd, char *args[])
{
    struct HYD_string_stash stash;
    char *cmd;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    HYD_STRING_STASH_INIT(stash);
    HYD_STRING_STASH(stash, HYDU_strdup("cmd=maxes kvsname_max="), status);
    HYD_STRING_STASH(stash, HYDU_int_to_str(PMI_MAXKVSLEN), status);
    HYD_STRING_STASH(stash, HYDU_strdup(" keylen_max="), status);
    HYD_STRING_STASH(stash, HYDU_int_to_str(PMI_MAXKEYLEN), status);
    HYD_STRING_STASH(stash, HYDU_strdup(" vallen_max="), status);
    HYD_STRING_STASH(stash, HYDU_int_to_str(PMI_MAXVALLEN), status);
    HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);

    HYD_STRING_SPIT(stash, cmd, status);

    status = send_cmd_downstream(fd, cmd);
    HYDU_ERR_POP(status, "error sending PMI response\n");
    HYDU_FREE(cmd);

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_get_appnum(int fd, char *args[])
{
    int i, idx;
    struct HYD_exec *exec;
    struct HYD_string_stash stash;
    char *cmd;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    /* Get the process index */
    for (i = 0; i < HYD_pmcd_pmip.local.proxy_process_count; i++)
        if (HYD_pmcd_pmip.downstream.pmi_fd[i] == fd)
            break;
    idx = i;
    HYDU_ASSERT(idx < HYD_pmcd_pmip.local.proxy_process_count, status);

    i = 0;
    for (exec = HYD_pmcd_pmip.exec_list; exec; exec = exec->next) {
        i += exec->proc_count;
        if (idx < i)
            break;
    }

    HYD_STRING_STASH_INIT(stash);
    HYD_STRING_STASH(stash, HYDU_strdup("cmd=appnum appnum="), status);
    HYD_STRING_STASH(stash, HYDU_int_to_str(exec->appnum), status);
    HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);

    HYD_STRING_SPIT(stash, cmd, status);

    status = send_cmd_downstream(fd, cmd);
    HYDU_ERR_POP(status, "error sending PMI response\n");
    HYDU_FREE(cmd);

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_get_my_kvsname(int fd, char *args[])
{
    struct HYD_string_stash stash;
    char *cmd;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    HYD_STRING_STASH_INIT(stash);
    HYD_STRING_STASH(stash, HYDU_strdup("cmd=my_kvsname kvsname="), status);
    HYD_STRING_STASH(stash, HYDU_strdup(HYD_pmcd_pmip.local.kvs->kvsname), status);
    HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);

    HYD_STRING_SPIT(stash, cmd, status);

    status = send_cmd_downstream(fd, cmd);
    HYDU_ERR_POP(status, "error sending PMI response\n");
    HYDU_FREE(cmd);

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_get_usize(int fd, char *args[])
{
    struct HYD_string_stash stash;
    char *cmd;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    HYD_STRING_STASH_INIT(stash);
    HYD_STRING_STASH(stash, HYDU_strdup("cmd=universe_size size="), status);
    if (HYD_pmcd_pmip.user_global.usize == HYD_USIZE_SYSTEM)
        HYD_STRING_STASH(stash,
                         HYDU_int_to_str(HYD_pmcd_pmip.system_global.global_core_map.global_count),
                         status);
    else if (HYD_pmcd_pmip.user_global.usize == HYD_USIZE_INFINITE)
        HYD_STRING_STASH(stash, HYDU_int_to_str(-1), status);
    else
        HYD_STRING_STASH(stash, HYDU_int_to_str(HYD_pmcd_pmip.user_global.usize), status);
    HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);

    HYD_STRING_SPIT(stash, cmd, status);

    status = send_cmd_downstream(fd, cmd);
    HYDU_ERR_POP(status, "error sending PMI response\n");
    HYDU_FREE(cmd);

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_get(int fd, char *args[])
{
    struct HYD_string_stash stash;
    char *cmd, *key, *val;
    struct HYD_pmcd_token *tokens;
    int token_count, i;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    status = HYD_pmcd_pmi_args_to_tokens(args, &tokens, &token_count);
    HYDU_ERR_POP(status, "unable to convert args to tokens\n");

    key = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "key");
    HYDU_ERR_CHKANDJUMP(status, key == NULL, HYD_INTERNAL_ERROR, "unable to find token: key\n");

    if (!strcmp(key, "PMI_process_mapping")) {
        HYD_STRING_STASH_INIT(stash);
        HYD_STRING_STASH(stash, HYDU_strdup("cmd=get_result rc=0 msg=success value="), status);
        HYD_STRING_STASH(stash, HYDU_strdup(HYD_pmcd_pmip.system_global.pmi_process_mapping),
                         status);
        HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);

        HYD_STRING_SPIT(stash, cmd, status);

        status = send_cmd_downstream(fd, cmd);
        HYDU_ERR_POP(status, "error sending PMI response\n");
        HYDU_FREE(cmd);
    }
    else {
        val = NULL;
        for (i = 0; i < cache_get.keyval_len; i++) {
            if (!strcmp(cache_get.key[i], key)) {
                val = cache_get.val[i];
                break;
            }
        }

        if (val) {
            HYD_STRING_STASH_INIT(stash);
            HYD_STRING_STASH(stash, HYDU_strdup("cmd=get_result rc="), status);
            HYD_STRING_STASH(stash, HYDU_strdup("0 msg=success value="), status);
            HYD_STRING_STASH(stash, HYDU_strdup(val), status);
            HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);

            HYD_STRING_SPIT(stash, cmd, status);

            status = send_cmd_downstream(fd, cmd);
            HYDU_ERR_POP(status, "error sending PMI response\n");
            HYDU_FREE(cmd);
        }
        else {
            /* if we can't find the key locally, ask upstream */
            status = send_cmd_upstream("cmd=get ", fd, token_count, args);
            HYDU_ERR_POP(status, "error sending command upstream\n");
        }
    }

  fn_exit:
    HYD_pmcd_pmi_free_tokens(tokens, token_count);
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_put(int fd, char *args[])
{
    struct HYD_string_stash stash;
    char *cmd;
    char *key, *val;
    struct HYD_pmcd_token *tokens;
    int token_count;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    status = HYD_pmcd_pmi_args_to_tokens(args, &tokens, &token_count);
    HYDU_ERR_POP(status, "unable to convert args to tokens\n");

    key = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "key");
    HYDU_ERR_CHKANDJUMP(status, key == NULL, HYD_INTERNAL_ERROR, "unable to find token: key\n");

    val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "value");
    if (val == NULL)
        val = HYDU_strdup("");

    /* add to the cache */
    HYD_STRING_STASH_INIT(stash);
    HYD_STRING_STASH(stash, HYDU_strdup(key), status);
    HYD_STRING_STASH(stash, HYDU_strdup("="), status);
    HYD_STRING_STASH(stash, HYDU_strdup(val), status);

    HYD_STRING_SPIT(stash, cmd, status);

    cache_put.keyval[cache_put.keyval_len++] = cmd;
    debug("cached command: %s\n", cmd);

    if (cache_put.keyval_len >= CACHE_PUT_KEYVAL_MAXLEN)
        cache_put_flush(fd);

    status = send_cmd_downstream(fd, "cmd=put_result rc=0 msg=success\n");
    HYDU_ERR_POP(status, "error sending PMI response\n");

  fn_exit:
    HYD_pmcd_pmi_free_tokens(tokens, token_count);
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_keyval_cache(int fd, char *args[])
{
    struct HYD_pmcd_token *tokens;
    int token_count, i;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    status = HYD_pmcd_pmi_args_to_tokens(args, &tokens, &token_count);
    HYDU_ERR_POP(status, "unable to convert args to tokens\n");

    /* allocate a larger space for the cached keyvals, copy over the
     * older keyvals and add the new ones in */
    HYDU_REALLOC(cache_get.key, char **, (cache_get.keyval_len + token_count) * sizeof(char *),
                 status);
    HYDU_REALLOC(cache_get.val, char **, (cache_get.keyval_len + token_count) * sizeof(char *),
                 status);

    for (i = 0; i < token_count; i++) {
        cache_get.key[cache_get.keyval_len + i] = HYDU_strdup(tokens[i].key);
        cache_get.val[cache_get.keyval_len + i] = HYDU_strdup(tokens[i].val);
    }
    cache_get.keyval_len += token_count;

  fn_exit:
    HYD_pmcd_pmi_free_tokens(tokens, token_count);
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_barrier_in(int fd, char *args[])
{
    static int barrier_count = 0;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    barrier_count++;
    if (barrier_count == HYD_pmcd_pmip.local.proxy_process_count) {
        barrier_count = 0;

        cache_put_flush(fd);

        status = send_cmd_upstream("cmd=barrier_in", fd, 0, args);
        HYDU_ERR_POP(status, "error sending command upstream\n");
    }

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_barrier_out(int fd, char *args[])
{
    const char *cmd;
    int i;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    cmd = HYDU_strdup("cmd=barrier_out\n");

    for (i = 0; i < HYD_pmcd_pmip.local.proxy_process_count; i++) {
        status = send_cmd_downstream(HYD_pmcd_pmip.downstream.pmi_fd[i], cmd);
        HYDU_ERR_POP(status, "error sending PMI response\n");
    }

    HYDU_FREE(cmd);

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static HYD_status fn_finalize(int fd, char *args[])
{
    const char *cmd;
    int i;
    static int finalize_count = 0;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    cmd = HYDU_strdup("cmd=finalize_ack\n");

    status = send_cmd_downstream(fd, cmd);
    HYDU_ERR_POP(status, "error sending PMI response\n");
    HYDU_FREE(cmd);

    status = HYDT_dmx_deregister_fd(fd);
    HYDU_ERR_POP(status, "unable to deregister fd\n");
    close(fd);

    finalize_count++;

    if (finalize_count == HYD_pmcd_pmip.local.proxy_process_count) {
        /* All processes have finalized */
        for (i = 0; i < cache_get.keyval_len; i++) {
            HYDU_FREE(cache_get.key[i]);
            HYDU_FREE(cache_get.val[i]);
        }
        HYDU_FREE(cache_get.key);
        HYDU_FREE(cache_get.val);
    }

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}

static struct HYD_pmcd_pmip_pmi_handle pmi_v1_handle_fns_foo[] = {
    {"init", fn_init},
    {"initack", fn_initack},
    {"get_maxes", fn_get_maxes},
    {"get_appnum", fn_get_appnum},
    {"get_my_kvsname", fn_get_my_kvsname},
    {"get_universe_size", fn_get_usize},
    {"get", fn_get},
    {"put", fn_put},
    {"keyval_cache", fn_keyval_cache},
    {"barrier_in", fn_barrier_in},
    {"barrier_out", fn_barrier_out},
    {"finalize", fn_finalize},
    {"\0", NULL}
};

struct HYD_pmcd_pmip_pmi_handle *HYD_pmcd_pmip_pmi_v1 = pmi_v1_handle_fns_foo;


text:
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/socket/tcp_server_socket.h"

#include <utility>

#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/check.h"
#include "base/notreached.h"
#include "net/base/net_errors.h"
#include "net/socket/socket_descriptor.h"
#include "net/socket/tcp_client_socket.h"

namespace net {

TCPServerSocket::TCPServerSocket(NetLog* net_log, const NetLogSource& source)
    : TCPServerSocket(
          std::make_unique<TCPSocket>(nullptr /* socket_performance_watcher */,
                                      net_log,
                                      source)) {}

TCPServerSocket::TCPServerSocket(std::unique_ptr<TCPSocket> socket)
    : socket_(std::move(socket)), pending_accept_(false) {}

int TCPServerSocket::AdoptSocket(SocketDescriptor socket) {
  return socket_->AdoptUnconnectedSocket(socket);
}

TCPServerSocket::~TCPServerSocket() = default;

int TCPServerSocket::Listen(const IPEndPoint& address, int backlog) {
  int result = socket_->Open(address.GetFamily());
  if (result != OK)
    return result;

  result = socket_->SetDefaultOptionsForServer();
  if (result != OK) {
    socket_->Close();
    return result;
  }

  result = socket_->Bind(address);
  if (result != OK) {
    socket_->Close();
    return result;
  }

  result = socket_->Listen(backlog);
  if (result != OK) {
    socket_->Close();
    return result;
  }

  return OK;
}

int TCPServerSocket::GetLocalAddress(IPEndPoint* address) const {
  return socket_->GetLocalAddress(address);
}

int TCPServerSocket::Accept(std::unique_ptr<StreamSocket>* socket,
                            CompletionOnceCallback callback) {
  return Accept(socket, std::move(callback), nullptr);
}

int TCPServerSocket::Accept(std::unique_ptr<StreamSocket>* socket,
                            CompletionOnceCallback callback,
                            IPEndPoint* peer_address) {
  DCHECK(socket);
  DCHECK(!callback.is_null());

  if (pending_accept_) {
    NOTREACHED();
    return ERR_UNEXPECTED;
  }

  // It is safe to use base::Unretained(this). |socket_| is owned by this class,
  // and the callback won't be run after |socket_| is destroyed.
  CompletionOnceCallback accept_callback = base::BindOnce(
      &TCPServerSocket::OnAcceptCompleted, base::Unretained(this), socket,
      peer_address, std::move(callback));
  int result = socket_->Accept(&accepted_socket_, &accepted_address_,
                               std::move(accept_callback));
  if (result != ERR_IO_PENDING) {
    // |accept_callback| won't be called so we need to run
    // ConvertAcceptedSocket() ourselves in order to do the conversion from
    // |accepted_socket_| to |socket|.
    result = ConvertAcceptedSocket(result, socket, peer_address);
  } else {
    pending_accept_ = true;
  }

  return result;
}

void TCPServerSocket::DetachFromThread() {
  socket_->DetachFromThread();
}

int TCPServerSocket::ConvertAcceptedSocket(
    int result,
    std::unique_ptr<StreamSocket>* output_accepted_socket,
    IPEndPoint* output_accepted_address) {
  // Make sure the TCPSocket object is destroyed in any case.
  std::unique_ptr<TCPSocket> temp_accepted_socket(std::move(accepted_socket_));
  if (result != OK)
    return result;

  if (output_accepted_address)
    *output_accepted_address = accepted_address_;

  output_accepted_socket->reset(
      new TCPClientSocket(std::move(temp_accepted_socket), accepted_address_));

  return OK;
}

void TCPServerSocket::OnAcceptCompleted(
    std::unique_ptr<StreamSocket>* output_accepted_socket,
    IPEndPoint* output_accepted_address,
    CompletionOnceCallback forward_callback,
    int result) {
  result = ConvertAcceptedSocket(result, output_accepted_socket,
                                 output_accepted_address);
  pending_accept_ = false;
  std::move(forward_callback).Run(result);
}

}  // namespace net


text:
package com.koch.ambeth.ioc;

import com.koch.ambeth.util.IDisposable;

public class DisposableHook implements IDisposableBean {
	private final IDisposable hook;

	public DisposableHook(IDisposable hook) {
		this.hook = hook;
	}

	@Override
	public void destroy() throws Throwable {
		hook.dispose();
	}
}


text:
namespace v8 {
namespace internal {

bool CpuFeatures::SupportsOptimizer() { return true; }

bool CpuFeatures::SupportsWasmSimd128() { return IsSupported(NEON); }

int DoubleRegister::NumRegisters() {
  return CpuFeatures::IsSupported(VFP32DREGS) ? 32 : 16;
}

void RelocInfo::apply(intptr_t delta) {
  if (RelocInfo::IsInternalReference(rmode_)) {
    // absolute code pointer inside code object moves with the code object.
    int32_t* p = reinterpret_cast<int32_t*>(pc_);
    *p += delta;  // relocate entry
  } else if (RelocInfo::IsRelativeCodeTarget(rmode_)) {
    Instruction* branch = Instruction::At(pc_);
    int32_t branch_offset = branch->GetBranchOffset() + delta;
    branch->SetBranchOffset(branch_offset);
  }
}

Address RelocInfo::target_address() {
  DCHECK(IsCodeTargetMode(rmode_) || IsRuntimeEntry(rmode_) ||
         IsWasmCall(rmode_));
  return Assembler::target_address_at(pc_, constant_pool_);
}

Address RelocInfo::target_address_address() {
  DCHECK(HasTargetAddressAddress());
  if (Assembler::IsMovW(Memory<int32_t>(pc_))) {
    return pc_;
  } else if (Assembler::IsLdrPcImmediateOffset(Memory<int32_t>(pc_))) {
    return constant_pool_entry_address();
  } else {
    DCHECK(Assembler::IsBOrBlPcImmediateOffset(Memory<int32_t>(pc_)));
    DCHECK(IsRelativeCodeTarget(rmode_));
    return pc_;
  }
}

Address RelocInfo::constant_pool_entry_address() {
  DCHECK(IsInConstantPool());
  return Assembler::constant_pool_entry_address(pc_, constant_pool_);
}

int RelocInfo::target_address_size() {
  return kPointerSize;
}

HeapObject RelocInfo::target_object() {
  DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
  return HeapObject::cast(
      Object(Assembler::target_address_at(pc_, constant_pool_)));
}

Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
  if (IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT) {
    return Handle<HeapObject>(reinterpret_cast<Address*>(
        Assembler::target_address_at(pc_, constant_pool_)));
  }
  DCHECK(IsRelativeCodeTarget(rmode_));
  return origin->relative_code_target_object_handle_at(pc_);
}

void RelocInfo::set_target_object(Heap* heap, HeapObject target,
                                  WriteBarrierMode write_barrier_mode,
                                  ICacheFlushMode icache_flush_mode) {
  DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
  Assembler::set_target_address_at(pc_, constant_pool_, target->ptr(),
                                   icache_flush_mode);
  if (write_barrier_mode == UPDATE_WRITE_BARRIER && !host().is_null()) {
    WriteBarrierForCode(host(), this, target);
  }
}

Address RelocInfo::target_external_reference() {
  DCHECK(rmode_ == EXTERNAL_REFERENCE);
  return Assembler::target_address_at(pc_, constant_pool_);
}

void RelocInfo::set_target_external_reference(
    Address target, ICacheFlushMode icache_flush_mode) {
  DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
  Assembler::set_target_address_at(pc_, constant_pool_, target,
                                   icache_flush_mode);
}

Address RelocInfo::target_internal_reference() {
  DCHECK(rmode_ == INTERNAL_REFERENCE);
  return Memory<Address>(pc_);
}

Address RelocInfo::target_internal_reference_address() {
  DCHECK(rmode_ == INTERNAL_REFERENCE);
  return pc_;
}

Address RelocInfo::target_runtime_entry(Assembler* origin) {
  DCHECK(IsRuntimeEntry(rmode_));
  return target_address();
}

void RelocInfo::set_target_runtime_entry(Address target,
                                         WriteBarrierMode write_barrier_mode,
                                         ICacheFlushMode icache_flush_mode) {
  DCHECK(IsRuntimeEntry(rmode_));
  if (target_address() != target)
    set_target_address(target, write_barrier_mode, icache_flush_mode);
}

Address RelocInfo::target_off_heap_target() {
  DCHECK(IsOffHeapTarget(rmode_));
  return Assembler::target_address_at(pc_, constant_pool_);
}

void RelocInfo::WipeOut() {
  DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
         IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
         IsInternalReference(rmode_) || IsOffHeapTarget(rmode_));
  if (IsInternalReference(rmode_)) {
    Memory<Address>(pc_) = kNullAddress;
  } else {
    Assembler::set_target_address_at(pc_, constant_pool_, kNullAddress);
  }
}

Handle<Code> Assembler::relative_code_target_object_handle_at(
    Address pc) const {
  Instruction* branch = Instruction::At(pc);
  int code_target_index = branch->GetBranchOffset() / kInstrSize;
  return GetCodeTarget(code_target_index);
}

Operand::Operand(int32_t immediate, RelocInfo::Mode rmode) : rmode_(rmode) {
  value_.immediate = immediate;
}

Operand Operand::Zero() { return Operand(static_cast<int32_t>(0)); }

Operand::Operand(const ExternalReference& f)
    : rmode_(RelocInfo::EXTERNAL_REFERENCE) {
  value_.immediate = static_cast<int32_t>(f.address());
}

Operand::Operand(Smi value) : rmode_(RelocInfo::NONE) {
  value_.immediate = static_cast<intptr_t>(value.ptr());
}

Operand::Operand(Register rm) : rm_(rm), shift_op_(LSL), shift_imm_(0) {}

void Assembler::CheckBuffer() {
  if (buffer_space() <= kGap) {
    GrowBuffer();
  }
  MaybeCheckConstPool();
}

void Assembler::emit(Instr x) {
  CheckBuffer();
  *reinterpret_cast<Instr*>(pc_) = x;
  pc_ += kInstrSize;
}

Address Assembler::target_address_from_return_address(Address pc) {
  // Returns the address of the call target from the return address that will
  // be returned to after a call.
  // Call sequence on V7 or later is:
  //  movw  ip, #... @ call address low 16
  //  movt  ip, #... @ call address high 16
  //  blx   ip
  //                      @ return address
  // For V6 when the constant pool is unavailable, it is:
  //  mov  ip, #...     @ call address low 8
  //  orr  ip, ip, #... @ call address 2nd 8
  //  orr  ip, ip, #... @ call address 3rd 8
  //  orr  ip, ip, #... @ call address high 8
  //  blx   ip
  //                      @ return address
  // In cases that need frequent patching, the address is in the
  // constant pool.  It could be a small constant pool load:
  //  ldr   ip, [pc, #...] @ call address
  //  blx   ip
  //                      @ return address
  Address candidate = pc - 2 * kInstrSize;
  Instr candidate_instr(Memory<int32_t>(candidate));
  if (IsLdrPcImmediateOffset(candidate_instr)) {
    return candidate;
  } else {
    if (CpuFeatures::IsSupported(ARMv7)) {
      candidate -= 1 * kInstrSize;
      DCHECK(IsMovW(Memory<int32_t>(candidate)) &&
             IsMovT(Memory<int32_t>(candidate + kInstrSize)));
    } else {
      candidate -= 3 * kInstrSize;
      DCHECK(IsMovImmed(Memory<int32_t>(candidate)) &&
             IsOrrImmed(Memory<int32_t>(candidate + kInstrSize)) &&
             IsOrrImmed(Memory<int32_t>(candidate + 2 * kInstrSize)) &&
             IsOrrImmed(Memory<int32_t>(candidate + 3 * kInstrSize)));
    }
    return candidate;
  }
}

Address Assembler::return_address_from_call_start(Address pc) {
  if (IsLdrPcImmediateOffset(Memory<int32_t>(pc))) {
    // Load from constant pool, small section.
    return pc + kInstrSize * 2;
  } else {
    if (CpuFeatures::IsSupported(ARMv7)) {
      DCHECK(IsMovW(Memory<int32_t>(pc)));
      DCHECK(IsMovT(Memory<int32_t>(pc + kInstrSize)));
      // A movw / movt load immediate.
      return pc + kInstrSize * 3;
    } else {
      DCHECK(IsMovImmed(Memory<int32_t>(pc)));
      DCHECK(IsOrrImmed(Memory<int32_t>(pc + kInstrSize)));
      DCHECK(IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)));
      DCHECK(IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
      // A mov / orr load immediate.
      return pc + kInstrSize * 5;
    }
  }
}

void Assembler::deserialization_set_special_target_at(
    Address constant_pool_entry, Code code, Address target) {
  DCHECK(!Builtins::IsIsolateIndependentBuiltin(code));
  Memory<Address>(constant_pool_entry) = target;
}

int Assembler::deserialization_special_target_size(Address location) {
  return kSpecialTargetSize;
}

void Assembler::deserialization_set_target_internal_reference_at(
    Address pc, Address target, RelocInfo::Mode mode) {
  Memory<Address>(pc) = target;
}

bool Assembler::is_constant_pool_load(Address pc) {
  return IsLdrPcImmediateOffset(Memory<int32_t>(pc));
}

Address Assembler::constant_pool_entry_address(Address pc,
                                               Address constant_pool) {
  DCHECK(Assembler::IsLdrPcImmediateOffset(Memory<int32_t>(pc)));
  Instr instr = Memory<int32_t>(pc);
  return pc + GetLdrRegisterImmediateOffset(instr) + Instruction::kPcLoadDelta;
}

Address Assembler::target_address_at(Address pc, Address constant_pool) {
  if (is_constant_pool_load(pc)) {
    // This is a constant pool lookup. Return the value in the constant pool.
    return Memory<Address>(constant_pool_entry_address(pc, constant_pool));
  } else if (CpuFeatures::IsSupported(ARMv7) && IsMovW(Memory<int32_t>(pc))) {
    // This is an movw / movt immediate load. Return the immediate.
    DCHECK(IsMovW(Memory<int32_t>(pc)) &&
           IsMovT(Memory<int32_t>(pc + kInstrSize)));
    Instruction* movw_instr = Instruction::At(pc);
    Instruction* movt_instr = Instruction::At(pc + kInstrSize);
    return static_cast<Address>((movt_instr->ImmedMovwMovtValue() << 16) |
                                movw_instr->ImmedMovwMovtValue());
  } else if (IsMovImmed(Memory<int32_t>(pc))) {
    // This is an mov / orr immediate load. Return the immediate.
    DCHECK(IsMovImmed(Memory<int32_t>(pc)) &&
           IsOrrImmed(Memory<int32_t>(pc + kInstrSize)) &&
           IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)) &&
           IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
    Instr mov_instr = instr_at(pc);
    Instr orr_instr_1 = instr_at(pc + kInstrSize);
    Instr orr_instr_2 = instr_at(pc + 2 * kInstrSize);
    Instr orr_instr_3 = instr_at(pc + 3 * kInstrSize);
    Address ret = static_cast<Address>(
        DecodeShiftImm(mov_instr) | DecodeShiftImm(orr_instr_1) |
        DecodeShiftImm(orr_instr_2) | DecodeShiftImm(orr_instr_3));
    return ret;
  } else {
    Instruction* branch = Instruction::At(pc);
    int32_t delta = branch->GetBranchOffset();
    return pc + delta + Instruction::kPcLoadDelta;
  }
}

void Assembler::set_target_address_at(Address pc, Address constant_pool,
                                      Address target,
                                      ICacheFlushMode icache_flush_mode) {
  if (is_constant_pool_load(pc)) {
    // This is a constant pool lookup. Update the entry in the constant pool.
    Memory<Address>(constant_pool_entry_address(pc, constant_pool)) = target;
    // Intuitively, we would think it is necessary to always flush the
    // instruction cache after patching a target address in the code as follows:
    //   FlushInstructionCache(pc, sizeof(target));
    // However, on ARM, no instruction is actually patched in the case
    // of embedded constants of the form:
    // ldr   ip, [pp, #...]
    // since the instruction accessing this address in the constant pool remains
    // unchanged.
  } else if (CpuFeatures::IsSupported(ARMv7) && IsMovW(Memory<int32_t>(pc))) {
    // This is an movw / movt immediate load. Patch the immediate embedded in
    // the instructions.
    DCHECK(IsMovW(Memory<int32_t>(pc)));
    DCHECK(IsMovT(Memory<int32_t>(pc + kInstrSize)));
    uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc);
    uint32_t immediate = static_cast<uint32_t>(target);
    instr_ptr[0] = PatchMovwImmediate(instr_ptr[0], immediate & 0xFFFF);
    instr_ptr[1] = PatchMovwImmediate(instr_ptr[1], immediate >> 16);
    DCHECK(IsMovW(Memory<int32_t>(pc)));
    DCHECK(IsMovT(Memory<int32_t>(pc + kInstrSize)));
    if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
      FlushInstructionCache(pc, 2 * kInstrSize);
    }
  } else if (IsMovImmed(Memory<int32_t>(pc))) {
    // This is an mov / orr immediate load. Patch the immediate embedded in
    // the instructions.
    DCHECK(IsMovImmed(Memory<int32_t>(pc)) &&
           IsOrrImmed(Memory<int32_t>(pc + kInstrSize)) &&
           IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)) &&
           IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
    uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc);
    uint32_t immediate = static_cast<uint32_t>(target);
    instr_ptr[0] = PatchShiftImm(instr_ptr[0], immediate & kImm8Mask);
    instr_ptr[1] = PatchShiftImm(instr_ptr[1], immediate & (kImm8Mask << 8));
    instr_ptr[2] = PatchShiftImm(instr_ptr[2], immediate & (kImm8Mask << 16));
    instr_ptr[3] = PatchShiftImm(instr_ptr[3], immediate & (kImm8Mask << 24));
    DCHECK(IsMovImmed(Memory<int32_t>(pc)) &&
           IsOrrImmed(Memory<int32_t>(pc + kInstrSize)) &&
           IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)) &&
           IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
    if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
      FlushInstructionCache(pc, 4 * kInstrSize);
    }
  } else {
    intptr_t branch_offset = target - pc - Instruction::kPcLoadDelta;
    Instruction* branch = Instruction::At(pc);
    branch->SetBranchOffset(branch_offset);
    if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
      FlushInstructionCache(pc, kInstrSize);
    }
  }
}

EnsureSpace::EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); }

template <typename T>
bool UseScratchRegisterScope::CanAcquireVfp() const {
  VfpRegList* available = assembler_->GetScratchVfpRegisterList();
  DCHECK_NOT_NULL(available);
  for (int index = 0; index < T::kNumRegisters; index++) {
    T reg = T::from_code(index);
    uint64_t mask = reg.ToVfpRegList();
    if ((*available & mask) == mask) {
      return true;
    }
  }
  return false;
}

template <typename T>
T UseScratchRegisterScope::AcquireVfp() {
  VfpRegList* available = assembler_->GetScratchVfpRegisterList();
  DCHECK_NOT_NULL(available);
  for (int index = 0; index < T::kNumRegisters; index++) {
    T reg = T::from_code(index);
    uint64_t mask = reg.ToVfpRegList();
    if ((*available & mask) == mask) {
      *available &= ~mask;
      return reg;
    }
  }
  UNREACHABLE();
}

}  // namespace internal
}  // namespace v8

#endif  // V8_ARM_ASSEMBLER_ARM_INL_H_


text:
module BrNfe
	module Service
		module Response
			module Build
				class ConsultaSituacaoLoteRps  < BrNfe::Service::Response::Build::Base
					##############################################################################################################
					#######################   CAMINHOS PARA ENCONTRAR OS VALORES NA RESPOSTA DA REQUISIÇÃO   #####################
						# o numero do lote
						attr_accessor :lot_number_path

						# a situação do lote rps
						attr_accessor :situation_path

						attr_accessor :situation_key_values
						def situation_key_values
							@situation_key_values.is_a?(Hash) ? @situation_key_values : {
								'1' =>  :unreceived, # Não Recebido
								'2' =>  :unprocessed,# Não Processado
								'3' =>  :error,      # Processado com Erro
								'4' =>  :success,    # Processado com Sucesso
							}
						end

						def default_values
							super.merge({
								message_errors_path: [:consultar_situacao_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno],
								lot_number_path:     [:consultar_situacao_lote_rps_resposta, :numero_lote],
								situation_path:      [:consultar_situacao_lote_rps_resposta, :situacao],
							})
						end
					#######################   FIM DA DEFINIÇÃO DOS CAMINHOS   ############################
					######################################################################################
					def response
						@response ||= BrNfe::Service::Response::ConsultaSituacaoLoteRps.new({
							error_messages:   get_message_for_path(message_errors_path),
							numero_lote:      get_lot_number,
							situation:        get_situation,
							original_xml:     savon_response.xml.force_encoding('UTF-8'),
						})
					end

					# Método utilizado para pegar a situação do RPS
					#
					# <b>Tipo de retorno: </b> _Symbol_
					#
					def get_situation
						situation_value = find_value_for_keys(savon_body, path_with_root(situation_path))
						situation_value = situation_key_values[situation_value.to_s.strip] if situation_value.present?
						situation_value
					end
				end
			end
		end
	end
end


text:
#ifndef _hs_snappy_h
#define _hs_snappy_h

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C"
{
#endif

struct BS {
  const char *ptr;
  size_t off;
  size_t len;
};

size_t _hsnappy_MaxCompressedLength(size_t);

void _hsnappy_RawCompress(const char *input, size_t input_length,
			  char *compressed, size_t *compressed_length);

int _hsnappy_GetUncompressedLength(const char *compressed,
				   size_t compressed_length,
				   size_t *result);

int _hsnappy_RawUncompress(const char *compressed, size_t compressed_length,
			   char *uncompressed);

struct BS;

void _hsnappy_CompressChunks(struct BS *chunks, size_t count,
			     size_t length, char *compressed,
			     size_t *compressed_length);

struct BSSource;

struct BSSource *_hsnappy_NewSource(struct BS *chunks, size_t nchunks,
				    size_t length);

void _hsnappy_DeleteSource(struct BSSource *reader);

int _hsnappy_UncompressChunks(struct BSSource *reader, char *uncompressed);

int _hsnappy_GetUncompressedLengthChunks(struct BSSource *reader,
					 uint32_t *result);

#ifdef __cplusplus
}
#endif

#endif /* _hs_snappy_h */


text:
Navigate to the [Connections > Passwordless](${manage_url}/#/connections/passwordless) page in the [Auth0 Dashboard](${manage_url}/), and enable the SMS toggle.

![Enable SMS Passwordless](/media/articles/connections/passwordless/connections-passwordless-list.png)

To send the SMS, you can either use Twilio, or a Custom SMS Gateway.

### Configure Twilio settings

You will need a [Twilio Account SID](https://www.twilio.com/help/faq/twilio-basics/what-is-an-application-sid) and a [Twilio Auth Token](https://www.twilio.com/help/faq/twilio-basics/what-is-the-auth-token-and-how-can-i-change-it). These are the Twilio API credentials that Auth0 will use to send an SMS to the user.

1. Enter your **Twilio Account SID** and **Twilio Auth Token**.

::: note
To learn how to find your Twilio SID and Auth Token, see Twilio docs: [How to create an Application SID](https://www.twilio.com/help/faq/twilio-basics/what-is-an-application-sid) and [Auth Tokens and how to change them](https://www.twilio.com/help/faq/twilio-basics/what-is-the-auth-token-and-how-can-i-change-it).
:::

![Configure SMS Passwordless](/media/articles/connections/passwordless/connections-passwordless-sms.png)

2. Select your **SMS Source** and depending on your selection, enter either your **Twilio Messaging Service SID** or a **From** phone number. Users will see what you enter as the sender of the SMS.

::: note
To learn about using Twilio Copilot, see Twilio docs: [Sending Messages with Copilot](https://www.twilio.com/docs/api/rest/sending-messages-copilot).
:::

### Configure a custom SMS gateway

If you would like to use your own SMS gateway, you will need to create the passwordless connection and then modify it using our Management API. To learn how to modify the connection to use your own SMS gateway, see [Configure SMS Gateway for Passwordless Connections](/connections/passwordless/guides/use-sms-gateway-passwordless).

### Configure passwordless SMS settings

1. In **Message**, enter the body text of the SMS.

::: note
The `@@password@@` placeholder will automatically be replaced with the one-time password that is sent to the user.
:::

2. Adjust settings for your **OTP Expiry** and **OTP Length**.

<%= include('../../_otp-limitations') %>

3. Decide if you want to **Disable Signups**. You can enable passwordless access just for existing users by enabling this setting.

4. Click **SAVE**.

#### Multi-language support

The **Message** area supports multiple languages.

To choose the language, call the [/passwordless/start authentication endpoint](/api/authentication/reference#get-code-or-link) and set the value of the 'x-request-language' header. When this header is not set, the language is extracted from the 'accept-language' header, which is automatically set by the browser.

#### Message syntax

The **Message** area accepts Liquid syntax. You can use this syntax, combined with exposed parameter values, to programmatically construct elements of the message. For example, you can reference the `request_language` parameter to change the language of the message:

```text
{% if request_language contains 'dutch' %}
   Hier is uw verificatie code: {{ password }}
{% endif %}

{% if request_language contains 'fr-FR' %}
   Ceci est votre code: {{ password }}
{% endif %}
```

The following parameters are available when defining the message template:

| Exposed Parameter | Description |
|:------------------|:---------|
| `password` or `code` | The password to use |
| `phone_number` | The user's phone number |
| `application.name` | The name of the application with which the user is signing up |
| `request_language` | The requested language for message content |

### Enable your apps

Click the **Apps** tab, and enable the apps for which you would like to use <dfn data-key="passwordless">Passwordless</dfn> SMS.


text:
using System;

namespace MVCForms.Models.Booking
{
	public class BookTableVM
	{
		public string Name { get; set; }

		public DateTime Date { get; set; }

		public byte AmmountOfPeople { get; set; }
	}
}


text:
package org.lable.oss.uniqueid.zookeeper;

import org.lable.oss.dynamicconfig.zookeeper.MonitoringZookeeperConnection;
import org.lable.oss.uniqueid.BaseUniqueIDGenerator;
import org.lable.oss.uniqueid.Clock;
import org.lable.oss.uniqueid.GeneratorIdentityHolder;
import org.lable.oss.uniqueid.IDGenerator;
import org.lable.oss.uniqueid.bytes.Mode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Create an {@link IDGenerator} capable of generating unique identifiers in a distributed environment with multiple
 * services generating them. To do this, the {@link GeneratorIdentityHolder} it uses acquires a temporary claim on a
 * generator ID negotiated via a ZooKeeper quorum.
 * <p>
 * Because claimed generator IDs are automatically returned to the pool after a set time
 * ({@link ExpiringResourceClaim#DEFAULT_CLAIM_HOLD}), there is no guarantee that IDs generated by the same
 * {@link IDGenerator} instance share the same generator ID.
 */
public class SynchronizedUniqueIDGeneratorFactory {
    final static Logger logger = LoggerFactory.getLogger(SynchronizedUniqueIDGeneratorFactory.class);
    final static Map<String, IDGenerator> instances = new HashMap<>();

    /**
     * Get the synchronized ID generator instance.
     *
     * @param zooKeeperConnection Connection to the ZooKeeper quorum.
     * @param znode               Base-path of the resource pool in ZooKeeper.
     * @param clock               Clock implementation.
     * @param mode                Generator mode.
     * @return An instance of this class.
     * @throws IOException Thrown when something went wrong trying to find the cluster ID or trying to claim a
     *                     generator ID.
     */
    public static synchronized IDGenerator generatorFor(MonitoringZookeeperConnection zooKeeperConnection,
                                                        String znode,
                                                        Clock clock,
                                                        Mode mode)
            throws IOException {

        if (!instances.containsKey(znode)) {
            final int clusterId = ClusterID.get(zooKeeperConnection.getActiveConnection(), znode);
            SynchronizedGeneratorIdentity generatorIdentityHolder =
                    new SynchronizedGeneratorIdentity(zooKeeperConnection, znode, clusterId, null, null);

            return generatorFor(generatorIdentityHolder, clock, mode);
        }
        return instances.get(znode);
    }

    /**
     * Get the synchronized ID generator instance.
     *
     * @param zooKeeperConnection Connection to the ZooKeeper quorum.
     * @param znode               Base-path of the resource pool in ZooKeeper.
     * @param mode                Generator mode.
     * @return An instance of this class.
     * @throws IOException Thrown when something went wrong trying to find the cluster ID or trying to claim a
     *                     generator ID.
     */
    public static synchronized IDGenerator generatorFor(MonitoringZookeeperConnection zooKeeperConnection,
                                                        String znode,
                                                        Mode mode)
            throws IOException {
        return generatorFor(zooKeeperConnection, znode, null, mode);
    }

    /**
     * Get the synchronized ID generator instance.
     *
     * @param synchronizedGeneratorIdentity An instance of {@link SynchronizedGeneratorIdentity} to (re)use for
     *                                      acquiring the generator ID.
     * @param clock                         Clock implementation.
     * @param mode                          Generator mode.
     * @return An instance of this class.
     * @throws IOException Thrown when something went wrong trying to find the cluster ID or trying to claim a
     *                     generator ID.
     */
    public static synchronized IDGenerator generatorFor(SynchronizedGeneratorIdentity synchronizedGeneratorIdentity,
                                                        Clock clock,
                                                        Mode mode)
            throws IOException {

        String instanceKey = synchronizedGeneratorIdentity.getZNode();
        if (!instances.containsKey(instanceKey)) {
            logger.debug("Creating new instance.");
            instances.putIfAbsent(instanceKey, new BaseUniqueIDGenerator(synchronizedGeneratorIdentity, clock, mode));
        }
        return instances.get(instanceKey);
    }
}


text:
<?php

/**
 * `CHECKSUM` statement.
 */

namespace PhpMyAdmin\SqlParser\Statements;

/**
 * `CHECKSUM` statement.
 *
 * CHECKSUM TABLE tbl_name array(, tbl_name] ... array( QUICK | EXTENDED ]
 *
 * @category   Statements
 *
 * @license    https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
 */
class ChecksumStatement extends MaintenanceStatement
{
    /**
     * Options of this statement.
     *
     * @var array
     */
    public static $OPTIONS = array(
        'TABLE' => 1,

        'QUICK' => 2,
        'EXTENDED' => 3
    );
}


text:
import React, { PureComponent } from "react";
import { withStyles } from "@material-ui/core/styles";
import colors from "shared/colors";

const styles = {
  base: {
    textAlign: "center",
    margin: "auto",
    marginBottom: "50px",
    width: "270px",
    "& p": {
      fontSize: "11px",
      fontWeight: "600",
      textTransform: "uppecarse",
      marginBottom: "20px",
      "& p span": {
        fontSize: "10px",
        color: colors.lead,
        fontWeight: "600",
        display: "inline-block",
        marginLeft: "10px"
      }
    }
  },
  percentageBar: {
    height: "2px",
    background: colors.mouse,
    position: "relative"
  },
  fill: {
    height: "2px",
    position: "absolute",
    top: "0",
    left: "0",
    background: colors.ocean
  }
};

class PercentageBarProgress extends PureComponent<{
  percentage: number,
  label: string | React$Node,
  classes: Object
}> {
  render() {
    const { percentage, label, classes } = this.props;

    return (

        {label}

          <div
            className={classes.fill}
            style={{ width: `${100 * percentage}%` }}
          />

    );
  }
}

export default withStyles(styles)(PercentageBarProgress);


text:
<?php defined('SYSPATH') OR die('No direct access allowed.');

return array(
	'vendor_path' => 'petrovich-php',
);


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

<task oid="eb8f5be6-2b51-11e7-848c-2fd84a283b03"
	xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema">

	<name>Shadow refresh</name>

	<taskIdentifier>eb8f5be6-2b51-11e7-848c-2fd84a283b03</taskIdentifier>
	<ownerRef oid="00000000-0000-0000-0000-000000000002"/>
	<executionStatus>runnable</executionStatus>

	<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/shadowRefresh/handler-3</handlerUri>
	<recurrence>single</recurrence>

</task>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DataReader.Events;
using DataReader.Models;

namespace DataReader.Utils
{
    public interface INameProjector
    {
        void HandleEvent<T>(T eventData, ref NameDTO fullNameModel) where T : IEvent;
    }
}