text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/automl/v1/text_segment.proto

namespace GPBMetadata\Google\Cloud\Automl\V1;

class TextSegment
{
    public static $is_initialized = false;

    public static function initOnce() {
        $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();

        if (static::$is_initialized == true) {
          return;
        }
        $pool->internalAddGeneratedFile(
            '
Ô
)google/cloud/automl/v1/text_segment.protogoogle.cloud.automl.v1"H
TextSegment
content (
start_offset (

end_offset (B¼
com.google.cloud.automl.v1BTextSegmentProtoPZ<google.golang.org/genproto/googleapis/cloud/automl/v1;automlªGoogle.Cloud.AutoML.V1ÊGoogle\\Cloud\\AutoMl\\V1êGoogle::Cloud::AutoML::V1bproto3'
        , true);

        static::$is_initialized = true;
    }
}


text:
 {{"COMMON.LOADING" | translate}}

        {{board.name}}

        {{"COMMON.REFRESH" | translate}}

        <ng-switch on="row.type">

                                        <button type="button" class="btn btn-default btn-sm">
                                            {{param.name}}
                                        </button>
                                        <button type="button" class="btn btn-default btn-sm dropdown-toggle"
                                                ng-click="editParam(param)">

                                        </button>

                    <dashboard-widget ng-if="widget.show"></dashboard-widget>

                         {{"COMMON.LOADING" | translate}}

{{widget.name}}

                                    <button type="button" class="btn btn-box-tool" data-widget="collapse">
                                    </button>

                                {{'ADMIN.CONTACT_ADMIN' | translate}}:

 {{ri.type | translate}}:{{ri.name}}

        </ng-switch>

redpajama_set_name: RedPajamaGithub


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model mi\modules\credit\models\MiConfigSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'id') ?>

    <?= $form->field($model, 'sitetitle') ?>

    <?= $form->field($model, 'sitetitle2') ?>

    <?= $form->field($model, 'sitedescription') ?>

    <?= $form->field($model, 'siteurl') ?>

    <?php // echo $form->field($model, 'sitekeywords') ?>

    <?php // echo $form->field($model, 'sitetcp') ?>

    <?php // echo $form->field($model, 'sitelx') ?>

    <?php // echo $form->field($model, 'sitelogo') ?>

    <?php // echo $form->field($model, 'pingoff') ?>

    <?php // echo $form->field($model, 'postovertime') ?>

    <?php // echo $form->field($model, 'bookoff') ?>

    <?php // echo $form->field($model, 'mood') ?>

    <?php // echo $form->field($model, 'ishits') ?>

    <?php // echo $form->field($model, 'iscopyfrom') ?>

    <?php // echo $form->field($model, 'isauthor') ?>

    <?php // echo $form->field($model, 'artlistnum') ?>

        <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
const should = require('should');
const sinon = require('sinon');
const settingsCache = require('../../../../../core/shared/settings-cache');
const controllers = require('../../../../../core/frontend/services/routing/controllers');
const TaxonomyRouter = require('../../../../../core/frontend/services/routing/TaxonomyRouter');

const RESOURCE_CONFIG = require('../../../../../core/frontend/services/routing/config');

describe('UNIT - services/routing/TaxonomyRouter', function () {
    let req;
    let res;
    let next;
    let routerCreatedSpy;

    beforeEach(function () {
        sinon.stub(settingsCache, 'get').withArgs('permalinks').returns('/:slug/');

        routerCreatedSpy = sinon.spy();

        sinon.spy(TaxonomyRouter.prototype, 'mountRoute');
        sinon.spy(TaxonomyRouter.prototype, 'mountRouter');

        req = sinon.stub();
        res = sinon.stub();
        next = sinon.stub();

        res.locals = {};
    });

    afterEach(function () {
        sinon.restore();
    });

    it('instantiate', function () {
        const taxonomyRouter = new TaxonomyRouter('tag', '/tag/:slug/', {}, routerCreatedSpy);

        should.exist(taxonomyRouter.router);
        should.exist(taxonomyRouter.rssRouter);

        taxonomyRouter.taxonomyKey.should.eql('tag');
        taxonomyRouter.getPermalinks().getValue().should.eql('/tag/:slug/');

        routerCreatedSpy.calledOnce.should.be.true();
        routerCreatedSpy.calledWith(taxonomyRouter).should.be.true();

        taxonomyRouter.mountRouter.callCount.should.eql(1);
        taxonomyRouter.mountRouter.args[0][0].should.eql('/tag/:slug/');
        taxonomyRouter.mountRouter.args[0][1].should.eql(taxonomyRouter.rssRouter.router());

        taxonomyRouter.mountRoute.callCount.should.eql(3);

        // permalink route
        taxonomyRouter.mountRoute.args[0][0].should.eql('/tag/:slug/');
        taxonomyRouter.mountRoute.args[0][1].should.eql(controllers.channel);

        // pagination feature
        taxonomyRouter.mountRoute.args[1][0].should.eql('/tag/:slug/page/:page(\\d+)');
        taxonomyRouter.mountRoute.args[1][1].should.eql(controllers.channel);

        // edit feature
        taxonomyRouter.mountRoute.args[2][0].should.eql('/tag/:slug/edit');
        taxonomyRouter.mountRoute.args[2][1].should.eql(taxonomyRouter._redirectEditOption.bind(taxonomyRouter));
    });

    it('_prepareContext behaves as expected', function () {
        const taxonomyRouter = new TaxonomyRouter('tag', '/tag/:slug/', RESOURCE_CONFIG, routerCreatedSpy);
        taxonomyRouter._prepareContext(req, res, next);
        next.calledOnce.should.eql(true);

        res.routerOptions.should.eql({
            type: 'channel',
            name: 'tag',
            permalinks: '/tag/:slug/',
            resourceType: RESOURCE_CONFIG.QUERY.tag.resource,
            data: {tag: RESOURCE_CONFIG.QUERY.tag},
            filter: RESOURCE_CONFIG.TAXONOMIES.tag.filter,
            context: ['tag'],
            slugTemplate: true,
            identifier: taxonomyRouter.identifier
        });
    });
});


text:
/******************************************************************************
 *
 * Name: acdebug.h - ACPI/AML debugger
 *
 *****************************************************************************/

/******************************************************************************
 *
 * 1. Copyright Notice
 *
 * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp.
 * All rights reserved.
 *
 * 2. License
 *
 * 2.1. This is your license from Intel Corp. under its intellectual property
 * rights. You may have additional license terms from the party that provided
 * you this software, covering your right to use that party's intellectual
 * property rights.
 *
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
 * copy of the source code appearing in this file ("Covered Code") an
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
 * base code distributed originally by Intel ("Original Intel Code") to copy,
 * make derivatives, distribute, use and display any portion of the Covered
 * Code in any form, with the right to sublicense such rights; and
 *
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
 * license (with the right to sublicense), under only those claims of Intel
 * patents that are infringed by the Original Intel Code, to make, use, sell,
 * offer to sell, and import the Covered Code and derivative works thereof
 * solely to the minimum extent necessary to exercise the above copyright
 * license, and in no event shall the patent license extend to any additions
 * to or modifications of the Original Intel Code. No other license or right
 * is granted directly or by implication, estoppel or otherwise;
 *
 * The above copyright and patent license is granted only if the following
 * conditions are met:
 *
 * 3. Conditions
 *
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification with rights to further distribute source must include
 * the above Copyright Notice, the above License, this list of Conditions,
 * and the following Disclaimer and Export Compliance provision. In addition,
 * Licensee must cause all Covered Code to which Licensee contributes to
 * contain a file documenting the changes Licensee made to create that Covered
 * Code and the date of any change. Licensee must include in that file the
 * documentation of any changes made by any predecessor Licensee. Licensee
 * must include a prominent statement that the modification is derived,
 * directly or indirectly, from Original Intel Code.
 *
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification without rights to further distribute source must
 * include the following Disclaimer and Export Compliance provision in the
 * documentation and/or other materials provided with distribution. In
 * addition, Licensee may not authorize further sublicense of source of any
 * portion of the Covered Code, and must include terms to the effect that the
 * license from Licensee to its licensee is limited to the intellectual
 * property embodied in the software Licensee provides to its licensee, and
 * not to intellectual property embodied in modifications its licensee may
 * make.
 *
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
 * substantial portion of the Covered Code or modification must reproduce the
 * above Copyright Notice, and the following Disclaimer and Export Compliance
 * provision in the documentation and/or other materials provided with the
 * distribution.
 *
 * 3.4. Intel retains all right, title, and interest in and to the Original
 * Intel Code.
 *
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
 * Intel shall be used in advertising or otherwise to promote the sale, use or
 * other dealings in products derived from or relating to the Covered Code
 * without prior written authorization from Intel.
 *
 * 4. Disclaimer and Export Compliance
 *
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE.
 *
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
 * LIMITED REMEDY.
 *
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
 * software or system incorporating such software without first obtaining any
 * required license or other approval from the U. S. Department of Commerce or
 * any other agency or department of the United States Government. In the
 * event Licensee exports any such software from the United States or
 * re-exports any such software from a foreign destination, Licensee shall
 * ensure that the distribution and export/re-export of the software is in
 * compliance with all laws, regulations, orders, or other restrictions of the
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
 * any of its subsidiaries will export/re-export any technical data, process,
 * software, or service, directly or indirectly, to any country for which the
 * United States government or any agency thereof requires an export license,
 * other governmental approval, or letter of assurance, without first obtaining
 * such license, approval or letter.
 *
 *****************************************************************************
 *
 * Alternatively, you may choose to be licensed under the terms of the
 * following license:
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Alternatively, you may choose to be licensed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 *****************************************************************************/

#ifndef __ACDEBUG_H__
#define __ACDEBUG_H__

/* The debugger is used in conjunction with the disassembler most of time */

#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
#endif

#define ACPI_DEBUG_BUFFER_SIZE      0x4000      /* 16K buffer for return objects */
#define ACPI_DEBUG_LENGTH_FORMAT    " (%.4X bits, %.3X bytes)"

typedef struct acpi_db_command_info
{
    const char              *Name;          /* Command Name */
    UINT8                   MinArgs;        /* Minimum arguments required */

} ACPI_DB_COMMAND_INFO;

typedef struct acpi_db_command_help
{
    UINT8                   LineCount;      /* Number of help lines */
    char                    *Invocation;    /* Command Invocation */
    char                    *Description;   /* Command Description */

} ACPI_DB_COMMAND_HELP;

typedef struct acpi_db_argument_info
{
    const char              *Name;          /* Argument Name */

} ACPI_DB_ARGUMENT_INFO;

typedef struct acpi_db_execute_walk
{
    UINT32                  Count;
    UINT32                  MaxCount;

} ACPI_DB_EXECUTE_WALK;

#define PARAM_LIST(pl)                  pl

#define EX_NO_SINGLE_STEP               1
#define EX_SINGLE_STEP                  2

/*
 * dbxface - external debugger interfaces
 */
ACPI_DBR_DEPENDENT_RETURN_OK (
ACPI_STATUS
AcpiDbSingleStep (
    ACPI_WALK_STATE         *WalkState,
    ACPI_PARSE_OBJECT       *Op,
    UINT32                  OpType))

ACPI_DBR_DEPENDENT_RETURN_VOID (
void
AcpiDbSignalBreakPoint (
    ACPI_WALK_STATE         *WalkState))

/*
 * dbcmds - debug commands and output routines
 */
ACPI_NAMESPACE_NODE *
AcpiDbConvertToNode (
    char                    *InString);

void
AcpiDbDisplayTableInfo (
    char                    *TableArg);

void
AcpiDbDisplayTemplate (
    char                    *BufferArg);

void
AcpiDbUnloadAcpiTable (
    char                    *Name);

void
AcpiDbSendNotify (
    char                    *Name,
    UINT32                  Value);

void
AcpiDbDisplayInterfaces (
    char                    *ActionArg,
    char                    *InterfaceNameArg);

ACPI_STATUS
AcpiDbSleep (
    char                    *ObjectArg);

void
AcpiDbTrace (
    char                    *EnableArg,
    char                    *MethodArg,
    char                    *OnceArg);

void
AcpiDbDisplayLocks (
    void);

void
AcpiDbDisplayResources (
    char                    *ObjectArg);

ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiDbDisplayGpes (
    void))

void
AcpiDbDisplayHandlers (
    void);

ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiDbGenerateGpe (
    char                    *GpeArg,
    char                    *BlockArg))

ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiDbGenerateSci (
    void))

void
AcpiDbExecuteTest (
    char                    *TypeArg);

/*
 * dbconvert - miscellaneous conversion routines
 */
ACPI_STATUS
AcpiDbHexCharToValue (
    int                     HexChar,
    UINT8                   *ReturnValue);

ACPI_STATUS
AcpiDbConvertToPackage (
    char                    *String,
    ACPI_OBJECT             *Object);

ACPI_STATUS
AcpiDbConvertToObject (
    ACPI_OBJECT_TYPE        Type,
    char                    *String,
    ACPI_OBJECT             *Object);

UINT8 *
AcpiDbEncodePldBuffer (
    ACPI_PLD_INFO           *PldInfo);

void
AcpiDbDumpPldBuffer (
    ACPI_OBJECT             *ObjDesc);

/*
 * dbmethod - control method commands
 */
void
AcpiDbSetMethodBreakpoint (
    char                    *Location,
    ACPI_WALK_STATE         *WalkState,
    ACPI_PARSE_OBJECT       *Op);

void
AcpiDbSetMethodCallBreakpoint (
    ACPI_PARSE_OBJECT       *Op);

void
AcpiDbSetMethodData (
    char                    *TypeArg,
    char                    *IndexArg,
    char                    *ValueArg);

ACPI_STATUS
AcpiDbDisassembleMethod (
    char                    *Name);

void
AcpiDbDisassembleAml (
    char                    *Statements,
    ACPI_PARSE_OBJECT       *Op);

void
AcpiDbEvaluatePredefinedNames (
    void);

/*
 * dbnames - namespace commands
 */
void
AcpiDbSetScope (
    char                    *Name);

void
AcpiDbDumpNamespace (
    char                    *StartArg,
    char                    *DepthArg);

void
AcpiDbDumpNamespacePaths (
    void);

void
AcpiDbDumpNamespaceByOwner (
    char                    *OwnerArg,
    char                    *DepthArg);

ACPI_STATUS
AcpiDbFindNameInNamespace (
    char                    *NameArg);

void
AcpiDbCheckPredefinedNames (
    void);

ACPI_STATUS
AcpiDbDisplayObjects (
    char                    *ObjTypeArg,
    char                    *DisplayCountArg);

void
AcpiDbCheckIntegrity (
    void);

void
AcpiDbFindReferences (
    char                    *ObjectArg);

void
AcpiDbGetBusInfo (
    void);

ACPI_STATUS
AcpiDbDisplayFields (
    UINT32                  AddressSpaceId);

/*
 * dbdisply - debug display commands
 */
void
AcpiDbDisplayMethodInfo (
    ACPI_PARSE_OBJECT       *Op);

void
AcpiDbDecodeAndDisplayObject (
    char                    *Target,
    char                    *OutputType);

ACPI_DBR_DEPENDENT_RETURN_VOID (
void
AcpiDbDisplayResultObject (
    ACPI_OPERAND_OBJECT     *ObjDesc,
    ACPI_WALK_STATE         *WalkState))

ACPI_STATUS
AcpiDbDisplayAllMethods (
    char                    *DisplayCountArg);

void
AcpiDbDisplayArguments (
    void);

void
AcpiDbDisplayLocals (
    void);

void
AcpiDbDisplayResults (
    void);

void
AcpiDbDisplayCallingTree (
    void);

void
AcpiDbDisplayObjectType (
    char                    *ObjectArg);

ACPI_DBR_DEPENDENT_RETURN_VOID (
void
AcpiDbDisplayArgumentObject (
    ACPI_OPERAND_OBJECT     *ObjDesc,
    ACPI_WALK_STATE         *WalkState))

/*
 * dbexec - debugger control method execution
 */
void
AcpiDbExecute (
    char                    *Name,
    char                    **Args,
    ACPI_OBJECT_TYPE        *Types,
    UINT32                  Flags);

void
AcpiDbCreateExecutionThread (
    char                    *MethodNameArg,
    char                    **Arguments,
    ACPI_OBJECT_TYPE        *Types);

void
AcpiDbCreateExecutionThreads (
    char                    *NumThreadsArg,
    char                    *NumLoopsArg,
    char                    *MethodNameArg);

void
AcpiDbDeleteObjects (
    UINT32                  Count,
    ACPI_OBJECT             *Objects);

#ifdef ACPI_DBG_TRACK_ALLOCATIONS
UINT32
AcpiDbGetCacheInfo (
    ACPI_MEMORY_LIST        *Cache);
#endif

/*
 * dbfileio - Debugger file I/O commands
 */
ACPI_OBJECT_TYPE
AcpiDbMatchArgument (
    char                    *UserArgument,
    ACPI_DB_ARGUMENT_INFO   *Arguments);

void
AcpiDbCloseDebugFile (
    void);

void
AcpiDbOpenDebugFile (
    char                    *Name);

ACPI_STATUS
AcpiDbLoadAcpiTable (
    char                    *Filename);

ACPI_STATUS
AcpiDbLoadTables (
    ACPI_NEW_TABLE_DESC     *ListHead);

/*
 * dbhistry - debugger HISTORY command
 */
void
AcpiDbAddToHistory (
    char                    *CommandLine);

void
AcpiDbDisplayHistory (
    void);

char *
AcpiDbGetFromHistory (
    char                    *CommandNumArg);

char *
AcpiDbGetHistoryByIndex (
    UINT32                  CommanddNum);

/*
 * dbinput - user front-end to the AML debugger
 */
ACPI_STATUS
AcpiDbCommandDispatch (
    char                    *InputBuffer,
    ACPI_WALK_STATE         *WalkState,
    ACPI_PARSE_OBJECT       *Op);

void ACPI_SYSTEM_XFACE
AcpiDbExecuteThread (
    void                    *Context);

ACPI_STATUS
AcpiDbUserCommands (
    void);

char *
AcpiDbGetNextToken (
    char                    *String,
    char                    **Next,
    ACPI_OBJECT_TYPE        *ReturnType);

/*
 * dbobject
 */
void
AcpiDbDecodeInternalObject (
    ACPI_OPERAND_OBJECT     *ObjDesc);

void
AcpiDbDisplayInternalObject (
    ACPI_OPERAND_OBJECT     *ObjDesc,
    ACPI_WALK_STATE         *WalkState);

void
AcpiDbDecodeArguments (
    ACPI_WALK_STATE         *WalkState);

void
AcpiDbDecodeLocals (
    ACPI_WALK_STATE         *WalkState);

void
AcpiDbDumpMethodInfo (
    ACPI_STATUS             Status,
    ACPI_WALK_STATE         *WalkState);

/*
 * dbstats - Generation and display of ACPI table statistics
 */
void
AcpiDbGenerateStatistics (
    ACPI_PARSE_OBJECT       *Root,
    BOOLEAN                 IsMethod);

ACPI_STATUS
AcpiDbDisplayStatistics (
    char                    *TypeArg);

/*
 * dbutils - AML debugger utilities
 */
void
AcpiDbSetOutputDestination (
    UINT32                  Where);

void
AcpiDbDumpExternalObject (
    ACPI_OBJECT             *ObjDesc,
    UINT32                  Level);

void
AcpiDbPrepNamestring (
    char                    *Name);

ACPI_NAMESPACE_NODE *
AcpiDbLocalNsLookup (
    char                    *Name);

void
AcpiDbUint32ToHexString (
    UINT32                  Value,
    char                    *Buffer);

#endif  /* __ACDEBUG_H__ */


text:
import {
    CachedReceipt,
    MAIN_ROOM_TIMELINE,
    Receipt,
    ReceiptCache,
    Receipts,
    ReceiptType,
    WrappedReceipt,
} from "../@types/read_receipts";
import { ListenerMap, TypedEventEmitter } from "./typed-event-emitter";
import * as utils from "../utils";
import { MatrixEvent } from "./event";
import { EventType } from "../@types/event";
import { EventTimelineSet } from "./event-timeline-set";

export function synthesizeReceipt(userId: string, event: MatrixEvent, receiptType: ReceiptType): MatrixEvent {
    return new MatrixEvent({
        content: {
            [event.getId()!]: {
                [receiptType]: {
                    [userId]: {
                        ts: event.getTs(),
                        threadId: event.threadRootId ?? MAIN_ROOM_TIMELINE,
                    },
                },
            },
        },
        type: EventType.Receipt,
        room_id: event.getRoomId(),
    });
}

const ReceiptPairRealIndex = 0;
const ReceiptPairSyntheticIndex = 1;

export abstract class ReadReceipt<
    Events extends string,
    Arguments extends ListenerMap<Events>,
    SuperclassArguments extends ListenerMap<any> = Arguments,
> extends TypedEventEmitter<Events, Arguments, SuperclassArguments> {
    // receipts should clobber based on receipt_type and user_id pairs hence
    // the form of this structure. This is sub-optimal for the exposed APIs
    // which pass in an event ID and get back some receipts, so we also store
    // a pre-cached list for this purpose.
    private receipts: Receipts = {}; // { receipt_type: { user_id: Receipt } }
    private receiptCacheByEventId: ReceiptCache = {}; // { event_id: CachedReceipt[] }

    public abstract getUnfilteredTimelineSet(): EventTimelineSet;
    public abstract timeline: MatrixEvent[];

    /**
     * Gets the latest receipt for a given user in the room
     * @param userId The id of the user for which we want the receipt
     * @param ignoreSynthesized Whether to ignore synthesized receipts or not
     * @param receiptType Optional. The type of the receipt we want to get
     * @returns the latest receipts of the chosen type for the chosen user
     */
    public getReadReceiptForUserId(
        userId: string, ignoreSynthesized = false, receiptType = ReceiptType.Read,
    ): WrappedReceipt | null {
        const [realReceipt, syntheticReceipt] = this.receipts[receiptType]?.[userId] ?? [];
        if (ignoreSynthesized) {
            return realReceipt;
        }

        return syntheticReceipt ?? realReceipt;
    }

    /**
     * Get the ID of the event that a given user has read up to, or null if we
     * have received no read receipts from them.
     * @param {String} userId The user ID to get read receipt event ID for
     * @param {Boolean} ignoreSynthesized If true, return only receipts that have been
     *                                    sent by the server, not implicit ones generated
     *                                    by the JS SDK.
     * @return {String} ID of the latest event that the given user has read, or null.
     */
    public getEventReadUpTo(userId: string, ignoreSynthesized = false): string | null {
        // XXX: This is very very ugly and I hope I won't have to ever add a new
        // receipt type here again. IMHO this should be done by the server in
        // some more intelligent manner or the client should just use timestamps

        const timelineSet = this.getUnfilteredTimelineSet();
        const publicReadReceipt = this.getReadReceiptForUserId(userId, ignoreSynthesized, ReceiptType.Read);
        const privateReadReceipt = this.getReadReceiptForUserId(userId, ignoreSynthesized, ReceiptType.ReadPrivate);

        // If we have both, compare them
        let comparison: number | null | undefined;
        if (publicReadReceipt?.eventId && privateReadReceipt?.eventId) {
            comparison = timelineSet.compareEventOrdering(publicReadReceipt?.eventId, privateReadReceipt?.eventId);
        }

        // If we didn't get a comparison try to compare the ts of the receipts
        if (!comparison && publicReadReceipt?.data?.ts && privateReadReceipt?.data?.ts) {
            comparison = publicReadReceipt?.data?.ts - privateReadReceipt?.data?.ts;
        }

        // The public receipt is more likely to drift out of date so the private
        // one has precedence
        if (!comparison) return privateReadReceipt?.eventId ?? publicReadReceipt?.eventId ?? null;

        // If public read receipt is older, return the private one
        return ((comparison < 0) ? privateReadReceipt?.eventId : publicReadReceipt?.eventId) ?? null;
    }

    public addReceiptToStructure(
        eventId: string,
        receiptType: ReceiptType,
        userId: string,
        receipt: Receipt,
        synthetic: boolean,
    ): void {
        if (!this.receipts[receiptType]) {
            this.receipts[receiptType] = {};
        }
        if (!this.receipts[receiptType][userId]) {
            this.receipts[receiptType][userId] = [null, null];
        }

        const pair = this.receipts[receiptType][userId];

        let existingReceipt = pair[ReceiptPairRealIndex];
        if (synthetic) {
            existingReceipt = pair[ReceiptPairSyntheticIndex] ?? pair[ReceiptPairRealIndex];
        }

        if (existingReceipt) {
            // we only want to add this receipt if we think it is later than the one we already have.
            // This is managed server-side, but because we synthesize RRs locally we have to do it here too.
            const ordering = this.getUnfilteredTimelineSet().compareEventOrdering(
                existingReceipt.eventId,
                eventId,
            );
            if (ordering !== null && ordering >= 0) {
                return;
            }
        }

        const wrappedReceipt: WrappedReceipt = {
            eventId,
            data: receipt,
        };

        const realReceipt = synthetic ? pair[ReceiptPairRealIndex] : wrappedReceipt;
        const syntheticReceipt = synthetic ? wrappedReceipt : pair[ReceiptPairSyntheticIndex];

        let ordering: number | null = null;
        if (realReceipt && syntheticReceipt) {
            ordering = this.getUnfilteredTimelineSet().compareEventOrdering(
                realReceipt.eventId,
                syntheticReceipt.eventId,
            );
        }

        const preferSynthetic = ordering === null || ordering < 0;

        // we don't bother caching just real receipts by event ID as there's nothing that would read it.
        // Take the current cached receipt before we overwrite the pair elements.
        const cachedReceipt = pair[ReceiptPairSyntheticIndex] ?? pair[ReceiptPairRealIndex];

        if (synthetic && preferSynthetic) {
            pair[ReceiptPairSyntheticIndex] = wrappedReceipt;
        } else if (!synthetic) {
            pair[ReceiptPairRealIndex] = wrappedReceipt;

            if (!preferSynthetic) {
                pair[ReceiptPairSyntheticIndex] = null;
            }
        }

        const newCachedReceipt = pair[ReceiptPairSyntheticIndex] ?? pair[ReceiptPairRealIndex];
        if (cachedReceipt === newCachedReceipt) return;

        // clean up any previous cache entry
        if (cachedReceipt && this.receiptCacheByEventId[cachedReceipt.eventId]) {
            const previousEventId = cachedReceipt.eventId;
            // Remove the receipt we're about to clobber out of existence from the cache
            this.receiptCacheByEventId[previousEventId] = (
                this.receiptCacheByEventId[previousEventId].filter(r => {
                    return r.type !== receiptType || r.userId !== userId;
                })
            );

            if (this.receiptCacheByEventId[previousEventId].length < 1) {
                delete this.receiptCacheByEventId[previousEventId]; // clean up the cache keys
            }
        }

        // cache the new one
        if (!this.receiptCacheByEventId[eventId]) {
            this.receiptCacheByEventId[eventId] = [];
        }
        this.receiptCacheByEventId[eventId].push({
            userId: userId,
            type: receiptType as ReceiptType,
            data: receipt,
        });
    }

    /**
     * Get a list of receipts for the given event.
     * @param {MatrixEvent} event the event to get receipts for
     * @return {Object[]} A list of receipts with a userId, type and data keys or
     * an empty list.
     */
    public getReceiptsForEvent(event: MatrixEvent): CachedReceipt[] {
        return this.receiptCacheByEventId[event.getId()!] || [];
    }

    public abstract addReceipt(event: MatrixEvent, synthetic: boolean): void;

    /**
     * Add a temporary local-echo receipt to the room to reflect in the
     * client the fact that we've sent one.
     * @param {string} userId The user ID if the receipt sender
     * @param {MatrixEvent} e The event that is to be acknowledged
     * @param {ReceiptType} receiptType The type of receipt
     */
    public addLocalEchoReceipt(userId: string, e: MatrixEvent, receiptType: ReceiptType): void {
        this.addReceipt(synthesizeReceipt(userId, e, receiptType), true);
    }

    /**
     * Get a list of user IDs who have <b>read up to</b> the given event.
     * @param {MatrixEvent} event the event to get read receipts for.
     * @return {String[]} A list of user IDs.
     */
    public getUsersReadUpTo(event: MatrixEvent): string[] {
        return this.getReceiptsForEvent(event).filter(function(receipt) {
            return utils.isSupportedReceiptType(receipt.type);
        }).map(function(receipt) {
            return receipt.userId;
        });
    }

    /**
     * Determines if the given user has read a particular event ID with the known
     * history of the room. This is not a definitive check as it relies only on
     * what is available to the room at the time of execution.
     * @param {String} userId The user ID to check the read state of.
     * @param {String} eventId The event ID to check if the user read.
     * @returns {Boolean} True if the user has read the event, false otherwise.
     */
    public hasUserReadEvent(userId: string, eventId: string): boolean {
        const readUpToId = this.getEventReadUpTo(userId, false);
        if (readUpToId === eventId) return true;

        if (this.timeline?.length
            && this.timeline[this.timeline.length - 1].getSender()
            && this.timeline[this.timeline.length - 1].getSender() === userId) {
            // It doesn't matter where the event is in the timeline, the user has read
            // it because they've sent the latest event.
            return true;
        }

        for (let i = this.timeline?.length - 1; i >= 0; --i) {
            const ev = this.timeline[i];

            // If we encounter the target event first, the user hasn't read it
            // however if we encounter the readUpToId first then the user has read
            // it. These rules apply because we're iterating bottom-up.
            if (ev.getId() === eventId) return false;
            if (ev.getId() === readUpToId) return true;
        }

        // We don't know if the user has read it, so assume not.
        return false;
    }
}


text:
import * as protos from '../protos/protos';
import * as assert from 'assert';
import * as sinon from 'sinon';
import {SinonStub} from 'sinon';
import {describe, it} from 'mocha';
import * as applicationsModule from '../src';

import {protobuf, LROperation, operationsProtos} from 'google-gax';

// Dynamically loaded proto JSON is needed to get the type information
// to fill in default values for request objects
const root = protobuf.Root.fromJSON(
  require('../protos/protos.json')
).resolveAll();

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function getTypeDefaultValue(typeName: string, fields: string[]) {
  let type = root.lookupType(typeName) as protobuf.Type;
  for (const field of fields.slice(0, -1)) {
    type = type.fields[field]?.resolvedType as protobuf.Type;
  }
  return type.fields[fields[fields.length - 1]]?.defaultValue;
}

function generateSampleMessage<T extends object>(instance: T) {
  const filledObject = (
    instance.constructor as typeof protobuf.Message
  ).toObject(instance as protobuf.Message<T>, {defaults: true});
  return (instance.constructor as typeof protobuf.Message).fromObject(
    filledObject
  ) as T;
}

function stubSimpleCall<ResponseType>(response?: ResponseType, error?: Error) {
  return error
    ? sinon.stub().rejects(error)
    : sinon.stub().resolves([response]);
}

function stubSimpleCallWithCallback<ResponseType>(
  response?: ResponseType,
  error?: Error
) {
  return error
    ? sinon.stub().callsArgWith(2, error)
    : sinon.stub().callsArgWith(2, null, response);
}

function stubLongRunningCall<ResponseType>(
  response?: ResponseType,
  callError?: Error,
  lroError?: Error
) {
  const innerStub = lroError
    ? sinon.stub().rejects(lroError)
    : sinon.stub().resolves([response]);
  const mockOperation = {
    promise: innerStub,
  };
  return callError
    ? sinon.stub().rejects(callError)
    : sinon.stub().resolves([mockOperation]);
}

function stubLongRunningCallWithCallback<ResponseType>(
  response?: ResponseType,
  callError?: Error,
  lroError?: Error
) {
  const innerStub = lroError
    ? sinon.stub().rejects(lroError)
    : sinon.stub().resolves([response]);
  const mockOperation = {
    promise: innerStub,
  };
  return callError
    ? sinon.stub().callsArgWith(2, callError)
    : sinon.stub().callsArgWith(2, null, mockOperation);
}

describe('v1.ApplicationsClient', () => {
  describe('Common methods', () => {
    it('has servicePath', () => {
      const servicePath = applicationsModule.v1.ApplicationsClient.servicePath;
      assert(servicePath);
    });

    it('has apiEndpoint', () => {
      const apiEndpoint = applicationsModule.v1.ApplicationsClient.apiEndpoint;
      assert(apiEndpoint);
    });

    it('has port', () => {
      const port = applicationsModule.v1.ApplicationsClient.port;
      assert(port);
      assert(typeof port === 'number');
    });

    it('should create a client with no option', () => {
      const client = new applicationsModule.v1.ApplicationsClient();
      assert(client);
    });

    it('should create a client with gRPC fallback', () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        fallback: true,
      });
      assert(client);
    });

    it('has initialize method and supports deferred initialization', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      assert.strictEqual(client.applicationsStub, undefined);
      await client.initialize();
      assert(client.applicationsStub);
    });

    it('has close method for the initialized client', done => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      assert(client.applicationsStub);
      client.close().then(() => {
        done();
      });
    });

    it('has close method for the non-initialized client', done => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      assert.strictEqual(client.applicationsStub, undefined);
      client.close().then(() => {
        done();
      });
    });

    it('has getProjectId method', async () => {
      const fakeProjectId = 'fake-project-id';
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.auth.getProjectId = sinon.stub().resolves(fakeProjectId);
      const result = await client.getProjectId();
      assert.strictEqual(result, fakeProjectId);
      assert((client.auth.getProjectId as SinonStub).calledWithExactly());
    });

    it('has getProjectId method with callback', async () => {
      const fakeProjectId = 'fake-project-id';
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.auth.getProjectId = sinon
        .stub()
        .callsArgWith(0, null, fakeProjectId);
      const promise = new Promise((resolve, reject) => {
        client.getProjectId((err?: Error | null, projectId?: string | null) => {
          if (err) {
            reject(err);
          } else {
            resolve(projectId);
          }
        });
      });
      const result = await promise;
      assert.strictEqual(result, fakeProjectId);
    });
  });

  describe('getApplication', () => {
    it('invokes getApplication without error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.GetApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.GetApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedResponse = generateSampleMessage(
        new protos.google.appengine.v1.Application()
      );
      client.innerApiCalls.getApplication = stubSimpleCall(expectedResponse);
      const [response] = await client.getApplication(request);
      assert.deepStrictEqual(response, expectedResponse);
      const actualRequest = (
        client.innerApiCalls.getApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.getApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes getApplication without error using callback', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.GetApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.GetApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedResponse = generateSampleMessage(
        new protos.google.appengine.v1.Application()
      );
      client.innerApiCalls.getApplication =
        stubSimpleCallWithCallback(expectedResponse);
      const promise = new Promise((resolve, reject) => {
        client.getApplication(
          request,
          (
            err?: Error | null,
            result?: protos.google.appengine.v1.IApplication | null
          ) => {
            if (err) {
              reject(err);
            } else {
              resolve(result);
            }
          }
        );
      });
      const response = await promise;
      assert.deepStrictEqual(response, expectedResponse);
      const actualRequest = (
        client.innerApiCalls.getApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.getApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes getApplication with error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.GetApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.GetApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedError = new Error('expected');
      client.innerApiCalls.getApplication = stubSimpleCall(
        undefined,
        expectedError
      );
      await assert.rejects(client.getApplication(request), expectedError);
      const actualRequest = (
        client.innerApiCalls.getApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.getApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes getApplication with closed client', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.GetApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.GetApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedError = new Error('The client has already been closed.');
      client.close();
      await assert.rejects(client.getApplication(request), expectedError);
    });
  });

  describe('createApplication', () => {
    it('invokes createApplication without error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.CreateApplicationRequest()
      );
      const expectedResponse = generateSampleMessage(
        new protos.google.longrunning.Operation()
      );
      client.innerApiCalls.createApplication =
        stubLongRunningCall(expectedResponse);
      const [operation] = await client.createApplication(request);
      const [response] = await operation.promise();
      assert.deepStrictEqual(response, expectedResponse);
    });

    it('invokes createApplication without error using callback', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.CreateApplicationRequest()
      );
      const expectedResponse = generateSampleMessage(
        new protos.google.longrunning.Operation()
      );
      client.innerApiCalls.createApplication =
        stubLongRunningCallWithCallback(expectedResponse);
      const promise = new Promise((resolve, reject) => {
        client.createApplication(
          request,
          (
            err?: Error | null,
            result?: LROperation<
              protos.google.appengine.v1.IApplication,
              protos.google.appengine.v1.IOperationMetadataV1
            > | null
          ) => {
            if (err) {
              reject(err);
            } else {
              resolve(result);
            }
          }
        );
      });
      const operation = (await promise) as LROperation<
        protos.google.appengine.v1.IApplication,
        protos.google.appengine.v1.IOperationMetadataV1
      >;
      const [response] = await operation.promise();
      assert.deepStrictEqual(response, expectedResponse);
    });

    it('invokes createApplication with call error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.CreateApplicationRequest()
      );
      const expectedError = new Error('expected');
      client.innerApiCalls.createApplication = stubLongRunningCall(
        undefined,
        expectedError
      );
      await assert.rejects(client.createApplication(request), expectedError);
    });

    it('invokes createApplication with LRO error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.CreateApplicationRequest()
      );
      const expectedError = new Error('expected');
      client.innerApiCalls.createApplication = stubLongRunningCall(
        undefined,
        undefined,
        expectedError
      );
      const [operation] = await client.createApplication(request);
      await assert.rejects(operation.promise(), expectedError);
    });

    it('invokes checkCreateApplicationProgress without error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const expectedResponse = generateSampleMessage(
        new operationsProtos.google.longrunning.Operation()
      );
      expectedResponse.name = 'test';
      expectedResponse.response = {type_url: 'url', value: Buffer.from('')};
      expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')};

      client.operationsClient.getOperation = stubSimpleCall(expectedResponse);
      const decodedOperation = await client.checkCreateApplicationProgress(
        expectedResponse.name
      );
      assert.deepStrictEqual(decodedOperation.name, expectedResponse.name);
      assert(decodedOperation.metadata);
      assert((client.operationsClient.getOperation as SinonStub).getCall(0));
    });

    it('invokes checkCreateApplicationProgress with error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const expectedError = new Error('expected');

      client.operationsClient.getOperation = stubSimpleCall(
        undefined,
        expectedError
      );
      await assert.rejects(
        client.checkCreateApplicationProgress(''),
        expectedError
      );
      assert((client.operationsClient.getOperation as SinonStub).getCall(0));
    });
  });

  describe('updateApplication', () => {
    it('invokes updateApplication without error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.UpdateApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.UpdateApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedResponse = generateSampleMessage(
        new protos.google.longrunning.Operation()
      );
      client.innerApiCalls.updateApplication =
        stubLongRunningCall(expectedResponse);
      const [operation] = await client.updateApplication(request);
      const [response] = await operation.promise();
      assert.deepStrictEqual(response, expectedResponse);
      const actualRequest = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes updateApplication without error using callback', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.UpdateApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.UpdateApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedResponse = generateSampleMessage(
        new protos.google.longrunning.Operation()
      );
      client.innerApiCalls.updateApplication =
        stubLongRunningCallWithCallback(expectedResponse);
      const promise = new Promise((resolve, reject) => {
        client.updateApplication(
          request,
          (
            err?: Error | null,
            result?: LROperation<
              protos.google.appengine.v1.IApplication,
              protos.google.appengine.v1.IOperationMetadataV1
            > | null
          ) => {
            if (err) {
              reject(err);
            } else {
              resolve(result);
            }
          }
        );
      });
      const operation = (await promise) as LROperation<
        protos.google.appengine.v1.IApplication,
        protos.google.appengine.v1.IOperationMetadataV1
      >;
      const [response] = await operation.promise();
      assert.deepStrictEqual(response, expectedResponse);
      const actualRequest = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes updateApplication with call error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.UpdateApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.UpdateApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedError = new Error('expected');
      client.innerApiCalls.updateApplication = stubLongRunningCall(
        undefined,
        expectedError
      );
      await assert.rejects(client.updateApplication(request), expectedError);
      const actualRequest = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes updateApplication with LRO error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.UpdateApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.UpdateApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedError = new Error('expected');
      client.innerApiCalls.updateApplication = stubLongRunningCall(
        undefined,
        undefined,
        expectedError
      );
      const [operation] = await client.updateApplication(request);
      await assert.rejects(operation.promise(), expectedError);
      const actualRequest = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.updateApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes checkUpdateApplicationProgress without error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const expectedResponse = generateSampleMessage(
        new operationsProtos.google.longrunning.Operation()
      );
      expectedResponse.name = 'test';
      expectedResponse.response = {type_url: 'url', value: Buffer.from('')};
      expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')};

      client.operationsClient.getOperation = stubSimpleCall(expectedResponse);
      const decodedOperation = await client.checkUpdateApplicationProgress(
        expectedResponse.name
      );
      assert.deepStrictEqual(decodedOperation.name, expectedResponse.name);
      assert(decodedOperation.metadata);
      assert((client.operationsClient.getOperation as SinonStub).getCall(0));
    });

    it('invokes checkUpdateApplicationProgress with error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const expectedError = new Error('expected');

      client.operationsClient.getOperation = stubSimpleCall(
        undefined,
        expectedError
      );
      await assert.rejects(
        client.checkUpdateApplicationProgress(''),
        expectedError
      );
      assert((client.operationsClient.getOperation as SinonStub).getCall(0));
    });
  });

  describe('repairApplication', () => {
    it('invokes repairApplication without error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.RepairApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.RepairApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedResponse = generateSampleMessage(
        new protos.google.longrunning.Operation()
      );
      client.innerApiCalls.repairApplication =
        stubLongRunningCall(expectedResponse);
      const [operation] = await client.repairApplication(request);
      const [response] = await operation.promise();
      assert.deepStrictEqual(response, expectedResponse);
      const actualRequest = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes repairApplication without error using callback', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.RepairApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.RepairApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedResponse = generateSampleMessage(
        new protos.google.longrunning.Operation()
      );
      client.innerApiCalls.repairApplication =
        stubLongRunningCallWithCallback(expectedResponse);
      const promise = new Promise((resolve, reject) => {
        client.repairApplication(
          request,
          (
            err?: Error | null,
            result?: LROperation<
              protos.google.appengine.v1.IApplication,
              protos.google.appengine.v1.IOperationMetadataV1
            > | null
          ) => {
            if (err) {
              reject(err);
            } else {
              resolve(result);
            }
          }
        );
      });
      const operation = (await promise) as LROperation<
        protos.google.appengine.v1.IApplication,
        protos.google.appengine.v1.IOperationMetadataV1
      >;
      const [response] = await operation.promise();
      assert.deepStrictEqual(response, expectedResponse);
      const actualRequest = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes repairApplication with call error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.RepairApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.RepairApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedError = new Error('expected');
      client.innerApiCalls.repairApplication = stubLongRunningCall(
        undefined,
        expectedError
      );
      await assert.rejects(client.repairApplication(request), expectedError);
      const actualRequest = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes repairApplication with LRO error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const request = generateSampleMessage(
        new protos.google.appengine.v1.RepairApplicationRequest()
      );
      const defaultValue1 = getTypeDefaultValue(
        '.google.appengine.v1.RepairApplicationRequest',
        ['name']
      );
      request.name = defaultValue1;
      const expectedHeaderRequestParams = `name=${defaultValue1}`;
      const expectedError = new Error('expected');
      client.innerApiCalls.repairApplication = stubLongRunningCall(
        undefined,
        undefined,
        expectedError
      );
      const [operation] = await client.repairApplication(request);
      await assert.rejects(operation.promise(), expectedError);
      const actualRequest = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[0];
      assert.deepStrictEqual(actualRequest, request);
      const actualHeaderRequestParams = (
        client.innerApiCalls.repairApplication as SinonStub
      ).getCall(0).args[1].otherArgs.headers['x-goog-request-params'];
      assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams));
    });

    it('invokes checkRepairApplicationProgress without error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const expectedResponse = generateSampleMessage(
        new operationsProtos.google.longrunning.Operation()
      );
      expectedResponse.name = 'test';
      expectedResponse.response = {type_url: 'url', value: Buffer.from('')};
      expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')};

      client.operationsClient.getOperation = stubSimpleCall(expectedResponse);
      const decodedOperation = await client.checkRepairApplicationProgress(
        expectedResponse.name
      );
      assert.deepStrictEqual(decodedOperation.name, expectedResponse.name);
      assert(decodedOperation.metadata);
      assert((client.operationsClient.getOperation as SinonStub).getCall(0));
    });

    it('invokes checkRepairApplicationProgress with error', async () => {
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      const expectedError = new Error('expected');

      client.operationsClient.getOperation = stubSimpleCall(
        undefined,
        expectedError
      );
      await assert.rejects(
        client.checkRepairApplicationProgress(''),
        expectedError
      );
      assert((client.operationsClient.getOperation as SinonStub).getCall(0));
    });
  });

  describe('Path templates', () => {
    describe('instance', () => {
      const fakePath = '/rendered/path/instance';
      const expectedParameters = {
        app: 'appValue',
        service: 'serviceValue',
        version: 'versionValue',
        instance: 'instanceValue',
      };
      const client = new applicationsModule.v1.ApplicationsClient({
        credentials: {client_email: 'bogus', private_key: 'bogus'},
        projectId: 'bogus',
      });
      client.initialize();
      client.pathTemplates.instancePathTemplate.render = sinon
        .stub()
        .returns(fakePath);
      client.pathTemplates.instancePathTemplate.match = sinon
        .stub()
        .returns(expectedParameters);

      it('instancePath', () => {
        const result = client.instancePath(
          'appValue',
          'serviceValue',
          'versionValue',
          'instanceValue'
        );
        assert.strictEqual(result, fakePath);
        assert(
          (client.pathTemplates.instancePathTemplate.render as SinonStub)
            .getCall(-1)
            .calledWith(expectedParameters)
        );
      });

      it('matchAppFromInstanceName', () => {
        const result = client.matchAppFromInstanceName(fakePath);
        assert.strictEqual(result, 'appValue');
        assert(
          (client.pathTemplates.instancePathTemplate.match as SinonStub)
            .getCall(-1)
            .calledWith(fakePath)
        );
      });

      it('matchServiceFromInstanceName', () => {
        const result = client.matchServiceFromInstanceName(fakePath);
        assert.strictEqual(result, 'serviceValue');
        assert(
          (client.pathTemplates.instancePathTemplate.match as SinonStub)
            .getCall(-1)
            .calledWith(fakePath)
        );
      });

      it('matchVersionFromInstanceName', () => {
        const result = client.matchVersionFromInstanceName(fakePath);
        assert.strictEqual(result, 'versionValue');
        assert(
          (client.pathTemplates.instancePathTemplate.match as SinonStub)
            .getCall(-1)
            .calledWith(fakePath)
        );
      });

      it('matchInstanceFromInstanceName', () => {
        const result = client.matchInstanceFromInstanceName(fakePath);
        assert.strictEqual(result, 'instanceValue');
        assert(
          (client.pathTemplates.instancePathTemplate.match as SinonStub)
            .getCall(-1)
            .calledWith(fakePath)
        );
      });
    });
  });
});


text:
<?xml version="1.0"?>
<doc>
<assembly>
<name>
GRCRestarter
</name>
</assembly>
<members>
<member name="P:GRCRestarter.My.Resources.Resources.ResourceManager">
	<summary>
  Returns the cached ResourceManager instance used by this class.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.Culture">
	<summary>
  Overrides the current thread's CurrentUICulture property for all
  resource lookups using this strongly typed resource class.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.gradient75">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.gradient751">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.gradient752">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.GradientB">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.gradientmiddle">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.GradientU">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="P:GRCRestarter.My.Resources.Resources.gridcoin_horizontal">
	<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member><member name="T:GRCRestarter.My.Resources.Resources">
	<summary>
  A strongly-typed resource class, for looking up localized strings, etc.
</summary>
</member>
</members>
</doc>


text:
package testesUnitarios.modelo;

import entidade.Publicacao;
import java.time.Instant;
import java.util.Date;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

/**
 *
 * @author Izaquias
 */

public class TestePublicacao {

    @Rule
    public ExpectedException excecao = ExpectedException.none();

    @Test
    public void naoDevePermitirCriarPublicacaoComDescricaoNula(){
        excecao.expect(IllegalArgumentException.class);
        Date data = Date.from(Instant.now());
        new Publicacao("categoria x", "tal", data, null, "PENDENTE");
    }
    @Test
    public void naoDevePermitirCriarPublicacaoComDescricaoVazia(){
        excecao.expect(IllegalArgumentException.class);
        Date data = Date.from(Instant.now());
        new Publicacao("categoria x", "tal", data, "", "PENDENTE");
    }
    @Test
    public void naoDevePermitirCriarPublicacaoComLocalidadeNula(){
        excecao.expect(IllegalArgumentException.class);
        Date data = Date.from(Instant.now());
        new Publicacao("categoria x", null, data, "descrição x", "PENDENTE");
    }
    @Test
    public void naoDevePermitirCriarPublicacaoComLocalidadeVazia(){
        excecao.expect(IllegalArgumentException.class);
        Date data = Date.from(Instant.now());
        new Publicacao("categoria x", "", data, "descrição x", "PENDENTE");
    }
}


text:
class collectible : public Entity
{
public:
	collectible(std::string gfx, Map* map, float x, float y);
	void offset(float x, float y);
	bool Update(sf::RenderWindow* window);
protected:
	Map* map;
private:
	sf::Vector2f position;
};


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>In Missouri - n montano</title>
    <meta name="description" content="Stopped on an interminable trip through/from Iowa (connotations of false      Mason City emanate deep). Protestations regarding the need to stop, something s...">

    <link href='https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,400,900,400italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="/css/main.css">
    <link rel="canonical" href="http://erikradio.github.io/2015/06/In-Missouri">
    <link rel="alternate" type="application/rss+xml" title="n montano" href="http://erikradio.github.io/feed.xml">

        *

In Missouri

<time datetime="2015-06-11T00:00:00-05:00" itemprop="datePublished">Jun 11, 2015</time>

Stopped on an interminable trip through/from Iowa (connotations of false
      Mason City emanate deep). Protestations regarding the need to stop, something sinister. A
      shack, rain falling, grime. A game cycling back on itself. Basements, darkness.    Her generous ass paraded around the room. The only chance for freedom. A
      green, glowing square situated very significantly on her lower left cheek. He grabbed the
      laser gun and fired. Her ass was quick but finally impact. Like an ancient column, the green
      square cracked slowly working its way into the flesh. Green light dims, extinguished. Gently a
      flower placed in a perfectly circular crater where the disintegrated ass had fallen
      away.    A suburban house's garage where in front of a car's trunk where a
      mother collapses to her knees dead as Wagnerian strings soar. With his foot Montano pushes the
      corpse underneath the car, then kicks the villain with a snide grin to the audience, the work
      ends on a note of glorious resignation.

© erik radio 2016


text:
<?php

use yii\helpers\Html;
use yii\grid\GridView;

use app\models\general\GeneralLabel;
use app\models\general\GeneralMessage;
use common\models\general\GeneralFunction;

/* @var $this yii\web\View */
/* @var $searchModel frontend\models\PengurusanSajianMakanSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = GeneralLabel::pengurusan_sajian_makan;
$this->params['breadcrumbs'][] = $this->title;
?>

    <?php
        $template = '{view}';

        // Update Access
        if(isset(Yii::$app->user->identity->peranan_akses['MSN']['pengurusan-sajian-makan']['update'])){
            $template .= ' {update}';
        }

        // Delete Access
        if(isset(Yii::$app->user->identity->peranan_akses['MSN']['pengurusan-sajian-makan']['delete'])){
            $template .= ' {delete}';
        }
    ?>

<?= Html::encode($this->title) ?>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?php if(isset(Yii::$app->user->identity->peranan_akses['MSN']['pengurusan-sajian-makan']['create'])): ?>

            <?= Html::a(GeneralLabel::createTitle . ' ' . GeneralLabel::pengurusan_sajian_makan, ['create'], ['class' => 'btn btn-success']) ?>
            <?= Html::a(GeneralLabel::laporan_jadual_waktu_sajian_makanan_atlet, ['laporan-jadual-waktu-sajian-makanan-atlet'], ['class' => 'btn btn-primary', 'target' => '_blank']) ?>

    <?php endif; ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'pengurusan_sajian_makan_id',
            //'atlet_id',
            [
                'attribute' => 'atlet_id',
                'filterInputOptions' => [
                    'class'       => 'form-control',
                    'placeholder' => GeneralLabel::filter.' '.GeneralLabel::atlet_id,
                ],
                //'value' => 'refAtlet.name_penuh'
            ],
            [
                'attribute' => 'tarikh_mula',
                'filterInputOptions' => [
                    'class'       => 'form-control',
                    'placeholder' => GeneralLabel::filter.' '.GeneralLabel::tarikh_mula,
                ],
                 'value'=>function ($model) {
                    return GeneralFunction::convert($model->tarikh_mula, GeneralFunction::TYPE_DATE);
                },
            ],
            [
                'attribute' => 'tarikh_akhir',
                'filterInputOptions' => [
                    'class'       => 'form-control',
                    'placeholder' => GeneralLabel::filter.' '.GeneralLabel::tarikh_akhir,
                ],
                 'value'=>function ($model) {
                    return GeneralFunction::convert($model->tarikh_akhir, GeneralFunction::TYPE_DATE);
                },
            ],
            //'bilangan_tempahan_makan',

            //['class' => 'yii\grid\ActionColumn'],
            ['class' => 'yii\grid\ActionColumn',
                'buttons' => [
                    'delete' => function ($url, $model) {
                        return Html::a('', $url, [
                        'title' => Yii::t('yii', 'Delete'),
                        'data-confirm' => GeneralMessage::confirmDelete,
                        'data-method' => 'post',
                        ]);

                    },
                ],
                'template' => $template,
            ],
        ],
    ]); ?>


text:
package resources

import (
	"context"
	"fmt"

	"github.com/gravitational/trace"
	"k8s.io/apimachinery/pkg/api/meta"
	"k8s.io/apimachinery/pkg/runtime"
	ctrl "sigs.k8s.io/controller-runtime"
	kclient "sigs.k8s.io/controller-runtime/pkg/client"

	"github.com/gravitational/teleport/api/types"
	resourcesv2 "github.com/gravitational/teleport/operator/apis/resources/v2"
	"github.com/gravitational/teleport/operator/sidecar"
)

// TODO: Have the User controller to use the generic Teleport reconciler

// UserReconciler reconciles a TeleportUser object
type UserReconciler struct {
	kclient.Client
	Scheme                 *runtime.Scheme
	TeleportClientAccessor sidecar.ClientAccessor
}

//+kubebuilder:rbac:groups=resources.teleport.dev,resources=users,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=resources.teleport.dev,resources=users/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=resources.teleport.dev,resources=users/finalizers,verbs=update

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcile
func (r *UserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
	return ResourceBaseReconciler{
		Client:         r.Client,
		DeleteExternal: r.Delete,
		UpsertExternal: r.Upsert,
	}.Do(ctx, req, &resourcesv2.TeleportUser{})
}

// SetupWithManager sets up the controller with the Manager.
func (r *UserReconciler) SetupWithManager(mgr ctrl.Manager) error {
	return ctrl.NewControllerManagedBy(mgr).
		For(&resourcesv2.TeleportUser{}).
		Complete(r)
}

func (r *UserReconciler) Delete(ctx context.Context, obj kclient.Object) error {
	teleportClient, err := r.TeleportClientAccessor(ctx)
	if err != nil {
		return trace.Wrap(err)
	}
	return teleportClient.DeleteUser(ctx, obj.GetName())
}

func (r *UserReconciler) Upsert(ctx context.Context, obj kclient.Object) error {
	k8sResource, ok := obj.(*resourcesv2.TeleportUser)
	if !ok {
		return fmt.Errorf("failed to convert Object into resource object: %T", obj)
	}
	teleportResource := k8sResource.ToTeleport()

	teleportClient, err := r.TeleportClientAccessor(ctx)
	if err != nil {
		return trace.Wrap(err)
	}

	existingResource, err := teleportClient.GetUser(teleportResource.GetName(), false)
	if err != nil && !trace.IsNotFound(err) {
		return trace.Wrap(err)
	}

	exists := !trace.IsNotFound(err)

	newOwnershipCondition, isOwned := checkOwnership(existingResource)
	meta.SetStatusCondition(&k8sResource.Status.Conditions, newOwnershipCondition)
	if !isOwned {
		silentUpdateStatus(ctx, r.Client, k8sResource)
		return trace.AlreadyExists("unowned resource '%s' already exists", existingResource.GetName())
	}

	r.addTeleportResourceOrigin(teleportResource)

	if !exists {
		err = teleportClient.CreateUser(ctx, teleportResource)
	} else {
		// We don't want to lose the "created_by" data populated on creation
		teleportResource.SetCreatedBy(existingResource.GetCreatedBy())
		err = teleportClient.UpdateUser(ctx, teleportResource)
	}
	// If an error happens we want to put it in status.conditions before returning.
	newReconciliationCondition := getReconciliationConditionFromError(err)
	meta.SetStatusCondition(&k8sResource.Status.Conditions, newReconciliationCondition)
	if err != nil {
		silentUpdateStatus(ctx, r.Client, k8sResource)
		return trace.Wrap(err)
	}

	// We update the status conditions on exit
	return trace.Wrap(r.Status().Update(ctx, k8sResource))
}

func (r *UserReconciler) addTeleportResourceOrigin(resource types.User) {
	metadata := resource.GetMetadata()
	if metadata.Labels == nil {
		metadata.Labels = make(map[string]string)
	}
	metadata.Labels[types.OriginLabel] = types.OriginKubernetes
	resource.SetMetadata(metadata)
}