text:
package com.discobeard.lwjgl.display;

import com.discobeard.lwjgl.game.Console;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public class DisplayUtils {

    public static List<DisplayMode> getDisplayModes(){
        List<DisplayMode> returnableModes = new ArrayList<>();
        try {
            DisplayMode[] modes = Display.getAvailableDisplayModes();

            for(DisplayMode mode :modes){
                if(mode.getFrequency()==60&& mode.getBitsPerPixel()==32){
                    returnableModes.add(mode);
                }

            }
        } catch (LWJGLException e) {
            Console.log("Could not get display modes");
        }

        return returnableModes;
    }

    public static ByteBuffer[] createIconsFromBuffers(List<ByteBuffer> byteBuffers) throws IOException {

        ByteBuffer[] icons = new ByteBuffer[byteBuffers.size()];

        for (int i = 0; i < byteBuffers.size(); i++) {
            icons[i] = byteBuffers.get(i);
        }

        return icons;
    }

}


text:
/*!
    \file  gd32f30x_libopt.h
    \brief library optional for gd32f30x

    \version 2018-10-10, V1.1.0, firmware for GD32F30x(The version is for mbed)
*/

/*
    Copyright (c) 2018, GigaDevice Semiconductor Inc.

    All rights reserved.

    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.
    2. Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.
    3. Neither the name of the copyright holder nor the names of its 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 HOLDER 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.
*/

#ifndef GD32F30X_LIBOPT_H
#define GD32F30X_LIBOPT_H

#include "gd32f30x_rcu.h"
#include "gd32f30x_adc.h"
#include "gd32f30x_can.h"
#include "gd32f30x_crc.h"
#include "gd32f30x_ctc.h"
#include "gd32f30x_dac.h"
#include "gd32f30x_dbg.h"
#include "gd32f30x_dma.h"
#include "gd32f30x_exti.h"
#include "gd32f30x_fmc.h"
#include "gd32f30x_fwdgt.h"
#include "gd32f30x_gpio.h"
#include "gd32f30x_i2c.h"
#include "gd32f30x_pmu.h"
#include "gd32f30x_bkp.h"
#include "gd32f30x_rtc.h"
#include "gd32f30x_sdio.h"
#include "gd32f30x_spi.h"
#include "gd32f30x_timer.h"
#include "gd32f30x_usart.h"
#include "gd32f30x_wwdgt.h"
#include "gd32f30x_misc.h"
#include "gd32f30x_enet.h"
#include "gd32f30x_exmc.h"

#endif /* GD32F30X_LIBOPT_H */

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2011-2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.security.zynamics.binnavi.Gui.GraphWindows.Undo;

import java.net.URL;

import javax.swing.JTree;

import com.google.security.zynamics.binnavi.Help.CHelpFunctions;
import com.google.security.zynamics.binnavi.Help.IHelpInformation;
import com.google.security.zynamics.binnavi.Help.IHelpProvider;

/**
 * Tree that shows the selection history.
 */
public final class CUndoTree extends JTree implements IHelpProvider {
  /**
   * Used for serialization.
   */
  private static final long serialVersionUID = 6738360704404921690L;

  /**
   * Creates a new UndoTree object.
   *
   * @param rootNode Root node of the tree.
   */
  public CUndoTree(final CSelectionHistoryTreeNode rootNode) {
    super(rootNode);
  }

  @Override
  public IHelpInformation getHelpInformation() {
    return new IHelpInformation() {
      @Override
      public String getText() {
        return "This tree is used to keep track of recent selection states. By clicking on the nodes of the tree you can return to earlier selection states.";
      }

      @Override
      public URL getUrl() {
        return CHelpFunctions.urlify(CHelpFunctions.MAIN_WINDOW_FILE);
      }
    };
  }
}


text:
<?php

namespace Doctrine\KeyValueStore\Storage;

/**
 * Storage abstraction layer for key-value stores
 *
 * The storage layer is an interface for the CRUD operations on datastorages.
 * There is currently no support for update in place operations that many of
 * the no-sql databases have for counters and such. The focus is on mapping
 * the data onto PHP objects. More efficient operations if required should be
 * done with the raw connection of the underlying storage.
 *
 * The assumption is that keys are always arrays of multiple values. Each
 * implementation has to handle the serialization of this keys into a single
 * value if necessary or disallow composite primary keys through the
 * {@supportsCompositePrimarKeys()} flag.
 *
 * Batch Query facilities of the storages will be handled through another
 * interface.
 *
 * @author Benjamin Eberlei <kontakt@beberlei.de>
 */
interface Storage
{
    /**
     * Determine if the storage supports updating only a subset of properties,
     * or if all properties have to be set, even if only a subset of properties
     * changed.
     *
     * @return bool
     */
    public function supportsPartialUpdates();

    /**
     * Does this storage support composite primary keys?
     *
     * @return bool
     */
    public function supportsCompositePrimaryKeys();

    /**
     * Does this storage require composite primary keys?
     *
     * @return bool
     */
    public function requiresCompositePrimaryKeys();

    /**
     * Insert data into the storage key specified.
     *
     * @param string $storageName
     * @param array|string $key
     * @param array $data
     * @return void
     */
    public function insert($storageName, $key, array $data);

    /**
     * Update data into the given key.
     *
     * @param string $storageName
     * @param array|string $key
     * @param array $data
     * @return void
     */
    public function update($storageName, $key, array $data);

    /**
     * Delete data at key
     *
     * @param string $storageName
     * @param array|string $key
     * @return void
     */
    public function delete($storageName, $key);

    /**
     * Find data at key
     *
     * Important note: The returned array does contain the identifier (again)!
     *
     * @throws Doctrine\KeyValueStore\NotFoundException When data with key is not found.
     *
     * @param string $storageName
     * @param array|string $key
     * @return array
     */
    public function find($storageName, $key);

    /**
     * Return a name of the underlying storage.
     *
     * @return string
     */
    public function getName();
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Puccinia artemisiae-hookerianae Dietel

### Remarks
null


text:
<?php namespace Pixel\Services;

use Pixel\User;
use Validator;
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;

class Registrar implements RegistrarContract {

	/**
	 * Get a validator for an incoming registration request.
	 *
	 * @param  array  $data
	 * @return \Illuminate\Contracts\Validation\Validator
	 */
	public function validator(array $data)
	{
		return Validator::make($data, [
			'name' => 'required|max:255',
			'email' => 'required|email|max:255|unique:users',
			'password' => 'required|confirmed|min:6',
		]);
	}

	/**
	 * Create a new user instance after a valid registration.
	 *
	 * @param  array  $data
	 * @return User
	 */
	public function create(array $data)
	{
		return User::create([
			'name' => $data['name'],
			'email' => $data['email'],
			'password' => bcrypt($data['password']),
		]);
	}

}


text:
test_error
==========

test_error is used to raise an error to test if exception_notification really works.

Install
-------

add in Gemfile

    gem "test_error", "~> 1.0.0"

Usage
-----

visit http://yourapp.com/test_error, then an error raised.
if you setup exception_notification correctly, you should receive the exception notify email.

Copyright © 2010 Richard Huang (flyerhzm@gmail.com), released under the MIT license


text:
#pragma once
#include <aws/redshift/Redshift_EXPORTS.h>
#include <aws/redshift/RedshiftRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Redshift
{
namespace Model
{

  /**
   *

See Also:
   AWS
   * API Reference

   */
  class AWS_REDSHIFT_API DescribeClusterParametersRequest : public RedshiftRequest
  {
  public:
    DescribeClusterParametersRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DescribeClusterParameters"; }

    Aws::String SerializePayload() const override;

  protected:
    void DumpBodyToUrl(Aws::Http::URI& uri ) const override;

  public:

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline const Aws::String& GetParameterGroupName() const{ return m_parameterGroupName; }

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline bool ParameterGroupNameHasBeenSet() const { return m_parameterGroupNameHasBeenSet; }

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline void SetParameterGroupName(const Aws::String& value) { m_parameterGroupNameHasBeenSet = true; m_parameterGroupName = value; }

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline void SetParameterGroupName(Aws::String&& value) { m_parameterGroupNameHasBeenSet = true; m_parameterGroupName = std::move(value); }

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline void SetParameterGroupName(const char* value) { m_parameterGroupNameHasBeenSet = true; m_parameterGroupName.assign(value); }

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline DescribeClusterParametersRequest& WithParameterGroupName(const Aws::String& value) { SetParameterGroupName(value); return *this;}

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline DescribeClusterParametersRequest& WithParameterGroupName(Aws::String&& value) { SetParameterGroupName(std::move(value)); return *this;}

    /**
     *
The name of a cluster parameter group for which to return details.

     */
    inline DescribeClusterParametersRequest& WithParameterGroupName(const char* value) { SetParameterGroupName(value); return *this;}

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline const Aws::String& GetSource() const{ return m_source; }

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline bool SourceHasBeenSet() const { return m_sourceHasBeenSet; }

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline void SetSource(const Aws::String& value) { m_sourceHasBeenSet = true; m_source = value; }

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline void SetSource(Aws::String&& value) { m_sourceHasBeenSet = true; m_source = std::move(value); }

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline void SetSource(const char* value) { m_sourceHasBeenSet = true; m_source.assign(value); }

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline DescribeClusterParametersRequest& WithSource(const Aws::String& value) { SetSource(value); return *this;}

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline DescribeClusterParametersRequest& WithSource(Aws::String&& value) { SetSource(std::move(value)); return *this;}

    /**
     *
The parameter types to return. Specify user to show parameters
     * that are different form the default. Similarly, specify
     * engine-default to show parameters that are the same as the default
     * parameter group.

Default: All parameter types returned.

Valid
     * Values: user | engine-default

     */
    inline DescribeClusterParametersRequest& WithSource(const char* value) { SetSource(value); return *this;}

    /**
     *
The maximum number of response records to return in each call. If the number
     * of remaining response records exceeds the specified MaxRecords
     * value, a value is returned in a marker field of the response. You
     * can retrieve the next set of records by retrying the command with the returned
     * marker value.

Default: 100

Constraints: minimum 20,
     * maximum 100.

     */
    inline int GetMaxRecords() const{ return m_maxRecords; }

    /**
     *
The maximum number of response records to return in each call. If the number
     * of remaining response records exceeds the specified MaxRecords
     * value, a value is returned in a marker field of the response. You
     * can retrieve the next set of records by retrying the command with the returned
     * marker value.

Default: 100

Constraints: minimum 20,
     * maximum 100.

     */
    inline bool MaxRecordsHasBeenSet() const { return m_maxRecordsHasBeenSet; }

    /**
     *
The maximum number of response records to return in each call. If the number
     * of remaining response records exceeds the specified MaxRecords
     * value, a value is returned in a marker field of the response. You
     * can retrieve the next set of records by retrying the command with the returned
     * marker value.

Default: 100

Constraints: minimum 20,
     * maximum 100.

     */
    inline void SetMaxRecords(int value) { m_maxRecordsHasBeenSet = true; m_maxRecords = value; }

    /**
     *
The maximum number of response records to return in each call. If the number
     * of remaining response records exceeds the specified MaxRecords
     * value, a value is returned in a marker field of the response. You
     * can retrieve the next set of records by retrying the command with the returned
     * marker value.

Default: 100

Constraints: minimum 20,
     * maximum 100.

     */
    inline DescribeClusterParametersRequest& WithMaxRecords(int value) { SetMaxRecords(value); return *this;}

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline const Aws::String& GetMarker() const{ return m_marker; }

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline bool MarkerHasBeenSet() const { return m_markerHasBeenSet; }

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline void SetMarker(const Aws::String& value) { m_markerHasBeenSet = true; m_marker = value; }

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline void SetMarker(Aws::String&& value) { m_markerHasBeenSet = true; m_marker = std::move(value); }

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline void SetMarker(const char* value) { m_markerHasBeenSet = true; m_marker.assign(value); }

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline DescribeClusterParametersRequest& WithMarker(const Aws::String& value) { SetMarker(value); return *this;}

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline DescribeClusterParametersRequest& WithMarker(Aws::String&& value) { SetMarker(std::move(value)); return *this;}

    /**
     *
An optional parameter that specifies the starting point to return a set of
     * response records. When the results of a DescribeClusterParameters request
     * exceed the value specified in MaxRecords, Amazon Web Services
     * returns a value in the Marker field of the response. You can
     * retrieve the next set of response records by providing the returned marker value
     * in the Marker parameter and retrying the request.

     */
    inline DescribeClusterParametersRequest& WithMarker(const char* value) { SetMarker(value); return *this;}

  private:

    Aws::String m_parameterGroupName;
    bool m_parameterGroupNameHasBeenSet;

    Aws::String m_source;
    bool m_sourceHasBeenSet;

    int m_maxRecords;
    bool m_maxRecordsHasBeenSet;

    Aws::String m_marker;
    bool m_markerHasBeenSet;
  };

} // namespace Model
} // namespace Redshift
} // namespace Aws


text:
import { assertType } from './lib/assert';
import EmberObject from '@ember/object';
import ArrayPrototypeExtensions from '@ember/array/types/prototype-extensions';

declare global {
    interface Array<T> extends ArrayPrototypeExtensions<T> {}
}

class Person extends EmberObject {
    name: string;
}

const person = Person.create({ name: 'Joe' });
const array = [person];

assertType<number>(array.get('length'));
assertType<Person | undefined>(array.get('firstObject'));
assertType<string[]>(array.mapBy('name'));
assertType<string[]>(array.map(p => p.get('name')));
assertType<Person[]>(array.sortBy('name'));
assertType<Person[]>(array.uniq());
assertType<Person[]>(array.uniqBy('name'));
assertType<Person[]>(array.uniqBy(p => p.get('name')));


text:
    # "h:console": "hasura console --admin-secret myadminsecretkey",
    # "h:migrate": "hasura migrate apply",
    # "h:migrate-create": "hasura migrate create --from-server --admin-secret myadminsecretkey",
    # "h:metadata": "hasura metadata export --admin-secret myadminsecretkey",
    # "h:update-cli": "hasura update-cli"

# Seeds
  # hasura seed apply --admin-secret myadminsecretkey

# Publish
    # git remote -v
    # git push heroku master

# Squash migrations and add checkpoints to version control
    # hasura migrate squash --name "changes_to_use_page" --from 1609172197076 --log-level DEBUG --admin-secret myadminsecretkey


text:
PORT-AU-PRINCE	GOING	23-30
FAMILY	LIFE	23-30
ARISTIDE	LEAVE	SOCIETY
WHO	LEADS	SOCIETY
ARISTIDE	LEAVE	HAITI
WHO	LEADS	HAITI
HE	HEADING	DELEGATION
ARISTIDE	POINTED	FINGER
WHO	SHOULDER	FINGER
WHICH	THINKS	FINGER
ARMY	ORDERS	FINGER
HEAD	DECLARED	FINGER
ARISTIDE	POINTED	RESPONSIBILITY
WHO	SHOULDER	RESPONSIBILITY
WHICH	THINKS	RESPONSIBILITY
ARMY	ORDERS	RESPONSIBILITY
HEAD	DECLARED	RESPONSIBILITY
ARISTIDE	FEELS	SECURITY
ONE	COUNT	SECURITY
ARISTIDE	SAYS	BRIGADES
PART	HONEST	BRIGADES
TODAY	DICTATES	BRIGADES
WE	WANT	BRIGADES
ARISTIDE	SAYS	REPEAT
PART	HONEST	REPEAT
TODAY	DICTATES	REPEAT
WE	WANT	REPEAT
ARISTIDE	SAYS	YES
ARISTIDE	SAYS	JUSTICE
OAS	GO	HANDS
IT	WASHING	HANDS
OAS	GO	THEM
IT	WASHING	THEM
OAS	GO	THEM
IT	WASHING	THEM
POPULATION	PROVIDING	JUSTICE
ALL	SHUT	JUSTICE
ARISTIDE	SAID	JUSTICE
POPULATION	ACTS	JUSTICE
AUTHORITIES	DO	JUSTICE
MINISTRY	DECIDE	JUSTICE
THEY	IDENTIFIED	JUSTICE
POPULATION	PROVIDING	WAY
ALL	SHUT	WAY
ARISTIDE	SAID	WAY
POPULATION	ACTS	WAY
AUTHORITIES	DO	WAY
MINISTRY	DECIDE	WAY
THEY	IDENTIFIED	WAY
POPULATION	PROVIDING	DUTY
ALL	SHUT	DUTY
ARISTIDE	SAID	DUTY
POPULATION	ACTS	DUTY
AUTHORITIES	DO	DUTY
MINISTRY	DECIDE	DUTY
THEY	IDENTIFIED	DUTY
POPULATION	PROVIDING	IT
ALL	SHUT	IT
ARISTIDE	SAID	IT
POPULATION	ACTS	IT
AUTHORITIES	DO	IT
MINISTRY	DECIDE	IT
THEY	IDENTIFIED	IT
POPULATION	PROVIDING	IT
ALL	SHUT	IT
ARISTIDE	SAID	IT
POPULATION	ACTS	IT
AUTHORITIES	DO	IT
MINISTRY	DECIDE	IT
THEY	IDENTIFIED	IT
ARISTIDE	PLANNING	THAT
ARISTIDE	DECLARED	THAT
ARISTIDE	POWER-MAD	THAT
I	DO	WHAT
MASSES	ASK	WHAT
I	DO	ME
MASSES	ASK	ME
ARISTIDE	ASKED	MEMBERS
THEY	GO	HAITI
WHO	WORKED	HAITI
ARISTIDE	HELD	CONFERENCE
HE	GOING	CONFERENCE
THAT	HELD	CONFERENCE


text:
using LightingType = smskinedit::enums::LightingType;

namespace smskinedit {
    namespace control {

        void LightingControl::setLightingType(LightingType lightingType) {
            _lightingType = lightingType;
            onControlUpdated(LightingControl::LIGHTING_CHANGED);
        }
        LightingType LightingControl::getLightingType() const {
            return _lightingType;
        }

    }
}


text: Cities.data_path = 'cities'


text:
ngDescribe({
    name: 'Test manage-wedding component',
    modules: 'app',
    element: '<manage-wedding></manage-wedding>',
    tests: function (deps) {

        it('basic test', () => {
            //
        });
    }
});


text:
var runner = require('../setup');

Sugar = runner.load('../../packages/sugar-language');

// Tests
runner.loadTest('language');

runner.run(module, 'chained', Sugar);


text:
  Outer context menu

Inner context menu

<ng-template #outer>

    <button class="example-menu-item" cdkMenuItem>Save</button>
    <button class="example-menu-item" cdkMenuItem>Exit</button>

</ng-template>

<ng-template #inner>

    <button class="example-menu-item" cdkMenuItem>Cut</button>
    <button class="example-menu-item" cdkMenuItem>Copy</button>
    <button class="example-menu-item" cdkMenuItem>Paste</button>

</ng-template>


text:
const isEqual = require("./isEqual.js");
const keys = require("../collection/keys.js");
const paths = require("../collection/paths.js");
const getByType = require("../collection/getByType.js");

/**
 * Get the depth level of the specified key (first level is 1).
 * @param   {Object} obj        The object to evaluate
 * @param   {Object} key        The key to look for
 * @returns {Number}            The depth level
 */
function howDeep(obj, key)
{
    var path = paths(obj, true);

    if (key && (key in path))
    {
        return path[key].split(".").length;
    }
    else
    {
        var objs = getByType(obj, "*", true);

        for (let o in objs)
        {
            if (isEqual(obj, objs[o]))
            {
                return howDeep(obj, keys(objs[o])[0]);
            }
        }
    }
}

module.exports = howDeep;


text:
Your program should display the outputs shown in this table for the given inputs provided:

| Input      | Output                                     |
| ---------- | ------------------------------------------ |
| 45         | This is an acute triangle.                 |
| 90         | This is a right triangle.                  |
| 120        | This is an obtuse triangle.                |


text:
package co.cask.tigon.internal.app.queue;

import co.cask.tigon.app.queue.InputDatum;
import co.cask.tigon.app.queue.QueueReader;

import java.util.concurrent.TimeUnit;

/**
 * An implementation of {@link QueueReader} that always returns the same {@link InputDatum}.
 * Each {@link #dequeue(long, java.util.concurrent.TimeUnit)} call would also increment
 * the retry count of the given {@link InputDatum} by 1.
 *
 * @param <T> Type of input dequeued from this reader.
 */
public class SingleItemQueueReader<T> implements QueueReader<T> {

  private final InputDatum<T> input;

  public SingleItemQueueReader(InputDatum<T> input) {
    this.input = input;
  }

  @Override
  public InputDatum<T> dequeue(long timeout, TimeUnit timeoutUnit) {
    input.incrementRetry();
    return input;
  }
}


text:
"use strict";
// 类似noop函数
function INTERNAL() {}

function isFunction(func) {
    return typeof func === "function";
}

function isObject(obj) {
    return typeof obj === "object";
}

function isArray(arr) {
    return Object.prototype.toString.call(arr) === "[object Array]";
}
// Promsie的状态
var PENDING = 0;
var FULFILLED = 1;
var REJECTED = 2;

function Promise(resolver) {
    if (!isFunction(resolver)) {
        throw new TypeError("resolver must be a function");
    }
    this.state = PENDING;
    this.value = void 0;
    // 队列
    this.queue = [];
    if (resolver !== INTERNAL) {
        safelyResolveThen(this, resolver);
    }
}
// then方法内默认返回一个新的promise
Promise.prototype.then = function(onFulfilled, onRejected) {
    // 如果是值穿透的情况
    if (
        (!isFunction(onFulfilled) && this.state === FULFILLED) ||
        (!isFunction(onRejected) && this.state === REJECTED)
    ) {
        return this;
    }
    // 创建一个新的promise,
    // 或者使用,var promise = new Promise(INTERNAL);
    var promise = new this.constructor(INTERNAL);
    if (this.state !== PENDING) {
        // 如Promse.resolve('234234').then(() => {}),或者reject的情况
        // 会创造一个新的Promise并且this.value指向234234
        var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
        // 直接执行回调了
        unwrap(promise, resolver, this.value);
    } else {
        // 正常进来都是PENDING状态,所以放到队列中,resolve或者reject掉之后返回
        this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
    }
    return promise;
};
Promise.prototype.catch = function(onRejected) {
    return this.then(null, onRejected);
};
Promise.resolve = function resolve(value) {
    // 当 Promise.resolve 参数是一个 promise 时,直接返回该值。
    if (value instanceof this) {
        return value;
    }
    return doResolve(new this(INTERNAL), value);
}

Promise.reject = function reject(reason) {
    var promise = new this(INTERNAL);
    return doReject(promise, reason);
}
// 安全的执行 then 函数,捕获异常,resolve或者reject只执行一次,没错执行doResolve,错误执行doReject
function safelyResolveThen(self, then) {
    var called = false;
    try {
        then(
            function(value) {
                if (called) {
                    return;
                }
                called = true;
                doResolve(self, value);
            },
            function(error) {
                if (called) {
                    return;
                }
                called = true;
                doReject(self, error);
            }
        );
    } catch (err) {
        if (called) {
            return;
        }
        called = true;
        doReject(self, err);
    }
}
// 具体成功的执行函数,返回一个promise
function doResolve(self, value) {
    try {
        var then = getThen(value);
        // 如果返回的还是一个promise的话,则把这个promise.then执行完
        if (then) {
            safelyResolveThen(self, then);
        } else {
            // 正常设置FULFILLED状态,然后进入.then方法中,这里把成功和失败的方法统一包装成了一个对象
            self.state = FULFILLED;
            self.value = value;
            self.queue.forEach(function(queueItem) {
                queueItem.callFulfilled(value);
            });
        }
        return self;
    } catch (err) {
        return doReject(self, err);
    }
}
function doReject(self, error) {
    // 有错误或者Reject掉的情况
    self.state = REJECTED;
    self.value = error;
    self.queue.forEach(function(queueItem) {
        queueItem.callRejected(error);
    });
    return self;
}
// 辅助函数,获取then函数的
function getThen(obj) {
    var then = obj && obj.then;
    if (obj && (isObject(obj) || isFunction(obj)) && isFunction(then)) {
        return function applyThen() {
            then.apply(obj, arguments);
        };
    }
}
//执行异步操作的地方, 第一个参数是子 promise,第二个参数是父 promise 的 then 的回调(onFulfilled/onRejected),第三个参数是父 promise 的值(正常值/错误)。
function unwrap(promise, func, value) {
    // 执行异步操作
    setTimeout(function() {
        var returnValue;
        try {
            // promise的then中的回调结合返回值
            returnValue = func(value);
        } catch (error) {
            return doReject(promise, error);
        }
        if (returnValue === promise) {
            doReject(
                promise,
                new TypeError("Cannot resolve promise with itself")
            );
        } else {
            doResolve(promise, returnValue);
        }
    });
}
// then中onFulfilled,onRejected包装成了一个类对象
function QueueItem(promise, onFulfilled, onRejected) {
    this.promise = promise;
    // 为了兼容值穿透的情况,返回value
    this.callFulfilled = function(value) {
        doResolve(this.promise, value);
    };
    this.callRejected = function(error) {
        doReject(this.promise, error);
    };
    if (isFunction(onFulfilled)) {
        this.callFulfilled = function(value) {
            unwrap(this.promise, onFulfilled, value);
        };
    }
    if (isFunction(onRejected)) {
        this.callRejected = function(error) {
            unwrap(this.promise, onRejected, error);
        };
    }
}
module.exports = Promise;


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/exttools/attroverride/attrTextToBinaryBlob.C $            */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2014,2015                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

/**
 * @Description - This file performs the operation of converting a text file
 *                containing various attributes into their binary
 *                representations and outputing that data into a .bin file. The
 *                program uses a lot of the functionality/logic present in
 *                /hostboot/src/usr/hwpf/plat/fapiPlatAttrOverrideSync in order
 *                to parse the input attribute text file into corresponding
 *                data. This tool takes in an attribute override text file
 *                as input and outputs an ECC protected binary blob containing
 *                the data for the given input attribute overrides.
 *
 *                output file name: attrOverride.bin
 */
//******************************************************************************
// Includes
//******************************************************************************

#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
#include <stdint.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <endian.h>
#include <unistd.h>
#include <hwpf/fapi/fapiTarget.H>
#include <attributeenums.H>
#include <pnor/ecc.H>

#include "attrTextToBinaryBlob.H"

AttributeTank::AttributeHeader::AttributeHeader() :
    iv_attrId(0), iv_targetType(0), iv_pos(0), iv_unitPos(0), iv_flags(0),
    iv_node(0), iv_valSize(0)
{
}

namespace AttrOverrideSyncConstants
{
// Constants used for processing all attribute related text files
const size_t MIN_ATTRIBUTE_SIZE = 32; //Every attribute has AT LEAST 32 bytes
const size_t ATTRIBUTE_HEADER_SIZE = 16;
//******************************************************************************
// Constants used for processing FAPI Attribute Text files
// See the header file for the format
//******************************************************************************
const char * const ATTR_FILE_ATTR_START_STR = "ATTR_";
const char * const ATTR_FILE_TARGET_HEADER_STR = "target";
const char * const ATTR_FILE_TARGET_EXT_HEADER_STR = "target = k0";
const char * const ATTR_FILE_TARGET_EXT_FOOTER_STR = ":s0:";
const char * const ATTR_CONST = "CONST";
const char * const TARGET_NODE_HEADER_STR = ":n";
const char * const TARGET_POS_HEADER_STR = ":p";
const char * const TARGET_UNIT_POS_HEADER_STR = ":c";
const char * const TARGET_NODE_ALL_STR = "all";
const char * const TARGET_POS_ALL_STR = "all";

// Used to translate target strings in FAPI Attribute Info files to the value
// in a FAPI or TARG Layer AttributeTanks
const struct TargStrToType
{
    const char * iv_pString;
    uint32_t iv_fapiType;
    uint32_t iv_targType;
} TARG_STR_TO_TYPE [] = {
    {"p8.ex",           fapi::TARGET_TYPE_EX_CHIPLET,   TARGETING::TYPE_EX},
    {"centaur.mba",     fapi::TARGET_TYPE_MBA_CHIPLET,  TARGETING::TYPE_MBA},
    {"p8.mcs",          fapi::TARGET_TYPE_MCS_CHIPLET,  TARGETING::TYPE_MCS},
    {"p8.xbus",         fapi::TARGET_TYPE_XBUS_ENDPOINT,TARGETING::TYPE_XBUS},
    {"p8.abus",         fapi::TARGET_TYPE_ABUS_ENDPOINT,TARGETING::TYPE_ABUS},
    {"centaur",         fapi::TARGET_TYPE_MEMBUF_CHIP,  TARGETING::TYPE_MEMBUF},
    {"p8",              fapi::TARGET_TYPE_PROC_CHIP,    TARGETING::TYPE_PROC},
    {"dimm",            fapi::TARGET_TYPE_DIMM,         TARGETING::TYPE_DIMM},
    {"pu",              fapi::TARGET_TYPE_PROC_CHIP,    TARGETING::TYPE_PROC}
};

bool operator==(const TargStrToType& i, const std::string& v)
{
    return 0 == strcmp(v.c_str(), i.iv_pString);
}

const char * const ATTR_INFO_FILE_UINT8_STR = "u8";
const char * const ATTR_INFO_FILE_UINT16_STR = "u16";
const char * const ATTR_INFO_FILE_UINT32_STR = "u32";
const char * const ATTR_INFO_FILE_UINT64_STR = "u64";

}

template <typename T>
int compareAttribute(const T& l, const T& r)
{
    return strcmp(l.iv_name, r.iv_name);
}

template <typename T> bool operator<(const T&, const T&);

template <>
bool operator< <AttributeData>(const AttributeData& l, const AttributeData& r)
{
    return compareAttribute(l, r) < 0;
}

template <>
bool operator< <AttributeEnum>(const AttributeEnum& l, const AttributeEnum& r)
{
    return compareAttribute(l, r) < 0;
}

template <typename T>
const T* findAttribute(const T* array,
                       size_t arraySize,
                       const char* attrName)
{
    T constant; constant.iv_name = attrName;

    const T* element =
        std::lower_bound(&array[0], &array[arraySize], constant);

    if ((&array[arraySize] == element) ||
        (0 != compareAttribute(*element, constant)))
    {
        return NULL;
    }

    return element;
}

//global to allow debug logs
bool g_showDebugLogs = false;

//global to indicate if tool is generated permanent overrides
bool g_permOverride = false;

using namespace AttrOverrideSyncConstants;

//******************************************************************************
bool AttrTextToBinaryBlob::writeDataToBuffer(
                            AttributeTank::AttributeHeader & i_attrData,
                            AttributeTank::TankLayer i_tankLayer,
                            uint8_t * i_pVal,
                            FILE * io_attrFile,
                            uint8_t *& io_buffer,
                            size_t & io_totalSize )
{
    bool l_err = false;
    FILE * l_data;
    uint64_t l_size;
    int l_success;
    uint32_t * l_bytes;
    uint32_t l_padding = 0x00000000;
    uint32_t l_tankLayer;
    uint32_t l_valSize = i_attrData.iv_valSize;
    size_t l_index;
    size_t l_attributeSize;

    //First update index to copy into buffer
    l_index = io_totalSize;
    //Now, update the total size of the blob
    l_attributeSize = (MIN_ATTRIBUTE_SIZE + l_valSize);
    io_totalSize += l_attributeSize;

    //update the size of our buffer
    io_buffer =(uint8_t *)realloc(io_buffer, io_totalSize);

    // Add tank layer to blob
    l_tankLayer = htonl(static_cast<uint32_t>(i_tankLayer));
    memcpy(&io_buffer[l_index], &l_tankLayer, sizeof(uint32_t));
    l_index += sizeof(uint32_t);

    //add 4 bytes of padding
    memcpy(&io_buffer[l_index], &l_padding, sizeof(uint32_t));
    l_index += sizeof(uint32_t);

    //First need to find out the size of the attribute's data.
    l_size = sizeof(i_attrData) + i_attrData.iv_valSize;

    //convert size to big endian
    l_size = htobe64(l_size);

    //write size to buffer
    memcpy(&io_buffer[l_index], &l_size, sizeof(uint64_t));
    l_index += sizeof(uint64_t);

    //Flatten AttributeHeader into stream of bytes
    flattenAttributeHeader(i_attrData, l_bytes);

    //Write the AttributeHeader data into the blob
    memcpy(&io_buffer[l_index], l_bytes, ATTRIBUTE_HEADER_SIZE);
    l_index += ATTRIBUTE_HEADER_SIZE;

    //Write the value of the attribute into the blob.

    memcpy(&io_buffer[l_index], i_pVal, l_valSize);
    l_index += l_valSize;

    return l_err;
}

//******************************************************************************
void AttrTextToBinaryBlob::flattenAttributeHeader(
                                  AttributeTank::AttributeHeader & i_attrHeader,
                                  uint32_t *& o_data)
{

    i_attrHeader.iv_attrId = htonl(i_attrHeader.iv_attrId);
    i_attrHeader.iv_targetType = htonl(i_attrHeader.iv_targetType);
    i_attrHeader.iv_pos = htons(i_attrHeader.iv_pos);
    i_attrHeader.iv_valSize = htonl(i_attrHeader.iv_valSize);

    o_data = reinterpret_cast<uint32_t *>(&i_attrHeader);

    return;
}

//******************************************************************************
bool AttrTextToBinaryBlob::attrFileIsAttrLine(
    const std::string & i_line,
    std::string & o_attrString)
{
    /*
     * e.g. "target = k0:n0:s0:centaur.mba:pall:call" - false
     *      "ATTR_MSS_DIMM_MFG_ID_CODE[0][0] u32[2][2] 0x12345678" - true
     */
    bool l_isAttrLine = false;

    if (0 == i_line.find(ATTR_FILE_ATTR_START_STR))
    {
        // The attribute ID string terminates with either '[' or ' '
        size_t l_pos = i_line.find_first_of("[ ");

        if (l_pos != std::string::npos)
        {
            o_attrString = i_line.substr(0, l_pos);
            l_isAttrLine = true;
        }
    }

    return l_isAttrLine;
}

//******************************************************************************
bool AttrTextToBinaryBlob::attrFileIsTargLine(
    const std::string & i_line)
{
    /*
     * e.g. "target = k0:n0:s0:centaur.mba:pall:call" - true
     *      "ATTR_MSS_DIMM_MFG_ID_CODE[0][0] u32[2][2] 0x12345678" - false
     */
    return 0 == i_line.find(ATTR_FILE_TARGET_HEADER_STR);
}

//******************************************************************************
bool AttrTextToBinaryBlob::attrFileAttrLineToFields(
    const std::string & i_line,
    std::string & o_attrString,
    size_t (& o_dims)[ATTR_MAX_DIMS],
    std::string & o_valStr,
    bool & o_const)
{
    /*
     * e.g. "ATTR_MSS_DIMM_MFG_ID_CODE[0][1] u32[2][2] 0x12345678"
     * - o_attrString = "ATTR_MSS_DIMM_MFG_ID_CODE"
     * - o_dims = {0, 1, 0, 0}
     * - o_valStr = "0x12345678"
     * - o_const = false
     */
    bool l_success = false;
    bool l_break = false;
    o_const = false;
    size_t l_pos1 = 0;
    size_t l_pos2 = 0;

    for (size_t i = 0; i < ATTR_MAX_DIMS; i++)
    {
        o_dims[i] = 0;
    }

    // Copy input string into a local string and strip of any newline
    std::string l_line(i_line);

    if (l_line[l_line.size() - 1] == '\n')
    {
        l_line = l_line.substr(0, l_line.size() - 1);
    }

    do
    {
        // Find the first field: attribute string
        l_pos2 = l_line.find_first_of(" \t");

        if (l_pos2 == std::string::npos)
        {
            printf(
            "attrFileAttrLineToFields:"
            " Could not find end of attr str in '%s'\n",
                l_line.c_str());
            break;
        }

        // Found the attribute-string
        //

        std::string l_attrString = l_line.substr(0, l_pos2);

        // Find if the attribute string contains array dimensions
        size_t l_pos = l_attrString.find('[');
        o_attrString = l_attrString.substr(0, l_pos);

        size_t l_dim = 0;

        while ((l_pos != std::string::npos) && (l_dim < ATTR_MAX_DIMS))
        {
            l_attrString = l_attrString.substr(l_pos + 1);
            o_dims[l_dim++] = strtoul(l_attrString.c_str(), NULL, 0);

            if(l_dim > ATTR_MAX_DIMS)
            {
                printf("MAX_DIMS exceeded! Exiting... "
                        "attrTextToBinaryBlob::attrFileAttrLineToFields");
                l_break = true;
                break;
            }

            l_pos = l_attrString.find('[');
        }

        if( l_break )
        {
            break;
        }

        // Find the second field: type (optional) or value
        l_pos1 = l_line.find_first_not_of(" \t", l_pos2);

        if (l_pos1 == std::string::npos)
        {
            printf(
                "attrFileAttrLineToFields:"
                " Could not find start of second field in '%s'\n",
                l_line.c_str());
            break;
        }

        l_pos2 = l_line.find_first_of(" \t", l_pos1);

        if (l_pos2 == std::string::npos)
        {
            // The second and last string must be the value string
            o_valStr = l_line.substr(l_pos1);
            l_success = true;
            break;
        }

        // Found the second field
        o_valStr = l_line.substr(l_pos1, l_pos2 - l_pos1);

        // If the second field is the optional and unused type field then
        // the next field is the val string
        if ( (o_valStr.find(ATTR_INFO_FILE_UINT8_STR) != std::string::npos) ||
             (o_valStr.find(ATTR_INFO_FILE_UINT16_STR) != std::string::npos) ||
             (o_valStr.find(ATTR_INFO_FILE_UINT32_STR) != std::string::npos) ||
             (o_valStr.find(ATTR_INFO_FILE_UINT64_STR) != std::string::npos) )
        {
            l_pos1 = l_line.find_first_not_of(" \t", l_pos2);

            if (l_pos1 == std::string::npos)
            {
                printf(
                    "attrFileAttrLineToFields:"
                    " Could not find start of val field in '%s'\n",
                    l_line.c_str());
                break;
            }

            l_pos2 = l_line.find_first_of(" \t", l_pos1);

            if (l_pos2 == std::string::npos)
            {
                // The third and last string must be the value string
                o_valStr = l_line.substr(l_pos1);
                l_success = true;
            }
            else
            {
                o_valStr = l_line.substr(l_pos1, l_pos2 - l_pos1);
                l_success = true;
            }
        }
        else
        {
            l_success = true;
        }

        if (l_pos2 != std::string::npos)
        {
            // Find the final const field if it exists
            l_pos1 = l_line.find_first_not_of(" \t", l_pos2);

            if (l_pos1 == std::string::npos)
            {
                break;
            }

            std::string l_constStr = l_line.substr(l_pos1);

            if (0 == l_constStr.find(ATTR_CONST))
            {
                o_const = true;
            }
        }

    } while (0);
    return l_success;
}

//******************************************************************************
void AttrTextToBinaryBlob::attrFileTargetLineToData(
    const std::string & i_line,
    const AttributeTank::TankLayer i_tankLayer,
    uint32_t & o_targetType,
    uint16_t & o_targetPos,
    uint8_t & o_targetUnitPos,
    uint8_t & o_targetNode)
{
    /*
     * e.g. "target = k0:n0:s0:centaur.mba:p02:c1"
     * - o_targetType = 0x00000001
     * - o_targetPos = 2
     * - o_targetUnitPos = 1
     */

    // If the target string is not decoded into a non-system target and
    // explicit positions are not found then the caller will get these defaults
    bool l_sysTarget = true;
    if (i_tankLayer == AttributeTank::TANK_LAYER_FAPI)
    {
        o_targetType = fapi::TARGET_TYPE_SYSTEM;
    }
    else
    {
        o_targetType = TARGETING::TYPE_SYS;
    }

    o_targetNode = AttributeTank:: ATTR_NODE_NA;
    o_targetPos = AttributeTank:: ATTR_POS_NA;
    o_targetUnitPos = AttributeTank::ATTR_UNIT_POS_NA;

    // Find the node, target type, pos and unit-pos
    if (0 == i_line.find(ATTR_FILE_TARGET_EXT_HEADER_STR))
    {
        // Create a local string and remove the target header
        std::string l_line =
            i_line.substr(strlen(ATTR_FILE_TARGET_EXT_HEADER_STR));

        // Figure out the node number
        if (0 == l_line.find(TARGET_NODE_HEADER_STR))
        {
            l_line = l_line.substr(strlen(TARGET_NODE_HEADER_STR));

            if (0 == l_line.find(TARGET_NODE_ALL_STR))
            {
                l_line = l_line.substr(strlen(TARGET_NODE_ALL_STR));
            }
            else
            {
                o_targetNode = strtoul(l_line.c_str(), NULL, 10);

                size_t l_pos = l_line.find(':');

                if (l_pos != std::string::npos)
                {
                    l_line = l_line.substr(l_pos);
                }
                else
                {
                    l_line.clear();
                }
            }
        }

        if (0 == l_line.find(ATTR_FILE_TARGET_EXT_FOOTER_STR))
        {
            // Remove the target footer
            l_line = l_line.substr(strlen(ATTR_FILE_TARGET_EXT_FOOTER_STR));
        }

        // Figure out the target type
        const TargStrToType* last =
          &TARG_STR_TO_TYPE[sizeof(TARG_STR_TO_TYPE)/sizeof(TargStrToType) -1];

        //not sure how long the string representing the title will be
        //therefore we must look up the next colon and take all chars up to
        //the colon and assume that is the string representation of the target.
        size_t nextColon = l_line.find(':');
        std::string l_targetString = l_line.substr(0, nextColon);

        const TargStrToType* item =
            std::find(&TARG_STR_TO_TYPE[0], last, l_targetString);

        if (item != last)
        {
            o_targetType = (i_tankLayer == AttributeTank::TANK_LAYER_TARG ?
                            item->iv_targType : item->iv_fapiType);
            l_line = l_line.substr(strlen(item->iv_pString));
            l_sysTarget = false;
        }

        // For a non-system target, figure out the position and unit position
        if (l_sysTarget == false)
        {
            // Figure out the target's position
            if (0 == l_line.find(TARGET_POS_HEADER_STR))
            {
                l_line = l_line.substr(strlen(TARGET_POS_HEADER_STR));

                if (0 == l_line.find(TARGET_POS_ALL_STR))
                {
                    l_line = l_line.substr(strlen(TARGET_POS_ALL_STR));
                }
                else
                {
                    o_targetPos = strtoul(l_line.c_str(), NULL, 10);

                    size_t l_pos = l_line.find(':');

                    if (l_pos != std::string::npos)
                    {
                        l_line = l_line.substr(l_pos);
                    }
                    else
                    {
                        l_line.clear();
                    }
                }
            }

            // Figure out the target's unit position
            if (0 == l_line.find(TARGET_UNIT_POS_HEADER_STR))
            {
                l_line = l_line.substr(strlen(TARGET_UNIT_POS_HEADER_STR));

                if (0 == l_line.find(TARGET_POS_ALL_STR))
                {
                    l_line = l_line.substr(strlen(TARGET_POS_ALL_STR));
                }
                else
                {
                    o_targetUnitPos = strtoul(l_line.c_str(), NULL, 10);
                }
            }
        }
    }

    // System targets must have an NA node
    if (l_sysTarget)
    {
        o_targetNode = AttributeTank::ATTR_NODE_NA;
    }

}

//******************************************************************************
bool AttrTextToBinaryBlob::attrFileAttrLinesToData(
    std::vector<std::string> & i_lines,
    uint32_t & o_attrId,
    uint32_t & o_valSizeBytes,
    uint8_t * & o_pVal,
    bool & o_const,
    AttributeTank::TankLayer & o_tankLayer)
{
    bool l_pErr = false;
    size_t l_numElements = 0;
    // Data for the attribute
    uint32_t l_attrElemSizeBytes = 0;
    size_t d[ATTR_MAX_DIMS] = {0}; // dimensions of the attribute

    // Data for this line. Note that this function expects all lines to be for
    // the same attr (in the case of an array attribute)
    std::string l_attrString;
    size_t td[ATTR_MAX_DIMS] = {0}; // dimensions of this line's element
    std::string l_valString;
    uint64_t l_attrVal = 0;

    std::vector<std::string>::const_iterator l_itr;

    // Iterate over each line
    for (l_itr = i_lines.begin(); l_itr != i_lines.end(); ++l_itr)
    {
        // Split the attribute line into fields
        bool l_success = attrFileAttrLineToFields(*l_itr, l_attrString, td,
            l_valString, o_const);

        if (!l_success)
        {
            printf(
                "attrFileAttrLinesToData: "
                "Error. Could not break into fields (%s)\n",
                (*l_itr).c_str());
            break;
        }

        if (o_pVal == NULL)
        {

            l_success = getAttrDataFromMap(l_attrString.c_str(),
                               o_attrId,
                               l_attrElemSizeBytes,
                               d,
                               o_tankLayer);
            if(!l_success)
            {
                printf("There was a problem getting data for %s\n",
                        l_attrString.c_str());
                break;
            }

            o_valSizeBytes = l_attrElemSizeBytes * d[0] * d[1] * d[2] * d[3];
            o_pVal = new uint8_t[o_valSizeBytes];
        }

        // Check that the attribute isn't overflowing an array

        for(size_t i = 0; i < ATTR_MAX_DIMS; i++)
        {
            if(td[i] >= d[i])
            {
                printf("attrFileAttrLinesToData: Error. Array Overflow (%s)\n",
                         (*l_itr).c_str());
                break;
            }
        }

        if ((l_valString[0] == '0') && (l_valString[1] == 'x'))
        {
            // Value string is a value
            l_attrVal = strtoull(l_valString.c_str(), NULL, 0);
        }
        else
        {
            // Value string is an enumerator, it is decoded using <attr>_<enum>
            l_valString = l_attrString + "_" + l_valString;

            l_success = getAttrEnumDataFromMap(l_valString.c_str(), l_attrVal);

            if(!l_success)
            {
                printf("An error occurred when retrieving the enum value for"
                       " %s\n", l_valString.c_str());
                break;
            }

        }

        // Write the element to the correct place in the buffer
        size_t l_size = sizeof(d)/sizeof(size_t);
        size_t l_elem = 0;
        for(size_t idx = 0; idx < l_size; idx++)
        {
            l_elem *= d[idx];
            l_elem += td[idx];
        }

        if (l_attrElemSizeBytes == sizeof(uint8_t))
        {
            o_pVal[l_elem] = l_attrVal;
            l_numElements++;
        }
        else if (l_attrElemSizeBytes == sizeof(uint16_t))
        {
            uint16_t * l_pVal = reinterpret_cast<uint16_t *>(o_pVal);
            l_pVal[l_elem] = htobe16(l_attrVal);
            l_numElements++;
        }
        else if (l_attrElemSizeBytes == sizeof(uint32_t))
        {
            uint32_t * l_pVal = reinterpret_cast<uint32_t *>(o_pVal);
            l_pVal[l_elem] = htobe32(l_attrVal);
            l_numElements++;
        }
        else
        {
            uint64_t * l_pVal = reinterpret_cast<uint64_t *>(o_pVal);
            l_pVal[l_elem] = htobe64(l_attrVal);
            l_numElements++;
        }

    }
    return l_pErr;
}

//******************************************************************************
void AttrTextToBinaryBlob::padToNextPage( uint8_t *& io_buffer,
                                                    size_t & io_bufSize )
{

    size_t l_pageSize = 0x1000;
    size_t l_overUnder = io_bufSize%l_pageSize;
    size_t l_paddingSize = l_pageSize - l_overUnder;
    size_t l_startPoint = io_bufSize;

    io_bufSize += l_paddingSize;
    io_buffer = (uint8_t *)realloc(io_buffer, io_bufSize);
    memset(&io_buffer[l_startPoint], 0xff, l_paddingSize);
    return;
}

//******************************************************************************
bool AttrTextToBinaryBlob::attrTextToBinaryBlob( std::ifstream& i_file,
                                                 bool i_injectECC )
{
    bool l_pErr = false;

    // Attribute Data
    uint32_t l_attrId = 0;
    uint32_t l_targetType = 0;
    uint16_t l_pos = AttributeTank::ATTR_POS_NA;
    uint8_t l_unitPos = AttributeTank::ATTR_UNIT_POS_NA;
    uint8_t l_node = AttributeTank::ATTR_NODE_NA;
    uint32_t l_valSize = 0;
    uint8_t * l_pVal = NULL;
    bool l_const = false;
    size_t l_fwriteSuccess;
    AttributeTank::TankLayer l_tankLayer =
                                  AttributeTank::TANK_LAYER_NONE;
    std::string l_line;
    std::string l_targetLine;
    std::string l_attrString;
    std::string l_thisAttrString;
    std::vector<std::string> l_attrLines;
    AttributeTank::AttributeHeader l_attrData;

    uint8_t * l_buffer = NULL;
    uint8_t * l_writeBuffer;
    size_t l_totalSize = 0;
    size_t l_newSize;
    size_t l_whitespacePos;

    //File name subject to change on request
    const char * l_blobName = "attrOverride.bin";
    FILE * l_attrBlob;
    l_attrBlob = fopen(l_blobName, "wb");

    // Iterate over all lines in the file.
    do
    {
        // Iterate over all attribute lines for the same attribute. For
        // multi-dimensional attributes, there is a line for each element
        l_attrString.clear();
        l_attrLines.clear();

        do
        {
            // Read next line.
            if (!l_line.length())
            {
                std::getline(i_file, l_line);
                if (!l_line.length())
                {
                    break;
                }
            }

            //Remove any leading whitespace
            l_whitespacePos = l_line.find_first_not_of(" \t");
            l_line = l_line.substr(l_whitespacePos, l_line.size());

            // Process the line.  Could be:
            //    * Target line.
            //    * Attribute line.
            //    * other line.
            if (attrFileIsTargLine(l_line))
            {
                if (l_attrString.empty())
                {
                    // Not currently processing attribute lines, save the target
                    // line, it is for following attribute lines
                    l_targetLine = l_line;
                    l_line.clear();
                }
                else
                {
                    // Currently processing attribute lines. Break out of the
                    // loop to process the current set and look at this target
                    // line in the next iteration
                    break;
                }
            }
            else if (attrFileIsAttrLine(l_line, l_thisAttrString))
            {
                // Found an Attribute line.
                if (l_attrString.empty())
                {
                    // First attribute of the set
                    l_attrString = l_thisAttrString;
                }
                else if (l_attrString != l_thisAttrString)
                {
                    // This attribute is different from the current set. Break
                    // out of the loop to process the current set and look at
                    // this new attribute in the next iteration
                    break;
                }

                // Add the attribute line to the vector and get the next line
                l_attrLines.push_back(l_line);
                l_line.clear();
            }
            else
            {
                // Not a target or attribute line, get the next line
                // If CLEAR line, just get next line since we arent
                // directly dealing with any tanks.
                l_line.clear();
            }
        }
        while(1);

        if (l_attrLines.size())
        {
            // Get the attribute data for this attribute
            l_pErr = attrFileAttrLinesToData(l_attrLines, l_attrId, l_valSize,
                l_pVal, l_const, l_tankLayer);

            // Get the Target Data for this attribute
            attrFileTargetLineToData(l_targetLine, l_tankLayer, l_targetType,
                l_pos, l_unitPos, l_node);

            if (l_pErr)
            {
                printf("attrTextToBinaryBlob:"
                       " Error getting attribute data\n");
                break;
            }

            // Figure out the attribute flags
            uint8_t l_flags = 0;
            if (l_const)
            {
                l_flags = AttributeTank::ATTR_FLAG_CONST;
            }

            //Add data to AttributeHeader
            l_attrData.iv_attrId = l_attrId;
            l_attrData.iv_targetType = l_targetType;
            l_attrData.iv_pos = l_pos;
            l_attrData.iv_unitPos = l_unitPos;
            l_attrData.iv_node = l_node;
            l_attrData.iv_flags = l_flags;
            l_attrData.iv_valSize = l_valSize;

            if( g_showDebugLogs )
            {
                //Print information
                printf("attrTextToBinaryBlob: ATTR override "
                         "Id: 0x%08x, TargType: 0x%08x, Pos: 0x%04x, "
                         "UPos: 0x%02x\n",
                         l_attrId, l_targetType, l_pos, l_unitPos);
                printf("attrTextToBinaryBlob: ATTR override "
                         "Node: 0x%02x, Flags: 0x%02x, Size: 0x%08x",
                         l_node, l_flags, l_valSize);
                printf(" Val: 0x");
                //print the value
                for(int i = 0; i < l_valSize; i++)
                {
                    printf("%x", l_pVal[i]);
                }
                printf("\n\n");
            }

            //write attribute data into a buffer
            l_pErr = writeDataToBuffer( l_attrData,
                                      l_tankLayer,
                                      l_pVal,
                                      l_attrBlob,
                                      l_buffer,
                                      l_totalSize );

            if( l_pErr )
            {
                printf("An error occured in writeDataToBuffer\n");
            }
            delete[] l_pVal;
            l_pVal = NULL;
        }
    } while (!i_file.eof());

    //The Attribute text file has been processed and written into a buffer

    //pad the buffer up to the next multiple of 0x1000 (page size).
    padToNextPage( l_buffer,
                   l_totalSize );

    //inject ECC protection bytes if desired
    if( i_injectECC )
    {
        l_newSize = (l_totalSize/8)*9;
        l_writeBuffer = (uint8_t *) malloc((l_newSize));
        PNOR::ECC::injectECC( l_buffer, l_totalSize, l_writeBuffer );
    }
    else
    {
        l_newSize = l_totalSize;
        l_writeBuffer = l_buffer;
    }

    //write the overrides to the file
    l_fwriteSuccess = fwrite(l_writeBuffer, 1, l_newSize, l_attrBlob);
    if( l_fwriteSuccess != l_newSize )
    {
        printf("There was an error writing to the file!\n");
    }

    if (!l_pErr)
    {
        // Successfully processed the attribute file, close it
        i_file.close();

        // Close attribute blob file
        int l_fclose = fclose(l_attrBlob);

        if(l_fclose != 0 )
        {
            printf("attrTextToBinaryBlob: Error closing blob file\n");
        }

        // free allocated memory
        free(l_buffer);

        //free the ECC buffer if we used it.
        if( i_injectECC )
        {
            free(l_writeBuffer);
        }

    }

    return l_pErr;
}

//******************************************************************************
bool AttrTextToBinaryBlob::getAttrDataFromMap(const char * i_attrString,
                         uint32_t & o_attrId,
                         uint32_t & o_attrElemSizeBytes,
                         size_t (& o_dims)[4],
                         AttributeTank::TankLayer & o_tankLayer)
{
    bool l_success = true;
    do
    {
        const AttributeData* currentAttr = NULL;
        // Check for attribute inside attribute data maps. Must search
        // the TARG map first because for an attribute that exists in both FAPI
        // and TARG maps (i.e. a FAPI Attribute that is implemented by a TARG
        // attribute), an override should be stored in the TARG override tank.
        currentAttr = findAttribute(g_TargAttrs,
                                    sizeof(g_TargAttrs)/sizeof(AttributeData),
                                    i_attrString);
        o_tankLayer = AttributeTank::TANK_LAYER_TARG;

        if (NULL == currentAttr)
        {
            currentAttr =
                      findAttribute(g_FapiAttrs,
                                    sizeof(g_FapiAttrs)/sizeof(AttributeData),
                                    i_attrString);
            o_tankLayer = AttributeTank::TANK_LAYER_FAPI;
        }

        // If generating a permanent override, set tank layer accordingly
        if (g_permOverride)
        {
            if (o_tankLayer == AttributeTank::TANK_LAYER_FAPI)
            {
                printf("Cannot create a permanent override for FAPI attributes - attr = %s\n",
                    i_attrString);
                l_success = false;
                break;
            }
            else
            {
                o_tankLayer = AttributeTank::TANK_LAYER_PERM;
            }
        }

        if (NULL == currentAttr)
        {
            printf("Attribute data not present for the attribute %s!\n",
                    i_attrString);
            l_success = false;
            break;
        }

        o_attrId = currentAttr->iv_attrId;
        o_attrElemSizeBytes = currentAttr->iv_attrElemSizeBytes;
        for(size_t i = 0; i < sizeof(o_dims)/sizeof(size_t); ++i)
        {
            o_dims[i] = currentAttr->iv_dims[i];
        }

    }while( 0 );

    return l_success;
}

bool AttrTextToBinaryBlob::getAttrEnumDataFromMap(const char * i_attrString,
                                                  uint64_t & o_enumVal)
{
    bool l_success = true;

    do
    {
        const AttributeEnum* currentAttr = NULL;
        currentAttr = findAttribute(g_FapiEnums,
                                    sizeof(g_FapiEnums)/sizeof(AttributeEnum),
                                    i_attrString);

        if (NULL == currentAttr)
        {
            printf("Could not find the ENUM value for %s\n", i_attrString);
            l_success = false;
            break;
        }

        o_enumVal = currentAttr->iv_value;

    }while( 0 );
    return l_success;
}

int main(int argc, char *argv[])
{
    std::ifstream l_attributeFile;
    bool err = false;
    bool l_injectECC = false;
    char * l_option;
    const char * l_attributeString;

    int opt;
    while((opt = getopt(argc, argv, "dfhtp")) != -1)
    {
        switch (opt)
        {
            case 'd':
                g_showDebugLogs = true;
                break;
            case 'f':
                l_injectECC = false;
                break;

            case 't':
                l_injectECC = true;
                break;
            case 'p':
                g_permOverride = true;
                break;
            case 'h':
                printf("%s [options] <file>:\n", argv[0]);
                printf("\nExpected args:\n\t Attribute text file of the "
                        "following format: \n\n\t\t # This is a comment\n\n"
                        "\t\tCLEAR\n\n"
                        "\t\ttarget = k0:n0:s0:\n"
                        "\t\tATTR_SCRATCH_UINT8_1 0x12\n"
                        "\t\tATTR_SCRATCH_UINT32_1 0x12345678\n"
                        "\t\tATTR_SCRATCH_UINT64_1 0x8000000000000001 CONST\n\n"
                        "\t\ttarget = k0:n0:s0:centaur:p06\n"
                        "\t\tATTR_MSS_CACHE_ENABLE 0x0 CONST\n\n"
                        "\t\ttarget = k0:n0:s0:centaur.mba:p06:c1\n"
                        "\t\tATTR_MSS_FREQ 0x00000640 CONST\n"
                        "\t\tATTR_MSS_VOLT 0x00000546 CONST\n"
                        "\t\tATTR_EFF_CEN_DRV_IMP_CNTL[0] OHM15 CONST\n"
                        "\t\tATTR_EFF_CEN_DRV_IMP_CNTL[1] OHM15 CONST\n\n"
                        "\t\ttarget = k0:n0:s0:centaur.mba:pall:call\n"
                        "\t\tATTR_MSS_DIMM_MFG_ID_CODE[0][0] 0x12345678\n"
                        "\t\tATTR_MSS_DIMM_MFG_ID_CODE[0][1] 0x12345678\n"
                        "\t\tATTR_MSS_DIMM_MFG_ID_CODE[1][0] 0x12345678\n"
                        "\t\tATTR_MSS_DIMM_MFG_ID_CODE[1][1] 0x12345678\n\n");

                printf("\tOne of the following options:\n\n"
                       "\t\t'-d' - allow debug logs.\n"
                       "\t\t'-h' - display help text.\n"
                       "\t\t'-f' - prevent ECC bytes from being inserted.\n"
                       "\t\t'-t' - allow ECC bytes to be inserted.\n"
                       "\t\t'-p' - permanent override. [FAPI attributes not allowed]\n"
                       "\t\tno option - same as '-f' option.\n\n");

                return 0;
        }
    }

    if (optind == argc)
    {
        printf("Attribute text file not given! Aborting...\n");
        return -1;
    }

    do{

        l_attributeString = argv[optind];
        l_attributeFile.open(l_attributeString);

        err = AttrTextToBinaryBlob::attrTextToBinaryBlob( l_attributeFile,
                                                          l_injectECC );

        if( err )
        {
            printf("An Error occurred!\n");
        }

        if( g_showDebugLogs )
        {
            printf("Attribute overrides successfully written to "
                   "attrOverride.bin\n");
        }
    }while( 0 );

    return (err ? -1 : 0);
}


text:
package retry

import (
	"bufio"
	"context"
	"fmt"
	"io"
	"math"
	"net"
	"net/http"
	"net/http/httptrace"
	"time"

	"github.com/cenkalti/backoff/v4"
	"github.com/opentracing/opentracing-go/ext"
	"github.com/traefik/traefik/v2/pkg/config/dynamic"
	"github.com/traefik/traefik/v2/pkg/log"
	"github.com/traefik/traefik/v2/pkg/middlewares"
	"github.com/traefik/traefik/v2/pkg/safe"
	"github.com/traefik/traefik/v2/pkg/tracing"
)

// Compile time validation that the response writer implements http interfaces correctly.
var _ middlewares.Stateful = &responseWriterWithCloseNotify{}

const (
	typeName = "Retry"
)

// Listener is used to inform about retry attempts.
type Listener interface {
	// Retried will be called when a retry happens, with the request attempt passed to it.
	// For the first retry this will be attempt 2.
	Retried(req *http.Request, attempt int)
}

// Listeners is a convenience type to construct a list of Listener and notify
// each of them about a retry attempt.
type Listeners []Listener

// retry is a middleware that retries requests.
type retry struct {
	attempts        int
	initialInterval time.Duration
	next            http.Handler
	listener        Listener
	name            string
}

// New returns a new retry middleware.
func New(ctx context.Context, next http.Handler, config dynamic.Retry, listener Listener, name string) (http.Handler, error) {
	log.FromContext(middlewares.GetLoggerCtx(ctx, name, typeName)).Debug("Creating middleware")

	if config.Attempts <= 0 {
		return nil, fmt.Errorf("incorrect (or empty) value for attempt (%d)", config.Attempts)
	}

	return &retry{
		attempts:        config.Attempts,
		initialInterval: time.Duration(config.InitialInterval),
		next:            next,
		listener:        listener,
		name:            name,
	}, nil
}

func (r *retry) GetTracingInformation() (string, ext.SpanKindEnum) {
	return r.name, tracing.SpanKindNoneEnum
}

func (r *retry) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
	if r.attempts == 1 {
		r.next.ServeHTTP(rw, req)
		return
	}

	closableBody := req.Body
	defer closableBody.Close()

	// if we might make multiple attempts, swap the body for an io.NopCloser
	// cf https://github.com/traefik/traefik/issues/1008
	req.Body = io.NopCloser(closableBody)

	attempts := 1

	operation := func() error {
		shouldRetry := attempts < r.attempts
		retryResponseWriter := newResponseWriter(rw, shouldRetry)

		// Disable retries when the backend already received request data
		trace := &httptrace.ClientTrace{
			WroteHeaders: func() {
				retryResponseWriter.DisableRetries()
			},
			WroteRequest: func(httptrace.WroteRequestInfo) {
				retryResponseWriter.DisableRetries()
			},
		}
		newCtx := httptrace.WithClientTrace(req.Context(), trace)

		r.next.ServeHTTP(retryResponseWriter, req.WithContext(newCtx))

		if !retryResponseWriter.ShouldRetry() {
			return nil
		}

		attempts++

		return fmt.Errorf("attempt %d failed", attempts-1)
	}

	backOff := backoff.WithContext(r.newBackOff(), req.Context())

	notify := func(err error, d time.Duration) {
		log.FromContext(middlewares.GetLoggerCtx(req.Context(), r.name, typeName)).
			Debugf("New attempt %d for request: %v", attempts, req.URL)

		r.listener.Retried(req, attempts)
	}

	err := backoff.RetryNotify(safe.OperationWithRecover(operation), backOff, notify)
	if err != nil {
		log.FromContext(middlewares.GetLoggerCtx(req.Context(), r.name, typeName)).
			Debugf("Final retry attempt failed: %v", err.Error())
	}
}

func (r *retry) newBackOff() backoff.BackOff {
	if r.attempts < 2 || r.initialInterval <= 0 {
		return &backoff.ZeroBackOff{}
	}

	b := backoff.NewExponentialBackOff()
	b.InitialInterval = r.initialInterval

	// calculate the multiplier for the given number of attempts
	// so that applying the multiplier for the given number of attempts will not exceed 2 times the initial interval
	// it allows to control the progression along the attempts
	b.Multiplier = math.Pow(2, 1/float64(r.attempts-1))

	// according to docs, b.Reset() must be called before using
	b.Reset()
	return b
}

// Retried exists to implement the Listener interface. It calls Retried on each of its slice entries.
func (l Listeners) Retried(req *http.Request, attempt int) {
	for _, listener := range l {
		listener.Retried(req, attempt)
	}
}

type responseWriter interface {
	http.ResponseWriter
	http.Flusher
	ShouldRetry() bool
	DisableRetries()
}

func newResponseWriter(rw http.ResponseWriter, shouldRetry bool) responseWriter {
	responseWriter := &responseWriterWithoutCloseNotify{
		responseWriter: rw,
		headers:        make(http.Header),
		shouldRetry:    shouldRetry,
	}
	if _, ok := rw.(http.CloseNotifier); ok {
		return &responseWriterWithCloseNotify{
			responseWriterWithoutCloseNotify: responseWriter,
		}
	}
	return responseWriter
}

type responseWriterWithoutCloseNotify struct {
	responseWriter http.ResponseWriter
	headers        http.Header
	shouldRetry    bool
	written        bool
}

func (r *responseWriterWithoutCloseNotify) ShouldRetry() bool {
	return r.shouldRetry
}

func (r *responseWriterWithoutCloseNotify) DisableRetries() {
	r.shouldRetry = false
}

func (r *responseWriterWithoutCloseNotify) Header() http.Header {
	if r.written {
		return r.responseWriter.Header()
	}
	return r.headers
}

func (r *responseWriterWithoutCloseNotify) Write(buf []byte) (int, error) {
	if r.ShouldRetry() {
		return len(buf), nil
	}
	return r.responseWriter.Write(buf)
}

func (r *responseWriterWithoutCloseNotify) WriteHeader(code int) {
	if r.ShouldRetry() && code == http.StatusServiceUnavailable {
		// We get a 503 HTTP Status Code when there is no backend server in the pool
		// to which the request could be sent.  Also, note that r.ShouldRetry()
		// will never return true in case there was a connection established to
		// the backend server and so we can be sure that the 503 was produced
		// inside Traefik already and we don't have to retry in this cases.
		r.DisableRetries()
	}

	if r.ShouldRetry() {
		return
	}

	// In that case retry case is set to false which means we at least managed
	// to write headers to the backend : we are not going to perform any further retry.
	// So it is now safe to alter current response headers with headers collected during
	// the latest try before writing headers to client.
	headers := r.responseWriter.Header()
	for header, value := range r.headers {
		headers[header] = value
	}

	r.responseWriter.WriteHeader(code)
	r.written = true
}

func (r *responseWriterWithoutCloseNotify) Hijack() (net.Conn, *bufio.ReadWriter, error) {
	hijacker, ok := r.responseWriter.(http.Hijacker)
	if !ok {
		return nil, nil, fmt.Errorf("%T is not a http.Hijacker", r.responseWriter)
	}
	return hijacker.Hijack()
}

func (r *responseWriterWithoutCloseNotify) Flush() {
	if flusher, ok := r.responseWriter.(http.Flusher); ok {
		flusher.Flush()
	}
}

type responseWriterWithCloseNotify struct {
	*responseWriterWithoutCloseNotify
}

func (r *responseWriterWithCloseNotify) CloseNotify() <-chan bool {
	return r.responseWriter.(http.CloseNotifier).CloseNotify()
}


text:
package com.appleframework.jms.eventbus.producer;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.appleframework.jms.core.exception.JmsException;
import com.appleframework.jms.core.producer.MessageProducer;
import com.google.common.eventbus.EventBus;

/**
 * @author Cruise.Xu
 *
 */
public class TMessageProducer implements MessageProducer {

	private static Logger logger = LoggerFactory.getLogger(TMessageProducer.class);

	private EventBus eventBus;

	public void setEventBus(EventBus eventBus) {
		this.eventBus = eventBus;
	}

	@Override
	public void sendByte(byte[] message) throws JmsException {
		try {
			eventBus.post(message);
		} catch (Exception e) {
			logger.error("", e);
		}
	}

	@Override
	public void sendObject(Serializable message) throws JmsException {
		try {
			eventBus.post(message);
		} catch (Exception e) {
			logger.error("", e);
		}
	}

	@Override
	public void sendText(String message) throws JmsException {
		try {
			eventBus.post(message);
		} catch (Exception e) {
			logger.error("", e);
		}
	}

}


text:
#ifndef ORM_FILTERSET_HPP
#define ORM_FILTERSET_HPP

//#include <ORM/backends/private/VFilter.hpp>
#include <ORM/backends/private/Filter.hpp>

namespace orm
{
    template<typename RELATED>
    class FilterSet
    {
        public:

            FilterSet(FilterSet<RELATED>&& a);
            FilterSet(const FilterSet<RELATED>& a);

            template<typename T>
            FilterSet(Filter<RELATED,T>&& f);

            FilterSet(FilterSet<RELATED>&& l, const std::string& o);
            FilterSet(const FilterSet<RELATED>& l, const std::string& o);

            FilterSet(FilterSet<RELATED>&& l, const std::string o,FilterSet<RELATED>&& r);

            ~FilterSet();

            void debugPrint(const DB& db)const;

        private:
            void* _left;
            std::string _ope;
            FilterSet<RELATED>* _right;

            enum Type {
                LEAF,
                UNARY,
                BINARY,
            } _type;

        protected:
            template<typename T> friend class QuerySet;
            template<typename T,typename U> friend class M2MQuerySet;
           /**
            * \brief set the value in the filter in the query
            *
            * \param query Prepared query
            * \param column column index
            *
            * \return false if fail
            **/
            bool _set(Query& query,unsigned int& column) const;

            /**
             * \brief add the sql code to the query
             * \param query sql to append to
             * \param db data base to use
             */
            void _toQuery(std::string& query,DB& db) const;
    };

    template<typename RELATED>
    FilterSet<RELATED> operator!(FilterSet<RELATED>&& a);

    template<typename RELATED>
    FilterSet<RELATED> operator!(const FilterSet<RELATED>& a);

    template<typename RELATED>
    FilterSet<RELATED> operator&&(FilterSet<RELATED>&& a, FilterSet<RELATED>&& b);

    template<typename RELATED>
    FilterSet<RELATED> operator||(FilterSet<RELATED>&& a, FilterSet<RELATED>&& b);

    template <typename RELATED,typename T, typename ... Args>
    FilterSet<RELATED> Q(const T& value,Args&& ... args);

}
#include <ORM/backends/private/FilterSet.tpl>
#endif


text:
'use strict';

/**
 * Input to apply recovery point.
 *
 */
class ApplyRecoveryPointInput {
  /**
   * Create a ApplyRecoveryPointInput.
   * @member {object} [properties] The input properties to apply recovery
   * point.
   * @member {string} [properties.recoveryPointId] The recovery point Id.
   * @member {object} [properties.providerSpecificDetails] Provider specific
   * input for applying recovery point.
   * @member {string} [properties.providerSpecificDetails.instanceType]
   * Polymorphic Discriminator
   */
  constructor() {
  }

  /**
   * Defines the metadata of ApplyRecoveryPointInput
   *
   * @returns {object} metadata of ApplyRecoveryPointInput
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ApplyRecoveryPointInput',
      type: {
        name: 'Composite',
        className: 'ApplyRecoveryPointInput',
        modelProperties: {
          properties: {
            required: false,
            serializedName: 'properties',
            type: {
              name: 'Composite',
              className: 'ApplyRecoveryPointInputProperties'
            }
          }
        }
      }
    };
  }
}

module.exports = ApplyRecoveryPointInput;


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

namespace PeterJuhasz.AspNetCore.Extensions.Security;

public class CspDirectiveList
{
    /// <summary>
    /// The base-uri directive restricts the URLs which can be used in a document's <base> element. If this value is absent, then any URI is allowed. If this directive is absent, the user agent will use the value in the <base> element.
    /// </summary>
    public CspDirective? BaseUri { get; set; }

    /// <summary>
    /// Serves as a fallback for the other fetch directives.
    /// </summary>
    public CspDirective DefaultSrc { get; set; } = CspDirective.None;

    /// <summary>
    /// Specifies valid sources for stylesheets.
    /// </summary>
    public StyleCspDirective? StyleSrc { get; set; }

    /// <summary>
    /// Specifies valid sources for inline styles applied to individual DOM elements.
    /// </summary>
    public StyleCspDirective? StyleSrcAttr { get; set; }

    /// <summary>
    /// Specifies valid sources for stylesheets <style> elements and <link> elements with rel="stylesheet".
    /// </summary>
    public StyleCspDirective? StyleSrcElem { get; set; }

    /// <summary>
    /// Specifies valid sources for JavaScript.
    /// </summary>
    public ScriptCspDirective? ScriptSrc { get; set; }

    /// <summary>
    /// Specifies valid sources for JavaScript inline event handlers.
    /// </summary>
    public ScriptCspDirective? ScriptSrcAttr { get; set; }

    /// <summary>
    /// Specifies valid sources for JavaScript <script> elements.
    /// </summary>
    public ScriptCspDirective? ScriptSrcElem { get; set; }

    /// <summary>
    /// Specifies valid sources of images and favicons
    /// </summary>
    public CspDirective? ImgSrc { get; set; }

    /// <summary>
    /// Specifies valid sources for fonts loaded using @font-face.
    /// </summary>
    public CspDirective? FontSrc { get; set; }

    /// <summary>
    /// Restricts the URLs which can be loaded using script interfaces.
    /// </summary>
    public CspDirective? ConnectSrc { get; set; }

    /// <summary>
    /// Specifies valid sources for the <object>, <embed>, and <applet> elements.
    /// </summary>
    public CspDirective? ObjectSrc { get; set; }

    /// <summary>
    /// Specifies valid resources that may be prefetched or prerendered.
    /// </summary>
    public CspDirective? PrefetchSrc { get; set; }

    /// <summary>
    /// Specifies valid sources for loading media using the <audio> and <video> elements.
    /// </summary>
    public CspDirective? MediaSrc { get; set; }

    /// <summary>
    /// Specifies valid sources of application manifest files.
    /// </summary>
    public CspDirective? ManifestSrc { get; set; }

    /// <summary>
    /// Specifies valid sources for nested browsing contexts loading using elements such as <frame> and <iframe>.
    /// </summary>
    public CspDirective? FrameSrc { get; set; }

    /// <summary>
    /// Defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>.
    /// </summary>
    public CspDirective? ChildSrc { get; set; }

    /// <summary>
    /// Restricts the URLs which can be used as the target of a form submissions from a given context.
    /// </summary>
    public CspDirective? FormAction { get; set; }

    /// <summary>
    /// Specifies valid parents that may embed a page using <frame>, <iframe>, <object>, <embed>, or <applet>.
    /// </summary>
    public CspDirective? FrameAncestors { get; set; }

    /// <summary>
    /// Specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts.
    /// </summary>
    public CspDirective? WorkerSrc { get; set; }

    /// <summary>
    /// Restricts the URLs to which a document can navigate by any means (a, form, window.location, window.open, etc.).
    /// </summary>
    public CspDirective? NavigationTo { get; set; }

    /// <summary>
    /// Enables a sandbox for the requested resource similar to the <iframe> sandbox attribute.
    /// </summary>
    public CspSandboxRules? Sandbox { get; set; }

    /// <summary>
    /// Restricts the set of plugins that can be embedded into a document by limiting the types of resources which can be loaded.
    /// </summary>
    public IReadOnlyCollection<string>? PluginTypes { get; set; }

    /// <summary>
    /// Requires the use of SRI for scripts or styles on the page.
    /// </summary>
    public CspRequireSRIResources? RequireSriFor { get; set; }

    /// <summary>
    /// The upgrade-insecure-requests directive instructs user agents to treat all of a site's insecure URLs (those served over HTTP) as though they have been replaced with secure URLs (those served over HTTPS).
    /// </summary>
    public bool UpgradeInsecureRequests { get; set; } = true;

    /// <summary>
    /// The block-all-mixed-content directive prevents loading any assets using HTTP when the page is loaded using HTTPS.
    /// </summary>
    public bool BlockAllMixedContent { get; set; } = true;

    /// <summary>
    /// Gets or sets the name of the Report-To group for reporting violations.
    /// </summary>
    public string? ReportTo { get; set; }

    [Obsolete]
    public Uri? ReportUri { get; set; }

    public CspDirectiveList Clone()
    {
        return new CspDirectiveList
        {
            BaseUri = this.BaseUri,
            BlockAllMixedContent = this.BlockAllMixedContent,
            ChildSrc = this.ChildSrc,
            ConnectSrc = this.ConnectSrc,
            DefaultSrc = this.DefaultSrc,
            FontSrc = this.FontSrc,
            FormAction = this.FormAction,
            FrameAncestors = this.FrameAncestors,
            FrameSrc = this.FrameSrc,
            ImgSrc = this.ImgSrc,
            ManifestSrc = this.ManifestSrc,
            MediaSrc = this.MediaSrc,
            NavigationTo = this.NavigationTo,
            ObjectSrc = this.ObjectSrc,
            PrefetchSrc = this.PrefetchSrc,
            PluginTypes = this.PluginTypes,
            RequireSriFor = this.RequireSriFor,
            Sandbox = this.Sandbox,
            ScriptSrc = this.ScriptSrc,
            ScriptSrcAttr = this.ScriptSrcAttr,
            ScriptSrcElem = this.ScriptSrcElem,
            StyleSrc = this.StyleSrc,
            StyleSrcAttr = this.StyleSrcAttr,
            StyleSrcElem = this.StyleSrcElem,
            UpgradeInsecureRequests = this.UpgradeInsecureRequests,
            WorkerSrc = this.WorkerSrc,
            ReportTo = this.ReportTo,
#pragma warning disable CS0612
            ReportUri = this.ReportUri,
#pragma warning restore CS0612
        };
    }

    public override string ToString()
    {
        ICollection<string> directives = new List<string>();

        if (this.DefaultSrc != null) directives.Add($"default-src {this.DefaultSrc}");
        if (this.BaseUri != null) directives.Add($"base-uri {this.BaseUri}");
        if (this.ChildSrc != null) directives.Add($"child-src {this.ChildSrc}");
        if (this.ConnectSrc != null) directives.Add($"connect-src {this.ConnectSrc}");
        if (this.FontSrc != null) directives.Add($"font-src {this.FontSrc}");
        if (this.FormAction != null) directives.Add($"form-action {this.FormAction}");
        if (this.FrameAncestors != null) directives.Add($"frame-ancestors {this.FrameAncestors}");
        if (this.FrameSrc != null) directives.Add($"frame-src {this.FrameSrc}");
        if (this.ImgSrc != null) directives.Add($"img-src {this.ImgSrc}");
        if (this.ManifestSrc != null) directives.Add($"manifest-src {this.ManifestSrc}");
        if (this.MediaSrc != null) directives.Add($"media-src {this.MediaSrc}");
        if (this.NavigationTo != null) directives.Add($"navigation-to {this.NavigationTo}");
        if (this.ObjectSrc != null) directives.Add($"object-src {this.ObjectSrc}");
        if (this.PrefetchSrc != null) directives.Add($"prefetch-src {this.PrefetchSrc}");
        if (this.ScriptSrc != null) directives.Add($"script-src {this.ScriptSrc}");
        if (this.ScriptSrcAttr != null) directives.Add($"script-src-attr {this.ScriptSrcAttr}");
        if (this.ScriptSrcElem != null) directives.Add($"script-src-elem {this.ScriptSrcElem}");
        if (this.StyleSrc != null) directives.Add($"style-src {this.StyleSrc}");
        if (this.StyleSrcAttr != null) directives.Add($"style-src-attr {this.StyleSrcAttr}");
        if (this.StyleSrcElem != null) directives.Add($"style-src-elem {this.StyleSrcElem}");
        if (this.WorkerSrc != null) directives.Add($"worker-src {this.WorkerSrc}");

        if (this.BlockAllMixedContent) directives.Add("block-all-mixed-content");
        if (this.UpgradeInsecureRequests) directives.Add("upgrade-insecure-requests");
        if (this.PluginTypes?.Any() ?? false) directives.Add($"plugin-types {String.Join(" ", this.PluginTypes)}");
        if (this.RequireSriFor != null) directives.Add(ConstructHeaderValue(this.RequireSriFor.Value));
        if (this.Sandbox != null) directives.Add(ConstructHeaderValue(this.Sandbox.Value));

        if (this.ReportTo != null) directives.Add($"report-to ${this.ReportTo}");
#pragma warning disable CS0612
        if (this.ReportUri != null) directives.Add($"report-uri {this.ReportUri}");
#pragma warning restore CS0612

        return String.Join("; ", directives);
    }

    internal static string ConstructHeaderValue(CspRequireSRIResources values)
    {
        ICollection<string> tokens = new List<string>();

        if (values.HasFlag(CspRequireSRIResources.Style)) tokens.Add("style");
        if (values.HasFlag(CspRequireSRIResources.Script)) tokens.Add("script");

        return $"require-sri-for {String.Join(" ", tokens)}";
    }

    internal static string ConstructHeaderValue(CspSandboxRules values)
    {
        if (values == CspSandboxRules.Sandbox)
            return "sandbox";

        ICollection<string> tokens = new List<string>();

        if (values.HasFlag(CspSandboxRules.AllowForms)) tokens.Add("allow-forms");
        if (values.HasFlag(CspSandboxRules.AllowModals)) tokens.Add("allow-modals");
        if (values.HasFlag(CspSandboxRules.AllowOrientationLock)) tokens.Add("allow-orientation-lock");
        if (values.HasFlag(CspSandboxRules.AllowPointerLock)) tokens.Add("allow-pointer-lock");
        if (values.HasFlag(CspSandboxRules.AllowPopups)) tokens.Add("allow-popups");
        if (values.HasFlag(CspSandboxRules.AllowPopupsToEscapeSandbox)) tokens.Add("allow-popups-to-escape-sandbox");
        if (values.HasFlag(CspSandboxRules.AllowPresentation)) tokens.Add("allow-presentation");
        if (values.HasFlag(CspSandboxRules.AllowSameOrigin)) tokens.Add("allow-same-origin");
        if (values.HasFlag(CspSandboxRules.AllowScripts)) tokens.Add("allow-scripts");
        if (values.HasFlag(CspSandboxRules.AllowTopNavigation)) tokens.Add("allow-top-navigation");

        return $"sandbox {String.Join(" ", tokens)}";
    }
}


text:
#ifndef _LINUX_HDSMART_H
#define _LINUX_HDSMART_H

#define OFFLINE_FULL_SCAN		0
#define SHORT_SELF_TEST			1
#define EXTEND_SELF_TEST		2
#define SHORT_CAPTIVE_SELF_TEST		129
#define EXTEND_CAPTIVE_SELF_TEST	130

/* smart_attribute is the vendor specific in SFF-8035 spec */
typedef struct ata_smart_attribute_s {
	unsigned char			id;
	unsigned short			status_flag;
	unsigned char			normalized;
	unsigned char			worse_normal;
	unsigned char			raw[6];
	unsigned char			reserv;
} __attribute__ ((packed)) ata_smart_attribute_t;

/* smart_values is format of the read drive Atrribute command */
typedef struct ata_smart_values_s {
	unsigned short			revnumber;
	ata_smart_attribute_t		vendor_attributes [30];
        unsigned char			offline_data_collection_status;
        unsigned char			self_test_exec_status;
	unsigned short			total_time_to_complete_off_line;
	unsigned char			vendor_specific_366;
	unsigned char			offline_data_collection_capability;
	unsigned short			smart_capability;
	unsigned char			errorlog_capability;
	unsigned char			vendor_specific_371;
	unsigned char			short_test_completion_time;
	unsigned char			extend_test_completion_time;
	unsigned char			reserved_374_385 [12];
	unsigned char			vendor_specific_386_509 [125];
	unsigned char			chksum;
} __attribute__ ((packed)) ata_smart_values_t;

/* Smart Threshold data structures */
/* Vendor attribute of SMART Threshold */
typedef struct ata_smart_threshold_entry_s {
	unsigned char			id;
	unsigned char			normalized_threshold;
	unsigned char			reserved[10];
} __attribute__ ((packed)) ata_smart_threshold_entry_t;

/* Format of Read SMART THreshold Command */
typedef struct ata_smart_thresholds_s {
	unsigned short			revnumber;
	ata_smart_threshold_entry_t	thres_entries[30];
	unsigned char			reserved[149];
	unsigned char			chksum;
} __attribute__ ((packed)) ata_smart_thresholds_t;

typedef struct ata_smart_errorlog_command_struct_s {
	unsigned char			devicecontrolreg;
	unsigned char			featuresreg;
	unsigned char			sector_count;
	unsigned char			sector_number;
	unsigned char			cylinder_low;
	unsigned char			cylinder_high;
	unsigned char			drive_head;
	unsigned char			commandreg;
	unsigned int			timestamp;
} __attribute__ ((packed)) ata_smart_errorlog_command_struct_t;

typedef struct ata_smart_errorlog_error_struct_s {
	unsigned char			error_condition;
	unsigned char			extended_error[14];
	unsigned char			state;
	unsigned short			timestamp;
} __attribute__ ((packed)) ata_smart_errorlog_error_struct_t;

typedef struct ata_smart_errorlog_struct_s {
	ata_smart_errorlog_command_struct_t	commands[6];
	ata_smart_errorlog_error_struct_t	error_struct;
} __attribute__ ((packed)) ata_smart_errorlog_struct_t;

typedef struct ata_smart_errorlog_s {
	unsigned char			revnumber;
	unsigned char			error_log_pointer;
	ata_smart_errorlog_struct_t	errorlog_struct[5];
	unsigned short			ata_error_count;
	unsigned short			non_fatal_count;
	unsigned short			drive_timeout_count;
	unsigned char			reserved[53];
	unsigned char			chksum;
} __attribute__ ((packed)) ata_smart_errorlog_t;

typedef struct ata_smart_selftestlog_struct_s {
	unsigned char			selftestnumber;
	unsigned char			selfteststatus;
	unsigned short			timestamp;
	unsigned char			selftestfailurecheckpoint;
	unsigned int			lbafirstfailure;
	unsigned char			vendorspecific[15];
} __attribute__ ((packed)) ata_smart_selftestlog_struct_t;

typedef struct ata_smart_selftestlog_s {
	unsigned short			revnumber;
	ata_smart_selftestlog_struct_t	selftest_struct[21];
	unsigned char			vendorspecific[2];
	unsigned char			mostrecenttest;
	unsigned char			resevered[2];
	unsigned char			chksum;
} __attribute__ ((packed)) ata_smart_selftestlog_t;

#endif	/* _LINUX_HDSMART_H */