text:
package com.android.email.activity;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.content.Context;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.TextView;

/**
 * Class to hide/show a banner.
 */
public class BannerController {
    private static final int ANIMATION_DURATION = 100;
    private static final TimeInterpolator INTERPOLATOR = new DecelerateInterpolator(1.5f);

    private final TextView mBannerView;
    private final int mBannerHeight;

    private boolean mShown;

    /** Hold last animator to cancel. */
    private Animator mLastAnimator;

    public BannerController(Context context, TextView bannerView, int bannerHeight) {
        mBannerView = bannerView;
        mBannerHeight = bannerHeight;

        setBannerYAnim(-mBannerHeight); // hide by default.
    }

    /**
     * @return the current y position of the banner.
     */
    private int getBannerY() {
        return ((ViewGroup.MarginLayoutParams) mBannerView.getLayoutParams()).topMargin;
    }

    private static final String PROP_SET_BANNER_Y = "bannerYAnim";

    /**
     * Set the Y position of the banner.  public, but should only be used by animators.
     */
    public void setBannerYAnim(int y) {
        ((ViewGroup.MarginLayoutParams) mBannerView.getLayoutParams()).topMargin = y;
        mBannerView.requestLayout();
    }

    /**
     * Show a banner with a message.
     *
     * @return false if a banner is already shown, in which case the message won't be updated.
     */
    public boolean show(String message) {
        if (mShown) {
            return false; // If already shown, don't change the message, to avoid flicker.
        }
        mShown = true;
        mBannerView.setText(message);
        slideBanner(0);
        return true;
    }

    /**
     * Dismiss a banner.
     */
    public void dismiss() {
        if (!mShown) {
            return; // Always hidden, or hiding.
        }
        mShown = false;
        slideBanner(-mBannerHeight); // Slide up to hide.
    }

    private void slideBanner(int toY) {
        if (mLastAnimator != null) {
            mLastAnimator.cancel();
        }

        final PropertyValuesHolder[] values = {
                PropertyValuesHolder.ofInt(PROP_SET_BANNER_Y, getBannerY(), toY) };
        final ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(
                this, values).setDuration(ANIMATION_DURATION);
        animator.setInterpolator(INTERPOLATOR);
        mLastAnimator = animator;
        animator.start();
    }
}


text:
                    <fa [name]="'twitter'" [border]=false size=2></fa>
                    <fa [name]="'instagram'" [border]=false size=2></fa>
                    <fa [name]="'facebook'" [border]=false size=2></fa>

© Bemoove 2017

                hello@bemoove.fr |
                Blog |
                Devenir partenaire
                Conditions générales
                Mentions légales

redpajama_set_name: RedPajamaGithub


text:
./gradlew run --args="-nogui -noconfig -dir:${test_dir} -exec:vme-tm.circuit.js" >${log_file}

# Post-processing
result_file=${test_dir}/vme-tm.circuit.txt
function report_file_header() {
    file_name=$1
    header_size=$2
    clean_option=${3:keep} # [keep], remove
    eol_option=${4:preserve} # [preserve], unix
    if [[ "$eol_option" == "unix" ]]; then
        sed -i.bak 's/\\r$//g' ${file_name}
        rm -f ${file_name}.bak
    fi
    if [[ -e $file_name ]]; then
        header=$(head -c $header_size $file_name)
    fi
    echo "$(basename $file_name):" >> ${result_file}
    echo "${header}" >> ${result_file}
    echo >> ${result_file}
    if [[ "$clean_option" == "remove" ]]; then
        rm -f $file_name
    fi
}

rm -f ${result_file}
report_file_header ${test_dir}/vme-tm.circuit.v 144 keep unix
report_file_header ${test_dir}/vme-tm.circuit.svg 155 remove unix
report_file_header ${test_dir}/vme-tm.circuit.png 8 remove
report_file_header ${test_dir}/vme-tm.circuit.pdf 9 remove
report_file_header ${test_dir}/vme-tm.circuit.eps 24 remove
report_file_header ${test_dir}/vme-tm.circuit.ps 14 remove


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "device/usb/usb_device_handle_impl.h"

#include <algorithm>
#include <vector>

#include "base/bind.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "base/synchronization/lock.h"
#include "base/thread_task_runner_handle.h"
#include "components/device_event_log/device_event_log.h"
#include "device/usb/usb_context.h"
#include "device/usb/usb_descriptors.h"
#include "device/usb/usb_device_impl.h"
#include "device/usb/usb_error.h"
#include "device/usb/usb_service.h"
#include "third_party/libusb/src/libusb/libusb.h"

namespace device {

typedef libusb_device* PlatformUsbDevice;

void HandleTransferCompletion(PlatformUsbTransferHandle transfer);

namespace {

static uint8 ConvertTransferDirection(const UsbEndpointDirection direction) {
  switch (direction) {
    case USB_DIRECTION_INBOUND:
      return LIBUSB_ENDPOINT_IN;
    case USB_DIRECTION_OUTBOUND:
      return LIBUSB_ENDPOINT_OUT;
    default:
      NOTREACHED();
      return LIBUSB_ENDPOINT_IN;
  }
}

static uint8 CreateRequestType(
    const UsbEndpointDirection direction,
    const UsbDeviceHandle::TransferRequestType request_type,
    const UsbDeviceHandle::TransferRecipient recipient) {
  uint8 result = ConvertTransferDirection(direction);

  switch (request_type) {
    case UsbDeviceHandle::STANDARD:
      result |= LIBUSB_REQUEST_TYPE_STANDARD;
      break;
    case UsbDeviceHandle::CLASS:
      result |= LIBUSB_REQUEST_TYPE_CLASS;
      break;
    case UsbDeviceHandle::VENDOR:
      result |= LIBUSB_REQUEST_TYPE_VENDOR;
      break;
    case UsbDeviceHandle::RESERVED:
      result |= LIBUSB_REQUEST_TYPE_RESERVED;
      break;
  }

  switch (recipient) {
    case UsbDeviceHandle::DEVICE:
      result |= LIBUSB_RECIPIENT_DEVICE;
      break;
    case UsbDeviceHandle::INTERFACE:
      result |= LIBUSB_RECIPIENT_INTERFACE;
      break;
    case UsbDeviceHandle::ENDPOINT:
      result |= LIBUSB_RECIPIENT_ENDPOINT;
      break;
    case UsbDeviceHandle::OTHER:
      result |= LIBUSB_RECIPIENT_OTHER;
      break;
  }

  return result;
}

static UsbTransferStatus ConvertTransferStatus(
    const libusb_transfer_status status) {
  switch (status) {
    case LIBUSB_TRANSFER_COMPLETED:
      return USB_TRANSFER_COMPLETED;
    case LIBUSB_TRANSFER_ERROR:
      return USB_TRANSFER_ERROR;
    case LIBUSB_TRANSFER_TIMED_OUT:
      return USB_TRANSFER_TIMEOUT;
    case LIBUSB_TRANSFER_STALL:
      return USB_TRANSFER_STALLED;
    case LIBUSB_TRANSFER_NO_DEVICE:
      return USB_TRANSFER_DISCONNECT;
    case LIBUSB_TRANSFER_OVERFLOW:
      return USB_TRANSFER_OVERFLOW;
    case LIBUSB_TRANSFER_CANCELLED:
      return USB_TRANSFER_CANCELLED;
    default:
      NOTREACHED();
      return USB_TRANSFER_ERROR;
  }
}

}  // namespace

class UsbDeviceHandleImpl::InterfaceClaimer
    : public base::RefCountedThreadSafe<UsbDeviceHandleImpl::InterfaceClaimer> {
 public:
  InterfaceClaimer(const scoped_refptr<UsbDeviceHandleImpl> handle,
                   const int interface_number);

  bool Claim() const;

  int alternate_setting() const { return alternate_setting_; }
  void set_alternate_setting(const int alternate_setting) {
    alternate_setting_ = alternate_setting;
  }

 private:
  friend class UsbDevice;
  friend class base::RefCountedThreadSafe<InterfaceClaimer>;
  ~InterfaceClaimer();

  const scoped_refptr<UsbDeviceHandleImpl> handle_;
  const int interface_number_;
  int alternate_setting_;

  DISALLOW_COPY_AND_ASSIGN(InterfaceClaimer);
};

UsbDeviceHandleImpl::InterfaceClaimer::InterfaceClaimer(
    const scoped_refptr<UsbDeviceHandleImpl> handle,
    const int interface_number)
    : handle_(handle),
      interface_number_(interface_number),
      alternate_setting_(0) {
}

UsbDeviceHandleImpl::InterfaceClaimer::~InterfaceClaimer() {
  libusb_release_interface(handle_->handle(), interface_number_);
}

bool UsbDeviceHandleImpl::InterfaceClaimer::Claim() const {
  const int rv = libusb_claim_interface(handle_->handle(), interface_number_);
  if (rv != LIBUSB_SUCCESS) {
    USB_LOG(EVENT) << "Failed to claim interface " << interface_number_ << ": "
                   << ConvertPlatformUsbErrorToString(rv);
  }
  return rv == LIBUSB_SUCCESS;
}

// This inner class owns the underlying libusb_transfer and may outlast
// the UsbDeviceHandle that created it.
class UsbDeviceHandleImpl::Transfer {
 public:
  static scoped_ptr<Transfer> CreateControlTransfer(
      uint8 type,
      uint8 request,
      uint16 value,
      uint16 index,
      uint16 length,
      scoped_refptr<net::IOBuffer> buffer,
      unsigned int timeout,
      const UsbTransferCallback& callback);
  static scoped_ptr<Transfer> CreateBulkTransfer(
      uint8 endpoint,
      scoped_refptr<net::IOBuffer> buffer,
      int length,
      unsigned int timeout,
      const UsbTransferCallback& callback);
  static scoped_ptr<Transfer> CreateInterruptTransfer(
      uint8 endpoint,
      scoped_refptr<net::IOBuffer> buffer,
      int length,
      unsigned int timeout,
      const UsbTransferCallback& callback);
  static scoped_ptr<Transfer> CreateIsochronousTransfer(
      uint8 endpoint,
      scoped_refptr<net::IOBuffer> buffer,
      size_t length,
      unsigned int packets,
      unsigned int packet_length,
      unsigned int timeout,
      const UsbTransferCallback& callback);

  ~Transfer();

  bool Submit(base::WeakPtr<UsbDeviceHandleImpl> device_handle);
  void Cancel();
  void ProcessCompletion();
  void Complete(UsbTransferStatus status, size_t bytes_transferred);

  const UsbDeviceHandleImpl::InterfaceClaimer* claimed_interface() const {
    return claimed_interface_.get();
  }

 private:
  Transfer(UsbTransferType transfer_type,
           scoped_refptr<net::IOBuffer> buffer,
           size_t length,
           const UsbTransferCallback& callback);

  static void LIBUSB_CALL PlatformCallback(PlatformUsbTransferHandle handle);

  UsbTransferType transfer_type_;
  base::WeakPtr<UsbDeviceHandleImpl> device_handle_;
  PlatformUsbTransferHandle platform_transfer_;
  scoped_refptr<net::IOBuffer> buffer_;
  scoped_refptr<UsbDeviceHandleImpl::InterfaceClaimer> claimed_interface_;
  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
  size_t length_;
  bool cancelled_;
  UsbTransferCallback callback_;
  scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner_;
};

// static
scoped_ptr<UsbDeviceHandleImpl::Transfer>
UsbDeviceHandleImpl::Transfer::CreateControlTransfer(
    uint8 type,
    uint8 request,
    uint16 value,
    uint16 index,
    uint16 length,
    scoped_refptr<net::IOBuffer> buffer,
    unsigned int timeout,
    const UsbTransferCallback& callback) {
  scoped_ptr<Transfer> transfer(new Transfer(USB_TRANSFER_CONTROL, buffer,
                                             length + LIBUSB_CONTROL_SETUP_SIZE,
                                             callback));

  transfer->platform_transfer_ = libusb_alloc_transfer(0);
  if (!transfer->platform_transfer_) {
    USB_LOG(ERROR) << "Failed to allocate control transfer.";
    return nullptr;
  }

  libusb_fill_control_setup(reinterpret_cast<uint8*>(buffer->data()), type,
                            request, value, index, length);
  libusb_fill_control_transfer(transfer->platform_transfer_,
                               nullptr, /* filled in by Submit() */
                               reinterpret_cast<uint8*>(buffer->data()),
                               &UsbDeviceHandleImpl::Transfer::PlatformCallback,
                               transfer.get(), timeout);

  return transfer.Pass();
}

// static
scoped_ptr<UsbDeviceHandleImpl::Transfer>
UsbDeviceHandleImpl::Transfer::CreateBulkTransfer(
    uint8 endpoint,
    scoped_refptr<net::IOBuffer> buffer,
    int length,
    unsigned int timeout,
    const UsbTransferCallback& callback) {
  scoped_ptr<Transfer> transfer(
      new Transfer(USB_TRANSFER_BULK, buffer, length, callback));

  transfer->platform_transfer_ = libusb_alloc_transfer(0);
  if (!transfer->platform_transfer_) {
    USB_LOG(ERROR) << "Failed to allocate bulk transfer.";
    return nullptr;
  }

  libusb_fill_bulk_transfer(transfer->platform_transfer_,
                            nullptr, /* filled in by Submit() */
                            endpoint, reinterpret_cast<uint8*>(buffer->data()),
                            static_cast<int>(length),
                            &UsbDeviceHandleImpl::Transfer::PlatformCallback,
                            transfer.get(), timeout);

  return transfer.Pass();
}

// static
scoped_ptr<UsbDeviceHandleImpl::Transfer>
UsbDeviceHandleImpl::Transfer::CreateInterruptTransfer(
    uint8 endpoint,
    scoped_refptr<net::IOBuffer> buffer,
    int length,
    unsigned int timeout,
    const UsbTransferCallback& callback) {
  scoped_ptr<Transfer> transfer(
      new Transfer(USB_TRANSFER_INTERRUPT, buffer, length, callback));

  transfer->platform_transfer_ = libusb_alloc_transfer(0);
  if (!transfer->platform_transfer_) {
    USB_LOG(ERROR) << "Failed to allocate interrupt transfer.";
    return nullptr;
  }

  libusb_fill_interrupt_transfer(
      transfer->platform_transfer_, nullptr, /* filled in by Submit() */
      endpoint, reinterpret_cast<uint8*>(buffer->data()),
      static_cast<int>(length),
      &UsbDeviceHandleImpl::Transfer::PlatformCallback, transfer.get(),
      timeout);

  return transfer.Pass();
}

// static
scoped_ptr<UsbDeviceHandleImpl::Transfer>
UsbDeviceHandleImpl::Transfer::CreateIsochronousTransfer(
    uint8 endpoint,
    scoped_refptr<net::IOBuffer> buffer,
    size_t length,
    unsigned int packets,
    unsigned int packet_length,
    unsigned int timeout,
    const UsbTransferCallback& callback) {
  DCHECK(packets <= length && (packets * packet_length) <= length)
      << "transfer length is too small";

  scoped_ptr<Transfer> transfer(
      new Transfer(USB_TRANSFER_ISOCHRONOUS, buffer, length, callback));

  transfer->platform_transfer_ = libusb_alloc_transfer(packets);
  if (!transfer->platform_transfer_) {
    USB_LOG(ERROR) << "Failed to allocate isochronous transfer.";
    return nullptr;
  }

  libusb_fill_iso_transfer(
      transfer->platform_transfer_, nullptr, /* filled in by Submit() */
      endpoint, reinterpret_cast<uint8*>(buffer->data()),
      static_cast<int>(length), packets, &Transfer::PlatformCallback,
      transfer.get(), timeout);
  libusb_set_iso_packet_lengths(transfer->platform_transfer_, packet_length);

  return transfer.Pass();
}

UsbDeviceHandleImpl::Transfer::Transfer(UsbTransferType transfer_type,
                                        scoped_refptr<net::IOBuffer> buffer,
                                        size_t length,
                                        const UsbTransferCallback& callback)
    : transfer_type_(transfer_type),
      buffer_(buffer),
      length_(length),
      cancelled_(false),
      callback_(callback) {
  // Remember the thread from which this transfer was created so that |callback|
  // can be dispatched there.
  callback_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}

UsbDeviceHandleImpl::Transfer::~Transfer() {
  if (platform_transfer_) {
    libusb_free_transfer(platform_transfer_);
  }
}

bool UsbDeviceHandleImpl::Transfer::Submit(
    base::WeakPtr<UsbDeviceHandleImpl> device_handle) {
  device_handle_ = device_handle;
  // Remember the thread from which this transfer was submitted so that it can
  // be marked complete there.
  task_runner_ = base::ThreadTaskRunnerHandle::Get();
  // GetClaimedInterfaceForEndpoint may return nullptr. libusb_submit_transfer
  // will fail if it requires an interface we didn't claim.
  claimed_interface_ = device_handle->GetClaimedInterfaceForEndpoint(
      platform_transfer_->endpoint);
  platform_transfer_->dev_handle = device_handle_->handle_;

  const int rv = libusb_submit_transfer(platform_transfer_);
  if (rv == LIBUSB_SUCCESS) {
    return true;
  } else {
    USB_LOG(EVENT) << "Failed to submit transfer: "
                   << ConvertPlatformUsbErrorToString(rv);
    Complete(USB_TRANSFER_ERROR, 0);
    return false;
  }
}

void UsbDeviceHandleImpl::Transfer::Cancel() {
  if (!cancelled_) {
    libusb_cancel_transfer(platform_transfer_);
    claimed_interface_ = nullptr;
  }
  cancelled_ = true;
}

void UsbDeviceHandleImpl::Transfer::ProcessCompletion() {
  DCHECK_GE(platform_transfer_->actual_length, 0)
      << "Negative actual length received";
  size_t actual_length =
      static_cast<size_t>(std::max(platform_transfer_->actual_length, 0));

  DCHECK(length_ >= actual_length)
      << "data too big for our buffer (libusb failure?)";

  switch (transfer_type_) {
    case USB_TRANSFER_CONTROL:
      // If the transfer is a control transfer we do not expose the control
      // setup header to the caller. This logic strips off the header if
      // present before invoking the callback provided with the transfer.
      if (actual_length > 0) {
        CHECK(length_ >= LIBUSB_CONTROL_SETUP_SIZE)
            << "buffer was not correctly set: too small for the control header";

        if (length_ >= (LIBUSB_CONTROL_SETUP_SIZE + actual_length)) {
          // If the payload is zero bytes long, pad out the allocated buffer
          // size to one byte so that an IOBuffer of that size can be allocated.
          scoped_refptr<net::IOBuffer> resized_buffer =
              new net::IOBuffer(static_cast<int>(
                  std::max(actual_length, static_cast<size_t>(1))));
          memcpy(resized_buffer->data(),
                 buffer_->data() + LIBUSB_CONTROL_SETUP_SIZE, actual_length);
          buffer_ = resized_buffer;
        }
      }
      break;

    case USB_TRANSFER_ISOCHRONOUS:
      // Isochronous replies might carry data in the different isoc packets even
      // if the transfer actual_data value is zero. Furthermore, not all of the
      // received packets might contain data, so we need to calculate how many
      // data bytes we are effectively providing and pack the results.
      if (actual_length == 0) {
        size_t packet_buffer_start = 0;
        for (int i = 0; i < platform_transfer_->num_iso_packets; ++i) {
          PlatformUsbIsoPacketDescriptor packet =
              &platform_transfer_->iso_packet_desc[i];
          if (packet->actual_length > 0) {
            // We don't need to copy as long as all packets until now provide
            // all the data the packet can hold.
            if (actual_length < packet_buffer_start) {
              CHECK(packet_buffer_start + packet->actual_length <= length_);
              memmove(buffer_->data() + actual_length,
                      buffer_->data() + packet_buffer_start,
                      packet->actual_length);
            }
            actual_length += packet->actual_length;
          }

          packet_buffer_start += packet->length;
        }
      }
      break;

    case USB_TRANSFER_BULK:
    case USB_TRANSFER_INTERRUPT:
      break;

    default:
      NOTREACHED() << "Invalid usb transfer type";
      break;
  }

  Complete(ConvertTransferStatus(platform_transfer_->status), actual_length);
}

void UsbDeviceHandleImpl::Transfer::Complete(UsbTransferStatus status,
                                             size_t bytes_transferred) {
  if (callback_task_runner_->RunsTasksOnCurrentThread()) {
    callback_.Run(status, buffer_, bytes_transferred);
  } else {
    callback_task_runner_->PostTask(
        FROM_HERE, base::Bind(callback_, status, buffer_, bytes_transferred));
  }
}

/* static */
void LIBUSB_CALL UsbDeviceHandleImpl::Transfer::PlatformCallback(
    PlatformUsbTransferHandle platform_transfer) {
  scoped_ptr<Transfer> transfer(
      reinterpret_cast<Transfer*>(platform_transfer->user_data));
  DCHECK(transfer->platform_transfer_ == platform_transfer);

  // Because device_handle_ is a weak pointer it is guaranteed that the callback
  // will be discarded if the handle has been freed.
  Transfer* tmp_transfer = transfer.get();  // base::Passed invalidates transfer
  tmp_transfer->task_runner_->PostTask(
      FROM_HERE, base::Bind(&UsbDeviceHandleImpl::CompleteTransfer,
                            tmp_transfer->device_handle_,
                            base::Passed(&transfer)));
}

UsbDeviceHandleImpl::UsbDeviceHandleImpl(scoped_refptr<UsbContext> context,
                                         scoped_refptr<UsbDeviceImpl> device,
                                         PlatformUsbDeviceHandle handle)
    : device_(device),
      handle_(handle),
      context_(context),
      task_runner_(base::ThreadTaskRunnerHandle::Get()),
      weak_factory_(this) {
  DCHECK(handle) << "Cannot create device with NULL handle.";
}

UsbDeviceHandleImpl::~UsbDeviceHandleImpl() {
  DCHECK(thread_checker_.CalledOnValidThread());

  libusb_close(handle_);
  handle_ = NULL;
}

scoped_refptr<UsbDevice> UsbDeviceHandleImpl::GetDevice() const {
  return device_;
}

void UsbDeviceHandleImpl::Close() {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (device_)
    device_->Close(this);
}

bool UsbDeviceHandleImpl::SetConfiguration(int configuration_value) {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (!device_) {
    return false;
  }

  for (Transfer* transfer : transfers_) {
    transfer->Cancel();
  }
  claimed_interfaces_.clear();

  int rv = libusb_set_configuration(handle_, configuration_value);
  if (rv == LIBUSB_SUCCESS) {
    device_->RefreshConfiguration();
    RefreshEndpointMap();
  } else {
    USB_LOG(EVENT) << "Failed to set configuration " << configuration_value
                   << ": " << ConvertPlatformUsbErrorToString(rv);
  }
  return rv == LIBUSB_SUCCESS;
}

bool UsbDeviceHandleImpl::ClaimInterface(const int interface_number) {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (!device_)
    return false;
  if (ContainsKey(claimed_interfaces_, interface_number))
    return true;

  scoped_refptr<InterfaceClaimer> claimer =
      new InterfaceClaimer(this, interface_number);

  if (claimer->Claim()) {
    claimed_interfaces_[interface_number] = claimer;
    RefreshEndpointMap();
    return true;
  }
  return false;
}

bool UsbDeviceHandleImpl::ReleaseInterface(const int interface_number) {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (!device_)
    return false;
  if (!ContainsKey(claimed_interfaces_, interface_number))
    return false;

  // Cancel all the transfers on that interface.
  InterfaceClaimer* interface_claimer =
      claimed_interfaces_[interface_number].get();
  for (Transfer* transfer : transfers_) {
    if (transfer->claimed_interface() == interface_claimer) {
      transfer->Cancel();
    }
  }
  claimed_interfaces_.erase(interface_number);

  RefreshEndpointMap();
  return true;
}

bool UsbDeviceHandleImpl::SetInterfaceAlternateSetting(
    const int interface_number,
    const int alternate_setting) {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (!device_)
    return false;
  if (!ContainsKey(claimed_interfaces_, interface_number))
    return false;
  const int rv = libusb_set_interface_alt_setting(
      handle_, interface_number, alternate_setting);
  if (rv == LIBUSB_SUCCESS) {
    claimed_interfaces_[interface_number]->set_alternate_setting(
        alternate_setting);
    RefreshEndpointMap();
  } else {
    USB_LOG(EVENT) << "Failed to set interface " << interface_number
                   << " to alternate setting " << alternate_setting << ": "
                   << ConvertPlatformUsbErrorToString(rv);
  }
  return rv == LIBUSB_SUCCESS;
}

bool UsbDeviceHandleImpl::ResetDevice() {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (!device_)
    return false;

  const int rv = libusb_reset_device(handle_);
  if (rv != LIBUSB_SUCCESS) {
    USB_LOG(EVENT) << "Failed to reset device: "
                   << ConvertPlatformUsbErrorToString(rv);
  }
  return rv == LIBUSB_SUCCESS;
}

bool UsbDeviceHandleImpl::GetStringDescriptor(uint8 string_id,
                                              base::string16* string) {
  if (!GetSupportedLanguages()) {
    return false;
  }

  std::map<uint8, base::string16>::const_iterator it = strings_.find(string_id);
  if (it != strings_.end()) {
    *string = it->second;
    return true;
  }

  for (size_t i = 0; i < languages_.size(); ++i) {
    // Get the string using language ID.
    uint16 language_id = languages_[i];
    // The 1-byte length field limits the descriptor to 256-bytes (128 char16s).
    base::char16 text[128];
    int size =
        libusb_get_string_descriptor(handle_,
                                     string_id,
                                     language_id,
                                     reinterpret_cast<unsigned char*>(&text[0]),
                                     sizeof(text));
    if (size < 0) {
      USB_LOG(EVENT) << "Failed to get string descriptor " << string_id
                     << " (langid " << language_id
                     << "): " << ConvertPlatformUsbErrorToString(size);
      continue;
    } else if (size < 2) {
      USB_LOG(EVENT) << "String descriptor " << string_id << " (langid "
                     << language_id << ") has no header.";
      continue;
      // The first 2 bytes of the descriptor are the total length and type tag.
    } else if ((text[0] & 0xff) != size) {
      USB_LOG(EVENT) << "String descriptor " << string_id << " (langid "
                     << language_id << ") size mismatch: " << (text[0] & 0xff)
                     << " != " << size;
      continue;
    } else if ((text[0] >> 8) != LIBUSB_DT_STRING) {
      USB_LOG(EVENT) << "String descriptor " << string_id << " (langid "
                     << language_id << ") is not a string descriptor.";
      continue;
    }

    *string = base::string16(text + 1, (size - 2) / 2);
    strings_[string_id] = *string;
    return true;
  }

  return false;
}

void UsbDeviceHandleImpl::ControlTransfer(UsbEndpointDirection direction,
                                          TransferRequestType request_type,
                                          TransferRecipient recipient,
                                          uint8 request,
                                          uint16 value,
                                          uint16 index,
                                          net::IOBuffer* buffer,
                                          size_t length,
                                          unsigned int timeout,
                                          const UsbTransferCallback& callback) {
  if (length > UINT16_MAX) {
    USB_LOG(USER) << "Transfer too long.";
    callback.Run(USB_TRANSFER_ERROR, buffer, 0);
    return;
  }

  const size_t resized_length = LIBUSB_CONTROL_SETUP_SIZE + length;
  scoped_refptr<net::IOBuffer> resized_buffer(
      new net::IOBufferWithSize(static_cast<int>(resized_length)));
  if (!resized_buffer.get()) {
    callback.Run(USB_TRANSFER_ERROR, buffer, 0);
    return;
  }
  memcpy(resized_buffer->data() + LIBUSB_CONTROL_SETUP_SIZE, buffer->data(),
         length);

  scoped_ptr<Transfer> transfer = Transfer::CreateControlTransfer(
      CreateRequestType(direction, request_type, recipient), request, value,
      index, static_cast<uint16>(length), resized_buffer, timeout, callback);
  if (!transfer) {
    callback.Run(USB_TRANSFER_ERROR, buffer, 0);
    return;
  }

  PostOrSubmitTransfer(transfer.Pass());
}

void UsbDeviceHandleImpl::BulkTransfer(const UsbEndpointDirection direction,
                                       const uint8 endpoint,
                                       net::IOBuffer* buffer,
                                       const size_t length,
                                       const unsigned int timeout,
                                       const UsbTransferCallback& callback) {
  if (length > INT_MAX) {
    USB_LOG(USER) << "Transfer too long.";
    callback.Run(USB_TRANSFER_ERROR, buffer, 0);
    return;
  }

  scoped_ptr<Transfer> transfer = Transfer::CreateBulkTransfer(
      ConvertTransferDirection(direction) | endpoint, buffer,
      static_cast<int>(length), timeout, callback);

  PostOrSubmitTransfer(transfer.Pass());
}

void UsbDeviceHandleImpl::InterruptTransfer(
    UsbEndpointDirection direction,
    uint8 endpoint,
    net::IOBuffer* buffer,
    size_t length,
    unsigned int timeout,
    const UsbTransferCallback& callback) {
  if (length > INT_MAX) {
    USB_LOG(USER) << "Transfer too long.";
    callback.Run(USB_TRANSFER_ERROR, buffer, 0);
    return;
  }

  scoped_ptr<Transfer> transfer = Transfer::CreateInterruptTransfer(
      ConvertTransferDirection(direction) | endpoint, buffer,
      static_cast<int>(length), timeout, callback);

  PostOrSubmitTransfer(transfer.Pass());
}

void UsbDeviceHandleImpl::IsochronousTransfer(
    const UsbEndpointDirection direction,
    const uint8 endpoint,
    net::IOBuffer* buffer,
    const size_t length,
    const unsigned int packets,
    const unsigned int packet_length,
    const unsigned int timeout,
    const UsbTransferCallback& callback) {
  if (length > INT_MAX) {
    USB_LOG(USER) << "Transfer too long.";
    callback.Run(USB_TRANSFER_ERROR, buffer, 0);
    return;
  }

  scoped_ptr<Transfer> transfer = Transfer::CreateIsochronousTransfer(
      ConvertTransferDirection(direction) | endpoint, buffer,
      static_cast<int>(length), packets, packet_length, timeout, callback);

  PostOrSubmitTransfer(transfer.Pass());
}

void UsbDeviceHandleImpl::RefreshEndpointMap() {
  DCHECK(thread_checker_.CalledOnValidThread());
  endpoint_map_.clear();
  const UsbConfigDescriptor* config = device_->GetConfiguration();
  if (config) {
    for (const auto& map_entry : claimed_interfaces_) {
      int interface_number = map_entry.first;
      const scoped_refptr<InterfaceClaimer>& claimed_iface = map_entry.second;

      for (const UsbInterfaceDescriptor& iface : config->interfaces) {
        if (iface.interface_number == interface_number &&
            iface.alternate_setting == claimed_iface->alternate_setting()) {
          for (const UsbEndpointDescriptor& endpoint : iface.endpoints) {
            endpoint_map_[endpoint.address] = interface_number;
          }
          break;
        }
      }
    }
  }
}

scoped_refptr<UsbDeviceHandleImpl::InterfaceClaimer>
UsbDeviceHandleImpl::GetClaimedInterfaceForEndpoint(unsigned char endpoint) {
  if (ContainsKey(endpoint_map_, endpoint))
    return claimed_interfaces_[endpoint_map_[endpoint]];
  return NULL;
}

void UsbDeviceHandleImpl::PostOrSubmitTransfer(scoped_ptr<Transfer> transfer) {
  if (task_runner_->RunsTasksOnCurrentThread()) {
    SubmitTransfer(transfer.Pass());
  } else {
    task_runner_->PostTask(
        FROM_HERE, base::Bind(&UsbDeviceHandleImpl::SubmitTransfer, this,
                              base::Passed(&transfer)));
  }
}

void UsbDeviceHandleImpl::SubmitTransfer(scoped_ptr<Transfer> transfer) {
  DCHECK(thread_checker_.CalledOnValidThread());

  if (device_) {
    if (transfer->Submit(weak_factory_.GetWeakPtr())) {
      // Transfer is now owned by libusb until its completion callback is run.
      // This object holds a weak reference.
      transfers_.insert(transfer.release());
    }
  } else {
    transfer->Complete(USB_TRANSFER_DISCONNECT, 0);
  }
}

void UsbDeviceHandleImpl::CompleteTransfer(scoped_ptr<Transfer> transfer) {
  DCHECK(ContainsKey(transfers_, transfer.get()))
      << "Missing transfer completed";
  transfers_.erase(transfer.get());
  transfer->ProcessCompletion();
}

bool UsbDeviceHandleImpl::GetSupportedLanguages() {
  if (!languages_.empty()) {
    return true;
  }

  // The 1-byte length field limits the descriptor to 256-bytes (128 uint16s).
  uint16 languages[128];
  int size = libusb_get_string_descriptor(
      handle_,
      0,
      0,
      reinterpret_cast<unsigned char*>(&languages[0]),
      sizeof(languages));
  if (size < 0) {
    USB_LOG(EVENT) << "Failed to get list of supported languages: "
                   << ConvertPlatformUsbErrorToString(size);
    return false;
  } else if (size < 2) {
    USB_LOG(EVENT) << "String descriptor zero has no header.";
    return false;
    // The first 2 bytes of the descriptor are the total length and type tag.
  } else if ((languages[0] & 0xff) != size) {
    USB_LOG(EVENT) << "String descriptor zero size mismatch: "
                   << (languages[0] & 0xff) << " != " << size;
    return false;
  } else if ((languages[0] >> 8) != LIBUSB_DT_STRING) {
    USB_LOG(EVENT) << "String descriptor zero is not a string descriptor.";
    return false;
  }

  languages_.assign(languages[1], languages[(size - 2) / 2]);
  return true;
}

void UsbDeviceHandleImpl::InternalClose() {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (!device_)
    return;

  // Cancel all the transfers.
  for (Transfer* transfer : transfers_) {
    // The callback will be called some time later.
    transfer->Cancel();
  }

  // Attempt-release all the interfaces.
  // It will be retained until the transfer cancellation is finished.
  claimed_interfaces_.clear();

  // Cannot close device handle here. Need to wait for libusb_cancel_transfer to
  // finish.
  device_ = NULL;
}

}  // namespace device


text:
#include "QmitkDataManagerHotkeysPrefPage.h"
#include <QmitkHotkeyLineEdit.h>

#include "berryIPreferencesService.h"
#include "berryPlatform.h"

#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QGridLayout>
#include <QMessageBox>
#include <QApplication>

#include <map>

using namespace berry;

QmitkDataManagerHotkeysPrefPage::QmitkDataManagerHotkeysPrefPage()
: m_MainControl(0)
{

}

void QmitkDataManagerHotkeysPrefPage::Init(berry::IWorkbench::Pointer )
{

}

void QmitkDataManagerHotkeysPrefPage::CreateQtControl(QWidget* parent)
{
  IPreferencesService::Pointer prefService = Platform::GetServiceRegistry().GetServiceById<IPreferencesService>(IPreferencesService::ID);
  berry::IPreferences::Pointer _DataManagerHotkeysPreferencesNode = prefService->GetSystemPreferences()->Node("/DataManager/Hotkeys");
  m_DataManagerHotkeysPreferencesNode = _DataManagerHotkeysPreferencesNode;

  m_HotkeyEditors["Make all nodes invisible"] = new QmitkHotkeyLineEdit("Ctrl+, V");

  m_HotkeyEditors["Toggle visibility of selected nodes"] = new QmitkHotkeyLineEdit("V");

  m_HotkeyEditors["Delete selected nodes"] = new QmitkHotkeyLineEdit("Del");

  m_HotkeyEditors["Reinit selected nodes"] = new QmitkHotkeyLineEdit("R");

  m_HotkeyEditors["Global Reinit"] = new QmitkHotkeyLineEdit("Ctrl+, R");

  m_HotkeyEditors["Save selected nodes"] = new QmitkHotkeyLineEdit("Ctrl+, S");

  m_HotkeyEditors["Load"] = new QmitkHotkeyLineEdit("Ctrl+, L");

  m_HotkeyEditors["Show Node Information"] = new QmitkHotkeyLineEdit("Ctrl+, I");

  m_MainControl = new QWidget(parent);

  QGridLayout* layout = new QGridLayout;
  int i = 0;
  for (std::map<QString, QmitkHotkeyLineEdit*>::iterator it = m_HotkeyEditors.begin()
    ; it != m_HotkeyEditors.end(); ++it)
  {
    layout->addWidget(new QLabel(it->first), i,0);
    layout->addWidget(it->second, i,1);
    layout->setRowStretch(i,0);
    ++i;
  }
  layout->setRowStretch(i+1,10);

  m_MainControl->setLayout(layout);
  this->Update();
}

QWidget* QmitkDataManagerHotkeysPrefPage::GetQtControl() const
{
  return m_MainControl;
}

bool QmitkDataManagerHotkeysPrefPage::PerformOk()
{
  IPreferences::Pointer _DataManagerHotkeysPreferencesNode = m_DataManagerHotkeysPreferencesNode.Lock();
  if(_DataManagerHotkeysPreferencesNode.IsNotNull())
  {
    bool duplicate = false;
    QString keyString;
    QString errString;
    for (std::map<QString, QmitkHotkeyLineEdit*>::iterator it = m_HotkeyEditors.begin()
      ; it != m_HotkeyEditors.end(); ++it)
    {
      keyString = it->second->GetKeySequenceAsString();

      if(keyString.isEmpty())
        errString = QString("No valid key sequence for \"%1\"").arg(it->first);

      if(errString.isEmpty())
      {
        std::map<QString, QmitkHotkeyLineEdit*>::iterator it2;
        // search for duplicated key
        for (it2 = m_HotkeyEditors.begin(); it2 != m_HotkeyEditors.end(); ++it2)
        {
           if(it->first != it2->first && keyString == it2->second->GetKeySequenceAsString())
           {
             duplicate = true;
             break;
           }
        }
        if(duplicate == true)
          errString = QString("Duplicate hot key for \"%1\" and \"%2\"").arg(it->first).arg(it2->first);
      }

      if(!errString.isEmpty())
      {
        QMessageBox::critical(QApplication::activeWindow(), "Error", errString);
        return false;
      }
    }

  //# no errors -> save all values and flush to file
    for (std::map<QString, QmitkHotkeyLineEdit*>::iterator it = m_HotkeyEditors.begin()
      ; it != m_HotkeyEditors.end(); ++it)
      _DataManagerHotkeysPreferencesNode->Put(it->first.toStdString()
        , it->second->GetKeySequenceAsString().toStdString());

    _DataManagerHotkeysPreferencesNode->Flush();

    return true;
  }
  return false;
}

void QmitkDataManagerHotkeysPrefPage::PerformCancel()
{

}

void QmitkDataManagerHotkeysPrefPage::Update()
{
  IPreferences::Pointer _DataManagerHotkeysPreferencesNode = m_DataManagerHotkeysPreferencesNode.Lock();
  if(_DataManagerHotkeysPreferencesNode.IsNotNull())
  {
    for (std::map<QString, QmitkHotkeyLineEdit*>::iterator it = m_HotkeyEditors.begin()
      ; it != m_HotkeyEditors.end(); ++it)
    {
      it->second->setText(QString::fromStdString(_DataManagerHotkeysPreferencesNode->Get(it->first.toStdString()
        , it->second->text().toStdString())));
    }
  }
}


text:
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title><?= $this->h CONFIG()->app_name ?>/<?= $this->h $this->params()->tags ?></title>
  <link><?= scheme ?><?= $this->h CONFIG()->server_host ?>/</link>
  <description><?= $this->h CONFIG()->app_name ?>PicLens RSS Feed</description>
  <?php unless $this->posts.current_page == 1 ?>
    <?= tag("atom:link", {'rel' => 'previous', 'href' => 'url_for'('only_path' => 'false', 'post#piclens', :page => $this->posts.previous_page, :tags => $this->params()->tags)}, false) ?>
  <?php end ?>
  <?php unless $this->posts.next_page.nil? ?>
    <?= tag("atom:link", {'rel' => 'next', 'href' => 'url_for'('only_path' => 'false', 'post#piclens', :page => $this->posts.next_page, :tags => $this->params()->tags)}, false) ?>
  <?php end ?>

  <?php foreach ($this->posts as $post) : ?>
    <item>
      <title><?= $this->h post.cached_tags ?></title>
      <link><?= scheme ?><?= $this->h CONFIG()->server_host ?>/post/show/<?= post.id ?></link>
      <guid><?= scheme ?><?= $this->h CONFIG()->server_host ?>/post/show/<?= post.id ?></guid>
      <media:thumbnail url="<?= post.preview_url ?>"/>
    <?php if (CONFIG()->image_samples) : ?>
      <media:content url="<?= post.sample_url ?>" type=""/>
    <?php else ?>
        <media:content url="<?= post.file_url ?>" type=""/>
    <?php endif ?>
    </item>
  <?php endforeach ?>
</channel>
</rss>


text:
using Microsoft.Azure.Management.NetApp;
using Microsoft.Azure.Management.NetApp.Models;
using System.Collections.Generic;
using System.Threading;
using Xunit;

namespace NetApp.Tests.Helpers
{
    public class ResourceUtils
    {
        public const long gibibyte = 1024L * 1024L * 1024L;

        private const string remoteSuffix = "-RSC";
        public const string vnet = "sdknettestqa2vnet464";
        public const string repVnet = "sdktestqa2vnet464";
        public const string remoteVnet = repVnet + remoteSuffix;
        public const string subsId = "69a75bda-882e-44d5-8431-63421204132a";
        public const string location = "westus2stage";
        public const string remoteLocation = "southcentralusstage";
        public const string resourceGroup = "sdk-net-test-qa2";
        public const string repResourceGroup = "sdk-test-qa2";
        public const string remoteResourceGroup = repResourceGroup + remoteSuffix;
        public const string accountName1 = "sdk-net-tests-acc-20";
        public const string remoteAccountName1 = accountName1 + remoteSuffix;
        public const string accountName2 = "sdk-net-tests-acc-21";
        public const string poolName1 = "sdk-net-tests-pool-10";
        public const string remotePoolName1 = poolName1 + remoteSuffix;
        public const string poolName2 = "sdk-net-tests-pool-11";
        public const string volumeName1 = "sdk-net-tests-vol-1000";
        public const string remoteVolumeName1 = volumeName1 + remoteSuffix;
        public const string volumeName2 = "sdk-net-tests-vol-1001";
        public const string snapshotName1 = "sdk-net-tests-snap-10";
        public const string snapshotName2 = "sdk-net-tests-snap-11";

        public static ActiveDirectory activeDirectory = new ActiveDirectory()
        {
            Username = "sdkuser",
            Password = "sdkpass",
            Domain = "sdkdomain",
            Dns = "127.0.0.1",
            SmbServerName = "SDKSMBSeNa",
        };

        public static ActiveDirectory activeDirectory2 = new ActiveDirectory()
        {
            Username = "sdkuser1",
            Password = "sdkpass1",
            Domain = "sdkdomain",
            Dns = "127.0.0.1",
            SmbServerName = "SDKSMBSeNa",
        };

        public static ExportPolicyRule defaultExportPolicyRule = new ExportPolicyRule()
        {
            RuleIndex = 1,
            UnixReadOnly = false,
            UnixReadWrite = true,
            Cifs = false,
            Nfsv3 = true,
            Nfsv41 = false,
            AllowedClients = "0.0.0.0/0"
        };

        public static IList<ExportPolicyRule> defaultExportPolicyRuleList = new List<ExportPolicyRule>()
        {
            defaultExportPolicyRule
        };

        public static VolumePropertiesExportPolicy defaultExportPolicy = new VolumePropertiesExportPolicy()
        {
            Rules = defaultExportPolicyRuleList
        };

        private const int delay = 5000;
        private const int retryAttempts = 4;

        public static NetAppAccount CreateAccount(AzureNetAppFilesManagementClient netAppMgmtClient, string accountName = accountName1, string resourceGroup = resourceGroup, string location = location, IDictionary<string, string> tags = default(IDictionary<string, string>), ActiveDirectory activeDirectory = null)
        {
            // request reference example
            // az netappfiles account update -g --account-name cli-lf-acc2  --active-directories '[{"username": "aduser", "password": "aduser", "smbservername": "SMBSERVER", "dns": "1.2.3.4", "domain": "westcentralus"}]' -l westus2

            var activeDirectories = activeDirectory != null ? new List <ActiveDirectory> { activeDirectory } : null;

            var netAppAccount = new NetAppAccount()
            {
                Location = location,
                Tags = tags,
                ActiveDirectories = activeDirectories
            };

            var resource = netAppMgmtClient.Accounts.CreateOrUpdate(netAppAccount, resourceGroup, accountName);
            Assert.Equal(resource.Name, accountName);

            Thread.Sleep(delay); // some robustness against ARM caching

            return resource;
        }

        public static CapacityPool CreatePool(AzureNetAppFilesManagementClient netAppMgmtClient, string poolName = poolName1, string accountName = accountName1, string resourceGroup = resourceGroup, string location = location, IDictionary<string, string> tags = default(IDictionary<string, string>), bool poolOnly = false)
        {
            if (!poolOnly)
            {
                CreateAccount(netAppMgmtClient, accountName, resourceGroup: resourceGroup, location: location);
            }

            var pool = new CapacityPool
            {
                Location = location,
                Size = 4398046511104,
                ServiceLevel = "Premium",
                Tags = tags
            };

            CapacityPool resource;
            try
            {
                resource = netAppMgmtClient.Pools.CreateOrUpdate(pool, resourceGroup, accountName, poolName);
            }
            catch
            {
                // try one more time
                resource = netAppMgmtClient.Pools.CreateOrUpdate(pool, resourceGroup, accountName, poolName);
            }
            Assert.Equal(resource.Name, accountName + '/' + poolName);

            Thread.Sleep(delay); // some robustness against ARM caching

            return resource;
        }

        public static Volume CreateVolume(AzureNetAppFilesManagementClient netAppMgmtClient, string volumeName = volumeName1, string poolName = poolName1, string accountName = accountName1, string resourceGroup = resourceGroup, string location = location, List<string> protocolTypes = null, IDictionary<string, string> tags = default(IDictionary<string, string>), VolumePropertiesExportPolicy exportPolicy = null, string vnet = vnet, bool volumeOnly = false, string snapshotId = null)
        {
            if (!volumeOnly)
            {
                CreatePool(netAppMgmtClient, poolName, accountName, resourceGroup: resourceGroup, location: location);
            }
            var defaultProtocolType = new List<string>() { "NFSv3" };
            var volumeProtocolTypes = protocolTypes == null ? defaultProtocolType : protocolTypes;
            var volume = new Volume
            {
                Location = location,
                UsageThreshold = 100 * gibibyte,
                ProtocolTypes = volumeProtocolTypes,
                CreationToken = volumeName,
                SubnetId = "/subscriptions/" + netAppMgmtClient.SubscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Network/virtualNetworks/" + vnet + "/subnets/default",
                Tags = tags,
                ExportPolicy = exportPolicy,
                SnapshotId = snapshotId
            };

            var resource = netAppMgmtClient.Volumes.CreateOrUpdate(volume, resourceGroup, accountName, poolName, volumeName);
            Assert.Equal(resource.Name, accountName + '/' + poolName + '/' + volumeName);

            Thread.Sleep(delay); // some robustness against ARM caching

            return resource;
        }

        public static Volume CreateDpVolume(AzureNetAppFilesManagementClient netAppMgmtClient, Volume sourceVolume, string volumeName = remoteVolumeName1, string poolName = remotePoolName1, string accountName = remoteAccountName1, string resourceGroup = remoteResourceGroup, string location = location, List<string> protocolTypes = null, IDictionary<string, string> tags = default(IDictionary<string, string>), VolumePropertiesExportPolicy exportPolicy = null, bool volumeOnly = false, string snapshotId = null)
        {
            if (!volumeOnly)
            {
                CreatePool(netAppMgmtClient, poolName, accountName, resourceGroup: resourceGroup, location: remoteLocation);
            }
            var defaultProtocolType = new List<string>() { "NFSv3" };
            var volumeProtocolTypes = protocolTypes == null ? defaultProtocolType : protocolTypes;
            var replication = new ReplicationObject
            {
                EndpointType = "dst",
                RemoteVolumeResourceId = sourceVolume.Id,
                ReplicationSchedule = "_10minutely"
            };
            var dataProtection = new VolumePropertiesDataProtection
            {
                Replication = replication
            };

            var volume = new Volume
            {
                Location = remoteLocation,
                UsageThreshold = 100 * gibibyte,
                ProtocolTypes = volumeProtocolTypes,
                CreationToken = volumeName,
                //SubnetId = "/subscriptions/" + subsId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Network/virtualNetworks/" + remoteVnet + "/subnets/default",
                SubnetId = "/subscriptions/" + netAppMgmtClient.SubscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Network/virtualNetworks/" + remoteVnet + "/subnets/default",
                Tags = tags,
                ExportPolicy = exportPolicy,
                SnapshotId = snapshotId,
                VolumeType = "DataProtection",
                DataProtection = dataProtection
            };

            var resource = netAppMgmtClient.Volumes.CreateOrUpdate(volume, resourceGroup, accountName, poolName, volumeName);
            Assert.Equal(resource.Name, accountName + '/' + poolName + '/' + volumeName);

            Thread.Sleep(delay); // some robustness against ARM caching

            return resource;
        }

        public static void CreateSnapshot(AzureNetAppFilesManagementClient netAppMgmtClient, string snapshotName = snapshotName1, string volumeName = volumeName1, string poolName = poolName1, string accountName = accountName1, string resourceGroup = resourceGroup, string location = location, bool snapshotOnly = false)
        {
            Volume volume = null;
            var snapshot = new Snapshot();

            if (!snapshotOnly)
            {
                volume = CreateVolume(netAppMgmtClient, volumeName, poolName, accountName);

                snapshot = new Snapshot
                {
                    Location = location,
                };
            }
            else
            {
                // for those tests where snapshotOnly is true, no filesystem id will be available
                // use this opportunity to test snapshot creation with no filesystem id provided
                // for these cases it should use the name in the resource id
                snapshot = new Snapshot
                {
                    Location = location,
                };
            }

            var resource = netAppMgmtClient.Snapshots.Create(snapshot, resourceGroup, accountName, poolName, volumeName, snapshotName);
            Assert.Equal(resource.Name, accountName + '/' + poolName + '/' + volumeName + '/' + snapshotName);
        }

        public static void DeleteAccount(AzureNetAppFilesManagementClient netAppMgmtClient, string accountName = accountName1, string resourceGroup = resourceGroup, bool deep = false)
        {
            if (deep)
            {
                // find and delete all nested resources - not implemented
            }

            // now delete the account
            netAppMgmtClient.Accounts.Delete(resourceGroup, accountName);
        }

        public static void DeletePool(AzureNetAppFilesManagementClient netAppMgmtClient, string poolName = poolName1, string accountName = accountName1, string resourceGroup = resourceGroup, bool deep = false)
        {
            bool retry = true;
            int co = 0;

            if (deep)
            {
                // find and delete all nested resources - not implemented
            }

            // now delete the pool - with retry for test robustness due to
            //   - ARM caching (ARM continues to tidy up even after the awaited async op
            //     has returned)
            //   - other async actions in RP/SDE/NRP
            // e.g. snapshot deletion might not be complete and therefore pool has child resource
            while (retry == true)
            {
                Thread.Sleep(delay);

                try
                {
                    netAppMgmtClient.Pools.Delete(resourceGroup, accountName, poolName);
                    retry = false;
                }
                catch
                {
                    co++;
                    if (co > retryAttempts)
                    {
                        retry = false;
                    }
                }
            }
        }

        public static void DeleteVolume(AzureNetAppFilesManagementClient netAppMgmtClient, string volumeName = volumeName1, string poolName = poolName1, string accountName = accountName1, string resourceGroup = resourceGroup, string location = location, bool deep = false)
        {
            bool retry = true;
            int co = 0;

            if (deep)
            {
                // find and delete all nested resources - not implemented
            }

            // now delete the volume - with retry for test robustness due to
            //   - ARM caching (ARM continues to tidy up even after the awaited async op
            //     has returned)
            //   - other async actions in RP/SDE/NRP
            // e.g. snapshot deletion might not be complete and therefore volume has child resource
            while (retry == true)
            {
                Thread.Sleep(delay);

                try
                {
                    netAppMgmtClient.Volumes.Delete(resourceGroup, accountName, poolName, volumeName);
                    retry = false;
                }
                catch
                {
                    co++;
                    if (co > retryAttempts)
                    {
                        retry = false;
                    }
                }
            }
        }

        public static void DeleteSnapshot(AzureNetAppFilesManagementClient netAppMgmtClient, string snapshotName = snapshotName1, string volumeName = volumeName1, string poolName = poolName1, string accountName = accountName1, string resourceGroup = resourceGroup, string location = location, bool deep = false)
        {
            bool retry = true;
            int co = 0;

            if (deep)
            {
                // find and delete all nested resources - not implemented
            }

            // now delete the snapshot - with retry for test robustness due to
            //   - ARM caching (ARM continues to tidy up even after the awaited async op
            //     has returned)
            //   - other async actions in RP/SDE/NRP
            // e.g. snapshot deletion might fail if the actual creation is not complete at
            // all levels
            while (retry == true)
            {
                Thread.Sleep(delay);

                try
                {
                    netAppMgmtClient.Snapshots.Delete(resourceGroup, accountName, poolName, volumeName, snapshotName);
                    retry = false;
                }
                catch
                {
                    co++;
                    if (co > retryAttempts)
                    {
                        retry = false;
                    }
                }
            }
        }
    }
}


text:
set -e
export TAGNAME=v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}
export DEB_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}-${VERSION_BUILD}

export GITHUB_ORGANIZATION="kubernetes"
export GITHUB_REPO="minikube"
export PROJECT_NAME="minikube"
export DARWIN_SHA256=$(cat out/minikube-darwin-amd64.sha256)
export LINUX_SHA256=$(cat out/minikube-linux-amd64.sha256)
export WINDOWS_SHA256=$(cat out/minikube-windows-amd64.exe.sha256)

# Description could be moved into file on machine or fetched via URL.  Doing this for now as it is the simplest, portable solution.
# ================================================================================
export DESCRIPTION="# Minikube ${TAGNAME}
Minikube is still under active development, and features may change at any time. Release notes are available [here](https://github.com/kubernetes/minikube/blob/${TAGNAME}/CHANGELOG.md).

## Distribution
Minikube is distributed in binary form for Linux, OSX, and Windows systems for the ${TAGNAME} release. Please note that Windows support is currently experimental and may have issues.  Binaries are available through GitHub or on Google Cloud Storage. The direct GCS links are:
[Darwin/amd64](https://storage.googleapis.com/minikube/releases/${TAGNAME}/minikube-darwin-amd64)
[Linux/amd64](https://storage.googleapis.com/minikube/releases/${TAGNAME}/minikube-linux-amd64)
[Windows/amd64](https://storage.googleapis.com/minikube/releases/${TAGNAME}/minikube-windows-amd64.exe)

## Installation
### OSX
\`\`\`shell
curl -Lo minikube https://storage.googleapis.com/minikube/releases/${TAGNAME}/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
\`\`\`
Feel free to leave off the \`\`\`sudo mv minikube /usr/local/bin\`\`\` if you would like to add minikube to your path manually.

Or you can install via homebrew with \`brew cask install minikube\`.

### Linux
\`\`\`shell
curl -Lo minikube https://storage.googleapis.com/minikube/releases/${TAGNAME}/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
\`\`\`
Feel free to leave off the \`\`\`sudo mv minikube /usr/local/bin\`\`\` if you would like to add minikube to your path manually.

### Debian Package (.deb) [Experimental]
Download the \`minikube_${DEB_VERSION}.deb\` file, and install it using \`sudo dpkg -i minikube_$(DEB_VERSION).deb\`

### Windows [Experimental]
Download the \`minikube-windows-amd64.exe\` file, rename it to \`minikube.exe\` and add it to your path.

### Windows Installer [Experimental]
Download the \`minikube-installer.exe\` file, and execute the installer.  This will automatically add minikube.exe to your path with an uninstaller available as well.

## Usage
Documentation is available [here](https://github.com/kubernetes/minikube/blob/${TAGNAME}/README.md).

## Checksums
Minikube consists of a binary executable and a VM image in ISO format. To verify the contents of your distribution, you can compare sha256 hashes with these values:

\`\`\`
$ tail -n +1 -- out/*.sha256
==> out/minikube-darwin-amd64.sha256 <==
${DARWIN_SHA256}

==> out/minikube-linux-amd64.sha256 <==
${LINUX_SHA256}

==> out/minikube-windows-amd64.exe.sha256 <==
${WINDOWS_SHA256}
\`\`\`

### ISO
\`\`\`shell
$ openssl sha256 minikube.iso
SHA256(minikube.iso)=
${ISO_SHA256}
\`\`\`
"
# ================================================================================

# Deleting release from github before creating new one
github-release delete --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${TAGNAME} || true

# Creating a new release in github
github-release release \
    --user ${GITHUB_ORGANIZATION} \
    --repo ${GITHUB_REPO} \
    --tag ${TAGNAME} \
    --name "${TAGNAME}" \
    --description "${DESCRIPTION}"

# Uploading the files into github
FILES_TO_UPLOAD=(
    'minikube-linux-amd64'
    'minikube-linux-amd64.sha256'
    'minikube-darwin-amd64'
    'minikube-darwin-amd64.sha256'
    'minikube-windows-amd64'
    'minikube-windows-amd64.sha256'
    'minikube-installer.exe'
    "minikube_${DEB_VERSION}.deb"
    'docker-machine-driver-kvm2'
    'docker-machine-driver-hyperkit'
    'localkube'
    'localkube.sha256'
)

for UPLOAD in "${FILES_TO_UPLOAD[@]}"
do
    n=0
    until [ $n -ge 5 ]
    do
        github-release upload --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${TAGNAME} --name $UPLOAD --file out/$UPLOAD && break
        n=$[$n+1]
        sleep 15
    done
done


text:
<?php

namespace PhpOffice\PhpSpreadsheet;

/**
 * @template T of IComparable
 */
class HashTable
{
    /**
     * HashTable elements.
     *
     * @var T[]
     */
    protected $items = [];

    /**
     * HashTable key map.
     *
     * @var string[]
     */
    protected $keyMap = [];

    /**
     * Create a new \PhpOffice\PhpSpreadsheet\HashTable.
     *
     * @param T[] $pSource Optional source array to create HashTable from
     */
    public function __construct($pSource = null)
    {
        if ($pSource !== null) {
            // Create HashTable
            $this->addFromSource($pSource);
        }
    }

    /**
     * Add HashTable items from source.
     *
     * @param T[] $pSource Source array to create HashTable from
     */
    public function addFromSource(?array $pSource = null): void
    {
        // Check if an array was passed
        if ($pSource == null) {
            return;
        }

        foreach ($pSource as $item) {
            $this->add($item);
        }
    }

    /**
     * Add HashTable item.
     *
     * @param T $pSource Item to add
     */
    public function add(IComparable $pSource): void
    {
        $hash = $pSource->getHashCode();
        if (!isset($this->items[$hash])) {
            $this->items[$hash] = $pSource;
            $this->keyMap[count($this->items) - 1] = $hash;
        }
    }

    /**
     * Remove HashTable item.
     *
     * @param T $pSource Item to remove
     */
    public function remove(IComparable $pSource): void
    {
        $hash = $pSource->getHashCode();
        if (isset($this->items[$hash])) {
            unset($this->items[$hash]);

            $deleteKey = -1;
            foreach ($this->keyMap as $key => $value) {
                if ($deleteKey >= 0) {
                    $this->keyMap[$key - 1] = $value;
                }

                if ($value == $hash) {
                    $deleteKey = $key;
                }
            }
            unset($this->keyMap[count($this->keyMap) - 1]);
        }
    }

    /**
     * Clear HashTable.
     */
    public function clear(): void
    {
        $this->items = [];
        $this->keyMap = [];
    }

    /**
     * Count.
     *
     * @return int
     */
    public function count()
    {
        return count($this->items);
    }

    /**
     * Get index for hash code.
     *
     * @param string $pHashCode
     *
     * @return int Index
     */
    public function getIndexForHashCode($pHashCode)
    {
        return array_search($pHashCode, $this->keyMap);
    }

    /**
     * Get by index.
     *
     * @param int $pIndex
     *
     * @return null|T
     */
    public function getByIndex($pIndex)
    {
        if (isset($this->keyMap[$pIndex])) {
            return $this->getByHashCode($this->keyMap[$pIndex]);
        }

        return null;
    }

    /**
     * Get by hashcode.
     *
     * @param string $pHashCode
     *
     * @return null|T
     */
    public function getByHashCode($pHashCode)
    {
        if (isset($this->items[$pHashCode])) {
            return $this->items[$pHashCode];
        }

        return null;
    }

    /**
     * HashTable to array.
     *
     * @return T[]
     */
    public function toArray()
    {
        return $this->items;
    }

    /**
     * Implement PHP __clone to create a deep clone, not just a shallow copy.
     */
    public function __clone()
    {
        $vars = get_object_vars($this);
        foreach ($vars as $key => $value) {
            // each member of this class is an array
            if (is_array($value)) {
                $array1 = $value;
                foreach ($array1 as $key1 => $value1) {
                    if (is_object($value1)) {
                        $array1[$key1] = clone $value1;
                    }
                }
                $this->$key = $array1;
            }
        }
    }
}


text:
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Environment.Extensions;
using Orchard.Tags.Models;

namespace Orchard.Tags.Drivers {
    [OrchardFeature("Orchard.Tags.TagCloud")]
    public class TagCloudDriver : ContentPartDriver<TagCloudPart> {

        protected override string Prefix {
            get {
                return "tagcloud";
            }
        }

        protected override DriverResult Display(TagCloudPart part, string displayType, dynamic shapeHelper) {
            return ContentShape("Parts_TagCloud",
                () => shapeHelper.Parts_TagCloud(
                    TagCounts: part.TagCounts,
                    ContentPart: part,
                    ContentItem: part.ContentItem));
        }

        protected override DriverResult Editor(TagCloudPart part, dynamic shapeHelper) {

            return ContentShape("Parts_TagCloud_Edit",
                () => shapeHelper.EditorTemplate(
                    TemplateName: "Parts/TagCloud",
                    Model: part,
                    Prefix: Prefix));
        }

        protected override DriverResult Editor(TagCloudPart part, IUpdateModel updater, dynamic shapeHelper) {
            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part, shapeHelper);
        }
    }
}


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

namespace Bioinformatics
{
   [DebuggerStepThrough]
   internal static class Convert
   {
      // A-0 G-1 C-2 T-3
      public static char ToChar(Nucleotid nucleotid)
      {
         switch (nucleotid)
         {
            case Nucleotid.A:
               return 'A';
            case Nucleotid.G:
               return 'G';
            case Nucleotid.C:
               return 'C';
            case Nucleotid.T:
               return 'T';
            default:
               throw new ArgumentOutOfRangeException("nucleotid");
         }
      }

      public static char ToChar(NucleotidRna nucleotid)
      {
         switch (nucleotid)
         {
            case NucleotidRna.A:
               return 'A';
            case NucleotidRna.G:
               return 'G';
            case NucleotidRna.C:
               return 'C';
            case NucleotidRna.U:
               return 'U';
            default:
               throw new ArgumentOutOfRangeException("nucleotid");
         }
      }

      public static Nucleotid FromChar(char nucleotide)
      {
         if (nucleotide == 'A' || nucleotide == 'a')
            return Nucleotid.A;
         if (nucleotide == 'G' || nucleotide == 'g')
            return Nucleotid.G;
         if (nucleotide == 'C' || nucleotide == 'c')
            return Nucleotid.C;
         if (nucleotide == 'T' || nucleotide == 't')
            return Nucleotid.T;
         throw new ApplicationException(String.Format("Wrong nucleotide:'{0}'", nucleotide));
      }

      public static NucleotidRna RnaFromChar(char nucleotide)
      {
         if (nucleotide == 'A' || nucleotide == 'a')
            return NucleotidRna.A;
         if (nucleotide == 'G' || nucleotide == 'g')
            return NucleotidRna.G;
         if (nucleotide == 'C' || nucleotide == 'c')
            return NucleotidRna.C;
         if (nucleotide == 'U' || nucleotide == 'u')
            return NucleotidRna.U;
         throw new ApplicationException(String.Format("Wrong nucleotide:'{0}'", nucleotide));
      }

      public static AminoAcid AminoAcidFromChar(char aminoAcid)
      {
         switch (aminoAcid)
         {
            case 'G':
               return AminoAcid.G;
            case 'A':
               return AminoAcid.A;
            case 'V':
               return AminoAcid.V;
            case 'L':
               return AminoAcid.L;
            case 'I':
               return AminoAcid.I;
            case 'P':
               return AminoAcid.P;
            case 'F':
               return AminoAcid.F;
            case 'Y':
               return AminoAcid.Y;
            case 'W':
               return AminoAcid.W;
            case 'S':
               return AminoAcid.S;
            case 'T':
               return AminoAcid.T;
            case 'D':
               return AminoAcid.D;
            case 'E':
               return AminoAcid.E;
            case 'N':
               return AminoAcid.N;
            case 'Q':
               return AminoAcid.Q;
            case 'C':
               return AminoAcid.C;
            case 'M':
               return AminoAcid.M;
            case 'H':
               return AminoAcid.H;
            case 'K':
               return AminoAcid.K;
            case 'R':
               return AminoAcid.R;
            default:
               throw new ArgumentOutOfRangeException("aminoAcid");
         }
      }

      public static char ToChar(AminoAcid aminoAcid)
      {
         switch (aminoAcid)
         {
            case AminoAcid.G:
               return 'G';
            case AminoAcid.A:
               return 'A';
            case AminoAcid.V:
               return 'V';
            case AminoAcid.L:
               return 'L';
            case AminoAcid.I:
               return 'I';
            case AminoAcid.P:
               return 'P';
            case AminoAcid.F:
               return 'F';
            case AminoAcid.Y:
               return 'Y';
            case AminoAcid.W:
               return 'W';
            case AminoAcid.S:
               return 'S';
            case AminoAcid.T:
               return 'T';
            case AminoAcid.D:
               return 'D';
            case AminoAcid.E:
               return 'E';
            case AminoAcid.N:
               return 'N';
            case AminoAcid.Q:
               return 'Q';
            case AminoAcid.C:
               return 'C';
            case AminoAcid.M:
               return 'M';
            case AminoAcid.H:
               return 'H';
            case AminoAcid.K:
               return 'K';
            case AminoAcid.R:
               return 'R';
            case AminoAcid.Stop:
               return '*';
            default:
               throw new ArgumentOutOfRangeException("aminoAcid");
         }
      }

   }
}


text:
var express = require('express'),
  Mustache = require('mustache'),
  pgp = require('pg-promise')(),
  dbgeo = require("./dbgeo-modified.js");

//create express app and prepare db connection
var app = express(),
  port = process.env.PORT || 4000,
  config = require('./config.js'),
  db = pgp(config);

//use express static to serve up the frontend
app.use(express.static(__dirname + '/public'));

//expose sql endpoint, grab query as URL parameter and send it to the database
app.get('/sql', function(req, res){
  var sql = req.query.q;
  console.log('Executing SQL: ' + sql);

  //query using pg-promise
  db.any(sql)
    .then(function (data) { //use dbgeo to convert WKB from PostGIS into topojson
        return dbGeoParse(data);
    })
    .then(function (data) {
        console.log("DATA:", data);
        res.send(data);
    })
    .catch(function (err) { //send the error message if the query didn't work
        var msg = err.message || err;
        console.log("ERROR:", msg);
        res.send({
            error: msg
        });
    });

});

function dbGeoParse(data) {
    return new Promise(function (resolve, reject) {
        dbgeo.parse({
            data: data,
            outputFormat: 'topojson',
            geometryColumn: 'geom',
            geometryType: 'wkb'
        }, function (err, result) {
            if (err) {
                reject(err);
            } else {
                resolve(result);
            }
        });
    });
}

//start the server
app.listen(port);
console.log('postgis-preview is listening on port ' + port + '...');


text:
<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <meta name="keywords" content="W3C SVG 1.1 Test Suite testsuite mobile"/>
 <meta name="description" content="W3C SVG 1.2 Tiny Test Suite"/>
 <title>
SVG 1.2 Tiny test:media-audio-205-t </title>

Tiny version

Specification link: 12.2 The 'audio' element

    media-audio-204-t ←
    index
    → media-audio-206-t

media-audio-205-t

							SVG Image

							PNG Image

   	    		  			<object data="../svggen/media-audio-205-t.svg" width="480" height="360" type="image/svg+xml">
FAIL
</object>

        An audio element has a begin attribute of 3 seconds.

        To pass the audio media file should play 3 seconds after loading the svg file.

        If the user agent does not support the WAV media format, the test is still a pass.

				media-audio-204-t ←
				index
				→ media-audio-206-t


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _MapLayer2 = require('./MapLayer');

var _MapLayer3 = _interopRequireDefault(_MapLayer2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var BaseTileLayer = function (_MapLayer) {
  _inherits(BaseTileLayer, _MapLayer);

  function BaseTileLayer() {
    _classCallCheck(this, BaseTileLayer);

    return _possibleConstructorReturn(this, Object.getPrototypeOf(BaseTileLayer).apply(this, arguments));
  }

  _createClass(BaseTileLayer, [{
    key: 'componentDidUpdate',
    value: function componentDidUpdate(prevProps) {
      var _props = this.props;
      var opacity = _props.opacity;
      var zIndex = _props.zIndex;

      if (opacity && opacity !== prevProps.opacity) {
        this.leafletElement.setOpacity(opacity);
      }
      if (zIndex && zIndex !== prevProps.zIndex) {
        this.leafletElement.setZIndex(zIndex);
      }
    }
  }, {
    key: 'render',
    value: function render() {
      return null;
    }
  }]);

  return BaseTileLayer;
}(_MapLayer3.default);

BaseTileLayer.propTypes = {
  opacity: _react.PropTypes.number,
  zIndex: _react.PropTypes.number
};
exports.default = BaseTileLayer;


text:
last_is_void = false
ARGF.each do |line|
  case line
  when /\A\s*\z/, /\A\#/
    puts unless last_is_void
    last_is_void = true
  else
    print line
    last_is_void = false
  end
end


text:
package controllers

import (
	"github.com/kataras/iris/v12/_examples/mvc/login/datamodels"
	"github.com/kataras/iris/v12/_examples/mvc/login/services"

	"github.com/kataras/iris/v12"
)

// UsersController is our /users API controller.
// GET				/users  | get all
// GET				/users/{id:int64} | get by id
// PUT				/users/{id:int64} | update by id
// DELETE			/users/{id:int64} | delete by id
// Requires basic authentication.
type UsersController struct {
	// Optionally: context is auto-binded by Iris on each request,
	// remember that on each incoming request iris creates a new UserController each time,
	// so all fields are request-scoped by-default, only dependency injection is able to set
	// custom fields like the Service which is the same for all requests (static binding).
	Ctx iris.Context

	// Our UserService, it's an interface which
	// is binded from the main application.
	Service services.UserService
}

// Get returns list of the users.
// Demo:
// curl -i -u admin:password http://localhost:8080/users
//
// The correct way if you have sensitive data:
//
//	func (c *UsersController) Get() (results []viewmodels.User) {
//		data := c.Service.GetAll()
//
//		for _, user := range data {
//			results = append(results, viewmodels.User{user})
//		}
//		return
//	}
//
// otherwise just return the datamodels.
func (c *UsersController) Get() (results []datamodels.User) {
	return c.Service.GetAll()
}

// GetBy returns a user.
// Demo:
// curl -i -u admin:password http://localhost:8080/users/1
func (c *UsersController) GetBy(id int64) (user datamodels.User, found bool) {
	u, found := c.Service.GetByID(id)
	if !found {
		// this message will be binded to the
		// main.go -> app.OnAnyErrorCode -> NotFound -> shared/error.html -> .Message text.
		c.Ctx.Values().Set("message", "User couldn't be found!")
	}
	return u, found // it will throw/emit 404 if found == false.
}

// PutBy updates a user.
// Demo:
// curl -i -X PUT -u admin:password -F "username=kataras"
// -F "password=rawPasswordIsNotSafeIfOrNotHTTPs_You_Should_Use_A_client_side_lib_for_hash_as_well"
// http://localhost:8080/users/1
func (c *UsersController) PutBy(id int64) (datamodels.User, error) {
	// username := c.Ctx.FormValue("username")
	// password := c.Ctx.FormValue("password")
	u := datamodels.User{}
	if err := c.Ctx.ReadForm(&u); err != nil {
		return u, err
	}

	return c.Service.Update(id, u)
}

// DeleteBy deletes a user.
// Demo:
// curl -i -X DELETE -u admin:password http://localhost:8080/users/1
func (c *UsersController) DeleteBy(id int64) interface{} {
	wasDel := c.Service.DeleteByID(id)
	if wasDel {
		// return the deleted user's ID
		return map[string]interface{}{"deleted": id}
	}
	// right here we can see that a method function
	// can return any of those two types(map or int),
	// we don't have to specify the return type to a specific type.
	return iris.StatusBadRequest // same as 400.
}


text:
@echo off

if "%JAVA_HOME%" == "" goto nojava

set CLASSPATH=.\classes

echo CLASSPATH:%CLASSPATH%
echo JAVA_HOME:%JAVA_HOME%

%JAVA_HOME%\bin\java -cp %CLASSPATH% org.tp23.demo.Demonstration

goto end

:nojava
echo Set JAVA_HOME environment variable
goto end

:end


text:
require "rails_helper"

module Clockface
  RSpec.describe RootController, type: :controller do
    routes { Clockface::Engine.routes }

    describe "GET #index" do
      it "should blindly redirect to the events path" do
        get :index
        expect(response).to redirect_to(events_path)
      end
    end
  end
end


text:
namespace alarms = extensions::api::alarms;

namespace extensions {

namespace {

const char kDefaultAlarmName[] = "";
const char kAlarmNotFound[] = "No alarm named '*' exists.";
const char kBothRelativeAndAbsoluteTime[] =
    "Cannot set both when and delayInMinutes.";
const char kNoScheduledTime[] =
    "Must set at least one of when, delayInMinutes, or periodInMinutes.";
const int kReleaseDelayMinimum = 1;
const int kDevDelayMinimum = 0;

bool ValidateAlarmCreateInfo(const std::string& alarm_name,
                             const alarms::AlarmCreateInfo& create_info,
                             const Extension* extension,
                             std::string* error,
                             std::vector<std::string>* warnings) {
  if (create_info.delay_in_minutes.get() &&
      create_info.when.get()) {
    *error = kBothRelativeAndAbsoluteTime;
    return false;
  }
  if (create_info.delay_in_minutes == NULL &&
      create_info.when == NULL &&
      create_info.period_in_minutes == NULL) {
    *error = kNoScheduledTime;
    return false;
  }

  // Users can always use an absolute timeout to request an arbitrarily-short or
  // negative delay.  We won't honor the short timeout, but we can't check it
  // and warn the user because it would introduce race conditions (say they
  // compute a long-enough timeout, but then the call into the alarms interface
  // gets delayed past the boundary).  However, it's still worth warning about
  // relative delays that are shorter than we'll honor.
  if (create_info.delay_in_minutes.get()) {
    if (*create_info.delay_in_minutes < kReleaseDelayMinimum) {
      COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below);
      if (extension->location() == Manifest::LOAD)
        warnings->push_back(ErrorUtils::FormatErrorMessage(
            "Alarm delay is less than minimum of 1 minutes."
            " In released .crx, alarm \"*\" will fire in approximately"
            " 1 minutes.",
            alarm_name));
      else
        warnings->push_back(ErrorUtils::FormatErrorMessage(
            "Alarm delay is less than minimum of 1 minutes."
            " Alarm \"*\" will fire in approximately 1 minutes.",
            alarm_name));
    }
  }
  if (create_info.period_in_minutes.get()) {
    if (*create_info.period_in_minutes < kReleaseDelayMinimum) {
      COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below);
      if (extension->location() == Manifest::LOAD)
        warnings->push_back(ErrorUtils::FormatErrorMessage(
            "Alarm period is less than minimum of 1 minutes."
            " In released .crx, alarm \"*\" will fire approximately"
            " every 1 minutes.",
            alarm_name));
      else
        warnings->push_back(ErrorUtils::FormatErrorMessage(
            "Alarm period is less than minimum of 1 minutes."
            " Alarm \"*\" will fire approximately every 1 minutes.",
            alarm_name));
    }
  }

  return true;
}

}  // namespace

AlarmsCreateFunction::AlarmsCreateFunction()
    : clock_(new base::DefaultClock()), owns_clock_(true) {}

AlarmsCreateFunction::AlarmsCreateFunction(base::Clock* clock)
    : clock_(clock), owns_clock_(false) {}

AlarmsCreateFunction::~AlarmsCreateFunction() {
  if (owns_clock_)
    delete clock_;
}

bool AlarmsCreateFunction::RunImpl() {
  scoped_ptr<alarms::Create::Params> params(
      alarms::Create::Params::Create(*args_));
  EXTENSION_FUNCTION_VALIDATE(params.get());
  const std::string& alarm_name =
      params->name.get() ? *params->name : kDefaultAlarmName;
  std::vector<std::string> warnings;
  if (!ValidateAlarmCreateInfo(
          alarm_name, params->alarm_info, GetExtension(), &error_, &warnings))
    return false;
  for (std::vector<std::string>::const_iterator it = warnings.begin();
       it != warnings.end(); ++it)
    WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_WARNING, *it);

  Alarm alarm(alarm_name,
              params->alarm_info,
              base::TimeDelta::FromMinutes(
                  GetExtension()->location() == Manifest::LOAD ?
                  kDevDelayMinimum : kReleaseDelayMinimum),
              clock_->Now());
  ExtensionSystem::Get(profile())->alarm_manager()->AddAlarm(
      extension_id(), alarm);

  return true;
}

bool AlarmsGetFunction::RunImpl() {
  scoped_ptr<alarms::Get::Params> params(alarms::Get::Params::Create(*args_));
  EXTENSION_FUNCTION_VALIDATE(params.get());

  std::string name = params->name.get() ? *params->name : kDefaultAlarmName;
  const Alarm* alarm =
      ExtensionSystem::Get(profile())->alarm_manager()->GetAlarm(
          extension_id(), name);

  if (!alarm) {
    error_ = ErrorUtils::FormatErrorMessage(kAlarmNotFound, name);
    return false;
  }

  results_ = alarms::Get::Results::Create(*alarm->js_alarm);
  return true;
}

bool AlarmsGetAllFunction::RunImpl() {
  const AlarmManager::AlarmList* alarms =
      ExtensionSystem::Get(profile())->alarm_manager()->GetAllAlarms(
          extension_id());
  if (alarms) {
    std::vector<linked_ptr<extensions::api::alarms::Alarm> > create_arg;
    create_arg.reserve(alarms->size());
    for (size_t i = 0, size = alarms->size(); i < size; ++i) {
      create_arg.push_back((*alarms)[i].js_alarm);
    }
    results_ = alarms::GetAll::Results::Create(create_arg);
  } else {
    SetResult(new base::ListValue());
  }
  return true;
}

bool AlarmsClearFunction::RunImpl() {
  scoped_ptr<alarms::Clear::Params> params(
      alarms::Clear::Params::Create(*args_));
  EXTENSION_FUNCTION_VALIDATE(params.get());

  std::string name = params->name.get() ? *params->name : kDefaultAlarmName;
  bool success = ExtensionSystem::Get(profile())->alarm_manager()->RemoveAlarm(
     extension_id(), name);

  if (!success) {
    error_ = ErrorUtils::FormatErrorMessage(kAlarmNotFound, name);
    return false;
  }

  return true;
}

bool AlarmsClearAllFunction::RunImpl() {
  ExtensionSystem::Get(profile())->alarm_manager()->RemoveAllAlarms(
     extension_id());
  return true;
}

}  // namespace extensions


text:
module RIO
  module FS
    class Base
    end
  end
end


text:
<?php

/**
 * The "inspectTemplates" collection of methods.
 * Typical usage is:
 *  <code>
 *   $dlpService = new Google_Service_DLP(...);
 *   $inspectTemplates = $dlpService->inspectTemplates;
 *  </code>
 */
class Google_Service_DLP_Resource_ProjectsLocationsInspectTemplates extends Google_Service_Resource
{
  /**
   * Creates an InspectTemplate for re-using frequently used configuration for
   * inspecting content, images, and storage. See
   * https://cloud.google.com/dlp/docs/creating-templates to learn more.
   * (inspectTemplates.create)
   *
   * @param string $parent Required. Parent resource name. The format of this
   * value varies depending on the scope of the request (project or organization)
   * and whether you have [specified a processing location](/dlp/docs/specifying-
   * location): + Projects scope, location specified:
   * `projects/`PROJECT_ID`/locations/`LOCATION_ID + Projects scope, no location
   * specified (defaults to global): `projects/`PROJECT_ID + Organizations scope,
   * location specified: `organizations/`ORG_ID`/locations/`LOCATION_ID +
   * Organizations scope, no location specified (defaults to global):
   * `organizations/`ORG_ID The following example `parent` string specifies a
   * parent project with the identifier `example-project`, and specifies the
   * `europe-west3` location for processing data: parent=projects/example-
   * project/locations/europe-west3
   * @param Google_Service_DLP_GooglePrivacyDlpV2CreateInspectTemplateRequest $postBody
   * @param array $optParams Optional parameters.
   * @return Google_Service_DLP_GooglePrivacyDlpV2InspectTemplate
   */
  public function create($parent, Google_Service_DLP_GooglePrivacyDlpV2CreateInspectTemplateRequest $postBody, $optParams = array())
  {
    $params = array('parent' => $parent, 'postBody' => $postBody);
    $params = array_merge($params, $optParams);
    return $this->call('create', array($params), "Google_Service_DLP_GooglePrivacyDlpV2InspectTemplate");
  }
  /**
   * Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-
   * templates to learn more. (inspectTemplates.delete)
   *
   * @param string $name Required. Resource name of the organization and
   * inspectTemplate to be deleted, for example
   * `organizations/433245324/inspectTemplates/432452342` or projects/project-
   * id/inspectTemplates/432452342.
   * @param array $optParams Optional parameters.
   * @return Google_Service_DLP_GoogleProtobufEmpty
   */
  public function delete($name, $optParams = array())
  {
    $params = array('name' => $name);
    $params = array_merge($params, $optParams);
    return $this->call('delete', array($params), "Google_Service_DLP_GoogleProtobufEmpty");
  }
  /**
   * Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-
   * templates to learn more. (inspectTemplates.get)
   *
   * @param string $name Required. Resource name of the organization and
   * inspectTemplate to be read, for example
   * `organizations/433245324/inspectTemplates/432452342` or projects/project-
   * id/inspectTemplates/432452342.
   * @param array $optParams Optional parameters.
   * @return Google_Service_DLP_GooglePrivacyDlpV2InspectTemplate
   */
  public function get($name, $optParams = array())
  {
    $params = array('name' => $name);
    $params = array_merge($params, $optParams);
    return $this->call('get', array($params), "Google_Service_DLP_GooglePrivacyDlpV2InspectTemplate");
  }
  /**
   * Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-
   * templates to learn more.
   * (inspectTemplates.listProjectsLocationsInspectTemplates)
   *
   * @param string $parent Required. Parent resource name. The format of this
   * value varies depending on the scope of the request (project or organization)
   * and whether you have [specified a processing location](/dlp/docs/specifying-
   * location): + Projects scope, location specified:
   * `projects/`PROJECT_ID`/locations/`LOCATION_ID + Projects scope, no location
   * specified (defaults to global): `projects/`PROJECT_ID + Organizations scope,
   * location specified: `organizations/`ORG_ID`/locations/`LOCATION_ID +
   * Organizations scope, no location specified (defaults to global):
   * `organizations/`ORG_ID The following example `parent` string specifies a
   * parent project with the identifier `example-project`, and specifies the
   * `europe-west3` location for processing data: parent=projects/example-
   * project/locations/europe-west3
   * @param array $optParams Optional parameters.
   *
   * @opt_param string orderBy Comma separated list of fields to order by,
   * followed by `asc` or `desc` postfix. This list is case-insensitive, default
   * sorting order is ascending, redundant space characters are insignificant.
   * Example: `name asc,update_time, create_time desc` Supported fields are: -
   * `create_time`: corresponds to time the template was created. - `update_time`:
   * corresponds to time the template was last updated. - `name`: corresponds to
   * template's name. - `display_name`: corresponds to template's display name.
   * @opt_param int pageSize Size of the page, can be limited by server. If zero
   * server returns a page of max size 100.
   * @opt_param string pageToken Page token to continue retrieval. Comes from
   * previous call to `ListInspectTemplates`.
   * @opt_param string locationId Deprecated. This field has no effect.
   * @return Google_Service_DLP_GooglePrivacyDlpV2ListInspectTemplatesResponse
   */
  public function listProjectsLocationsInspectTemplates($parent, $optParams = array())
  {
    $params = array('parent' => $parent);
    $params = array_merge($params, $optParams);
    return $this->call('list', array($params), "Google_Service_DLP_GooglePrivacyDlpV2ListInspectTemplatesResponse");
  }
  /**
   * Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-
   * templates to learn more. (inspectTemplates.patch)
   *
   * @param string $name Required. Resource name of organization and
   * inspectTemplate to be updated, for example
   * `organizations/433245324/inspectTemplates/432452342` or projects/project-
   * id/inspectTemplates/432452342.
   * @param Google_Service_DLP_GooglePrivacyDlpV2UpdateInspectTemplateRequest $postBody
   * @param array $optParams Optional parameters.
   * @return Google_Service_DLP_GooglePrivacyDlpV2InspectTemplate
   */
  public function patch($name, Google_Service_DLP_GooglePrivacyDlpV2UpdateInspectTemplateRequest $postBody, $optParams = array())
  {
    $params = array('name' => $name, 'postBody' => $postBody);
    $params = array_merge($params, $optParams);
    return $this->call('patch', array($params), "Google_Service_DLP_GooglePrivacyDlpV2InspectTemplate");
  }
}


text:
This application makes use of the following third party libraries:

## Firebase

Copyright 2016 Google Inc.

## FirebaseAnalytics

Copyright 2016 Google Inc.

## FirebaseAuth

Copyright 2016 Google Inc. All Rights Reserved.

## FirebaseInstanceID

Copyright 2016 Google Inc.

## GoogleInterchangeUtilities

Copyright 2015 Google Inc.

## GoogleNetworkingUtilities

Copyright 2015 Google Inc.

## GoogleSymbolUtilities

Copyright 2015 Google Inc.

## GoogleUtilities

Copyright 2015 Google Inc.

## ObjectMapper

The MIT License (MIT)
Copyright (c) 2014 Hearst

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

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

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

Generated by CocoaPods - https://cocoapods.org