text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="@dimen/aipay_margin_vertical"
    android:layout_marginLeft="@dimen/aipay_margin_horizontal"
    android:layout_marginRight="@dimen/aipay_margin_horizontal"
    android:layout_marginTop="@dimen/aipay_margin_vertical"
    android:background="@drawable/aipay_bg" >

    <include
        android:id="@+id/v_title_bar_aipay"
        layout="@layout/aipay_title_bar" />

    <RelativeLayout
        android:id="@+id/rl_feeinfo_aipay"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/v_title_bar_aipay"
        android:background="@color/aipay_exctra_info_bg" >

        <TextView
            android:id="@+id/tv_appname_aipay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="12dp"
            android:layout_marginTop="20dp"
            android:textColor="@color/aipay_black_1"
            android:textSize="18sp" />

        <TextView
            android:id="@+id/tv_wares_name_aipay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/tv_appname_aipay"
            android:layout_marginBottom="20dp"
            android:layout_marginLeft="12dp"
            android:layout_marginTop="15dp"
            android:textColor="@color/aipay_black_1"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/tv_price_aipay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginRight="12dp"
            android:layout_marginTop="20dp"
            android:textColor="@color/aipay_orange"
            android:textSize="18sp" />

        <LinearLayout
            android:id="@+id/ll_feeinfo_aipay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/tv_price_aipay"
            android:layout_marginBottom="20dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="12dp"
            android:layout_marginTop="15dp"
            android:gravity="bottom"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/tv_feetype_aipay"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/aipay_black_1"
                android:textSize="12sp" />

            <ImageView
                android:id="@+id/iv_more_feeinfo_aipay"
                android:layout_width="12dp"
                android:layout_height="12dp"
                android:contentDescription="@null"
                android:scaleType="fitXY"
                android:src="@drawable/aipay_more_feeinfo" />
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_below="@+id/ll_feeinfo_aipay" />
    </RelativeLayout>

    <View
        android:id="@+id/v_divider_aipay"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/rl_feeinfo_aipay"
        android:background="#d2dbe6" />

    <ListView
        android:id="@+id/ll_paytype_aipay"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/v_divider_aipay"
        android:cacheColorHint="#00000000"
        android:divider="@color/aipay_divider_line"
        android:dividerHeight="1px"
        android:fadeScrollbars="false"
        android:fadingEdge="none"
        android:listSelector="@drawable/aipay_list_item_selector"
        android:scrollbarThumbVertical="@drawable/aipay_scrollbar" />

    <TextView
        android:id="@+id/tv_more_aipay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/ll_paytype_aipay"
        android:layout_marginRight="12dp"
        android:layout_marginTop="15dp"
        android:drawablePadding="4dp"
        android:drawableRight="@drawable/aipay_more"
        android:text="更多支付方式"
        android:textColor="@color/aipay_black_1"
        android:textSize="16sp"
        android:visibility="gone" />

    <LinearLayout
        android:id="@+id/ll_notice_aipay"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_alignParentBottom="true"
        android:background="#7f000000"
        android:gravity="center_vertical"
        android:orientation="horizontal"
               android:clickable="true"
        android:visibility="gone" >

        <com.iapppay.ui.MarqueeTextView
            android:id="@+id/tv_notice_aipay"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_weight="1"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:singleLine="true"

            android:textColor="@color/aipay_white"
            android:textSize="13sp"/>

        <ImageView
            android:id="@+id/iv_notice_del_aipay"
            android:layout_width="28dp"
            android:layout_height="match_parent"
            android:layout_gravity="center|right"
            android:layout_marginLeft="10dp"
            android:contentDescription="@null"
            android:scaleType="center"
            android:src="@drawable/aipay_del_selector" />
    </LinearLayout>

</RelativeLayout>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestCase.Model.Membership;
using TestCase.Model.Security;

namespace TestCase.Model.Locking
{
    /// <summary>
    /// Lock permission policy model.
    /// </summary>
    public class LockPermissionPolicy
    {
        /// <summary>
        /// Gets or sets the identifier.
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// Gets or sets the date created.
        /// </summary>
        public DateTime DateCreated { get; set; }

        /// <summary>
        /// Gets or sets the date updated.
        /// </summary>
        public DateTime DateUpdated { get; set; }

        /// <summary>
        /// Gets or sets the lock identifier.
        /// </summary>
        public Guid LockId { get; set; }

        /// <summary>
        /// Gets or sets the lock.
        /// </summary>
        public Lock Lock { get; set; }

        /// <summary>
        /// Gets or sets the permission identifier.
        /// </summary>
        public Guid PermissionId { get; set; }

        /// <summary>
        /// Gets or sets the permission.
        /// </summary>
        public Permission Permission { get; set; }

        /// <summary>
        /// Gets or sets the user identifier.
        /// </summary>
        public Guid? UserId { get; set; }

        /// <summary>
        /// Gets or sets the user.
        /// </summary>
        public User User { get; set; }

        /// <summary>
        /// Gets or sets the role identifier.
        /// </summary>
        public Guid? RoleId { get; set; }

        /// <summary>
        /// Gets or sets the role.
        /// </summary>
        public Role Role { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
// Include required library files.
require_once('../includes/config.php');
require_once('../autoload.php');

// Create PayPal object.
$PayPalConfig = array(
					  'Sandbox' => $sandbox,
					  'DeveloperAccountEmail' => $developer_account_email,
					  'ApplicationID' => $application_id,
					  'DeviceID' => $device_id,
					  'IPAddress' => $_SERVER['REMOTE_ADDR'],
					  'APIUsername' => $api_username,
					  'APIPassword' => $api_password,
					  'APISignature' => $api_signature,
					  'APISubject' => $api_subject,
					  'PrintHeaders' => $print_headers,
					  'LogResults' => $log_results,
					  'LogPath' => $log_path,
					);

$PayPal = new angelleye\PayPal\Adaptive($PayPalConfig);

// Prepare request arrays
$PreapprovalDetailsFields = array(
								  'GetBillingAddress' => '', 									// Opion to get the billing address in the response.  true or false.  Only available with Advanced permissions levels.
								  'PreapprovalKey' => '' 										// Required.  A preapproval key that identifies the preapproval for which you want to retrieve details.  Returned in the PreapprovalResponse
								  );

$PayPalRequestData = array(
					 'PreapprovalDetailsFields' => $PreapprovalDetailsFields
					 );

// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$PayPalResult = $PayPal->PreapprovalDetails($PayPalRequestData);

// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($PayPalResult);
?>


text:
package io.realm.internal;

import java.io.Closeable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Nullable;

import io.realm.RealmChangeListener;

/**
 * This interface needs to be implemented by Java and pass to Realm Object Store in order to get notifications when
 * other thread/process changes the Realm file.
 */
@Keep
public abstract class RealmNotifier implements Closeable {

// Calling sequences for a remote commit
// |-------------------------------+--------------+-----------------------------------|
// | Thread A                      | Thread B     | Daemon Thread                     |
// |-------------------------------+--------------+-----------------------------------|
// |                               | Make changes |                                   |
// |-------------------------------+--------------+-----------------------------------|
// |                               |              | epoll callback and notify ALooper |
// |-------------------------------+--------------+-----------------------------------|
// | ALooper callback              |              |                                   |
// | BindingContext::before_notify |              |                                   |
// | RealmNotifier.beforeNotify    |              |                                   |
// | BindingContext::did_change    |              |                                   |
// | RealmNotifier.didChange       |              |                                   |
// | process_available_async       |              |                                   |
// | Collection listeners          |              |                                   |
// |-------------------------------+--------------+-----------------------------------|

    private static class RealmObserverPair<T> extends ObserverPairList.ObserverPair<T, RealmChangeListener<T>> {
        public RealmObserverPair(T observer, RealmChangeListener<T> listener) {
            super(observer, listener);
        }

        private void onChange(T observer) {
            //noinspection ConstantConditions
            if (observer != null) {
                listener.onChange(observer);
            }
        }
    }

    private ObserverPairList<RealmObserverPair> realmObserverPairs = new ObserverPairList<RealmObserverPair>();
    private final ObserverPairList.Callback<RealmObserverPair> onChangeCallBack =
            new ObserverPairList.Callback<RealmObserverPair>() {
                @Override
                public void onCalled(RealmObserverPair pair, Object observer) {
                    //noinspection unchecked
                    if (sharedRealm != null && !sharedRealm.isClosed()) {
                        pair.onChange(observer);
                    }
                }
            };

    protected RealmNotifier(@Nullable OsSharedRealm sharedRealm) {
        this.sharedRealm = sharedRealm;
    }

    private OsSharedRealm sharedRealm;
    // TODO: The only reason we have this is that async transactions is not supported by OS yet. And OS is using ALopper
    // which will be using a different message queue from which java is using to deliver remote Realm changes message.
    // We need a way to deliver the async transaction onSuccess callback to the caller thread after the caller Realm
    // advanced. This is implemented by posting the callback by RealmNotifier.post() first, and check the realm version
    // in the posted Runnable. If the Realm version there is still behind the async transaction we committed, the
    // onSuccess callback will be added to this list and be executed later when we get the change event from OS.
    // This list is NOT supposed to be thread safe!
    private List<Runnable> transactionCallbacks = new ArrayList<Runnable>();

    // Called from JavaBindingContext::did_change.
    // This will be called in the caller thread when:
    // - A committed remote transaction, called from changed event handler.
    // - A committed remote transaction, called directly from refresh call.
    // - A committed local transaction, called directly from commitTransaction instead of next event.
    //   loop.
    // Package protected to avoid finding class by name in JNI.
    @SuppressWarnings("unused")
    // called from java_binding_context.cpp
    void didChange() {
        realmObserverPairs.foreach(onChangeCallBack);

        if (!transactionCallbacks.isEmpty()) {
            // The callback list needs to be cleared before calling to avoid synchronized transactions in the callback
            // triggers it recursively.
            List<Runnable> callbacks = transactionCallbacks;
            transactionCallbacks = new ArrayList<Runnable>();
            for (Runnable runnable : callbacks) {
                runnable.run();
            }
        }
    }

    // Called from JavaBindingContext::before_notify.
    // This will be called in the caller thread when:
    // 1. Get changed notification by this/other Realm instances.
    // 2. OsSharedRealm::refresh called.
    // In both cases, this will be called before the any other callbacks (changed callbacks, async query callbacks.).
    // Package protected to avoid finding class by name in JNI.
    @SuppressWarnings("unused")
    void beforeNotify() {
        // For the stable iteration.
        sharedRealm.invalidateIterators();
    }

    /**
     * Called when close OsSharedRealm to clean up any event left in to queue.
     */
    @Override
    public void close() {
        removeAllChangeListeners();
    }

    public <T> void addChangeListener(T observer, RealmChangeListener<T> realmChangeListener) {
        RealmObserverPair observerPair = new RealmObserverPair<T>(observer, realmChangeListener);
        realmObserverPairs.add(observerPair);
    }

    public <E> void removeChangeListener(E observer, RealmChangeListener<E> realmChangeListener) {
        realmObserverPairs.remove(observer, realmChangeListener);
    }

    public <E> void removeChangeListeners(E observer) {
        realmObserverPairs.removeByObserver(observer);
    }

    // Since RealmObject is using this notifier as well, use removeChangeListeners to remove all listeners by the given
    // observer.
    private void removeAllChangeListeners() {
        realmObserverPairs.clear();
    }

    public void addTransactionCallback(Runnable runnable) {
        transactionCallbacks.add(runnable);
    }

    /**
     * For current implementation of async transaction only. See comments for {@link #transactionCallbacks}.
     *
     * @param runnable to be executed in the following event loop.
     */
    public abstract boolean post(Runnable runnable);

    public int getListenersListSize() {
        return realmObserverPairs.size();
    }
}


text:
package com.twitter.finagle.netty4.http

import com.twitter.finagle.dispatch.ClientDispatcher.wrapWriteException
import com.twitter.finagle.http._
import com.twitter.finagle.netty4.ByteBufConversion
import com.twitter.finagle.transport.Transport
import com.twitter.io.Pipe
import com.twitter.io.Reader
import com.twitter.io.ReaderDiscardedException
import com.twitter.io.StreamTermination
import com.twitter.util._
import io.netty.handler.codec.http._
import java.net.InetSocketAddress

private[http] object Netty4StreamTransport {

  /**
   * Collate [[Transport]] messages into a [[Reader]]. Processing terminates when an
   * EOS message arrives.
   */
  def streamIn(trans: Transport[Any, Any]): Reader[Chunk] with Future[Unit] =
    new Promise[Unit] with Reader[Chunk] {

      private[this] val pipe = new Pipe[Chunk]

      private def copyLoop(): Future[Unit] =
        trans.read().flatMap {
          case chunk: LastHttpContent =>
            val last =
              if (!chunk.content.isReadable && chunk.trailingHeaders().isEmpty)
                Chunk.lastEmpty
              else
                Chunk.last(
                  ByteBufConversion.byteBufAsBuf(chunk.content()),
                  Bijections.netty.headersToFinagle(chunk.trailingHeaders())
                )

            pipe.write(last)

          case chunk: HttpContent =>
            val cons = Chunk(ByteBufConversion.byteBufAsBuf(chunk.content))
            pipe.write(cons).before(copyLoop())

          case other =>
            Future.exception(
              new IllegalArgumentException(
                "Expected a HttpContent, but read an instance of " + other.getClass.getSimpleName
              ))
        }

      // Ensure that collate's future is satisfied _before_ its reader
      // is closed. This allows callers to observe the stream completion
      // before readers are notified.
      private[this] val writes = copyLoop()

      forwardInterruptsTo(writes)

      writes.respond {
        case ret @ Throw(t) =>
          updateIfEmpty(ret)
          pipe.fail(t)
        case r @ Return(_) =>
          updateIfEmpty(r)
          pipe.close()
      }

      def read(): Future[Option[Chunk]] = pipe.read()

      def discard(): Unit = {
        // The order in which these two are running matters. We want to fail the underlying transport
        // before we discard the user-facing reader, thereby releasing the connection in the stack.
        // If we do these in the reverse order, the connection that's about to get failed, becomes
        // available for reuse.
        raise(new ReaderDiscardedException)
        pipe.discard()
      }

      def onClose: Future[StreamTermination] = pipe.onClose
    }

  /**
   * Drain a [[Reader]] into a [[Transport]]. The inverse of collation.
   */
  def streamOut(
    trans: Transport[Any, Any],
    r: Reader[Chunk],
    contentLength: Option[Long]
  ): Future[Unit] = {

    // A helper to ensure that we don't send netty more (or less) data that the
    // content-length header requires.
    def verifyContentLength(chunk: Option[Chunk], written: Long): Unit = contentLength match {
      case None => // nop: we don't have a content-length header so no constraints
      case Some(contentLength) =>
        chunk match {
          // Short write case: the reader doesn't contain as much data is its
          // content-length header advertised which is an illegal message. We
          // handle this by surfacing an exception that will close the channel.
          case None if contentLength != written =>
            r.discard()
            throw new IllegalStateException(
              s"HTTP stream terminated before enough content was written. " +
                s"Provided content length: ${contentLength}, observed: $written.")

          // Attempting to write trailers which don't honor the content-length
          // header, either too little or too much data.
          case Some(chunk) if chunk.isLast && chunk.content.length + written != contentLength =>
            r.discard()
            throw new IllegalStateException(
              s"HTTP stream terminated with incorrect amount of data written. " +
                s"Provided content length: ${contentLength}, observed: ${chunk.content.length + written}.")

          // Attempting to write a chunk that overflows the length
          // dictated by the content-length header
          case Some(chunk) if contentLength < written + chunk.content.length =>
            r.discard()
            throw new IllegalStateException(
              s"HTTP stream attempted to write more data than the content-length header allows. " +
                s"Provided content length: ${contentLength}, observed (so far): ${written + chunk.content.length}")

          case _ => // nop: nothing illegal observed with this chunk.
        }
    }

    def continue(written: Long): Future[Unit] = r.read().flatMap { chunk =>
      verifyContentLength(chunk, written)
      chunk match {
        case None =>
          trans.write(LastHttpContent.EMPTY_LAST_CONTENT)

        case Some(chunk) if chunk.isLast =>
          terminate(chunk)

        case Some(chunk) =>
          trans
            .write(
              new DefaultHttpContent(ByteBufConversion.bufAsByteBuf(chunk.content))
            ).before(continue(written + chunk.content.length))
      }
    }

    // We need to read one more time before writing last chunk to ensure the stream isn't malformed.
    def terminate(last: Chunk): Future[Unit] = r.read().flatMap {
      case None =>
        // TODO (vk): PR against Netty; we need to construct out of given Headers so we avoid
        // copying afterwards.

        if (last.content.isEmpty && last.trailers.isEmpty) {
          trans.write(LastHttpContent.EMPTY_LAST_CONTENT)
        } else {
          val contentAndTrailers = new DefaultLastHttpContent(
            ByteBufConversion.bufAsByteBuf(last.content),
            false /*validateHeaders*/
          )

          if (!last.trailers.isEmpty) {
            Bijections.finagle
              .writeFinagleHeadersToNetty(last.trailers, contentAndTrailers.trailingHeaders())
          }

          trans.write(contentAndTrailers)
        }

      case _ =>
        Future.exception(
          new IllegalStateException("HTTP stream is malformed: only EOS can follow trailers")
        )
    }

    // Begin the loop.
    continue(written = 0L)
  }
}

private[finagle] class Netty4ServerStreamTransport(rawTransport: Transport[Any, Any])
    extends StreamTransportProxy[Response, Request](rawTransport) {
  import Netty4StreamTransport._

  private[this] val transport =
    Transport.cast[HttpResponse, HttpRequest](rawTransport)

  def write(in: Response): Future[Unit] = {
    val nettyRep =
      if (in.isChunked)
        Bijections.finagle.chunkedResponseToNetty(in)
      else
        Bijections.finagle.fullResponseToNetty(in)

    transport.write(nettyRep).transform {
      case Throw(exc) =>
        wrapWriteException(exc)
      case Return(_) =>
        if (in.isChunked) streamOut(rawTransport, in.chunkReader, in.contentLength)
        else Future.Done
    }
  }

  def read(): Future[Multi[Request]] = {
    transport.read().flatMap {
      case req: FullHttpRequest =>
        val finagleReq = Bijections.netty.fullRequestToFinagle(
          req,
          // We have to match/cast as remoteAddress is stored as SocketAddress but Request's
          // constructor expects InetSocketAddress. In practice, this is always a successful match
          // given all our transports operate on inet addresses.
          transport.context.remoteAddress match {
            case ia: InetSocketAddress => ia
            case _ => new InetSocketAddress(0)
          }
        )
        Future.value(Multi(finagleReq, Future.Done))

      case req: HttpRequest =>
        assert(!req.isInstanceOf[HttpContent]) // chunks are handled via collation

        val coll = streamIn(rawTransport)
        val finagleReq = Bijections.netty.chunkedRequestToFinagle(
          req,
          coll,
          // We have to match/cast as remoteAddress is stored as SocketAddress but Request's
          // constructor expects InetSocketAddress. In practice, this is always a successful match
          // given all our transports operate on inet addresses.
          transport.context.remoteAddress match {
            case ia: InetSocketAddress => ia
            case _ => new InetSocketAddress(0)
          }
        )
        Future.value(Multi(finagleReq, coll))

      case invalid =>
        // relies on GenSerialClientDispatcher satisfying `p`
        Future.exception(new IllegalArgumentException(s"invalid message '$invalid'"))
    }
  }
}

private[finagle] class Netty4ClientStreamTransport(rawTransport: Transport[Any, Any])
    extends StreamTransportProxy[Request, Response](rawTransport) {
  import Netty4StreamTransport._

  def write(in: Request): Future[Unit] = {
    val contentLengthHeader = in.contentLength
    val nettyReq = Bijections.finagle.requestToNetty(in, contentLengthHeader)
    rawTransport.write(nettyReq).transform {
      case Throw(exc) =>
        wrapWriteException(exc)
      case Return(_) =>
        if (in.isChunked) streamOut(rawTransport, in.chunkReader, contentLengthHeader)
        else Future.Done
    }
  }

  def read(): Future[Multi[Response]] = {
    rawTransport.read().flatMap {
      // fully buffered message
      case rep: FullHttpResponse =>
        val finagleRep: Response = Bijections.netty.fullResponseToFinagle(rep)
        Future.value(Multi(finagleRep, Future.Done))

      // chunked message, collate the transport
      case rep: HttpResponse =>
        assert(!rep.isInstanceOf[HttpContent]) // chunks are handled via collation
        val coll = streamIn(rawTransport)
        val finagleRep = Bijections.netty.chunkedResponseToFinagle(rep, coll)
        Future.value(Multi(finagleRep, coll))

      case invalid =>
        // relies on GenSerialClientDispatcher satisfying `p`
        Future.exception(new IllegalArgumentException(s"invalid message '$invalid'"))
    }
  }
}


text:
SPK_NAME = lazylibrarian
SPK_VERS = $(shell date +%Y%m%d)
SPK_REV = 3
SPK_ICON = src/lazylibrarian.png
DSM_UI_DIR = app

DEPENDS  =
SPK_DEPENDS = "python>2.7.3-3"

MAINTAINER = SynoCommunity
DESCRIPTION = LazyLibrarian is an automated book downloader for SABnzbd.
DESCRIPTION_FRE = LazyLibrarian est un téléchargeur automatique de livre pour SABnzbd.
ADMIN_PORT = 8082
RELOAD_UI = yes
DISPLAY_NAME = LazyLibrarian
CHANGELOG = "1. Use source from LibrarianMike\\\n2. Default port changed to 8082"

HOMEPAGE   = https://github.com/LibrarianMike/LazyLibrarian
LICENSE    =

INSTALLER_SCRIPT = src/installer.sh
SSS_SCRIPT       = src/dsm-control.sh

INSTALL_PREFIX = /usr/local/$(SPK_NAME)

COPY_TARGET = nop
POST_STRIP_TARGET = lazylibrarian_extra_install

# Pure Python package, make sure ARCH is not defined
override ARCH=

include ../../mk/spksrc.spk.mk

.PHONY: lazylibrarian_extra_install
lazylibrarian_extra_install: $(STAGING_DIR)/share/LazyLibrarian
	install -m 755 -d $(STAGING_DIR)/var
	install -m 600 src/config.ini $(STAGING_DIR)/var/config.ini
	install -m 755 -d $(STAGING_DIR)/app
	install -m 644 src/app/config $(STAGING_DIR)/app/config
	install -m 755 src/app/lazylibrarian.cgi.py $(STAGING_DIR)/app/lazylibrarian.cgi
	install -m 755 -d $(STAGING_DIR)/app/images
	for size in 16 24 32 48 72; do \
		convert $(SPK_ICON) -thumbnail $${size}x$${size} \
		        $(STAGING_DIR)/app/images/$(SPK_NAME)-$${size}.png ; \
	done

$(STAGING_DIR)/share/LazyLibrarian:
	install -m 755 -d $(STAGING_DIR)/share
	cd $(STAGING_DIR)/share && git clone https://github.com/LibrarianMike/LazyLibrarian.git LazyLibrarian
	rm -fr $(STAGING_DIR)/share/LazyLibrarian/.git $(STAGING_DIR)/share/LazyLibrarian/.gitignore


text:
@protocol QLScrubViewDataSource
- (struct CGSize)scrubView:(id)arg1 pageSizeAtIndex:(unsigned long long)arg2;
- (id)scrubView:(id)arg1 thumbnailOperationForPageAtIndex:(unsigned long long)arg2;
- (long long)numberOfPagesInScrubView:(id)arg1;
@end


text:
'use strict';
var swig = require('swig');

swig.setDefaults({
  loader: swig.loaders.fs(process.cwd())
});

module.exports = function(grunt) {

  grunt.registerMultiTask('rus_swig', 'Grunt plugin for swig template engine', function() {
    var data = this.data;

    if (!data.src || !grunt.file.exists(data.src)) {
      grunt.log.warn('Template file "' + data.src + '" not found.');
      return false;
    }

    if (!data.dest || Object.keys(data.dest).length === 0) {
      grunt.log.warn('Dest "' + data.src + '" not found.');
      return false;
    }

    var compiledTemplate = swig.compileFile(data.src);
    var jsonFilePath;
    for (jsonFilePath in data.dest) {
      var json = grunt.file.readJSON(jsonFilePath + '.json');
      var dest = data.dest[jsonFilePath];
      if (Array.isArray(dest)) {
        var i = dest.length;
        var content = compiledTemplate(json);
        while (i--) {
          grunt.file.write(dest[i] + '.html', content);
        }
      } else {
        grunt.file.write(dest + '.html', compiledTemplate(json));
      }
    }
  });

};


text:
package com.gluigip.werewolf.model;

import java.util.List;

/**
 * Created by Gianluigi Pierini on 05-Feb-17.
 */
public enum Action {

    VOTE("Vote"), KILL("Kill"), SEE("See"), SHOT("Shot"), REVEAL("Reveal");

    public final String name;

    Action(String name) {
        this.name = name;
    }

    private Player player;
    private List<Player> subjects;

    public Action to(Player player) {
        this.player = player;
        return this;
    }

    public Action from(List<Player> subjects) {
        this.subjects = subjects;
        return this;
    }

    public Player getPlayer() {
        return player;
    }

    public List<Player> getSubjects() {
        return subjects;
    }
}


text:
<?php

namespace Sinner\Phpseclib\File;

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Pure-PHP ANSI Decoder
 *
 * PHP versions 4 and 5
 *
 * If you call read() in Net_SSH2 you may get {@link http://en.wikipedia.org/wiki/ANSI_escape_code ANSI escape codes} back.
 * They'd look like chr(0x1B) . '[00m' or whatever (0x1B = ESC).  They tell a
 * {@link http://en.wikipedia.org/wiki/Terminal_emulator terminal emulator} how to format the characters, what
 * color to display them in, etc. File_ANSI is a {@link http://en.wikipedia.org/wiki/VT100 VT100} terminal emulator.
 *
 * LICENSE: 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.
 *
 * @category   File
 * @package    File_ANSI
 * @author     Jim Wigginton <terrafrost@php.net>
 * @copyright  MMXII Jim Wigginton
 * @license    http://www.opensource.org/licenses/mit-license.html  MIT License
 * @version    $Id$
 * @link       htp://phpseclib.sourceforge.net
 */

/**
 * Pure-PHP ANSI Decoder
 *
 * @author  Jim Wigginton <terrafrost@php.net>
 * @version 0.3.0
 * @access  public
 * @package File_ANSI
 */
class File_ANSI {
    /**
     * Max Width
     *
     * @var Integer
     * @access private
     */
    protected $max_x;

    /**
     * Max Height
     *
     * @var Integer
     * @access private
     */
    protected $max_y;

    /**
     * Max History
     *
     * @var Integer
     * @access private
     */
    protected $max_history;

    /**
     * History
     *
     * @var Array
     * @access private
     */
    protected $history;

    /**
     * History Attributes
     *
     * @var Array
     * @access private
     */
    protected $history_attrs;

    /**
     * Current Column
     *
     * @var Integer
     * @access private
     */
    protected $x;

    /**
     * Current Row
     *
     * @var Integer
     * @access private
     */
    protected $y;

    /**
     * Old Column
     *
     * @var Integer
     * @access private
     */
    protected $old_x;

    /**
     * Old Row
     *
     * @var Integer
     * @access private
     */
    protected $old_y;

    /**
     * An empty attribute row
     *
     * @var Array
     * @access private
     */
    protected $attr_row;

    /**
     * The current screen text
     *
     * @var Array
     * @access private
     */
    protected $screen;

    /**
     * The current screen attributes
     *
     * @var Array
     * @access private
     */
    protected $attrs;

    /**
     * The current foreground color
     *
     * @var String
     * @access private
     */
    protected $foreground;

    /**
     * The current background color
     *
     * @var String
     * @access private
     */
    protected $background;

    /**
     * Bold flag
     *
     * @var Boolean
     * @access private
     */
    protected $bold;

    /**
     * Underline flag
     *
     * @var Boolean
     * @access private
     */
    protected $underline;

    /**
     * Blink flag
     *
     * @var Boolean
     * @access private
     */
    protected $blink;

    /**
     * Reverse flag
     *
     * @var Boolean
     * @access private
     */
    protected $reverse;

    /**
     * Color flag
     *
     * @var Boolean
     * @access private
     */
    protected $color;

    /**
     * Current ANSI code
     *
     * @var String
     * @access private
     */
    protected $ansi;

    /**
     * Default Constructor.
     *
     * @return File_ANSI
     * @access public
     */
    function __construct()
    {
        $this->setHistory(200);
        $this->setDimensions(80, 24);
    }

    /**
     * Set terminal width and height
     *
     * Resets the screen as well
     *
     * @param Integer $x
     * @param Integer $y
     * @access public
     */
    function setDimensions($x, $y)
    {
        $this->max_x = $x - 1;
        $this->max_y = $y - 1;
        $this->x = $this->y = 0;
        $this->history = $this->history_attrs = array();
        $this->attr_row = array_fill(0, $this->max_x + 1, '');
        $this->screen = array_fill(0, $this->max_y + 1, '');
        $this->attrs = array_fill(0, $this->max_y + 1, $this->attr_row);
        $this->foreground = 'white';
        $this->background = 'black';
        $this->bold = false;
        $this->underline = false;
        $this->blink = false;
        $this->reverse = false;
        $this->color = false;

        $this->ansi = '';
    }

    /**
     * Set the number of lines that should be logged past the terminal height
     *
     * @param Integer $x
     * @param Integer $y
     * @access public
     */
    function setHistory($history)
    {
        $this->max_history = $history;
    }

    /**
     * Load a string
     *
     * @param String $source
     * @access public
     */
    function loadString($source)
    {
        $this->setDimensions($this->max_x + 1, $this->max_y + 1);
        $this->appendString($source);
    }

    /**
     * Appdend a string
     *
     * @param String $source
     * @access public
     */
    function appendString($source)
    {
        for ($i = 0; $i < strlen($source); $i++) {
            if (strlen($this->ansi)) {
                $this->ansi.= $source[$i];
                $chr = ord($source[$i]);
                // http://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements
                // single character CSI's not currently supported
                switch (true) {
                    case $this->ansi == "\x1B=":
                        $this->ansi = '';
                        continue 2;
                    case strlen($this->ansi) == 2 && $chr >= 64 && $chr <= 95 && $chr != ord('['):
                    case strlen($this->ansi) > 2 && $chr >= 64 && $chr <= 126:
                        break;
                    default:
                        continue 2;
                }
                // http://ascii-table.com/ansi-escape-sequences-vt-100.php
                switch ($this->ansi) {
                    case "\x1B[H":
                        $this->old_x = $this->x;
                        $this->old_y = $this->y;
                        $this->x = $this->y = 0;
                        break;
                    case "\x1B[J":
                        $this->history = array_merge($this->history, array_slice(array_splice($this->screen, $this->y + 1), 0, $this->old_y));
                        $this->screen = array_merge($this->screen, array_fill($this->y, $this->max_y, ''));

                        $this->history_attrs = array_merge($this->history_attrs, array_slice(array_splice($this->attrs, $this->y + 1), 0, $this->old_y));
                        $this->attrs = array_merge($this->attrs, array_fill($this->y, $this->max_y, $this->attr_row));

                        if (count($this->history) == $this->max_history) {
                            array_shift($this->history);
                            array_shift($this->history_attrs);
                        }
                    case "\x1B[K":
                        $this->screen[$this->y] = substr($this->screen[$this->y], 0, $this->x);

                        array_splice($this->attrs[$this->y], $this->x + 1);
                        break;
                    case "\x1B[?1h": // set cursor key to application
                        break;
                    default:
                        switch (true) {
                            case preg_match('#\x1B\[(\d+);(\d+)H#', $this->ansi, $match):
                                $this->old_x = $this->x;
                                $this->old_y = $this->y;
                                $this->x = $match[2] - 1;
                                $this->y = $match[1] - 1;
                                break;
                            case preg_match('#\x1B\[(\d+)C#', $this->ansi, $match):
                                $this->old_x = $this->x;
                                $x = $match[1] - 1;
                                break;
                            case preg_match('#\x1B\[(\d+);(\d+)r#', $this->ansi, $match): // Set top and bottom lines of a window
                                break;
                            case preg_match('#\x1B\[(\d*(?:;\d*)*)m#', $this->ansi, $match):
                                $mods = explode(';', $match[1]);
                                foreach ($mods as $mod) {
                                    switch ($mod) {
                                        case 0:
                                            $this->attrs[$this->y][$this->x] = '';

                                            if ($this->bold) $this->attrs[$this->y][$this->x].= '';
                                            if ($this->underline) $this->attrs[$this->y][$this->x].= '</underline>';
                                            if ($this->blink) $this->attrs[$this->y][$this->x].= '</blink>';
                                            if ($this->color) $this->attrs[$this->y][$this->x].= '';

                                            if ($this->reverse) {
                                                $temp = $this->background;
                                                $this->background = $this->foreground;
                                                $this->foreground = $temp;
                                            }

                                            $this->bold = $this->underline = $this->blink = $this->color = $this->reverse = false;
                                            break;
                                        case 1:
                                            if (!$this->bold) {
                                                $this->attrs[$this->y][$this->x] = '';
                                                $this->bold = true;
                                            }
                                            break;
                                        case 4:
                                            if (!$this->underline) {
                                                $this->attrs[$this->y][$this->x] = '';
                                                $this->underline = true;
                                            }
                                            break;
                                        case 5:
                                            if (!$this->blink) {
                                                $this->attrs[$this->y][$this->x] = '<blink>';
                                                $this->blink = true;
                                            }
                                            break;
                                        case 7:
                                            $this->reverse = !$this->reverse;
                                            $temp = $this->background;
                                            $this->background = $this->foreground;
                                            $this->foreground = $temp;
                                            $this->attrs[$this->y][$this->x] = 'foreground . '; background: ' . $this->background . '">';
                                            if ($this->color) {
                                                $this->attrs[$this->y][$this->x] = '' . $this->attrs[$this->y][$this->x];
                                            }
                                            $this->color = true;
                                            break;
                                        default:
                                            //$front = $this->reverse ? &$this->background : &$this->foreground;
                                            $front = &$this->{ $this->reverse ? 'background' : 'foreground' };
                                            //$back = $this->reverse ? &$this->foreground : &$this->background;
                                            $back = &$this->{ $this->reverse ? 'foreground' : 'background' };
                                            switch ($mod) {
                                                case 30: $front = 'black'; break;
                                                case 31: $front = 'red'; break;
                                                case 32: $front = 'green'; break;
                                                case 33: $front = 'yellow'; break;
                                                case 34: $front = 'blue'; break;
                                                case 35: $front = 'magenta'; break;
                                                case 36: $front = 'cyan'; break;
                                                case 37: $front = 'white'; break;

                                                case 40: $back = 'black'; break;
                                                case 41: $back = 'red'; break;
                                                case 42: $back = 'green'; break;
                                                case 43: $back = 'yellow'; break;
                                                case 44: $back = 'blue'; break;
                                                case 45: $back = 'magenta'; break;
                                                case 46: $back = 'cyan'; break;
                                                case 47: $back = 'white'; break;

                                                default:
                                                    user_error('Unsupported attribute: ' . $mod);
                                                    $this->ansi = '';
                                                    break 2;
                                            }

                                            unset($temp);
                                            $this->attrs[$this->y][$this->x] = 'foreground . '; background: ' . $this->background . '">';
                                            if ($this->color) {
                                                $this->attrs[$this->y][$this->x] = '' . $this->attrs[$this->y][$this->x];
                                            }
                                            $this->color = true;
                                    }
                                }
                                break;
                            default:
                                echo "{$this->ansi} unsupported\r\n";
                        }
                }
                $this->ansi = '';
                continue;
            }

            switch ($source[$i]) {
                case "\r":
                    $this->x = 0;
                    break;
                case "\n":
                    //if ($this->y < $this->max_y) {
                    //    $this->y++;
                    //}

                    while ($this->y >= $this->max_y) {
                        $this->history = array_merge($this->history, array(array_shift($this->screen)));
                        $this->screen[] = '';

                        $this->history_attrs = array_merge($this->history_attrs, array(array_shift($this->attrs)));
                        $this->attrs[] = $this->attr_row;

                        if (count($this->history) >= $this->max_history) {
                            array_shift($this->history);
                            array_shift($this->history_attrs);
                        }

                        $this->y--;
                    }
                    $this->y++;
                    break;
                case "\x0F": // shift
                    break;
                case "\x1B": // start ANSI escape code
                    $this->ansi.= "\x1B";
                    break;
                default:
                    $this->screen[$this->y] = substr_replace(
                        $this->screen[$this->y],
                        $source[$i],
                        $this->x,
                        1
                    );

                    if ($this->x > $this->max_x) {
                        $this->x = 0;
                        $this->y++;
                    } else {
                        $this->x++;
                    }
            }
        }
    }

    /**
     * Returns the current screen without preformating
     *
     * @access private
     * @return String
     */
    function _getScreen()
    {
        $output = '';
        for ($i = 0; $i <= $this->max_y; $i++) {
            for ($j = 0; $j <= $this->max_x + 1; $j++) {
                if (isset($this->attrs[$i][$j])) {
                    $output.= $this->attrs[$i][$j];
                }
                if (isset($this->screen[$i][$j])) {
                    $output.= htmlspecialchars($this->screen[$i][$j]);
                }
            }
            $output.= "\r\n";
        }
        return rtrim($output);
    }

    /**
     * Returns the current screen
     *
     * @access public
     * @return String
     */
    function getScreen()
    {
        return '
max_x + 1) . '">' . $this->_getScreen() . '
';
    }

    /**
     * Returns the current screen and the x previous lines
     *
     * @access public
     * @return String
     */
    function getHistory()
    {
        $scrollback = '';
        for ($i = 0; $i < count($this->history); $i++) {
            for ($j = 0; $j <= $this->max_x + 1; $j++) {
                if (isset($this->history_attrs[$i][$j])) {
                    $scrollback.= $this->history_attrs[$i][$j];
                }
                if (isset($this->history[$i][$j])) {
                    $scrollback.= htmlspecialchars($this->history[$i][$j]);
                }
            }
            $scrollback.= "\r\n";
        }
        $scrollback.= $this->_getScreen();

        return '
max_x + 1) . '">' . $scrollback . '
';
    }
}


text:
package main.nl.uva.ui.types;

import java.awt.Color;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JComponent;
import javax.swing.JTextField;

import main.nl.uva.ui.element.DeclarationUI;
import main.nl.uva.validation.type.Money;
import main.nl.uva.validation.type.Value;

public class MoneyUI extends ValueUI implements KeyListener {

    private final JTextField _textField;

    private final DeclarationUI _parent;

    public MoneyUI(final DeclarationUI parent, final Value value) {
        _textField = new JTextField();
        valueChange(value);
        _textField.addKeyListener(this);

        _parent = parent;
    }

    @Override
    public JComponent getComponent() {
        return _textField;
    }

    @Override
    public void keyTyped(final KeyEvent e) {}

    @Override
    public void keyPressed(final KeyEvent e) {}

    @Override
    public void keyReleased(final KeyEvent e) {
        double value = 0;

        try {
            value = Double.parseDouble(_textField.getText());
        } catch (NumberFormatException numberExceptino) {
            _textField.setBackground(Color.RED);
            return;
        }

        _textField.setBackground(Color.WHITE);
        _parent.onChange(value);
    }

    @Override
    public void valueChange(final Value value) {
        Money money = (Money) value;
        _textField.setText(money.getValue() + "");
    }

    @Override
    public void setEditable(final boolean enabled) {
        _textField.setEditable(false);
    }
}


text:
Release history
###############

QISKit SDK 0.4.0
================

2018/01/08

Improvements
------------

- Job handling improvements.
    - Allow asynchronous job submission.
    - New JobProcessor class: utilizes concurrent.futures.
    - New QuantumJob class: job description.
- Modularize circuit "compilation".
    Takes quantum circuit and information about backend to transform
    circuit into one which can run on the backend.
- Standardize job description.
    All backends take QuantumJob objects which wraps ``qobj`` program description.
- Simplify addition of backends, where circuits are run/simulated.
    - ``qiskit.backends`` package added.
    - Real devices and simulators are considered "backends" which inherent from ``BaseBackend``.
- Reorganize and improve Sphinx documentation.
- Improve unittest framework.
- Add tools for generating random circuits.
- New utilities for fermionic Hamiltonians (``qiskit/tools/apps/fermion``).
- New utilities for classical optimization and chemistry (``qiskit/tools/apps/optimization``).
- Randomized benchmarking data handling.
- Quantum tomography (``qiskit/tools/qcvv``).
    Added functions for generating, running and fitting process tomography experiments.
- Quantum information functions (``qiskit/tools/qi``).
    - Partial trace over subsystems of multi-partite vector.
    - Partial trace over subsystems of multi-partite matrix.
    - Flatten an operator to a vector in a specified basis.
    - Generate random unitary matrix.
    - Generate random density matrix.
    - Generate normally distributed complex matrix.
    - Generate random density matrix from Hilbert-Schmidt metric.
    - Generate random density matrix from the Bures metric.
    - Compute Shannon entropy of probability vector.
    - Compute von Neumann entropy of quantum state.
    - Compute mutual information of a bipartite state.
    - Compute the entanglement of formation of quantum state.
- Visualization improvements (``qiskit/tools``).
    - Wigner function representation.
    - Latex figure of circuit.
- Use python logging facility for info, warnings, etc.
- Auto-deployment of sphinx docs to github pages.
- Check IBMQuantumExperience version at runtime.
- Add QuantumProgram method to reconfigure already generated qobj.
- Add Japanese introductory documentation (``doc/ja``).
- Add Korean translation of readme (``doc/ko``).
- Add appveyor for continuous integration on Windows.
- Enable new IBM Q parameters for hub/group/project.
- Add QuantumProgram methods for destroying registers and circuits.
- Use Sympy for evaluating expressions.
- Add support for ibmqx_hpc_qasm_simulator backend.
- Add backend interface to Project Q C++ simulator.
    Requires installation of Project Q.
- Introduce ``InitializeGate`` class.
    Generates circuit which initializes qubits in arbitrary state.
- Introduce ``local_qiskit_simulator`` a C++ simulator with realistic noise.
    Requires C++ build environment for ``make``-based build.
- Introduce ``local_clifford_simulator`` a C++ Clifford simulator.
    Requires C++ build environment for ``make``-based build.

Bug Fixes
---------

- Fix basis gates (#76).
- Enable QASM parser to work in multiuser environments.
- Correct operator precedence when parsing expressions (#190).
- Fix "math domain error" in mapping (#111, #151).

Backward-incompatible changes
-----------------------------

- The standard extension for creating U base gates has been modified to be
  consistent with the rest of the gate APIs (see #203).
- The ``silent`` parameter has been removed from a number of ``QuantumProgram``
  methods. The same behaviour can be achieved now by using the
  ``enable_logs()`` and ``disable_logs()`` methods, which use the standard
  Python logging.


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.zalando</groupId>
        <artifactId>riptide-parent</artifactId>
        <version>3.2.3-SNAPSHOT</version>
        <relativePath>../riptide-parent</relativePath>
    </parent>

    <artifactId>riptide-opentelemetry</artifactId>

    <name>Riptide: OpenTelemetry</name>
    <description>Client side response routing</description>

    <properties>
        <opentelemetry.version>1.20.0</opentelemetry.version>
        <opentelemetry-semconv.version>${opentelemetry.version}-alpha</opentelemetry-semconv.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.zalando</groupId>
            <artifactId>riptide-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-api</artifactId>
            <version>${opentelemetry.version}</version>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-semconv</artifactId>
            <version>${opentelemetry-semconv.version}</version>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-sdk-testing</artifactId>
            <version>${opentelemetry.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-sdk</artifactId>
            <version>${opentelemetry.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.rest-driver</groupId>
            <artifactId>rest-client-driver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.zalando</groupId>
            <artifactId>riptide-failsafe</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>


text:
<?php

namespace SlmLocale\Strategy;

use SlmLocale\LocaleEvent;

/**
 * This class checks whether the requested uri should deliver an asset and should therefore not be redirected.
 * If it is an asset, we return false to stop further processing of other strategies in SlmLocale\Locale\Detector.
 *
 * Example config:
 * 'slm_locale' => [
 *     'default' => 'de_DE',
 *     'supported' => ['en_GB', 'de_DE'],
 *     'strategies' => [
 *         [
 *             'name' => SlmLocale\Strategy\AssetStrategy::class,
 *             'options' => [
 *                 'file_extensions' => [
 *                     'css', 'js'
 *                 ]
 *             ]
 *         ],
 *         'query',
 *         'cookie',
 *         'acceptlanguage'
 *     ],
 *     'mappings' => [
 *         'en' => 'en_GB',
 *         'de' => 'de_DE',
 *     ]
 * ],
 *
 * This example config would ignore the file_extensions ".css", ".CSS", ".js", ".JS".
 *
 * Class AssetStrategy
 * @package SlmLocale\Strategy
 */
final class AssetStrategy extends AbstractStrategy
{
    /** @var  array */
    private $file_extensions = [];

    public function detect(LocaleEvent $event)
    {
        $this->stopPropagationIfAsset($event);
    }

    public function found(LocaleEvent $event)
    {
        $this->stopPropagationIfAsset($event);
    }

    private function stopPropagationIfAsset(LocaleEvent $event)
    {
        if (! $this->isHttpRequest($event->getRequest())) {
            return;
        }

        $path      = $event->getRequest()->getUri();
        $path      = parse_url($path, PHP_URL_PATH);
        $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));

        // if the file extension of the uri is found within the configured file_extensions, we do not rewrite and skip further processing
        if (in_array($extension, $this->file_extensions)) {
            $event->stopPropagation();
        }
    }

    public function setOptions(array $options = [])
    {
        if (array_key_exists('file_extensions', $options)) {
            $this->file_extensions = (array) $options['file_extensions'];
        }
    }
}


text:
shopt -s -o pipefail
set -e 		# Exit on error

PKG_NAME="findutils"
PKG_VERSION="4.4.2"

TARBALL="${PKG_NAME}-${PKG_VERSION}.tar.gz"
SRC_DIR="${PKG_NAME}-${PKG_VERSION}"

function showHelp() {
    echo -e "--------------------------------------------------------------------------------------------------------------"
    echo -e "Description: The Findutils package contains programs to find files. These programs are provided to recursively"
    echo -e "search through a directory tree and to create, maintain, and search a database (often faster than the"
    echo -e "recursive find, but unreliable if the database has not been recently updated)."
    echo -e "--------------------------------------------------------------------------------------------------------------"
    echo -e ""
}

function prepare() {
    ln -sv /sources/${TARBALL} ${TARBALL}
}

function unpack() {
    tar xf ${TARBALL}
}

function build() {
    ./configure --prefix=/usr                   \
                --libexecdir=/usr/lib/locate    \
                --localstatedir=/var/lib/locate

    make ${MAKE_PARALLEL}
}

function runTest() {
    make ${MAKE_PARALLEL} check
}

function instal() {
    make ${MAKE_PARALLEL} install
}

function clean() {
    rm -rf ${SRC_DIR} ${TARBALL}
}

# Run the installation procedure
time { showHelp;clean;prepare;unpack;pushd ${SRC_DIR};build;[[ ${MAKE_TESTS} = TRUE ]] && runTest;instal;popd;clean; }
# Verify installation
if [ -f /usr/bin/find ]; then
    touch ${DONE_DIR_BUILD_SYSTEM}/$(basename $(pwd))
fi


text:
#include <IOKit/IOLib.h>
#include "ev_keymap.h"
#include "IOHIDEvent.h"
#include "IOHIDEventData.h"
#include "IOHIDUsageTables.h"

#define EXTERNAL ((unsigned int) -1)

#define super OSObject

OSDefineMetaClassAndStructors(IOHIDEvent, OSObject)

extern unsigned int hid_adb_2_usb_keymap[];

//==============================================================================
// IOHIDEvent::initWithCapacity
//==============================================================================
bool IOHIDEvent::initWithCapacity(IOByteCount capacity)
{
    if (!super::init())
        return false;

    if (_data && (!capacity || _capacity < capacity) ) {
        // clean out old data's storage if it isn't big enough
        IOFree(_data, _capacity);
        _data = 0;
    }

    _capacity = capacity;

    if ( !_capacity )
        return false;

    if ( !_data && !(_data = (IOHIDEventData *) IOMalloc(_capacity)))
        return false;

    bzero(_data, _capacity);
    _data->size = _capacity;
    _children = NULL;

    return true;
}

//==============================================================================
// IOHIDEvent::initWithType
//==============================================================================
bool IOHIDEvent::initWithType(IOHIDEventType type)
{
    size_t capacity = 0;

    IOHIDEventGetSize(type,capacity);

    if ( !initWithCapacity(capacity) )
        return false;

    _data->type = type;
    _typeMask   = IOHIDEventTypeMask(type);

    return true;
}

//==============================================================================
// IOHIDEvent::initWithTypeTimeStamp
//==============================================================================
bool IOHIDEvent::initWithTypeTimeStamp(IOHIDEventType type, AbsoluteTime timeStamp, IOOptionBits options)
{
    if ( !initWithType(type))
        return false;

    _timeStamp  = timeStamp;
    _options    = options;

    return true;
}

//==============================================================================
// IOHIDEvent::free
//==============================================================================
void IOHIDEvent::free()
{
    if (_capacity != EXTERNAL && _data && _capacity) {
        IOFree(_data, _capacity);
        _data = NULL;
        _capacity = 0;
    }

    if ( _children ) {
        // We should probably iterate over each child to clear the parent
        _children->release();
        _children = NULL;
    }
    super::free();
}

//==============================================================================
// IOHIDEvent::getTimeStamp
//==============================================================================
AbsoluteTime IOHIDEvent::getTimeStamp()
{
    return _timeStamp;
}

//==============================================================================
// IOHIDEvent::setTimeStamp
//==============================================================================
void IOHIDEvent::setTimeStamp( AbsoluteTime timeStamp )
{
    _timeStamp = timeStamp;
}

//==============================================================================
// IOHIDEvent::withType
//==============================================================================
IOHIDEvent * IOHIDEvent::withType(      IOHIDEventType          type,
                                        IOOptionBits            options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithType(type)) {
        me->release();
        return 0;
    }

    me->_options = options;

    return me;
}

//==============================================================================
// IOHIDEvent::withEventData
//==============================================================================
IOHIDEvent * IOHIDEvent::withEventData (
                                        AbsoluteTime            timeStamp,
                                        UInt32                  type,
                                        NXEventData *           data,
                                        IOOptionBits            options)
{
    IOHIDEvent *me = NULL;

    switch ( type ) {
        case NX_LMOUSEDOWN:
        case NX_LMOUSEUP:
        case NX_RMOUSEDOWN:
        case NX_RMOUSEUP:
        case NX_OMOUSEDOWN:
        case NX_OMOUSEUP:
            break;
        case NX_MOUSEMOVED:
        case NX_LMOUSEDRAGGED:
        case NX_RMOUSEDRAGGED:
        case NX_OMOUSEDRAGGED:
            me = IOHIDEvent::translationEvent(timeStamp, data->mouseMove.dx<<16 + data->mouseMove.subx<<8, data->mouseMove.dy<<16 + data->mouseMove.suby<<8, 0, options);
            break;

        case NX_KEYDOWN:
        case NX_KEYUP:
            {
            uint32_t usage = hid_adb_2_usb_keymap[data->key.keyCode];

            if ( usage < kHIDUsage_KeyboardLeftControl || usage > kHIDUsage_KeyboardRightGUI || !data->key.repeat )
                me = IOHIDEvent::keyboardEvent(timeStamp, kHIDPage_KeyboardOrKeypad, hid_adb_2_usb_keymap[data->key.keyCode], type==NX_KEYDOWN, options | (data->key.repeat ? kIOHIDKeyboardIsRepeat : 0));
            }
            break;
        case NX_SCROLLWHEELMOVED:
            me = IOHIDEvent::scrollEvent(timeStamp, data->scrollWheel.pointDeltaAxis2<<16, data->scrollWheel.pointDeltaAxis1<<16, data->scrollWheel.pointDeltaAxis3<<16, options);
            break;
        case NX_ZOOM:
            me = IOHIDEvent::zoomEvent(timeStamp, data->scrollWheel.pointDeltaAxis2<<16, data->scrollWheel.pointDeltaAxis1<<16, data->scrollWheel.pointDeltaAxis3<<16, options);
            break;
        case NX_SYSDEFINED:
            switch (data->compound.subType) {
                case NX_SUBTYPE_AUX_MOUSE_BUTTONS:
                    me = IOHIDEvent::buttonEvent(timeStamp, data->compound.misc.L[1], options);
                    break;
                case NX_SUBTYPE_AUX_CONTROL_BUTTONS:
                    uint16_t flavor = data->compound.misc.L[0] >> 16;
                    switch ( flavor ) {
                        case NX_KEYTYPE_SOUND_UP:
                        case NX_KEYTYPE_SOUND_DOWN:
                        case NX_KEYTYPE_BRIGHTNESS_UP:
                        case NX_KEYTYPE_BRIGHTNESS_DOWN:
                        case NX_KEYTYPE_HELP:
                        case NX_POWER_KEY:
                        case NX_KEYTYPE_MUTE:
                        case NX_KEYTYPE_NUM_LOCK:

                        case NX_KEYTYPE_EJECT:
                        case NX_KEYTYPE_VIDMIRROR:

                        case NX_KEYTYPE_PLAY:
                        case NX_KEYTYPE_NEXT:
                        case NX_KEYTYPE_PREVIOUS:
                        case NX_KEYTYPE_FAST:
                        case NX_KEYTYPE_REWIND:

                        case NX_KEYTYPE_ILLUMINATION_UP:
                        case NX_KEYTYPE_ILLUMINATION_DOWN:
                        case NX_KEYTYPE_ILLUMINATION_TOGGLE:
                            break;
                    }
            }
            break;
    }

    return me;
}

//==============================================================================
// IOHIDEvent::keyboardEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::keyboardEvent( AbsoluteTime            timeStamp,
                                        UInt32                  usagePage,
                                        UInt32                  usage,
                                        Boolean                 down,
                                        IOOptionBits            options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(kIOHIDEventTypeKeyboard, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDKeyboardEventData * keyboard = (IOHIDKeyboardEventData *)me->_data;
    keyboard->usagePage = usagePage;
    keyboard->usage = usage;
    keyboard->down = down;

    return me;
}

//==============================================================================
// IOHIDEvent::_axisEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::_axisEvent(    IOHIDEventType          type,
                                        AbsoluteTime            timeStamp,
                                        IOFixed                 x,
                                        IOFixed                 y,
                                        IOFixed                 z,
                                        IOOptionBits            options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(type, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDAxisEventData * event = (IOHIDAxisEventData *)me->_data;
    event->position.x = x;
    event->position.y = y;
    event->position.z = z;

    return me;
}

//==============================================================================
// IOHIDEvent::translationEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::translationEvent(
                                        AbsoluteTime            timeStamp,
                                        IOFixed                 x,
                                        IOFixed                 y,
                                        IOFixed                 z,
                                        IOOptionBits            options)
{
    return IOHIDEvent::_axisEvent(      kIOHIDEventTypeTranslation,
                                        timeStamp,
                                        x,
                                        y,
                                        z,
                                        options);
}

//==============================================================================
// IOHIDEvent::scrollEvet
//==============================================================================
IOHIDEvent * IOHIDEvent::scrollEvent(
                                        AbsoluteTime            timeStamp,
                                        IOFixed                 x,
                                        IOFixed                 y,
                                        IOFixed                 z,
                                        IOOptionBits            options)
{
    return IOHIDEvent::_axisEvent(      kIOHIDEventTypeScroll,
                                        timeStamp,
                                        x,
                                        y,
                                        z,
                                        options);
}

//==============================================================================
// IOHIDEvent::zoomEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::zoomEvent(
                                        AbsoluteTime            timeStamp,
                                        IOFixed                 x,
                                        IOFixed                 y,
                                        IOFixed                 z,
                                        IOOptionBits            options)
{
    return IOHIDEvent::_axisEvent(      kIOHIDEventTypeZoom,
                                        timeStamp,
                                        x,
                                        y,
                                        z,
                                        options);
}

//==============================================================================
// IOHIDEvent::accelerometerEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::accelerometerEvent(
                                        AbsoluteTime            timeStamp,
                                        IOFixed                 x,
                                        IOFixed                 y,
                                        IOFixed                 z,
                                        IOHIDAccelerometerType  type,
										IOHIDAccelerometerSubType  subType,
                                        IOOptionBits            options)
{
    IOHIDEvent *                    event;
    IOHIDAccelerometerEventData *   data;

    event = IOHIDEvent::_axisEvent( kIOHIDEventTypeAccelerometer,
                                    timeStamp,
                                    x,
                                    y,
                                    z,
                                    options);

    if ( event ) {
        data = (IOHIDAccelerometerEventData *)event->_data;
        data->acclType = type;
		data->acclSubType = subType;
    }

    return event;
}

//==============================================================================
// IOHIDEvent::gyroEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::gyroEvent(
											AbsoluteTime            timeStamp,
											IOFixed                 x,
											IOFixed                 y,
											IOFixed                 z,
											IOHIDGyroType           type,
											IOHIDGyroSubType		subType,
											IOOptionBits            options)
{
    IOHIDEvent *                    event;
    IOHIDGyroEventData *		data;

    event = IOHIDEvent::_axisEvent( kIOHIDEventTypeGyro,
								   timeStamp,
								   x,
								   y,
								   z,
								   options);

    if ( event ) {
        data = (IOHIDGyroEventData *)event->_data;
        data->gyroType = type;
        data->gyroSubType = subType;
    }

    return event;
}

//==============================================================================
// IOHIDEvent::compassEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::compassEvent(
                                   AbsoluteTime            timeStamp,
                                   IOFixed                 x,
                                   IOFixed                 y,
                                   IOFixed                 z,
                                   IOHIDCompassType		type,
                                   IOOptionBits            options)
{
    IOHIDEvent *                event;
    IOHIDCompassEventData *		data;

    event = IOHIDEvent::_axisEvent( kIOHIDEventTypeCompass,
								   timeStamp,
								   x,
								   y,
								   z,
								   options);

    if ( event ) {
        data = (IOHIDCompassEventData *)event->_data;
        data->compassType = type;
    }

    return event;
}

//==============================================================================
// IOHIDEvent::ambientLightSensorEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::ambientLightSensorEvent(
                                        AbsoluteTime            timeStamp,
                                        UInt32                  level,
                                        UInt32                  channel0,
                                        UInt32                  channel1,
										UInt32                  channel2,
										UInt32                  channel3,
                                        IOOptionBits            options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(kIOHIDEventTypeAmbientLightSensor, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDAmbientLightSensorEventData * event = (IOHIDAmbientLightSensorEventData *)me->_data;
    event->level = level;
    event->ch0 = channel0;
    event->ch1 = channel1;
    event->ch2 = channel2;
    event->ch3 = channel3;

    return me;
}

//==============================================================================
// IOHIDEvent::proximityEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::proximityEvent (
                                        AbsoluteTime				timeStamp,
                                        IOHIDProximityDetectionMask	mask,
										UInt32						level,
                                        IOOptionBits				options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(kIOHIDEventTypeProximity, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDProximityEventData * event = (IOHIDProximityEventData *)me->_data;
    event->detectionMask	= mask;
	event->level			= level;

    return me;
}

//==============================================================================
// IOHIDEvent::temperatureEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::temperatureEvent(
                                        AbsoluteTime            timeStamp,
                                        IOFixed                 temperature,
                                        IOOptionBits            options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(kIOHIDEventTypeTemperature, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDTemperatureEventData * event = (IOHIDTemperatureEventData *)me->_data;
    event->level = temperature;

    return me;
}

//==============================================================================
// IOHIDEvent::buttonEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::buttonEvent(
                                        AbsoluteTime            timeStamp,
                                        UInt32                  buttonMask,
                                        IOOptionBits            options)
{
    return IOHIDEvent::buttonEvent(timeStamp, buttonMask, 0, options);
}

//==============================================================================
// IOHIDEvent::buttonEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::buttonEvent(
                                        AbsoluteTime            timeStamp,
                                        UInt32                  buttonMask,
                                        IOFixed                 pressure,
                                        IOOptionBits            options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(kIOHIDEventTypeButton, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDButtonEventData * event = (IOHIDButtonEventData *)me->_data;
    event->button.buttonMask = buttonMask;
    event->button.pressure   = pressure;

    return me;
}

//====================================================================================================
// IOHIDEvent::absolutePointerEvent
//====================================================================================================
IOHIDEvent * IOHIDEvent::absolutePointerEvent(
                                        AbsoluteTime                timeStamp,
                                        SInt32                      x,
                                        SInt32                      y,
                                        IOGBounds *                 bounds,
                                        UInt32                      buttonState __unused,
                                        bool                        inRange __unused,
                                        SInt32                      tipPressure __unused,
                                        SInt32                      tipPressureMin __unused,
                                        SInt32                      tipPressureMax __unused,
                                        IOOptionBits                options)
{
    const int kIOFixedScale = 16;

    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(kIOHIDEventTypeDigitizer, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDDigitizerEventData *event = (IOHIDDigitizerEventData *)me->_data;

    x = min(max(x, bounds->minx), bounds->maxx);
    y = min(max(y, bounds->miny), bounds->maxy);

    event->position.x = IOFixedDivide( (x - bounds->minx)<<kIOFixedScale, (bounds->maxx - bounds->minx)<<kIOFixedScale);;
    event->position.y = IOFixedDivide( (y - bounds->miny)<<kIOFixedScale, (bounds->maxy - bounds->miny)<<kIOFixedScale);;
    event->position.z = 0;

    event->transducerIndex = 1; // Multitouch uses this as a path ID
    event->transducerType = 0;  // not used?
    event->identity = 2;        // Multitouch interprets this as 'finger', hard code to 2 or index finger
    event->eventMask = 0;       // todo:
    event->buttonMask = 0;      // todo:
    event->tipPressure = 0;     // todo: should be IOFixed tipPressure, scaled between min and max
    event->barrelPressure = 0;
    event->twist = 90<<kIOFixedScale;   // hard code to 90� for now, is multi-touch using this right?
    event->orientationType = kIOHIDDigitizerOrientationTypeQuality;
    event->orientation.quality.quality = 0;
    event->orientation.quality.density = 0;
    event->orientation.quality.irregularity = 0;
    event->orientation.quality.majorRadius = 6<<kIOFixedScale;
    event->orientation.quality.minorRadius = 6<<kIOFixedScale;

    return me;
}

//====================================================================================================
// IOHIDEvent::powerEvent
//====================================================================================================
IOHIDEvent * IOHIDEvent::powerEvent(
                                   AbsoluteTime            timeStamp,
                                   IOFixed                 measurement,
                                   IOHIDPowerType          powerType,
                                   IOHIDPowerSubType       powerSubType,
                                   IOOptionBits            options)
{
    IOHIDEvent *me = new IOHIDEvent;

    if (me && !me->initWithTypeTimeStamp(kIOHIDEventTypePower, timeStamp, options)) {
        me->release();
        return 0;
    }

    IOHIDPowerEventData *event = (IOHIDPowerEventData *)me->_data;

    event->measurement = measurement;
    event->powerType = powerType;
    event->powerSubType = powerSubType;

    return me;
}

//==============================================================================
// IOHIDEvent::appendChild
//==============================================================================
void IOHIDEvent::appendChild(IOHIDEvent *childEvent)
{
    if (!_children) {
        const OSObject *events[] = { childEvent };

        _children = OSArray::withObjects(events, 1);
    } else {
        _children->setObject(childEvent);
    }

}

//==============================================================================
// IOHIDEvent::getType
//==============================================================================
IOHIDEventType IOHIDEvent::getType()
{
    return _data->type;
}

//==============================================================================
// IOHIDEvent::setType
//==============================================================================
void IOHIDEvent::setType(IOHIDEventType type)
{
    initWithType(type);
}

//==============================================================================
// IOHIDEvent::getEvent
//==============================================================================
IOHIDEvent * IOHIDEvent::getEvent(      IOHIDEventType          type,
                                        IOOptionBits            options __unused)
{
    return (_data->type == type) ? this : NULL;
}

//==============================================================================
// IOHIDEvent::getIntegerValue
//==============================================================================
SInt32 IOHIDEvent::getIntegerValue(     IOHIDEventField         key,
                                        IOOptionBits            options)
{
    SInt32 value = 0;

    GET_EVENT_VALUE(this, key, value, options);

    return value;
}

//==============================================================================
// IOHIDEvent::getFixedValue
//==============================================================================
IOFixed IOHIDEvent::getFixedValue(      IOHIDEventField         key,
                                        IOOptionBits            options)
{
    IOFixed value = 0;

    GET_EVENT_VALUE_FIXED(this, key, value, options);

    return value;
}

//==============================================================================
// IOHIDEvent::setIntegerValue
//==============================================================================
void IOHIDEvent::setIntegerValue(       IOHIDEventField         key,
                                        SInt32                  value,
                                        IOOptionBits            options)
{
    SET_EVENT_VALUE(this, key, value, options);
}

//==============================================================================
// IOHIDEvent::setFixedValue
//==============================================================================
void IOHIDEvent::setFixedValue(         IOHIDEventField         key,
                                        IOFixed                 value,
                                        IOOptionBits            options)
{
    SET_EVENT_VALUE_FIXED(this, key, value, options);
}

//==============================================================================
// IOHIDEvent::getLength
//==============================================================================
size_t IOHIDEvent::getLength()
{
    _eventCount = 0;
    return getLength(&_eventCount);
}

//==============================================================================
// IOHIDEvent::getLength
//==============================================================================
IOByteCount IOHIDEvent::getLength(UInt32 * count)
{
    IOByteCount length = _data->size;

    length += sizeof(IOHIDSystemQueueElement);

    if ( _children )
    {
        UInt32          i, childCount;
        IOHIDEvent *    child;

        childCount = _children->getCount();

        for(i=0 ;i<childCount; i++) {
            if ( (child = (IOHIDEvent *)_children->getObject(i)) ) {
                length += child->getLength(count) - sizeof(IOHIDSystemQueueElement);
            }
        }
    }

    if ( count )
        *count = *count + 1;

    return length;
}

//==============================================================================
// IOHIDEvent::appendBytes
//==============================================================================
IOByteCount IOHIDEvent::appendBytes(UInt8 * bytes, IOByteCount withLength)
{
    IOByteCount size = 0;

    size = _data->size;

    if ( size > withLength )
        return 0;

    bcopy(_data, bytes, size);

    if ( _children )
    {
        UInt32          i, childCount;
        IOHIDEvent *    child;

        childCount = _children->getCount();

        for(i=0 ;i<childCount; i++) {
            if ( (child = (IOHIDEvent *)_children->getObject(i)) ) {
                size += child->appendBytes(bytes + size, withLength - size);
            }
        }
    }

    return size;
}

//==============================================================================
// IOHIDEvent::withBytes
//==============================================================================
IOHIDEvent * IOHIDEvent::withBytes(     const void *            bytes,
                                        IOByteCount             size)
{
    IOHIDSystemQueueElement *   queueElement= NULL;
    IOHIDEvent *                parent      = NULL;
    UInt32                      index       = 0;
    UInt32                      total       = 0;
    UInt32                      offset      = 0;

    if ( !bytes || !size )
        return NULL;

    queueElement    = (IOHIDSystemQueueElement *)bytes;
    total           = size - sizeof(IOHIDSystemQueueElement);

    for (index=0; index<queueElement->eventCount && offset<total; index++)
    {
        IOHIDEventData *    eventData   = queueElement->events + offset;
        IOHIDEvent *        event       = IOHIDEvent::withType(eventData->type);

        if ( !event )
            continue;

        bcopy(eventData, event->_data, event->_data->size);
        *((uint64_t *)&(event->_timeStamp)) = queueElement->timeStamp;
        event->_options = queueElement->options;

        if ( !parent )
            parent = event;
        else {
            //Append event here;
            event->release();
        }
        offset += eventData->size;
    }

    return parent;
}

//==============================================================================
// IOHIDEvent::readBytes
//==============================================================================
IOByteCount IOHIDEvent::readBytes(void * bytes, IOByteCount withLength)
{
    IOHIDSystemQueueElement *   queueElement= NULL;

    queueElement    = (IOHIDSystemQueueElement *)bytes;

    queueElement->timeStamp     = *((uint64_t *)&_timeStamp);
    queueElement->options       = _options;
    queueElement->eventCount    = _eventCount;

    //bytes += sizeof(IOHIDSystemQueueElement);
    withLength -= sizeof(IOHIDSystemQueueElement);

    return appendBytes((UInt8 *)queueElement->events, withLength);
}

//==============================================================================
// IOHIDEvent::getPhase
//==============================================================================
IOHIDEventPhaseBits IOHIDEvent::getPhase()
{
    return (_data->options >> kIOHIDEventEventOptionPhaseShift) & kIOHIDEventEventPhaseMask;
}

//==============================================================================
// IOHIDEvent::setPhase
//==============================================================================
void IOHIDEvent::setPhase(IOHIDEventPhaseBits phase)
{
    _data->options &= ~(kIOHIDEventEventPhaseMask << kIOHIDEventEventOptionPhaseShift);
    _data->options |= ((phase & kIOHIDEventEventPhaseMask) << kIOHIDEventEventOptionPhaseShift);
}

//==============================================================================
// IOHIDEvent::setDeviceID
//==============================================================================
void IOHIDEvent::setDeviceID(uint64_t deviceID)
{
    _data->deviceID = deviceID;
}