text:
var JSActiveModelSync = function(){
};

JSActiveModelSync.prototype = new JSActiveModel();
JSActiveModelSync.prototype.constructor = JSActiveModelSync;
JSActiveModelSync.prototype.parent = JSActiveModel.prototype;

JSActiveModel.inheritKlass(JSActiveModelSync, JSActiveModel);

JSActiveModelSync.parms = {
}

/*DB methods*/
JSActiveModelSync.prototype.init = function(parms){
  JSActiveModelSync.prototype.dbsetup(parms);
}
JSActiveModelSync.prototype.dbsetup = function(parms){
  if(JSActiveModelSync.prototype.dbopen(parms)){
    var DBTABLE = parms['DBTABLE'];
    var DBCOLUMNS = parms['DBCOLUMNS'];
    DBCOLUMNS = DBCOLUMNS + ', jsam_id';
    db.transaction(function (tx) {
      tx.executeSql('CREATE TABLE IF NOT EXISTS ' + DBTABLE + ' (' + DBCOLUMNS + ')');
      tx.executeSql('CREATE TABLE IF NOT EXISTS ' + DBTABLE + '_AUDIT (' + DBCOLUMNS + ', api_url)');
    });
  }else{
    //methods.get_records( url );
  }
}
JSActiveModelSync.prototype.dbopen = function(parms){
  //these vars should have been set on some global var
  if(window.openDatabase){
    var DATABASE = " "+parms['DATABASE']+" ";
    var DBVERSION = parms['DBVERSION'];
    var DBDESCRIPTION = " "+parms['DBDESCRIPTION']+" ";
    var DBSIZE = parms['DBSIZE'];
    db = openDatabase(DATABASE, DBVERSION, DBDESCRIPTION, DBSIZE);
    return true;
  }else{
    return false;
  }
}

/*Housekeeping methods*/
JSActiveModelSync.prototype.if_exist = function(DBTABLE, DBCOLUMNS, data, auto_handle){
  function queryHandle(tx){
    var remote_id = data.id;
    tx.executeSql('SELECT * FROM ' + DBTABLE + ' WHERE jsam_id = ?', [remote_id], querySuccess, errorHandle );
  }
  function querySuccess(tx, results){
    if(results.rows.length == 0){
      JSActiveModelSync.prototype.sync_pull(DBTABLE, DBCOLUMNS, data)//insert this record
      auto_handle('0');
    }else{
      console.log('already here');
      //TODO:: Update method call here
      auto_handle(id);
    }
  }
  function errorHandle(err){
    console.log(err);
  }
  db.transaction(queryHandle, errorHandle);
}//end last_id
JSActiveModelSync.prototype.last_id = function(DBTABLE, auto_handle){
  function queryHandle(tx){
    tx.executeSql('SELECT MAX(id) AS last_id FROM ' + DBTABLE, [], querySuccess, errorHandle );
  }
  function querySuccess(tx, results){
    for (var i=0; i<results.rows.length; i++) {
      var row = results.rows.item(i);
      last_id = row['last_id'] + 1;
    }
    auto_handle(last_id);
  }
  function errorHandle(err){
  }
  db.transaction(queryHandle, errorHandle);
}//end last_id
JSActiveModelSync.prototype.auto_increment = function(DBTABLE, auto_handle){
  function queryHandle(tx){
    tx.executeSql('SELECT MAX(jsam_id) AS last_jsam_id FROM ' + DBTABLE, [], querySuccess, errorHandle );
  }
  function querySuccess(tx, results){
    for (var i=0; i<results.rows.length; i++) {
      var row = results.rows.item(i);
      last_jsam_id = row['last_jsam_id'] + 1;
    }
    auto_handle(last_jsam_id);
  }
  function errorHandle(err){
    handler(err);
  }
  db.transaction(queryHandle, errorHandle);
}//end auto_increment
JSActiveModelSync.prototype.audit_update = function(DBTABLE, id, keyvals){
  function queryHandle(tx){
    tx.executeSql('UPDATE ' + DBTABLE + '_AUDIT SET ' + keyvals + ' WHERE jsam_id = ' + id );
  }
  function querySuccess(tx, results){
    console.log('success');
  }
  function errorHandle(err){
    console.log('fail');
    handler(err);
  }
  db.transaction(queryHandle, errorHandle);
}//end audit_update
JSActiveModelSync.prototype.audit_delete = function(DBTABLE, id){
  function queryHandle(tx){
    tx.executeSql('DELETE FROM ' + DBTABLE + '_AUDIT WHERE jsam_id = ' + id );
  }
  function querySuccess(tx, results){
    console.log('success');
  }
  function errorHandle(err){
    console.log('fail');
    handler(err);
  }
  db.transaction(queryHandle, errorHandle);
}//end audit delete
JSActiveModelSync.prototype.sync_pull = function(DBTABLE, DBCOLUMNS, post_data){
  function insertHandle(tx, results){
    //prep post_data to have right values for right columns
    data = [];
    for(column in DBCOLUMNS){
     if(DBCOLUMNS[column] in post_data){
      data.push('"' + post_data[DBCOLUMNS[column]] + '"');
     }else{
      data.push("null");
     }
    }
    keys = DBCOLUMNS + ', jsam_id';
    values = data + ', ' + post_data.id;
    tx.executeSql('INSERT INTO ' + DBTABLE + '(' + keys + ') VALUES (' + values + ')' );
  }
  function successHandle(){
  }
  function errorHandle(err){
    handler(err);
  }
  db.transaction(insertHandle, errorHandle, successHandle);
}//end insert
JSActiveModelSync.prototype.sync_push = function(DBTABLE){
  function queryHandle(tx){
    tx.executeSql('SELECT * FROM ' + DBTABLE + '_AUDIT ', [], querySuccess, errorHandle );
  }
  function querySuccess(tx, results){
    for(i=0;i<results.rows.length;i++){
      //case for what type of a push
      switch(type){
        case 'create':
          alert('create');
          break;
        case 'update':
          alert('update');
          break;
        case 'delete':
          alert('delete');
          break;
    }
  }
  function errorHandle(err){
    handler(err);
  }
    db.transaction(queryHandle, errorHandle);
  }
}

//klass methods
JSActiveModelSync.klass = {
  all : function(url, handler){
    var DBTABLE = this.parms['DBTABLE'];
    var DBCOLUMNS = this.parms['DBCOLUMNS'];
    JSActiveModelSync.prototype.init(this.parms); //make sure db is available and open
    function queryHandle(tx){
      tx.executeSql('SELECT * FROM ' + DBTABLE, [], querySuccess, errorHandle );
    }
    function querySuccess(tx, results){
      if(typeof(handler) == 'function'){
        rt = []
        for(i=0;i<results.rows.length;i++){
          rows = {};
          rows = results.rows.item(i);
          rt.push(rows);
        }
        handler(rt);
      }
    }
    function errorHandle(err){
      handler(err);
    }
    if(this.parms['isSyncable']){
      db.transaction(queryHandle, errorHandle);
    }else{
      db.transaction(queryHandle, errorHandle);
    }
  },
  find : function(url, id, handler){
    var DBTABLE = this.parms['DBTABLE'];
    JSActiveModelSync.prototype.init(this.parms); //make sure db is available and open
    function queryHandle(tx){
      tx.executeSql('SELECT * FROM ' + DBTABLE + ' WHERE jsam_id = ' + id, [], querySuccess, errorHandle );
    }
    function querySuccess(tx, results){
      if(typeof(handler) == 'function'){
        handler(results.rows.item(0));
      }
    }
    function errorHandle(err){
      handler(err);
    }
    if(this.parms['isSyncable']){
      db.transaction(queryHandle, errorHandle);
    }else{
      db.transaction(queryHandle, errorHandle);
    }
  },
  /*  Useage for find_by()
  *   [Model Name].find_by([url to api], [db column], [value], [handler])
  *   returns result from "SELECT * FROM [DBTABLE} WHERE [db column] = [value]"
  */
  find_by : function(url, key, value, handler){
    var DBTABLE = this.parms['DBTABLE'];
    JSActiveModelSync.prototype.init(this.parms); //make sure db is available and open
    function queryHandle(tx){
      tx.executeSql("SELECT * FROM " + DBTABLE + " WHERE " + key + " = ?", [value], querySuccess, errorHandle );
    }
    function querySuccess(tx, results){
      if(typeof(handler) == 'function'){
        rt = []
        for(i=0;i<results.rows.length;i++){
          rows = {};
          rows = results.rows.item(i);
          rt.push(rows);
        }
        handler(rt);
      }
    }
    function errorHandle(err){
      console.log("ERROR:");
      console.log(err);
      handler(err);
    }
    if(this.parms['isSyncable']){
      db.transaction(queryHandle, errorHandle);
    }else{
      db.transaction(queryHandle, errorHandle);
    }
  },
  /*  Useage for find_by_sql()
  *   [Model Name].find_by_sql([url to api], [your sql], [handler])
  *   returns result from "SELECT * FROM [DBTABLE} WHERE [db column] = [value]"
  *   It appears that values for your sql need to be in quotes like this:
  *   'SELECT * FROM assignments WHERE task_id = "'+ task +'" AND day = "'+ day +'"'
  */
  find_by_sql : function(url, sql, handler){
    var DBTABLE = this.parms['DBTABLE'];
    JSActiveModelSync.prototype.init(this.parms); //make sure db is available and open
    function queryHandle(tx){
      tx.executeSql(sql, [], querySuccess, errorHandle );
    }
    function querySuccess(tx, results){
      if(typeof(handler) == 'function'){
        rt = []
        for(i=0;i<results.rows.length;i++){
          rows = {};
          rows = results.rows.item(i);
          rt.push(rows);
        }
        handler(rt);
      }
    }
    function errorHandle(err){
      console.log("ERROR:");
      console.log(err);
      handler(err);
    }
    if(this.parms['isSyncable']){
      db.transaction(queryHandle, errorHandle);
    }else{
      db.transaction(queryHandle, errorHandle);
    }
  },
  update : function(url, id, post_data, handler){
    DBTABLE = this.parms['DBTABLE'];
    DBCOLUMNS = this.parms['DBCOLUMNS'];
      JSActiveModelSync.prototype.auto_increment(DBTABLE, function(auto_handle){
        function insertHandle(tx, results){
        //prep post_data to have right values for right columns
        keyvals = '';
        for(column in DBCOLUMNS){
         if(DBCOLUMNS[column] in post_data){
          keyvals += DBCOLUMNS[column] + '="' + post_data[DBCOLUMNS[column]] +'", ';
         }
        }
        keyvals = keyvals.substring(0, keyvals.length-2);
        tx.executeSql('UPDATE ' + DBTABLE + ' SET ' + keyvals + ' WHERE jsam_id = ' + id );
        }
        function successHandle(){
          //trigger sync here?
          handler();
        }
        function errorHandle(err){
          console.log(err);
          handler(err);
        }
        db.transaction(insertHandle, errorHandle, successHandle);
      }); //auto increment before creating the record
  },//end update
  create : function(url, post_data, handler){
    DBTABLE = this.parms['DBTABLE'];
    DBCOLUMNS = this.parms['DBCOLUMNS'];
    JSActiveModelSync.prototype.init(this.parms); //make sure db is available and open
      JSActiveModelSync.prototype.auto_increment(DBTABLE, function(auto_handle){
        function insertHandle(tx, results){
          //prep post_data to have right values for right columns
          data = [];
          for(column in DBCOLUMNS){
           if(DBCOLUMNS[column] in post_data){
            data.push('"' + post_data[DBCOLUMNS[column]] + '"');
           }else{
            data.push("null");
           }
          }
          keys = DBCOLUMNS + ', jsam_id';
          values = data + ', ' + auto_handle ;
          tx.executeSql('INSERT INTO ' + DBTABLE + '(' + keys + ') VALUES (' + values + ')' );
          tx.executeSql('INSERT INTO ' + DBTABLE + '_AUDIT(' + keys + ') VALUES (' + values + ')' );
        }
        function successHandle(){
          //trigger sync here?
          handler();
        }
        function errorHandle(err){
          console.log(err);
          handler(err);
        }
        db.transaction(insertHandle, errorHandle, successHandle);
      }); //auto increment before creating the record
  },//end create
  destroy : function(url, id, handler){
    DBTABLE = this.parms['DBTABLE'];
    DBCOLUMNS = this.parms['DBCOLUMNS'];
      function deleteHandle(tx, results){
        tx.executeSql('DELETE FROM ' + DBTABLE + ' WHERE jsam_id = ' + id );
      }
      function successHandle(){
        //audit table cleanup
        JSActiveModelSync.prototype.audit_delete(DBTABLE, id)
        //trigger sync here?
        handler();
      }
      function errorHandle(err){
        handler(err);
      }
      if(this.parms['isSyncable']){
        db.transaction(deleteHandle, errorHandle, successHandle);
      }else{
        db.transaction(deleteHandle, errorHandle, successHandle);
      }
  },//end destroy
  save : function(){
  },//end save
  sync : function(url){
    //I wanted to make this a prototype method but I couldnt get parms up there. so its here for now
    var DBTABLE = this.parms['DBTABLE'];
    var DBCOLUMNS = this.parms['DBCOLUMNS'];
    JSActiveModelSync.prototype.init(this.parms); //make sure db is available and open

      JSActiveModel.req(url, function(j){
        for(i=0;i<j.length;i++){
          j[i].jsam_id = j[i].id;
          post_data = j[i];
          JSActiveModelSync.prototype.if_exist(DBTABLE, DBCOLUMNS, post_data, function(exist){
            if(exist == 0){
              //it was created
            }else{
              //it was updated
            }
          });
        }
      });

    //clear out the audit table
    JSActiveModelSync.prototype.sync_push(DBTABLE)//clean up audit table for this model

  }//end sync
}

JSActiveModel.hideKlass(JSActiveModelSync);


text:
IPT Knowledge Tester provides ability for instructors to define tests, and for students to test their knowledge and abilities.
In addition to that it allows users to register, and administrators to manage them.The system willbe developed as a Single Page Application (SPA)
using *React.js* and *react-router* as front-end, and *Node.js* + *hapi* + *MongoDB* as backend technologies.

## Project Configuration
Please choose the MongoDB data folder and specify it in *package.json* in scripts section, *'mongo'* script.
By default it uses `c:/mongo-data` folder.

## Runnung The Demo
In order to start the project instal latest *Node.js* and from console run:
```
npm install
npm start
```

Alternatively you can selectively start the individual application components:
* MongoDB - `npm run mongo`
* node.js + hapi.js serrvices - `npm run services` (if you don't need automatic server restarting on change - use `node` instead of `nodemon` in the script)
* webpack-dev-server with HMR (Hot Module Replacement) - `npm run webpack`

## Project Decription and Main Components
Application provides following functionality:

* *Anonymous users* can view the information pages and try few sample tests without saving test results.
* *Students* can choose tests to complete – test results are saved automatically on test completion.
* *Instructors* can create tests and see the students' test results.
* *Administrators* can manage (create, edit user data and delete) all registered users, as well as tests and test results.

JavaScript (ECMAScript 6) client part is available in `/app` folder. It uses *Webpack* and *webpack-dev-server* with HMR (Hot Module Replacement).
Configuration is specified in webpack.config.js.

Client side application is developed as *Singe Page App (SPA)*. The app entry point is `index.js`, which imports *react-router* configuration
specified in `main-router.jsx`. The top-level application component is `ipt-knowledge-tester.jsx` (React JSX + ES6).

Server side is implemented using *hapi.js (http://hapijs.com/)* *Node* framework and resides in `/test-api` forlder.
The Test API is proxied by webpack-dev-server configuration to port 9000 (configurable). Main server class is `server.js`.

Two main features are implemented both on client and server side in this version of the project:
* User management
* Test /Question /Answer management

The server side implementation for two features are in `user.routes.js` and `user.handlers.js` (for User management),
and `test.routes.js` and `test.handlers.js` (for Test management).

Client side implementation uses React ES6 components and resides id `/app/componets/views/users`, and `/app/componets/views/tests` accordingly.

redpajama_set_name: RedPajamaGithub


text:
<TITLE>Review for Breakdown (1997)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Breakdown (1997)

reviewed by
Steve Rhodes

                                BREAKDOWN
                       A film review by Steve Rhodes
                        Copyright 1997 Steve Rhodes

RATING (0 TO ****):  **

     Attention shoppers.  Behind this door at your local multiplex we
are featuring two shows for the price of one, but not a double feature.

     BREAKDOWN encompasses two competing movies.  One, a taut thriller
will keep your attention wondering how the hero will get himself and
his wife out of their predicament.  Nothing worthy of a Hitchcock, but
a substantive, even if highly derivative, mystery.

     The other movie, which could go by the handle of KILLER TRUCK,
believes that satisfaction comes from car chases and crashes, with
maximum highway carnage being the chief metric of success.  This part
moves surpasses the absurd on its way to the truly ridiculous.

     So which part wins?  I'll tell you at the end of the review.

     The movie opens with Jeff and Amy Taylor, played by Kurt Russell
and Kathleen Quinlan, driving on a remote road in a desert canyon in
one of the western states.  They have sold their Massachusetts home and
are almost broke except for their shinny red, new Jeep Cherokee.  They
quit their jobs and are off to find new ones just like the Howards did
in LOST IN AMERICA.  The Taylors, however, run into a bit more trouble.

     Their car dies in the middle of nowhere, but luckily, or perhaps
unluckily, a friendly trucker named Red Barr (J. T. Walsh) passes by
and offers a hand.  Jeff suggests that Amy go with Red in his
18-wheeler to Billie's Dinner five miles up the road so that she can
call a tow truck.  Meanwhile, Jeff will keep an eye on their prized and
only major possession to ensure that it is not stolen.  (His cell phone
has proven useless since they are too far from a cell site.)

     Jeff discovers a wire that has pulled loose so he starts the car
and goes to find his wife.  The unfriendly natives at the dusty dinner
can't abide strangers asking questions, but none of them claims to have
seen Amy.  The owner's carefully worded response is that he has been
busy and hasn't seen her, but that he cannot say for sure if she has
been there or not.

     When Jeff drives off to go looking again, he finds Red, but Red
claims to have never seen Jeff or his wife.  The polite local cop stops
by and searches Red's truck without finding any evidence.

     This is merely the setup for the mystery.  I will not discuss it
further so as not to give anything away.  If you've seen the trailers,
you already know more than I've told you.

     Kurt Russell sweats and sweats as panic sets in.  His heavy
breathing transmits a palpable sense of fright.  As his eyes glaze over
while looking at a board of flyers about missing people, his fear and
feeling of helplessness engulf the screen.

     Kathleen Quinlan, who received an Academy Award nomination for her
part as Marilyn Lovell in APOLLO 13, puts very little into her role in
BREAKDOWN, but she gets minimum screen time.  Quinlan needs more subtle
roles to bring out her talent.  Here she is wasted.

     Best is J. T. Walsh as the cool, but deadly trucker.  Walsh has
had small but important assignments in a whole host of films from GOOD
MORNING, VIETNAM to EXECUTIVE DECISION.  He has the aura of an
explosion about to happen at any moment, even when he is completely
composed.

     The film's pacing is fast and the tension in the show mounts,
thanks to the editing by Derek Brechin and Kevin Stitt.  They love to
shock the audience with a quick cut from a quiet scene to the loud
noise of something bad happening.  The frequently overpowering music by
Basil Poledouris keeps the film from ever being in danger of having a
subtle moment.  Director Jonathan Mostow, whose only other theatrical
film was BEVERLY HILLS BODYSNATCHERS, has talent but needs to exercise
more self-restraint when it comes to creating action sequences.

     I promised to reveal which movie won.  In an ending that seems
like it will never finish, the car chase part overwhelms the mystery
part.  Watching one action cliche after another, the audience's natural
reaction to the film's conclusion has to be, "Yeah, right!"

     BREAKDOWN runs 1:36.  It is rated R for terror, violence, and
profanity.  The show would be fine for most teenagers.  Until the
ending, I was favorably inclined toward the film, but after the
demolition derby, I could not recommend this movie to anyone.  I give
the film ** since the thriller part was well done.

**** = A must see film.
***  = Excellent show.  Look for it.
**   = Average movie.  Kind of enjoyable.
*    = Poor show.  Don't waste your money.
0    = Totally and painfully unbearable picture.

REVIEW WRITTEN ON: April 24, 1997

Opinions expressed are mine and not meant to reflect my employer's.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
package com.example.ibanez_xiphos.databindingsample.adapters;

import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.AbstractList;
import java.util.ArrayList;

public class RecyclerBindingAdapter<T>
        extends RecyclerView.Adapter<RecyclerBindingAdapter.BindingHolder> {

    private int holderLayout, variableId;
    private AbstractList<T> items = new ArrayList<>();
    private OnItemClickListener<T> onItemClickListener;

    public RecyclerBindingAdapter(int holderLayout, int variableId, AbstractList<T> items) {
        this.holderLayout = holderLayout;
        this.variableId = variableId;
        this.items = items;
    }

    @Override
    public RecyclerBindingAdapter.BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext())
                .inflate(holderLayout, parent, false);
        return new BindingHolder(v);
    }

    @Override
    public void onBindViewHolder(RecyclerBindingAdapter.BindingHolder holder, int position) {
        final T item = items.get(position);
        holder.getBinding().getRoot().setOnClickListener(v -> {
            if (onItemClickListener != null)
                onItemClickListener.onItemClick(position, item);
        });
        holder.getBinding().setVariable(variableId, item);
    }

    @Override
    public int getItemCount() {
        return items.size();
    }

    public void setOnItemClickListener(OnItemClickListener<T> onItemClickListener) {
        this.onItemClickListener = onItemClickListener;
    }

    public interface OnItemClickListener<T> {
        void onItemClick(int position, T item);
    }

    public static class BindingHolder extends RecyclerView.ViewHolder {
        private ViewDataBinding binding;

        public BindingHolder(View v) {
            super(v);
            binding = DataBindingUtil.bind(v);
        }

        public ViewDataBinding getBinding() {
            return binding;
        }
    }
}


text:
using namespace std;
using namespace puppet::runtime;
namespace x3 = boost::spirit::x3;

namespace puppet { namespace compiler { namespace evaluation { namespace collectors {

    query_evaluator::query_evaluator(evaluation::context& context, boost::optional<ast::query_expression> const& expression) :
        _context(context),
        _expression(expression)
    {
    }

    bool query_evaluator::evaluate(compiler::resource const& resource) const
    {
        // Accept all if not given a query to evaluate
        if (!_expression) {
            return true;
        }

        // Climb the remainder of the expression
        auto begin = _expression->operations.begin();
        return climb_expression(_expression->operand, 0, begin, _expression->operations.end(), resource);
    }

    bool query_evaluator::evaluate(ast::basic_query_expression const& expression, compiler::resource const& resource) const
    {
        // Handle nested expressions
        if (auto nested = boost::get<x3::forward_ast<ast::nested_query_expression>>(&expression)) {
            query_evaluator evaluator{ _context, nested->get().expression };
            return evaluator.evaluate(resource);
        }

        evaluation::evaluator evaluator{ _context };

        // Otherwise, this should be an attribute query
        auto& query = boost::get<ast::attribute_query>(expression);

        // Evaluate the expected value
        auto expected = evaluator.evaluate(query.value);

        // If the query is on the title, search the resource's title
        bool result = false;
        if (query.attribute.value == "title") {
            if (auto str = expected.as<string>()) {
                result = resource.type().title() == *str;
            }
        } else {
            // If the attribute doesn't exist, return false
            auto attribute = resource.get(query.attribute.value);
            if (!attribute) {
                return false;
            }

            // If the attribute's value is an array, first check for containment
            if (auto array = attribute->value().as<values::array>()) {
                for (auto const& element : *array) {
                    if (element == expected) {
                        result = true;
                        break;
                    }
                }
            }

            // Otherwise, compare for equality
            result = result || attribute->value() == expected;
        }

        if (query.operator_ == ast::query_operator::not_equals) {
            result = !result;
        }
        return result;
    }

    bool query_evaluator::climb_expression(
        ast::basic_query_expression const& expression,
        std::uint8_t min_precedence,
        std::vector<ast::binary_query_operation>::const_iterator& begin,
        std::vector<ast::binary_query_operation>::const_iterator const& end,
        compiler::resource const& resource) const
    {
        // Evaluate the left-hand side of the expression
        auto result = evaluate(expression, resource);

        // Climb the binary operations based on operator precedence
        uint8_t precedence;
        while (begin != end && (precedence = get_precedence(begin->operator_)) >= min_precedence)
        {
            auto& operation = *begin;
            ++begin;

            // Attempt short circuiting
            if ((operation.operator_ == ast::binary_query_operator::logical_and && !result) ||
                (operation.operator_ == ast::binary_query_operator::logical_or && result)) {
                begin = end;
                return result;
            }

            // Recurse and climb the expression
            uint8_t next_precedence = precedence + (is_right_associative(operation.operator_) ? static_cast<uint8_t>(0) : static_cast<uint8_t>(1));
            result = climb_expression(operation.operand, next_precedence, begin, end, resource);
        }
        return result;
    }

    uint8_t query_evaluator::get_precedence(ast::binary_query_operator op)
    {
        // Return the precedence (low to high)
        switch (op) {
            case ast::binary_query_operator::logical_or:
                return 1;

            case ast::binary_query_operator::logical_and:
                return 2;

            default:
                break;
        }

        throw runtime_error("invalid binary query operator.");
    }

    bool query_evaluator::is_right_associative(ast::binary_query_operator op)
    {
        // Currently all operators are left-associative
        return false;
    }

}}}}  // namespace puppet::compiler::evaluation::collectors


text:
<?php

namespace Furniture\ProductBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use FiveLab\Component\Exception\UnexpectedTypeException;
use Furniture\FactoryBundle\Entity\Factory;
use Furniture\ProductBundle\Model\ProductPartMaterialOptionValueGrouped;
use Sylius\Component\Translation\Model\AbstractTranslatable;
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Translation\Model\TranslationInterface;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Product part material
 */
class ProductPartMaterial extends AbstractTranslatable
{
    /**
     * @var int
     */
    protected $id;

    /**
     * Internal name
     *
     * @Assert\NotBlank()
     *
     * @var string
     */
    protected $name;

    /**
     * Displaying for user
     *
     * @var string
     */
    protected $presentation;

    /**
     * @var Collection|ProductPartMaterialOptionValue[]
     */
    protected $optionValues;

    /**
     * @var Collection|ProductPartMaterialVariant[]
     */
    protected $variants;

    /**
     * @var Factory
     */
    private $factory;

    /**
     * Construct
     */
    public function __construct()
    {
        parent::__construct();

        $this->optionValues = new ArrayCollection();
        $this->variants = new ArrayCollection();
    }

    /**
     * {@inheritdoc}
     */
    public function addTranslation(TranslationInterface $translation)
    {
        if (!$translation instanceof ProductPartMaterialTranslation) {
            throw UnexpectedTypeException::create($translation, ProductPartMaterialTranslation::class);
        }

        return parent::addTranslation($translation);
    }

    /**
     * {@inheritDoc}
     */
    public function removeTranslation(TranslationInterface $translation)
    {
        if (!$translation instanceof ProductPartMaterialTranslation) {
            throw UnexpectedTypeException::create($translation, ProductPartMaterialTranslation::class);
        }

        return parent::removeTranslation($translation);
    }

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

    /**
     * Set name
     *
     * @param string $name
     *
     * @return ProductPartMaterial
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set presentation
     *
     * @param string $presentation
     *
     * @return ProductPartMaterial
     */
    public function setPresentation($presentation)
    {
        $this->translate()->setPresentation($presentation);

        return $this;
    }

    /**
     * Get presentation
     *
     * @return string
     */
    public function getPresentation()
    {
        return $this->translate()->getPresentation();
    }

    /**
     * Set option values
     *
     * @param Collection $optionValues
     *
     * @return ProductPartMaterial
     */
    public function setOptionValues(Collection $optionValues)
    {
        $optionValues->forAll(function ($key, $optionValue){
            if (!$optionValue instanceof ProductPartMaterialOptionValue) {
                throw UnexpectedTypeException::create($optionValue, ProductPartMaterialOptionValue::class);
            }

            $optionValue->setMaterial($this);

            return true;
        });

        $this->optionValues = $optionValues;

        return $this;
    }

    /**
     * Get option values
     *
     * @return Collection
     */
    public function getOptionValues()
    {
        return $this->optionValues;
    }

    /**
     * Get grouped option values
     *
     * @return ProductPartMaterialOptionValueGrouped|ProductPartMaterialOptionValueGrouped[]
     */
    public function getGroupedOptionValues()
    {
        $data = [];

        foreach ($this->optionValues as $optionValue) {
            $option = $optionValue->getOption();
            $optionName = $option->getName();

            if (!isset($data[$optionName])) {
                $data[$optionName] = [
                    'option' => $option,
                    'values' => []
                ];
            }

            $data[$optionName]['values'][] = $optionValue;
        }

        $result = new ArrayCollection();

        foreach ($data as $info) {
            $option = $info['option'];
            $values = new ArrayCollection($info['values']);

            $result->add(new ProductPartMaterialOptionValueGrouped($option, $values));
        }

        return $result;
    }

    /**
     * Add option value
     *
     * @param ProductPartMaterialOptionValue $optionValue
     *
     * @return ProductPartMaterial
     */
    public function addOptionValue(ProductPartMaterialOptionValue $optionValue)
    {
        if (!$this->optionValues->contains($optionValue)) {
            $optionValue->setMaterial($this);
            $this->optionValues->add($optionValue);
        }

        return $this;
    }

    /**
     * Remove option
     *
     * @param ProductPartMaterialOptionValue $optionValue
     *
     * @return ProductPartMaterial
     */
    public function removeOptionValue(ProductPartMaterialOptionValue $optionValue)
    {
        if ($this->optionValues->contains($optionValue)) {
            $optionValue->setMaterial(null);
            $this->optionValues->removeElement($optionValue);
        }

        return $this;
    }

    /**
     * Get all variants for this product part material
     *
     * @return Collection|ProductPartMaterialVariant[]
     */
    public function getVariants()
    {
        return $this->variants;
    }

    /**
     * Set factory
     *
     * @param Factory $factory
     *
     * @return ProductPartMaterial
     */
    public function setFactory(Factory $factory = null)
    {
        $this->factory = $factory;

        return $this;
    }

    /**
     * Get factory
     *
     * @return Factory
     */
    public function getFactory()
    {
        return $this->factory;
    }

    /**
     * Implement __toString
     *
     * @return string
     */
    public function __toString()
    {
        return $this->name ?: '';
    }
}


text:
using System.Windows.Controls;

namespace iServerJava6R_SampleCode
{
    public partial class TiledWMTSLayerTest : UserControl
    {
        public TiledWMTSLayerTest()
        {
            InitializeComponent();
        }
    }
}


text:
<?php

/*
 * GENERATED CODE WARNING
 * This file was automatically generated - do not edit!
 */

namespace Google\Cloud\NetworkManagement\Tests\Unit\V1;

use Google\ApiCore\ApiException;

use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\Testing\GeneratedTest;

use Google\ApiCore\Testing\MockTransport;
use Google\Cloud\NetworkManagement\V1\ConnectivityTest;
use Google\Cloud\NetworkManagement\V1\Endpoint;

use Google\Cloud\NetworkManagement\V1\ListConnectivityTestsResponse;
use Google\Cloud\NetworkManagement\V1\ReachabilityServiceClient;
use Google\LongRunning\GetOperationRequest;
use Google\LongRunning\Operation;
use Google\Protobuf\Any;
use Google\Protobuf\FieldMask;
use Google\Protobuf\GPBEmpty;
use Google\Rpc\Code;
use stdClass;

/**
 * @group networkmanagement
 *
 * @group gapic
 */
class ReachabilityServiceClientTest extends GeneratedTest
{
    /**
     * @return TransportInterface
     */
    private function createTransport($deserialize = null)
    {
        return new MockTransport($deserialize);
    }

    /**
     * @return CredentialsWrapper
     */
    private function createCredentials()
    {
        return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
    }

    /**
     * @return ReachabilityServiceClient
     */
    private function createClient(array $options = [])
    {
        $options += [
            'credentials' => $this->createCredentials(),
        ];
        return new ReachabilityServiceClient($options);
    }

    /**
     * @test
     */
    public function createConnectivityTestTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/createConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $name = 'name3373707';
        $description = 'description-1724546052';
        $protocol = 'protocol-989163880';
        $displayName = 'displayName1615086568';
        $expectedResponse = new ConnectivityTest();
        $expectedResponse->setName($name);
        $expectedResponse->setDescription($description);
        $expectedResponse->setProtocol($protocol);
        $expectedResponse->setDisplayName($displayName);
        $anyResponse = new Any();
        $anyResponse->setValue($expectedResponse->serializeToString());
        $completeOperation = new Operation();
        $completeOperation->setName('operations/createConnectivityTestTest');
        $completeOperation->setDone(true);
        $completeOperation->setResponse($anyResponse);
        $operationsTransport->addResponse($completeOperation);
        // Mock request
        $parent = 'parent-995424086';
        $testId = 'testId-1422455832';
        $resource = new ConnectivityTest();
        $resourceName = 'resourceName-384566343';
        $resource->setName($resourceName);
        $resourceSource = new Endpoint();
        $resource->setSource($resourceSource);
        $resourceDestination = new Endpoint();
        $resource->setDestination($resourceDestination);
        $response = $client->createConnectivityTest($parent, $testId, $resource);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $apiRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($apiRequests));
        $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
        $this->assertSame(0, count($operationsRequestsEmpty));
        $actualApiFuncCall = $apiRequests[0]->getFuncCall();
        $actualApiRequestObject = $apiRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.networkmanagement.v1.ReachabilityService/CreateConnectivityTest', $actualApiFuncCall);
        $actualValue = $actualApiRequestObject->getParent();
        $this->assertProtobufEquals($parent, $actualValue);
        $actualValue = $actualApiRequestObject->getTestId();
        $this->assertProtobufEquals($testId, $actualValue);
        $actualValue = $actualApiRequestObject->getResource();
        $this->assertProtobufEquals($resource, $actualValue);
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/createConnectivityTestTest');
        $response->pollUntilComplete([
            'initialPollDelayMillis' => 1,
        ]);
        $this->assertTrue($response->isDone());
        $this->assertEquals($expectedResponse, $response->getResult());
        $apiRequestsEmpty = $transport->popReceivedCalls();
        $this->assertSame(0, count($apiRequestsEmpty));
        $operationsRequests = $operationsTransport->popReceivedCalls();
        $this->assertSame(1, count($operationsRequests));
        $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
        $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
        $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
        $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }

    /**
     * @test
     */
    public function createConnectivityTestExceptionTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/createConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $operationsTransport->addResponse(null, $status);
        // Mock request
        $parent = 'parent-995424086';
        $testId = 'testId-1422455832';
        $resource = new ConnectivityTest();
        $resourceName = 'resourceName-384566343';
        $resource->setName($resourceName);
        $resourceSource = new Endpoint();
        $resource->setSource($resourceSource);
        $resourceDestination = new Endpoint();
        $resource->setDestination($resourceDestination);
        $response = $client->createConnectivityTest($parent, $testId, $resource);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/createConnectivityTestTest');
        try {
            $response->pollUntilComplete([
                'initialPollDelayMillis' => 1,
            ]);
            // If the pollUntilComplete() method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stubs are exhausted
        $transport->popReceivedCalls();
        $operationsTransport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteConnectivityTestTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/deleteConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $expectedResponse = new GPBEmpty();
        $anyResponse = new Any();
        $anyResponse->setValue($expectedResponse->serializeToString());
        $completeOperation = new Operation();
        $completeOperation->setName('operations/deleteConnectivityTestTest');
        $completeOperation->setDone(true);
        $completeOperation->setResponse($anyResponse);
        $operationsTransport->addResponse($completeOperation);
        // Mock request
        $name = 'name3373707';
        $response = $client->deleteConnectivityTest($name);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $apiRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($apiRequests));
        $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
        $this->assertSame(0, count($operationsRequestsEmpty));
        $actualApiFuncCall = $apiRequests[0]->getFuncCall();
        $actualApiRequestObject = $apiRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.networkmanagement.v1.ReachabilityService/DeleteConnectivityTest', $actualApiFuncCall);
        $actualValue = $actualApiRequestObject->getName();
        $this->assertProtobufEquals($name, $actualValue);
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/deleteConnectivityTestTest');
        $response->pollUntilComplete([
            'initialPollDelayMillis' => 1,
        ]);
        $this->assertTrue($response->isDone());
        $this->assertEquals($expectedResponse, $response->getResult());
        $apiRequestsEmpty = $transport->popReceivedCalls();
        $this->assertSame(0, count($apiRequestsEmpty));
        $operationsRequests = $operationsTransport->popReceivedCalls();
        $this->assertSame(1, count($operationsRequests));
        $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
        $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
        $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
        $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }

    /**
     * @test
     */
    public function deleteConnectivityTestExceptionTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/deleteConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $operationsTransport->addResponse(null, $status);
        // Mock request
        $name = 'name3373707';
        $response = $client->deleteConnectivityTest($name);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/deleteConnectivityTestTest');
        try {
            $response->pollUntilComplete([
                'initialPollDelayMillis' => 1,
            ]);
            // If the pollUntilComplete() method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stubs are exhausted
        $transport->popReceivedCalls();
        $operationsTransport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }

    /**
     * @test
     */
    public function getConnectivityTestTest()
    {
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $name2 = 'name2-1052831874';
        $description = 'description-1724546052';
        $protocol = 'protocol-989163880';
        $displayName = 'displayName1615086568';
        $expectedResponse = new ConnectivityTest();
        $expectedResponse->setName($name2);
        $expectedResponse->setDescription($description);
        $expectedResponse->setProtocol($protocol);
        $expectedResponse->setDisplayName($displayName);
        $transport->addResponse($expectedResponse);
        // Mock request
        $name = 'name3373707';
        $response = $client->getConnectivityTest($name);
        $this->assertEquals($expectedResponse, $response);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.networkmanagement.v1.ReachabilityService/GetConnectivityTest', $actualFuncCall);
        $actualValue = $actualRequestObject->getName();
        $this->assertProtobufEquals($name, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function getConnectivityTestExceptionTest()
    {
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $name = 'name3373707';
        try {
            $client->getConnectivityTest($name);
            // If the $client method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listConnectivityTestsTest()
    {
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        // Mock response
        $nextPageToken = '';
        $resourcesElement = new ConnectivityTest();
        $resources = [
            $resourcesElement,
        ];
        $expectedResponse = new ListConnectivityTestsResponse();
        $expectedResponse->setNextPageToken($nextPageToken);
        $expectedResponse->setResources($resources);
        $transport->addResponse($expectedResponse);
        // Mock request
        $parent = 'parent-995424086';
        $response = $client->listConnectivityTests($parent);
        $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
        $resources = iterator_to_array($response->iterateAllElements());
        $this->assertSame(1, count($resources));
        $this->assertEquals($expectedResponse->getResources()[0], $resources[0]);
        $actualRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($actualRequests));
        $actualFuncCall = $actualRequests[0]->getFuncCall();
        $actualRequestObject = $actualRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.networkmanagement.v1.ReachabilityService/ListConnectivityTests', $actualFuncCall);
        $actualValue = $actualRequestObject->getParent();
        $this->assertProtobufEquals($parent, $actualValue);
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function listConnectivityTestsExceptionTest()
    {
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
        ]);
        $this->assertTrue($transport->isExhausted());
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage  = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $transport->addResponse(null, $status);
        // Mock request
        $parent = 'parent-995424086';
        try {
            $client->listConnectivityTests($parent);
            // If the $client method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stub is exhausted
        $transport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
    }

    /**
     * @test
     */
    public function rerunConnectivityTestTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/rerunConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $name2 = 'name2-1052831874';
        $description = 'description-1724546052';
        $protocol = 'protocol-989163880';
        $displayName = 'displayName1615086568';
        $expectedResponse = new ConnectivityTest();
        $expectedResponse->setName($name2);
        $expectedResponse->setDescription($description);
        $expectedResponse->setProtocol($protocol);
        $expectedResponse->setDisplayName($displayName);
        $anyResponse = new Any();
        $anyResponse->setValue($expectedResponse->serializeToString());
        $completeOperation = new Operation();
        $completeOperation->setName('operations/rerunConnectivityTestTest');
        $completeOperation->setDone(true);
        $completeOperation->setResponse($anyResponse);
        $operationsTransport->addResponse($completeOperation);
        // Mock request
        $name = 'name3373707';
        $response = $client->rerunConnectivityTest($name);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $apiRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($apiRequests));
        $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
        $this->assertSame(0, count($operationsRequestsEmpty));
        $actualApiFuncCall = $apiRequests[0]->getFuncCall();
        $actualApiRequestObject = $apiRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.networkmanagement.v1.ReachabilityService/RerunConnectivityTest', $actualApiFuncCall);
        $actualValue = $actualApiRequestObject->getName();
        $this->assertProtobufEquals($name, $actualValue);
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/rerunConnectivityTestTest');
        $response->pollUntilComplete([
            'initialPollDelayMillis' => 1,
        ]);
        $this->assertTrue($response->isDone());
        $this->assertEquals($expectedResponse, $response->getResult());
        $apiRequestsEmpty = $transport->popReceivedCalls();
        $this->assertSame(0, count($apiRequestsEmpty));
        $operationsRequests = $operationsTransport->popReceivedCalls();
        $this->assertSame(1, count($operationsRequests));
        $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
        $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
        $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
        $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }

    /**
     * @test
     */
    public function rerunConnectivityTestExceptionTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/rerunConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $operationsTransport->addResponse(null, $status);
        // Mock request
        $name = 'name3373707';
        $response = $client->rerunConnectivityTest($name);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/rerunConnectivityTestTest');
        try {
            $response->pollUntilComplete([
                'initialPollDelayMillis' => 1,
            ]);
            // If the pollUntilComplete() method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stubs are exhausted
        $transport->popReceivedCalls();
        $operationsTransport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }

    /**
     * @test
     */
    public function updateConnectivityTestTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/updateConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $name = 'name3373707';
        $description = 'description-1724546052';
        $protocol = 'protocol-989163880';
        $displayName = 'displayName1615086568';
        $expectedResponse = new ConnectivityTest();
        $expectedResponse->setName($name);
        $expectedResponse->setDescription($description);
        $expectedResponse->setProtocol($protocol);
        $expectedResponse->setDisplayName($displayName);
        $anyResponse = new Any();
        $anyResponse->setValue($expectedResponse->serializeToString());
        $completeOperation = new Operation();
        $completeOperation->setName('operations/updateConnectivityTestTest');
        $completeOperation->setDone(true);
        $completeOperation->setResponse($anyResponse);
        $operationsTransport->addResponse($completeOperation);
        // Mock request
        $updateMask = new FieldMask();
        $resource = new ConnectivityTest();
        $resourceName = 'resourceName-384566343';
        $resource->setName($resourceName);
        $resourceSource = new Endpoint();
        $resource->setSource($resourceSource);
        $resourceDestination = new Endpoint();
        $resource->setDestination($resourceDestination);
        $response = $client->updateConnectivityTest($updateMask, $resource);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $apiRequests = $transport->popReceivedCalls();
        $this->assertSame(1, count($apiRequests));
        $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
        $this->assertSame(0, count($operationsRequestsEmpty));
        $actualApiFuncCall = $apiRequests[0]->getFuncCall();
        $actualApiRequestObject = $apiRequests[0]->getRequestObject();
        $this->assertSame('/google.cloud.networkmanagement.v1.ReachabilityService/UpdateConnectivityTest', $actualApiFuncCall);
        $actualValue = $actualApiRequestObject->getUpdateMask();
        $this->assertProtobufEquals($updateMask, $actualValue);
        $actualValue = $actualApiRequestObject->getResource();
        $this->assertProtobufEquals($resource, $actualValue);
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/updateConnectivityTestTest');
        $response->pollUntilComplete([
            'initialPollDelayMillis' => 1,
        ]);
        $this->assertTrue($response->isDone());
        $this->assertEquals($expectedResponse, $response->getResult());
        $apiRequestsEmpty = $transport->popReceivedCalls();
        $this->assertSame(0, count($apiRequestsEmpty));
        $operationsRequests = $operationsTransport->popReceivedCalls();
        $this->assertSame(1, count($operationsRequests));
        $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
        $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
        $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
        $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }

    /**
     * @test
     */
    public function updateConnectivityTestExceptionTest()
    {
        $operationsTransport = $this->createTransport();
        $operationsClient = new OperationsClient([
            'serviceAddress' => '',
            'transport' => $operationsTransport,
            'credentials' => $this->createCredentials(),
        ]);
        $transport = $this->createTransport();
        $client = $this->createClient([
            'transport' => $transport,
            'operationsClient' => $operationsClient,
        ]);
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
        // Mock response
        $incompleteOperation = new Operation();
        $incompleteOperation->setName('operations/updateConnectivityTestTest');
        $incompleteOperation->setDone(false);
        $transport->addResponse($incompleteOperation);
        $status = new stdClass();
        $status->code = Code::DATA_LOSS;
        $status->details = 'internal error';
        $expectedExceptionMessage = json_encode([
            'message' => 'internal error',
            'code' => Code::DATA_LOSS,
            'status' => 'DATA_LOSS',
            'details' => [],
        ], JSON_PRETTY_PRINT);
        $operationsTransport->addResponse(null, $status);
        // Mock request
        $updateMask = new FieldMask();
        $resource = new ConnectivityTest();
        $resourceName = 'resourceName-384566343';
        $resource->setName($resourceName);
        $resourceSource = new Endpoint();
        $resource->setSource($resourceSource);
        $resourceDestination = new Endpoint();
        $resource->setDestination($resourceDestination);
        $response = $client->updateConnectivityTest($updateMask, $resource);
        $this->assertFalse($response->isDone());
        $this->assertNull($response->getResult());
        $expectedOperationsRequestObject = new GetOperationRequest();
        $expectedOperationsRequestObject->setName('operations/updateConnectivityTestTest');
        try {
            $response->pollUntilComplete([
                'initialPollDelayMillis' => 1,
            ]);
            // If the pollUntilComplete() method call did not throw, fail the test
            $this->fail('Expected an ApiException, but no exception was thrown.');
        } catch (ApiException $ex) {
            $this->assertEquals($status->code, $ex->getCode());
            $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
        }
        // Call popReceivedCalls to ensure the stubs are exhausted
        $transport->popReceivedCalls();
        $operationsTransport->popReceivedCalls();
        $this->assertTrue($transport->isExhausted());
        $this->assertTrue($operationsTransport->isExhausted());
    }
}


text:
package com.uphyca.idobata.http;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.nio.charset.Charset;

/**
 * Represents an encoded form data.
 *
 * @author Sosuke Masui (masui@uphyca.com)
 */
public class FormUrlEncodedTypedOutput implements TypedOutput {

    private static final String MIME_TYPE = "application/x-www-form-urlencoded; charset=UTF-8";

    private static final Charset ENCODE_CHARSET = Charset.forName("UTF-8");

    private final ByteArrayOutputStream content = new ByteArrayOutputStream();

    public FormUrlEncodedTypedOutput addField(String name, String value) {
        if (content.size() > 0) {
            content.write('&');
        }

        try {
            content.write(URLEncoder.encode(name, ENCODE_CHARSET.name())
                                    .getBytes(ENCODE_CHARSET));
            content.write('=');
            content.write(URLEncoder.encode(value, ENCODE_CHARSET.name())
                                    .getBytes(ENCODE_CHARSET));
            return this;
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }

    public FormUrlEncodedTypedOutput addField(String name, long value) {
        return addField(name, Long.toString(value));
    }

    @Override
    public String mimeType() {
        return MIME_TYPE;
    }

    @Override
    public long length() {
        return content.size();
    }

    @Override
    public void writeTo(OutputStream out) throws IOException {
        out.write(content.toByteArray());
    }
}


text:
<?php

namespace Zend\Hydrator;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class DelegatingHydratorFactory implements FactoryInterface
{
    /**
     * Creates DelegatingHydrator (v2)
     *
     * @param  ServiceLocatorInterface $serviceLocator
     * @return DelegatingHydrator
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        return $this($serviceLocator, '');
    }

    /**
     * Creates DelegatingHydrator (v3)
     *
     * @param ContainerInterface $container
     * @param string $requestedName
     * @param array|null $options
     * @return DelegatingHydrator
     */
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $container = $this->marshalHydratorPluginManager($container);
        return new DelegatingHydrator($container);
    }

    /**
     * Locate and return a HydratorPluginManager instance.
     *
     * @param ContainerInterface $container
     * @return HydratorPluginManager
     */
    private function marshalHydratorPluginManager(ContainerInterface $container)
    {
        // Already one? Return it.
        if ($container instanceof HydratorPluginManager) {
            return $container;
        }

        // As typically registered with v3 (FQCN)
        if ($container->has(HydratorPluginManager::class)) {
            return $container->get(HydratorPluginManager::class);
        }

        // As registered by zend-mvc
        if ($container->has('HydratorManager')) {
            return $container->get('HydratorManager');
        }

        // Fallback: create one
        return new HydratorPluginManager($container);
    }
}


text:
package org.binxance.service.model.marketdata.orderbook;

import java.math.BigDecimal;

import org.binxance.service.model.BaseModel;

public class OrderEntry extends BaseModel {

	private BigDecimal level;
	private BigDecimal quantity;

	public BigDecimal getLevel() {
		return level;
	}

	public void setLevel(BigDecimal level) {
		this.level = level;
	}

	public BigDecimal getQuantity() {
		return quantity;
	}

	public void setQuantity(BigDecimal quantity) {
		this.quantity = quantity;
	}

}


text:
layout: default
title: DeepDive Open Datasets
---

# DeepDive Open Datasets

Over the last few years, our collaborators have used DeepDive to build over [a dozen different
applications](http://deepdive.stanford.edu). Often, these applications are interesting because of the sheer volume of documents that one can read--millions of documents or billions of Web pages. However, many researchers can't get started on these problems because NLP preprocessing is simply too expensive and painful. With the generous support of Condor CHTC, we have been fortunate to be have a ready supply of CPU hours for our own projects. The datasets below have taken over 5+ million CPU hours to produce. It's time that we gave back to the NLP community that has given us so many good ideas for our own systems.

Our work would not be possible without open data. As a result, our group decided to enhance as many [Creative Commons
datasets](http://creativecommons.org/) as we can find. Below, we describe the data format and provide a small list of data sets in this page. We plan to process more data sets and to provide richer data as well (extracted entities and relationships). Feel free to contact us to suggest more open data sets to process.

Acknowledgement

We would like to thank the HTCondor research group and the Center for High Throughput Computing (CHTC) at the University of Wisconsin-Madison, who have provided millions of machine hours to our group. Thank you, Miron Livny. We would also like to thank the Stanford Natural Language Processing Group, whose tools we use in many of our applications. DeepDive is also generously supported by our sponsors.

### Data Format (NLP Markups)

The datasets we provide are in two formats, and for
most datasets, we provide data in both formats.

  - **DeepDive-ready DB Dump.** In this format, the
  data is a database table that can be loaded directly
  into a database with PostgreSQL or Greenplum. The schema of this
  table is the same as what we used in our [walkthrough example](http://deepdive.stanford.edu/doc/basics/walkthrough/walkthrough.html)
  such that you can start building your own DeepDive applications
  immediately after download.

  - **CoNLL-format Markups.** Using DeepDive provides us
  the opportunity to better support your application and
  related technical questions, however, you do not need to
  be tied up to DeepDive to use our datasets. We also provide
  a format that is similar to what has been used in the [CoNLL-X
  shared task](https://code.google.com/p/clearparser/wiki/DataFormat#CoNLL-X_format_(conll)). The columns of the TSV file is arranged as follows:
    `ID` `FORM` `POSTAG` `NERTAG` `LEMMA` `DEPREL` `HEAD` `SENTID` `PROV`.
  The meaning for most of these names could be found in the CoNLL
  specification. `PROV` means a set of bounding boxes in the original
  documents that corresponds to the word, which we will describe in details.

**Provenance.** For each word in our dataset, we provide its
provenance back to the original document. Depending on the
format of the original document, the provenance is provided
in _one_ of the following two formats.

  - PDF provenance: If the original document is PDF or (scanned) image, the
  provenance for a word is a set of bounding boxes. For example,
    `[p8l1329t1388r1453b1405, p8l1313t1861r1440b1892],`
  means that the corresponding word appears in page 8 of the original
  document. It has two bounding boxes because it cross two lines.
  The first bounding box has left margin 1329, top margin 1388, right margin
  1453, and bottom margin 1405. All numbers are in pixels when the image
  is converted with 300dpi.

  - Pure-text provenance: If the original document is HTML or pure text,
  the provenance for a word is a set of intervals of character offsets.
  For example, `14/15` means that the corresponding word contains
  a single character that starts at character offset 14 (include)
  and ends at character offset 15 (not include).

Each dataset is versioned with date, and with the MD5 checksum in the file name.

## PMC-OA (PubMed Central Open Access Subset)

Quick Statistics & Downloads

       Pipeline

      HTML
      >
      STRIP (html2text)
      >
      NLP (Stanford CoreNLP 1.3.4)

       Size 	   70 GB
       Document Type 	  Journal Articles

       # Documents 	   359,324
       # Machine Hours 	  100 K

       # Words 	   2.7 Billion
       # Sentences 	   110 Million

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

PubMed Central (PMC) is a free full-text archive of biomedical and life sciences journal literature at the U.S. National Institutes of Health's National Library of Medicine (NIH/NLM). DeepDive's PMC-OA corpus contains a full snapshot
that we downloaded in March 2014 from the PubMed Central
Open Access Subset.

 PMC
applies different creative common licenses.
Information obtained at [Jan 27, 2015](http://www.ncbi.nlm.nih.gov/pmc/tools/openftlist/).

## BMC (BioMed Central)

Quick Statistics & Downloads

       Pipeline

      HTML
      >
      STRIP (html2text)
      >
      NLP (Stanford CoreNLP 1.3.4)

       Size 	   21 GB
       Document Type 	  Journal Articles

       # Documents 	   70,043
       # Machine Hours 	  20 K

       # Sentences 	   15 Million
       # Words 	   400 Million

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

BioMed Central is an STM (Science, Technology and Medicine) publisher of 274 peer-reviewed open access journals. We plan to have DeepDive's BMC corpus
to contain a full snapshot of BioMed Central in
Jan 2015.

 BioMed Central
applies CC BY 4.0 license.
Information obtained at [Jan 27, 2015](http://www.biomedcentral.com/about).

## PLOS (Public Library of Science)

Quick Statistics & Downloads

       Pipeline

      PDF
      >
      OCR (Tesseract)
      >
      NLP (Stanford CoreNLP 1.3.4)

       Size 	   70GB
       Document Type 	  Journal Articles

       # Documents 	   125,378
       # Machine Hours 	  370 K

       # Words 	   1.3 Billion
       # Sentences 	   73 Million

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

 PLOS is a nonprofit open access scientific publishing project aimed at creating a library of open access journals and other scientific literature under an open content license. DeepDive's PLOS corpus contains a full snapshot that we downloaded in Aug 2014 of the following PLOS journals: (1) PLOS Biology, (2) PLOS Medicine, (3) PLOS Computational Biology, (4) PLOS Genetics, (5) PLOS Pathogens, (6) PLOS Clinical Trials, (7) PLOS ONE, (8) PLOS Neglected Tropical Diseases, and (9) PLOS Currents.

 PLOS applies
CC BY 3.0 license.
Information obtained at [Jan 26, 2015](http://www.plosone.org/static/license).

## BHL (Biodiversity Heritage Library)

Quick Statistics & Downloads

       Pipeline

      OCR'ed Text
      >
      NLP (Stanford CoreNLP 1.3.4)

       Size 	   229 GB
       Document Type 	  Books

       # Documents 	   98,099
       # Machine Hours 	  500 K

       # Sentences 	   1 Billion
       # Words 	   8.7 Billion

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggled" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

The Biodiversity Heritage Library (BHL) is a consortium of natural history and botanical libraries that cooperate to digitize and make accessible the legacy literature of biodiversity held in their collections and to make that literature available for open access and responsible use as a part of a global ''biodiversity commons.'' DeepDive's BHL corpus contains a full snapshot that we downloaded in Jan 2014 from the Biodiversity Heritage Library.

 BHL applies
CC BY-NC-SA 4.0 license.
Information obtained at [Jan 26, 2015](http://biodivlib.wikispaces.com/Licensing+and+Copyright).

## PATENT (Google Patents)

Quick Statistics & Downloads

       Pipeline

      OCR'ed Text
      >
      NLP (Stanford CoreNLP 3.5.1)

       Size 	   428 GB
       Document Type 	  Government Document

       # Documents 	   2,437,000
       # Machine Hours 	  100 K

       # Sentences 	   248 Million
       # Words 	   7.7 Billion

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

We plan to have
DeepDive's PATENT Corpus to contain a full snapshot
of patent grants since 1920 from the United States Patent and Trademark Office (USPTO), European Patent Office (EPO), and World Intellectual Property Organization (WIPO),
indexed by Google Patents in Feb 2015.

 Patent applications we processed belong to the public domain.
Information obtained at [Jan 27, 2015](http://en.wikipedia.org/wiki/Google_Patents).

## WIKI (Wikipedia (English Edition))

Quick Statistics & Downloads

       Pipeline

      WIKI PAGE
      >
      WikiExtractor (link)
      >
      NLP (Stanford CoreNLP 3.5.1)

       Size 	   97 GB
       Document Type 	  Web page

       # Documents 	   4,776,093
       # Machine Hours 	  24 K

       # Sentences 	   85 Million
       # Words 	   2 Billion

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggled" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

Wikipedia is a free-access, free content Internet encyclopedia, supported and hosted by the non-profit Wikimedia Foundation. We plan to have
DeepDive's WIKI Corpus to contain a full snapshot
of the English-language edition of Wikipedia in Feb 2015.

**Note.** For Web-based data sets that contain million
of Web pages, e.g., Wikipedia, CommonCrawl, and ClueWeb, we follow
the standard WARC format to deliver CoNLL-based NLP result. Each chunk
is a `.gz` file that contains a single `.warc` file. Each
`.warc` file contains multiple Web pages, e.g.,

    WARC/1.0
    WARC-Type: conversion
    Content-Length: 30098
    WARC-Date: 2015-03-03T15:11:08Z
    WARC-Payload-Digest: sha1:e7e0459dce73775510147726156fb74f30aa07c3
    WARC-Target-URI: http://en.wikipedia.org/wiki?curid=2504364
    Content-Type: application/octet-stream
    WARC-Record-ID: <urn:uuid:855b1a64-c1b7-11e4-886d-842b2b4a49e6>

    1 Mr. NNP O Mr. nn  4 SENT_1  0:3
    2 Capone-E  NNP O Capone-E  nn  4 SENT_1  4:12
    3 Mr. NNP O Mr. nn  4 SENT_1  14:17
    4 Capone-E  NNP O Capone-E  nsubj 11  SENT_1  18:26
    5 or  CC  O or  null  0 SENT_1  27:29
    6 Fahd  NNP O Fahd  nn  7 SENT_1  30:34
    7 Azam  NNP O Azam  conj_or 4 SENT_1  35:39
    8 is  VBZ O be  cop 11  SENT_1  40:42
    9 an  DT  O a det 11  SENT_1  43:45
    10  Pakistani JJ  MISC  pakistani amod  11  SENT_1  46:55
    11  rapper  NN  O rapper  null  0 SENT_1  56:62
    12  . . O . null  0 SENT_1  62:63

 Wikipedia
applies CC BY-SA 3.0 Unported license.
Information obtained at [Jan 27, 2015](http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License).

## CCRAWL (CommonCrawl)

Quick Statistics & Downloads

       Pipeline

      HTML
      >
      STRIP (html2text)
      >
      NLP (Stanford CoreNLP)

       Size 	   -
       Document Type 	  Web page

       # Documents 	   -
       # Machine Hours 	  -

       # Sentences 	   -
       # Words 	   -

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle disabled" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggle disabled" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

We plan to have
DeepDive's CCRAWL Corpus to process a full
snapshot of the [Common Crawl Corpus](http://commoncrawl.org/), which is a corpus of web crawl data composed of over 5 billion web pages.

 This data set is freely available on Amazon S3 and is released under the Common Crawl Terms of Use.

## CLUEWEB (ClueWeb)

Quick Statistics & Downloads

       Pipeline

      HTML
      >
      STRIP (html2text)
      >
      NLP (Stanford CoreNLP)

       Size 	   -
       Document Type 	  Web page

       # Documents 	   -
       # Machine Hours 	  -

       # Sentences 	   -
       # Words 	   -

       Downloads

          <button type="button" class="btn btn-primary dropdown-toggle disabled" data-toggle="dropdown" aria-expanded="false"> Download Full Corpus
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

          <button type="button" class="btn btn-primary dropdown-toggle disabled" data-toggle="dropdown" aria-expanded="false"> Download Small Teaser
          </button>

DeepDive-ready DB Dump

CoNLL-format Markups

We plan to have
DeepDive's CLUEWEB Corpus to process a full
snapshot of the [ClueWeb 2012](http://commoncrawl.org/) corpus, which is a corpus of web crawl data composed of over 733 million web pages.

## More Datasets Are Coming -- Stay Tuned!

We are currently working hard to bring more (10+!) datasets
available in the next couple months. In the mean time,
we'd love to hear about your applications or interesting
datasets that you have in mind. [Just let us know!](mailto:contact.hazy@gmail.com)

To cite DeepDive open datasets, you can use the following BibTeX citation:

    @misc{DeepDive:2015:OpenData,
      author       = { Christopher R\'{e} and Ce Zhang },
      title        = { {DeepDive} open datasets },
      howpublished = { \url{http://deepdive.stanford.edu/doc/opendata} },
      year         = { 2015 }
    }


text:
fn send<T:Send + std::fmt::Debug>(ch: _chan<T>, data: T) {
    println!("{:?}", ch);
    println!("{:?}", data);
    panic!();
}

#[derive(Debug)]
struct _chan<T>(isize);

// Tests that "log(debug, message);" is flagged as using
// message after the send deinitializes it
fn test00_start(ch: _chan<Box<isize>>, message: Box<isize>, _count: Box<isize>) {
    send(ch, message);
    println!("{}", message); //~ ERROR use of moved value: `message`
}

fn main() { panic!(); }


text:
oauth2client.client module
==========================

.. automodule:: oauth2client.client
    :members:
    :undoc-members:
    :show-inheritance:


text:
package com.tozny.crypto.android;

import android.test.AndroidTestCase;

/**
 * Testing Fundamentals
 */
public class AesCbcWithIntegrityTest extends AndroidTestCase {

    public AesCbcWithIntegrityTest() {
    }

    public void testEncryptionDecryptionWorks() throws Exception {
        AesCbcWithIntegrity.SecretKeys keys = AesCbcWithIntegrity.generateKey();

        //encrypt
        AesCbcWithIntegrity.CipherTextIvMac cipherTextIvMac = AesCbcWithIntegrity.encrypt("some test", keys);
        //store or send to server
        String ciphertextString = cipherTextIvMac.toString();

        //decrypt
        String plainText = AesCbcWithIntegrity.decryptString(cipherTextIvMac, keys);

        assertEquals("some test", plainText);

    }

    public void testEncryptionDecryptionWithPassword() throws Exception {
        AesCbcWithIntegrity.SecretKeys keys = AesCbcWithIntegrity.generateKeyFromPassword("mypassword", "salty".getBytes());

        //encrypt
        AesCbcWithIntegrity.CipherTextIvMac cipherTextIvMac = AesCbcWithIntegrity.encrypt("some test", keys);
        //store or send to server
        String ciphertextString = cipherTextIvMac.toString();

        //decrypt
        String plainText = AesCbcWithIntegrity.decryptString(cipherTextIvMac, keys);

        assertEquals("some test", plainText);

    }

    public void testEncryptionDecryptionCustomIterationCount() throws Exception {
        AesCbcWithIntegrity.SecretKeys keys = AesCbcWithIntegrity.generateKeyFromPassword("mypassword", "salty".getBytes(), 1000);

        //encrypt
        AesCbcWithIntegrity.CipherTextIvMac cipherTextIvMac = AesCbcWithIntegrity.encrypt("some test", keys);
        //store or send to server
        String ciphertextString = cipherTextIvMac.toString();

        //decrypt
        String plainText = AesCbcWithIntegrity.decryptString(cipherTextIvMac, keys);

        assertEquals("some test", plainText);

    }

    public void testEncryptionDecryptionWithDodgySalt() throws Exception {
        try {
            AesCbcWithIntegrity.SecretKeys keys = AesCbcWithIntegrity.generateKeyFromPassword("mypassword", "ABCD + == + EFG!@$%£|~%  ^%$");
            fail("Salt contains invalid base64 chars, an error should be thrown but wasn't");
        }catch (IllegalArgumentException e){
            //ignore this should happen
        }

    }

}


text:
package seedu.address.logic.commands;

import java.util.Set;

import seedu.address.commons.core.EventsCenter;
import seedu.address.commons.events.ui.DisplayTaskListEvent;

/**
 * Finds and lists all tasks in address book whose name contains any of the argument keyphrases.
 * Keyword matching is case sensitive.
 */
public class FindCommand extends Command {

    public static final String COMMAND_WORD = "find";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all tasks containing any of "
            + "the specified keywords (case-insensitive) in task name and displays them as a list with index numbers.\n"
    		+ "Keyword may be a key word or a key phrase found in task name.\n"
            + "Parameters: KEYWORD, [MORE_KEYWORDS], ...\n"
            + "Example: " + COMMAND_WORD + " dinner with wife, report";

    private final Set<String> keyphrases;

    public FindCommand(Set<String> keyphrases) {
        this.keyphrases = keyphrases;
    }

    @Override
    public CommandResult execute() {
    	EventsCenter.getInstance().post(new DisplayTaskListEvent(model.getFilteredTaskList()));
    	model.checkForOverdueTasks();
    	model.updateFilteredTaskList(keyphrases);
        return new CommandResult(getMessageForTaskListShownSummary(model.getFilteredTaskList().size()));
    }

}


text:
This bundle integrates the [JoliTypo](https://github.com/jolicode/JoliTypo) library into Symfony.

Please refer to the [JoliTypo documentation](https://github.com/jolicode/JoliTypo/blob/master/README.md) to learn more
about fixers and how to combine them.

**Note:** there is no cache involved with JoliTypo, take care of it if you want to save some CPU cycles :grimacing:

Not using Symfony Flex? Register the bundle `JoliTypo\Bridge\Symfony\JoliTypoBundle` in your kernel:

```php
  new JoliTypo\Bridge\Symfony\JoliTypoBundle(),
```

Define your Fixers preset as you want (in `config/packages/joli_typo.yaml` or `app/config/config.yml`):

```yaml
joli_typo:
    presets:
        fr:
            fixers: [ Ellipsis, Dimension, Dash, SmartQuotes, FrenchNoBreakSpace, CurlyQuote, Trademark ]
            locale: fr_FR
        en:
            fixers: [ Ellipsis, Dimension, Dash, SmartQuotes, CurlyQuote, Trademark ]
            locale: en_GB
```

Twig function
=============

The Bundle makes use of the Twig bridge and it's method/filter named `jolitypo`, waiting for two arguments: HTML content
to fix and the preset name.

```twig
{{ jolitypo('<p>Hi folk!</p>', 'fr') | raw }}

{# or #}

{{ '<p>Hi folk!</p>' | jolitypo('fr') }}
```

To fix large HTML content, you can pass the markup directly into the `filter` (Twig version < 2.8) / `apply` (Twig version >= 2.8) tag:

```twig
{# Twig < 2.8 #}
{% filter jolitypo('fr') %}
    <p>Je suis "très content" de t'avoir invité sur <a href="http://jolicode.com/">Jolicode.com</a> !</p>
    <p>12 x 6 = 72</p>
    <p>(r), (c), (TM)</p>
    <p>"Tell me Mr. Anderson... what good is a phone call... if you're unable to speak?" -- Agent Smith,<em>Matrix</em>.</p>
{% endfilter %}
```

```twig
{# Twig >= 2.8 #}
{% apply jolitypo('fr') %}
    <p>Je suis "très content" de t'avoir invité sur <a href="http://jolicode.com/">Jolicode.com</a> !</p>
    <p>12 x 6 = 72</p>
    <p>(r), (c), (TM)</p>
    <p>"Tell me Mr. Anderson... what good is a phone call... if you're unable to speak?" -- Agent Smith,<em>Matrix</em>.</p>
{% endapply %}
```

Another way to use it is by passing a whole block to it:

```twig
{% block content %}
    {{ jolitypo(block('real_content'), 'fr') | raw }}
{% endblock %}

{% block real_content %}
    <h2>My whole dynamic page</h2>
{% endblock %}
```