text:
<?php

namespace Site\PortailBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Site\PortailBundle\Form\ProposeArticleForm;
use Site\PortailBundle\Form\CommentaireForm;
use Site\PortailBundle\Form\AjoutArticle;
use Site\PortailBundle\Entity\Article;
use Site\PortailBundle\Entity\CommantArticle;
use Pagerfanta\Adapter\DoctrineORMAdapter;
use Pagerfanta\Pagerfanta;
use Pagerfanta\Adapter\ArrayAdapter;
use Pagerfanta\OptionableView;
class ArticleController extends Controller
{
public function IndexAction()
    {
	return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:GestionArticle.html.twig');
	}
	/***************************************/
	public function tchatAction()
    {
	return $this->container->get('templating')->renderResponse('SitePortailBundle:tchat:tchat.html.twig');
	}
	/*******************************************************/
public function AjoutAction()
    {

$m='';
$request = $this->container->get('request');
$session=$this->getRequest()->getSession();
 $article = new Article();
	 $form = $this->container->get('form.factory')->create(new AjoutArticle(),$article);
	if($request->getMethod()=='POST')
	 {

	$form->bindRequest($request);

    if ($form->isValid())
    {

	  $article->setid_admin($session->get('id'));

    if(!$article->save('admin'))
		throw new NotFoundHttpException("Erreur");
		else
		{
		$m='votre message envoyer';
		}
		$this->get('session')->setFlash('enregister_article',$m);
	 return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:GestionArticle.html.twig');
	  }
	  }

    return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:AjoutArticle.html.twig',array('form' => $form->createView()));

}
/*****************************************************************/

public function ProposeAction()
    {
	 $session=$this->getRequest()->getSession();
			if($session->get('type')=="membre")
{
$m='';
$request = $this->container->get('request');
$session=$this->getRequest()->getSession();
 $article = new Article();
	 $form = $this->container->get('form.factory')->create(new ProposeArticleForm(),$article);
	if($request->getMethod()=='POST')
	 {

	$form->bindRequest($request);

    if ($form->isValid())
    {

	  $article->setid_mbr($session->get('id'));

    if(!$article->save('membre'))
		throw new NotFoundHttpException("Erreur");
		else
		{
		$m='votre article proposé est enregistre';
		}
		$this->get('session')->setFlash('enregister_article',$m);
	 return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:ProposeArticle.html.twig',array('form' => $form->createView()));
	  }
	  }

    return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:ProposeArticle.html.twig',array('form' => $form->createView()));
}
	return $this->container->get('templating')->renderResponse('SitePortailBundle:Portail:Inscrire_connect.html.twig');

	}
/***********************************************************************/
public function ListeAction($categorie=null)
    {

	   $request = $this->container->get('request');
  $article = new Article();
	if($categorie!=null)
	 {
	 $liste=$article->listAll($categorie);
	 $adapter =new ArrayAdapter($liste);
     /* j' utilise un         Adapter que je  vais  passer à pagerfanta*/
     $pagerfanta = new Pagerfanta($adapter); // j' instancie pagerfanta
     $pagerfanta->setMaxPerPage(5);//je fixe le nombre d'articles par page à 5
     $request = $this->get('request');
     $page = $request->query->get('page',1);
     try
    {
         $pagerfanta->setCurrentPage($page);
     }
     catch (\Pagerfanta\Exception\NotValidCurrentPageException $e)
    {
         $this->createNotFoundException();
     }
	 return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:ListeArticle.html.twig',array('pagerfanta' => $pagerfanta,'categorie'=>$categorie));

	 }
	   $adapter =new ArrayAdapter($article->listCategorie());
     /* j' utilise un         Adapter que je  vais  passer à pagerfanta*/
     $pagerfanta = new Pagerfanta($adapter); // j' instancie pagerfanta
     $pagerfanta->setMaxPerPage(5);//je fixe le nombre d'articles par page à 5
     $request = $this->get('request');
     $page = $request->query->get('page',1);
     try
    {
         $pagerfanta->setCurrentPage($page);
     }
     catch (\Pagerfanta\Exception\NotValidCurrentPageException $e)
    {
         $this->createNotFoundException();
     }

     return $this->render('SitePortailBundle:Article:ListeCategorie.html.twig',array('pagerfanta' => $pagerfanta));
 }
/**********************************************************/
public function AfficheAction($id)
    {

	 $article = new Article();
	 $article=$article->find($id);
	 return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:AfficheArticle.html.twig',array('article'=>$article));

    }
	/***********************************************************************************/
	public function LireAction($id)
    {
	$article = new Article();
	 $article=$article->find($id);
	$request = $this->container->get('request');
 $commentaire2 = new CommantArticle();
 $commentaire = new CommantArticle();
 $form = $this->container->get('form.factory')->create(new CommentaireForm(),$commentaire);
	/*if($request->getMethod()=='POST')
	 {

	$form->bindRequest($request);

    if ($form->isValid())
    {
	  $session=$this->getRequest()->getSession();
			if($session->get('type')=="membre")
{
	  $commentaire->setid_mbr($session->get('id'));

   $commentaire->save();
   }
   else return $this->container->get('templating')->renderResponse('SitePortailBundle:Portail:Inscrire_connect.html.twig');
	}
	 return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:LireArticle.html.twig',array('commentaire'=>$commentaire->list_commentaire($id),'article'=>$article,'form' => $form->createView()));

    }*/
	return $this->container->get('templating')->renderResponse('SitePortailBundle:Article:LireArticle.html.twig',array('commentaire'=>$commentaire2->list_commentaire($id),'article'=>$article,'form' => $form->createView()));
	}
	/*********************************************************/
	public function DeleteAction($id,$categorie)
    {
  $session=$this->getRequest()->getSession();
	 $article = new Article();
	 if(!$article->delete($id))
	 {$m='Erreur';}
	 else
	 {$m='article sumpprimeé';}
	 $this->get('session')->setFlash('supprime_article',$m);
	 return $this->redirect($this->generateUrl('SitePortailBundle_Liste_article', array('categorie' =>$categorie)));

    }
	/******************************************************************************************/

	public function ValideAction($id,$categorie)
    {
	$session=$this->getRequest()->getSession();
 $article = new Article();
	 if(!$article->valider($id))
	 {$m='Erreur';}
	 else
	 {$m='article validé';}
	 $this->get('session')->setFlash('validation_article',$m);
	 return $this->redirect($this->generateUrl('SitePortailBundle_Liste_article', array('categorie' =>$categorie)));

    }
	/******************************************************************************************/
	public function PagerAction($categorie)
    {
	$session=$this->getRequest()->getSession();
	 $article = new Article();
	$liste=$article->ListeSite($categorie);
	if($categorie=='islamiyat')
	{
	return $this->render('SitePortailBundle:Article:Islamiyat.html.twig',array('islamiyat'=>$liste));
	}
	 $session->set('article',$liste);

	 return $this->render('SitePortailBundle:Portail:index.html.twig',array('m'=>''));
	}
}


text:
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: monitor_v1_service.proto

/*
Package monitor_v1_service is a generated protocol buffer package.

Monitor Service

The Key Transparency monitor server service consists of APIs to fetch
monitor results queried using the mutations API.

It is generated from these files:
	monitor_v1_service.proto

It has these top-level messages:
*/
package monitor_v1_service

import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import monitor_v1_types "github.com/google/keytransparency/core/proto/monitor_v1_types"
import _ "google.golang.org/genproto/googleapis/api/annotations"

import (
	context "golang.org/x/net/context"
	grpc "google.golang.org/grpc"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// Client API for MonitorService service

type MonitorServiceClient interface {
	// GetSignedMapRoot returns the latest valid signed map root the monitor
	// observed. Additionally, the response contains additional data necessary to
	// reproduce errors on failure.
	//
	// Returns the signed map root for the latest epoch the monitor observed. If
	// the monitor could not reconstruct the map root given the set of mutations
	// from the previous to the current epoch it won't sign the map root and
	// additional data will be provided to reproduce the failure.
	GetSignedMapRoot(ctx context.Context, in *monitor_v1_types.GetMonitoringRequest, opts ...grpc.CallOption) (*monitor_v1_types.GetMonitoringResponse, error)
	// GetSignedMapRootByRevision works similar to GetSignedMapRoot but returns
	// the monitor's result for a specific map revision.
	//
	// Returns the signed map root for the specified epoch the monitor observed.
	// If the monitor could not reconstruct the map root given the set of
	// mutations from the previous to the current epoch it won't sign the map root
	// and additional data will be provided to reproduce the failure.
	GetSignedMapRootByRevision(ctx context.Context, in *monitor_v1_types.GetMonitoringRequest, opts ...grpc.CallOption) (*monitor_v1_types.GetMonitoringResponse, error)
}

type monitorServiceClient struct {
	cc *grpc.ClientConn
}

func NewMonitorServiceClient(cc *grpc.ClientConn) MonitorServiceClient {
	return &monitorServiceClient{cc}
}

func (c *monitorServiceClient) GetSignedMapRoot(ctx context.Context, in *monitor_v1_types.GetMonitoringRequest, opts ...grpc.CallOption) (*monitor_v1_types.GetMonitoringResponse, error) {
	out := new(monitor_v1_types.GetMonitoringResponse)
	err := grpc.Invoke(ctx, "/monitor.v1.service.MonitorService/GetSignedMapRoot", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *monitorServiceClient) GetSignedMapRootByRevision(ctx context.Context, in *monitor_v1_types.GetMonitoringRequest, opts ...grpc.CallOption) (*monitor_v1_types.GetMonitoringResponse, error) {
	out := new(monitor_v1_types.GetMonitoringResponse)
	err := grpc.Invoke(ctx, "/monitor.v1.service.MonitorService/GetSignedMapRootByRevision", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for MonitorService service

type MonitorServiceServer interface {
	// GetSignedMapRoot returns the latest valid signed map root the monitor
	// observed. Additionally, the response contains additional data necessary to
	// reproduce errors on failure.
	//
	// Returns the signed map root for the latest epoch the monitor observed. If
	// the monitor could not reconstruct the map root given the set of mutations
	// from the previous to the current epoch it won't sign the map root and
	// additional data will be provided to reproduce the failure.
	GetSignedMapRoot(context.Context, *monitor_v1_types.GetMonitoringRequest) (*monitor_v1_types.GetMonitoringResponse, error)
	// GetSignedMapRootByRevision works similar to GetSignedMapRoot but returns
	// the monitor's result for a specific map revision.
	//
	// Returns the signed map root for the specified epoch the monitor observed.
	// If the monitor could not reconstruct the map root given the set of
	// mutations from the previous to the current epoch it won't sign the map root
	// and additional data will be provided to reproduce the failure.
	GetSignedMapRootByRevision(context.Context, *monitor_v1_types.GetMonitoringRequest) (*monitor_v1_types.GetMonitoringResponse, error)
}

func RegisterMonitorServiceServer(s *grpc.Server, srv MonitorServiceServer) {
	s.RegisterService(&_MonitorService_serviceDesc, srv)
}

func _MonitorService_GetSignedMapRoot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(monitor_v1_types.GetMonitoringRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(MonitorServiceServer).GetSignedMapRoot(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/monitor.v1.service.MonitorService/GetSignedMapRoot",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(MonitorServiceServer).GetSignedMapRoot(ctx, req.(*monitor_v1_types.GetMonitoringRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _MonitorService_GetSignedMapRootByRevision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(monitor_v1_types.GetMonitoringRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(MonitorServiceServer).GetSignedMapRootByRevision(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/monitor.v1.service.MonitorService/GetSignedMapRootByRevision",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(MonitorServiceServer).GetSignedMapRootByRevision(ctx, req.(*monitor_v1_types.GetMonitoringRequest))
	}
	return interceptor(ctx, in, info, handler)
}

var _MonitorService_serviceDesc = grpc.ServiceDesc{
	ServiceName: "monitor.v1.service.MonitorService",
	HandlerType: (*MonitorServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetSignedMapRoot",
			Handler:    _MonitorService_GetSignedMapRoot_Handler,
		},
		{
			MethodName: "GetSignedMapRootByRevision",
			Handler:    _MonitorService_GetSignedMapRootByRevision_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "monitor_v1_service.proto",
}

func init() { proto.RegisterFile("monitor_v1_service.proto", fileDescriptor0) }

var fileDescriptor0 = []byte{
	// 273 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x90, 0xb1, 0x4e, 0xc3, 0x40,
	0x0c, 0x86, 0xd5, 0x0e, 0x0c, 0x19, 0x10, 0xba, 0x09, 0x45, 0x4c, 0x0c, 0x14, 0x18, 0x62, 0x0a,
	0x1b, 0x23, 0x4b, 0x17, 0xba, 0xa4, 0x30, 0x47, 0xd7, 0x60, 0xa5, 0xa7, 0x26, 0xf6, 0x71, 0x76,
	0x22, 0x45, 0x55, 0x17, 0x5e, 0x01, 0x76, 0x9e, 0x87, 0x99, 0x57, 0xe0, 0x41, 0x90, 0x92, 0x20,
	0x55, 0x30, 0x74, 0x61, 0xf5, 0xef, 0xff, 0xf3, 0x27, 0x47, 0xc7, 0x15, 0x93, 0x53, 0x0e, 0x59,
	0x33, 0xcd, 0x04, 0x43, 0xe3, 0x72, 0x4c, 0x7c, 0x60, 0x65, 0x63, 0x86, 0x24, 0x69, 0xa6, 0xc9,
	0x90, 0xc4, 0x0f, 0x85, 0xd3, 0x55, 0xbd, 0x4c, 0x72, 0xae, 0xa0, 0x60, 0x2e, 0x4a, 0x84, 0x35,
	0xb6, 0x1a, 0x2c, 0x89, 0xb7, 0x01, 0x29, 0x6f, 0x21, 0xe7, 0x80, 0xd0, 0x11, 0x60, 0x07, 0xad,
	0xad, 0x47, 0xf9, 0x33, 0xe8, 0x2f, 0xc5, 0x27, 0x03, 0xca, 0x7a, 0x07, 0x96, 0x88, 0xd5, 0xaa,
	0x63, 0x1a, 0xd2, 0xeb, 0x8f, 0x71, 0x74, 0x38, 0xef, 0x8b, 0x8b, 0x5e, 0xc3, 0xbc, 0x8d, 0xa2,
	0xa3, 0x19, 0xea, 0xc2, 0x15, 0x84, 0x4f, 0x73, 0xeb, 0x53, 0x66, 0x35, 0x67, 0xc9, 0x8e, 0x70,
	0x8f, 0x9f, 0xa1, 0x0e, 0x4d, 0x47, 0x45, 0x8a, 0xcf, 0x35, 0x8a, 0xc6, 0x93, 0xbd, 0x7b, 0xe2,
	0x99, 0x04, 0x4f, 0xe1, 0xe5, 0xf3, 0xeb, 0x75, 0x7c, 0x61, 0x26, 0xd0, 0x4c, 0x7f, 0xd4, 0x61,
	0xb3, 0xd6, 0xec, 0x31, 0xbd, 0xdf, 0x42, 0x65, 0x3d, 0x04, 0x94, 0xba, 0x54, 0xb9, 0x2d, 0xad,
	0xa2, 0xa8, 0x79, 0x1f, 0x45, 0xf1, 0x6f, 0xad, 0xbb, 0x36, 0xc5, 0xc6, 0x89, 0x63, 0xfa, 0x7f,
	0xc1, 0xab, 0x4e, 0xf0, 0xd2, 0x9c, 0xef, 0x13, 0x84, 0x0d, 0x7a, 0xce, 0x57, 0xdb, 0xe5, 0x41,
	0xf7, 0xd2, 0x9b, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x96, 0x6d, 0xf3, 0xf6, 0x01, 0x00,
	0x00,
}

redpajama_set_name: RedPajamaGithub


text:
package puzzle2.FireHydrantsBasicTests;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import puzzle2.FakeTicker;
import puzzle2.FireHydrantsImplType;
import puzzle2.firehydrants.FireHydrants;
import puzzle2.firehydrants.FireHydrantsFactory;
import puzzle2.tester.Tester;
import puzzle2.tester.TesterFactory;
import puzzle2.tester.TesterPolicy;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by bharath on 5/8/17.
 */
public class FireHydrantsBasicImplQ1Test {
        private FireHydrants fireHydrants;
        private FireHydrantsImplType implType;
        private FakeTicker fakeTicker;

        // One tester with capabilities as 5 min to complete each task.

        @Before
        public void setUp() throws Exception {
            implType = FireHydrantsImplType.BASIC;
            fakeTicker = new FakeTicker();
            TesterPolicy policy = new TesterPolicy.Builder()
                    .withNumTestsPerRollingPeriod(100)
                    .withRollingPeriodInSecs(1 * 60 *60)
                    .withTimeToCompleteWorkInSecs(5 * 60)
                    .withTicker(fakeTicker)
                    .build();
            List<Tester> testers = new LinkedList<>();
            testers.add(TesterFactory.getTester(policy, implType));

            fireHydrants = FireHydrantsFactory.getFireHydrants(testers, implType);

        }

        // Sending second request after the time to complete each request.
        @Test
        public void testcase1() throws Exception {
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(5 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());
        }

        //Testing the canSellHydrants method.
        @Test
        public void testcase2() throws Exception {
            Assert.assertTrue(fireHydrants.canSellHydrants());
            Assert.assertTrue(fireHydrants.canSellHydrants());
        }

        // Sending second request before the time to complete each request.
        @Test
        public void testcase3() throws Exception {
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(4 * 60);
            Assert.assertFalse(fireHydrants.canSellHydrants());
            Assert.assertFalse(fireHydrants.sellHydrants());

        }

        // Sending second request before the time to complete each request, but third request after the time to complete each request
        @Test
        public void testcase4() throws Exception {
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(4 * 60);
            Assert.assertFalse(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(5 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());
        }

        //Request every 5 mins.
        @Test
        public void testcase5() throws Exception {
            for (int i = 1; i < 5; i++) {
                Assert.assertTrue(fireHydrants.canSellHydrants());
                Assert.assertTrue(fireHydrants.sellHydrants());
                fakeTicker.setTimeInSecs((5 * i) * 60);
            }
        }

        // Random requests at different times.
        @Test
        public void testcase6() throws Exception {
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(5 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(9 * 60 + 58);
            Assert.assertFalse(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(15 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(19 * 60 + 59);
            Assert.assertFalse(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(20 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());

        }

        // Random requests at different times, but with a gap of 5 mins.
        @Test
        public void testcase7() throws Exception {
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(5 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(10 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(15 * 60);
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(20 * 60 );
            Assert.assertTrue(fireHydrants.sellHydrants());

        }

        // Random requests to both sellHydrants() and canSellHydrants() at different times.
        @Test
        public void testcase8() throws Exception {
            Assert.assertTrue(fireHydrants.canSellHydrants());
            Assert.assertTrue(fireHydrants.canSellHydrants());
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(5 * 60);
            Assert.assertTrue(fireHydrants.canSellHydrants());
            Assert.assertTrue(fireHydrants.sellHydrants());
            Assert.assertFalse(fireHydrants.canSellHydrants());
            fakeTicker.setTimeInSecs(10 * 60);
            Assert.assertTrue(fireHydrants.canSellHydrants());
            Assert.assertTrue(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(13 * 60);
            Assert.assertFalse(fireHydrants.canSellHydrants());
            Assert.assertFalse(fireHydrants.canSellHydrants());
            Assert.assertFalse(fireHydrants.sellHydrants());
            fakeTicker.setTimeInSecs(15 * 60);
            Assert.assertTrue(fireHydrants.canSellHydrants());
            Assert.assertTrue(fireHydrants.sellHydrants());
        }
}


text:
package com.sqb.designpattern.factory.abstractfactory;

public interface IFactory {
    public IProduct1 createProduct1();
    public IProduct2 createProduct2();
}


text:
// Classfile.cpp

#include "ClassFile.h"

#include "BytesDecoder.h"
#include "ClassFileAnalyzer.h"
#include "FileReader.h"

#include <stdlib.h>

ClassFile::ClassFile(const char* infilename)
    : mConstantPoolCount(0)
    , mConstantPool(0)
    , mAttributes(0)
{
    FileReader reader(infilename);

    reader.ReadLong(); // magic
    reader.ReadWord(); // minor_version
    reader.ReadWord(); // major_version
    mConstantPoolCount = reader.ReadWord();
    mConstantPool = readConstantPool(reader, infilename, mConstantPoolCount);
    reader.ReadWord(); // access_flags
    reader.ReadWord(); // this_class
    reader.ReadWord(); // super_class
    uint16_t interfaces_count = reader.ReadWord();
    skipWordArray(reader, interfaces_count); // interfaces
    uint16_t fields_count = reader.ReadWord();
    mAttributes = readFields(reader, fields_count, mAttributes); // fields
    uint16_t methods_count = reader.ReadWord();
    mAttributes = readMethods(reader, methods_count, mAttributes); // methods
    uint16_t attributes_count = reader.ReadWord();
    mAttributes = readAttributes(reader, attributes_count, mAttributes);
}

attribute_info* ClassFile::readAttributeInfo(FileReader& reader, attribute_info* atts)
{
    uint16_t attribute_name_index = reader.ReadWord();
    long attribute_length = reader.ReadLong();
    uint8_t* info = reader.ReadByteArray(attribute_length);

    return new attribute_info(attribute_name_index, attribute_length, info, atts);
}

attribute_info* ClassFile::readAttributes(FileReader& reader, int count, attribute_info* atts)
{
    for (int i=0; i<count; ++i)
        atts = readAttributeInfo(reader, atts);
    return atts;
}

void ClassFile::scanAnnotation(BytesDecoder& decoder, ClassFileAnalyzer& analyzer)
{
    int type_index = decoder.DecodeWord();
    const char* name = getClassName(type_index);
    if (analyzer.isIncludedClass(name))
        analyzer.addDep(name);
    int num_element_value_pairs = decoder.DecodeWord();
    for (int i = 0; i < num_element_value_pairs; ++i)
    {
        decoder.DecodeWord(); // skip over element_name_index
        scanElementValue(decoder, analyzer);
    }
}

void ClassFile::scanElementValue(BytesDecoder& decoder, ClassFileAnalyzer& analyzer)
{
    uint8_t tag = decoder.DecodeByte();
    switch (tag)
    {
        case 'B':
        case 'C':
        case 'D':
        case 'F':
        case 'I':
        case 'J':
        case 'S':
        case 'Z':
        {
            decoder.DecodeWord(); // skip over const_value_index
            break;
        }
        case 's':
        {
            decoder.DecodeWord(); // skip over const_value_index
            break;
        }
        case 'c':
        {
            decoder.DecodeWord(); // skip over class_info_index
            break;
        }
        case 'e':
        {
            int type_name_index = decoder.DecodeWord();
            const char* name = getClassName(type_name_index);
            decoder.DecodeWord(); // skip over const_name_index
            if (analyzer.isIncludedClass(name))
                analyzer.addDep(name);
            break;
        }
        case '@':
        {
            scanAnnotation(decoder, analyzer);
            break;
        }
        case '[':
        {
            int num_values = decoder.DecodeWord();
            int i;
            for (i = 0; i < num_values; ++i)
                scanElementValue(decoder, analyzer);
            break;
        }
        default:
            break;
    }
}

void ClassFile::findDepsInFile(const char* target, ClassFileAnalyzer& analyzer)
{
    for (int i=0; i < mConstantPoolCount; ++i)
    {
        cp_info* cp = mConstantPool[i];
        if (cp && cp->tag == CONSTANT_Class)
        {
            const char* name = getClassName(i);
            if (analyzer.isIncludedClass(name))
            {
                if (name[0] != '[')   /* Skip array classes */
                {
                    char* dollar = index(name, '$');
                    if (dollar)
                    {
                        /* It's an inner class */
                        if (strncmp(name, target, dollar-name) == 0)
                        {
                            /* It's one of target's inner classes, so we
                               depend on whatever *it* depends on and thus
                               we need to recurse. */
                            bool added = analyzer.addDep(name);
                            if (added)
                            {
                                analyzer.findDeps(name);    // Recurses here!!
                            }
                        }
                        else
                        {
                            /* It's somebody else's inner class, so we
                               depend on its outer class source file */
                            *dollar = '\0';
                            analyzer.addDep(name);
                            *dollar = '$';
                        }
                    }
                    else
                    {
                        /* It's a regular class */
                        analyzer.addDep(name);
                    }
                }
            }
        }
    }

    attribute_info* att = mAttributes;
    while (att != NULL)
    {
        const char* name = getString(att->attribute_name_index);
        if (strcmp(name, "RuntimeVisibleAnnotations") == 0)
        {
            int i;
            BytesDecoder decoder(att->info, att->attribute_length);
            int num_annotations = decoder.DecodeWord();
            for (i = 0; i < num_annotations; ++i)
                scanAnnotation(decoder, analyzer);
        }
        att = att->next;
    }
}

cp_info** ClassFile::readConstantPool(FileReader& reader, const char* filename, int count)
{
    cp_info** result = new cp_info*[count];
    int i;
    result[0] = NULL;
    for (i=1; i<count; ++i)
    {
        result[i] = readConstantPoolInfo(reader, filename);
        if (result[i] == kLongTag)
        {
            result[i] = NULL;
            result[++i] = NULL;
        }
    }
    return result;
}

cp_info* ClassFile::readConstantPoolInfo(FileReader& reader, const char* filename)
{
    uint8_t tag = reader.ReadByte();
    switch (tag)
    {
        case CONSTANT_Class:
        {
            uint16_t name_index = reader.ReadWord();
            return new constant_class_info(name_index);
        }
        case CONSTANT_Fieldref:
        {
            reader.ReadWord(); // class_index
            reader.ReadWord(); // name_and_type_index
            return NULL;
        }
        case CONSTANT_Methodref:
        {
            reader.ReadWord(); // class_index
            reader.ReadWord(); // name_and_type_index
            return NULL;
        }
        case CONSTANT_InterfaceMethodref:
        {
            reader.ReadWord(); // class_index
            reader.ReadWord(); // name_and_type_index
            return NULL;
        }
        case CONSTANT_String:
        {
            reader.ReadWord(); // string_index
            return NULL;
        }
        case CONSTANT_Integer:
        {
            reader.ReadLong(); // bytes
            return NULL;
        }
        case CONSTANT_Float:
        {
            reader.ReadLong(); // bytes
            return NULL;
        }
        case CONSTANT_Long:
        {
            reader.ReadLong(); // high_bytes
            reader.ReadLong(); // low_bytes
            return kLongTag;
        }
        case CONSTANT_Double:
        {
            reader.ReadLong(); // high_bytes
            reader.ReadLong(); // low_bytes
            return kLongTag;
        }
        case CONSTANT_NameAndType:
        {
            reader.ReadWord(); // name_index
            reader.ReadWord(); // descriptor_index
            return NULL;
        }
        case CONSTANT_Utf8:
        {
            uint16_t length = reader.ReadWord();
            char* str = (char*) reader.ReadByteArray(length);
            return new constant_utf8_info(str);
        }
        default:
        {
            fprintf(stderr, "invalid constant pool tag %d in %s\n", tag,
                    filename);
            exit(1);
        }
    }
    return NULL;
}

attribute_info* ClassFile::readFieldInfo(FileReader& reader, attribute_info* atts)
{
    reader.ReadWord(); // access_flags
    reader.ReadWord(); // name_index
    reader.ReadWord(); // descriptor_index
    uint16_t attributes_count = reader.ReadWord();
    return readAttributes(reader, attributes_count, atts);
}

attribute_info* ClassFile::readFields(FileReader& reader, int count, attribute_info* atts)
{
    int i;
    for (i=0; i<count; ++i)
        atts = readFieldInfo(reader, atts);
    return atts;
}

attribute_info* ClassFile::readMethodInfo(FileReader& reader, attribute_info* atts)
{
    reader.ReadWord(); // access_flags
    reader.ReadWord(); // name_index
    reader.ReadWord(); // descriptor_index
    uint16_t attributes_count = reader.ReadWord();
    return readAttributes(reader, attributes_count, atts);
}

attribute_info* ClassFile::readMethods(FileReader& reader, int count, attribute_info* atts)
{
    for (int i = 0; i < count; ++i)
        atts = readMethodInfo(reader, atts);
    return atts;
}

void ClassFile::skipWordArray(FileReader& reader, int length)
{
    for (int i = 0; i < length; ++i)
        reader.ReadWord();
}

const char* ClassFile::getString(int index) const
{
    cp_info* cp = mConstantPool[index];
    cp = mConstantPool[index];
    if (cp->tag == CONSTANT_Utf8)
    {
        const char* name = ((constant_utf8_info*) cp)->str;
        return name;
    }
    return NULL;
}

const char* ClassFile::getClassName(int index) const
{
    cp_info* cp = mConstantPool[index];
    if (cp == NULL)
        return NULL;
    else if (cp->tag == CONSTANT_Class)
    {
        constant_class_info* classInfo = (constant_class_info*) cp;
        return getString(classInfo->name_index);
    }
    else if (cp->tag == CONSTANT_Utf8)
    {
        char* name = ((constant_utf8_info*) cp)->str;
        if (name[0] == 'L')
        {
            char* result = strdup(name + 1);
            char* s = result;
            while (*s)
            {
                if (*s == ';')
                {
                    *s = '\0';
                    break;
                }
                ++s;
            }
            return result;
        }
    }
    return NULL;
}


text:
[![Build Status](https://travis-ci.org/sdboyer/gliph.png?branch=master)](https://travis-ci.org/sdboyer/gliph)
[![Latest Stable Version](https://poser.pugx.org/sdboyer/gliph/v/stable.png)](https://packagist.org/packages/sdboyer/gliph)
[![Coverage Status](https://coveralls.io/repos/sdboyer/gliph/badge.png?branch=master)](https://coveralls.io/r/sdboyer/gliph?branch=master)

Gliph is a graph library for PHP. It provides graph building blocks and datastructures for use by other PHP applications. It is designed for use with in-memory graphs, not for interaction with a graph database like [Cayley](https://github.com/google/cayley) or [Neo4J](http://neo4j.org/) (though it could be used to facilitate such connection).

Gliph aims for both sane interfaces and as performant an implementation as userspace PHP allows.

This does require knowing enough about graphs to know what type is appropriate for your use case, but we are aiming to provide helpers that simplify those choices.

## Quickstart

Working with gliph is easy: pick a graph implementation, then add edges and vertices as needed. ()Note that gliph currently supports only object vertices, though this limitation may be loosened in future releases)

```php
<?php

use Gliph\Graph\DirectedAdjacencyList;

class Vertex {
    public $val;

    public function __construct($val) {
        $this->val = $val;
    }
}

$vertices = array(
    'a' => new Vertex('a'),
    'b' => new Vertex('b'),
    'c' => new Vertex('c'),
    'd' => new Vertex('d'),
    'e' => new Vertex('e'),
    'f' => new Vertex('f'),
);

$g = new DirectedAdjacencyList();

foreach ($vertices as $vertex) {
    $g->ensureVertex($vertex);
}

$g->ensureArc($vertices['a'], $vertices['b']);
$g->ensureArc($vertices['b'], $vertices['c']);
$g->ensureArc($vertices['a'], $vertices['c']);
$g->ensureArc($vertices['d'], $vertices['a']);
$g->ensureArc($vertices['d'], $vertices['e']);
```

This would create the following directed graph:

![Base digraph](doc/base.dot.png)

Once your graph is created, gliph provides a number of `Traversable` mechanisms for doing work on the graph. These mechanisms are important to understand and are explored in greater detail [in the wiki](https://github.com/sdboyer/gliph/wiki/Iterators), but for those familiar with graph theory, the method naming is intended to be self-explanatory:

For directed and undirected graphs:

* `Graph::vertices()`
* `Graph::edges()`
* `Graph::adjacentTo($vertex)`
* `Graph::incidentTo($vertex)`

And for directed graphs only:

* `Digraph::successorsOf($vertex)`
* `Digraph::predecessorsOf($vertex)`
* `Digraph::arcsFrom($vertex)`
* `Digraph::arcsTo($vertex)`

## Core Concepts

Gliph has several conceptual components that work together to create a coherent library: graph implementations, algorithms, and visitors.

Gliph has several components that work together: graph classes, algorithms, and visitors. Generally speaking, Gliph is patterned after the [C++ Boost Graph Library](http://www.boost.org/libs/graph/doc); reading their documentation can yield a lot of insight into how Gliph is intended to work.

### Graphs

Gliph's most important baseline export is its assorted [graph interfaces](https://github.com/sdboyer/gliph/tree/master/src/Gliph/Graph). The other components (algorithms and visitors) rely **strictly** on the interfaces, never on concrete implementations. Consequently, users of gliph can craft case-specific implementations with the assurance that they will work with the algorithms. To assist towards that end, gliph provides phpunit testing traits that make it easy to ensure your custom graph implementations conform to both the letter and the spirit of gliph's interfaces.

Gliph's own implementations are designed to be as performant as possible for the general case. Current implementations include only adjacency lists, in both directed and undirected flavors.

### Algorithms

Gliph provides various algorithms that can be run on graph objects. These algorithms interact with the graph by making calls to methods, primarily the iterators, defined in the assorted Graph interfaces. If a graph implements the interface type-hinted by a particular algorithm, then the algorithm can run on that graph. But the efficiency of the algorithm will be largely determined by how efficiently that graph implementation can meet the requirements of the interface. Adjacency lists, for example, are not terribly efficient at providing a list of all edges in a graph, but are very good at single-vertex-centric operations.

Gliph's algorithms are typically implemented quite sparsely (especially traversers) - they seek to implement the simplest, most generic version of an algorithm. They also may not return any output, as that work is left to Visitors.

### Visitors

Most algorithms require a visitor object to be provided. The visitor conforms to an interface specified by the algorithm, and the algorithm will call the visitor at certain choice points during its execution. This allows the algorithms to stay highly generic, while visitors can be tailored to a more specific purpose.

For example, a ```DepthFirst``` visitor might be used to calculate vertex reach, or generate a topologically sorted list. Each of these are things that a depth-first graph traversal can do. But the work of doing so is left to the visitor so that only one traversal algorithm is needed, and that algorithm is as cheap (memory and cycles) as possible.

## Acknowledgements

This library draws inspiration from the [C++ Boost Graph Library](http://www.boost.org/libs/graph/doc), though has diverged in some significant design philosophies. Gliph generally follows the same patterns as [gogl](https://github.com/sdboyer/gogl), though the concepts are more rigorously applied there.

## License

MIT


text:
package com.abbcc.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.abbcc.common.PaginationSupport;
import com.abbcc.dao.AdminDAO;
import com.abbcc.dao.ModuleDAO;
import com.abbcc.models.AbcAdmin;
import com.abbcc.models.AbcModule;
import com.abbcc.service.DomainbindService;
import com.abbcc.service.ModuleService;

public class ModuleServiceImpl implements ModuleService {

	private ModuleDAO moduleDAO;

	public void setModuleDAO(ModuleDAO moduleDAO) {
		this.moduleDAO = moduleDAO;
	}

	public void save(AbcModule transientInstance) {
		moduleDAO.save(transientInstance);
	}

	public void delete(AbcModule persistentInstance) {

	}

	public AbcModule findById(String id) {
		return moduleDAO.findById(id);
	}

	public List<AbcModule> findByExample(AbcModule instance) {
		return moduleDAO.findByExample(instance);

	}

	public List<AbcModule> findAll() {
		return moduleDAO.findAll();

	}

	public void saveOrUpdate(AbcModule instance) {
		moduleDAO.saveOrUpdate(instance);

	}

	public PaginationSupport findPageByCriteria(
			DetachedCriteria detachedCriteria) {
		return moduleDAO.findPageByCriteria(detachedCriteria);
	}

	public PaginationSupport findPageByCriteria(
			DetachedCriteria detachedCriteria, int startIndex) {
		return moduleDAO.findPageByCriteria(detachedCriteria, startIndex);

	}

	public PaginationSupport findPageByCriteria(
			DetachedCriteria detachedCriteria, int pageSize, int startIndex) {
		return moduleDAO.findPageByCriteria(detachedCriteria, pageSize,
				startIndex);
	}

	public List findAllByCriteria(DetachedCriteria detachedCriteria) {
		return moduleDAO.findAllByCriteria(detachedCriteria);

	}

	public int getCountByCriteria(DetachedCriteria detachedCriteria) {
		return moduleDAO.getCountByCriteria(detachedCriteria);

	}

	public void callProcedure(String procString, List<Object> params)
			throws Exception {
		moduleDAO.callProcedure(procString, params);
	}

	public List getCallProcedureResult(String procString, List<Object> params)
			throws Exception {
		return moduleDAO.getCallProcedureResult(procString, params);
	}

}


text:
function logFullName() {
    'use strict';
    var sName = 'John';
    sSurname = 'Doe'; // Sets a global value.

    console.log(sName + ' ' + sSurname);
}

// Throws "ReferenceError: sSurname is not defined"
logFullName();


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

import java.util.function.Supplier;

import static java.util.Objects.requireNonNull;

public interface TrackingLookupSourceSupplier
{
    LookupSource getLookupSource();

    OuterPositionIterator getOuterPositionIterator();

    static TrackingLookupSourceSupplier nonTracking(Supplier<LookupSource> lookupSourceSupplier)
    {
        requireNonNull(lookupSourceSupplier, "lookupSourceSupplier is null");
        return new TrackingLookupSourceSupplier()
        {
            @Override
            public LookupSource getLookupSource()
            {
                return lookupSourceSupplier.get();
            }

            @Override
            public OuterPositionIterator getOuterPositionIterator()
            {
                throw new UnsupportedOperationException();
            }
        };
    }
}


text:
<?php

namespace Propel\Generator\Manager;

use Propel\Generator\Exception\InvalidArgumentException;
use Propel\Generator\Model\Column;
use Propel\Generator\Model\Database;
use Propel\Generator\Model\Table;
use Propel\Generator\Platform\PlatformInterface;
use Propel\Generator\Util\SqlParser;
use Propel\Runtime\Adapter\AdapterFactory;
use Propel\Runtime\Connection\ConnectionFactory;
use Propel\Runtime\Connection\ConnectionInterface;

/**
 * Service class for preparing and executing migrations
 *
 * @author François Zaninotto
 */
class MigrationManager extends AbstractManager
{
    /**
     * @var array
     */
    protected $connections = [];

    /**
     * @var ConnectionInterface[]
     */
    protected $adapterConnections = [];

    /**
     * @var string
     */
    protected $migrationTable;

    /**
     * Set the database connection settings
     *
     * @param array $connections
     */
    public function setConnections($connections)
    {
        $this->connections = $connections;
    }

    /**
     * Get the database connection settings
     *
     * @return array
     */
    public function getConnections()
    {
        return $this->connections;
    }

    public function getConnection($datasource)
    {
        if (!isset($this->connections[$datasource])) {
            throw new InvalidArgumentException(sprintf('Unknown datasource "%s"', $datasource));
        }

        return $this->connections[$datasource];
    }

    /**
     * @param $datasource
     * @return ConnectionInterface
     */
    public function getAdapterConnection($datasource)
    {
        if (!isset($this->adapterConnections[$datasource])) {
            $buildConnection = $this->getConnection($datasource);
            $conn = ConnectionFactory::create($buildConnection, AdapterFactory::create($buildConnection['adapter']));
            $this->adapterConnections[$datasource] = $conn;
        }

        return $this->adapterConnections[$datasource];
    }

    /**
     * @param  string            $datasource
     * @return PlatformInterface
     */
    public function getPlatform($datasource)
    {
        $params  = $this->getConnection($datasource);
        $adapter = $params['adapter'];

        $class = '\\Propel\\Generator\\Platform\\' . ucfirst($adapter) . 'Platform';

        return new $class();
    }

    /**
     * Set the migration table name
     *
     * @param string $migrationTable
     */
    public function setMigrationTable($migrationTable)
    {
        $this->migrationTable = $migrationTable;
    }

    /**
     * get the migration table name
     *
     * @return string
     */
    public function getMigrationTable()
    {
        return $this->migrationTable;
    }

    public function getAllDatabaseVersions()
    {
        $connections = $this->getConnections();
        if (!$connections) {
            throw new \Exception('You must define database connection settings in a buildtime-conf.xml file to use migrations');
        }

        $migrationTimestamps = [];
        foreach ($connections as $name => $params) {
            $conn = $this->getAdapterConnection($name);
            $platform = $this->getGeneratorConfig()->getConfiguredPlatform($conn);
            if (!$platform->supportsMigrations()) {
                continue;
            }

            $sql = sprintf('SELECT version FROM %s', $this->getMigrationTable());

            try {
                $stmt = $conn->prepare($sql);
                $stmt->execute();

                while ($migrationTimestamp = $stmt->fetchColumn()) {
                    $migrationTimestamps[] = $migrationTimestamp;
                }
            } catch (\PDOException $e) {
                $this->createMigrationTable($name);
                $migrationTimestamps = [];
            }
        }

        sort($migrationTimestamps);

        return $migrationTimestamps;
    }

    public function migrationTableExists($datasource)
    {
        $conn = $this->getAdapterConnection($datasource);
        $sql = sprintf('SELECT version FROM %s', $this->getMigrationTable());
        try {
            $stmt = $conn->prepare($sql);
            $stmt->execute();

            return true;
        } catch (\PDOException $e) {
            return false;
        }
    }

    public function createMigrationTable($datasource)
    {
        $platform = $this->getPlatform($datasource);
        // modelize the table
        $database = new Database($datasource);
        $database->setPlatform($platform);

        $table = new Table($this->getMigrationTable());
        $database->addTable($table);

        $column = new Column('version');
        $column->getDomain()->copy($platform->getDomainForType('INTEGER'));
        $column->setDefaultValue(0);

        $table->addColumn($column);
        // insert the table into the database
        $statements = $platform->getAddTableDDL($table);
        $conn = $this->getAdapterConnection($datasource);
        $res = SqlParser::executeString($statements, $conn);

        if (!$res) {
            throw new \Exception(sprintf('Unable to create migration table in datasource "%s"', $datasource));
        }
    }

    public function removeMigrationTimestamp($datasource, $timestamp)
    {
        $platform = $this->getPlatform($datasource);
        $conn = $this->getAdapterConnection($datasource);
        $conn->transaction(function () use ($conn, $platform, $timestamp) {
            $sql = sprintf('DELETE FROM %s WHERE %s = ?',
                $this->getMigrationTable(),
                $platform->doQuoting('version')
            );
            $stmt = $conn->prepare($sql);
            $stmt->bindParam(1, $timestamp, \PDO::PARAM_INT);
            $stmt->execute();
        });
    }

    public function updateLatestMigrationTimestamp($datasource, $timestamp)
    {
        $platform = $this->getPlatform($datasource);
        $conn = $this->getAdapterConnection($datasource);
        $sql = sprintf('INSERT INTO %s (%s) VALUES (?)',
            $this->getMigrationTable(),
            $platform->doQuoting('version')
        );
        $stmt = $conn->prepare($sql);
        $stmt->bindParam(1, $timestamp, \PDO::PARAM_INT);
        $stmt->execute();
    }

    public function getMigrationTimestamps()
    {
        $path = $this->getWorkingDirectory();
        $migrationTimestamps = [];

        if (is_dir($path)) {
            $files = scandir($path);
            foreach ($files as $file) {
                if (preg_match('/^PropelMigration_(\d+).*\.php$/', $file, $matches)) {
                    $migrationTimestamps[] = (integer) $matches[1];
                }
            }
        }

        return $migrationTimestamps;
    }

    public function getValidMigrationTimestamps()
    {
        $migrationTimestamps = array_diff($this->getMigrationTimestamps(), $this->getAllDatabaseVersions());
        sort($migrationTimestamps);

        return $migrationTimestamps;
    }

    public function hasPendingMigrations()
    {
        return [] !== $this->getValidMigrationTimestamps();
    }

    public function getAlreadyExecutedMigrationTimestamps()
    {
        $migrationTimestamps = array_intersect($this->getMigrationTimestamps(), $this->getAllDatabaseVersions());
        sort($migrationTimestamps);

        return $migrationTimestamps;
    }

    public function getFirstUpMigrationTimestamp()
    {
        $validTimestamps = $this->getValidMigrationTimestamps();

        return array_shift($validTimestamps);
    }

    public function getFirstDownMigrationTimestamp()
    {
        return $this->getOldestDatabaseVersion();
    }

    public function getMigrationClassName($timestamp, $suffix = "")
    {
        $className = sprintf('PropelMigration_%d', $timestamp);
        if ($suffix === "") {
            $suffix = $this->findMigrationClassNameSuffix($timestamp);
        }
        if ($suffix !== "") {
            $className .= '_' . $suffix;
        }
        return $className;
    }

    public function findMigrationClassNameSuffix($timestamp) {
        $suffix = "";
        $path = $this->getWorkingDirectory();
        if (is_dir($path)) {
            $files = scandir($path);
            foreach ($files as $file) {
                if (preg_match('/^PropelMigration_'.$timestamp.'(_)?(.*)\.php$/', $file, $matches)) {
                    $suffix = (string) $matches[2];
                }
            }
        }
        return $suffix;
    }

    public function getMigrationObject($timestamp)
    {
        $className = $this->getMigrationClassName($timestamp);
        require_once sprintf('%s/%s.php',
            $this->getWorkingDirectory(),
            $className
        );

        return new $className();
    }

    public function getMigrationClassBody($migrationsUp, $migrationsDown, $timestamp, $comment = "", $suffix = "")
    {
        $timeInWords = date('Y-m-d H:i:s', $timestamp);
        $migrationAuthor = ($author = $this->getUser()) ? 'by ' . $author : '';
        $migrationClassName = $this->getMigrationClassName($timestamp, $suffix);
        $migrationUpString = var_export($migrationsUp, true);
        $migrationDownString = var_export($migrationsDown, true);
        $commentString = var_export($comment, true);
        $migrationClassBody = <<<EOP
<?php

use Propel\Generator\Manager\MigrationManager;

/**
 * Data object containing the SQL and PHP code to migrate the database
 * up to version $timestamp.
 * Generated on $timeInWords $migrationAuthor
 */
class $migrationClassName
{
    public \$comment = $commentString;

    public function preUp(MigrationManager \$manager)
    {
        // add the pre-migration code here
    }

    public function postUp(MigrationManager \$manager)
    {
        // add the post-migration code here
    }

    public function preDown(MigrationManager \$manager)
    {
        // add the pre-migration code here
    }

    public function postDown(MigrationManager \$manager)
    {
        // add the post-migration code here
    }

    /**
     * Get the SQL statements for the Up migration
     *
     * @return array list of the SQL strings to execute for the Up migration
     *               the keys being the datasources
     */
    public function getUpSQL()
    {
        return $migrationUpString;
    }

    /**
     * Get the SQL statements for the Down migration
     *
     * @return array list of the SQL strings to execute for the Down migration
     *               the keys being the datasources
     */
    public function getDownSQL()
    {
        return $migrationDownString;
    }

}
EOP;

        return $migrationClassBody;
    }

    public function getMigrationFileName($timestamp, $suffix = "")
    {
        return sprintf('%s.php', $this->getMigrationClassName($timestamp, $suffix));
    }

    public static function getUser()
    {
        if (function_exists('posix_getuid')) {
            $currentUser = posix_getpwuid(posix_getuid());
            if (isset($currentUser['name'])) {
                return $currentUser['name'];
            }
        }

        return '';
    }

    public function getOldestDatabaseVersion()
    {
        $versions = $this->getAllDatabaseVersions();

        return array_pop($versions);
    }
}


text:
/* @file  : cmsis_nvic_virtual.h
 * @brief : NVIC functions list
 * @date  : December 2019
 * @note  : List of NVIC macro and customize TFM interrupt
 */

#include "cmsis.h"

#ifndef NVIC_VIRTUAL_H
#define NVIC_VIRTUAL_H

#ifdef __cplusplus
extern "C" {
#endif

#include "s5js100_type.h"

/* NVIC functions */
#define NVIC_SetPriorityGrouping    __NVIC_SetPriorityGrouping
#define NVIC_GetPriorityGrouping    __NVIC_GetPriorityGrouping
#define NVIC_EnableIRQ              __NVIC_EnableIRQ
#define NVIC_GetEnableIRQ           __NVIC_GetEnableIRQ
#define NVIC_DisableIRQ             __NVIC_DisableIRQ
#define NVIC_GetPendingIRQ          __NVIC_GetPendingIRQ
#define NVIC_SetPendingIRQ          __NVIC_SetPendingIRQ
#define NVIC_ClearPendingIRQ        __NVIC_ClearPendingIRQ
#define NVIC_GetActive              __NVIC_GetActive
#define NVIC_SetPriority            __NVIC_SetPriority
#define NVIC_GetPriority            __NVIC_GetPriority
#define NVIC_SystemReset            __NVIC_TFMSystemReset

/**
 * \brief Overriding the default CMSIS system reset implementation by calling
 *        secure TFM service.
 *
 */
__NO_RETURN __STATIC_INLINE void __NVIC_TFMSystemReset(void)
{
    putreg32(0x1, 0x8301100C);
    putreg32(0x1 << 1, 0x82020018);

    putreg32(0x4, 0x83011000); // enable watchdog
    putreg32(0x1, 0x83011010);
    putreg32(0x1, 0x83011020);
    putreg32(327, 0x83011004);  //set 10ms to be reset , 1 sec=32768
    putreg32(0xFF, 0x83011008); // force to load value to be reset

    /* Wait for the reset */
    for (;;) {
    }
}

#ifdef __cplusplus
}
#endif

#endif


text:
@import Foundation;

typedef NS_ENUM(int, DirectionValue) {
  DirectionValueNorth = 0,
  DirectionValueEast,
  DirectionValueSouth,
  DirectionValueWest
};

static const int NumberOfDirections = 4;

@interface Direction : NSObject

@property (nonatomic, readonly) DirectionValue code;
@property (nonatomic, readonly) int x;
@property (nonatomic, readonly) int y;

+ (instancetype)direction:(DirectionValue)direction x:(int)x y:(int)y;
+ (instancetype)directionFromValue:(DirectionValue)direction;

+ (instancetype)oppositeDirectionTo:(Direction *)other;

@end


text:
package dataAccessLayer;

public class Member {
	private int ID;
	private String name;
	private String address;
	private String suburb;
	private String state;
	private String postCode;
	private int spouseID;
	private String homePhone;
	private String mobilePhone;

	public Member(int aID, String aName, String aAddress, String aSuburb,
			String aState, String aPostCode, int aSpouseID, String aHomePhone,
			String aMobilePhone) {
		ID = aID;
		name = aName;
		address = aAddress;
		suburb = aSuburb;
		state = aState;
		postCode = aPostCode;
		spouseID = aSpouseID;
		homePhone = aHomePhone;
		mobilePhone = aMobilePhone;
	}

	public int getID() {
		return ID;
	}

	public void setID(int iD) {
		ID = iD;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getSuburb() {
		return suburb;
	}

	public void setSuburb(String suburb) {
		this.suburb = suburb;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getPostCode() {
		return postCode;
	}

	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}

	public int getSpouseID() {
		return spouseID;
	}

	public void setSpouseID(int spouseID) {
		this.spouseID = spouseID;
	}

	public String getHomePhone() {
		return homePhone;
	}

	public void setHomePhone(String homePhone) {
		this.homePhone = homePhone;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}
}


text:
package io.druid.segment.column;

import io.druid.collections.bitmap.ImmutableBitmap;
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
import io.druid.segment.ColumnValueSelector;
import io.druid.segment.IndexIO;
import io.druid.segment.data.ColumnarDoubles;
import io.druid.segment.data.ReadableOffset;

/**
 */
public class DoublesColumn implements GenericColumn
{
  /**
   * Factory method to create DoublesColumn.
   */
  public static DoublesColumn create(ColumnarDoubles column, ImmutableBitmap nullValueBitmap)
  {
    if (nullValueBitmap.isEmpty()) {
      return new DoublesColumn(column);
    } else {
      return new DoublesColumnWithNulls(column, nullValueBitmap);
    }
  }

  final ColumnarDoubles column;

  DoublesColumn(ColumnarDoubles columnarDoubles)
  {
    column = columnarDoubles;
  }

  @Override
  public int length()
  {
    return column.size();
  }

  @Override
  public ColumnValueSelector makeColumnValueSelector(ReadableOffset offset)
  {
    return column.makeColumnValueSelector(offset, IndexIO.LEGACY_FACTORY.getBitmapFactory().makeEmptyImmutableBitmap());
  }

  @Override
  public long getLongSingleValueRow(int rowNum)
  {
    return (long) column.get(rowNum);
  }

  @Override
  public void close()
  {
    column.close();
  }

  @Override
  public void inspectRuntimeShape(RuntimeShapeInspector inspector)
  {
    inspector.visit("column", column);
  }
}


text:
[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/agents/sarsa.py#L17)
### SARSAAgent

```python
rl.agents.sarsa.SARSAAgent(model, nb_actions, policy=None, test_policy=None, gamma=0.99, nb_steps_warmup=10, train_interval=1, delta_clip=inf)
```

Write me

---

### References
- [Reinforcement learning: An introduction](http://incompleteideas.net/book/the-book-2nd.html), Sutton and Barto, 2018.


text:
require 'spec_helper'

describe WelcomeController do
  let(:user) { FactoryBot.create(:user) }

  describe "GET 'help'" do
    context "When not logged in" do
      it "returns http success" do
        get :help
        expect(response).to be_successful

        assert_match(/Help/, response.body)
      end
    end

    context "when logged in" do
      before { sign_in user }

      it "returns http success" do
        get :help
        expect(response).to be_successful

        assert_match(/Help/, response.body)
      end
    end
  end

  describe "GET changelog" do
    it "returns http success" do
      get :changelog
      expect(response).to be_successful
    end
  end

  describe "GET help_translate" do
    it "returns http success" do
      get :help_translate
      expect(response).to be_successful
    end
  end

  describe "GET index" do
    describe "when there is a 'Home' page" do
      let!(:home_page) { FactoryBot.create(:page, :home) }

      it "redirects to homepage" do
        get :index
        expect(response).to redirect_to(page_path(home_page.slug))
      end
    end

    describe "when there is no 'Home' page" do
      it "redirects to log_in page" do
        get :index
        expect(response).to redirect_to(new_user_session_path)
      end
    end
  end

  # handle case where a machine queries for a non-locale
  describe "GET 'humans.txt'" do
    it "returns 404-not-found" do
      sign_in user
      expect do
        get :index, params: { locale: 'humans' }, format: 'txt'
      end.to raise_error(ActiveRecord::RecordNotFound)
    end
  end
end


text:
from oslotest import base as test_base

from oslo_config import cfg

from ironic_lib import exception
from ironic_lib import metrics as metricslib
from ironic_lib import metrics_statsd
from ironic_lib import metrics_utils

CONF = cfg.CONF

class TestGetLogger(test_base.BaseTestCase):
    def setUp(self):
        super(TestGetLogger, self).setUp()

    def test_default_backend(self):
        metrics = metrics_utils.get_metrics_logger('foo')
        self.assertIsInstance(metrics, metricslib.NoopMetricLogger)

    def test_statsd_backend(self):
        CONF.set_override('backend', 'statsd', group='metrics')

        metrics = metrics_utils.get_metrics_logger('foo')
        self.assertIsInstance(metrics, metrics_statsd.StatsdMetricLogger)
        CONF.clear_override('backend', group='metrics')

    def test_nonexisting_backend(self):
        CONF.set_override('backend', 'none', group='metrics')

        self.assertRaises(exception.InvalidMetricConfig,
                          metrics_utils.get_metrics_logger, 'foo')
        CONF.clear_override('backend', group='metrics')

    def test_numeric_prefix(self):
        self.assertRaises(exception.InvalidMetricConfig,
                          metrics_utils.get_metrics_logger, 1)

    def test_numeric_list_prefix(self):
        self.assertRaises(exception.InvalidMetricConfig,
                          metrics_utils.get_metrics_logger, (1, 2))

    def test_default_prefix(self):
        metrics = metrics_utils.get_metrics_logger()
        self.assertIsInstance(metrics, metricslib.NoopMetricLogger)
        self.assertEqual(metrics.get_metric_name("bar"), "bar")

    def test_prepend_host_backend(self):
        CONF.set_override('prepend_host', True, group='metrics')
        CONF.set_override('prepend_host_reverse', False, group='metrics')

        metrics = metrics_utils.get_metrics_logger(prefix='foo',
                                                   host="host.example.com")
        self.assertIsInstance(metrics, metricslib.NoopMetricLogger)
        self.assertEqual(metrics.get_metric_name("bar"),
                         "host.example.com.foo.bar")

        CONF.clear_override('prepend_host', group='metrics')
        CONF.clear_override('prepend_host_reverse', group='metrics')

    def test_prepend_global_prefix_host_backend(self):
        CONF.set_override('prepend_host', True, group='metrics')
        CONF.set_override('prepend_host_reverse', False, group='metrics')
        CONF.set_override('global_prefix', 'global_pre', group='metrics')

        metrics = metrics_utils.get_metrics_logger(prefix='foo',
                                                   host="host.example.com")
        self.assertIsInstance(metrics, metricslib.NoopMetricLogger)
        self.assertEqual(metrics.get_metric_name("bar"),
                         "global_pre.host.example.com.foo.bar")

        CONF.clear_override('prepend_host', group='metrics')
        CONF.clear_override('prepend_host_reverse', group='metrics')
        CONF.clear_override('global_prefix', group='metrics')

    def test_prepend_other_delim(self):
        metrics = metrics_utils.get_metrics_logger('foo', delimiter='*')
        self.assertIsInstance(metrics, metricslib.NoopMetricLogger)
        self.assertEqual(metrics.get_metric_name("bar"),
                         "foo*bar")

    def test_prepend_host_reverse_backend(self):
        CONF.set_override('prepend_host', True, group='metrics')
        CONF.set_override('prepend_host_reverse', True, group='metrics')

        metrics = metrics_utils.get_metrics_logger('foo',
                                                   host="host.example.com")
        self.assertIsInstance(metrics, metricslib.NoopMetricLogger)
        self.assertEqual(metrics.get_metric_name("bar"),
                         "com.example.host.foo.bar")

        CONF.clear_override('prepend_host', group='metrics')
        CONF.clear_override('prepend_host_reverse', group='metrics')


text:
var gulp = require('gulp');
var gulpNodeBuildTasks = require('gulp-node-build-tasks');

var config = {};

gulpNodeBuildTasks.apply(config, gulp);


text:
<?php

namespace Mcf\PhpJobQueue\Storage;

use Mcf\PhpJobQueue\Job\JobInterface;
use Mcf\PhpJobQueue\Worker\AbstractWorker;
use Mcf\PhpJobQueue\Worker\TraceInfo;

/**
 * Interface that defines the methods a storage class must expose
 */
interface StorageInterface
{
    /**
     * Returns a storage key from the id.
     *
     * @param string $id
     * @return string
     */
    public static function idToKey($id);

    /**
     * Get a job object from an ID
     *
     * @throws \Mcf\PhpJobQueue\Exception\JobNotFoundException
     * @throws \Mcf\PhpJobQueue\Exception\JobCorruptException
     *
     * @return Job
     */
    public function getJob($id);

    /**
     * Notifies the database that a job has been started.
     * The database should record the time this occurred.
     *
     * @param Job $job
     */
    public function jobStarted(JobInterface $job);

    /**
     * Notifies the database that a job completed successfully.
     * The database should record the time this occurred.
     *
     * @param Job $job
     */
    public function jobCompleted(JobInterface $job);

    /**
     * Notifies the database that a job failed with an exception or error message
     *
     * @param Job $job
     * @param mixed $error Error message or typically an exception
     */
    public function jobFailed(JobInterface $job, $error);

    /**
     * Find a job by job ID
     *
     * @param string
     * @return Job $job
     */
    public function findJob($id);

    # workers: pid, status, current job

    /**
     * Updates the database with the status, pid and current job (if working),
     * time started and worked count.
     *
     * @param AbstractWorker $worker
     */
    public function traceWorkerStatus(AbstractWorker $worker);

    /**
     * Remove from the database the tracking information for a worker
     *
     * @param AbstractWorker $worker
     */
    public function workerTerminated(AbstractWorker $worker);

    /**
     * Gets all the trace information of the workers
     *
     * @return TraceInfo[]
     */
    public function getWorkersTraceInfo();
}


text:
package org.qi4j.bootstrap;

import org.qi4j.api.composite.TransientComposite;

/**
 * This represents the assembly information of a single TransientComposite in a Module.
 */
public interface TransientAssembly
    extends TypeAssembly
{
}


text:
#include <stdint.h>
#include <string>

#include "gtest/gtest.h"
#include "utils/shared_ptr.h"
#include "smart_objects/smart_object.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/application.h"
#include "commands/commands_test.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/commands/hmi/vr_get_supported_languages_response.h"
#include "application_manager/policies/mock_policy_handler_interface.h"

namespace test {
namespace components {
namespace commands_test {
namespace hmi_commands_test {
namespace vr_get_supported_languages_response {

using ::testing::Return;
using ::utils::SharedPtr;
using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
using am::commands::VRGetSupportedLanguagesResponse;

typedef SharedPtr<VRGetSupportedLanguagesResponse>
    VRGetSupportedLanguagesResponsePtr;
typedef NiceMock<
    ::test::components::application_manager_test::MockHMICapabilities>
    MockHMICapabilities;

namespace {
const uint32_t kConnectionKey = 2u;
const std::string kStringNum = "123";
const std::string kLanguage = "EN_US";
const smart_objects::SmartObject supported_languages(kLanguage);
}  // namespace

class VRGetSupportedLanguagesResponseTest
    : public CommandsTest<CommandsTestMocks::kIsNice> {
 public:
  MockHMICapabilities mock_hmi_capabilities_;
  SmartObject capabilities_;
};

TEST_F(VRGetSupportedLanguagesResponseTest, RUN_SUCCESS) {
  MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
  (*command_msg)[strings::msg_params][strings::number] = kStringNum;
  (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
  (*command_msg)[strings::params][hmi_response::code] =
      hmi_apis::Common_Result::SUCCESS;
  (*command_msg)[strings::msg_params][hmi_response::capabilities] =
      (capabilities_);
  (*command_msg)[strings::msg_params][hmi_response::languages] =
      supported_languages;

  VRGetSupportedLanguagesResponsePtr command(
      CreateCommand<VRGetSupportedLanguagesResponse>(command_msg));

  EXPECT_CALL(app_mngr_, hmi_capabilities())
      .WillOnce(ReturnRef(mock_hmi_capabilities_));

  EXPECT_CALL(mock_hmi_capabilities_,
              set_vr_supported_languages((supported_languages)));

  command->Run();
}
TEST_F(VRGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
  MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
  (*command_msg)[strings::msg_params][strings::number] = kStringNum;
  (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
  (*command_msg)[strings::params][hmi_response::code] =
      hmi_apis::Common_Result::WRONG_LANGUAGE;
  (*command_msg)[strings::msg_params][hmi_response::capabilities] =
      (capabilities_);

  VRGetSupportedLanguagesResponsePtr command(
      CreateCommand<VRGetSupportedLanguagesResponse>(command_msg));

  EXPECT_CALL(mock_hmi_capabilities_,
              set_vr_supported_languages(supported_languages)).Times(0);

  command->Run();

  EXPECT_FALSE((*command_msg)[am::strings::msg_params].keyExists(
      am::hmi_response::languages));
}

}  // namespace vr_get_supported_languages_response
}  // namespace hmi_commands_test
}  // namespace commands_test
}  // namespace components
}  // namespace test


text:
David M.

    	<input type="password" class="md-input text-center">
    	Your Password

    	Unlock


text:
import signal
from argparse import ArgumentParser, Namespace
from pathlib import Path
from time import monotonic_ns
from typing import Optional
from unittest.mock import Mock

import pytest

from vedro import Scenario
from vedro.core import AggregatedResult, Dispatcher, ScenarioResult, VirtualScenario
from vedro.events import ArgParsedEvent, ArgParseEvent, ScenarioReportedEvent
from vedro.plugins.interrupter import Interrupter, InterrupterPlugin

HANDLE_SIGNAL = signal.SIGTERM

@pytest.fixture()
def dispatcher() -> Dispatcher:
    return Dispatcher()

@pytest.fixture()
def interrupter(dispatcher: Dispatcher) -> InterrupterPlugin:
    class _Interrupter(Interrupter):
        handle_signals = (HANDLE_SIGNAL,)

    interrupter = InterrupterPlugin(_Interrupter)
    interrupter.subscribe(dispatcher)
    return interrupter

@pytest.fixture()
def sig_handler_():
    orig_handler = signal.getsignal(HANDLE_SIGNAL)

    handler_ = Mock()
    signal.signal(HANDLE_SIGNAL, handler_)

    yield handler_

    signal.signal(HANDLE_SIGNAL, orig_handler)

def make_vscenario() -> VirtualScenario:
    class _Scenario(Scenario):
        __file__ = Path(f"scenario_{monotonic_ns()}.py").absolute()

    return VirtualScenario(_Scenario, steps=[])

def make_scenario_result() -> ScenarioResult:
    return ScenarioResult(make_vscenario())

def make_aggregated_result(scenario_result: Optional[ScenarioResult] = None) -> AggregatedResult:
    if scenario_result is None:
        scenario_result = make_scenario_result()
    return AggregatedResult.from_existing(scenario_result, [scenario_result])

async def fire_arg_parsed_event(dispatcher: Dispatcher, fail_fast: Optional[bool] = None) -> None:
    arg_parse_event = ArgParseEvent(ArgumentParser())
    await dispatcher.fire(arg_parse_event)

    arg_parsed_event = ArgParsedEvent(Namespace(fail_fast=fail_fast))
    await dispatcher.fire(arg_parsed_event)

async def fire_scenario_reported_event(dispatcher: Dispatcher,
                                       aggregated_result: AggregatedResult) -> None:
    scenario_reported_event = ScenarioReportedEvent(aggregated_result)
    await dispatcher.fire(scenario_reported_event)


text:
<?php

namespace TeamNeusta\Magedev\Test\Commands\Docker;

use Mockery as m;
use TeamNeusta\Magedev\Commands\Docker\RestartCommand;

/**
 * Class: RestartCommandTest.
 *
 * @see \PHPUnit_Framework_TestCase
 */
class RestartCommandTest extends \TeamNeusta\Magedev\Test\TestCase
{
    public function testExecute()
    {
        $input = m::mock('\Symfony\Component\Console\Input\InputInterface');
        $output = m::mock('\Symfony\Component\Console\Output\ConsoleOutput[]', ['writeln']);

        $command = m::mock('\Symfony\Component\Console\Command\Command')->shouldAllowMockingProtectedMethods();
        $command->shouldReceive('execute')->times(2);

        $application = m::mock('\Symfony\Component\Console\Application');
        $application->shouldReceive('find')->with('docker:stop')->andReturn($command);
        $application->shouldReceive('find')->with('docker:start')->andReturn($command);

        $command = m::mock(
            RestartCommand::class,
            [
                'getApplication' => $application,
            ]
        );
        $command->execute($input, $output);
    }
}


text:
namespace mojo {
namespace {

// Note: MSVS is very strict (and arguably buggy) about warnings for classes
// defined in a local scope, so define these globally.
struct TestOverrideBaseClass {
  virtual ~TestOverrideBaseClass() {}
  virtual void ToBeOverridden() {}
  virtual void AlsoToBeOverridden() = 0;
};

struct TestOverrideSubclass : public TestOverrideBaseClass {
  ~TestOverrideSubclass() override {}
  void ToBeOverridden() override {}
  void AlsoToBeOverridden() override {}
};

TEST(MacrosCppTest, Override) {
  TestOverrideSubclass x;
  x.ToBeOverridden();
  x.AlsoToBeOverridden();
}

// Note: MSVS is very strict (and arguably buggy) about warnings for classes
// defined in a local scope, so define these globally.
class TestDisallowCopyAndAssignClass {
 public:
  TestDisallowCopyAndAssignClass() {}
  explicit TestDisallowCopyAndAssignClass(int) {}
  void NoOp() {}

 private:
  MOJO_DISALLOW_COPY_AND_ASSIGN(TestDisallowCopyAndAssignClass);
};

TEST(MacrosCppTest, DisallowCopyAndAssign) {
  TestDisallowCopyAndAssignClass x;
  x.NoOp();
  TestDisallowCopyAndAssignClass y(789);
  y.NoOp();
}

// Test that |MOJO_ARRAYSIZE()| works in a |static_assert()|.
const int kGlobalArray[5] = {1, 2, 3, 4, 5};
static_assert(MOJO_ARRAYSIZE(kGlobalArray) == 5u,
              "MOJO_ARRAY_SIZE() failed in static_assert()");

TEST(MacrosCppTest, ArraySize) {
  double local_array[4] = {6.7, 7.8, 8.9, 9.0};
  // MSVS considers this local variable unused since MOJO_ARRAYSIZE only takes
  // the size of the type of the local and not the values itself.
  MOJO_ALLOW_UNUSED_LOCAL(local_array);
  EXPECT_EQ(4u, MOJO_ARRAYSIZE(local_array));
}

// Note: MSVS is very strict (and arguably buggy) about warnings for classes
// defined in a local scope, so define these globally.
class MoveOnlyInt {
  MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyInt, RValue)

 public:
  MoveOnlyInt() : is_set_(false), value_() {}
  explicit MoveOnlyInt(int value) : is_set_(true), value_(value) {}
  ~MoveOnlyInt() {}

  // Move-only constructor and operator=.
  MoveOnlyInt(RValue other) { *this = other; }
  MoveOnlyInt& operator=(RValue other) {
    if (other.object != this) {
      is_set_ = other.object->is_set_;
      value_ = other.object->value_;
      other.object->is_set_ = false;
    }
    return *this;
  }

  int value() const {
    assert(is_set());
    return value_;
  }
  bool is_set() const { return is_set_; }

 private:
  bool is_set_;
  int value_;
};

TEST(MacrosCppTest, MoveOnlyTypeForCpp03) {
  MoveOnlyInt x(123);
  EXPECT_TRUE(x.is_set());
  EXPECT_EQ(123, x.value());
  MoveOnlyInt y;
  EXPECT_FALSE(y.is_set());
  y = x.Pass();
  EXPECT_FALSE(x.is_set());
  EXPECT_TRUE(y.is_set());
  EXPECT_EQ(123, y.value());
  MoveOnlyInt z(y.Pass());
  EXPECT_FALSE(y.is_set());
  EXPECT_TRUE(z.is_set());
  EXPECT_EQ(123, z.value());
  z = z.Pass();
  EXPECT_TRUE(z.is_set());
  EXPECT_EQ(123, z.value());
}

}  // namespace
}  // namespace mojo


text:
#include "cppunit/thread.h"
#include "queue/queue_type.h"
#include "queue/queue_defs.h"

// Multi-threaded queue test for pop operation
namespace queue {

#define TEST_CASE( Q, V )       void Q() { test< Types<V>::Q >(); }
#define TEST_BOUNDED( Q, V )    void Q() { test_bounded< Types<V>::Q >(); }
#define TEST_SEGMENTED( Q, V )  void Q() { test_segmented< Types<V>::Q >(); }

    namespace ns_Queue_Pop {
        static size_t s_nThreadCount = 8;
        static size_t s_nQueueSize = 20000000 ;   // no more than 20 million records

        struct SimpleValue {
            size_t    nNo;

            SimpleValue(): nNo(0) {}
            SimpleValue( size_t n ): nNo(n) {}
            size_t getNo() const { return  nNo; }
        };
    }
    using namespace ns_Queue_Pop;

    class Queue_Pop: public CppUnitMini::TestCase
    {
        template <class Queue>
        class Thread: public CppUnitMini::TestThread
        {
            virtual TestThread *    clone()
            {
                return new Thread( *this );
            }
        public:
            Queue&              m_Queue;
            double              m_fTime;
            long *              m_arr;
            size_t              m_nPopCount;

        public:
            Thread( CppUnitMini::ThreadPool& pool, Queue& q )
                : CppUnitMini::TestThread( pool )
                , m_Queue( q )
            {
                m_arr = new long[s_nQueueSize];
            }
            Thread( Thread& src )
                : CppUnitMini::TestThread( src )
                , m_Queue( src.m_Queue )
            {
                m_arr = new long[s_nQueueSize];
            }
            ~Thread()
            {
                delete [] m_arr;
            }

            Queue_Pop&  getTest()
            {
                return reinterpret_cast<Queue_Pop&>( m_Pool.m_Test );
            }

            virtual void init()
            {
                cds::threading::Manager::attachThread();
                memset(m_arr, 0, sizeof(m_arr[0]) * s_nQueueSize );
            }
            virtual void fini()
            {
                cds::threading::Manager::detachThread();
            }

            virtual void test()
            {
                m_fTime = m_Timer.duration();

                typedef typename Queue::value_type value_type;
                value_type value = value_type();
                size_t nPopCount = 0;
                while ( m_Queue.pop( value ) ) {
                    ++m_arr[ value.getNo() ];
                    ++nPopCount;
                }
                m_nPopCount = nPopCount;

                m_fTime = m_Timer.duration() - m_fTime;
            }
        };

    protected:

        template <class Queue>
        void analyze( CppUnitMini::ThreadPool& pool, Queue& testQueue  )
        {
            size_t * arr = new size_t[ s_nQueueSize ];
            memset(arr, 0, sizeof(arr[0]) * s_nQueueSize );

            double fTime = 0;
            size_t nTotalPops = 0;
            for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
                Thread<Queue> * pThread = reinterpret_cast<Thread<Queue> *>(*it);
                for ( size_t i = 0; i < s_nQueueSize; ++i )
                    arr[i] += pThread->m_arr[i];
                nTotalPops += pThread->m_nPopCount;
                fTime += pThread->m_fTime;
            }
            CPPUNIT_MSG( "     Duration=" << (fTime / s_nThreadCount) );
            CPPUNIT_CHECK_EX( nTotalPops == s_nQueueSize, "Total pop=" << nTotalPops << ", queue size=" << s_nQueueSize);
            CPPUNIT_CHECK( testQueue.empty() )

            size_t nError = 0;
            for ( size_t i = 0; i < s_nQueueSize; ++i ) {
                if ( arr[i] != 1 ) {
                    CPPUNIT_MSG( "   ERROR: Item " << i << " has not been popped" );
                    CPPUNIT_ASSERT( ++nError <= 10 );
                }
            }

            delete [] arr;
        }

        template <class Queue>
        void test()
        {
            Queue testQueue;
            CppUnitMini::ThreadPool pool( *this );
            pool.add( new Thread<Queue>( pool, testQueue ), s_nThreadCount );

            CPPUNIT_MSG( "   Create queue size =" << s_nQueueSize << " ...");
            cds::OS::Timer      timer;
            for ( size_t i = 0; i < s_nQueueSize; ++i )
                testQueue.push( i );
            CPPUNIT_MSG( "     Duration=" << timer.duration() );

            CPPUNIT_MSG( "   Pop test, thread count=" << s_nThreadCount << " ...");
            pool.run();

            analyze( pool, testQueue );

            CPPUNIT_MSG( testQueue.statistics() );
        }

        template <class Queue>
        void test_bounded()
        {
            Queue testQueue( s_nQueueSize );
            CppUnitMini::ThreadPool pool( *this );
            pool.add( new Thread<Queue>( pool, testQueue ), s_nThreadCount );

            CPPUNIT_MSG( "   Create queue size =" << s_nQueueSize << " ...");
            cds::OS::Timer      timer;
            for ( size_t i = 0; i < s_nQueueSize; ++i )
                testQueue.push( i );
            CPPUNIT_MSG( "     Duration=" << timer.duration() );

            CPPUNIT_MSG( "   Pop test, thread count=" << s_nThreadCount << " ...");
            pool.run();

            analyze( pool, testQueue );

            CPPUNIT_MSG( testQueue.statistics() );
        }

        template <class Queue>
        void test_segmented()
        {
            for ( size_t nSegmentSize = 4; nSegmentSize <= 256; nSegmentSize *= 4 ) {
                CPPUNIT_MSG( "Segment size: " << nSegmentSize );

                Queue testQueue( nSegmentSize );
                CppUnitMini::ThreadPool pool( *this );
                pool.add( new Thread<Queue>( pool, testQueue ), s_nThreadCount );

                CPPUNIT_MSG( "   Create queue size =" << s_nQueueSize << " ...");
                cds::OS::Timer      timer;
                for ( size_t i = 0; i < s_nQueueSize; ++i )
                    testQueue.push( i );
                CPPUNIT_MSG( "     Duration=" << timer.duration() );

                CPPUNIT_MSG( "   Pop test, thread count=" << s_nThreadCount << " ...");
                pool.run();

                analyze( pool, testQueue );

                CPPUNIT_MSG( testQueue.statistics() );
            }
        }

        void setUpParams( const CppUnitMini::TestCfg& cfg ) {
            s_nThreadCount = cfg.getULong("ThreadCount", 8 );
            s_nQueueSize = cfg.getULong("QueueSize", 20000000 );
        }

    protected:
        CDSUNIT_DECLARE_MoirQueue( SimpleValue )
        CDSUNIT_DECLARE_MSQueue( SimpleValue )
        CDSUNIT_DECLARE_OptimisticQueue( SimpleValue )
        CDSUNIT_DECLARE_BasketQueue( SimpleValue )
        CDSUNIT_DECLARE_FCQueue( SimpleValue )
        CDSUNIT_DECLARE_FCDeque( SimpleValue )
        CDSUNIT_DECLARE_SegmentedQueue( SimpleValue )
        CDSUNIT_DECLARE_RWQueue( SimpleValue )
        CDSUNIT_DECLARE_TsigasCysleQueue( SimpleValue )
        CDSUNIT_DECLARE_VyukovMPMCCycleQueue( SimpleValue )
        CDSUNIT_DECLARE_StdQueue( SimpleValue )

        CPPUNIT_TEST_SUITE(Queue_Pop)
            CDSUNIT_TEST_MoirQueue
            CDSUNIT_TEST_MSQueue
            CDSUNIT_TEST_OptimisticQueue
            CDSUNIT_TEST_BasketQueue
            CDSUNIT_TEST_FCQueue
            CDSUNIT_TEST_FCDeque
            CDSUNIT_TEST_SegmentedQueue
            CDSUNIT_TEST_RWQueue
            CDSUNIT_TEST_TsigasCysleQueue
            CDSUNIT_TEST_VyukovMPMCCycleQueue
            CDSUNIT_TEST_StdQueue
        CPPUNIT_TEST_SUITE_END();
    };

} // namespace queue

CPPUNIT_TEST_SUITE_REGISTRATION(queue::Queue_Pop);


text:
<?php

namespace ZendTest\Stdlib\StringWrapper;

use Zend\Stdlib\Exception;
use Zend\Stdlib\StringWrapper\Intl;

class IntlTest extends CommonStringWrapperTest
{
    public function setUp()
    {
        if (!extension_loaded('intl')) {
            try {
                new Intl('utf-8');
                $this->fail('Missing expected Zend\Stdlib\Exception\ExtensionNotLoadedException');
            } catch (Exception\ExtensionNotLoadedException $e) {
                $this->markTestSkipped('Missing ext/intl');
            }
        }

        parent::setUp();
    }

    protected function getWrapper($encoding = null, $convertEncoding = null)
    {
        if ($encoding === null) {
            $supportedEncodings = Intl::getSupportedEncodings();
            $encoding = array_shift($supportedEncodings);
        }

        if (!Intl::isSupported($encoding, $convertEncoding)) {
            return false;
        }

        $wrapper = new Intl();
        $wrapper->setEncoding($encoding, $convertEncoding);
        return $wrapper;
    }
}


text:
//
//  YXMapController.m
//  火车票
//
//  Created by 刘雨轩 on 15/10/17.
//  Copyright © 2015年 刘雨轩. All rights reserved.
//

#import "YXMapController.h"
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
#import "YXAnnotation.h"
#import "MBProgressHUD+XMG.h"
@interface YXMapController ()<CLLocationManagerDelegate,MKMapViewDelegate>
@property (weak, nonatomic) IBOutlet MKMapView *mapView;

@property(nonatomic,strong)CLLocationManager *manager;  /**< 位置管理者*/
@property(nonatomic,strong)YXAnnotation *annotation;  /**< 从代售点进入的位置*/
@property(nonatomic,strong)YXAnnotation *addAnnotation;  /**< 地图保存的位置*/
@property (nonatomic, strong) CLGeocoder *geoC;//位置管理器
@property (nonatomic,strong)NSDictionary *dict;
@end

@implementation YXMapController
#pragma mark   懒加载
#pragma ----------------------------
- (CLGeocoder *)geoC
{
    if (!_geoC) {
        _geoC = [[CLGeocoder alloc] init];
    }
    return _geoC;
}

- (CLLocationManager *)manager
{
    if (!_manager) {
        _manager = [[CLLocationManager alloc]init];
        _manager.delegate = self;

        //适配.请求授权
        if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
            [_manager requestWhenInUseAuthorization];
            if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
                [_manager requestAlwaysAuthorization];
            }
        }
    }
    return _manager;
}
#pragma mark   按键处理
#pragma ----------------------------
- (IBAction)back:(id)sender {
    self.mapView.userTrackingMode = MKUserTrackingModeFollow;
    [self.mapView setCenterCoordinate:self.mapView.userLocation.location.coordinate animated:YES];
}

- (IBAction)returnPop:(UIButton *)sender {
    //  确定按钮
    if (sender.tag) {
        //发送通知
        [[NSNotificationCenter defaultCenter] postNotificationName:@"map" object:nil userInfo:self.dict];
    }
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self judgeStatus];
}

- (void)viewDidLoad
{
    self.navigationItem.title = @"地图定位";
    [super viewDidLoad];
    [self.manager requestLocation];
    [self setUpMap];
}

- (void)judgeStatus
{
    if (self.address.length > 0) {      //用户点击地址进入的
        [self.geoC geocodeAddressString:self.address completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
            CLPlacemark *pl = [placemarks firstObject];

            YXAnnotation *annotation = [[YXAnnotation alloc]init];
            annotation.coordinate = pl.location.coordinate;
            annotation.title = pl.locality;
            annotation.subtitle = pl.name;
            [self.mapView addAnnotation:annotation];
            self.annotation = annotation;
        }];
    }else
    {
        self.mapView.userTrackingMode = MKUserTrackingModeFollow;
    }
}

- (void)setUpMap
{

    self.mapView.mapType = MKMapTypeStandard;
    // 设置地图的显示项
    // 指南针
    self.mapView.delegate = self;
    self.mapView.showsCompass = YES;
    // 比例尺
    self.mapView.showsScale = YES;
    // 显示交通
    self.mapView.showsTraffic = YES;
    // 兴趣点
    self.mapView.showsPointsOfInterest = YES;
    // 建筑物
    self.mapView.showsBuildings = YES;

    [self.mapView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(addAn:) ]];
}

- (void)addAn:(UIGestureRecognizer *)gest
{
    //获取位置
    CGPoint point = [gest locationInView:self.mapView];
    //转换坐标
    CLLocationCoordinate2D center = [self.mapView convertPoint:point toCoordinateFromView:self.mapView];

    CLLocation *location = [[CLLocation alloc] initWithLatitude:center.latitude longitude:center.longitude];
    if (self.addAnnotation) {
     [self.mapView removeAnnotation:self.addAnnotation];
    }
    YXAnnotation *annotation = [[YXAnnotation alloc]init];
    self.addAnnotation  = annotation;
    [self.mapView addAnnotation:annotation];
    [self.geoC reverseGeocodeLocation:location completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
        if (error == nil) {

            annotation.coordinate = center;
            CLPlacemark *pl = [placemarks firstObject];
            annotation.title = pl.locality;
            annotation.subtitle = pl.name;
            self.dict = pl.addressDictionary;
        }

    }];

}

#pragma mark - MKMapViewDelegate
// 自定义方法, 系统的加载大头针视图的实现方案
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
    if ([annotation isKindOfClass:[MKUserLocation class]]) {
        return nil;
    }

    // 模拟当这个方法, 返回nil, 系统加载系统自带的打头针视图的流程 MKPinAnnotationView
    // 大头针也有重复利用机制
    static NSString *pinID = @"pinID";
    MKPinAnnotationView  *pinView = (MKPinAnnotationView  *)[mapView dequeueReusableAnnotationViewWithIdentifier:pinID];
    if (pinView == nil) {
        pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pinID];
    }
    // 重新设置一次, 大头针数据模型, 防止重复利用时, 数据出错
    pinView.annotation = annotation;
    // 设置大头针可以弹框
    pinView.canShowCallout = YES;
    if ([annotation isEqual:self.annotation])
    {
        pinView.pinTintColor = [UIColor blackColor];
        // 不会自动放大地图比例
        CLLocationCoordinate2D centerCoordinate = annotation.coordinate;
        MKCoordinateSpan span = MKCoordinateSpanMake(0.027023, 0.018108);
        MKCoordinateRegion region = MKCoordinateRegionMake(centerCoordinate,span);
        // 设置地图显示区域
        [self.mapView setRegion:region animated:YES];

    }

    return pinView;
}
/**
 *  当地图获取到用户位置时调用
 *
 *  @param mapView      地图
 *  @param userLocation 大头针数据模型
 */
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{

    // 显示当前地图的中心, 在哪个具体的经纬度坐标
    // 不会自动放大地图比例
    [self.mapView setCenterCoordinate:userLocation.location.coordinate animated:YES];
    //将用户的地址转换地址
    [self.geoC reverseGeocodeLocation:userLocation.location completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
        if (error == nil) {

            CLPlacemark *pl = [placemarks firstObject];
            userLocation.title = pl.locality;
            userLocation.subtitle = pl.name;
            self.dict = pl.addressDictionary;

        }

    }];

    CLLocationCoordinate2D centerCoordinate = userLocation.location.coordinate;
    MKCoordinateSpan span = MKCoordinateSpanMake(0.027023, 0.018108);
    MKCoordinateRegion region = MKCoordinateRegionMake(centerCoordinate,span);
    // 设置地图显示区域
    [self.mapView setRegion:region animated:YES];

}

#pragma mark - CLLocationManagerDelegate

// 定位失败时调用
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
    [MBProgressHUD showError:@"定位失败!"];
}

-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
//    NSLog(@"定位到了");
}

-(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
    switch (status) {
        case kCLAuthorizationStatusDenied:
        {

            // 判断当前设备是否支持定位, 定位服务是否开启
            if([CLLocationManager locationServicesEnabled])
            {
                [MBProgressHUD showError:@"请授权,以获取位置!"];

                // 提醒给APP 授权
                // iOS8.0- , 截图
                // iOS8.0+ , 通过调用一个方法, 来直接到达设置界面
                // 跳转核心代码
                NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
                if ([[UIApplication sharedApplication] canOpenURL:url]) {
                    [[UIApplication sharedApplication] openURL: url];
                }

            }
            else
            {
                [MBProgressHUD showError:@"请打开GPS服务!"];

            }
            break;
        }
    }
}
#pragma mark   创建的方法
#pragma ----------------------------
- (instancetype)init
{
    return [[NSBundle mainBundle] loadNibNamed:@"YXMapController" owner:nil options:nil].lastObject;
}

@end


text:
/* global, window */
import React, {Component} from 'react';
import DeckGL, {ScatterplotLayer} from 'deck.gl';
import PropTypes from 'prop-types';
import {isWebGL2, registerShaderModules} from 'luma.gl';

import WindLayer from './layers/wind-layer/wind-layer';
import DelaunayCoverLayer from './layers/delaunay-cover-layer/delaunay-cover-layer';
import ParticleLayer from './layers/particle-layer/particle-layer';

import {loadData} from './utils/load-data';

import TWEEN from 'tween.js';

import fsfp32 from './shaderlib/fs-fp32/fs-fp32';
import fsproject from './shaderlib/fs-project/fs-project';
import fslighting from './shaderlib/fs-lighting/fs-lighting';

registerShaderModules([fsfp32, fsproject, fslighting]);

const propTypes = {
  viewport: PropTypes.object.isRequired,
  settings: PropTypes.object.isRequired
};

const windLightSettings = {
  lightsPosition: [-60, 25, 15000, -140, 0, 400000],
  ambientRatio: 0.8,
  diffuseRatio: 0.6,
  specularRatio: 0.2,
  lightsStrength: [1.0, 0.0, 2.0, 0.0],
  numberOfLights: 2
};

const elevationLightSettings = {
  lightsPosition: [-100, 25, 15000],
  ambientRatio: 0.2,
  diffuseRatio: 0.9,
  specularRatio: 0.2,
  lightsStrength: [1.0, 0.0],
  numberOfLights: 1
};

export default class WindDemo extends Component {
  constructor(props) {
    super(props);

    this.state = {
      data: null,
      webGL2Supported: true
    };

    const particleState = {particleTime: 0};
    this._particleAnimation = new TWEEN.Tween(particleState)
      .to({particleTime: 60}, 1000)
      .onUpdate(() => this.setState(particleState))
      .repeat(Infinity);
  }

  componentDidMount() {
    loadData().then(data => {
      this.setState({data});
    });

    if (this.props.settings.showParticles) {
      this._particleAnimation.start();
    }
  }

  componentWillReceiveProps(nextProps) {
    const {
      settings: {showParticles}
    } = nextProps;
    if (this.props.settings.showParticles !== showParticles) {
      if (showParticles) {
        this._particleAnimation.start();
      } else {
        this._particleAnimation.stop();
      }
    }
  }

  componentWillUnmount() {
    this._particleAnimation.stop();
  }

  _onWebGLInitialized(gl) {
    const webGL2Supported = isWebGL2(gl);
    this.setState({webGL2Supported});
  }

  render() {
    const {data, webGL2Supported} = this.state;
    if (!webGL2Supported) {
      return (
        <div
          style={{
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            height: '100vh'
          }}
        >
          <h2> {"THIS DEMO REQUIRES WEBLG2, BUT YOUR BRWOSER DOESN'T SUPPORT IT"} </h2>
        </div>
      );
    }
    const {viewport, settings} = this.props;

    if (!data) {
      return null;
    }

    const {stations, triangulation, texData, bbox} = data;

    const layers = [
      new ScatterplotLayer({
        id: 'stations',
        data: stations,
        getPosition: d => [-d.long, d.lat, d.elv],
        getFillColor: d => [200, 200, 100],
        getRadius: d => 150,
        opacity: 0.2,
        radiusScale: 30
      }),
      settings.showParticles &&
        new ParticleLayer({
          id: 'particles',
          bbox,
          texData,
          time: settings.time,
          zScale: 100
        }),
      settings.showWind &&
        new WindLayer({
          id: 'wind',
          bbox,
          dataBounds: texData.dataBounds,
          dataTextureArray: texData.textureArray,
          dataTextureSize: texData.textureSize,
          time: settings.time,
          lightSettings: windLightSettings
        }),
      // settings.showElevation && new ElevationLayer({
      //   id: 'elevation',
      //   boundingBox,
      //   triangulation,
      //   lngResolution: 200,
      //   latResolution: 100,
      //   zScale: 100
      // })
      settings.showElevation &&
        new DelaunayCoverLayer({
          id: 'delaunay-cover',
          triangulation,
          lightSettings: elevationLightSettings
        })
      // FIXME - deck.gl should automatically cull null/false layers
    ].filter(Boolean);

    return (
      <DeckGL
        glOptions={{webgl2: true}}
        {...viewport}
        layers={layers}
        useDevicePixels={settings.useDevicePixels}
        onWebGLInitialized={this._onWebGLInitialized.bind(this)}
      />
    );
  }
}

WindDemo.propTypes = propTypes;