text:
<?php namespace Tuxion\DoctrineRest\Responder;

use Aura\Web\Response;
use Tuxion\DoctrineRest\Domain\Result\ResultInterface;

/**
 * A responder that outputs the results in a (JSON) REST format.
 */
class RestResponder implements ResponderInterface
{

  /**
   * The helper class mapping results to HTTP status codes.
   * @var StatusCodes
   */
  protected $statusCodes;

  /**
   * The Aura Response object.
   * @var Response
   */
  protected $response;

  /**
   * The ResultInterface that holds the final state of the application to communicate to the user.
   * @var ResultInterface
   */
  protected $result;

  /**
   * Returns the Aura Response object.
   * @return Response
   */
  public function getResponse(){
    return $this->response;
  }

  /**
   * Return the ResultInterface that holds the final state of the application to communicate to the user.
   * @return ResultInterface
   */
  public function getResult(){
    return $this->result;
  }

  /**
   * Sets the ResultInterface that holds the final state of the application to communicate to the user.
   * @param ResultInterface $result
   * @return void
   */
  public function setResult(ResultInterface $value){
    $this->result = $value;
  }

  /**
   * Creates a new RestResponder instance.
   * @param Response    $response    The Aura Response object.
   * @param StatusCodes $statusCodes The helper class mapping results to HTTP status codes.
   */
  public function __construct(Response $response, StatusCodes $statusCodes)
  {
    $this->response = $response;
    $this->statusCodes = $statusCodes;
  }

  /**
   * Sets the response on an Aura Response object and returns it.
   * @return Response
   */
  public function __invoke()
  {

    //No result given is a bad thing.
    if(!isset($this->result))
      throw new \Exception('No result was set.');

    //Map the status code and set it on the response.
    $code = $this->statusCodes->fromResult($this->result);
    $this->response->status->set($code);

    //Get our result body and set it (in JSON format) if it is not empty.
    $body = $this->result->getBody();
    if(!is_null($body)){
      $json = json_encode($this->result->getBody());
      $this->response->content->set($json);
      $this->response->content->setType('application/json');
      $this->response->content->setCharset('utf-8');
    }

    //That should conclude our adventures!
    return $this->response;

  }

}


text:
<?php

namespace app\components\filters;

use Yii;
use Yii\base\ActionFilter;
use app\models\Code;
use app\models\FailedAttempt;
use yii\web\HttpException;
use yii\base\UserException;

class TokenFilter extends BaseFilter {

    public function beforeAction($action)
    {
        $request = Yii::$app->getRequest();
        $response = Yii::$app->getResponse();

        $token = $this->getToken();

        if ($token === null) {
            // Query parameter not provided.
            $this->handleNoToken($response);
        }

        if (!is_string($token)) {
            // Value is not a string for whatever reason.
            $this->handleInvalid($request, $response);
        }

        $code = Code::findCodeByToken($token, get_class($this));

        if ($code === null || !$code->isValid()) {
            // The code is not valid.
            $this->handleInvalid($request, $response);
        } elseif ($code->isUsed()) {
            // The code has already been used.
            $this->handleUsed($response);
        }
        $this->handleSuccess($code);
        return true;
    }

    private function handleNoToken($response)
    {
        throw new UserException(Yii::t('app', 'No voting code provided.'));
    }

    private function handleInvalid($request, $response)
    {
        throw new UserException(Yii::t('app', 'Invalid voting code'));
    }

    private function handleUsed($response)
    {
        throw new UserException(Yii::t('app', 'This voting code has already been used.'));
    }

    private function handleSuccess($code)
    {
        $poll = $code->getPoll()->one();

        $now = new \DateTime('now', new \DateTimeZone('UTC'));
        $startTime = new \DateTime($poll->start_time, new \DateTimeZone('UTC'));
        $endTime = new \DateTime($poll->end_time, new \DateTimeZone('UTC'));
        // only lock Poll if it also at least started.
        if (!$poll->isLocked() && ($now >= $startTime) && ($now <= $endTime)) {
            $poll->lock();
            $poll->save();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Anneck\Game\Item;

use Anneck\Game\ActionInterface;
use Anneck\Game\Exception\GameException;
use Anneck\Game\Exception\GameFeatureMissingException;
use Anneck\Game\Features\ItemRegisterFeatureInterface;
use Anneck\Game\GameInterface;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * The ActionManager stores actions and their usages including number of, date-time, etc.
 * It serves every item class as a helper and uses the register in the provided game to access the meta data properties
 * of the item.
 *
 *
 * @since   0.0.1-dev
 *
 * @author  André Anneck <andreanneck73@gmail.com>
 */
class ActionManager extends ArrayCollection
{
    const ACTION_KEY = 'Action';
    const MAXIMUM_USES_KEY = 'MaximumUses';
    const COOLDOWN_TIME_KEY = 'CooldownTime';

    /**
     * @var GameInterface
     */
    private $game;

    /**
     * Creates the ActionManager with a Game who has the ItemRegisterFeature implemented.
     *
     * @param GameInterface $gameToUse the game to use.
     *
     * @throws GameFeatureMissingException if the game is missing a feature.
     */
    public function __construct(GameInterface $gameToUse)
    {
        if (!$gameToUse instanceof ItemRegisterFeatureInterface) {
            throw new GameFeatureMissingException('The ActionManager could not be created!', 'ItemRegisterFeature', $gameToUse);
        }

        $this->game = $gameToUse;
    }

    /**
     * Dont use this method, use addAction instead!
     *
     * @param mixed $value
     *
     * @return bool
     *
     * @throws GameException
     */
    public function add($value)
    {
        if (!$value instanceof ActionInterface) {
            throw new GameException('ActionManager add() requires ActionInterface!');
        }
        // This will insert the default maximumUses for the specified action!
        return $this->addGameAction($value);
    }

    /**
     * Adds the action into the manager's internal data storage.
     *
     * @param ActionInterface $action      the action to add.
     * @param string          $maximumUses the number of uses for the item
     * @param string          $coolDown    the cron-tab like string to indicate cool down times, default "5s".
     *
     * @return bool true if added successfully.
     */
    public function addGameAction(ActionInterface $action, $maximumUses = '*', $coolDown = '5s')
    {
        $actionUseData = [
            static::ACTION_KEY => $action,
            static::MAXIMUM_USES_KEY => $maximumUses,
            static::COOLDOWN_TIME_KEY => $coolDown,
        ];

        return parent::add($actionUseData);
    }

    /**
     * @return ArrayCollection
     */
    public function getUsableActionList()
    {
        $useableActions = new ArrayCollection();
/*
        if($this->game->hasItem($this)) {
            // we are in the register ...
            $itemData = $this->game->getItemData($this);
            $uses = $itemData->get('Uses');

        }
*/
        return $useableActions;
    }

    /**
     * @return ArrayCollection
     */
    public function getActionCollection()
    {
        $actionList = new ArrayCollection();
        foreach ($this->getIterator() as $actionUseData) {
            $action = $actionUseData[static::ACTION_KEY];

            $actionList->add($action);
        }

        return $actionList;
    }
}


text:
  <title>Mocha spec runner</title>
  <link rel="stylesheet" href="mocha.css">


text:
from django.core.management.base import BaseCommand
from corehq.apps.domain.models import Domain

class Command(BaseCommand):
    help = 'Make sure valid_domains is a superset of owners for all media'

    def handle(self, *args, **options):
        def settify(entity):
            entity = [entity] if not isinstance(entity, list) else entity
            return set(filter(None, entity))

        domains = Domain.get_all()
        for d in domains:
            for m in d.all_media():
                owners, valid_domains, sharers = \
                    settify(m.owners), settify(m.valid_domains), settify(m.shared_by)
                new_valid_domains = valid_domains.copy()

                if not new_valid_domains >= owners:
                    new_valid_domains |= owners
                if not new_valid_domains >= sharers:
                    new_valid_domains |= sharers

                if valid_domains != new_valid_domains:
                    m.valid_domains = list(new_valid_domains)
                    self.stdout.write("updating media %s: %s => %s" %
                                      (m._id, list(valid_domains), m.valid_domains))
                    m.save()


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.releasequeue.jenkins.action;

import com.releasequeue.jenkins.trigger.ReleaseQueueBuildCause;
import hudson.Extension;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.CauseAction;
import hudson.model.ChoiceParameterDefinition;
import hudson.model.ParameterDefinition;
import hudson.model.ParameterValue;
import hudson.model.ParametersAction;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.StringParameterDefinition;
import hudson.model.TextParameterDefinition;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javax.servlet.ServletInputStream;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.json.simple.parser.JSONParser;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

/**
 *
 * @author adrian
 */
@Extension
public class ReleaseQueueWebHookAction implements Action {
    static final String URL = "rqhook";

    public String getIconFileName() {
        return null;
    }

    public String getDisplayName() {
        return null;
    }

    public String getUrlName() {
        return URL;
    }

    private static final Logger LOGGER =  Logger.getLogger(ReleaseQueueWebHookAction.class.getName());

    public void doIndex(StaplerRequest req, StaplerResponse resp) throws Exception {
        List<Ancestor> ancestors = req.getAncestors();
        AbstractProject project = (AbstractProject)ancestors.get(ancestors.size() - 2).getObject();

        byte[] data      = new byte[req.getContentLength()];
        ServletInputStream inputStream = req.getInputStream();
        inputStream.read(data);
        JSONParser parser = new JSONParser();
        JSONObject jsonObj = JSONObject.fromObject(parser.parse(new String(data)));

        List<ParameterValue> values = new ArrayList<ParameterValue>();
        ParametersDefinitionProperty property = (ParametersDefinitionProperty)project.getProperty(ParametersDefinitionProperty.class);

        if (property != null){
            for (ParameterDefinition parameterDefinition : property.getParameterDefinitions()) {
                String parameterName = parameterDefinition.getName();
                ParameterValue parameterValue = null;

                if(jsonObj.containsKey(parameterName)){
                    String strValue = jsonObj.get(parameterName).toString();
                    if (parameterDefinition.getClass() == StringParameterDefinition.class){
                        parameterValue = ((StringParameterDefinition) parameterDefinition).createValue(strValue);
                    }
                    else if (parameterDefinition.getClass() == TextParameterDefinition.class){
                        parameterValue = ((TextParameterDefinition) parameterDefinition).createValue(strValue);
                    }
                    else if (parameterDefinition.getClass() == ChoiceParameterDefinition.class){
                        if (((ChoiceParameterDefinition)parameterDefinition).getChoices().contains(strValue)){
                            parameterValue = ((ChoiceParameterDefinition)parameterDefinition).createValue(strValue);
                        }
                    }
                }
                if (parameterValue == null) {
                    parameterValue = parameterDefinition.getDefaultParameterValue();
                }

                values.add(parameterValue);
            }
        }

        Jenkins.getInstance().getQueue().schedule(project, 0, new ParametersAction(values), new CauseAction(new ReleaseQueueBuildCause()));
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Provisioning.WorkflowTemplate
{
    public class ConsoleLogger : ILogger
    {
        public void WriteMessage(string message)
        {
            Console.WriteLine(message);
        }
    }
}


text:
This is the documentation for Hilo.js.

## Table of contents

### Getting Started

* [Introduction](intro.md)
* [Using](use.md)
* [Basic Tutorial](tute.md)

## Documentation

* [Dom](dom/main.md)
* [CSS](css/main.md)
* [AJAX](dom/main.md)
* [Feature Detection](feat/main.md)
* [Testing](dom/main.md)


text:
package persistence

/**
  * Created by andrea on 22/05/16.
  */
object MongoCollection {
    val storageEntries = "storageEntries"
    val categories = "categories"
    val products = "products"
}


text:
<?xml version="1.0"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd">

<coverage line-rate="0.9" branch-rate="0.75" version="1.9" timestamp="1187350905008">
    <sources>
        <source></source>
    </sources>
    <packages>
        <package name="MyAssemblyOne" line-rate="0.6" branch-rate="0.6" complexity="3.0">
            <classes>
                <class name="TestClass" filename="C:\Repos\testrepo.git\TestClass.cs" line-rate="0.2" branch-rate="0.2" complexity="3.0">
                    <methods>
                        <method name="ProcessAction" signature="()" line-rate="0" branch-rate="0">
                            <lines>
                                <line number="4" hits="1" branch="false"/>
                            </lines>
                        </method>
                        <method name="CheckCodeCoverage" signature="()" line-rate="1.0" branch-rate="1.0">
                            <lines>
                                <line number="5" hits="0" branch="false"/>
                                <line number="6" hits="0" branch="false"/>
                                <line number="7" hits="0" branch="false"/>
                                <line number="8" hits="0" branch="false"/>
                            </lines>
                        </method>
                    </methods>
                    <lines>
                        <line number="4" hits="1" branch="false"/>
                        <line number="5" hits="0" branch="false"/>
                        <line number="6" hits="0" branch="false"/>
                        <line number="7" hits="0" branch="false"/>
                        <line number="8" hits="0" branch="false"/>
                    </lines>
                </class>
                <class name="AdditionalClass" filename="C:\Repos\testrepo.git\AdditionalClass.cs" line-rate="1.0" branch-rate="1.0" complexity="3.0">
                    <methods>
                        <method name="ProcessAction" signature="()" line-rate="1.0" branch-rate="1.0">
                            <lines>
                                <line number="4" hits="1" branch="false"/>
                            </lines>
                        </method>
                    </methods>
                    <lines>
                        <line number="4" hits="1" branch="false"/>
                    </lines>
                </class>
            </classes>
        </package>
        <package name="MyAssemblyTwo" line-rate="0.8" branch-rate="0.8" complexity="3.5">
            <classes>
                <class name="TestClass" filename="C:\Repos\testrepo.git\TestClass.cs" line-rate="0.8" branch-rate="0.8" complexity="3.5">
                    <methods>
                        <method name="ProcessAction" signature="()" line-rate="0" branch-rate="0">
                            <lines>
                                <line number="4" hits="0" branch="false"/>
                            </lines>
                        </method>
                        <method name="CheckCodeCoverage" signature="()" line-rate="1.0" branch-rate="1.0">
                            <lines>
                                <line number="5" hits="1" branch="false"/>
                                <line number="6" hits="1" branch="false"/>
                                <line number="7" hits="1" branch="false"/>
                                <line number="8" hits="1" branch="false"/>
                            </lines>
                        </method>
                    </methods>
                    <lines>
                        <line number="4" hits="0" branch="false"/>
                        <line number="5" hits="1" branch="false"/>
                        <line number="6" hits="1" branch="false"/>
                        <line number="7" hits="1" branch="false"/>
                        <line number="8" hits="1" branch="false"/>
                    </lines>
                </class>
        </classes>
        </package>
    </packages>
</coverage>


text:
La mia visualizzazione reale di "pentagramma" raccoglie solo la velocità, viene così visualizzata come cerchi che si espandono su un "pentagramma", come le onde sonore. Tre colori differenti, blu, giallo, rosso, differenziati in base alla velocità, stabilita come lenta, media e veloce; per tutti e tre ci sono delle frequenze che verranno trasferite alla cassa che emette le frequenze che muovono il liquido.

![Dataviz uno] (http://imgur.com/Mixt8fS.png)


text:
/*
options {
	id: exactly what it sounds like
	width:
	height:
}
*/
quack.renderers.GLRenderer = function(canvas, options) {
	//constructor
	this.canvas = canvas;
	this.id = options.id || "default";
	this.width = canvas.clientWidth;
	this.height = canvas.clientHeight;
	this.clearColor = options.clearColor || new quack.math.vector4(0.0, 0.0, 0.0, 0.0);
	this.gl = undefined;
	this._program = undefined;
	this._vertexShader = undefined;
	this._fragShader = undefined;
	this._prevRenderData = undefined;
	this.rendererData = {
		vertices: 0,
		faces: 0
	};

	//init the context
	this.contextOptions = {
		alpha: options.alpha || false,
		antialias: options.antialias || false,
		stencil: options.stencil || false,
		depth: options.depth || true,
		preserveDrawingBuffer: options.preserveDrawingBuffer || false
	};

	this.setClearColor = function(color) {
		this.gl.clearColor(color.x, color.y, color.z, color.w);
	};

	this._loadShader = function(type, src) {
		var shader = this.gl.createShader(type);
		this.gl.shaderSource(shader, src);
		this.gl.compileShader(shader);

		return shader;
	};

	this._setElementArrayBuffer = function(data) {
		var buffer = this.gl.createBuffer();
		this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, buffer);
		this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, data, this.gl.STATIC_DRAW);

		return buffer;
	};

	this._setArrayBuffer = function(data, n, type, attr) {
		var buffer = this.gl.createBuffer();
		this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);
		this.gl.bufferData(this.gl.ARRAY_BUFFER, data, this.gl.STATIC_DRAW);

		var a_attr = this.gl.getAttribLocation(this.gl.program, attr);
		if (a_attr < 0) {
			console.warn("Failed to get location of: " + attr);
		}
		this.gl.vertexAttribPointer(a_attr, n, type, false, 0, 0);
		this.gl.enableVertexAttribArray(a_attr);

		return buffer;
	};

	this._attachShaders = function(data) {
		this._vertexShader = this._loadShader(this.gl.VERTEX_SHADER, data.vertex);
		this._fragShader = this._loadShader(this.gl.FRAGMENT_SHADER, data.frag);

		this.gl.attachShader(this._program, this._vertexShader);
		this.gl.attachShader(this._program, this._fragShader);
		this.gl.linkProgram(this._program);

		//check
		var linkStatus = this.gl.getProgramParameter(this._program, this.gl.LINK_STATUS);
		if (!linkStatus) {
			var e = this.gl.getProgramInfoLog(this._program);
			console.log("Error in linking!!!");
			console.log(e);

			return;
		}

		this.gl.useProgram(this._program);
		this.gl.program = this._program;

		this._prevRenderData = data;
	};

	this.render = function(scene, camera) {
		if ( !(scene instanceof quack.core.scene) || (!(camera instanceof quack.camera.orthographicCamera) && !(camera instanceof quack.camera.perspectiveCamera)) ) {
			throw new Error("Invalid render arguments");
		}

		//clear buffers
		this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);

		this.rendererData.vertices = 0;
		this.rendererData.faces = 0;
		var target, vertices, faces;

		//This needs to account for all children at any depth, but this is fine for now
		for (var k = 0, n = scene.children.length; k < n; k++) {
			target = scene.children[k];

			//If no rendering data was set
			if (!this._prevRenderData) {
				this._attachShaders(target.material.shaders);
			}

			this.rendererData.vertices += target.vertices.length / 3;
			this.rendererData.faces += target.faces.length;

			var arrayBuffers = [], elemArrayBuffers = [], uniforms = [], t, tokens, r, val;

			//Read the material mappings and apply them
			for (var q in target.material.mappings) {

				//used to get values when multiple levels are involved
				var getMultProps = function(obj, props) {
					for (var o = 1; o < props.length; o++) {
						obj = obj[props[o]];
					}
					return obj;
				};

				if (q === "arrayBuffer") {
					for (r in target.material.mappings[q]) {
						t = target.material.mappings[q][r];
						tokens = t[0].split(".");
						if (tokens[0] === "geometry") {
							val = getMultProps(target, tokens);
							arrayBuffers.push(this._setArrayBuffer(val, t[1], this.gl[t[2]], r));
						}
					}
				}
				else if (q === "elementArrayBuffer") {
					t = target.material.mappings[q];
					for (r = 0; r < t.length; r++) {
						tokens = t[r].split(".");
						if (tokens[0] === "geometry") {
							val = getMultProps(target, tokens);
							elemArrayBuffers.push(this._setElementArrayBuffer(val));
						}
					}
				}
				else if (q === "uniform") {
					for (r in target.material.mappings[q]) {
						t = target.material.mappings[q][r];

						//get the location of the uniform
						uniforms.push(this.gl.getUniformLocation(this.gl.program, r));

						//pass the correct data to the uniform
						tokens = t.split(".");
						if (tokens[0] === "geometry") {
							val = getMultProps(target, tokens);
							this.gl.uniformMatrix4fv(uniforms[uniforms.length - 1], false, val);
						}
						else if (tokens[0] === "camera") {
							val = getMultProps(camera, tokens);
							this.gl.uniformMatrix4fv(uniforms[uniforms.length - 1], false, val);
						}
					}
				}
			}

			//cross your fingers and hope it works
			this.gl.drawElements(this.gl.TRIANGLES, target.indices.length, this.gl.UNSIGNED_SHORT, 0);
		}

	};

	this._saveRendererData = function() {
		this.rendererData.depthBits = this.gl.getParameter(this.gl.DEPTH_BITS);
		for (var k in this.contextOptions) {
			this.rendererData[k] = this.contextOptions[k];
		}
	};

	this._init = function() {
		this.gl = canvas.getContext("webgl", this.contextOptions);
		this.gl.clearColor(this.clearColor.x, this.clearColor.y, this.clearColor.z, this.clearColor.w);
		this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
		this.gl.enable(this.gl.DEPTH_TEST);
		this.gl.depthFunc(this.gl.LEQUAL);
		this._saveRendererData();

		this._program = this.gl.createProgram();
	}.call(this);
};


text:
The squbs admin console provides a web/JSON interface into system state and statistics of both squbs and the JVM. All state and statistics of squbs and the JVM is provided as JMX MXBeans. Cubes, applications, or components are free to register their own monitors.

**Note**: The squbs admin console does not allow JMX method execution or modifications of any settings just yet.

## Dependencies

To use the squbs admin console, simply add the following dependencies in your build.sbt file or Scala build script:

```
  "org.squbs" %% "squbs-admin" % squbsVersion
```

squbs-admin will be auto-detected. No API is required.

## Accessing Bean Information

squbs-admin uses the context `/adm`. Just hitting `/adm` alone will list out the catalog of JMX MXBeans and the corresponding URLs to access the beans as in the following example:

```json
{
  "JMImplementation:type=MBeanServerDelegate" : "http://localhost:8080/adm/bean/JMImplementation:type~MBeanServerDelegate",
  "com.sun.management:type=DiagnosticCommand" : "http://localhost:8080/adm/bean/com.sun.management:type~DiagnosticCommand",
  "com.sun.management:type=HotSpotDiagnostic" : "http://localhost:8080/adm/bean/com.sun.management:type~HotSpotDiagnostic",
  "java.lang:type=ClassLoading" : "http://localhost:8080/adm/bean/java.lang:type~ClassLoading",
  "java.lang:type=Compilation" : "http://localhost:8080/adm/bean/java.lang:type~Compilation",
  "java.lang:type=GarbageCollector,name=PS MarkSweep" : "http://localhost:8080/adm/bean/java.lang:type~GarbageCollector,name~PS%20MarkSweep",
  "java.lang:type=GarbageCollector,name=PS Scavenge" : "http://localhost:8080/adm/bean/java.lang:type~GarbageCollector,name~PS%20Scavenge",
  "java.lang:type=Memory" : "http://localhost:8080/adm/bean/java.lang:type~Memory",
  "java.lang:type=MemoryManager,name=CodeCacheManager" : "http://localhost:8080/adm/bean/java.lang:type~MemoryManager,name~CodeCacheManager",
  "java.lang:type=MemoryManager,name=Metaspace Manager" : "http://localhost:8080/adm/bean/java.lang:type~MemoryManager,name~Metaspace%20Manager",
  "java.lang:type=MemoryPool,name=Code Cache" : "http://localhost:8080/adm/bean/java.lang:type~MemoryPool,name~Code%20Cache",
  "java.lang:type=MemoryPool,name=Compressed Class Space" : "http://localhost:8080/adm/bean/java.lang:type~MemoryPool,name~Compressed%20Class%20Space",
  "java.lang:type=MemoryPool,name=Metaspace" : "http://localhost:8080/adm/bean/java.lang:type~MemoryPool,name~Metaspace",
  "java.lang:type=MemoryPool,name=PS Eden Space" : "http://localhost:8080/adm/bean/java.lang:type~MemoryPool,name~PS%20Eden%20Space",
  "java.lang:type=MemoryPool,name=PS Old Gen" : "http://localhost:8080/adm/bean/java.lang:type~MemoryPool,name~PS%20Old%20Gen",
  "java.lang:type=MemoryPool,name=PS Survivor Space" : "http://localhost:8080/adm/bean/java.lang:type~MemoryPool,name~PS%20Survivor%20Space",
  "java.lang:type=OperatingSystem" : "http://localhost:8080/adm/bean/java.lang:type~OperatingSystem",
  "java.lang:type=Runtime" : "http://localhost:8080/adm/bean/java.lang:type~Runtime",
  "java.lang:type=Threading" : "http://localhost:8080/adm/bean/java.lang:type~Threading",
  "java.nio:type=BufferPool,name=direct" : "http://localhost:8080/adm/bean/java.nio:type~BufferPool,name~direct",
  "java.nio:type=BufferPool,name=mapped" : "http://localhost:8080/adm/bean/java.nio:type~BufferPool,name~mapped",
  "java.util.logging:type=Logging" : "http://localhost:8080/adm/bean/java.util.logging:type~Logging",
  "org.squbs.unicomplex:type=CubeState,name=admin" : "http://localhost:8080/adm/bean/org.squbs.unicomplex:type~CubeState,name~admin",
  "org.squbs.unicomplex:type=Cubes" : "http://localhost:8080/adm/bean/org.squbs.unicomplex:type~Cubes",
  "org.squbs.unicomplex:type=Extensions" : "http://localhost:8080/adm/bean/org.squbs.unicomplex:type~Extensions",
  "org.squbs.unicomplex:type=Listeners" : "http://localhost:8080/adm/bean/org.squbs.unicomplex:type~Listeners",
  "org.squbs.unicomplex:type=ServerStats,listener=default-listener" : "http://localhost:8080/adm/bean/org.squbs.unicomplex:type~ServerStats,listener~default-listener",
  "org.squbs.unicomplex:type=SystemSetting" : "http://localhost:8080/adm/bean/org.squbs.unicomplex:type~SystemSetting",
  "org.squbs.unicomplex:type=SystemState" : "http://localhost:8080/adm/bean/org.squbs.unicomplex:type~SystemState"
}
```

JSON plugins for your browser would detect and allow easy clicking on the links. Following the provided links, for instance, bean `org.squbs.unicomplex:type=Cubes` will show all bean detail as follows:

```json
{
  "Cubes" : [
    {
      "fullName" : "org.squbs.admin",
      "name" : "admin",
      "supervisor" : "Actor[akka://squbs/user/admin#104594558]",
      "version" : "0.7.1"
    }
  ]
}
```

## Bean URL & Encoding

All beans are under the `/adm/bean/` path, followed by the full bean object name. The bean object name gets translated as follows to make it possible for easy URL access:

1. The `=` in the bean name is replaced with `~`.
2. All other characters are encoded according to standard URL encoding. For instance, a space in the name is encoded as `%20`.

For instance, to access the bean with object name `java.lang:type=GarbageCollector,name=PS Scavenge`, the URL path would be `/adm/bean/java.lang:type~GarbageCollector,name~PS%20Scavenge`

## Listener

squbs-admin binds to the `admin-listener`. By default, this is an alias of the `default-listener`. Services can override the Unicomplex configuration and re-assign the `admin-listener` alias to any other defined listener of choice. The following example shows how to re-assign aliases in your `application.conf`:

Alias defined in Unicomplex

```
default-listener {
  aliases = [admin-listener]
}
```

An example override in `application.conf`

```
default-listener {
  aliases = []
}

my-listener {
  aliases = [admin-listener]
}
```

## Exclusions

In many cases, an MXBean may contain information deemed sensitive, and should not be displayed in the admin console. The best way around this is, of course, to not include such information into a JMX bean in the first place. However, sometimes these beans are not exposed by your component but by a third party component or library and there is no way to hide such information short of modifying the third party component. Exclusions are a feature provided by the admin console to hide such information from showing in the JSON.

### Configuring Exclusions

Exclusions are configured under squbs.admin in your standard configuration in `application.conf` as can be seen in the following example:

```
squbs.admin {
  exclusions = [
    "java.lang:type=Memory",
    "java.lang:type=GarbageCollector,name=PS MarkSweep::init",
    "java.lang:type=GarbageCollector,name=PS MarkSweep::startTime"
  ]
}
```

* To exclude a whole MXBean from the console's view, list the bean object name in the exclusions.
* To exclude a field or property in an MXBean, list the bean object name and the field name in the exclusions.
  * The bean object name and field name are separated by `::`.
  * The field name acts as a filter of any attribute or field at any depth in the MXBean. If the field name matches the provided name, it will be excluded.
* Multiple field exclusion on the same bean can be achieved by listing `beanName::field1`, `beanName::field2`, and so forth.

## Error Responses
A 404 (NotFound) response is provided on a request to obtain an invalid bean object name, or a name of a blacklisted bean. The results of either case is indistinguishable for security reasons.


text:
<?php
use Opulence\Cache\FileBridge;
use Opulence\Databases\Adapters\Pdo\PostgreSql\Driver;
use Opulence\Environments\Environment;
use Opulence\Sessions\Handlers\FileSessionHandler;
use Opulence\Views\Caching\FileCache;

/**
 * ----------------------------------------------------------
 * Set environment metadata
 * ----------------------------------------------------------
 */
Environment::setVar('ENV_NAME', Environment::DEVELOPMENT);

/**
 * ----------------------------------------------------------
 * Set the session handler and cache bridge
 * ----------------------------------------------------------
 */
Environment::setVar('SESSION_HANDLER', FileSessionHandler::class);
Environment::setVar('SESSION_CACHE_BRIDGE', FileBridge::class);
Environment::setVar('SESSION_COOKIE_DOMAIN', '');
Environment::setVar('SESSION_COOKIE_IS_SECURE', false);
Environment::setVar('SESSION_COOKIE_PATH', '/');

/**
 * ----------------------------------------------------------
 * Set the view cache
 * ----------------------------------------------------------
 */
Environment::setVar('VIEW_CACHE', FileCache::class);

/**
 * ----------------------------------------------------------
 * Set SQL database connection info
 * ----------------------------------------------------------
 */
Environment::setVar('DB_DRIVER', Driver::class);
Environment::setVar('DB_HOST', 'localhost');
Environment::setVar('DB_USER', 'myuser');
Environment::setVar('DB_PASSWORD', 'mypassword');
Environment::setVar('DB_NAME', 'public');
Environment::setVar('DB_PORT', 5432);

/**
 * ----------------------------------------------------------
 * Set Memcached connection info
 * ----------------------------------------------------------
 */
Environment::setVar('MEMCACHED_HOST', 'localhost');
Environment::setVar('MEMCACHED_PORT', 11211);

/**
 * ----------------------------------------------------------
 * Set Redis connection info
 * ----------------------------------------------------------
 */
Environment::setVar('REDIS_HOST', 'localhost');
Environment::setVar('REDIS_PORT', 6379);
Environment::setVar('REDIS_DATABASE', 0);

/**
 * ----------------------------------------------------------
 * Set the encryption key
 * ----------------------------------------------------------
 */
Environment::setVar('ENCRYPTION_KEY', '');


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Package org.apache.wicket.request.mapper.info (Wicket Parent 1.5.7 API)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Package
org.apache.wicket.request.mapper.info

Packages that use org.apache.wicket.request.mapper.info

org.apache.wicket.request.mapper

org.apache.wicket.request.mapper.info

Classes in org.apache.wicket.request.mapper.info used by org.apache.wicket.request.mapper

PageComponentInfo

          Encapsulates both page and component info.

PageInfo

          Possible string representation of PageInfo:

 pageId

Classes in org.apache.wicket.request.mapper.info used by org.apache.wicket.request.mapper.info

ComponentInfo

          Encodes listener inteface and component path in form of
 <listenerInterface&gt-<componentPath>,
 <listenerInterface&gt.

PageComponentInfo

          Encapsulates both page and component info.

PageInfo

          Possible string representation of PageInfo:

 pageId

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.


text:
.. _cli_ref:

Workflow Management
===================

These docs show how to populate an example workflow in Tower and how to
automate the creation or copying of workflows.

Normal CRUD
-----------

Workflows and workflow nodes can be managed as normal tower-cli
resources.

Workflow Creation
~~~~~~~~~~~~~~~~~

Create an empty workflow:

::

    tower-cli workflow create --name="workflow1" --organization="Default" --description="example description"

Check the existing workflows with the standard list or get commands.

::

    tower-cli workflow list --description-on

Node Creation
~~~~~~~~~~~~~

Create nodes inside the workflow These all become "root" nodes and will
spawn jobs on workflow launch without any dependencies on other nodes.
These commands create 2 root nodes.

::

    tower-cli node create -W workflow1 --job-template="Hello World"
    tower-cli node create -W workflow1 --job-template="Hello World"

List the nodes inside of the workflow

::

    tower-cli node list -W workflow1

Node Association
~~~~~~~~~~~~~~~~

From the list command, you can find the ids of nodes you want to link
``associate_success_node`` will cause the 2nd node to run on success of
the first node. The following command causes node 2 to run on the event
of successful completion of node 1.

::

    tower-cli node associate_success_node 1 2

This operation is only possible when node 2 is a root node. See the
Tower documentation for the limitations on the types of node connections
allowed.

Auto-creation of the success node, only knowing the parent node id:

::

    tower-cli node associate_success_node 8 --job-template="Hello world"

Corresponding disassociate commands are also available. Disassociating a
node from another node will make it a root node.

Node Network Bulk Management
----------------------------

To print out a YAML representation of the nodes of a workflow, you can
use the following command. JSON format is also allowed.

::

    tower-cli workflow schema workflow1

Here, "workflow1" is the name of the workflow.

Creating/updating a Schema Definition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To bulk-create or buld-update a workflow node network, use the workflow
schema command. The schema is JSON or YAML content, and can be passed in
the CLI argument, or pointed to a file. The schema is passed as a second
positional argument, where the first argument references the workflow.

::

    tower-cli workflow schema workflow2 @schema.yml

The schema can be provided without using a file:

::

    tower-cli workflow schema workflow2 '[{"job_template": "Hello world"}]'

The Schema definition defines the hierarchy structure that connects the
nodes. Names, as well as other valid parameters for node creation, are
acceptable inside of the node's entry inside the schema definition.

Links must be declared as a list under a key that starts with "success",
"failure", or "always". The following is an example of a valid schema
definition.

Example ``schema.yml`` file:

.. code:: yaml

    - job_template: Hello world
      failure:
      - inventory_source: AWS servers (AWS servers - 42)
      success:
      - project: Ansible Examples
        always:
        - job_template: Echo variable
          success:
          - job_template: Scan localhost

This style may be useful to apply in a script to create a workflow
network with a tower-cli command after the constituent resources like
the job templates and projects were created by preceding tower-cli
commands.

Workflows Inside Workflows
~~~~~~~~~~~~~~~~~~~~~~~~~~

It is possible to have a workflow embedded inside of the schema of another
workflow. To do this, use the key "workflow".

.. code:: yaml

    - workflow: Another workflow

Differences with Machine Formatted Schemas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After writing a workflow schema, you may notice differences in how
tower-cli subsequently echos the schema definition back to you. The
following is what tower-cli might return after writing the above
example.

.. code:: yaml

    - failure_nodes:
      - inventory_source: 42
      job_template: 45
      success_nodes:
      - always_nodes:
        - job_template: 55
          success_nodes:
          - job_template: 44
        project: 40

Note that the root node data starts with "failure\_nodes", instead of
the name of the job template. This will not impact functionality, and
manually changing the order will not impact functionality either.

Although this format is harder to read, it does the same thing as the
previous schema. The ability to both echo and create schemas can be used
to copy the contents of one workflow to another.

As an example, consider 2 workflows. The first has a name "workflow1",
and has its node network populated. The second is named "workflow2" and
is empty. The following commands will copy the structure from the first
to the second.

.. code:: bash

    tower-cli workflow schema workflow1 > schema.yml
    tower-cli workflow schema workflow2 @schema.yml

Idempotence
~~~~~~~~~~~

The workflow schema feature populates the workflow node network based on
the hierarchy structure. Before creating each node, it attempts to find
an existing node with the specified properties in that location in the
tree, and will not create a new node if it exists. Also, if an existing
node has no correspondence in the schema, the entire sub-tree based on
that node will be deleted.

Thus, after running the schema command, the resulting workflow topology
will always be exactly the same as what is specified in the given schema
file. To continue with the previous example, subsequent invocations of:

.. code:: bash

    tower-cli workflow schema workflow2 @schema.yml
    tower-cli workflow schema workflow2 @schema.yml

should not change the network of workflow2, since ``schema.yml`` file
itself remains unchanged. However

.. code:: bash

    tower-cli workflow schema workflow2 @new_schema.yml

will modify topology of workflow2 to exactly the same as what is
specified in ``new_schema.yml``.

Launching Workflow Jobs
-----------------------

Use the workflow\_job resource to launch workflow jobs. This supports
the use of extra\_vars, which can contain answers to survey questions.
The ``--monitor`` and ``--wait`` flag are available to poll the server
until workflow job reaches a completed status. The ``--monitor`` option
will print rolling updates of the jobs that ran as part of the workflow.
Here is an example of using those features:

::

    tower-cli workflow_job launch -W "echo Hello World" -e a=1 --monitor


text:
<?php
/**
 * Athene2 - Advanced Learning Resources Manager
 *
 * @author      Aeneas Rekkas (aeneas.rekkas@serlo.org)
 * @license     MIT License
 * @license     http://opensource.org/licenses/MIT The MIT License (MIT)
 * @link        https://github.com/serlo-org/athene2 for the canonical source repository
 */
namespace ClassResolverTest;

use ClassResolver\ClassResolver;
use ClassResolverTest\Fake\Foo;
use Zend\ServiceManager\ServiceManager;

class ClassResolverTest extends \PHPUnit_Framework_TestCase
{

    protected $classResolver, $serviceLocatorMock;

    public function setUp()
    {
        parent::setUp();

        $this->classResolver = new ClassResolver([
            'ClassResolverTest\Fake\FailInterface'      => 'ClassResolverTest\Fake\Foo',
            'ClassResolverTest\Fake\FooInterface'       => 'ClassResolverTest\Fake\Foo',
            'ClassResolverTest\Fake\BarInterface'       => 'ClassResolverTest\Fake\Bar',
            'ClassResolverTest\Fake\SuperFailInterface' => 'ClassResolverTest\Fake\SuperFail',
        ]);
    }

    public function testResolveClassName()
    {
        $this->assertEquals(
            'ClassResolverTest\Fake\Foo',
            $this->classResolver->resolveClassName('ClassResolverTest\Fake\FooInterface')
        );
        $this->assertEquals(
            'ClassResolverTest\Fake\Bar',
            $this->classResolver->resolveClassName('ClassResolverTest\Fake\BarInterface')
        );
    }

    public function testResolve()
    {
        $this->assertInstanceOf(
            'ClassResolverTest\Fake\FooInterface',
            $this->classResolver->resolve('ClassResolverTest\Fake\FooInterface')
        );
        $this->assertNotSame(
            $this->classResolver->resolve('ClassResolverTest\Fake\FooInterface'),
            $this->classResolver->resolve('ClassResolverTest\Fake\FooInterface')
        );
    }

    public function testResolveFromServiceManager()
    {
        $serviceManager = new ServiceManager();
        $service        = new Foo();

        $serviceManager->setService('ClassResolverTest\Fake\Foo', $service);
        $this->classResolver->setServiceLocator($serviceManager);

        $this->assertSame($service, $this->classResolver->resolve('ClassResolverTest\Fake\FooInterface', true));
    }

    /**
     * @expectedException \ClassResolver\Exception\RuntimeException
     */
    public function testResolveException()
    {
        $this->classResolver->resolve('ClassResolverTest\Fake\FailInterface');
    }

    /**
     * @expectedException \ClassResolver\Exception\InvalidArgumentException
     */
    public function testInvalidArgumentException()
    {
        $this->classResolver->resolveClassName([]);
    }

    /**
     * @expectedException \ClassResolver\Exception\RuntimeException
     */
    public function testClassNotFound()
    {
        $this->classResolver->resolveClassName('ClassResolverTest\Fake\SuperFailInterface');
    }

    /**
     * @expectedException \ClassResolver\Exception\RuntimeException
     */
    public function testNotResolvable()
    {
        $this->classResolver->resolveClassName('NotResolvable');
    }
}


text:
// The MIT License (MIT)
//
// Copyright (c) 2021 Henk-Jan Lebbink
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace AsmTools
{
    using System;
    using System.Diagnostics.Contracts;

    [Flags]
    public enum MicroArch
    {
        NONE = 0,
        SandyBridge = 1 << 0,
        IvyBridge = 1 << 1,
        Haswell = 1 << 2,
        Broadwell = 1 << 3,
        Skylake = 1 << 4,
        SkylakeX = 1 << 5,
        Kabylake = 1 << 6,
        Cannonlake = 1 << 7,
        Icelake = 1 << 8,
        Tigerlake = 1 << 9,

        KnightsCorner = 1 << 10,
        KnightsLanding = 1 << 11,
    }

    public static partial class AsmSourceTools
    {
        public static MicroArch ParseMicroArch(string str, bool strIsCapitals)
        {
            Contract.Requires(str != null);

            switch (ToCapitals(str, strIsCapitals))
            {
                case "SANDYBRIDGE": return MicroArch.SandyBridge;
                case "IVYBRIDGE": return MicroArch.IvyBridge;
                case "HASWELL": return MicroArch.Haswell;
                case "BROADWELL": return MicroArch.Broadwell;
                case "SKYLAKE": return MicroArch.Skylake;
                case "SKYLAKEX": return MicroArch.SkylakeX;
                case "KABYLAKE": return MicroArch.Kabylake;
                case "CANNONLAKE": return MicroArch.Cannonlake;
                case "ICELAKE": return MicroArch.Icelake;
                case "TIGERLAKE": return MicroArch.Tigerlake;
                case "KNIGHTSCORNER": return MicroArch.KnightsCorner;
                case "KNIGHTSLANDING": return MicroArch.KnightsLanding;
                default: return MicroArch.NONE;
            }
        }
    }
}


text:
package fr.openwide.maven.artifact.notifier.web.application.artifact.component;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.ExternalLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.spring.injection.annot.SpringBean;

import fr.openwide.core.jpa.exception.SecurityServiceException;
import fr.openwide.core.jpa.exception.ServiceException;
import fr.openwide.core.wicket.behavior.ClassAttributeAppender;
import fr.openwide.core.wicket.markup.html.basic.CountLabel;
import fr.openwide.core.wicket.more.markup.html.list.GenericPortfolioPanel;
import fr.openwide.core.wicket.more.model.BindingModel;
import fr.openwide.core.wicket.more.util.DatePattern;
import fr.openwide.maven.artifact.notifier.core.business.artifact.model.Artifact;
import fr.openwide.maven.artifact.notifier.core.business.artifact.model.ArtifactDeprecationStatus;
import fr.openwide.maven.artifact.notifier.core.business.artifact.service.IFollowedArtifactService;
import fr.openwide.maven.artifact.notifier.core.business.search.service.IMavenCentralSearchUrlService;
import fr.openwide.maven.artifact.notifier.core.business.user.model.User;
import fr.openwide.maven.artifact.notifier.core.business.user.service.IUserService;
import fr.openwide.maven.artifact.notifier.core.util.binding.Binding;
import fr.openwide.maven.artifact.notifier.web.application.MavenArtifactNotifierSession;
import fr.openwide.maven.artifact.notifier.web.application.artifact.model.ArtifactLastVersionModel;
import fr.openwide.maven.artifact.notifier.web.application.artifact.model.ArtifactModel;
import fr.openwide.maven.artifact.notifier.web.application.artifact.page.ArtifactDescriptionPage;
import fr.openwide.maven.artifact.notifier.web.application.common.component.DateLabelWithPlaceholder;

public class RecommendedArtifactPortfolioPanel extends GenericPortfolioPanel<Artifact> {

	private static final long serialVersionUID = 2168203516395191437L;

	@SpringBean
	private IUserService userService;

	@SpringBean
	private IFollowedArtifactService followedArtifactService;

	@SpringBean
	private IMavenCentralSearchUrlService mavenCentralSearchUrlService;

	public RecommendedArtifactPortfolioPanel(String id, final IDataProvider<Artifact> dataProvider, int itemsPerPage) {
		super(id, dataProvider, itemsPerPage);

		add(new Label("title", new ResourceModel("artifact.follow.search.recommended.title")));
	}

	@Override
	protected void addItemColumns(final Item<Artifact> item, IModel<? extends Artifact> itemModel) {
		item.setOutputMarkupId(true);

		Artifact artifact = item.getModelObject();
		final IModel<Artifact> artifactModel = new ArtifactModel(Model.of(item.getModelObject().getArtifactKey()));
		final ArtifactLastVersionModel artifactLastVersionModel = new ArtifactLastVersionModel(artifactModel);

		item.add(new ClassAttributeAppender(new LoadableDetachableModel<String>() {
			private static final long serialVersionUID = 1L;

			@Override
			protected String load() {
				User user = MavenArtifactNotifierSession.get().getUser();
				boolean isFollowed = user != null && userService.isFollowedArtifact(user, item.getModelObject());
				boolean isDeprecated = artifactModel.getObject() != null &&
						ArtifactDeprecationStatus.DEPRECATED.equals(artifactModel.getObject().getDeprecationStatus());
				return isFollowed ? "success" : (isDeprecated ? "warning" : null);
			}
		}));

		// GroupId column
		item.add(new Label("groupId", BindingModel.of(artifactModel, Binding.artifact().group().groupId())));
		item.add(new ExternalLink("groupLink", mavenCentralSearchUrlService.getGroupUrl(artifact.getGroup().getGroupId())));

		// ArtifactId column
		Link<Void> localArtifactLink = ArtifactDescriptionPage.linkDescriptor(artifactModel).link("localArtifactLink");
		localArtifactLink.add(new Label("artifactId", BindingModel.of(artifactModel, Binding.artifact().artifactId())));
		item.add(localArtifactLink);

		item.add(new ExternalLink("artifactLink", mavenCentralSearchUrlService.getArtifactUrl(artifact.getGroup().getGroupId(), artifact.getArtifactId())));

		// LastVersion, lastUpdateDate columns
		item.add(new Label("synchronizationPlannedPlaceholder", new ResourceModel("artifact.follow.synchronizationPlanned")) {
			private static final long serialVersionUID = 1L;

			@Override
			protected void onConfigure() {
				super.onConfigure();
				setVisible(artifactModel.getObject() != null && !artifactLastVersionModel.isLastVersionAvailable());
			}
		});

		WebMarkupContainer localContainer = new WebMarkupContainer("followedArtifact") {
			private static final long serialVersionUID = 1L;

			@Override
			protected void onConfigure() {
				super.onConfigure();
				setVisible(artifactLastVersionModel.isLastVersionAvailable());
			}
		};
		localContainer.add(new ArtifactVersionTagPanel("latestVersion", Model.of(artifactLastVersionModel.getLastVersion())));
		String latestVersion = (artifact.getLatestVersion() != null ? artifact.getLatestVersion().getVersion() : "");
		localContainer.add(new ExternalLink("versionLink", mavenCentralSearchUrlService.getVersionUrl(artifact.getGroup().getGroupId(),
				artifact.getArtifactId(), latestVersion)));

		localContainer.add(new DateLabelWithPlaceholder("lastUpdateDate",
				Model.of(artifactLastVersionModel.getLastVersionUpdateDate()), DatePattern.SHORT_DATE));
		item.add(localContainer);

		// Followers count column
		Label followersCount = new CountLabel("followersCount", "artifact.follow.dataView.followers",
				BindingModel.of(artifactModel, Binding.artifact().followersCount()));
		followersCount.add(new AttributeModifier("class", new LoadableDetachableModel<String>() {
			private static final long serialVersionUID = 1L;

			@Override
			protected String load() {
				if (artifactModel.getObject() != null && artifactModel.getObject().getFollowersCount() > 0) {
					return "badge";
				}
				return null;
			}
		}));
		item.add(followersCount);

		// Follow actions
		item.add(new ArtifactFollowActionsPanel("followActions", artifactModel));
	}

	@Override
	protected boolean hasWritePermissionOn(IModel<? extends Artifact> itemModel) {
		return false;
	}

	@Override
	protected void doDeleteItem(IModel<? extends Artifact> itemModel) throws ServiceException, SecurityServiceException {
	}

	@Override
	protected boolean isActionAvailable() {
		return false;
	}

	@Override
	protected boolean isDeleteAvailable() {
		return false;
	}

	@Override
	protected boolean isEditAvailable() {
		return false;
	}

	@Override
	protected void onConfigure() {
		super.onConfigure();
		setVisible(getDataView().getDataProvider().size() != 0);
	}
}


text:
<?php

namespace Zicht\Tool\Script\Node\Expr;

/**
 * Represents a numeric literal
 */
class Number extends Literal
{
}


text:
namespace boost {
namespace unit_test {
namespace data {

namespace monomorphic {

#if !defined(BOOST_TEST_DOXYGEN_DOC__)
template<typename T>
struct traits;

template<typename T>
class dataset;

template<typename T>
class singleton;

template<typename C>
class collection;

template<typename T>
class array;
#endif

#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#  define BOOST_TEST_ENABLE_IF std::enable_if
#else
#  define BOOST_TEST_ENABLE_IF boost::enable_if_c
#endif

// ************************************************************************** //
// **************            monomorphic::is_dataset           ************** //
// ************************************************************************** //

//! Helper metafunction indicating if the specified type is a dataset.
template<typename DataSet>
struct is_dataset : mpl::false_ {};

//! A reference to a dataset is a dataset
template<typename DataSet>
struct is_dataset<DataSet&> : is_dataset<DataSet> {};

//! A const dataset is a dataset
template<typename DataSet>
struct is_dataset<DataSet const> : is_dataset<DataSet> {};

//____________________________________________________________________________//

} // namespace monomorphic

// ************************************************************************** //
// **************                  data::make                  ************** //
// ************************************************************************** //

#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES

//! @brief Creates a dataset from a value, a collection or an array
//!
//! This function has several overloads:
//! @code
//! // returns ds if ds is already a dataset
//! template <typename DataSet> DataSet make(DataSet&& ds);
//!
//! // creates a singleton dataset, for non forward iterable and non dataset type T
//! // (a C string is not considered as a sequence).
//! template <typename T> monomorphic::singleton<T> make(T&& v);
//! monomorphic::singleton<char*> make( char* str );
//! monomorphic::singleton<char const*> make( char const* str );
//!
//! // creates a collection dataset, for forward iterable and non dataset type C
//! template <typename C> monomorphic::collection<C> make(C && c);
//!
//! // creates an array dataset
//! template<typename T, std::size_t size> monomorphic::array<T> make( T (&a)[size] );
//! @endcode
template<typename DataSet>
inline typename BOOST_TEST_ENABLE_IF<monomorphic::is_dataset<DataSet>::value,DataSet>::type
make(DataSet&& ds)
{
    return std::forward<DataSet>( ds );
}

// warning: doxygen is apparently unable to handle @overload from different files, so if the overloads
// below are not declared with @overload in THIS file, they do not appear in the documentation.

// fwrd declaration for singletons
//! @overload boost::unit_test::data::make()
template<typename T>
inline typename BOOST_TEST_ENABLE_IF<!is_forward_iterable<T>::value &&
                                     !monomorphic::is_dataset<T>::value &&
                                     !boost::is_array< typename boost::remove_reference<T>::type >::value,
                                     monomorphic::singleton<T> >::type
make( T&& v );

//! @overload boost::unit_test::data::make()
template<typename C>
inline typename BOOST_TEST_ENABLE_IF<is_forward_iterable<C>::value,
                                     monomorphic::collection<C> >::type
make( C&& c );

#else  // !BOOST_NO_CXX11_RVALUE_REFERENCES

//! @overload boost::unit_test:data::make()
template<typename DataSet>
inline typename BOOST_TEST_ENABLE_IF<monomorphic::is_dataset<DataSet>::value,DataSet const&>::type
make(DataSet const& ds)
{
    return ds;
}

// fwrd declaration for singletons
#if !(defined(BOOST_MSVC) && (BOOST_MSVC < 1600))
//! @overload boost::unit_test::data::make()
template<typename T>
inline typename BOOST_TEST_ENABLE_IF<!is_forward_iterable<T>::value &&
                                     !monomorphic::is_dataset<T>::value &&
                                     !boost::is_array< typename boost::remove_reference<T>::type >::value,
                                     monomorphic::singleton<T> >::type
make( T const& v );
#endif

// fwrd declaration for collections
//! @overload boost::unit_test::data::make()
template<typename C>
inline typename BOOST_TEST_ENABLE_IF<is_forward_iterable<C>::value,
                                     monomorphic::collection<C> >::type
make( C const& c );

//____________________________________________________________________________//

#endif // !BOOST_NO_CXX11_RVALUE_REFERENCES

// fwrd declarations
//! @overload boost::unit_test::data::make()
template<typename T, std::size_t size>
inline monomorphic::array< typename boost::remove_const<T>::type >
make( T (&a)[size] );

// apparently some compilers (eg clang-3.4 on linux) have trouble understanding
// the previous line for T being const
//! @overload boost::unit_test::data::make()
template<typename T, std::size_t size>
inline monomorphic::array< typename boost::remove_const<T>::type >
make( T const (&)[size] );

template<typename T, std::size_t size>
inline monomorphic::array< typename boost::remove_const<T>::type >
make( T a[size] );

//! @overload boost::unit_test::data::make()
inline monomorphic::singleton<char*>
make( char* str );

//! @overload boost::unit_test::data::make()
inline monomorphic::singleton<char const*>
make( char const* str );

//____________________________________________________________________________//

namespace result_of {

#ifndef BOOST_NO_CXX11_DECLTYPE
//! Result of the make call.
template<typename DataSet>
struct make
{
    typedef decltype(data::make(boost::declval<DataSet>())) type;
};
#else

// explicit specialisation, cumbersome

template <typename DataSet, typename Enable = void>
struct make;

template <typename DataSet>
struct make<
         DataSet const&,
         typename BOOST_TEST_ENABLE_IF<monomorphic::is_dataset<DataSet>::value>::type
         >
{
    typedef DataSet const& type;
};

template <typename T>
struct make<
         T,
         typename BOOST_TEST_ENABLE_IF< (!is_forward_iterable<T>::value &&
                                         !monomorphic::is_dataset<T>::value &&
                                         !boost::is_array< typename boost::remove_reference<T>::type >::value)
                                      >::type
         >
{
    typedef monomorphic::singleton<T> type;
};

template <typename C>
struct make<
         C,
         typename BOOST_TEST_ENABLE_IF< is_forward_iterable<C>::value>::type
         >
{
    typedef monomorphic::collection<C> type;
};

#if 1
template <typename T, std::size_t size>
struct make<T [size]>
{
    typedef monomorphic::array<typename boost::remove_const<T>::type> type;
};
#endif

template <typename T, std::size_t size>
struct make<T (&)[size]>
{
    typedef monomorphic::array<typename boost::remove_const<T>::type> type;
};

template <typename T, std::size_t size>
struct make<T const (&)[size]>
{
    typedef monomorphic::array<typename boost::remove_const<T>::type> type;
};

template <>
struct make<char*>
{
    typedef monomorphic::singleton<char*> type;
};

template <>
struct make<char const*>
{
    typedef monomorphic::singleton<char const*> type;
};

#endif // BOOST_NO_CXX11_DECLTYPE

} // namespace result_of

//____________________________________________________________________________//

} // namespace data
} // namespace unit_test
} // namespace boost

#include <boost/test/detail/enable_warnings.hpp>

#endif // BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER


text:
require 'test_helper'

module Take
  class AssessmentsControllerTest < ActionController::TestCase
    setup do
      @assessment = assessments(:one)
    end

    test "should get index" do
      get :index
      assert_response :success
      assert_not_nil assigns(:assessments)
    end

    test "should get new" do
      get :new
      assert_response :success
    end

    test "should create assessment" do
      assert_difference('Assessment.count') do
        post :create, assessment: @assessment.attributes
      end

      assert_redirected_to assessment_path(assigns(:assessment))
    end

    test "should show assessment" do
      get :show, id: @assessment.to_param
      assert_response :success
    end

    test "should get edit" do
      get :edit, id: @assessment.to_param
      assert_response :success
    end

    test "should update assessment" do
      put :update, id: @assessment.to_param, assessment: @assessment.attributes
      assert_redirected_to assessment_path(assigns(:assessment))
    end

    test "should destroy assessment" do
      assert_difference('Assessment.count', -1) do
        delete :destroy, id: @assessment.to_param
      end

      assert_redirected_to assessments_path
    end
  end
end


text:
create a pod without deployment and /badpodswo should show it.

```
apiVersion: v1
kind: Pod
metadata:
  name: single-pod
spec:
  containers:
    - name: nginx
      image: nginx:1.7.9
      ports:
        - containerPort: 80
```

create a bad deployment:

```
kubectl run bad-deployment --namespace=dummy-test --image=gcr.io/google_containers/echoserver:1.4
```

create a bad ingress:

```
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: bad-ingress
  labels:
    name: bad-ingress
spec:
  rules:
  - host: pizza.example.com
    http:
      paths:
      - backend:
          serviceName: some-service
          servicePort: 80
        path: /
```

create a bad job

```
apiVersion: batch/v1
kind: Job
metadata:
  name: bad-job
spec:
  template:
    metadata:
      name: bad-job
    spec:
      containers:
      - name: bad-job
        image: bash
        command: ["sleep 300"]
      restartPolicy: Never
```

create a bad cronjob

```
apiVersion: batch/v2alpha1
kind: CronJob
metadata:
  name: bad-cronjob
spec:
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox
            args:
            - /bin/sh
            - -c
            - date; echo Hello from the Kubernetes cluster
          restartPolicy: OnFailure
```


text:
package org.demis.comics.web.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.demis.comics.business.service.ComicBookBusinessService;
import org.demis.comics.data.jpa.entity.ComicBookEntity;
import org.demis.comics.web.RestConfiguration;
import org.demis.comics.web.dto.ComicBookWebDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ContextHierarchy;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.web.context.WebApplicationContext;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.util.List;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;

@WebAppConfiguration
@ContextHierarchy({
        @ContextConfiguration(classes = RestConfiguration.class)
})
public class ComicBookControllerTest extends AbstractTestNGSpringContextTests {

    private static String newComicBook = "{ \"title\": \"Adele et la bête\"}";
    private static String modifiedComicBook = "{ \"title\": \"Adèle et la bête\"}";
    @Autowired
    private WebApplicationContext webApplicationContext;
    @Autowired
    private ComicBookBusinessService businessService;
    private MockMvc mockMvc;

    @BeforeClass
    public void setup() throws Exception {
        this.mockMvc = webAppContextSetup(webApplicationContext).build();
        List<ComicBookEntity> entities = businessService.findAll();
        for (ComicBookEntity entity : entities) {
            businessService.delete(entity.getId());
        }

    }

    @Test
    public void testGelAll() throws Exception {
        mockMvc.perform(get("/comicBook").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNoContent());
    }

    @Test
    public void testLifeCycle() throws Exception {
        ObjectMapper mapper = new ObjectMapper();

        // Test GET collection
        mockMvc.perform(get("/comicBook").contentType(MediaType.APPLICATION_JSON))
                .andExpect(status().isNoContent());
        // Test POST a new resource and get the id
        MvcResult postResponse = mockMvc.perform(post("/comicBook")
                .contentType(MediaType.APPLICATION_JSON)
                .content(newComicBook))
                .andExpect(status().isCreated()).andReturn();
        ComicBookWebDTO postDTOResponse = mapper.readValue(postResponse.getResponse().getContentAsString(), ComicBookWebDTO.class);
        // Test GET collection and test we return a resource
        mockMvc.perform(get("/comicBook")
                .contentType(MediaType.APPLICATION_JSON))
                .andExpect(status().isOk());
        // Test GET the created resource
        mockMvc.perform(get("/comicBook/" + postDTOResponse.getId())
                .contentType(MediaType.APPLICATION_JSON))
                .andExpect(status().isOk());
        // Test PUT modify the resource
        MvcResult putResponse = mockMvc.perform(put("/comicBook/" + postDTOResponse.getId())
                .contentType(MediaType.APPLICATION_JSON)
                .content(modifiedComicBook))
                .andExpect(status().isOk()).andReturn();
        ComicBookWebDTO putDTOResponse = mapper.readValue(putResponse.getResponse().getContentAsString(), ComicBookWebDTO.class);
        Assert.assertEquals(putDTOResponse.getTitle(), "Adèle et la bête");
        // Test DELETE the create resource
        mockMvc.perform(delete("/comicBook/" + postDTOResponse.getId())
                .contentType(MediaType.APPLICATION_JSON))
                .andExpect(status().isNoContent());
        // Test GET no more resource
        mockMvc.perform(get("/comicBook")
                .contentType(MediaType.APPLICATION_JSON))
                .andExpect(status().isNoContent());
    }
}


text:
var mongoose = require('mongoose');
var _ = require('underscore');
var fs = require('fs');
var eco = require('eco');
var async = require('async');
var DocumentManifest = mongoose.model('DocumentManifest');
var ResourceHistory = mongoose.model('ResourceHistory');
var ResponseFormatHelper = require(__dirname + '/../../lib/response_format_helper');

exports.load = function(req, res, id, vid, next) {
  if (req.resourceHistory) {
    if(vid !== null){
      req.resourceHistory.getVersion(vid, function(err, documentmanifest) {
        req.documentmanifest = documentmanifest;
        next(documentmanifest);
      });
    } else {
      req.resourceHistory.findLatest(function(err, documentmanifest) {
        req.documentmanifest = documentmanifest;
        next(documentmanifest);
      });
    }
  } else {
    ResourceHistory.findOne(id, function(rhErr, resourceHistory) {
      if (rhErr) {
        next(rhErr);
      }
      if(resourceHistory !== null) {
        req.resourceHistory = resourceHistory;
        req.resourceHistory.findLatest(function(err, documentmanifest) {
          req.documentmanifest = documentmanifest;
          next(documentmanifest);
        });
      }
    });
  }
};

exports.show = function(req, res) {
  var documentmanifest = req.documentmanifest;
  var json = JSON.stringify(documentmanifest);
  res.send(json);
};

exports.create = function(req, res) {
  var documentmanifest = new DocumentManifest(req.body);
  documentmanifest.save(function(err, savedDocumentManifest) {
    if(err) {
      res.send(500);
    } else {
      var resourceHistory = new ResourceHistory({resourceType: 'DocumentManifest'});
      resourceHistory.addVersion(savedDocumentManifest.id);
      resourceHistory.save(function(rhErr, savedResourceHistory){
        if (rhErr) {
          res.send(500);
        } else {
          res.set('Location', ("http://localhost:3000/documentmanifest/@" + resourceHistory.id));
          res.send(201);
        }
      });
    }
  });
};

exports.update = function(req, res) {
  var documentmanifest = req.documentmanifest;
  documentmanifest = _.extend(documentmanifest, req.body);
  documentmanifest.save(function(err, saveddocumentmanifest) {
    if(err) {
      res.send(500);
    } else {
      var resourceHistory = req.resourceHistory;
      resourceHistory.addVersion(saveddocumentmanifest);
      resourceHistory.save(function(rhErr, savedResourceHistory) {
        if (rhErr) {
          res.send(500);
        } else {
          res.send(200);
        }
      });
    }
  });
};

exports.destroy = function(req, res) {
  var documentmanifest = req.documentmanifest;
  documentmanifest.remove(function (err) {
    if(err) {
      res.send(500);
    } else {
      res.send(204);
    }
  });
};

exports.list = function(req, res) {

  var content = {
    title: "Search results for resource type DocumentManifest",
    id: "http://localhost:3000/documentmanifest",
    totalResults: 0,
    link: {
      href: "http://localhost:3000/documentmanifest",
      rel: "self"
    },
    updated: new Date(Date.now()),
    entry: []
  };

  ResourceHistory.find({resourceType:"DocumentManifest"}, function (rhErr, histories) {
    if (rhErr) {
      return next(rhErr);
    }
    var counter = 0;
    async.forEach(histories, function(history, callback) {
      counter++;
      content.totalResults = counter;
      history.findLatest( function(err, documentmanifest) {
        var entrywrapper = {
          title: "DocumentManifest " + history.vistaId + " Version " + history.versionCount(),
          id: "http://localhost:3000/documentmanifest/@" + history.vistaId,
          link: {
            href: "http://localhost:3000/documentmanifest/@" + history.vistaId + "/history/@" + history.versionCount(),
            rel: "self"
          },
          updated: history.lastUpdatedAt(),
          published: new Date(Date.now()),
          content: documentmanifest
        };
        content.entry.push(entrywrapper);
        callback();
      });
    }, function(err) {
        res.send(JSON.stringify(content));
    });
  });
};


text:
An API to get patient care providers data. This API follows best practices with versioning, which is currently `v1`. See documentation to get the data. There is a client side to consume the API.

###### Technologies used
1. Front End: Angular, HTML, CSS/Sass, Gulp, Bower, and some others
2. Back End: Rails to power the API

#### Getting Started

* Pull repo
* Make sure you have Ruby installed (currently using 2.3.0)
* `gem install bundler`
* `bundle install`
* `bundle exec rake db:create` then `bundle exec rake db:migrate`
* `bundle exec rake db:seed`
* run `rails s` to start server
* visit the Rails server at `localhost:3000`, you now have the complete client + API app running but it is running on the last build from the client. To make changes in the client and rebuild, install `bower` and `npm` to get all the dependencies setup.
* In the `client` directory, run `bower install & npm install`
* `gulp serve` which will start the client server `localhost:3001`. Two servers are running now.
* If `rails s` was not run, `gulp serve:full-stack` can be used to run both servers at the same time.

### Documentation
#### GET `/api/v1/providers`

Response:
```json

[{
    "id": 1,
    "name": "Stephen's Care Home",
    "location": "San Francisco, CA",
    "phone_number": "415-715-9717",
    "provides": ["Dialysis", "Physical Therapy"],
    "created_at": "2016-06-20T18:56:35.016Z",
    "updated_at": "2016-06-20T18:56:35.016Z"
}, {
    "id": 2,
    "name": "Justin's Care Home",
    "location": "Los Altos, CA",
    "phone_number": null,
    "provides": ["Diabetes Care", "Medication Management", "Outpatient Therapy"],
    "created_at": "2016-06-20T18:56:35.036Z",
    "updated_at": "2016-06-20T18:56:35.036Z"
}, {
    "id": 3,
    "name": "Bode, Franecki and Hagenes Care Home",
    "location": "Los Angelos, CA",
    "phone_number": "176.405.9895",
    "provides": ["Diabetes Care", "Dialysis", "Medication Management", "Outpatient Therapy", "Oxygen", "Physical Therapy"],
    "created_at": "2016-06-20T18:56:35.764Z",
    "updated_at": "2016-06-20T18:56:35.764Z"
}]
```

#### GET `/api/v1/providers/{id}`

Response:
```json
{
    "id": 4,
    "name": "Smith-Effertz Care Center",
    "location": "San Francisco, CA",
    "phone_number": null,
    "provides": ["Diabetes Care", "Dialysis", "Medication Management", "Outpatient Therapy", "Oxygen", "Physical Therapy", "Speech Therapy", "Wound Care"],
    "created_at": "2016-06-20T18:56:35.773Z",
    "updated_at": "2016-06-20T18:56:35.773Z"
}
```

#### POST `/api/v1/providers`

Body Message

```json
{
    name: "Bode, Franecki and Hagenes Care Home",
    location: "Los Angelos, CA",
    phone_number: "176.405.9895",
    provides: [
        "Diabetes Care",
        "Dialysis",
        "Medication Management",
        "Outpatient Therapy",
        "Oxygen",
        "Physical Therapy"
    ]
}
```

Response

```json

{
    "id": 3,
    "name": "Bode, Franecki and Hagenes Care Home",
    "location": "Los Angelos, CA",
    "phone_number": "176.405.9895",
    "provides": ["Diabetes Care", "Dialysis", "Medication Management", "Outpatient Therapy", "Oxygen", "Physical Therapy"],
    "created_at": "2016-06-20T18:56:35.764Z",
    "updated_at": "2016-06-20T18:56:35.764Z"
}
```

#### PUT `/api/v1/providers/{id}`

```json
{
    location: "San Jose, CA"
}
```

```json

{
    "id": 3,
    "name": "Bode, Franecki and Hagenes Care Home",
    "location": "San Jose, CA",
    "phone_number": "176.405.9895",
    "provides": ["Diabetes Care", "Dialysis", "Medication Management", "Outpatient Therapy", "Oxygen", "Physical Therapy"],
    "created_at": "2016-06-20T18:56:35.764Z",
    "updated_at": "2016-06-20T18:56:35.764Z"
}
```

#### DELETE `/api/v1/providers/{id}`
This deletes the provider with the specified `id`


text:
Create a sequence-to-sequence model with support for bucketing.

The seq2seq argument is a function that defines a sequence-to-sequence model,
e.g., seq2seq = lambda x, y: basic_rnn_seq2seq(x, y, rnn_cell.GRUCell(24))

##### Args:

*  <b>`encoder_inputs`</b>: A list of Tensors to feed the encoder; first seq2seq input.
*  <b>`decoder_inputs`</b>: A list of Tensors to feed the decoder; second seq2seq input.
*  <b>`targets`</b>: A list of 1D batch-sized int32 Tensors (desired output sequence).
*  <b>`weights`</b>: List of 1D batch-sized float-Tensors to weight the targets.
*  <b>`buckets`</b>: A list of pairs of (input size, output size) for each bucket.
*  <b>`seq2seq`</b>: A sequence-to-sequence model function; it takes 2 input that
    agree with encoder_inputs and decoder_inputs, and returns a pair
    consisting of outputs and states (as, e.g., basic_rnn_seq2seq).
*  <b>`softmax_loss_function`</b>: Function (inputs-batch, labels-batch) -> loss-batch
    to be used instead of the standard softmax (the default if this is None).
*  <b>`per_example_loss`</b>: Boolean. If set, the returned loss will be a batch-sized
    tensor of losses for each sequence in the batch. If unset, it will be
    a scalar with the averaged loss from all examples.
*  <b>`name`</b>: Optional name for this operation, defaults to "model_with_buckets".

##### Returns:

  A tuple of the form (outputs, losses), where:

*  <b>`outputs`</b>: The outputs for each bucket. Its j'th element consists of a list
      of 2D Tensors. The shape of output tensors can be either
      [batch_size x output_size] or [batch_size x num_decoder_symbols]
      depending on the seq2seq model used.
*  <b>`losses`</b>: List of scalar Tensors, representing losses for each bucket, or,
      if per_example_loss is set, a list of 1D batch-sized float Tensors.

##### Raises:

*  <b>`ValueError`</b>: If length of encoder_inputsut, targets, or weights is smaller
    than the largest (last) bucket.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WcfTestService
{
    // HINWEIS: Mit dem Befehl "Umbenennen" im Menü "Umgestalten" können Sie den Klassennamen "Service1" sowohl im Code als auch in der SVC- und der Konfigurationsdatei ändern.
    // HINWEIS: Wählen Sie zum Starten des WCF-Testclients zum Testen dieses Diensts Service1.svc oder Service1.svc.cs im Projektmappen-Explorer aus, und starten Sie das Debuggen.
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
    }
}


text:
<?php

	$STRAVA_AUTHORIZE_URL = "https://www.strava.com/oauth/authorize?";
	$CLIENT_ID = "463";
	$REDIRECT_URI = "http://localhost:8888/mille-bornes/mille-bornes/index.php/admin/update";

	$url = $STRAVA_AUTHORIZE_URL . "client_id=" .$CLIENT_ID. "&response_type=code&redirect_uri=".$REDIRECT_URI;

?>
 <a href="<?php echo $url; ?>" class="login-with-strava-btn ir">Login-with-strava


text:
import sys
from typing import TYPE_CHECKING

if sys.version_info < (3, 7) or TYPE_CHECKING:
    from ._specular import SpecularValidator
    from ._roughness import RoughnessValidator
    from ._fresnel import FresnelValidator
    from ._diffuse import DiffuseValidator
    from ._ambient import AmbientValidator
else:
    from _plotly_utils.importers import relative_import

    __all__, __getattr__, __dir__ = relative_import(
        __name__,
        [],
        [
            "._specular.SpecularValidator",
            "._roughness.RoughnessValidator",
            "._fresnel.FresnelValidator",
            "._diffuse.DiffuseValidator",
            "._ambient.AmbientValidator",
        ],
    )


text:
<dc:language>en-US</dc:language>
<dc:creator opf:file-as="Supreme Court of the United States" opf:role="aut">Supreme Court of the United States</dc:creator>
<dc:publisher>Supreme Court of the United States republished via Cornell Internet Law</dc:publisher>
<dc:rights>Creative Commons</dc:rights>
<dc:title>NEW YORK v. HILL</dc:title>


text:
class NotificationMetricsLogger;

class NotificationMetricsLoggerFactory
    : public BrowserContextKeyedServiceFactory {
 public:
  static NotificationMetricsLogger* GetForBrowserContext(
      content::BrowserContext* browser_context);
  static NotificationMetricsLoggerFactory* GetInstance();

  NotificationMetricsLoggerFactory(const NotificationMetricsLoggerFactory&) =
      delete;
  NotificationMetricsLoggerFactory& operator=(
      const NotificationMetricsLoggerFactory&) = delete;

 private:
  friend struct base::DefaultSingletonTraits<NotificationMetricsLoggerFactory>;

  NotificationMetricsLoggerFactory();

  // BrowserContextKeyedServiceFactory implementation.
  KeyedService* BuildServiceInstanceFor(
      content::BrowserContext* context) const override;
  content::BrowserContext* GetBrowserContextToUse(
      content::BrowserContext* context) const override;
};

#endif  // CHROME_BROWSER_NOTIFICATIONS_METRICS_NOTIFICATION_METRICS_LOGGER_FACTORY_H_


text:
include_recipe 'apache2::default'

if node['apache']['mod_auth_cas']['from_source']
  package 'httpd-devel' do
    package_name value_for_platform_family(
      %w[rhel fedora suse] => 'httpd-devel',
      'debian' => 'apache2-dev'
    )
  end

  git '/tmp/mod_auth_cas' do
    repository 'git://github.com/Jasig/mod_auth_cas.git'
    revision   node['apache']['mod_auth_cas']['source_revision']
    notifies   :run, 'execute[compile mod_auth_cas]', :immediately
  end

  execute 'compile mod_auth_cas' do
    command './configure && make && make install'
    cwd     '/tmp/mod_auth_cas'
    not_if  "test -f #{node['apache']['libexecdir']}/mod_auth_cas.so"
  end

  template "#{node['apache']['dir']}/mods-available/auth_cas.load" do
    source 'mods/auth_cas.load.erb'
    owner  'root'
    group  node['apache']['root_group']
    mode   '0644'
  end
else
  case node['platform_family']
  when 'debian'
    package 'libapache2-mod-auth-cas'

  when 'rhel', 'fedora'
    yum_package 'mod_auth_cas' do
      notifies :run, 'execute[generate-module-list]', :immediately
    end

    file "#{node['apache']['dir']}/conf-available/auth_cas.conf" do
      action :delete
      backup false
    end
  end
end

apache_module 'auth_cas' do
  conf true
end

directory "#{node['apache']['cache_dir']}/mod_auth_cas" do
  owner node['apache']['user']
  group node['apache']['group']
  mode  '0700'
end


text:
// File generated from our OpenAPI spec

declare module 'stripe' {
  namespace Stripe {
    interface PromotionCodeCreateParams {
      /**
       * The coupon for this promotion code.
       */
      coupon: string;

      /**
       * Whether the promotion code is currently active.
       */
      active?: boolean;

      /**
       * The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically.
       */
      code?: string;

      /**
       * The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers.
       */
      customer?: string;

      /**
       * Specifies which fields in the response should be expanded.
       */
      expand?: Array<string>;

      /**
       * The timestamp at which this promotion code will expire. If the coupon has specified a `redeems_by`, then this value cannot be after the coupon's `redeems_by`.
       */
      expires_at?: number;

      /**
       * A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a `max_redemptions`, then this value cannot be greater than the coupon's `max_redemptions`.
       */
      max_redemptions?: number;

      /**
       * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
       */
      metadata?: Stripe.MetadataParam;

      /**
       * Settings that restrict the redemption of the promotion code.
       */
      restrictions?: PromotionCodeCreateParams.Restrictions;
    }

    namespace PromotionCodeCreateParams {
      interface Restrictions {
        /**
         * Promotion codes defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
         */
        currency_options?: {
          [key: string]: Restrictions.CurrencyOptions;
        };

        /**
         * A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices
         */
        first_time_transaction?: boolean;

        /**
         * Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work).
         */
        minimum_amount?: number;

        /**
         * Three-letter [ISO code](https://stripe.com/docs/currencies) for minimum_amount
         */
        minimum_amount_currency?: string;
      }

      namespace Restrictions {
        interface CurrencyOptions {
          /**
           * Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work).
           */
          minimum_amount?: number;
        }
      }
    }

    interface PromotionCodeRetrieveParams {
      /**
       * Specifies which fields in the response should be expanded.
       */
      expand?: Array<string>;
    }

    interface PromotionCodeUpdateParams {
      /**
       * Whether the promotion code is currently active. A promotion code can only be reactivated when the coupon is still valid and the promotion code is otherwise redeemable.
       */
      active?: boolean;

      /**
       * Specifies which fields in the response should be expanded.
       */
      expand?: Array<string>;

      /**
       * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
       */
      metadata?: Stripe.Emptyable<Stripe.MetadataParam>;

      /**
       * Settings that restrict the redemption of the promotion code.
       */
      restrictions?: PromotionCodeUpdateParams.Restrictions;
    }

    namespace PromotionCodeUpdateParams {
      interface Restrictions {
        /**
         * Promotion codes defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
         */
        currency_options?: {
          [key: string]: Restrictions.CurrencyOptions;
        };
      }

      namespace Restrictions {
        interface CurrencyOptions {
          /**
           * Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work).
           */
          minimum_amount?: number;
        }
      }
    }

    interface PromotionCodeListParams extends PaginationParams {
      /**
       * Filter promotion codes by whether they are active.
       */
      active?: boolean;

      /**
       * Only return promotion codes that have this case-insensitive code.
       */
      code?: string;

      /**
       * Only return promotion codes for this coupon.
       */
      coupon?: string;

      /**
       * A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
       */
      created?: Stripe.RangeQueryParam | number;

      /**
       * Only return promotion codes that are restricted to this customer.
       */
      customer?: string;

      /**
       * Specifies which fields in the response should be expanded.
       */
      expand?: Array<string>;
    }

    class PromotionCodesResource {
      /**
       * A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.
       */
      create(
        params: PromotionCodeCreateParams,
        options?: RequestOptions
      ): Promise<Stripe.Response<Stripe.PromotionCode>>;

      /**
       * Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing code use [list](https://stripe.com/docs/api/promotion_codes/list) with the desired code.
       */
      retrieve(
        id: string,
        params?: PromotionCodeRetrieveParams,
        options?: RequestOptions
      ): Promise<Stripe.Response<Stripe.PromotionCode>>;
      retrieve(
        id: string,
        options?: RequestOptions
      ): Promise<Stripe.Response<Stripe.PromotionCode>>;

      /**
       * Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.
       */
      update(
        id: string,
        params?: PromotionCodeUpdateParams,
        options?: RequestOptions
      ): Promise<Stripe.Response<Stripe.PromotionCode>>;

      /**
       * Returns a list of your promotion codes.
       */
      list(
        params?: PromotionCodeListParams,
        options?: RequestOptions
      ): ApiListPromise<Stripe.PromotionCode>;
      list(options?: RequestOptions): ApiListPromise<Stripe.PromotionCode>;
    }
  }
}


text:
package com.asakusafw.operation.tools.directio.transaction;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.MessageFormat;

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

import com.asakusafw.runtime.directio.hadoop.DirectIoTransactionEditor;
import com.asakusafw.runtime.directio.hadoop.DirectIoTransactionEditor.TransactionInfo;
import com.asakusafw.utils.jcommander.CommandConfigurationException;
import com.asakusafw.utils.jcommander.CommandExecutionException;
import com.asakusafw.utils.jcommander.common.HelpParameter;
import com.asakusafw.utils.jcommander.common.OutputParameter;
import com.asakusafw.utils.jcommander.common.VerboseParameter;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;

/**
 * A command for aborting Direct I/O transactions.
 * @since 0.10.0
 */
@Parameters(
        commandNames = "abort",
        commandDescriptionKey = "command.transaction-abort",
        resourceBundle = "com.asakusafw.operation.tools.directio.jcommander"
)
public class TransactionAbortCommand implements Runnable {

    static final Logger LOG = LoggerFactory.getLogger(TransactionAbortCommand.class);

    @ParametersDelegate
    final HelpParameter helpParameter = new HelpParameter();

    @ParametersDelegate
    final VerboseParameter verboseParameter = new VerboseParameter();

    @ParametersDelegate
    final OutputParameter outputParameter = new OutputParameter();

    @ParametersDelegate
    final TransactionEditorParameter transactionEditorParameter = new TransactionEditorParameter();

    @ParametersDelegate
    final TransactionIdParameter transactionIdParameter = new TransactionIdParameter();

    @Parameter(
            names = { "-f", "--force" },
            descriptionKey = "parameter.force-abort")
    boolean force;

    @Parameter(
            names = { "-q", "--quiet" },
            descriptionKey = "parameter.quiet-abort")
    boolean quiet;

    @Override
    public void run() {
        LOG.debug("starting {}", getClass().getSimpleName());

        String id = transactionIdParameter.getId();
        TransactionInfo info = transactionEditorParameter.find(id)
                .orElse(null);
        if (info == null) {
            if (quiet) {
                return;
            }
            throw new CommandConfigurationException(MessageFormat.format(
                    "transaction \"{0}\" not found (may be already completed)",
                    id));
        } else if (info.isCommitted()) {
            if (force == false) {
                if (quiet) {
                    return;
                }
                throw new CommandConfigurationException(MessageFormat.format(
                        "transaction \"{0}\" is already committed (add \"--force\" to abort this transaction)",
                        id));
            }
        }

        DirectIoTransactionEditor editor = transactionEditorParameter.getEditor();
        try (PrintWriter writer = outputParameter.open()) {
            verboseParameter.printf(writer, "abort transaction%n");
            verboseParameter.ifRequired(() -> TransactionShowCommand.print(writer, info, 0));
            if (editor.abort(id) == false) {
                throw new CommandExecutionException(MessageFormat.format(
                        "cannot abort transaction \"{0}\" (see the above log message)",
                        id));
            }
        } catch (IOException | InterruptedException e) {
            throw new CommandExecutionException(MessageFormat.format(
                    "cannot abort transaction \"{0}\" (see the causal exception message)",
                    id), e);
        }
    }
}


text:
package org.onetwo.boot.module.qrcode;

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Hashtable;

import org.onetwo.common.exception.BaseException;
import org.onetwo.common.file.FileUtils;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;

public class QRCodeCreator {
	private String charset = "utf-8";
    private String content;
    // 二维码尺寸
    private int size = 300;
    private String format = "png";

    public QRCodeCreator(String content) {
		super();
		this.content = content;
	}

	public QRCodeCreator(String content, int size) {
		super();
		this.content = content;
		this.size = size;
	}

	public void writeTo(String targetPath) {
		File file = new File(targetPath);
		BufferedImage bufImg = toImage();
		FileUtils.writeToFile(bufImg, format, file);
	}

	public byte[] toByteArray() {
		BufferedImage bufImg = toImage();
		return FileUtils.toByteArray(bufImg, format);
	}

    public BufferedImage toImage() {
        Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
        hints.put(EncodeHintType.CHARACTER_SET, charset);
        hints.put(EncodeHintType.MARGIN, 1);
        BitMatrix bitMatrix = null;
        try {
            bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, size, size,
                    hints);
        } catch (WriterException e) {
            throw new BaseException("create qrcode error: " + e.getMessage(), e);
        }
        int width = bitMatrix.getWidth();
        int height = bitMatrix.getHeight();
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF);
            }
        }
        return image;
    }

	public void setCharset(String charset) {
		this.charset = charset;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getFormat() {
		return format;
	}

}