text:
<?php

namespace Perry;

class Perry
{
    /**
     * @var string Version string
     */
    public static $version = '3.0.0-dev';

    /**
     * @param string      $url
     * @param null|string $representation
     *
     * @return \GuzzleHttp\Promise\PromiseInterface that will resolve into a \Perry\Representation\Base
     */
    public static function fromUrl($url, $representation = null)
    {
        $dataPromise = Setup::getInstance()->fetcher->doGetRequest($url, $representation);
        $promise = $dataPromise->then(
            function ($data) {
                $classname = Tool::parseRepresentationToClass($data->representation);

                return new $classname($data);
            }
        );

        return $promise;
    }

    /**
     * @param array         $requests  Array of requests. An array is either a url
     *                                 or an array of the form ['url' => ..., 'representation' => ...].
     *                                 Representations are optional, thus ['url' => ...] is also allowed.
     * @param null|callable $fulfilled A callable of the form: function($response, $index)
     * @param null|callable $rejected  A callable of the form: function($reason, $index)
     *
     * @return \GuzzleHttp\Promise\PromisorInterface
     */
    public static function fromUrls($requests, $fulfilled = null, $rejected = null)
    {
        $wrapFulfilled = function ($data, $index) use (&$fulfilled) {
            $classname = Tool::parseRepresentationToClass($data->representation);
            $fulfilled(new $classname($data), $index);
        };

        return Setup::getInstance()->fetcher->doGetRequests($requests, $wrapFulfilled, $rejected);
    }

    /**
     * @param array $requests Array of requests.
     * @param int   $perBatch The number of requests to batch together.
     *
     * @return Generator A generator yielding request batches.
     */
    private static function batches($requests, $perBatch = null)
    {
        $numRequests = count($requests);

        if (!$perBatch) {
            $perBatch = Setup::$batchSize;
        }

        $numBatches = ceil($numRequests / $perBatch);

        for ($i = 0; $i < $numBatches; ++$i) {
            $idx = $i * $perBatch;
            yield ['requests' => array_slice($requests, $idx, $perBatch), 'startIndex' => $idx];
        }
    }

    /**
     * @param array         $requests  Array of requests. An array is either a url
     *                                 or an array of the form ['url' => ..., 'representation' => ...].
     *                                 Representations are optional, thus ['url' => ...] is also allowed.
     * @param null|callable $fulfilled A callable of the form: function($response, $index)
     * @param null|callable $rejected  A callable of the form: function($reason, $index)
     * @param int           $perBatch  The number of requests to batch together.
     *
     * @return Generator A generator yielding \GuzzleHttp\Promise\PromisorInterface objects.
     */
    public static function fromUrlsBatched($requests, $fulfilled = null, $rejected = null, $perBatch = null)
    {
        $batches = self::batches($requests, $perBatch);

        foreach ($batches as $batch) {
            $startIdx = $batch['startIndex'];

            $wrapFulfilled = function ($d, $index) use (&$fulfilled, &$batch) {
                $fulfilled($d, $index + $batch['startIndex']);
            };

            $wrapRejected = function ($d, $index) use (&$rejected, &$batch) {
                $rejected($d, $index + $batch['startIndex']);
            };

            yield self::fromUrls($batch['requests'], $wrapFulfilled, $wrapRejected);
        }
    }

    /**
     * Synchronously wait for all outstanding connections to be handled.
     */
    public static function execute()
    {
        Setup::getInstance()->fetcher->execute();
    }
}


text:
<?php
if (!defined('ON_ROOT')) { include_once 'views/404.php'; die();}

class Renderer {
  var $view = 'default';
  var $args = array();

  public function setView($view) {
    $this->view = $view;
  }

  public function setArg($key, $value) {
    $this->args[$key] = $value;
  }

  public function render() {
    foreach ($this->args as $key => $value) {
      $$key = $value;
    }

    include_once "views/{$this->view}.php";
  }
}

redpajama_set_name: RedPajamaGithub


text:
package fr.eyal.datalib.sample.netflix.data.model.top100;

import java.util.ArrayList;
import java.util.Calendar;

import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import fr.eyal.lib.data.model.BusinessObjectDAO;
import fr.eyal.datalib.sample.netflix.data.model.NetflixProvider;

public class ItemTop100Base extends BusinessObjectDAO {

    protected long _parentId = ID_INVALID;

	//list of content
	public String title;
	public String link;
	public String description;

    public ItemTop100Base() {
        super();
    }

    public ItemTop100Base(final long id) {
        super(id);
    }

    @Override
    protected void initialize() {
        super.initialize();
    }

    /**
     * DATABASE MANAGEMENT
     */

    /**
     * Constants used with a ContentProvider's access
     */
    public static final String CONTENT_PATH = "itemtop100";
    public static final String CONTENT_URL = NetflixProvider.PROVIDER_PREFIX + NetflixProvider.AUTHORITY + "/" + CONTENT_PATH;
    public static final Uri CONTENT_URI = Uri.parse(CONTENT_URL);

    /**
     * SQL databases table's name
     */
    public static String DATABASE_TABLE_NAME = "itemtop100";

    /**
     * SQL database table's fields names
     */
    public static final String FIELD__ID = BusinessObjectDAO.FIELD_ID;
    public static final String FIELD__UPDATED_AT = BusinessObjectDAO.FIELD_UPDATED_AT;
    public static final String FIELD__PARENT_ID = "_parent_id";
	//list of content
    public static final String FIELD_TITLE = "title";
    public static final String FIELD_LINK = "link";
    public static final String FIELD_DESCRIPTION = "description";

    /**
     * List of SQL database fields' names
     */
    public static String[] DATABASE_TABLE_FIELDS_NAMES = {
			// header
            FIELD__ID, // _id
            FIELD__UPDATED_AT, // updated_at
            FIELD__PARENT_ID, // sensors_id
		    //list of content
		    FIELD_TITLE, //title;
		    FIELD_LINK, //link;
		    FIELD_DESCRIPTION, //description;
    };

    /**
     * SQL fields' types in the table
     */
    static String[] DATABASE_TABLE_FIELDS_TYPES = {
            // prevision_meteo_meteo_weather
            // header
            "integer", "integer", "integer",

			//list of content
			"text",
			"text",
			"text",

    };

    /**
     * SQLite scripts to create the table
     */
    public static String CREATE_TABLE = "CREATE TABLE " + DATABASE_TABLE_NAME + " ("
			+ DATABASE_TABLE_FIELDS_NAMES[0] + " " + DATABASE_TABLE_FIELDS_TYPES[0] + " PRIMARY KEY AUTOINCREMENT" + ", "
            + DATABASE_TABLE_FIELDS_NAMES[1] + " " + DATABASE_TABLE_FIELDS_TYPES[1] + ", "
            + DATABASE_TABLE_FIELDS_NAMES[2] + " " + DATABASE_TABLE_FIELDS_TYPES[2] + " REFERENCES "
            + Top100.DATABASE_TABLE_NAME + "(" + Top100.DATABASE_TABLE_FIELDS_NAMES[0] + ") ON DELETE CASCADE" + ", "

			//list of content
			+ DATABASE_TABLE_FIELDS_NAMES[3] + " " + DATABASE_TABLE_FIELDS_TYPES[3] + ", "
			+ DATABASE_TABLE_FIELDS_NAMES[4] + " " + DATABASE_TABLE_FIELDS_TYPES[4] + ", "
			+ DATABASE_TABLE_FIELDS_NAMES[5] + " " + DATABASE_TABLE_FIELDS_TYPES[5] + "); "

            + "CREATE INDEX "
            + DATABASE_TABLE_NAME + "_" + DATABASE_TABLE_FIELDS_NAMES[0] + " ON " + DATABASE_TABLE_NAME + " (" + DATABASE_TABLE_FIELDS_NAMES[0] + ");";

    @Override
    protected ContentResolver getContentResolver() {
        try {
        return NetflixProvider.getContentResolver();
		} catch (InstantiationException e) {
			e.printStackTrace();
		}
        return null;
    }

    @Override
    public ContentValues getContentValues() {
        // we create the values to add
        final ContentValues values = new ContentValues();

        if (_id != ID_INVALID)
            values.put(FIELD__ID, _id);
        if (_parentId != ID_INVALID)
            values.put(FIELD__PARENT_ID, _parentId);
        values.put(FIELD__UPDATED_AT, _updatedAt.getTimeInMillis() / 1000);

	    //list of content
	    values.put(FIELD_TITLE, title);
	    values.put(FIELD_LINK, link);
	    values.put(FIELD_DESCRIPTION, description);

        return values;
    }

    @Override
    protected void fillFromDatabaseById(final long id) {
        // we define the access condition to the object
        final String[] columns = new String[DATABASE_TABLE_FIELDS_NAMES.length];
        for (int i = 0; i < DATABASE_TABLE_FIELDS_NAMES.length; i++) {
            columns[i] = DATABASE_TABLE_FIELDS_NAMES[i];
        }

        final String where = FIELD__ID + "=?";
        final String[] args = { id + "" };

        // we check the existence inside the database
        final Cursor cursor = mResolver.query(CONTENT_URI, // ItemTop100
                columns, // id
                where, // id=?
                args, // id

                FIELD__UPDATED_AT + " DESC"); // ORDER BY updated_at DESC

        // we fill the object thanks to the Cursor recieved
        if (cursor.moveToFirst()) {
            fillObjectFromCursor(cursor);
        }

        if (!cursor.isClosed()) {
            cursor.close();
        }

        // we get the childs content
        fillChildrenFromDatabase();

    }

    @Override
    protected void fillObjectFromCursor(final Cursor cursor) {

		// if we have a content
        if (!cursor.isClosed() && !cursor.isAfterLast()) {

            int i = 0;

            // header
            _id = cursor.getLong(i++);
            _updatedAt = Calendar.getInstance();
            _updatedAt.setTimeInMillis(cursor.getLong(i++) * 1000);
            _parentId = cursor.getLong(i++);

			//list of content
			title = cursor.getString(i++);
			link = cursor.getString(i++);
			description = cursor.getString(i++);

        } else {
            _id = ID_INVALID;
        }

    }

    @Override
    public ContentProviderResult[] save() throws OperationApplicationException, RemoteException {

        // we define the access conditions to the object
        final String[] columns = {
                FIELD__ID
        };
        final String where = FIELD__ID + " LIKE ?"; // id LIKE {this.id}
        final String[] args = {
                _id + ""
        };

        return save(columns, where, args, CONTENT_URI, NetflixProvider.AUTHORITY);

    }

	@Override
	protected int updateChildrenId(long[] ids, int index, int parentIndex) {
		// Nothing to do

		return index;
	}

    @Override
	public int updateId(long[] ids, int index, int parentIndex) {
		if(parentIndex >= 0)
			_parentId = ids[parentIndex];

		return super.updateId(ids, index);
	}

    @Override
    protected void updateIntoTheDatabase(final ArrayList<ContentProviderOperation> batch) {
        updateIntoTheDatabase(batch, CONTENT_URI);
    }

    @Override
    public ContentProviderResult[] delete() throws OperationApplicationException, RemoteException {
        // we define the access conditions to the object
        final String[] columns = { FIELD__ID };
        final String where = FIELD__ID + "=?"; // _url LIKE {this.url}
        final String[] args = { _id + "" };

        return delete(columns, where, args, CONTENT_URI, NetflixProvider.AUTHORITY);
    }

    @Override
    public boolean deleteFromDatabase(final ArrayList<ContentProviderOperation> batch) {
        return deleteFromDatabase(batch, CONTENT_URI);
    }

    @Override
    public void deleteChildsFromDatabase(final ArrayList<ContentProviderOperation> batch) {
		// Nothing to do
    }

    @Override
    public void addChildsIntoDatabase(final ArrayList<ContentProviderOperation> batch, final int previousResult) {
		// Nothing to do
    }

    @Override
    public void addChildsIntoDatabase(final ArrayList<ContentProviderOperation> batch) {
		// Nothing to do
    }

    @Override
    protected void fillChildrenFromDatabase() {
		// Nothing to do
    }

	/**
     * This function build an array of {@link ItemTop100Base} thanks to a Cursor
     * object received from the database.
     *
     * @param c The cursor object.
     * @param join Tells if the child of the objects have to be recursively
     *            filled from the database.
     * @return Returns an {@link ArrayList} of the result fill with the content
     *         of the Cursor. If the Cursor is empty, it returns an empty array.
     *  	   <b>The result of this function is return as ArrayList<?>. It has
     *  	   to be casted into the expected class to be useful.</b>
     *  	   Ex: Cast to ArrayList<{@link ItemTop100}> if you want it as {@link ItemTop100}
     */
    public static ArrayList<?> buildArrayFromCursor(final Cursor c, final boolean join) {

        final ArrayList<ItemTop100Base> result = new ArrayList<ItemTop100Base>();

        if (c.moveToFirst()) {
            do {
                // we create and fill the item
                final ItemTop100Base newObject = new ItemTop100Base();
                newObject.fillObjectFromCursor(c);
                // if it's asked we fill the childs of the item
                if (join) {
                    newObject.fillChildrenFromDatabase();
                }
                // we add the element to the result
                result.add(newObject);
            } while (c.moveToNext());
        }

        return result;
    }

    /**
     * PARCELABLE MANAGMENT
     */

	public static final Parcelable.Creator<ItemTop100Base> CREATOR = new Parcelable.Creator<ItemTop100Base>() {
	    @Override
	    public ItemTop100Base createFromParcel(final Parcel in) {
	        return new ItemTop100Base(in);
	    }

	    @Override
	    public ItemTop100Base[] newArray(final int size) {
	        return new ItemTop100Base[size];
	    }
	};

	@Override
	public int describeContents() {
	    return 0;
	}

	@Override
	public void writeToParcel(final Parcel dest, final int flags) {
		// Business Object DAO
		dest.writeLong(_id);
		dest.writeLong(_updatedAt.getTimeInMillis());

		//list of content
		dest.writeString(title);
		dest.writeString(link);
		dest.writeString(description);

	}

	public ItemTop100Base(final Parcel in) {
		// Business Object DAO
		_id = in.readLong();
		_updatedAt = Calendar.getInstance();
		_updatedAt.setTimeInMillis(in.readLong());

		//list of content
		title = in.readString();
		link = in.readString();
		description = in.readString();

	}
}


text:
package com.dongdongxia.my.patterns.abstractdocument.domain;

import java.util.stream.Stream;

import com.dongdongxia.my.patterns.abstractdocument.Document;
/**
 *
 *
Description: 配件默认实现接口

 * @ClassName: HasParts
 * @author java_liudong@163.com  2017年8月26日 下午4:57:31
 */
public interface HasParts extends Document {

    String PROPERTY = "parts";

    default Stream<Part> getParts() {
        return children(PROPERTY, Part::new);
    }
}


text:
namespace llvm {

class RemoteTarget {
  std::string ErrorMsg;
  bool IsRunning;

  SmallVector<sys::MemoryBlock, 16> Allocations;

public:
  StringRef getErrorMsg() const { return ErrorMsg; }

  /// Allocate space in the remote target address space.
  ///
  /// @param      Size      Amount of space, in bytes, to allocate.
  /// @param      Alignment Required minimum alignment for allocated space.
  /// @param[out] Address   Remote address of the allocated memory.
  ///
  /// @returns False on success. On failure, ErrorMsg is updated with
  ///          descriptive text of the encountered error.
  bool allocateSpace(size_t Size, unsigned Alignment, uint64_t &Address);

  /// Load data into the target address space.
  ///
  /// @param      Address   Destination address in the target process.
  /// @param      Data      Source address in the host process.
  /// @param      Size      Number of bytes to copy.
  ///
  /// @returns False on success. On failure, ErrorMsg is updated with
  ///          descriptive text of the encountered error.
  bool loadData(uint64_t Address, const void *Data, size_t Size);

  /// Load code into the target address space and prepare it for execution.
  ///
  /// @param      Address   Destination address in the target process.
  /// @param      Data      Source address in the host process.
  /// @param      Size      Number of bytes to copy.
  ///
  /// @returns False on success. On failure, ErrorMsg is updated with
  ///          descriptive text of the encountered error.
  bool loadCode(uint64_t Address, const void *Data, size_t Size);

  /// Execute code in the target process. The called function is required
  /// to be of signature int "(*)(void)".
  ///
  /// @param      Address   Address of the loaded function in the target
  ///                       process.
  /// @param[out] RetVal    The integer return value of the called function.
  ///
  /// @returns False on success. On failure, ErrorMsg is updated with
  ///          descriptive text of the encountered error.
  bool executeCode(uint64_t Address, int &RetVal);

  /// Minimum alignment for memory permissions. Used to seperate code and
  /// data regions to make sure data doesn't get marked as code or vice
  /// versa.
  ///
  /// @returns Page alignment return value. Default of 4k.
  unsigned getPageAlignment() { return 4096; }

  /// Start the remote process.
  void create();

  /// Terminate the remote process.
  void stop();

  RemoteTarget() : ErrorMsg(""), IsRunning(false) {}
  ~RemoteTarget() { if (IsRunning) stop(); }

private:
  // Main processing function for the remote target process. Command messages
  // are received on file descriptor CmdFD and responses come back on OutFD.
  static void doRemoteTargeting(int CmdFD, int OutFD);
};

} // end namespace llvm

#endif


text:
package icons;

import consulo.annotation.DeprecationInfo;
import consulo.platform.base.icon.PlatformIconGroup;
import consulo.ui.image.Image;

/**
 * NOTE THIS FILE IS AUTO-GENERATED
 * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
 */
@Deprecated
@DeprecationInfo("Use PlatformIconGroup")
public class DvcsImplIcons {
  public static final Image CherryPick = PlatformIconGroup.dvcsCherryPick(); // 16x16
  public static final Image Favorite = PlatformIconGroup.nodesFavorite(); // 16x16
  public static final Image NotFavoriteOnHover = PlatformIconGroup.nodesNotFavoriteOnHover(); // 16x16
  public static final Image Incoming = PlatformIconGroup.dvcsIncoming();
  public static final Image IncomingOutgoing = PlatformIconGroup.dvcsIncomingOutgoing();
  public static final Image Outgoing = PlatformIconGroup.dvcsOutgoing();
}


text:
<?php

/**
 * PluginPlaylist form.
 *
 * @package    PubsPlugin
 * @subpackage filter
 * @author     Dario Sebastian Sasturain
 * @version    SVN: $Id: sfDoctrineFormFilterPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
abstract class PluginPlaylistFormFilter extends BasePlaylistFormFilter
{
}


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

namespace $safeprojectname$.Extensions
{

	public static class IEnumerableExtensions
	{

		public static IEnumerable<T> Add<T>(this IEnumerable<T> e, T value) {
			foreach ( var cur in e)
			{
				yield return cur;
			}
			yield return value;
		}

	}

}


text:
/******************************************************************************
 *
 * Module Name: acapps - common include for ACPI applications/tools
 *
 *****************************************************************************/

/******************************************************************************
 *
 * 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 _ACAPPS
#define _ACAPPS

#ifdef ACPI_USE_STANDARD_HEADERS
#include <sys/stat.h>
#endif /* ACPI_USE_STANDARD_HEADERS */

/* Common info for tool signons */

#define ACPICA_NAME                 "Intel ACPI Component Architecture"
#define ACPICA_COPYRIGHT            "Copyright (c) 2000 - 2020 Intel Corporation"

#if ACPI_MACHINE_WIDTH == 64
#define ACPI_WIDTH          " (64-bit version)"

#elif ACPI_MACHINE_WIDTH == 32
#define ACPI_WIDTH          " (32-bit version)"

#else
#error unknown ACPI_MACHINE_WIDTH
#define ACPI_WIDTH          " (unknown bit width, not 32 or 64)"

#endif

/* Macros for signons and file headers */

#define ACPI_COMMON_SIGNON(UtilityName) \
    "\n%s\n%s version %8.8X\n%s\n\n", \
    ACPICA_NAME, \
    UtilityName, ((UINT32) ACPI_CA_VERSION), \
    ACPICA_COPYRIGHT

#define ACPI_COMMON_HEADER(UtilityName, Prefix) \
    "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
    Prefix, ACPICA_NAME, \
    Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
    Prefix, ACPICA_COPYRIGHT, \
    Prefix

#define ACPI_COMMON_BUILD_TIME \
    "Build date/time: %s %s\n", __DATE__, __TIME__

/* Macros for usage messages */

#define ACPI_USAGE_HEADER(Usage) \
    printf ("Usage: %s\nOptions:\n", Usage);

#define ACPI_USAGE_TEXT(Description) \
    printf (Description);

#define ACPI_OPTION(Name, Description) \
    printf ("  %-20s%s\n", Name, Description);

/* Check for unexpected exceptions */

#define ACPI_CHECK_STATUS(Name, Status, Expected) \
    if (Status != Expected) \
    { \
        AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
            AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
    }

/* Check for unexpected non-AE_OK errors */

#define ACPI_CHECK_OK(Name, Status)   ACPI_CHECK_STATUS (Name, Status, AE_OK);

#define FILE_SUFFIX_DISASSEMBLY     "dsl"
#define FILE_SUFFIX_BINARY_TABLE    ".dat" /* Needs the dot */

/* acfileio */

ACPI_STATUS
AcGetAllTablesFromFile (
    char                    *Filename,
    UINT8                   GetOnlyAmlTables,
    ACPI_NEW_TABLE_DESC     **ReturnListHead);

void
AcDeleteTableList (
    ACPI_NEW_TABLE_DESC     *ListHead);

BOOLEAN
AcIsFileBinary (
    FILE                    *File);

ACPI_STATUS
AcValidateTableHeader (
    FILE                    *File,
    long                    TableOffset);

/* Values for GetOnlyAmlTables */

#define ACPI_GET_ONLY_AML_TABLES    TRUE
#define ACPI_GET_ALL_TABLES         FALSE

/*
 * getopt
 */
int
AcpiGetopt(
    int                     argc,
    char                    **argv,
    char                    *opts);

int
AcpiGetoptArgument (
    int                     argc,
    char                    **argv);

extern int                  AcpiGbl_Optind;
extern int                  AcpiGbl_Opterr;
extern int                  AcpiGbl_SubOptChar;
extern char                 *AcpiGbl_Optarg;

/*
 * cmfsize - Common get file size function
 */
UINT32
CmGetFileSize (
    ACPI_FILE               File);

/*
 * adwalk
 */
void
AcpiDmCrossReferenceNamespace (
    ACPI_PARSE_OBJECT       *ParseTreeRoot,
    ACPI_NAMESPACE_NODE     *NamespaceRoot,
    ACPI_OWNER_ID           OwnerId);

void
AcpiDmDumpTree (
    ACPI_PARSE_OBJECT       *Origin);

void
AcpiDmFindOrphanMethods (
    ACPI_PARSE_OBJECT       *Origin);

void
AcpiDmFinishNamespaceLoad (
    ACPI_PARSE_OBJECT       *ParseTreeRoot,
    ACPI_NAMESPACE_NODE     *NamespaceRoot,
    ACPI_OWNER_ID           OwnerId);

void
AcpiDmConvertParseObjects (
    ACPI_PARSE_OBJECT       *ParseTreeRoot,
    ACPI_NAMESPACE_NODE     *NamespaceRoot);

/*
 * adfile
 */
ACPI_STATUS
AdInitialize (
    void);

char *
FlGenerateFilename (
    char                    *InputFilename,
    char                    *Suffix);

ACPI_STATUS
FlSplitInputPathname (
    char                    *InputPath,
    char                    **OutDirectoryPath,
    char                    **OutFilename);

char *
FlGetFileBasename (
    char                    *FilePathname);

char *
AdGenerateFilename (
    char                    *Prefix,
    char                    *TableId);

void
AdWriteTable (
    ACPI_TABLE_HEADER       *Table,
    UINT32                  Length,
    char                    *TableName,
    char                    *OemTableId);

#endif /* _ACAPPS */


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>de.lars-francke.osm</groupId>
    <artifactId>osm-super-pom</artifactId>
    <version>1-SNAPSHOT</version>
  </parent>

  <groupId>de.lars-francke.osm</groupId>
  <artifactId>osm-domain</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>OSM Domain Objects</name>

  <scm>
    <url>https://github.com/lfrancke/osm-domain</url>
    <connection>scm:git:git://github.com/lfrancke/osm-domain.git</connection>
    <developerConnection>scm:git:git@github.com:lfrancke/osm-domain.git</developerConnection>
  </scm>

  <ciManagement>
    <system>jenkins</system>
    <url>http://builds.lars-francke.com/job/osm-domain</url>
  </ciManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-maven-plugin</artifactId>
        <version>${avro.version}</version>
        <executions>
          <execution>
            <id>generate-avro</id>
            <goals>
              <goal>schema</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>lars</id>
      <url>http://repository.lars-francke.com/content/groups/lars</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.apache.avro</groupId>
      <artifactId>avro</artifactId>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
    </dependency>
  </dependencies>

</project>


text:
package org.infinispan.dataplacement.stats;

import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Task that saves the round statistics to a file
 *
 * @author Pedro Ruivo
 * @since 5.2
 */
public class SaveStatsTask implements Runnable {

   private static final Log log = LogFactory.getLog(SaveStatsTask.class);
   private static final String PATH = "./stats.csv";
   private static final AtomicBoolean FIRST_TIME = new AtomicBoolean(true);
   private final Stats stats;

   public SaveStatsTask(Stats stats) {
      this.stats = stats;
   }

   @Override
   public void run() {
      try {
         log.errorf("Save stats to %s, first time %s", PATH, FIRST_TIME.get());
         BufferedWriter writer = new BufferedWriter(new FileWriter(PATH, !FIRST_TIME.get()));
         stats.saveTo(writer, FIRST_TIME.compareAndSet(true, false));
         writer.flush();
         writer.close();
      } catch (Exception e) {
         log.errorf(e, "Error saving stats to %s", PATH);
      }
   }
}


text:
#pragma once

#include "MKLDNNLayer.h"
#include "mkldnn.hpp"

namespace paddle {
typedef mkldnn::lrn_forward lrn_fwd;
typedef mkldnn::lrn_backward lrn_bwd;

/**
 * @brief A subclass of MKLDNNLayer LRN(Local Response Norm) layer.
 *
 * The config file api is mkldnn_lrn
 */
class MKLDNNLRNLayer : public MKLDNNLayer {
 protected:
  // save forward primitive_desc, which can be used in backward
  std::shared_ptr<lrn_fwd::primitive_desc> fwdPD_;
  // according to https://github.com/01org/mkl-dnn/blob/master/tests/gtests/
  // test_lrn_backward.cpp, lrn need workspace for backward
  std::shared_ptr<mkldnn::memory> workspace_;

  int localSize_;
  float alpha_, beta_;  // scale and pow in paddle

 public:
  explicit MKLDNNLRNLayer(const LayerConfig& config) : MKLDNNLayer(config) {}

  ~MKLDNNLRNLayer() {}

  bool init(const LayerMap& layerMap,
            const ParameterMap& parameterMap) override;

  void reshape(
      int& bs, int& ic, int& ih, int& iw, int& oc, int& oh, int& ow) override;

  void resetFwd(std::vector<mkldnn::primitive>& pipeline,
                std::vector<MKLDNNMatrixPtr>& inputs,
                MKLDNNMatrixPtr& out) override;

  void resetBwd(std::vector<mkldnn::primitive>& pipeline,
                std::vector<MKLDNNMatrixPtr>& inputs,
                MKLDNNMatrixPtr& out) override;

 protected:
  void resetFwdBuffers(MKLDNNMatrixPtr& in, MKLDNNMatrixPtr& out);
  void resetFwdPD(std::shared_ptr<lrn_fwd::primitive_desc>& pd,
                  MKLDNNMatrixPtr in,
                  MKLDNNMatrixPtr out);
  void resetFwdPipeline(std::vector<mkldnn::primitive>& pipeline,
                        std::shared_ptr<lrn_fwd::primitive_desc>& pd,
                        MKLDNNMatrixPtr& in,
                        MKLDNNMatrixPtr& out);
  void resetBwdBuffers(MKLDNNMatrixPtr& in, MKLDNNMatrixPtr& out);
  void resetBwdPD(std::shared_ptr<lrn_bwd::primitive_desc>& pd,
                  MKLDNNMatrixPtr& in,
                  MKLDNNMatrixPtr& out);
  void resetBwdPipeline(std::vector<mkldnn::primitive>& pipeline,
                        std::shared_ptr<lrn_bwd::primitive_desc>& pd,
                        MKLDNNMatrixPtr& in,
                        MKLDNNMatrixPtr& out);
};

}  // namespace paddle


text:
NCMS Server Status with Node.js + React + Socket.io
![NCMS](https://github.com/nabigraphics/NCMS/blob/master/index.jpg?raw=true)


text:
void test_rsession_invalidation() {
    drmaa2_rsession rs = drmaa2_create_rsession("mysession", NULL);
    drmaa2_destroy_rsession("mysession");
    CU_ASSERT_PTR_NULL(drmaa2_rsession_get_contact(rs));
    CU_ASSERT_PTR_NULL(drmaa2_rsession_get_session_name(rs));
    CU_ASSERT_EQUAL(drmaa2_lasterror(), DRMAA2_INVALID_SESSION);
    drmaa2_rsession_free(&rs);
}

void test_rsession_getter_methods() {
    drmaa2_rsession rs = drmaa2_create_rsession("mysession", NULL);

    // test getter functions
    drmaa2_string name = drmaa2_rsession_get_session_name(rs);
    CU_ASSERT_STRING_EQUAL(name, "mysession");
    drmaa2_string_free(&name);
    drmaa2_string contact = drmaa2_rsession_get_contact(rs);
    CU_ASSERT_PTR_NULL(contact);
    drmaa2_string_free(&contact);

    drmaa2_destroy_rsession("mysession");
    drmaa2_rsession_free(&rs);
}

void test_rsession_get_reservation() {
    drmaa2_rsession rs = drmaa2_create_rsession("mysession2", NULL);
    CU_ASSERT_PTR_NOT_NULL(rs);

    // test invalid reservation
    drmaa2_r r = drmaa2_rsession_get_reservation(rs, "123");
    CU_ASSERT_PTR_NULL(r);
    CU_ASSERT_EQUAL(drmaa2_lasterror(), DRMAA2_INVALID_ARGUMENT);

    // create and get reservation
    drmaa2_rtemplate rt = drmaa2_rtemplate_create();
    rt->maxSlots = 4;                                                    // perform advance reservation
    if (DRMAA2_TRUE == drmaa2_supports(DRMAA2_RT_MACHINEOS))
        rt->machineOS = DRMAA2_LINUX;
    r = drmaa2_rsession_request_reservation(rs, rt);
    drmaa2_rtemplate_free(&rt);

    drmaa2_string r_id  = drmaa2_r_get_id(r);
    drmaa2_r r2        = drmaa2_rsession_get_reservation(rs, r_id);
    drmaa2_string r_id2 = drmaa2_r_get_id(r2);

    CU_ASSERT_STRING_EQUAL(r_id, r_id2);
    drmaa2_string_free(&r_id);
    drmaa2_string_free(&r_id2);

    drmaa2_string sn  = drmaa2_r_get_session_name(r);
    drmaa2_string sn2 = drmaa2_r_get_session_name(r2);

    CU_ASSERT_STRING_EQUAL(sn, "mysession2");
    CU_ASSERT_STRING_EQUAL(sn, sn2);
    drmaa2_string_free(&sn);
    drmaa2_string_free(&sn2);

    drmaa2_r_free(&r);
    drmaa2_r_free(&r2);

    drmaa2_destroy_rsession("mysession2");
    drmaa2_rsession_free(&rs);
}

void test_rsession_get_reservations() {
    drmaa2_rsession rs = drmaa2_create_rsession("mysession", NULL);
    CU_ASSERT_PTR_NOT_NULL(rs);

    //test empty reservation list
    drmaa2_r_list reservations = drmaa2_rsession_get_reservations(rs);
    CU_ASSERT_EQUAL(drmaa2_list_size(reservations), 0);
    drmaa2_list_free(&reservations);

    drmaa2_rtemplate rt  = drmaa2_rtemplate_create();
    drmaa2_r r            = drmaa2_rsession_request_reservation(rs, rt);
    drmaa2_r_free(&r);
    r                    = drmaa2_rsession_request_reservation(rs, rt);
    drmaa2_r_free(&r);
    drmaa2_rtemplate_free(&rt);

    reservations = drmaa2_rsession_get_reservations(rs);
    CU_ASSERT_EQUAL(drmaa2_list_size(reservations), 2);
    drmaa2_list_free(&reservations);

    drmaa2_destroy_rsession("mysession");
    drmaa2_rsession_free(&rs);
}


text:
package com.thingtrack.konekti.view.kernel.ui.layout;

public class ViewEvent {
   	private IView sourceFrom;
	private IView sourceTo;

    /**
     * New instance of selected view change view event
     *
     * @param source the Source of the event.
     */
    public ViewEvent(IView sourceFrom, IView sourceTo) {
        this.sourceFrom = sourceFrom;
        this.sourceTo = sourceTo;
    }

    /**
     * view from where the event occurred.
     *
     * @return the Source of the event.
     */
    public IView getViewFrom() {
        return this.sourceFrom;

    }

    /**
     * slide to where the event occurred.
     *
     * @return the Source of the event.
     */
    public IView getViewTo() {
        return this.sourceTo;

    }
}


text:
require 'spec_helper'
require './models/build/buildReport.rb'

describe BuildReport do

	it 'should answer the correct values for a nested build' do
    	wasteCalc = mock('wasteCalc')
    	wasteCalc.expects(:calculate_quantity).returns(1).at_least_once

		item1 = LineItem.new('250mm Railgun I', 1, wasteCalc)
		item1.expects(:typeID).returns(1)
		item1.expects(:quantity).returns(1)
		item1.expects(:materials).returns({34 => 10, 35 => 20})

		item2 = LineItem.new('250mm Railgun I', 1, wasteCalc)
		item2.expects(:typeID).returns(1)
		item2.expects(:quantity).returns(1)
		item2.expects(:materials).returns({34 => 10, 35 => 20})

	 	nested = Build.new('Nested');
	 	nested.add(item1)
	 	nested.add(item2)

	 	root = Build.new('Root');
	 	root.add(nested)

	 	pricing = mock('pricing')
    	pricing.expects(:price).with(1).returns(300).twice()
    	pricing.expects(:price).with(34).returns(5).twice()
    	pricing.expects(:price).with(35).returns(10).twice()

	 	report = BuildReport.new(root, pricing)
	 	report.cost.should eq(500)
	 	report.value.should eq(600)
	 	report.profit.should eq(100)
	 	report.profit_margin.should eq(20)
	 	report.materials[34].should eq(20)
	 	report.materials[35].should eq(40)
	end

end


text:
/* Desc: A model state
 * Author: Nate Koenig
 */

#ifndef MODEL_STATE_HH
#define MODEL_STATE_HH

#include <vector>
#include <string>

#include "physics/State.hh"
#include "physics/LinkState.hh"
#include "physics/JointState.hh"
#include "math/Pose.hh"

namespace gazebo
{
  namespace physics
  {
    class ModelState : public State
    {
      /// \brief Default constructor
      public: ModelState();

      /// \brief Constructor
      public: ModelState(ModelPtr _model);

      /// \brief Destructor
      public: virtual ~ModelState();

      /// \brief Load state from SDF element
      public: virtual void Load(sdf::ElementPtr _elem);

      /// \brief Get the model pose
      public: math::Pose GetPose() const;

      /// \brief Get the number of link states
      public: unsigned int GetLinkStateCount() const;

      /// \brief Get a link state
      public: LinkState GetLinkState(unsigned int _index) const;

      /// \brief Get a link state by model name
      public: LinkState GetLinkState(const std::string &_modelName) const;

      /// \brief Get the number of joint states
      public: unsigned int GetJointStateCount() const;

      /// \brief Get a model state
      public: JointState GetJointState(unsigned int _index) const;

      /// \brief Get a model state by model name
      public: JointState GetJointState(const std::string &_jointName) const;

      /// \brief Fill a State SDF element with state info
      public: void FillStateSDF(sdf::ElementPtr _elem);

      /// \brief Update a Model SDF element with this state info
      public: void UpdateModelSDF(sdf::ElementPtr _elem);

      private: math::Pose pose;
      private: std::vector<LinkState> linkStates;
      private: std::vector<JointState> jointStates;
    };
  }
}
#endif


text:
package api

// ecosystem_test.go provides tooling and tests for whole-ecosystem testing,
// consisting of multiple full, non-state-sharing nodes connected in various
// arrangements and performing various full-ecosystem tasks.
//
// To the absolute greatest extent possible, nodes are queried and updated
// exclusively through the API.

import (
	"errors"
	"net/url"
	"testing"
	"time"

	"github.com/NebulousLabs/Sia/types"
)

// addStorageToAllHosts adds a storage folder with a bunch of storage to each
// host.
func addStorageToAllHosts(sts []*serverTester) error {
	for _, st := range sts {
		values := url.Values{}
		values.Set("path", st.dir)
		values.Set("size", "1048576")
		err := st.stdPostAPI("/host/storage/folders/add", values)
		if err != nil {
			return err
		}
	}
	return nil
}

// announceAllHosts will announce every host in the tester set to the
// blockchain.
func announceAllHosts(sts []*serverTester) error {
	// Check that all announcements will be on the same chain.
	_, err := synchronizationCheck(sts)
	if err != nil {
		return err
	}

	// Announce each host.
	for _, st := range sts {
		// Set the host to be accepting contracts.
		acceptingContractsValues := url.Values{}
		acceptingContractsValues.Set("acceptingcontracts", "true")
		err = st.stdPostAPI("/host", acceptingContractsValues)
		if err != nil {
			return err
		}

		// Fetch the host net address.
		var hg HostGET
		err = st.getAPI("/host", &hg)
		if err != nil {
			return err
		}

		// Make the announcement.
		announceValues := url.Values{}
		announceValues.Set("address", string(hg.ExternalSettings.NetAddress))
		err = st.stdPostAPI("/host/announce", announceValues)
		if err != nil {
			return err
		}
	}

	// Wait until all of the transactions have propagated to all of the nodes.
	//
	// TODO: Replace this direct transaction pool call with a call to the
	// /transactionpool endpoint.
	//
	// TODO: At some point the number of transactions needed to make an
	// announcement may change. Currently its 2.
	for i := 0; i < 50; i++ {
		if len(sts[0].tpool.TransactionList()) == len(sts)*2 {
			break
		}
		time.Sleep(time.Millisecond * 100)
	}
	if len(sts[0].tpool.TransactionList()) != len(sts)*2 {
		return errors.New("Host announcements do not seem to have propagated to the leader's tpool")
	}

	// Mine a block and then wait for all of the nodes to syncrhonize to it.
	_, err = sts[0].miner.AddBlock()
	if err != nil {
		return err
	}
	_, err = synchronizationCheck(sts)
	if err != nil {
		return err
	}

	// Block until every node has completed the scan of every other node, so
	// that each node has a full hostdb.
	for _, st := range sts {
		var ah ActiveHosts
		for i := 0; i < 50; i++ {
			err = st.getAPI("/hostdb/active", &ah)
			if err != nil {
				return err
			}
			if len(ah.Hosts) >= len(sts) {
				break
			}
			time.Sleep(time.Millisecond * 100)
		}
		if len(ah.Hosts) < len(sts) {
			return errors.New("one of the nodes hostdbs was unable to find at least one host announcement")
		}
	}
	return nil
}

// fullyConnectNodes takes a bunch of tester nodes and connects each to the
// other, creating a fully connected graph so that everyone is on the same
// chain.
//
// After connecting the nodes, it verifies that all the nodes have
// synchronized.
func fullyConnectNodes(sts []*serverTester) error {
	for i, sta := range sts {
		var gg GatewayGET
		err := sta.getAPI("/gateway", &gg)
		if err != nil {
			return err
		}

		// Connect this node to every other node.
		for _, stb := range sts[i+1:] {
			err := stb.stdPostAPI("/gateway/connect/"+string(gg.NetAddress), nil)
			if err != nil {
				return err
			}
		}
	}

	// Perform a synchronization check.
	_, err := synchronizationCheck(sts)
	return err
}

// fundAllNodes will make sure that each node has mined a block in the longest
// chain, then will mine enough blocks that the miner payouts manifest in the
// wallets of each node.
func fundAllNodes(sts []*serverTester) error {
	// Check that all of the nodes are synchronized.
	chainTip, err := synchronizationCheck(sts)
	if err != nil {
		return err
	}

	// Mine a block for each node to fund their wallet.
	for i := range sts {
		err := waitForBlock(chainTip, sts[i])
		if err != nil {
			return err
		}

		// Mine a block. The next iteration of this loop will ensure that the
		// block propagates and does not get orphaned.
		block, err := sts[i].miner.AddBlock()
		if err != nil {
			return err
		}
		chainTip = block.ID()
	}

	// Wait until the chain tip has propagated to the first node.
	err = waitForBlock(chainTip, sts[0])
	if err != nil {
		return err
	}

	// Mine types.MaturityDelay more blocks from the final node to mine a
	// block, to guarantee that all nodes have had their payouts mature, such
	// that their wallets can begin spending immediately.
	for i := types.BlockHeight(0); i <= types.MaturityDelay; i++ {
		_, err := sts[0].miner.AddBlock()
		if err != nil {
			return err
		}
	}

	// Block until every node has the full chain.
	_, err = synchronizationCheck(sts)
	return err
}

// synchronizationCheck takes a bunch of server testers as input and checks
// that they all have the same current block as the first server tester. The
// first server tester needs to have the most recent block in order for the
// check to work.
func synchronizationCheck(sts []*serverTester) (types.BlockID, error) {
	// Prefer returning an error in the event of a zero-length server tester -
	// an error should be returned if the developer accidentally uses a nil
	// slice instead of whatever value was intended, and there's no reason to
	// check for synchronization if there aren't any nodes to be synchronized.
	if len(sts) == 0 {
		return types.BlockID{}, errors.New("no server testers provided")
	}

	var cg ConsensusGET
	err := sts[0].getAPI("/consensus", &cg)
	if err != nil {
		return types.BlockID{}, err
	}
	leaderBlockID := cg.CurrentBlock
	for i := range sts {
		// Spin until the current block matches the leader block.
		success := false
		for j := 0; j < 100; j++ {
			err = sts[i].getAPI("/consensus", &cg)
			if err != nil {
				return types.BlockID{}, err
			}
			if cg.CurrentBlock == leaderBlockID {
				success = true
				break
			}
			time.Sleep(time.Millisecond * 100)
		}
		if !success {
			return types.BlockID{}, errors.New("synchronization check failed - nodes do not seem to be synchronized")
		}
	}
	return leaderBlockID, nil
}

// waitForBlock will block until the provided chain tip is the most recent
// block in the provided testing node.
func waitForBlock(chainTip types.BlockID, st *serverTester) error {
	var cg ConsensusGET
	success := false
	for j := 0; j < 100; j++ {
		err := st.getAPI("/consensus", &cg)
		if err != nil {
			return err
		}
		if cg.CurrentBlock == chainTip {
			success = true
			break
		}
		time.Sleep(time.Millisecond * 100)
	}
	if !success {
		return errors.New("node never reached the correct chain tip")
	}
	return nil
}

// TestHostPoorConnectivity creates several full server testers and links them
// together in a way that might mimic a full host ecosystem with a renter, and
// then isolates one of the hosts from the network, denying the host proper
// transaction propagation. The renters performed chained contract forming and
// uploading in the same manner that might happen in the wild, and then the
// host must get a file contract to the blockchain despite not getting any of
// the dependencies into the transaction pool from the flood network.
func TestHostPoorConnectivity(t *testing.T) {
	if testing.Short() {
		t.SkipNow()
	}
	t.Parallel()

	// Create the various nodes that will be forming the simulated ecosystem of
	// this test.
	stLeader, err := createServerTester("TestHostPoorConnectivity - Leader")
	if err != nil {
		t.Fatal(err)
	}
	stHost1, err := blankServerTester("TestHostPoorConnectivity - Host 1")
	if err != nil {
		t.Fatal(err)
	}
	stHost2, err := blankServerTester("TestHostPoorConnectivity - Host 2")
	if err != nil {
		t.Fatal(err)
	}
	stHost3, err := blankServerTester("TestHostPoorConnectivity - Host 3")
	if err != nil {
		t.Fatal(err)
	}
	stHost4, err := blankServerTester("TestHostPoorConnectivity - Host 4")
	if err != nil {
		t.Fatal(err)
	}
	stRenter1, err := blankServerTester("TestHostPoorConnectivity - Renter 1")
	if err != nil {
		t.Fatal(err)
	}
	stRenter2, err := blankServerTester("TestHostPoorConnectivity - Renter 2")
	if err != nil {
		t.Fatal(err)
	}

	// Fetch all of the addresses of the nodes that got created.
	var ggSTL, ggSTH1, ggSTH2, ggSTH3, ggSTH4, ggSTR1, ggSTR2 GatewayGET
	err = stLeader.getAPI("/gateway", &ggSTL)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost1.getAPI("/gateway", &ggSTH1)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost2.getAPI("/gateway", &ggSTH2)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost3.getAPI("/gateway", &ggSTH3)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost4.getAPI("/gateway", &ggSTH4)
	if err != nil {
		t.Fatal(err)
	}
	err = stRenter1.getAPI("/gateway", &ggSTR1)
	if err != nil {
		t.Fatal(err)
	}
	err = stRenter2.getAPI("/gateway", &ggSTR2)
	if err != nil {
		t.Fatal(err)
	}

	// Connect all of the peers in a circle, so that everyone is connected but
	// there are a lot of hops.
	err = stLeader.stdPostAPI("/gateway/connect/"+string(ggSTH1.NetAddress), nil)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost1.stdPostAPI("/gateway/connect/"+string(ggSTH2.NetAddress), nil)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost2.stdPostAPI("/gateway/connect/"+string(ggSTH3.NetAddress), nil)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost3.stdPostAPI("/gateway/connect/"+string(ggSTH4.NetAddress), nil)
	if err != nil {
		t.Fatal(err)
	}
	err = stHost4.stdPostAPI("/gateway/connect/"+string(ggSTR1.NetAddress), nil)
	if err != nil {
		t.Fatal(err)
	}
	err = stRenter1.stdPostAPI("/gateway/connect/"+string(ggSTR2.NetAddress), nil)
	if err != nil {
		t.Fatal(err)
	}
	err = stRenter2.stdPostAPI("/gateway/connect/"+string(ggSTL.NetAddress), nil)
	if err != nil {
		t.Fatal(err)
	}

	// Connectivity check - all nodes should be synchronized to the leader's
	// chain, which should have been the longest.
	allTesters := []*serverTester{stLeader, stHost1, stHost2, stHost3, stHost4, stRenter1, stRenter2}
	chainTip, err := synchronizationCheck(allTesters)
	if err != nil {
		t.Fatal(err)
	}

	// Mine a block from each node, to give the node money in the wallet that
	// is recognized by the shared chain.
	for i := range allTesters {
		// Wait until the current tester has 'chainTip' as its current
		// block, to make sure the network is building a community chain
		// instead of creating orphans.
		var cg ConsensusGET
		success := false
		for j := 0; j < 100; j++ {
			err = allTesters[i].getAPI("/consensus", &cg)
			if err != nil {
				t.Fatal(err)
			}
			if cg.CurrentBlock == chainTip {
				success = true
				break
			}
			time.Sleep(time.Millisecond * 100)
		}
		if !success {
			t.Fatal("nodes do not seem to be synchronizing")
		}
		err := allTesters[i].cs.Flush()
		if err != nil {
			t.Fatal(err)
		}

		// Mine a block for this node. The next iteration will wait for
		// synchronization before mining the block for the next node.
		block, err := allTesters[i].miner.AddBlock()
		if err != nil {
			t.Fatal(err, i)
		}
		chainTip = block.ID()
	}

	// Wait until the leader has the most recent block.
	var cg ConsensusGET
	success := false
	for i := 0; i < 100; i++ {
		err = allTesters[0].getAPI("/consensus", &cg)
		if err != nil {
			t.Fatal(err)
		}
		if cg.CurrentBlock == chainTip {
			success = true
			break
		}
		time.Sleep(time.Millisecond * 100)
	}
	if !success {
		t.Fatal("nodes do not seem to be synchronizing")
	}

	// Make sure that everyone has the most recent block.
	_, err = synchronizationCheck(allTesters)
	if err != nil {
		t.Fatal(err)
	}

	// Mine blocks from the leader until everyone's miner payouts have matured
	// and become spendable.
	for i := types.BlockHeight(0); i <= types.MaturityDelay; i++ {
		_, err := stLeader.miner.AddBlock()
		if err != nil {
			t.Fatal(err)
		}
	}
	_, err = synchronizationCheck(allTesters)
	if err != nil {
		t.Fatal(err)
	}
}


text:
class TemplateRequirement:
  def __init__(self,reqId,reqName,assetName,reqType,reqDesc,reqRat,reqFC):
    self.theId = reqId
    self.theName = reqName
    self.theAssetName = assetName
    self.theType = reqType
    self.theDescription= reqDesc
    self.theRationale = reqRat
    self.theFitCriterion = reqFC

  def id(self): return self.theId
  def name(self): return self.theName
  def asset(self): return self.theAssetName
  def type(self): return self.theType
  def description(self): return self.theDescription
  def rationale(self): return self.theRationale
  def fitCriterion(self): return self.theFitCriterion


text:
module PLDCleaner
  extend self

  COLLECTION_NAMES = [:companies, :people]

  def clean!(client)
    COLLECTION_NAMES.each do |collection_name|
      collection = client.send(collection_name)

      collection.each do |model|
        #CRITICAL
        model.destroy || raise("Could not remove #{model.inspect}")
      end
    end
  end
end


text:
package com.linecorp.armeria.internal.client.grpc;

import java.util.concurrent.CompletableFuture;

import com.linecorp.armeria.client.ClientRequestContext;
import com.linecorp.armeria.client.HttpClient;
import com.linecorp.armeria.client.SimpleDecoratingHttpClient;
import com.linecorp.armeria.common.CommonPools;
import com.linecorp.armeria.common.HttpRequest;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.internal.common.grpc.MetadataUtil;

import io.grpc.Attributes;
import io.grpc.CallCredentials;
import io.grpc.CallCredentials.MetadataApplier;
import io.grpc.CallCredentials.RequestInfo;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.SecurityLevel;
import io.grpc.Status;

final class CallCredentialsDecoratingClient extends SimpleDecoratingHttpClient {

    private final CallCredentials credentials;
    private final MethodDescriptor<?, ?> method;
    private final String authority;

    CallCredentialsDecoratingClient(HttpClient delegate, CallCredentials credentials,
                                    MethodDescriptor<?, ?> method, String authority) {
        super(delegate);
        this.credentials = credentials;
        this.method = method;
        this.authority = authority;
    }

    @Override
    public HttpResponse execute(ClientRequestContext ctx, HttpRequest req) {
        final CompletableFuture<HttpResponse> response = new CompletableFuture<>();

        final RequestInfo requestInfo = new RequestInfo() {
            @Override
            public MethodDescriptor<?, ?> getMethodDescriptor() {
                return method;
            }

            @Override
            public SecurityLevel getSecurityLevel() {
                // Semantics of SecurityLevel aren't very clear but we follow the pattern of the upstream
                // client.
                // https://github.com/grpc/grpc-java/blob/bf2a66c8a2d52be41afd7090c151984a3ce64e0d/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java#L586
                return ctx.sessionProtocol().isTls() ? SecurityLevel.PRIVACY_AND_INTEGRITY : SecurityLevel.NONE;
            }

            @Override
            public String getAuthority() {
                return authority;
            }

            @Override
            public Attributes getTransportAttrs() {
                // There is a race condition where the first request to an endpoint will not have transport
                // attributes available yet. It seems unlikely that CallCredentials could ever use these
                // attributes reliably, so for now don't return them and revisit if anyone needs them.

                // The most popular CallCredentials, GoogleAuthLibraryCallCredentials, do not use the transport
                // attributes.
                // https://github.com/grpc/grpc-java/blob/master/auth/src/main/java/io/grpc/auth/GoogleAuthLibraryCallCredentials.java
                return Attributes.EMPTY;
            }
        };

        credentials.applyRequestMetadata(
                requestInfo,
                CommonPools.blockingTaskExecutor(),
                new MetadataApplier() {
                    @Override
                    public void apply(Metadata metadata) {
                        ctx.mutateAdditionalRequestHeaders(
                                headers -> MetadataUtil.fillHeaders(metadata, headers));
                        try {
                            response.complete(delegate().execute(ctx, req));
                        } catch (Exception e) {
                            response.completeExceptionally(e);
                        }
                    }

                    @Override
                    public void fail(Status status) {
                        response.completeExceptionally(status.asRuntimeException());
                    }
                });

        return HttpResponse.from(response);
    }
}


text:
package com.tle.web.searching.itemlist;

import com.google.inject.Inject;
import com.tle.beans.item.Item;
import com.tle.beans.item.attachments.AttachmentType;
import com.tle.beans.item.attachments.FileAttachment;
import com.tle.core.guice.Bind;
import com.tle.core.mimetypes.MimeTypeService;
import com.tle.web.itemlist.item.ListSettings;
import com.tle.web.itemlist.item.StandardItemListEntry;
import com.tle.web.sections.equella.annotation.PlugKey;
import com.tle.web.sections.events.RenderContext;
import com.tle.web.sections.result.util.CountLabel;
import com.tle.web.sections.result.util.IconLabel;
import com.tle.web.sections.result.util.IconLabel.Icon;
import com.tle.web.sections.result.util.PluralKeyLabel;
import com.tle.web.sections.standard.model.HtmlLinkState;
import com.tle.web.sections.standard.renderers.DivRenderer;
import com.tle.web.sections.standard.renderers.LinkRenderer;
import java.util.List;

@SuppressWarnings("nls")
@Bind
public class ItemListImageCountDisplaySection extends ItemListFileCountDisplaySection {
  @PlugKey("images.count")
  private static String COUNT_KEY;

  @Inject private MimeTypeService mimeTypeService;

  @Override
  public ProcessEntryCallback<Item, StandardItemListEntry> processEntries(
      final RenderContext context,
      List<StandardItemListEntry> entries,
      ListSettings<StandardItemListEntry> listSettings) {
    final boolean countDisabled = isFileCountDisabled();

    return new ProcessEntryCallback<Item, StandardItemListEntry>() {
      @Override
      public void processEntry(StandardItemListEntry entry) {
        if (!countDisabled) {
          final boolean canViewRestricted = canViewRestricted(entry.getItem());

          // Optimised?
          final List<FileAttachment> fileatts = entry.getAttachments().getList(AttachmentType.FILE);
          long count =
              fileatts.stream()
                  .filter(
                      fa -> {
                        if (canViewRestricted || !fa.isRestricted()) {
                          String mimeType =
                              mimeTypeService.getMimeTypeForFilename(fa.getFilename());
                          return mimeType.startsWith("image");
                        }
                        return false;
                      })
                  .count();

          if (count > 1) {
            // disabled link renders as a span, deel wiv it
            HtmlLinkState link =
                new HtmlLinkState(new IconLabel(Icon.IMAGE, new CountLabel(count), false));
            link.setDisabled(true);
            link.setTitle(new PluralKeyLabel(COUNT_KEY, count));
            entry.setThumbnailCount(new DivRenderer("filecount", new LinkRenderer(link)));
          }
        }
      }
    };
  }
}


text:
#include <zephyr/kernel.h>

#include <kernel_internal.h>
#include <zephyr/kernel_structs.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/logging/log_ctrl.h>
#include <zephyr/logging/log.h>
#include <zephyr/fatal.h>
#ifndef	CONFIG_XTENSA
#include <zephyr/debug/coredump.h>
#endif

LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);

/* LCOV_EXCL_START */
FUNC_NORETURN __weak void arch_system_halt(unsigned int reason)
{
	ARG_UNUSED(reason);

	/* TODO: What's the best way to totally halt the system if SMP
	 * is enabled?
	 */

	(void)arch_irq_lock();
	for (;;) {
		/* Spin endlessly */
	}
}
/* LCOV_EXCL_STOP */

/* LCOV_EXCL_START */
__weak void k_sys_fatal_error_handler(unsigned int reason,
				      const z_arch_esf_t *esf)
{
	ARG_UNUSED(esf);

	LOG_PANIC();
	LOG_ERR("Halting system");
	arch_system_halt(reason);
	CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
}
/* LCOV_EXCL_STOP */

static const char *thread_name_get(struct k_thread *thread)
{
	const char *thread_name = (thread != NULL) ? k_thread_name_get(thread) : NULL;

	if ((thread_name == NULL) || (thread_name[0] == '\0')) {
		thread_name = "unknown";
	}

	return thread_name;
}

static const char *reason_to_str(unsigned int reason)
{
	switch (reason) {
	case K_ERR_CPU_EXCEPTION:
		return "CPU exception";
	case K_ERR_SPURIOUS_IRQ:
		return "Unhandled interrupt";
	case K_ERR_STACK_CHK_FAIL:
		return "Stack overflow";
	case K_ERR_KERNEL_OOPS:
		return "Kernel oops";
	case K_ERR_KERNEL_PANIC:
		return "Kernel panic";
	default:
		return "Unknown error";
	}
}

/* LCOV_EXCL_START */
FUNC_NORETURN void k_fatal_halt(unsigned int reason)
{
	arch_system_halt(reason);
}
/* LCOV_EXCL_STOP */

static inline int get_cpu(void)
{
#if defined(CONFIG_SMP)
	return arch_curr_cpu()->id;
#else
	return 0;
#endif
}

void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
{
	/* We can't allow this code to be preempted, but don't need to
	 * synchronize between CPUs, so an arch-layer lock is
	 * appropriate.
	 */
	unsigned int key = arch_irq_lock();
	struct k_thread *thread = IS_ENABLED(CONFIG_MULTITHREADING) ?
			k_current_get() : NULL;

	/* twister looks for the "ZEPHYR FATAL ERROR" string, don't
	 * change it without also updating twister
	 */
	LOG_ERR(">>> ZEPHYR FATAL ERROR %d: %s on CPU %d", reason,
		reason_to_str(reason), get_cpu());

	/* FIXME: This doesn't seem to work as expected on all arches.
	 * Need a reliable way to determine whether the fault happened when
	 * an IRQ or exception was being handled, or thread context.
	 *
	 * See #17656
	 */
#if defined(CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION)
	if ((esf != NULL) && arch_is_in_nested_exception(esf)) {
		LOG_ERR("Fault during interrupt handling\n");
	}
#endif

	LOG_ERR("Current thread: %p (%s)", thread,
		thread_name_get(thread));

#ifndef CONFIG_XTENSA
	coredump(reason, esf, thread);
#endif

	k_sys_fatal_error_handler(reason, esf);

	/* If the system fatal error handler returns, then kill the faulting
	 * thread; a policy decision was made not to hang the system.
	 *
	 * Policy for fatal errors in ISRs: unconditionally panic.
	 *
	 * There is one exception to this policy: a stack sentinel
	 * check may be performed (on behalf of the current thread)
	 * during ISR exit, but in this case the thread should be
	 * aborted.
	 *
	 * Note that k_thread_abort() returns on some architectures but
	 * not others; e.g. on ARC, x86_64, Xtensa with ASM2, ARM
	 */
	if (!IS_ENABLED(CONFIG_TEST)) {
		__ASSERT(reason != K_ERR_KERNEL_PANIC,
			 "Attempted to recover from a kernel panic condition");
		/* FIXME: #17656 */
#if defined(CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION)
		if ((esf != NULL) && arch_is_in_nested_exception(esf)) {
#if defined(CONFIG_STACK_SENTINEL)
			if (reason != K_ERR_STACK_CHK_FAIL) {
				__ASSERT(0,
				 "Attempted to recover from a fatal error in ISR");
			 }
#endif /* CONFIG_STACK_SENTINEL */
		}
#endif /* CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION */
	} else {
		/* Test mode */
#if defined(CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION)
		if ((esf != NULL) && arch_is_in_nested_exception(esf)) {
			/* Abort the thread only on STACK Sentinel check fail. */
#if defined(CONFIG_STACK_SENTINEL)
			if (reason != K_ERR_STACK_CHK_FAIL) {
				arch_irq_unlock(key);
				return;
			}
#else
			arch_irq_unlock(key);
			return;
#endif /* CONFIG_STACK_SENTINEL */
		} else {
			/* Abort the thread only if the fault is not due to
			 * a spurious ISR handler triggered.
			 */
			if (reason == K_ERR_SPURIOUS_IRQ) {
				arch_irq_unlock(key);
				return;
			}
		}
#endif /*CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION */
	}

	arch_irq_unlock(key);

	if (IS_ENABLED(CONFIG_MULTITHREADING)) {
		k_thread_abort(thread);
	}
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Asperella duthiei Stapf ex Hook.f.

### Remarks
null


text:
package org.cloudfoundry.samples.music;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@EnableAutoConfiguration
@ComponentScan("org.cloudfoundry.samples.music")
@EnableJpaRepositories("org.cloudfoundry.samples.music.repositories")
@EntityScan("org.cloudfoundry.samples.music.model")
@EnableWebMvc
public class Application extends SpringBootServletInitializer {

	/**
	 * Spring-boot hook into servlet lifecyle for deployment to servlet container.
	 */
	@Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

	/**
	 * Spring-boot harness for running application standalone.
	 */
	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}


text:
#include <assert.h>
#include <vector>
#include <boost/unordered_map.hpp>
#include <nparse/nparse.hpp>
#include <util/free.hpp>
#include "../static.hpp"
#include "../source_tree.hpp"

namespace {

using namespace nparse;

class Staging: public IStaging
{
	plugin::instance<IAcceptorFactory> m_factory;
	SourceTree<string_t> m_st;

	typedef std::vector<IAcceptor*> stored_t;
	stored_t m_stored;

	typedef boost::unordered_map<string_t, anta::ndl::Cluster<NLG>*> clusters_t;
	clusters_t m_clusters;

	typedef boost::unordered_map<string_t, const IAcceptor*> acceptors_t;
	acceptors_t m_acceptors;

	typedef std::vector<action_pointer> action_stack_t;
	action_stack_t m_action_stack;

	typedef std::vector<joint_pointer> joint_stack_t;
	joint_stack_t m_joint_stack;

	typedef std::vector<plugin::IFactory*> bound_factories_t;
	bound_factories_t m_bound_factories;

	typedef std::vector<anta::range<SG>::type> import_hints_t;
	import_hints_t m_import_hints;

	string_t m_namespace;

public:
	Staging ():
		m_factory ("nparse.AcceptorFactory")
	{
	}

	~Staging ()
	{
		utility::free_all(m_stored);
		utility::free2nds(m_clusters);
		utility::free2nds(m_acceptors);
		utility::free_all(m_bound_factories);
	}

public:
	// Overridden from IStaging:

	anta::ndl::Cluster<NLG>& cluster (const string_t& a_name)
	{
		string_t name = a_name;

		clusters_t::iterator found_at = m_clusters. find(name);
		if (found_at == m_clusters. end() && ! m_namespace. empty()
				&& name. find_first_of(L'.') == name. npos)
		{
			name. insert(0, m_namespace);
			found_at = m_clusters. find(name);
		}

		if (found_at == m_clusters. end())
		{
			const std::pair<clusters_t::iterator, bool> p = m_clusters. insert(
				clusters_t::value_type(name, new anta::ndl::Cluster<NLG>(name))
			);
			assert(p. second);
			found_at = p. first;
		}

		return *(found_at -> second);
	}

	const anta::Acceptor<NLG>& acceptor (const string_t& a_def)
	{
		// @todo: acceptor key (a_def) depends on current path
		const std::string& path = m_st. current_path();
		acceptors_t::iterator found_at = m_acceptors. find(a_def);
		if (found_at == m_acceptors. end())
		{
			const IAcceptor* instance = NULL;
			if (! m_factory -> create(a_def, instance, path))
			{
				// NOTE: Yes, it's a logic error!
				throw std::logic_error("unable to create an acceptor from"
						" the given definition");
			}
			const std::pair<acceptors_t::iterator, bool> p =
				m_acceptors. insert(acceptors_t::value_type(a_def, instance));
			assert(p. second);
			found_at = p. first;
		}
		return *(found_at -> second);
	}

	const anta::Acceptor<NLG>& acceptor (IAcceptor* a_ptr)
	{
		m_stored. push_back(a_ptr);
		return *a_ptr;
	}

	void push (const action_pointer& a_ptr)
	{
		m_action_stack. push_back(a_ptr);
	}

	action_pointer pop ()
	{
		assert(! m_action_stack. empty());
		const action_pointer top = m_action_stack. back();
		m_action_stack. pop_back();
		return top;
	}

	action_pointer top () const
	{
		assert(! m_action_stack. empty());
		return m_action_stack. back();
	}

	void swap (std::vector<action_pointer>& a_av)
	{
		m_action_stack. swap(a_av);
		m_action_stack. clear();
	}

	void import (const std::string& a_path, const bool a_reset)
	{
		m_st. import(a_path, a_reset, -1);
	}

	void import (const anta::range<SG>::type& a_path)
	{
		const string_t path(a_path. first, a_path. second);
		const int hint = static_cast<int>(m_import_hints. size());
		m_import_hints. push_back(a_path);
		m_st. import(path, false, hint);
	}

	bool load (anta::range<SG>::type& a_range)
	{
		SourceTree<string_t>::range r;
		try
		{
			if (! m_st. load(r))
			{
				return false;
			}
		}
		catch (const std::exception& err_)
		{
			ex::compile_error err;
			err << ex::message(err_. what());
			const int hint_ = m_st. current_hint();
			if (hint_ >= 0)
			{
				const import_hints_t::size_type index =
					static_cast<import_hints_t::size_type>(hint_);
				const anta::range<SG>::type& where = m_import_hints[index];
				err << ex::location(where);
			}
			throw err;
		}
		a_range. first = &* r. first;
		a_range. second = &* r. second;
		m_namespace. clear();
		return true;
	}

	bool identify (const anta::iterator<SG>::type& a_iterator,
			std::string& a_file, int& a_line, int& a_offset) const
	{
		const SourceTree<string_t>::iterator iter(a_iterator);
		return m_st. identify(iter, a_file, a_line, a_offset);
	}

	void setNamespace (const string_t& a_namespace)
	{
		m_namespace = a_namespace;
		if (! m_namespace. empty())
		{
			m_namespace. append(1, L'.');
		}
	}

	const string_t& getNamespace () const
	{
		return m_namespace;
	}

	void pushJoint (const joint_pointer& a_ptr)
	{
		m_joint_stack. push_back(a_ptr);
	}

	joint_pointer popJoint ()
	{
		assert(! m_joint_stack. empty());
		const joint_pointer top = m_joint_stack. back();
		m_joint_stack. pop_back();
		return top;
	}

	void bind (plugin::IFactory* a_factory)
	{
		m_bound_factories. push_back(a_factory);
	}

	void extend (ex::generic_error& a_error) const
	{
		// Check whether the exception has been bound to a file already.
		if (boost::get_error_info<ex::file>(a_error))
		{
			return;
		}

		// Check whether the exception has location information.
		const anta::range<SG>::type* pin =
			boost::get_error_info<ex::location>(a_error);
		if (! pin)
		{
			return;
		}

		// Try to identify location.
		std::string file;
		int line, offset;
		if (! identify(pin -> first, file, line, offset))
		{
			return;
		}

		// Add file/line/offset to the exception.
		a_error << ex::file(file) << ex::line(line) << ex::offset(offset);
	}

};

class StagingFactory: public IStagingFactory
{
public:
	boost::shared_ptr<IStaging> createInstance ()
	{
		return boost::shared_ptr<IStaging>(new Staging());
	}

};

} // namespace

PLUGIN(StagingFactory, script_staging, nparse.script.StagingFactory)


text:
<?php

namespace Magento\ConfigurableProduct\Model\ResourceModel\Indexer\Stock;

/**
 * CatalogInventory Configurable Products Stock Status Indexer Resource Model
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus;

class Configurable extends \Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock
{
    /**
     * Get the select object for get stock status by configurable product ids
     *
     * @param int|array $entityIds
     * @param bool $usePrimaryTable use primary or temporary index table
     * @return \Magento\Framework\DB\Select
     */
    protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = false)
    {
        $connection = $this->getConnection();
        $idxTable = $usePrimaryTable ? $this->getMainTable() : $this->getIdxTable();
        $select = $connection->select()->from(['e' => $this->getTable('catalog_product_entity')], ['entity_id']);
        $this->_addWebsiteJoinToSelect($select, true);
        $this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', 'e.entity_id');
        $select->columns(
            'cw.website_id'
        )->join(
            ['cis' => $this->getTable('cataloginventory_stock')],
            '',
            ['stock_id']
        )->joinLeft(
            ['cisi' => $this->getTable('cataloginventory_stock_item')],
            'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id',
            []
        )->joinLeft(
            ['l' => $this->getTable('catalog_product_super_link')],
            'l.parent_id = e.entity_id',
            []
        )->join(
            ['le' => $this->getTable('catalog_product_entity')],
            'le.entity_id = l.product_id',
            []
        )->joinLeft(
            ['i' => $idxTable],
            'i.product_id = l.product_id AND cw.website_id = i.website_id AND cis.stock_id = i.stock_id',
            []
        )->columns(
            ['qty' => new \Zend_Db_Expr('0')]
        )->where(
            'cw.website_id != 0'
        )->where(
            'e.type_id = ?',
            $this->getTypeId()
        )->group(
            ['e.entity_id', 'cw.website_id', 'cis.stock_id']
        );

        $psExpr = $this->_addAttributeToSelect($select, 'status', 'e.entity_id', 'cs.store_id');
        $psCond = $connection->quoteInto($psExpr . '=?', ProductStatus::STATUS_ENABLED);

        if ($this->_isManageStock()) {
            $statusExpr = $connection->getCheckSql(
                'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0',
                1,
                'cisi.is_in_stock'
            );
        } else {
            $statusExpr = $connection->getCheckSql(
                'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1',
                'cisi.is_in_stock',
                1
            );
        }

        $optExpr = $connection->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', 0);
        $stockStatusExpr = $connection->getLeastSql(["MAX({$optExpr})", "MIN({$statusExpr})"]);

        $select->columns(['status' => $stockStatusExpr]);

        if ($entityIds !== null) {
            $select->where('e.entity_id IN(?)', $entityIds);
        }

        return $select;
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Graphis elegans f. albocincta Erichsen

### Remarks
null


text:
#ifndef _SECP256K1_UTIL_H_
#define _SECP256K1_UTIL_H_

#if defined HAVE_CONFIG_H
#include "libsecp256k1-config.h"
#endif

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>

#ifdef DETERMINISTIC
#define TEST_FAILURE(msg) do { \
    fprintf(stderr, "%s\n", msg); \
    abort(); \
} while(0);
#else
#define TEST_FAILURE(msg) do { \
    fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, msg); \
    abort(); \
} while(0)
#endif

#ifndef HAVE_BUILTIN_EXPECT
#define EXPECT(x,c) __builtin_expect((x),(c))
#else
#define EXPECT(x,c) (x)
#endif

#ifdef DETERMINISTIC
#define CHECK(cond) do { \
    if (EXPECT(!(cond), 0)) { \
        TEST_FAILURE("test condition failed"); \
    } \
} while(0)
#else
#define CHECK(cond) do { \
    if (EXPECT(!(cond), 0)) { \
        TEST_FAILURE("test condition failed: " #cond); \
    } \
} while(0)
#endif

/* Like assert(), but safe to use on expressions with side effects. */
#ifndef NDEBUG
#define DEBUG_CHECK CHECK
#else
#define DEBUG_CHECK(cond) do { (void)(cond); } while(0)
#endif

/* Like DEBUG_CHECK(), but when VERIFY is defined instead of NDEBUG not defined. */
#ifdef VERIFY
#define VERIFY_CHECK CHECK
#else
#define VERIFY_CHECK(cond) do { (void)(cond); } while(0)
#endif

static inline void *checked_malloc(size_t size) {
    void *ret = malloc(size);
    CHECK(ret != NULL);
    return ret;
}

/* Macro for restrict, when available and not in a VERIFY build. */
#if defined(SECP256K1_BUILD) && defined(VERIFY)
# define SECP256K1_RESTRICT
#else
# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
#  if SECP256K1_GNUC_PREREQ(3,0)
#   define SECP256K1_RESTRICT __restrict__
#  elif (defined(_MSC_VER) && _MSC_VER >= 1400)
#   define SECP256K1_RESTRICT __restrict
#  else
#   define SECP256K1_RESTRICT
#  endif
# else
#  define SECP256K1_RESTRICT restrict
# endif
#endif

#endif


text:
using System;
using System.Linq;
using Microsoft.WindowsAzure.Management.StorSimple.Models;

namespace Microsoft.WindowsAzure.Management.StorSimple.Models
{
    /// <summary>
    /// This class respresents the details for backup request.
    /// </summary>
    public partial class BackupNowRequest
    {
        private BackupType _type;

        /// <summary>
        /// Required. The backup type.
        /// </summary>
        public BackupType Type
        {
            get { return this._type; }
            set { this._type = value; }
        }

        /// <summary>
        /// Initializes a new instance of the BackupNowRequest class.
        /// </summary>
        public BackupNowRequest()
        {
        }

        /// <summary>
        /// Initializes a new instance of the BackupNowRequest class with
        /// required arguments.
        /// </summary>
        public BackupNowRequest(BackupType type)
            : this()
        {
            this.Type = type;
        }
    }
}


text:
"""
Test std::shared_ptr functionality with a class from debug info as content.
"""

from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil

class TestSharedPtrDbgInfoContent(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    # FIXME: This should work on more setups, so remove these
    # skipIf's in the future.
    @add_test_categories(["libc++"])
    @skipIf(compiler=no_match("clang"))
    @skipIf(oslist=no_match(["linux"]))
    @skipIf(debug_info=no_match(["dwarf"]))
    def test(self):
        self.build()

        lldbutil.run_to_source_breakpoint(self,
            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))

        self.runCmd("settings set target.import-std-module true")

        self.expect("expr (int)s->a", substrs=['(int) $0 = 3'])
        self.expect("expr (int)(s->a = 5)", substrs=['(int) $1 = 5'])
        self.expect("expr (int)s->a", substrs=['(int) $2 = 5'])
        self.expect("expr (bool)s", substrs=['(bool) $3 = true'])
        self.expect("expr s.reset()")
        self.expect("expr (bool)s", substrs=['(bool) $4 = false'])


text:
This is your dinosaur-enabled editor. The insert menu allows you
  to insert dinosaurs.

This paragraph , for example,

  is full  of
  dinosaurs.

Dinosaur nodes can be selected, copied, pasted, dragged, and so on.