text:
#ifndef BOOST_INTERPROCESS_TEST_ALLOCATION_TEST_TEMPLATE_HEADER
#define BOOST_INTERPROCESS_TEST_ALLOCATION_TEST_TEMPLATE_HEADER

#include <boost/interprocess/detail/config_begin.hpp>
#include "expand_bwd_test_allocator.hpp"
#include <boost/interprocess/detail/type_traits.hpp>
#include <algorithm> //std::equal
#include <vector>
#include <iostream>

namespace boost { namespace interprocess { namespace test {

template<class T>
struct value_holder
{
   value_holder(T val)  :  m_value(val){}
   value_holder(): m_value(0){}
   ~value_holder(){ m_value = 0; }
   bool operator == (const value_holder &other) const
   {  return m_value == other.m_value; }
   bool operator != (const value_holder &other) const
   {  return m_value != other.m_value; }

   T m_value;
};

template<class T>
struct triple_value_holder
{
   triple_value_holder(T val)
      :  m_value1(val)
      ,  m_value2(val)
      ,  m_value3(val)
   {}

   triple_value_holder()
      :  m_value1(0)
      ,  m_value2(0)
      ,  m_value3(0)
   {}

   ~triple_value_holder()
   {  m_value1 = m_value2 = m_value3 = 0; }

   bool operator == (const triple_value_holder &other) const
   {
      return   m_value1 == other.m_value1
         &&    m_value2 == other.m_value2
         &&    m_value3 == other.m_value3;
   }

   bool operator != (const triple_value_holder &other) const
   {
      return   m_value1 != other.m_value1
         ||    m_value2 != other.m_value2
         ||    m_value3 != other.m_value3;
   }

   T m_value1;
   T m_value2;
   T m_value3;
};

typedef value_holder<int> int_holder;
typedef triple_value_holder<int> triple_int_holder;

//Function to check if both sets are equal
template <class Vector1, class Vector2>
bool CheckEqualVector(const Vector1 &vector1, const Vector2 &vector2)
{
   if(vector1.size() != vector2.size())
      return false;
   return std::equal(vector1.begin(), vector1.end(), vector2.begin());
}

template<class Vector>
bool CheckUninitializedIsZero(const Vector & v)
{
   typedef  typename Vector::value_type value_type;
   typename Vector::size_type sz    = v.size();
   typename Vector::size_type extra = v.capacity() - v.size();
   value_type comp(0);

   const value_type *holder = &v[0] + sz;

   while(extra--){
      if(*holder++ != comp)
         return false;
   }
   return true;
}

//This function tests all the possible combinations when
//inserting data in a vector and expanding backwards
template<class VectorWithExpandBwdAllocator>
bool test_insert_with_expand_bwd()
{
   typedef typename VectorWithExpandBwdAllocator::value_type value_type;
   typedef typename boost::interprocess::ipcdetail::remove_volatile<value_type>::type non_volatile_value_type;
   typedef std::vector<non_volatile_value_type> Vect;
   const int MemorySize = 1000;

   //Distance old and new buffer
   const int Offset[]      =
      {  350,  250,  150,  150,
         150,  50,   50,   50    };
   //Insert position
   const int Position[]    =
      {  100,  100,  100,  100,
         100,  100,  100,  100   };
   //Initial vector size
   const int InitialSize[] =
      {  200,  200,  200,  200,
         200,  200,  200,  200   };
   //Size of the data to insert
   const int InsertSize[]  =
      {  100,  100,  100,  200,
         300,  25,   100,  200   };
   //Number of tests
   const int Iterations    = sizeof(InsertSize)/sizeof(int);

   for(int iteration = 0; iteration < Iterations; ++iteration)
   {
      value_type *memory = new value_type[MemorySize];
      try {
         std::vector<non_volatile_value_type> initial_data;
         initial_data.resize(InitialSize[iteration]);
         for(int i = 0; i < InitialSize[iteration]; ++i){
            initial_data[i] = i;
         }

         Vect data_to_insert;
         data_to_insert.resize(InsertSize[iteration]);
         for(int i = 0; i < InsertSize[iteration]; ++i){
            data_to_insert[i] = -i;
         }

         expand_bwd_test_allocator<value_type> alloc
            (&memory[0], MemorySize, Offset[iteration]);
         VectorWithExpandBwdAllocator vector(alloc);
         vector.insert( vector.begin()
                     , initial_data.begin(), initial_data.end());
         vector.insert( vector.begin() + Position[iteration]
                     , data_to_insert.begin(), data_to_insert.end());
         initial_data.insert(initial_data.begin() + Position[iteration]
                           , data_to_insert.begin(), data_to_insert.end());
         //Now check that values are equal
         if(!CheckEqualVector(vector, initial_data)){
            std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
                     << "   Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
                     << "   Iteration: " << iteration << std::endl;
            return false;
         }
      }
      catch(...){
         delete [](const_cast<non_volatile_value_type*>(memory));
         throw;
      }
      delete [](const_cast<non_volatile_value_type*>(memory));
   }

   return true;
}

//This function tests all the possible combinations when
//inserting data in a vector and expanding backwards
template<class VectorWithExpandBwdAllocator>
bool test_assign_with_expand_bwd()
{
   typedef typename VectorWithExpandBwdAllocator::value_type value_type;
   typedef typename boost::interprocess::ipcdetail::remove_volatile<value_type>::type non_volatile_value_type;
   const int MemorySize = 200;

   const int Offset[]      = { 50, 50, 50};
   const int InitialSize[] = { 25, 25, 25};
   const int InsertSize[]  = { 15, 35, 55};
   const int Iterations    = sizeof(InsertSize)/sizeof(int);

   for(int iteration = 0; iteration <Iterations; ++iteration)
   {
      value_type *memory = new value_type[MemorySize];
      try {
         //Create initial data
         std::vector<non_volatile_value_type> initial_data;
         initial_data.resize(InitialSize[iteration]);
         for(int i = 0; i < InitialSize[iteration]; ++i){
            initial_data[i] = i;
         }

         //Create data to insert
         std::vector<non_volatile_value_type> data_to_insert;
         data_to_insert.resize(InsertSize[iteration]);
         for(int i = 0; i < InsertSize[iteration]; ++i){
            data_to_insert[i] = -i;
         }

         //Insert initial data to the vector to test
         expand_bwd_test_allocator<value_type> alloc
            (&memory[0], MemorySize, Offset[iteration]);
         VectorWithExpandBwdAllocator vector(alloc);
         vector.insert( vector.begin()
                     , initial_data.begin(), initial_data.end());

         //Insert data
         vector.insert(vector.cbegin(), data_to_insert.begin(), data_to_insert.end());
         initial_data.insert(initial_data.begin(), data_to_insert.begin(), data_to_insert.end());

         //Now check that values are equal
         if(!CheckEqualVector(vector, initial_data)){
            std::cout << "test_insert_with_expand_bwd::CheckEqualVector failed." << std::endl
                     << "   Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
                     << "   Iteration: " << iteration << std::endl;
            return false;
         }
      }
      catch(...){
         delete [](const_cast<typename boost::interprocess::ipcdetail::remove_volatile<value_type>::type*>(memory));
         throw;
      }
      delete [](const_cast<typename boost::interprocess::ipcdetail::remove_volatile<value_type>::type*>(memory));
   }

   return true;
}

//This function calls all tests
template<class VectorWithExpandBwdAllocator>
bool test_all_expand_bwd()
{
   std::cout << "Starting test_insert_with_expand_bwd." << std::endl << "  Class: "
             << typeid(VectorWithExpandBwdAllocator).name() << std::endl;

   if(!test_insert_with_expand_bwd<VectorWithExpandBwdAllocator>()){
      std::cout << "test_allocation_direct_deallocation failed. Class: "
                << typeid(VectorWithExpandBwdAllocator).name() << std::endl;
      return false;
   }

   std::cout << "Starting test_assign_with_expand_bwd." << std::endl << "  Class: "
             << typeid(VectorWithExpandBwdAllocator).name() << std::endl;

   if(!test_assign_with_expand_bwd<VectorWithExpandBwdAllocator>()){
      std::cout << "test_allocation_direct_deallocation failed. Class: "
                << typeid(VectorWithExpandBwdAllocator).name() << std::endl;
      return false;
   }

   return true;
}

}}}   //namespace boost { namespace interprocess { namespace test {

#include <boost/interprocess/detail/config_end.hpp>

#endif   //BOOST_INTERPROCESS_TEST_ALLOCATION_TEST_TEMPLATE_HEADER

redpajama_set_name: RedPajamaGithub


text:
using namespace czrpc::base;

#define IS_SAME(message, other_message) (message->GetDescriptor()->full_name() == other_message::descriptor()->full_name())

czrpc::client::async_rpc_client client;

void test_func()
{
    while (true)
    {
        try
        {
            auto message = std::make_shared<request_person_info_message>();
            message->set_name("Jack");
            message->set_age(20);

            client.async_call("request_person_info", message).result([](const czrpc::message::result_ptr& ret)
            {
                if (ret->error_code())
                {
                    log_warn() << ret->error_code().message();
                    return;
                }

                if (IS_SAME(ret->message(), response_person_info_message))
                {
                    auto message = std::dynamic_pointer_cast<response_person_info_message>(ret->message());
                    message->PrintDebugString();
                }
                else if (IS_SAME(ret->message(), response_error))
                {
                    auto message = std::dynamic_pointer_cast<response_error>(ret->message());
                    message->PrintDebugString();
                }
            });

            client.async_call_raw("echo", "Hello world").result([](const czrpc::message::result_ptr& ret)
            {
                if (ret->error_code())
                {
                    log_warn() << ret->error_code().message();
                    return;
                }
                std::cout << ret->raw_data() << std::endl;
            });
        }
        catch (std::exception& e)
        {
            log_warn() << e.what();
        }
        std::this_thread::sleep_for(std::chrono::milliseconds(20));
    }
}

void connect_success_notify()
{
    log_info() << "connect success...";
}

int main()
{
    try
    {
        client.set_connect_success_notify(std::bind(&connect_success_notify));
        client.connect("127.0.0.1:50051").timeout(3, 3).run();
    }
    catch (std::exception& e)
    {
        log_warn() << e.what();
        return 0;
    }

#if 0
    try
    {
        auto message = std::make_shared<request_person_info_message>();
        message->set_name("Jack");
        message->set_age(20);

        client.async_call("request_person_info", message).result([](const czrpc::message::result_ptr& ret)
        {
            if (ret->error_code())
            {
                log_warn() << ec.message();
                return;
            }

            if (IS_SAME(ret->message(), response_person_info_message))
            {
                auto message = std::dynamic_pointer_cast<response_person_info_message>(ret->message());
                message->PrintDebugString();
            }
            else if (IS_SAME(ret->message(), response_error))
            {
                auto message = std::dynamic_pointer_cast<response_error>(ret->message());
                message->PrintDebugString();
            }
        });
    }
    catch (std::exception& e)
    {
        log_warn() << e.what();
        return 0;
    }
    std::cin.get();

#else
    std::thread t(test_func);
    std::thread t2(test_func);

    t.join();
    t2.join();
#endif

    return 0;
}


text:
<?php
/**
 * TagTest
 *
 * PHP version 5
 *
 * @category Class
 * @package  Swagger\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * PhraseApp
 *
 * PhraseApp API for the interaction with the PhraseApp localization platform
 *
 * OpenAPI spec version: 2.0
 * Contact: support@phraseapp.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Please update the test case below to test the model.
 */

namespace Swagger\Client;

/**
 * TagTest Class Doc Comment
 *
 * @category    Class */
// * @description Tag
/**
 * @package     Swagger\Client
 * @author      Swagger Codegen team
 * @link        https://github.com/swagger-api/swagger-codegen
 */
class TagTest extends \PHPUnit_Framework_TestCase
{

    /**
     * Setup before running any test case
     */
    public static function setUpBeforeClass()
    {
    }

    /**
     * Setup before running each test case
     */
    public function setUp()
    {
    }

    /**
     * Clean up after running each test case
     */
    public function tearDown()
    {
    }

    /**
     * Clean up after running all test cases
     */
    public static function tearDownAfterClass()
    {
    }

    /**
     * Test "Tag"
     */
    public function testTag()
    {
    }

    /**
     * Test attribute "name"
     */
    public function testPropertyName()
    {
    }

    /**
     * Test attribute "keys_count"
     */
    public function testPropertyKeysCount()
    {
    }

    /**
     * Test attribute "created_at"
     */
    public function testPropertyCreatedAt()
    {
    }

    /**
     * Test attribute "updated_at"
     */
    public function testPropertyUpdatedAt()
    {
    }
}


text:
package showcase.billingbuffer;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.time.Duration;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.regex.*;

import akka.actor.*;
import akka.japi.pf.ReceiveBuilder;

import akka.pattern.Patterns;
import com.rbmhtechnology.eventuate.ReplicationConnection;
import com.rbmhtechnology.eventuate.ReplicationEndpoint;
import com.rbmhtechnology.eventuate.VersionedAggregate.*;
import com.rbmhtechnology.eventuate.log.leveldb.LeveldbEventLog;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import scala.Console;
import scala.concurrent.duration.FiniteDuration;

import static showcase.billingbuffer.SessionActor.*;
import static showcase.billingbuffer.SessionView.*;
import static scala.compat.java8.JFunction.func;
import static scala.compat.java8.JFunction.proc;

public class SessionExample extends AbstractActor {
    private static Pattern pExit = Pattern.compile("^exit\\s*");
    private static Pattern pState = Pattern.compile("^state\\s*");
    private static Pattern pCount = Pattern.compile("^count\\s+(\\w+)\\s*");
    private static Pattern pCreate = Pattern.compile("^create\\s+(\\w+)\\s*");
    private static Pattern pDelete = Pattern.compile("^delete\\s+(\\w+)\\s*");
    private static Pattern pSave = Pattern.compile("^save\\s+(\\w+)\\s*");
    private static Pattern pUpdateUsage = Pattern.compile("^updateusage\\s+(\\w+)\\s+(\\w+)\\s*");
    private static Pattern pBill = Pattern.compile("^bill\\s+(\\w+)\\s+(\\w+)\\s*");
    private static Pattern pResolve = Pattern.compile("^resolve\\s+(\\w+)\\s+(\\d+)\\s*");

    private ActorRef manager;
    private ActorRef view;

    private BufferedReader reader;

    public SessionExample(ActorRef manager, ActorRef view) {
        this.manager = manager;
        this.view = view;

        this.reader = new BufferedReader(new InputStreamReader(System.in));

        receive(ReceiveBuilder
                .match(GetStateSuccess.class, r -> {
                    r.state.values().stream().forEach(SessionActor::printSession);
                    prompt();
                })
                .match(GetStateFailure.class, r -> {
                    System.out.println(r.cause.getMessage());
                    prompt();
                })
                .match(SaveSnapshotSuccess.class, r -> {
                    System.out.println(String.format("[%s] saved snapshot at sequence number %d", r.sessionId, r.metadata.sequenceNr()));
                    prompt();
                })
                .match(SaveSnapshotFailure.class, r -> {
                    System.out.println(String.format("[%s] saved snapshot failed: %s", r.sessionId, r.cause));
                    prompt();
                })
                .match(GetUpdateCountSuccess.class, r -> {
                    System.out.println("[" + r.sessionId + "]" + " update count = " + r.count);
                    prompt();
                })
                .match(CommandFailure.class, r -> r.cause instanceof ConflictDetectedException, r -> {
                    ConflictDetectedException cause = (ConflictDetectedException) r.cause;
                    System.out.println(cause.getMessage() + ", select one of the following versions to resolve conflict");
                    printSession(cause.getVersions());
                    prompt();
                })
                .match(CommandFailure.class, r -> {
                    System.out.println(r.cause.getMessage());
                    prompt();
                })
                .match(CommandSuccess.class, r -> prompt())
                .match(String.class, this::process).build());
    }

    private void prompt() throws IOException {
        String line = reader.readLine();
        if (line != null)
            self().tell(line, null);
    }

    private void process(String cmd) throws IOException {
        // okay, a bit eager, but anyway ...
        Matcher mExit = pExit.matcher(cmd);
        Matcher mState = pState.matcher(cmd);
        Matcher mCount = pCount.matcher(cmd);
        Matcher mCreate = pCreate.matcher(cmd);
        Matcher mDelete = pDelete.matcher(cmd);
        Matcher mSave = pSave.matcher(cmd);
        Matcher mUpdateUsage = pUpdateUsage.matcher(cmd);
        Matcher mBill = pBill.matcher(cmd);
        Matcher mResolve = pResolve.matcher(cmd);

        if (mExit.matches()) {
            getContext().system().terminate();
        } else if (mState.matches()) {
            manager.tell(GetState.instance, self());
        } else if (mCount.matches()) {
            view.tell(new GetUpdateCount(mCount.group(1)), self());
        } else if (mCreate.matches()) {
            manager.tell(new CreateSession(mCreate.group(1), "0.0.0.0", true), self());
        } else if (mDelete.matches()) {
            manager.tell(new DeleteSession(mDelete.group(1)), self());
        } else if (mSave.matches()) {
            manager.tell(new SaveSnapshot(mSave.group(1)), self());
        } else if (mUpdateUsage.matches()) {
            manager.tell(new UpdateSessionUsage(mUpdateUsage.group(1), Long.parseLong(mUpdateUsage.group(2)), 0), self());
        } else if (mBill.matches()) {
            manager.tell(new BillSession(mBill.group(1), Long.parseLong(mBill.group(2)), 0, 0, 0), self());
        } else if (mResolve.matches()) {
            manager.tell(new Resolve(mResolve.group(1), Integer.parseInt(mResolve.group(2)), ""), self());
        } else {
            System.out.println("unknown command: " + cmd);
            prompt();
        }
    }

    @Override
    public void preStart() throws Exception {
        prompt();
    }

    @Override
    public void postStop() throws Exception {
        reader.close();
    }

    public static void main(String[] args) {
        if (args.length == 0)
            throw new UnsupportedOperationException("missing config file");

        File configFile = new File(args[0]);
        if (!configFile.exists())
            throw new UnsupportedOperationException("config file not found");

        Config config = ConfigFactory.parseFile(configFile);
        ActorSystem system = ActorSystem.create(ReplicationConnection.DefaultRemoteSystemName(), config);
        ReplicationEndpoint endpoint = ReplicationEndpoint.create(id -> LeveldbEventLog.props(id, "j", true), system);

        ActorRef view = system.actorOf(Props.create(SessionView.class, endpoint.id(), endpoint.logs().apply(ReplicationEndpoint.DefaultLogName())));
        if (!args[1].contains("view")) {
            ActorRef manager = system.actorOf(Props.create(SessionManager.class, endpoint.id(), endpoint.logs().apply(ReplicationEndpoint.DefaultLogName())));
            ActorRef driver = system.actorOf(Props.create(SessionExample.class, manager, view));

//            manager.tell(new CreateSession("a" + ((Integer) new Random().nextInt(10000)).toString()), ActorRef.noSender());
//            Patterns.ask(manager, new CreateSession("b" + ((Integer) new Random().nextInt(10000)).toString()), Duration.ofSeconds(5).toMillis())
//                    .onComplete(proc(result -> {
//                        if (result.isSuccess()) {
//                            manager.tell(new UseSession(((CommandSuccess) result.get()).sessionId,
//                                    String.format("Somewhere %d", new Random().nextInt(10))), ActorRef.noSender());
//                        } else {
//                            result.failed().get().printStackTrace();
//                        }
//                    }), system.dispatcher());
        }
        else
        {
            system.scheduler().schedule(
                    new FiniteDuration(1000, TimeUnit.MILLISECONDS),
                    new FiniteDuration(1000, TimeUnit.MILLISECONDS),
                    () -> {
                        Patterns.ask(view, new GetUpdateCount("a"), Duration.ofSeconds(5).toMillis())
                                .onComplete(proc(result -> {
                                    if (result.isSuccess()) {
                                        GetUpdateCountSuccess x = (GetUpdateCountSuccess) result.get();
                                        Console.out().println(x.count + "->" + x.sessionId);
                                    } else {
                                        result.failed().get().printStackTrace();
                                    }
                                }), system.dispatcher());
                    },
                    system.dispatcher());

        }

        endpoint.activate();
    }
}


text:
package com.yoghurt.crypto.transactions.client.ui;

import com.yoghurt.crypto.transactions.shared.domain.AddressInformation;
import com.yoghurt.crypto.transactions.shared.domain.Base58CheckContents;

public interface AddressView extends LazyProgressWidget {
  public interface Presenter {

  }

  void setAddress(Base58CheckContents address);

  void setAddressInformation(AddressInformation addressInformation);
}


text:
package com.touzbi.checkers.player;

import com.touzbi.checkers.board.TokenColor;

public interface Player {
	TokenColor getTokenColor();

	/**
	 * Callback message sent to the player announcing the beginning of the
	 * player's turn
	 */
	void startTurn();
}


text:
#include <cstdio>
#include <cstdlib>

#include <LibUtilities/Memory/NekMemoryManager.hpp>
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <LibUtilities/Communication/Comm.h>
#include <MultiRegions/DisContField2D.h>
#include <SpatialDomains/MeshGraph2D.h>

//#define TIMING
#ifdef TIMING
#include <time.h>
#define Timing(s) \
 fprintf(stdout,"%s Took %g seconds\n",s,(clock()-st)/(double)CLOCKS_PER_SEC); \
 st = clock();
#else
#define Timing(s) \
 /* Nothing */
#endif

using namespace Nektar;

int main(int argc, char *argv[])
{
    LibUtilities::SessionReaderSharedPtr vSession
            = LibUtilities::SessionReader::CreateInstance(argc, argv);

    LibUtilities::CommSharedPtr vComm = vSession->GetComm();

    MultiRegions::DisContField2DSharedPtr Exp,Fce;
    MultiRegions::ExpListSharedPtr DerExp1,DerExp2;
    int     i, nq,  coordim;
    Array<OneD,NekDouble>  fce;
    Array<OneD,NekDouble>  xc0,xc1,xc2;
    StdRegions::ConstFactorMap factors;

    if(argc < 2)
    {
        fprintf(stderr,"Usage: PostProcHDG2D  meshfile [solntype]\n");
        exit(1);
    }

    //----------------------------------------------
    // Read in mesh from input file
    SpatialDomains::MeshGraphSharedPtr graph2D = MemoryManager<SpatialDomains::MeshGraph2D>::AllocateSharedPtr(vSession);
    //----------------------------------------------

    //----------------------------------------------
    // Print summary of solution details
    factors[StdRegions::eFactorLambda] = vSession->GetParameter("Lambda");
    factors[StdRegions::eFactorTau] = 1.0;
    const SpatialDomains::ExpansionMap &expansions = graph2D->GetExpansions();
    LibUtilities::BasisKey bkey0
                            = expansions.begin()->second->m_basisKeyVector[0];

	//WILL NEED ADJUSTMENT FOR TRIANGLE, PROBABLY
	int num_modes = bkey0.GetNumModes();
	int num_points = bkey0.GetNumPoints();

    if (vComm->GetRank() == 0)
    {
        cout << "Solving 2D Helmholtz:"  << endl;
        cout << "         Lambda     : " << factors[StdRegions::eFactorLambda] << endl;
        cout << "         No. modes  : " << num_modes << endl;
        cout << endl;
    }

    //----------------------------------------------
    // Define Expansion
    //----------------------------------------------
    Exp = MemoryManager<MultiRegions::DisContField2D>::
        AllocateSharedPtr(vSession,graph2D,vSession->GetVariable(0));
    //----------------------------------------------
    Timing("Read files and define exp ..");

    //----------------------------------------------
    // Set up coordinates of mesh for Forcing function evaluation
    coordim = Exp->GetCoordim(0);
    nq      = Exp->GetTotPoints();

    xc0 = Array<OneD,NekDouble>(nq,0.0);
    xc1 = Array<OneD,NekDouble>(nq,0.0);
    xc2 = Array<OneD,NekDouble>(nq,0.0);

    switch(coordim)
    {
    case 1:
        Exp->GetCoords(xc0);
        break;
    case 2:
        Exp->GetCoords(xc0,xc1);
        break;
    case 3:
        Exp->GetCoords(xc0,xc1,xc2);
        break;
    }
    //----------------------------------------------

    //----------------------------------------------
    // Define forcing function for first variable defined in file
    fce = Array<OneD,NekDouble>(nq);
    LibUtilities::EquationSharedPtr ffunc
                                    = vSession->GetFunction("Forcing", 0);

    ffunc->Evaluate(xc0, xc1, xc2, fce);

    //----------------------------------------------

    //----------------------------------------------
    // Setup expansion containing the  forcing function
    Fce = MemoryManager<MultiRegions::DisContField2D>::AllocateSharedPtr(*Exp);
    Fce->SetPhys(fce);
    //----------------------------------------------
    Timing("Define forcing ..");

    //----------------------------------------------
    // Helmholtz solution taking physical forcing
    Exp->HelmSolve(Fce->GetPhys(), Exp->UpdateCoeffs(), NullFlagList, factors);
    //----------------------------------------------

    Timing("Helmholtz Solve ..");

    //-----------------------------------------------
    // Backward Transform Solution to get solved values at
    Exp->BwdTrans(Exp->GetCoeffs(), Exp->UpdatePhys());
    //-----------------------------------------------
    Timing("Backward Transform ..");

    //-----------------------------------------------
    // Write solution to file
    //string out = vSession->GetSessionName() + ".fld";
    //std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
    //    = Exp->GetFieldDefinitions();
    //std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());

    //for(i = 0; i < FieldDef.size(); ++i)
    //{
    //    FieldDef[i]->m_fields.push_back("u");
    //    Exp->AppendFieldData(FieldDef[i], FieldData[i]);
    //}
    //LibUtilities::Write(out, FieldDef, FieldData);
    //--------------------------------------------
    //-----------------------------------------------
    // See if there is an exact solution, if so
    // evaluate and plot errors
    LibUtilities::EquationSharedPtr ex_sol =
        vSession->GetFunction("ExactSolution", 0);

	//----------------------------------------------
	// evaluate exact solution
	ex_sol->Evaluate(xc0, xc1, xc2, fce);

	//----------------------------------------------

	//Triangles
	const LibUtilities::PointsKey PkeyT1(num_points+1,LibUtilities::eGaussLobattoLegendre);
	const LibUtilities::PointsKey PkeyT2(num_points,LibUtilities::eGaussRadauMAlpha1Beta0);//need to doublecheck this one
	LibUtilities::BasisKeyVector  BkeyT;
	BkeyT.push_back(LibUtilities::BasisKey(LibUtilities::eModified_A, num_modes+1, PkeyT1));
	BkeyT.push_back(LibUtilities::BasisKey(LibUtilities::eModified_B, num_modes+1, PkeyT2));
	//Quadrilaterals
	const LibUtilities::PointsKey PkeyQ(num_points+1,LibUtilities::eGaussLobattoLegendre);
	LibUtilities::BasisKeyVector  BkeyQ;
	BkeyQ.push_back(LibUtilities::BasisKey(LibUtilities::eModified_A, num_modes+1, PkeyQ));
	BkeyQ.push_back(LibUtilities::BasisKey(LibUtilities::eModified_A, num_modes+1, PkeyQ));

	graph2D->SetBasisKey(LibUtilities::eTriangle, BkeyT);
	graph2D->SetBasisKey(LibUtilities::eQuadrilateral, BkeyQ);

	MultiRegions::DisContField2DSharedPtr PostProc =
		MemoryManager<MultiRegions::DisContField2D>::AllocateSharedPtr(vSession,graph2D,vSession->GetVariable(0));

	int ErrorCoordim = PostProc->GetCoordim(0);
	int ErrorNq      = PostProc->GetTotPoints();

	Array<OneD,NekDouble> ErrorXc0(ErrorNq,0.0);
	Array<OneD,NekDouble> ErrorXc1(ErrorNq,0.0);
	Array<OneD,NekDouble> ErrorXc2(ErrorNq,0.0);

	switch(ErrorCoordim)
	{
		case 1:
			PostProc->GetCoords(ErrorXc0);
			break;
		case 2:
			PostProc->GetCoords(ErrorXc0,ErrorXc1);
			break;
		case 3:
			PostProc->GetCoords(ErrorXc0,ErrorXc1,ErrorXc2);
			break;
	}

	// evaluate exact solution
	Array<OneD,NekDouble> ppSol(ErrorNq);
	ex_sol->Evaluate(ErrorXc0,ErrorXc1,ErrorXc2,ppSol);

	// calcualte spectral/hp approximation on the quad points of this new
	// expansion basis
	std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
		= Exp->GetFieldDefinitions();
	std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
	std::string fieldstr = "u";

	for(i = 0; i < FieldDef.size(); ++i)
	{
		FieldDef[i]->m_fields.push_back(fieldstr);
		Exp->AppendFieldData(FieldDef[i], FieldData[i]);
		PostProc->ExtractDataToCoeffs(FieldDef[i],FieldData[i],fieldstr,PostProc->UpdateCoeffs());
	}

	// Interpolation of trace
	std::vector<LibUtilities::FieldDefinitionsSharedPtr> TraceDef
		= Exp->GetTrace()->GetFieldDefinitions();
	std::vector<std::vector<NekDouble> > TraceData(FieldDef.size());
	for(i = 0; i < TraceDef.size(); ++i)
	{
		TraceDef[i]->m_fields.push_back(fieldstr);
		Exp->GetTrace()->AppendFieldData(TraceDef[i], TraceData[i]);
		PostProc->GetTrace()->ExtractDataToCoeffs(TraceDef[i],TraceData[i],fieldstr,PostProc->GetTrace()->UpdateCoeffs());
	}

	PostProc->BwdTrans_IterPerExp(PostProc->GetCoeffs(),PostProc->UpdatePhys());

	PostProc->EvaluateHDGPostProcessing(PostProc->UpdateCoeffs());
	PostProc->BwdTrans_IterPerExp(PostProc->GetCoeffs(),PostProc->UpdatePhys());

	NekDouble vLinfError = Exp->Linf(fce);
	NekDouble vL2Error   = Exp->L2  (fce);
	NekDouble L2ErrorPostProc = PostProc->L2(ppSol);
	NekDouble LinfErrorPostProc = PostProc->Linf(ppSol);

	if (vSession->GetComm()->GetRank() == 0)
	{
		cout << "L infinity error : " << vLinfError << endl;
		cout << "L 2 error        : " << vL2Error   << endl;
		cout << "Postprocessed L infinity error : " << LinfErrorPostProc << endl;
		cout << "Postprocessed L 2 error        : " << L2ErrorPostProc   << endl;
	}

	vSession->Finalise();

    return 0;
}


text:
package com.watchtime.base.providers.media.models;

/**
 * Created by João Paulo on 24/01/2017.
 */

public class Genre {
    private String mKey;
    private int mLabel;

    public Genre(String key, int label) {
        mKey = key;
        mLabel = label;
    }

    public String getKey() {
        return mKey;
    }

    public int getLabelId() {
        return mLabel;
    }
}


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

package com.google.gerrit.server.schema;

import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gwtorm.jdbc.JdbcSchema;
import com.google.gwtorm.schema.sql.SqlDialect;
import com.google.gwtorm.server.OrmException;
import com.google.gwtorm.server.StatementExecutor;
import com.google.inject.Inject;
import com.google.inject.Provider;
import java.sql.SQLException;

/** Create account_external_ids_byEmail index. */
public class Schema_145 extends SchemaVersion {

  @Inject
  Schema_145(Provider<Schema_144> prior) {
    super(prior);
  }

  @Override
  protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException {
    JdbcSchema schema = (JdbcSchema) db;
    SqlDialect dialect = schema.getDialect();
    try (StatementExecutor e = newExecutor(db)) {
      try {
        dialect.dropIndex(e, "account_external_ids", "account_external_ids_byEmail");
      } catch (OrmException ex) {
        // Ignore.  The index did not exist.
      }
      e.execute(
          "CREATE INDEX account_external_ids_byEmail"
              + " ON account_external_ids"
              + " (email_address)");
    }
  }
}


text:
//
//  WAAppRouteRegistrar.h
//  WAAppRouter
//
//  Created by Marian Paul on 18/08/2015.
//  Copyright (c) 2015 Wasappli. All rights reserved.
//

@import Foundation;
#import "WAAppRouterMatcherProtocol.h"

@class WAAppRouteEntity, WAAppLink;

typedef void (^WAAppRouteHandlerBlock)(WAAppLink *appLink);

/**
 @brief This class intention is to register both `WAAppRouteEntity` objects or blocks matching a path
 */
@interface WAAppRouteRegistrar : NSObject

/**
 *  Initialize the registrar with a route matcher
 *
 *  @param routeMatcher the route matcher you wish to use to match urls against patterns
 *
 *  @return a fresh registrar
 */
- (instancetype)initWithRouteMatcher:(id <WAAppRouteMatcherProtocol>)routeMatcher NS_DESIGNATED_INITIALIZER;

/**
 *  @see `initWithRouteMatcher:`
 */
+ (instancetype)registrarWithRouteMatcher:(id <WAAppRouteMatcherProtocol>)routeMatcher;

/**
 *  Register a new route entity
 *
 *  @param entity the entity to register
 */
- (void)registerAppRouteEntity:(WAAppRouteEntity *)entity;

/**
 *  Register a block handler
 *
 *  @param routeBlockHandler the block handler
 *  @param route             the route you want the block to triggers on call
 */
- (void)registerBlockRouteHandler:(WAAppRouteHandlerBlock)routeBlockHandler forRoute:(NSString *)route;

/**
 *  Retrieve an entity from a route URL
 *
 *  @param url the URL you received in input
 *
 *  @return the corresponding entity
 */
- (WAAppRouteEntity *)entityForURL:(NSURL *)url;

/**
 *  Get the block handler for a URL
 *
 *  @param url the URL you received in input
 *
 *  @return the block to execute
 */
- (WAAppRouteHandlerBlock)blockHandlerForURL:(NSURL *)url;

/**
 *  Retrieve an entity from a class you want to display
 *
 *  @param targetClass the class you want to display
 *
 *  @return the corresponding entity
 */
- (WAAppRouteEntity *)entityForTargetClass:(Class)targetClass;

@property (nonatomic, strong, readonly) id <WAAppRouteMatcherProtocol>routeMatcher;

@end


text:
function dUpsilon = lfmvpGradientUpsilonMatrix(gamma, sigma2, t1, ...
    t2, mode, upsilon)

% LFMVPGRADIENTUPSILONMATRIX Gradient upsilon matrix vel. pos.
%
%	Description:
%
%	UPSILON = LFMVPGRADIENTUPSILONMATRIX(GAMMA, SIGMA2, T1, T2, UPSILON,
%	MODE) computes the gradient of a portion of the LFM kernel.
%	 Returns:
%	  UPSILON - result of this subcomponent of the kernel for the given
%	   values.
%	 Arguments:
%	  GAMMA - Gamma value for system.
%	  SIGMA2 - length scale of latent process.
%	  T1 - first time input (number of time points x 1).
%	  T2 - second time input (number of time points x 1).
%	  UPSILON - precomputation of the upsilon matrix.
%	  MODE - operation mode, according to the derivative (mode 0,
%	   derivative wrt t1, mode 1 derivative wrt t2)
%
%
%	See also
%	LFMVPCOMPUTEUPSILONMATRIX.M

%	Copyright (c) 2010 Mauricio A. Alvarez

sigma = sqrt(sigma2);

if nargin<6
    upsilon = lfmComputeUpsilonMatrix(gamma, sigma2, t1, t2);
    if nargin <5
        mode =0;
    end
end

if mode ==0
    dUpsilon = -upsilon - gamma*lfmGradientUpsilonMatrix(gamma, sigma2, t1, t2);
else
    dUpsilon = upsilon + gamma*lfmGradientUpsilonMatrix(gamma, sigma2, t1, t2) ...
        - (2/(sqrt(pi)*sigma))*(t1.*exp(-gamma*t1))*(exp(-(t2.^2)/sigma2)).';
end


text:
DoubleSpreadsheetCell::DoubleSpreadsheetCell()
    : mValue(std::numeric_limits<double>::quiet_NaN())
{
}

void DoubleSpreadsheetCell::set(double inDouble) {
    mValue = inDouble;
}

void DoubleSpreadsheetCell::set(const std::string& inString) {
    mValue = DoubleSpreadsheetCell::stringToDouble(inString);
}

std::string DoubleSpreadsheetCell::getString() const {
    return DoubleSpreadsheetCell::doubleToString(mValue);
}

std::string DoubleSpreadsheetCell::doubleToString(double inValue) {
    std::ostringstream outputStringStream;
    outputStringStream << inValue;
    return outputStringStream.str();
}

double DoubleSpreadsheetCell::stringToDouble(const std::string& inValue) {
    double temp;
    std::istringstream inputStringStream(inValue);
    inputStringStream >> temp;
    if (inputStringStream.fail() || !inputStringStream.eof()) {
        return 0;
    }
    return temp;
}


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

"""
This script copies all of the .symcache files referenced by the specified
ETW trace to a specified directory so that they can easily be shared with
other people. The package export option in WPA (File-> Export Package) makes
this functionality mostly obsolete (Export Package puts the .symcache files in
a .wpapk file along with the trace and the current profile) but this script is
retained because it does give additional flexibility and serves as an example.
"""

import os
import re
import shutil
import sys
import csv
import subprocess

# This regular expression takes apart the CodeView Record block.
pdb_re = re.compile(r'\[RSDS\] PdbSig: {(.*-.*-.*-.*-.*)}; Age: (.*); Pdb: (.*)')

def ParseRow(row):
  """Take a CSV row record from an xperf -i -a symcache command and parse it.
  The cvRecord is broken up into its constituent guid, age, and PDBPath
  parts and the integer components are turned into integers (stripping 0x
  headers in the process). The "-" characters in the guid are removed.
  If the record contains the file header that labels the columns then None
  is returned.
  """
  TimeDateStamp, ImageSize, OrigFileName, cvRecord = row
  if TimeDateStamp == "TimeDateStamp":
    # Ignore the column labels
    return None
  TimeDateStamp = int(TimeDateStamp, 0)
  ImageSize = int(ImageSize, 0)
  # Assume that this re match will always succeed.
  result = pdb_re.match(cvRecord)
  guid, age, PDBPath = result.groups()
  guid = guid.replace("-", "")
  age = int(age) # Note that the age is in decimal here
  return TimeDateStamp, ImageSize, OrigFileName, guid, age, PDBPath

def main():

  if len(sys.argv) < 3:
    print("Syntax: PackETWSymbols ETWFilename.etl destdirname [-verbose]")
    print("This script looks for symbols needed to decode the specified trace, and")
    print("copies them to the specified directory. This allows moving traces to")
    print("other machines for analysis and sharing.")
    sys.exit(0)

  ETLName = sys.argv[1]
  DestDirName = sys.argv[2]
  if not os.path.exists(DestDirName):
    os.mkdir(DestDirName)

  verbose = False
  if len(sys.argv) > 3 and sys.argv[3].lower() == "-verbose":
    verbose = True

  print("Extracting symbols from ETL file '%s'." % ETLName)

  # -tle = tolerate lost events
  # -tti = tolerate time ivnersions
  # -a symcache = show image and symbol identification (see xperf -help processing)
  #  Options to the symcache option (see xperf -help symcache)
  #  -quiet = don't issue warnings
  #  -build = build the symcache, including downloading symbols
  #  -imageid = show module size/data/name information
  #  -dbgid = show PDB guid/age/name information
  command = "xperf.exe -i \"%s\" -tle -tti -a symcache -quiet -imageid -dbgid" % ETLName
  # The -symbols option can be added in front of -a if symbol loading from
  # symbol servers is desired.

  # Typical output lines (including the heading) look like this:
  #TimeDateStamp,  ImageSize, OrigFileName, CodeView Record
  #   0x4da89d03, 0x00bcb000, "client.dll", "[RSDS] PdbSig: {7b2a9028-87cd-448d-8500-1a18cdcf6166}; Age: 753; Pdb: u:\buildbot\dota_staging_win32\build\src\game\client\Release_dota\client.pdb"

  print("Executing command '%s'" % command)
  lines = str(subprocess.check_output(command)).splitlines()

  matchCount = 0
  matchExists = 0
  interestingModuleCount = 0

  symCachePathBase = os.getenv("_NT_SYMCACHE_PATH");
  if symCachePathBase == None or len(symCachePathBase) == 0:
    # Set SymCache to the C drive if not specified.
    symCachePathBase = "c:\\symcache\\"
    print("_NT_SYMCACHE_PATH not set. Looking for symcache in %s" % symCachePathBase)

  for row in csv.reader(lines, delimiter = ",", quotechar = '"', skipinitialspace=True):
    results = ParseRow(row)
    if not results:
      continue
    TimeDateStamp, ImageSize, OrigFileName, guid, age, PDBPath = results
    matchCount += 1

    # Find out which PDBs are 'interesting'. There is no obvious heuristic
    # for this, so for now all symbols whose PDB path name contains a colon
    # are counted, which filters out many Microsoft symbols. The ideal filter
    # would return all locally built symbols - all that cannot be found on
    # symbol servers - and this gets us partway there.
    interesting = PDBPath.count(":") > 0
    if interesting:
      interestingModuleCount += 1
      # WPT has two different .symcache file patterns. Neither is documented but
      # both occur in the symcache directory.
      symCachePathv1 = "%s-%08x%08xv1.symcache" % (OrigFileName, TimeDateStamp, ImageSize)
      symCachePathv2 = "%s-%s%xv2.symcache" % (OrigFileName, guid, age)
      symCachePathv1 = os.path.join(symCachePathBase, symCachePathv1)
      symCachePathv2 = os.path.join(symCachePathBase, symCachePathv2)
      foundPath = None
      if os.path.isfile(symCachePathv1):
        foundPath = symCachePathv1
      elif os.path.isfile(symCachePathv2):
        foundPath = symCachePathv2

      if foundPath:
        matchExists += 1
        print("Copying %s" % foundPath)
        shutil.copyfile(foundPath, os.path.join(DestDirName, os.path.split(foundPath)[1]))
      else:
        if verbose:
          print("Symbols for '%s' are not in %s or %s" % (OrigFileName, symCachePathv1, symCachePathv2))
    else:
      #This is normally too verbose
      if verbose:
        print("Skipping %s" % PDBPath)

  if matchCount == interestingModuleCount:
    print("%d symbol files found in the trace and %d of those exist in symcache." % (matchCount, matchExists))
  else:
    print("%d symbol files found in the trace, %d appear to be interesting, and %d of those exist in symcache." % (matchCount, interestingModuleCount, matchExists))
  if matchExists > 0:
    print("Symbol files found were copied to %s" % DestDirName)

if __name__ == "__main__":
  main()


text:
// +build integration

package tests

import (
	"github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/common"
	"github.com/stretchr/testify/assert"
	"os"
	"testing"
)

var wskprops = common.GetWskprops()

// TODO: write the integration against openwhisk
func TestTriggerRule(t *testing.T) {
	wskdeploy := common.NewWskdeploy()
	_, err := wskdeploy.Deploy(manifestPath, deploymentPath)
	assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
	_, err = wskdeploy.Undeploy(manifestPath, deploymentPath)
	assert.Equal(t, nil, err, "Failed to undeploy based on the manifest and deployment files.")
}

var (
	manifestPath   = os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/triggerrule/manifest.yml"
	deploymentPath = os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/triggerrule/deployment.yml"
)


text:
;(function($) {

$('.nav_menu_logged_in_out_field').each(function(i){

	var $field = $(this);

	var id = $field.find('input.nav-menu-id').val();

	// if set to display by role (aka is null) then show the roles list, otherwise hide
	if( $field.find('input.nav-menu-logged-in-out:checked').val() === '' ){
		$field.next('.nav_menu_role_field').show();
	} else {
		$field.next('.nav_menu_role_field').hide();
	}
});

// on in/out/role change, hide/show the roles
$('#menu-to-edit').on('change', 'input.nav-menu-logged-in-out', function() {
	if( $(this).val() === '' ){
		$(this).parentsUntil('.nav_menu_logged_in_out').next('.nav_menu_role_field').slideDown();
	} else {
		$(this).parentsUntil('.nav_menu_logged_in_out').next('.nav_menu_role_field').slideUp();
	}
});

})(jQuery);


text:
/**
 * AMONIS: 16/02/2017: Forum gulp file to compress html / js
 * npm install gulp-cli -g
 * npm install gulp -D
 * npm install gulp-uglify
 * npm install gulp-uglifycss
 * usage: gulp
 */
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var htmlmin = require('gulp-htmlmin');
var uglifycss = require('gulp-uglifycss');

/*
 * ###minifyJs
 * Accepts all the files in /src, uglifies and then merges into single output
 */
gulp.task('concatJs', function (cb) {

    return gulp.src( [
        'src/docifier.js'
    ] )
        .pipe( concat('docifier.min.js') )
        .pipe( gulp.dest('.') );
});

gulp.task('minifyJs', [ 'concatJs' ], function (cb) {
    return gulp.src( 'docifier.min.js' )
        .pipe( uglify() )
        .pipe( gulp.dest('.') );
});

/**
 * ###minifyCss
 * Accepts all CSS and merges into a single file
 */
gulp.task('minifyCss', function () {
  gulp.src('./src/*.css')
    // .pipe( uglifycss( { "maxLineLen":80, "uglyComments":true } ) )
    .pipe( concat('docifier.min.css') )
    .pipe( gulp.dest( '.' ) );
});

gulp.task( 'watch', function(){
    gulp.watch( './src/**/*.*', [ 'concatJs', 'minifyCss' ] );
});

gulp.task( 'default', [ 'concatJs', 'minifyCss' ] );


text:
namespace storage::distributor {

struct VisitorOrder {

    VisitorOrder() { }

    bool operator()(const document::BucketId& a, const document::BucketId& b) {
        if (a == document::BucketId(INT_MAX) ||
            b == document::BucketId(0, 0)) {
            return false; // All before max, non before null
        }
        if (a == document::BucketId(0, 0) ||
            b == document::BucketId(INT_MAX)) {
            return true; // All after null, non after max
        }
        return (a.toKey() < b.toKey()); // Reversed bucket id order
    }
};

}


text:
<!DOCTYPE html >

    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />

    <title>Pie chart Explode</title>

    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A Pie chart that explodes when a segment is clicked" />

Pie chart explode (onclick)

        This Pie chart is similar to the "explode onmousemove demo. But instead of
        using the onmousemove event this uses the onclick event. As a result of using
        the click event instead of the mousemove event you will see far fewer
        peculiarities.

    <canvas id="cvs" width="450" height="300">[No canvas support]</canvas>

    This goes in the documents header:

<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.dynamic.js"></script>
<script src="RGraph.common.tooltips.js"></script>
<script src="RGraph.common.effects.js"></script>
<script src="RGraph.pie.js"></script>

    Put this where you want the chart to show up:

<canvas id="cvs" width="450" height="300">
    [No canvas support]
</canvas>

    This is the code that generates the chart:

<script>
    window.onload = function ()
    {
        // Create the Pie chart
        var pie = new RGraph.Pie({
            id: 'cvs',
            data: [4,6,3,5,2,5,8],
            options: {
                labels: ['Monday', 'Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
                textColor: '#aaa',
                exploded: 5,
                radius: 100,
                linewidth: 1
            }
        }).on('click', function (e, shape)
        {
            if (!pie.get('exploded') || !pie.get('exploded')[shape['index']]) {
                pie.explodeSegment(shape['index'], 25);
            }

            e.stopPropagation();
        }).on('mousemove', function (e, shape)
        {
            e.target.style.cursor = 'pointer';
        }).draw()

        // Add the window click listener that resets the Pie chart
        window.onmousedown = function (e)
        {
            pie.set('exploded', 5);
            RGraph.redraw();
        }
    };
</script>

        « Back


text:
package org.kie.uberfire.metadata.engine;

import org.uberfire.java.nio.file.Path;
import org.kie.uberfire.metadata.model.KObject;
import org.kie.uberfire.metadata.model.KObjectKey;

public interface Indexer {

    /**
     * Different Indexers can handle different file-types
     * @param path
     * @return
     */
    boolean supportsPath( final Path path );

    /**
     * Index file represented by Path into an index object
     * @param path
     * @return
     */
    KObject toKObject( final Path path );

    /**
     * Index file represented by Path into an index key object
     * @param path
     * @return
     */
    KObjectKey toKObjectKey( final Path path );

}


text:
#include "PEMutator.h"

#include <fstream>
#include <cassert>
#include <algorithm>

namespace mut
{

PEMutator::PEMutator( MutationImpl* pImpl )
    : _mutator( pImpl )
{
}

PEMutator::~PEMutator()
{
}

/// <summary>
/// Mutate executable
/// </summary>
/// <param name="filePath">Executable path</param>
/// <param name="newPath">Output file</param>
/// <returns>Output file path</returns>
std::string PEMutator::Mutate( const std::string& filePath, std::string newPath /*= "" */ )
{
    std::ifstream file( filePath, std::ios::binary | std::ios::in );
    _image.reset( new pe_bliss::pe_base( pe_bliss::pe_factory::create_pe( file ) ) );

    size_t ep = _image->get_ep();
    bool hasEP = (ep != 0);
    if (!hasEP)
    {
        for (auto& sec : _image->get_image_sections())
        {
            // Filter data sections
            if (sec.get_characteristics() & (pe_bliss::pe_win::image_scn_mem_execute))
            {
                ep = sec.get_virtual_address();
                break;
            }
        }
    }

    auto& secRef = _image->section_from_rva( ep );
    auto oldText = secRef;
    auto newText = secRef;
    pe_bliss::section relocSec;
    std::list<FuncData> funcs;

    auto ep_rva = hasEP ? ep - oldText.get_virtual_address() : -1;
    uint8_t* obuf = nullptr;

    GetKnownFunctions( oldText, funcs );

    // Strip relocations section if required
    if (_image->has_reloc())
    {
        auto& relSec = _image->section_from_directory( pe_bliss::pe_win::image_directory_entry_basereloc );
        relocSec = relSec;
        _image->strip_section( relSec );
    }

    auto& lastSec = _image->get_image_sections().back();

    // Set new section VA
    newText.set_virtual_address( lastSec.get_virtual_address() +
                                 pe_bliss::pe_utils::align_up( lastSec.get_virtual_size(), _image->get_section_alignment() ) );

    // Mutate code section
    auto delta = newText.get_virtual_address() - secRef.get_virtual_address();
    auto sz = _mutator.Mutate( (uint8_t*)secRef.get_raw_data().c_str(),
                               secRef.get_raw_data().length(),
                               ep_rva, delta, funcs,
                               _image->get_image_base_32() + oldText.get_virtual_address(),
                               obuf );

    newText.set_raw_data( std::string( obuf, obuf + sz ) );
    secRef.set_name( ".pdata" );

    _image->add_section( newText );

    // Restore reloc section
    if (_image->has_reloc())
    {
        auto& lastSec = _image->get_image_sections().back();
        relocSec.set_virtual_address( lastSec.get_virtual_address() +
                                     pe_bliss::pe_utils::align_up( lastSec.get_virtual_size(), _image->get_section_alignment() ) );

        _image->add_section( relocSec );
        _image->set_directory_rva( pe_bliss::pe_win::image_directory_entry_basereloc, relocSec.get_virtual_address() );
    }

    _image->set_base_of_code( newText.get_virtual_address() );

    if (hasEP)
        _image->set_ep( ep_rva + oldText.get_virtual_address() + delta );

    // Perform PE fixups
    FixKnownFunctions( oldText, newText, funcs );
    FixSafeSEH( oldText, newText );
    FixExport( oldText, newText );
    FixRelocs( oldText, newText );

    // Build new name
    if (newPath.empty())
    {
        auto pt = filePath.rfind( '.' );
        if (pt != filePath.npos)
        {
            auto ext = filePath.substr( pt + 1 );
            auto name = filePath.substr( 0, pt );
            newPath = name + "_Mutated." + ext;
        }
        else
        {
            newPath = filePath + "_Mutated";
        }
    }

    // Write new file
    std::ofstream new_file( newPath, std::ios::binary );
    if (!new_file.is_open())
        throw std::runtime_error( "Couldn't create output file: " + newPath );

    pe_bliss::rebuild_pe( *_image, new_file );

    return newPath;
}

/// <summary>
/// Try to find functions from known pointers and data sections
/// </summary>
/// <param name="oldText">original code section</param>
/// <param name="funcs">Found functions</param>
/// <returns>Function count</returns>
size_t PEMutator::GetKnownFunctions( const pe_bliss::section& oldText, std::list<FuncData>& funcs )
{
    uint32_t textStart = oldText.get_virtual_address() + _image->get_image_base_32();
    uint32_t textEnd = textStart + oldText.get_virtual_size();

    // Parse export
    if (_image->has_exports())
        ParseExport( oldText, funcs );

    // Parse TLS
    if (_image->has_tls())
        ParseTls( oldText, funcs );

    // Parse SAFESEH
    if (_image->has_config())
        ParseSAFESEH( oldText, funcs );

    // Use relocations to get code pointers
    if (_image->has_reloc())
        ParseRelocs( oldText, textStart, textEnd, funcs );
    // Brute-force approach
    else
        ParseRawSections( textStart, textEnd, funcs );

    return funcs.size();
}

/// <summary>
/// Get functions form export directory
/// </summary>
/// <param name="oldText">Original code section</param>
/// <param name="funcs">Found functions</param>
void PEMutator::ParseExport( const pe_bliss::section &oldText, std::list<FuncData> &funcs )
{
    pe_bliss::export_info info;
    auto exports = pe_bliss::get_exported_functions( *_image, info );
    auto& expSec = _image->section_from_directory( pe_bliss::pe_win::image_directory_entry_export );

    for (auto& exp : exports)
    {
        if (exp.is_forwarded())
            continue;

        // Function inside old .text section
        if (exp.get_rva() >= oldText.get_virtual_address() &&
             exp.get_rva() <= oldText.get_virtual_address() + oldText.get_virtual_size())
        {
            auto rva = exp.get_rva() - oldText.get_virtual_address();
            funcs.emplace_back( FuncData( expSec.get_virtual_address(), 0xFFFFFFFF, rva ) );
        }
    }
}

/// <summary>
/// Get functions form TLS callbacks table
/// </summary>
/// <param name="oldText">Original code section</param>
/// <param name="funcs">Found functions</param>
void PEMutator::ParseTls( const pe_bliss::section &oldText, std::list<FuncData> &funcs )
{
    auto tls = pe_bliss::get_tls_info( *_image );

    if (tls.get_callbacks_rva() != 0)
    {
        auto& tlsSec = _image->section_from_rva( tls.get_callbacks_rva() );
        auto pSectionData = _image->section_data_from_rva( tls.get_callbacks_rva() );

        for (uint32_t* pCallback = (uint32_t*)pSectionData; *pCallback; pCallback++)
        {
            auto ptr = *pCallback - _image->get_image_base_32();

            // Callback belongs to old .text section
            if (ptr >= oldText.get_virtual_address() &&
                 ptr <= oldText.get_virtual_address() + oldText.get_virtual_size())
            {
                auto rva = (const char*)pCallback - tlsSec.get_raw_data().c_str();
                funcs.emplace_back( FuncData( tlsSec.get_virtual_address(), rva, ptr - oldText.get_virtual_address() ) );
            }
        }
    }
}

/// <summary>
/// Get functions form SAFESEH table
/// </summary>
/// <param name="oldText">Original code section</param>
/// <param name="funcs">Found functions</param>
void PEMutator::ParseSAFESEH( const pe_bliss::section &oldText, std::list<FuncData> &funcs )
{
    auto& cfgSec = _image->section_from_directory( pe_bliss::pe_win::image_directory_entry_load_config );
    auto cfg = pe_bliss::get_image_config( *_image );
    auto& handlers = cfg.get_se_handler_rvas();

    for (size_t i = 0; i < handlers.size(); i++)
    {
        // Handler inside old section
        if (handlers[i] >= oldText.get_virtual_address() &&
             handlers[i] <= oldText.get_virtual_address() + oldText.get_virtual_size())
        {
            auto rva = handlers[i] - oldText.get_virtual_address();

            // Exclude functions from generic fix
            funcs.emplace_back( FuncData( cfgSec.get_virtual_address(), 0xFFFFFFFF, rva ) );
        }
    }
}

/// <summary>
/// Get functions form relocations
/// </summary>
/// <param name="oldText">Original code section</param>
/// <param name="textStart">Text section RVA + ImageBase</param>
/// <param name="textEnd">textStart + text section size</param>
/// <param name="funcs">Found functions</param>
void PEMutator::ParseRelocs( const pe_bliss::section &oldText,
                             uint32_t textStart,
                             uint32_t textEnd,
                             std::list<FuncData> &funcs )
{
    auto relocs = pe_bliss::get_relocations( *_image );

    for (auto& relBlock : relocs)
    {
        // Exclude code section relocations
        if (relBlock.get_rva() >= oldText.get_virtual_address() &&
             relBlock.get_rva() < oldText.get_virtual_address() + oldText.get_virtual_size())
             continue;

        auto& sec = _image->section_from_rva( relBlock.get_rva() );
        auto pData = (uint8_t*)sec.get_raw_data().data();
        auto baseRVA = relBlock.get_rva() - sec.get_virtual_address();

        for (auto& rel : relBlock.get_relocations())
        {
            auto rva = baseRVA + rel.get_rva();
            if ((rva % 4))
                continue;

            auto ptr = (uint32_t*)(pData + rva);

            // Pointer belongs to code section
            if (*ptr >= textStart &&  *ptr < textEnd)
                funcs.emplace_back( FuncData( sec.get_virtual_address(), rva, *ptr - textStart ) );
        }
    }
}

/// <summary>
/// Get functions from section data
/// </summary>
/// <param name="textStart">Text section RVA + ImageBase</param>
/// <param name="textEnd">textStart + text section size</param>
/// <param name="funcs">Found functions</param>
void PEMutator::ParseRawSections( uint32_t textStart, uint32_t textEnd, std::list<FuncData> &funcs )
{
    // Prepare exclusion regions
    std::list<std::pair<uint32_t, uint32_t>> rgns;
    for (auto i = pe_bliss::pe_win::image_directory_entry_export; i <= pe_bliss::pe_win::image_directory_entry_com_descriptor; i++)
    {
        auto base = _image->get_directory_rva( i );
        auto size = _image->get_directory_size( i );

        if (base != 0 && size != 0)
            rgns.push_back( std::make_pair( base, base + size ) );
    }

    for (auto& sec : _image->get_image_sections())
    {
        // Filter data sections
        if (sec.get_characteristics() & (pe_bliss::pe_win::image_scn_cnt_initialized_data | pe_bliss::pe_win::image_scn_cnt_uninitialized_data))
        {
            uint32_t* start = (uint32_t*)sec.get_raw_data().c_str();
            uint32_t* end = (uint32_t*)(sec.get_raw_data().c_str() + sec.get_raw_data().length());

            for (uint32_t* ptr = start; ptr < end - 1; ptr++)
            {
                // Exclude some PE metadata regions
                auto rva = sec.get_virtual_address() + (ptr - start) * sizeof(uint32_t);
                auto iter = std::find_if( rgns.begin(), rgns.end(),
                                          [rva]( const std::pair<uint32_t, uint32_t>& val ) { return (rva >= val.first && rva < val.second); } );

                if (iter == rgns.end() && *ptr >= textStart && *ptr < textEnd)
                    funcs.emplace_back( FuncData( sec.get_virtual_address(), (ptr - start) * sizeof(uint32_t), *ptr - textStart ) );
            }
        }
    }
}

/// <summary>
/// Fix function returned by GetKnownFunctions
/// </summary>
/// <param name="oldText">Original .text section</param>
/// <param name="newText">New .text section</param>
/// <param name="funcs">Function list</param>
void PEMutator::FixKnownFunctions( const pe_bliss::section& /*oldText*/,
                                   const pe_bliss::section& newText,
                                   const std::list<FuncData>& funcs )
{
    for (auto& func : funcs)
    {
        // Skip function
        if (func.rva == -1)
            continue;

        auto& sec = _image->section_from_rva( func.section_rva );
        auto pData = _mutator.GetIdataByRVA( func.ptr );
        if (pData)
            *(uint32_t*)(sec.get_raw_data().c_str() + func.rva) = _image->get_image_base_32() + newText.get_virtual_address() + pData->new_rva;
    }
}

/// <summary>
/// Fix relocations
/// </summary>
/// <param name="oldText">Original .text section</param>
/// <param name="newText">New .text section</param>
void PEMutator::FixRelocs( const pe_bliss::section& oldText, const pe_bliss::section& newText )
{
    // No relocations
    if (!_image->has_reloc())
        return;

    auto relocs = pe_bliss::get_relocations( *_image );
    std::vector<std::pair<uint32_t, uint16_t>> tmpRelocs;

    for (size_t i = 0; i < relocs.size(); )
    {
        // Collect information about new relocation addresses
        if (relocs[i].get_rva() >= oldText.get_virtual_address() &&
             relocs[i].get_rva() < oldText.get_virtual_address() + oldText.get_virtual_size())
        {
            auto recBaseRVA = relocs[i].get_rva() - oldText.get_virtual_address();

            for (auto& rel : relocs[i].get_relocations())
            {
                auto pData = _mutator.GetIdataByRVA( rel.get_rva() + recBaseRVA );
                if (pData)
                    tmpRelocs.push_back( std::make_pair( rel.get_rva() - (pData->old_rva - recBaseRVA) + pData->new_rva, rel.get_type() ) );
               /* else
                    assert( false && "Invalid relocation RVA" );*/
            }

            relocs.erase( relocs.begin() + i );
        }
        else
            i++;
    }

    // Add jump tables
    for (auto& entry : _mutator.dataList())
        tmpRelocs.push_back( std::make_pair( entry.second.new_rva, pe_bliss::pe_win::image_rel_based_highlow ) );

    std::sort( tmpRelocs.begin(), tmpRelocs.end() );

    // Make new relocation table
    for (auto& rel : tmpRelocs)
    {
        auto page = rel.first >> 12;
        if (relocs.empty() || relocs.back().get_rva() != newText.get_virtual_address() + (page << 12))
        {
            relocs.push_back( pe_bliss::relocation_table() );
            relocs.back().set_rva( newText.get_virtual_address() + (page << 12) );
        }

        relocs.back().add_relocation( pe_bliss::relocation_entry( rel.first & 0xFFF, rel.second ) );
    }

    pe_bliss::rebuild_relocations( *_image, relocs,
                                   _image->get_image_sections().back()/*,
                                   0, true, false*/ );
}

/// <summary>
/// Fix export section
/// </summary>
/// <param name="oldText">Original .text section</param>
/// <param name="newText">New .text section</param>
void PEMutator::FixExport( const pe_bliss::section& oldText, const pe_bliss::section& newText )
{
    // No exports
    if (!_image->has_exports())
        return;

    pe_bliss::export_info info;
    auto exports = pe_bliss::get_exported_functions( *_image, info );
    auto ofst = _image->get_directory_rva( pe_bliss::pe_win::image_directory_entry_export )
              - _image->section_from_directory( pe_bliss::pe_win::image_directory_entry_export ).get_virtual_address();

    for (auto& exp : exports)
    {
        if (exp.is_forwarded())
            continue;

        // Function inside old .text section
        if (exp.get_rva() >= oldText.get_virtual_address() &&
             exp.get_rva() <= oldText.get_virtual_address() + oldText.get_virtual_size())
        {
            auto rva = exp.get_rva() - oldText.get_virtual_address();
            auto pData = _mutator.GetIdataByRVA( rva );
            if (pData)
                exp.set_rva( pData->new_rva + newText.get_virtual_address() );
            else
                assert( false && "Invalid export pointer" );
        }
    }

    pe_bliss::rebuild_exports( *_image, info, exports, _image->section_from_directory( pe_bliss::pe_win::image_directory_entry_export ), ofst );
}

/// <summary>
/// Fix SAFESEH table
/// </summary>
/// <param name="oldText">Original .text section</param>
/// <param name="newText">New .text section</param>
void PEMutator::FixSafeSEH( const pe_bliss::section& oldText, const pe_bliss::section& newText )
{
    if (!_image->has_config())
        return;

    auto cfg = pe_bliss::get_image_config( *_image );
    auto& handlers = cfg.get_se_handler_rvas();

    if (handlers.empty())
        return;

    for (size_t i = 0; i < handlers.size(); i++)
    {
        // Handler inside old section
        if (handlers[i] >= oldText.get_virtual_address() &&
             handlers[i] <= oldText.get_virtual_address() + oldText.get_virtual_size())
        {
            auto rva = handlers[i] - oldText.get_virtual_address();
            auto pData = _mutator.GetIdataByRVA( rva );
            if (pData)
                handlers[i] = pData->new_rva + newText.get_virtual_address();
            else
                assert( false && "Invalid handler" );
        }
    }

    std::sort( handlers.begin(), handlers.end() );

    auto pSectionData = _image->section_data_from_va( cfg.get_se_handler_table_va() );
    memcpy( pSectionData, &handlers[0], handlers.size() * sizeof(handlers[0]) );
}

}


text:
<?php

namespace Alex\MailCatcher\Tests;

use Alex\MailCatcher\Person;

class PersonTest extends \PHPUnit_Framework_TestCase
{
    public function provideIncorrect()
    {
        return array(
            array('foo'),
            array('foo@example.org'),
        );
    }

    public function provideCorrect()
    {
        return array(
            array('foo <foo@example.org>', 'foo', 'foo@example.org'),
            array('<foo@example.org>', null, 'foo@example.org'),
        );
    }

    /**
     * @dataProvider provideIncorrect
     * @expectedException \InvalidArgumentException
     */
    public function testIncorrect($string)
    {
        Person::createFromString($string);
    }

    /**
     * @dataProvider provideCorrect
     */
    public function testCorrect($string, $name, $email)
    {
        $person = Person::createFromString($string);

        $this->assertEquals($email, $person->getEmail(), "Email is correct");
        $this->assertEquals($name, $person->getName(), "Name is correct");
    }
}


text:
package middlewares

import (
	"net/http"

	"github.com/cloudfoundry-incubator/bits-service/pathsigner"
)

type SignatureVerificationMiddleware struct {
	SignatureValidator pathsigner.PathSignatureValidator
}

func (middleware *SignatureVerificationMiddleware) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request, next http.HandlerFunc) {
	if request.URL.Query().Get("signature") == "" {
		responseWriter.WriteHeader(403)
		return
	}
	if !middleware.SignatureValidator.SignatureValid(request.Method, request.URL) {
		responseWriter.WriteHeader(403)
		return
	}
	next(responseWriter, request)
}


text: Repo for article


text:
module Forem
  # Defines a whole bunch of permissions for Forem
  # Access (most) areas by default
  module DefaultPermissions
    extend ActiveSupport::Concern

    included do
      unless method_defined?(:can_read_forem_category?)
        def can_read_forem_category?(category)
          true
        end
      end

      unless method_defined?(:can_read_forem_forums?)
        def can_read_forem_forums?
          true
        end
      end

      unless method_defined?(:can_read_forem_forum?)
        def can_read_forem_forum?(forum)
          true
        end
      end

      unless method_defined?(:can_create_forem_topics?)
        def can_create_forem_topics?(forum)
          true
        end
      end

      unless method_defined?(:can_reply_to_forem_topic?)
        def can_reply_to_forem_topic?(topic)
          true
        end
      end

      unless method_defined?(:can_edit_forem_posts?)
        def can_edit_forem_posts?(forum)
          true
        end
      end

      unless method_defined?(:can_read_forem_topic?)
        def can_read_forem_topic?(topic)
          !topic.hidden? || forem_admin?
        end
      end

      unless method_defined?(:can_moderate_forem_forum?)
        def can_moderate_forem_forum?(forum)
          forum.moderator?(self)
        end
      end
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<billStatus>
  <bill>
    <sponsors>
      <item>
        <district>4</district>
        <firstName>Henry</firstName>
        <identifiers>
          <bioguideId>J000288</bioguideId>
          <lisID>1843</lisID>
          <gpoId>7901</gpoId>
        </identifiers>
        <lastName>Johnson</lastName>
        <bioguideId>J000288</bioguideId>
        <middleName>C. "Hank"</middleName>
        <fullName>Rep. Johnson, Henry C. "Hank," Jr. [D-GA-4]</fullName>
        <party>D</party>
        <byRequestType />
        <state>GA</state>
      </item>
    </sponsors>
    <committeeReports />
    <billNumber>213</billNumber>
    <updateDate>2017-10-05T07:15:40Z</updateDate>
    <policyArea>
      <name>Health</name>
    </policyArea>
    <summaries>
      <billSummaries>
        <item>
          <actionDate>2017-03-21</actionDate>
          <actionDesc>Introduced in House</actionDesc>
          <versionCode>00</versionCode>
          <name>Introduced in House</name>
          <text><![CDATA[
Expresses support for the designation of National Vitiligo Awareness Day. (Vitiligo is a condition in which skin color is lost in patches.)

Recognizes the importance of providing support for individuals diagnosed with vitiligo.
]]></text>
          <updateDate>2017-03-21T04:00:00Z</updateDate>
          <lastSummaryUpdateDate>2017-03-31T20:36:56Z</lastSummaryUpdateDate>
        </item>
      </billSummaries>
    </summaries>
    <recordedVotes />
    <cboCostEstimates />
    <notes />
    <cosponsors>
      <item>
        <bioguideId>M001137</bioguideId>
        <fullName>Rep. Meeks, Gregory W. [D-NY-5]</fullName>
        <district>5</district>
        <firstName>GREGORY</firstName>
        <identifiers>
          <bioguideId>M001137</bioguideId>
          <lisID>1506</lisID>
          <gpoId>8067</gpoId>
        </identifiers>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <party>D</party>
        <lastName>MEEKS</lastName>
        <middleName>W.</middleName>
        <state>NY</state>
        <sponsorshipDate>2017-03-21</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>G000551</bioguideId>
        <fullName>Rep. Grijalva, Raul M. [D-AZ-3]</fullName>
        <district>3</district>
        <firstName>Raul</firstName>
        <identifiers>
          <bioguideId>G000551</bioguideId>
          <lisID>1708</lisID>
          <gpoId>7804</gpoId>
        </identifiers>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <party>D</party>
        <lastName>Grijalva</lastName>
        <middleName>M.</middleName>
        <state>AZ</state>
        <sponsorshipDate>2017-03-21</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>D000624</bioguideId>
        <fullName>Rep. Dingell, Debbie [D-MI-12]</fullName>
        <district>12</district>
        <firstName>Debbie</firstName>
        <identifiers>
          <gpoId />
          <lisID>2251</lisID>
          <bioguideId>D000624</bioguideId>
        </identifiers>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <party>D</party>
        <lastName>Dingell</lastName>
        <middleName />
        <state>MI</state>
        <sponsorshipDate>2017-03-21</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>B001257</bioguideId>
        <fullName>Rep. Bilirakis, Gus M. [R-FL-12]</fullName>
        <district>12</district>
        <firstName>Gus</firstName>
        <identifiers>
          <lisID>1838</lisID>
          <gpoId>7881</gpoId>
          <bioguideId>B001257</bioguideId>
        </identifiers>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <party>R</party>
        <lastName>Bilirakis</lastName>
        <middleName>M.</middleName>
        <state>FL</state>
        <sponsorshipDate>2017-03-21</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>N000147</bioguideId>
        <fullName>Rep. Norton, Eleanor Holmes [D-DC-At Large]</fullName>
        <district>0</district>
        <firstName>ELEANOR</firstName>
        <identifiers>
          <bioguideId>N000147</bioguideId>
          <lisID>868</lisID>
          <gpoId>7871</gpoId>
        </identifiers>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <party>D</party>
        <lastName>NORTON</lastName>
        <middleName>HOLMES</middleName>
        <state>DC</state>
        <sponsorshipDate>2017-03-21</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>J000032</bioguideId>
        <fullName>Rep. Jackson Lee, Sheila [D-TX-18]</fullName>
        <district>18</district>
        <firstName>SHEILA</firstName>
        <identifiers>
          <bioguideId>J000032</bioguideId>
          <lisID>588</lisID>
          <gpoId>8174</gpoId>
        </identifiers>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <party>D</party>
        <lastName>JACKSON LEE</lastName>
        <middleName />
        <state>TX</state>
        <sponsorshipDate>2017-03-21</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>S001157</bioguideId>
        <fullName>Rep. Scott, David [D-GA-13]</fullName>
        <district>13</district>
        <firstName>David</firstName>
        <identifiers>
          <lisID>1722</lisID>
          <gpoId>7910</gpoId>
          <bioguideId>S001157</bioguideId>
        </identifiers>
        <isOriginalCosponsor>True</isOriginalCosponsor>
        <party>D</party>
        <lastName>Scott</lastName>
        <middleName />
        <state>GA</state>
        <sponsorshipDate>2017-03-21</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>B001281</bioguideId>
        <fullName>Rep. Beatty, Joyce [D-OH-3]</fullName>
        <district>3</district>
        <firstName>Joyce</firstName>
        <identifiers>
          <bioguideId>B001281</bioguideId>
          <lisID>2153</lisID>
          <gpoId />
        </identifiers>
        <isOriginalCosponsor>False</isOriginalCosponsor>
        <party>D</party>
        <lastName>Beatty</lastName>
        <middleName />
        <state>OH</state>
        <sponsorshipDate>2017-04-28</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>B001303</bioguideId>
        <fullName>Rep. Blunt Rochester, Lisa [D-DE-At Large]</fullName>
        <district>0</district>
        <firstName>Lisa</firstName>
        <identifiers>
          <lisID>2313</lisID>
          <gpoId />
          <bioguideId>B001303</bioguideId>
        </identifiers>
        <isOriginalCosponsor>False</isOriginalCosponsor>
        <party>D</party>
        <lastName>Blunt Rochester</lastName>
        <middleName />
        <state>DE</state>
        <sponsorshipDate>2017-07-12</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
      <item>
        <bioguideId>E000288</bioguideId>
        <fullName>Rep. Ellison, Keith [D-MN-5]</fullName>
        <district>5</district>
        <firstName>Keith</firstName>
        <identifiers>
          <bioguideId>E000288</bioguideId>
          <lisID>1857</lisID>
          <gpoId>8005</gpoId>
        </identifiers>
        <isOriginalCosponsor>False</isOriginalCosponsor>
        <party>D</party>
        <lastName>Ellison</lastName>
        <middleName />
        <state>MN</state>
        <sponsorshipDate>2017-10-04</sponsorshipDate>
        <sponsorshipWithdrawnDate />
      </item>
    </cosponsors>
    <relatedBills />
    <billType>HRES</billType>
    <latestAction>
      <actionDate>2017-03-24</actionDate>
      <links />
      <text>Referred to the Subcommittee on Health.</text>
    </latestAction>
    <congress>115</congress>
    <actions>
      <actionTypeCounts>
        <placeholderTextForH>1</placeholderTextForH>
        <introducedInHouse>1</introducedInHouse>
        <introducedInTheHouse>1</introducedInTheHouse>
        <billReferrals>1</billReferrals>
      </actionTypeCounts>
      <actionByCounts>
        <houseOfRepresentatives>4</houseOfRepresentatives>
      </actionByCounts>
      <item>
        <actionDate>2017-03-24</actionDate>
        <committee>
          <systemCode>hsif14</systemCode>
          <name>Health Subcommittee</name>
        </committee>
        <links />
        <sourceSystem>
          1
          <name>House committee actions</name>
        </sourceSystem>
        <text>Referred to the Subcommittee on Health.</text>
        <type>Committee</type>
      </item>
      <item>
        <links />
        <type>IntroReferral</type>
        <actionCode>H11100</actionCode>
        <sourceSystem>
          2
          <name>House floor actions</name>
        </sourceSystem>
        <actionDate>2017-03-21</actionDate>
        <committee>
          <systemCode>hsif00</systemCode>
          <name>Energy and Commerce Committee</name>
        </committee>
        <text>Referred to the House Committee on Energy and Commerce.</text>
      </item>
      <item>
        <links />
        <type>IntroReferral</type>
        <actionCode>Intro-H</actionCode>
        <sourceSystem>
          9
          <name>Library of Congress</name>
        </sourceSystem>
        <actionDate>2017-03-21</actionDate>
        <committee />
        <text>Introduced in House</text>
      </item>
      <item>
        <links />
        <type>IntroReferral</type>
        <actionCode>1000</actionCode>
        <sourceSystem>
          9
          <name>Library of Congress</name>
        </sourceSystem>
        <actionDate>2017-03-21</actionDate>
        <committee />
        <text>Introduced in House</text>
      </item>
    </actions>
    <createDate>2017-03-22T05:45:11Z</createDate>
    <title>Expressing support for designation of October 17, 2017, as the "National Vitiligo Awareness Day".</title>
    <introducedDate>2017-03-21</introducedDate>
    <laws />
    <originChamber>House</originChamber>
    <subjects>
      <billSubjects>
        <legislativeSubjects>
          <item>
            <name>Commemorative events and holidays</name>
          </item>
          <item>
            <name>Health promotion and preventive care</name>
          </item>
          <item>
            <name>Musculoskeletal and skin diseases</name>
          </item>
        </legislativeSubjects>
        <policyArea>
          <name>Health</name>
        </policyArea>
      </billSubjects>
    </subjects>
    <version>1.0.0</version>
    <amendments />
    <calendarNumbers />
    <committees>
      <billCommittees>
        <item>
          <chamber>House</chamber>
          <type>Standing</type>
          <activities>
            <item>
              <date>2017-03-21T14:00:07Z</date>
              <name>Referred to</name>
            </item>
          </activities>
          <subcommittees>
            <item>
              <activities>
                <item>
                  <date>2017-03-24T17:40:31Z</date>
                  <name>Referred to</name>
                </item>
              </activities>
              <name>Health Subcommittee</name>
              <systemCode>hsif14</systemCode>
            </item>
          </subcommittees>
          <name>Energy and Commerce Committee</name>
          <systemCode>hsif00</systemCode>
        </item>
      </billCommittees>
    </committees>
    <constitutionalAuthorityStatementText />
    <titles>
      <item>
        <titleType>Official Title as Introduced</titleType>
        <title>Expressing support for designation of October 17, 2017, as the "National Vitiligo Awareness Day".</title>
        <chamberName />
        <parentTitleType />
        <chamberCode />
      </item>
      <item>
        <titleType>Display Title</titleType>
        <title>Expressing support for designation of October 17, 2017, as the "National Vitiligo Awareness Day".</title>
        <chamberName />
        <parentTitleType />
        <chamberCode />
      </item>
    </titles>
  </bill>
  <dublinCore xmlns:dc="http://purl.org/dc/elements/1.1/">
    <dc:format>text/xml</dc:format>
    <dc:language>EN</dc:language>
    <dc:rights>Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain.</dc:rights>
    <dc:contributor>Congressional Research Service, Library of Congress</dc:contributor>
    <dc:description>This file contains bill summaries and statuses for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is "to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives". For more information, refer to the User Guide that accompanies this file.</dc:description>
  </dublinCore>
</billStatus>


text:
'use strict';

import { Component, PropTypes } from 'react'
import _ from 'lodash'

class NavBarTop extends Component {

  constructor (props) {
    super(props)
    this.state = {
      navs: [
        { name: '草稿', tag: 'draft' },
        { name: '已发布', tag: 'post' }
      ],
      active: 0
    }
  }

  render () {
    let _navs = this.state.navs
    let _active = _.findIndex(_navs, { tag: this.props.tab })
    return (

          新建
          {
            _navs.map( (nav, i) => {
              return (
                {nav.name}
              )
            })
          }

    )
  }

  _selectNav (index) {
    if (index === -1) {
      this.props.refreshState('newadd')
      return
    }
    this.setState({ active: index })
    this.props.refreshState(this.state.navs[index].tag)
  }

}

NavBarTop.propTypes = {
  tab: PropTypes.string,
  refreshState: PropTypes.func
}

NavBarTop.defaultProps = {
  tab: 'draft',
  refreshState: () => null
}

export default NavBarTop


text:
/** @module react-elementary/lib/createFactory */

import { ReactNode, ReactType } from 'react'

import { createElement, PropsOrNode } from './createElement'

/**
 * A function that binds createElement with a ReactType.
 * @param  {ReactType} type - the component type
 * @return {function}         a createElement function with bound type
 */
export default function createFactory(type: ReactType) {
  return (propsOrNode?: PropsOrNode, ...args: ReactNode[]) =>
    createElement(type, propsOrNode, ...args)
}


text:
#include "config.h"
#include "Module.h"

#include <WebCore/DelayLoadedModulesEnumerator.h>
#include <WebCore/ImportedFunctionsEnumerator.h>
#include <WebCore/ImportedModulesEnumerator.h>
#include <shlwapi.h>

using namespace WebCore;

namespace WebKit {

bool Module::load()
{
    ASSERT(!::PathIsRelativeW(m_path.charactersWithNullTermination()));
    m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
    return m_module;
}

void Module::unload()
{
    if (!m_module)
        return;
    ::FreeLibrary(m_module);
    m_module = 0;
}

static void memcpyToReadOnlyMemory(void* destination, const void* source, size_t size)
{
    DWORD originalProtection;
    if (!::VirtualProtect(destination, size, PAGE_READWRITE, &originalProtection))
        return;

    memcpy(destination, source, size);

    ::VirtualProtect(destination, size, originalProtection, &originalProtection);
}

static const void* const* findFunctionPointerAddress(ImportedModulesEnumeratorBase& modules, const char* importDLLName, const char* importFunctionName)
{
    for (; !modules.isAtEnd(); modules.next()) {
        if (_stricmp(importDLLName, modules.currentModuleName()))
            continue;

        for (ImportedFunctionsEnumerator functions = modules.functionsEnumerator(); !functions.isAtEnd(); functions.next()) {
            const char* currentFunctionName = functions.currentFunctionName();
            if (!currentFunctionName || strcmp(importFunctionName, currentFunctionName))
                continue;

            return functions.addressOfCurrentFunctionPointer();
        }

        break;
    }

    return 0;
}

static const void* const* findFunctionPointerAddress(HMODULE module, const char* importDLLName, const char* importFunctionName)
{
    PEImage image(module);

    ImportedModulesEnumerator importedModules(image);
    if (const void* const* functionPointerAddress = findFunctionPointerAddress(importedModules, importDLLName, importFunctionName))
        return functionPointerAddress;

    DelayLoadedModulesEnumerator delayLoadedModules(image);
    return findFunctionPointerAddress(delayLoadedModules, importDLLName, importFunctionName);
}

void Module::installIATHook(const char* importDLLName, const char* importFunctionName, const void* hookFunction)
{
    if (!m_module)
        return;

    // The Import Address Table (IAT) contains one function pointer for each function imported by
    // this module. When code in this module calls that function, the function pointer from the IAT
    // is used. We find that function pointer and overwrite it with hookFunction so that
    // hookFunction will be called instead.

    const void* const* functionPointerAddress = findFunctionPointerAddress(m_module, importDLLName, importFunctionName);
    if (!functionPointerAddress || *functionPointerAddress == hookFunction)
        return;

    memcpyToReadOnlyMemory(const_cast<const void**>(functionPointerAddress), &hookFunction, sizeof(hookFunction));
}

void* Module::platformFunctionPointer(const char* functionName) const
{
    if (!m_module)
        return 0;

    return ::GetProcAddress(m_module, functionName);
}

} // namespace WebKit


text:
{% extends "timepiece/business/base.html" %}
{% load bootstrap_toolkit %}
{% load url from future %}

{% block title %}Businesses{% endblock title %}

{% block content %}

Businesses

                {% if perms.crm.add_business %}

Create Business

                {% endif %}

            <form class='form-inline' accept-charset='UTF-8' method='get' action=''>
                {{ form|as_bootstrap:"inline" }}
                <button type='submit' class='btn' name='submit'>Search</button>
            </form>

            {% load pagination_tags %}
            {% autopaginate object_list %}

            {% paginate %}

                        Name
                        Description

                    {% for business in object_list %}

                            {{ business.name }}
                            {{ business.description|truncatewords:8 }}

                    {% endfor %}

            {% paginate %}

{% endblock content %}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Prism.Mvvm;

namespace BackupAssistant.ViewModels
{
    /// <summary>
    /// 被排除的文件夹ViewModel
    /// </summary>
    public class ExcludeDiretoryViewModel : BindableBase
    {
        bool _partialPath;
        /// <summary>
        /// 是否部分路径匹配模式
        /// </summary>
        public bool PartialPath { get { return _partialPath; } set { SetProperty(ref _partialPath, value); } }

        string _path;
        /// <summary>
        /// 路径
        /// </summary>
        public string Path { get { return _path; } set { SetProperty(ref _path, value); } }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Deprecated List (Solr 6.0.0 API)</title>
<meta name="date" content="2016-04-01">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

Deprecated API

Contents

Deprecated Classes

Deprecated Methods

Deprecated Constructors

Deprecated Classes

Class and Description

org.apache.solr.search.Insanity

Deprecated Methods

Method and Description

org.apache.solr.internal.csv.CSVStrategy.clone()

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setCommentStart(char)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setDelimiter(char)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setEncapsulator(char)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setEscape(char)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setIgnoreEmptyLines(boolean)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setIgnoreLeadingWhitespaces(boolean)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setIgnoreTrailingWhitespaces(boolean)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setPrinterNewline(String)

will be removed in Solr 7

org.apache.solr.internal.csv.CSVStrategy.setUnicodeEscapeInterpretation(boolean)

will be removed in Solr 7

Deprecated Constructors

Constructor and Description

org.apache.solr.internal.csv.CSVStrategy(char, char, char, char, boolean, boolean, boolean, boolean)

Use the ctor that also takes printerNewline.  This ctor will be removed in Solr 7.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

          Copyright © 2000-2016 Apache Software Foundation.  All Rights Reserved.


text:
<?php

namespace Bravesheep\FlysystemUrlBundle\Resolver;

use Bravesheep\FlysystemUrlBundle\Exception\UrlResolveException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class LocalUrlResolver implements UrlResolverInterface
{
    /**
     * @inheritDoc
     */
    public function getSupportedAdapters()
    {
        return ['League\Flysystem\Adapter\Local'];
    }

    /**
     * @inheritDoc
     */
    public function createServiceDefinitions(array $data, ContainerBuilder $container, $prefix)
    {
        if (isset($data['host']) && isset($data['path'])) {
            $path = "{$data['host']}/{$data['path']}";
        } else if (isset($data['path'])) {
            $path = $data['path'];
        } else {
            throw new UrlResolveException('No path to storage location found');
        }

        if (!self::isAbsolute($path)) {
            throw new UrlResolveException("Configured path '$path' is not an absolute path");
        }

        $lock = LOCK_EX;
        if (isset($data['lock']) && ($data['lock'] === '0' || $data['lock'] === 'false')) {
            $lock = 0;
        }

        $filePermPublic = 0744;
        if (isset($data['file_perm'])) {
            $filePermPublic = self::parsePermissions($data['file_perm']);
        }

        $filePermPrivate = 0700;
        if (isset($data['file_perm_priv'])) {
            $filePermPrivate = self::parsePermissions($data['file_perm_priv']);
        }

        $dirPermPublic = 0755;
        if (isset($data['dir_perm'])) {
            $dirPermPublic = self::parsePermissions($data['dir_perm']);
        }

        $dirPermPrivate = 0700;
        if (isset($data['dir_perm_priv'])) {
            $dirPermPrivate = self::parsePermissions($data['dir_perm_priv']);
        }

        $container->setDefinition(
            "$prefix.adapter",
            new Definition('League\Flysystem\Adapter\Local', [
                $path,
                $lock,
                [
                    'file' => ['public' => $filePermPublic, 'private' => $filePermPrivate],
                    'dir' => ['public' => $dirPermPublic, 'private' => $dirPermPrivate]
                ]
            ])
        );

        return "$prefix.adapter";
    }

    /**
     * Checks whether the path is an absolute path.
     *
     * @param string $path
     * @return bool
     */
    private static function isAbsolute($path)
    {
        // TODO: add a better check here
        return $path[0] === '/';
    }

    /**
     * @param string $permissions
     * @return int
     * @throws UrlResolveException
     */
    private static function parsePermissions($permissions)
    {
        if (ctype_digit($permissions) && $permissons[0] === '0') {
            return octdec($permissions);
        }

        throw new UrlResolveException("Invalid file permissions specification: '$permissions'");
    }

}