text:
#include "modules/perception/obstacle/lidar/roi_filter/hdmap_roi_filter/polygon_scan_converter.h"

namespace apollo {
namespace perception {

const double PolygonScanConverter::kEpsilon =
    std::numeric_limits<float>::epsilon();
const double PolygonScanConverter::kInf =
    std::numeric_limits<double>::infinity();

void PolygonScanConverter::Init(const DirectionMajor major_dir,
                                const Interval &valid_x_range,
                                const Polygon &polygon, const double step) {
  major_dir_ = major_dir;
  op_major_dir_ = OppositeDirection(major_dir);

  polygon_ = polygon;
  min_x_ = valid_x_range.first;
  scans_size_ = (valid_x_range.second - valid_x_range.first) / step;
  step_ = step;
}

void PolygonScanConverter::ConvertScans(
    std::vector<std::vector<Interval>> *scans_intervals) {
  scans_intervals->resize(scans_size_);

  DisturbPolygon();
  ConvertPolygonToSegments();
  BuildEdgeTable();

  for (const auto &edge : edge_table_[0]) {
    if (std::isfinite(edge.k)) {
      active_edge_table_.push_back(edge);
    } else {
      (*scans_intervals)[0].push_back(Interval(edge.y, edge.max_y));
    }
  }

  std::sort(active_edge_table_.begin(), active_edge_table_.end());
  for (size_t i = 0; i < active_edge_table_.size(); i += 2) {
    double min_y = active_edge_table_[i].y;
    double max_y = active_edge_table_[i + 1].y;
    (*scans_intervals)[0].push_back(Interval(min_y, max_y));
  }

  for (size_t i = 1; i < scans_size_; ++i) {
    UpdateActiveEdgeTable(i, &(scans_intervals->at(i)));
  }
}

void PolygonScanConverter::UpdateActiveEdgeTable(
    const size_t x_id, std::vector<Interval> *scan_intervals) {
  size_t valid_edges_num = active_edge_table_.size();
  size_t invalid_edges_num = 0;

  // For each edege in active edge table, check whether it is still valid.
  for (auto &edge : active_edge_table_) {
    if (!edge.MoveUp(step_)) {
      --valid_edges_num;
      ++invalid_edges_num;
      edge.y = kInf;
    }
  }

  size_t new_edges_num = 0;
  for (const auto &edge : edge_table_[x_id]) {
    if (std::isfinite(edge.k)) {
      ++valid_edges_num;
      ++new_edges_num;
      active_edge_table_.push_back(edge);
    } else {
      scan_intervals->emplace_back(edge.y, edge.max_y);
    }
  }

  if (invalid_edges_num != 0 || new_edges_num != 0) {
    std::sort(active_edge_table_.begin(), active_edge_table_.end(),
              [](const Edge &a, const Edge &b) { return a.y < b.y; });
    active_edge_table_.erase(next(active_edge_table_.begin(), valid_edges_num),
                             active_edge_table_.end());
  }

  for (size_t i = 0; i + 1 < active_edge_table_.size(); i += 2) {
    double min_y = active_edge_table_[i].y;
    double max_y = active_edge_table_[i + 1].y;

    scan_intervals->emplace_back(min_y, max_y);
  }
}

void PolygonScanConverter::BuildEdgeTable() {
  edge_table_.resize(scans_size_);

  std::vector<std::pair<int, Edge>> edges;
  edges.reserve(segments_.size());
  for (size_t i = 0; i < segments_.size(); ++i) {
    std::pair<int, Edge> out_edge;
    if (ConvertSegmentToEdge(i, &out_edge)) {
      edges.push_back(out_edge);
    }
  }

  active_edge_table_.reserve(edges.size());

  for (size_t i = 0; i < edges.size(); ++i) {
    int x_id = edges[i].first;
    const Edge &edge = edges[i].second;

    if (x_id >= static_cast<int>(scans_size_)) {
      continue;
    }

    if (x_id >= 0) {
      edge_table_[x_id].push_back(edge);
    } else {
      Edge active_edge = edge;
      if (active_edge.MoveUp(0.0 - active_edge.x)) {
        active_edge_table_.push_back(active_edge);
      }
    }
  }
}

bool PolygonScanConverter::ConvertSegmentToEdge(
    const size_t seg_id, std::pair<int, Edge> *out_edge) {
  const Segment &segment = segments_[seg_id];

  double min_x = segment.first[major_dir_] - min_x_;
  double min_y = segment.first[op_major_dir_];

  int x_id = std::ceil(min_x / step_);
  out_edge->first = x_id;

  Edge &edge = out_edge->second;
  edge.x = x_id * step_;
  edge.max_x = segment.second[major_dir_] - min_x_;
  edge.max_y = segment.second[op_major_dir_];
  edge.k = slope_[seg_id];

  if (std::isfinite(edge.k)) {
    edge.y = min_y + (edge.x - min_x) * edge.k;
  } else {
    edge.y = min_y;
    if (edge.y > edge.max_y) {
      std::swap(edge.y, edge.max_y);
    }
  }

  if (std::isfinite(edge.k) && edge.max_x < edge.x) {
    return false;
  }
  return true;
}

void PolygonScanConverter::ConvertPolygonToSegments() {
  size_t vertices_num = polygon_.size();

  segments_.reserve(vertices_num);
  slope_.reserve(vertices_num);

  for (size_t i = 0; i < vertices_num; ++i) {
    const Point &cur_vertex = polygon_[i];
    const Point &next_vertex = polygon_[(i + 1) % vertices_num];
    if (cur_vertex[major_dir_] < next_vertex[major_dir_]) {
      segments_.emplace_back(cur_vertex, next_vertex);
    } else {
      segments_.emplace_back(next_vertex, cur_vertex);
    }

    double x_diff = next_vertex[major_dir_] - cur_vertex[major_dir_];
    double y_diff = next_vertex[op_major_dir_] - cur_vertex[op_major_dir_];
    std::abs(cur_vertex[major_dir_] - next_vertex[major_dir_]) < kEpsilon
        ? slope_.push_back(kInf)
        : slope_.push_back(y_diff / x_diff);
  }
}

void PolygonScanConverter::DisturbPolygon() {
  for (auto &pt : polygon_) {
    // For current point, find the x coordinate of nearest scan line.
    // If they are too close, disturb the point in case of the point locating on
    // the line.
    double &x = pt[major_dir_];
    double d_x = (x - min_x_) / step_;
    int int_d_x = std::round(d_x);
    double delta_x = d_x - int_d_x;
    if (std::abs(delta_x) < kEpsilon) {
      if (delta_x > 0) {
        x = (int_d_x + kEpsilon) * step_ + min_x_;
      } else {
        x = (int_d_x - kEpsilon) * step_ + min_x_;
      }
    }
  }
}

bool PolygonScanConverter::Edge::MoveUp(const double delta_x) {
  if (delta_x < 0 || !std::isfinite(k)) {
    return false;
  }
  x += delta_x;
  if (x > max_x) {
    return false;
  }
  y += (delta_x * k);
  return true;
}

}  // namespace perception
}  // namespace apollo


text:
(function () {
  'use strict';

  angular
    .module('plusCar')
    .controller('DetailsController', DetailsController);

  DetailsController.$inject = ['$scope', '$mdDialog', 'car'];

  function DetailsController($scope, $mdDialog, car) {

    var vm = this;
    vm.close = closeModal;

    function activate() {
      console.log('Activate: ', 'DetailsController!!!');
      vm.car = car;
    }

    $scope.$on('$destroy', function () {
      console.log('$destroy: ', 'DetailsController!!!');
    });

    function closeModal() {
      $mdDialog.hide();
    }

    ////////////////

    activate();

  }
})();

redpajama_set_name: RedPajamaGithub


text:
package action

import (
	"github.com/cloudfoundry/bosh-cpi-go/apiv1"
	bosherr "github.com/cloudfoundry/bosh-utils/errors"

	bwcdisk "bosh-warden-cpi/disk"
)

type HasDiskMethod struct {
	diskFinder bwcdisk.Finder
}

func NewHasDiskMethod(diskFinder bwcdisk.Finder) HasDiskMethod {
	return HasDiskMethod{diskFinder: diskFinder}
}

func (a HasDiskMethod) HasDisk(cid apiv1.DiskCID) (bool, error) {
	disk, err := a.diskFinder.Find(cid)
	if err != nil {
		return false, bosherr.WrapErrorf(err, "Finding disk '%s'", cid)
	}

	return disk.Exists()
}


text:
package ssl

import (
	"crypto/x509"
	"fmt"
	"io/ioutil"
	"testing"
	"time"

	certutil "k8s.io/client-go/util/cert"
	"k8s.io/client-go/util/cert/triple"
	"k8s.io/ingress/core/pkg/ingress"
)

// generateRSACerts generates a self signed certificate using a self generated ca
func generateRSACerts(host string) (*triple.KeyPair, *triple.KeyPair, error) {
	ca, err := triple.NewCA("self-sign-ca")
	if err != nil {
		return nil, nil, err
	}

	key, err := certutil.NewPrivateKey()
	if err != nil {
		return nil, nil, fmt.Errorf("unable to create a server private key: %v", err)
	}

	config := certutil.Config{
		CommonName: host,
		Usages:     []x509.ExtKeyUsage{x509.ExtKeyUsageAny},
	}
	cert, err := certutil.NewSignedCert(config, key, ca.Cert, ca.Key)
	if err != nil {
		return nil, nil, fmt.Errorf("unable to sign the server certificate: %v", err)
	}

	return &triple.KeyPair{
		Key:  key,
		Cert: cert,
	}, ca, nil
}

func TestAddOrUpdateCertAndKey(t *testing.T) {
	td, err := ioutil.TempDir("", "ssl")
	if err != nil {
		t.Fatalf("Unexpected error creating temporal directory: %v", err)
	}
	ingress.DefaultSSLDirectory = td

	cert, _, err := generateRSACerts("echoheaders")
	if err != nil {
		t.Fatalf("unexpected error creating SSL certificate: %v", err)
	}

	name := fmt.Sprintf("test-%v", time.Now().UnixNano())

	c := certutil.EncodeCertPEM(cert.Cert)
	k := certutil.EncodePrivateKeyPEM(cert.Key)

	ngxCert, err := AddOrUpdateCertAndKey(name, c, k, []byte{})
	if err != nil {
		t.Fatalf("unexpected error checking SSL certificate: %v", err)
	}

	if ngxCert.PemFileName == "" {
		t.Fatalf("expected path to pem file but returned empty")
	}

	if len(ngxCert.CN) == 0 {
		t.Fatalf("expected at least one cname but none returned")
	}

	if ngxCert.CN[0] != "echoheaders" {
		t.Fatalf("expected cname echoheaders but %v returned", ngxCert.CN[0])
	}
}

func TestCACert(t *testing.T) {
	td, err := ioutil.TempDir("", "ssl")
	if err != nil {
		t.Fatalf("Unexpected error creating temporal directory: %v", err)
	}
	ingress.DefaultSSLDirectory = td

	cert, CA, err := generateRSACerts("echoheaders")
	if err != nil {
		t.Fatalf("unexpected error creating SSL certificate: %v", err)
	}

	name := fmt.Sprintf("test-%v", time.Now().UnixNano())

	c := certutil.EncodeCertPEM(cert.Cert)
	k := certutil.EncodePrivateKeyPEM(cert.Key)
	ca := certutil.EncodeCertPEM(CA.Cert)

	ngxCert, err := AddOrUpdateCertAndKey(name, c, k, ca)
	if err != nil {
		t.Fatalf("unexpected error checking SSL certificate: %v", err)
	}
	if ngxCert.CAFileName == "" {
		t.Fatalf("expected a valid CA file name")
	}
}

func TestGetFakeSSLCert(t *testing.T) {
	k, c := GetFakeSSLCert()
	if len(k) == 0 {
		t.Fatalf("expected a valid key")
	}
	if len(c) == 0 {
		t.Fatalf("expected a valid certificate")
	}
}

func TestAddCertAuth(t *testing.T) {
	td, err := ioutil.TempDir("", "ssl")
	if err != nil {
		t.Fatalf("Unexpected error creating temporal directory: %v", err)
	}
	ingress.DefaultSSLDirectory = td

	cn := "demo-ca"
	_, ca, err := generateRSACerts(cn)
	if err != nil {
		t.Fatalf("unexpected error creating SSL certificate: %v", err)
	}
	c := certutil.EncodeCertPEM(ca.Cert)
	ic, err := AddCertAuth(cn, c)
	if err != nil {
		t.Fatalf("unexpected error creating SSL certificate: %v", err)
	}
	if ic.CAFileName == "" {
		t.Fatalf("expected a valid CA file name")
	}
}


text:
using System;
using System.ComponentModel;
using System.Reactive.Linq;
using Espera.Core;

namespace Espera.View.ViewModels
{
    public sealed class LocalSongViewModel : ISongViewModelBase, IEquatable<LocalSongViewModel>, INotifyPropertyChanged, IDisposable
    {
        private readonly IDisposable propertyChangedSubscription;

        public LocalSongViewModel(Song model)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            this.Model = model;

            // We only want to know if the whole metadata changes (e.g when editing the tags in the
            // tag editor) so we can update the viewmodel, everything else isn't interesting to us
            this.propertyChangedSubscription = Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => this.Model.PropertyChanged += h,
                    h => this.Model.PropertyChanged -= h)
                .Where(x => string.IsNullOrEmpty(x.EventArgs.PropertyName))
                .Subscribe(_ => this.OnPropertyChanged(string.Empty));
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public string Album
        {
            get { return this.Model.Album; }
        }

        public string Artist
        {
            get { return this.Model.Artist; }
        }

        public TimeSpan Duration
        {
            get { return this.Model.Duration; }
        }

        public string FormattedDuration
        {
            get { return this.Duration.FormatAdaptive(); }
        }

        public string Genre
        {
            get { return this.Model.Genre; }
        }

        public Song Model { get; private set; }

        public string Path
        {
            get { return this.Model.OriginalPath; }
        }

        public string Title
        {
            get { return this.Model.Title; }
        }

        public int TrackNumber
        {
            get { return this.Model.TrackNumber; }
        }

        public void Dispose()
        {
            this.propertyChangedSubscription.Dispose();
        }

        public bool Equals(LocalSongViewModel other)
        {
            return this.Model.Equals(other.Model);
        }

        public override int GetHashCode()
        {
            return this.Model.GetHashCode();
        }

        private void OnPropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}


text:
package org.springframework.boot.actuate.health;

import java.util.Map;

/**
 * A registry of {@link HealthIndicator HealthIndicators}.
 *

 * Implementations must be thread-safe.
 *
 * @author Andy Wilkinson
 * @author Vedran Pavic
 * @author Stephane Nicoll
 * @since 2.1.0
 */
public interface HealthIndicatorRegistry {

	/**
	 * Registers the given {@link HealthIndicator}, associating it with the given
	 * {@code name}.
	 * @param name the name of the indicator
	 * @param healthIndicator the indicator
	 * @throws IllegalStateException if an indicator with the given {@code name} is
	 * already registered.
	 */
	void register(String name, HealthIndicator healthIndicator);

	/**
	 * Unregisters the {@link HealthIndicator} previously registered with the given
	 * {@code name}.
	 * @param name the name of the indicator
	 * @return the unregistered indicator, or {@code null} if no indicator was found in
	 * the registry for the given {@code name}.
	 */
	HealthIndicator unregister(String name);

	/**
	 * Returns the {@link HealthIndicator} registered with the given {@code name}.
	 * @param name the name of the indicator
	 * @return the health indicator, or {@code null} if no indicator was registered with
	 * the given {@code name}.
	 */
	HealthIndicator get(String name);

	/**
	 * Returns a snapshot of the registered health indicators and their names. The
	 * contents of the map do not reflect subsequent changes to the registry.
	 * @return the snapshot of registered health indicators
	 */
	Map<String, HealthIndicator> getAll();

}


text:
namespace openscreen {
namespace cast {

class RtcpSession;

// Collects current status and feedback messages from the Receiver in the
// current process, and builds compound RTCP packets to be transmitted to a
// Sender.
//
// Usage:
//
//   1. Call the various SetXYZ/IncludeXYZInNextPacket() methods as the
//      receiver's state changes. The SetXYZ() methods provide values that will
//      be included in every RTCP packet until they are changed, while the
//      IncludeXYZInNextPacket() methods provide values for only the next-built
//      RTCP packet. The latter case is part of the overall protocol design, to
//      help prevent the Sender from acting on stale Receiver state.
//
//   2. At certain times, call BuildPacket() and transmit it to the sender:
//      a. By default, every 1/2 sec, to provide the sender with a "keep alive"
//         ping that it can also use to monitor network round-trip times.
//      b. When there is new feedback, the collected information should be
//         immediately conveyed to the sender.
class CompoundRtcpBuilder {
 public:
  explicit CompoundRtcpBuilder(RtcpSession* session);
  ~CompoundRtcpBuilder();

  // Gets/Sets the checkpoint |frame_id| that will be included in built RTCP
  // packets. This value indicates to the sender that all of the packets for all
  // frames up to and including the given frame have been successfully received.
  FrameId checkpoint_frame() const { return checkpoint_frame_id_; }
  void SetCheckpointFrame(FrameId frame_id);

  // Gets/Sets the current end-to-end target playout delay setting for the Cast
  // RTP receiver, to be included in built RTCP packets. This reflect any
  // changes the sender has made by using the "Cast Adaptive Latency Extension"
  // in received RTP packets.
  std::chrono::milliseconds playout_delay() const { return playout_delay_; }
  void SetPlayoutDelay(std::chrono::milliseconds delay);

  // Gets/Sets the picture loss indicator flag. While this is set, built RTCP
  // packets will include a PLI message that indicates to the sender that there
  // has been an unrecoverable decoding error. This asks the sender to provide a
  // key frame as soon as possible. The client must explicitly clear this flag
  // when decoding will recover.
  bool is_picture_loss_indicator_set() const { return picture_loss_indicator_; }
  void SetPictureLossIndicator(bool picture_is_lost);

  // Include a receiver report about recent packet receive activity in ONLY the
  // next built RTCP packet. This replaces a prior receiver report if
  // BuildPacket() was not called in the meantime (since only the most
  // up-to-date version of the Receiver's state is relevant to the Sender).
  void IncludeReceiverReportInNextPacket(
      const RtcpReportBlock& receiver_report);

  // Include detailed feedback about wholly-received frames, whole missing
  // frames, and partially-received frames (specific missing packets) in ONLY
  // the next built RTCP packet. The data will be included in a best-effort
  // fashion, depending on the size of the |buffer| passed to the next call to
  // BuildPacket(). This replaces prior feedback data if BuildPacket() was not
  // called in the meantime (since only the most up-to-date version of the
  // Receiver's state is relevant to the Sender).
  //
  // The elements in the lists are assumed to be monotonically increasing:
  // |packet_nacks| indicates specific packets that have not yet been received,
  // or may use kAllPacketsLost to indicate that no packets have been received
  // for a frame. |frame_acks| indicates which frames after the checkpoint frame
  // have been fully received.
  void IncludeFeedbackInNextPacket(std::vector<PacketNack> packet_nacks,
                                   std::vector<FrameId> frame_acks);

  // Builds a compound RTCP packet and returns the portion of the |buffer| that
  // was used. The buffer's size must be at least kRequiredBufferSize, but
  // should generally be the maximum packet size (see discussion in
  // rtp_defines.h), to avoid dropping any ACK/NACK feedback.
  //
  // |send_time| specifies the when the resulting packet will be sent. This
  // should be monotonically increasing so the consuming side (the Sender) can
  // determine the chronological ordering of RTCP packets. The Sender might also
  // use this to estimate round-trip times over the network.
  absl::Span<uint8_t> BuildPacket(Clock::time_point send_time,
                                  absl::Span<uint8_t> buffer);

  // The required buffer size to be provided to BuildPacket(). This accounts for
  // all the possible headers and report structures that might be included,
  // along with a reasonable amount of space for the feedback's ACK/NACKs bit
  // vectors.
  static constexpr int kRequiredBufferSize = 256;

 private:
  // Helper methods called by BuildPacket() to append one RTCP packet to the
  // |buffer| that will ultimately contain a "compound RTCP packet."
  void AppendReceiverReportPacket(absl::Span<uint8_t>* buffer);
  void AppendReceiverReferenceTimeReportPacket(Clock::time_point send_time,
                                               absl::Span<uint8_t>* buffer);
  void AppendPictureLossIndicatorPacket(absl::Span<uint8_t>* buffer);
  void AppendCastFeedbackPacket(absl::Span<uint8_t>* buffer);
  int AppendCastFeedbackLossFields(absl::Span<uint8_t>* buffer);
  void AppendCastFeedbackAckFields(absl::Span<uint8_t>* buffer);

  RtcpSession* const session_;

  // Data to include in the next built RTCP packet.
  FrameId checkpoint_frame_id_ = FrameId::leader();
  std::chrono::milliseconds playout_delay_ = kDefaultTargetPlayoutDelay;
  absl::optional<RtcpReportBlock> receiver_report_for_next_packet_;
  std::vector<PacketNack> nacks_for_next_packet_;
  std::vector<FrameId> acks_for_next_packet_;
  bool picture_loss_indicator_ = false;

  // An 8-bit wrap-around counter that tracks how many times Cast Feedback has
  // been included in the built RTCP packets.
  uint8_t feedback_count_ = 0;
};

}  // namespace cast
}  // namespace openscreen

#endif  // CAST_STREAMING_COMPOUND_RTCP_BUILDER_H_


text:
<?php

namespace WordpressLib\ACF;

class Media
{

    public function __construct($data)
    {
        $this->data = $data;
    }

    public function getUrl()
    {
        return $this->data['url'];
    }

    public function getId()
    {
        return $this->data['ID'];
    }

    public function getTitle()
    {
        return $this->data['title'];
    }

    public function getCaption()
    {
        return $this->data['caption'];
    }

    public function getDescription()
    {
        return $this->data['description'];
    }
}


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

namespace SourceCode.Clay.Json
{
    /// <summary>
    /// Represents a way to compare different <see cref="Number"/> values.
    /// </summary>
    public abstract class NumberComparer :
        IEqualityComparer<Number>,
        IComparer<Number>,
        IEqualityComparer<Number?>,
        IComparer<Number?>
    {
        private const double DoubleDecimalMinValue = (double)decimal.MinValue;
        private const double DoubleDecimalMaxValue = (double)decimal.MaxValue;

        private const float SingleDecimalMinValue = (float)decimal.MinValue;
        private const float SingleDecimalMaxValue = (float)decimal.MaxValue;

        /// <summary>
        /// Gets a <see cref="NumberComparer"/> that compares all fields of a <see cref="Number"/> value.
        /// </summary>
        public static NumberComparer Default { get; } = new DefaultComparer();

        private NumberComparer()
        { }

        /// <inheritdoc/>
        public abstract int Compare(Number x, Number y);

        public int Compare(Number? x, Number? y)
        {
            if (!x.HasValue && !y.HasValue) return 0;
            if (!x.HasValue) return -1;
            if (!y.HasValue) return 1;

            int cmp = Compare(x.Value, y.Value);
            return cmp;
        }

        /// <inheritdoc/>
        public abstract bool Equals(Number x, Number y);

        /// <inheritdoc/>
        public bool Equals(Number? x, Number? y)
        {
            if (!x.HasValue) return !y.HasValue; // (null, null) or (null, y)
            if (!y.HasValue) return false; // (x, null)

            bool equal = Equals(x.Value, y.Value);
            return equal;
        }

        /// <inheritdoc/>
        public abstract int GetHashCode(Number obj);

        public int GetHashCode(Number? obj)
        {
            if (!obj.HasValue) return -42;

            return GetHashCode(obj.Value);
        }

        private sealed class DefaultComparer : NumberComparer
        {
            public override int Compare(Number x, Number y)
            {
                switch (((uint)x.ValueTypeCode << 5) | (uint)y.ValueTypeCode)
                {
                    // this == SByte
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.SByte: return x._sbyte.CompareTo(y._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.Byte: return x._sbyte < 0 ? -1 : -y._byte.CompareTo((byte)x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.Int16: return -y._int16.CompareTo(x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.UInt16: return x._sbyte < 0 ? -1 : -y._uint16.CompareTo((ushort)x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.Int32: return -y._int32.CompareTo(x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.UInt32: return x._sbyte < 0 ? -1 : -y._uint32.CompareTo((uint)x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.Int64: return -y._int64.CompareTo(x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.UInt64: return x._sbyte < 0 ? -1 : -y._uint64.CompareTo((ulong)x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.Single: return -y._single.CompareTo(x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.Double: return -y._double.CompareTo(x._sbyte);
                    case (uint)TypeCode.SByte << 5 | (uint)TypeCode.Decimal: return -y._decimal.CompareTo(x._sbyte);

                    // this == Byte
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.SByte: return y._sbyte < 0 ? 1 : x._byte.CompareTo((byte)y._sbyte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.Byte: return x._byte.CompareTo(y._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.Int16: return y._int16 < 0 ? 1 : -y._int16.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.UInt16: return -y._uint16.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.Int32: return y._int32 < 0 ? 1 : -y._int32.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.UInt32: return -y._uint32.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.Int64: return y._int64 < 0 ? 1 : -y._int64.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.UInt64: return -y._uint64.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.Single: return y._single < 0 ? 1 : -y._single.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.Double: return y._double < 0 ? 1 : -y._double.CompareTo(x._byte);
                    case (uint)TypeCode.Byte << 5 | (uint)TypeCode.Decimal: return y._decimal < 0 ? 1 : -y._decimal.CompareTo(x._byte);

                    // this == Int16
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.SByte: return x._int16.CompareTo(y._sbyte);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.Byte: return x._int16 < 0 ? -1 : x._int16.CompareTo(y._byte);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.Int16: return x._int16.CompareTo(y._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.UInt16: return x._int16 < 0 ? -1 : -y._uint16.CompareTo((ushort)x._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.Int32: return -y._int32.CompareTo(x._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.UInt32: return x._int16 < 0 ? -1 : -y._uint32.CompareTo((uint)x._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.Int64: return -y._int64.CompareTo(x._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.UInt64: return x._int16 < 0 ? -1 : -y._uint64.CompareTo((ulong)x._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.Single: return -y._single.CompareTo(x._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.Double: return -y._double.CompareTo(x._int16);
                    case (uint)TypeCode.Int16 << 5 | (uint)TypeCode.Decimal: return -y._decimal.CompareTo(x._int16);

                    // this == UInt16
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.SByte: return y._sbyte < 0 ? 1 : x._uint16.CompareTo((ushort)y._sbyte);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.Byte: return x._uint16.CompareTo(y._byte);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.Int16: return y._int16 < 0 ? 1 : x._uint16.CompareTo((ushort)y._int16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.UInt16: return x._uint16.CompareTo(y._uint16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.Int32: return y._int32 < 0 ? 1 : -y._int32.CompareTo(x._uint16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.UInt32: return -y._uint32.CompareTo(x._uint16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.Int64: return y._int64 < 0 ? 1 : -y._int64.CompareTo(x._uint16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.UInt64: return -y._uint64.CompareTo(x._uint16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.Single: return y._single < 0 ? 1 : -y._single.CompareTo(x._uint16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.Double: return y._double < 0 ? 1 : -y._double.CompareTo(x._uint16);
                    case (uint)TypeCode.UInt16 << 5 | (uint)TypeCode.Decimal: return y._decimal < 0 ? 1 : -y._decimal.CompareTo(x._uint16);

                    // this == Int32
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.SByte: return x._int32.CompareTo(y._sbyte);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.Byte: return x._int32 < 0 ? -1 : x._int32.CompareTo(y._byte);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.Int16: return x._int32.CompareTo(y._int16);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.UInt16: return x._int32 < 0 ? -1 : x._int32.CompareTo(y._uint16);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.Int32: return x._int32.CompareTo(y._int32);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.UInt32: return x._int32 < 0 ? -1 : -y._uint32.CompareTo((uint)x._int32);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.Int64: return -y._int64.CompareTo(x._int32);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.UInt64: return x._int32 < 0 ? -1 : -y._uint64.CompareTo((ulong)x._int32);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.Single: return -y._single.CompareTo(x._int32);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.Double: return -y._double.CompareTo(x._int32);
                    case (uint)TypeCode.Int32 << 5 | (uint)TypeCode.Decimal: return -y._decimal.CompareTo(x._int32);

                    // this == UInt32
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.SByte: return y._sbyte < 0 ? 1 : x._uint32.CompareTo((uint)y._sbyte);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.Byte: return x._uint32.CompareTo(y._byte);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.Int16: return y._int16 < 0 ? 1 : x._uint32.CompareTo((uint)y._int16);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.UInt16: return x._uint32.CompareTo(y._uint16);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.Int32: return y._int32 < 0 ? 1 : x._uint32.CompareTo((uint)y._int32);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.UInt32: return x._uint32.CompareTo(y._uint32);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.Int64: return y._int64 < 0 ? 1 : -y._int64.CompareTo(x._uint32);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.UInt64: return -y._uint64.CompareTo(x._uint32);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.Single: return y._single < 0 ? 1 : -y._single.CompareTo(x._uint32);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.Double: return y._double < 0 ? 1 : -y._double.CompareTo(x._uint32);
                    case (uint)TypeCode.UInt32 << 5 | (uint)TypeCode.Decimal: return y._decimal < 0 ? 1 : -y._decimal.CompareTo(x._uint32);

                    // this == Int64
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.SByte: return x._int64.CompareTo(y._sbyte);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.Byte: return x._int64 < 0 ? -1 : x._int64.CompareTo(y._byte);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.Int16: return x._int64.CompareTo(y._int16);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.UInt16: return x._int64 < 0 ? -1 : x._int64.CompareTo(y._uint16);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.Int32: return x._int64.CompareTo(y._int32);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.UInt32: return x._int64 < 0 ? -1 : x._int64.CompareTo(y._uint32);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.Int64: return x._int64.CompareTo(y._int64);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.UInt64: return x._int64 < 0 ? -1 : -y._uint64.CompareTo((ulong)x._int64);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.Single: return -((double)y._single).CompareTo(x._int64);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.Double: return -y._double.CompareTo(x._int64);
                    case (uint)TypeCode.Int64 << 5 | (uint)TypeCode.Decimal: return -y._decimal.CompareTo(x._int64);

                    // this == UInt64
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.SByte: return y._sbyte < 0 ? 1 : x._uint64.CompareTo((ulong)y._sbyte);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.Byte: return x._uint64.CompareTo(y._byte);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.Int16: return y._int16 < 0 ? 1 : x._uint64.CompareTo((ulong)y._int16);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.UInt16: return x._uint64.CompareTo(y._uint16);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.Int32: return y._int32 < 0 ? 1 : x._uint64.CompareTo((ulong)y._int32);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.UInt32: return x._uint64.CompareTo(y._uint32);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.Int64: return y._int64 < 0 ? 1 : x._uint64.CompareTo((ulong)y._int64);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.UInt64: return x._uint64.CompareTo(y._uint64);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.Single: return y._single < 0 ? 1 : -((double)y._single).CompareTo(x._uint64);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.Double: return y._double < 0 ? 1 : -y._double.CompareTo(x._uint64);
                    case (uint)TypeCode.UInt64 << 5 | (uint)TypeCode.Decimal: return y._decimal < 0 ? 1 : -y._decimal.CompareTo(x._uint64);

                    // this == Single
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.SByte: return x._single.CompareTo(y._sbyte);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.Byte: return x._single < 0 ? -1 : x._single.CompareTo(y._byte);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.Int16: return x._single.CompareTo(y._int16);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.UInt16: return x._single < 0 ? -1 : x._single.CompareTo(y._uint16);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.Int32: return x._single.CompareTo(y._int32);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.UInt32: return x._single < 0 ? -1 : x._single.CompareTo(y._uint32);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.Int64: return ((double)x._single).CompareTo(y._int64);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.UInt64: return x._single < 0 ? -1 : ((double)x._single).CompareTo(y._uint64);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.Single: return x._single.CompareTo(y._single);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.Double: return -y._double.CompareTo(x._single);
                    case (uint)TypeCode.Single << 5 | (uint)TypeCode.Decimal:
                        return x._single <= SingleDecimalMinValue || x._single >= SingleDecimalMaxValue
                            ? x._single.CompareTo((float)y._decimal)
                            : -y._decimal.CompareTo((decimal)x._single);

                    // this == Double
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.SByte: return x._double.CompareTo(y._sbyte);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.Byte: return x._double < 0 ? -1 : x._double.CompareTo(y._byte);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.Int16: return x._double.CompareTo(y._int16);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.UInt16: return x._double < 0 ? -1 : x._double.CompareTo(y._uint16);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.Int32: return x._double.CompareTo(y._int32);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.UInt32: return x._double < 0 ? -1 : x._double.CompareTo(y._uint32);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.Int64: return x._double.CompareTo(y._int64);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.UInt64: return x._double < 0 ? -1 : x._double.CompareTo(y._uint64);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.Single: return x._double.CompareTo(y._single);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.Double: return x._double.CompareTo(y._double);
                    case (uint)TypeCode.Double << 5 | (uint)TypeCode.Decimal:
                        return x._double <= DoubleDecimalMinValue || x._double >= DoubleDecimalMaxValue
                            ? x._double.CompareTo((double)y._decimal)
                            : -y._decimal.CompareTo((decimal)x._double);

                    // this == Decimal
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.SByte: return x._decimal.CompareTo(y._sbyte);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.Byte: return x._decimal < 0 ? -1 : x._decimal.CompareTo(y._byte);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.Int16: return x._decimal.CompareTo(y._int16);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.UInt16: return x._decimal < 0 ? -1 : x._decimal.CompareTo(y._uint16);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.Int32: return x._decimal.CompareTo(y._int32);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.UInt32: return x._decimal < 0 ? -1 : x._decimal.CompareTo(y._uint32);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.Int64: return x._decimal.CompareTo(y._int64);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.UInt64: return x._decimal < 0 ? -1 : x._decimal.CompareTo(y._uint64);
                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.Single:
                        return y._single <= SingleDecimalMinValue || y._single >= SingleDecimalMaxValue
                            ? ((float)x._decimal).CompareTo(y._single)
                            : x._decimal.CompareTo((decimal)y._single);

                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.Double:
                        return y._double <= DoubleDecimalMinValue || y._double >= DoubleDecimalMaxValue
                            ? ((double)x._decimal).CompareTo(y._double)
                            : x._decimal.CompareTo((decimal)y._double);

                    case (uint)TypeCode.Decimal << 5 | (uint)TypeCode.Decimal: return x._decimal.CompareTo(y._decimal);
                }

                return 0;
            }

            public override bool Equals(Number x, Number y)
            {
                if (x.ValueTypeCode != y.ValueTypeCode) return false;

                // Double
                if ((x.Kind & NumberKinds.Real) > 0)
                    return x._double == y._double;

                // Decimal
                if (x.ValueTypeCode == TypeCode.Decimal)
                    return x._decimal == y._decimal;

                // Int
                return x._uint64 == y._uint64;
            }

            public override int GetHashCode(Number obj)
            {
                // Double
                if ((obj.Kind & NumberKinds.Real) > 0)
#if !NETSTANDARD2_0
                    return HashCode.Combine(obj.ValueTypeCode, obj._double);
#else
                {
                    int hc = 11;
                    unchecked
                    {
                        hc = hc * 7 + (int)obj.ValueTypeCode;
                        hc = hc * 7 + obj._double.GetHashCode();
                    }
                    return hc;
                }
#endif

                // Decimal
                if (obj.ValueTypeCode == TypeCode.Decimal)
#if !NETSTANDARD2_0
                    return HashCode.Combine(obj.ValueTypeCode, obj._decimal);
#else
                {
                    int hc = 11;
                    unchecked
                    {
                        hc = hc * 7 + (int)obj.ValueTypeCode;
                        hc = hc * 7 + obj._decimal.GetHashCode();
                    }
                    return hc;
                }
#endif

                // Int
#if !NETSTANDARD2_0
                return HashCode.Combine(obj.ValueTypeCode, obj._uint64);
#else
                {
                    int hc = 11;
                    unchecked
                    {
                        hc = hc * 7 + (int)obj.ValueTypeCode;
                        hc = hc * 7 + obj._uint64.GetHashCode();
                    }
                    return hc;
                }
#endif
            }
        }
    }
}


text:
package info.benjaminhill.vst;

import java.nio.file.Paths;
import java.util.List;
import java.util.SortedSet;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import info.benjaminhill.util.DBLite;

/**
 * @author benhill
 */
public class VirtualStarTracker {

	private static final Logger LOG = Logger.getLogger(VirtualStarTracker.class.getName());
	private static final int COMBINE_EXPOSURE_MS = 1_000 * 15;

	/**
	 * @param args
	 */
	public static void main(final String... args) {
		System.setProperty("java.util.logging.SimpleFormatter.format", "%4$s: %5$s%n");
		Frame.schema();
		Pixel.schema();

		if (DBLite.DB.selectLong("SELECT count(1) FROM `frame`") < 3) {
			LOG.info("Not enough frames, reloading.");

			ImageUtils.getImageFiles(Paths.get("frames")).parallelStream().forEach(file -> new Frame(file).save());
			LOG.info("Saved all frames");
		}

		if (DBLite.DB.selectLong("SELECT count(1) FROM `pixel`") < 10) {
			LOG.info("Not enough pixels, reloading brights.");
			Frame.loadTimeGrouped(COMBINE_EXPOSURE_MS).parallelStream().forEach(frame -> {
				frame.findBrights();
				LOG.log(Level.INFO, "{0}\t{1}", new Object[] { frame.getPixels().size(), frame.getAddedPath() });
			});
			LOG.info("Finished finding pixels.");
		}

		final SortedSet<Frame> frames = Frame.loadTimeGrouped(COMBINE_EXPOSURE_MS);

		LOG.log(Level.INFO, "DB has frame groups:{0}", frames.size());

		final SortedSet<PixelTrail> activeTrails = new ConcurrentSkipListSet<>();
		final ConcurrentSkipListSet<PixelTrail> finishedTrails = new ConcurrentSkipListSet<>();

		frames.forEach(frame -> {

			finishedTrails.addAll(activeTrails.stream().filter(pt -> {
				return !pt.isWithinTimeWindow(frame.getTs());
			}).collect(Collectors.toList()));

			activeTrails.removeAll(finishedTrails);

			frame.getPixels().stream().forEach(pixel -> {
				// First check to see if it can be added to an existing trail
				for (final PixelTrail trail : activeTrails) {
					if (trail.offerPixel(frame, pixel)) {
						return;
					}
				}
				PixelTrail newTrail = new PixelTrail();
				newTrail.offerPixel(frame, pixel);
				activeTrails.add(newTrail);
			});
		});
		finishedTrails.addAll(activeTrails);
		activeTrails.clear();
		LOG.log(Level.INFO, "Trails: {0}", finishedTrails.size());

		final List<PixelTrail> longTrails = finishedTrails.stream().filter(t -> t.getDuration() > 1_000 * 60 * 10 && t
				.getPixelDistanceSq() > 10).collect(Collectors.toList());

		LOG.log(Level.INFO, "Long Trails: {0}", longTrails.size());

	}

}


text:
package br.eti.hmagalhaes.rh.controller;

import br.eti.hmagalhaes.rh.model.dto.ColaboradorFormDTO;
import br.eti.hmagalhaes.rh.model.entity.Colaborador;
import br.eti.hmagalhaes.rh.model.service.*;
import javax.validation.Valid;
import org.slf4j.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.core.convert.ConversionService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @author Hudson P. Magalhães <hudson@hmagalhaes.eti.br>
 * @since 27-Feb-2014
 */
@Controller
@RequestMapping("/colaborador")
public class ColaboradorController {
	private static final String FORM_INCLUIR = "formIncluirColaborador";
	private static final String FORM_EDITAR = "formEditarColaborador";
	private final Logger log = LoggerFactory.getLogger(ColaboradorController.class);
	private ColaboradorService colaboradorService;
	private DepartamentoService departamentoService;
	private ConversionService conversionService;
	private ResourceBundleMessageSource msgBundle;
	private I18nService i18nService;

	@RequestMapping("")
	public String listar(Model model,
			@RequestParam(value="msg", required=false) String mensagem) {
		try {
			model.addAttribute("lista", colaboradorService.buscar());
			model.addAttribute("msg", mensagem);
			loadLocaleData(model);
			return "colaborador/listar";
		} catch (RuntimeException ex) {
			return mostrarErro(model, ex);
		}
	}

	@RequestMapping(value="/{id}/editar", method=RequestMethod.GET)
	public String formEditar(Model model, @PathVariable("id") Long id) {
		try {
			Colaborador colaborador = colaboradorService.buscar(id);
			if (colaborador != null) {
				model.addAttribute(FORM_EDITAR,
						conversionService.convert(colaborador, ColaboradorFormDTO.class));
				model.addAttribute("departamentos", departamentoService.buscar());
				loadLocaleData(model);
				return "colaborador/editar";
			} else {
				throw new RuntimeException(msgBundle.getMessage("colab.msg.reg_nao_encontrado",
						new Long[]{id}, i18nService.getLocaleAtual()) );
			}
		} catch (RuntimeException ex) {
			return mostrarErro(model, ex);
		}
	}

	@RequestMapping(value="/{id}/editar", method=RequestMethod.POST)
	public String salvarEditar(Model model,
			@Valid @ModelAttribute(FORM_EDITAR) ColaboradorFormDTO form,
			BindingResult result) {
		try {
			if (!result.hasErrors()) {
				colaboradorService.atualizar(form);
				model.addAttribute("msg", msgBundle.getMessage("colab.msg.atualizado",
						new String[]{form.getNome()}, i18nService.getLocaleAtual()));
				return "redirect:/colaborador/";
			} else {
				model.addAttribute(FORM_EDITAR, form);
				model.addAttribute("departamentos", departamentoService.buscar());
				loadLocaleData(model);
				return "colaborador/editar";
			}
		} catch (RuntimeException ex) {
			return mostrarErro(model, ex);
		}
	}

	@RequestMapping(value="/incluir", method=RequestMethod.GET)
	public String formIncluir(Model model) {
		try {
			model.addAttribute(FORM_INCLUIR, new ColaboradorFormDTO());
			model.addAttribute("departamentos", departamentoService.buscar());
			loadLocaleData(model);
			return "colaborador/incluir";
		} catch (RuntimeException ex) {
			return mostrarErro(model, ex);
		}
	}

	@RequestMapping(value="/incluir", method=RequestMethod.POST)
	public String salvarIncluir(Model model,
			@Valid @ModelAttribute(FORM_INCLUIR) ColaboradorFormDTO form,
			BindingResult result) {
		try {
			if (!result.hasErrors()) {
				colaboradorService.inserir(form);
				model.addAttribute("msg", msgBundle.getMessage("colab.msg.inserido",
						new String[]{form.getNome()}, i18nService.getLocaleAtual()));
				return "redirect:/colaborador/";
			} else {
				model.addAttribute(FORM_INCLUIR, form);
				model.addAttribute("departamentos", departamentoService.buscar());
				loadLocaleData(model);
				return "colaborador/incluir";
			}
		} catch (RuntimeException ex) {
			return mostrarErro(model, ex);
		}
	}

	@RequestMapping(value="/{id}/remover")
	public String remover(Model model, @PathVariable("id") Long id) {
		try {
			colaboradorService.remover(id);
			model.addAttribute("msg", msgBundle.getMessage("colab.msg.removido",
					new Long[]{id}, i18nService.getLocaleAtual()));
			return "redirect:/colaborador/";
		} catch (RuntimeException ex) {
			return mostrarErro(model, ex);
		}
	}

	private String mostrarErro(Model model, Throwable ex) {
		log.error(ex.getMessage(), ex);
		model.addAttribute("error", ex.toString() + " " +
				(ex.getMessage() != null ? ex.getMessage() : "") );
		loadLocaleData(model);
		return "error";
	}

	/**
	 * Carrega no modelo indicado os dados de locale necessários às views
	 * da aplicação.
	 * @param model
	 */
	private void loadLocaleData(Model model) {
		model.addAttribute("localeAtual", i18nService.getLocaleAtual());
		model.addAttribute("locales", i18nService.getLocalesSuportados());
	}

	@Autowired
	public void setColaboradorService(ColaboradorService colaboradorService) {
		this.colaboradorService = colaboradorService;
	}

	@Autowired
	public void setConversionService(ConversionService conversionService) {
		this.conversionService = conversionService;
	}

	@Autowired
	public void setDepartamentoService(DepartamentoService departamentoService) {
		this.departamentoService = departamentoService;
	}

	@Autowired
	public void setMsgBundle(ResourceBundleMessageSource msgBundle) {
		this.msgBundle = msgBundle;
	}

	@Autowired
	public void setI18nService(I18nService i18nService) {
		this.i18nService = i18nService;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/custom_dialog_layout_design_user_input"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp">

    <TextView
        android:id="@+id/dialogTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Create New HashTag"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/userInputDialog"
        android:backgroundTint="@color/md_grey_500"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Write New Hashtag"
        android:inputType="text" />
</LinearLayout>


text:
angular.module('myapis').controller('EditApiController', ['$scope', '$location', '$routeParams', '$filter', '$modal', 'apiClient','util', function($scope, $location, $routeParams, $filter, $modal, apiclient, util){

    var apiId = $routeParams.id;

    var apisOptions = { method : "GET", url : "/?me=true&sort=name"};
    //var apisOptions = { method : "GET", url : "/?sort=name"};
    var instanceOptions = { method : "GET", url : "/" + apiId + "/instances"};
    var gbuOptions = {
        url: "https://api.mypsn.com/svc1/v2/businesshierarchy/BusinessUnits?limit=9001",
        method : "GET",
        mode: "production",
        headers: [{"Accept": "application/json"}]
    };
    var functionsOptions = {
        url: "https://api.mypsn.com/svc1/v2/businesshierarchy/Functions?limit=9001",
        method : "GET",
        mode: "production",
        headers:[{"Accept": "application/json"}]
    };
    $scope.alertMsg = {
    	type: "",
    	message: "",
    	clss: "",
    	show: false
    };

    $scope.apis = null;
    $scope.instances = null;
    $scope.selApiId = apiId;
    $scope.selApiName = "";
    $scope.selInstanceId = null;
    $scope.selInstanceName = "";
    $scope.selInstanceType = "";
    $scope.httpMethods = ["POST","PUT","DELETE","GET"];

    //Current Metadata to bind views
    $scope.curApi = null;
    $scope.curInstance = null;
    $scope.curEndpoints = null;

    if($location.$$search.endpts!=null)
    {
    	$scope.selContext = "endpoints";
    	$scope.selInstanceId = $location.$$search.inst;
    	BindEndpointsData();
    }
    else
    {
    	$scope.selContext = "api";
    }

    $scope.api_changed = function() {

        // angular.element('#leftnav .list-group-item').removeClass('active');
        // angular.element('#leftnavHome').addClass('active');

        angular.element('#leftTreeNav .abn-tree-row').removeClass('active');
        angular.element('#leftTreeNavHome').addClass('active');

        $scope.selContext = "api";
        $scope.selApiId = this.selApiId;
        $scope.curApi = null;
        $scope.curInstance = null;
        $scope.curEndpoints = null;
        //console.log("Changed" + $scope.selApiId);
        apiclient.request({ method : "GET", url : "/" +  this.selApiId + "/instances"}, GetInstances, "services");
        GetApiData();
    };

    $scope.action = function(type,e){

    	var id = this.item ? this.item.id : $scope.selApiId;
        $scope.selContext = type;

        angular.element('#leftTreeNav .abn-tree-row').removeClass('active');
        angular.element(e.currentTarget).parent().addClass('active');

        // angular.element('#leftnav .list-group-item').removeClass('active');
        // angular.element(e.currentTarget).addClass('active');

        util.loading(true);

        if(type=="instance"){
            //if($scope.selInstanceId != id)
            //{
                var instid = this.item.id;
                $scope.selInstanceId = instid;
                $scope.selInstanceName = this.item.shortName;
                $scope.selInstanceType = this.item.type;
                $scope.curInstance = null;
    			$scope.curEndpoints = null;
    			apiclient.request({ method : "GET", url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId}, GetInstanceData, "services");
            	apiclient.request({ method : "GET", url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId + "/endpoints?full=true&sort=name"}, GetEndpointsData, "services");
            //}
        }
        else if(type=="endpoints"){
            //if($scope.selInstanceId != id)
            //{
                var instid = this.item.id;
                $scope.selInstanceId = instid;
                $scope.selInstanceName = this.item.shortName;
                $scope.selInstanceType = this.item.type;
                $scope.curEndpoints = null;
                apiclient.request({ method : "GET", url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId + "/endpoints?full=true&sort=name"}, GetEndpointsData, "services");
            //}
        }
        //console.log($scope.mytype);
    };

	$scope.addApi = function(form) {

		$location.url("/developer/addapi");
	};

    $scope.saveApi = function(form) {

    	form.$setPristine();

    	if(form.$valid)
    	{
	    	var saveOptions = {
	    	 		method : "PUT",
	    	 		url : "/" + $scope.curApi._id,
	    	 		body: $scope.curApi
	    	 		};
	    	apiclient.request(saveOptions, SaveApiData, "services");
	    }
	    else
	    {
	    	ShowMsg("Please fill the required fields.", "error");
	    }
    };

    function SaveApiData(data, status)
	{
		//Todo: add sucess/error messages based on the status codes
		if(status === 200)
		{
			if(data.items.length > 0)
			{
				ShowMsg("Successfully saved data.", "success");
			}
		}
		else
		{
			ShowMsg("Unable to process the request.", "error");
			//console.log(data);
		}
	}

	$scope.deleteApi = function() {

        var confDelete = confirm('Are you absolutely sure you want to delete?');

        if(confDelete)
        {
	        if($scope.curApi._id != null)
	        {
	            var apiDelOptions = { method : "DELETE", url : "/" +  $scope.selApiId};
	            apiclient.request(apiDelOptions, DeleteApiData, "services");
	        }
        }
    };

    function DeleteApiData(data, status)
    {
        if(status === 200)
		{
			if(data.items.length > 0)
			{
				ShowMsg("Successfully completed the operation.", "success");
				$location.url("/developer/myapis");
			}
		}
		else
		{
			ShowMsg("Unable to process the request.", "error");
		}
    };

	$scope.addInstance = function() {
    	$scope.curInstance = { shortName: "", api_id: null, servers: [], platform: "custom", private: false, beta: false, version: "1.0.0", type: "staging"};
    	$scope.selContext = "instance";
    	$scope.selInstanceName = "";
    	$scope.selInstanceType = "";
    	$scope.curEndpoints = "";
    };

	$scope.saveInstance = function(form) {

		form.$setPristine();

		if(form.$valid)
    	{
    		for(i=0; i < $scope.curInstance.servers.length; i++)
    		{
    			var srv = $scope.curInstance.servers[i];

    			if(srv.context != null)
    			{
    				var contx = {};
	    			if(srv.context.type=="path")
		    		{
		    			contx["type"] = "path";
		    			contx["value"] = srv.context.value;
		    			contx["segment"] = srv.context.segment;

		    		}
		    		else if(srv.context.type=="query")
		    		{
		    			contx["type"] = "query";
		    			contx["value"] = srv.context.value;
		    			contx["key"] = srv.context.key;
		    		}
		    		else if(srv.context.type=="none")
		    		{
		    			contx = null;
		    		}

		    		srv.context = contx;
	    		}
	    		else
	    		{
	    			srv.context = null;
	    		}

	    		$scope.curInstance.servers[i] = srv;
    		}

    		if($scope.curInstance.api_id == null)
    		{
    			$scope.curInstance.api_id = $scope.selApiId;
    		}

	         if($scope.curInstance._id == null)
	         {
	            var instanceSaveOptions = {
	                method : "POST",
	                url : "/" +  $scope.selApiId + "/instances",
	                body: $scope.curInstance
	                };
	            apiclient.request(instanceSaveOptions, SaveInstanceData, "services");
	         } else {
	            var instanceSaveOptions = {
	                method : "PUT",
	                url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId,
	                body: angular.toJson($scope.curInstance)
	                };
	            apiclient.request(instanceSaveOptions, SaveInstanceData, "services");
	         }
        }
        else
		{
			ShowMsg("Unable to process the request.", "error");
			//console.log(data);
		}
    };

    function SaveInstanceData(data, status)
	{
		if(status === 200)
		{
			if(data.items.length > 0)
			{
				ShowMsg("Successfully saved data.", "success");
			}
		}
		else
		{
			HandleError(data);
		}

		apiclient.request(instanceOptions, GetInstances, "services");
	}

	$scope.deleteInstance = function() {

		var confDelete = confirm('Are you sure you want to delete?');

        if(confDelete)
        {
	        if($scope.curInstance._id != null)
	        {
	            var instanceDelOptions = { method : "DELETE", url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId};
	            apiclient.request(instanceDelOptions, DeleteInstanceData, "services");
	        }
        }
    };

    function DeleteInstanceData(data, status)
    {
        if(status === 200)
		{
			if(data.items.length > 0)
			{
				$scope.curInstance = null;
				ShowMsg("Successfully completed the operation.", "success");
			}
		}
		else
		{
			HandleError(data);
		}
		$scope.selInstanceId = null;
    	$scope.selInstanceName = "";
		$scope.curInstance = null;
		$scope.curEndpoints = null;
		apiclient.request(instanceOptions, GetInstances, "services");
    };

    $scope.saveEndpoint = function(endpoint, form) {

    	form.$setPristine();

    	if(form.$valid)
    	{
	         if(endpoint._id == null)
	         {
	            var endpointSaveOptions = {
	                method : "POST",
	                url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId + "/endpoints",
	                body: endpoint
	                };
	            apiclient.request(endpointSaveOptions, CreateEndpointData, "services");
	         } else {
	            var endpointSaveOptions = {
	                method : "PUT",
	                url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId + "/endpoints/" +   endpoint._id,
	                body: endpoint
	                };
	            apiclient.request(endpointSaveOptions, UpdateEndpointData, "services");
	         }
         }
        else
		{
			ShowMsg("Unable to process the request.", "error");
			//console.log(data);
		}
    };

    function CreateEndpointData(data, status)
    {
        //Todo: add sucess/error messages based on the status codes
        if(status === 200)
        {
        	ShowMsg("Successfully completed the operation.", "success");
            BindEndpointsData();
        }
        else
		{
			HandleError(data);
		}
    }

    function UpdateEndpointData(data, status)
    {
        //Todo: add sucess/error messages based on the status codes
        if(status === 200)
        {
        	ShowMsg("Successfully completed the operation.", "success");
            BindEndpointsData();
        }
        else
		{
			var msg = JSON.parse(data.message);

			if(msg.name.toLowerCase().indexOf("error") > -1)
			{
				ShowMsg(JSON.parse(data.message).message, "error");
			}
			else
			{
				ShowMsg("Unable to process the request.", "error");
			}

			//console.log(data);
		}
    }

    $scope.deleteEndpoint = function(endpoints, endpoint, index) {
        if(endpoint._id != null)
        {
        	var confDelete = confirm('Are you sure you want to delete?');

	        if(confDelete)
	        {
            	var endpointDelOptions = { method : "DELETE", url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId + "/endpoints/" +   endpoint._id};
            	apiclient.request(endpointDelOptions, DeleteEndpointData, "services");
            }
        }
        else
        {
            endpoints.splice(index, 1);
        }
    };

    function DeleteEndpointData(data, status)
    {
        //Todo: add sucess/error messages based on the status codes
        if(status === 200)
        {
            BindEndpointsData();
        }
        else
        {
        	var msg = JSON.parse(data.message);

			if(msg.name.toLowerCase().indexOf("error") > -1)
			{
				ShowMsg(JSON.parse(data.message).message, "error");
			}
			else
			{
				ShowMsg("Unable to process the request.", "error");
			}

			//console.log(data);
        }
    }

    $scope.addEndpoint = function() {

    	var endpoints = $scope.curEndpoints;

    	if(endpoints != null)
    	{
	    	if($scope.selContext != "endpoints")
	    	{
	    		$scope.selContext = "endpoints";
	    		//$scope.action("endpoints");
	    	}

	        var endpointObj = { path: "/path", operations: [], statusEndpoint: false, private: false, description: ""};

	        var duplcte = endpoints.filter(function(item){
	                if(item.path === "/path")
	                  return true;}
	                 );
	        if(duplcte.length == 0)
	        {
	            $scope.isopen = true;
	            endpoints.push(endpointObj);
	        }
       }
       else
       {
       		ShowMsg("Please select an instance to add endpoint.", "error");
       }
    };

    $scope.addOperation = function(endpoint, method) {
        var operObj = { httpMethod: method, supports: ["application/json"], responseClass: "void", private: false, parameters: [], summary: "", nickname: "resource"};

        var duplcte = endpoint.operations.filter(function(item){
                if(item.httpMethod === operObj.httpMethod)
                  return true;}
                 );
        if(duplcte.length == 0)
          endpoint.operations.push(operObj);
    };

    $scope.removeOperation = function(endpoint, index) {
        endpoint.operations.splice(index, 1);
    };

    $scope.addParameter = function(operation) {
        var paramObj = { name: "", enum: [], dataType: "string", required: false, private: false, description: "", paramType: "query"};

        var duplcte = operation.parameters.filter(function(item){
                if(item.name === "")
                  return true;}
                 );
        if(duplcte.length == 0)
          operation.parameters.push(paramObj);
    };

    $scope.removeParameter = function(operation, index) {
        operation.parameters.splice(index, 1);
    };

    $scope.addTag = function(tags,tag,typ) {
        if(tag != null && tag.Name != null)
        {
            var duplcte = tags.filter(function(item){
                if(item.name === tag.Name)
                  return true;}
                 );
            if(duplcte.length == 0)
            {
                var obj =  { type: typ, name: tag.Name, _id: ""};
                tags.push(obj);
                tag = null;
            }
        }
    };

    $scope.removeTag = function(tags, tag, type) {
        for(var i in tags){
            if(tags[i].name==tag.name && tags[i].type==tag.type){
                tags.splice(i,1);
                break;
            }
        }
    };
    $scope.addServerContext = function(instnc) {
        var serverObj = { url: "http://", context: null};

        var duplcte = instnc.servers.filter(function(item){
                if(item.name === "http://")
                  return true;}
                 );
        if(duplcte.length == 0)
          instnc.servers.push(serverObj);
    };

    $scope.copyServerContext = function(instnc, server) {

        var contx = null;
        if(server.context != null)
        {
            contx = {};
            if(server.context.type=="path")
            {
                contx["type"] = "path";
                contx["value"] = server.context.value;
                contx["segment"] = server.context.segment;

            }
            else if(server.context.type=="query")
            {
                contx["type"] = "query";
                contx["value"] = server.context.value;
                contx["key"] = server.context.key;
            }
        }

        var serverObj = { url: server.url, context: contx};

        instnc.servers.push(serverObj);
    };

    $scope.removeServerContext = function(instnc, index) {
        instnc.servers.splice(index, 1);
    };

    function BindEndpointsData()
    {
        apiclient.request({ method : "GET", url : "/" +  $scope.selApiId + "/instances/" + $scope.selInstanceId + "/endpoints?full=true&sort=name"}, GetEndpointsData, "services");
    	util.loading(true);
    }

    function GetEndpointsData(data, status)
    {
    	util.loading(false);
        if(status === 200)
        {
            $scope.curEndpoints = data.items;
        }
    }

    function GetInstanceData(data, status)
    {
        if(status === 200)
        {
            $scope.curInstance = data.items[0];
            $scope.selInstanceType = $scope.curInstance.type;
        }
    }

    function GetApiData()
    {
        if($scope.apis != null)
        {
            var api = $scope.apis.filter(function(item){
                if(item._id === $scope.selApiId)
                  return true;}
                 );
           if(api !=null && api.length > 0)
           {
                $scope.curApi = api[0];
                $scope.selApiName = api[0].name;
           }
       }
    }

    function GetApis(data, status)
    {
        if(status === 200)
        {
            $scope.apis = data.items;
        }
        else
        {
        	$scope.apis = null;
        }
        //console.log("Done" + data);
        GetApiData();
    }

    function GetInstances(data, status)
    {
        if(status === 200)
        {
            $scope.instances = data.items;
        }
        else
        {
            $scope.instances = null;
        }
        //console.log("Done" + data);
        GetApiData();
    }

    function GetGBUs(data, status)
    {
        if(status === 200)
        {
            $scope.gbus = data.Items;
        }
    }

    function GetFunctions(data, status)
    {
        if(status === 200)
        {
            $scope.functions = data.Items;
        }
    }

    function HandleError(data)
	{
		var msg = null;
		if(data.message != null)
		{
			msg = JSON.parse(data.message);
		}
		else
		{
			msg = JSON.parse(data);
		}

		if((msg!=null) && (msg.name!=null) && (msg.name.toLowerCase().indexOf("error") > -1))
		{
			ShowMsg(msg.message, "error");
		}
		else
		{
			ShowMsg("Unable to process the request.", "error");
		}

		//console.log(data);
	}

    /* Alerts */
    $scope.alerts = [];

    function ShowMsg(mesg, typ)
	{
		if(typ == "error") typ = "danger";
		$scope.alerts.push({type: typ, msg: mesg});
	}

	$scope.closeAlert = function(index){
		$scope.alerts.splice(index, 1);
	};

	/*Copy Endpoints - Modal - Start*/

	$scope.openCopyEndpoints = function () {

		if($scope.selInstanceId != null)
		{

		    var modalInstance = $modal.open({
		      templateUrl: 'developer/myapis/copyEndpoints.tpl.html',
		      controller: 'CopyEndpointsController',
		      resolve: {
		        instances: function () {
		          return $scope.instances;
		        },
		        selApIName: function () {
		          return $scope.selApiName;
		        },
		        selInstanceId: function () {
		          return $scope.selInstanceId;
		        },
		        selApiId: function () {
		          return $scope.selApiId;
		        }
		      }
		    });

		    modalInstance.result.then(function (result) {

		    		if(result == "success")
		    		{
		    			ShowMsg("Successfully copied the endpoints", "success");
		    		}

					//console.log("Selected Item:" + selectedItem);
		    	}, function () {
		      		//console.log('Modal dismissed at: ' + new Date());
		    	});
     	}
     	else
     	{
     		ShowMsg("Please select an Instance to Copy Endpoints.","warning");
     	}
  	};

  	/*Copy Endpoints - Modal - End*/

    apiclient.request(apisOptions, GetApis, "services");
    apiclient.request(instanceOptions, GetInstances, "services");
    //Get GBUs for dropdown
    apiclient.request(gbuOptions, GetGBUs);
    //Get functions for dropdown
    apiclient.request(functionsOptions, GetFunctions);

}]);


text:
package cloudflare

import (
	"encoding/json"
	"github.com/pkg/errors"
	"time"
)

// WorkerRequestParams provides parameters for worker requests for both enterprise and standard requests
type WorkerRequestParams struct {
	ZoneID     string
	ScriptName string
}

// WorkerRoute aka filters are patterns used to enable or disable workers that match requests.
//
// API reference: https://api.cloudflare.com/#worker-filters-properties
type WorkerRoute struct {
	ID      string `json:"id,omitempty"`
	Pattern string `json:"pattern"`
	Enabled bool   `json:"enabled"`
	Script  string `json:"script"`
}

// WorkerRoutesResponse embeds Response struct and slice of WorkerRoutes
type WorkerRoutesResponse struct {
	Response
	Routes []WorkerRoute `json:"result"`
}

// WorkerRouteResponse embeds Response struct and a single WorkerRoute
type WorkerRouteResponse struct {
	Response
	WorkerRoute `json:"result"`
}

// WorkerScript Cloudflare Worker struct with metadata
type WorkerScript struct {
	WorkerMetaData
	Script string `json:"script"`
}

// WorkerMetaData contains worker script information such as size, creation & modification dates
type WorkerMetaData struct {
	ID         string    `json:"id,omitempty"`
	ETAG       string    `json:"etag,omitempty"`
	Size       int       `json:"size,omitempty"`
	CreatedOn  time.Time `json:"created_on,omitempty"`
	ModifiedOn time.Time `json:"modified_on,omitempty"`
}

// WorkerListResponse wrapper struct for API response to worker script list API call
type WorkerListResponse struct {
	Response
	WorkerList []WorkerMetaData `json:"result"`
}

// WorkerScriptResponse wrapper struct for API response to worker script calls
type WorkerScriptResponse struct {
	Response
	WorkerScript `json:"result"`
}

// DeleteWorker deletes worker for a zone.
//
// API reference: https://api.cloudflare.com/#worker-script-delete-worker
func (api *API) DeleteWorker(requestParams *WorkerRequestParams) (WorkerScriptResponse, error) {
	// if organization ID is defined and ScriptName is provided we will treat as org request
	if api.organizationID != "" && requestParams.ScriptName != "" {
		return api.deleteWorkerWithName(requestParams.ScriptName)
	}
	uri := "/zones/" + requestParams.ZoneID + "/workers/script"
	res, err := api.makeRequest("DELETE", uri, nil)
	var r WorkerScriptResponse
	if err != nil {
		return r, errors.Wrap(err, errMakeRequestError)
	}
	err = json.Unmarshal(res, &r)
	if err != nil {
		return r, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// DeleteWorkerWithName deletes worker for a zone.
// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise
// organizationID must be specified as api option https://godoc.org/github.com/cloudflare/cloudflare-go#UsingOrganization
//
// API reference: https://api.cloudflare.com/#worker-script-delete-worker
func (api *API) deleteWorkerWithName(scriptName string) (WorkerScriptResponse, error) {
	if api.organizationID == "" {
		return WorkerScriptResponse{}, errors.New("organization ID required for enterprise only request")
	}
	uri := "/accounts/" + api.organizationID + "/workers/scripts/" + scriptName
	res, err := api.makeRequest("DELETE", uri, nil)
	var r WorkerScriptResponse
	if err != nil {
		return r, errors.Wrap(err, errMakeRequestError)
	}
	err = json.Unmarshal(res, &r)
	if err != nil {
		return r, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// DownloadWorker fetch raw script content for your worker returns []byte containing worker code js
//
// API reference: https://api.cloudflare.com/#worker-script-download-worker
func (api *API) DownloadWorker(requestParams *WorkerRequestParams) (WorkerScriptResponse, error) {
	if api.organizationID != "" && requestParams.ScriptName != "" {
		return api.downloadWorkerWithName(requestParams.ScriptName)
	}
	uri := "/zones/" + requestParams.ZoneID + "/workers/script"
	api.headers.Add("Content-Type", "application/javascript")
	res, err := api.makeRequest("GET", uri, nil)
	var r WorkerScriptResponse
	if err != nil {
		return r, errors.Wrap(err, errMakeRequestError)
	}
	r.Script = string(res)
	r.Success = true
	return r, nil
}

// DownloadWorkerWithName fetch raw script content for your worker returns string containing worker code js
// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise/
//
// API reference: https://api.cloudflare.com/#worker-script-download-worker
func (api *API) downloadWorkerWithName(scriptName string) (WorkerScriptResponse, error) {
	if api.organizationID == "" {
		return WorkerScriptResponse{}, errors.New("organization ID required for enterprise only request")
	}
	uri := "/accounts/" + api.organizationID + "/workers/scripts/" + scriptName
	api.headers.Add("Content-Type", "application/javascript")
	res, err := api.makeRequest("GET", uri, nil)
	var r WorkerScriptResponse
	if err != nil {
		return r, errors.Wrap(err, errMakeRequestError)
	}
	r.Script = string(res)
	r.Success = true
	return r, nil
}

// ListWorkerScripts returns list of worker scripts for given organization
// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise
//
// API reference: https://developers.cloudflare.com/workers/api/config-api-for-enterprise/
func (api *API) ListWorkerScripts() (WorkerListResponse, error) {
	if api.organizationID == "" {
		return WorkerListResponse{}, errors.New("organization ID required for enterprise only request")
	}
	uri := "/accounts/" + api.organizationID + "/workers/scripts"
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return WorkerListResponse{}, errors.Wrap(err, errMakeRequestError)
	}
	var r WorkerListResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return WorkerListResponse{}, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// UploadWorker push raw script content for your worker
//
// API reference: https://api.cloudflare.com/#worker-script-upload-worker
func (api *API) UploadWorker(requestParams *WorkerRequestParams, data string) (WorkerScriptResponse, error) {
	if api.organizationID != "" && requestParams.ScriptName != "" {
		return api.uploadWorkerWithName(requestParams.ScriptName, data)
	}
	uri := "/zones/" + requestParams.ZoneID + "/workers/script"
	api.headers.Add("Content-Type", "application/javascript")
	res, err := api.makeRequest("PUT", uri, []byte(data))
	var r WorkerScriptResponse
	if err != nil {
		return r, errors.Wrap(err, errMakeRequestError)
	}
	err = json.Unmarshal(res, &r)
	if err != nil {
		return r, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// UploadWorkerWithName push raw script content for your worker
// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise/
//
// API reference: https://api.cloudflare.com/#worker-script-upload-worker
func (api *API) uploadWorkerWithName(scriptName string, data string) (WorkerScriptResponse, error) {
	if api.organizationID == "" {
		return WorkerScriptResponse{}, errors.New("organization ID required for enterprise only request")
	}
	uri := "/accounts/" + api.organizationID + "/workers/scripts/" + scriptName
	api.headers.Add("Content-Type", "application/javascript")
	res, err := api.makeRequest("PUT", uri, []byte(data))
	var r WorkerScriptResponse
	if err != nil {
		return r, errors.Wrap(err, errMakeRequestError)
	}
	err = json.Unmarshal(res, &r)
	if err != nil {
		return r, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// CreateWorkerRoute creates worker route for a zone
//
// API reference: https://api.cloudflare.com/#worker-filters-create-filter
func (api *API) CreateWorkerRoute(zoneID string, route WorkerRoute) (WorkerRouteResponse, error) {
	uri := "/zones/" + zoneID + "/workers/filters"
	res, err := api.makeRequest("POST", uri, route)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errMakeRequestError)
	}
	var r WorkerRouteResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// DeleteWorkerRoute deletes worker route for a zone
//
// API reference: https://api.cloudflare.com/#worker-filters-delete-filter
func (api *API) DeleteWorkerRoute(zoneID string, routeID string) (WorkerRouteResponse, error) {
	uri := "/zones/" + zoneID + "/workers/filters/" + routeID
	res, err := api.makeRequest("DELETE", uri, nil)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errMakeRequestError)
	}
	var r WorkerRouteResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// ListWorkerRoutes returns list of worker routes
//
// API reference: https://api.cloudflare.com/#worker-filters-list-filters
func (api *API) ListWorkerRoutes(zoneID string) (WorkerRoutesResponse, error) {
	uri := "/zones/" + zoneID + "/workers/filters"
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return WorkerRoutesResponse{}, errors.Wrap(err, errMakeRequestError)
	}
	var r WorkerRoutesResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return WorkerRoutesResponse{}, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}

// UpdateWorkerRoute updates worker route for a zone.
//
// API reference: https://api.cloudflare.com/#worker-filters-update-filter
func (api *API) UpdateWorkerRoute(zoneID string, routeID string, route WorkerRoute) (WorkerRouteResponse, error) {
	uri := "/zones/" + zoneID + "/workers/filters/" + routeID
	res, err := api.makeRequest("PUT", uri, route)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errMakeRequestError)
	}
	var r WorkerRouteResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}


text:
/*global $, gettext*/
var bankimport_transactionlist = {

    _btn_click: function (e) {
        console.log(e.delegateTarget);
        var trans_id = parseInt($(e.delegateTarget).attr("name").split("_")[1]);
        var value = $(e.delegateTarget).val();
        if (value === "discard") {
            bankimport_transactionlist.discard(trans_id);
        } else if (value === "accept") {
            bankimport_transactionlist.accept(trans_id);
        } else if (value === "retry") {
            bankimport_transactionlist.retry(trans_id);
        } else if (value === "assign") {
            bankimport_transactionlist.assign(trans_id);
        }
        return false;
    },

    _action: function (id, action, success) {
        $("tr[data-id=" + id + "] button").prop("disabled", true);
        var data = {
            "csrfmiddlewaretoken": $("[name=csrfmiddlewaretoken]").val()
        };
        data["action_" + id] = action;
        $.ajax({
            "method": "POST",
            "url": $(".transaction-list").attr("data-url"),
            "data": data,
            "dataType": "json",
            "success": function (data) {
                if (data.status == "ok") {
                    $("tr[data-id=" + id + "]").removeClass("has-error");
                    success();
                } else {
                    $("tr[data-id=" + id + "] button").prop("disabled", false);
                    $("tr[data-id=" + id + "] .help-block").remove();
                    $("tr[data-id=" + id + "]").addClass("has-error");
                    $("
").addClass("help-block").text(data.message).appendTo($("tr[data-id=" + id + "] td.actions"));
                }
            }
        });
    },

    discard: function (id) {
        bankimport_transactionlist._action(id, "discard", function () {
            $("tr[data-id=" + id + "] td").remove();
        });
    },

    retry: function (id) {
        bankimport_transactionlist._action(id, "retry", function () {
            $("tr[data-id=" + id + "] td.actions").html('').text(gettext("Marked as paid"));
        });
    },

    accept: function (id) {
        bankimport_transactionlist._action(id, "accept", function () {
            $("tr[data-id=" + id + "] td.actions").html('').text(gettext("Marked as paid"));
        });
    },

    assign: function (id) {
        bankimport_transactionlist._action(id, "assign:" + $("tr[data-id=" + id + "] input.form-control:not(.tt-hint)").val(), function () {
            $("tr[data-id=" + id + "] td.actions").html('').text(gettext("Marked as paid"));
        });
    },

    comment_reset_to_text: function (id, text) {
        var $box = $("tr[data-id=" + id + "] .comment-box");
        $box.html("")
            .append($("").text(gettext("Comment:")))
            .append(" ")
            .append($("").addClass("comment").text(text))
            .append(" ")
            .append($("").addClass("comment-modify btn btn-default btn-xs")
                        .append(""));
    },

    comment_start_edit: function (e) {
        var $box = $(e.target).closest("div");
        var id = $box.closest("tr").attr("data-id");
        var $inp = $("<textarea>").addClass("form-control");
        var orig_text = $box.find(".comment").text();
        $inp.val(orig_text);

        var $btngrp = $("
");
        $btngrp.addClass("btn-group");
        var $btn1 = $("<button>");
        $btn1.attr("type", "button").addClass("btn btn-default");
        $btn1.append("");
        $btngrp.append($btn1);
        var $btn2 = $("<button>");
        $btn2.attr("type", "button").addClass("btn btn-default");
        $btn2.append("");
        $btngrp.append($btn2);
        $box.html("").append($inp).append($btngrp);
        $btn1.click(function () {
            var text = $box.find("textarea").val();
            $box.find("input, textarea, button").prop("disabled", true);
            bankimport_transactionlist._action(id, "comment:" + text, function () {
                bankimport_transactionlist.comment_reset_to_text(id, text);
            });
        });
        $btn2.click(function () {
            bankimport_transactionlist.comment_reset_to_text(id, orig_text);
        });

        e.preventDefault();
    },

    typeahead_source: function () {
        return new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            remote: {
                url: $(".transaction-list").attr("data-url"),
                prepare: function (query, settings) {
                    settings.url = settings.url + '?query=' + encodeURIComponent(query);
                    return settings;
                },
                transform: function (object) {
                    var results = object.results;
                    var suggs = [];
                    var reslen = results.length;
                    for (var i = 0; i < reslen; i++) {
                        suggs.push(results[i]);
                    }
                    return suggs;
                }
            }
        });
    },

    init: function () {
        if ($(".transaction-list").length) {
            $(".transaction-list button").click(bankimport_transactionlist._btn_click);

            $(".transaction-list").on("click", ".comment-modify", bankimport_transactionlist.comment_start_edit);

            $(".transaction-list .form-control").typeahead(null, {
                minLength: 2,
                name: 'order-dataset',
                source: bankimport_transactionlist.typeahead_source(),
                display: function (obj) {
                    return obj.code;
                },
                templates: {
                    suggestion: function (obj) {
                        return '
' + obj.code + ' (' + obj.total + ', ' + obj.status + ')
';
                    }
                }
            }).keypress(function (e) {
                if (e.keyCode === 13) {
                    $(this).parent().parent().find("button[value=assign]").click();
                }
            });
        }

        if ($("[data-job-waiting]").length) {
            window.setTimeout(bankimport_transactionlist.check_state, 750);
        }
    },

    check_state: function () {
        $.getJSON($("[data-job-waiting-url]").attr("data-job-waiting-url"), function (data) {
            if (data.state == 'running' || data.state == 'pending') {
                window.setTimeout(bankimport_transactionlist.check_state, 750);
            } else {
                location.reload();
            }
        });
    }
};

$(function () {
    bankimport_transactionlist.init();
});


text:
import axios from 'axios';
import {all, fork, takeLatest} from 'redux-saga/effects';

import {getSagaRequest} from '@alluxio/common-ui/src/utilities';
import {fetchError, fetchSuccess} from './actions';
import {InitActionTypes} from './types';

const API_ENDPOINT = `${process.env.REACT_APP_API_ROOT}/webui_init`;

const watchRequest = function* () {
  yield takeLatest(InitActionTypes.FETCH_REQUEST, getSagaRequest(axios.get, API_ENDPOINT, fetchSuccess, fetchError));
};

export const initSaga = function* () {
  yield all([fork(watchRequest)]);
};


text:
/**
 * Gets the style information for input fields.
 */
export function getInputStyle() {
    return {
        borderRadius: 0,
        borderStyle: "solid",
        borderWidth: 1,
        display: "block",
        lineHeight: "normal",
        margin: "0 auto",
        overflowX: "hidden",
        overflowY: "hidden",
        paddingBottom: 6,
        paddingLeft: 12,
        paddingRight: 12,
        paddingTop: 6,
        zIndex: 0,
        backgroundColor: "white",
        color: "black",
        borderColor: "#d0d0d0",
        float: "left",
        fontFamily: "Calibri",
        fontSize: 16,
    };
}


text:
'use strict';

/**
* Create a zero-filled ndarray having the same shape and data type as a provided ndarray.
*
* @module @stdlib/ndarray/zeros-like
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
* var zerosLike = require( '@stdlib/ndarray/zeros-like' );
*
* var x = zeros( [ 2, 2 ] );
* // returns <ndarray>
*
* var y = zerosLike( x );
* // returns <ndarray>
*
* var sh = y.shape;
* // returns [ 2, 2 ]
*
* var dt = y.dtype;
* // returns 'float64'
*/

// MODULES //

var main = require( './main.js' );

// EXPORTS //

module.exports = main;


text:
[ -d "./bin" ] || ( tar fzx default.tgz )
source ./bin/helpers.sh
baseDir=`pwd`

# madgraph source
MG=MG5_aMC_v2.3.3.tar.gz
MG_SOURCE=https://cms-project-generators.web.cern.ch/cms-project-generators/

# command line arguments and corresponding environment
TASK="$1"
source ./$VERSION/${TASK}.env

if ! [ -e "./work" ]
then
  mkdir -p ./work
else
  rm -rf ./work/*
fi
cd ./work
workDir=`pwd`

wget --no-check-certificate ${MG_SOURCE}/${MG}
tar xzf ${MG}
rm $MG
export MG_BASE=`echo MG5_*`
cd $MG_BASE

# patch -l -p0 -i $PRODHOME/patches/mgfixes.patch
# patch -l -p0 -i $PRODHOME/patches/models.patch

echo "set auto_update 0"                 > config.$$
echo "set automatic_html_opening False" >> config.$$
echo "set lhapdf $LHAPDFCONFIG"         >> config.$$
echo "set run_mode 0"                   >> config.$$
echo "save options"                     >> config.$$
cat config.$$
./bin/mg5_aMC config.$$

# now we need to get all relevant models
cd models/
sed 's:#.*$::g' $baseDir/${VERSION}/${TASK}/template_extramodels.dat | while read model
do
  echo Model: $model
  if [ -e "$baseDir/tgz/$model" ]
  then
    cp $baseDir/tgz/$model ./
  else
    ##wget --no-check-certificate $MG_SOURCE/$model
    echo " MODEL NOT FOUND"
  fi
  tar xzf $model
  dir=`tar fzt $model | head -1`
  rm $model

##  # fine tuning of the parameters
##  if [ "$model" == "DMAxial_monow012j.tgz" ]
##  then
##     # adjust model defaults -- irrelevant numbers for now
##    cat $dir/parameters.py | sed -e 's@XX-MED-XX@10@' -e 's@XX-DM-XX@1@' > tmp.py
##    mv tmp.py $dir/parameters.py
##  fi
##
done
cd -

# finally we build the generator
cd $workDir
./$MG_BASE/bin/mg5_aMC $baseDir/${VERSION}/${TASK}/template_proc_card.dat

# copy our run card into the default location
cp $baseDir/${VERSION}/${TASK}/template_run_card.dat madgraph-generator/Cards/run_card.dat

# change the name to our task
mv madgraph-generator madgraph-${TASK}

# tar it, and move the generator ready to be shipped for production
tar fzc madgraph-${TASK}.tgz madgraph-${TASK} $MG_BASE
mv madgraph-${TASK}.tgz $baseDir/generators/

# do some cleanup
cd $baseDir
rm -rf ./work/*

exit 0


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

namespace JellyDb.Core.Sql.Dml
{
    public class SubtractionOperator : ArithmeticOperator
    {
        public override Term Process(Term leftOperand, Term rightOperand)
        {
            throw new NotImplementedException();
        }
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.communication.chat.models;

import com.azure.core.exception.AzureException;

/**
 * Exception when a participant cannot be added to a chat thread
 */
public final class InvalidParticipantException extends AzureException {

    private final transient ChatError chatError;

    /**
     * Constructs a new InvalidParticipantException
     *
     * @param chatError the ChatError underlying this exception
     */
    public InvalidParticipantException(ChatError chatError) {
        super(chatError.getMessage());
        this.chatError = chatError;
    }

    /**
     * Gets the underlying ChatError returned from the server
     *
     * @return the CHatError
     */
    public ChatError getChatError() {
        return chatError;
    }
}


text:
import React from 'react'
import {
  Container,
  Group,
  TabBar,
  Icon,
  Badge,
  amStyles,
} from 'amazeui-touch'
import {Link} from 'react-router'

class App extends React.Component{
    propsType ={
      children:React.PropTypes.node
    }
    render(){
        let {
            location,
            params,
            children,
            ...props
        } = this.props;
        let transition = children.props.transition || 'sfr'
        return (
            <Container direction="column">
                 <Container
                    transition={transition}
                 >
                 {children}
                </Container>
                <TabBar
                >
                    <TabBar.Item
                        component={Link}
                        eventKey = 'home'
                        active = {location.pathname === '/'}
                        icon = 'home'
                        title = '首页'
                        to='/'
                    />
                    <TabBar.Item
                        component={Link}
                        active={location.pathname === '/class'}
                        eventKey="class"
                        icon="list"
                        title="课程"
                        to='/class'
                    />
                    <TabBar.Item
                        active={location.pathname === '/search'}
                        eventKey="search"
                        icon="search"
                        title="发现"
                    />
                    <TabBar.Item
                        component={Link}
                        active={location.pathname === '/me'}
                        eventKey="person"
                        icon="person"
                        title="我"
                        to='/me'
                    />
                </TabBar>
             </Container>
        )
    }
}

export default App


text:
.nclass{color:#000}
/*# sourceMappingURL=main.css.map*/


text:
class FileFormatUtil
{
public:
    enum Format : int
    {
        None = -1,
        csv,
    };

public:
    FileFormatUtil() = delete;

    static bool ValidateFileFormat(const std::string& filepath, Format format);

private:
    static bool GetExtension(Format format, std::string& ext);
};


text:
import jsonFetch from '../json-fetch';
import t from '../../i18n/locale-keys';

const WINHELLO_SERVICE_URL = 'https://127.0.0.1:8440/api/v1/wh';
const WINHELLO_ENROLL_SUFFIX = '/enroll';
const WINHELLO_LOGON_SUFFIX = '/logon';

function callWinHelloService(urlSuffix, data) {
    return jsonFetch({
        camelize: true,
        data,
        decamelize: true,
        method: 'POST',
        url: WINHELLO_SERVICE_URL + urlSuffix
    }).catch((failedResponseData) => {
        if (failedResponseData.status) {
            return Promise.reject(t.windowsHelloServiceUnavailable());
        }

        return Promise.reject(t.windowsHelloServiceError());
    }).then((data) => {
        if (data.result === 'failed') {
            return Promise.reject(t.verificationFailed());
        }

        return data;
    });
}

export const winHelloEnroll = (data) => callWinHelloService(WINHELLO_ENROLL_SUFFIX, data);
export const winHelloLogon = (data) => callWinHelloService(WINHELLO_LOGON_SUFFIX, data);


text:
import AssetEditor from './AssetEditor.js'
import AssetUploadButton from './AssetUploadButton.js'
import NewAssetModal from './NewAssetModal.js'
import AssetProperties from './AssetProperties.js'
import Studio from 'jsreport-studio'

Studio.addEntitySet({
  name: 'assets',
  faIcon: 'fa-file',
  visibleName: 'asset',
  onNew: (options) => Studio.openModal(NewAssetModal, options),
  referenceAttributes: ['isSharedHelper'],
  entityTreePosition: 700
})

Studio.addEditorComponent('assets', AssetEditor)

Studio.addToolbarComponent(AssetUploadButton)
Studio.addPropertiesComponent(AssetProperties.title, AssetProperties, (entity) => entity.__entitySet === 'assets')

Studio.entityTreeIconResolvers.push((entity) => {
  if (entity.__entitySet !== 'assets') {
    return
  }

  const parts = entity.name.split('.')

  if (parts.length === 1) {
    return
  }

  const extension = parts[parts.length - 1]

  switch (extension) {
    case 'html': return 'fa-html5'
    case 'jpg':
    case 'jpeg':
    case 'png':
    case 'gif':
    case 'svg': return 'fa-camera'
    case 'js': return entity.isSharedHelper ? 'fa-cogs' : 'fa-cog'
    case 'css': return 'fa-css3'
    default: return 'fa-file-o '
  }
})

Studio.entityTreeDropResolvers.push({
  type: Studio.dragAndDropNativeTypes.FILE,
  async handler ({
    draggedItem,
    dragOverContext,
    dropComplete
  }) {
    const files = draggedItem.files

    let targetInfo = {
      shortid: null
    }

    if (dragOverContext && dragOverContext.containerTargetEntity) {
      targetInfo.shortid = dragOverContext.containerTargetEntity.shortid
    }

    const errors = []

    for (const file of files) {
      if (/\.zip$/.test(file.name)) {
        continue
      }

      try {
        const assetFile = await new Promise((resolve, reject) => {
          const fileName = file.name
          const reader = new FileReader()

          reader.onloadend = async () => {
            resolve({
              name: fileName,
              content: reader.result.substring(reader.result.indexOf('base64,') + 'base64,'.length)
            })
          }

          reader.onerror = function () {
            const errMsg = `There was an error reading the file "${fileName}"`
            reject(errMsg)
          }

          reader.readAsDataURL(file)
        })

        if (targetInfo.shortid != null) {
          assetFile.folder = {
            shortid: targetInfo.shortid
          }
        }

        let response = await Studio.api.post('/odata/assets', {
          data: assetFile
        }, true)

        response.__entitySet = 'assets'

        Studio.addExistingEntity(response)
        Studio.openTab(Object.assign({}, response))

        // delay the collapsing a bit to avoid showing ugly transition of collapsed -> uncollapsed
        setTimeout(() => {
          Studio.collapseEntity({ shortid: response.shortid }, false, { parents: true, self: false })
        }, 200)
      } catch (e) {
        errors.push(e)
      }
    }

    dropComplete()

    if (errors.length > 0) {
      const assetsUploadedError = new Error(`Could not complete asset upload${files.length > 1 ? ' of some files' : ''}.\n\n${errors.map((e) => e.message).join('\n')}`)
      Studio.apiFailed(assetsUploadedError)
    }
  }
})


text:
package dk.lessismore.nojpa.db.statements;

import java.sql.*;

/**
 * This interface defines the functionality of an select sql statement.
 *
 * @author LESS-IS-MORE
 * @version 1.0 25-7-02
 */
public interface PreparedSQLStatement {

    public void addLeafExpression(LeafExpression expression);

    public void makeStatementReadyToExcute(PreparedStatement statement) throws SQLException;

}