text:
AliBalanceEventMixing *GetBalanceFunctionObject(const char* analysisLevel = "ESD",
						const char* centralityName = 0x0,
						Double_t centrMin = 0.,
						Double_t centrMax = 100.,
						Bool_t bShuffle = kFALSE,
						Bool_t bHBTcut = kFALSE,
						Bool_t bConversionCut = kFALSE) {
  //Function to setup the AliBalanceEventMixing object and return it
  AliBalanceEventMixing *gBalance = new AliBalanceEventMixing();
  gBalance->SetAnalysisLevel(analysisLevel);
  gBalance->SetShuffle(bShuffle);
  gBalance->SetHBTcut(bHBTcut);
  gBalance->SetConversionCut(bConversionCut);
  if(centralityName) gBalance->SetCentralityIdentifier(centralityName);
  gBalance->SetCentralityInterval(centrMin,centrMax);

  //Set all analyses separately
  //Rapidity
  gBalance->SetInterval(AliBalanceEventMixing::kRapidity,-0.8,0.8,64,0.0,1.6);
  //Eta
  gBalance->SetInterval(AliBalanceEventMixing::kEta,-0.8,0.8,64,0.0,1.6);
  //Qlong
  gBalance->SetInterval(AliBalanceEventMixing::kQlong,-1,1,100,0.0,2.0);
  //Qout
  gBalance->SetInterval(AliBalanceEventMixing::kQout,-1,1,100,0.0,2.0);
  //Qside
  gBalance->SetInterval(AliBalanceEventMixing::kQside,-1,1,100,0.0,2.0);
  //Qinv
  gBalance->SetInterval(AliBalanceEventMixing::kQinv,-1,1,100,0.0,2.0);
  //Phi
  gBalance->SetInterval(AliBalanceEventMixing::kPhi,0.,360.,90,0.,180.0);

  //Init the histograms
  gBalance->InitHistograms();

  return gBalance;
}

//__________________________________________________//
AliESDtrackCuts *GetTrackCutsObject(Double_t ptMin, Double_t ptMax, Double_t etaMin, Double_t etaMax, Double_t maxTPCchi2, Double_t maxDCAz, Double_t maxDCAxy, Int_t minNClustersTPC) {

  // only used for ESDs
  // Function to setup the AliESDtrackCuts object and return it
  AliESDtrackCuts *cuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
  cuts->SetRequireTPCStandAlone(kTRUE); // TPC only cuts!

  // extra TPC cuts (Syst studies)
  if(minNClustersTPC != -1)  cuts->SetMinNClustersTPC(minNClustersTPC);
  else cuts->SetMinNClustersTPC(70); // standard for filter bit 128

  if(maxTPCchi2 != -1) cuts->SetMaxChi2PerClusterTPC(maxTPCchi2);

  // extra DCA cuts (Syst studies)
  if(maxDCAz!=-1 && maxDCAxy != -1){
    cuts->SetMaxDCAToVertexZ(maxDCAz);
    cuts->SetMaxDCAToVertexXY(maxDCAxy);
  }

  cuts->SetPtRange(ptMin,ptMax);
  cuts->SetEtaRange(etaMin,etaMax);
  cuts->DefineHistograms(1);
  //cuts->SaveHistograms("trackCuts");

  return cuts;
}


text:
backbone.paginator
==================

|travis-status|_

A pageable, drop-in replacement for Backbone.Collection called
Backbone.PageableCollection.

.. contents:: Table of Contents
   :backlinks: none

Migrating from Backbone.Paginator 1.0
-------------------------------------

Backbone.Paginator 2.0 was originally called backbone-pageable, which in turn
was inspired by Backbone.Paginator < 1.0 by @addyosmani. The two project has
merged as of May 2014 and backbone-pageable has effectively become
Backbone.Paginator 2.0. This guide describes some of the differences and
similarities to ease migration.

Package Naming
++++++++++++++

Backbone.Paginator 2.0 will continue to use the backbone.paginator name for the
file, ``npm`` and ``bower`` packages. In addition, a new ``component`` package
is also available, also inheriting the backbone.paginator name.

Module Naming
+++++++++++++

The module exported by the packages will still be called ``PageableCollection``
to emphasize the function of this Backbone plugin as a ``Collection`` instead of
a ``View``.

API Changes
+++++++++++

=================================== ======================================================================================
Backbone.Paginator <= 1.0           Backbone.Paginator 2.0
=================================== ======================================================================================
``Backbone.Paginator``              ``Backbone.PageableCollection``
``Backbone.Paginator.requestPager`` ``PageableCollection.extend({mode: "server" | "infinite"})``
``Backbone.Paginator.clientPager``  ``PageableCollection.extend({mode: "client"})``
``paginator_core``                  Override ``PageableCollection#sync`` or use ``PagableCollection.fetch({data: {...}})``
``paginator_ui``                    ``state``
``server_api``                      ``queryParams``
``bootstrap()``                     ``new Backbone.PageaableCollection([{...}, ...])``
``parse()``                         ``parse()``, ``parseRecords()``, ``parseState()``, ``parseLinks()``
``goTo()``                          ``getPage()``
``prevPage()``, ``nextPage()``      ``getPreviousPage()``, ``getNextPage()``
``howManyPer()``                    ``setPageSize()``
``setSort()``                       ``setSorting()``
``*Filter*()``                      N/A. Implement your own ``View`` or use ``underscore`` methods on ``fullCollection``
Diacritic plugin                    N/A. See above
N/A                                 ``getPageByOffSet()``
N/A                                 ``hasPreviousPage()``, ``hasNextPage()``
N/A                                 ``switchMode()``
=================================== ======================================================================================

Advantages
----------

Supports client-side and server-side operations
  You can initialize ``Backbone.PageableCollection`` to paginate and/or sort on
  the client-side, server-side or both.
Infinite paging
  Many public APIs like `Github <http://developer.github.com/v3/#pagination>`_
  or `Facebook
  <https://developers.facebook.com/docs/reference/api/pagination/>`_ support
  infinite paging, ``Backbone.PageableCollection`` can handle them easily.
Comes with reasonable defaults
  Server API parameters preconfigured to work with most Rails RESTful APIs by
  default.
Works well with existing server-side APIs
  Query parameter mappings are all configurable, and you can use either 0-based
  or 1-based indices.
Bi-directional event handling
  In client-mode, any changes done on one page is immediately reflected on the
  others with the appropriate events propagated.
100% compatible with existing code
  ``Backbone.PageableCollection`` is a strict superset of
  ``Backbone.Collection`` and passes its `test suite
  <http://backbone-paginator.github.io/backbone.paginator/test/index.html>`_.
Well tested
  Comes with 100s of tests in addition to the ``Backbone.Collection`` test
  suite.
Well documented
  Use cases and functionality are thoroughly documented.
No surprising behavior
  ``Backbone.PageableCollection`` performs internal state sanity checks at
  appropriate times, so it is next to impossible to get into a weird state.
Light-weight
  The library is only 4.2KB minified and gzipped.

Playable Demos
--------------

The following examples utilizes `Backgrid.js
<http://backgridjs.com>`_ to render the collections.

- `Server Mode <http://backbone-paginator.github.io/backbone.paginator/examples/server-mode.html>`_
- `Client Mode <http://backbone-paginator.github.io/backbone.paginator/examples/client-mode.html>`_
- `Infinite Mode <http://backbone-paginator.github.io/backbone.paginator/examples/infinite-mode.html>`_

Installation
------------

Installing from Node.js
+++++++++++++++++++++++

.. code-block:: bash

  npm install backbone.paginator

Installing from Bower
+++++++++++++++++++++

.. code-block:: bash

  bower install backbone.paginator

Browser
+++++++

.. code-block:: html

  <script src="underscore.js"></script>
  <script src="backbone.js"></script>
  <script src="backbone.paginator.js"></script>

Getting to the Backbone.PageableCollection Class from Node.js and AMD
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. code-block:: javascript

  var PageableCollection = require("backbone.paginator");

Getting to the Backbone.PageableCollection Class in the Browser
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. code-block:: javascript

  var PageableCollection = Backbone.PageableCollection;

Introduction
------------

Like Backbone.Collection, you can provide a URL endpoint, configure your initial
pagination state and server API mapping by extending
``Backbone.PageableCollection``:

.. code-block:: javascript

  var Book = Backbone.Model.extend({});

  var Books = Backbone.PageableCollection.extend({
    model: Book,
    url: "api.mybookstore.com/books",

    // Any `state` or `queryParam` you override in a subclass will be merged with
    // the defaults in `Backbone.PageableCollection` 's prototype.
    state: {

      // You can use 0-based or 1-based indices, the default is 1-based.
      // You can set to 0-based by setting ``firstPage`` to 0.
      firstPage: 0,

      // Set this to the initial page index if different from `firstPage`. Can
      // also be 0-based or 1-based.
      currentPage: 2,

      // Required under server-mode
      totalRecords: 200
    },

    // You can configure the mapping from a `Backbone.PageableCollection#state`
    // key to the query string parameters accepted by your server API.
    queryParams: {

      // `Backbone.PageableCollection#queryParams` converts to ruby's
      // will_paginate keys by default.
      currentPage: "current_page",
      pageSize: "page_size"
    }
  });

You can initialize ``state`` and ``queryParams`` from the constructor too:

.. code-block:: javascript

   var Books = Backbone.PageableCollection.extend({
     model: Book,
     url:"api.mybookstore.com/books"
   });

   var books = new Books([], {

     // All the `state` and `queryParams` key value pairs are merged with
     // the defaults too.
     state: {
       firstPage: 0,
       currentPage: 0
     },

     queryParams: {
       currentPage: "current_page",
       pageSize: "page_size"
     }
   });

Adapting to a Server API
++++++++++++++++++++++++

To adapt to an existing server API that do not use ``will_paginate`` keys, you
can configure the ``queryParams`` object hash to map ``state`` keys to the query
parameters your server will accept. Those query parameters will be in the query
string of the URL used for fetching. You can also put extra items into
``queryParams`` and they will be in the query string as is. Setting ``null`` as
the value of any mapping will remove it from the query string. Finally, the
values in the ``queryParams`` can be either a literal value or a parameter-less
function that returns a value.

This is a listing of the default ``state`` and ``queryParam`` values.

============ ===== ============= ============================
    ``state``                   ``queryParams``
------------------ ------------------------------------------
Attribute    Value Attribute     Value
============ ===== ============= ============================
firstPage    1
lastPage     null
currentPage  null  currentPage   "page"
pageSize     25    pageSize      "per_page"
totalPages   null  totalPages    "total_pages"
totalRecords null  totalRecords  "total_entries"
sortKey      null  sortKey       "sort_by"
order        -1    order         "order"
\                  directions    { "-1": "asc", "1": "desc" }
============ ===== ============= ============================

You can consult the `API documentation
<http://backbone-paginator.github.io/backbone.paginator/#!/api/Backbone.PageableCollection>`_
for a detailed explaination of these fields.

Fetching Data and Managing States
+++++++++++++++++++++++++++++++++

You can access the pageable collection's internal state by looking at the
``state`` object attached to it. This state object, however, is generally
read-only after initialization. There are various methods to help you manage
this state, you should use them instead of manually modifying it. For the
unusual circumstances where you need to modify the ``state`` object directly, a
sanity check will be performed at the next time you perform any
pagination-specific operations to ensure internal state consistency.

================================ ===============================================
Method                           Use When
================================ ===============================================
``setPageSize``                  Changing the page size
``setSorting``                   Changing the sorting
``switchMode``                   Switching between modes
``state``                        Need to read the internal state
``get*Page``                     Need to go to a different page
``hasPreviousPage, hasNextPage`` Check if paging backward or forward is possible
================================ ===============================================

In addition to the above methods, you can also synchronize the state with the
server during a fetch. ``Backbone.PageableCollection`` overrides the default
`Backbone.Collection#parse <http://backbonejs.org/#Collection-parse>`_ method to
support an additional response data structure that contains an object hash of
pagination state. The following is a table of the response data structure
formats ``Backbone.PageableCollection`` accepts.

================= ========================================
Without State     With State
================= ========================================
``[{}, {}, ...]`` ``[{ pagination state }, [{}, {} ...]]``
================= ========================================

Most of the time, providing something like this in your response is sufficient
for updating the pagination state.

``[{"total_entries": 100}, [{}, {}, ...]]``

Since 1.1.7, customizing ``parse`` has been simplified and the default
implementation now delegates to two new methods - ``parseState`` and
``parseRecords``. You are encouraged to override them instead of ``parse`` if it
is not clear how to do so. For infinite mode, you should override ``parseLinks``
instead of ``parseState`` to return an object of links.

See the examples below or the `API
<http://backbone-paginator.github.io/backbone.paginator/>`_ for details on
customizing ``parseState``, ``parseRecords`` and ``parseLinks``.

Bootstrapping
-------------

``Backbone.PageableCollection`` is 100% compatible with ``Backbone.Collection``
's interface, so you can bootstrap the models and supply a comparator to the
constructor just like you are used to:

.. code-block:: javascript

  // Bootstrap with just 1 page of data for server-mode, or all the pages for
  // client-mode.
  var books = new Books([
    { name: "A Tale of Two Cities" },
    { name: "Lord of the Rings" },
    // ...
  ], {
    // Paginate and sort on the client side, default is `server`.
    mode: "client",
    // This will maintain the current page in the order the comparator defined
    // on the client-side, regardless of modes.
    comparator: function (model) { return model.get("name"); }
  });

Pagination
----------

Server-Mode
+++++++++++

``Backbone.Pagination`` defaults to server-mode, which means it only holds one
page of data at a time. All of the ``get*page`` operations are done by
delegating to ``fetch``. They return a ``jqXHR`` in this mode.

.. code-block:: javascript

  books.getFirstPage();
  books.getPreviousPage();
  books.getNextPage();
  books.getLastPage();

  // All the `get*Page` methods under server-mode delegates to `fetch`, so you
  // can attach a callback to the returned `jqXHR` objects' `done` event.
  books.getPage(2).done(function () {
    // do something ...
  });

All of the ``get*Page`` methods accept the same options
`Backbone.Collection#fetch <http://backbonejs.org/#Collection-fetch>`_ accepts
under server-mode.

Client-Mode
+++++++++++

Client-mode is a very convenient mode for paginating a handful of pages entirely
on the client side without going through the network page-by-page. This mode is
best suited if you only have a small number of pages so sending all of the data
to the client is not too time-consuming.

.. code-block:: javascript

  var books = new Books([
    // Bootstrap all the records for all the pages here
  ], { mode: "client" });

All of the ``get*Page`` methods reset the pageable collection's data to the models
belonging to the current page and return the collection itself instead of a
``jqXHR``.

.. code-block:: javascript

  // You can immediately operate on the collection without waiting for jQuery to
  // call your `done` callback.
  var json = JSON.stringify(books.getLastPage());

  // You can force a fetch in client-mode to get the most updated data if the
  // collection has gone stale.
  books.getFirstPage({ fetch: true });

  // Do something interesting with books...

Infinite-Mode
+++++++++++++

Infinite paging mode is a hybrid of server mode and client mode. Once
initialized and bootstrapped, paging backwards will be done on the client-side
by default while paging forward will be done by fetching.

As before, you can make use of ``getFirstPage``, ``getPreviousPage``,
``getNextPage``, and ``getLastPage`` for navigation under infinite-mode. If a
page has been fetched, you can use ``getPage`` directly with the page number, an
error will be thrown if the page has not been fetched yet.

By default, ``Backbone.PageableCollection`` parses the response headers to find
out what the ``first``, ``next`` and ``prev`` links are. The parsed links are
available in the ``links`` field.

.. code-block:: javascript

   var Issues = Backbone.PageableCollection.extend({
     url: "https://api.github.com/repos/documentclound/backbone/issues?state=closed",
     mode: "infinite"

     // Initial pagination states
     state: {
       pageSize: 15,
       sortKey: "updated",
       order: 1
     },

     // You can remap the query parameters from ``state`` keys from the default
     // to those your server supports. Setting ``null`` on queryParams removed them
     // from being appended to the request URLs.
     queryParams: {
       totalPages: null,
       totalRecords: null,
       sortKey: "sort",
       order: "direction",
       directions: {
         "-1": "asc",
         "1": "desc"
       }
     }

   });

   var issues = new Issues();

   issues.getFirstPage().done(function () {
      // do something interesting...
   });

If your server API does not return the links using the ``Link`` header like
`Github <http://developer.github.com/v3/#pagination>`_ does, you can subclass
``Backbone.PageableCollection`` to override the ``parseLinks`` methods to
return a links object.

.. code-block:: javascript

   var FBComment = Backbone.Model.extend({});

   var FBComments = Backbone.PageableCollection.extend({
     model: FBComment,
     url: "https://graph.facebook.com/A_REALLY_LONG_FACEBOOK_OBJECT_ID",
     mode: "infinite",
     // Set the indices to 0-based for Graph API.
     state: {
       firstPage: 0
     },
     queryParams: {
       pageSize: "limit",
       // Setting a parameter mapping value to null removes it from the query string
       currentPage: null,
       // Any extra query string parameters are sent as is, values can be functions,
       // which will be bound to the pageable collection instance temporarily
       // when called.
       offset: function () { return this.state.currentPage * this.state.pageSize; }
     },
     // Return all the comments for this Facebook object
     parseRecords: function (resp) {
       return resp.comments.data;
     },
     // Facebook's `paging` object is in the exact format
     // `Backbone.PageableCollection` accepts.
     parseLinks: function (resp, xhr) {
       return resp.comments.paging;
     }
   });

To act on the newly fetched models under infinite mode, you can listen to the
``fullCollection`` reference's ``add`` event like you would under client mode,
and render the newly fetched models accordingly.

.. code-block:: javascript

   var ToiletPaper = Backbone.View.extend({

     events: {
       "scroll": "fetchSheets"
     },

     initialize: function (options) {
       this.listenTo(this.collection.fullCollection, "add", this.addSheet);
     },

     addSheet: function () {
       // ...
     },

     fetchSheets: function () {
       this.collection.getNextPage();
     },

     // ...

   });

   var wordsOfTheDay = new Backbone.PageableCollection({
     mode: "infinite",
     // url, initial state, etc...
   });

   var toiletPaper = new ToiletPaper({collection: wordsOfTheDay});

   $("#toilet-paper-dispenser").append(toiletPaper.render().el);

   wordsOfTheDay.fetch();

Note:
+++++

**Don't** override ``parseState`` or send down a stateful list of records from
the server.

Under infinite mode, ``totalRecords`` will always equal to the number of models
inside ``fullCollection`` i.e. ``fullCollection.length``. PagebleCollection will
automatically keep all the states consistent. Modifying the state during
infinite paging results in undefined behavior. As such, you shouldn't override
``parseState`` and should only send down a stateless list of records as
described in `Fetching Data and Managing States`_.

Sorting
-------

Sorting has been drastically simplified in the 1.0 release while retaining the
full power it had in older versions.

The main way to define a sorting for a pageable collection is to utilize the
``setSorting`` method.  Given a ``sortKey`` and an ``order``, ``setSorting``
sets ``state.sortKey`` and ``state.order`` to the given values. If ``order`` is
not given, ``state.order`` is assumed. By default a comparator is applied to the
full collection under client mode. Calling ``sort`` on the full collection will
then get the entire pageable collection sorted globally. When operating under
server or infinite mode, no comparator will be applied to the collection as
sorting is assumed to be done on the server by default. Set ``options.full`` to
``false`` to apply a comparator to the current page under any mode. To sort a
pageable collection under infinite mode on the client side, set ``options.side``
to ``"client"`` will apply a comparator to the full collection.

Setting ``sortKey`` to ``null`` removes the comparator from both the current
page and the full collection.

.. code-block:: javascript

   var books = new Books([
     ...
   ], {
     mode: "client"
   });

   // Sets a comparator on `#fullCollection` that sorts the title in ascending
   // order
   books.setSorting("title");

   // Don't forget to call `sort` just like you would on a `Backbone.Collection`
   books.fullCollection.sort();

   // Clears the comparator
   books.setSorting(null);

   // Sets a comparator on the current page that sorts the title in descending
   // order
   books.setSorting("title", 1, {full: false})
   books.sort();

   books.switchMode("infinite");

   // Sorts the books collection under infinite paging mode on the client side
   books.setSorting("title", -1, {side: "client"});
   books.fullCollection.sort();

   books.switchMode("server");

   // Sets a comparator on the current page under server mode
   books.setSorting("title", {side: "client", full: false});
   books.sort();

Manipulation
------------

This is one of the areas where ``Backbone.PageableCollection`` truely shines. A
``Backbone.PageableCollection`` instance not only can do everything a plain
``Backbone.Collection`` can for the current page, in client-mode, it can also
synchronize changes and events across all of the pages. For example, you can add
or remove a model from either a ``Backbone.PageableCollection`` instance, which
is holding the current page, or the
``Backbone.PageableCollection#fullCollection`` collection, which is a plain
``Backbone.Collection`` holding the models for all of the pages, and the pages
will all update themselves to maintain within a page size. Any additions,
removals, resets, model attribute changes and synchronization actions are
communicated between all the pages throught the two collections.

.. code-block:: javascript

   // The books collection is initialized to start at the first page.
   var books = new Books([
     // bootstrap with all of the models for all of the pages here
   ], {
     mode: "client"
   });

   // A book is added to the end of the current page, which will overflow to the
   // next page and trigger an `add` event on `fullCollection`.
   books.push({ name: "The Great Gatsby"});

   books.fullCollection.at(books.state.currentPage - 1 * books.state.pageSize).get("name");
   >>> "The Great Gatsby"

   // Add a new book to the beginning of the first page.
   books.fullCollection.unshift({ name: "Oliver Twist" });
   books.at(0).get("name");
   >>> "Oliver Twist"

API Reference
-------------

See `here <http://backbone-paginator.github.io/backbone.paginator/>`_.

FAQ
---

#. Which package managers does backbone.paginator support?

   bower, npm, CommonJS and AMD and Component.

#. Why doesn't backbone.paginator support filtering?

   Wheels should be reinvented only when they are crooked. backbone.paginator aims
   to do one thing only and does it well, which is pagination and sorting. Besides,
   since Backbone.PageableCollection is 100% compatible with Backbone.Collection,
   you can do filtering fairly easily with Backbone's built-in support for
   Underscore.js methods.

Legal
-----

Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors

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.

.. |travis-status| image:: https://travis-ci.org/backbone-paginator/backbone.paginator.png
.. _travis-status: https://travis-ci.org/backbone-paginator/backbone.paginator

redpajama_set_name: RedPajamaGithub


text:
var children=doc.currentPage().children();
console.assert(children.count()<50,"I can't handle more than 50 layers! :)");


text:
package com.qingbo.project.repository.search;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

/**
 * 逻辑条件表达式 用于复杂条件时使用,如但属性多对应值的OR查询等
 * @author lee
 *
 */
public class LogicalExpression extends AbstractExpression {
    private Criterion[] criterion;  // 逻辑表达式中包含的表达式
    private Operator operator;      //计算符

    protected LogicalExpression(Criterion[] criterions, Operator operator) {
        this.criterion = criterions;
        this.operator = operator;
    }

    public Predicate toPredicate(Root<?> root, CriteriaQuery<?> query,
            CriteriaBuilder builder) {
        List<Predicate> predicates = new ArrayList<Predicate>();
        for(int i=0;i<this.criterion.length;i++){
            predicates.add(this.criterion[i].toPredicate(root, query, builder));
        }
        switch (operator) {
        case OR:
            return builder.or(predicates.toArray(new Predicate[predicates.size()]));
        default:
            return null;
        }
    }

}


text:
<?php

namespace OSC\Apps\PayPal\PayPal\API;

class GetBalance extends \OSC\Apps\PayPal\PayPal\APIAbstract
{
    public function execute(array $extra_params = null)
    {
        $params = [
            'USER' => $this->app->getApiCredentials($this->server, 'username'),
            'PWD' => $this->app->getApiCredentials($this->server, 'password'),
            'SIGNATURE' => $this->app->getApiCredentials($this->server, 'signature'),
            'METHOD' => 'GetBalance',
            'RETURNALLCURRENCIES' => '1'
        ];

        if (!empty($extra_params)) {
            $params = array_merge($params, $extra_params);
        }

        $response = $this->getResult($params);

        return [
            'res' => $response,
            'success' => in_array($response['ACK'], ['Success', 'SuccessWithWarning']),
            'req' => $params
        ];
    }
}


text:
layout: post
title: Basic knowledge about quadcopter (part 2)
description: "This part will talk about basic knowledge that I accumulated to prepar for building my own quadcopter"
tags: [Drone]
categories: [Project]
image:
    feature: drone_project_2.jpg
---

As [part 1](http://cuongtv.com/project/Drone-Project-Part-1/) introduced about
necessary components to build a quadcopter. Today, I will talk about basic knowledge
that I accumulated on the internet.

## Orientation - Angles

Orientation

The quadcopter orientation can be defined by three angles: Pitch, Roll, and Yaw.
These angles determine orientation and therefore the direction the quadcopter will take. Basically, changing the pitch will make the quadcopter go forward/backward,
the roll bends to the left/right and the yaw will make it rotate around its vertical axis. And final parameter you need to control attitude of quadcopter is throttle that will spin your all brushless motors up.

I will use these axes as reference:

## Quadcopter motion

There are 2 kinds of quadcopter configuration: + and X with  clockwise rotation
and  counter-clockwise rotation propeller.

I am using quad X configuration.

Most commercially available quadcopters work in one of two possible modes:

* Aerobatic Mode: This mode allows you to perform spins and flips on the quadcopter.
* Attitude/ Stable Mode: This is the preferred mode for beginners and this is the mode my quadcopter will run in. In this mode data from accelerometer and gyroscope is combined to caculate the quadcopter angle, no spins or flips will
be performed.

Quadcopter motion in different axis:

* Throttle control: Quadcopter moves up when you increase speed all motors.
Moving down when you decrease all motors.
* Pitch control: Quadcopter moves forward when you increase 2 front motors and decrease 2 back motors. Revert with the quadcopter moves backward.
* Roll control: Quadcopter bend left when you increase speed 2 right motors and decrease speed 2 left motors. Vice versa for bending right
* Yaw control: Quadcopter rotates left when you increase speed front right motor and back left and rest motors are decreased. Quadcopter rotates right when you speed up front left motor and back right motor and rest motors are at normal speed.

## Quadcopter Flowchart
This is a flowchart for quadcopter programing that I will follow this reference:

### 1. PWM Decoder Driver:
In order to interpret commands from a standard RC Transmitter/Receiver, it needs
PWM decoder from each channel of transmitter to control speed of 4 motors and flight modes.

### 2. Command Translator:
Depending on the flight mode, the PWM values give by the transmitter are interpreted differently. The command Translator determines which mode the quadcopter is flying in and translates commands accordingly.

### 3. Sensor Fusion:
Actually, in BNO055 there is a 32-bit ARM Cortex M0+ microcontroller running Bosch Sensortec sensor fusion software, that means you don't need to implement a fusion part. However, the problem here is that price of BNO055 is expensive (around 17$) then maybe I will change another one that is cheaper (MPU-6000). For fusion algorithms, there are [Extended Kalman Filter](https://en.wikipedia.org/wiki/Extended_Kalman_filter) (EKF) and [Complementary Filter](http://robottini.altervista.org/tag/complementary-filter)
to implement, for instance. The reasons for implementing fusion algorithm are:

* Accelerometer - Good for long duration (in short time it has many noise)
* Gyroscope - Good for short duration (in long time it will be drift)

Therefore, fusion algorithm will combine accelerometer and gyroscope to solve their weakness.

### 4. Proportional-Integral-Derivative (PID) Stabilization:
PID controller is used to determine the fastest way to make the desired quadcopter's flying become reality from transmitter commands and value of sensor fusion. PID controller is very efficient for control of a system in which an accurate physical model is unknown. Using calculus to determine error slopes and areas, PID compensates for environmental noise and disturbances while overcoming steady state error and oscillations.

### 5. PWM Encoder Driver:
Once everything has been computed, the PWM Encoder takes the control values and generates a pulse width modulated (PWM) output for each motor.


text:
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.tika.example;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import org.junit.Test;

@SuppressWarnings("deprecation")
public class SimpleTypeDetectorTest {

	@Test
	public void testSimpleTypeDetector() throws Exception {
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();

		PrintStream out = System.out;
		System.setOut(new PrintStream(buffer, true, UTF_8.name()));

		SimpleTypeDetector.main(new String[] { "pom.xml" });

		System.setOut(out);

		assertEquals("pom.xml: application/xml",
				buffer.toString(UTF_8.name()).trim());
	}

}


text:
package ru.nbakaev.hishop.home;

import io.swagger.annotations.ApiModel;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;

import java.util.Date;

/**
 * Created by Nikita Bakaev, ya@nbakaev.ru on 1/10/2016.
 * All Rights Reserved
 */

@ApiModel("This is just test/demo class for health-checking web-server")
public class RootClass {

    @Id
    private String id = new ObjectId().toString();

    private String serverRequestName = "UNRESOLVED_ADDRESS";
    private Date date = new Date();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getServerRequestName() {
        return serverRequestName;
    }

    public void setServerRequestName(String serverRequestName) {
        this.serverRequestName = serverRequestName;
    }
}


text:
package com.spectralogic.dsbrowser.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class Platform {

    public final static OS OS_TYPE;
    private final static Logger LOG = LoggerFactory.getLogger(Platform.class);

    static {
        final String osName = System.getProperty("os.name");
        if (osName.contains("Windows")) {
            OS_TYPE = OS.WINDOWS;
        } else if (osName.contains("Mac")) {
            OS_TYPE = OS.OSX;
        } else if (osName.contains("Linux")) {
            OS_TYPE = OS.LINUX;
        } else if (osName.contains("FreeBSD")) {
            OS_TYPE = OS.FREE_BSD;
        } else {
            LOG.info("Unknown platform type: " + osName);
            OS_TYPE = OS.UNKNOWN;
        }
    }

    public static boolean isWin() {
        return OS_TYPE == OS.WINDOWS;
    }

    public enum OS {
        WINDOWS, LINUX, OSX, FREE_BSD, UNKNOWN
    }
}


text:
1) Create a new project:

	composer create-project --no-install numbers/skeleton [project directory]

	Note: Composer must be installed on your system.
	Note: We skip vendor directory here by using --no-install option;

2) Build application:

	Navigate to [project directory] and run following command:

		make build

	Note: By default application will be complied to run in production mode. You can use "make deployment_development" to compile it in development mode.

3) Setup host:

	3.1) For single host applications add an entry to /etc/hosts like:

		127.0.0.1	[your domain]

	3.2) For multi host application you need to install "dnsmasq" and add an entry to dnsmasq.conf file as follows:

		address=/.[your domain]/127.0.0.1

		Note: For development you can add entry to process all domains that ends with .local:

			address=/.local/127.0.0.1

4) Setup Apache:

	4.1) Take [project directory]/conf/dev/vhosts.000.general.conf as a template and put it to apache configuration folder;

	4.2) Take [project directory]/conf/dev/vhosts.100.your_domain.conf as a template and replace [your domain] with your domain, adjust directories as per your system and put it to your apache configuration folder;

	4.3) Restart Apache

5) Create database and promote schema changes:

	Framework provides two options to promote schema changes to database:

	5.1) Direct schema changes, available commands:
		make schema_test
		make schema_commit
		make schema_drop

	5.2) Migrations, available commands:
		make migration_code_test
		make migration_code_commit
		make migration_code_drop
		make migration_db_test
		make migration_db_commit
		make migration_db_rollback

	Note: If you want to have migrations as mandatory promotion method you can set following setting in environment.ini file:

			application.structure.db_migration = 1

		In this case you cannot run schema commands and vise versa.

	Note: you need to navigate to [project directory] to run make commands.

6) Run your application in a browser and enjoy.


text:
<?php
namespace JukeBox;

include("inc.header.php");
require_once 'utils/Files.php';
require_once 'utils/Strings.php';
use JukeBox\Utils\Files;
use JukeBox\Utils\Strings;

/**************************************************
* VARIABLES
* No changes required if you stuck to the
* INSTALL-stretch.md instructions.
* If you want to change the paths, edit config.php
***************************************************/

/* NO CHANGES BENEATH THIS LINE ***********/

$trackDat = array();
$trackDat['metaKeys']['mp3'] = array(
    "COMM==XXX",//=comment
    "TALB",//=album
    "TCOM",//=composer
    "TCON",//=genre
    "TDRC",//=2010
    "TIT2",//=title
    "TPE1",//=artist
    "TPE2",//=album artist
    "TPOS",//=Part of set
    "TRCK",//=Track Number
);
/*
    --AENC    Audio encryption.
    --APIC    Attached (or linked) Picture.
    --ASPI    Audio seek point index.
    --COMM    User comment.
    --COMR    Commercial frame.
    --ENCR    Encryption method registration.
    --EQU2    Equalisation (2).
    --ETCO    Event timing codes.
    --GEOB    General Encapsulated Object.
    --GRID    Group identification registration.
    --IPLS    Involved People List
    --LINK    Linked information.
    --MCDI    Binary dump of CD's TOC
    --MLLT    MPEG location lookup table.
    --OWNE    Ownership frame.
    --PCNT    Play counter.
    --POPM    Popularimeter.
    --POSS    Position synchronisation frame
    --PRIV    Private frame.
    --RBUF    Recommended buffer size.
    --RVA2    Relative volume adjustment (2).
    --RVRB    Reverb.
    --SEEK    Seek frame.
    --SIGN    Signature frame.
    --SYLT    Synchronised lyrics/text.
    --SYTC    Synchronised tempo codes.
    --TALB    Album
    --TBPM    Beats per minute
    --TCMP    iTunes Compilation Flag
    --TCOM    Composer
    --TCON    Content type (Genre)
    --TCOP    Copyright (c)
    --TDAT    Date of recording (DDMM)
    --TDEN    Encoding Time
    --TDES    iTunes Podcast Description
    --TDLY    Audio Delay (ms)
    --TDOR    Original Release Time
    --TDRC    Recording Time
    --TDRL    Release Time
    --TDTG    Tagging Time
    --TENC    Encoder
    --TEXT    Lyricist
    --TFLT    File type
    --TGID    iTunes Podcast Identifier
    --TIME    Time of recording (HHMM)
    --TIPL    Involved People List
    --TIT1    Content group description
    --TIT2    Title
    --TIT3    Subtitle/Description refinement
    --TKEY    Starting Key
    --TLAN    Audio Languages
    --TLEN    Audio Length (ms)
    --TMCL    Musicians Credits List
    --TMED    Source Media Type
    --TMOO    Mood
    --TOAL    Original Album
    --TOFN    Original Filename
    --TOLY    Original Lyricist
    --TOPE    Original Artist/Performer
    --TORY    Original Release Year
    --TOWN    Owner/Licensee
    --TPE1    Lead Artist/Performer/Soloist/Group
    --TPE2    Band/Orchestra/Accompaniment
    --TPE3    Conductor
    --TPE4    Interpreter/Remixer/Modifier
    --TPOS    Part of set
    --TPRO    Produced (P)
    --TPUB    Publisher
    --TRCK    Track Number
    --TRDA    Recording Dates
    --TRSN    Internet Radio Station Name
    --TRSO    Internet Radio Station Owner
    --TSIZ    Size of audio data (bytes)
    --TSO2    iTunes Album Artist Sort
    --TSOA    Album Sort Order key
    --TSOC    iTunes Composer Sort
    --TSOP    Perfomer Sort Order key
    --TSOT    Title Sort Order key
    --TSRC    International Standard Recording Code (ISRC)
    --TSSE    Encoder settings
    --TSST    Set Subtitle
    --TXXX    User-defined text data.
    --TYER    Year of recording
    --UFID    Unique file identifier.
    --USER    Terms of use.
    --USLT    Unsynchronised lyrics/text transcription.
    --WCOM    Commercial Information
    --WCOP    Copyright Information
    --WFED    iTunes Podcast Feed
    --WOAF    Official File Information
    --WOAR    Official Artist/Performer Information
    --WOAS    Official Source Information
    --WORS    Official Internet Radio Information
    --WPAY    Payment Information
    --WPUB    Official Publisher Information
    --WXXX    User-defined URL data.

*/

/*******************************************
* URLPARAMETERS
*******************************************/
if(isset($_GET['folder']) && $_GET['folder'] != "") {
    $post['folder'] = $_GET['folder'];
} else {
    if(isset($_POST['folder']) && $_POST['folder'] != "") {
        $post['folder'] = $_POST['folder'];
    }
}
if(isset($_GET['filename']) && $_GET['filename'] != "") {
    $post['filename'] = $_GET['filename'];
} else {
    if(isset($_POST['filename']) && $_POST['filename'] != "") {
        $post['filename'] = $_POST['filename'];
    }
}
/*
* track information
*/
if(isset($_POST['TIT2']) && trim($_POST['TIT2']) != "") {
    $post['trackTitle'] = trim($_POST['TIT2']);
}
if(isset($_POST['TPE1']) && trim($_POST['TPE1']) != "") {
    $post['trackArtist'] = trim($_POST['TPE1']);
}
if(isset($_POST['TALB']) && trim($_POST['TALB']) != "") {
    $post['trackAlbum'] = trim($_POST['TALB']);
}
if(isset($_POST['TCOM']) && trim($_POST['TCOM']) != "") {
    $post['trackComposer'] = trim($_POST['TCOM']);
}

/*******************************************
* ACTIONS
*******************************************/
$messageAction = "";
$messageSuccess = "";

/*
* Move file to different dir
*/
if($_POST['ACTION'] == "trackMove") {
    $sourceFolder = $post['folder'];
    $targetFolder = trim($_POST['folderNew']);
    $fileName = trim($_POST['filename']);

    $sourceFile = Files::buildPath($sourceFolder, $fileName);
    $targetFile = Files::buildPath($targetFolder, $fileName);

    if (!empty($targetFolder) && is_dir($targetFolder)
            && $sourceFolder != $targetFolder
            && Strings::startsWith($targetFile, $Audio_Folders_Path) && Strings::startsWith($sourceFile, $Audio_Folders_Path)) {
        $result = rename($sourceFile, $targetFile);
        if ($result) {
            $post['folder'] = $targetFolder;
            $messageSuccess = "
File '".$fileName."' moved successfully to '" . $targetFolder . "'.
";

        } else {
            $messageWarning = "
Move file '".$fileName."' to '" . $targetFolder . "'failed!
";
            error_log('Move track failed!' . var_export(array("sourceFile" => $sourceFile, 'targetFile' => $targetFile), true), 0);
        }
    }
    else {
        $messageWarning = "
Move file '".$fileName."' to '" . $targetFolder . "'failed!
";
        error_log('Move track failed!' . var_export(array("sourceFile" => $sourceFile, 'targetFile' => $targetFile), true), 0);
    }
}

/*
* Update track tags
* WARNING: I spent two days testing with ffmpeg, id3v2, id3 and mid3v2 to make utf-8 work.
* And failed.
* So there is help needed here. Until then, I am using an ugly solution to avoid '?':
* search and replace for Umlaute (because besides the English speaking users, there are
* mainly German speaking Phoniebox tinkerers.
* The function is inside the file htdocs/func.php and used here to make the metadata
* human readable (yet not searcheable :)
*/
if($_POST['ACTION'] == "trackUpdate") {
    unset($exec);
    $fileName = Files::buildPath($post['folder'], $post['filename']);
    /*
    * general metadata that should work for all file types
    */
    $optionalArtistOption = (isset($post['trackArtist']))? " --artist='" . replaceUmlaute($post['trackArtist']) . "'" : "";
    $optionalTitleOption = (isset($post['trackTitle']))?   " --song='" . replaceUmlaute($post['trackTitle']) . "'" : "";
    $optionalAlbumOption = (isset($post['trackAlbum']))?   " --album='" . replaceUmlaute($post['trackAlbum']) . "'" : "";
    $optionalComposerOption = (strtolower(pathinfo($post['filename'], PATHINFO_EXTENSION)) == "mp3" && isset($post['trackComposer']))? " --TCOM='" . replaceUmlaute($post['trackComposer']) . "'" : "";

    $exec = "mid3v2" . $optionalArtistOption . $optionalAlbumOption . $optionalTitleOption . $optionalComposerOption . " '" . $fileName . "'";

    if ($optionalArtistOption || $optionalTitleOption || $optionalAlbumOption || $optionalComposerOption) {
        exec($exec);
    }
}
/*
* Delete file
*/
if($_POST['ACTION'] == "trackDelete") {
    if($_POST['deleteTrack'] == "yes") {
        // delte the file
        $exec = 'sudo rm "'.$post['folder'].'/'.$post['filename'].'"';
        exec($exec);
        $messageSuccess = "
File '".$post['folder']."/".$post['filename']."' was deleted from your collection.
";
        // unset the filename and folder var
        unset($post['filename']);
        unset($post['folder']);
    } else {
        $messageWarning = "
File '".$post['folder']."/".$post['filename']."' was NOT deleted. You need to select 'yes' to confirm.
";
    }
}

/*
* read metadata
*/
$fileName = Files::buildPath($post['folder'], $post['filename']);
$exec = "mid3v2 -l '" .escapeshellarg($fileName) ."'" ;
$res = shell_exec($exec);
$lines = explode(PHP_EOL, $res);
foreach($lines as $line) {
    $parts = explode("=",$line);
    $key = trim(array_shift($parts)); // take the first
    $val = trim(implode("=",$parts)); // put the rest back together
    if (in_array($key, $trackDat['metaKeys']['mp3'])) {
        $trackDat['existingTags'][$key] = $val;
    }
}

/*******************************************
* START HTML
*******************************************/

html_bootstrap3_createHeader("en","Phoniebox",$conf['base_url']);

?>

<?php
include("inc.navigation.php");
?>

<?php print $lang['trackEditTitle']; ?>

<?php
/*
* Do we need to voice a warning here?
*/
if ($messageAction == "") {
    $messageAction = "";
}
if(isset($messageWarning) && $messageWarning != "") {
    print '
'.$messageWarning.'
';
}
if(isset($messageAction) && $messageAction != "") {
    print '
'.$messageAction.'
';
}
if(isset($messageSuccess) && $messageSuccess != "") {
    print '
'.$messageSuccess.'
';
    //unset($post);
}

?>

<?php
/*
* ONLY show the forms if the file and folder are set and known. e.g. not after file was deleted.
*/
if(
    isset($post['filename'])
    && isset($post['folder'])
    && $post['filename'] != ""
    && $post['folder'] != ""
    ) {
?>

          <?php print $lang['trackEditInformation']; ?>

          <?php print $lang['globalFolder']; ?>

<?php print $post['folder']; ?>

           <?php print $lang['globalFilename']; ?>

<?php print $post['filename']; ?>

        <form name='volume' method='post' action='<?php print $_SERVER['PHP_SELF']; ?>'>
          <input type="hidden" name="folder" value="<?php print $post['folder']; ?>">
          <input type="hidden" name="filename" value="<?php print $post['filename']; ?>">
          <input type="hidden" name="ACTION" value="trackMove">
        <fieldset>
        <legend> <?php print $lang['trackEditMove']; ?></legend>

          <?php print $lang['trackEditMoveSelectLabel']; ?>

            <select id="folderNew" name="folderNew" class="form-control">

              <option value="<?php print basename($post['folder']); ?>" selected="selected"><?php print $lang['trackEditMoveSelectDefault']; ?></option>
<?php
/*
* read the subfolders of $Audio_Folders_Path
*/
$audiofolders_abs = dir_list_recursively($Audio_Folders_Path);
usort($audiofolders_abs, 'strcasecmp');
/*
* get relative paths for pulldown
*/
$audiofolders = array();
foreach($audiofolders_abs as $audiofolder){
    /*
    * get the relative path as value, set the absolute path as key
    */
    $relpath = substr($audiofolder, strlen($Audio_Folders_Path) + 1, strlen($audiofolder));
    if($relpath != "") {
        $audiofolders[$audiofolder] = substr($audiofolder, strlen($Audio_Folders_Path) + 1, strlen($audiofolder));
    }
}
//print "
"; print_r($audiofolders); print "
"; //???

// counter for ID of each folder
$idcounter = 0;
// go through all folders
foreach($audiofolders as $keyfolder => $audiofolder) {
    if($post['folder'] != $keyfolder) {
        print "              <option value='".$keyfolder."'";
        print ">".$audiofolder."</option>\n";
    }
}
?>
            </select>

        </fieldset>

            <button id="submit" name="submit" class="btn btn-success" value="trackMove"><?php print $lang['globalMove']; ?></button>

        </form>

        <form name='volume' method='post' action='<?php print $_SERVER['PHP_SELF']; ?>'>
          <input type="hidden" name="folder" value="<?php print $post['folder']; ?>">
          <input type="hidden" name="filename" value="<?php print $post['filename']; ?>">
          <input type="hidden" name="ACTION" value="trackDelete">
        <fieldset>
        <legend> <?php print $lang['trackEditDelete']; ?></legend>

      <?php print $lang['trackEditDeleteLabel']; ?>

      <input name="deleteTrack" id="deleteTrack-0" value="no" checked="checked" type="radio">
      <?php print $lang['trackEditDeleteNo']; ?>

      <input name="deleteTrack" id="deleteTrack-1" value="yes" type="radio">
      <?php print $lang['trackEditDeleteYes']; ?>

          <?php print $lang['trackEditDeleteHelp']; ?>

        </fieldset>

            <button id="submit" name="submit" class="btn btn-warning" value="trackMove"><?php print $lang['globalDelete']; ?></button>

        </form>

        <form name='volume' method='post' action='<?php print $_SERVER['PHP_SELF']; ?>'>
          <input type="hidden" name="folder" value="<?php print $post['folder']; ?>">
          <input type="hidden" name="filename" value="<?php print $post['filename']; ?>">
          <input type="hidden" name="ACTION" value="trackUpdate">
        <fieldset>
        <legend> Edit track information</legend>

Please note that the tag editing only works well for ASCII chars. German Umlaute will be replaced. Other UTF-8 chars turn into '?'. Help needed: please file pull requests :)

          Track title

          <input value="<?php
          if (isset($trackDat['existingTags']['TIT2']) && trim($trackDat['existingTags']['TIT2']) != "") {
              echo trim($trackDat['existingTags']['TIT2']);
          }
          ?>" id="TIT2" name="TIT2" placeholder="" class="form-control input-md" type="text">

          Artist

          <input value="<?php
          if (isset($trackDat['existingTags']['TPE1']) && trim($trackDat['existingTags']['TPE1']) != "") {
              echo trim($trackDat['existingTags']['TPE1']);
          }
          ?>" id="TPE1" name="TPE1" placeholder="" class="form-control input-md" type="text">

          Composer

          <input value="<?php
          if (isset($trackDat['existingTags']['TCOM']) && trim($trackDat['existingTags']['TCOM']) != "") {
              echo trim($trackDat['existingTags']['TCOM']);
          }
          ?>" id="TCOM" name="TCOM" placeholder="" class="form-control input-md" type="text">

          Album title

          <input value="<?php
          if (isset($trackDat['existingTags']['TALB']) && trim($trackDat['existingTags']['TALB']) != "") {
              echo trim($trackDat['existingTags']['TALB']);
          }
          ?>" id="TALB" name="TALB" placeholder="" class="form-control input-md" type="text">

        </fieldset>

            <button id="submit" name="submit" class="btn btn-success" value="trackUpdate"><?php print $lang['globalUpdate']; ?></button>

        </form>

<?php
/*
* ONLY show the forms if the file and folder are set and known. e.g. not after file was deleted.
*
if(
    isset($post['filename'])
    && isset($post['folder'])
    && $post['filename'] != ""
    && $post['folder'] != ""
    ) {
*/
}
?>

<?php
if($debug == "true") {
    print "
";
    print "_POST\n";
    print_r($_POST);
    print "\nconf\n";
    print_r($conf);
    print "\npost\n";
    print_r($post);
    print "\nfile extension: ".strtolower(pathinfo($post['filename'], PATHINFO_EXTENSION))."\n";//.lower(pathinfo($filname, PATHINFO_EXTENSION));
    print_r($trackDat);
    print $res;
    print "
";
    include('inc.debug.php');
}
?>


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Agency - Start Bootstrap Theme</title>

        <link href="css/bootstrap.min.css" rel="stylesheet">

        <link href="css/agency.css" rel="stylesheet">

        <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
        <link href="http://fonts.googleapis.com/css?family=Kaushan+Script" rel="stylesheet" type="text/css">
        <link href="http://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic" rel="stylesheet" type="text/css">
        <link href="http://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700" rel="stylesheet" type="text/css">

        <link href="http://fonts.googleapis.com/css?family=Jockey+One|Merriweather:400,300italic,300,700italic,700,400italic,900,900italic" rel="stylesheet" type="text/css">

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                        Toggle navigation

                    </button>
                    Hicham Idiomas

                            IDIOMAS

                            SERVIÇOS

                            O PROFESSOR

                            DEPOIMENTOS

                            PACOTES

HICHAM IDIOMAS

Experimente o mundo em uma nova língua

                    Tell Me More

POR QUE ESTUDAR UMA NOVA LÍNGUA?

Lorem ipsum dolor sit amet consectetur.

Francês

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

Alemão

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

o QUE OFERECEMOS

Lorem ipsum dolor sit amet consectetur.

Foco nos seus objetivos

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

Material didático moderno

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

Aulas individuais ou em grupo

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

Horários flexíveis

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

Localização de fácil acesso

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

Certificados de conclusão

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.

CONHEÇA O PROFESSOR

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc massa libero, sollicitudin eget imperdiet in, vestibulum non justo. Sed in mi aliquet purus volutpat bibendum. Praesent vel imperdiet diam, vel finibus diam. Nullam placerat risus dui, quis elementum velit condimentum at. Donec lorem lacus, convallis at libero ac, varius vehicula risus. Sed finibus magna eget leo commodo, vehicula maximus dui cursus. Vestibulum blandit massa placerat, tincidunt odio ac, consectetur ipsum.

Lorem ipsum.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc massa libero, sollicitudin eget imperdiet in, vestibulum non justo. Sed in mi aliquet purus volutpat bibendum. Praesent vel imperdiet diam, vel finibus diam. Nullam placerat risus dui, quis elementum velit condimentum at. Donec lorem lacus, convallis at libero ac, varius vehicula risus. Sed finibus magna eget leo commodo, vehicula maximus dui cursus. Vestibulum blandit massa placerat, tincidunt odio ac, consectetur ipsum.

 Donec lorem lacus, convallis at libero ac, varius vehicula risus. Sed finibus magna eget leo commodo, vehicula maximus dui cursus. Vestibulum blandit massa placerat, tincidunt odio ac, consectetur ipsum.

VEJA O QUE NOSSOS ALUNOS ESTÃO DIZENDO

Kay Garland

Lead Designer

Larry Parker

Lead Marketer

Diana Pertersen

Lead Developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.

Contact Us

Lorem ipsum dolor sit amet consectetur.

                        <form name="sentMessage" id="contactForm" novalidate>

                                        <input type="text" class="form-control" placeholder="Your Name *" id="name" required data-validation-required-message="Please enter your name.">

                                        <input type="email" class="form-control" placeholder="Your Email *" id="email" required data-validation-required-message="Please enter your email address.">

                                        <input type="tel" class="form-control" placeholder="Your Phone *" id="phone" required data-validation-required-message="Please enter your phone number.">

                                        <textarea class="form-control" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea>

                                    <button type="submit" class="btn btn-xl">Send Message</button>

                        </form>

                        Copyright © Your Website 2014

                                Privacy Policy

                                Terms of Use

Project Name

Lorem ipsum dolor sit amet consectetur.

Use this area to describe your project. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est blanditiis dolorem culpa incidunt minus dignissimos deserunt repellat aperiam quasi sunt officia expedita beatae cupiditate, maiores repudiandae, nostrum, reiciendis facere nemo!

Want these icons in this portfolio item sample?You can download 60 of them for free, courtesy of RoundIcons.com, or you can purchase the 1500 icon set here.

Date: July 2014

Client: Round Icons

Category: Graphic Design

                                <button type="button" class="btn btn-primary" data-dismiss="modal">
                                     Close Project
                                </button>

Project Heading

Lorem ipsum dolor sit amet consectetur.

Startup Framework is a website builder for professionals. Startup Framework contains components and complex blocks (PSD+HTML Bootstrap themes and templates) which can easily be integrated into almost any design. All of these components are made in the same style, and can easily be integrated into projects, allowing you to create hundreds of solutions for your future projects.

You can preview Startup Framework here.

                                <button type="button" class="btn btn-primary" data-dismiss="modal">
                                     Close Project
                                </button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Treehouse is a free PSD web template built by Mathavan Jaya. This is bright and spacious design perfect for people or startup companies looking to showcase their apps or other projects.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal">
                                     Close Project
                                </button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Start Bootstrap's Agency theme is based on Golden, a free PSD website template built by Mathavan Jaya. Golden is a modern and clean one page web template that was made exclusively for Best PSD Freebies. This template has a great portfolio, timeline, and meet your team sections that can be easily modified to fit your needs.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal">
                                     Close Project
                                </button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Escape is a free PSD web template built by Mathavan Jaya. Escape is a one page web template that was designed with agencies in mind. This template is ideal for those looking for a simple one page solution to describe your business and offer your services.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal">
                                     Close Project
                                </button>

Project Name

Lorem ipsum dolor sit amet consectetur.

Dreams is a free PSD web template built by Mathavan Jaya. Dreams is a modern one page web template designed for almost any purpose. It's a beautiful template that's designed with the Bootstrap framework in mind.

You can download the PSD template in this portfolio sample item at FreebiesXpress.com.

                                <button type="button" class="btn btn-primary" data-dismiss="modal">
                                     Close Project
                                </button>


text:
import { FixtureId } from 'react-cosmos-shared2/renderer';
import { getCosmosConfigAtPath, getFixtures } from 'react-cosmos';
import { create } from 'react-test-renderer';

const cosmosConfig = getCosmosConfigAtPath(require.resolve('../cosmos.config'));

it('returns fixture elements', async () => {
  expect.hasAssertions();
  const fixtures = await getFixtures({ cosmosConfig });
  fixtures.forEach(({ fixtureId, getElement }) => {
    const renderer = create(getElement());
    expect(renderer.toJSON()).toMatchSnapshot(stringifyFixtureId(fixtureId));
  });
});

function stringifyFixtureId({ path, name }: FixtureId) {
  return name ? `${path} ${name}` : path;
}


text:
BlottleshipsServer
==================

A server for Blottleships written in Haskell


text:
package selling.sunshine.dao.impl;

import common.sunshine.utils.IDGenerator;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import common.sunshine.dao.BaseDao;
import selling.sunshine.dao.WithdrawDao;
import selling.sunshine.model.WithdrawRecord;
import common.sunshine.pagination.DataTablePage;
import common.sunshine.pagination.DataTableParam;
import common.sunshine.utils.ResponseCode;
import common.sunshine.utils.ResultData;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by sunshine on 6/6/16.
 */
@Repository
public class WithdrawDaoImpl extends BaseDao implements WithdrawDao {
    private Logger logger = LoggerFactory.getLogger(WithdrawDaoImpl.class);

    private Object lock = new Object();

    @Transactional
    @Override
    public ResultData insertWithdraw(WithdrawRecord record) {
        ResultData result = new ResultData();
        synchronized (lock) {
            try {
                record.setWithdrawId(IDGenerator.generate("WID"));
                sqlSession.insert("selling.agent.withdraw.insert", record);
                result.setData(record);
            } catch (Exception e) {
                logger.error(e.getMessage());
                result.setResponseCode(ResponseCode.RESPONSE_ERROR);
                result.setDescription(e.getMessage());
            } finally {
                return result;
            }
        }
    }

    @Override
    public ResultData queryWithdraw(Map<String, Object> condition) {
        ResultData result = new ResultData();
        try {
            condition = handle(condition);
            List<WithdrawRecord> list = sqlSession.selectList("selling.agent.withdraw.query", condition);
            result.setData(list);
        } catch (Exception e) {
            logger.error(e.getMessage());
            result.setResponseCode(ResponseCode.RESPONSE_ERROR);
            result.setDescription(e.getMessage());
        } finally {
            return result;
        }
    }

    @Transactional
    @Override
    public ResultData updateWithdraw(WithdrawRecord record) {
        ResultData result = new ResultData();
        synchronized (lock) {
            try {
                sqlSession.update("selling.agent.withdraw.update", record);
                result.setData(record);
            } catch (Exception e) {
                logger.error(e.getMessage());
                result.setResponseCode(ResponseCode.RESPONSE_ERROR);
                result.setDescription(e.getMessage());
            } finally {
                return result;
            }
        }
    }

    @Override
    public ResultData queryWithdrawByPage(Map<String, Object> condition, DataTableParam param) {
        ResultData result = new ResultData();
        DataTablePage<WithdrawRecord> page = new DataTablePage<>(param);
        condition = handle(condition);
        if (!StringUtils.isEmpty(param.getsSearch())) {
            String searchParam=param.getsSearch().replace("/", "-");
        	condition.put("search", "%"+searchParam+"%");
        }
        if (!StringUtils.isEmpty(param.getParams())) {
            JSONObject json = JSON.parseObject(param.getParams());
            if (json.containsKey("status")) {
            	List<Integer> status = new ArrayList<>();
                switch (json.getString("status")) {
                    case "APPLICATION":
                         status.add(0);
                         condition.put("status", status);
                         condition.put("blockFlag", true);
                        break;
                    case "CHECK":
                        status.add(0);
                        status.add(1);
                        condition.put("status", status);
                        condition.put("blockFlag", false);
                        break;
                }
            }
        }
        ResultData total = queryWithdraw(condition);
        if (total.getResponseCode() != ResponseCode.RESPONSE_OK) {
            result.setResponseCode(ResponseCode.RESPONSE_ERROR);
            result.setDescription(total.getDescription());
            return result;
        }
        page.setiTotalRecords(((List<WithdrawRecord>) total.getData()).size());
        page.setiTotalDisplayRecords(((List<WithdrawRecord>) total.getData()).size());
        List<WithdrawRecord> current = queryWithdrawByPage(condition, param.getiDisplayStart(), param.getiDisplayLength());
        if (current.isEmpty()) {
            result.setResponseCode(ResponseCode.RESPONSE_NULL);
        }
        page.setData(current);
        result.setData(page);
        return result;
    }

    private List<WithdrawRecord> queryWithdrawByPage(Map<String, Object> condition, int start, int length) {
        List<WithdrawRecord> result = new ArrayList<>();
        try {
            result = sqlSession.selectList("selling.agent.withdraw.query", condition, new RowBounds(start, length));
        } catch (Exception e) {
            logger.error(e.getMessage());
        } finally {
            return result;
        }
    }

    @Override
    public ResultData statistic(Map<String, Object> condition) {
        ResultData result = new ResultData();
        try {
            List<Map<String, Object>> list = sqlSession.selectList("selling.agent.withdraw.statistic", condition);
            result.setData(list);
            result.setResponseCode(ResponseCode.RESPONSE_OK);
            return result;
        } catch (Exception e) {
            logger.error(e.getMessage());
            result.setResponseCode(ResponseCode.RESPONSE_ERROR);
            result.setDescription(e.getMessage());
        }
        return result;
    }

    @Override
    public ResultData money(Map<String, Object> condition) {
        ResultData result = new ResultData();
        try {
            Double money = sqlSession.selectOne("selling.agent.withdraw.money", condition);
            result.setData(money);
        } catch (Exception e) {
            logger.error(e.getMessage());
            result.setResponseCode(ResponseCode.RESPONSE_ERROR);
            result.setDescription(e.getMessage());
        } finally {
            return result;
        }
    }
}


text:
basePath = '../';

files = [
  JASMINE,
  JASMINE_ADAPTER,
  'app/lib/jquery/jquery-1.9.1.min.js',
  'app/lib/jquery/jquery-ui-1.10.2.min.js',
  'app/lib/jquery/jquery.*.js',
  'app/lib/angular/angular.js',
  'app/lib/angular/angular-*.js',
  'app/js/**/*.js',
  'app/lib/external/*.js',
  'test/unit/**/*.js'
];

browsers = ['Chrome'];
autoWatch = true;
singleRun = false;

junitReporter = {
  outputFile: 'dev-test-results.xml',
/*   Copyright (C) 2013-2014 Computer Sciences Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. */

  suite: 'unit'
};


text:
package tasks

import (
	f "floe/workflow/flow"
	"fmt"
	"github.com/golang/glog"
	"io"
	"io/ioutil"
)

type LsTask struct {
	path string
}

func (ft *LsTask) Type() string {
	return "list directory"
}

func MakeLsTask(path string) *LsTask {
	return &LsTask{
		path: path,
	}
}

// params are passed in and mutated with results
func (ft *LsTask) Exec(t *f.TaskNode, p *f.Params, out *io.PipeWriter) {
	glog.Info("executing list directory ", p.Complete)

	path, ok := p.Props["path"]

	// if no passed in path use defualt
	if !ok {
		path = ft.path
	}

	if path == "" {
		p.Status = f.FAIL
		p.Response = "no path specified"
		return
	}

	// this is mandatory node
	path = t.WorkFlow().Params.Props[f.KEY_WORKSPACE] + "/" + path

	files, _ := ioutil.ReadDir(path)
	for _, f := range files {
		p.Props[fmt.Sprint(f.Name())] = ""
	}

	p.Response = "list directory done"
	p.Status = f.SUCCESS

	return
}