text:
import { SpanNode, SpanNodeBuilder } from './span-node';

class ClockSkew {
  constructor(params) {
    const { endpoint, skew } = params;
    this._endpoint = endpoint;
    this._skew = skew;
  }

  get endpoint() {
    return this._endpoint;
  }

  get skew() {
    return this._skew;
  }
}

export function ipsMatch(a, b) {
  // export for testing
  if (!a || !b) return false;
  if (a.ipv6 && b.ipv6 && a.ipv6 === b.ipv6) {
    return true;
  }
  if (!a.ipv4 && !b.ipv4) return false;
  return a.ipv4 === b.ipv4;
}

// If any annotation has an IP with skew associated, adjust accordingly.
function adjustTimestamps(span, skew) {
  if (!ipsMatch(skew.endpoint, span.localEndpoint)) return span;

  const result = { ...span };
  if (span.timestamp) result.timestamp = span.timestamp - skew.skew;
  const annotationLength = span.annotations.length;
  if (annotationLength > 0) result.annotations = [];
  for (let i = 0; i < annotationLength; i += 1) {
    const a = span.annotations[i];
    result.annotations[i] = {
      timestamp: a.timestamp - skew.skew,
      value: a.value,
    };
  }
  return result;
}

/* Uses span kind to determine if there's clock skew. */
export function getClockSkew(node) {
  // export for testing
  const parent = node.parent ? node.parent.span : undefined;
  const child = node.span;
  if (!parent) return undefined;

  // skew is only detectable client to server
  if (parent.kind !== 'CLIENT' || child.kind !== 'SERVER') return undefined;

  let oneWay = false;
  const clientTimestamp = parent.timestamp;
  const serverTimestamp = child.timestamp;
  if (!clientTimestamp || !serverTimestamp) return undefined;

  // skew is when the server happens before the client
  if (serverTimestamp > clientTimestamp) return undefined;

  const clientDuration = parent.duration;
  const serverDuration = child.duration;
  if (!clientDuration || !serverDuration) oneWay = true;

  const server = child.localEndpoint;
  if (!server) return undefined;
  const client = parent.localEndpoint;
  if (!client) return undefined;

  // There's no skew if the RPC is going to itself
  if (ipsMatch(server, client)) return undefined;

  if (oneWay) {
    const latency = serverTimestamp - clientTimestamp;

    // the only way there is skew is when the client appears to be after the server
    if (latency > 0) return undefined;
    // We can't currently do better than push the client and server apart by minimum duration (1)
    return new ClockSkew({ endpoint: server, skew: latency - 1 });
  }
  // If the client finished before the server (async), we still know the server must have happened
  // after the client. So, push 1us.
  if (clientDuration < serverDuration) {
    const skew = serverTimestamp - clientTimestamp - 1;
    return new ClockSkew({ endpoint: server, skew });
  }

  // We assume latency is half the difference between the client and server duration.
  const latency = (clientDuration - serverDuration) / 2;

  // We can't see skew when send happens before receive
  if (latency < 0) return undefined;

  const skew = serverTimestamp - latency - clientTimestamp;
  if (skew !== 0) return new ClockSkew({ endpoint: server, skew });

  return undefined;
}

/*
 * Recursively adjust the timestamps on the span trace. Root span is the reference point, all
 * children's timestamps gets adjusted based on that span's timestamps.
 */
function adjust(node, skewFromParent) {
  // adjust skew for the endpoint brought over from the parent span
  if (skewFromParent) {
    node.setSpan(adjustTimestamps(node.span, skewFromParent));
  }

  // Is there any skew in the current span?
  let skew = getClockSkew(node);
  if (skew) {
    // the current span's skew may be a different endpoint than its parent, so adjust again.
    node.setSpan(adjustTimestamps(node.span, skew));
  } else if (skewFromParent) {
    // Assumes we are on the same host: propagate skew from our parent
    skew = skewFromParent;
  }
  // propagate skew to any children
  node.children.forEach((child) => adjust(child, skew));
}

export function treeCorrectedForClockSkew(spans, debug = false) {
  if (spans.length === 0) return new SpanNode();

  const trace = new SpanNodeBuilder({ debug }).build(spans);

  if (!trace.span) {
    if (debug) {
      /* eslint-disable no-console */
      console.log(
        `skipping clock skew adjustment due to missing root span: traceId=${spans[0].traceId}`,
      );
    }
    return trace;
  }

  const childrenOfRoot = trace.children;
  for (let i = 0; i < childrenOfRoot.length; i += 1) {
    const next = childrenOfRoot[i].span;
    if (next.parentId || next.shared) continue;

    const { traceId } = next;
    const spanId = next.id;
    const rootSpanId = trace.span.id;
    if (debug) {
      /* eslint-disable no-console */
      const prefix = 'skipping redundant root span';
      console.log(
        `${prefix}: traceId=${traceId}, rootSpanId=${rootSpanId}, spanId=${spanId}`,
      );
    }
    return trace;
  }

  adjust(trace);
  return trace;
}


text:
package fr.landel.utils.commons.tuple;

/**
 *

 * Abstract version for overriding purpose, don't forgot to keep it immutable.
 *

 *
 *

 * An immutable quad consisting of four {@code Object} elements.
 *

 *
 *

 * Although the implementation is immutable, there is no restriction on the
 * objects that may be stored. If mutable objects are stored in the quad, then
 * the quad itself effectively becomes mutable.
 *

 *
 *

 * #ThreadSafe# if all objects are thread-safe
 *

 *
 * @param
 *            the first element type
 * @param
 *            the second element type
 * @param <C>
 *            the third element type
 * @param <D>
 *            the fourth element type
 *
 * @since Jul 26, 2016
 * @author Gilles
 *
 */
public abstract class AbstractImmutableQuad extends Quad {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 3705003920443865537L;

    /** First object */
    private final A first;
    /** Second object */
    private final B second;
    /** Third object */
    private final C third;
    /** Fourth object */
    private final D fourth;

    /**
     * Create a new immutable quad instance.
     *
     * @param first
     *            the first element, may be null
     * @param second
     *            the second element, may be null
     * @param third
     *            the third element, may be null
     * @param fourth
     *            the fourth element, may be null
     */
    public AbstractImmutableQuad(final A first, final B second, final C third, final D fourth) {
        super();
        this.first = first;
        this.second = second;
        this.third = third;
        this.fourth = fourth;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public A getFirst() {
        return this.first;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public B getSecond() {
        return this.second;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public C getThird() {
        return this.third;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public D getFourth() {
        return this.fourth;
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * @typedef {object} Phaser.Types.Loader.FileTypes.CSSFileConfig
 *
 * @property {string} key - The key of the file. Must be unique within the Loader.
 * @property {string} [url] - The absolute or relative URL to load the file from.
 * @property {string} [extension='js'] - The default file extension to use if no url is provided.
 * @property {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file.
 */


text:
#define EIGEN_USE_THREADS

#include "sparse_fill_empty_rows_op.h"

#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <utility>
#include <vector>

#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_util.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/lib/gtl/inlined_vector.h"
#include "tensorflow/core/util/sparse/sparse_tensor.h"

namespace tensorflow {

using GPUDevice = Eigen::GpuDevice;

template <typename Device, typename T>
class SparseFillEmptyRowsOp : public OpKernel {
 public:
  explicit SparseFillEmptyRowsOp(OpKernelConstruction* context)
      : OpKernel(context) {}

  void Compute(OpKernelContext* context) override {
    functor::SparseFillEmptyRowsFunctor<Device, T>()(context);
  }
};

#if GOOGLE_CUDA
#define REGISTER_KERNELS(type)                            \
  REGISTER_KERNEL_BUILDER(Name("TfraSparseFillEmptyRows") \
                              .Device(DEVICE_GPU)         \
                              .TypeConstraint<type>("T"), \
                          SparseFillEmptyRowsOp<GPUDevice, type>)
TF_CALL_int8(REGISTER_KERNELS);
TF_CALL_int32(REGISTER_KERNELS);
TF_CALL_half(REGISTER_KERNELS);
TF_CALL_float(REGISTER_KERNELS);
TF_CALL_int64(REGISTER_KERNELS);
#undef REGISTER_KERNELS
#endif  // GOOGLE_CUDA
}  // namespace tensorflow


text:
[![Build Status](https://travis-ci.org/bsiddiqui/args-to-array.svg?branch=master)](https://travis-ci.org/bsiddiqui/args-to-array) [![Code Climate](https://codeclimate.com/github/bsiddiqui/args-to-array/badges/gpa.svg)](https://codeclimate.com/github/bsiddiqui/args-to-array) [![Version](https://badge.fury.io/js/args-to-array.svg)](http://badge.fury.io/js/args-to-array) [![Downloads](http://img.shields.io/npm/dm/args-to-array.svg)](https://www.npmjs.com/package/args-to-array)

Coverts a javascript arguments object into an array

## Install
``
$ npm install --save args-to-array
``

## Usage
```js
var argsToArray = require('args-to-array')

function add (1, 2) {
  args = argsToArray(arguments)
  // => [1, 2]
  ...
}
```

## API

#### `argsToArray(arguments)` -> `array`

##### arguments
*Required* <br>
Type: `object`

The javascript [arguments object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments)


text:
<?php

namespace Aet\AnnuaireBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Aet\AnnuaireBundle\Form\Type\ContactType;
use Aet\AnnuaireBundle\Entity\Contact;
use Aet\AnnuaireBundle\Entity\User;
use Aet\AnnuaireBundle\Helpers\SearchHelper;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Aet\AnnuaireBundle\Form\Type\UserEditType;
use Aet\AnnuaireBundle\Form\Type\AetPageType;
use FOS\UserBundle\Controller\RegistrationController as BaseController;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

use ZendSearch\Lucene\Document;
use ZendSearch\Lucene\Document\Field;

class DefaultController extends Controller
{

    private $numberOfUsersPerPage = 10;
    private $aetUserSearchIndexName = "aetuserindex";

    public function indexAction()
    {
        return $this->redirect($this->generateUrl('aet_annuaire_page_view'));
        //return $this->render('AetAnnuaireBundle:Default:index.html.twig');
    }

    public function LoginBisAction()
    {
        $csrfToken = $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate');

        return $this->container->get('templating')->renderResponse('AetAnnuaireBundle:Security:login_content.html.twig', array(
            'last_username' => null,
            'error'         => null,
            'csrf_token'    => $csrfToken
        ));
    }

    public function AetListAction(Request $request)
    {

        // On vérifie que l'utilisateur dispose bien du rôle ROLE_AUTEUR
        if (!$this->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
            // Sinon on déclenche une exception « Accès interdit »
            throw new AccessDeniedException('Accès limité aux utilisateurs connectés.');
        }

        $em = $this->getDoctrine()->getManager();
        $paginator  = $this->get('knp_paginator');

        $searchText = array();

        // On crée le FormBuilder grâce au service form factory
        $formBuilder = $this->get('form.factory')->createBuilder('form', $searchText);

        // On ajoute les champs de l'entité que l'on veut à notre formulaire
        $formBuilder
            ->add('searchText',     'text', array('label'=>false, 'required'=>false))
            ->add('search',      'submit')
        ;

        // À partir du formBuilder, on génère le formulaire
        $searchForm = $formBuilder->getForm();

        $searchForm->handleRequest($request);
        if ($searchForm->isValid()) {
            // On l'enregistre notre objet $advert dans la base de données, par exemple

            $searchQueryValue = trim($searchForm["searchText"]->getData());

            if ($searchQueryValue === "")
            {
                return $this->redirect($this->generateUrl('aet_annuaire_aetlist'));
            }

            /*$elasticaManager = $this->container->get('fos_elastica.manager');
            $foundUsers = $elasticaManager->getRepository('AetAnnuaireBundle:User')->AetUserSearch($searchQueryValue);*/

            /*$foundUsers = $em
                ->getRepository('AetAnnuaireBundle:User')
                ->AetUserSearch($searchQueryValue);*/

            $index = $this->get('ivory_lucene_search')->getIndex($this->aetUserSearchIndexName);
            $foundUsers = $this->luceneSearchAetUsers($index,$searchQueryValue);

            $pagination = $paginator->paginate(
                $foundUsers,
                $request->query->get('page', 1),
                $this->numberOfUsersPerPage
            );

            return $this->render('AetAnnuaireBundle:Page:aetlist.html.twig',
                array('pagination' => $pagination, 'searchForm' => $searchForm->createView()));

        }

        $users = $em
            ->getRepository('AetAnnuaireBundle:User')
            ->findAll();

        $pagination = $paginator->paginate(
            $users,
            $request->query->get('page', 1),
            $this->numberOfUsersPerPage
        );

        return $this->render('AetAnnuaireBundle:Page:aetlist.html.twig',
            array('pagination' => $pagination, 'searchForm' => $searchForm->createView()));
    }

    public function ViewAetProfileAction($id, Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        // On récupère l'annonce $id
        $aet = $em
            ->getRepository('AetAnnuaireBundle:User')
            ->find($id);

        //$comment = new Comment();

        if (null === $aet) {
            throw new NotFoundHttpException("L'utilisateur AET d'id ".$id." n'existe pas.");
        }

        return $this->render('AetAnnuaireBundle:Page:aetprofile.view.html.twig',
            array('aetUser' => $aet
            ));
    }

    public function EditAetProfileAction($id, Request $request)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $user = $this->get('security.context')->getToken()->getUser();
        $connectedUserId = $user->getId();

        // On vérifie que l'utilisateur dispose bien du rôle ROLE_AUTEUR
        if ($connectedUserId != $id) {
            // Sinon on déclenche une exception « Accès interdit »
            throw new AccessDeniedException('Vous n\'avez pas le droit d\'éditer ce profil.');
        }
        $aetEntity = $em->getRepository('AetAnnuaireBundle:User')->find($id);

        $form = $this->createForm(new UserEditType(), $aetEntity);

        $form->handleRequest($request);

        if ($request->getMethod() === 'POST')
        {

            if ($form->isValid()) {
                $em->persist($aetEntity);
                $em->flush();

                //Reindex the user for search
                $index = $this->get('ivory_lucene_search')->getIndex($this->aetUserSearchIndexName);

                //Update the search index
                $dbIdTerm = new \ZendSearch\Lucene\Index\Term($aetEntity->getId(), 'dbId');
                $dbIdSubQuery = new \ZendSearch\Lucene\Search\Query\Term($dbIdTerm);

                $foundDocuments = $index->find($dbIdSubQuery);
                //$docNum = count($foundDocuments);
                foreach ($foundDocuments as $foundDoc)
                {
                    $index->delete($foundDoc->id);
                }

                $this->addAetUserToSearchIndex($index,$aetEntity);

                return $this->redirect($this->generateUrl('aet_annuaire_aetprofile_view',array('id'=>$id)));
            }

            $em->refresh($user); // Add this line
        }

        return $this->render('AetAnnuaireBundle:Page:aetprofile.edit.html.twig', array(
            'aetUser'      => $aetEntity,
            'form'   => $form->createView(),
        ));
    }

#Page de contact de l'association des Aet
    public function contactAction(Request $request)
    {
        $contact=new Contact();
        $form = $this->createForm(new ContactType(), $contact);
        $form->handleRequest($request);

        if ($form->isValid()) {
            // fait quelque chose comme sauvegarder la tâche dans la bdd
// fait quelque chose comme sauvegarder la tâche dans la bdd
            $message = \Swift_Message::newInstance()
                ->setSubject($contact->getSubject())
                ->setFrom($contact->getEmail())
                ->setTo($this->container->getParameter('aet_annuaire.emails.contact_email'))
                ->setBody($this->renderView('AetAnnuaireBundle:Page:contactEmail.txt.twig', array('contact' => $contact)));

            $this->get('mailer')->send($message);

            $this->get('session')->getFlashBag()->add('blogger-notice', 'Your contact enquiry was successfully sent. Thank you!');

            return $this->redirect($this->generateUrl('aet_annuaire_contact'));
        }

        return $this->render('AetAnnuaireBundle:Page:contact.html.twig',array(
            'form' => $form->createView()
        ));
    }

    public function registerAction(Request $request)
    {
        $mail='a.moctarsidibe@gmail.com';
        $form = $this->container->get('fos_user.registration.form');
        $formHandler = $this->container->get('fos_user.registration.form.handler');
        $confirmationEnabled = $this->container->getParameter('fos_user.registration.confirmation.enabled');

        $process = $formHandler->process($confirmationEnabled);
        if ($process) {
            $user = $form->getData();

            /*****************************************************
             * Add new functionality (e.g. log the registration) *
             *****************************************************/
            $this->container->get('logger')->info(
                sprintf('New user registration: %s', $user)
            );

            if ($confirmationEnabled) {
               $this->container->get('session')->set('fos_user_send_confirmation_email/email', $user->getEmail());

                $route = 'fos_user_registration_check_email';
            } else {
                $this->authenticateUser($user);
                $route = 'fos_user_registration_confirmed';
                //Index user entity for search
                $index = $this->get('ivory_lucene_search')->getIndex($this->aetUserSearchIndexName);
                $this->addAetUserToSearchIndex($index,$user);
            }

            $this->setFlash('fos_user_success', 'registration.flash.user_created');
            $url = $this->container->get('router')->generate($route);

            return new RedirectResponse($url);
        }

        return $this->container->get('templating')->renderResponse('AetAnnuaireBundle:Registration:register.html.twig', array(
            'form' => $form->createView(),
        ));
    }

    public function PageViewAction($urlId, Request $request)
    {

        $em = $this->getDoctrine()->getManager();
        // On récupère l'annonce $id
        $aetPage = $em
            ->getRepository('AetAnnuaireBundle:AetPage')
            ->findOneByUrlId($urlId);

        //$comment = new Comment();

        if (null === $aetPage) {
            throw new NotFoundHttpException("La page d'url ".$urlId." n'existe pas.");
        }

        return $this->render('AetAnnuaireBundle:Page:aetpage.view.html.twig',
            array('AetPage' => $aetPage

            ));

    }

    public function PageEditAction($urlId, Request $request)
    {
        // On vérifie que l'utilisateur dispose bien du rôle ROLE_AUTEUR
        if (!$this->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
            // Sinon on déclenche une exception « Accès interdit »
            throw new AccessDeniedException('Accès limité aux utilisateurs connectés.');
        }

        // On l'enregistre notre objet $advert dans la base de données, par exemple
        $em = $this->getDoctrine()->getManager();

        $aetPage = $em->getRepository('AetAnnuaireBundle:AetPage')
                            ->findOneByUrlId($urlId);

        $authorizationChecker = $this->get('security.context');

        // check for edit access
        if (false === $authorizationChecker->isGranted('ROLE_ADMIN')) {
            throw new AccessDeniedException('Vous n\'avez pas la permission d\'éditer cette page');
        }

        // À partir du formBuilder, on génère le formulaire
        //$form = $formBuilder->getForm();
        $form = $this->createForm(new AetPageType(), $aetPage);

        // On fait le lien Requête <-> Formulaire
        // À partir de maintenant, la variable $advert contient les valeurs entrées dans le formulaire par le visiteur
        $form->handleRequest($request);

        // On vérifie que les valeurs entrées sont correctes
        // (Nous verrons la validation des objets en détail dans le prochain chapitre)
        if ($form->isValid()) {

            //We modify the 'alt' attribute to make sure that the "PreUpdate" event is fired in the "Image" Entity
            //$communication->getImage()->setAlt("forUpdate");

            $em->persist($aetPage);

            $em->flush();

            //$request->getSession()->getFlashBag()->add('notice', 'Communication bien enregistrée.');

            // On redirige vers la page de visualisation de l'annonce nouvellement créée
            return $this->redirect($this->generateUrl('aet_annuaire_page_view', array('urlId' => $aetPage->getUrlId())));
        }

        // Si on n'est pas en POST, alors on affiche le formulaire
        return $this->render('AetAnnuaireBundle:Page:aetpage.edit.html.twig', array('AetPage'=>$aetPage, 'form' => $form->createView()));
    }

    public function eraseAetUserIndexAction()
    {
        // On vérifie que l'utilisateur dispose bien du rôle ROLE_ADMIN
        if (!$this->get('security.context')->isGranted('ROLE_ADMIN')) {
            // Sinon on déclenche une exception « Accès interdit »
            throw new AccessDeniedException('Accès limité aux ADMINISTRATEURS.');
        }

        $luceneSearch = $this->get('ivory_lucene_search');
        $luceneSearch->eraseIndex($this->aetUserSearchIndexName);

        return $this->redirect($this->generateUrl('aet_annuaire_aetlist'));
    }

    public function indexAetUsersAction()
    {
        // On vérifie que l'utilisateur dispose bien du rôle ROLE_ADMIN
        if (!$this->get('security.context')->isGranted('ROLE_ADMIN')) {
            // Sinon on déclenche une exception « Accès interdit »
            throw new AccessDeniedException('Accès limité aux ADMINISTRATEURS.');
        }

        $em = $this->getDoctrine()->getManager();
        // Ici, on récupérera la liste des annonces, puis on la passera au template
        // Notre liste d'annonce en dur listAdverts
        $listAetUserss = $em
            ->getRepository('AetAnnuaireBundle:User')
            ->findAll()
        ;
        $index = $this->get('ivory_lucene_search')->getIndex($this->aetUserSearchIndexName);

        foreach ($listAetUserss as $aetUser)
        {
            $this->addAetUserToSearchIndex($index,$aetUser);
        }

        return $this->redirect($this->generateUrl('aet_annuaire_aetlist'));

    }

    public function addAetUserToSearchIndex($index, User $aetUser)
    {
        // Create a new document
        $document = new Document();

        $document->addField(Field::keyword('dbId', $aetUser->getId(),'utf-8'));
        $document->addField(Field::unStored('firstname', $aetUser->getFirstname(), 'utf-8'));
        $document->addField(Field::unStored('lastname', $aetUser->getLastname(), 'utf-8'));
        $document->addField(Field::unStored('activiteprincipale', $aetUser->getActivitePrincipale(), 'utf-8'));
        $document->addField(Field::unStored('codepostal', $aetUser->getCodePostale(), 'utf-8'));
        $document->addField(Field::unStored('email', $aetUser->getEmail(), 'utf-8'));
        $document->addField(Field::unStored('matricule', $aetUser->getMatricule(), 'utf-8'));
        $document->addField(Field::unStored('pays', $aetUser->getPays(), 'utf-8'));
        $document->addField(Field::unStored('promotion', strval($aetUser->getPromotion()->format("Y")), 'utf-8'));
        $document->addField(Field::unStored('telephone', strval($aetUser->getTelephone()), 'utf-8'));
        $document->addField(Field::unStored('ville', $aetUser->getVille(), 'utf-8'));
        $document->addField(Field::unStored('whoami', $aetUser->getWhoami(), 'utf-8'));

        // Add your document to the index
        $index->addDocument($document);

        // Commit your change
        $index->commit();

        $index->optimize();
    }

    public function luceneSearchAetUsers($index, $searchKeyWord)
    {
        $dbIds = Array();
        $searchValue = SearchHelper::utf8_to_ascii( mb_strtolower($searchKeyWord, "UTF-8"));
        $em = $this->getDoctrine()->getManager();

        $term1 = new \ZendSearch\Lucene\Index\Term($searchValue, 'firstname');
        //$subquery1 = new \ZendSearch\Lucene\Search\Query\Term($term1);

        $term2 = new \ZendSearch\Lucene\Index\Term($searchValue, 'lastname');
        //$subquery2 = new \ZendSearch\Lucene\Search\Query\Term($term2);

        $term3 = new \ZendSearch\Lucene\Index\Term($searchValue, 'activiteprincipale');
        //$subquery3 = new \ZendSearch\Lucene\Search\Query\Term($term3);

        $term4 = new \ZendSearch\Lucene\Index\Term($searchValue, 'codepostal');
        //$subquery4 = new \ZendSearch\Lucene\Search\Query\Term($term4);

        $term5 = new \ZendSearch\Lucene\Index\Term($searchValue, 'email');
        //$subquery5 = new \ZendSearch\Lucene\Search\Query\Term($term5);

        $term6 = new \ZendSearch\Lucene\Index\Term($searchValue, 'matricule');
        //$subquery6 = new \ZendSearch\Lucene\Search\Query\Term($term6);

        $term7 = new \ZendSearch\Lucene\Index\Term($searchValue, 'pays');
        //$subquery7 = new \ZendSearch\Lucene\Search\Query\Term($term7);

        $term8 = new \ZendSearch\Lucene\Index\Term($searchValue, 'promotion');
        //$subquery8 = new \ZendSearch\Lucene\Search\Query\Term($term8);

        $term9 = new \ZendSearch\Lucene\Index\Term($searchValue, 'telephone');
        //$subquery9 = new \ZendSearch\Lucene\Search\Query\Term($term9);

        $term10 = new \ZendSearch\Lucene\Index\Term($searchValue, 'ville');
        //$subquery10 = new \ZendSearch\Lucene\Search\Query\Term($term10);

        $term11 = new \ZendSearch\Lucene\Index\Term($searchValue, 'whoami');
        //$subquery11 = new \ZendSearch\Lucene\Search\Query\Term($term11);

        //$subqueries = array($subquery1, $subquery2, $subquery3, $subquery4, $subquery5, $subquery6, $subquery7, $subquery8, $subquery9, $subquery10, $subquery11);
        $terms = array($term1, $term2, $term3, $term4, $term5, $term6, $term7, $term8, $term9, $term10, $term11);
        $signs = array(null, null, null, null, null, null, null, null, null, null, null);

        $termsQuery = new \ZendSearch\Lucene\Search\Query\MultiTerm($terms, $signs);
        //$boolQuery = new \ZendSearch\Lucene\Search\Query\Boolean($subqueries, $signs);

        $foundDocuments = $index->find($termsQuery);
        //$docNum = count($foundDocuments);
        foreach ($foundDocuments as $foundDoc)
        {
            $dbIds[] = $foundDoc->dbId;
        }

        $results = $em->getRepository('AetAnnuaireBundle:User')->findById($dbIds);

        return $results;
    }

}


text:
<?php

declare(strict_types=1);

namespace Sylius\Component\Addressing\Model;

use Sylius\Component\Resource\Model\TimestampableTrait;

/**
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class Address implements AddressInterface
{
    use TimestampableTrait;

    /**
     * @var mixed
     */
    protected $id;

    /**
     * @var string|null
     */
    protected $firstName;

    /**
     * @var string|null
     */
    protected $lastName;

    /**
     * @var string|null
     */
    protected $phoneNumber;

    /**
     * @var string|null
     */
    protected $company;

    /**
     * @var string|null
     */
    protected $countryCode;

    /**
     * @var string|null
     */
    protected $provinceCode;

    /**
     * @var string|null
     */
    protected $provinceName;

    /**
     * @var string|null
     */
    protected $street;

    /**
     * @var string|null
     */
    protected $city;

    /**
     * @var string|null
     */
    protected $postcode;

    public function __construct()
    {
        $this->createdAt = new \DateTime();
    }

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

    /**
     * {@inheritdoc}
     */
    public function getFirstName(): ?string
    {
        return $this->firstName;
    }

    /**
     * {@inheritdoc}
     */
    public function setFirstName(?string $firstName): void
    {
        $this->firstName = $firstName;
    }

    /**
     * {@inheritdoc}
     */
    public function getLastName(): ?string
    {
        return $this->lastName;
    }

    /**
     * {@inheritdoc}
     */
    public function setLastName(?string $lastName): void
    {
        $this->lastName = $lastName;
    }

    /**
     * {@inheritdoc}
     */
    public function getFullName(): string
    {
        return trim(sprintf('%s %s', $this->firstName, $this->lastName));
    }

    /**
     * {@inheritdoc}
     */
    public function getPhoneNumber(): ?string
    {
        return $this->phoneNumber;
    }

    /**
     * {@inheritdoc}
     */
    public function setPhoneNumber(?string $phoneNumber): void
    {
        $this->phoneNumber = $phoneNumber;
    }

    /**
     * {@inheritdoc}
     */
    public function getCompany(): ?string
    {
        return $this->company;
    }

    /**
     * {@inheritdoc}
     */
    public function setCompany(?string $company): void
    {
        $this->company = $company;
    }

    /**
     * {@inheritdoc}
     */
    public function getCountryCode(): ?string
    {
        return $this->countryCode;
    }

    /**
     * {@inheritdoc}
     */
    public function setCountryCode(?string $countryCode): void
    {
        if (null === $countryCode) {
            $this->provinceCode = null;
        }

        $this->countryCode = $countryCode;
    }

    /**
     * {@inheritdoc}
     */
    public function getProvinceCode(): ?string
    {
        return $this->provinceCode;
    }

    /**
     * {@inheritdoc}
     */
    public function setProvinceCode(?string $provinceCode): void
    {
        if (null === $this->countryCode) {
            return;
        }

        $this->provinceCode = $provinceCode;
    }

    /**
     * {@inheritdoc}
     */
    public function getProvinceName(): ?string
    {
        return $this->provinceName;
    }

    /**
     * {@inheritdoc}
     */
    public function setProvinceName(?string $provinceName): void
    {
        $this->provinceName = $provinceName;
    }

    /**
     * {@inheritdoc}
     */
    public function getStreet(): ?string
    {
        return $this->street;
    }

    /**
     * {@inheritdoc}
     */
    public function setStreet(?string $street): void
    {
        $this->street = $street;
    }

    /**
     * {@inheritdoc}
     */
    public function getCity(): ?string
    {
        return $this->city;
    }

    /**
     * {@inheritdoc}
     */
    public function setCity(?string $city): void
    {
        $this->city = $city;
    }

    /**
     * {@inheritdoc}
     */
    public function getPostcode(): ?string
    {
        return $this->postcode;
    }

    /**
     * {@inheritdoc}
     */
    public function setPostcode(?string $postcode): void
    {
        $this->postcode = $postcode;
    }
}


text:
module SwitchUser
  module Provider
    class Sorcery < Base
      def initialize(controller)
        @controller = controller
      end

      def login(user, _scope = nil)
        @controller.auto_login(user)
      end

      def logout(_scope = nil)
        save_original_user_identifier if SwitchUser.switch_back

        @controller.logout

        restore_original_user_identifier
      end

      def save_original_user_identifier
        @original_user_scope_identifier = @controller.session[:original_user_scope_identifier]
      end

      def restore_original_user_identifier
        @controller.session[:original_user_scope_identifier] =
          @original_user_scope_identifier if @original_user_scope_identifier
      end

      def current_user(_scope = nil)
        @controller.current_user
      end
    end
  end
end


text:
/** navbar */
directive_module.directive('apollonav',
    function ($compile, $window, $translate, toastr, AppUtil, AppService, EnvService,
        UserService, CommonService, PermissionService) {
        return {
            restrict: 'E',
            templateUrl: AppUtil.prefixPath() + '/views/common/nav.html',
            transclude: true,
            replace: true,
            link: function (scope, element, attrs) {

                CommonService.getPageSetting().then(function (setting) {
                    scope.pageSetting = setting;
                });

               // Looks like a trick to make xml/yml/json namespaces display right, but why?
               $(document).on('click', function () {
                   scope.$apply(function () {});
               });

               $translate('ApolloConfirmDialog.SearchPlaceHolder').then(function(placeholderLabel)  {
                   $('#app-search-list').select2({
                      placeholder: placeholderLabel,
                      ajax: {
                        url: AppUtil.prefixPath() + "/apps/search/by-appid-or-name",
                        dataType: 'json',
                        delay: 400,
                        data: function (params) {
                            return {
                                query: params.term || '',
                                page: params.page ? params.page - 1 : 0,
                                    size: 20
                                };
                            },
                            processResults: function (data) {
                                if (data && data.content) {
                                    var hasMore = data.content.length
                                        === data.size;
                                    var result = [];
                                    data.content.forEach(function (app) {
                                        result.push({
                                            id: app.appId,
                                            text: app.appId + ' / ' + app.name
                                        })
                                    });
                                    return {
                                        results: result,
                                        pagination: {
                                            more: hasMore
                                        }
                                    };
                                } else {
                                    return {
                                        results: [],
                                        pagination: {
                                            more: false
                                        }
                                    };
                                }

                            }
                        }
                    });

                    $('#app-search-list').on('select2:select', function () {
                        var selected = $('#app-search-list').select2('data');
                        if (selected && selected.length) {
                            jumpToConfigPage(selected[0].id)
                        }
                    });
                });

                function jumpToConfigPage(selectedAppId) {
                    if ($window.location.href.indexOf("config.html") > -1) {
                        $window.location.hash = "appid=" + selectedAppId;
                        $window.location.reload();
                    } else {
                        $window.location.href = AppUtil.prefixPath() + '/config.html?#appid=' + selectedAppId;
                    }
                };

                UserService.load_user().then(function (result) {
                    scope.userName = result.userId;
                    scope.userDisplayName = result.name;
                }, function (result) {

                });

                PermissionService.has_root_permission().then(function (result) {
                    scope.hasRootPermission = result.hasPermission;
                })

                scope.changeLanguage = function (lang) {
                    $translate.use(lang)
                }
            }
        }

    });

/** env cluster selector*/
directive_module.directive('apolloclusterselector', function ($compile, $window, AppService, AppUtil, toastr) {
    return {
        restrict: 'E',
        templateUrl: AppUtil.prefixPath() + '/views/component/env-selector.html',
        transclude: true,
        replace: true,
        scope: {
            appId: '=apolloAppId',
            defaultAllChecked: '=apolloDefaultAllChecked',
            select: '=apolloSelect',
            defaultCheckedEnv: '=apolloDefaultCheckedEnv',
            defaultCheckedCluster: '=apolloDefaultCheckedCluster',
            notCheckedEnv: '=apolloNotCheckedEnv',
            notCheckedCluster: '=apolloNotCheckedCluster'
        },
        link: function (scope, element, attrs) {

            scope.$watch("defaultCheckedEnv", refreshClusterList);
            scope.$watch("defaultCheckedCluster", refreshClusterList);

            refreshClusterList();

            function refreshClusterList() {
                AppService.load_nav_tree(scope.appId).then(function (result) {
                    scope.clusters = [];
                    var envClusterInfo = AppUtil.collectData(result);
                    envClusterInfo.forEach(function (node) {
                        var env = node.env;
                        node.clusters.forEach(function (cluster) {
                            cluster.env = env;
                            //default checked
                            cluster.checked = scope.defaultAllChecked ||
                                (cluster.env == scope.defaultCheckedEnv && cluster.name
                                    == scope.defaultCheckedCluster);
                            //not checked
                            if (cluster.env == scope.notCheckedEnv && cluster.name == scope.notCheckedCluster) {
                                cluster.checked = false;
                            }

                            scope.clusters.push(cluster);
                        })
                    });
                    scope.select(collectSelectedClusters());
                });
            }

            scope.envAllSelected = scope.defaultAllChecked;

            scope.toggleEnvsCheckedStatus = function () {
                scope.envAllSelected = !scope.envAllSelected;
                scope.clusters.forEach(function (cluster) {
                    cluster.checked = scope.envAllSelected;
                });
                scope.select(collectSelectedClusters());
            };

            scope.switchSelect = function (o, $event) {
                o.checked = !o.checked;
                $event.stopPropagation();
                scope.select(collectSelectedClusters());
            };

            scope.toggleClusterCheckedStatus = function (cluster) {
                cluster.checked = !cluster.checked;
                scope.select(collectSelectedClusters());
            };

            function collectSelectedClusters() {
                var selectedClusters = [];
                scope.clusters.forEach(function (cluster) {
                    if (cluster.checked) {
                        cluster.clusterName = cluster.name;
                        selectedClusters.push(cluster);
                    }
                });
                return selectedClusters;
            }

        }
    }

});

/** 必填项*/
directive_module.directive('apollorequiredfield', function ($compile, $window) {
    return {
        restrict: 'E',
        template: '*',
        transclude: true,
        replace: true
    }
});

/**  确认框 */
directive_module.directive('apolloconfirmdialog', function ($compile, $window, $sce,$translate,AppUtil) {
    return {
        restrict: 'E',
        templateUrl: AppUtil.prefixPath() + '/views/component/confirm-dialog.html',
        transclude: true,
        replace: true,
        scope: {
            dialogId: '=apolloDialogId',
            title: '=apolloTitle',
            detail: '=apolloDetail',
            showCancelBtn: '=apolloShowCancelBtn',
            doConfirm: '=apolloConfirm',
            extraClass: '=apolloExtraClass',
            confirmBtnText: '=?',
            cancel: '='
        },
        link: function (scope, element, attrs) {

            scope.$watch("detail", function () {
                scope.detailAsHtml = $sce.trustAsHtml(scope.detail);
            });

            if (!scope.confirmBtnText) {
                scope.confirmBtnText = $translate.instant('ApolloConfirmDialog.DefaultConfirmBtnName');
            }

            scope.confirm = function () {
                if (scope.doConfirm) {
                    scope.doConfirm();
                }
            };

        }
    }
});

/** entrance */
directive_module.directive('apolloentrance', function ($compile, $window,AppUtil) {
    return {
        restrict: 'E',
        templateUrl: AppUtil.prefixPath() + '/views/component/entrance.html',
        transclude: true,
        replace: true,
        scope: {
            imgSrc: '=apolloImgSrc',
            title: '=apolloTitle',
            href: '=apolloHref'
        },
        link: function (scope, element, attrs) {
        }
    }
});

/** entrance */
directive_module.directive('apollouserselector', function ($compile, $window,AppUtil) {
    return {
        restrict: 'E',
        templateUrl: AppUtil.prefixPath() + '/views/component/user-selector.html',
        transclude: true,
        replace: true,
        scope: {
            id: '=apolloId',
            disabled: '='
        },
        link: function (scope, element, attrs) {

            scope.$watch("id", initSelect2);

            var select2Options = {
                ajax: {
                    url: AppUtil.prefixPath() + '/users',
                    dataType: 'json',
                    delay: 250,
                    data: function (params) {
                        return {
                            keyword: params.term ? params.term : '',
                            limit: 100
                        }
                    },
                    processResults: function (data, params) {
                        var users = [];
                        data.forEach(function (user) {
                            users.push({
                                id: user.userId,
                                text: user.userId + " | " + user.name + " | " + user.email
                            })
                        });
                        return {
                            results: users
                        }

                    },
                    cache: true,
                    minimumInputLength: 5
                }
            };

            function initSelect2() {
                $('.' + scope.id).select2(select2Options);
            }

        }
    }
});

directive_module.directive('apollomultipleuserselector', function ($compile, $window,AppUtil) {
    return {
        restrict: 'E',
        templateUrl: AppUtil.prefixPath() + '/views/component/multiple-user-selector.html',
        transclude: true,
        replace: true,
        scope: {
            id: '=apolloId'
        },
        link: function (scope, element, attrs) {

            scope.$watch("id", initSelect2);

            var searchUsersAjax = {
                ajax: {
                    url: AppUtil.prefixPath() + '/users',
                    dataType: 'json',
                    delay: 250,
                    data: function (params) {
                        return {
                            keyword: params.term ? params.term : '',
                            limit: 100
                        }
                    },
                    processResults: function (data, params) {
                        var users = [];
                        data.forEach(function (user) {
                            users.push({
                                id: user.userId,
                                text: user.userId + " | " + user.name + " | " + user.email
                            })
                        });
                        return {
                            results: users
                        }

                    },
                    cache: true,
                    minimumInputLength: 5
                }
            };

            function initSelect2() {
                $('.' + scope.id).select2(searchUsersAjax);
            }
        }
    }
});


text:
function a() {
  function b() {
	queryThenMutateDOM(
      () => {
        title = SomeThing.call(root, 'someLongStringThatPushesThisTextReallyFar')[0];
      }
    );
  }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence
	xmlns="http://java.sun.com/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://java.sun.com/xml/ns/persistence
		http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
	version="1.0">

	<persistence-unit name="transactions-optional">
		<provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</provider>
		<properties>
			<property name="datanucleus.NontransactionalRead" value="true" />
			<property name="datanucleus.NontransactionalWrite" value="true" />
			<property name="datanucleus.ConnectionURL" value="appengine" />
		</properties>
	</persistence-unit>

</persistence>


text:
import os
import sys
from setuptools import setup

install_requires = ["requests"]
#tests_require = ["mock", "unittest2"]
tests_require = ["coverage", "nose"]

base_dir = os.path.dirname(os.path.abspath(__file__))

version = "0.1"

#if sys.argv[-1] == 'publish':
#    os.system("git tag -a %s -m 'v%s'" % (version, version))
#    os.system("python setup.py sdist bdist_wheel upload -r pypi")
#    print("Published version %s, do `git push --tags` to push new tag to remote" % version)
#    sys.exit()

#if sys.argv[-1] == 'syncci':
#    os.system("panci --to=tox .travis.yml > tox.ini");
#    sys.exit();

setup(
    name = "inferelator_strawman",
    version = version,
    description = "inferelator refactor strawman",
    long_description="\n\n".join([
        open(os.path.join(base_dir, "README.md"), "r").read(),
        #open(os.path.join(base_dir, "CHANGELOG.rst"), "r").read()
    ]),
    url = "https://github.com/AaronWatters/inferelator_strawman",
    author = "Aaron Watters",
    author_email = "awatters@simonsfoundation.org",
    maintainer = "Aaron Watters",
    maintainer_email = "awatters@simonsfoundation.org",
    packages = ["inferelator_strawman"],
    zip_safe = False,
    install_requires = install_requires,
    tests_require = tests_require,
    test_suite = "nose.collector",
)


text:
from tempest.api.identity import base
from tempest import clients
from tempest.common import custom_matchers
from tempest.common import isolated_creds
from tempest import config
from tempest import exceptions
import tempest.test

CONF = config.CONF

class BaseObjectTest(tempest.test.BaseTestCase):

    @classmethod
    def setUpClass(cls):
        cls.set_network_resources()
        super(BaseObjectTest, cls).setUpClass()
        if not CONF.service_available.swift:
            skip_msg = ("%s skipped as swift is not available" % cls.__name__)
            raise cls.skipException(skip_msg)
        cls.isolated_creds = isolated_creds.IsolatedCreds(
            cls.__name__, network_resources=cls.network_resources)
        if CONF.compute.allow_tenant_isolation:
            # Get isolated creds for normal user
            cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
            # Get isolated creds for admin user
            cls.os_admin = clients.Manager(
                cls.isolated_creds.get_admin_creds())
            # Get isolated creds for alt user
            cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
            # Add isolated users to operator role so that they can create a
            # container in swift.
            cls._assign_member_role()
        else:
            cls.os = clients.Manager()
            cls.os_admin = clients.AdminManager()
            cls.os_alt = clients.AltManager()

        cls.object_client = cls.os.object_client
        cls.container_client = cls.os.container_client
        cls.account_client = cls.os.account_client
        cls.custom_object_client = cls.os.custom_object_client
        cls.token_client = cls.os_admin.token_client
        cls.identity_admin_client = cls.os_admin.identity_client
        cls.custom_account_client = cls.os.custom_account_client
        cls.object_client_alt = cls.os_alt.object_client
        cls.container_client_alt = cls.os_alt.container_client
        cls.identity_client_alt = cls.os_alt.identity_client

        # Make sure we get fresh auth data after assigning swift role
        cls.object_client.auth_provider.clear_auth()
        cls.container_client.auth_provider.clear_auth()
        cls.account_client.auth_provider.clear_auth()
        cls.custom_object_client.auth_provider.clear_auth()
        cls.custom_account_client.auth_provider.clear_auth()
        cls.object_client_alt.auth_provider.clear_auth()
        cls.container_client_alt.auth_provider.clear_auth()

        cls.data = base.DataGenerator(cls.identity_admin_client)

    @classmethod
    def tearDownClass(cls):
        cls.isolated_creds.clear_isolated_creds()
        super(BaseObjectTest, cls).tearDownClass()

    @classmethod
    def _assign_member_role(cls):
        primary_creds = cls.isolated_creds.get_primary_creds()
        alt_creds = cls.isolated_creds.get_alt_creds()
        swift_role = CONF.object_storage.operator_role
        try:
            resp, roles = cls.os_admin.identity_client.list_roles()
            role = next(r for r in roles if r['name'] == swift_role)
        except StopIteration:
            msg = "No role named %s found" % swift_role
            raise exceptions.NotFound(msg)
        for creds in [primary_creds, alt_creds]:
            cls.os_admin.identity_client.assign_user_role(creds.tenant_id,
                                                          creds.user_id,
                                                          role['id'])

    @classmethod
    def delete_containers(cls, containers, container_client=None,
                          object_client=None):
        """Remove given containers and all objects in them.

        The containers should be visible from the container_client given.
        Will not throw any error if the containers don't exist.
        Will not check that object and container deletions succeed.

        :param containers: list of container names to remove
        :param container_client: if None, use cls.container_client, this means
            that the default testing user will be used (see 'username' in
            'etc/tempest.conf')
        :param object_client: if None, use cls.object_client
        """
        if container_client is None:
            container_client = cls.container_client
        if object_client is None:
            object_client = cls.object_client
        for cont in containers:
            try:
                objlist = container_client.list_all_container_objects(cont)
                # delete every object in the container
                for obj in objlist:
                    try:
                        object_client.delete_object(cont, obj['name'])
                    except exceptions.NotFound:
                        pass
                container_client.delete_container(cont)
            except exceptions.NotFound:
                pass

    def assertHeaders(self, resp, target, method):
        """
        Common method to check the existence and the format of common response
        headers
        """
        self.assertThat(resp, custom_matchers.ExistsAllResponseHeaders(
                        target, method))
        self.assertThat(resp, custom_matchers.AreAllWellFormatted())


text:
#ifndef QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_PROJECT_HPP_
#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_PROJECT_HPP_

#include <memory>
#include <string>
#include <vector>

#include "query_optimizer/OptimizerTree.hpp"
#include "query_optimizer/expressions/AttributeReference.hpp"
#include "query_optimizer/expressions/Expression.hpp"
#include "query_optimizer/expressions/NamedExpression.hpp"
#include "query_optimizer/logical/Logical.hpp"
#include "query_optimizer/logical/LogicalType.hpp"
#include "utility/Macros.hpp"

namespace quickstep {
namespace optimizer {
namespace logical {

/** \addtogroup OptimizerLogical
 *  @{
 */

class Project;
typedef std::shared_ptr<const Project> ProjectPtr;

/**
 * @brief Project operator that computes the values of a list of expressions for
 *        each input tuple and outputs them as a new relation.
 */
class Project : public Logical {
 public:
  LogicalType getLogicalType() const override { return LogicalType::kProject; }

  std::string getName() const override { return "Project"; }

  /**
   * @return The expressions to be evaluated by the Project.
   */
  const std::vector<expressions::NamedExpressionPtr>& project_expressions() const {
    return project_expressions_;
  }

  /**
   * @return The input operator.
   */
  const LogicalPtr& input() const { return input_; }

  LogicalPtr copyWithNewChildren(
      const std::vector<LogicalPtr> &new_children) const override;

  LogicalPtr copyWithNewInputExpressions(
      const std::vector<expressions::ExpressionPtr> &input_expressions) const override;

  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;

  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;

  /**
   * @brief Creates a Project that computes \p project_expressions on the
   *        relation produced by \p input.
   *
   * @param input The input operator to this Project.
   * @param project_expressions The project expressions.
   * @return An immutable Project.
   */
  static ProjectPtr Create(
      const LogicalPtr &input,
      const std::vector<expressions::NamedExpressionPtr> &project_expressions) {
    return ProjectPtr(new Project(input, project_expressions));
  }

 protected:
  void getFieldStringItems(
      std::vector<std::string> *inline_field_names,
      std::vector<std::string> *inline_field_values,
      std::vector<std::string> *non_container_child_field_names,
      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
      std::vector<std::string> *container_child_field_names,
      std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;

 private:
  Project(
      const LogicalPtr &input,
      const std::vector<expressions::NamedExpressionPtr> &project_expressions)
      : input_(input), project_expressions_(project_expressions) {
    addChild(input);
    addInputExpressions(project_expressions_);
  }

  const LogicalPtr input_;
  const std::vector<expressions::NamedExpressionPtr> project_expressions_;

  DISALLOW_COPY_AND_ASSIGN(Project);
};

/** @} */

}  // namespace logical
}  // namespace optimizer
}  // namespace quickstep

#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_PROJECT_HPP_ */


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

namespace Mepham.Forum.Models.Entities
{
    /// <summary>
    /// Is a user of the system, can create Topics, Posts and Comments.
    /// Will be defined as a Moderator when creating a Topic and an Author
    /// when creating a Post / Comment
    /// </summary>
    public class User : BaseEntity
    {
        [Required]
        public string Username { get; set; }

        [Required]
        public string Password { get; set; }

        #region Navigation Properties

        public virtual ICollection<Topic> ModeratingTopics { get; set; }

        public virtual ICollection<Post> AuthoredPosts { get; set; }

        public virtual ICollection<Comment> AuthoredComments { get; set; }

        #endregion
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingLeft="7dip"
    android:paddingRight="7dip"
    android:gravity="end|right">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="106dp"
        android:layout_height="106dp"

        >

        <ImageView
            android:id="@+id/profile_picture"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            android:src="@drawable/luis_profile_picture"
            android:layout_gravity="center"

            android:padding="6dp"
            />

        <ImageView
            android:id="@+id/frame_contact"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            android:src="@drawable/object_frame_1x1"
            android:layout_gravity="center"

            />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:paddingLeft="8dip"
            android:paddingRight="8dip"
            android:paddingTop="3dip"
            android:paddingBottom="8dip"

            >

            <com.bitdubai.fermat_android_api.layer.definition.wallet.views.FermatTextView
                android:id="@+id/contact_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"

                android:textColor="#FFFFFFFF"
                android:textSize="12sp"
                android:textStyle="bold"
                android:text="New contact name"

                android:background="@color/black_overlay"
                android:layout_gravity="center"

                android:paddingLeft="8dip"
                android:paddingRight="8dip"
                />
        </FrameLayout>

        <ImageView
            android:id="@+id/icon_send_message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_action_email1"
            android:layout_alignParentTop="true"
            android:paddingLeft="7dp"
            android:paddingRight="7dp"
            android:layout_alignParentLeft="true"
            android:paddingBottom="7dp"
            android:paddingTop="7dp"

            />

        <ImageView
            android:id="@+id/icon_receive_profile"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_action_receive_now1"
            android:layout_alignParentRight="true"

            android:layout_alignParentTop="true"
            android:paddingLeft="7dp"
            android:paddingRight="7dp"
            android:paddingBottom="7dp"
            android:paddingTop="7dp"

            />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="106dp"

        >

        <ImageView
            android:id="@+id/frame_tx_record"
            android:layout_width="match_parent"
            android:layout_height="106dp"
            android:scaleType="centerCrop"

            android:layout_gravity="center"
            android:background="@drawable/object_frame_3x1_filled"
            />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_alignParentRight="true"

            >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingLeft="10dip"
                android:paddingRight="10dip"
                android:paddingTop="10dip">
                <com.bitdubai.fermat_android_api.layer.definition.wallet.views.FermatTextView
                    android:id="@+id/amount"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:textColor="#FF666666"
                    android:textSize="12sp"
                    android:textStyle="normal"
                    android:text="$0.00"
                    android:paddingBottom="1dip"
                    android:paddingTop="2dip"
                    android:layout_gravity="start" />

                <com.bitdubai.fermat_android_api.layer.definition.wallet.views.FermatTextView android:id="@+id/total_amount"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="$amount"
                    android:gravity="end"
                    android:textColor="#FF666666"

                    android:textStyle="normal"
                    android:textSize="12sp"
                    android:paddingBottom="1dip"
                    android:paddingTop="2dip"/>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingLeft="10dip"
                android:paddingRight="10dip"
                android:weightSum="1">
                <com.bitdubai.fermat_android_api.layer.definition.wallet.views.FermatTextView
                    android:id="@+id/when"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="#FF666666"
                    android:textSize="12sp"
                    android:textStyle="normal"
                    android:text="yesterday"
                    android:gravity="start" android:paddingBottom="1dip"
                    android:paddingTop="1dip"/>

                <com.bitdubai.fermat_android_api.layer.definition.wallet.views.FermatTextView android:id="@+id/history_count"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="history count"
                    android:textColor="#FF666666"

                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:textSize="12sp"
                    android:textStyle="normal"
                    android:paddingBottom="1dip"
                    android:paddingTop="1dip"
                    android:gravity="end"

                    />

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingLeft="10dip"
                android:paddingRight="10dip" android:paddingBottom="2dip" android:paddingTop="2dip">

                <com.bitdubai.fermat_android_api.layer.definition.wallet.views.FermatTextView
                    android:id="@+id/notes"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:textColor="#FF666666"
                    android:textSize="12sp"
                    android:textStyle="normal"
                    android:text="notes"
                    android:layout_gravity="start"
                    android:paddingBottom="1dip"
                    android:paddingTop="1dip" />

                </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="10dip"
            android:paddingRight="10dip"
            android:layout_alignParentBottom="true"
            android:paddingBottom="8dip"
            android:layout_gravity="bottom">
            <ImageView
                android:id="@+id/recent_transactions"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_action_expand_grey"
                android:layout_weight="1"/>

        </LinearLayout>
    </RelativeLayout>
</LinearLayout>


text:
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { useParams, Link } from 'react-router-dom';
import { fromURL } from './utils/url';
import TabList from './TabList';

function ArtistTabs() {
  const params = useParams();
  const [loading, setLoading] = useState(false);
  const [loaded, setLoaded] = useState(false);
  const [tabs, setTabs] = useState(null);
  const [error, setError] = useState(null);

  useEffect(function loadArtistTabs() {
    if (loading || loaded) return;

    setLoading(true);

    axios.get(`/api/tabs/${params.artist}`).then(response => {
      setTabs(response.data);

      setLoaded(true);
      setLoading(false);
    }).catch(error => {
      console.log(error);
      setLoaded(true);
      setLoading(false);
      setError(error.message);
    });
  }, [loading, loaded, params.artist]);

  return (

{fromURL(params.artist)}

      {error &&

{error}

      }
      <TabList
        tabs={tabs}
        renderEmpty={() =>

            No tabs found. Add a new tab <Link to="/tabs/new">here</Link>

        }
      />

  );
}

export default ArtistTabs;


text:
package uk.ac.cam.cl.dtg.picky.client.ui;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.text.DateFormat;
import java.time.Duration;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import javafx.beans.binding.Bindings;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.AreaChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.chart.XYChart.Data;
import javafx.scene.chart.XYChart.Series;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.CheckBoxTreeItem;
import javafx.scene.control.Dialog;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.TextField;
import javafx.scene.control.TitledPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.TilePane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

import org.controlsfx.control.CheckTreeView;
import org.controlsfx.validation.ValidationMessage;
import org.controlsfx.validation.decoration.GraphicValidationDecoration;
import org.reactfx.EventStreams;

import uk.ac.cam.cl.dtg.picky.client.ClientApp;
import uk.ac.cam.cl.dtg.picky.client.analytics.Analytics;
import uk.ac.cam.cl.dtg.picky.client.binding.BusyGraphicsBinding;
import uk.ac.cam.cl.dtg.picky.dataset.Chunk;
import uk.ac.cam.cl.dtg.picky.dataset.Dataset;
import uk.ac.cam.cl.dtg.picky.engine.Engine;
import uk.ac.cam.cl.dtg.picky.engine.ProgressEvent;
import uk.ac.cam.cl.dtg.picky.engine.ProgressEvent.Action;
import uk.ac.cam.cl.dtg.picky.engine.ProgressListener;
import uk.ac.cam.cl.dtg.picky.planner.Plan;
import de.ecclesia.kipeto.common.util.FileSizeFormatter;
import de.ecclesia.kipeto.repository.CachedReadingStrategy;
import de.ecclesia.kipeto.repository.ReadingRepositoryStrategy;

public class ClientPresenter implements Initializable {

	private static final File SETTINGS = new File("settings.properties");

	private static final String SETTINGS_SERVER = "server";
	private static final String SETTINGS_DATASET = "dataset";
	private static final String SETTINGS_TARGET = "targetDir";
	private static final String SETTINGS_CACHE = "cacheDir";
	private static final String SETTINGS_TEMP = "tempDir";
	private static final String SETTINGS_FILE_FILTER = "fileFilter";
	private static final String SETTINGS_ENTRY_SELECTION = "entrySelection";

	private static final long DOWNLOAD_CHART_TICKS = TimeUnit.HOURS.toSeconds(1);

	@FXML private VBox fileSelectionVBox;
	@FXML private VBox entrySelectionVBox;
	@FXML private VBox tasksVBox;
	@FXML private TitledPane fileSelectionTitledPane;
	@FXML private TitledPane entrySelectionTitledPane;
	@FXML private VBox settings;
	@FXML private VBox areaChartBox;
	@FXML private Label datasetLabel;
	@FXML private Label hashLabel;
	@FXML private Label contentLabel;
	@FXML private Hyperlink urlLink;
	@FXML private ImageView logoImage;
	@FXML private TextField fileFilter;
	@FXML private Label fileFilterError;
	@FXML private TilePane fileFilterContext;
	@FXML private ImageView fileFilterTick;
	@FXML private TitledPane datasetTitledPane;
	@FXML private TitledPane changesTitledPane;
	@FXML private TextField serverText;
	@FXML private TextField referenceText;
	@FXML private ProgressIndicator datasetProgress;
	@FXML private Label datasetStatusLabel;

	private DirView targetDir;
	private DirView cacheDir;
	private DirView tempDir;

	private CheckTreeView<String> entrySelectionTreeView;
	private AreaChart<Number, Number> areaChart;

	private Engine engine;
	private Map<Action, TaskItemView> tasks = new HashMap<>();

	private ClientModel model;

	private XYChart.Series<Number, Number> byteDownloadSeries;
	// private XYChart.Series<Number, Number> byteReadSeries;
	// private XYChart.Series<Number, Number> byteWriteSeries;

	private NumberAxis xAxis;
	private NumberAxis yAxis;

	private DateFormat timeFormat;
	private Button applyButton;

	private Properties properties;

	@Override
	public void initialize(URL url, ResourceBundle rb) {
		entrySelectionTreeView = new CheckTreeView<String>(new CheckBoxTreeItem<String>());
		entrySelectionTreeView.showRootProperty().set(false);
		entrySelectionVBox.getChildren().add(entrySelectionTreeView);

		targetDir = new DirView("Target");
		cacheDir = new DirView("Cache");
		tempDir = new DirView("Temp");

		settings.getChildren().addAll(targetDir.getView(), cacheDir.getView(), tempDir.getView());

		restoreSettings();

		model = new ClientModel(serverText.textProperty(), referenceText.textProperty(), targetDir.getText().textProperty(), cacheDir
				.getText().textProperty(), tempDir.getText().textProperty(), fileFilter.textProperty(), entrySelectionTreeView
				.getCheckModel().getCheckedItems());

		fileFilterError.textProperty().bind(model.getFilterErrorBinding());
		fileFilterTick.visibleProperty().bind(Bindings.isNotNull(model.getFilterBinding()));
		fileSelectionTitledPane.textProperty().bind(model.getFileSelectionLabel());
		entrySelectionTitledPane.textProperty().bind(model.getEntrySelectionLabel());

		BusyGraphicsBinding.install(fileSelectionTitledPane, model.getDatasetBinding());
		BusyGraphicsBinding.install(datasetTitledPane, model.getDatasetBinding(), datasetProgress, datasetStatusLabel);
		BusyGraphicsBinding.install(changesTitledPane, model.getPlanBinding());
		BusyGraphicsBinding.install(entrySelectionTitledPane, model.getFileSelectionBinding());

		urlLink.setOnAction((e) -> {
			ClientApp.getInstance().getHostServices().showDocument(urlLink.getText());
		});

		model.getPlanBinding().addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> {
			stopApplyingChanges();
		});

		model.getDatasetBinding().addListener(new ChangeListener<Dataset>() {

			@Override
			public void changed(ObservableValue<? extends Dataset> observable, Dataset oldValue, Dataset newValue) {
				if (newValue != null) {
					Image image = new Image(new ByteArrayInputStream(newValue.getIcon()));
					logoImage.setImage(image);
					datasetLabel.setText(newValue.getDescription());
					hashLabel.setText(newValue.getId());
					contentLabel.setText(newValue.getContentDescription());
					urlLink.setText(newValue.getUrl());
				} else {
					logoImage.setImage(null);
					datasetLabel.setText("");
					hashLabel.setText("");
					contentLabel.setText("");
					urlLink.setText("");
				}
			}
		});

		Bindings.bindContent(fileFilterContext.getChildren(), model.getFileContextLabels());

		model.getEntryTreeBinding().addListener(new ChangeListener<CheckBoxTreeItem<String>>() {

			private String entrySelection = properties.getProperty(SETTINGS_ENTRY_SELECTION, "");

			@Override
			public void changed(ObservableValue<? extends CheckBoxTreeItem<String>> observable, CheckBoxTreeItem<String> oldValue,
					CheckBoxTreeItem<String> newValue) {

				if (newValue == null && oldValue != null) {
					entrySelection = CheckTreeViewPersistenceUtil.persist(entrySelectionTreeView);
					entrySelectionTreeView.getRoot().getChildren().clear();
					entrySelectionTreeView.getCheckModel().getCheckedItems().clear();
				} else if (newValue != null) {
					entrySelectionTreeView.getRoot().getChildren().addAll(newValue.getChildren());
					CheckTreeViewPersistenceUtil.restore(entrySelectionTreeView, entrySelection);
				}
			}
		});

		model.getPlanBinding().addListener(new UpdateTasksListener());

		byteDownloadSeries = new AreaChart.Series<Number, Number>();
		byteDownloadSeries.setName("Download");
		byteDownloadSeries.getData().add(new Data<Number, Number>(getCurrentTS(), 0L));

		// byteReadSeries = new AreaChart.Series<Number, Number>();
		// byteReadSeries.setName("Read");
		// byteReadSeries.getData().add(
		// new Data<Number, Number>(getCurrentTS(), 0L));
		//
		// byteWriteSeries = new AreaChart.Series<Number, Number>();
		// byteWriteSeries.setName("Write");
		// byteWriteSeries.getData().add(
		// new Data<Number, Number>(getCurrentTS(), 0L));

		timeFormat = DateFormat.getTimeInstance(DateFormat.DEFAULT);

		xAxis = new NumberAxis(0, DOWNLOAD_CHART_TICKS, DOWNLOAD_CHART_TICKS / 10);
		xAxis.setForceZeroInRange(false);
		xAxis.setAutoRanging(false);
		xAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(xAxis) {
			@Override
			public String toString(Number object) {
				return timeFormat.format(new Date(object.longValue() * 1000));
			}
		});

		yAxis = new NumberAxis();
		yAxis.setAutoRanging(true);
		yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
			@Override
			public String toString(Number object) {
				String label;
				label = FileSizeFormatter.formateBytes(object.longValue(), 0);
				return label;
			}
		});

		areaChart = new AreaChart<Number, Number>(xAxis, yAxis) {
			// Override to remove symbols on each data point
			@Override
			protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
			}
		};
		areaChart.setAnimated(false);
		areaChart.getData().addAll(Arrays.asList( // byteReadSeries,
													// byteWriteSeries,
				byteDownloadSeries));

		areaChartBox.getChildren().add(areaChart);

		EventStreams.ticks(Duration.ofSeconds(1)).subscribe(new AreaChartUpdater());

		GraphicValidationDecoration validationDecoration = new GraphicValidationDecoration();
		validationDecoration.applyRequiredDecoration(serverText);

		model.getDatasetBinding().errorMessageProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
			if (newValue != null) {
				validationDecoration.applyValidationDecoration(ValidationMessage.error(serverText, newValue));
			} else {
				validationDecoration.removeDecorations(serverText);
			}
		});

	}

	private void toggleApplyChanges(ActionEvent event) {
		if (engine == null) {
			startApplyingChanges();
		} else {
			stopApplyingChanges();
		}
	}

	private void startApplyingChanges() {
		if (engine != null) stopApplyingChanges();

		Plan plan = model.getPlanBinding().get();

		engine = new Engine(model.getRepositoryBinding().get(), plan);
		engine.addListener(new EngineProgressListener());
		engine.execute();

		Analytics.sendAnalytics(model, "start_applying_changes");

		if (applyButton != null) applyButton.setText("Stop");
	}

	private void stopApplyingChanges() {
		if (engine != null) {
			engine.stop();
			engine = null;

			Analytics.sendAnalytics(model, "stop_applying_changes");
		}

		if (applyButton != null) applyButton.setText("Start");
	}

	private long getCurrentTS() {
		return System.currentTimeMillis() / 1000;
	}

	private final class UpdateTasksListener implements ChangeListener<Plan> {

		@Override
		public void changed(ObservableValue<? extends Plan> observable, Plan oldPlan, Plan newPlan) {
			tasks.clear();
			applyButton = null;

			if (newPlan != null) {
				if (!newPlan.getDeleteDirActions().isEmpty()) {
					tasks.put(Action.DELETE_DIR, new TaskItemView("Delete Directories", newPlan.getDeleteDirActions().size()));
				}

				if (!newPlan.getDeleteFileActions().isEmpty()) {
					tasks.put(Action.DELETE_FILE, new TaskItemView("Delete Files", newPlan.getDeleteFileActions().size()));
				}

				if (!newPlan.getMakeDirActions().isEmpty()) {
					tasks.put(Action.MAKE_DIR, new TaskItemView("Make Directories", newPlan.getMakeDirActions().size()));
				}

				if (!newPlan.getChunksToDownload().isEmpty()) {
					long totalDownloadSize = newPlan.getChunksToDownload().stream().mapToLong(Chunk::getLengthCompressed).sum();
					tasks.put(Action.DOWNLOAD_CHUNK, new TaskItemView("Download Chunks", newPlan.getChunksToDownload().size(),
							totalDownloadSize));
				}

				if (!newPlan.getInstallFileActions().isEmpty()) {
					long totalFileSize = newPlan.getInstallFileActions().stream().mapToLong(a -> a.getFileSize()).sum();
					tasks.put(Action.INSTALL_FILE, new TaskItemView("Install Files", newPlan.getInstallFileActions().size(), totalFileSize));
				}

				if (!newPlan.getUpdateFileActions().isEmpty()) {
					tasks.put(Action.UPDATE_FILE, new TaskItemView("Update Files", newPlan.getUpdateFileActions().size()));
				}
			}

			tasksVBox.getChildren().setAll(
					tasks.keySet().stream().sorted().map(tasks::get).map(t -> t.getView()).collect(Collectors.toList()));

			if (!tasks.isEmpty()) {
				applyButton = new Button("Start");
				applyButton.setOnAction(ClientPresenter.this::toggleApplyChanges);
				tasksVBox.getChildren().add(applyButton);
			}

		}
	}

	private class AreaChartUpdater implements Consumer<Object> {
		long bytesReadLastTime;

		// long read;
		// long written;

		@Override
		public void accept(Object t) {
			long bytesRead = 0;

			CachedReadingStrategy cachedReadingStrategy = model.getRepositoryBinding().get();
			if (cachedReadingStrategy != null) {
				ReadingRepositoryStrategy repository = cachedReadingStrategy.getRepository();
				bytesRead = repository.bytesRead();
			}

			bytesReadLastTime = updateDiff("Download", byteDownloadSeries, bytesReadLastTime, bytesRead);
			// read = updateDiff("Read", byteReadSeries, read, engine != null ?
			// engine.getBytesReadFromCache() : 0);
			// written = updateDiff("Write", byteWriteSeries, written, engine !=
			// null ? engine.getBytesWrittenToTarget() : 0);

			xAxis.setLowerBound(getCurrentTS() - DOWNLOAD_CHART_TICKS);
			xAxis.setUpperBound(getCurrentTS() - 1);
		}

		private long updateDiff(String label, Series<Number, Number> series, long bytesReadLastTime, long currentRead) {
			long diff = bytesReadLastTime <= currentRead ? currentRead - bytesReadLastTime : currentRead;

			series.setName(label + (diff > 0 ? " (" + FileSizeFormatter.formateBytes(diff, 1) + "/s)" : ""));
			series.getData().add(new Data<>(getCurrentTS(), diff));
			if (series.getData().size() > DOWNLOAD_CHART_TICKS) {
				series.getData().remove(0);
			}

			return currentRead;
		}

	}

	private class EngineProgressListener implements ProgressListener {

		@Override
		public void onActionStart(ProgressEvent event) {
			setProgress(event.getAction(), event.getMsg(), event.getTasksDone(), event.getBytesDone());
		}

		@Override
		public void onActionFinished(ProgressEvent event) {
			setProgress(event.getAction(), event.getMsg(), event.getTasksDone(), event.getBytesDone());
		}

	}

	private void setProgress(Action action, String msg, int tasksDone, long bytesDone) {
		TaskItemView taskItemView = tasks.get(action);
		if (taskItemView != null) ((TaskItemPresenter) tasks.get(action).getPresenter()).update(msg, tasksDone, bytesDone);
	}

	public void restoreSettings() {
		properties = new Properties();

		if (SETTINGS.exists()) try {
			properties.load(new BufferedInputStream(new FileInputStream(SETTINGS)));
		} catch (IOException e) {
			throw new RuntimeException(e);
		}

		serverText.setText(properties.getProperty(SETTINGS_SERVER, ""));
		referenceText.setText(properties.getProperty(SETTINGS_DATASET, ""));
		cacheDir.getText().setText(properties.getProperty(SETTINGS_CACHE, ""));
		targetDir.getText().setText(properties.getProperty(SETTINGS_TARGET, ""));
		tempDir.getText().setText(properties.getProperty(SETTINGS_TEMP, ""));
		fileFilter.setText(properties.getProperty(SETTINGS_FILE_FILTER, ""));
	}

	public void persistSettings() {
		properties.put(SETTINGS_CACHE, cacheDir.getText().getText());
		properties.put(SETTINGS_DATASET, referenceText.getText());
		properties.put(SETTINGS_SERVER, serverText.getText());
		properties.put(SETTINGS_TARGET, targetDir.getText().getText());
		properties.put(SETTINGS_TEMP, tempDir.getText().getText());
		properties.put(SETTINGS_FILE_FILTER, fileFilter.getText());
		properties.put(SETTINGS_ENTRY_SELECTION, CheckTreeViewPersistenceUtil.persist(entrySelectionTreeView));

		try {
			properties.store(new BufferedOutputStream(new FileOutputStream(SETTINGS)), null);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}

		Analytics.sendAnalytics(model, "close");
	}

	@FXML
	public void close() {
		persistSettings();

		Stage stage = (Stage) contentLabel.getScene().getWindow();
		stage.close();
	}

	@FXML
	public void about() {
		Dialog<Void> dialog = new Dialog<>();
		dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
		dialog.getDialogPane().setContent(new AboutDialogView().getView());
		dialog.showAndWait();
	}

}


text:
package org.apache.kylin.engine.mr.invertedindex;

import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.cube.CubeInstance;
import org.apache.kylin.cube.CubeManager;
import org.apache.kylin.cube.CubeSegment;
import org.apache.kylin.engine.mr.CubingJob;
import org.apache.kylin.invertedindex.IIInstance;
import org.apache.kylin.invertedindex.IIManager;
import org.apache.kylin.invertedindex.IISegment;
import org.apache.kylin.job.exception.ExecuteException;
import org.apache.kylin.job.execution.AbstractExecutable;
import org.apache.kylin.job.execution.ExecutableContext;
import org.apache.kylin.job.execution.ExecuteResult;
import org.apache.kylin.metadata.model.SegmentStatusEnum;

import java.io.IOException;

/**
 */
public class UpdateIIInfoAfterBuildStep extends AbstractExecutable {

    private static final String II_NAME = "iiName";
    private static final String JOB_ID = "jobId";

    public UpdateIIInfoAfterBuildStep() {
        super();
    }

    public void setInvertedIndexName(String cubeName) {
        this.setParam(II_NAME, cubeName);
    }

    private String getInvertedIndexName() {
        return getParam(II_NAME);
    }

    public void setJobId(String id) {
        setParam(JOB_ID, id);
    }

    private String getJobId() {
        return getParam(JOB_ID);
    }

    @Override
    protected ExecuteResult doWork(ExecutableContext context) throws ExecuteException {

        IIManager mgr = IIManager.getInstance(KylinConfig.getInstanceFromEnv());
        IIInstance ii = mgr.getII(getInvertedIndexName());
        IISegment segment = ii.getFirstSegment();
        segment.setStatus(SegmentStatusEnum.READY);

        segment.setLastBuildJobID(getJobId());
        segment.setLastBuildTime(System.currentTimeMillis());

        try {
            mgr.updateII(ii);
            return new ExecuteResult(ExecuteResult.State.SUCCEED, "succeed");
        } catch (IOException e) {
            logger.error("fail to update inverted index after build", e);
            return new ExecuteResult(ExecuteResult.State.ERROR, e.getLocalizedMessage());
        }
    }

}