text:
package de.uni_hildesheim.sse.qmApp.editors;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;

import de.uni_hildesheim.sse.qmApp.dialogs.Dialogs;
import de.uni_hildesheim.sse.qmApp.model.ModelAccess;
import eu.qualimaster.easy.extension.QmConstants;
import net.ssehub.easy.basics.logger.EASyLoggerFactory;
import net.ssehub.easy.basics.modelManagement.IModelListener;
import net.ssehub.easy.instantiation.core.Bundle;
import net.ssehub.easy.producer.ui.productline_editor.ConfigurationTableEditorFactory;
import net.ssehub.easy.producer.ui.productline_editor.DelegatingEasyEditorPage;
import net.ssehub.easy.producer.ui.productline_editor.IRefreshableEditor;
import net.ssehub.easy.producer.ui.productline_editor.ConfigurationTableEditorFactory.UIConfiguration;
import net.ssehub.easy.producer.ui.productline_editor.ConfigurationTableEditorFactory.UIParameter;
import net.ssehub.easy.varModel.confModel.Configuration;
import net.ssehub.easy.varModel.confModel.DisplayNameProvider;
import net.ssehub.easy.varModel.confModel.IDecisionVariable;
import net.ssehub.easy.varModel.management.VarModel;
import net.ssehub.easy.varModel.model.AbstractVariable;
import net.ssehub.easy.varModel.model.ContainableModelElement;
import net.ssehub.easy.varModel.model.DecisionVariableDeclaration;
import net.ssehub.easy.varModel.model.Project;
import net.ssehub.easy.varModel.model.datatypes.Compound;
import net.ssehub.easy.varModel.model.datatypes.ConstraintType;
import net.ssehub.easy.varModel.model.datatypes.Container;
import net.ssehub.easy.varModel.model.datatypes.Enum;
import net.ssehub.easy.varModel.model.datatypes.EnumLiteral;
import net.ssehub.easy.varModel.model.datatypes.IDatatype;
import net.ssehub.easy.varModel.model.datatypes.Reference;
import net.ssehub.easy.varModel.model.datatypes.StringType;
import net.ssehub.easy.varModel.model.filter.ReferenceValuesFinder;
import net.ssehub.easy.varModel.model.values.CompoundValue;
import net.ssehub.easy.varModel.model.values.Value;
import net.ssehub.easy.varModel.model.values.ValueDoesNotMatchTypeException;
import net.ssehub.easy.varModel.model.values.ValueFactory;
import net.ssehub.easy.varModel.persistency.StringProvider;
import qualimasterapplication.Activator;

/**
 * Provides the basis for QualiMaster specific table editors.
 *
 * @author Holger Eichelberger
 */
public abstract class AbstractTableEditor extends Composite implements IQMEditor, IDirtyableEditor,
    IModelListener<Project>, IRefreshableEditor {

    protected static final String SLOT_NAME = QmConstants.SLOT_FIELD_NAME;
    protected static final String SLOT_TYPE = QmConstants.SLOT_FIELD_TYPE;

    private TableViewer tableViewer;
    private int prefWidth = -1;
    private int prefHeight = 80;
    private net.ssehub.easy.varModel.confModel.Configuration tmpConfig;
    private UIConfiguration uiCfg;
    private List<SelectionListener> dirtyListener = new ArrayList<SelectionListener>();
    private Map<UIParameter, Object> parentParameters;
    private IDecisionVariable variable;

    /**
     * Creates an instance.
     *
     * @param config the parent UI configuration
     * @param variable the variable to be edited
     * @param parent the parent composite
     * @param style the composite style
     */
    protected AbstractTableEditor(UIConfiguration config, IDecisionVariable variable, Composite parent, int style) {
        super(parent, style);
        this.variable = variable;
        VarModel.INSTANCE.events().addModelListener(variable.getConfiguration().getProject(), this);
        this.parentParameters = config.getParameters();
    }

    @Override
    public void dispose() {
        VarModel.INSTANCE.events().removeModelListener(variable.getConfiguration().getProject(), this);
        super.dispose();
    }

    /**
     * Returns the decision variable underlying this editor. Do not store this variable
     * permanently as it may change due to model reloads.
     *
     * @return the variable to be edited
     */
    protected IDecisionVariable getVariable() {
        return variable;
    }

    /**
     * Returns the configuration containing the underlying decision variable. Do not store this variable
     * permanently as it may change due to model reloads.
     *
     * @return the containing project
     */
    protected Configuration getConfiguration() {
        return variable.getConfiguration();
    }

    /**
     * Returns the project containing the underlying decision variable. Do not store this variable
     * permanently as it may change due to model reloads.
     *
     * @return the containing project
     */
    protected Project getProject() {
        return getConfiguration().getProject();
    }

    /**
     * Defines the actual table viewer.
     *
     * @param tableViewer the actual table viewer
     * @return tableViewer
     */
    protected TableViewer setTableViewer(TableViewer tableViewer) {
        this.tableViewer = tableViewer;
        return tableViewer;
    }

    /**
     * Defines the preferred size of this table editor.
     *
     * @param prefWidth the preferred width (ignored if negative)
     * @param prefHeight the preferred height (ignored if negative)
     */
    protected void setPreferredSize(int prefWidth, int prefHeight) {
        this.prefWidth = prefWidth;
        this.prefHeight = prefHeight;
    }

    /**
     * Returns the actual table viewer. (call {@link #setTableViewer(TableViewer)} before)
     *
     * @return the actual table viewer
     */
    protected TableViewer getTableViewer() {
        return tableViewer;
    }

    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        if (null != tableViewer) {
            tableViewer.getTable().setEnabled(enabled);
        }
    }

    /**
     * Returns whether decl shall be displayed.
     *
     * @param decl the declaration to be considered
     * @return true if decl shall be displayed, false else
     */
    protected static boolean display(DecisionVariableDeclaration decl) {
        return ModelAccess.isVisibleType(decl.getType()) && !ConstraintType.isConstraint(decl.getType());
    }

    /**
     * Turns a value into a string and aims at emulating the currently missing label provider relying on the
     * actual value. This shall later be replaced by relying on GUIvariables! Then this method can be deleted.
     *
     * @param value the value to be turned into a String
     * @return the String representation
     */
    protected static String toString(Value value) {
        String result = StringProvider.toIvmlString(value);
        IDatatype type = value.getType();
        if (StringType.TYPE.isAssignableFrom(type)) {
            while (result.startsWith("\"")) {
                result = result.substring(1);
            }
            while (result.endsWith("\"")) {
                result = result.substring(0, result.length() - 1);
            }
        } else if (Enum.TYPE.isAssignableFrom(type)) {
            int pos = result.lastIndexOf(".");
            if (pos > 0 && pos + 1 < result.length()) {
                result = result.substring(pos + 1);
            }
        } else if (Container.TYPE.isAssignableFrom(type)) {
            if (result.startsWith("{\"")) {
                result = result.substring(2);
            }
            while (result.endsWith("\"}")) {
                result = result.substring(0, result.length() - 2);
            }
        }
        return result;
    }

    @Override
    public Point computeSize(int wHint, int hHint, boolean changed) {
        Point result = super.computeSize(wHint, hHint, changed);
        if (prefWidth >= 0 && result.x < prefWidth) {
            result.x = prefWidth;
        }
        if (prefHeight >= 0 && result.y < prefHeight) {
            result.y = prefHeight;
        }
        return result;
    }

    /**
     * Creates a temporary model to enable the EASy editors. EASy does not create deeper level decision
     * variables, otherwise we could just use them. This is an awful hack.
     *
     * @param compound the compound to take the contained elements from
     */
    protected void createTemporaryModel(Compound compound) {
        Project tmpModel = new Project("tmp");
        for (int e = 0; e < compound.getElementCount(); e++) {
            DecisionVariableDeclaration elt = compound.getElement(e);
            DecisionVariableDeclaration tmpDecl = new DecisionVariableDeclaration(
                elt.getName(), elt.getType(), tmpModel);
            tmpDecl.setComment(elt.getComment()); // take over .text information
            tmpModel.add(tmpDecl);
        }
        augmentTemporaryModel(tmpModel);
        tmpConfig = new net.ssehub.easy.varModel.confModel.Configuration(tmpModel);
        uiCfg = ConfigurationTableEditorFactory.createConfiguration(tmpConfig,
            new DelegatingEasyEditorPage(tableViewer.getTable()), parentParameters);
    }

    /**
     * Returns the specified UI parameter.
     *
     * @param key the parameter (key)
     * @return the parameter value (may be null)
     */
    protected Object getUiParameter(UIParameter key) {
        return null == uiCfg ? null : uiCfg.getParameter(key);
    }

    /**
     * Allows to augment the temporary model.
     *
     * @param tmpModel the temporary model
     */
    protected void augmentTemporaryModel(Project tmpModel) {
    }

    /**
     * Creates a cell editor for the given decision variable from the temporary model.
     * Call {@link #createTemporaryModel(Compound)} to initialize the model first.
     *
     * @param var the variable to create the editor for
     * @return the cell editor (may be null)
     */
    protected CellEditor createCellEditor(IDecisionVariable var) {
        return ConfigurationTableEditorFactory.createCellEditor(uiCfg, var);
    }

    /**
     * Returns a decision variable from the temporary configuration.
     * Call {@link #createTemporaryModel(Compound)} to initialize the temporary configuration.
     *
     * @param name the name of the variable
     * @return null if no such variable exists or the temporary configuration was not initialized
     */
    protected IDecisionVariable getTemporaryDecisionVariable(String name) {
        IDecisionVariable var = null;
        ContainableModelElement elt = tmpConfig.getProject().getElement(name);
        if (elt instanceof AbstractVariable) {
            var = tmpConfig.getDecision((AbstractVariable) elt);
        }
        return var;
    }

    /**
     * Sets the value of a compound field if possible.
     *
     * @param compound the compound to set the value for
     * @param field the field name
     * @param value the value
     */
    protected void setValue(CompoundValue compound, String field, Object value) {
        String name = null;
        if (null != compound) {
            try {
                name = compound.getStringValue(SLOT_NAME);
                DecisionVariableDeclaration element = ((Compound) compound.getType()).getElement(field);
                if (null != element) {
                    IDatatype type = element.getType();
                    if (null != type) {
                        value = referenceValue(type, value);
                        compound.configureValue(field, ValueFactory.createValue(type, value));
                        notifyDirty();
                    }
                }
            } catch (ValueDoesNotMatchTypeException e) {
                EASyLoggerFactory.INSTANCE.getLogger(AbstractTableEditor.class, Activator.PLUGIN_ID).exception(e);
                Dialogs.showErrorDialog("Illegal value", name + ":" + e.getMessage());
            }
        }
    }

    /**
     * Turns the given value into an reference if required, e.g., for configurable types.
     *
     * @param type the target type
     * @param value the value to be set
     * @return the referenced value or value
     */
    private static Object referenceValue(IDatatype type, Object value) {
        if (Reference.TYPE.isAssignableFrom(type)) {
            DisplayNameProvider nameProvider = DisplayNameProvider.getInstance();
            List<AbstractVariable> possibleDecls = ReferenceValuesFinder.findPossibleValues(
                de.uni_hildesheim.sse.qmApp.model.VariabilityModel.Configuration.INFRASTRUCTURE.getConfiguration()
                    .getProject(), (Reference) type);
            for (int i = 0; i < possibleDecls.size(); i++) {
                AbstractVariable declaration = possibleDecls.get(i);
                String name = nameProvider.getDisplayName(declaration);
                if (name.equals(value)) {
                    value = declaration;
                    break;
                }
            }
        }
        return value;
    }

    /**
     * Provides access to a (nested) value of a variable in a generic way. This is needed to retrieve the value
     * on demand based on changing models.
     *
     * @author Holger Eichelberger
     */
    protected interface IValueAccessor {

        /**
         * Returns the actual value.
         *
         * @param key in case that the accessor holds more than one value, key provides access to the
         *     right value
         * @return the actual value
         */
        public CompoundValue getValue(Object key);

    }

    /**
     * A basic table object representing a compound a name.
     *
     * @author Holger Eichelberger
     */
    protected class TableObject {

        private String name;
        private IValueAccessor accessor;

        /**
         * Creates a table object.
         *
         * @param name the name
         * @param accessor the value accessor
         */
        protected TableObject(String name, IValueAccessor accessor) {
            this.name = name;
            this.accessor = accessor;
        }

        /**
         * Returns the name.
         *
         * @return the name
         */
        public String getName() {
            return name;
        }

        /**
         * Changes the name (also in the compound value if possible).
         *
         * @param name the new name
         */
        public void setName(String name) {
            this.name = name;
            setValue(getCompoundValue(), SLOT_NAME, name);
        }

        /**
         * Returns the compound value.
         *
         * @return the compound value
         */
        protected CompoundValue getCompoundValue() {
            return accessor.getValue(this);
        }

    }

    /**
     * A basic table object representing a compound with name and type.
     *
     * @author Holger Eichelberger
     */
    protected class TypedTableObject extends TableObject {

        private String type;

        /**
         * Creates a table object.
         *
         * @param name the name
         * @param type the type
         * @param accessor the value accessor
         */
        protected TypedTableObject(String name, String type, IValueAccessor accessor) {
            super(name, accessor);
            this.type = type;
        }

        /**
         * Returns the name.
         *
         * @return the name
         */
        public String getType() {
            return type;
        }

        /**
         * Return tuples type.
         * @param type the type to set
         */
        public void setType(String type) {
            this.type = type;
            setValue(getCompoundValue(), SLOT_TYPE, type);
        }

    }

    /**
     * EditingSUpport for name row assuming that table elements are of type {@link TableObject}.
     *
     * @author Niko
     */
    protected class NameEditingSupport extends EditingSupport {

        private final TableViewer viewer;
        private IDecisionVariable var;

        /**
         * Constructor.
         *
         * @param viewer the parent table viewer
         */
        public NameEditingSupport(TableViewer viewer) {
            this(viewer, getTemporaryDecisionVariable(SLOT_NAME));
        }

        /**
         * Constructor.
         *
         * @param viewer the parent table viewer
         * @param var the variable to edit
         */
        protected NameEditingSupport(TableViewer viewer, IDecisionVariable var) {
            super(viewer);
            this.viewer = viewer;
            this.var = var;
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            CellEditor result;
            if (var != null) {
                result = createCellEditor(var);
            } else {
                result = new TextCellEditor(viewer.getTable());
            }
            return result;
        }

        @Override
        protected boolean canEdit(Object element) {
            return true;
        }

        @Override
        protected Object getValue(Object element) {
            TableObject object = (TableObject) element;
            return object.getName();
        }

        @Override
        protected void setValue(Object element, Object value) {
            TableObject object = (TableObject) element;
            if (value != null) {
                object.setName(value.toString());
                viewer.update(element, null);
            }
        }

        /**
         * Returns the table viewer.
         *
         * @return the table viewer
         */
        public TableViewer getTableViewer() {
            return viewer;
        }

    }

    /**
     * Editing Support for enum-based types. Requires {@link TypedTableObject}.
     *
     * @author Niko
     */
    protected class EnumTypeEditingSupport extends EditingSupport {

        private final TableViewer viewer;
        private IDecisionVariable var;
        private net.ssehub.easy.varModel.model.datatypes.Enum type;

        /**
         * Constructor.
         * @param viewer .
         */
        public EnumTypeEditingSupport(TableViewer viewer) {
            super(viewer);
            this.viewer = viewer;
            var = getTemporaryDecisionVariable(SLOT_TYPE);
            if (null != var) {
                IDatatype varType = var.getDeclaration().getType();
                if (varType instanceof net.ssehub.easy.varModel.model.datatypes.Enum) {
                    type = (net.ssehub.easy.varModel.model.datatypes.Enum) varType;
                }
            }
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            CellEditor result;
            if (var != null) {
                result = createCellEditor(var);
            } else {
                result = new TextCellEditor(viewer.getTable());
            }
            return result;
        }

        @Override
        protected boolean canEdit(Object element) {
            return true;
        }

        @Override
        protected Object getValue(Object element) {
            Object result = -1;
            if (element instanceof TypedTableObject) {
                TypedTableObject object = (TypedTableObject) element;
                if (null != type && null != object.type) {
                    EnumLiteral lit = type.get(object.type);
                    if (null != lit) {
                        result = type.getLiteralIndex(lit);
                    }
                }
            }
            return result;
        }

        @Override
        protected void setValue(Object element, Object value) {
            if (element instanceof TypedTableObject) {
                TypedTableObject object = (TypedTableObject) element;
                if (value != null) {
                    if (value instanceof Integer && null != type) {
                        EnumLiteral lit = type.getLiteral(((Integer) value).intValue());
                        if (null != lit) {
                            object.setType(lit.getName());
                            viewer.update(element, null);
                        }
                    } else {
                        object.setType(value.toString());
                        viewer.update(element, null);
                    }
                }
            }
        }
    }

    /**
     * Editing Support for ref-based types. This class requires proper resolution of the available types.
     * Requires {@link TypedTableObject}.
     *
     * @author Niko
     */
    protected class ReferenceTypeEditingSupport extends EditingSupport {

        private final TableViewer viewer;
        private IDecisionVariable var;
        private String[] items;

        /**
         * Constructor.
         * @param viewer .
         */
        public ReferenceTypeEditingSupport(TableViewer viewer) {
            super(viewer);
            this.viewer = viewer;
            var = getTemporaryDecisionVariable(SLOT_TYPE);
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            CellEditor result;
            if (var != null) {
                result = createCellEditor(var);
            } else {
                result = new TextCellEditor(viewer.getTable());
            }
            if (result instanceof ComboBoxCellEditor) {
                ComboBoxCellEditor cEditor = (ComboBoxCellEditor) result;
                items = cEditor.getItems();
            }
            return result;
        }

        @Override
        protected boolean canEdit(Object element) {
            return true;
        }

        @Override
        protected Object getValue(Object element) {
            int result = -1;
            if (element instanceof TypedTableObject) {
                TypedTableObject object = (TypedTableObject) element;
                if (null != items && null != object.type) {
                    for (int i = 0; -1 == result && i < items.length; i++) {
                        if (items[i].equals(object.type)) {
                            result = i;
                        }
                    }
                }
            }
            return result;
        }

        @Override
        protected void setValue(Object element, Object value) {
            if (element instanceof TypedTableObject) {
                TypedTableObject object = (TypedTableObject) element;
                if (null != items && value instanceof Integer) {
                    int pos = ((Integer) value).intValue();
                    if (pos >= 0 && pos < items.length) {
                        object.setType(items[pos]);
                        viewer.update(element, null);
                    }
                }
            }
        }
    }

    /**
     * Returns the compound slot value as string.
     *
     * @param value the value to return the slot from
     * @param slotName the slot name
     * @return the slot value
     */
    protected static String getCompoundSlot(CompoundValue value, String slotName) {
        String result;
        Value nVal = value.getNestedValue(slotName);
        if (null != nVal) {
            result = toString(nVal);
        } else {
            result = "";
        }
        return result;
    }

    @Override
    public void addDirtyListener(DirtyListener listener) {
        dirtyListener.add(listener);
        tableViewer.getTable().addSelectionListener(listener);
    }

    @Override
    public void removeDirtyListener(DirtyListener listener) {
        dirtyListener.remove(listener);
        tableViewer.getTable().removeSelectionListener(listener);
    }

    /**
     * Notifies the externally attached listeners that the editor became dirty.
     */
    protected void notifyDirty() {
        Event evt = new Event();
        evt.item = this;
        evt.widget = this;
        SelectionEvent event = new SelectionEvent(evt);
        for (SelectionListener listener : dirtyListener) {
            listener.widgetSelected(event);
        }
    }

    @Override
    public void notifyReplaced(Project oldModel, Project newModel) {
        IDecisionVariable newVar = Configuration.mapVariable(variable, variable.getConfiguration());
        if (null != newVar) {
            variable = newVar;
        } else {
            EASyLoggerFactory.INSTANCE.getLogger(getClass(), Bundle.ID)
                .error("No variable found in new configuratio, i.e., discontinued mapping!");
        }
    }
}


text:
package com.palmithor.musicapi.service.external;

import com.palmithor.musicapi.service.external.model.CoverArtArchiveResponse;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Path;
import rx.Observable;

/**
 * Retrofit service for accessing Cover Art Archive API
 *
 * @author palmithor
 * @since 23.1.2017.
 */
public interface CoverArtArchiveService {

    @GET("release-group/{mbid}")
    Observable<Response<CoverArtArchiveResponse>> getByMBId(@Path("mbid") final String mbid);

}

redpajama_set_name: RedPajamaGithub


text:
NAME
----

    nl - Load test tool for HTTP APIs.  Generates result charts and has hooks
    for generating requests.

SYNOPSIS
--------

    nl.js [options] <host>:<port>[<path>]

DESCRIPTION
-----------

    nl is for generating lots of requests to send to an HTTP API. It is
    inspired by Apache's ab benchmark tool and is designed to let programmers
    develop load tests and get informative reports without having to learn a
    big and complicated framework.

OPTIONS
-------

    -n, --number NUMBER              Number of requests to make. Defaults to
                                     value of --concurrency unless a time limit is specified.
    -c, --concurrency NUMBER         Concurrent number of connections. Defaults to 1.
    -t, --time-limit NUMBER          Number of seconds to spend running test. No timelimit by default.
    -e, --request-rate NUMBER        Target number of requests per seconds. Infinite by default
    -m, --method STRING              HTTP method to use.
    -d, --data STRING                Data to send along with PUT or POST request.
    -r, --request-generator STRING   Path to module that exports getRequest function
    -i, --report-interval NUMBER     Frequency in seconds to report statistics. Default is 10.
    -q, --quiet                      Supress display of progress count info.
    -h, --help                       Show usage info

ENVIRONMENT
-----------

    nl requires node to be installed somewhere on your path. Get it
    from http://nodejs.org/#download.

    To get a known working combination of nodeload + node, be sure
    to install using npm:

        $ curl http://npmjs.org/install.sh | sh     # installs npm
        $ npm install nodeload

QUICKSTART
----------

    nodeload contains a toy server that you can use for a quick demo.
    Try the following:

        $ examples/test-server.js &
        [1] 2756
        $ Server running at http://127.0.0.1:9000/
        $ nl.js -f -c 10 -n 10000 -i 1 -r examples/test-generator.js localhost:9000

    You should now see some test output in your console.  The generated HTML
    report contains a graphical chart of test results.

THANKS
------

Thanks to Orlando Vazquez <ovazquez@gmail.com> for the original proof of concept app.

SEE ALSO
--------

`ab(1)`, [NODELOADLIB.md](http://github.com/benschmaus/nodeload/blob/master/NODELOADLIB.md)


text:
if which python > /dev/null;
then
  echo "Please install python first!"
  if uname -a| grep "Ubuntu";
  then
    sudo apt-get intall python
  fi
fi

if which pip > /dev/null;
then
  echo "Please install pip first!"
  if uname -a| grep "Ubuntu";
  then
    sudo apt-get intall pip
  fi
fi

sudo pip install -r requirements.txt


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
using System.Net.Http;

namespace ITCC.HTTP.Client.Common
{
    /// <summary>
    ///     Static class that contains all library delegates
    /// </summary>
    public static class Delegates
    {
        /// <summary>
        ///     Operation to be performed during authentification
        /// </summary>
        /// <param name="request">Outcoming request</param>
        /// <returns>Operation status</returns>
        public delegate bool AuthentificationDataAdder(HttpRequestMessage request);
    }
}


text:
package xfer

import (
	"io"
	"net/http"
	"sync"
	"time"

	"github.com/gorilla/websocket"
	log "github.com/sirupsen/logrus"
	"github.com/ugorji/go/codec"

	"github.com/weaveworks/common/mtime"
)

const (
	// Time allowed to write a message to the peer.
	writeWait = 10 * time.Second

	// Time allowed to read the next pong message from the peer. Needs to be less
	// than the idle timeout on whatever frontend server is proxying the
	// websocket connections (e.g. nginx).
	pongWait = 60 * time.Second

	// Send pings to peer with this period. Must be less than pongWait. The peer
	// must respond with a pong in < pongWait. But it may take writeWait for the
	// pong to be sent. Therefore we want to allow time for that, and a bit of
	// delay/round-trip in case the peer is busy. 1/3 of pongWait seems like a
	// reasonable amount of time to respond to a ping.
	pingPeriod = ((pongWait - writeWait) * 2 / 3)
)

// Websocket exposes the bits of *websocket.Conn we actually use.
type Websocket interface {
	ReadMessage() (messageType int, p []byte, err error)
	WriteMessage(messageType int, data []byte) error
	ReadJSON(v interface{}) error
	WriteJSON(v interface{}) error
	Close() error
}

type pingingWebsocket struct {
	pinger    *time.Timer
	readLock  sync.Mutex
	writeLock sync.Mutex
	conn      *websocket.Conn
}

var upgrader = websocket.Upgrader{
	CheckOrigin: func(r *http.Request) bool { return true },
}

// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (Websocket, error) {
	wsConn, err := upgrader.Upgrade(w, r, responseHeader)
	if err != nil {
		return nil, err
	}
	return Ping(wsConn), nil
}

// WSDialer can dial a new websocket
type WSDialer interface {
	Dial(urlStr string, requestHeader http.Header) (*websocket.Conn, *http.Response, error)
}

// DialWS creates a new client connection. Use requestHeader to specify the
// origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie).
// Use the response.Header to get the selected subprotocol
// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
func DialWS(d WSDialer, urlStr string, requestHeader http.Header) (Websocket, *http.Response, error) {
	wsConn, resp, err := d.Dial(urlStr, requestHeader)
	if err != nil {
		return nil, resp, err
	}
	return Ping(wsConn), resp, nil
}

// Ping adds a periodic ping to a websocket connection.
func Ping(c *websocket.Conn) Websocket {
	p := &pingingWebsocket{conn: c}
	p.conn.SetPongHandler(p.pong)
	p.conn.SetReadDeadline(mtime.Now().Add(pongWait))
	p.pinger = time.AfterFunc(pingPeriod, p.ping)
	return p
}

func (p *pingingWebsocket) ping() {
	p.writeLock.Lock()
	defer p.writeLock.Unlock()
	if err := p.conn.WriteControl(websocket.PingMessage, nil, mtime.Now().Add(writeWait)); err != nil {
		log.Errorf("websocket ping error: %v", err)
		p.conn.Close()
		return
	}
	p.pinger.Reset(pingPeriod)
}

func (p *pingingWebsocket) pong(string) error {
	p.conn.SetReadDeadline(mtime.Now().Add(pongWait))
	return nil
}

// ReadMessage is a helper method for getting a reader using NextReader and
// reading from that reader to a buffer.
func (p *pingingWebsocket) ReadMessage() (int, []byte, error) {
	p.readLock.Lock()
	defer p.readLock.Unlock()
	return p.conn.ReadMessage()
}

// WriteMessage is a helper method for getting a writer using NextWriter,
// writing the message and closing the writer.
func (p *pingingWebsocket) WriteMessage(messageType int, data []byte) error {
	p.writeLock.Lock()
	defer p.writeLock.Unlock()
	if err := p.conn.SetWriteDeadline(mtime.Now().Add(writeWait)); err != nil {
		return err
	}
	return p.conn.WriteMessage(messageType, data)
}

// WriteJSON writes the JSON encoding of v to the connection.
func (p *pingingWebsocket) WriteJSON(v interface{}) error {
	p.writeLock.Lock()
	defer p.writeLock.Unlock()
	w, err := p.conn.NextWriter(websocket.TextMessage)
	if err != nil {
		return err
	}
	if err := p.conn.SetWriteDeadline(mtime.Now().Add(writeWait)); err != nil {
		return err
	}
	err1 := codec.NewEncoder(w, &codec.JsonHandle{}).Encode(v)
	err2 := w.Close()
	if err1 != nil {
		return err1
	}
	return err2
}

// ReadJSON reads the next JSON-encoded message from the connection and stores
// it in the value pointed to by v.
func (p *pingingWebsocket) ReadJSON(v interface{}) error {
	p.readLock.Lock()
	defer p.readLock.Unlock()
	_, r, err := p.conn.NextReader()
	if err != nil {
		return err
	}
	err = codec.NewDecoder(r, &codec.JsonHandle{}).Decode(v)
	if err == io.EOF {
		// One value is expected in the message.
		err = io.ErrUnexpectedEOF
	}
	return err
}

// Close closes the connection
func (p *pingingWebsocket) Close() error {
	p.writeLock.Lock()
	defer p.writeLock.Unlock()
	p.pinger.Stop()
	return p.conn.Close()
}

// IsExpectedWSCloseError returns boolean indicating whether the error is a
// clean disconnection.
func IsExpectedWSCloseError(err error) bool {
	return err == io.EOF || err == io.ErrClosedPipe || websocket.IsCloseError(err,
		websocket.CloseNormalClosure,
		websocket.CloseGoingAway,
		websocket.CloseNoStatusReceived,
		websocket.CloseAbnormalClosure,
	)
}


text:
		<title>Output Caching</title>
		<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<link rel="stylesheet" type="text/css" href="../../MSDN.css">

						Alachisoft NCache 4.3

Step 3: Start/Restart ASP.NET Application

Now that you have configured a cache through NCache Manager and   have edited web.config to add NCache Output Caching, you're ready   to start or restart your ASP.NET application. To restart your ASP.NET   application, kill your ASP.NET process through Task Manager first.

See Also

Configure the Cache | Edit Web.Config or Machine.Config

						Send comments on this topic.

					Copyright © 2005-2014 Alachisoft. All rights reserved.

				<o:p></o:p>


text:
package com.heaven7.data.mediator.data_binding_test.sample.propertychain;

import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.heaven7.data.mediator.data_binding_test.R;
import com.heaven7.data.mediator.data_binding_test.module.RootModule;
import com.heaven7.data.mediator.data_binding_test.module.ViewBind;
import com.heaven7.data.mediator.data_binding_test.sample.BaseActivity;
import com.heaven7.data.mediator.data_binding_test.util.ResHelper;
import com.heaven7.java.data.mediator.Binder;
import com.heaven7.java.data.mediator.DataMediator;
import com.heaven7.java.data.mediator.DataMediatorFactory;
import com.heaven7.java.data.mediator.bind.BindBackground;
import com.heaven7.java.data.mediator.bind.BindBackgroundColor;
import com.heaven7.java.data.mediator.bind.BindBackgroundRes;
import com.heaven7.java.data.mediator.bind.BindEnable;
import com.heaven7.java.data.mediator.bind.BindVisibility;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 测试含有list属性的 属性链的绑定
 * test data-binding of view: setBackground, setBackgroundColor,setBackgroundResource.setEnable . etc.
 * Created by heaven7 on 2017/9/24.
 */
public class ListPropertyChainBindActivity extends BaseActivity {

    //'viewBindList' is a property name of RootModule.
    @BindView(R.id.v_enable)@BindEnable("viewBindList[0].enable")
    View mV_enable;

    @BindView(R.id.v_bg) @BindBackground("viewBindList[0].background")
    View mV_bg;

    @BindView(R.id.v_bg_color)@BindBackgroundColor("viewBindList[0].backgroundColor")
    View mV_bg_color;

    @BindView(R.id.v_bg_res)@BindBackgroundRes("viewBindList[0].backgroundRes")
    View mV_bg_res;

    @BindView(R.id.v_visibility)@BindVisibility("viewBindList[0].visible")
    View mV_visibility;

    private ResHelper mHelper = new ResHelper();
    private Binder<RootModule> rootBinder;
    private DataMediator<ViewBind> dm_viewBind;

    @Override
    protected int getLayoutId() {
        return R.layout.ac_test_view_bind;
    }
    @Override
    protected void onInit(Context context, Bundle savedInstanceState) {
        mHelper.init(context);

        RootModule rootModule = DataMediatorFactory.createData(RootModule.class);
        rootModule.setViewBindList(new ArrayList<ViewBind>());
        rootModule.getViewBindList().add(DataMediatorFactory.createData(ViewBind.class));

        //bind data.
        rootBinder = DataMediatorFactory.bind(this, rootModule);
        dm_viewBind = DataMediatorFactory.createDataMediator(
                rootBinder.getDataMediator(), rootModule.getViewBindList().get(0));
    }

    @OnClick(R.id.bt_change_bg)
    public void onClickChangeBg(View v){
        //改变背景(drawable)
        dm_viewBind.getDataProxy().setBackground(mHelper.toggleDrawable());
    }

    @OnClick(R.id.bt_change_bg_color)
    public void onClickChangeBgColor(View v){
        //改变背景(color)
        dm_viewBind.getDataProxy().setBackgroundColor(mHelper.toggleColor());
    }

    @OnClick(R.id.bt_change_bg_res)
    public void onClickChangeBgRes(View v){
        //改变背景(resource id)
        dm_viewBind.getDataProxy().setBackgroundRes(mHelper.toggleDrawableRes());
    }

    @OnClick(R.id.bt_change_enable)
    public void onClickChangeEnable(View v){
        //改变enable 状态
        dm_viewBind.getDataProxy().setEnable(!dm_viewBind.getData().isEnable());
    }
    @OnClick(R.id.bt_change_visibility)
    public void onClickChangeVisibility(View v){
        dm_viewBind.getDataProxy().setVisible(!dm_viewBind.getDataProxy().isVisible());
    }

}


text:
<!doctype html>

<title>OK</title>


text:
package com.alibaba.nacos.core.cluster.lookup;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.common.http.HttpRestResult;
import com.alibaba.nacos.common.http.client.NacosRestTemplate;
import com.alibaba.nacos.common.http.param.Header;
import com.alibaba.nacos.common.http.param.Query;
import com.alibaba.nacos.common.model.RestResult;
import com.alibaba.nacos.core.cluster.ServerMemberManager;
import com.alibaba.nacos.core.utils.GenericType;
import com.alibaba.nacos.core.utils.Loggers;
import com.alibaba.nacos.sys.env.EnvUtil;
import junit.framework.TestCase;
import com.alibaba.nacos.common.utils.StringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.test.util.ReflectionTestUtils;

import java.lang.reflect.Type;
import java.util.Map;

import static com.alibaba.nacos.common.constant.RequestUrlConstants.HTTP_PREFIX;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class AddressServerMemberLookupTest extends TestCase {

    @Mock
    private NacosRestTemplate restTemplate;

    @Mock
    private ServerMemberManager memberManager;

    @Mock
    private HttpRestResult<String> result;

    private AddressServerMemberLookup addressServerMemberLookup;

    private String addressUrl;

    private String envIdUrl;

    private String addressServerUrl;

    private String addressPort;

    private String domainName;

    @Mock
    private ConfigurableEnvironment environment;

    private final GenericType<String> genericType = new GenericType<String>() { };

    @Before
    public void setUp() throws Exception {
        EnvUtil.setEnvironment(environment);
        when(environment.getProperty("maxHealthCheckFailCount", "12")).thenReturn("12");
        when(environment.getProperty("nacos.core.address-server.retry", Integer.class, 5)).thenReturn(5);
        when(environment.getProperty("address.server.domain", "jmenv.tbsite.net")).thenReturn("jmenv.tbsite.net");
        when(environment.getProperty("address.server.port", "8080")).thenReturn("8080");
        when(environment.getProperty(eq("address.server.url"), any(String.class))).thenReturn("/nacos/serverlist");
        initAddressSys();
        when(restTemplate.<String>get(eq(addressServerUrl), any(Header.EMPTY.getClass()), any(Query.EMPTY.getClass()), any(Type.class)))
                .thenReturn(result);
        addressServerMemberLookup = new AddressServerMemberLookup();
        ReflectionTestUtils.setField(addressServerMemberLookup, "restTemplate", restTemplate);

        when(result.ok()).thenReturn(true);
        when(result.getData()).thenReturn("1.1.1.1:8848");
        addressServerMemberLookup.start();
    }

    @After
    public void tearDown() throws NacosException {
        addressServerMemberLookup.destroy();
    }

    @Test
    public void testMemberChange() throws Exception {
        addressServerMemberLookup.injectMemberManager(memberManager);
        verify(restTemplate).get(eq(addressServerUrl), any(Header.EMPTY.getClass()), any(Query.EMPTY.getClass()), any(Type.class));
    }

    @Test
    public void testInfo() {
        Map<String, Object> infos =  addressServerMemberLookup.info();
        assertEquals(4, infos.size());
        assertTrue(infos.containsKey("addressServerHealth"));
        assertTrue(infos.containsKey("addressServerUrl"));
        assertTrue(infos.containsKey("envIdUrl"));
        assertTrue(infos.containsKey("addressServerFailCount"));
        assertEquals(addressServerUrl, infos.get("addressServerUrl"));
        assertEquals(envIdUrl, infos.get("envIdUrl"));
    }

    @Test
    public void testSyncFromAddressUrl() throws Exception {
        RestResult<String> result = restTemplate
                .get(addressServerUrl, Header.EMPTY, Query.EMPTY, genericType.getType());
        assertEquals("1.1.1.1:8848", result.getData());
    }

    private void initAddressSys() {
        String envDomainName = System.getenv("address_server_domain");
        if (StringUtils.isBlank(envDomainName)) {
            domainName = EnvUtil.getProperty("address.server.domain", "jmenv.tbsite.net");
        } else {
            domainName = envDomainName;
        }
        String envAddressPort = System.getenv("address_server_port");
        if (StringUtils.isBlank(envAddressPort)) {
            addressPort = EnvUtil.getProperty("address.server.port", "8080");
        } else {
            addressPort = envAddressPort;
        }
        String envAddressUrl = System.getenv("address_server_url");
        if (StringUtils.isBlank(envAddressUrl)) {
            addressUrl = EnvUtil.getProperty("address.server.url", EnvUtil.getContextPath() + "/" + "serverlist");
        } else {
            addressUrl = envAddressUrl;
        }
        addressServerUrl = HTTP_PREFIX + domainName + ":" + addressPort + addressUrl;
        envIdUrl = HTTP_PREFIX + domainName + ":" + addressPort + "/env";

        Loggers.CORE.info("ServerListService address-server port:" + addressPort);
        Loggers.CORE.info("ADDRESS_SERVER_URL:" + addressServerUrl);
    }
}


text:
using AsmResolver.IO;

namespace AsmResolver.DotNet.Signatures
{
    /// <summary>
    /// Represents a blob signature that might contain extra data not part of the standard format of the signature.
    /// </summary>
    public abstract class ExtendableBlobSignature : BlobSignature
    {
        /// <summary>
        /// Gets or sets the extra custom data in the blob signature.
        /// </summary>
        public byte[]? ExtraData
        {
            get;
            set;
        }

        /// <inheritdoc />
        public sealed override void Write(in BlobSerializationContext context)
        {
            WriteContents(context);
            if (ExtraData is not null)
                context.Writer.WriteBytes(ExtraData);
        }

        /// <summary>
        /// Serializes the blob (without extra data) to an output stream.
        /// </summary>
        protected abstract void WriteContents(in BlobSerializationContext context);
    }
}


text:
using System;
using System.Runtime.Serialization;

namespace Artemis.Engine
{
    /// <summary>
    /// An exception that occurs when something goes wrong in a Multiform.
    /// </summary>
    public class MultiformException : Exception
    {
        public MultiformException() : base() { }
        public MultiformException(string msg) : base(msg) { }
        public MultiformException(string msg, Exception inner) : base(msg, inner) { }
        public MultiformException(SerializationInfo info, StreamingContext context) : base(info, context) { }
    }
}


text:
package org.xdty.phone.number.net.juhe;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.text.TextUtils;

import org.xdty.phone.number.model.INumber;
import org.xdty.phone.number.model.NumberHandler;
import org.xdty.phone.number.util.App;
import org.xdty.phone.number.util.Utils;

import javax.inject.Inject;

import okhttp3.OkHttpClient;
import okhttp3.Request;

public class JuHeNumberHandler implements NumberHandler<JuHeNumber> {

    public transient final static String META_DATA_KEY_URI =
            "org.xdty.phone.number.JUHE_API_KEY";
    public transient final static String API_KEY = "juhe_api_key";

    @Inject Context mContext;
    @Inject OkHttpClient mOkHttpClient;

    public JuHeNumberHandler() {
        App.getAppComponent().inject(this);
    }

    @Override
    public String url() {
        return "https://op.juhe.cn/onebox/phone/query?tel=";
    }

    @Override
    public String key() {
        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mContext);
        String apiKey = pref.getString(API_KEY, "");
        if (apiKey.isEmpty()) {
            apiKey = Utils.get().getMetadata(mContext, META_DATA_KEY_URI);
        }
        return apiKey;
    }

    @Override
    public JuHeNumber find(String number) {
        if (TextUtils.isEmpty(number)) {
            return null;
        }

        if (number.startsWith("+") && !number.startsWith("+86")) {
            return null;
        }
        String url = url() + number + "&key=" + key();
        okhttp3.Response response = null;
        Request.Builder request = new Request.Builder().url(url);
        try {
            response = mOkHttpClient.newCall(request.build()).execute();
            String s = response.body().string().replace("rpt_cnt\":\"\"", "rpt_cnt\":0");
            return Utils.gson().fromJson(s, JuHeNumber.class);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (response != null && response.body() != null) {
                response.body().close();
            }
        }
        return null;
    }

    @Override
    public boolean isOnline() {
        return true;
    }

    @Override
    public int getApiId() {
        return INumber.API_ID_JH;
    }
}


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.BotService.Models
{
    public partial class BotServiceSku : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("name");
            writer.WriteStringValue(Name.ToString());
            writer.WriteEndObject();
        }

        internal static BotServiceSku DeserializeBotServiceSku(JsonElement element)
        {
            BotServiceSkuName name = default;
            Optional<BotServiceSkuTier> tier = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new BotServiceSkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tier = new BotServiceSkuTier(property.Value.GetString());
                    continue;
                }
            }
            return new BotServiceSku(name, Optional.ToNullable(tier));
        }
    }
}


text:
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;

// These fail during CTFE (as they read a static), so they only cause an error
// when *using* the const.

const MUTATE_INTERIOR_MUT: usize = {
    static FOO: AtomicUsize = AtomicUsize::new(0);
    FOO.fetch_add(1, Ordering::Relaxed)
};

const READ_INTERIOR_MUT: usize = {
    static FOO: AtomicUsize = AtomicUsize::new(0);
    unsafe { *(&FOO as *const _ as *const usize) }
};

static mut MUTABLE: u32 = 0;
const READ_MUT: u32 = unsafe { MUTABLE };

fn main() {
    MUTATE_INTERIOR_MUT;
    //~^ ERROR: erroneous constant used
    READ_INTERIOR_MUT;
    //~^ ERROR: erroneous constant used
    READ_MUT;
    //~^ ERROR: erroneous constant used
}


text:
{% extends "admin/base.html" %}
{% load i18n grp_tags %}

{% block title %}{{ title }} | {% get_site_title %}{% endblock %}

{% block branding %}
    {# Use the div#grp-branding for branding elements, e.g. a logo #}
    {#

 #}

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" />

{% endblock %}

{% block nav-global %}{% endblock %}


text:
package org.datanucleus.samples.rdbms.application;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class EmbeddedB
{
    @PrimaryKey
    @Column(name="EMBEDDEDB_ID")
    long id;

    @Column(name="NAME")
    String name;

    public EmbeddedB(long id, String name)
    {
        this.id = id;
        this.name = name;
    }
}


text:
/**
 * Accepts any node Stream instance and hijacks its "write()" function,
 * so that it can count any newlines that get written to the output.
 *
 * When a '\n' byte is encountered, then a "newline" event will be emitted
 * on the stream, with no arguments. It is up to the listeners to determine
 * any necessary deltas required for their use-case.
 *
 * Ex:
 *
 *   var cursor = ansi(process.stdout)
 *     , ln = 0
 *   process.stdout.on('newline', function () {
 *    ln++
 *   })
 */

/**
 * Module dependencies.
 */

'use strict';

var assert = require('assert');
var NEWLINE = '\n'.charCodeAt(0);

function emitNewlineEvents(stream) {
  if (stream._emittingNewlines) {
    // already emitting newline events
    return;
  }

  var write = stream.write;

  stream.write = function (data) {
    // first write the data
    var rtn = write.apply(stream, arguments);

    if (stream.listeners('newline').length > 0) {
      var len = data.length,
          i = 0;
      // now try to calculate any deltas
      if (typeof data == 'string') {
        for (; i < len; i++) {
          processByte(stream, data.charCodeAt(i));
        }
      } else {
        // buffer
        for (; i < len; i++) {
          processByte(stream, data[i]);
        }
      }
    }

    return rtn;
  };

  stream._emittingNewlines = true;
}
module.exports = emitNewlineEvents;

/**
 * Processes an individual byte being written to a stream
 */

function processByte(stream, b) {
  assert.equal(typeof b, 'number');
  if (b === NEWLINE) {
    stream.emit('newline');
  }
}

//# sourceMappingURL=newlines-compiled.js.map


text:
package org.buzzrobotics.commands;
/*
 * @param speed how fast the robot should go
 * @param turn how much turn the bot should have. 0 is straight.
 * @param timeout
 * @author Kyle Deane
 */
public class Drive_Time_Turn extends CommandBase {
    public double m_timeout;
    public double m_speed;
    public double m_turn;
    /*
     * Drive - drives the specified speed with the specified turn for the specified time
     * @param speed the speed the wheels turn
     * @param turn how much turn goes on that side.
     * @param timeout how long to drive for
     *
     * @author Kyle Deane
     */
    public Drive_Time_Turn(double speed, double turn, double timeout) {
        m_turn = turn;
        m_speed = speed;
        m_timeout = timeout;
        requires(drivetrain);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        setTimeout(m_timeout);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        drivetrain.drive(m_speed, m_turn);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return isTimedOut();
    }

    // Called once after isFinished returns true
    protected void end() {

    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}


text:
const onUpdatedProfileInfoSubscriptionsStub = [
  {
    type: 'email',
    topic: 'News',
    isSubscribed: true
  },
  {
    type: 'email',
    topic: 'Offers',
    isSubscribed: false
  },
  {
    type: 'sms',
    isSubscribed: true
  }
]

const onUpdatedProfileInfoStub = {
  operation: 'UpdateProfile',
  data: {
    customer: {
      authenticationTicket: 'xxxxx',
      ids: {
        bitrixId: 'user123'
      },
      firstName: 'John',
      lastName: 'Dow',
      email: 'test@driveback.ru',
      mobilePhone: '79374134389',
      customFields: {
        source: 'Driveback',
        city: 'Moscow',
        b2b: true,
        childrenNames: [
          'Helen',
          'Bob'
        ]
      },
      subscriptions: [
        {
          pointOfContact: 'Email',
          topic: 'News',
          isSubscribed: true
        },
        {
          pointOfContact: 'Email',
          topic: 'Offers',
          isSubscribed: false
        },
        {
          pointOfContact: 'Sms',
          isSubscribed: true
        }
      ]
    }
  }
}

export { onUpdatedProfileInfoSubscriptionsStub, onUpdatedProfileInfoStub }


text:
Date: Wed, 11 Dec 1996 23:14:05 GMT
Server: NCSA/1.5
Content-type: text/html
Last-modified: Fri, 30 Aug 1996 22:18:51 GMT
Content-length: 2842

<TITLE> The UW-Madison Computer Sciences Dept. Alumni Group</TITLE>

<!WA0><!WA0><!WA0>
<!WA1><!WA1><!WA1>

 The Computer Sciences Alumni Group

This WWW home page contains relevant information for our alumni.  The
UW-CS Alumni Group was launched in 1993 in order to encourage a strong
connection between past and present members of our department.
Currently the department supports:

 The Alumni Directory (published annually).

 This printed directory
contains address and employment information for those alumni who
choose to share this information.

 The Alumni Newsletter, Badger Bytes (published twice a year).

 This printed newsletter reports news both about our department
and our alumni.

 The Alumni Email List.

 We use our email list to announce job postings
and other items of general interest to UW-CS alums.  To submit an item
for the Alumni Email List, email <!WA2><!WA2><!WA2>alumni@cs.wisc.edu.

 On-Line Options

Note: to use the following, your web viewer must be capable of handling Forms.
(These forms display properly in several viewers, though
there have been some layout problems with Mosaic for Microsoft Windows.
Should you have any advice for improving them, please email
<!WA3><!WA3><!WA3>alumni@cs.wisc.edu.)

 <!WA4><!WA4><!WA4>         Reporting News for the Alumni Group Newsletter

 <!WA5><!WA5><!WA5> Changing Your Address

 <!WA6><!WA6><!WA6>           Joining the Alumni Group  (there are no fees)

 Other UW-Madison Links

 <!WA7><!WA7><!WA7>
        UW-Madison CS Dept

 <!WA8><!WA8><!WA8>
        UW-Madison School of Letters & Sciences

 <!WA9><!WA9><!WA9>
        UW-Madison Graduate School

 <!WA10><!WA10><!WA10>
        UW-Madison

 <!WA11><!WA11><!WA11>
	Wisconsin Alumni Association

For more information, contact Carrie Pritchard  email:pritchar@cs.wisc.edu, the alumni coordinator.

  email: <!WA12><!WA12><!WA12>alumni@cs.wisc.edu

  phone: (608) 263-6759

  dept. phone: (608) 262-1204

  fax: (608) 262-9777

  in person: Room 5378 CS&Stats Building

  US mail: CS Dept, 1210 W. Dayton St., Madison, WI 53706

<ADDRESS> Last Changed: March 29, 1996 by
<!WA13><!WA13><!WA13>alumni@cs.wisc.edu </ADDRESS>


text:
Shell script for setting up a new WordPress project

## Usage

`cd` to the root of your new project
```sh
curl -v --fail --output 'dispatch-sh.sh' https://raw.githubusercontent.com/wpdispatch/dispatch-sh/master/dispatch-sh.sh
curl -v --fail --output 'dispatch-sh.yml' https://raw.githubusercontent.com/wpdispatch/dispatch-sh/master/dispatch-sh.example.yml
```
edit `dispatch-sh.yml`
```sh
bash dispatch-sh.sh
```

## Credits

this project was inspired by [WPDistillery](https://github.com/flurinduerst/WPDistillery)


text:
require File.join(File.dirname(__FILE__), '..', "spec_helper")
require "rspec/matchers/dm/has_property"

describe DataMapperMatchers::HasProperty do
  it "should pass with the property type" do
   Post.should has_property :title, String
  end

  it "should fail with improper property type" do
    lambda {Post.should has_property :title, Integer}.should fail_with("expected title to have type of Integer but has String")
  end

end


text:
#ifndef WELS_MV_PRED_H__
#define WELS_MV_PRED_H__

#include "dec_frame.h"
#include "decoder_context.h"

namespace WelsDec {

/*!
* \brief     update mv and ref_index cache for current MB, only for P_16x16 (SKIP inclusive)
* \param
* \param
*/
void UpdateP16x16MotionInfo (PDqLayer pCurDqLayer, int32_t listIdx, int8_t iRef, int16_t iMVs[2]);

/*!
* \brief     update ref_index cache for current MB, only for P_16x16 (SKIP inclusive)
* \param
* \param
*/
void UpdateP16x16RefIdx (PDqLayer pCurDqLayer, int32_t listIdx, int8_t iRef);

/*!
* \brief     update mv only cache for current MB, only for P_16x16 (SKIP inclusive)
* \param
* \param
*/
void UpdateP16x16MotionOnly (PDqLayer pCurDqLayer, int32_t listIdx, int16_t iMVs[2]);

/*!
* \brief   update mv and ref_index cache for current MB, only for P_16x8
* \param
* \param
*/
void UpdateP16x8MotionInfo (PDqLayer pCurDqLayer, int16_t iMotionVector[LIST_A][30][MV_A],
                            int8_t iRefIndex[LIST_A][30],
                            int32_t listIdx, int32_t iPartIdx, int8_t iRef, int16_t iMVs[2]);

/*!
 * \brief    update mv and ref_index cache for current MB, only for P_8x16
 * \param
 * \param
 */
void UpdateP8x16MotionInfo (PDqLayer pCurDqLayer, int16_t iMotionVector[LIST_A][30][MV_A],
                            int8_t iRefIndex[LIST_A][30],
                            int32_t listIdx, int32_t iPartIdx, int8_t iRef, int16_t iMVs[2]);

/*!
 * \brief   get the motion predictor for skip mode
 * \param
 * \param   output iMvp[]
 */
void PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]);

/*!
* \brief   get the motion predictor and reference for B-slice direct mode version 2
* \param
* \param   output iMvp[] and ref
*/
int32_t  PredMvBDirectSpatial (PWelsDecoderContext pCtx, int16_t iMvp[LIST_A][2], int8_t ref[LIST_A],
                               SubMbType& subMbType);

/*!
* \brief   get Colocated MB for both Spatial and Temporal Direct Mode
* \param
* \param   output MbType and SubMbType
*/
int32_t GetColocatedMb (PWelsDecoderContext pCtx, MbType& mbType, SubMbType& subMbType);

/*!
* \brief   get the motion predictor for B-slice temporal direct mode 16x16
*/
int32_t PredBDirectTemporal (PWelsDecoderContext pCtx, int16_t iMvp[LIST_A][2], int8_t ref[LIST_A],
                             SubMbType& subMbType);

/*!
* \brief   get the motion params for B-slice spatial direct mode
* \param
* \param   output iMvp[]
*/

/*!
 * \brief   get the motion predictor for 4*4 or 8*8 or 16*16 block
 * \param
 * \param   output iMvp[]
 */
void PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
             int32_t listIdx, int32_t iPartIdx, int32_t iPartWidth, int8_t iRef, int16_t iMVP[2]);

/*!
 * \brief   get the motion predictor for inter16x8 MB
 * \param
 * \param   output mvp_x and mvp_y
 */
void PredInter16x8Mv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
                      int32_t listIdx, int32_t iPartIdx, int8_t iRef, int16_t iMVP[2]);

/*!
 * \brief   get the motion predictor for inter8x16 MB
 * \param
 * \param   output mvp_x and mvp_y
 */
void PredInter8x16Mv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],
                      int32_t listIdx, int32_t iPartIdx, int8_t iRef, int16_t iMVP[2]);

/*!
* \brief   Fill the spatial direct motion vectors for 8x8 direct MB
* \param
* \param   output motion vector cache and motion vector deviation cache
*/
void FillSpatialDirect8x8Mv (PDqLayer pCurLayer, const int16_t& iIdx8, const int8_t& iPartCount, const int8_t& iPartW,
                             const SubMbType& subMbType, const bool& bIsLongRef, int16_t pMvDirect[LIST_A][2], int8_t iRef[LIST_A],
                             int16_t pMotionVector[LIST_A][30][MV_A], int16_t pMvdCache[LIST_A][30][MV_A]);

/*!
* \brief   Fill the temporal direct motion vectors for 8x8 direct MB
* \param
* \param   output motion vector cache and motion vector deviation cache
*/
void FillTemporalDirect8x8Mv (PDqLayer pCurLayer, const int16_t& iIdx8, const int8_t& iPartCount, const int8_t& iPartW,
                              const SubMbType& subMbType, int8_t iRef[LIST_A], int16_t (*mvColoc)[2],
                              int16_t pMotionVector[LIST_A][30][MV_A], int16_t pMvdCache[LIST_A][30][MV_A]);

/*!
* \brief   returns ref_index in List_0 from the colocated ref_index in LIST_0.
* \param
*  returns ref_index in List_0 of ref picture LIST_0
*/
int8_t MapColToList0 (PWelsDecoderContext& pCtx, const int8_t& colocRefIndexL0,
                      const int32_t& ref0Count); //ISO/IEC 14496-10:2009(E) (8-193)

/*!
* \brief     update ref_index cache for current MB, for 8x8
* \param
* \param
*/
void Update8x8RefIdx (PDqLayer& pCurDqLayer, const int16_t& iPartIdx, const int32_t& listIdx, const int8_t& iRef);

} // namespace WelsDec

#endif//WELS_MV_PRED_H__


text:
module GenericExample where

import Control.DeepSeq ( NFData(rnf) )
import Control.DeepSeq.Generics

import qualified Data.Comp.Multi as M
import Data.Comp.Multi.Derive ( derive, makeHFunctor, makeHTraversable, makeHFoldable, makeEqHF, makeShowHF, makeOrdHF, smartConstructors )
import qualified Data.Comp.Multi.Ops as M

import GHC.Generics ( Generic(..), (:*:)(..), (:+:)(..), K1(..), V1, Rec0, U1(..) )

import Language.Haskell.TH hiding ( Lit )

import Tarski.Data.Comp.Derive.Generic

data ArithL
data AtomL
data LitL

data Arith e l where
   Add :: e (Maybe AtomL) -> e AtomL -> Arith e ArithL

data Atom e l where
   Var :: String -> Atom e AtomL
   Const :: e LitL -> Atom e AtomL

data Lit (e :: * -> *) l where
   Lit :: Int -> Lit e LitL

data MaybeF e l where
  NothingF :: MaybeF e (Maybe l)
  JustF :: e l -> MaybeF e (Maybe l)

derive [makeHFunctor, makeHTraversable, makeHFoldable, makeEqHF, makeShowHF,
                    makeOrdHF, smartConstructors]
       [''Arith, ''Atom, ''Lit]

type ArithSig = Arith M.:+: Atom M.:+: Lit M.:+: MaybeF

type ArithTerm = M.Term ArithSig

--from (iAdd (iConst $ iLit 1) (iConst $ iLit 2))

instance Generic (MaybeF e (Maybe l)) where
  type Rep (MaybeF e (Maybe l)) = U1 :+: Rec0 (e l)
  from NothingF = L1 $ U1
  from (JustF x) = R1 $ K1 x
  to (L1 U1) = NothingF
  to (R1 (K1 x)) = JustF x

makeGeneric [''Arith, ''Atom, ''Lit] [ConT ''ArithL, ConT ''AtomL, ConT ''LitL, AppT (ConT ''Maybe) (VarT (mkName "l"))]
makeGeneric [''MaybeF] [ConT ''ArithL, ConT ''AtomL, ConT ''LitL]

makeInstancesLike [''ArithTerm] [ConT ''ArithL, ConT ''AtomL, ConT ''LitL] [d| instance NFData GenericExample where rnf = genericRnfV1 |]

instance (NFData (ArithTerm l)) => NFData (ArithTerm (Maybe l)) where rnf = genericRnfV1


text:
package org.apache.wicket.protocol.http.servlet;

import java.util.Iterator;
import java.util.List;

import javax.servlet.FilterConfig;

import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.util.lang.Generics;

/**
 * A very simple manager for web filter factories.
 *
 * @author Juergen Donnerstag
 */
public class FilterFactoryManager implements Iterable<AbstractRequestWrapperFactory>
{
	private List<AbstractRequestWrapperFactory> filters;

	/**
	 * Construct.
	 */
	public FilterFactoryManager()
	{
	}

	/**
	 * Add a filter factory
	 *
	 * @param wrapperFactory
	 * @return this
	 */
	public final FilterFactoryManager add(final AbstractRequestWrapperFactory wrapperFactory)
	{
		if (wrapperFactory != null)
		{
			if (filters == null)
			{
				filters = Generics.newArrayList(2);
			}

			filters.add(wrapperFactory);
		}

		return this;
	}

	/**
	 * Add a X-Forwarded web filter factory
	 *
	 * @param config
	 *            If null, WebApplication.get().getWicketFilter().getFilterConfig()
	 *            will be called to retrieve the config.
	 * @return this
	 */
	public final FilterFactoryManager addXForwardedRequestWrapperFactory(FilterConfig config)
	{
		if (config == null)
		{
			config = WebApplication.get().getWicketFilter().getFilterConfig();
		}

		XForwardedRequestWrapperFactory factory = new XForwardedRequestWrapperFactory();
		factory.init(config);

		return add(factory);
	}

	/**
	 * Add a Secure remote address web filter factory
	 *
	 * @param config
	 *            If null, WebApplication.get().getWicketFilter().getFilterConfig()
	 *            will be called to retrieve the config.
	 * @return this
	 */
	public final FilterFactoryManager addSecuredRemoteAddressRequestWrapperFactory(
		FilterConfig config)
	{
		if (config == null)
		{
			config = WebApplication.get().getWicketFilter().getFilterConfig();
		}

		SecuredRemoteAddressRequestWrapperFactory factory = new SecuredRemoteAddressRequestWrapperFactory();
		factory.init(config);

		return add(factory);
	}

	/**
	 * @see java.lang.Iterable#iterator()
	 */
	@Override
	public Iterator<AbstractRequestWrapperFactory> iterator()
	{
		return filters.iterator();
	}
}


text:
package main

import (
	"errors"
	"fmt"
	"os"

	"github.com/jutkko/mindown/input"
	"github.com/jutkko/mindown/output"
	"github.com/jutkko/mindown/util"
	"github.com/urfave/cli"
)

func main() {
	app := cli.NewApp()
	app.Name = "mindown"
	app.Usage = "convert mind to files"
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "input-format",
			Value: "opml",
			Usage: "the input file format",
		},
		cli.StringFlag{
			Name:  "input-file",
			Value: "input.txt",
			Usage: "input file name",
		},
		cli.StringFlag{
			Name:  "output-file",
			Value: "output.txt",
			Usage: "output file name",
		},
		cli.BoolFlag{
			Name:  "f",
			Usage: "provide this flag to overwrite the output file if it exists",
		},
	}

	app.Action = func(c *cli.Context) error {
		var (
			graph *util.Graph
			err   error
		)

		switch c.String("input-format") {
		case "yml":
			graph, err = input.ParseYaml(c.String("input-file"))
			if err != nil {
				return err
			}
		case "opml":
			graph, err = input.ParseOpml(c.String("input-file"))
			if err != nil {
				return err
			}
		default:
			return errors.New(fmt.Sprintf("input-format not supported: %s", c.String("input-format")))
		}

		err = output.WriteMarkdown(c.String("output-file"), c.Bool("f"), graph)
		if err != nil {
			return err
		}

		return nil
	}

	app.Run(os.Args)
}