text:
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>Castle.MonoRail.Views.Brail</name>
    </assembly>
    <members>
        <member name="T:Castle.MonoRail.Views.Brail.Macros.ComponentNaming">
            <summary>
            we need to have a unique name, because of MR 371, nested components should not use the same name.
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BooViewEngine.compilations">
            <summary>
            This field holds all the cache of all the
            compiled types (not instances) of all the views that Brail nows of.
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BooViewEngine.constructors">
            <summary>
            used to hold the constructors of types, so we can avoid using
            Activator (which takes a long time
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BooViewEngine.typeToFileName">
            <summary>
            Used to map between type and file name, this is useful when we
            want to remove a script by its type.
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BooViewEngine.common">
            <summary>
            This is used to add a reference to the common scripts for each compiled scripts
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BooViewEngine.RenderStaticWithinLayout(System.String,Castle.MonoRail.Framework.IEngineContext,Castle.MonoRail.Framework.IController,Castle.MonoRail.Framework.IControllerContext)">
            <summary>
            Wraps the specified content in the layout using the
            context to output the result.
            </summary>
            <param name="contents"></param>
            <param name="context"></param>
            <param name="controller"></param>
            <param name="controllerContext"></param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BooViewEngine.GetCompiledScriptInstance(System.String,System.IO.TextWriter,Castle.MonoRail.Framework.IEngineContext,Castle.MonoRail.Framework.IController,Castle.MonoRail.Framework.IControllerContext)">
            <summary>
            This takes a filename and return an instance of the view ready to be used.
            If the file does not exist, an exception is raised
            The cache is checked to see if the file has already been compiled, and it had been
            a check is made to see that the compiled instance is newer then the file's modification date.
            If the file has not been compiled, or the version on disk is newer than the one in memory, a new
            version is compiled.
            Finally, an instance is created and returned
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BooViewEngine.DoCompile(System.Collections.Generic.IEnumerable{Boo.Lang.Compiler.ICompilerInput},System.String)">
            <summary>
            Perform the actual compilation of the scripts
            Things to note here:
            * The generated assembly reference the Castle.MonoRail.MonoRailBrail and Castle.MonoRail.Framework assemblies
            * If a common scripts assembly exist, it is also referenced
            * The AddBrailBaseClassStep compiler step is added - to create a class from the view's code
            * The ProcessMethodBodiesWithDuckTyping is replaced with ReplaceUknownWithParameters
              this allows to use naked parameters such as (output context.IsLocal) without using
              any special syntax
            * The FixTryGetParameterConditionalChecks is run afterward, to transform "if ?Error" to "if not ?Error isa IgnoreNull"
            * The ExpandDuckTypedExpressions is replace with a derived step that allows the use of Dynamic Proxy assemblies
            * The IntroduceGlobalNamespaces step is removed, to allow to use common variables such as
              date and list without accidently using the Boo.Lang.BuiltIn versions
            </summary>
            <param name="files"></param>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.BrailBase">
             <summary>
            Base class for all the view scripts, this is the class that is responsible for
             support all the behind the scenes magic such as variable to PropertyBag trasnlation,
             resources usage, etc.
             </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase._dsl">
            <summary>
            Reference to the DSL service
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase.childOutput">
            <summary>
            This is used by layout scripts only, for outputing the child's content
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase.parent">
            <summary>
            usually used by the layout to refer to its view, or a subview to its parent
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase.viewComponentsParameters">
            <summary>
            used to hold the ComponentParams from the view, so their views/sections could access them
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.#ctor(Castle.MonoRail.Views.Brail.BooViewEngine,System.IO.TextWriter,Castle.MonoRail.Framework.IEngineContext,Castle.MonoRail.Framework.IController,Castle.MonoRail.Framework.IControllerContext)">
            <summary>
            Initializes a new instance of the <see cref="T:Castle.MonoRail.Views.Brail.BrailBase"/> class.
            </summary>
            <param name="viewEngine">The view engine.</param>
            <param name="output">The output.</param>
            <param name="context">The context.</param>
            <param name="__controller">The controller.</param>
            <param name="__controllerContext">The __controller context.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.Run">
            <summary>
            Runs this instance, this is generated by the script
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.OutputSubView(System.String)">
            <summary>
            Output the subview to the client, this is either a relative path "SubView" which
            is relative to the current /script/ or an "absolute" path "/home/menu" which is
            actually relative to ViewDirRoot
            </summary>
            <param name="subviewName"></param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.OutputSubView(System.String,System.Collections.IDictionary)">
            <summary>
            Similiar to the OutputSubView(string) function, but with a bunch of parameters that are used
            just for this subview. This parameters are /not/ inheritable.
            </summary>
            <returns>An empty string, just to make it possible to use inline ${OutputSubView("foo")}</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.OutputSubView(System.String,System.IO.TextWriter,System.Collections.IDictionary)">
            <summary>
            Outputs the sub view to the writer
            </summary>
            <param name="subviewName">Name of the subview.</param>
            <param name="writer">The writer.</param>
            <param name="parameters">The parameters.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.GetSubViewFilename(System.String)">
            <summary>
            Get the sub view file name, if the subview starts with a '/'
            then the filename is considered relative to ViewDirRoot
            otherwise, it's relative to the current script directory
            </summary>
            <param name="subviewName"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.GetParameter(System.String)">
            <summary>
            this is called by ReplaceUnknownWithParameters step to create a more dynamic experiance
            any uknown identifier will be translate into a call for GetParameter('identifier name').
            This mean that when an uknonwn identifier is in the script, it will only be found on runtime.
            </summary>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.TryGetParameter(System.String)">
            <summary>
            this is called by ReplaceUnknownWithParameters step to create a more dynamic experiance
            any uknown identifier with the prefix of ? will be translated into a call for
            TryGetParameter('identifier name without the ? prefix').
            This method will return null if the value it not found.
            </summary>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.WrapPossilbeNullValue(System.Object)">
            <summary>
            Wraps the possilbe null value in an ignore value object
            </summary>
            <param name="value">The value.</param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.GetParameterInternal(System.String)">
            <summary>
            Gets the parameter - implements the logic for searching parameters.
            </summary>
            <param name="name">The name.</param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.SetParent(Castle.MonoRail.Views.Brail.BrailBase)">
            <summary>
            Sets the parent.
            </summary>
            <param name="myParent">My parent.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.IsDefined(System.String)">
            <summary>
            Allows to check that a parameter was defined
            </summary>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.SetOutputStream(System.IO.TextWriter)">
            <summary>
            This is required because we may want to replace the output stream and get the correct
            behavior from components call RenderText() or RenderSection()
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.OutputEscaped(System.Object)">
            <summary>
            Will output the given value as escaped HTML
            </summary>
            <param name="toOutput"></param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.AddProperty(System.String,System.Object)">
            <summary>
            Note that this will overwrite any existing property.
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.AddViewComponentProperties(System.Collections.IDictionary)">
            <summary>
            Adds the view component newProperties.
            This will be included in the parameters searching, note that this override
            the current parameters if there are clashing.
            The search order is LIFO
            </summary>
            <param name="newProperties">The newProperties.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.RemoveViewComponentProperties(System.Collections.IDictionary)">
            <summary>
            Removes the view component properties, so they will no longer be visible to the views.
            </summary>
            <param name="propertiesToRemove">The properties to remove.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.InitProperties(Castle.MonoRail.Framework.IEngineContext,Castle.MonoRail.Framework.IController,Castle.MonoRail.Framework.IControllerContext)">
            <summary>
            Initialize all the properties that a script may need
            One thing to note here is that resources are wrapped in ResourceToDuck wrapper
            to enable easy use by the script
            </summary>
            <param name="myContext">My context.</param>
            <param name="myController">My controller.</param>
            <param name="controllerContext">The controller context.</param>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.ScriptDirectory">
             <summary>
            The path of the script, this is filled by AddBrailBaseClassStep
             and is used for sub views
             </summary>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.ViewEngine">
            <summary>
            Gets the view engine.
            </summary>
            <value>The view engine.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.Dsl">
            <summary>
            Gets the DSL provider
            </summary>
            <value>Reference to the current DSL Provider</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.Flash">
            <summary>
            Gets the flash.
            </summary>
            <value>The flash.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.OutputStream">
            <summary>
            Gets the output stream.
            </summary>
            <value>The output stream.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.ChildOutput">
            <summary>
            Gets or sets the child output.
            </summary>
            <value>The child output.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.Properties">
            <summary>
            Gets the properties.
            </summary>
            <value>The properties.</value>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSElementGenerator.#ctor(Castle.MonoRail.Framework.JSGeneration.IJSCodeGenerator,Castle.MonoRail.Framework.JSGeneration.IJSElementGenerator,System.Object[])">
            <summary>
            Initializes a new instance of the <see cref="T:Castle.MonoRail.Views.Brail.BrailJSElementGenerator"/> class.
            </summary>
            <param name="codeGen">The code gen.</param>
            <param name="elementGenerator">The element generator.</param>
            <param name="extensions">The extensions.</param>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.BrailJSGenerator">
            <summary>

            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.#ctor(Castle.MonoRail.Framework.JSGeneration.IJSCodeGenerator,Castle.MonoRail.Framework.JSGeneration.IJSGenerator,System.Object[],System.Object[])">
            <summary>
            Initializes a new instance of the <see cref="T:Castle.MonoRail.Views.Brail.BrailJSGenerator"/> class.
            </summary>
            <param name="codeGen">The code gen.</param>
            <param name="generator">The generator.</param>
            <param name="extensions">The extensions.</param>
            <param name="elementExtensions">The element extensions.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.QuackGet(System.String,System.Object[])">
            <summary>
            Defines the behavior when a property is read
            </summary>
            <param name="propName">Property name.</param>
            <param name="parameters">Parameters for indexers</param>
            <returns>value back to the template</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.QuackSet(System.String,System.Object[],System.Object)">
            <summary>
            Defines the behavior when a property is written
            </summary>
            <param name="propName">Property name.</param>
            <param name="parameters">Parameters for indexers</param>
            <param name="value">The value to assign.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.QuackInvoke(System.String,System.Object[])">
            <summary>
            Invokes the specified method.
            </summary>
            <param name="method">The method name.</param>
            <param name="args">The method arguments.</param>
            <returns>value back to the template</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailPreProcessor.EscapeNullPropagationsInOutputExpression(System.String)">
            <summary>
            Given a brail output expression: ${...}
            replace any null propagations, while respecting quoted strings and escaped characters such as ("\"\"").
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailPreProcessor.FindPositionAfterClosingQuote(System.String,System.Int32)">
            <summary>
            Find the position after the end of the closing quote token for the quoted
            substring that started at the specified position

            for example, given the following string x:
             "abc" blah
            01234567890
            FindPositionAfterClosingQuote(x, 1) will return 6

            handles triple-double-quotes, double, and single quotes, and escaped quotes within the string
            </summary>
            <param name="code">code fragment</param>
            <param name="openingQuotePosition">index of opening quote within the code fragment</param>
            <returns>position after closing quote, or -1 if not found</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailPreProcessor.FindStartOfNextQuotedString(System.String,System.Int32)">
            <summary>
            Returns the character position of the next instance of any boo string-quoting tokens: ', ", """
            Note that this returns the position of the beginning of the quote token, not the text inside the quote
            </summary>
            <param name="code"></param>
            <param name="position">position to start search</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailPreProcessor.GetExpressionsPositions(System.String)">
            <summary>
            Will find all the (outer most ${} expressions in the code, and return their positions).
            Smart enough to figure out $${} escaping, but not much more
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailViewComponentContext.#ctor(Castle.MonoRail.Views.Brail.BrailBase,Boo.Lang.ICallable,System.String,System.IO.TextWriter,System.Collections.IDictionary)">
            <summary>
            Initializes a new instance of the <see cref="T:Castle.MonoRail.Views.Brail.BrailViewComponentContext"/> class.
            </summary>
            <param name="parent">The parent.</param>
            <param name="body">The body.</param>
            <param name="name">The name.</param>
            <param name="text">The text.</param>
            <param name="parameters">The parameters.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailViewComponentContext.RenderView(System.String,System.IO.TextWriter)">
            <summary>
            Pendent
            </summary>
            <param name="name"></param>
            <param name="writer"></param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailViewComponentContext.RenderSection(System.String,System.IO.TextWriter)">
            <summary>
            Renders the the specified section
            </summary>
            <param name="sectionName">Name of the section.</param>
            <param name="writer">The writer.</param>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.ExpandDuckTypedExpressions_WorkaroundForDuplicateVirtualMethods">
            <summary>
            This is here because we need to overcome a tendecy of Dynamic Proxy to generate virtual override that
            do not match exactly what the compiler does.
            This means that when you do GetMethod("Foo") and DP has proxied it, you would get an exception because it would
            recognize two methods with this name.
            We recognize when we are trying to invoke something that DP has build and act accordingly.

            The code is mostly taken fro Boo.Lang.Runtime.RuntimeServices, and modified to understand that when the type is from DP, is should
            use DeclareOnly
            </summary>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.FixTryGetParameterConditionalChecks">
            <summary>
            We need to handle the following code:
            if ?Error:
            end

            However, because ?Op will return an IgnoreNull object, we can't just
            use the default boo behavior, but need to fix it up
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.IgnoreNull.ExtractTarget(Castle.MonoRail.Views.Brail.IgnoreNull)">
            <summary>
            Gets the underlying target object of the IgnorNull
            </summary>
            <param name="ignored"></param>
            <returns>target</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.IgnoreNull.ReplaceIgnoreNullsWithTargets(System.Object[])">
            <summary>
            Returns a new array copied from args that has replaced IgnoreNull instances
            with the underlying target object.
            </summary>
            <param name="args">source array</param>
            <returns>new array</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.IgnoreNull.ReplaceIgnoreNullsWithTargets(System.Collections.IDictionary)">
            <summary>
            Replace all the values in the Hashtable that are marked as
            replaced values of IgnoreNull with the underlying target object.
            </summary>
            <param name="dict"></param>
            <returns>The original hashtable, with all the IgnoreNull values stripped to their targets</returns>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.ReplaceUknownWithParameters">
            <summary>
             Replace any uknown identifier with a call to GetParameter('unknown')
             this mean that unknonwn identifier in scripts will only fail in run time if they
             were not defined by the controller.
             </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.ReplaceUknownWithParameters.OnMethodInvocationExpression(Boo.Lang.Compiler.Ast.MethodInvocationExpression)">
            <summary>
            This turn a call to TryGetParemeter('item') where item is a local variable
            into a WrapIfNull(item) method call.
            </summary>
            <param name="node">The node.</param>
        </member>
    </members>
</doc>


text:
/* =STS=> Instrument.h[1729].aa09   open     SMID:10 */
//////////////////////////////////////////////////////////////////////
//
// (c) Copyright 2003 Cyberkinetics, Inc.
//
// $Workfile: Instrument.h $
// $Archive: /Cerebus/WindowsApps/Central/Instrument.h $
// $Revision: 4 $
// $Date: 1/05/04 4:36p $
// $Author: Kkorver $
//
// $NoKeywords: $
//
//////////////////////////////////////////////////////////////////////

#ifndef INSTRUMENT_H_INCLUDED
#define INSTRUMENT_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "cbhwlib.h"
#include "UDPsocket.h"
#include "cki_common.h"

#define NSP_IN_ADDRESS      cbNET_UDP_ADDR_INST  // NSP default address
#define NSP_OUT_ADDRESS     cbNET_UDP_ADDR_CNT   // NSP subnet default address
#define NSP_IN_PORT         cbNET_UDP_PORT_BCAST // Neuroflow Data Port
#define NSP_OUT_PORT        cbNET_UDP_PORT_CNT   // Neuroflow Control Port
#define NSP_REC_BUF_SIZE (4096 * 2048)  // Receiving system buffer size (multiple of 4096)

class Instrument
{
public:
    Instrument();
    virtual ~Instrument();

    // Open the NSP instrument
    cbRESULT OpenNSP(STARTUP_OPTIONS nStartupOptionsFlags, uint16_t nNSPnum);
    cbRESULT Open(STARTUP_OPTIONS nStartupOptionsFlags, bool bBroadcast = false, bool bDontRoute = true,
        bool bNonBlocking = true, int nRecBufSize = NSP_REC_BUF_SIZE);
    void SetNetwork(int nInPort, int nOutPort, LPCSTR szInIP, LPCSTR szOutIP);

    void Close();
    void Standby();
    void Shutdown();
    void TestForReply(void * pPacket);

    enum { TICK_COUNT = 15 };        // Default number of ticks to wait for a response ( 10ms per tick)
    enum { RESEND_COUNT = 10 };     // Default number of times to "resend" a packet before erroring out.
    void Reset(int nMaxTickCount = TICK_COUNT, int nMaxRetryCount = RESEND_COUNT);

    // Called every 10 ms...use for "resending"
    // Outputs:
    //  TRUE if any instrument error has happened; FALSE otherwise
    bool Tick(void);

    enum ModeType
    {
        MT_OK_TO_SEND,              // It is OK to send out a packet
        MT_WAITING_FOR_REPLY,       // We are waiting for the "response"
    };
    ModeType GetSendMode();     // What is our current send mode?

    int Recv(void * packet);

    int Send(void *ppkt);       // Send this packet out

    // Is it OK to send a new packet out?
    bool OkToSend();

    // Purpose: receive a buffer from the "loopback" area. In other words, get it from our
    //  local buffer. It wasn't really sent
    // Inputs:
    //  pBuffer - Where to stuff the packet
    // Outputs:
    //  the number of bytes read, or 0 if no data was found
    int LoopbackRecv(void * pBuffer, uint32_t nInstance = 0)
    {
        uint32_t nIdx = cb_library_index[nInstance];

        // The logic here is quite complicated. Data is filled in from other processes
        // in a 2 pass mode. First they fill all except they skip the first 4 bytes.
        // The final step in the process is to convert the 1st dword from "0" to some other number.
        // This step is done in a thread-safe manner
        // Consequently, all packets can not have "0" as the first DWORD. At the time of writing,
        // We were looking at the "time" value of a packet.
        if (cb_xmt_local_buffer_ptr[nIdx]->buffer[cb_xmt_local_buffer_ptr[nIdx]->tailindex] != 0)
        {
            cbPKT_GENERIC * pPacket = (cbPKT_GENERIC*)&(cb_xmt_local_buffer_ptr[nIdx]->buffer[cb_xmt_local_buffer_ptr[nIdx]->tailindex]);
            return LoopbackRecvLow(pBuffer, pPacket, nInstance);
        }
        return 0;
    }

protected:
    UDPSocket m_icUDP;          // Socket to deal with the sending of the UDP packets

    // Purpose: receive a buffer from the "loopback" area. In other words, get it from our
    //  local buffer. It wasn't really sent. We assume that there is enough memory for
    //  all of the memory copies that take place
    // Inputs:
    //  pBuffer - Where to stuff the packet
    //  pPacketData - the packet put put in this location
    // Outputs:
    //  the number of bytes read, or 0 if no data was found
    int LoopbackRecvLow(void * pBuffer, void * pPacketData, uint32_t nInstance = 0);

    class CachedPacket
    {
    public:
        CachedPacket();
        ModeType GetMode() { return m_enSendMode; }

        void Reset(int nMaxTickCount = TICK_COUNT, int nMaxRetryCount = RESEND_COUNT); // Stop trying to send packets and restart
        bool AddPacket(void * pPacket, int cbBytes);         // Save this packet, of this size
        void CheckForReply(void * pPacket);     // A packet came in, compare to see if necessary
        bool OkToSend() { return m_enSendMode == MT_OK_TO_SEND; }

        // Called every 10 ms...use for "resending"
        // Outputs:
        //  TRUE if any instrument error has happened; FALSE otherwise
        bool Tick(const UDPSocket & rcUDP);

    protected:

        ModeType m_enSendMode;          // What is our current send mode?

        int m_nTickCount;               // How many ticks have passed since we sent?
        int m_nRetryCount;              // How many times have we re-sent this packet?
        int m_nMaxTickCount;            // How many ticks to wait for a response ( 10ms per tick)
        int m_nMaxRetryCount;           // How many times to "resend" a packet before erroring out.

        // This array MUST be larger than the largest data packet
        char m_abyPacket[2048];         // This is the packet that was sent out.
        int m_cbPacketBytes;            // The size of the most recent packet addition

    };

    enum { NUM_OF_PACKETS_CACHED = 6 };
    CachedPacket m_aicCache[NUM_OF_PACKETS_CACHED];

private:
    int m_nInPort;
    int m_nOutPort;
    LPCSTR m_szInIP;
    LPCSTR m_szOutIP;
};

extern Instrument g_icInstrument;   // The one and only instrument

#endif // include guard

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Nova Hedwigia, Beih. 29: 32 (1969)

#### Original name
Clitocybe marthae Singer

### Remarks
null


text:
<?php
/**
 * Created by Marco 'Marcoski' Trognoni.
 */

namespace CpPress\Application\WP\Theme\Feature;

use Commonhelp\WP\WPContainer;
use CpPress\Application\WP\Admin\PostMeta;
use CpPress\Application\WP\Asset\Scripts;
use CpPress\Application\WP\Asset\Styles;
use CpPress\Application\WP\Hook\Filter;
use CpPress\Application\WP\Hook\Hook;

class VideoThumbFeature extends BaseFeature
{

    public function __construct(Hook $hook, Filter $filter, Scripts $scripts, Styles $styles, WPContainer $container ) {
        parent::__construct( $hook, $filter, $scripts, $styles, [], $container );

        $this->options = array(
            'id' => 'cp-viedo-thumb',
            'label' => __('Featured Video', 'cppress'),
            'post_type' => null,
            'priority' => 'low',
            'context' => 'side'
        );

        $this->hooks();
    }

    public function hooks() {
        $this->hook->register('save_post', array($this, 'save'));
        parent::hooks();
    }

    public function getMetaKey() {
        return 'cp-viedo-thumb';

    }

    public function render(){
        global $post;
        echo '<p>
			<input type="text" name="'.$this->getMetaKey().'" class="cp-viedo-thumb" value="'.PostMeta::find($post->ID, $this->getMetaKey()).'" />
		</p>';
    }

    public function save($postId){
        /** @var Request $request */
        $request = $this->container->getRequest();
        if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){
            return;
        }
        if($request->getParam($this->getMetaKey(), null) !== null){
            update_post_meta($postId, $this->getMetaKey(), sanitize_text_field($request->getParam($this->getMetaKey())));
        }
    }
}


text:
Maintenance version, with just one important resources fix

Fixes

 * *scalaz* use the `TimedTask` `ExecutorService` instead of the default `Strategy` to fork tasks in the
  scalaz `TaskEffect`


text:
package org.pentaho.hbase.shim.mapr401;

import org.apache.hadoop.conf.Configuration;
import org.pentaho.hadoop.shim.ShimVersion;
import org.pentaho.hbase.shim.mapr401.wrapper.HBaseShimInterface;
import org.pentaho.hbase.shim.spi.HBaseConnection;
import org.pentaho.hbase.shim.spi.HBaseShim;

/**
 * Concrete implementation of HBaseShim suitable for use with Apache HBase 0.90.x.
 *
 * @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
 */
public class MapRHBaseShim extends HBaseShim implements HBaseShimInterface {

  @Override
  public ShimVersion getVersion() {
    return new ShimVersion( 1, 0 );
  }

  @Override
  public HBaseConnection getHBaseConnection() {
    return new MapRHBaseConnection();
  }

  @Override
  public void setInfo( Configuration configuration ) {
    // noop
  }
}


text:
module ActiveRecord
  module ConnectionAdapters
    module SQLServer
      module Type
        class Integer < ActiveRecord::Type::Integer

        end
      end
    end
  end
end


text:
randomColor();

// Returns an array of ten green colors
// $ExpectType string[]
randomColor({
    count: 10,
    hue: 'green'
});

// Returns a hex code for a light blue
randomColor({
    luminosity: 'light',
    hue: 'blue'
});

// Returns a hex code for a 'truly random' color
randomColor({
    luminosity: 'random',
    hue: 'random'
});

// Returns a bright color in RGB
randomColor({
    luminosity: 'bright',
    format: 'rgb' // e.g. 'rgb(225,200,20)'
});

// Returns a dark RGB color with random alpha
randomColor({
    luminosity: 'dark',
    format: 'rgba' // e.g. 'rgba(9, 1, 107, 0.6482447960879654)'
});

// Returns a light HSL color with random alpha
randomColor({
    luminosity: 'light',
    format: 'hsla' // e.g. 'hsla(27, 88.99%, 81.83%, 0.6450211517512798)'
});

// Returns a dark RGB color with specified alpha
randomColor({
    luminosity: 'dark',
    format: 'rgba',
    alpha: 0.5 // e.g. 'rgba(9, 1, 107, 0.5)',
});

// Support for setting hue from a hex color
randomColor({
    hue: "#00FFFF"
});


text:
// Copyright 2019 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.

package org.chromium.chrome.browser.ui.appmenu;

import android.content.Context;
import android.view.View;
import android.view.ViewConfiguration;

import androidx.annotation.VisibleForTesting;

import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;

/** A UI coordinator the app menu. */
class AppMenuCoordinatorImpl implements AppMenuCoordinator {
    private static Boolean sHasPermanentMenuKeyForTesting;

    /**
     * Factory which creates the AppMenuHandlerImpl.
     */
    @VisibleForTesting
    interface AppMenuHandlerFactory {
        /**
         * @param delegate Delegate used to check the desired AppMenu properties on show.
         * @param appMenuDelegate The AppMenuDelegate to handle menu item selection.
         * @param activityLifecycleDispatcher The {@link ActivityLifecycleDispatcher} for the
         *         containing activity.
         * @param menuResourceId Resource Id that should be used as the source for the menu items.
         *            It is assumed to have back_menu_id, forward_menu_id, bookmark_this_page_id.
         * @param decorView The decor {@link View}, e.g. from Window#getDecorView(), for the
         *         containing activity.
         * @return AppMenuHandlerImpl for the given activity and menu resource id.
         */
        AppMenuHandlerImpl get(AppMenuPropertiesDelegate delegate, AppMenuDelegate appMenuDelegate,
                int menuResourceId, View decorView,
                ActivityLifecycleDispatcher activityLifecycleDispatcher);
    }

    private final Context mContext;
    private final MenuButtonDelegate mButtonDelegate;
    private final AppMenuDelegate mAppMenuDelegate;

    private AppMenuPropertiesDelegate mAppMenuPropertiesDelegate;
    private AppMenuHandlerImpl mAppMenuHandler;

    /**
     * Construct a new AppMenuCoordinatorImpl.
     * @param context The activity context.
     * @param activityLifecycleDispatcher The {@link ActivityLifecycleDispatcher} for the containing
     *         activity.
     * @param buttonDelegate The {@link MenuButtonDelegate} for the containing activity.
     * @param appMenuDelegate The {@link AppMenuDelegate} for the containing activity.
     * @param decorView The decor {@link View}, e.g. from Window#getDecorView(), for the containing
     *         activity.
     * @param hardwareButtonAnchorView The {@link View} used as an anchor for the menu when it is
     *            displayed using a hardware button.
     */
    public AppMenuCoordinatorImpl(Context context,
            ActivityLifecycleDispatcher activityLifecycleDispatcher,
            MenuButtonDelegate buttonDelegate, AppMenuDelegate appMenuDelegate, View decorView,
            View hardwareButtonAnchorView) {
        mContext = context;
        mButtonDelegate = buttonDelegate;
        mAppMenuDelegate = appMenuDelegate;
        mAppMenuPropertiesDelegate = mAppMenuDelegate.createAppMenuPropertiesDelegate();

        mAppMenuHandler = new AppMenuHandlerImpl(mAppMenuPropertiesDelegate, mAppMenuDelegate,
                mAppMenuPropertiesDelegate.getAppMenuLayoutId(), decorView,
                activityLifecycleDispatcher, hardwareButtonAnchorView);
    }

    @Override
    public void destroy() {
        // Prevent the menu window from leaking.
        if (mAppMenuHandler != null) mAppMenuHandler.destroy();

        mAppMenuPropertiesDelegate.destroy();
    }

    @Override
    public void showAppMenuForKeyboardEvent() {
        if (mAppMenuHandler == null || !mAppMenuHandler.shouldShowAppMenu()) return;

        boolean hasPermanentMenuKey = sHasPermanentMenuKeyForTesting != null
                ? sHasPermanentMenuKeyForTesting.booleanValue()
                : ViewConfiguration.get(mContext).hasPermanentMenuKey();
        mAppMenuHandler.showAppMenu(
                hasPermanentMenuKey ? null : mButtonDelegate.getMenuButtonView(), false,
                mButtonDelegate.isMenuFromBottom());
    }

    @Override
    public AppMenuHandler getAppMenuHandler() {
        return mAppMenuHandler;
    }

    @Override
    public AppMenuPropertiesDelegate getAppMenuPropertiesDelegate() {
        return mAppMenuPropertiesDelegate;
    }

    @Override
    public void registerAppMenuBlocker(AppMenuBlocker blocker) {
        mAppMenuHandler.registerAppMenuBlocker(blocker);
    }

    @Override
    public void unregisterAppMenuBlocker(AppMenuBlocker blocker) {
        mAppMenuHandler.unregisterAppMenuBlocker(blocker);
    }

    // Testing methods

    @VisibleForTesting
    AppMenuHandlerImpl getAppMenuHandlerImplForTesting() {
        return mAppMenuHandler;
    }

    /**
     * @param hasPermanentMenuKey Overrides {@link ViewConfiguration#hasPermanentMenuKey()} for
     *         testing. Pass null to reset.
     */
    @VisibleForTesting
    static void setHasPermanentMenuKeyForTesting(Boolean hasPermanentMenuKey) {
        sHasPermanentMenuKeyForTesting = hasPermanentMenuKey;
    }
}


text:
/*
 *  OpenWFEru densha - open source ruby workflow and bpm engine
 *  (c) 2007-2008 John Mettraux
 *
 *  OpenWFEru densha is freely distributable under the terms
 *  of a BSD-style license.
 *  For details, see the OpenWFEru web site: http://openwferu.rubyforge.org
 *
 *  Made in Japan
 */

function toggleWadminAddButton (form_id, button_id) {

    var form = $(form_id);
    var button = $(button_id);

    form.toggle();

    if (form.visible())
        button.hide();
    else
        button.show();
}


text:
require 'cunn'
local matio = require 'matio'

local util = {}

function util.save_vz(fname, grid, min, range)
    print('Saving ' .. fname .. ': min=' .. grid:min() .. 'max=' .. grid:max())
    im = grid
    im = im - min
    im = im/range
    image.save(fname, im)
end

function util.bool2int(b) return b and 1 or 0 end

function util.rev_table(tbl)
    rev = {}
    for i,v in ipairs(tbl) do
        rev[v] = i
    end
    return rev
end

function util.train_qnetwork_3state(net, crit, params, dynamics, fnamesave, fname_network, fname_mat)
    local memoryState = nil
    local memoryNState = nil
    local memoryReward = nil
    local memoryTerm = nil
    local memoryMask = nil
    local termIn = nil
    local termOut = nil
    local termTerm = nil
    local termMask = nil
    local hat = netClone(net)
    local batchState = torch.Tensor(params.batch_size, dynamics.inSize)
    local batchNState = torch.Tensor(params.batch_size, dynamics.inSize)
    local batchTarget = torch.Tensor(params.batch_size, dynamics.outSize)
    local batchTerm = torch.Tensor(params.batch_size, 1)
    local batchMask = torch.Tensor(params.batch_size, dynamics.outSize)
    local lossvals = torch.Tensor(10)
    for i=0,params.iterations do
        local input, outIdx, reward, new_state, terminal = dynamics:step(1)
        local output = torch.zeros(1,dynamics.outSize)
        output[1][outIdx] = reward

        local mask = torch.zeros(1,dynamics.outSize):scatter(2,torch.LongTensor{outIdx}:view(1,1),1)

        input = dynamics:normalize_points(input)
        new_state = dynamics:normalize_points(new_state)

        if not terminal then
            if not memoryState then
                memoryState = input:clone()
                memoryNState = new_state:clone()
                memoryReward = output:clone()
                memoryTerm = torch.Tensor(1,1):fill(util.bool2int(terminal))
                memoryMask = mask:clone()
            end
            if memoryState:size(1) < params.memory_size then
                memoryState = torch.cat(memoryState, input,1)
                memoryNState = torch.cat(memoryNState, new_state,1)
                memoryReward = torch.cat(memoryReward, output,1)
                memoryTerm = torch.cat(memoryTerm, torch.Tensor(1,1):fill(util.bool2int(terminal)),1)
                memoryMask = torch.cat(memoryMask, mask,1)
            else
                idx = torch.random(1,params.memory_size)
                memoryState[idx] = input
                memoryNState[idx] = new_state
                memoryReward[idx] = output
                memoryTerm[idx] = util.bool2int(terminal)
                memoryMask[idx] = mask
            end

        else
            if not termIn then
                termIn = input:clone()
                termOut = output:clone()
                termTerm = torch.Tensor(1,1):fill(util.bool2int(terminal))
                termMask = mask:clone()
            end
            if termIn:size(1) < params.memory_size then
                termIn = torch.cat(termIn, input,1)
                termOut = torch.cat(termOut, output,1)
                termTerm = torch.cat(termTerm, torch.Tensor(1,1):fill(util.bool2int(terminal)),1)
                termMask = torch.cat(termMask, mask,1)
            else
                idx = torch.random(1,params.memory_size)
                termIn[idx] = input
                termOut[idx] = output
                termTerm[idx] = util.bool2int(terminal)
                termMask[idx] = mask
            end
        end

        if memoryState ~= nil then
            ms = memoryState:size(1)
            bs = math.min(params.batch_size, ms)
            ridx = torch.randperm(ms):type('torch.LongTensor')
            batchState = memoryState:index(1, ridx[{{1,bs}}])
            batchNState = memoryNState:index(1, ridx[{{1,bs}}])
            batchTarget = memoryReward:index(1, ridx[{{1,bs}}])
            batchMask = memoryMask:index(1, ridx[{{1,bs}}])
            batchFinal = torch.zeros(#batchTarget)

            local cvals = netForward(hat, batchNState[{{1,bs},{}}])
            local nQvals, nQidx = cvals:max(2)
            nQvals = nQvals*params.gamma
            batchFinal:maskedCopy(batchMask:eq(1), nQvals)
            batchFinal = batchFinal + batchTarget

            local result = netForward(net, batchState[{{1,bs},{}}])

            crit:forward(result, batchFinal[{{1,bs},{}}])

            netZeroGradParameters(net)
            local grad = crit:backward(result:cuda(), batchFinal[{{1,bs},{}}]:cuda())
            grad:maskedFill(batchMask[{{1,bs},{}}]:eq(0):cuda(), 0)
            netBackward(net, batchState[{{1,bs},{}}], grad)
            netUpdateParameters(net, params.learning_rate)
            local loss = grad:pow(2):sum()

            if i % params.print_freq == 0 then
                print('Iter: ' .. i .. '\t Loss=' .. loss)
                lossvals = torch.cat(lossvals, torch.Tensor{loss},1)
            end
            outt = {}
            tomat = torch.Tensor(qwidth, qheight, #net, #rlacts)
            if i % (400*params.print_freq) == 0 or i == params.iterations then
                for phs=1,#net do
                    st = torch.zeros(3)
                    input = rl.env:gen_grid(st)
                    outt['act'..phs] = rl.net[phs]:forward(input)
                    outt['act'..phs] = outt['act'..phs]:type('torch.DoubleTensor')
                    min = outt['act'..phs]:min()
                    range = outt['act'..phs]:max() - min
                    for j=1,#rlacts do
                        out = outt['act'..phs][{{},{j}}]:clone()
                        tomat[{{},{},phs,j}] = out:view(qwidth,qheight)
                        util.save_vz(string.format(fnamesave,i..'-'..phs,j), out:view(qwidth,qheight):clone(), min, range)
                    end
                    torch.save(string.format(fname_network, phs), hat)

                end
                matio.save(fname_mat, {Q=tomat, vals=lossvals, umap=torch.Tensor{10}, voxel_grid=pdata.voxel_grid:type('torch.DoubleTensor')})
                print('---> ' .. os.date())
            end
        end

        if termIn ~= nil then
            ms = termIn:size(1)
            bs = math.min(params.batch_size, ms)
            ridx = torch.randperm(ms):type('torch.LongTensor')
            batchState = termIn:index(1, ridx[{{1,bs}}])
            batchTarget = termOut:index(1, ridx[{{1,bs}}])
            batchMask = termMask:index(1, ridx[{{1,bs}}])

            local result = netForward(net, batchState[{{1,bs},{}}])

            crit:forward(result, batchTarget[{{1,bs},{}}])

            netZeroGradParameters(net)
            local grad = crit:backward(result:cuda(), batchTarget[{{1,bs},{}}]:cuda())
            grad:maskedFill(batchMask[{{1,bs},{}}]:eq(0):cuda(), 0)
            netBackward(net, batchState[{{1,bs},{}}], grad)
            netUpdateParameters(net, params.learning_rate)
        end

        if i % params.net_reset == 0 then
            hat = netClone(net)
        end
    end
end

function util.train_qnetwork(net, crit, params, dynamics, fnamesave, fname_network)
    local memoryState = nil
    local memoryNState = nil
    local memoryReward = nil
    local memoryTerm = nil
    local memoryMask = nil
    local termIn = nil
    local termOut = nil
    local termTerm = nil
    local termMask = nil
    local hat = net:clone()
    local batchState = torch.Tensor(params.batch_size, dynamics.inSize)
    local batchNState = torch.Tensor(params.batch_size, dynamics.inSize)
    local batchTarget = torch.Tensor(params.batch_size, dynamics.outSize)
    local batchTerm = torch.Tensor(params.batch_size, 1)
    local batchMask = torch.Tensor(params.batch_size, dynamics.outSize)
    for i=1,params.iterations do
        local input, outIdx, reward, new_state, terminal = dynamics:step(1)
        local output = torch.zeros(1,dynamics.outSize)
        output[1][outIdx] = reward

        local mask = torch.zeros(1,dynamics.outSize):scatter(2,torch.LongTensor{outIdx}:view(1,1),1)

        input = dynamics:normalize_points(input)
        new_state = dynamics:normalize_points(new_state)

        if not terminal then
            if not memoryState then
                memoryState = input:clone()
                memoryNState = new_state:clone()
                memoryReward = output:clone()
                memoryTerm = torch.Tensor(1,1):fill(util.bool2int(terminal))
                memoryMask = mask:clone()
            end
            if memoryState:size(1) < params.memory_size then
                memoryState = torch.cat(memoryState, input,1)
                memoryNState = torch.cat(memoryNState, new_state,1)
                memoryReward = torch.cat(memoryReward, output,1)
                memoryTerm = torch.cat(memoryTerm, torch.Tensor(1,1):fill(util.bool2int(terminal)),1)
                memoryMask = torch.cat(memoryMask, mask,1)
            else
                idx = torch.random(1,params.memory_size)
                memoryState[idx] = input
                memoryNState[idx] = new_state
                memoryReward[idx] = output
                memoryTerm[idx] = util.bool2int(terminal)
                memoryMask[idx] = mask
            end

        else
            if not termIn then
                termIn = input:clone()
                termOut = output:clone()
                termTerm = torch.Tensor(1,1):fill(util.bool2int(terminal))
                termMask = mask:clone()
            end
            if termIn:size(1) < params.memory_size then
                termIn = torch.cat(termIn, input,1)
                termOut = torch.cat(termOut, output,1)
                termTerm = torch.cat(termTerm, torch.Tensor(1,1):fill(util.bool2int(terminal)),1)
                termMask = torch.cat(termMask, mask,1)
            else
                idx = torch.random(1,params.memory_size)
                termIn[idx] = input
                termOut[idx] = output
                termTerm[idx] = util.bool2int(terminal)
                termMask[idx] = mask
            end
        end

        if memoryState ~= nil then
            ms = memoryState:size(1)
            bs = math.min(params.batch_size, ms)
            ridx = torch.randperm(ms):type('torch.LongTensor')
            batchState = memoryState:index(1, ridx[{{1,bs}}]):cuda()
            batchNState = memoryNState:index(1, ridx[{{1,bs}}]):cuda()
            batchTarget = memoryReward:index(1, ridx[{{1,bs}}]):cuda()
            batchMask = memoryMask:index(1, ridx[{{1,bs}}]):cuda()
            batchFinal = torch.zeros(#batchTarget):cuda()

            local cvals = hat:forward(batchNState[{{1,bs},{}}])
            local nQvals, nQidx = cvals:max(2)
            nQvals = nQvals*params.gamma
            batchFinal:maskedCopy(batchMask:eq(1), nQvals)
            batchFinal = batchFinal + batchTarget

            local result = net:forward(batchState[{{1,bs},{}}])

            crit:forward(result, batchFinal[{{1,bs},{}}])

            net:zeroGradParameters()
            local grad = crit:backward(net.output, batchFinal[{{1,bs},{}}])
            grad:maskedFill(batchMask[{{1,bs},{}}]:eq(0), 0)
            net:backward(batchState[{{1,bs},{}}], grad)
            net:updateParameters(params.learning_rate)
            local loss = grad:pow(2):sum()

            if i % params.print_freq == 0 then
                print('Iter: ' .. i .. '\t Loss=' .. loss)
            end
            if i % (100*params.print_freq) == 0 then
                st = torch.zeros(3)
                input = rl.env:gen_grid(st)
                outt = rl.net:forward(input)
                min = outt:min()
                range = outt:max() - min
                for j=1,#rlacts do
                    out = outt[{{},{j}}]:clone()
                    util.save_vz(string.format(fnamesave, i,j), out:view(qwidth,qheight):clone(), min, range)
                end
                torch.save(fname_network, hat)
            end
        end

        if termIn ~= nil then
            ms = termIn:size(1)
            bs = math.min(params.batch_size, ms)
            ridx = torch.randperm(ms):type('torch.LongTensor')
            batchState = termIn:index(1, ridx[{{1,bs}}]):cuda()
            batchTarget = termOut:index(1, ridx[{{1,bs}}]):cuda()
            batchMask = termMask:index(1, ridx[{{1,bs}}]):cuda()

            local result = net:forward(batchState[{{1,bs},{}}])

            crit:forward(result, batchTarget[{{1,bs},{}}])

            net:zeroGradParameters()
            local grad = crit:backward(net.output, batchTarget[{{1,bs},{}}])
            grad:maskedFill(batchMask[{{1,bs},{}}]:eq(0), 0)
            net:backward(batchState[{{1,bs},{}}], grad)
            net:updateParameters(params.learning_rate)
        end

        if i % params.net_reset == 0 then
            hat = net:clone()
        end
    end
end

function util.train_basicnetwork(net, crit, params, dynamics)
    local memoryIn = nil
    local memoryOut = nil
    local memoryTerm = nil
    local memoryMask = nil
    local batchIn = torch.Tensor(params.batch_size, dynamics.inSize)
    local batchOut = torch.Tensor(params.batch_size, dynamics.outSize)
    local batchTerm = torch.Tensor(params.batch_size, 1)
    local batchMask = torch.Tensor(params.batch_size, dynamics.outSize)
    for i=1,params.iterations do
        local input, outIdx, reward, new_state, terminal = dynamics:step(1)
        local output = torch.zeros(1,dynamics.outSize)
        output[1][outIdx] = reward

        local mask = torch.zeros(1,dynamics.outSize):scatter(2,torch.LongTensor{outIdx}:view(1,1),1)

        input = dynamics:normalize_points(input)

        if not memoryIn then
            memoryIn = input:clone()
            memoryOut = output:clone()
            memoryTerm = torch.Tensor(1,1):fill(util.bool2int(terminal))
            memoryMask = mask:clone()
        end
        if i < params.memory_size then
            memoryIn = torch.cat(memoryIn, input,1)
            memoryOut = torch.cat(memoryOut, output,1)
            memoryTerm = torch.cat(memoryTerm, torch.Tensor(1,1):fill(util.bool2int(terminal)),1)
            memoryMask = torch.cat(memoryMask, mask,1)
        else
            idx = torch.random(1,params.memory_size)
            memoryIn[idx] = input
            memoryOut[idx] = output
            memoryTerm[idx] = util.bool2int(terminal)
            memoryMask[idx] = mask
        end

        ms = memoryIn:size(1)
        bs = math.min(params.batch_size, ms)
        ridx = torch.randperm(ms):type('torch.LongTensor')
        batchIn = memoryIn:index(1, ridx[{{1,bs}}]):cuda()
        batchOut = memoryOut:index(1, ridx[{{1,bs}}]):cuda()
        batchMask = memoryMask:index(1, ridx[{{1,bs}}]):cuda()

        local result = net:forward(batchIn[{{1,bs},{}}])

        crit:forward(result, batchOut[{{1,bs},{}}])

        net:zeroGradParameters()
        local grad = crit:backward(net.output, batchOut[{{1,bs},{}}])
        grad:maskedFill(batchMask[{{1,bs},{}}]:eq(0), 0)
        net:backward(batchIn[{{1,bs},{}}], grad)
        net:updateParameters(params.learning_rate)
        local loss = grad:pow(2):sum()

        --[[
        termSize = memoryTerm:sum()
        if termSize > 0 then
            ms = memoryIn:size(1)
            bs = math.min(params.batch_size, termSize)
            c = torch.randperm(termSize):type('torch.LongTensor')
            ridx = memoryTerm:nonzero():select(2,1):index(1, c[{{1,bs}}])
            batchIn = memoryIn:index(1, ridx[{{1,bs}}]):cuda()
            batchOut = memoryOut:index(1, ridx[{{1,bs}}]):cuda()
            batchMask = memoryMask:index(1, ridx[{{1,bs}}]):cuda()

            local result = net:forward(batchIn[{{1,bs},{}}])

            crit:forward(result, batchOut[{{1,bs},{}}])

            net:zeroGradParameters()
            local grad = crit:backward(net.output, batchOut[{{1,bs},{}}])
            grad:maskedFill(batchMask[{{1,bs},{}}]:eq(0), 0)
            net:backward(batchIn[{{1,bs},{}}], grad)
            net:updateParameters(params.learning_rate)
        end
        --]]

        if i % params.print_freq == 0 then
            print('Iter: ' .. i .. '\t Loss=' .. loss)
        end
    end
end
return util


text:
using System;
namespace hmsspx
{
    partial class pageBase
    {
        public int add_NavigationNode(int level, HMS.SP.NavigationNode spNavigationNode)
        {
            return add_NavigationNode(-1, level, spNavigationNode);
        }
        public int  add_NavigationNode(int pos, int level, HMS.SP.NavigationNode spNavigationNode)
        {
            if (spNavigationNode.__HMSError_ != null && (spNavigationNode.__HMSError_.errno != 0 || spNavigationNode.__HMSError_.info != "" ))
            {
                pos = this.add_lineAt(pos, level, "__HMSError", HMS.Util.__HMSError.toString(spNavigationNode.__HMSError_));
            }
            pos = this.add__deferred(pos, level, spNavigationNode.__deferred_);
            pos = this.add__metadata(pos, level, spNavigationNode.__metadata_);
            pos = this.add__rest(pos, level, spNavigationNode.__rest);
            pos = this.add_deferredAt(pos,level, "Children", "...", myType.GetType("SP.NavigationNode"), spNavigationNode.Children_.__deferred_); //NavigationNode;
            pos = this.add_lineAt(pos,level,  "Id", HMS.SP.SPUtil.toString(spNavigationNode.Id_)); //Undefined;
            pos = this.add_lineAt(pos,level,  "IsDocLib", HMS.SP.SPUtil.toString(spNavigationNode.IsDocLib_)); //Undefined;
            pos = this.add_lineAt(pos,level,  "IsExternal", HMS.SP.SPUtil.toString(spNavigationNode.IsExternal_)); //Undefined;
            pos = this.add_lineAt(pos,level,  "IsVisible", HMS.SP.SPUtil.toString(spNavigationNode.IsVisible_)); //Undefined;
            pos = this.add_lineAt(pos,level,  "Title", HMS.SP.SPUtil.toString(spNavigationNode.Title_)); //String;
            pos = this.add_lineAt(pos,level,  "Url", HMS.SP.SPUtil.toString(spNavigationNode.Url_)); //String;
            return pos;
        }
        public int add_NavigationNode_deferred(int pos, int level, HMS.SP.NavigationNode spNavigationNode)
        {
            {
                string useUrl = spNavigationNode.__deferred_.uri;
                if( !String.IsNullOrEmpty(useUrl) )
                {
                    pos = this.add_lineAt(pos, level, false,  "NavigationNode","", knownPages.pageNavigationNode, useUrl);
                }
                else
                {
                    pos = this.add_lineAt(pos, level, true,   "NavigationNode", "",knownPages.NONE, "");
                    pos = this.add_NavigationNode(pos, level+1, spNavigationNode);
                }
            }
        return pos;
        }
    }
}


text:
     || defined(__i486__) || defined(__i586__) || defined(__i686__) \
     || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \
     || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \
     || defined(_M_IX86) || defined(_I86_)) && defined(BOOST_WINDOWS)
# define BOOST_CONTEXT_CALLDECL __cdecl
#else
# define BOOST_CONTEXT_CALLDECL
#endif

#if defined(BOOST_USE_SEGMENTED_STACKS)
# if ! ( (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) ) ) || \
         (defined(__clang__) && (__clang_major__ > 2 || ( __clang_major__ == 2 && __clang_minor__ > 3) ) ) )
#  error "compiler does not support segmented_stack stacks"
# endif
# define BOOST_CONTEXT_SEGMENTS 10
#endif

#define BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE
// use rd6 macros for std::integer_sequence
#if defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304
# undef BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE
#endif
// workaroud: MSVC 14 does not provide macros to test for compile-time integer sequence
#if _MSC_VER > 1800 // _MSC_VER == 1800 -> MS Visual Studio 2013
# undef BOOST_CONTEXT_NO_INDEX_SEQUENCE
#endif
// workaround: Xcode clang feature detection
#if ! defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304
# if _LIBCPP_STD_VER > 11
#  undef BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE
# endif
#endif

// workaroud: MSVC 14 does support constexpr
#if _MSC_VER > 1800 // _MSC_VER == 1800 -> MS Visual Studio 2013
# undef BOOST_NO_CXX11_CONSTEXPR
#endif

#undef BOOST_CONTEXT_NO_CXX11
#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \
    defined(BOOST_NO_CXX11_CONSTEXPR) || \
    defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \
    defined(BOOST_NO_CXX11_FINAL) || \
    defined(BOOST_NO_CXX11_HDR_TUPLE) || \
    defined(BOOST_NO_CXX11_NOEXCEPT) || \
    defined(BOOST_NO_CXX11_NULLPTR) || \
    defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
    defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || \
    defined(BOOST_NO_CXX11_UNIFIED_INITIALISATION_SYNTAX) || \
    defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \
    defined(BOOST_NO_HDR_ATOMIC) || \
    defined(BOOST_NO_HDR_TUPLE)
# define BOOST_CONTEXT_NO_CXX11
#endif

#if ! defined(BOOST_EXECUTION_CONTEXT)
# if defined(BOOST_USE_SEGMENTED_STACKS)
#  define BOOST_EXECUTION_CONTEXT 1
# else
#  define BOOST_EXECUTION_CONTEXT 2
# endif
#endif

#if ! defined(BOOST_NO_CXX11_CONSTEXPR)
// modern architectures have cachelines with 64byte length
// ARM Cortex-A15 32/64byte, Cortex-A9 16/32/64bytes
// MIPS 74K: 32byte, 4KEc: 16byte
// ist should be safe to use 64byte for all
static constexpr std::size_t cache_alignment{ 64 };
static constexpr std::size_t cacheline_length{ 64 };
// lookahead size for prefetching
static constexpr std::size_t prefetch_stride{ 4 * cacheline_length };
#endif

#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
// GNU libstdc++ 3
#  define BOOST_CONTEXT_HAS_CXXABI_H
#endif

#if defined( BOOST_CONTEXT_HAS_CXXABI_H )
# include <cxxabi.h>
#endif

#if defined(__OpenBSD__)
// stacks need mmap(2) with MAP_STACK
# define BOOST_CONTEXT_USE_MAP_STACK
#endif

#endif // BOOST_CONTEXT_DETAIL_CONFIG_H


text:
package MongoDB::Role::_DatabaseOp;

# MongoDB interface for database operations

use version;
our $VERSION = 'v0.999.999.6';

use MongoDB::BSON;
use MongoDB::Error;
use MongoDB::_Protocol;
use Moo::Role;
use MongoDB::_Constants;
use MongoDB::_Types qw(
    BSONCodec
);
use namespace::clean;

requires 'execute';

has bson_codec => (
    is       => 'ro',
    required => 1,
    isa => BSONCodec,
);

# Sends a BSON query string, then read, parse and validate the reply.
# Throws various errors if the results indicate a problem.  Returns
# a "result" structure generated by MongoDB::_Protocol, but with
# the 'docs' field replaced with inflated documents.

# as this is the hot loop, we do a number of odd things in the name of
# optimization, such as chaining lots of operations with ',' to keep them
# in a single statement

# args are self, link, op_bson, request_id and not unpacked as they are only
# used briefly

sub _query_and_receive {
    my ($result, $doc_bson, $bson_codec, $docs, $len, $i);
    $_[1]->write( $_[2] ),
      ( $result   = MongoDB::_Protocol::parse_reply( $_[1]->read, $_[3] ) ),
      ( $doc_bson = $result->{docs} ),
      ( $docs     = $result->{docs} = [] ),
      ( ( $bson_codec, $i ) = ( $_[0]->bson_codec, 0 ) ),
      ( $#$docs = $result->{number_returned} - 1 );

    # XXX should address be added to result here?

    MongoDB::CursorNotFoundError->throw("cursor not found")
      if $result->{flags}{cursor_not_found};

    # XXX eventually, BSON needs an API to do this efficiently for us without a
    # loop here.  Alternatively, BSON strings could be returned as objects that
    # inflate lazily

    while ( length($doc_bson) ) {
        $len = unpack( P_INT32, $doc_bson );
        MongoDB::ProtocolError->throw("document in response at index $i was truncated")
          if $len > length($doc_bson);
        $docs->[ $i++ ] = $bson_codec->decode_one( substr( $doc_bson, 0, $len, '' ) );
    }

    MongoDB::ProtocolError->throw(
        sprintf(
            "unexpected number of documents: got %s, expected %s",
            scalar @$docs,
            $result->{number_returned}
        )
    ) if scalar @$docs != $result->{number_returned};

    return $result
      unless $result->{flags}{query_failure};

    # had query_failure, so pretend the query was a command and assert it here
    MongoDB::CommandResult->_new(
        output  => $result->{docs}[0],
        address => $_[1]->address
    )->assert;
}

1;


text:
<?php

namespace Caxy\AuditLogBundle\EventListener;

use Caxy\AuditLogBundle\Manager\AuditLogManager;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\ClassMetadataInfo;

class SchemaSubscriber implements EventSubscriber
{
    /**
     * @var \Caxy\AuditLogBundle\AuditLogConfiguration
     */
    protected $config;

    /**
     * @var \Caxy\AuditLogBundle\Metadata\MetadataFactory
     */
    protected $metadataFactory;

    public function __construct(AuditLogManager $manager)
    {
        $this->config = $manager->getConfiguration();
        $this->metadataFactory = $manager->getMetadataFactory();
    }

    /**
     * {@inheritDoc}
     */
    public function getSubscribedEvents()
    {
        return array(
            Events::loadClassMetadata,
        );
    }

    /**
     * @param LoadClassMetadataEventArgs $eventArgs [description]
     */
    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
    {
        $classMetadata = $eventArgs->getClassMetadata();
        if ($classMetadata->namespace != 'Caxy\AuditLogBundle\Model') {
            return;
        }
        if ($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()) {
            return;
        }

        $classMetadata->setTableName($this->config->getTablePrefix().$classMetadata->getTableName().$this->config->getTableSuffix());

        foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
            if ($mapping['type'] == ClassMetadataInfo::MANY_TO_MANY) {
                $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];
                $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->config->getTablePrefix().$mappedTableName.$this->config->getTableSuffix();
            }
        }
    }
}


text:
void CEntityManager::createEntity()
{
	unsigned int static ID = 0;

	bool isSuitable = false;
	std::unordered_map<unsigned int, CEntity*>::const_iterator iterator = mEntities.find(ID);
	if(iterator == mEntities.end()) // if iterator reach to end of std::unordered_map then there is no same ID added at past
	{
		isSuitable = true;
	}

	if(isSuitable == true)
	{
		CEntity entity(ID);

		std::pair<unsigned int, CEntity*> data;
		data.first = ID;
		data.second = &entity;
		mEntities.insert(data);
	}
}

void CEntityManager::removeEntityByID(unsigned int id)
{
	mEntities.erase(id);
}
void CEntityManager::addComponentToEntity(unsigned int id, CComponent &c)
{
	std::unordered_map<unsigned int, CEntity*>::const_iterator iterator = mEntities.find(id);
	iterator->second->addComponent(c);
}

CEntity* CEntityManager::getEntityByID(unsigned int id)
{
	std::unordered_map<unsigned int, CEntity*>::const_iterator iterator = mEntities.find(id);
	return iterator->second;
}


text:
package com.jakewharton.rxbinding2.support.v4.view;

import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import com.jakewharton.rxbinding2.InitialValueObservable;
import io.reactivex.Observer;
import io.reactivex.android.MainThreadDisposable;

final class ViewPagerPageSelectedObservable extends InitialValueObservable<Integer> {
  private final ViewPager view;

  ViewPagerPageSelectedObservable(ViewPager view) {
    this.view = view;
  }

  @Override protected void subscribeListener(Observer<? super Integer> observer) {
    Listener listener = new Listener(view, observer);
    observer.onSubscribe(listener);
    view.addOnPageChangeListener(listener);
  }

  @Override protected Integer getInitialValue() {
    return view.getCurrentItem();
  }

  static final class Listener extends MainThreadDisposable implements OnPageChangeListener {
    private final ViewPager view;
    private final Observer<? super Integer> observer;

    Listener(ViewPager view, Observer<? super Integer> observer) {
      this.view = view;
      this.observer = observer;
    }

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

    }

    @Override public void onPageSelected(int position) {
      if (!isDisposed()) {
        observer.onNext(position);
      }
    }

    @Override public void onPageScrollStateChanged(int state) {

    }

    @Override protected void onDispose() {
      view.removeOnPageChangeListener(this);
    }
  }
}


text:
import { Component, Input, OnChanges } from '@angular/core';

@Component({
    selector: 'extended-input',
    templateUrl: 'extended-input.component.html'
})
export class ExtendedInputComponent {

    @Input()
    labelText: string = '';

    @Input()
    errorMessage: string = '';
}


text:
var Hook = require('../index.js');
var assert = require('assert');

describe('Contructor', function() {
  it('should read metaData.json and combine it with assets.json and cache is true', function () {
    var hook = new Hook(__dirname + '/fixtures/assets1');

    var expectedResult = require('./fixtures/assets1-meta.json');
    assert.deepEqual(hook.metaData, expectedResult, 'metaData is not correctly loaded');
    assert.equal(hook.cache, true, 'cache is not true by default');
  });
});

describe('getParcelAssets()', function() {
  it('should return the right url', function () {
    var expectedResult =  {
      "script": [
        "123/page1_bundle.js"
      ],
      "style": [
        "123/page1_bundle.css"
      ],
      "image": []
    };

    var hook = new Hook(__dirname + '/fixtures/assets1');
    var result = hook.getParcelAssets('pages/page1');
    assert.deepEqual(result, expectedResult);
  });

  it('should set this.cache=false if options.cache=false', function () {
    var expectedResult =  {
      "script": [
        "123/page1_bundle.js"
      ],
      "style": [
        "123/page1_bundle.css"
      ],
      "image": []
    };

    var hook = new Hook(__dirname + '/fixtures/assets1', {cache: false});

    this.metaData = {};

    var result = hook.getParcelAssets('pages/page1');
    assert.deepEqual(result, expectedResult);
  });

  it('should set this.cache=true if options.cache=true', function () {
    var hook = new Hook(__dirname + '/fixtures/assets1', {cache: true});

    hook.metaData = {
      packageMap: {
        'pages/page1': {}
      }
    };

    var result = hook.getParcelAssets('pages/page1');
    assert.deepEqual(result, {});
  });

});


text:
<?php
namespace HylianShield\Validator;

interface ValidatorCollectionInterface extends ValidatorInterface
{
    /**
     * Add the given validator to the collection.
     *
     * @param ValidatorInterface $validator
     * @return ValidatorCollectionInterface
     */
    public function addValidator(
        ValidatorInterface $validator
    ): ValidatorCollectionInterface;

    /**
     * Remove the given validator from the collection.
     *
     * @param ValidatorInterface $validator
     * @return ValidatorCollectionInterface
     */
    public function removeValidator(
        ValidatorInterface $validator
    ): ValidatorCollectionInterface;
}