text:
function visualizeOverviewTestComparisonRetinaVsCortex( paramRetinaTest,paramCortexTest )
%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here
load(paramRetinaTest.cmSource);
display('Overview Training vs. Test Comparison');
figure('position', [1 1 1600 785]);
hold on;
% DEBUG
% load([paramCortexTest.dataFolder paramCortexTest.outputSubfolder  paramCortexTest.affMaps(1).name filesep 'seg' num2str(0) '-' num2str(1) '-' num2str(1) '.mat'], 'segmentation');
% evalBefore = evaluateSegCortex(segmentation, paramCortexTest.skel, 2);
% evalAfter = evaluateSegCortex(segmentation, paramCortexTest2.skel, 2);
% DEBUG END
[a,b,c] = plotParamRetina(paramRetinaTest, autoKLEE_colormap(1,:));
[d,e,f] = plotParamCortex(paramCortexTest, autoKLEE_colormap(2,:));
xlabel('average distance between merger [nm]');
ylabel('average distance between splits [nm]');
zlabel('# objects');
grid on;
legend([a b c d e f], 'test retina node threshold 1', 'test retina node threshold 2', 'test retina node threshold 3' ...
    , 'test cortex node threshold 1', 'test cortex node threshold 2', 'test cortex node threshold 3');
set(gca, 'XScale', 'log');
set(gca, 'YScale', 'log');
saveas(gcf, [paramRetinaTest.dataFolder paramRetinaTest.figureSubfolder '/overviewComparison.fig']);

function [u,v,w] = plotParamRetina(param, color)
    marker = {'+' 'o' 'x'};
    for r=1:2
        for algo=2
            aa = load([param.dataFolder param.outputSubfolder  param.affMaps(1).name filesep 'seg' num2str(r) '-' num2str(algo) '.mat'], 'v');
            eval1 = evaluateSeg(aa.v, param.skel, 1);
            eval2 = evaluateSeg(aa.v, param.skel, 2);
            eval3 = evaluateSeg(aa.v, param.skel, 3);
            for i=1:size(aa.v,1)
                for j=1:size(aa.v,2)
                    u = plot3(param.totalPathLength./max([eval1.merge(i,j,1).sum],1), param.totalPathLength./[eval1.split(i,j,1).sum], [eval1.general(i,j,1).maxNrObjects],...
                        marker{1}, 'MarkerEdgeColor', color, 'MarkerSize', 5);
                    v = plot3(param.totalPathLength./max([eval2.merge(i,j,1).sum],1), param.totalPathLength./[eval2.split(i,j,1).sum], [eval2.general(i,j,1).maxNrObjects],...
                        marker{2}, 'MarkerEdgeColor', color, 'MarkerSize', 5);
                    w = plot3(param.totalPathLength./max([eval3.merge(i,j,1).sum],1), param.totalPathLength./[eval3.split(i,j,1).sum], [eval3.general(i,j,1).maxNrObjects],...
                        marker{3}, 'MarkerEdgeColor', color, 'MarkerSize', 5);
                end
            end
        end
    end
end

function [u, v, w] = plotParamCortex(param, color)
    marker = {'+' 'o' 'x'};
    paramCell = getParamCombinations(param.algo);
    for i=1:1%only first algo for cortex size(paramCell,2)
        for j=1:length(paramCell{i})
                display([num2str(j, '%.3i') ' of ' num2str(length(paramCell{i}), '%.3i')]);
                load([param.dataFolder param.outputSubfolder  param.affMaps(1).name filesep 'seg' num2str(0) '-' num2str(i) '-' num2str(j) '.mat'], 'segmentation');
                eval1 = evaluateSegCortex(segmentation, param.skel, 1);
                eval2 = evaluateSegCortex(segmentation, param.skel, 2);
                eval3 = evaluateSegCortex(segmentation, param.skel, 3);
                u = plot3(param.totalPathLength./max([eval1.merge.sum],1), param.totalPathLength./[eval1.split.sum], [eval1.general.maxNrObjects],...
                    marker{1}, 'MarkerEdgeColor', color, 'MarkerSize', 5);
                v = plot3(param.totalPathLength./max([eval2.merge.sum],1), param.totalPathLength./[eval2.split.sum], [eval2.general.maxNrObjects],...
                    marker{2}, 'MarkerEdgeColor', color, 'MarkerSize', 5);
                w = plot3(param.totalPathLength./max([eval3.merge.sum],1), param.totalPathLength./[eval3.split.sum], [eval3.general.maxNrObjects],...
                    marker{3}, 'MarkerEdgeColor', color, 'MarkerSize', 5);
        end
    end
end

function [paramRetina,paramCortex] = equalizeSkeletons(paramRetina,paramCortex)
    for i=1:length(paramRetina.skel)
       paramRetina.nrNodes(i) = size(paramRetina.skel{i}.nodes,1);
    end
    paramRetina.density = paramRetina.totalPathLength./sum(paramRetina.nrNodes);
    display(['Statistics dense test retina:']);
    display([num2str(sum(paramRetina.nrNodes), '%.0i') ' nodes']);
    display([num2str(paramRetina.totalPathLength/1e6, '%.2f') ' path length [mm]']);
    display([num2str(paramRetina.density, '%.1f') ' path length per node [nm]']);
    display([num2str(paramRetina.totalPathLength/1e3/202, '%.2f') ' path length per volume [microns/microns^3]']);
    for i=1:length(paramCortex.skel)
       paramCortex.nrNodes(i) = size(paramCortex.skel{i}.nodes,1);
    end
    paramCortex.density = paramCortex.totalPathLength./sum(paramCortex.nrNodes);
    display(['Statistics dense test cortex before downsampling:']);
    display([num2str(sum(paramCortex.nrNodes), '%.0i') ' nodes']);
    display([num2str(paramCortex.totalPathLength/1e6, '%.2f') ' path length [mm]']);
    display([num2str(paramCortex.density, '%.1f') ' path length per node [nm]']);
    display([num2str(paramCortex.totalPathLength/1e3/95.5, '%.2f') ' path length per volume [microns/microns^3]']);
    fractionToDrop = 1 - paramCortex.density ./ paramRetina.density;
    fractionToDrop = 1.3*fractionToDrop;
    for i=1:length(paramCortex.skel)
        r = rand(size(paramCortex.skel{i}.nodes,1),1);
        toDel = r < fractionToDrop;
        paramCortex.skel{i} = removeNodes(paramCortex.skel{i}, toDel);
    end
    paramCortex.totalPathLength = getPathLength(paramCortex.skel);
    for i=1:length(paramCortex.skel)
       paramCortex.nrNodes(i) = size(paramCortex.skel{i}.nodes,1);
    end
    paramCortex.density = paramCortex.totalPathLength./sum(paramCortex.nrNodes);
    display(['Statistics dense test cortex after downsampling:']);
    display([num2str(sum(paramCortex.nrNodes), '%.0i') ' nodes']);
    display([num2str(paramCortex.totalPathLength/1e6, '%.2f') ' path length [mm]']);
    display([num2str(paramCortex.density, '%.1f') ' path length per node [nm]']);
    display([num2str(paramCortex.totalPathLength/1e3/95.5, '%.2f') ' path length per volume [microns/microns^3]']);
end

function skel = removeNodes(skel, toDel)
    ids = 1:size(skel.nodes,1);
    skel.nodes(toDel,:) = [];
    idsToDel = ids(toDel);
    idsToKeep = ids(~toDel);
    for i=1:length(idsToDel)
        edgesToDel = skel.edges == idsToDel(i);
        [row,col] = find(edgesToDel);
        col(col==2) = 0;
        col = col + 1;
        idsToJoin = skel.edges(row,col);
        idsToJoin = idsToJoin(:);
        idsToJoin(idsToJoin == idsToDel(i)) = [];
        idsToJoin = unique(idsToJoin);
        skel.edges(row,:) = [];
        for j=2:length(idsToJoin)
                skel.edges(end+1,:) = [idsToJoin(1) idsToJoin(j)];
        end
    end
    for i=1:length(idsToKeep)
        skel.edges(skel.edges == idsToKeep(i)) = i;
    end
end
end


text:
package org.onosproject.cli.net;

import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.net.Device;
import org.onosproject.net.behaviour.InterfaceConfig;
import org.onosproject.net.device.DeviceInterfaceDescription;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.driver.DriverHandler;
import org.onosproject.net.driver.DriverService;

import java.util.List;

import static org.onosproject.net.DeviceId.deviceId;

/**
 * Lists all interfaces or interfaces of a device.
 */
@Command(scope = "onos", name = "device-interfaces",
        description = "Lists all interfaces or interfaces of a device.")
public class DeviceInterfacesListCommand extends DevicesListCommand {
    private static final String FORMAT = "%s";
    private static final String MODE_FORMAT = " mode=";
    private static final String ACCESS_MODE = "access";
    private static final String TRUNK_MODE = "trunk";
    private static final String VLAN_FORMAT = " vlan=";
    private static final String LIMIT_FORMAT = " rate-limit=";
    private static final String ERROR_RESULT = "Cannot retrieve interfaces for device";
    private static final String NO_INTERFACES = "No interfaces found";
    private static final String PERCENT = "%%";

    @Argument(index = 0, name = "uri", description = "Device ID",
            required = false, multiValued = false)
    private String uri = null;

    @Override
    protected void execute() {
        DeviceService deviceService = get(DeviceService.class);
        DriverService driverService = get(DriverService.class);

        if (uri == null) {
            // No specific device, so all devices will be examined.
            for (Device device : getSortedDevices(deviceService)) {
                printDevice(deviceService, driverService, device);
            }
        } else {
            Device device = deviceService.getDevice(deviceId(uri));
            printDevice(deviceService, driverService, device);
        }
    }

    private void printDevice(DeviceService deviceService,
                             DriverService driverService,
                             Device device) {
        super.printDevice(deviceService, device);
        if (!device.is(InterfaceConfig.class)) {
            // The relevant behavior is not supported by the device.
            print(ERROR_RESULT);
            return;
        }
        DriverHandler h = driverService.createHandler(device.id());
        InterfaceConfig interfaceConfig = h.behaviour(InterfaceConfig.class);

        List<DeviceInterfaceDescription> interfaces =
                interfaceConfig.getInterfaces(device.id());
        if (interfaces == null) {
            print(ERROR_RESULT);
        } else if (interfaces.isEmpty()) {
            print(NO_INTERFACES);
        } else {
            interfaces.forEach(this::printInterface);
        }
    }

    private void printInterface(DeviceInterfaceDescription intf) {
        StringBuilder formatStringBuilder = new StringBuilder(FORMAT);

        if (intf.mode().equals(DeviceInterfaceDescription.Mode.ACCESS)) {
            formatStringBuilder.append(MODE_FORMAT)
                    .append(ACCESS_MODE)
                    .append(VLAN_FORMAT);
            formatStringBuilder.append(intf.vlans().get(0).toString());
        } else if (intf.mode().equals(DeviceInterfaceDescription.Mode.TRUNK)) {
            formatStringBuilder.append(MODE_FORMAT)
                    .append(TRUNK_MODE)
                    .append(VLAN_FORMAT);
            for (int i = 0; i < intf.vlans().size(); i++) {
                formatStringBuilder.append(intf.vlans().get(i));
                if (i != intf.vlans().size() - 1) {
                    formatStringBuilder.append(",");
                }
            }
        }

        if (intf.isRateLimited()) {
            formatStringBuilder.append(LIMIT_FORMAT);
            formatStringBuilder.append(intf.rateLimit());
            formatStringBuilder.append(PERCENT);
        }

        print(formatStringBuilder.toString(), intf.name());
    }
}

redpajama_set_name: RedPajamaGithub


text:
        {% if posts.has_prev %}

Earlier posts

        {% else %}

No earlier posts

        {% endif %}
        {% if posts.has_next %}

Later posts

        {% else %}

No later posts

        {% endif %}


text:
namespace DD.CBU.Compute.Api.Contracts.Requests.Network20
{
    using System;

    /// <summary>A firewall rule list options model. </summary>
    public class FirewallRuleListOptions : FilterableRequest
    {
        /// <summary>
        /// The "id" field name.
        /// </summary>
        public const string IdField = "id";

        /// <summary>
        /// The "networkDomainId" field name.
        /// </summary>
        public const string NetworkDomainIdField = "networkDomainId";

        /// <summary>
        /// The "name" field name.
        /// </summary>
        public const string NameField = "name";

        /// <summary>
        /// The "state" field name.
        /// </summary>
        public const string StateField = "state";

        /// <summary>
        /// The "createTime" field name.
        /// </summary>
        public const string CreateTimeField = "createTime";

        /// <summary>
        /// Filter by identifier.
        /// </summary>
        public Guid? Id
        {
            get { return GetFilter<Guid?>(IdField); }
            set { SetFilter(IdField, value); }
        }

        /// <summary>
        /// Filter by Network Domain.
        /// </summary>
        public Guid NetworkDomainId
        {
            get { return GetFilter<Guid>(NetworkDomainIdField); }
            set { SetFilter(NetworkDomainIdField, value); }
        }

        /// <summary>
        /// Filter by their name.
        /// </summary>
        public string Name
        {
            get { return GetFilter<string>(NameField); }
            set { SetFilter(NameField, value); }
        }

        /// <summary>
        /// Filter by their state.
        /// Case insensitive. The initial possible set of values for state are:
        /// "NORMAL",
        /// "PENDING_ADD",
        /// "PENDING_CHANGE",
        /// "PENDING_DELETE",
        /// "FAILED_ADD",
        /// "FAILED_CHANGE",
        /// "FAILED_DELETE" and
        /// "REQUIRES_SUPPORT".
        /// </summary>
        public string State
        {
            get { return GetFilter<string>(StateField); }
            set { SetFilter(StateField, value); }
        }
    }
}


text:
package com.mycompany.myproj.beans;

public class MySimpleBean {

}


text:
easing.sine = {
  /**
   * Easing equation function for a sinusoidal (sin(t))
   * easing in: accelerating from zero velocity.
   * @param {number} t  Current time (in frames or seconds).
   * @param {number} b  Starting value.
   * @param {number} c  Change needed in value.
   * @param {number} d  Expected easing duration (in frames or seconds).
   * @return {number}   The correct value.
   */
  easeIn: function (t, b, c, d) {
    return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  },

  /**
   * Easing equation function for a sinusoidal (sin(t))
   * easing out: decelerating from zero velocity.
   * @param {number} t  Current time (in frames or seconds).
   * @param {number} b  Starting value.
   * @param {number} c  Change needed in value.
   * @param {number} d  Expected easing duration (in frames or seconds).
   * @return {number}   The correct value.
   */
  easeOut: function (t, b, c, d) {
    return c * Math.sin(t/d * (Math.PI/2)) + b;
  },

  /**
   * Easing equation function for a sinusoidal (sin(t))
   * easing in/out: acceleration until halfway, then deceleration.
   * @param {number} t  Current time (in frames or seconds).
   * @param {number} b  Starting value.
   * @param {number} c  Change needed in value.
   * @param {number} d  Expected easing duration (in frames or seconds).
   * @return {number}   The correct value.
   */
  easeInOut: function (t, b, c, d) {
    return -c/2 * (Math.cos(Math.PI * t/d) - 1) + b;
  },

  /**
   * Easing equation function for a sinusoidal (sin(t))
   * easing out/in: deceleration until halfway, then acceleration.
   * @param {number} t  Current time (in frames or seconds).
   * @param {number} b  Starting value.
   * @param {number} c  Change needed in value.
   * @param {number} d  Expected easing duration (in frames or seconds).
   * @return {number}   The correct value.
   */
  easeOutIn: function (t, b, c, d) {
    if (t < d/2) {
      return easing.sine.easeOut(t * 2, b, c/2, d);
    } else {
      return easing.sine.easeIn((t * 2) - d, b + c/2, c/2, d);
    }
  }
};


text:
module Main where

import Prelude hiding (Either(..))

import GameInput
import GameState
import GameRenderer

main :: IO ()
main = do
  let gs = GameStatus {runStatus = Init, board = emptyBoard}
  initializePainter "Game of Life"
  drawGame gs inputInstructions
  gameLoop gs

gameLoop :: GameStatus -> IO ()
gameLoop gs = do
  input <- getInput
  case input of
    Quit -> quitWithMessage
    _ -> handleInput gs input

handleInput :: GameStatus -> Input -> IO ()
handleInput gs input = case input of
    Up      -> upAction gs
    Down    -> downAction gs
    Right   -> rightAction gs
    Left    -> leftAction gs
    Liven   -> livenAction gs
    Dead    -> deadAction gs
    Start   -> runSimulation gs
    _       -> gameLoop gs

upAction :: GameStatus -> IO ()
upAction gs = do
  curUp
  let updatedBoard = moveUp (board gs)
  let ngs = gs {board = updatedBoard}
  gameLoop ngs

downAction :: GameStatus -> IO ()
downAction gs = do
  curDown
  let updatedBoard = moveDown (board gs)
  let ngs = gs {board = updatedBoard}
  gameLoop ngs

rightAction :: GameStatus -> IO ()
rightAction gs = do
  curRight
  let updatedBoard = moveForward (board gs)
  let ngs = gs {board = updatedBoard}
  gameLoop ngs

leftAction :: GameStatus -> IO ()
leftAction gs = do
  curLeft
  let updatedBoard = moveBackward (board gs)
  let ngs = gs {board = updatedBoard}
  gameLoop ngs

livenAction :: GameStatus -> IO ()
livenAction gs = do
  drawLiveCell
  let updatedBoard = makeLive b curPos
  let ub = moveForward updatedBoard
  let ngs = gs {board = ub}
  gameLoop ngs
  where b = board gs
        curPos = currentPos b

deadAction :: GameStatus -> IO ()
deadAction gs = do
  drawDeadCell
  let updatedBoard = makeDead b curPos
  let ub = moveForward updatedBoard
  let ngs = gs {board = ub}
  gameLoop ngs
  where b = board gs
        curPos = currentPos b

quitWithMessage :: IO ()
quitWithMessage = quit "Thanks for playing!!"

runSimulation :: GameStatus -> IO ()
runSimulation gs = do
  drawGame gs inputInstructions
  pause
  let nb = stepBoard (board gs)
  let ngs = gs {board = nb}
  handleCharPress 'q' quitWithMessage (runSimulation ngs)


text:
@annotate: folktale.maybe.Just.prototype.concat
@annotate: folktale.maybe.Nothing.prototype.concat
category: Combining
---

Combines two maybes such that if they both have values (are a `Just`) their values
are concatenated. Maybe values are expected to be Fantasy Land 1.x semigroups and
implement a `concat` method.

## Example::

    const Maybe = require('folktale/maybe');

    Maybe.Just([1]).concat(Maybe.Just([2]));
    // ==> Maybe.Just([1, 2])

    Maybe.Just([1]).concat(Maybe.Nothing());
    // ==> Maybe.Just([1])

    Maybe.Nothing().concat(Maybe.Nothing());
    // ==> Maybe.Nothing()


text:
package com.devplant.basics.security.model;

import java.util.List;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@Entity
@Table(name = "users")
@NoArgsConstructor
@AllArgsConstructor
public class User {

    @Id
    @Column(name = "username")
    private String username;

    @Column(name = "password")
    private String password;

    @Column(name = "enabled")
    private boolean enabled = true;

    @ElementCollection
    @CollectionTable(
            name = "roles",
            joinColumns = @JoinColumn(name = "username")
    )
    @Column(name = "role")
    private List<String> roles;

}


text:
import Bottleneck from 'bottleneck';

/** Concurrency presets based on some basic benchmarking & common-sense. */
export const npmPublishConcurrencyPreset = 6;
export const fsConcurrencyPreset = 6;
export const githubConcurrencyPreset = 16;

/**
 * When running a batch process, return two collections: one of successful runs
 * that completed without throwing an exception, and one where an exception
 * occurred.
 */
export interface BatchProcessResponse<T, V> {
  successes: Map<T, V>;
  failures: Map<T, Error>;
}

/**
 * Run some function of work over each item in an array (where the function is
 * called with each item as an argument). Group the results by successes an
 * failures based on whether an exception was thrown by that function.
 */
export async function batchProcess<T, V>(
    items: T[], fn: (repo: T) => Promise<V>, options?: {concurrency: number}):
    Promise<BatchProcessResponse<T, V>> {
  const concurrency = (options && options.concurrency) || 0;
  const rateLimitter = new Bottleneck(concurrency);
  const successRuns = new Map<T, V>();
  const failRuns = new Map<T, Error>();

  await Promise.all(items.map((item) => {
    return rateLimitter.schedule(fn, item).then(
        (result: any) => {
          successRuns.set(item, result);
        },
        (err: Error) => {
          failRuns.set(item, err);
        });
  }));
  return {successes: successRuns, failures: failRuns};
}

/**
 * A generic function interface, useful for extending the batchProcess generic
 * function signature.
 * See: https://www.typescriptlang.org/docs/handbook/generics.html
 */
export interface BatchProcessFn<T, V = any> {
  (items: T[], fn: (repo: T) => Promise<V>,
   options?: {concurrency: number}): Promise<BatchProcessResponse<T, V>>;
}


text:
package private

import (
	"encoding/json"
	"strings"

	"code.gitea.io/git"
	"code.gitea.io/gitea/models"
	"code.gitea.io/gitea/modules/log"

	macaron "gopkg.in/macaron.v1"
)

// PushUpdate update public key updates
func PushUpdate(ctx *macaron.Context) {
	var opt models.PushUpdateOptions
	if err := json.NewDecoder(ctx.Req.Request.Body).Decode(&opt); err != nil {
		ctx.JSON(500, map[string]interface{}{
			"err": err.Error(),
		})
		return
	}

	branch := strings.TrimPrefix(opt.RefFullName, git.BranchPrefix)
	if len(branch) == 0 || opt.PusherID <= 0 {
		ctx.Error(404)
		log.Trace("PushUpdate: branch or secret is empty, or pusher ID is not valid")
		return
	}

	repo, err := models.PushUpdate(opt)
	if err != nil {
		ctx.JSON(500, map[string]interface{}{
			"err": err.Error(),
		})
		return
	}

	pusher, err := models.GetUserByID(opt.PusherID)
	if err != nil {
		if models.IsErrUserNotExist(err) {
			ctx.Error(404)
		} else {
			ctx.JSON(500, map[string]interface{}{
				"err": err.Error(),
			})
		}
		return
	}

	log.Trace("TriggerTask '%s/%s' by %s", repo.Name, branch, pusher.Name)

	go models.HookQueue.Add(repo.ID)
	go models.AddTestPullRequestTask(pusher, repo.ID, branch, true)
	ctx.Status(202)
}


text:
.. _glossary:

Glossary
========

.. glossary::

    Cache Regions
        Bundles of configuration options keyed to a user-defined variable
        for use with the :meth:`beaker.cache.CacheManager.region`
        decorator.

    Container
        A Beaker container is a storage object for a specific cache value
        and the key under the namespace it has been assigned.

    Dog-Pile Effect
        What occurs when a cached object expires, and multiple requests to
        fetch it are made at the same time. In systems that don't lock or
        use a scheme to prevent multiple instances from simultaneously
        creating the same thing, every request will cause the system to
        create a new value to be cached.

        Beaker alleviates this with file locking to ensure that only a single
        copy is re-created while other requests for the same object are
        instead given the old value until the new one is ready.

    NamespaceManager
        A Beaker namespace manager, is best thought of as a collection of
        containers with various keys. For example, a single template to be
        cached might vary slightly depending on search term, or user login, so
        the template would be keyed based on the variable that changes its
        output.

        The namespace would be the template name, while each container would
        correspond to one of the values and the key it responds to.


text:
package pl.consdata.ico.sqcompanion.sync;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * @author pogoma
 */
@Entity(name = "synchronization")
@Table
@Data
@Builder
@RequiredArgsConstructor
@AllArgsConstructor
@SequenceGenerator(name = "synchronization_id_seq", sequenceName = "synchronization_id_seq", allocationSize = 1)
public class SynchronizationStateEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "synchronization_id_seq")
    private Long id;
    @NotNull
    private Long startTimestamp;
    private Long finishTimestamp;
    private Long allTasks;
    private Long finishedTasks;
    private Long failedTasks;
    private Long duration;

}


text:
<?php
/**
 * PSHD utility wrapper
 * @example http://pshd.lazos.me/example/
 * @author Lajos Bencz <lazos@lazos.me>
 */

namespace PSHD;

/**
 * Exception thrown by PSHD methods
 * Class Exception
 * @package PSHD
 */
class Exception extends \Exception
{

	/**
	 * @var array
	 */
	protected $_parameters = array();

	/**
	 * Get parameters of SQL query
	 * @return array
	 */
	public function getParameters()
	{
		return $this->_parameters;
	}

	/**
	 * @param string $message Error message
	 * @param int $code Error code
	 * @param \Exception $exception Inner exception
	 * @param array $parameters Query parameters
	 */
	public function __construct($message = "", $code = 0, $exception = null, $parameters = array())
	{
		if (strlen($message) < 1 && is_object($exception)) {
			$message = $exception->getMessage();
			ob_start();
			var_dump($exception->getTrace());
			$message .= ob_get_clean();
		}
		$this->_parameters = $parameters;
		parent::__construct($message, $code, $exception);
	}

	/**
	 * @return string
	 */
	public function __toString()
	{
		$s = parent::__toString();
		if (count($this->_parameters) > 0) {
			ob_start();
			var_dump($this->_parameters);
			$s .= ob_get_clean();
		}
		return $s;
	}
}


text:
package main

import (
	"testing"
)

// This is just a dummy test function to have a base to start with for Travis
func Test_dummy(t *testing.T) {
	t.Log("Dummy test passed")
}


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

import io.prestosql.parquet.Field;
import it.unimi.dsi.fastutil.booleans.BooleanArrayList;
import it.unimi.dsi.fastutil.booleans.BooleanList;

import static io.prestosql.parquet.ParquetTypeUtils.isValueNull;

public final class StructColumnReader
{
    private StructColumnReader() {}

    /**
     * Each struct has three variants of presence:
     * 1) Struct is not defined, because one of it's optional parent fields is null
     * 2) Struct is null
     * 3) Struct is defined and not empty.
     */
    public static BooleanList calculateStructOffsets(
            Field field,
            int[] fieldDefinitionLevels,
            int[] fieldRepetitionLevels)
    {
        int maxDefinitionLevel = field.getDefinitionLevel();
        int maxRepetitionLevel = field.getRepetitionLevel();
        BooleanList structIsNull = new BooleanArrayList();
        boolean required = field.isRequired();
        if (fieldDefinitionLevels == null) {
            return structIsNull;
        }
        for (int i = 0; i < fieldDefinitionLevels.length; i++) {
            if (fieldRepetitionLevels[i] <= maxRepetitionLevel) {
                if (isValueNull(required, fieldDefinitionLevels[i], maxDefinitionLevel)) {
                    // Struct is null
                    structIsNull.add(true);
                }
                else if (fieldDefinitionLevels[i] >= maxDefinitionLevel) {
                    // Struct is defined and not empty
                    structIsNull.add(false);
                }
            }
        }
        return structIsNull;
    }
}


text:
from __future__ import print_function
import os
import sys
import time

import google.auth.credentials
from google.auth.environment_vars import CREDENTIALS as TEST_CREDENTIALS

# From shell environ. May be None.
CREDENTIALS = os.getenv(TEST_CREDENTIALS)

ENVIRON_ERROR_MSG = """\
To run the system tests, you need to set some environment variables.
Please check the CONTRIBUTING guide for instructions.
"""

class EmulatorCreds(google.auth.credentials.Credentials):
    """A mock credential object.

    Used to avoid unnecessary token refreshing or reliance on the network
    while an emulator is running.
    """

    def __init__(self):  # pylint: disable=super-init-not-called
        self.token = b'seekrit'
        self.expiry = None

    @property
    def valid(self):
        """Would-be validity check of the credentials.

        Always is :data:`True`.
        """
        return True

    def refresh(self, unused_request):  # pylint: disable=unused-argument
        """Off-limits implementation for abstract method."""
        raise RuntimeError('Should never be refreshed.')

def check_environ():
    err_msg = None
    if CREDENTIALS is None:
        err_msg = '\nMissing variables: ' + TEST_CREDENTIALS
    elif not os.path.isfile(CREDENTIALS):
        err_msg = '\nThe %s path %r is not a file.' % (TEST_CREDENTIALS,
                                                       CREDENTIALS)

    if err_msg is not None:
        msg = ENVIRON_ERROR_MSG + err_msg
        print(msg, file=sys.stderr)
        sys.exit(1)

def unique_resource_id(delimiter='_'):
    """A unique identifier for a resource.

    Intended to help locate resources created in particular
    testing environments and at particular times.
    """
    build_id = os.getenv('CIRCLE_BUILD_NUM', '')
    if build_id == '':
        return '%s%d' % (delimiter, 1000 * time.time())
    else:
        return '%s%s%s%d' % (delimiter, build_id, delimiter, time.time())


text:
<?php

// debug & production
DEFINE ("IS_DEBUG", false);
DEFINE ("REVISTE_READY_FOR_PROD", array("Level", "Games 4 Kids", "Hobbyte''s", "Game Over"));

// site
DEFINE ("SITE_NAME"  , "Arhiva Reviste Vechi");
DEFINE ("SITE_TAG"   , "No gods or kings. Only man.");
DEFINE ("SEARCH_HINT", "I'm looking for 30 dead guys and one woman.");

// arhiva
DEFINE ("ARHIVA"    , ROOT . "/arhiva");
DEFINE ("ARHIVABITS", ARHIVA . "/bits");

// lib
DEFINE ("LIB"       , ROOT ."/lib");
DEFINE ("HELPERS"   , LIB ."/helpers");

// html + css
DEFINE ("HTMLLIB"   , ROOT ."/html");
DEFINE ("CSSLIB"    , HTMLLIB ."/css");
DEFINE ("HTMLBITS"  , HTMLLIB ."/bits");
DEFINE ("HTMLSTATIC", HTMLLIB ."/static");

// resources
DEFINE ("RESOURCES" , ROOT . "/resources");
DEFINE ("TEMPL"     , RESOURCES ."/templates");
DEFINE ("IMG"       , RESOURCES ."/img");

// cache
DEFINE ("CACHE_DIR" , ROOT . "/cache");

// db
DEFINE ("DB_DIR"    , RESOURCES . "/db");
DEFINE ("DB_FILE"   , DB_DIR . "/arhiva_reviste_v6.db");

require_once DB_DIR . "/DBC.php";
use ArhivaRevisteVechi\resources\db\DBC;
$db = new DBC(DB_FILE);

// coperti default
DEFINE ("COPERTI_DIR"    , IMG . "/coperti");
DEFINE ("COPERTA_DEFAULT", IMG . "/coperti/default.jpg");
DEFINE ("THUMB_DEFAULT"  , IMG . "/coperti/default_th.jpg");

// external links
DEFINE ("RVWIKI_BASE_LINK"         , "https://revistevechi.awiki.org");
DEFINE ("KNOWN_FILE_HOSTS", array(
    "archive" => "Archive.org",
    "scribd" => "Scribd",
    "mediafire" => "Mediafire",
    "imgur" => "Imgur"));


text:
.. only:: not (epub or latex or html)

    WARNING: You are looking at unreleased Cilium documentation.
    Please use the official rendered version released here:
    https://docs.cilium.io

.. _local-redirect-policy:

*****************************
Local Redirect Policy (beta)
*****************************

This document explains how to configure Cilium's Local Redirect Policy, that
enables pod traffic destined to an IP address and port/protocol tuple
or Kubernetes service to be redirected locally to backend pod(s) within a node,
using eBPF. The namespace of backend pod(s) need to match with that of the policy.
The CiliumLocalRedirectPolicy is configured as a ``CustomResourceDefinition``.

.. admonition:: Video
  :class: attention

  Aside from this document, you can watch a video explanation of Cilium's Local Redirect Policy on `eCHO episode 39: Local Redirect Policy <https://www.youtube.com/watch?v=BT_gdlhjiQc&t=176s>`__.

There are two types of Local Redirect Policies supported. When traffic for a
Kubernetes service needs to be redirected, use the `ServiceMatcher` type. The
service needs to be of type ``clusterIP``.
When traffic matching IP address and port/protocol, that doesn't belong to
any Kubernetes service, needs to be redirected, use the `AddressMatcher` type.

The policies can be gated by Kubernetes Role-based access control (RBAC)
framework. See the official `RBAC documentation
<https://kubernetes.io/docs/reference/access-authn-authz/rbac/>`_.

When policies are applied, matched pod traffic is redirected. If desired, RBAC
configurations can be used such that application developers can not escape
the redirection.

.. include:: ../../beta.rst

Prerequisites
=============

.. note::

   Local Redirect Policy feature requires a v4.19.x or more recent Linux kernel.

.. include:: ../../installation/k8s-install-download-release.rst

The Cilium Local Redirect Policy feature relies on :ref:`kubeproxy-free`,
follow the guide to create a new deployment. The beta feature is disabled by default.
Enable the feature by setting the ``localRedirectPolicy`` value to ``true``.

.. parsed-literal::

   helm install cilium |CHART_RELEASE| \\
     --set localRedirectPolicy=true

Verify that Cilium agent pod is running.

.. code-block:: shell-session

    $ kubectl -n kube-system get pods -l k8s-app=cilium
    NAME           READY   STATUS    RESTARTS   AGE
    cilium-5ngzd   1/1     Running   0          3m19s

Validate that the Cilium Local Redirect Policy CRD has been registered.

.. code-block:: shell-session

	   $ kubectl get crds
	   NAME                              CREATED AT
	   [...]
	   ciliumlocalredirectpolicies.cilium.io              2020-08-24T05:31:47Z

Create backend and client pods
==============================

Deploy a backend pod where traffic needs to be redirected to based on the
configurations specified in a CiliumLocalRedirectPolicy. The metadata
labels and container port and protocol respectively match with the labels,
port and protocol fields specified in the CiliumLocalRedirectPolicy custom
resources that will be created in the next step.

.. literalinclude:: ../../../examples/kubernetes-local-redirect/backend-pod.yaml

.. parsed-literal::

    $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes-local-redirect/backend-pod.yaml

Verify that the pod is running.

.. code-block:: shell-session

    $ kubectl get pods | grep lrp-pod
    lrp-pod                      1/1     Running   0          46s

Deploy a client pod that will generate traffic which will be redirected based on
the configurations specified in the CiliumLocalRedirectPolicy.

.. parsed-literal::

    $ kubectl create -f \ |SCM_WEB|\/examples/kubernetes-dns/dns-sw-app.yaml
    $ kubectl get po
    NAME                             READY   STATUS    RESTARTS   AGE
    pod/mediabot                     1/1     Running   0          14s

Create Cilium Local Redirect Policy Custom Resources
=====================================================
There are two types of configurations supported in the CiliumLocalRedirectPolicy
in order to match the traffic that needs to be redirected.

.. _AddressMatcher:

AddressMatcher
---------------

This type of configuration is specified using an IP address and a Layer 4 port/protocol.
When multiple ports are specified for frontend in ``toPorts``, the ports need
to be named. The port names will be used to map frontend ports with backend ports.

Verify that the ports specified in ``toPorts`` under ``redirectBackend``
exist in the backend pod spec.

The example shows how to redirect from traffic matching, IP address ``169.254.169.254``
and Layer 4 port ``8080`` with protocol ``TCP``, to a backend pod deployed with
labels ``app=proxy`` and Layer 4 port ``80`` with protocol ``TCP``. The
``localEndpointSelector`` set to ``app=proxy`` in the policy is used to select
the backend pods where traffic is redirected to.

Create a custom resource of type CiliumLocalRedirectPolicy with ``addressMatcher``
configuration.

.. literalinclude:: ../../../examples/kubernetes-local-redirect/lrp-addrmatcher.yaml

.. parsed-literal::

    $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes-local-redirect/lrp-addrmatcher.yaml

Verify that the custom resource is created.

.. code-block:: shell-session

    $ kubectl get ciliumlocalredirectpolicies | grep lrp-addr
    NAME           AGE
    lrp-addr       20h

Verify that Cilium's eBPF kube-proxy replacement created a ``LocalRedirect``
service entry with the backend IP address of that of the ``lrp-pod`` that was
selected by the policy. Make sure that ``cilium service list`` is run
in Cilium pod running on the same node as ``lrp-pod``.

.. code-block:: shell-session

    $ kubectl describe pod lrp-pod  | grep 'IP:'
    IP:           10.16.70.187

.. code-block:: shell-session

    $ kubectl exec -it -n kube-system cilium-5ngzd -- cilium service list
    ID   Frontend               Service Type   Backend
    [...]
    4    172.20.0.51:80         ClusterIP      1 => 10.16.70.187:80

Invoke a curl command from the client pod to the IP address and port
configuration specified in the ``lrp-addr`` custom resource above.

.. code-block:: shell-session

    $ kubectl exec mediabot -- curl -I -s http://169.254.169.254:8080/index.html
    HTTP/1.1 200 OK
    Server: nginx/1.19.2
    Date: Fri, 28 Aug 2020 01:33:34 GMT
    Content-Type: text/html
    Content-Length: 612
    Last-Modified: Tue, 11 Aug 2020 14:50:35 GMT
    Connection: keep-alive
    ETag: "5f32b03b-264"
    Accept-Ranges: bytes

Verify that the traffic was redirected to the ``lrp-pod`` that was deployed.
``tcpdump`` should be run on the same node that ``lrp-pod`` is running on.

.. code-block:: shell-session

    $ sudo tcpdump -i any -n port 80
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
    01:36:24.608566 IP 10.16.215.55.60876 > 10.16.70.187.80: Flags [S], seq 2119454273, win 28200, options [mss 1410,sackOK,TS val 2541637677 ecr 0,nop,wscale 7], length 0
    01:36:24.608600 IP 10.16.70.187.80 > 10.16.215.55.60876: Flags [S.], seq 1315636594, ack 2119454274, win 27960, options [mss 1410,sackOK,TS val 2962246962 ecr 2541637677,nop,wscale 7], length 0
    01:36:24.608638 IP 10.16.215.55.60876 > 10.16.70.187.80: Flags [.], ack 1, win 221, options [nop,nop,TS val 2541637677 ecr 2962246962], length 0
    01:36:24.608867 IP 10.16.215.55.60876 > 10.16.70.187.80: Flags [P.], seq 1:96, ack 1, win 221, options [nop,nop,TS val 2541637677 ecr 2962246962], length 95: HTTP: HEAD /index.html HTTP/1.1
    01:36:24.608876 IP 10.16.70.187.80 > 10.16.215.55.60876: Flags [.], ack 96, win 219, options [nop,nop,TS val 2962246962 ecr 2541637677], length 0
    01:36:24.609007 IP 10.16.70.187.80 > 10.16.215.55.60876: Flags [P.], seq 1:239, ack 96, win 219, options [nop,nop,TS val 2962246962 ecr 2541637677], length 238: HTTP: HTTP/1.1 200 OK
    01:36:24.609052 IP 10.16.215.55.60876 > 10.16.70.187.80: Flags [.], ack 239, win 229, options [nop,nop,TS val 2541637677 ecr 2962246962], length 0

.. _ServiceMatcher:

ServiceMatcher
---------------

This type of configuration is specified using Kubernetes service name and namespace
for which traffic needs to be redirected. The service must be of type ``clusterIP``.
When ``toPorts`` under ``redirectFrontend`` are not specified, traffic for
all the service ports will be redirected. However, if traffic destined to only
a subset of ports needs to be redirected, these ports need to be specified in the spec.
Additionally, when multiple service ports are specified in the spec, they must be
named. The port names will be used to map frontend ports with backend ports.
Verify that the ports specified in ``toPorts`` under ``redirectBackend``
exist in the backend pod spec. The ``localEndpointSelector`` set to ``app=proxy``
in the policy is used to select the backend pods where traffic is redirected to.

When a policy of this type is applied, the existing service entry
created by Cilium's eBPF kube-proxy replacement will be replaced with a new
service entry of type ``LocalRedirect``. This entry may only have node-local backend pods.

The example shows how to redirect from traffic matching ``my-service``, to a
backend pod deployed with labels ``app=proxy`` and Layer 4 port ``80``
with protocol ``TCP``. The ``localEndpointSelector`` set to ``app=proxy`` in the
policy is used to select the backend pods where traffic is redirected to.

Deploy the Kubernetes service for which traffic needs to be redirected.

.. literalinclude:: ../../../examples/kubernetes-local-redirect/k8s-svc.yaml

.. parsed-literal::

    $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes-local-redirect/k8s-svc.yaml

Verify that the service is created.

.. code-block:: shell-session

    $ kubectl get service | grep 'my-service'
    my-service   ClusterIP   172.20.0.51   <none>        80/TCP     2d7h

Verify that Cilium's eBPF kube-proxy replacement created a ``ClusterIP``
service entry.

.. code-block:: shell-session

    $ kubectl exec -it -n kube-system ds/cilium -- cilium service list
    ID   Frontend               Service Type   Backend
    [...]
    4    172.20.0.51:80         ClusterIP

Create a custom resource of type CiliumLocalRedirectPolicy with ``serviceMatcher``
configuration.

.. literalinclude:: ../../../examples/kubernetes-local-redirect/lrp-svcmatcher.yaml

.. parsed-literal::

    $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes-local-redirect/lrp-svcmatcher.yaml

Verify that the custom resource is created.

.. code-block:: shell-session

    $ kubectl get ciliumlocalredirectpolicies | grep svc
    NAME               AGE
    lrp-svc   20h

Verify that entry Cilium's eBPF kube-proxy replacement updated the
service entry with type ``LocalRedirect`` and the node-local backend
selected by the policy. Make sure to run ``cilium service list`` in Cilium pod
running on the same node as ``lrp-pod``.

.. code-block:: shell-session

    $ kubectl exec -it -n kube-system cilium-5ngzd -- cilium service list
    ID   Frontend               Service Type       Backend
    [...]
    4    172.20.0.51:80         LocalRedirect      1 => 10.16.70.187:80

Invoke a curl command from the client pod to the Cluster IP address and port of
``my-service`` specified in the ``lrp-svc`` custom resource above.

.. code-block:: shell-session

    $ kubectl exec mediabot -- curl -I -s http://172.20.0.51/index.html
    HTTP/1.1 200 OK
    Server: nginx/1.19.2
    Date: Fri, 28 Aug 2020 01:50:50 GMT
    Content-Type: text/html
    Content-Length: 612
    Last-Modified: Tue, 11 Aug 2020 14:50:35 GMT
    Connection: keep-alive
    ETag: "5f32b03b-264"
    Accept-Ranges: bytes

Verify that the traffic was redirected to the ``lrp-pod`` that was deployed.
``tcpdump`` should be run on the same node that ``lrp-pod`` is running on.

.. code-block:: shell-session

    $ kubectl describe pod lrp-pod  | grep 'IP:'
    IP:           10.16.70.187

.. code-block:: shell-session

    $ sudo tcpdump -i any -n port 80
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
    01:36:24.608566 IP 10.16.215.55.60186 > 10.16.70.187.80: Flags [S], seq 2119454273, win 28200, options [mss 1410,sackOK,TS val 2541637677 ecr 0,nop,wscale 7], length 0
    01:36:24.608600 IP 10.16.70.187.80 > 10.16.215.55.60876: Flags [S.], seq 1315636594, ack 2119454274, win 27960, options [mss 1410,sackOK,TS val 2962246962 ecr 2541637677,nop,wscale 7], length 0
    01:36:24.608638 IP 10.16.215.55.60876 > 10.16.70.187.80: Flags [.], ack 1, win 221, options [nop,nop,TS val 2541637677 ecr 2962246962], length 0
    01:36:24.608867 IP 10.16.215.55.60876 > 10.16.70.187.80: Flags [P.], seq 1:96, ack 1, win 221, options [nop,nop,TS val 2541637677 ecr 2962246962], length 95: HTTP: HEAD /index.html HTTP/1.1
    01:36:24.608876 IP 10.16.70.187.80 > 10.16.215.55.60876: Flags [.], ack 96, win 219, options [nop,nop,TS val 2962246962 ecr 2541637677], length 0
    01:36:24.609007 IP 10.16.70.187.80 > 10.16.215.55.60876: Flags [P.], seq 1:239, ack 96, win 219, options [nop,nop,TS val 2962246962 ecr 2541637677], length 238: HTTP: HTTP/1.1 200 OK
    01:36:24.609052 IP 10.16.215.55.60876 > 10.16.70.187.80: Flags [.], ack 239, win 229, options [nop,nop,TS val 2541637677 ecr 2962246962], length 0

Limitations
===========
When you create a Local Redirect Policy, traffic for all the new connections
that get established after the policy is enforced will be redirected. But if
you have existing active connections to remote pods that match the configurations
specified in the policy, then these might not get redirected. To ensure all
such connections are redirected locally, restart the client pods after
configuring the CiliumLocalRedirectPolicy.

Local Redirect Policy updates are currently not supported. If there are any
changes to be made, delete the existing policy, and re-create a new one.

Use Cases
=========
Local Redirect Policy allows Cilium to support the following use cases:

Node-local DNS cache
--------------------
`DNS node-cache <https://github.com/kubernetes/dns>`_ listens on a static IP to intercept
traffic from application pods to the cluster's DNS service VIP by default, which will be
bypassed when Cilium is handling service resolution at or before the veth interface of the
application pod. To enable the DNS node-cache in a Cilium cluster, the following example
steers traffic to a local DNS node-cache which runs as a normal pod.

* Deploy DNS node-cache in pod namespace.

  .. tabs::

    .. group-tab:: Quick Deployment

        Deploy DNS node-cache.

        .. note::

           * The example yaml is populated with default values for ``__PILLAR_LOCAL_DNS__`` and
             ``__PILLAR_DNS_DOMAIN__``.
           * If you have a different deployment, please follow the official `NodeLocal DNSCache Configuration
             <https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/#configuration>`_
             to fill in the required template variables ``__PILLAR__LOCAL__DNS__``, ``__PILLAR__DNS__DOMAIN__``,
             and ``__PILLAR__DNS__SERVER__`` before applying the yaml.

        .. parsed-literal::

            $ wget \ |SCM_WEB|\/examples/kubernetes-local-redirect/node-local-dns.yaml

            $ kubedns=$(kubectl get svc kube-dns -n kube-system -o jsonpath={.spec.clusterIP}) && sed -i "s/__PILLAR__DNS__SERVER__/$kubedns/g;" node-local-dns.yaml

            $ kubectl apply -f node-local-dns.yaml

    .. group-tab:: Manual Configuration

         * Follow the official `NodeLocal DNSCache Configuration
           <https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/#configuration>`_
           to fill in the required template variables ``__PILLAR__LOCAL__DNS__``, ``__PILLAR__DNS__DOMAIN__``,
           and ``__PILLAR__DNS__SERVER__`` before applying the yaml.

         * Make sure to use a Node-local DNS image with a release version >= 1.15.16.
           This is to ensure that we have a knob to disable dummy network interface creation/deletion in
           Node-local DNS when we deploy it in non-host namespace.

         * Modify Node-local DNS cache's deployment yaml to pass these additional arguments to node-cache:
           ``-skipteardown=true``, ``-setupinterface=false``, and ``-setupiptables=false``.

         * Modify Node-local DNS cache's deployment yaml to put it in non-host namespace by setting
           ``hostNetwork: false`` for the daemonset.

         * In the Corefile, bind to ``0.0.0.0`` instead of the static IP.

         * In the Corefile, let CoreDNS serve health-check on its own IP instead of the static IP by
           removing the host IP string after health plugin.

         * Modify Node-local DNS cache's deployment yaml to point readiness probe to its own IP by
           removing the ``host`` field under ``readinessProbe``.

* Deploy Local Redirect Policy (LRP) to steer DNS traffic to the node local dns cache.

  .. parsed-literal::

      $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes-local-redirect/node-local-dns-lrp.yaml

  .. note::

      * The LRP above uses ``kube-dns`` for the cluster DNS service, however if your cluster DNS service is different,
        you will need to modify this example LRP to specify it.
      * The namespace specified in the LRP above is set to the same namespace as the cluster's dns service.
      * The LRP above uses the same port names ``dns`` and ``dns-tcp`` as the example quick deployment yaml, you will
        need to modify those to match your deployment if they are different.

After all ``node-local-dns`` pods are in ready status, DNS traffic will now go to the local node-cache first.
You can verify by checking the DNS cache's metrics ``coredns_dns_request_count_total`` via curling
``<node-local-dns pod IP>:9253/metrics``, the metric should increment as new DNS requests being issued from
application pods are now redirected to the ``node-local-dns`` pod.

In the absence of a node-local DNS cache, DNS queries from application pods
will get directed to cluster DNS pods backed by the ``kube-dns`` service.

kiam redirect on EKS
--------------------
`kiam <https://github.com/uswitch/kiam>`_ agent runs on each node in an EKS
cluster, and intercepts requests going to the AWS metadata server to fetch
security credentials for pods.

- In order to only redirect traffic from pods to the kiam agent, and pass
  traffic from the kiam agent to the AWS metadata server without any redirection,
  we need the socket lookup functionality in the datapath. This functionality
  requires v5.1.16, v5.2.0 or more recent Linux kernel. Make sure the kernel
  version installed on EKS cluster nodes satisfies these requirements.

- Deploy `kiam <https://github.com/uswitch/kiam>`_ using helm charts.

  .. code-block:: shell-session

      $ helm repo add uswitch https://uswitch.github.io/kiam-helm-charts/charts/
      $ helm repo update
      $ helm install --set agent.host.iptables=false --set agent.whitelist-route-regexp=meta-data kiam uswitch/kiam

  - The above command may provide instructions to prepare kiam in the cluster.
    Follow the instructions before continuing.

  - kiam must run in the ``hostNetwork`` mode and without the "--iptables" argument.
    The install instructions above ensure this by default.

- Deploy the Local Redirect Policy to redirect pod traffic to the deployed kiam agent.

  .. parsed-literal::

      $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes-local-redirect/kiam-lrp.yaml

.. note::

    - The ``addressMatcher`` ip address in the Local Redirect Policy is set to
      the ip address of the AWS metadata server and the ``toPorts`` port
      to the default HTTP server port. The ``toPorts`` field under
      ``redirectBackend`` configuration in the policy is set to the port that
      the kiam agent listens on. The port is passed as "--port" argument in
      the ``kiam-agent DaemonSet``.
    - The Local Redirect Policy namespace is set to the namespace
      in which kiam-agent DaemonSet is deployed.

- Once all the kiam agent pods are in ``Running`` state, the metadata requests
  from application pods will get redirected to the node-local kiam agent pods.
  You can verify this by running a curl command to the AWS metadata server from
  one of the application pods, and tcpdump command on the same EKS cluster node as the
  pod. Following is an example output, where ``192.169.98.118`` is the ip
  address of an application pod, and ``192.168.60.99`` is the ip address of the
  kiam agent running on the same node as the application pod.

  .. code-block:: shell-session

      $ kubectl exec app-pod -- curl -s -w "\n" -X GET http://169.254.169.254/latest/meta-data/
      ami-id
      ami-launch-index
      ami-manifest-path
      block-device-mapping/
      events/
      hostname
      iam/
      identity-credentials/
      (...)

  .. code-block:: shell-session

      $ sudo tcpdump -i any -enn "(port 8181) and (host 192.168.60.99 and 192.168.98.118)"
      tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
      listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
      05:16:05.229597  In de:e4:e9:94:b5:9f ethertype IPv4 (0x0800), length 76: 192.168.98.118.47934 > 192.168.60.99.8181: Flags [S], seq 669026791, win 62727, options [mss 8961,sackOK,TS val 2539579886 ecr 0,nop,wscale 7], length 0
      05:16:05.229657 Out 56:8f:62:18:6f:85 ethertype IPv4 (0x0800), length 76: 192.168.60.99.8181 > 192.168.98.118.47934: Flags [S.], seq 2355192249, ack 669026792, win 62643, options [mss 8961,sackOK,TS val 4263010641 ecr 2539579886,nop,wscale 7], length 0

Miscellaneous
=============
When a Local Redirect Policy is applied, cilium BPF datapath translates frontend
(identified by ip/port/protocol tuple) address from the policy to a node-local backend
pod selected by the policy. However, when traffic originates from the node-local
backend pod(s), and is destined to the policy frontend, we skip translating the
frontend address using ``sk_lookup_`` BPF helpers. This is done in order to avoid
forming a loop. As a result, traffic in such cases is forwarded to the original frontend.


text:
<?php

namespace CentraleLille\KnowledgeBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * ForumPost
 *
 * @ORM\Table(name="forum_post")
 * @ORM\Entity(repositoryClass="CentraleLille\KnowledgeBundle\Repository\ForumPostRepository")
 */
class ForumPost
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
    * @ORM\ManyToOne(targetEntity="\CentraleLille\CustomFosUserBundle\Entity\User")
    * @ORM\JoinColumn(name="author_id", referencedColumnName="id")
     */
    private $author;

    /**
    * @ORM\ManyToOne(targetEntity="\CentraleLille\KnowledgeBundle\Entity\ForumThread")
    * @ORM\JoinColumn(name="thread_id", referencedColumnName="id")
     */
    private $thread;

    /**
     * @var string
     *
     * @ORM\Column(name="content", type="text")
     */
    private $content;

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set content
     *
     * @param string $content
     *
     * @return ForumPost
     */
    public function setContent($content)
    {
        $this->content = $content;

        return $this;
    }

    /**
     * Get content
     *
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * Get author
     *
     * @return User
     */
    public function getAuthor()
    {
        return $this->author;
    }

    /**
     * Set author
     *
     * @return ForumPost
     */
    public function setAuthor($author)
    {
        $this->author = $author;
        return $this;
    }

    /**
     * Get thread
     *
     * @return ForumThread
     */
    public function getThread()
    {
        return $this->thread;
    }

    /**
     * Set thread
     *
     * @return ForumPost
     */
    public function setThread($thread)
    {
        $this->thread = $thread;
        return $this;
    }
}


text:
/*==STRUCTURE==*/
#header {
	height:60px;
	clear:both;
	z-index:99999;
	top:0px;
}
#left_bar {
	width:270px;
	float:left;
	height:100%;
	position:relative;
	overflow:hidden;
}
#container {
	overflow:hidden;
}
#content {
	margin:0px 1% 20px 1%;
	position:relative;
	min-height:650px;
}
/*.full_block #content,.full_block .switch_bar{ margin:0px !important;}
.grid_container .full_block { width:100% !important; margin:0px !important;}
.full_block .widget_wrap{ margin:0px !important;}
*/#primary_nav {
	height:100%;
	width:70px;
	position:fixed;
}
#primary_nav ul li {
	height:70px;
	position:relative;
}
#primary_nav li a {
	height:70px;
	width:70px;
	display:block;
}
#sidebar {
	width:200px;
	margin-left:70px;
}
#secondary_nav {
	margin:10px;
}
#secondary_nav ul li {
	margin-bottom:2px;
	position:relative;
}
#theme-default .acitem li {
	margin-bottom:0px !important;
}
#secondary_nav ul li a {
	line-height:35px;
	display:block;
	text-decoration:none;
	padding-left:38px;
}
.top_search {
	height:49px;
	width:270px;
	position: absolute;
	top:0px;
	right:0px;
}
.page_title {
	height:49px;
	position:relative;
	clear:both;
}
.primary_active {
	height:60px;
	width:6px;
	display:block;
	position:absolute;
	right:-1px;
	top:5px;
}
/*==GRID==*/
/*
	Variable Grid System (Fluid Version).
	Learn more ~ http://www.spry-soft.com/grids/
	Based on 960 Grid System - http://960.gs/ & 960 Fluid - http://www.designinfluences.com/

	Licensed under GPL and MIT.
*/

/* Containers
----------------------------------------------------------------------------------------------------*/
.grid_container {
	width:100%;
}
/* Grid >> Global
----------------------------------------------------------------------------------------------------*/

.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9, .grid_10, .grid_11, .grid_12 {
	display:inline;
	float: left;
	position: relative;
	margin-left: 1%;
	margin-right: 1%;
}
/* Grid >> Children (Alpha ~ First, Omega ~ Last)
----------------------------------------------------------------------------------------------------*/

.alpha {
	margin-left: 0 !important;
}
.omega {
	margin-right: 0 !important;
}
/* Grid >> 12 Columns
----------------------------------------------------------------------------------------------------*/

.grid_container .grid_1 {
	width:6.333%;
}
.grid_container .grid_2 {
	width:14.667%;
}
.grid_container .grid_3 {
	width:23.0%;
}
.grid_container .grid_4 {
	width:31.333%;
}
.grid_container .grid_5 {
	width:39.667%;
}
.grid_container .grid_6 {
	width:48.0%;
}
.grid_container .grid_7 {
	width:56.333%;
}
.grid_container .grid_8 {
	width:64.667%;
}
.grid_container .grid_9 {
	width:73.0%;
}
.grid_container .grid_10 {
	width:81.333%;
}
.grid_container .grid_11 {
	width:89.667%;
}
.grid_container .grid_12 {
	width:98.0%;
}
/* Prefix Extra Space >> 12 Columns
----------------------------------------------------------------------------------------------------*/

.grid_container .prefix_1 {
	padding-left:8.333%;
}
.grid_container .prefix_2 {
	padding-left:16.667%;
}
.grid_container .prefix_3 {
	padding-left:25.0%;
}
.grid_container .prefix_4 {
	padding-left:33.333%;
}
.grid_container .prefix_5 {
	padding-left:41.667%;
}
.grid_container .prefix_6 {
	padding-left:50.0%;
}
.grid_container .prefix_7 {
	padding-left:58.333%;
}
.grid_container .prefix_8 {
	padding-left:66.667%;
}
.grid_container .prefix_9 {
	padding-left:75.0%;
}
.grid_container .prefix_10 {
	padding-left:83.333%;
}
.grid_container .prefix_11 {
	padding-left:91.667%;
}
/* Suffix Extra Space >> 12 Columns
----------------------------------------------------------------------------------------------------*/

.grid_container .suffix_1 {
	padding-right:8.333%;
}
.grid_container .suffix_2 {
	padding-right:16.667%;
}
.grid_container .suffix_3 {
	padding-right:25.0%;
}
.grid_container .suffix_4 {
	padding-right:33.333%;
}
.grid_container .suffix_5 {
	padding-right:41.667%;
}
.grid_container .suffix_6 {
	padding-right:50.0%;
}
.grid_container .suffix_7 {
	padding-right:58.333%;
}
.grid_container .suffix_8 {
	padding-right:66.667%;
}
.grid_container .suffix_9 {
	padding-right:75.0%;
}
.grid_container .suffix_10 {
	padding-right:83.333%;
}
.grid_container .suffix_11 {
	padding-right:91.667%;
}
/* Push Space >> 12 Columns
----------------------------------------------------------------------------------------------------*/

.grid_container .push_1 {
	left:8.333%;
}
.grid_container .push_2 {
	left:16.667%;
}
.grid_container .push_3 {
	left:25.0%;
}
.grid_container .push_4 {
	left:33.333%;
}
.grid_container .push_5 {
	left:41.667%;
}
.grid_container .push_6 {
	left:50.0%;
}
.grid_container .push_7 {
	left:58.333%;
}
.grid_container .push_8 {
	left:66.667%;
}
.grid_container .push_9 {
	left:75.0%;
}
.grid_container .push_10 {
	left:83.333%;
}
.grid_container .push_11 {
	left:91.667%;
}
/* Pull Space >> 12 Columns
----------------------------------------------------------------------------------------------------*/

.grid_container .pull_1 {
	left:-8.333%;
}
.grid_container .pull_2 {
	left:-16.667%;
}
.grid_container .pull_3 {
	left:-25.0%;
}
.grid_container .pull_4 {
	left:-33.333%;
}
.grid_container .pull_5 {
	left:-41.667%;
}
.grid_container .pull_6 {
	left:-50.0%;
}
.grid_container .pull_7 {
	left:-58.333%;
}
.grid_container .pull_8 {
	left:-66.667%;
}
.grid_container .pull_9 {
	left:-75.0%;
}
.grid_container .pull_10 {
	left:-83.333%;
}
.grid_container .pull_11 {
	left:-91.667%;
}
/* Clear Floated Elements
----------------------------------------------------------------------------------------------------*/

/* http://sonspring.com/journal/clearing-floats */

.clear {
	clear: both;
	display: block;
	overflow: hidden;
	visibility: hidden;
	width: 0;
	height: 0;
}
/* http://perishablepress.com/press/2008/02/05/lessons-learned-concerning-the-clearfix-css-hack */

.clearfix:after {
	clear: both;
	content: ' ';
	display: block;
	font-size: 0;
	line-height: 0;
	visibility: hidden;
	width: 0;
	height: 0;
}
.clearfix {
	display: inline-block;
}
* html .clearfix {
	height: 1%;
}
.clearfix {
	display: block;
}
/* FORM GRID --------------------------------------------------------------------------------------*/
.form_container {
	width:100%;
}
/* Grid >> Global
----------------------------------------------------------------------------------------------------*/

.form_grid_1, .form_grid_2, .form_grid_3, .form_grid_4, .form_grid_5, .form_grid_6, .form_grid_7, .form_grid_8, .form_grid_9, .form_grid_10, .form_grid_11, .form_grid_12 {
	float:left;
	position: relative;
	margin-left: 1%;
	margin-right: 1%;
}
/* Grid >> 12 Columns
----------------------------------------------------------------------------------------------------*/

.form_container .form_grid_1 {
	width:6.333%;
}
.form_container .form_grid_2 {
	width:14.667%;
}
.form_container .form_grid_3 {
	width:23.0%;
}
.form_container .form_grid_4 {
	width:31.333%;
}
.form_container .form_grid_5 {
	width:39.667%;
}
.form_container .form_grid_6 {
	width:48.0%;
}
.form_container .form_grid_7 {
	width:56.333%;
}
.form_container .form_grid_8 {
	width:64.667%;
}
.form_container .form_grid_9 {
	width:73.0%;
}
.form_container .form_grid_10 {
	width:81.333%;
}
.form_container .form_grid_11 {
	width:89.667%;
}
.form_container .form_grid_12 {
	width:98.0%;
	clear:both;
	float:none;
}

/* Optimized for Mobile Devices */

@media screen and (min-width: 0px) and (max-width: 480px) {
.login_container{ width:300px !important; margin:auto;}
.login_header .login_branding { width:285px !important;}
.grid_container .grid_1, .grid_container .grid_2, .grid_container .grid_3, .grid_container .grid_4, .grid_container .grid_5, .grid_container .grid_6, .grid_container .grid_7, .grid_container .grid_8, .grid_container .grid_9, .grid_container .grid_10, .grid_container .grid_11, .grid_container .grid_12 {
 width:96% !important;
 margin-left: 10px;
 margin-right: 10px;
}
.grid_container .grid_12 .grid_1, .grid_container .grid_12 .grid_2, .grid_container .grid_12 .grid_3, .grid_container .grid_12 .grid_4, .grid_container .grid_12 .grid_5, .grid_container .grid_12 .grid_6, .grid_container .grid_12 .grid_7, .grid_container .grid_12 .grid_8, .grid_container .grid_12 .grid_9, .grid_container .grid_12 .grid_10, .grid_container .grid_12 .grid_11, .grid_container .grid_12 .grid_12 {
 width:100% !important;
 margin-left: 0px;
 margin-right: 0px;
}
 #left_bar {
display:none !important;
}
 #sidebar {
display:none !important;
}
 #container {
margin-left:0px !important;
}
 #header {
height:120px !important;
}
 .header_left {
width:435px !important;
float:none;
}
 #responsive_mnu {
float:left !important;
display: block !important;
}
 .header_right {
width:435px !important;
}
 .activities_s,  .comments_s,  .views_s,  .user_s {
width:95% !important;
float: none !important;
margin-bottom:20px;
}
 .user_s {
margin-bottom:0px;
}
 .table_content {
overflow:scroll !important;
}
 #widget_tab li a {
padding:0 10px !important;
}
 .alpha, .omega {
 margin-left: 0 !important;
 margin-right: 0 !important;
}
 .align_center, .align_right {
 text-align: left !important;
}
 #chart1 table .jqplot-table-legend {
display:none;
}
 .item_widget .item_block {
width:160px !important;
margin:10px !important;
}
.item_block:last-child {
float:left !important;
}
.invoice_tbl {
overflow: scroll;
width:401px;
border-left:#ccc 1px solid;
border-bottom:#ccc 1px solid;
border-right:#ccc 1px solid;
}
.widget_content .page_content {
margin: 0px 18px !important;
}
}

@media screen and (min-width: 481px) and (max-width: 768px) {
.grid_container .grid_1, .grid_container .grid_2, .grid_container .grid_3, .grid_container .grid_4, .grid_container .grid_5, .grid_container .grid_6, .grid_container .grid_7, .grid_container .grid_8, .grid_container .grid_9, .grid_container .grid_10, .grid_container .grid_11, .grid_container .grid_12 {
 width:97% !important;
 margin-left: 10px;
 margin-right: 10px;
}
.grid_container .grid_12 .grid_1, .grid_container .grid_12 .grid_2, .grid_container .grid_12 .grid_3, .grid_container .grid_12 .grid_4, .grid_container .grid_12 .grid_5, .grid_container .grid_12 .grid_6, .grid_container .grid_12 .grid_7, .grid_container .grid_12 .grid_8, .grid_container .grid_12 .grid_9, .grid_container .grid_12 .grid_10, .grid_container .grid_12 .grid_11, .grid_container .grid_12 .grid_12 {
 width:100% !important;
 margin-left: 0px;
 margin-right: 0px;
}
 #left_bar {
display:none !important;
}
 #sidebar {
display:none !important;
}
 #container {
margin-left:0px !important;
}
 #header {
height:120px !important;
}
 .header_left {
width:768px !important;
float:none;
}
 #responsive_mnu {
float:left !important;
display: block !important;
}
 .header_right {
width:726px !important;
}
 .activities_s,  .comments_s,  .views_s,  .user_s {
width:95% !important;
float: none !important;
margin-bottom:20px;
}
 .user_s {
margin-bottom:0px;
}
 .table_content {
overflow:scroll !important;
}
 #widget_tab li a {
padding:0 10px !important;
}
 .alpha, .omega {
 margin-left: 0 !important;
 margin-right: 0 !important;
}
 .align_center, .align_right {
 text-align: left !important;
}
 #chart1 table .jqplot-table-legend {
display:none;
}
.item_widget .item_block {
width:160px !important;
margin:10px !important;
}
.item_block:last-child {
float:left !important;
}
.invoice_tbl {
overflow: scroll;
width:768px;
border-left:#ccc 1px solid;
border-bottom:#ccc 1px solid;
border-right:#ccc 1px solid;
}
.widget_content .page_content {
margin: 0px 18px !important;
}
}

@media screen and (min-width: 769px) and (max-width: 1024px){
#left_bar{ width:200px !important;}
 #primary_nav,#start_menu{ display:none !important;}
 #sidebar{ margin-left:0px !important;}
 .grid_container .grid_1, .grid_container .grid_2, .grid_container .grid_3, .grid_container .grid_4, .grid_container .grid_5, .grid_container .grid_6, .grid_container .grid_7, .grid_container .grid_8, .grid_container .grid_9, .grid_container .grid_10, .grid_container .grid_11, .grid_container .grid_12 {
 width:97% !important;
 margin-left: 10px;
 margin-right: 10px;
}
.grid_container .grid_12 .grid_1, .grid_container .grid_12 .grid_2, .grid_container .grid_12 .grid_3, .grid_container .grid_12 .grid_4, .grid_container .grid_12 .grid_5, .grid_container .grid_12 .grid_6, .grid_container .grid_12 .grid_7, .grid_container .grid_12 .grid_8, .grid_container .grid_12 .grid_9, .grid_container .grid_12 .grid_10, .grid_container .grid_12 .grid_11, .grid_container .grid_12 .grid_12 {
 width:100% !important;
 margin-left: 0px;
 margin-right: 0px;
}

 .activities_s,  .comments_s,  .views_s,  .user_s {
width:95% !important;
float: none !important;
margin-bottom:20px;
}
  .user_s {
margin-bottom:0px;
}
.item_widget .item_block {
width:140px !important;
margin:10px !important;
}
.item_block:last-child {
float:left !important;
}
}


text:
package com.nms.ws.charging;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;

/**
 * This object contains factory methods for each
 * Java content interface and Java element interface
 * generated in the com.nms.ws.charging package.
 * <p>An ObjectFactory allows you to programatically
 * construct new instances of the Java representation
 * for XML content. The Java representation of XML
 * content can consist of schema derived interfaces
 * and classes representing the binding of schema
 * type definitions, element declarations and model
 * groups.  Factory methods for each of these are
 * provided in this class.
 *
 */
@XmlRegistry
public class ObjectFactory {

    private final static QName _ChargeItemsResponse_QNAME = new QName("http://chargingwebservice.nms.com/", "ChargeItemsResponse");
    private final static QName _ChargeItems_QNAME = new QName("http://chargingwebservice.nms.com/", "ChargeItems");

    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.nms.ws.charging
     *
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link ChargeItemsResponse }
     *
     */
    public ChargeItemsResponse createChargeItemsResponse() {
        return new ChargeItemsResponse();
    }

    /**
     * Create an instance of {@link ChargeItems }
     *
     */
    public ChargeItems createChargeItems() {
        return new ChargeItems();
    }

    /**
     * Create an instance of {@link ContentPurcharseRes }
     *
     */
    public ContentPurcharseRes createContentPurcharseRes() {
        return new ContentPurcharseRes();
    }

    /**
     * Create an instance of {@link RequestBase }
     *
     */
    public RequestBase createRequestBase() {
        return new RequestBase();
    }

    /**
     * Create an instance of {@link ContentPurcharseReq }
     *
     */
    public ContentPurcharseReq createContentPurcharseReq() {
        return new ContentPurcharseReq();
    }

    /**
     * Create an instance of {@link ResponseBase }
     *
     */
    public ResponseBase createResponseBase() {
        return new ResponseBase();
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link ChargeItemsResponse }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://chargingwebservice.nms.com/", name = "ChargeItemsResponse")
    public JAXBElement<ChargeItemsResponse> createChargeItemsResponse(ChargeItemsResponse value) {
        return new JAXBElement<ChargeItemsResponse>(_ChargeItemsResponse_QNAME, ChargeItemsResponse.class, null, value);
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link ChargeItems }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://chargingwebservice.nms.com/", name = "ChargeItems")
    public JAXBElement<ChargeItems> createChargeItems(ChargeItems value) {
        return new JAXBElement<ChargeItems>(_ChargeItems_QNAME, ChargeItems.class, null, value);
    }

}


text:
//=================================================================================================

//=================================================================================================

#ifndef _BLAZE_MATH_SMP_DEFAULT_DENSEMATRIX_H_
#define _BLAZE_MATH_SMP_DEFAULT_DENSEMATRIX_H_

//*************************************************************************************************
// Includes
//*************************************************************************************************

#include <blaze/math/expressions/DenseMatrix.h>
#include <blaze/math/expressions/Matrix.h>
#include <blaze/math/typetraits/IsDenseMatrix.h>
#include <blaze/system/SMP.h>
#include <blaze/util/Assert.h>
#include <blaze/util/EnableIf.h>
#include <blaze/util/logging/FunctionTrace.h>
#include <blaze/util/StaticAssert.h>

namespace blaze {

//=================================================================================================
//
//  GLOBAL FUNCTIONS
//
//=================================================================================================

//*************************************************************************************************
/*!\name Dense matrix SMP functions */
//@{
template< typename MT1, bool SO1, typename MT2, bool SO2 >
inline typename EnableIf< IsDenseMatrix<MT1> >::Type
   smpAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );

template< typename MT1, bool SO1, typename MT2, bool SO2 >
inline typename EnableIf< IsDenseMatrix<MT1> >::Type
   smpAddAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );

template< typename MT1, bool SO1, typename MT2, bool SO2 >
inline typename EnableIf< IsDenseMatrix<MT1> >::Type
   smpSubAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );
//@}
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Default implementation of the SMP assignment of a matrix to a dense matrix.
// \ingroup smp
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side matrix to be assigned.
// \return void
//
// This function implements the default SMP assignment of a matrix to a dense matrix.\n
// This function must \b NOT be called explicitly! It is used internally for the performance
// optimized evaluation of expression templates. Calling this function explicitly might result
// in erroneous results and/or in compilation errors. Instead of using this function use the
// assignment operator.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , bool SO1      // Storage order of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side matrix
        , bool SO2 >    // Storage order of the right-hand side matrix
inline typename EnableIf< IsDenseMatrix<MT1> >::Type
   smpAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   assign( ~lhs, ~rhs );
}
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Default implementation of the SMP addition assignment of a matrix to a dense matrix.
// \ingroup smp
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side matrix to be added.
// \return void
//
// This function implements the default SMP addition assignment of a matrix to a dense matrix.\n
// This function must \b NOT be called explicitly! It is used internally for the performance
// optimized evaluation of expression templates. Calling this function explicitly might result
// in erroneous results and/or in compilation errors. Instead of using this function use the
// assignment operator.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , bool SO1      // Storage order of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side matrix
        , bool SO2 >    // Storage order of the right-hand side matrix
inline typename EnableIf< IsDenseMatrix<MT1> >::Type
   smpAddAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   addAssign( ~lhs, ~rhs );
}
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
// \ingroup smp
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side matrix to be subtracted.
// \return void
//
// This function implements the default SMP subtraction assignment of a matrix to a dense matrix.\n
// This function must \b NOT be called explicitly! It is used internally for the performance
// optimized evaluation of expression templates. Calling this function explicitly might result
// in erroneous results and/or in compilation errors. Instead of using this function use the
// assignment operator.
*/
template< typename MT1  // Type of the left-hand side dense matrix
        , bool SO1      // Storage order of the left-hand side dense matrix
        , typename MT2  // Type of the right-hand side matrix
        , bool SO2 >    // Storage order of the right-hand side matrix
inline typename EnableIf< IsDenseMatrix<MT1> >::Type
   smpSubAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
{
   BLAZE_FUNCTION_TRACE;

   BLAZE_INTERNAL_ASSERT( (~lhs).rows()    == (~rhs).rows()   , "Invalid number of rows"    );
   BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );

   subAssign( ~lhs, ~rhs );
}
//*************************************************************************************************

//=================================================================================================
//
//  COMPILE TIME CONSTRAINT
//
//=================================================================================================

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
namespace {

BLAZE_STATIC_ASSERT( !BLAZE_OPENMP_PARALLEL_MODE      );
BLAZE_STATIC_ASSERT( !BLAZE_CPP_THREADS_PARALLEL_MODE );

}
/*! \endcond */
//*************************************************************************************************

} // namespace blaze

#endif


text:
package org.openkilda.messaging.nbtopology.request;

import org.openkilda.messaging.nbtopology.annotations.ReadRequest;
import org.openkilda.model.SwitchId;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.ToString;

@SuppressWarnings("squid:MaximumInheritanceDepth")
@ReadRequest
@Getter
@ToString
public class UpdateSwitchUnderMaintenanceRequest extends SwitchesBaseRequest {

    @JsonProperty("switch_id")
    private SwitchId switchId;

    @JsonProperty("under_maintenance")
    private boolean underMaintenance;

    @JsonProperty(value = "evacuate")
    private boolean evacuate;

    public UpdateSwitchUnderMaintenanceRequest(@JsonProperty("switch_id") SwitchId switchId,
                                               @JsonProperty("under_maintenance") boolean underMaintenance,
                                               @JsonProperty("evacuate") boolean evacuate) {
        this.switchId = switchId;
        this.underMaintenance = underMaintenance;
        this.evacuate = evacuate;
    }
}


text:
layout: post
title: FireHose Project - Week 5
---
This week I started and focused all on the Flixter app, the last solo project in the program. It's an online platform for videos lessons, similar to Udemy. It has two modes, one for teachers to create courses and upload videos, and one for students to enroll and watch the videos.

First, I built the basic layout, such as home page, top nav bar, and footer, and added basic css styles. Then I added the CRUDs actions to the app covering the ability to add courses, sections, lessons, enrollments for teachers and showing the course pages for students. The main features were then added, such as uploading and viewing videos and pictures and credit card payment processing. These features seem complicated to implement from the surface, but thanks to the large library of gem that the Ruby community has, they ended up pretty straightforward to implement.

There was also a feature to sort sections and lessons by doing a drag and drop action via JavaScript with Ajax. This might seem like a minor or common feature for users, but it's definitely more development work than it seems. It's interesting to see how a common feature you see around everyday is built and this was one of the best task this week. I made good progress on the app overall and should be done early next week, then I will be moving on to coding challenges and starting group project, exciting!

 Cool things I learned:

* JavaScript, sortable feature! This is when you just drag and drop to move a list of things, so cool to understand how it works now!

* Credit Card payment with Stripe. Stripe does all the heavy lifting, all you have to do is hook it up to you app.
Embedding video into the site, easily to make your site look good.

Stuck of the week:

Forgot to "rake db:migrate" on heroku after deployment. The app was throwing an error whenever I uploaded a video, but locally was fine and error log had no obvious error. Can't believe such a simple error.

How I'm feeling:

Excited to almost finish Flixster app and move on to something new, group project!

Random Thoughts:

I want to learn more javascript, so maybe I'll do some more lesson from other online resources.