text:
    #ifndef MSG_NOSIGNAL
        #define MSG_NOSIGNAL SO_NOSIGPIPE
    #endif
#endif

network::network(string hostname, string port)
{
	struct addrinfo *p;
	struct addrinfo hints;
	sockfd = 0;
	int status;
	char ipstr[INET6_ADDRSTRLEN];

	memset(&hints, 0, sizeof(hints));

	hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force IPv4 or IPv6
	hints.ai_socktype = SOCK_STREAM;

	if((status = getaddrinfo(hostname.c_str(), port.c_str(), &hints, &res)) != 0)
	{
		cerr << "getaddrinfo: " << gai_strerror(status) << endl;
	}

	cout << "Connecting to: " << hostname;

	for(p = res; p != NULL; p = p->ai_next)
	{
		void *addr;
		string ipver;

		//get the pointer to the address itself,
		//different fields in IPv4 and IPv6:
		if(p->ai_family == AF_INET)
		{
			//IPv4
			struct sockaddr_in *ipv4 = reinterpret_cast<struct sockaddr_in *>(p->ai_addr);
			addr = &(ipv4->sin_addr);
			ipver = "IPv4";
		}
		else
		{
			//IPv6
			struct sockaddr_in6 *ipv6 = reinterpret_cast<struct sockaddr_in6 *>(p->ai_addr);
			addr = &(ipv6->sin6_addr);
			ipver = "IPv6";
		}

		//convert the IP to a string and print it:
		inet_ntop(p->ai_family, addr, ipstr, sizeof(ipstr));
		cout << " (" << ipver << ": " << ipstr << ")" << endl;
	}

	sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
	//Uncommenting the following line would enable non-blocking sockets which whore cpu.
	//fcntl(sockfd, F_SETFL, O_NONBLOCK);
	connect(sockfd, res->ai_addr, res->ai_addrlen);
}

int network::recvTimeout(int s, char *buf, int len, int timeout)
{
	//This function is shamelessly stolen from Beej's Guide to Network programming
	fd_set fds;
	int n;
	struct timeval tv;

	//set up the file descriptor set
	FD_ZERO(&fds);
	FD_SET(s, &fds);

	//set up the struct timeval for the timeout
	tv.tv_sec = 0;
	tv.tv_usec = timeout;

	//wait until timeout or data received
	n = select(s+1, &fds, NULL, NULL, &tv);
	if(n == 0) return -2; //timeout
	if(n == -1) return -1; //error

	//data must be here, so do a normal recv()
	return recv(s, buf, len, 0);
}

int network::recieveMsg(string &result)
{
	int numbytes = 0;
	const int MAX_SIZE = 10000;
	char temp[MAX_SIZE];

	//recieve input with a timeout of 1/10 of a second
	numbytes = recvTimeout(sockfd, temp, MAX_SIZE-1, 100000);
	//timeout
	if(numbytes == -2)
	{
		//do nothing \o/
		return -2;
	}
	//error
	if(numbytes == -1)
	{
		perror("recv");
		close(sockfd);
		freeaddrinfo(res);
		return -1;
	}
	//disconnected
	else if(numbytes == 0)
	{
		cout << "Disconnected" << endl;
		close(sockfd);
		freeaddrinfo(res);
		return -1;
	}
	//recieved a message
	else
	{
		temp[numbytes] = '\0';
		result = string(temp);
		cout << result;// << endl << endl;
		return numbytes;
	}
}

int network::sendMsg(string message)
{
	message = message + "\n";
	cout << "Sending: " << message;
	const int len = message.size();
	//sent = send(sockfd, message.c_str(), len, 0);
	send(sockfd, message.c_str(), len, MSG_NOSIGNAL);
	//cout << "(sent " << sent << "/" << len << " bytes)" << endl;
	return len;
}


text:
require "action_dispatch/testing/request_encoder"

module ActionDispatch
  # Integration test methods such as Integration::RequestHelpers#get
  # and Integration::RequestHelpers#post return objects of class
  # TestResponse, which represent the HTTP response results of the requested
  # controller actions.
  #
  # See Response for more information on controller response objects.
  class TestResponse < Response
    def self.from_response(response)
      new response.status, response.headers, response.body
    end

    # Returns a parsed body depending on the response MIME type. When a parser
    # corresponding to the MIME type is not found, it returns the raw body.
    #
    # ==== Examples
    #   get "/posts"
    #   response.content_type      # => "text/html; charset=utf-8"
    #   response.parsed_body.class # => String
    #   response.parsed_body       # => "<!DOCTYPE html>\n<html>\n..."
    #
    #   get "/posts.json"
    #   response.content_type      # => "application/json; charset=utf-8"
    #   response.parsed_body.class # => Array
    #   response.parsed_body       # => [{"id"=>42, "title"=>"Title"},...
    #
    #   get "/posts/42.json"
    #   response.content_type      # => "application/json; charset=utf-8"
    #   response.parsed_body.class # => Hash
    #   response.parsed_body       # => {"id"=>42, "title"=>"Title"}
    def parsed_body
      @parsed_body ||= response_parser.call(body)
    end

    def response_parser
      @response_parser ||= RequestEncoder.parser(media_type)
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * @file
 * Contains \Drupal\Component\Plugin\DefaultPluginBag.
 */

namespace Drupal\Component\Plugin;

use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\Component\Utility\MapArray;
use Drupal\Component\Utility\String;

/**
 * Provides a default plugin bag for a plugin type.
 *
 * A plugin bag is used to contain plugins that will be lazily instantiated. The
 * configurations of each potential plugin are passed in, and the configuration
 * key containing the plugin ID is specified by self::$pluginKey.
 */
class DefaultPluginBag extends PluginBag {

  /**
   * The manager used to instantiate the plugins.
   *
   * @var \Drupal\Component\Plugin\PluginManagerInterface
   */
  protected $manager;

  /**
   * The initial configuration for each plugin in the bag.
   *
   * @var array
   *   An associative array containing the initial configuration for each plugin
   *   in the bag, keyed by plugin instance ID.
   */
  protected $configurations = array();

  /**
   * The key within the plugin configuration that contains the plugin ID.
   *
   * @var string
   */
  protected $pluginKey = 'id';

  /**
   * The original order of the instances.
   *
   * @var array
   */
  protected $originalOrder = array();

  /**
   * Constructs a new DefaultPluginBag object.
   *
   * @param \Drupal\Component\Plugin\PluginManagerInterface $manager
   *   The manager to be used for instantiating plugins.
   * @param array $configurations
   *   (optional) An associative array containing the initial configuration for
   *   each plugin in the bag, keyed by plugin instance ID.
   */
  public function __construct(PluginManagerInterface $manager, array $configurations = array()) {
    $this->manager = $manager;
    $this->configurations = $configurations;

    if (!empty($configurations)) {
      $this->instanceIDs = MapArray::copyValuesToKeys(array_keys($configurations));
      // Store the original order of the instance IDs for export.
      $this->originalOrder = $this->instanceIDs;
    }
  }

  /**
   * {@inheritdoc}
   */
  protected function initializePlugin($instance_id) {
    $configuration = isset($this->configurations[$instance_id]) ? $this->configurations[$instance_id] : array();
    if (!isset($configuration[$this->pluginKey])) {
      throw new PluginException(String::format("Unknown plugin ID '@instance'.", array('@instance' => $instance_id)));
    }
    $this->pluginInstances[$instance_id] = $this->manager->createInstance($configuration[$this->pluginKey], $configuration);
    $this->addInstanceID($instance_id);
  }

  /**
   * Sorts all plugin instances in this bag.
   *
   * @return self
   *   Returns the plugin bag.
   */
  public function sort() {
    uasort($this->instanceIDs, array($this, 'sortHelper'));
    return $this;
  }

  /**
   * Provides uasort() callback to sort plugins.
   */
  public function sortHelper($aID, $bID) {
    $a = $this->get($aID);
    $b = $this->get($bID);
    return strnatcasecmp($a->getPluginId(), $b->getPluginId());
  }

  /**
   * Returns the current configuration of all plugins in this bag.
   *
   * @return array
   *   An associative array keyed by instance ID, whose values are up-to-date
   *   plugin configurations.
   */
  public function getConfiguration() {
    $instances = array();
    $this->rewind();
    // Store the current order of the instances.
    $current_order = $this->instanceIDs;
    // Reorder the instances to match the original order, adding new instances
    // to the end.
    $this->instanceIDs = $this->originalOrder + $current_order;

    foreach ($this as $instance_id => $instance) {
      if ($instance instanceof ConfigurablePluginInterface) {
        $instances[$instance_id] = $instance->getConfiguration();
      }
      else {
        $instances[$instance_id] = $this->configurations[$instance_id];
      }
    }
    // Restore the current order.
    $this->instanceIDs = $current_order;
    return $instances;
  }

  /**
   * Updates the configuration for a plugin instance.
   *
   * If there is no plugin instance yet, a new will be instantiated. Otherwise,
   * the existing instance is updated with the new configuration.
   *
   * @param string $instance_id
   *   The ID of a plugin to set the configuration for.
   * @param array $configuration
   *   The plugin configuration to set.
   */
  public function setConfiguration($instance_id, array $configuration) {
    $this->configurations[$instance_id] = $configuration;
    $instance = $this->get($instance_id);
    if ($instance instanceof ConfigurablePluginInterface) {
      $instance->setConfiguration($configuration);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function removeInstanceID($instance_id) {
    parent::removeInstanceID($instance_id);
    unset($this->originalOrder[$instance_id]);
    unset($this->configurations[$instance_id]);
  }

}


text:
namespace Ui {
	class DbWindow;
}

class QTableWidget;
class QLineEdit;
class QListWidget;
class QListWidgetItem;
class Memory;
typedef struct s_register t_register;

class DbWindow : public QDialog
{
    Q_OBJECT

public:
    explicit DbWindow(t_register *r, Memory *mem, std::list<uint16_t> *_breakpoints);
    virtual	~DbWindow();

	void 	updateRegister(t_register& r);
	void	updateOtherRegister(Memory& mem);
	void 	updateMemory(Memory& m);
	void	updateDisassembler(t_register& r, Memory& mem);

	void	bpDel(QListWidgetItem *item);

	QTableWidget	*tableRegisters;
	QTableWidget	*tableOtherRegisters;
	QTableWidget	*tableVideoRegisters;
	QTableWidget	*tableDisassembler;
	QTableWidget	*tableMemory;

	QListWidget		*listBreakpoint;

	QPushButton		*buttonReset;
	QPushButton		*buttonStep;
	QPushButton		*buttonFrame;
	QPushButton		*buttonRun;
	QPushButton		*buttonOpen;
	QPushButton		*buttonBpAdd;
	QPushButton		*okEdit;

	QLineEdit		*lineAddr;
	QLineEdit		*lineStepCount;
	QLineEdit		*addrEdit;
	QLineEdit		*valEdit;

	signals:
		void	stepPressedSign(unsigned int count);
		void	framePressedSign();
		void	runPressedSign();
		void	resetPressedSign();
		void	openPressedSign(std::string path);
		void	bpAddSign(uint16_t addr);
		void	bpDelSign(uint16_t addr);
	public slots:
		void	stepPressedSlot();
		void	lineStepCountEditedSlot();
		void	framePressedSlot();
		void	runPressedSlot();
		void	resetPressedSlot();
		void	openPressedSlot();
		void	bpAddPressedSlot();
		void	bpDoubleClikedSlot(QListWidgetItem *item);
		void	updateAllSlot();
		void	lineAddrEditedSlot();
		void	editAddrSlot();

private:
    Ui::DbWindow	*ui;

	t_register			*_r;
	Memory				*_mem;
	std::list<uint16_t>	*_breakpoints; // unuse at this time
	unsigned int		_start;
	unsigned int		_stepCount;
};

#endif // DBWINDOW_H


text:
package org.axonframework.eventhandling;

import org.axonframework.common.Assert;

import java.util.*;

import static java.util.Arrays.stream;
import static java.util.stream.Collectors.toList;

/**
 * A representation of a segment and corresponding mask with various capabilities.
 *

 * Definition
 *

 *

 * A {@link Segment} is a fraction of the total population of events.
 * The 'mask' is a bitmask to be applied to an identifier, resulting in the segmentId of the {@link Segment}.
 */
public class Segment implements Comparable<Segment> {

    private static final Segment[] EMPTY_SEGMENTS = new Segment[0];
    private static final int ZERO_MASK = 0x0;

    /**
     * Represents the Segment that matches against all input, but can be split to start processing elements in parallel.
     */
    public static final Segment ROOT_SEGMENT = new Segment(0, ZERO_MASK);
    private final int segmentId;
    private final int mask;

    private static boolean computeSegments(Segment segment, List<Integer> segments, Set<Segment> applicableSegments) {

        final Segment[] splitSegment = segment.split();

        // As the first segmentId mask, keeps the original segmentId, we only check the 2nd segmentId mask being a know.
        if (segments.contains(splitSegment[1].getSegmentId())) {
            for (Segment segmentSplit : splitSegment) {
                if (!computeSegments(segmentSplit, segments, applicableSegments)) {
                    applicableSegments.add(segmentSplit);
                }
            }
        } else {
            applicableSegments.add(segment);
        }
        return true;
    }

    /**
     * Compute the {@link Segment}'s from a given list of segmentId's.
     *
     * @param segments The segment id's for which to compute Segments.
     * @return an array of computed {@link Segment}
     */
    public static Segment[] computeSegments(int... segments) {
        if (segments == null || segments.length == 0) {
            return EMPTY_SEGMENTS;
        }
        final Set<Segment> resolvedSegments = new HashSet<>();
        computeSegments(ROOT_SEGMENT, stream(segments).boxed().collect(toList()), resolvedSegments);

        // As we split and compute segment masks branching by first entry, the resolved segment mask is not guaranteed
        // to be added to the collection in natural order.
        return resolvedSegments.stream().sorted().collect(toList()).toArray(new Segment[resolvedSegments.size()]);
    }

    /**
     * Creates a Segment instance for the given {@code segmentId} based on the given {@code availableSegmentsIds}.
     *
     * @param segmentId           The Id of the segment to return
     * @param availableSegmentIds The available segment Ids, to base the mask of the segment on
     * @return the Segment instance representing for the given id
     */
    public static Segment computeSegment(int segmentId, int... availableSegmentIds) {
        Arrays.sort(availableSegmentIds);

        // as a 1 can only happen within the mask, the smallest possible mask is the lowest power of 2 (minus one)
        // higher than that value
        int splitCandidate = segmentId == 0 ? 1 : (Integer.highestOneBit(segmentId) << 1);
        while (Arrays.binarySearch(availableSegmentIds, splitCandidate | segmentId) >= 0) {
            // We have found the split value for the smallest mask. We need to increase the mask
            splitCandidate = splitCandidate << 1;
        }

        int mask = splitCandidate - 1;
        return new Segment(segmentId, mask);
    }

    /**
     * Split a given {@link Segment} n-times in round robin fashion.
     *

     *
     * @param segment       The {@link Segment} to split.
     * @param numberOfTimes The number of times to split it.
     * @return a collection of {@link Segment}'s.
     */
    public static List<Segment> splitBalanced(Segment segment, int numberOfTimes) {
        final SortedSet<Segment> toBeSplit = new TreeSet<>(Comparator.comparing(Segment::getMask)
                                                                     .thenComparing(Segment::getSegmentId));
        toBeSplit.add(segment);
        for (int i = 0; i < numberOfTimes; i++) {
            final Segment workingSegment = toBeSplit.first();
            toBeSplit.remove(workingSegment);
            toBeSplit.addAll(Arrays.asList(workingSegment.split()));
        }
        ArrayList<Segment> result = new ArrayList<>(toBeSplit);
        result.sort(Comparator.comparing(Segment::getSegmentId));
        return result;
    }

    /**
     * Construct a new Segment instance with given {@code segmentId} and {@code mask}
     *
     * @param segmentId The id of the segment
     * @param mask      The mask of the segment
     */
    protected Segment(int segmentId, int mask) {
        Assert.isTrue(mask == 0 || mask + 1 == Integer.highestOneBit(mask + 1), () -> "Invalid mask. It must end on a consecutive series of 1s");
        this.segmentId = segmentId;
        this.mask = mask;
    }

    /**
     * Calculates the Segment that represents the merger of this segment with the given {@code other} segment.
     *
     * @param other the segment to merge this one with
     * @return The Segment representing the merged segments
     */
    public Segment mergedWith(Segment other) {
        Assert.isTrue(this.isMergeableWith(other), () -> "Given " + other + " cannot be merged with " + this);
        return new Segment(Math.min(this.segmentId, other.segmentId), this.mask >>> 1);
    }

    /**
     * Returns the {@link #getSegmentId() segmentId} of the segment this one can be merged with
     *
     * @return the {@link #getSegmentId() segmentId} of the segment this one can be merged with
     */
    public int mergeableSegmentId() {
        int parentMask = mask >>> 1;
        int firstBit = mask ^ parentMask;

        return segmentId ^ firstBit;
    }

    /**
     * Indicates whether this segment can be merged with the given {@code other} segment.
     *

     * Two segments can be merged when their mask is identical, and the only difference in SegmentID is in the first
     * 1-bit of their mask.
     *
     * @param other the Segment to verify mergeability for
     * @return {@code true} if the segments can be merged, otherwise {@code false}
     */
    public boolean isMergeableWith(Segment other) {
        return this.mask == other.mask
                && mergeableSegmentId() == other.getSegmentId();
    }

    /**
     * Getter for the segment identifier.
     *
     * @return the Segment identifier.
     */
    public int getSegmentId() {
        return segmentId;
    }

    /**
     * Getter for the segment mask.
     *
     * @return the Segment mask.
     */
    public int getMask() {
        return mask;
    }

    /**
     * Returns {@code true} when the mask applied to the given value, matches the segment id.
     *
     * @param value The value to be tested.
     * @return {@code true} when matching this segment.
     */
    public boolean matches(int value) {
        return mask == 0 || (mask & value) == segmentId;
    }

    /**
     * Indicates whether the given {@code value} matches this segment. A value matches when the hashCode of a value,
     * after applying this segments mask, equals to this segment ID.
     *
     * @param value The value to verify against.
     * @return {@code true} if the given value matches this segment, otherwise {@code false}
     */
    public boolean matches(Object value) {
        return mask == 0 || matches(Objects.hashCode(value));
    }

    /**
     * Returns an array with two {@link Segment segments with a corresponding mask}.

     * The first entry contains the original {@code segmentId}, with the newly calculated mask. (Simple left shift, adding a '1' as LSB).
     * The 2nd entry is a new {@code segmentId} with the same derived mask.
     *

     * Callers must ensure that either the two returned Segments are used, or the instance from which they are derived,
     * but not both.
     *
     * @return an array of two {@link Segment}'s.
     */
    public Segment[] split() {

        if ((mask << 1) < 0) {
            throw new IllegalArgumentException("Unable to split the given segmentId, as the mask exceeds the max mask size.");
        }

        Segment[] segments = new Segment[2];
        int newMask = ((mask << 1) + 1);
        final int newSegment = segmentId + (mask == 0 ? 1 : newMask ^ mask);
        segments[0] = new Segment(segmentId, newMask);
        segments[1] = new Segment(newSegment, newMask);

        return segments;
    }

    /**
     * Returns the segmentId of the counterpart of this segment, if this segment were to be split.
     *
     * @return the segmentId of the counterpart of this segment
     */
    public int splitSegmentId() {
        return segmentId + (mask == 0 ? 1 : ((mask << 1) + 1) ^ mask);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Segment that = (Segment) o;
        return segmentId == that.segmentId &&
                mask == that.mask;
    }

    @Override
    public String toString() {
        return String.format("Segment[%d/%s]", getSegmentId(), getMask());
    }

    @Override
    public int hashCode() {
        return Objects.hash(segmentId, mask);
    }

    @Override
    public int compareTo(Segment that) {
        return Integer.compare(this.segmentId, that.segmentId);
    }
}


text:
package org.diorite.impl.command.defaults;

import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;

import org.diorite.impl.DioriteCore;
import org.diorite.impl.command.SystemCommandImpl;
import org.diorite.command.CommandPriority;

public class OnlineCmd extends SystemCommandImpl
{
    public OnlineCmd()
    {
        super("online", Pattern.compile("(online|who|list)", Pattern.CASE_INSENSITIVE), CommandPriority.LOW);
        this.setCommandExecutor((sender, command, label, matchedPattern, args) -> sender.sendSimpleColoredMessage("&3Online players: &7" + StringUtils.join(DioriteCore.getInstance().getPlayersManager().getOnlinePlayersNames(), "&9, &7")));
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2018 Evolveum and contributors
  ~
  ~ This work is dual-licensed under the Apache License 2.0
  ~ and European Union Public License. See LICENSE file for details.
  -->

<org oid="00000000-8888-6666-a300-000000000001"
     xmlns='http://midpoint.evolveum.com/xml/ns/public/common/common-3'
     xmlns:org='http://midpoint.evolveum.com/xml/ns/public/common/org-3'
     xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3">
    <name>Geidi Prime</name>
    <assignment id="1">
        <targetRef oid="00000000-8888-6666-a300-000000000000" type="OrgType"/> <!-- House Harkonnen -->
    </assignment>
    <displayName>Planet Geidi Prime</displayName>
    <identifier>310</identifier>
</org>


text:
package co.aurasphere.botmill.fb.model.outcoming.payload.template.airline;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;

import co.aurasphere.botmill.fb.model.outcoming.payload.PayloadType;
import co.aurasphere.botmill.fb.model.outcoming.template.airline.FlightInfoExtended;
import co.aurasphere.botmill.fb.model.outcoming.template.airline.PassengerInfo;
import co.aurasphere.botmill.fb.model.outcoming.template.airline.PassengerSegmentInfo;
import co.aurasphere.botmill.fb.model.outcoming.template.airline.PriceInfo;

import com.google.gson.annotations.SerializedName;

/**
 * The Class AirlineItineraryTemplatePayload.
 */
public class AirlineItineraryTemplatePayload extends
		AirlineBasePnrNumberTemplatePayload {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** The flight info. */
	@Valid
	@NotEmpty
	@SerializedName("flight_info")
	private List<FlightInfoExtended> flightInfo;

	/** The passenger info. */
	@Valid
	@NotEmpty
	@SerializedName("passenger_info")
	private List<PassengerInfo> passengerInfo;

	/** The passenger segment info. */
	@Valid
	@NotEmpty
	@SerializedName("passenger_segment_info")
	private List<PassengerSegmentInfo> passengerSegmentInfo;

	/** The price info. */
	@Valid
	@Size(max = 4)
	@SerializedName("price_info")
	private List<PriceInfo> priceInfo;

	/** The base price. */
	@SerializedName("base_price")
	private BigDecimal basePrice;

	/** The tax. */
	private BigDecimal tax;

	/** The total price. */
	@NotNull
	@SerializedName("total_price")
	private BigDecimal totalPrice;

	/** The currency. */
	@NotBlank
	@Pattern(regexp = "[A-Z]{3}", message = "{currency.pattern.message}")
	private String currency;

	/**
	 * Instantiates a new airline itinerary template payload.
	 *
	 * @param introMessage
	 *            the intro message
	 * @param locale
	 *            the locale
	 * @param pnrNumber
	 *            the pnr number
	 * @param totalPrice
	 *            the total price
	 * @param currency
	 *            the currency
	 */
	public AirlineItineraryTemplatePayload(String introMessage, String locale,
			String pnrNumber, BigDecimal totalPrice, String currency) {
		super(introMessage, locale, pnrNumber);
		this.totalPrice = totalPrice;
		this.currency = currency;
		this.passengerInfo = new ArrayList<PassengerInfo>();
		this.passengerSegmentInfo = new ArrayList<PassengerSegmentInfo>();
		this.priceInfo = new ArrayList<PriceInfo>();
		this.flightInfo = new ArrayList<FlightInfoExtended>();
		this.templateType = PayloadType.AIRLINE_ITINERARY;
	}

	/**
	 * Instantiates a new AirlineItineraryTemplatePayload.
	 */
	public AirlineItineraryTemplatePayload() {
	}

	/**
	 * Gets the passenger info.
	 *
	 * @return the passenger info
	 */
	public List<PassengerInfo> getPassengerInfo() {
		return passengerInfo;
	}

	/**
	 * Sets the passenger info.
	 *
	 * @param passengerInfo
	 *            the new passenger info
	 */
	public void setPassengerInfo(List<PassengerInfo> passengerInfo) {
		this.passengerInfo = passengerInfo;
	}

	/**
	 * Gets the passenger segment info.
	 *
	 * @return the passenger segment info
	 */
	public List<PassengerSegmentInfo> getPassengerSegmentInfo() {
		return passengerSegmentInfo;
	}

	/**
	 * Sets the passenger segment info.
	 *
	 * @param passengerSegmentInfo
	 *            the new passenger segment info
	 */
	public void setPassengerSegmentInfo(
			List<PassengerSegmentInfo> passengerSegmentInfo) {
		this.passengerSegmentInfo = passengerSegmentInfo;
	}

	/**
	 * Gets the price info.
	 *
	 * @return the price info
	 */
	public List<PriceInfo> getPriceInfo() {
		return priceInfo;
	}

	/**
	 * Sets the price info.
	 *
	 * @param priceInfo
	 *            the new price info
	 */
	public void setPriceInfo(List<PriceInfo> priceInfo) {
		this.priceInfo = priceInfo;
	}

	/**
	 * Gets the base price.
	 *
	 * @return the base price
	 */
	public BigDecimal getBasePrice() {
		return basePrice;
	}

	/**
	 * Sets the base price.
	 *
	 * @param basePrice the new base price
	 */
	public void setBasePrice(BigDecimal basePrice) {
		this.basePrice = basePrice;
	}

	/**
	 * Gets the tax.
	 *
	 * @return the tax
	 */
	public BigDecimal getTax() {
		return tax;
	}

	/**
	 * Sets the tax.
	 *
	 * @param tax the new tax
	 */
	public void setTax(BigDecimal tax) {
		this.tax = tax;
	}

	/**
	 * Gets the total price.
	 *
	 * @return the total price
	 */
	public BigDecimal getTotalPrice() {
		return totalPrice;
	}

	/**
	 * Sets the total price.
	 *
	 * @param totalPrice the new total price
	 */
	public void setTotalPrice(BigDecimal totalPrice) {
		this.totalPrice = totalPrice;
	}

	/**
	 * Gets the currency.
	 *
	 * @return the currency
	 */
	public String getCurrency() {
		return currency;
	}

	/**
	 * Sets the currency.
	 *
	 * @param currency
	 *            the new currency
	 */
	public void setCurrency(String currency) {
		this.currency = currency;
	}

	/**
	 * Adds the passenger info.
	 *
	 * @param passengerInfo
	 *            the passenger info
	 */
	public void addPassengerInfo(PassengerInfo passengerInfo) {
		this.passengerInfo.add(passengerInfo);
	}

	/**
	 * Adds the passenger segment info.
	 *
	 * @param segmentInfo
	 *            the segment info
	 */
	public void addPassengerSegmentInfo(PassengerSegmentInfo segmentInfo) {
		this.passengerSegmentInfo.add(segmentInfo);
	}

	/**
	 * Adds the price info.
	 *
	 * @param priceInfo
	 *            the price info
	 */
	public void addPriceInfo(PriceInfo priceInfo) {
		this.priceInfo.add(priceInfo);
	}

	/**
	 * Adds the flight info.
	 *
	 * @param flightInfo
	 *            the flight info
	 */
	public void addFlightInfo(FlightInfoExtended flightInfo) {
		this.flightInfo.add(flightInfo);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see co.aurasphere.botmill.fb.model.outcoming.payload.template.airline.
	 * AirlineBasePnrNumberTemplatePayload#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result
				+ ((basePrice == null) ? 0 : basePrice.hashCode());
		result = prime * result
				+ ((currency == null) ? 0 : currency.hashCode());
		result = prime * result
				+ ((flightInfo == null) ? 0 : flightInfo.hashCode());
		result = prime * result
				+ ((passengerInfo == null) ? 0 : passengerInfo.hashCode());
		result = prime
				* result
				+ ((passengerSegmentInfo == null) ? 0 : passengerSegmentInfo
						.hashCode());
		result = prime * result
				+ ((priceInfo == null) ? 0 : priceInfo.hashCode());
		result = prime * result + ((tax == null) ? 0 : tax.hashCode());
		result = prime * result
				+ ((totalPrice == null) ? 0 : totalPrice.hashCode());
		return result;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see co.aurasphere.botmill.fb.model.outcoming.payload.template.airline.
	 * AirlineBasePnrNumberTemplatePayload#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		AirlineItineraryTemplatePayload other = (AirlineItineraryTemplatePayload) obj;
		if (basePrice == null) {
			if (other.basePrice != null)
				return false;
		} else if (!basePrice.equals(other.basePrice))
			return false;
		if (currency == null) {
			if (other.currency != null)
				return false;
		} else if (!currency.equals(other.currency))
			return false;
		if (flightInfo == null) {
			if (other.flightInfo != null)
				return false;
		} else if (!flightInfo.equals(other.flightInfo))
			return false;
		if (passengerInfo == null) {
			if (other.passengerInfo != null)
				return false;
		} else if (!passengerInfo.equals(other.passengerInfo))
			return false;
		if (passengerSegmentInfo == null) {
			if (other.passengerSegmentInfo != null)
				return false;
		} else if (!passengerSegmentInfo.equals(other.passengerSegmentInfo))
			return false;
		if (priceInfo == null) {
			if (other.priceInfo != null)
				return false;
		} else if (!priceInfo.equals(other.priceInfo))
			return false;
		if (tax == null) {
			if (other.tax != null)
				return false;
		} else if (!tax.equals(other.tax))
			return false;
		if (totalPrice == null) {
			if (other.totalPrice != null)
				return false;
		} else if (!totalPrice.equals(other.totalPrice))
			return false;
		return true;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see co.aurasphere.botmill.fb.model.outcoming.payload.template.airline.
	 * AirlineBasePnrNumberTemplatePayload#toString()
	 */
	@Override
	public String toString() {
		return "AirlineItineraryTemplatePayload [flightInfo=" + flightInfo
				+ ", passengerInfo=" + passengerInfo
				+ ", passengerSegmentInfo=" + passengerSegmentInfo
				+ ", priceInfo=" + priceInfo + ", basePrice=" + basePrice
				+ ", tax=" + tax + ", totalPrice=" + totalPrice + ", currency="
				+ currency + ", templateType=" + templateType + "]";
	}
}


text:
package pilot

import (
	"fmt"
	"strconv"
	"sync"
	"testing"
	"time"

	"istio.io/istio/tests/util"
	"istio.io/pkg/log"
)

// maybeAddTLSForDestinationRule fills the DestinationRule template if the mTLS is turned on globally.
func maybeAddTLSForDestinationRule(tc *testConfig, templateFile string) string {
	outYaml, _ := util.CreateAndFill(tc.Info.TempDir, templateFile, map[string]string{
		"globalMTlsEnable": strconv.FormatBool(tc.Kube.AuthEnabled),
	})
	return outYaml
}

// The gateway is just another service.
// So we try to reach this gateway from service t (without sidecar)
// but use the hostname (uk.bookinfo.com) with which we configured the gateway so that
// we match the virtual host in the gateway.
// The backend for uk.bookinfo.com is set to c-v2 using the rule-ingressgateway.yaml
// virtual service spec.
// The gateways have already been deployed by the helm charts, and are configured by
// default (kube service level) to expose ports 80/443. So our gateway specs also expose
// ports 80/443.
func TestGateway_HTTPIngress(t *testing.T) {
	// Skip test if SDS is enabled.
	// Istio does not support legacy JWTs anymore.
	// Only Kubernetes 1.12 (beta) and later support trustworthy JWTs.
	if tc.Kube.AuthSdsEnabled {
		t.Skipf("Skipping %s: auth_sds_enable=true=true.", t.Name())
	}

	istioNamespace := tc.Kube.IstioSystemNamespace()
	ingressGatewayServiceName := tc.Kube.IstioIngressGatewayService()

	// Configure a route from us.bookinfo.com to "c-v2" only
	cfgs := &deployableConfig{
		Namespace: tc.Kube.Namespace,
		YamlFiles: []string{
			"testdata/networking/v1alpha3/ingressgateway.yaml",
			maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/destination-rule-c.yaml"),
			"testdata/networking/v1alpha3/rule-ingressgateway.yaml"},
		kubeconfig: tc.Kube.KubeConfig,
	}
	if err := cfgs.Setup(); err != nil {
		t.Fatal(err)
	}
	defer cfgs.Teardown()

	for cluster := range tc.Kube.Clusters {
		runRetriableTest(t, "HTTPIngressGateway", defaultRetryBudget, func() error {
			reqURL := fmt.Sprintf("http://%s.%s/c", ingressGatewayServiceName, istioNamespace)
			resp := ClientRequest(cluster, "t", reqURL, 100, "--key Host --val uk.bookinfo.com:80")
			count := make(map[string]int)
			for _, elt := range resp.Version {
				count[elt]++
			}
			log.Infof("request counts %+v", count)
			if count["v2"] >= 95 {
				return nil
			}
			return errAgain
		})
	}
}

func TestGateway_HTTPSIngress(t *testing.T) {
	// Skip test if SDS is enabled.
	// Istio does not support legacy JWTs anymore.
	// Only Kubernetes 1.12 (beta) and later support trustworthy JWTs.
	if tc.Kube.AuthSdsEnabled {
		t.Skipf("Skipping %s: auth_sds_enable=true=true.", t.Name())
	}

	istioNamespace := tc.Kube.IstioSystemNamespace()
	ingressGatewayServiceName := tc.Kube.IstioIngressGatewayService()

	// Configure a route from us.bookinfo.com to "c-v2" only
	cfgs := &deployableConfig{
		Namespace: tc.Kube.Namespace,
		YamlFiles: []string{
			"testdata/networking/v1alpha3/ingressgateway.yaml",
			maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/destination-rule-c.yaml"),
			"testdata/networking/v1alpha3/rule-ingressgateway.yaml"},
		kubeconfig: tc.Kube.KubeConfig,
	}
	if err := cfgs.Setup(); err != nil {
		t.Fatal(err)
	}
	defer cfgs.Teardown()

	for cluster := range tc.Kube.Clusters {
		runRetriableTest(t, "HTTPSIngressGateway", defaultRetryBudget, func() error {
			reqURL := fmt.Sprintf("https://%s.%s/c", ingressGatewayServiceName, istioNamespace)
			resp := ClientRequest(cluster, "t", reqURL, 100, "--key Host --val uk.bookinfo.com")
			count := make(map[string]int)
			for _, elt := range resp.Version {
				count[elt]++
			}
			log.Infof("request counts %+v", count)
			if count["v2"] >= 95 {
				return nil
			}
			return errAgain
		})
	}
}

func TestGateway_TCPIngress(t *testing.T) {
	// Skip test if SDS is enabled.
	// Istio does not support legacy JWTs anymore.
	// Only Kubernetes 1.12 (beta) and later support trustworthy JWTs.
	if tc.Kube.AuthSdsEnabled {
		t.Skipf("Skipping %s: auth_sds_enable=true=true.", t.Name())
	}

	istioNamespace := tc.Kube.IstioSystemNamespace()
	ingressGatewayServiceName := tc.Kube.IstioIngressGatewayService()

	// Configure a route from us.bookinfo.com to "c-v2" only
	cfgs := &deployableConfig{
		Namespace: tc.Kube.Namespace,
		YamlFiles: []string{
			"testdata/networking/v1alpha3/ingressgateway.yaml",
			maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/destination-rule-c.yaml"),
			"testdata/networking/v1alpha3/rule-ingressgateway.yaml"},
		kubeconfig: tc.Kube.KubeConfig,
	}
	if err := cfgs.Setup(); err != nil {
		t.Fatal(err)
	}
	defer cfgs.Teardown()

	for cluster := range tc.Kube.Clusters {
		runRetriableTest(t, "TCPIngressGateway", defaultRetryBudget, func() error {
			reqURL := fmt.Sprintf("http://%s.%s:31400/c", ingressGatewayServiceName, istioNamespace)
			resp := ClientRequest(cluster, "t", reqURL, 100, "--key Host --val uk.bookinfo.com")
			count := make(map[string]int)
			for _, elt := range resp.Version {
				count[elt]++
			}
			log.Infof("request counts %+v", count)
			if count["v1"] >= 95 {
				return nil
			}
			return errAgain
		})
	}
}

func TestIngressGateway503DuringRuleChange(t *testing.T) {
	// Skip test if SDS is enabled.
	// Istio does not support legacy JWTs anymore.
	// Only Kubernetes 1.12 (beta) and later support trustworthy JWTs.
	if tc.Kube.AuthSdsEnabled {
		t.Skipf("Skipping %s: auth_sds_enable=true=true.", t.Name())
	}

	istioNamespace := tc.Kube.IstioSystemNamespace()
	ingressGatewayServiceName := tc.Kube.IstioIngressGatewayService()

	gateway := &deployableConfig{
		Namespace:  tc.Kube.Namespace,
		YamlFiles:  []string{"testdata/networking/v1alpha3/ingressgateway.yaml"},
		kubeconfig: tc.Kube.KubeConfig,
	}

	// Add subsets
	newDestRule := &deployableConfig{
		Namespace:  tc.Kube.Namespace,
		YamlFiles:  []string{maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/rule-503test-destinationrule-c.yaml")},
		kubeconfig: tc.Kube.KubeConfig,
	}

	// route to subsets
	newVirtService := &deployableConfig{
		Namespace:  tc.Kube.Namespace,
		YamlFiles:  []string{"testdata/networking/v1alpha3/rule-503test-virtualservice.yaml"},
		kubeconfig: tc.Kube.KubeConfig,
	}

	addMoreSubsets := &deployableConfig{
		Namespace:  tc.Kube.Namespace,
		YamlFiles:  []string{maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/rule-503test-destinationrule-c-add-subset.yaml")},
		kubeconfig: tc.Kube.KubeConfig,
	}

	routeToNewSubsets := &deployableConfig{
		Namespace:  tc.Kube.Namespace,
		YamlFiles:  []string{"testdata/networking/v1alpha3/rule-503test-update-virtualservice.yaml"},
		kubeconfig: tc.Kube.KubeConfig,
	}

	deleteOldSubsets := &deployableConfig{
		Namespace:  tc.Kube.Namespace,
		YamlFiles:  []string{maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/rule-503test-destinationrule-c-del-subset.yaml")},
		kubeconfig: tc.Kube.KubeConfig,
	}

	var resp ClientResponse
	var err error
	var fatalError bool

	if err = gateway.Setup(); err != nil {
		t.Fatal(err)
	}
	defer gateway.Teardown()

	log.Infof("Adding new subsets v1,v2")
	// these functions have built in sleep. So we don't have to add any extra sleep here
	if err = newDestRule.Setup(); err != nil {
		t.Fatal(err)
	}
	defer newDestRule.Teardown()

	log.Infof("routing to v1,v2")
	if err = newVirtService.Setup(); err != nil {
		t.Fatal(err)
	}
	defer newVirtService.Teardown()

	time.Sleep(5 * time.Second)
	var wg sync.WaitGroup
	for cluster := range tc.Kube.Clusters {
		wg.Add(1)
		clusterc := cluster
		go func() {
			defer wg.Done()
			reqURL := fmt.Sprintf("http://%s.%s/c", ingressGatewayServiceName, istioNamespace)
			// 500 requests @20 qps = 25s. This is the minimum required to cover all rule changes below.
			resp = ClientRequest(clusterc, "t", reqURL, 500, "--key Host --val uk.bookinfo.com --qps 20")
		}()
	}

	log.Infof("Adding new subsets v3,v4")
	if err = addMoreSubsets.Setup(); err != nil {
		fatalError = true
		goto cleanup
	}
	time.Sleep(5 * time.Second)
	log.Infof("routing to v3,v4")
	if err = routeToNewSubsets.Setup(); err != nil {
		fatalError = true
		goto cleanup
	}
	time.Sleep(2 * time.Second)
	log.Infof("deleting old subsets v1,v2")
	if err = deleteOldSubsets.Setup(); err != nil {
		fatalError = true
		goto cleanup
	}

cleanup:
	wg.Wait()
	if fatalError {
		t.Fatal(err)
	} else {
		if len(resp.Code) > 0 {
			count := make(map[string]int)
			for _, elt := range resp.Code {
				count[elt]++
			}
			if count["200"] != len(resp.Code) {
				// have entries other than 200
				t.Errorf("Got non 200 status code while changing rules: %+v", count)
			} else {
				log.Infof("No 503s were encountered while changing rules (total %d requests)", len(resp.Code))
			}
		} else {
			t.Errorf("Could not parse response codes from the client")
		}
	}
}

func TestVirtualServiceMergingAtGateway(t *testing.T) {
	// Skip test if SDS is enabled.
	// Istio does not support legacy JWTs anymore.
	// Only Kubernetes 1.12 (beta) and later support trustworthy JWTs.
	if tc.Kube.AuthSdsEnabled {
		t.Skipf("Skipping %s: auth_sds_enable=true=true.", t.Name())
	}

	istioNamespace := tc.Kube.IstioSystemNamespace()
	ingressGatewayServiceName := tc.Kube.IstioIngressGatewayService()

	cfgs := &deployableConfig{
		Namespace: tc.Kube.Namespace,
		YamlFiles: []string{
			"testdata/networking/v1alpha3/ingressgateway.yaml",
			maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/destination-rule-c.yaml"),
			"testdata/networking/v1alpha3/rule-merging-path1.yaml",
			"testdata/networking/v1alpha3/rule-merging-path2.yaml"},
		kubeconfig: tc.Kube.KubeConfig,
	}
	if err := cfgs.Setup(); err != nil {
		t.Fatal(err)
	}
	defer cfgs.Teardown()

	for cluster := range tc.Kube.Clusters {
		runRetriableTest(t, "VirtualServiceMergingAtGateway-route1", defaultRetryBudget, func() error {
			reqURL := fmt.Sprintf("http://%s.%s/route1", ingressGatewayServiceName, istioNamespace)
			resp := ClientRequest(cluster, "t", reqURL, 10, "--key Host --val uk.bookinfo.com:80")
			count := make(map[string]int)
			for _, elt := range resp.Version {
				count[elt]++
			}
			log.Infof("request counts %v", count)
			if count["v1"] == 10 {
				return nil
			}
			return fmt.Errorf("expected %v requests to reach %s => Got %v", 10, "v1", count)
		})

		runRetriableTest(t, "VirtualServiceMergingAtGateway-route2", defaultRetryBudget, func() error {
			reqURL := fmt.Sprintf("http://%s.%s/route2", ingressGatewayServiceName, istioNamespace)
			resp := ClientRequest(cluster, "t", reqURL, 10, "--key Host --val uk.bookinfo.com:80")
			count := make(map[string]int)
			for _, elt := range resp.Version {
				count[elt]++
			}
			log.Infof("request counts %v", count)
			if count["v2"] == 10 {
				return nil
			}
			return fmt.Errorf("expected %v requests to reach %s => Got %v", 10, "v2", count)
		})
	}
}


text:
package com.serjltt.moshi.adapters;

import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.JsonReader;
import com.squareup.moshi.JsonWriter;
import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * {@linkplain JsonAdapter} that fallbacks to a default value of a primitive field annotated with
 * {@linkplain FallbackOnNull}.
 */
final class FallbackOnNullJsonAdapter<T> extends JsonAdapter<T> {
  /** Set of primitives classes that are supported by this adapter. */
  static final Set<Class<?>> PRIMITIVE_CLASSES = new LinkedHashSet<>();

  static {
    PRIMITIVE_CLASSES.add(boolean.class);
    PRIMITIVE_CLASSES.add(byte.class);
    PRIMITIVE_CLASSES.add(char.class);
    PRIMITIVE_CLASSES.add(double.class);
    PRIMITIVE_CLASSES.add(float.class);
    PRIMITIVE_CLASSES.add(int.class);
    PRIMITIVE_CLASSES.add(long.class);
    PRIMITIVE_CLASSES.add(short.class);
  }

  final JsonAdapter<T> delegate;
  final T fallback;
  final String fallbackType;

  FallbackOnNullJsonAdapter(JsonAdapter<T> delegate, T fallback, String fallbackType) {
    this.delegate = delegate;
    this.fallback = fallback;
    this.fallbackType = fallbackType;
  }

  @Override public T fromJson(JsonReader reader) throws IOException {
    if (reader.peek() == JsonReader.Token.NULL) {
      reader.nextNull(); // We need to consume the value.
      return fallback;
    }
    return delegate.fromJson(reader);
  }

  @Override public void toJson(JsonWriter writer, T value) throws IOException {
    delegate.toJson(writer, value);
  }

  @Override public String toString() {
    return delegate + ".fallbackOnNull(" + fallbackType + '=' + fallback + ')';
  }
}


text:
            <input type="text" data-dojo-props="regExp: '(https?|ftp)://[A-Za-z0-9-_]+\.[A-Za-z0-9-_%&~\?\/\.=]+', required:true, trim:true" data-dojo-attach-point="urlInput" style="width: 420px;" data-dojo-type="dijit.form.ValidationTextBox"/>

				<button data-dojo-type="dijit.form.Button" type="button" data-dojo-props="class:'dialogShadedButton'">Create transfer

				</button>
				<button data-dojo-type="dijit.form.Button" type="button" data-dojo-props="class:'dialogShadedButton'">Cancel

				</button>

					<input type="radio" name="groupEnable" checked value="off" data-dojo-attach-event="onclick:_disableShareGroup"/> No group: anonymous access

					<input type="radio" name="groupEnable" value="on" data-dojo-attach-event="onclick:_enableShareGroup"/> Choose group:

					<input type="hidden" data-dojo-attach-point="groupEnable" value="off"/>

Group members who will get access:

<input name="readonlycheck" data-dojo-attach-point="readOnlyCheckBox" data-dojo-type="dijit/form/CheckBox" value="true" checked/> Read only

				<button data-dojo-type="dijit.form.Button" data-dojo-props="class:'dialogShadedButton'" type="submit">Create share
				</button>
				<button data-dojo-type="dijit.form.Button" data-dojo-props="class:'dialogShadedButton'">Cancel

				</button>


text:
if [ $(id -u) -ne 0 ]; then
	gksu "'$0' $@"
	exit $?
fi

###  ERROR  ###

zenity_escape()
{
	echo "$1" | sed -e 's/</\</g' -e 's/>/\>/g' -e 's/\(\W\)/\\\1/g'
}

error()
{
	head="@APPNAME@: $(zenity_escape "$1")"
	body=$(zenity_escape "$2")
	text="$head\n\n$body"
	zenity --error --title="" --no-wrap --text="$text" 2> /dev/null \
	|| echo -e "$1: $2" >&2
	exit 1
}

###  PATHS  ###

self_file=$(readlink -f "$0") || error "Unexpected error" "readlink failed"
self_dir=$(dirname "$self_file")

gui_file="$self_dir/@rel_gui@"
config_file="$self_dir/@rel_config@"

###  CONFIG FILE  ###

print_default_config_file()
{
echo "$(cat <<'END_OF_DEFAULT_CONFIG'
[path]

lampp:         @def_lamppdir@

[command]

lampp:         %path_lampp%/lampp

start:         %command_lampp% start
startapache:   %command_lampp% startapache
startmysql:    %command_lampp% startmysql
startftp:      %command_lampp% startftp

stop:          %command_lampp% stop
stopapache:    %command_lampp% stopapache
stopmysql:     %command_lampp% stopmysql
stopftp:       %command_lampp% stopftp

reload:        %command_lampp% reload
reloadapache:  %command_lampp% reloadapache
reloadmysql:   %command_lampp% reloadmysql
reloadftp:     %command_lampp% reloadftp

restart:       %command_lampp% restart
security:      %command_lampp% security

enablessl:     %command_lampp% enablessl
disablessl:    %command_lampp% disablessl

backup:        %command_lampp% backup
oci8:          %command_lampp% oci8

status:        %path_scripts%/lampp_status.sh
END_OF_DEFAULT_CONFIG
)"
}

make_config_file()
{
	print_default_config_file > "$config_file"
	chown root:root "$config_file"
	chmod 644 "$config_file"
}

init_config_file()
{
	[ -f "$config_file" ] || make_config_file
}

###  VERSION  ###

print_version()
{
	echo '@APPNAME@ (@PACKAGE@) v@VERSION@ (@DATE@) @WEBSITE@'
}

###  OPTIONS  ###

usage()
{
cat <<EOF
Usage: @PACKAGE@ [params]
 --version : Print out package name and version and exit
 --help | -h : Print out this help message and exit
 --print-default-config | -c : Print out the default config file content
 --make-config | -C : Wipe config and create a new one using the default config
EOF
}

no_gui=''

while [ -n "$1" ]
do
	case $1 in
	--version) print_version; exit 0;;
	-h | --help) usage; exit 0;;
	-c | --print-default-config) print_default_config_file; no_gui=1; shift;;
	-C | --make-config) make_config_file; no_gui=1; shift;;
	'') shift;;
	*) usage; error "Parameter error" "Unknown option \"$1\"";;
	esac
done

[ -n "$no_gui" ] && exit 0

###  RUN GUI  ###

init_config_file

tmp_prefix="/tmp/$(date +%s%N)"
out_log="$tmp_prefix-log"
err_log="$tmp_prefix-log"
out_fifo="$tmp_prefix-out-fifo"
err_fifo="$tmp_prefix-err-fifo"
mkfifo "$out_fifo"
mkfifo "$err_fifo"
touch "$out_log" "$err_log"
log_pipe()
{
	cmd='echo "$1" >&'$1
	while read line; do
		sh -c "$cmd" +o "$line"
		echo "$line" >> "$2"
	done
}
cat "$out_fifo" | log_pipe 1 "$out_log" &
cat "$err_fifo" | log_pipe 2 "$err_log" &
"$gui_file" 2>"$err_fifo" > "$out_fifo"
exitcode=$?
out=$(cat "$out_log")
err=$(cat "$err_log")
rm -f "$out_fifo" "$err_fifo" "$out_log" "$err_log"
[ $exitcode -eq 0 ] || error "Unexpected error" "$err"


text:
#include "postgres_fe.h"
#include "pqexpbuffer.h"
#include "libpq-fe.h"
#include <regex.h>
#include <sys/stat.h>
#include <limits.h>
#include <assert.h>
#include "cdb_dump_util.h"
#include "cdb_table.h"
#include "cdb_seginst.h"

/* FreeSegmentDatabaseArray: This function frees the memory allocated for ther pSegDBAr->pData array,
 * and the strings that were allocated for each element in the array
 * It does NOT free the pSegDBAr itself.
 */
void
FreeSegmentDatabaseArray(SegmentDatabaseArray *pSegDBAr)
{
	int			i;

	if (pSegDBAr == NULL)
		return;

	for (i = 0; i < pSegDBAr->count; i++)
	{
		SegmentDatabase *pSegDB = &pSegDBAr->pData[i];

		if (pSegDB->pszHost != NULL)
			free(pSegDB->pszHost);
	}

	if (pSegDBAr->pData != NULL)
		free(pSegDBAr->pData);

	pSegDBAr->count = 0;
	pSegDBAr->pData = NULL;
}

void
FreeRestorePairArray(RestorePairArray * restorePairAr)
{
	if (restorePairAr == NULL)
		return;

	if (restorePairAr->pData != NULL)
		free(restorePairAr->pData);

	restorePairAr->count = 0;
	restorePairAr->pData = NULL;
}

/* GetSegmentDatabaseArray: This function reads all active instance segment pairs
 * from the function gp_segment_instance_map().
 * It then uses the set specification fo filter out any instid, segid combinations
 * that don't match the set.  bExcludeHead = true is used for restoring, because
 * the head is restored first seperately from the rest of the databases.
 */
bool
GetDumpSegmentDatabaseArray(PGconn *pConn,
							int remote_version,
							SegmentDatabaseArray *pSegDBAr,
							ActorSet actors,
							char *dump_set_str,
							bool dataOnly,
							bool schemaOnly)
{
	bool		bRtn = true;
	PQExpBuffer pQry = NULL;
	PGresult   *pRes = NULL;
	int			ntups;
	int			count;
	int			i_dbid;
	int			i_content;
	int			i_host;
	int			i_port;
	int			i;
	int			j;
	int			x;
	int			dbidset_count = 0;
	int		   *dbidset = NULL;
	SegmentDatabase *pSegDB;

	pQry = createPQExpBuffer();

	if (remote_version >= 80214)
		/* 4.0 and beyond */
		appendPQExpBuffer(pQry, "SELECT"
						  " dbid,"
						  " content,"
						  " hostname,"
						  " port "
						  "FROM "
						  " gp_segment_configuration "
						  "WHERE role='p' "
						  "ORDER BY content DESC");
	else
		/* pre 4.0 */
		appendPQExpBuffer(pQry, "SELECT"
						  " dbid,"
						  " content,"
						  " hostname,"
						  " port "
						  "FROM"
						  " gp_configuration "
						  "WHERE valid = 't' "
						  "AND isPrimary = 't' "
						  "ORDER BY content DESC");

	pRes = PQexec(pConn, pQry->data);
	if (!pRes || PQresultStatus(pRes) != PGRES_TUPLES_OK)
	{
		mpp_err_msg("ERROR", "gp_dump", "query to obtain list of Greenplum segment databases failed: %s",
					PQerrorMessage(pConn));
		bRtn = false;
		goto cleanup;
	}

	ntups = PQntuples(pRes);
	if (ntups <= 0)
	{
		mpp_err_msg("ERROR", "gp_dump", "no Greenplum segment databases found on master segment schema");
		bRtn = false;
		goto cleanup;
	}

	count = ntups + 1;

	/*
	 * See how many set elements there are that were specified by HostIP or
	 * name.
	 */

	/*
	 * Allocate enough memory for all of them, even though some may be
	 * filtered out.
	 */
	pSegDBAr->count = 0;
	pSegDBAr->pData = (SegmentDatabase *) calloc(count, sizeof(SegmentDatabase));
	if (pSegDBAr->pData == NULL)
	{
		mpp_err_msg("ERROR", "gp_dump", "Unable to allocate memory for Greenplum segment/instances information\n");
		bRtn = false;
		goto cleanup;
	}

	/* get the column numbers */
	i_dbid = PQfnumber(pRes, "dbid");
	i_content = PQfnumber(pRes, "content");
	i_host = PQfnumber(pRes, "hostname");
	i_port = PQfnumber(pRes, "port");

	/*
	 * if an individual set of dbid's was requested to be dumped, parse it and
	 * check that it really exists and is a primary segment.
	 */
	if (actors == SET_INDIVIDUAL)
	{
		/* allocate dbidset. len is more than we need but it's a safe bet */
		dbidset = (int *) calloc(strlen(dump_set_str), sizeof(int));
		MemSet(dbidset, 0, strlen(dump_set_str) * sizeof(int));

		if (dbidset == NULL)
		{
			mpp_err_msg("ERROR", "gp_dump", "Unable to allocate memory for Greenplum dbid set information\n");
			bRtn = false;
			goto cleanup;
		}

		/* parse the user specified dbid list, return dbid count */
		dbidset_count = parseDbidSet(dbidset, dump_set_str);

		if (dbidset_count < 1)
		{
			bRtn = false;
			goto cleanup;
		}

		for (i = 0; i < dbidset_count; i++)
		{
			bool		match = false;

			for (j = 0; j < ntups; j++)
			{
				int			dbid = atoi(PQgetvalue(pRes, j, i_dbid));

				if (dbid == dbidset[i])
				{
					match = true;
					break;
				}
			}

			if (!match)
			{
				mpp_err_msg("ERROR", "gp_dump", "dbid %d is not a correct Greenplum segment databases "
						"entry, or is not a primary segment\n ", dbidset[i]);
				bRtn = false;
				goto cleanup;
			}
		}
	}

	mpp_err_msg("INFO", "gp_dump", "Preparing to dump the following segments:\n");

	/* Read through the results set (all primary segments) */
	x = 0;
	for (i = 0; i < ntups; i++)
	{
		int			dbid = atoi(PQgetvalue(pRes, i, i_dbid));
		int			content = atoi(PQgetvalue(pRes, i, i_content));
		bool		should_dump = false;

		/* in dataOnly we don't dump master information */
		if (dataOnly && content == -1 && actors != SET_INDIVIDUAL)
			continue;

		/* in schemaOnly we skip all but the master */
		if (schemaOnly && content != -1 && actors != SET_INDIVIDUAL)
			continue;

		if (actors == SET_INDIVIDUAL)
		{
			should_dump = false;

			for (j = 0; j < dbidset_count; j++)
			{
				if (dbid == dbidset[j])
					should_dump = true;
			}

			if (!should_dump)
				continue;
		}

		pSegDB = &pSegDBAr->pData[x++];
		pSegDB->dbid = dbid;
		pSegDB->content = content;
		pSegDB->role = (content == -1 ? ROLE_MASTER : ROLE_SEGDB);
		pSegDB->port = atoi(PQgetvalue(pRes, i, i_port));
		pSegDB->pszHost = strdup(PQgetvalue(pRes, i, i_host));
		pSegDB->pszDBName = PQdb(pConn);
		pSegDB->pszDBUser = PQuser(pConn);
		pSegDB->pszDBPswd = PQpass(pConn);

		if (pSegDB->role == ROLE_MASTER)
			mpp_err_msg("INFO", "gp_dump", "Master (dbid 1)\n");
		else
			mpp_err_msg("INFO", "gp_dump", "Segment %d (dbid %d)\n",
						pSegDB->content,
						pSegDB->dbid);
	}

	/* set the count to be the number that passed the set inclusion test */
	pSegDBAr->count = x;

cleanup:
	if (pQry != NULL)
		destroyPQExpBuffer(pQry);
	if (pRes != NULL)
		PQclear(pRes);

	return bRtn;
}

bool
GetRestoreSegmentDatabaseArray(PGconn *pConn,
							   RestorePairArray * restorePairAr,
							   BackupLoc backupLocation,
							   char *restore_set_str,
							   bool dataOnly)
{
	bool		bRtn = true;
	PQExpBuffer pQry = NULL;
	PGresult   *pRes = NULL;
	int			ntups;
	int			count;
	int			i_dbid;
	int			i_content;
	int			i_host;
	int			i_port;
	int			i;
	int			j;
	int			x;
	int			dbidset_count = 0;
	int		   *dbidset = NULL;
	SegmentDatabase *sourceSegDB;
	SegmentDatabase *targetSegDB;

	pQry = createPQExpBuffer();

	appendPQExpBuffer(pQry, "SELECT"
					  " dbid,"
					  " content,"
					  " hostname,"
					  " port "
					  "FROM "
					  " gp_segment_configuration "
					  "WHERE role='p' "
					  "ORDER BY content DESC");

	pRes = PQexec(pConn, pQry->data);
	if (!pRes || PQresultStatus(pRes) != PGRES_TUPLES_OK)
	{
		mpp_err_msg("ERROR", "gp_restore", "query to obtain list of Greenplum segment databases failed: %s",
					PQerrorMessage(pConn));
		bRtn = false;
		goto cleanup;
	}

	ntups = PQntuples(pRes);
	if (ntups <= 0)
	{
		mpp_err_msg("ERROR", "gp_restore", "no Greenplum segment databases found on master segment schema");
		bRtn = false;
		goto cleanup;
	}

	count = ntups + 1;

	/*
	 * Allocate enough memory for all of them, even though some may be
	 * filtered out.
	 */
	restorePairAr->count = 0;
	restorePairAr->pData = (RestorePair *) calloc(count, sizeof(RestorePair));
	if (restorePairAr->pData == NULL)
	{
		mpp_err_msg("ERROR", "gp_restore", "Unable to allocate memory for Greenplum segment database information\n");
		bRtn = false;
		goto cleanup;
	}

	/* get the column numbers */
	i_dbid = PQfnumber(pRes, "dbid");
	i_content = PQfnumber(pRes, "content");
	i_host = PQfnumber(pRes, "hostname");
	i_port = PQfnumber(pRes, "port");

	/*
	 * if the dump file is on individual databases, parse the list of dbid's
	 * where those files exist.
	 */
	if (backupLocation == FILE_ON_INDIVIDUAL)
	{
		/* allocate dbidset. len is more than we need but it's a safe bet */
		dbidset = (int *) calloc(strlen(restore_set_str), sizeof(int));
		MemSet(dbidset, 0, strlen(restore_set_str) * sizeof(int));

		if (dbidset == NULL)
		{
			mpp_err_msg("ERROR", "gp_restore", "Unable to allocate memory for Greenplum dbidset information\n");
			bRtn = false;
			goto cleanup;
		}

		/* parse the user specified dbid list, return dbid count */
		dbidset_count = parseDbidSet(dbidset, restore_set_str);

		if (dbidset_count < 1)
		{
			bRtn = false;
			goto cleanup;
		}

		for (i = 0; i < dbidset_count; i++)
		{
			bool		match = false;

			for (j = 0; j < ntups; j++)
			{
				int			dbid = atoi(PQgetvalue(pRes, j, i_dbid));

				if (dbid == dbidset[i])
				{
					match = true;
					break;
				}
			}

			if (!match)
			{
				mpp_err_msg("ERROR", "gp_restore", "dbid %d is not a primary Greenplum segment databases entry\n",
							dbidset[i]);
				bRtn = false;
				goto cleanup;
			}
		}
	}

	mpp_err_msg("INFO", "gp_restore", "Preparing to restore the following segments:\n");

	/* Read through the results set.  */
	x = 0;
	for (i = 0; i < ntups; i++)
	{
		int			dbid = atoi(PQgetvalue(pRes, i, i_dbid));
		int			contentid = atoi(PQgetvalue(pRes, i, i_content));
		bool		should_restore = false;

		/* if dataOnly don't restore the master (table definitions) */
		if (dataOnly && contentid == -1)
			continue;

		if (backupLocation == FILE_ON_INDIVIDUAL)
		{
			should_restore = false;

			for (j = 0; j < dbidset_count; j++)
			{
				if (dbid == dbidset[j])
					should_restore = true;
			}

			if (!should_restore)
				continue;
		}

		targetSegDB = &restorePairAr->pData[x].segdb_target;
		targetSegDB->dbid = dbid;
		targetSegDB->role = (contentid == -1 ? ROLE_MASTER : ROLE_SEGDB);
		targetSegDB->port = atoi(PQgetvalue(pRes, i, i_port));
		targetSegDB->pszHost = strdup(PQgetvalue(pRes, i, i_host));
		targetSegDB->pszDBName = PQdb(pConn);
		targetSegDB->pszDBUser = PQuser(pConn);
		targetSegDB->pszDBPswd = PQpass(pConn);
		targetSegDB->content = contentid;

		sourceSegDB = &restorePairAr->pData[x].segdb_source;
		sourceSegDB->dbid = targetSegDB->dbid;
		sourceSegDB->role = targetSegDB->role;
		sourceSegDB->port = targetSegDB->port;
		sourceSegDB->pszHost = targetSegDB->pszHost;
		sourceSegDB->pszDBName = targetSegDB->pszDBName;
		sourceSegDB->pszDBUser = targetSegDB->pszDBUser;
		if (targetSegDB->pszDBPswd)
			sourceSegDB->pszDBPswd = targetSegDB->pszDBPswd;

		if (targetSegDB->role == ROLE_MASTER)
			mpp_err_msg("INFO", "gp_restore", "Master (dbid 1)\n");
		else
			mpp_err_msg("INFO", "gp_restore", "Segment %d (dbid %d)\n",
						contentid,
						targetSegDB->dbid);

		x++;
	}

	/* set the count to be the number that passed the set inclusion test */
	restorePairAr->count = x;

cleanup:
	if (pQry != NULL)
		destroyPQExpBuffer(pQry);
	if (pRes != NULL)
		PQclear(pRes);

	return bRtn;
}


text:
package apollo.editor;

import java.util.HashMap;
import java.util.Map;
import java.io.Serializable;

/**
 * Value class for transaction object classes
 * Presently used for Transaction. Should eventually be used
 * by FeatureChangeEvents as well.
 */
public class TransactionClass implements Serializable {

  private static Map stringToClass = new HashMap(7);

  public static final TransactionClass EXON = new TransactionClass("EXON");
  public static final TransactionClass COMMENT = new TransactionClass("COMMENT");
  public static final TransactionClass EVIDENCE = new TransactionClass("EVIDENCE");
  // I dont think translation belongs here - fix this!
  public static final TransactionClass TRANSLATION = new TransactionClass("TRANSLATION");
  public static final TransactionClass TRANSCRIPT = new TransactionClass("TRANSCRIPT");
  public static final TransactionClass ANNOTATION = new TransactionClass("ANNOTATION");
  /** This probably belongs in a new value class ObjectPart or something like
      that - for now shoving here - to say type has changed */
  public static final TransactionClass TYPE = new TransactionClass("TYPE");

  private String classString;

  private TransactionClass(String classString) {
    this.classString = classString;
    stringToClass.put(classString,this);
  }
  public String toString() { return classString; }

  public static TransactionClass stringToClass(String classString) {
    return (TransactionClass)stringToClass.get(classString);
  }
}


text:
package com.amazonaws.services.elasticloadbalancingv2.model.transform;

import java.util.List;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.elasticloadbalancingv2.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * DescribeTagsRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeTagsRequestMarshaller implements Marshaller<Request<DescribeTagsRequest>, DescribeTagsRequest> {

    public Request<DescribeTagsRequest> marshall(DescribeTagsRequest describeTagsRequest) {

        if (describeTagsRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        Request<DescribeTagsRequest> request = new DefaultRequest<DescribeTagsRequest>(describeTagsRequest, "AmazonElasticLoadBalancing");
        request.addParameter("Action", "DescribeTags");
        request.addParameter("Version", "2015-12-01");
        request.setHttpMethod(HttpMethodName.POST);

        if (describeTagsRequest.getResourceArns() != null) {
            java.util.List<String> resourceArnsList = describeTagsRequest.getResourceArns();
            if (resourceArnsList.isEmpty()) {
                request.addParameter("ResourceArns", "");
            } else {
                int resourceArnsListIndex = 1;

                for (String resourceArnsListValue : resourceArnsList) {
                    if (resourceArnsListValue != null) {
                        request.addParameter("ResourceArns.member." + resourceArnsListIndex, StringUtils.fromString(resourceArnsListValue));
                    }
                    resourceArnsListIndex++;
                }
            }
        }

        return request;
    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Java - Blog</title>
    <meta name="description" content="" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="https://sfoubert.github.io/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//sfoubert.github.io/themes/ichi/assets/css/normalize.css?v=1543497733221" />
    <link rel="stylesheet" type="text/css" href="//sfoubert.github.io/themes/ichi/assets/css/foundation.min.css?v=1543497733221" />

    <link rel="stylesheet" type="text/css" href="//sfoubert.github.io/themes/ichi/assets/fonts/foundation-icons/foundation-icons.css?v=1543497733221" />
    <link rel="stylesheet" type="text/css" href="//sfoubert.github.io/themes/ichi/assets/css/styles.css?v=1543497733221" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:300,700,400|Source+Sans+Pro:300,400,600,700,900,300italic,400italic,600italic,700italic,900italic" />

    <link rel="canonical" href="https://sfoubert.github.io/https://sfoubert.github.io/tag/Java/" />
    <meta name="referrer" content="origin" />

    <meta property="og:site_name" content="Blog" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Java - Blog" />
    <meta property="og:url" content="https://sfoubert.github.io/https://sfoubert.github.io/tag/Java/" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="Java - Blog" />
    <meta name="twitter:url" content="https://sfoubert.github.io/https://sfoubert.github.io/tag/Java/" />

    <meta name="generator" content="HubPress" />
    <link rel="alternate" type="application/rss+xml" title="Blog" href="https://sfoubert.github.io/rss/" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/prism/1.14.0/themes/prism-okaidia.min.css">

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

    <button type="button" class="overlay-close">Close</button>

Home

Blog

Java

            <time datetime="2018-11-29">29 Nov 2018</time>

Déclarer une ExceptionHandler dans SpringBoot

Voici comment déclarer des ExceptionHandlers pour transformer ses exceptions en réponse HTTP package fr.ippon.service.supply.purchaseorder.web.rest.exception; import fr.ippon.service.supply.common.exception.CreateBadRequestException; import fr.ippon.service.supply.common.exception.CreateConflictException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity;…

        Read more
        Posted on SpringBoot, Java

    Page 1 of 1


text:
/*
This tutorial show's how to use the animation Interpolation Group to change values in at least 3 dimensions.
The tutorial are using the animations in three different angles with different channels but, you can use the same funcions in every channel.
*/

#include <stdio.h>

//Including interpolation group for animate at least 3 values at the same time
#include "edk/animation/Interpolation3DGroup.h"
//Including interpolation for path
#include "edk/animation/Path3DGroup.h"

int main(){
    //
    edk::animation::Interpolation1DGroup inter1;

    //add first interpolation with two points
    inter1.addFirstInterpolationLine(0.f,0.f,1.f,1.f);
    //add a new interpolation passin a third point
    inter1.addNewInterpolationLine(2.f,2.f);

    //play the animation
    inter1.playForward();
    edk::float32 seconds=0.f;
    edk::float32 x=0.f;
    bool success = false;
    //run the animation
    if(inter1.isPlaying()){
        do{
            //clean the success
            success = true;
            seconds = inter1.updateClockAnimation();
            //return this value testing if have the value
            x = inter1.getClockX(&success);
            //if success print the value
            if(success){
                x = inter1.getClockX();
                printf("\nNORMAL ANIMATION Second %.2f Value %.2f"
                       ,seconds
                       ,x
                       );fflush(stdout);
            }
        }while(inter1.isPlaying());
    }

    edk::animation::Interpolation2DGroup inter2;

    //MAKING A BALL ANIMATION WITH A BEZIER CURVE

    //If you add a new interpolation without make the firt interpolation, the first interpolation point will wait until you add the new point.
    inter2.addNewInterpolationLine(0.f,0.f,10.f);
    //Add the second point to make the first animation
    inter2.addNewInterpolationLine(4.f,0.f,0.f);
    if(inter2.getInterpolations()){
        edk::uint32 position = inter2.getInterpolations()-1u;
        //change the straight line interpolation to be a curve interpolation
        inter2.setInterpolationCurveY(position);
        //set the curve values
        inter2.setInterpolationP1Y(position,3.f,10.f);
        inter2.setInterpolationP2Y(position,4.f,8.f);
    }
    //you can add an interpolation beetween the two last
    inter2.addNewInterpolationLine(8.0f,0.f,10.f);
    if(inter2.getInterpolations()){
        edk::uint32 position = inter2.getInterpolations()-1u;
        //change the straight line interpolation to be a curve interpolation
        inter2.setInterpolationCurveY(position);
        //set the curve values
        inter2.setInterpolationP1Y(position,4.f,8.f);
        inter2.setInterpolationP2Y(position,5.f,10.f);
    }

    //play the animation in a specific second
    inter2.playForwardIn(0.1f);
    //animate
    if(inter2.isPlaying()){
        do{
            printf("\nBALL ANIMATION FORWARD Second %.2f Value %.2f %.2f"
                   ,inter2.updateClockAnimation()
                   ,inter2.getClockX()
                   ,inter2.getClockY()
                   );fflush(stdout);
        }while(inter2.isPlaying());
    }
    //play the animation rewind
    inter2.playRewindIn(8.f);
    //animate
    if(inter2.isPlaying()){
        float second = 0.f;
        do{
            second = inter2.updateClockAnimation();
            printf("\nBALL ANIMATION REWIND Second %.2f Value %.2f %.2f"
                   ,second
                   ,inter2.getClockX()
                   ,inter2.getClockY()
                   );fflush(stdout);
        }while(inter2.isPlaying());
    }

    edk::animation::Interpolation3DGroup inter3;

    //add interpolations
    inter3.addNewInterpolationLine(0.f,0.f,0.f,0.f);
    inter3.addNewInterpolationLine(10.f,0.f,0.f,0.f);
    //don't be need to add the interpolation frames on sequence
    inter3.addNewInterpolationLine(4.35f,0.f,-5.f,0.f);
    inter3.addNewInterpolationLine(15.0f,0.f,-5.f,0.f);

    //create animation names to be played from the seconds
    inter3.addNewAnimationName("FIRST",0.f,5.f);
    inter3.addNewAnimationName("SECOND",5.f,10.f);
    inter3.addNewAnimationName("THIRD",10.f,15.f);
    //the back need to be played in rewind because an animation have to be the start before the end
    inter3.addNewAnimationName("BACK",0.f,15.f);

    //play the animation
    inter3.playNameForward("FIRST");
    //change the speed
    inter3.setSpeed(2.f);
    //animate
    if(inter3.isPlaying()){
        do{
            printf("\nPLAY FIRST Second %.2f Value %.2f %.2f %.2f"
                   ,inter3.updateClockAnimation()
                   ,inter3.getClockX()
                   ,inter3.getClockY()
                   ,inter3.getClockZ()
                   );fflush(stdout);
        }while(inter3.isPlaying());
    }
    //play the animation
    inter3.playNameForward("SECOND");
    //change the speed
    inter3.setSpeed(4.f);
    //animate
    if(inter3.isPlaying()){
        do{
            printf("\nPLAY SECOND Second %.2f Value %.2f %.2f %.2f"
                   ,inter3.updateClockAnimation()
                   ,inter3.getClockX()
                   ,inter3.getClockY()
                   ,inter3.getClockZ()
                   );fflush(stdout);
        }while(inter3.isPlaying());
    }
    //play the animation
    inter3.playNameForward("THIRD");
    //change the speed
    inter3.setSpeed(2.f);
    //animate
    if(inter3.isPlaying()){
        do{
            printf("\nPLAY THIRD Second %.2f Value %.2f %.2f %.2f"
                   ,inter3.updateClockAnimation()
                   ,inter3.getClockX()
                   ,inter3.getClockY()
                   ,inter3.getClockZ()
                   );fflush(stdout);
        }while(inter3.isPlaying());
    }
    //play the animation
    inter3.playNameRewind("BACK");
    //change the speed
    inter3.setSpeed(1.f);
    //animate
    if(inter3.isPlaying()){
        do{
            printf("\nPLAY BACK REWIND Second %.2f Value %.2f %.2f %.2f"
                   ,inter3.updateClockAnimation()
                   ,inter3.getClockX()
                   ,inter3.getClockY()
                   ,inter3.getClockZ()
                   );fflush(stdout);
        }while(inter3.isPlaying());
    }

    return 0;
}


text: export {default} from 'koenig-editor/components/koenig-editor';


text:
package scala.meta.internal.semanticdb.scalac

import scala.{meta => m}

trait SymbolOpsCompat { self: SemanticdbOps =>
  implicit class XtensionGSymbolCompat(sym: g.Symbol) {
    private lazy val implicitPrimitiveConversionNames = Set(
      g.termNames.toByte,
      g.termNames.toShort,
      g.termNames.toChar,
      g.termNames.toInt,
      g.termNames.toLong,
      g.termNames.toFloat,
      g.termNames.toDouble
    )

    // See comment in scala-2.13/.../SymbolOpsCompat.scala
    def isImplicitPrimitiveConversion(mtree: m.Name): Boolean = {
      sym.name.startsWith("to") &&
      g.definitions.ScalaValueClassesSet.contains(sym.owner) &&
      implicitPrimitiveConversionNames.contains(sym.name.toTermName) &&
      sym.name.toString() != mtree.value
    }
  }
}


text:
package com.github.liudaomanbu.excel.config;

import java.util.List;
import java.util.Optional;
import org.apache.poi.ss.usermodel.Workbook;
import com.github.liudaomanbu.excel.parse.result.WorkbookParseResult;
import com.github.liudaomanbu.excel.validator.Validator;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;

public class WorkbookConfig {
  public static class Builder {
    private List<SheetConfig.Builder> sheetConfigBuilders;
    private List<Validator<Workbook>> validators;
    private ParserConfig parserConfig;

    public Builder() {
      sheetConfigBuilders = Lists.newLinkedList();
      validators = Lists.newLinkedList();
    }

    public WorkbookConfig build() {
      return new WorkbookConfig(this);
    }

    public List<Validator<Workbook>> getValidators() {
      return validators;
    }

    public Builder setValidators(List<Validator<Workbook>> validators) {
      this.validators = validators;
      return this;
    }

    public ParserConfig getParserConfig() {
      return parserConfig;
    }

    public Builder setParserConfig(ParserConfig parserConfig) {
      this.parserConfig = parserConfig;
      return this;
    }

    public List<SheetConfig.Builder> getSheetConfigBuilders() {
      return sheetConfigBuilders;
    }

    public Builder setSheetConfigBuilders(List<SheetConfig.Builder> sheetConfigBuilders) {
      this.sheetConfigBuilders = sheetConfigBuilders;
      return this;
    }

  }

  public static Builder builder() {
    return new Builder();
  }

  private final ImmutableCollection<SheetConfig> sheetConfigs;
  private final ImmutableList<Validator<Workbook>> validators;
  private final ParserConfig parserConfig;

  private WorkbookConfig(Builder builder) {
    sheetConfigs = builder.sheetConfigBuilders.stream()
        .peek(sheetConfigBuilder -> sheetConfigBuilder.setWorkbookConfig(this))
        .map(SheetConfig.Builder::build).collect(ImmutableSet.toImmutableSet());
    validators = builder.validators.stream().collect(ImmutableList.toImmutableList());
    parserConfig = builder.parserConfig;
  }

  public WorkbookParseResult parse(Workbook workbook) {
    return WorkbookParseResult.builder().setWorkbook(workbook).setConfig(this).build();
  }

  public ParserConfig getEffectiveParserConfig() {
    return Optional.ofNullable(parserConfig).orElse(ParserConfig.GLOBAL);
  }

  public ImmutableCollection<SheetConfig> getSheetConfigs() {
    return sheetConfigs;
  }

  public ParserConfig getParserConfig() {
    return parserConfig;
  }

  public ImmutableList<Validator<Workbook>> getValidators() {
    return validators;
  }

}


text:
(function(angular) {
    "use strict";

    function CustomerUserServiceHandler($http) {

        var getUsers = function() {
            return $http({
                url: '/rest/getUsers',
                method: "GET",
                headers: {
                    //"Authorization": 'Basic YWRtaW46YWRtaW4='
                }
            });
        };

        var getUserInventory = function(userID) {
            return $http({
                url: '/rest/getUserInventory?userid=' + userID,
                method: "GET",
                headers: {
                    //"Authorization": 'Basic YWRtaW46YWRtaW4='
                }
            });
        };

        var getUserItems = function(userID) {
            return $http({
                url: '/rest/getUserItems?userid=' + userID,
                method: "GET",
                headers: {
                    //"Authorization": 'Basic YWRtaW46YWRtaW4='
                }
            });
        };
        var canChangeSharable = function(storedItemID) {
            return $http({
                url: '/rest/canChangeSharable?storedItemID=' + storedItemID,
                method: "GET",
                headers: {
                    //"Authorization": 'Basic YWRtaW46YWRtaW4='
                }
            });
        };

        var getUserRequest = function(userID) {
            return $http({
                url: '/rest/getUserRequests?userid=' + userID,
                method: "GET",
                headers: {
                    //"Authorization": 'Basic YWRtaW46YWRtaW4='
                }
            });
        };
        var saveImage = function(imageBase64) {
            return $http({
                url: '/rest/saveImage',
                method: "POST",
                data: imageBase64
                    // headers: {
                    //     // 'Authorization': "Basic YWRtaW46YWRtaW4=",
                    //     "Content-Type": "application/x-www-form-urlencoded"
                    // }
            });
        }
        var editUserItem = function(obj) {
            return $http({
                url: '/rest/editUserItem',
                method: "POST",
                data: obj
                    // headers: {
                    //     // 'Authorization': "Basic YWRtaW46YWRtaW4=",
                    //     "Content-Type": "application/x-www-form-urlencoded"
                    // }
            });
        }
        var getTrucksByUserrequests = function() {
            return $http({
                url: '/admin/getTrucksByUserrequests?date=' + "21/03/2017",
                method: "GET",
                headers: {
                    //"Authorization": 'Basic YWRtaW46YWRtaW4='
                }
            });
        };
        var getCategories = function(categories) {
            return $http({
                url: '/rest/getCategories?parentID=' + categories,
                method: "GET",
                headers: {
                    //"Authorization": 'Basic YWRtaW46YWRtaW4=',
                    "Content-Type": "application/x-www-form-urlencoded"
                }
            });
        }

        //EXPORTED Object
        return {
            getUsers,
            getUserInventory,
            getUserItems,
            getUserRequest,
            getTrucksByUserrequests,
            getCategories,
            saveImage,
            editUserItem,
            canChangeSharable
        }
    }

    angular.module('bathwaterApp.services')
        .factory('customerUserService', ['$http', CustomerUserServiceHandler]);

})(window.angular);


text:
<?php
namespace Concrete\Core\Entity\Calendar\Summary;

use Concrete\Core\Entity\Summary\GetTemplateDataTrait;
use Concrete\Core\Entity\Summary\Template;
use Concrete\Core\Summary\Data\Collection;
use Concrete\Core\Summary\Template\RenderableTemplateInterface;
use Doctrine\ORM\Mapping as ORM;

/**
 *
 * @ORM\Entity
 * @ORM\Table(
 *     name="CalendarEventSummaryTemplates"
 * )
 */
class CalendarEventTemplate implements RenderableTemplateInterface
{

    use GetTemplateDataTrait;

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="Concrete\Core\Entity\Calendar\CalendarEvent", inversedBy="summary_templates")
     * @ORM\JoinColumn(name="eventID", referencedColumnName="eventID")
     */
    protected $event;

    /**
     * @ORM\ManyToOne(targetEntity="Concrete\Core\Entity\Summary\Template")
     */
    protected $template;

    /**
     * @ORM\Column(type="json")
     */
    protected $data;

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

    /**
     * @return mixed
     */
    public function getEvent()
    {
        return $this->event;
    }

    /**
     * @param mixed $event
     */
    public function setEvent($event): void
    {
        $this->event = $event;
    }

    /**
     * @return mixed
     */
    public function getTemplate() : Template
    {
        return $this->template;
    }

    /**
     * @param mixed $template
     */
    public function setTemplate(Template $template): void
    {
        $this->template = $template;
    }

    public function getRawData()
    {
        return $this->data;
    }

    /**
     * @param mixed $data
     */
    public function setData($data): void
    {
        $this->data = $data;
    }

    public function jsonSerialize()
    {
        $data = [
            'template' => $this->getTemplate(),
            'data' => $this->getData(),
            'id' => $this->getId(),
            'eventID' => $this->getEvent()->getID(),
        ];
        return $data;
    }

}


text:
namespace Votyra.Core
{
    public interface IFrameDataProvider<TFrameData> where TFrameData : IFrameData
    {
        TFrameData GetCurrentFrameData();
    }
}


text:
<?php

namespace Google\Service\ShoppingContent;

class DeliveryTime extends \Google\Collection
{
  protected $collection_key = 'warehouseBasedDeliveryTimes';
  protected $cutoffTimeType = CutoffTime::class;
  protected $cutoffTimeDataType = '';
  protected $handlingBusinessDayConfigType = BusinessDayConfig::class;
  protected $handlingBusinessDayConfigDataType = '';
  protected $holidayCutoffsType = HolidayCutoff::class;
  protected $holidayCutoffsDataType = 'array';
  /**
   * @var string
   */
  public $maxHandlingTimeInDays;
  /**
   * @var string
   */
  public $maxTransitTimeInDays;
  /**
   * @var string
   */
  public $minHandlingTimeInDays;
  /**
   * @var string
   */
  public $minTransitTimeInDays;
  protected $transitBusinessDayConfigType = BusinessDayConfig::class;
  protected $transitBusinessDayConfigDataType = '';
  protected $transitTimeTableType = TransitTable::class;
  protected $transitTimeTableDataType = '';
  protected $warehouseBasedDeliveryTimesType = WarehouseBasedDeliveryTime::class;
  protected $warehouseBasedDeliveryTimesDataType = 'array';

  /**
   * @param CutoffTime
   */
  public function setCutoffTime(CutoffTime $cutoffTime)
  {
    $this->cutoffTime = $cutoffTime;
  }
  /**
   * @return CutoffTime
   */
  public function getCutoffTime()
  {
    return $this->cutoffTime;
  }
  /**
   * @param BusinessDayConfig
   */
  public function setHandlingBusinessDayConfig(BusinessDayConfig $handlingBusinessDayConfig)
  {
    $this->handlingBusinessDayConfig = $handlingBusinessDayConfig;
  }
  /**
   * @return BusinessDayConfig
   */
  public function getHandlingBusinessDayConfig()
  {
    return $this->handlingBusinessDayConfig;
  }
  /**
   * @param HolidayCutoff[]
   */
  public function setHolidayCutoffs($holidayCutoffs)
  {
    $this->holidayCutoffs = $holidayCutoffs;
  }
  /**
   * @return HolidayCutoff[]
   */
  public function getHolidayCutoffs()
  {
    return $this->holidayCutoffs;
  }
  /**
   * @param string
   */
  public function setMaxHandlingTimeInDays($maxHandlingTimeInDays)
  {
    $this->maxHandlingTimeInDays = $maxHandlingTimeInDays;
  }
  /**
   * @return string
   */
  public function getMaxHandlingTimeInDays()
  {
    return $this->maxHandlingTimeInDays;
  }
  /**
   * @param string
   */
  public function setMaxTransitTimeInDays($maxTransitTimeInDays)
  {
    $this->maxTransitTimeInDays = $maxTransitTimeInDays;
  }
  /**
   * @return string
   */
  public function getMaxTransitTimeInDays()
  {
    return $this->maxTransitTimeInDays;
  }
  /**
   * @param string
   */
  public function setMinHandlingTimeInDays($minHandlingTimeInDays)
  {
    $this->minHandlingTimeInDays = $minHandlingTimeInDays;
  }
  /**
   * @return string
   */
  public function getMinHandlingTimeInDays()
  {
    return $this->minHandlingTimeInDays;
  }
  /**
   * @param string
   */
  public function setMinTransitTimeInDays($minTransitTimeInDays)
  {
    $this->minTransitTimeInDays = $minTransitTimeInDays;
  }
  /**
   * @return string
   */
  public function getMinTransitTimeInDays()
  {
    return $this->minTransitTimeInDays;
  }
  /**
   * @param BusinessDayConfig
   */
  public function setTransitBusinessDayConfig(BusinessDayConfig $transitBusinessDayConfig)
  {
    $this->transitBusinessDayConfig = $transitBusinessDayConfig;
  }
  /**
   * @return BusinessDayConfig
   */
  public function getTransitBusinessDayConfig()
  {
    return $this->transitBusinessDayConfig;
  }
  /**
   * @param TransitTable
   */
  public function setTransitTimeTable(TransitTable $transitTimeTable)
  {
    $this->transitTimeTable = $transitTimeTable;
  }
  /**
   * @return TransitTable
   */
  public function getTransitTimeTable()
  {
    return $this->transitTimeTable;
  }
  /**
   * @param WarehouseBasedDeliveryTime[]
   */
  public function setWarehouseBasedDeliveryTimes($warehouseBasedDeliveryTimes)
  {
    $this->warehouseBasedDeliveryTimes = $warehouseBasedDeliveryTimes;
  }
  /**
   * @return WarehouseBasedDeliveryTime[]
   */
  public function getWarehouseBasedDeliveryTimes()
  {
    return $this->warehouseBasedDeliveryTimes;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DeliveryTime::class, 'Google_Service_ShoppingContent_DeliveryTime');


text:
void EventHandler::handleEvent(SDL_Event* event) {
    switch (event->type) {
    case SDL_KEYDOWN:
        handleKeyDown(
            event->key.keysym.sym,
            event->key.keysym.scancode,
            event->key.keysym.mod);
        break;
    case SDL_KEYUP:
        handleKeyUp(
            event->key.keysym.sym,
            event->key.keysym.scancode,
            event->key.keysym.mod);
        break;
    case SDL_QUIT:
        handleExit();
        break;
    }
}


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

namespace Azure.ResourceManager.Sql.Models
{
    public partial class JobCredential : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("properties");
            writer.WriteStartObject();
            if (Optional.IsDefined(Username))
            {
                writer.WritePropertyName("username");
                writer.WriteStringValue(Username);
            }
            if (Optional.IsDefined(Password))
            {
                writer.WritePropertyName("password");
                writer.WriteStringValue(Password);
            }
            writer.WriteEndObject();
            writer.WriteEndObject();
        }

        internal static JobCredential DeserializeJobCredential(JsonElement element)
        {
            Optional<string> id = default;
            Optional<string> name = default;
            Optional<string> type = default;
            Optional<string> username = default;
            Optional<string> password = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("username"))
                        {
                            username = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("password"))
                        {
                            password = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return new JobCredential(id.Value, name.Value, type.Value, username.Value, password.Value);
        }
    }
}


text:
php sdk for [腾讯云对象存储服务](http://wiki.qcloud.com/wiki/COS%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D)

## 安装(直接下载源码集成)

### 直接下载源码集成
从github下载源码装入到您的程序中,并加载include.php
调用请参考示例1

## 修改配置
修改Qcloud_cos/Conf.php内的appid等信息为您的配置

## 上传、查询、删除程序示例1(使用tencentyun提供的include.php)
```php
<?php

require('./include.php');

use Qcloud_cos\Auth;
use Qcloud_cos\Cosapi;

$bucketName = 'your bucket name';
$srcPath = 'local file path';
$dstPath = 'remote file path';

// 上传文件
$uploadRet = Cosapi::upload('test.log', $bucketName, '/test.log');
var_dump($uploadRet);

//分片上传
$sliceUploadRet = Cosapi::upload_slice(
        $srcPath, $bucketName, $dstPath);
//用户指定分片大小来分片上传
//$sliceUploadRet = Cosapi::upload_slice(
//        $srcPath, $bucketName, $dstPath, null, 2000000);
//指定了session,可以实现断点续传
//$sliceUploadRet = Cosapi::upload_slice(
//        $srcPath, $bucketName, $dstPath, null, 2000000, '48d44422-3188-4c6c-b122-6f780742f125+CpzDLtEHAA==');
var_dump($sliceUploadRet);

//创建目录
$createFolderRet = Cosapi::createFolder($bucketName, "/test/");
var_dump($createFolderRet);

//listFolder
$listRet = Cosapi::listFolder($bucketName, "/");
var_dump($listRet);

//prefixSearch
$ret = Cosapi::prefixSearch($bucketName, "/test");
var_dump($ret);

//updateFolder
$updateRet = Cosapi::updateFolder($bucketName, '/test/', 'attribution');
var_dump($updateRet);

//update
$updateRet = Cosapi::update($bucketName, $dstPath, 'attribution');
var_dump($updateRet);

//statFolder
$statRet = Cosapi::statFolder($bucketName, "/test/");
var_dump($statRet);

//stat
$statRet = Cosapi::stat($bucketName, $dstPath);
var_dump($statRet);

//delFolder
$delRet = Cosapi::delFolder($bucketName, "/test/");
var_dump($delRet);

//del
$delRet = Cosapi::del($bucketName, $dstPath);
var_dump($delRet);

```


text:
- Added Travis CI automated Testing
- Updated npm dependencies
- Fixed license ID in package file

### 1.3.3

- Fixed improper emitted errors in `lock.renewLock()` caused by race conditions with lock release / remove

### 1.3.2

- Fixed race issue when mutliple clients simultaneously create new LockCollections backed by the same mongodb server.

### 1.3.1

- Fixed failing unit test case
- Updated mongodb driver version

### 1.3.0

- Added support for the new node.js 2.0.x native MongoDB driver
- Write Locks now clear the `write_req` flag when released so that chained writes won't block all readers for long periods of time.
- Updated unit test dependencies

### 1.2.4

- Updated version test to recognize mongodb 3.0 as supporting mongo 2.6 queries

### 1.2.3

- Fixed issue #3, failing unit tests under Mongodb 2.4.x, et al.

### 1.2.2

- Fixed issue #2, a bug that blocked all read locks when a program aborts with an outstanding write lock request, under MongoDB 2.6 only. Thanks to @cearl for reporting.

### 1.2.1

- Fixed errors stemming from improper checking of the mongo error code in an emitted error object.
- Ensure that lockExpiration >= pollingInterval, or expirations may become instantaneous

### 1.2.0

- Introduced independant code paths depending on whether a lock collection is hosted on a MongoDB 2.4 or 2.6+ server. Use of one path or the other is transparent to the user.
- The benefits for MongoDB 2.6 first introduced in v1.1.0 are now back. Support for Mongo 2.4 remains as it was prior to v1.1.0. Both server version use the same gridfs-locks API and have the same functionality, but the MongoDB 2.6 code is simpler and should be more performant, mostly through a reduction in the number of queries used, especially under heavy locking load.

### 1.1.2

- Revert completely to use of MongoDB 2.4.x only update modifiers to maintain compatibility with mongo 2.4.x
- The more efficient MongoDB 2.6 version lives in the mongodb_2.6 branch for now until if can be cleanly included conditionally

### 1.1.1

- Revert from use of MongoDB 2.6 only $currentDate update modifier to maintain compatibility with mongo 2.4.x

### 1.1.0

- Refactoring of mongo queries to make many lock operations significantly faster
- Fixed an issue when multiple read lock holders hold locks with different expiration time lengths, and a lock with a shorter expiration renews and overwrites the later expiring lock's expiration time in the DB.

### 1.0.3

- Fixed typos in README.md code snippets

### 1.0.2

- Updated README.md code blocks to correct formatting glitches on npmjs.org

### 1.0.1

- Fixed issue when multiple simultaneous readers with different lockExpiration values could cause a reader lock to expire prematurely

### 1.0.0

- gridfs-locks now exclusively uses an event-emitter interface. See Readme for more information.

### 0.0.6

- Documentation fixes
- Removed console.log()

### 0.0.5

- Added 60 Unit Tests
- Method Parameters are now extensively validated
- Callback is now optional for Lock.releaseLock(); throws on error when no callback.
- Testing hooks added to obtainWriteLock()

### 0.0.1 - 0.0.4

Initial revision and documentation fixes.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NoFrillsTransformation.Interfaces;
using NoFrillsTransformation.Plugins.Csv;

namespace NoFrillsTransformation.Plugins.Statistics
{
    class FrequencyTransformer : ISourceTransformer
    {
        private IContext _context;
        private string _target;
        private string _targetConfig;
        private IParameter[] _parameters;
        private Dictionary<string, Dictionary<string, int>> _freqs;

        public FrequencyTransformer(IContext context, string target, string targetConfig, IParameter[] parameters)
        {
            _context = context;
            _target = target;
            _targetConfig = targetConfig;
            _parameters = parameters;

            InitFreqs(parameters);
        }

        private void InitFreqs(IParameter[] parameters)
        {
            _freqs = new Dictionary<string, Dictionary<string, int>>();
            foreach (var param in parameters)
            {
                _freqs[param.Name] = new Dictionary<string, int>();
            }
        }

        public void Transform(IContext context, IEvaluator eval)
        {
            // Special case for the Freq transform: Obey filters already.
            if (!context.CurrentRecordMatchesFilter(eval))
                return;

            foreach (var param in _parameters)
            {
                var value = eval.Evaluate(eval, param.Function, context);
                if (string.IsNullOrEmpty(value))
                    value = "(empty)";
                if (_freqs[param.Name].ContainsKey(value))
                    _freqs[param.Name][value]++;
                else
                    _freqs[param.Name][value] = 1;
            }
        }

        public void FinishTransform()
        {
            try
            {
                using (var csv = new CsvWriterPlugin(_context, _target, new string[] { }, new int[] { }, _targetConfig + " headers='false'"))
                {

                    bool first = true;
                    var header = new string[] { "" };
                    var line = new string[] { "", "" };
                    foreach (var param in _parameters)
                    {
                        if (!first)
                            csv.WriteRecord(new string[] { }); // New line

                        header[0] = param.Name;
                        csv.WriteRecord(header);
                        line[0] = "Value";
                        line[1] = "Frequency";
                        csv.WriteRecord(line);
                        var f = _freqs[param.Name];
                        foreach (var key in f.Keys)
                        {
                            line[0] = key;
                            line[1] = f[key].ToString();
                            csv.WriteRecord(line);
                        }

                        first = false;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("FrequencyTransform: An error occurred while writing the frequency analysis results: " + ex.Message);
            }
        }

        public bool HasField(string fieldName)
        {
            // We ain't got no fields. We just take stuff.
            return false;
        }

        public IRecord CurrentRecord
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public bool HasMoreRecords()
        {
            return false;
        }

        public bool HasResult()
        {
            return false;
        }

        public void NextRecord()
        {
            throw new NotImplementedException();
        }

        public void Dispose()
        {
        }
    }
}


text:
package gof.specification;

import org.junit.Test;

public class Example {
    @Test
    public void test() {
        final Person somePerson = new Person("John Doe", 19);

        // první způsob
        final boolean satisfied1 = new HasName("John Doe").and(new HasAge(18, 20)).isSatisfiedFor(somePerson);

        // druhý způsob
        final boolean satisfied2 = new AndSpecification<>(new HasName("John Doe"), new HasAge(18, 20)).isSatisfiedFor(somePerson);
    }
}


text:
import React, { FC } from 'react'
import classnames from 'classnames'
import { useRefFn } from 'observable-hooks'
import { ShadowPortal, defaultTimeout } from '@/components/ShadowPortal'
import { WordEditor, WordEditorProps } from './WordEditor'

export interface WordEditorPortalProps extends WordEditorProps {
  show: boolean
  withAnimation: boolean
  darkMode: boolean
}

export const WordEditorPortal: FC<WordEditorPortalProps> = props => {
  const { show, withAnimation, darkMode, ...restProps } = props
  const editorStyles = useRefFn(() => (
    <style>{require('./WordEditor.shadow.scss').toString()}</style>
  )).current
  return (
    <ShadowPortal
      id="saladict-wordeditor-root"
      head={editorStyles}
      in={show}
      innerRootClassName={classnames({ isAnimate: withAnimation, darkMode })}
      timeout={withAnimation ? defaultTimeout : 0}
    >
      {() => <WordEditor {...restProps} />}
    </ShadowPortal>
  )
}

export default WordEditorPortal