text:
package com.amazonaws.services.kinesisfirehose;

import com.amazonaws.*;
import com.amazonaws.regions.*;

import com.amazonaws.services.kinesisfirehose.model.*;

/**
 * Interface for accessing Firehose.
 *

 * <fullname>Amazon Kinesis Firehose API Reference</fullname>
 *

 * Amazon Kinesis Firehose is a fully-managed service that delivers real-time
 * streaming data to destinations such as Amazon S3 and Amazon Redshift.
 *

 */
public interface AmazonKinesisFirehose {

    /**
     * Overrides the default endpoint for this client
     * ("https://firehose.us-east-1.amazonaws.com"). Callers can use this method
     * to control which AWS region they want to work with.
     *

     * Callers can pass in just the endpoint (ex:
     * "firehose.us-east-1.amazonaws.com") or a full URL, including the protocol
     * (ex: "https://firehose.us-east-1.amazonaws.com"). If the protocol is not
     * specified here, the default protocol from this client's
     * {@link ClientConfiguration} will be used, which by default is HTTPS.
     *

     * For more information on using AWS regions with the AWS SDK for Java, and
     * a complete list of all available endpoints for all AWS services, see:  http://developer.amazonwebservices.com/connect/entry.jspa?externalID=
     * 3912
     *

     * This method is not threadsafe. An endpoint should be configured when
     * the client is created and before any service requests are made. Changing
     * it afterwards creates inevitable race conditions for any service requests
     * in transit or retrying.
     *
     * @param endpoint
     *        The endpoint (ex: "firehose.us-east-1.amazonaws.com") or a full
     *        URL, including the protocol (ex:
     *        "https://firehose.us-east-1.amazonaws.com") of the region specific
     *        AWS endpoint this client will communicate with.
     */
    void setEndpoint(String endpoint);

    /**
     * An alternative to {@link AmazonKinesisFirehose#setEndpoint(String)}, sets
     * the regional endpoint for this client's service calls. Callers can use
     * this method to control which AWS region they want to work with.
     *

     * By default, all service endpoints in all regions use the https protocol.
     * To use http instead, specify it in the {@link ClientConfiguration}
     * supplied at construction.
     *

     * This method is not threadsafe. A region should be configured when the
     * client is created and before any service requests are made. Changing it
     * afterwards creates inevitable race conditions for any service requests in
     * transit or retrying.
     *
     * @param region
     *        The region this client will communicate with. See
     *        {@link Region#getRegion(com.amazonaws.regions.Regions)} for
     *        accessing a given region. Must not be null and must be a region
     *        where the service is available.
     *
     * @see Region#getRegion(com.amazonaws.regions.Regions)
     * @see Region#createClient(Class,
     *      com.amazonaws.auth.AWSCredentialsProvider, ClientConfiguration)
     * @see Region#isServiceSupported(String)
     */
    void setRegion(Region region);

    /**
     *

     * Creates a delivery stream.
     *

     *

     * CreateDeliveryStream is an asynchronous operation that immediately
     * returns. The initial status of the delivery stream is
     * CREATING. After the delivery stream is created, its status
     * is ACTIVE and it now accepts data. Attempts to send data to
     * a delivery stream that is not in the ACTIVE state cause an
     * exception. To check the state of a delivery stream, use
     * DescribeDeliveryStream.
     *

     *

     * The name of a delivery stream identifies it. You can't have two delivery
     * streams with the same name in the same region. Two delivery streams in
     * different AWS accounts or different regions in the same AWS account can
     * have the same name.
     *

     *

     * By default, you can create up to 5 delivery streams per region.
     *

     *

     * A delivery stream can only be configured with a single destination,
     * Amazon S3 or Amazon Redshift. For correct CreateDeliveryStream
     * request syntax, specify only one destination configuration parameter:
     * either RedshiftDestinationConfiguration or
     * S3DestinationConfiguration
     *

     *

     * As part of S3DestinationConfiguration, optional values
     * BufferingHints, EncryptionConfiguration, and
     * CompressionFormat can be provided. By default, if no
     * BufferingHints value is provided, Amazon Kinesis Firehose
     * buffers data up to 5 MB or for 5 minutes, whichever condition is
     * satisfied first. Note that BufferingHints is a hint, so
     * there are some cases where the service cannot adhere to these conditions
     * strictly; for example, record boundaries are such that the size is a
     * little over or under the configured buffering size. By default, no
     * encryption is performed. We strongly recommend that you enable encryption
     * to ensure secure data storage in Amazon S3.
     *

     *

     * A few notes about RedshiftDestinationConfiguration:
     *

     *

     *
An Amazon Redshift destination requires an S3 bucket as intermediate
     * location, as Amazon Kinesis Firehose first delivers data to S3 and then
     * uses COPY syntax to load data into an Amazon Redshift table.
     * This is specified in the
     * RedshiftDestinationConfiguration.S3Configuration parameter
     * element.

     *
The compression formats SNAPPY or ZIP
     * cannot be specified in
     * RedshiftDestinationConfiguration.S3Configuration because the
     * Amazon Redshift COPY operation that reads from the S3 bucket
     * doesn't support these compression formats.

     *
We strongly recommend that the username and password provided is used
     * exclusively for Amazon Kinesis Firehose purposes, and that the
     * permissions for the account are restricted for Amazon Redshift
     * INSERT permissions.

     *

     *

     * Amazon Kinesis Firehose assumes the IAM role that is configured as part
     * of destinations. The IAM role should allow the Amazon Kinesis Firehose
     * principal to assume the role, and the role should have permissions that
     * allows the service to deliver the data. For more information, see Amazon S3 Bucket Access in the Amazon Kinesis Firehose Developer
     * Guide.
     *

     *
     * @param createDeliveryStreamRequest
     *        Contains the parameters for CreateDeliveryStream.
     * @return Result of the CreateDeliveryStream operation returned by the
     *         service.
     * @throws InvalidArgumentException
     *         The specified input parameter has an value that is not valid.
     * @throws LimitExceededException
     *         You have already reached the limit for a requested resource.
     * @throws ResourceInUseException
     *         The resource is already in use and not available for this
     *         operation.
     * @sample AmazonKinesisFirehose.CreateDeliveryStream
     */
    CreateDeliveryStreamResult createDeliveryStream(
            CreateDeliveryStreamRequest createDeliveryStreamRequest);

    /**
     *

     * Deletes a delivery stream and its data.
     *

     *

     * You can delete a delivery stream only if it is in ACTIVE or
     * DELETING state, and not in the CREATING state.
     * While the deletion request is in process, the delivery stream is in the
     * DELETING state.
     *

     *

     * To check the state of a delivery stream, use
     * DescribeDeliveryStream.
     *

     *

     * While the delivery stream is DELETING state, the service may
     * continue to accept the records, but the service doesn't make any
     * guarantees with respect to delivering the data. Therefore, as a best
     * practice, you should first stop any applications that are sending records
     * before deleting a delivery stream.
     *

     *
     * @param deleteDeliveryStreamRequest
     *        Contains the parameters for DeleteDeliveryStream.
     * @return Result of the DeleteDeliveryStream operation returned by the
     *         service.
     * @throws ResourceInUseException
     *         The resource is already in use and not available for this
     *         operation.
     * @throws ResourceNotFoundException
     *         The specified resource could not be found.
     * @sample AmazonKinesisFirehose.DeleteDeliveryStream
     */
    DeleteDeliveryStreamResult deleteDeliveryStream(
            DeleteDeliveryStreamRequest deleteDeliveryStreamRequest);

    /**
     *

     * Describes the specified delivery stream and gets the status. For example,
     * after your delivery stream is created, call DescribeDeliveryStream
     * to see if the delivery stream is ACTIVE and therefore ready
     * for data to be sent to it.
     *

     *
     * @param describeDeliveryStreamRequest
     *        Contains the parameters for DescribeDeliveryStream.
     * @return Result of the DescribeDeliveryStream operation returned by the
     *         service.
     * @throws ResourceNotFoundException
     *         The specified resource could not be found.
     * @sample AmazonKinesisFirehose.DescribeDeliveryStream
     */
    DescribeDeliveryStreamResult describeDeliveryStream(
            DescribeDeliveryStreamRequest describeDeliveryStreamRequest);

    /**
     *

     * Lists your delivery streams.
     *

     *

     * The number of delivery streams might be too large to return using a
     * single call to ListDeliveryStreams. You can limit the number of
     * delivery streams returned, using the Limit parameter. To
     * determine whether there are more delivery streams to list, check the
     * value of HasMoreDeliveryStreams in the output. If there are
     * more delivery streams to list, you can request them by specifying the
     * name of the last delivery stream returned in the call in the
     * ExclusiveStartDeliveryStreamName parameter of a subsequent
     * call.
     *

     *
     * @param listDeliveryStreamsRequest
     *        Contains the parameters for ListDeliveryStreams.
     * @return Result of the ListDeliveryStreams operation returned by the
     *         service.
     * @sample AmazonKinesisFirehose.ListDeliveryStreams
     */
    ListDeliveryStreamsResult listDeliveryStreams(
            ListDeliveryStreamsRequest listDeliveryStreamsRequest);

    /**
     *

     * Writes a single data record into an Amazon Kinesis Firehose delivery
     * stream. To write multiple data records into a delivery stream, use
     * PutRecordBatch. Applications using these operations are referred
     * to as producers.
     *

     *

     * By default, each delivery stream can take in up to 2,000 transactions per
     * second, 5,000 records per second, or 5 MB per second. Note that if you
     * use PutRecord and PutRecordBatch, the limits are an
     * aggregate across these two operations for each delivery stream. For more
     * information about limits and how to request an increase, see Amazon
     * Kinesis Firehose Limits.
     *

     *

     * You must specify the name of the delivery stream and the data record when
     * using PutRecord. The data record consists of a data blob that can
     * be up to 1,000 KB in size, and any kind of data, for example, a segment
     * from a log file, geographic location data, web site clickstream data,
     * etc.
     *

     *

     * Amazon Kinesis Firehose buffers records before delivering them to the
     * destination. To disambiguate the data blobs at the destination, a common
     * solution is to use delimiters in the data, such as a newline (
     * \n) or some other character unique within the data. This
     * allows the consumer application(s) to parse individual data items when
     * reading the data from the destination.
     *

     *

     * Amazon Kinesis Firehose does not maintain data record ordering. If the
     * destination data needs to be re-ordered by the consumer application, the
     * producer should include some form of sequence number in each data record.
     *

     *

     * The PutRecord operation returns a RecordId, which is
     * a unique string assigned to each record. Producer applications can use
     * this ID for purposes such as auditability and investigation.
     *

     *

     * If the PutRecord operation throws a
     * ServiceUnavailableException, back off and retry. If the
     * exception persists, it is possible that the throughput limits have been
     * exceeded for the delivery stream.
     *

     *

     * Data records sent to Amazon Kinesis Firehose are stored for 24 hours from
     * the time they are added to a delivery stream as it attempts to send the
     * records to the destination. If the destination is unreachable for more
     * than 24 hours, the data is no longer available.
     *

     *
     * @param putRecordRequest
     *        Contains the parameters for PutRecord.
     * @return Result of the PutRecord operation returned by the service.
     * @throws ResourceNotFoundException
     *         The specified resource could not be found.
     * @throws InvalidArgumentException
     *         The specified input parameter has an value that is not valid.
     * @throws ServiceUnavailableException
     *         The service is unavailable, back off and retry the operation. If
     *         you continue to see the exception, throughput limits for the
     *         delivery stream may have been exceeded. For more information
     *         about limits and how to request an increase, see Amazon Kinesis Firehose Limits.
     * @sample AmazonKinesisFirehose.PutRecord
     */
    PutRecordResult putRecord(PutRecordRequest putRecordRequest);

    /**
     *

     * Writes multiple data records into a delivery stream in a single call,
     * which can achieve higher throughput per producer than when writing single
     * records. To write single data records into a delivery stream, use
     * PutRecord. Applications using these operations are referred to as
     * producers.
     *

     *

     * Each PutRecordBatch request supports up to 500 records. Each
     * record in the request can be as large as 1,000 KB (before 64-bit
     * encoding), up to a limit of 4 MB for the entire request. By default, each
     * delivery stream can take in up to 2,000 transactions per second, 5,000
     * records per second, or 5 MB per second. Note that if you use
     * PutRecord and PutRecordBatch, the limits are an aggregate
     * across these two operations for each delivery stream. For more
     * information about limits and how to request an increase, see Amazon
     * Kinesis Firehose Limits.
     *

     *

     * You must specify the name of the delivery stream and the data record when
     * using PutRecord. The data record consists of a data blob that can
     * be up to 1,000 KB in size, and any kind of data, for example, a segment
     * from a log file, geographic location data, web site clickstream data, and
     * so on.
     *

     *

     * Amazon Kinesis Firehose buffers records before delivering them to the
     * destination. To disambiguate the data blobs at the destination, a common
     * solution is to use delimiters in the data, such as a newline (
     * \n) or some other character unique within the data. This
     * allows the consumer application(s) to parse individual data items when
     * reading the data from the destination.
     *

     *

     * The PutRecordBatch response includes a count of any failed
     * records, FailedPutCount, and an array of responses,
     * RequestResponses. The FailedPutCount value is a
     * count of records that failed. Each entry in the
     * RequestResponses array gives additional information of the
     * processed record. Each entry in RequestResponses directly
     * correlates with a record in the request array using the same ordering,
     * from the top to the bottom of the request and response.
     * RequestResponses always includes the same number of records
     * as the request array. RequestResponses both successfully and
     * unsuccessfully processed records. Amazon Kinesis Firehose attempts to
     * process all records in each PutRecordBatch request. A single
     * record failure does not stop the processing of subsequent records.
     *

     *

     * A successfully processed record includes a RecordId value,
     * which is a unique value identified for the record. An unsuccessfully
     * processed record includes ErrorCode and
     * ErrorMessage values. ErrorCode reflects the
     * type of error and is one of the following values:
     * ServiceUnavailable or InternalFailure.
     * ErrorMessage provides more detailed information about the
     * error.
     *

     *

     * If FailedPutCount is greater than 0 (zero), retry the
     * request. A retry of the entire batch of records is possible; however, we
     * strongly recommend that you inspect the entire response and resend only
     * those records that failed processing. This minimizes duplicate records
     * and also reduces the total bytes sent (and corresponding charges).
     *

     *

     * If the PutRecordBatch operation throws a
     * ServiceUnavailableException, back off and retry. If the
     * exception persists, it is possible that the throughput limits have been
     * exceeded for the delivery stream.
     *

     *

     * Data records sent to Amazon Kinesis Firehose are stored for 24 hours from
     * the time they are added to a delivery stream as it attempts to send the
     * records to the destination. If the destination is unreachable for more
     * than 24 hours, the data is no longer available.
     *

     *
     * @param putRecordBatchRequest
     *        Contains the parameters for PutRecordBatch.
     * @return Result of the PutRecordBatch operation returned by the service.
     * @throws ResourceNotFoundException
     *         The specified resource could not be found.
     * @throws InvalidArgumentException
     *         The specified input parameter has an value that is not valid.
     * @throws ServiceUnavailableException
     *         The service is unavailable, back off and retry the operation. If
     *         you continue to see the exception, throughput limits for the
     *         delivery stream may have been exceeded. For more information
     *         about limits and how to request an increase, see Amazon Kinesis Firehose Limits.
     * @sample AmazonKinesisFirehose.PutRecordBatch
     */
    PutRecordBatchResult putRecordBatch(
            PutRecordBatchRequest putRecordBatchRequest);

    /**
     *

     * Updates the specified destination of the specified delivery stream.
     *

     *

     * This operation can be used to change the destination type (for example,
     * to replace the Amazon S3 destination with Amazon Redshift) or change the
     * parameters associated with a given destination (for example, to change
     * the bucket name of the Amazon S3 destination). The update may not occur
     * immediately. The target delivery stream remains active while the
     * configurations are updated, so data writes to the delivery stream can
     * continue during this process. The updated configurations are normally
     * effective within a few minutes.
     *

     *

     * If the destination type is the same, Amazon Kinesis Firehose merges the
     * configuration parameters specified in the UpdateDestination
     * request with the destination configuration that already exists on the
     * delivery stream. If any of the parameters are not specified in the update
     * request, then the existing configuration parameters are retained. For
     * example, in the Amazon S3 destination, if EncryptionConfiguration
     * is not specified then the existing EncryptionConfiguration is
     * maintained on the destination.
     *

     *

     * If the destination type is not the same, for example, changing the
     * destination from Amazon S3 to Amazon Redshift, Amazon Kinesis Firehose
     * does not merge any parameters. In this case, all parameters must be
     * specified.
     *

     *

     * Amazon Kinesis Firehose uses the
     * CurrentDeliveryStreamVersionId to avoid race conditions and
     * conflicting merges. This is a required field in every request and the
     * service only updates the configuration if the existing configuration
     * matches the VersionId. After the update is applied
     * successfully, the VersionId is updated, which can be
     * retrieved with the DescribeDeliveryStream operation. The new
     * VersionId should be uses to set
     * CurrentDeliveryStreamVersionId in the next
     * UpdateDestination operation.
     *

     *
     * @param updateDestinationRequest
     *        Contains the parameters for UpdateDestination.
     * @return Result of the UpdateDestination operation returned by the
     *         service.
     * @throws InvalidArgumentException
     *         The specified input parameter has an value that is not valid.
     * @throws ResourceInUseException
     *         The resource is already in use and not available for this
     *         operation.
     * @throws ResourceNotFoundException
     *         The specified resource could not be found.
     * @throws ConcurrentModificationException
     *         Another modification has already happened. Fetch
     *         VersionId again and use it to update the
     *         destination.
     * @sample AmazonKinesisFirehose.UpdateDestination
     */
    UpdateDestinationResult updateDestination(
            UpdateDestinationRequest updateDestinationRequest);

    /**
     * Shuts down this client object, releasing any resources that might be held
     * open. This is an optional method, and callers are not expected to call
     * it, but can if they want to explicitly release any open resources. Once a
     * client has been shutdown, it should not be used to make any more
     * requests.
     */
    void shutdown();

    /**
     * Returns additional metadata for a previously executed successful request,
     * typically used for debugging issues where a service isn't acting as
     * expected. This data isn't considered part of the result data returned by
     * an operation, so it's available through this separate, diagnostic
     * interface.
     *

     * Response metadata is only cached for a limited period of time, so if you
     * need to access this extra diagnostic information for an executed request,
     * you should use this method to retrieve it as soon as possible after
     * executing a request.
     *
     * @param request
     *        The originally executed request.
     *
     * @return The response metadata for the specified request, or null if none
     *         is available.
     */
    ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request);
}


text:
using namespace Easy3D;
///////////////////////

bool BMFontLoader::load(Font& font,const Utility::Path& fontPath){
    //load font
	void *voidFntBuffer=NULL;
	size_t fntLen=0;
	Application::instance()->loadData(fontPath,voidFntBuffer,fntLen);
	//save info ptr
	char *startFntBuffer,*fntBuffer;
	startFntBuffer=fntBuffer=(char*)voidFntBuffer;

	ASPACKED(struct BlockSize{
				  uchar type;
				  int size;
			  });

	ASPACKED(struct BlockInfo{
			  bit16 fontSize;
			  bit8  bitField;
			  bit8  charSet;
			  bit16 stretchH;
			  bit8  aa;
			  bit8  paddingUp;
			  bit8  paddingRight;
			  bit8  paddingDown;
			  bit8  paddingLeft;
			  bit8  spacingHoriz;
			  bit8  spacingVert;
			  bit8  outline;
			  char fontName[1];//first char
			});

	ASPACKED(struct BlockCommon{
			  bit16 lineHeight;
			  bit16 base;
			  bit16 scaleW;
			  bit16 scaleH;
			  bit16 pages;
			  bit8 bitField;
			  bit8 alphaChnl;
			  bit8 redChnl;
			  bit8 greenChnl;
			  bit8 blueChnl;
			});

	ASPACKED(struct BlockPage{
				char fontName[1];//first char
			});
	ASPACKED(struct BlockChars{
				struct charInfo{
					bit32  id;
					bit16  x;
					bit16  y;
					bit16  width;
					bit16  height;
					short xoffset;
					short yoffset;
					short xadvance;
					bit8  page;
					bit8  chnl;
				} chars[1];
			  });
	#define readBlockSize(bufferPtr,blockPtr)\
		blockPtr=(BlockSize*)bufferPtr; bufferPtr+=sizeof(BlockSize);

	#define readBlockInfo(bufferPtr,blockPtr,size)\
		blockPtr=(BlockInfo*)bufferPtr; bufferPtr+=size;

	#define readBlockCommon(bufferPtr,blockPtr,size)\
		blockPtr=(BlockCommon*)bufferPtr; bufferPtr+=size;

	BlockSize* blockSize;
	BlockInfo* blockInfo;
	BlockCommon* blockCommon;
	//BlockPage* blockPage;
	BlockChars *blockChar;
	//versione file
	DEBUG_ASSERT(
	fntBuffer[0]=='B'&&
	fntBuffer[1]=='M'&&
	fntBuffer[2]=='F'&&
	fntBuffer[3]==3);
	fntBuffer+=4;

	while((fntBuffer-startFntBuffer)<fntLen){
		readBlockSize(fntBuffer,blockSize)
		switch (blockSize->type)
		{
			case 1:
				readBlockInfo(fntBuffer,blockInfo,blockSize->size)
				font.setSize(blockInfo->fontSize);
				font.setName(blockInfo->fontName);
			break;
			case 2:
				readBlockCommon(fntBuffer,blockCommon,blockSize->size)
			break;
			case 3: {
				char *localFntBuffer=fntBuffer;
				while(localFntBuffer<fntBuffer+blockSize->size){
					//load image
					String filename(localFntBuffer);
					Texture *pageTex=new Texture(fontPath.getDirectory()+"/"+filename);
					pageTex->bilinear(false);
					pageTex->mipmaps(false);
					//pageTex->load();
					font.addPage((pageTex));
					//next string
					localFntBuffer+=strlen(localFntBuffer)+1;
				}
				fntBuffer+=blockSize->size;
			}
			break;
			case 4: {
				int n=0;
				blockChar=(BlockChars*)fntBuffer;
				while((n*sizeof(BlockChars))<blockSize->size){
					Font::Character* chr=new Font::Character();

					chr->srcX=blockChar->chars[n].x;
					chr->srcY=blockChar->chars[n].y;
					chr->srcW=blockChar->chars[n].width;
					chr->srcH=blockChar->chars[n].height;
					chr->page=blockChar->chars[n].page;

					chr->xAdv=blockChar->chars[n].xadvance;
					chr->xOff=blockChar->chars[n].xoffset;
					chr->yOff=blockChar->chars[n].yoffset;

					chr->chnl=blockChar->chars[n].chnl;

					font.addCharacter(blockChar->chars[n].id,chr);
					++n;
				}
			}
			break;
			case 5: // kerning pairs (jump)
			default:
				fntBuffer+=blockSize->size;
			break;
		}
	}

	return true;
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Crocvoisin\PreinscritBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Crocvoisin\PreinscritBundle\Entity\Preinscrit;
use Crocvoisin\PreinscritBundle\Form\PreinscritType;
use \Symfony\Component\HttpFoundation\Response;

/**
 * Preinscrit controller.
 *
 * @Route("/preinscrit")
 */
class PreinscritController extends Controller
{

    public function showPreinscritFormAction(\Crocvoisin\ZoneBundle\Entity\Zone $zone)
    {
        $form = $this->createForm(new PreinscritType(), new Preinscrit, array (
                'action' => $this->generateUrl('crocvoisin_preinscrit_register')
        ));

        $form->get('zone')->setData($zone);
//        $form->get('diner')->setData($diner);
//        $form->get('utilisateur')->setData($utilisateur);
//        $form->get('donneurCommentaire')->setData($donneurCommentaire);

        return $this->container->get('templating')->renderResponse('CrocvoisinPreinscritBundle:Zone:show_preinscrit.html.twig', array(
                    'form' => $form->createView()
        ));
    }

    public function registerPreinscritFormAction(Request $request)
    {
        $form = $this->createForm(new PreinscritType(), new Preinscrit());

        $form->handleRequest($request);
        if ($form->isValid()) {

            $email = $form["email"]->getData();
            //print($email);
            //die;
            $zonename = $form["zone"]->getData()->getId();

            $em = $this->getDoctrine()->getManager();
            //récupération du nombre d'adresse, si supérieur à 0, alors on ne l'enregistre pas
            $nbadresses = $em->getRepository('CrocvoisinPreinscritBundle:Preinscrit')->existPreinscrit($zonename, $email);

            //return new Response($nbadresses);

            if($nbadresses != 0){

            $response = new Response("Votre adresse email est déjà enregistrée");
            return $response;

            }
            else{

            $data = $form->getData();

            $em->persist($data);
            $em->flush();

            //return $this->forward('CrocvoisinZoneBundle:Zone:ville');
            $response = new Response("Votre adresse email est enregistrée");
            return $response;
            }

        }
        //return $this->forward('CrocvoisinZoneBundle:Zone:ville');
        $response = new Response("Votre adresse email n'a pas été enregistrée");
        return $response;
    }

    /**
     * Lists all Preinscrit entities.
     *
     * @Route("/", name="preinscrit")
     * @Method("GET")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('CrocvoisinPreinscritBundle:Preinscrit')->findAll();

        return array(
            'entities' => $entities,
        );
    }
    /**
     * Creates a new Preinscrit entity.
     *
     * @Route("/", name="preinscrit_create")
     * @Method("POST")
     * @Template("CrocvoisinPreinscritBundle:Preinscrit:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity = new Preinscrit();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            echo "<script>alert(\" valid\")</script>";
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

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

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
    * Creates a form to create a Preinscrit entity.
    *
    * @param Preinscrit $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createCreateForm(Preinscrit $entity)
    {
        $form = $this->createForm(new PreinscritType(), $entity, array(
            'action' => $this->generateUrl('preinscrit_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }

    /**
     * Displays a form to create a new Preinscrit entity.
     *
     * @Route("/new", name="preinscrit_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Preinscrit();
        $form   = $this->createCreateForm($entity);
            echo "<script>alert(\"2\")</script>";

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Finds and displays a Preinscrit entity.
     *
     * @Route("/{id}", name="preinscrit_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CrocvoisinPreinscritBundle:Preinscrit')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Preinscrit entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Displays a form to edit an existing Preinscrit entity.
     *
     * @Route("/{id}/edit", name="preinscrit_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CrocvoisinPreinscritBundle:Preinscrit')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Preinscrit entity.');
        }

        $editForm = $this->createEditForm($entity);
        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
    * Creates a form to edit a Preinscrit entity.
    *
    * @param Preinscrit $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm(Preinscrit $entity)
    {
        $form = $this->createForm(new PreinscritType(), $entity, array(
            'action' => $this->generateUrl('preinscrit_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
    /**
     * Edits an existing Preinscrit entity.
     *
     * @Route("/{id}", name="preinscrit_update")
     * @Method("PUT")
     * @Template("CrocvoisinPreinscritBundle:Preinscrit:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CrocvoisinPreinscritBundle:Preinscrit')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Preinscrit entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

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

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
    /**
     * Deletes a Preinscrit entity.
     *
     * @Route("/{id}", name="preinscrit_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('CrocvoisinPreinscritBundle:Preinscrit')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Preinscrit entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

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

    /**
     * Creates a form to delete a Preinscrit entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('preinscrit_delete', array('id' => $id)))
            ->setMethod('DELETE')
            ->add('submit', 'submit', array('label' => 'Delete'))
            ->getForm()
        ;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Zyan.Communication.Threading;
using Zyan.Communication.Toolbox;

namespace Zyan.Tests
{
	#region Unit testing platform abstraction layer
#if NUNIT
	using NUnit.Framework;
	using TestClass = NUnit.Framework.TestFixtureAttribute;
	using TestMethod = NUnit.Framework.TestAttribute;
	using ClassInitializeNonStatic = NUnit.Framework.OneTimeSetUpAttribute;
	using ClassInitialize = DummyAttribute;
	using ClassCleanupNonStatic = NUnit.Framework.OneTimeTearDownAttribute;
	using ClassCleanup = DummyAttribute;
	using TestContext = System.Object;
#else
	using Microsoft.VisualStudio.TestTools.UnitTesting;
	using ClassCleanupNonStatic = DummyAttribute;
	using ClassInitializeNonStatic = DummyAttribute;
#endif
	#endregion

	/// <summary>
	/// Test class for the thread pool.
	///</summary>
	[TestClass]
	public class ThreadPoolTests
	{
		[TestMethod]
		public void SimpleLockThreadPoolRunDispose()
		{
			var count = 0;
			var pool = new SimpleLockThreadPool();
			var callback = new WaitCallback(obj => Interlocked.Increment(ref count));

			for (var i = 0; i < 1000; i++)
			{
				pool.QueueUserWorkItem(callback);
			}

			Thread.Sleep(TimeSpan.FromSeconds(1));

			pool.Dispose();
			Assert.AreEqual(1000, count);
		}

		[TestMethod]
		public void SimpleLockThreadPoolQueueFromMultipleThreads()
		{
			var count = 0;
			var queueCount = 0;
			var pool = new SimpleLockThreadPool();
			var queuePool = new SimpleLockThreadPool();
			var callback = new WaitCallback(obj => Interlocked.Increment(ref count));
			var queueCallback = new WaitCallback(obj =>
			{
				Interlocked.Increment(ref queueCount);
				pool.QueueUserWorkItem(callback);
			});

			for (var i = 0; i < 1000; i++)
			{
				queuePool.QueueUserWorkItem(queueCallback);
			}

			Thread.Sleep(TimeSpan.FromSeconds(2));

			queuePool.Dispose();
			Assert.AreEqual(1000, queueCount);

			Thread.Sleep(TimeSpan.FromSeconds(1));

			pool.Dispose();
			Assert.AreEqual(1000, count);
		}

		[TestMethod]
		public void SimpleLockThreadPoolWorkerThreadsAreNamed()
		{
			var pool = new SimpleLockThreadPool()
			{
				WorkerThreadName = "I'm not anonymous",
			};

			var count = 0;
			var callback = new WaitCallback(obj =>
			{
				Assert.AreEqual(pool.WorkerThreadName, Thread.CurrentThread.Name);
				Interlocked.Increment(ref count);
			});

			for (var i = 0; i < 10; i++)
			{
				pool.QueueUserWorkItem(callback);
			}

			Thread.Sleep(TimeSpan.FromSeconds(0.1));
			pool.Dispose();
			Assert.AreEqual(10, count);
		}
	}
}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('radioportal', '0014_show_public_email'),
    ]

    operations = [
        migrations.AddField(
            model_name='show',
            name='donation_url',
            field=models.URLField(default=b'', verbose_name='URL for donations (flattr, paypal.me) for this show', blank=True),
        ),
    ]


text:
function Pl_image(obj)
{
	this.x = 0;
	this.y = 0;
	this.w = 0;
	this.h = 0;
	this.sx = 0;
	this.sy = 0;
	this.sw = 0;
	this.sh = 0;
	this.was = [];
	this.was_r = [];
	this.angle = 0;
	this.vangle = 0;
	this.animation_iters = 0;
	this.animation_frame = 0;
	this.animation_frame_counter = 1;
	this.animation_name = '';
	this.animations = [];
	this.object = obj;
	this.object.layer.ready = 0;
	this.object.ready = 0;
	this.ready = 0;
	this.time;
	this.img = new Image();
	this.img.parent = this;
	this.img.onload =  function()
	{
		this.parent.ready = 1;
		this.parent.object.tryReady();
	}
	this.gx = function()
	{
		return this.x ;//+ this.object.layer.x;
	}
	this.gy = function()
	{
		return this.y ;//+ this.object.layer.y;
	}
	this.addAnimation = function(name,row,frames,speed)
	{
	if(!speed) var speed = [];
		this.animations[name] = {'row':row,'frames':frames,'speed':speed};
	}
	this.runAnimation = function(name,iter)
	{
		if(this.animations[name])
		{
			this.animation_name = name;
			this.was['sy'] = this.sy;
			this.was['sx'] = this.sx;
			this.sy = (this.animations[name]['row'] -1) * this.sh;
			this.sx = 0;
			this.animation_frame = 1;
			this.animation_iters = iter;
		}
		return this;
	}
	this.stopAnimation = function()
	{
		this.animation_iters = 0;
	}
	/*
	this.rotate = function(angle,time)
	{
		this.update();
		var dangle = this.angle - angle;
		var interval = this.object.layer.parent.options['interval'];
		this.vangle = (dangle/time) * interval;
		this.a_iter = Math.round(time / interval);
	}//*/
	this.update = function()
	{
		this.object.update();
	}
	this.chechUpdate = function()
	{
		if(this.animation_frame > 0) {
			this.update();
			return true;
		}
		if(this.animation_iters != 0){
			this.update();
			return true;
		}
		if(this.a_iter > 0)
		{
			this.update();
			return true;
		}
		return false;
	}
	this.draw = function()
	{
		/*
		if(this.time != this.object.layer.parent.time)
		{
			if(this.a_iter > 0)
			{
				this.angle -= this.vangle;
				this.a_iter--;
			}

		}

		if(this.angle)
		{
			this.object.layer.getCtx().save();
			//console.info(Math.round(this.x+this.w/2), Math.round(this.y+this.h/2));
			this.object.layer.getCtx().translate(this.x+this.w/2, this.y+this.h/2);
			this.object.layer.getCtx().rotate(-Math.PI*(this.angle/180));
			this.was_r['x'] = this.x;
			this.was_r['y'] = this.y;
			this.x = -(this.w/2);
			this.y = -(this.h/2);
		}//*/
		if(!this.w && !this.h)
		{
			this.object.layer.getCtx().drawImage(this.img, this.gx(), this.gy());
		}
		else if(!this.sw && !this.sh && !this.sx && !this.sy)
		{
			this.object.layer.getCtx().drawImage(this.img, this.gx(), this.gy(),this.w,this.h);
		}
		else
		{
			if(this.animation_frame > 0)
			{
				//console.error(this.animations[this.animation_name]['frames'],this.animation_frame);
				if(this.animation_frame != 1 && this.animation_frame <= this.animations[this.animation_name]['frames'])
				{
					this.sx = this.sw * (this.animation_frame - 1);
				}
				else if(this.animation_frame >= this.animations[this.animation_name]['frames'])
				{
					this.sy = this.was['sy'];
					this.sx = this.was['sx'];
					this.animation_frame = -1;
					this.was = [];
					if(this.animation_iters > 1  ) this.runAnimation(this.animation_name,this.animation_iters-1)
					else if(this.animation_iters < 0) this.runAnimation(this.animation_name,-1);
				}
				if(!this.animations[this.animation_name]['speed'][this.animation_frame-1])
				{//console.log(this.sy);
					this.animations[this.animation_name]['speed'][this.animation_frame-1] = 1;
				}
				if(this.animations[this.animation_name]['speed'][this.animation_frame-1] <= this.animation_frame_counter)
				{
					this.animation_frame++;
					this.animation_frame_counter=1;
				}
				else{
					this.animation_frame_counter++;
				}
				//console.info(this.sy,this.sx);
			}
			//console.info(this.sy);
			this.object.layer.getCtx().drawImage(this.img,this.sx,this.sy,this.sw,this.sh, this.gx(), this.gy(),this.w,this.h);
		}
		/*
		if(this.angle)
		{
			this.x = this.was_r['x'];
			this.y = this.was_r['y'];
			this.was_r = [];
			//this.object.layer.getCtx().rotate(Math.PI*(this.angle/180));
			this.object.layer.getCtx().restore();
		}//*/
		//this.time = this.object.layer.parent.time;
	}
}


text:
if(HUNTER_STATUS_DEBUG)
  message("[hunter] Custom FindwxWidgets module")
endif()

find_package(wxWidgets CONFIG)


text:
<?php
require_once($argv[1]); // type.php
require_once($argv[2]); // program.php
$file_prefix = $argv[3];
?>
# pragma once
# include <dsn/dist/replication.h>
# include "<?=$file_prefix?>.code.definition.h"
# include <iostream>

<?=$_PROG->get_cpp_namespace_begin()?>

<?php foreach ($_PROG->services as $svc) { ?>
class <?=$svc->name?>_client
    : public ::dsn::replication::replication_app_client_base
{
public:
    using replication_app_client_base::replication_app_client_base;
    virtual ~<?=$svc->name?>_client() {}

    // from requests to partition index
    // PLEASE DO RE-DEFINE THEM IN A SUB CLASS!!!
<?php
$keys = array();
foreach ($svc->functions as $f)
    $keys[$f->get_first_param()->get_cpp_type()] = 1;

foreach ($keys as $k => $v)
{
    echo "    virtual uint64_t get_key_hash(const ".$k."& key) { return 0; }".PHP_EOL;
}
?>
<?php foreach ($svc->functions as $f) { ?>

    // ---------- call <?=$f->get_rpc_code()?> ------------
    // - synchronous
    std::pair< ::dsn::error_code, <?=$f->get_cpp_return_type()?>> <?=$f->name?>_sync(
        const <?=$f->get_first_param()->get_cpp_type()?>& <?=$f->get_first_param()->name?>,
        std::chrono::milliseconds timeout = std::chrono::milliseconds(0)<?=$f->is_write ? PHP_EOL:",".PHP_EOL."        ::dsn::replication::read_semantic semantic = ::dsn::replication::read_semantic::ReadLastUpdate".PHP_EOL?>
        )
    {
        return dsn::rpc::wait_and_unwrap<<?=$f->get_cpp_return_type()?>>(
            ::dsn::replication::replication_app_client_base::<?=$f->is_write ? "write":"read"?>(
                get_key_hash(<?=$f->get_first_param()->name?>),
                <?=$f->get_rpc_code()?>,
                <?=$f->get_first_param()->name?>,
                this,
                empty_callback,
                timeout,
                0<?=$f->is_write ? PHP_EOL:",".PHP_EOL."                semantic".PHP_EOL?>
                )
            );
    }

    // - asynchronous with on-stack <?=$f->get_first_param()->get_cpp_type()?> and <?=$f->get_cpp_return_type()?>
    template<typename TCallback>
    ::dsn::task_ptr <?=$f->name?>(
        const <?=$f->get_first_param()->get_cpp_type()?>& <?=$f->get_first_param()->name?>,
        TCallback&& callback,
        std::chrono::milliseconds timeout = std::chrono::milliseconds(0),
        int reply_hash = 0<?=$f->is_write ? PHP_EOL:",".PHP_EOL."        ::dsn::replication::read_semantic semantic = ::dsn::replication::read_semantic::ReadLastUpdate".PHP_EOL?>
        )
    {
        return ::dsn::replication::replication_app_client_base::<?=$f->is_write ? "write":"read"?>(
            get_key_hash(<?=$f->get_first_param()->name?>),
            <?=$f->get_rpc_code()?>,
            <?=$f->get_first_param()->name?>,
            this,
            std::forward<TCallback>(callback),
            timeout,
            reply_hash<?=$f->is_write ? PHP_EOL:",".PHP_EOL."            semantic".PHP_EOL?>
            );
    }
<?php    }?>
};
<?php } ?>
<?=$_PROG->get_cpp_namespace_end()?>


text:
using Microsoft.Azure.Documents;
using SFA.DAS.EmployerAccounts.ReadStore.Data;
using StructureMap;

namespace SFA.DAS.EmployerAccounts.ReadStore.DependencyResolution
{
    internal class ReadStoreDataRegistry : Registry
    {
        public ReadStoreDataRegistry()
        {
            For<IDocumentClient>().Add(c => c.GetInstance<IDocumentClientFactory>().CreateDocumentClient()).Named(InstanceKeys.DocumentClient).Singleton();
            For<IDocumentClientFactory>().Use<DocumentClientFactory>();
            For<IAccountUsersRepository>().Use<AccountUsersRepository>().Ctor<IDocumentClient>().IsNamedInstance(InstanceKeys.DocumentClient);
        }
    }
}


text:
package org.zalando.logbook.jaxrs;

import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.MultiPart;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.glassfish.jersey.media.multipart.file.StreamDataBodyPart;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.zalando.logbook.HttpRequest;
import org.zalando.logbook.HttpResponse;
import org.zalando.logbook.Logbook;
import org.zalando.logbook.Sink;
import org.zalando.logbook.TestStrategy;
import org.zalando.logbook.jaxrs.testing.support.TestModel;
import org.zalando.logbook.jaxrs.testing.support.TestWebService;

import javax.ws.rs.core.Application;
import javax.ws.rs.core.Variant;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Locale;

import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.ws.rs.client.Entity.entity;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
import static javax.ws.rs.core.MediaType.MULTIPART_FORM_DATA_TYPE;
import static javax.ws.rs.core.MediaType.TEXT_PLAIN_TYPE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.zalando.logbook.BodyReplacers.stream;
import static org.zalando.logbook.RequestFilters.replaceBody;

final class ClientAndServerIgnoringBodyTest extends JerseyTest {

    private Sink client;
    private Sink server;

    ClientAndServerIgnoringBodyTest() {
        forceSet(TestProperties.CONTAINER_PORT, "0");
    }

    @Override
    protected Application configure() {
        // jersey calls this method within the constructor before our fields are initialized... WTF
        this.client = mock(Sink.class);
        this.server = mock(Sink.class);

        return new ResourceConfig(TestWebService.class)
                .register(new LogbookServerFilter(
                        Logbook.builder()
                                // do not replace multi-part form bodies, which is the default
                                .requestFilter(replaceBody(stream()))
                                .strategy(new TestStrategy())
                                .sink(server)
                                .build()))
                .register(MultiPartFeature.class);
    }

    @BeforeEach
    void beforeEach() throws Exception {
        super.setUp();

        when(client.isActive()).thenReturn(true);
        when(server.isActive()).thenReturn(true);

        getClient()
                .register(new LogbookClientFilter(
                        Logbook.builder()
                                // do not replace multi-part form bodies, which is the default
                                .requestFilter(replaceBody(stream()))
                                .strategy(new TestStrategy())
                                .sink(client)
                                .build()))
                .register(MultiPartFeature.class);
    }

    @Test
    void getWithPathAndQueryParamReturningTextPlain() throws Exception {
        target("testws/testGet/first/textPlain")
                .queryParam("param2", "second")
                .request()
                .header("Ignore", true)
                .get(String.class);

        final RoundTrip roundTrip = getRoundTrip();

        assertEquals("", roundTrip.getClientRequest().getBodyAsString());
        assertEquals("", roundTrip.getClientResponse().getBodyAsString());
        assertEquals("", roundTrip.getServerRequest().getBodyAsString());
        assertEquals("", roundTrip.getServerResponse().getBodyAsString());
    }

    @Test
    void multiPartFormDataAndSimulatedFileUpload() throws IOException {
        final MultiPart multiPart = new MultiPart();
        multiPart.setMediaType(MULTIPART_FORM_DATA_TYPE);
        target("testws/testPostForm")
                .request()
                .header("Ignore", true)
                .post(entity(multiPart.bodyPart(new StreamDataBodyPart("testFileFormField",
                                new ByteArrayInputStream("I am text file content".getBytes(UTF_8)),
                                "testUploadedFilename",
                                TEXT_PLAIN_TYPE
                        ))
                                .bodyPart(new FormDataBodyPart("name", "nameValue!@#$%"))
                                .bodyPart(new FormDataBodyPart("age", "-99")), multiPart.getMediaType()),
                        String.class
                );

        final RoundTrip roundTrip = getRoundTrip();

        assertEquals("", roundTrip.getClientRequest().getBodyAsString());
        assertEquals("", roundTrip.getClientResponse().getBodyAsString());
        assertEquals("", roundTrip.getServerRequest().getBodyAsString());
        assertEquals("", roundTrip.getServerResponse().getBodyAsString());
    }

    @Test
    void putJsonPayloadReturningJsonPayload() throws IOException {
        target("testws/testPutJson")
                .request()
                .header("Ignore", true)
                .put(entity(
                        new TestModel().setProperty1("val1").setProperty2("val2"),
                        new Variant(
                                APPLICATION_JSON_TYPE, Locale.CANADA, "utf-8"
                        ))
                );

        final RoundTrip roundTrip = getRoundTrip();

        assertEquals("", roundTrip.getClientRequest().getBodyAsString());
        assertEquals("", roundTrip.getClientResponse().getBodyAsString());
        assertEquals("", roundTrip.getServerRequest().getBodyAsString());
        assertEquals("", roundTrip.getServerResponse().getBodyAsString());
    }

    private RoundTrip getRoundTrip() throws IOException {
        return new RoundTrip(
                captureRequest(client),
                captureResponse(client),
                captureRequest(server),
                captureResponse(server)
        );
    }

    private static HttpRequest captureRequest(final Sink sink) throws IOException {
        final ArgumentCaptor<HttpRequest> captor = ArgumentCaptor.forClass(HttpRequest.class);
        verify(sink).write(any(), captor.capture());
        return captor.getValue();
    }

    private static HttpResponse captureResponse(final Sink sink) throws IOException {
        final ArgumentCaptor<HttpResponse> captor = ArgumentCaptor.forClass(HttpResponse.class);
        verify(sink).write(any(), any(), captor.capture());
        return captor.getValue();
    }

    @AfterEach
    void afterEach() throws Exception {
        super.tearDown();
    }

}


text:
from os.path import join, abspath, dirname, normpath

DEBUG = False
TEMPLATE_DEBUG = DEBUG

PROJECT_ROOT = abspath(join(dirname(__file__), '..', '..', '..'))

ADMINS = (
    ('Uber Mailman', 'mailman@uberlearner.com'),
)

MANAGERS = ADMINS

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Edmonton'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = normpath(join(PROJECT_ROOT, '..', 'media'))

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = join(PROJECT_ROOT, '..', 'collected-static')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    join(PROJECT_ROOT, 'static'),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    #'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
    )

ROOT_URLCONF = 'uberlearner.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'uberlearner.wsgi.application'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    join(PROJECT_ROOT, 'templates'),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.flatpages',
    'django.contrib.sitemaps',
    'django.contrib.admin',
    'djangoratings',
    'humanize',
    'storages',
    'main',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'bootstrap_toolkit',
    'captcha',
    'accounts',
    'avatar',
    'easy_thumbnails',
    'tastypie',
    'courses',
    'filestorage',
    'south',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}

# Add to TEMPLATE_CONTEXT_PROCESSORS and AUTHENTICATION_BACKENDS
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS, AUTHENTICATION_BACKENDS
TEMPLATE_CONTEXT_PROCESSORS += (
    'django.core.context_processors.request',
)

THUMBNAIL_ALIASES = {
    '': {
        'thumbnail': {
            'size': (260, 189),
            'crop': 'smart'
        },
        'tile': {
            'size': (313, 227),
            'crop': 'smart'
        }
    }
}
THUMBNAIL_SUBDIR = 'thumbnails'

FILESTORAGE_ALLOWED_CONTENT_TYPES = ['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
DEFAULT_FILE_STORAGE = 'main.staticfilestorage.FileSystemStorage'

SITE_WIDE_AVERAGE_RATING = 3

from sitemaps_settings import *
from flatpages_settings import *
from accounts_settings import *
from course_settings import *


text:
var PGL;
(function(e) {
    "use strict";
	e(document).on('click.closePopup', '.close-info', function(e){
        var $target = $(e.target),
            $popup = $target.closest('.infobox');

        $popup.length && $popup.parent().empty();
    });
    e(document).ready(function() {
        PGL = {
            initialized: false,
            agency_mapInitialLatitude: agency_mapInitialLatitude,
            agency_mapInitialLongitude: agency_mapInitialLongitude,
            properties_cluster_marker: properties_cluster_marker,
            properties_cluster_textcolor: properties_cluster_textcolor,
            properties_initialZoom: properties_initialZoom,
            properties_selectedZoom: properties_selectedZoom,
            properties_mapInitialLatitude: properties_mapInitialLatitude,
            properties_mapInitialLongitude: properties_mapInitialLongitude,
            use_default_map_style: use_default_map_style,
            init: function() {
                var e = this;
                if (e.initialized) {
                    return
                }
                e.initialized = true;
            },
            propertiesMap: function(e, t, n) {
                var r = this,
                    i = {},
                    s = [],
                    o, u, a, f, l, c, h, p, d;
                i.pics = null;
                i.map = null;
                i.markerClusterer = null;
                i.markers = [];
                i.infoWindow = null;
                if (!this.use_default_map_style) {
                    s = [{
                        featureType: "all",
                        elementType: "all",
                        stylers: [{
                            saturation: 0
                        }]
                    }]
                }
                o = new google.maps.StyledMapType(s, {
                    name: "PGL"
                });
                if (n !== undefined || n === null) {
                    u = new google.maps.LatLng(e[n].latitude, e[n].longitude);
                    r.properties_initialZoom = r.properties_selectedZoom
                } else {
                    u = new google.maps.LatLng(r.properties_mapInitialLatitude, r.properties_mapInitialLongitude)
                }
                a = {
                    zoom: r.properties_initialZoom,
                    center: u,
                    scrollwheel: false
                };
                i.map = new google.maps.Map(document.getElementById(t), a);
                i.map.mapTypes.set("map_style", o);
                i.map.setMapTypeId("map_style");
                i.pics = e;
                i.infoWindow = new InfoBox();
                f = function(e, t) {
                    return function(n) {
                        n.cancelBubble = true;
                        n.returnValue = false;
                        if (n.stopPropagation) {
                            n.stopPropagation();
                            n.preventDefault()
                        }
                        var s = '

' + '
' + 'x' + '' + '' + e.price + '' + e.forrea + '' + '
' + '
' + '
' + e.title + "
" + e.description + '
' + '
' + '

' + e.area + '

' + '

' + e.bedroom + '

' + e.bathroom + '

' + '

';

                        i.infoWindow.setContent(s);
                        i.infoWindow.setPosition(t);
                        i.infoWindow.open(i.map);

                    }
                };
                for (l = 0; l < i.pics.length; l += 1) {
                    c = new google.maps.LatLng(i.pics[l].latitude, i.pics[l].longitude);
                    h = new google.maps.Marker({
                        position: c,
                        map: i.map,
                        icon: i.pics[l].map_marker_icon
                    });
                    p = f(i.pics[l], c);
                    google.maps.event.addListener(h, "click", p);
                    i.markers.push(h);
                }
                d = {
                    styles: [{
                        height: 33,
                        url: r.properties_cluster_marker,
                        width: 26,
                        textColor: r.properties_cluster_textcolor,
                        anchorText: [0, 0],
                        textSize: 14,
                        fontWeight: "normal",
                        fontFamily: "Open Sans, Arial, sans-serif"
                    }, {
                        height: 33,
                        url: r.properties_cluster_marker,
                        width: 26,
                        textColor: r.properties_cluster_textcolor,
                        anchorText: [0, 0],
                        textSize: 14,
                        fontWeight: "normal",
                        fontFamily: "Open Sans, Arial, sans-serif"
                    }, {
                        height: 33,
                        url: r.properties_cluster_marker,
                        width: 26,
                        textColor: r.properties_cluster_textcolor,
                        anchorText: [0, 0],
                        textSize: 14,
                        fontWeight: "normal",
                        fontFamily: "Open Sans, Arial, sans-serif"
                    }],
                    maxZoom: 7
                };
                i.markerClusterer = new MarkerClusterer(i.map, i.markers, d)

            }
        };
        PGL.init()
    })
})(jQuery);


text:
<?php

namespace Bolt\Storage\Database\Schema;

use Bolt\Exception\StorageException;
use Bolt\Filesystem\Exception\FileNotFoundException;
use Bolt\Filesystem\Exception\IOException;
use Bolt\Filesystem\Handler\FileInterface;
use Carbon\Carbon;

/**
 * Schema validation check functionality.
 *
 * @author Gawain Lynch <gawain.lynch@gmail.com>
 */
class Timer
{
    /** @var FileInterface */
    protected $cacheFile;
    /** @var bool */
    protected $expired;

    const CHECK_INTERVAL = 1800;

    /**
     * Constructor.
     *
     * @param FileInterface $cacheFile
     */
    public function __construct(FileInterface $cacheFile)
    {
        $this->cacheFile = $cacheFile;
    }

    /**
     * Check if we have determined that we need to do a database check.
     *
     * @return bool
     */
    public function isCheckRequired()
    {
        if ($this->expired === false) {
            return false;
        }

        if ($this->cacheFile->exists()) {
            $expiryTimestamp = (int) $this->cacheFile->read();
        } else {
            $expiryTimestamp = 0;
        }
        $ts = Carbon::createFromTimestamp($expiryTimestamp + self::CHECK_INTERVAL);

        return $this->expired = $ts->isPast();
    }

    /**
     * Invalidate our database check by removing the timestamp file from cache.
     *
     * @throws \RuntimeException
     */
    public function setCheckRequired()
    {
        try {
            $this->expired = true;
            $this->cacheFile->delete();
        } catch (FileNotFoundException $e) {
            // Don't need to delete the file, it isn't there
        } catch (IOException $e) {
            $message = sprintf('Unable to remove database schema check timestamp: %s', $e->getMessage());

            throw new StorageException($message, $e->getCode(), $e);
        }
    }

    /**
     * Set our state as valid by writing the current date/time to the
     * app/cache/dbcheck.ts file.
     *
     * We only want to do these checks once per hour, per session, since it's
     * pretty time consuming… Unless specifically requested.
     */
    public function setCheckExpiry()
    {
        try {
            $this->expired = false;
            $this->cacheFile->put(Carbon::now()->getTimestamp());
        } catch (IOException $e) {
            // Something went wrong
        }
    }
}


text:
<?php
class LoadClass
{
	private $base_path;
	public static $inited_classes=array();
	public function __construct()
	{
		$this->base_path=BASEPATH;
	}

	public function load($class_name, $directory = 'sys', $param = NULL)
	{
		//is this class loaded
		$class_name=ucfirst($class_name);
		//static $_inited_classes = array();
		if (isset($this->inited_classes[$class_name]))
		{
			return $this->inited_classes[$class_name];
		}

		$class_path=$this->base_path.DIRECTORY_SEPARATOR.$directory.DIRECTORY_SEPARATOR;
		$class_file=$class_path.$class_name.'.php';
		if(!file_exists($class_file))
		{
			echo 'Can\'t find the class which located in '.$class_file;
			exit();
		}
		else
		{
			if (class_exists($class_name, FALSE) === FALSE)
			{
				require_once($class_file);
			}
		}

		$this->inited_classes[$class_name] = isset($param)
			? new $class_name($param)
			: new $class_name();
		return $this->inited_classes[$class_name];
	}
}


text:
JDBC Connection pools on top of org.osgi.service.jdbc.DataSourceFactory.
Instances of PoolDataSource are either configured in OSGI ConfigAdmin service,
or created by a builder api.


text:
<?php

include __DIR__ . '/libs/simple_html_dom.php';

class AndroidMarketParser{
	//application url
	private $_app_url = NULL;
	//alow download images into temp dir
	private $_download_images = FALSE;
	//set temp directory
	private $_temp_dir = './temp/';
	//output values
	private $_parsed = array();
	//temp html property
	private $_html;
	//caching time
	private $_cache_time = 0; //seconds

	const SELECTOR_ICON = 'div[class=doc-banner-icon]';
	const SELECTOR_TITLE = "h1";
	const SELECTOR_BANNER = "div[class=doc-banner-image-container]";
	const SELECTOR_IMAGES = "div[class=screenshot-carousel-content-container]";
	const SELECTOR_IMAGES_DIV = 'div[class=screenshot-image-wrapper]';
	const SELECTOR_ABOUT = "div[id=doc-original-text]";
	const SELECTOR_DATEPUBLISHED = 'time[itemprop=datePublished]';
	const SELECTOR_REVIEWS = 'div[class=doc-user-reviews-page]';
	const SELECTOR_REVIEWDATE = 'span[class=doc-review-date]';
	const SELECTOR_SOFTVERSION = 'dd[itemprop=softwareVersion]';
	const SELECTOR_SIZE = 'dd[itemprop=fileSize]';
	const SELECTOR_REVIEWAUTHOR = 'span[class=doc-review-author]';
	const SELECTOR_REVIEW_DETAIL = 'div[class=doc-review]';
	const SELECTOR_REVIEWTITLE = 'h4[class=review-title]';
	const SELECTOR_REVIEWTEXT = 'p[class=review-text]';
	const SELECTOR_NEWS = 'div[class=doc-whatsnew-container]';
	const SELECTOR_COMPANY = 'a[class=doc-header-link]';

	public function __construct( $app_url )
	{
		$this->setAppUrl($app_url);
	}

	/**
	 * set temp directory
	 * @param string $temp
	 * @return AndroidMarketParser
	 */
	public function setTemp( $temp )
	{
		if( !empty( $temp ) ){
			if( substr($temp, -1) != '/' ){
				$temp = $temp . '/';
			}

			if( !is_writeable($temp ) || !is_dir( $temp )){
				throw new Exception('temp directory is not writable');
			}

			$this->_temp_dir = $temp;
		}

		return $this;
	}

	/**
	 * Setup caching time
	 * @param int $time
	 * @return AndroidMarketParser
	 */
	public function setCacheTime($time)
	{
		$this->_cache_time = abs($time);
		return $this;
	}

	/**
	 * return temp directory
	 * @return string
	 */
	public function getTemp()
	{
		return $this->_temp_dir;
	}

	/**
	 * Enable or disable donwload images into temp
	 * @param BOOL $allow
	 * @return AndroidMarketParser
	 */
	public function allowDownloadImages( $allow = FALSE )
	{
		$allow = (bool)$allow;
		$this->_download_images = $allow;
		return $this;
	}

	/**
	 * Return if download is enabled
	 * @return boolean
	 */
	public function isAllowedDownloadImages()
	{
		return $this->_download_images;
	}

	/**
	 * Set app url
	 * @param string $file
	 * @throws Exception
	 * @return AndroidMarketParser
	 */
	private function setAppUrl( $file )
	{
		$file_headers = @get_headers($file);
		if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
			throw new Exception('failed url of application');
		}
		else {
			$this->_app_url = $file;
		}
		return $this;
	}

	/**
	 * return app url
	 * @return string
	 */
	private function getAppUrl()
	{
		return $this->_app_url;
	}

	private function setProperty($name, $value )
	{
		if( empty($value)){
			$value = NULL;
		}

		if( !is_array($value )){
			//is string
			$this->_parsed[$name ] = $value;
		}else{
			//is array
			$this->_parsed[$name] = $value;
		}
	}

	/**
	 * return property by key
	 * @param string $name
	 * @return multitype:|NULL
	 */
	public function getProperty( $name )
	{
		if( array_key_exists($name, $this->_parsed )){
			return $this->_parsed[$name];
		}
		return NULL;
	}

	/**
	 * return title
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
 	public function getTitle()
	{
		return $this->getProperty('title');
	}

	/**
	 * return icon
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getIcon()
	{
		return $this->getProperty('icon');
	}

	/**
	 * return banner url
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getBanner()
	{
		return $this->getProperty('banner');
	}

	/**
	 * return text about application
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getAbout()
	{
		return $this->getProperty('about');
	}

	/**
	 * return date of last pubhslied app
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getDatePublished()
	{
		return $this->getProperty('datePublished');
	}

	/**
	 * return software version
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getSoftvareVersion()
	{
		return $this->getProperty('softVersion');
	}

	/**
	 * return size of application
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getSize()
	{
		return $this->getProperty('size');
	}

	/**
	 * return array of reviews
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getReviews()
	{
		return $this->getProperty('reviews');
	}

	/**
	 * return array of images
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getImages()
	{
		return $this->getProperty('images');
	}

	/**
	 * get news from app
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getNews()
	{
		return $this->getProperty('news');
	}

	/**
	 * Return company name
	 * @return Ambigous <multitype:, NULL, multitype:>
	 */
	public function getCompany()
	{
		return $this->getProperty('company');
	}

	/**
	 * parse url
	 */
	public function parseUrl()
	{
		if( $this->_cache_time ){
			if( $this->loadFromCache() == true ){
				return;
			}
		}

		if( $this->createHtmlStruct() === false){
			throw new Exception('failed create structure');
		}

		$this->setProperty('title', $this->_html->find(self::SELECTOR_TITLE, 0)->plaintext);
		$this->setProperty('icon', $this->getIconFromHtml(self::SELECTOR_ICON));
		$this->setProperty('banner', $this->getIconFromHtml(self::SELECTOR_BANNER));
		$this->setProperty('about', $this->getAboutFromHtml(self::SELECTOR_ABOUT) );
		$this->setProperty('datePublished', $this->getAboutFromHtml(self::SELECTOR_DATEPUBLISHED));
		$this->setProperty('softVersion', $this->getAboutFromHtml(self::SELECTOR_SOFTVERSION));
		$this->setProperty('size', $this->getAboutFromHtml(self::SELECTOR_SIZE));
		$this->setProperty('reviews', $this->getReviewsFromHtml(self::SELECTOR_REVIEWS));
		$this->setProperty('images', $this->getImagesFromHtml(self::SELECTOR_IMAGES) );
		$this->setProperty('news', $this->getNewsFromHtml(self::SELECTOR_NEWS));
		$this->setProperty('company', $this->getCompanyFromHtml(self::SELECTOR_COMPANY));
		if( $this->_cache_time > 0 ){
			$this->saveIntoCache();
		}
	}

	private function getNewsFromHtml( $selector )
	{
		$news = $this->getAboutFromHtml($selector);
		$news = str_get_html( $news );
		//delete first paragragh
		$news = preg_replace('/<p>(.*)' . $news->find('p', 0)->innertext . '(.*)<\/p>/', '', $news);
		return $news;
	}

	private function loadFromCache()
	{
		$filename = sha1( $this->getAppUrl() );
		if( $this->_cache_time > 0 && file_exists( $this->getTemp() . $filename ) ){
			$age = time() - filemtime($this->getTemp() . $filename);
			if( $age > $this->_cache_time ){
				return false;
			}

			$f = file_get_contents($this->getTemp() . $filename);
			//make array from json
			$this->_parsed = json_decode($f, true);
			return true;
		}
		return false;
	}

	private function saveIntoCache()
	{
		if( count( $this->_parsed )){
			$json = json_encode( $this->_parsed );
			$cache_name = sha1($this->getAppUrl() );
			@unlink( $this->getTemp() . $cache_name );

			//save json
			$f = fopen($this->getTemp() . $cache_name, 'a');
			fwrite($f, $json);
			fclose($f);
		}
	}

	/**
	 * Return company name
	 * @param selector $selector
	 * @return string
	 */
	private function getCompanyFromHtml($selector)
	{
		return $this->_html->find($selector, 0)->innertext;
	}

	/**
	 * parse reviews from html
	 * @param string $selector
	 * @return array
	 */
	private function getReviewsFromHtml($selector)
	{
		$outreviews = array();

		$reviews = $this->_html->find($selector, 0);
		$i = 0;

		if( $reviews ){
			foreach ($reviews->find(self::SELECTOR_REVIEW_DETAIL) as $review ){
				if( $review ){
					$author =  $review->find(self::SELECTOR_REVIEWAUTHOR, 0)->find('strong', 0)->plaintext;

					$date = $date = $review->find(self::SELECTOR_REVIEWDATE, 0);
					if( $date ){
						$date = str_replace(' - ', '', $date->plaintext);
					}

					$title = $review->find(self::SELECTOR_REVIEWTITLE, 0);
					if( $title ){
						$title = $title->plaintext;
					}

					$text = $review->find(self::SELECTOR_REVIEWTEXT, 0);
					if($text){
						$text = $text->plaintext;
					}

					$outreviews[++$i]['author'] = $author;
					$outreviews[$i]['title'] = $title;
					$outreviews[$i]['date'] = $date;
					$outreviews[$i]['text'] = $text;
				}
			}
		}
		return $outreviews;
	}

	/**
	 * parse about applicatoin text
	 * @param string $selector
	 * @return string
	 */
	private function getAboutFromHtml( $selector )
	{
		return nl2br($this->_html->find($selector, 0)->innertext);
	}

	private function getImagesFromHtml($selector)
	{
		$images = array();
		$images_html = $this->_html->find($selector, 0);

		if( $images_html ){
			$i = 0;
			foreach( $images_html->find(self::SELECTOR_IMAGES_DIV) as $container ){
				if( $container ){
					$images[++$i]['full_image'] = $this->downloadImage( $container->getAttribute('data-baseurl') );
					$images[$i]['preview'] 	= $this->downloadImage( $container->find('img', 0)->src );
				}
			}
		}
		return $images;
	}

	/**
	 * Parse icon from html
	 * @param string $selector
	 * @return string
	 */
	private function getIconFromHtml( $selector )
	{
		$icon = $this->_html->find($selector, 0);

		if( $icon ){
			$icon = $icon->find('img', 0)->src;
		}

		if( $icon && $this->isAllowedDownloadImages() ){
			$icon = $this->downloadImage( $icon );
		}

		return $icon;
	}

	/**
	 * Download image into temp dir
	 * @param string $image
	 * @return string
	 */
	private function downloadImage( $image )
	{
		if( $this->isAllowedDownloadImages() == false){
			return $image;
		}

		$name = $this->_temp_dir . sha1($image);
		file_put_contents($name, file_get_contents($image) );

		$type = getimagesize($name);
		$postfix = $this->getImagePostfixByImageInfo( $type[2] );

		rename($name, $name . '.' . $postfix);
		return $name . '.' . $postfix;
	}

	/**
	 * Get postfix (image type) by image
	 * @param string $type
	 * @throws Exception
	 * @return string
	 */
	private function getImagePostfixByImageInfo( $type )
	{
		$postfix = explode('/', image_type_to_mime_type($type) );

		if( is_array( $postfix ) && count( $postfix ) > 0 &&  $postfix[0] == 'image' ){
			$postfix = str_replace('jpeg', 'jpg', $postfix[1]);
		}else{
			throw new Exception('Unknow file type');
		}

		return $postfix;

		/*
		$postfix = null;
		switch( image_type_to_mime_type($type )){
			case 'image/gif': $postfix = 'gif'; break;
			case 'image/jpeg':
			case 'image/jpg': $postfix = 'jpg'; break;
			case 'image/png':
			default: $postfix = 'png';
		}

		return $postfix;
		*/
	}

	/**
	 * Create html structure from url
	 * @return boolean
	 */
	private function createHtmlStruct()
	{
		$content = file_get_contents($this->getAppUrl());

		//quick fix
		$content = str_replace('"src', '" src', $content);
		//$this->_html = file_get_html( $this->getAppUrl() );

		$this->_html = str_get_html( $content );
		if( get_class($this->_html) != 'simple_html_dom'){
			return false;
		}
		return true;
	}

	/**
	 * Get output array
	 * @return array:
	 */
	public function getOutputArray()
	{
		return $this->_parsed;
	}
}


text:
namespace TextTool.Inspect
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.txtFolder = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.btnChooseFolder = new System.Windows.Forms.Button();
            this.btnCheck = new System.Windows.Forms.Button();
            this.txtRegexes = new System.Windows.Forms.TextBox();
            this.txtLog = new System.Windows.Forms.TextBox();
            this.button1 = new System.Windows.Forms.Button();
            this.txtFilePattern = new System.Windows.Forms.TextBox();
            this.btnCancel = new System.Windows.Forms.Button();
            this.btnExclude = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // txtFolder
            //
            this.txtFolder.Location = new System.Drawing.Point(75, 10);
            this.txtFolder.Name = "txtFolder";
            this.txtFolder.Size = new System.Drawing.Size(658, 21);
            this.txtFolder.TabIndex = 0;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(4, 13);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(65, 12);
            this.label1.TabIndex = 1;
            this.label1.Text = "代码位置:";
            //
            // btnChooseFolder
            //
            this.btnChooseFolder.Location = new System.Drawing.Point(848, 8);
            this.btnChooseFolder.Name = "btnChooseFolder";
            this.btnChooseFolder.Size = new System.Drawing.Size(115, 23);
            this.btnChooseFolder.TabIndex = 2;
            this.btnChooseFolder.Text = "选择文件夹";
            this.btnChooseFolder.UseVisualStyleBackColor = true;
            this.btnChooseFolder.Click += new System.EventHandler(this.btnChooseFolder_Click);
            //
            // btnCheck
            //
            this.btnCheck.Location = new System.Drawing.Point(2, 324);
            this.btnCheck.Name = "btnCheck";
            this.btnCheck.Size = new System.Drawing.Size(317, 23);
            this.btnCheck.TabIndex = 3;
            this.btnCheck.Text = "开始检查";
            this.btnCheck.UseVisualStyleBackColor = true;
            this.btnCheck.Click += new System.EventHandler(this.btnCheck_Click);
            //
            // txtRegexes
            //
            this.txtRegexes.Location = new System.Drawing.Point(2, 39);
            this.txtRegexes.Multiline = true;
            this.txtRegexes.Name = "txtRegexes";
            this.txtRegexes.Size = new System.Drawing.Size(1075, 279);
            this.txtRegexes.TabIndex = 4;
            this.txtRegexes.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtRegexes_KeyDown);
            //
            // txtLog
            //
            this.txtLog.Location = new System.Drawing.Point(2, 353);
            this.txtLog.Multiline = true;
            this.txtLog.Name = "txtLog";
            this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.txtLog.Size = new System.Drawing.Size(1075, 237);
            this.txtLog.TabIndex = 4;
            this.txtLog.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtLog_KeyDown);
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(1038, 8);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(39, 23);
            this.button1.TabIndex = 5;
            this.button1.Text = "Test";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // txtFilePattern
            //
            this.txtFilePattern.Location = new System.Drawing.Point(740, 10);
            this.txtFilePattern.Name = "txtFilePattern";
            this.txtFilePattern.Size = new System.Drawing.Size(102, 21);
            this.txtFilePattern.TabIndex = 6;
            this.txtFilePattern.Text = "*.cs";
            //
            // btnCancel
            //
            this.btnCancel.Enabled = false;
            this.btnCancel.Location = new System.Drawing.Point(326, 324);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(188, 23);
            this.btnCancel.TabIndex = 7;
            this.btnCancel.Text = "取消";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            //
            // btnExclude
            //
            this.btnExclude.Location = new System.Drawing.Point(926, 324);
            this.btnExclude.Name = "btnExclude";
            this.btnExclude.Size = new System.Drawing.Size(151, 23);
            this.btnExclude.TabIndex = 8;
            this.btnExclude.Text = "从VS的搜索结果中排除";
            this.btnExclude.UseVisualStyleBackColor = true;
            this.btnExclude.Click += new System.EventHandler(this.btnExclude_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1080, 593);
            this.Controls.Add(this.btnExclude);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.txtFilePattern);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.txtLog);
            this.Controls.Add(this.txtRegexes);
            this.Controls.Add(this.btnCheck);
            this.Controls.Add(this.btnChooseFolder);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtFolder);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Form1";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox txtFolder;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnChooseFolder;
        private System.Windows.Forms.Button btnCheck;
        private System.Windows.Forms.TextBox txtRegexes;
        private System.Windows.Forms.TextBox txtLog;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.TextBox txtFilePattern;
        private System.Windows.Forms.Button btnCancel;
        private System.Windows.Forms.Button btnExclude;
    }
}


text:
#include "Revision.h"
#include "JNIUtil.h"
#include "EnumMapper.h"

const svn_opt_revision_kind Revision::START = svn_opt_revision_unspecified;
const svn_opt_revision_kind Revision::HEAD = svn_opt_revision_head;

Revision::Revision (const svn_opt_revision_kind kind)
{
  m_revision.kind = kind;
  m_revision.value.number = 0;
}

Revision::Revision(jobject jthis, bool headIfUnspecified,
                   bool oneIfUnspecified)
{
  if (jthis == NULL)
    {
      m_revision.kind = svn_opt_revision_unspecified;
      m_revision.value.number = 0;
    }
  else
    {
      JNIEnv *env = JNIUtil::getEnv();

      // Create a local frame for our references
      env->PushLocalFrame(LOCAL_FRAME_SIZE);
      if (JNIUtil::isJavaExceptionThrown())
        return;

      static jfieldID fid = 0;
      if (fid == 0)
        {
          jclass clazz = env->FindClass(JAVA_PACKAGE"/types/Revision");
          if (JNIUtil::isJavaExceptionThrown())
            POP_AND_RETURN_NOTHING();

          fid = env->GetFieldID(clazz, "revKind",
                                "L"JAVA_PACKAGE"/types/Revision$Kind;");
          if (JNIUtil::isJavaExceptionThrown())
            POP_AND_RETURN_NOTHING();
        }
      jobject jKind = env->GetObjectField(jthis, fid);
      if (JNIUtil::isJavaExceptionThrown())
        POP_AND_RETURN_NOTHING();

      m_revision.value.number = 0;
      m_revision.kind = EnumMapper::toRevisionKind(jKind);

      switch(m_revision.kind)
        {
        case svn_opt_revision_number:
          {
            static jfieldID fidNum = 0;
            if (fidNum == 0)
              {
                jclass clazz =
                  env->FindClass(JAVA_PACKAGE"/types/Revision$Number");
                if (JNIUtil::isJavaExceptionThrown())
                  POP_AND_RETURN_NOTHING();

                fidNum = env->GetFieldID(clazz, "revNumber", "J");
                if (JNIUtil::isJavaExceptionThrown())
                  POP_AND_RETURN_NOTHING();
              }
            jlong jNumber = env->GetLongField(jthis, fidNum);
            m_revision.value.number = (svn_revnum_t) jNumber;
          }
          break;
        case svn_opt_revision_date:
          {
            static jfieldID fidDate = 0;
            if (fidDate == 0)
              {
                jclass clazz =
                  env->FindClass(JAVA_PACKAGE"/types/Revision$DateSpec");
                if (JNIUtil::isJavaExceptionThrown())
                  POP_AND_RETURN_NOTHING();

                fidDate = env->GetFieldID(clazz, "revDate",
                                          "Ljava/util/Date;");
                if (JNIUtil::isJavaExceptionThrown())
                  POP_AND_RETURN_NOTHING();
              }
            jobject jDate = env->GetObjectField(jthis, fidDate);
            if (JNIUtil::isJavaExceptionThrown())
              POP_AND_RETURN_NOTHING();

            static jmethodID mid = 0;
            if (mid == 0)
              {
                jclass clazz = env->FindClass("java/util/Date");
                if (JNIUtil::isJavaExceptionThrown())
                  POP_AND_RETURN_NOTHING();

                mid = env->GetMethodID(clazz, "getTime", "()J");
                if (JNIUtil::isJavaExceptionThrown())
                  POP_AND_RETURN_NOTHING();
              }
            jlong jMillSec = env->CallLongMethod(jDate, mid);
            if (JNIUtil::isJavaExceptionThrown())
              POP_AND_RETURN_NOTHING();

            m_revision.value.date = jMillSec * 1000;
          }
          break;
        default:
          /* None of the other revision kinds need special handling. */
          break;
        }
      env->PopLocalFrame(NULL);
    }
  if (headIfUnspecified && m_revision.kind == svn_opt_revision_unspecified)
    m_revision.kind = svn_opt_revision_head;
  else if (oneIfUnspecified && m_revision.kind == svn_opt_revision_unspecified)
    {
      m_revision.kind = svn_opt_revision_number;
      m_revision.value.number = 1;
    }
}

Revision::~Revision()
{
}

const svn_opt_revision_t *Revision::revision () const
{
  return &m_revision;
}

jobject
Revision::makeJRevision(svn_revnum_t rev)
{
  JNIEnv *env = JNIUtil::getEnv();
  jclass clazz = env->FindClass(JAVA_PACKAGE "/types/Revision");
  if (JNIUtil::isJavaExceptionThrown())
    return NULL;

  static jmethodID getInstance = 0;
  if (getInstance == 0)
    {
      getInstance = env->GetStaticMethodID(clazz, "getInstance",
                                           "(J)L" JAVA_PACKAGE "/types/Revision;");
      if (JNIUtil::isExceptionThrown())
        return NULL;
    }

  jobject jrevision = env->CallStaticObjectMethod(clazz, getInstance,
                                                  (jlong) rev);
  if (JNIUtil::isExceptionThrown())
    return NULL;

  return jrevision;
}


text:
<?php

namespace nadir\core;

/**
 * This is а class of the View (the view in a strictly).
 * @property mixed $name The variable for a passing custom data from a controller
 * to the view file.
 * @author Leonid Selikhov.
 */
class View extends AbstractCompositeView
{

    /**
     * {@inheritdoc}
     */
    public function render()
    {
        include $this->filePath;
    }
}


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

#include "JSArrayBuffer.h"
#include "JSCInlines.h"
#include "TypeError.h"
#include "TypedArrayController.h"

namespace JSC {

const ClassInfo JSArrayBufferView::s_info = {
    "ArrayBufferView", &Base::s_info, 0, CREATE_METHOD_TABLE(JSArrayBufferView)
};

String JSArrayBufferView::toStringName(const JSObject*, ExecState*)
{
    return ASCIILiteral("Object");
}

JSArrayBufferView::ConstructionContext::ConstructionContext(
    Structure* structure, uint32_t length, void* vector)
    : m_structure(structure)
    , m_vector(vector)
    , m_length(length)
    , m_mode(FastTypedArray)
    , m_butterfly(nullptr)
{
    RELEASE_ASSERT(length <= fastSizeLimit);
}

JSArrayBufferView::ConstructionContext::ConstructionContext(
    VM& vm, Structure* structure, uint32_t length, uint32_t elementSize,
    InitializationMode mode)
    : m_structure(0)
    , m_length(length)
    , m_butterfly(0)
{
    if (length <= fastSizeLimit) {
        // Attempt GC allocation.
        void* temp;
        size_t size = sizeOf(length, elementSize);
        if (size) {
            temp = vm.auxiliarySpace.tryAllocate(nullptr, size);
            if (!temp)
                return;
        } else
            temp = nullptr;

        m_structure = structure;
        m_vector = temp;
        m_mode = FastTypedArray;

        if (mode == ZeroFill) {
            uint64_t* asWords = static_cast<uint64_t*>(m_vector);
            for (unsigned i = size / sizeof(uint64_t); i--;)
                asWords[i] = 0;
        }

        return;
    }

    // Don't allow a typed array to use more than 2GB.
    if (length > static_cast<unsigned>(INT_MAX) / elementSize)
        return;

    if (mode == ZeroFill) {
        if (!tryFastCalloc(length, elementSize).getValue(m_vector))
            return;
    } else {
        if (!tryFastMalloc(length * elementSize).getValue(m_vector))
            return;
    }

    vm.heap.reportExtraMemoryAllocated(static_cast<size_t>(length) * elementSize);

    m_structure = structure;
    m_mode = OversizeTypedArray;
}

JSArrayBufferView::ConstructionContext::ConstructionContext(
    VM& vm, Structure* structure, RefPtr<ArrayBuffer>&& arrayBuffer,
    unsigned byteOffset, unsigned length)
    : m_structure(structure)
    , m_length(length)
    , m_mode(WastefulTypedArray)
{
    m_vector = static_cast<uint8_t*>(arrayBuffer->data()) + byteOffset;
    IndexingHeader indexingHeader;
    indexingHeader.setArrayBuffer(arrayBuffer.get());
    m_butterfly = Butterfly::create(vm, 0, 0, 0, true, indexingHeader, 0);
}

JSArrayBufferView::ConstructionContext::ConstructionContext(
    Structure* structure, RefPtr<ArrayBuffer>&& arrayBuffer,
    unsigned byteOffset, unsigned length, DataViewTag)
    : m_structure(structure)
    , m_length(length)
    , m_mode(DataViewMode)
    , m_butterfly(0)
{
    m_vector = static_cast<uint8_t*>(arrayBuffer->data()) + byteOffset;
}

JSArrayBufferView::JSArrayBufferView(VM& vm, ConstructionContext& context)
    : Base(vm, context.structure(), context.butterfly())
    , m_length(context.length())
    , m_mode(context.mode())
{
    m_vector.setWithoutBarrier(context.vector());
}

void JSArrayBufferView::finishCreation(VM& vm)
{
    Base::finishCreation(vm);
    switch (m_mode) {
    case FastTypedArray:
        return;
    case OversizeTypedArray:
        vm.heap.addFinalizer(this, finalize);
        return;
    case WastefulTypedArray:
        vm.heap.addReference(this, butterfly()->indexingHeader()->arrayBuffer());
        return;
    case DataViewMode:
        ASSERT(!butterfly());
        vm.heap.addReference(this, jsCast<JSDataView*>(this)->possiblySharedBuffer());
        return;
    }
    RELEASE_ASSERT_NOT_REACHED();
}

void JSArrayBufferView::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSArrayBufferView* thisObject = jsCast<JSArrayBufferView*>(cell);

    if (thisObject->hasArrayBuffer()) {
        WTF::loadLoadFence();
        ArrayBuffer* buffer = thisObject->possiblySharedBuffer();
        RELEASE_ASSERT(buffer);
        visitor.addOpaqueRoot(buffer);
    }

    Base::visitChildren(thisObject, visitor);
}

bool JSArrayBufferView::put(
    JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value,
    PutPropertySlot& slot)
{
    JSArrayBufferView* thisObject = jsCast<JSArrayBufferView*>(cell);

    if (UNLIKELY(isThisValueAltered(slot, thisObject)))
        return ordinarySetSlow(exec, thisObject, propertyName, value, slot.thisValue(), slot.isStrictMode());

    return Base::put(thisObject, exec, propertyName, value, slot);
}

ArrayBuffer* JSArrayBufferView::unsharedBuffer()
{
    ArrayBuffer* result = possiblySharedBuffer();
    RELEASE_ASSERT(!result->isShared());
    return result;
}

void JSArrayBufferView::finalize(JSCell* cell)
{
    JSArrayBufferView* thisObject = static_cast<JSArrayBufferView*>(cell);
    ASSERT(thisObject->m_mode == OversizeTypedArray || thisObject->m_mode == WastefulTypedArray);
    if (thisObject->m_mode == OversizeTypedArray)
        fastFree(thisObject->m_vector.get());
}

JSArrayBuffer* JSArrayBufferView::unsharedJSBuffer(ExecState* exec)
{
    return exec->vm().m_typedArrayController->toJS(exec, globalObject(), unsharedBuffer());
}

JSArrayBuffer* JSArrayBufferView::possiblySharedJSBuffer(ExecState* exec)
{
    return exec->vm().m_typedArrayController->toJS(exec, globalObject(), possiblySharedBuffer());
}

void JSArrayBufferView::neuter()
{
    RELEASE_ASSERT(hasArrayBuffer());
    RELEASE_ASSERT(!isShared());
    m_length = 0;
    m_vector.clear();
}

} // namespace JSC

namespace WTF {

using namespace JSC;

void printInternal(PrintStream& out, TypedArrayMode mode)
{
    switch (mode) {
    case FastTypedArray:
        out.print("FastTypedArray");
        return;
    case OversizeTypedArray:
        out.print("OversizeTypedArray");
        return;
    case WastefulTypedArray:
        out.print("WastefulTypedArray");
        return;
    case DataViewMode:
        out.print("DataViewMode");
        return;
    }
    RELEASE_ASSERT_NOT_REACHED();
}

} // namespace WTF