text:
package javas.grammar;

import java.lang.reflect.*;
import java.util.ArrayList;

/**
 * @author sunny
 * @version 1.0.0
 * @since 2012-11-28
 */
public class TestReflection {

    public TestReflection testReflection = new TestReflection();
    private static ArrayList<Object> visited = new ArrayList<Object>();

    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        // getClassField();
        Employee employee = new Employee();
        employee.setName("TaylorSwift");
        employee.setCompany("google");
        employee.setSalary(1234);
        employee.setSex("man");
        String str = TestReflection.toString(employee);
        System.out.println(str);
    }

    public TestReflection() {

    }

    /**
     * test extends Object getClass() method
     */
    public static void testClass() {
        Employee employee = new Employee();
        Class cls = employee.getClass();
        System.out.println(cls);
    }

    /**
     * print class
     *
     * @param className className
     */
    private static void printClass(String className) {
        Class cls = null;
        try {
            cls = Class.forName(className);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        printClassName(cls);
        printFields(cls);
        printConstructors(cls);
        prinMethods(cls);

        System.out.println("}");
    }

    /**
     * use reflection to print all features of a class
     */
    private static void printClassName(Class cls) {
        String classDes = "";
        // print class name and modifies and super class name
        String modifies = Modifier.toString(cls.getModifiers());
        classDes = classDes + modifies + " class " + cls.getName();

        Class superClass = cls.getSuperclass();
        String superClassName = superClass.getName();
        if (superClassName != null && superClassName.length() > 0) {
            classDes = classDes + " extends " + superClassName;
        }

        Class[] interfaces = cls.getInterfaces();
        if (interfaces != null && interfaces.length > 0) {
            classDes = classDes + " implements ";
            for (int i = 0; i < interfaces.length; i++) {
                if (i > 0) {
                    classDes = classDes + ",";
                }
                classDes = classDes + interfaces[i].getName();
            }
        }
        classDes = classDes + "\n{\n";
        System.out.print(classDes);
    }

    /**
     * print class fields
     */
    private static void printFields(Class cls) {
        Field[] fields = cls.getDeclaredFields();
        for (Field field : fields) {
            String fieldModifies = Modifier.toString(field.getModifiers());
            String fieldName = field.getName();
            System.out.print(fieldModifies + " " + fieldName + ";\n");
        }
        System.out.println();
    }

    /**
     * print class fields
     */
    private static void printConstructors(Class cls) {
        Constructor[] constructors = cls.getDeclaredConstructors();
        for (Constructor constructor : constructors) {
            String constructorModifies = Modifier.toString(constructor.getModifiers());
            String constructorName = constructor.getName();
            System.out.print(constructorModifies + " " + constructorName + "(");

            // print parameter types
            Class[] cl = constructor.getParameterTypes();
            for (int i = 0; i < cl.length; i++) {
                if (i > 0) {
                    System.out.print(",");
                }
                System.out.print(cl[i].getName());
            }
            System.out.print(");\n");
        }
        System.out.println();
    }

    /**
     * print class fields
     */
    private static void prinMethods(Class cls) {
        Method[] methods = cls.getDeclaredMethods();
        for (Method method : methods) {
            String methodModifies = Modifier.toString(method.getModifiers());
            Class returnType = method.getReturnType();
            String returnName = returnType.getName();
            String methodName = method.getName();
            System.out.print(methodModifies + " " + returnName + " " + methodName + "(");

            // print parameter types
            Class[] cl = method.getParameterTypes();
            for (int i = 0; i < cl.length; i++) {
                if (i > 0) {
                    System.out.print(",");
                }
                System.out.print(cl[i].getName());
            }
            System.out.print(");\n");
        }
    }

    /**
     * get field of a class
     */
    private static void getClassField() throws NoSuchFieldException, IllegalAccessException {
        Employee e = new Employee();
        e.setName("TaylorSwift");
        e.setCompany("microsoft");

        Class cls = e.getClass();
        Field f2 = cls.getDeclaredField("company");
        // can only get this class field or interfaces field ,can't get father
        // class field
        // Field f1 = cls.getDeclaredField("name");

        // if the field is modified by private ,must use setAccessible(true);
        // otherwise ,it will throw java.lang.IllegalAccessException
        f2.setAccessible(true);
        Object object = f2.get(e);
        System.out.println(object);
    }

    public static String toString(Object object) {

        if (object == null) {
            return "null";
        }
        if (visited.contains(object)) {
            return object.toString();// "..."; why?
        }
        visited.add(object);
        Class cls = object.getClass();
        if (cls == String.class) {
            return (String) object;
        }
        if (cls.isArray()) {
            String r = cls.getComponentType() + "[]{";
            for (int i = 0; i < Array.getLength(object); i++) {
                if (i > 0) {
                    r = r + ",";
                }
                Object val = Array.get(object, i);
                if (cls.getComponentType().isPrimitive()) {
                    r = r + val;
                } else {
                    r = r + toString(val);
                }
            }
            return r + "}";
        }

        String r = cls.getName();

        do {
            r = r + "[";
            Field[] fields = cls.getDeclaredFields();
            // set all fields can accessible
            AccessibleObject.setAccessible(fields, true);
            // check the field is static or not
            for (Field field : fields) {
                if (!Modifier.isStatic(field.getModifiers())) {
                    if (!r.endsWith("[")) {
                        r = r + ",";
                    }
                    r = r + field.getName() + "=";
                    try {
                        Object val = field.get(object);
                        r = r + toString(val);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    }
                }
            }
            r = r + "]";
            cls = cls.getSuperclass();
        } while (cls != null);
        return r;
    }

    // method pointer
    public void methodPointer() {
        Employee employee = new Employee();
        employee.setName("TaylorSwift");
        employee.setCompany("google");
        employee.setSalary(1234);
        employee.setSex("man");

    }

}


text:
package org.apache.hadoop.ant.condition;

public class DfsZeroLen extends DfsBaseConditional {
  protected final char flag = 'z';
  protected char getFlag() { return flag; }
}

redpajama_set_name: RedPajamaGithub


text:
@interface LanInfoCell3 : UITableViewCell

+ (LanInfoCell3 *)cellWithTableView:(UITableView *)tableView;

@end


text:
/*	$NetBSD: ssl.h,v 1.2 2014/01/07 02:07:08 joerg Exp $	*/

/*-
 * Copyright (c) 2012 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
#ifdef WITH_SSL

#define FETCH struct fetch_connect
struct fetch_connect;

int fetch_printf(struct fetch_connect *, const char *fmt, ...)
    __printflike(2, 3);
int fetch_fileno(struct fetch_connect *);
int fetch_error(struct fetch_connect *);
int fetch_flush(struct fetch_connect *);
struct fetch_connect *fetch_open(const char *, const char *);
struct fetch_connect *fetch_fdopen(int, const char *);
int fetch_close(struct fetch_connect *);
ssize_t fetch_read(void *, size_t, size_t, struct fetch_connect *);
char *fetch_getln(char *, int, struct fetch_connect *);
int fetch_getline(struct fetch_connect *, char *, size_t, const char **);
void fetch_set_ssl(struct fetch_connect *, void *);
void *fetch_start_ssl(int);

#else	/* !WITH_SSL */

#define FETCH FILE

#define	fetch_printf	fprintf
#define	fetch_fileno	fileno
#define	fetch_error	ferror
#define	fetch_flush	fflush
#define	fetch_open	fopen
#define	fetch_fdopen	fdopen
#define	fetch_close	fclose
#define	fetch_read	fread
#define	fetch_getln	fgets
#define	fetch_getline	get_line
#define	fetch_set_ssl(a, b)

#endif	/* !WITH_SSL */


text:
namespace mx
{
    namespace core
    {
        Ending::Ending()
        :myValue()
        ,myAttributes( std::make_shared<EndingAttributes>() )
        {}

        Ending::Ending( const XsString& value )
        :myValue( value )
        ,myAttributes( std::make_shared<EndingAttributes>() )
        {}

        bool Ending::hasAttributes() const
        {
            return myAttributes->hasValues();
        }

        bool Ending::hasContents() const
        {
            return true;
        }

        std::ostream& Ending::streamAttributes( std::ostream& os ) const
        {
            if ( myAttributes )
            {
                myAttributes->toStream( os );
            }
            return os;
        }

        std::ostream& Ending::streamName( std::ostream& os ) const
        {
            os << "ending";
            return os;
        }

        std::ostream& Ending::streamContents( std::ostream& os, const int indentLevel, bool& isOneLineOnly  ) const
        {
            MX_UNUSED( indentLevel );
            isOneLineOnly = true;
            os << myValue;
            return os;
        }

        EndingAttributesPtr Ending::getAttributes() const
        {
            return myAttributes;
        }

        void Ending::setAttributes( const EndingAttributesPtr& value )
        {
            if ( value )
            {
                myAttributes = value;
            }
        }

        XsString Ending::getValue() const
        {
            return myValue;
        }

        void Ending::setValue( const XsString& value )
        {
            myValue = value;
        }

        bool Ending::fromXElementImpl( std::ostream& message, ::ezxml::XElement& xelement )
        {
            bool isSuccess = true;
            isSuccess &= myAttributes->fromXElement( message, xelement );
            myValue.setValue( xelement.getValue() );
            MX_RETURN_IS_SUCCESS;
        }

    }
}


text:
<!doctype html>

    <title>NeonMob Enhancer</title>
    <link href="../css/settings.css" media="screen" rel="stylesheet" type="text/css">

NeonMob Enhancer Settings

Show Pack Information

            <input class="switch-input" id="pack" type="checkbox" name="pack">

                Yes
                No

Show Rarity Count Information

            <input class="switch-input" id="count" type="checkbox" name="count">

                Yes
                No

Show Chase/Variant Print Count

            <input class="switch-input" id="special" type="checkbox" name="special">

                Yes
                No


text:
package com.amazonaws.services.applicationinsights;

import javax.annotation.Generated;

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

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

/**
 * Interface for accessing Application Insights.
 *

 * Note: Do not directly implement this interface, new methods are added to it regularly. Extend from
 * {@link com.amazonaws.services.applicationinsights.AbstractAmazonApplicationInsights} instead.
 *

 *

 * <fullname>Amazon CloudWatch Application Insights</fullname>
 *

 * Amazon CloudWatch Application Insights is a service that helps you detect common problems with your applications. It
 * enables you to pinpoint the source of issues in your applications (built with technologies such as Microsoft IIS,
 * .NET, and Microsoft SQL Server), by providing key insights into detected problems.
 *

 *

 * After you onboard your application, CloudWatch Application Insights identifies, recommends, and sets up metrics and
 * logs. It continuously analyzes and correlates your metrics and logs for unusual behavior to surface actionable
 * problems with your application. For example, if your application is slow and unresponsive and leading to HTTP 500
 * errors in your Application Load Balancer (ALB), Application Insights informs you that a memory pressure problem with
 * your SQL Server database is occurring. It bases this analysis on impactful metrics and log errors.
 *

 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public interface AmazonApplicationInsights {

    /**
     * The region metadata service name for computing region endpoints. You can use this value to retrieve metadata
     * (such as supported regions) of the service.
     *
     * @see RegionUtils#getRegionsForService(String)
     */
    String ENDPOINT_PREFIX = "applicationinsights";

    /**
     *

     * Adds an application that is created from a resource group.
     *

     *
     * @param createApplicationRequest
     * @return Result of the CreateApplication operation returned by the service.
     * @throws ResourceInUseException
     *         The resource is already created or in use.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @throws TagsAlreadyExistException
     *         Tags are already registered for the specified application ARN.
     * @throws AccessDeniedException
     *         User does not have permissions to perform this action.
     * @sample AmazonApplicationInsights.CreateApplication
     * @see AWS API Documentation
     */
    CreateApplicationResult createApplication(CreateApplicationRequest createApplicationRequest);

    /**
     *

     * Creates a custom component by grouping similar standalone instances to monitor.
     *

     *
     * @param createComponentRequest
     * @return Result of the CreateComponent operation returned by the service.
     * @throws ResourceInUseException
     *         The resource is already created or in use.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.CreateComponent
     * @see AWS API Documentation
     */
    CreateComponentResult createComponent(CreateComponentRequest createComponentRequest);

    /**
     *

     * Adds an log pattern to a LogPatternSet.
     *

     *
     * @param createLogPatternRequest
     * @return Result of the CreateLogPattern operation returned by the service.
     * @throws ResourceInUseException
     *         The resource is already created or in use.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.CreateLogPattern
     * @see AWS API Documentation
     */
    CreateLogPatternResult createLogPattern(CreateLogPatternRequest createLogPatternRequest);

    /**
     *

     * Removes the specified application from monitoring. Does not delete the application.
     *

     *
     * @param deleteApplicationRequest
     * @return Result of the DeleteApplication operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws BadRequestException
     *         The request is not understood by the server.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DeleteApplication
     * @see AWS API Documentation
     */
    DeleteApplicationResult deleteApplication(DeleteApplicationRequest deleteApplicationRequest);

    /**
     *

     * Ungroups a custom component. When you ungroup custom components, all applicable monitors that are set up for the
     * component are removed and the instances revert to their standalone status.
     *

     *
     * @param deleteComponentRequest
     * @return Result of the DeleteComponent operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DeleteComponent
     * @see AWS API Documentation
     */
    DeleteComponentResult deleteComponent(DeleteComponentRequest deleteComponentRequest);

    /**
     *

     * Removes the specified log pattern from a LogPatternSet.
     *

     *
     * @param deleteLogPatternRequest
     * @return Result of the DeleteLogPattern operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws BadRequestException
     *         The request is not understood by the server.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DeleteLogPattern
     * @see AWS API Documentation
     */
    DeleteLogPatternResult deleteLogPattern(DeleteLogPatternRequest deleteLogPatternRequest);

    /**
     *

     * Describes the application.
     *

     *
     * @param describeApplicationRequest
     * @return Result of the DescribeApplication operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DescribeApplication
     * @see AWS API Documentation
     */
    DescribeApplicationResult describeApplication(DescribeApplicationRequest describeApplicationRequest);

    /**
     *

     * Describes a component and lists the resources that are grouped together in a component.
     *

     *
     * @param describeComponentRequest
     * @return Result of the DescribeComponent operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DescribeComponent
     * @see AWS API Documentation
     */
    DescribeComponentResult describeComponent(DescribeComponentRequest describeComponentRequest);

    /**
     *

     * Describes the monitoring configuration of the component.
     *

     *
     * @param describeComponentConfigurationRequest
     * @return Result of the DescribeComponentConfiguration operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DescribeComponentConfiguration
     * @see AWS API Documentation
     */
    DescribeComponentConfigurationResult describeComponentConfiguration(DescribeComponentConfigurationRequest describeComponentConfigurationRequest);

    /**
     *

     * Describes the recommended monitoring configuration of the component.
     *

     *
     * @param describeComponentConfigurationRecommendationRequest
     * @return Result of the DescribeComponentConfigurationRecommendation operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DescribeComponentConfigurationRecommendation
     * @see AWS API Documentation
     */
    DescribeComponentConfigurationRecommendationResult describeComponentConfigurationRecommendation(
            DescribeComponentConfigurationRecommendationRequest describeComponentConfigurationRecommendationRequest);

    /**
     *

     * Describe a specific log pattern from a LogPatternSet.
     *

     *
     * @param describeLogPatternRequest
     * @return Result of the DescribeLogPattern operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.DescribeLogPattern
     * @see AWS API Documentation
     */
    DescribeLogPatternResult describeLogPattern(DescribeLogPatternRequest describeLogPatternRequest);

    /**
     *

     * Describes an anomaly or error with the application.
     *

     *
     * @param describeObservationRequest
     * @return Result of the DescribeObservation operation returned by the service.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @sample AmazonApplicationInsights.DescribeObservation
     * @see AWS API Documentation
     */
    DescribeObservationResult describeObservation(DescribeObservationRequest describeObservationRequest);

    /**
     *

     * Describes an application problem.
     *

     *
     * @param describeProblemRequest
     * @return Result of the DescribeProblem operation returned by the service.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @sample AmazonApplicationInsights.DescribeProblem
     * @see AWS API Documentation
     */
    DescribeProblemResult describeProblem(DescribeProblemRequest describeProblemRequest);

    /**
     *

     * Describes the anomalies or errors associated with the problem.
     *

     *
     * @param describeProblemObservationsRequest
     * @return Result of the DescribeProblemObservations operation returned by the service.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @sample AmazonApplicationInsights.DescribeProblemObservations
     * @see AWS API Documentation
     */
    DescribeProblemObservationsResult describeProblemObservations(DescribeProblemObservationsRequest describeProblemObservationsRequest);

    /**
     *

     * Lists the IDs of the applications that you are monitoring.
     *

     *
     * @param listApplicationsRequest
     * @return Result of the ListApplications operation returned by the service.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.ListApplications
     * @see AWS API Documentation
     */
    ListApplicationsResult listApplications(ListApplicationsRequest listApplicationsRequest);

    /**
     *

     * Lists the auto-grouped, standalone, and custom components of the application.
     *

     *
     * @param listComponentsRequest
     * @return Result of the ListComponents operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.ListComponents
     * @see AWS API Documentation
     */
    ListComponentsResult listComponents(ListComponentsRequest listComponentsRequest);

    /**
     *

     * Lists the INFO, WARN, and ERROR events for periodic configuration updates performed by Application Insights.
     * Examples of events represented are:
     *

     *

     *

     *

     * INFO: creating a new alarm or updating an alarm threshold.
     *

     *

     *

     *

     * WARN: alarm not created due to insufficient data points used to predict thresholds.
     *

     *

     *

     *

     * ERROR: alarm not created due to permission errors or exceeding quotas.
     *

     *

     *

     *
     * @param listConfigurationHistoryRequest
     * @return Result of the ListConfigurationHistory operation returned by the service.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.ListConfigurationHistory
     * @see AWS API Documentation
     */
    ListConfigurationHistoryResult listConfigurationHistory(ListConfigurationHistoryRequest listConfigurationHistoryRequest);

    /**
     *

     * Lists the log pattern sets in the specific application.
     *

     *
     * @param listLogPatternSetsRequest
     * @return Result of the ListLogPatternSets operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.ListLogPatternSets
     * @see AWS API Documentation
     */
    ListLogPatternSetsResult listLogPatternSets(ListLogPatternSetsRequest listLogPatternSetsRequest);

    /**
     *

     * Lists the log patterns in the specific log LogPatternSet.
     *

     *
     * @param listLogPatternsRequest
     * @return Result of the ListLogPatterns operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.ListLogPatterns
     * @see AWS API Documentation
     */
    ListLogPatternsResult listLogPatterns(ListLogPatternsRequest listLogPatternsRequest);

    /**
     *

     * Lists the problems with your application.
     *

     *
     * @param listProblemsRequest
     * @return Result of the ListProblems operation returned by the service.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.ListProblems
     * @see AWS API Documentation
     */
    ListProblemsResult listProblems(ListProblemsRequest listProblemsRequest);

    /**
     *

     * Retrieve a list of the tags (keys and values) that are associated with a specified application. A tag is a
     * label that you optionally define and associate with an application. Each tag consists of a required tag
     * key and an optional associated tag value. A tag key is a general label that acts as a category for
     * more specific tag values. A tag value acts as a descriptor within a tag key.
     *

     *
     * @param listTagsForResourceRequest
     * @return Result of the ListTagsForResource operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @sample AmazonApplicationInsights.ListTagsForResource
     * @see AWS API Documentation
     */
    ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest);

    /**
     *

     * Add one or more tags (keys and values) to a specified application. A tag is a label that you optionally
     * define and associate with an application. Tags can help you categorize and manage application in different ways,
     * such as by purpose, owner, environment, or other criteria.
     *

     *

     * Each tag consists of a required tag key and an associated tag value, both of which you define. A
     * tag key is a general label that acts as a category for more specific tag values. A tag value acts as a descriptor
     * within a tag key.
     *

     *
     * @param tagResourceRequest
     * @return Result of the TagResource operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws TooManyTagsException
     *         The number of the provided tags is beyond the limit, or the number of total tags you are trying to attach
     *         to the specified resource exceeds the limit.
     * @throws ValidationException
     *         The parameter is not valid.
     * @sample AmazonApplicationInsights.TagResource
     * @see AWS API Documentation
     */
    TagResourceResult tagResource(TagResourceRequest tagResourceRequest);

    /**
     *

     * Remove one or more tags (keys and values) from a specified application.
     *

     *
     * @param untagResourceRequest
     * @return Result of the UntagResource operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @sample AmazonApplicationInsights.UntagResource
     * @see AWS API Documentation
     */
    UntagResourceResult untagResource(UntagResourceRequest untagResourceRequest);

    /**
     *

     * Updates the application.
     *

     *
     * @param updateApplicationRequest
     * @return Result of the UpdateApplication operation returned by the service.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @sample AmazonApplicationInsights.UpdateApplication
     * @see AWS API Documentation
     */
    UpdateApplicationResult updateApplication(UpdateApplicationRequest updateApplicationRequest);

    /**
     *

     * Updates the custom component name and/or the list of resources that make up the component.
     *

     *
     * @param updateComponentRequest
     * @return Result of the UpdateComponent operation returned by the service.
     * @throws ResourceInUseException
     *         The resource is already created or in use.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.UpdateComponent
     * @see AWS API Documentation
     */
    UpdateComponentResult updateComponent(UpdateComponentRequest updateComponentRequest);

    /**
     *

     * Updates the monitoring configurations for the component. The configuration input parameter is an escaped JSON of
     * the configuration and should match the schema of what is returned by
     * DescribeComponentConfigurationRecommendation.
     *

     *
     * @param updateComponentConfigurationRequest
     * @return Result of the UpdateComponentConfiguration operation returned by the service.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.UpdateComponentConfiguration
     * @see AWS API Documentation
     */
    UpdateComponentConfigurationResult updateComponentConfiguration(UpdateComponentConfigurationRequest updateComponentConfigurationRequest);

    /**
     *

     * Adds a log pattern to a LogPatternSet.
     *

     *
     * @param updateLogPatternRequest
     * @return Result of the UpdateLogPattern operation returned by the service.
     * @throws ResourceInUseException
     *         The resource is already created or in use.
     * @throws ResourceNotFoundException
     *         The resource does not exist in the customer account.
     * @throws ValidationException
     *         The parameter is not valid.
     * @throws InternalServerException
     *         The server encountered an internal error and is unable to complete the request.
     * @sample AmazonApplicationInsights.UpdateLogPattern
     * @see AWS API Documentation
     */
    UpdateLogPatternResult updateLogPattern(UpdateLogPatternRequest updateLogPatternRequest);

    /**
     * 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:
exports.waitLoaded = function(cb, eb) {
    if (window.document.readyState === "complete") {
        return cb({});
    } else {
        return window.addEventListener("load", cb);
    }
};

exports.onLoad = function(action) {
    return function() {
        window.addEventListener("load", function() {
            action();
        });
    };
};

exports.blur = function(el) {
    return function() {
        return el.blur();
    };
};

exports.focus = function(el) {
    return function() {
        return el.focus();
    };
};


text:
package serviceaccounts

import (
	kapi "k8s.io/kubernetes/pkg/apis/core"
)

// IsValidServiceAccountToken returns true if the given secret contains a service account token valid for the given service account
// TODO, these should collapse onto the upstream method
func IsValidServiceAccountToken(serviceAccount *kapi.ServiceAccount, secret *kapi.Secret) bool {
	if secret.Type != kapi.SecretTypeServiceAccountToken {
		return false
	}
	if secret.Namespace != serviceAccount.Namespace {
		return false
	}
	if secret.Annotations[kapi.ServiceAccountNameKey] != serviceAccount.Name {
		return false
	}
	if secret.Annotations[kapi.ServiceAccountUIDKey] != string(serviceAccount.UID) {
		return false
	}
	if len(secret.Data[kapi.ServiceAccountTokenKey]) == 0 {
		return false
	}
	return true
}


text:
<?php
/**
 * The SteamID library provides an easy way to work with SteamIDs and makes
 * conversions easy. Ported from SteamKit.
 *
 * This 64bit structure is used for identifying various objects on the Steam
 * network.
 *
 * This library requires GMP module to be installed.
 *
 * This implementation was ported from SteamKit:
 * {@link https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/SteamKit2/Types/SteamID.cs}
 *
 * GitHub: {@link https://github.com/xPaw/SteamID.php}
 * Website: {@link https://xpaw.me}
 *
 * @author xPaw
 * @license MIT
 */
class SteamID
{
	/**
	 * @var array Types of steam account
	 */
	private static $AccountTypeChars =
	[
		self::TypeAnonGameServer => 'A',
		self::TypeGameServer     => 'G',
		self::TypeMultiseat      => 'M',
		self::TypePending        => 'P',
		self::TypeContentServer  => 'C',
		self::TypeClan           => 'g',
		self::TypeChat           => 'T', // Lobby chat is 'L', Clan chat is 'c'
		self::TypeInvalid        => 'I',
		self::TypeIndividual     => 'U',
		self::TypeAnonUser       => 'a',
	];

	/**
	 * Steam universes. Each universe is a self-contained Steam instance.
	 */
	const UniverseInvalid  = 0;
	const UniversePublic   = 1;
	const UniverseBeta     = 2;
	const UniverseInternal = 3;
	const UniverseDev      = 4;
	const UniverseMax      = 5; // Max universes, not an actual universe

	/**
	 * Steam account types.
	 */
	const TypeInvalid        = 0;
	const TypeIndividual     = 1;
	const TypeMultiseat      = 2;
	const TypeGameServer     = 3;
	const TypeAnonGameServer = 4;
	const TypePending        = 5;
	const TypeContentServer  = 6;
	const TypeClan           = 7;
	const TypeChat           = 8;
	const TypeP2PSuperSeeder = 9;
	const TypeAnonUser       = 10;

	/**
	 * Steam allows 3 simultaneous user account instances right now.
	 */
	const AllInstances    = 0;
	const DesktopInstance = 1;
	const ConsoleInstance = 2;
	const WebInstance     = 4;

	/**
	 * Special flags for Chat accounts - they go in the top 8 bits
	 * of the steam ID's "instance", leaving 12 for the actual instances
	 */
	const InstanceFlagClan     = 524288; // ( k_unSteamAccountInstanceMask + 1 ) >> 1
	const InstanceFlagLobby    = 262144; // ( k_unSteamAccountInstanceMask + 1 ) >> 2
	const InstanceFlagMMSLobby = 131072; // ( k_unSteamAccountInstanceMask + 1 ) >> 3

	/**
	 * Vanity URL types used by ResolveVanityURL method.
	 */
	const VanityIndividual = 1;
	const VanityGroup      = 2;
	const VanityGameGroup  = 3;

	/**
	 * @var resource
	 */
	private $Data;

	/**
	 * Initializes a new instance of the SteamID class.
	 *
	 * It automatically guesses which type the input is, and works from there.
	 *
	 * @param string|null $Value
	 *
	 * @return SteamID Instance of SteamID class
	 */
	public function __construct( $Value = null )
	{
		$this->Data = gmp_init( 0 );

		if( $Value === null )
		{
			return;
		}

		// SetFromString
		if( preg_match( '/^STEAM_([0-4]):([0-1]):([0-9]{1,10})$/', $Value, $Matches ) === 1 )
		{
			$AccountID = $Matches[ 3 ];

			// Check for max unsigned 32-bit number
			if( gmp_cmp( $AccountID, '4294967295' ) > 0 )
			{
				throw new InvalidArgumentException( 'Provided SteamID exceeds max unsigned 32-bit integer.' );
			}

			$Universe = (int)$Matches[ 1 ];

			// Games before orange box used to incorrectly display universe as 0, we support that
			if( $Universe === self::UniverseInvalid )
			{
				$Universe = self::UniversePublic;
			}

			$AuthServer = (int)$Matches[ 2 ];
			$AccountID = ( (int)$AccountID << 1 ) | $AuthServer;

			$this->SetAccountUniverse( $Universe );
			$this->SetAccountInstance( self::DesktopInstance );
			$this->SetAccountType( self::TypeIndividual );
			$this->SetAccountID( $AccountID );
		}
		// SetFromSteam3String
		else if( preg_match( '/^\\[([AGMPCgcLTIUai]):([0-4]):([0-9]{1,10})(:([0-9]+))?\\]$/', $Value, $Matches ) === 1 )
		{
			$AccountID = $Matches[ 3 ];

			// Check for max unsigned 32-bit number
			if( gmp_cmp( $AccountID, '4294967295' ) > 0 )
			{
				throw new InvalidArgumentException( 'Provided SteamID exceeds max unsigned 32-bit integer.' );
			}

			$Type = $Matches[ 1 ];

			if( $Type === 'i' )
			{
				$Type = 'I';
			}

			if( $Type === 'T' || $Type === 'g' )
			{
				$InstanceID = self::AllInstances;
			}
			else if( isset( $Matches[ 5 ] ) )
			{
				$InstanceID = (int)$Matches[ 5 ];
			}
			else if( $Type === 'U' )
			{
				$InstanceID = self::DesktopInstance;
			}
			else
			{
				$InstanceID = self::AllInstances;
			}

			if( $Type === 'c' )
			{
				$InstanceID = self::InstanceFlagClan;

				$this->SetAccountType( self::TypeChat );
			}
			else if( $Type === 'L' )
			{
				$InstanceID = self::InstanceFlagLobby;

				$this->SetAccountType( self::TypeChat );
			}
			else
			{
				$this->SetAccountType( array_search( $Type, self::$AccountTypeChars, true ) );
			}

			$this->SetAccountUniverse( (int)$Matches[ 2 ] );
			$this->SetAccountInstance( $InstanceID );
			$this->SetAccountID( (int)$AccountID );
		}
		else if( self::IsNumeric( $Value ) )
		{
			$this->Data = gmp_init( $Value, 10 );
		}
		else
		{
			throw new InvalidArgumentException( 'Provided SteamID is invalid.' );
		}
	}

	/**
	 * Renders this instance into it's Steam2 "STEAM_" representation.
	 *
	 * @return string A string Steam2 "STEAM_" representation of this SteamID.
	 */
	public function RenderSteam2()
	{
		switch( $this->GetAccountType() )
		{
			case self::TypeInvalid:
			case self::TypeIndividual:
			{
				$Universe = $this->GetAccountUniverse();
				$AccountID = $this->GetAccountID();

				return 'STEAM_' . $Universe . ':' . ( $AccountID & 1 ) . ':' .
					( $AccountID >> 1 );
			}
			default:
			{
				return $this->ConvertToUInt64();
			}
		}
	}

	/**
	 * Renders this instance into its Steam3 representation.
	 *
	 * @return string A string Steam3 representation of this SteamID.
	 */
	public function RenderSteam3()
	{
		$AccountInstance = $this->GetAccountInstance();
		$AccountType = $this->GetAccountType();
		$AccountTypeChar = isset( self::$AccountTypeChars[ $AccountType ] ) ?
			self::$AccountTypeChars[ $AccountType ] :
			'i';

		$RenderInstance = false;

		switch( $AccountType )
		{
			case self::TypeChat:
			{
				if( $AccountInstance & SteamID :: InstanceFlagClan )
				{
					$AccountTypeChar = 'c';
				}
				else if( $AccountInstance & SteamID :: InstanceFlagLobby )
				{
					$AccountTypeChar = 'L';
				}

				break;
			}
			case self::TypeAnonGameServer:
			case self::TypeMultiseat:
			{
				$RenderInstance = true;

				break;
			}
			case self::TypeIndividual:
			{
				$RenderInstance = $AccountInstance != self::DesktopInstance;

				break;
			}
		}

		$Return = '[' . $AccountTypeChar . ':' . $this->GetAccountUniverse() .
			':' . $this->GetAccountID();

		if( $RenderInstance )
		{
			$Return .= ':' . $AccountInstance;
		}

		return $Return . ']';
	}

	/**
	 * Gets a value indicating whether this instance is valid.
	 *
	 * @return bool true if this instance is valid; otherwise, false.
	 */
	public function IsValid()
	{
		$AccountType = $this->GetAccountType();

		if( $AccountType <= self::TypeInvalid || $AccountType >= 11 ) // EAccountType.Max
		{
			return false;
		}

		$AccountUniverse = $this->GetAccountUniverse();

		if( $AccountUniverse <= self::UniverseInvalid || $AccountUniverse >= self::UniverseMax )
		{
			return false;
		}

		$AccountID = $this->GetAccountID();
		$AccountInstance = $this->GetAccountInstance();

		if( $AccountType === self::TypeIndividual )
		{
			if( $AccountID == 0 || $AccountInstance > self::WebInstance )
			{
				return false;
			}
		}

		if( $AccountType === self::TypeClan )
		{
			if( $AccountID == 0 || $AccountInstance != 0 )
			{
				return false;
			}
		}

		if( $AccountType === self::TypeGameServer )
		{
			if( $AccountID == 0 )
			{
				return false;
			}
		}

		return true;
	}

	/**
	 * Returns a SteamID instance constructed from a steamcommunity.com
	 * URL form, or simply from a vanity url.
	 *
	 * Please note that you must implement vanity lookup function using
	 * ISteamUser/ResolveVanityURL api interface yourself.
	 *
	 * Callback function must return resolved SteamID as a string,
	 * or null if API returns success=42 (meaning no match).
	 *
	 * It's up to you to throw any exceptions if you wish to do so.
	 *
	 * This function can act as a pass-through for rendered Steam2/Steam3 ids.
	 *
	 * Example implementation is provided in `VanityURLs.php` file.
	 *
	 * @param string $Value Input URL
	 * @param string $VanityCallback Callback which is called when a vanity lookup is required
	 *
	 * @return SteamID Fluent interface
	 *
	 * @throws InvalidArgumentException
	 */
	public static function SetFromURL( $Value, callable $VanityCallback )
	{
		if( preg_match( '/^https?:\/\/steamcommunity.com\/profiles\/(.+?)(?:\/|$)/', $Value, $Matches ) === 1 )
		{
			$Value = $Matches[ 1 ];
		}
		else if( preg_match( '/^https?:\/\/steamcommunity.com\/(id|groups|games)\/([\w-]+)(?:\/|$)/', $Value, $Matches ) === 1
		||       preg_match( '/^()([\w-]+)$/', $Value, $Matches ) === 1 ) // Empty capturing group so that $Matches has same indexes
		{
			$Length = strlen( $Matches[ 2 ] );

			if( $Length < 2 || $Length > 32 )
			{
				throw new InvalidArgumentException( 'Provided vanity url has bad length.' );
			}

			// Steam doesn't allow vanity urls to be valid steamids
			if( self::IsNumeric( $Matches[ 2 ] ) )
			{
				$SteamID = new SteamID( $Matches[ 2 ] );

				if( $SteamID->IsValid() )
				{
					return $SteamID;
				}
			}

			switch( $Matches[ 1 ] )
			{
				case 'groups': $VanityType = self::VanityGroup; break;
				case 'games' : $VanityType = self::VanityGameGroup; break;
				default      : $VanityType = self::VanityIndividual;
			}

			$Value = call_user_func( $VanityCallback, $Matches[ 2 ], $VanityType );

			if( $Value === null )
			{
				throw new InvalidArgumentException( 'Provided vanity url does not resolve to any SteamID.' );
			}
		}

		return new SteamID( $Value );
	}

	/**
	 * Sets the various components of this SteamID from a 64bit integer form.
	 *
	 * @param int $Value The 64bit integer to assign this SteamID from.
	 *
	 * @return SteamID Fluent interface
	 *
	 * @throws InvalidArgumentException
	 */
	public function SetFromUInt64( $Value )
	{
		if( self::IsNumeric( $Value ) )
		{
			$this->Data = gmp_init( $Value, 10 );
		}
		else
		{
			throw new InvalidArgumentException( 'Provided SteamID is not numeric.' );
		}

		return $this;
	}

	/**
	 * Converts this SteamID into it's 64bit integer form. This function returns
	 * as a string to work on 32-bit PHP systems.
	 *
	 * @return string A 64bit integer representing this SteamID.
	 */
	public function ConvertToUInt64()
	{
		return gmp_strval( $this->Data );
	}

	/**
	 * Gets the account id.
	 *
	 * @return int The account id.
	 */
	public function GetAccountID()
	{
		return gmp_intval( $this->Get( 0, '4294967295' ) ); // 4294967295 = 0xFFFFFFFF
	}

	/**
	 * Gets the account instance.
	 *
	 * @return int The account instance.
	 */
	public function GetAccountInstance()
	{
		return gmp_intval( $this->Get( 32, '1048575' ) ); // 1048575 = 0xFFFFF
	}

	/**
	 * Gets the account type.
	 *
	 * @return int The account type.
	 */
	public function GetAccountType()
	{
		return gmp_intval( $this->Get( 52, '15' ) ); // 15 = 0xF
	}

	/**
	 * Gets the account universe.
	 *
	 * @return int The account universe.
	 */
	public function GetAccountUniverse()
	{
		return gmp_intval( $this->Get( 56, '255' ) ); // 255 = 0xFF
	}

	/**
	 * Sets the account id.
	 *
	 * @param int $Value The account id.
	 *
	 * @return SteamID Fluent interface
	 */
	public function SetAccountID( $Value )
	{
		$this->Set( 0, '4294967295', $Value ); // 4294967295 = 0xFFFFFFFF

		return $this;
	}

	/**
	 * Sets the account instance.
	 *
	 * @param int $Value The account instance.
	 *
	 * @return SteamID Fluent interface
	 */
	public function SetAccountInstance( $Value )
	{
		$this->Set( 32, '1048575', $Value ); // 1048575 = 0xFFFFF

		return $this;
	}

	/**
	 * Sets the account type.
	 *
	 * @param int $Value The account type.
	 *
	 * @return SteamID Fluent interface
	 */
	public function SetAccountType( $Value )
	{
		$this->Set( 52, '15', $Value ); // 15 = 0xF

		return $this;
	}

	/**
	 * Sets the account universe.
	 *
	 * @param int $Value The account universe.
	 *
	 * @return SteamID Fluent interface
	 */
	public function SetAccountUniverse( $Value )
	{
		$this->Set( 56, '255', $Value ); // 255 = 0xFF

		return $this;
	}

	/**
	 * @param int $BitOffset
	 * @param int $ValueMask
	 *
	 * @return resource
	 */
	private function Get( $BitOffset, $ValueMask )
	{
		return gmp_and( self::ShiftRight( $this->Data, $BitOffset ), $ValueMask );
	}

	/**
	 * @param int $BitOffset
	 * @param int $ValueMask
	 * @param int $Value
	 *
	 * @return void
	 */
	private function Set( $BitOffset, $ValueMask, $Value )
	{
		$this->Data = gmp_or(
			gmp_and( $this->Data, gmp_com( self::ShiftLeft( $ValueMask, $BitOffset ) ) ),
			self::ShiftLeft( gmp_and( $Value, $ValueMask ), $BitOffset )
		);
	}

	/**
	 * Shift the bits of $x by $n steps to the left
	 *
	 * @param int|resource $x
	 * @param int $n
	 *
	 * @return resource
	 */
	private static function ShiftLeft( $x, $n )
	{
		return gmp_mul( $x, gmp_pow( 2, $n ) );
	}

	/**
	 * Shift the bits of $x by $n steps to the right
	 *
	 * @param int|resource $x
	 * @param int$n
	 *
	 * @return resource
	 */
	private static function ShiftRight( $x, $n )
	{
		return gmp_div( $x, gmp_pow( 2, $n ) );
	}

	/**
	 * This is way more restrictive than php's is_numeric()
	 */
	private static function IsNumeric( $n )
	{
		return preg_match( '/^[1-9][0-9]{0,19}$/', $n ) === 1;
	}
}


text:
\chapter{XSD}

Dans cette partie, nous expliquerons notre conception de la partie validation d'un document XML à partir d'un document XSD.

\section{Hypothèses simplificatrices}
	Afin de simplifier l'implémentation du parseur XSD, les hypothèses suivantes ont été posées :
	\begin{itemize}
		\item{Les types simples seront de type \textit{string} ou \textit{date}}
		\item{Les types complexes seront de type \textit{sequence} ou \textit{choice} et pourront contenir des attributs}
	\end{itemize}

\section{Fonctionalités implémentées}
Les points suivants sont pris en charge par le validateur XSD :
\begin{itemize}
    \item{Choix d'éléments racine multiples}
    \item{Présence et type des attributs}
    \item{Éléments de types \textit{mixed}}
    \item{Types complexes contenant des éléments \textit{sequence} et \textit{choice} imbriqués}
    \item{Nombre d'occurences minimum et maximum par élément}
    \item{Références sur des attributs, éléments et types}
\end{itemize}

\section{Diagramme de classes}
Les classes ici décrites seront rattachées au \textit{\lstinline$namespace Xsd$} défini en C++.

\begin{landscape}
\begin{figure}[H]
	\centering
	\includegraphics[width=1\linewidth]{images/xsd-uml.pdf}
	\caption{Diagramme de classe de la validation xsd}
	\label{xsdClassDiagram}
\end{figure}
\end{landscape}

\section{Entités}
	\subsection{Checker}
		Un objet Checker décrit les règles présentes dans un document XSD. Les méthodes principales sont les suivantes :
		\begin{itemize}
			\item \textbf{parseXsd} : méthode statique retournant un objet de type \textit{Checker},  construit à partir du document XSD passé en paramètre
			\item \textbf{isValid} : retourne \textit{true} si le document XML passé en paramètre est en accord avec les contraintes inscrites dans l'objet \textit{Checker} courant, \textit{false} sinon
		\end{itemize}

		La structure intermédiaire s'appuie sur 3 tables de hachages :
		\begin{itemize}
			\item \textbf{mTypes} : associe le nom (chaîne de caractères) d'un type avec son objet de type \textit{Type}
			\item \textbf{mElementsTypes} : associe le nom d'un élément avec le nom de son type
			\item \textbf{mAttributesTypes} : associe le nom d'un attribut avec le nom de son type
		\end{itemize}

	\subsection{Element}
		Un élément est une chaîne de caractères, associé\footnote{Dans la suite de cette partie, le terme \textit{associer} correspondra à l'insertion d'une paire clé/valeur dans une table de hachage} à un type dans la table de hachage \textit{mElementsTypes} d'un objet de type \textit{Checker}.

	\subsection{Type}
		On objet \textit{Type} correspond à un type complexe XSD. Il est défini par deux éléments :
		\textit{Expression régulière} : Cette chaîne de caractères détermine l'ensemble des fils directs que l'élément rattaché au type peut recevoir. Elle spécifie leur ordre et nombre d'occurences.
			\textbf{Exemple} : \textit{(<fromage>){4}|(<poisson>){1})} sera l'expression régulière du type associé à l'élément \textit{pizza}.
			Elle indique qu'une pizza peut contenir 4 fromages ou un poisson.
		\textit{Liste d'attributs} : Cette liste décrit les attributs que contiendra l'élément rattaché au type courant, l'ordre des attributs n'ayant pas d'importance.

	\subsection{Attribute}
		Un attribut est décrit par son nom et un attribut \textit{required} à \textit{true} ou \textit{false}. Il est également associé à un type dans la table de hachage \textit{mAttributesTypes}.

\section{Algorithme}

\subsection{Construction de la structure intermédiaire}
L'algorithme présent construit un objet Checker, lequel contiendra un ensemble de types et attributs.
Cet algorithme parcours en une passe l'arbre XML obtenu lors du parsing préalable du document XSD.
Il s'agît d'un algorithme récursif, le parcours de l'arbre XML pouvant être assimilé à un parseur de type SAX sur le document XSD.

	\subsubsection{Parsing du document XSD : \textit{parseXsd}}
		\lstinline$Parsing du document XSD sous forme d arbre XML$\\
		\lstinline$Parsing du type de l element racine (c.f. parseComplexType)$\\ \footnote{L élément \textit{schema} est implicitement de type complexe, ses éléments fils sont traités comme s ils étaient dans un élément \textit{choice}}
		\lstinline$Association du "ROOT_TYPE" avec le type recu$\\
		\lstinline$Association du nom d element "ROOT" avec le type recu$\\
		\lstinline$Verification des references (c.f. checkReferences)$\\

	\subsubsection{Parsing d'un élément \textit{complexType} : \textit{parseComplexType}}
		\lstinline$SI l element complexType a un attribut mixed a true$\\
		\indent \lstinline$Ajout de ".*" au separateur d elements de la regex$\\

		\lstinline$Parcours des fils de l element complextype$\\
		\indent \lstinline$SI c est un element sequence$\\
		\indent \indent \lstinline$Appel recursif$\\
		\indent \lstinline$SI c est un element choice$\\
		\indent \indent \lstinline$Appel recursif avec le separateur "|"$\\
		\indent \lstinline$SI c est un element element$\\
		\indent \indent \lstinline$on ajoute a la regex de l element complexType celle de l element retournee par parseElement() + le separateur$\\
		\indent \lstinline$SI c est un element attribute$\\
		\indent \indent \lstinline$Parsing de l attribut (c.f. parseAttribute)$\\
		\indent \indent \lstinline$Ajout de l attribut a la map d attributs du type courant$\\

		\lstinline$On retourne la regex associee au type$\\

	\subsubsection{Parsing d'un élément \textit{element} XSD : \textit{parseElement}}
		\lstinline$Construction d une regex decrivant l element en fonction de ses occurences$\\ \footnote{Par exemple, pour <xsd:element name="parfum" type="xsd:string" minOccurs="1" maxOccurs="2"/> on generera l expression (<pizza>){1}((<pizza>)?){1}}
		\lstinline$SI ce n est pas une reference$\\
		\indent \lstinline$SI l element a des enfants (c est un type complexe)$\\
		\indent \indent \lstinline$Construction d un type avec le premier fils de l element$\\ \footnote{Le constructeur de type appelle \textit{parseComplexType}}
		\indent \indent \lstinline$Association du nom du type avec le type construit$\\
		\indent \lstinline$Association du nom de l element avec le nom du type construit$\\
		\lstinline$On retourne la regex associee a l element$\\

	\subsubsection{Parsing d'un élément \textit{attribute} : \textit{parseAttribute}}
		\lstinline$SI les attributs nom et type sont definis, et que c est un type simple$\\
		\indent \lstinline$Association du nom de l attribut avec le nom du type$\\
		\lstinline$On retourne un nouvel attribut a partir d un nom et d un booleen required$\\

	\subsubsection{Vérification des références : \textit{checkReferences}}
		\lstinline$Pour chaque element$\\
		\indent \lstinline$On verifie que l element est rattache a un type dans mElementsTypes$\\
		\lstinline$Pour chaque type$\\
		\indent \lstinline$Pour chaque attribut du type$\\
		\indent \indent \lstinline$On verifie que l attribut est rattache a un type dans mAttributesTypes$\\

\pagebreak

\subsection{Validation d'un document XML}
	\subsubsection{Validation d'un type : \textit{checkValidity}}
		Cette méthode prend un élément XML en paramètre, et valide les attributs qu'il contient et l'architecture de ses fils directs.
		L'appel initial est donc fait sur le type associé au nom de l élément root XML

		\lstinline$On verifie que l ensemble des attributs de l element XML existent dans la map des attributs du type XSD$\\
		\lstinline$Pour chaque attribut XSD du type XSD$\\
		\indent \lstinline$Si l attribut XSD existe$\\
		\indent \indent \lstinline$On verifie que sa valeur valide l expression reguliere de son type$\\
		\indent \lstinline$Si l attribut XSD n existe pas$\\
		\indent \indent \lstinline$On verifie qu il n est pas requis$\\

		\lstinline$Generation d une chaine de caracteres correspondant a la concatenation des balises de ses elements fils$\\
		\lstinline$On verifie que l expression reguliere du type valide cette chaine de caracteres$\\

		\lstinline$Pour chaque element fils de l element XML recu$\\
		\indent \lstinline$Recuperation du type associe au nom du fils$\\
		\indent \lstinline$Appel recursif a la fonction checkValidity sur le type obtenu$\\


text:
function data_out = ...
    dual_secondborn_scatter(data_in,bank,ranges,sibling,data_ft_out,ranges_out)
level_counter = length(ranges)-2;

%% Selection of signal-adapted support to the filter bank
bank_behavior = bank.behavior;
colons = bank_behavior.colons;
subscripts = bank_behavior.subscripts;
signal_support = get_signal_support(data_in,ranges,subscripts);
support_index = log2(bank.spec.size/signal_support) + 1;
dual_psis = bank.dual_psis{support_index};

%% Definition of resampling factors
gamma_subscript = bank_behavior.gamma_subscript;
gamma_range = ranges{1+1}(:,gamma_subscript);
gammas = collect_range(gamma_range);
sibling_log2_resolutions = [sibling.metas.log2_resolution];
sibling_log2_oversampling = sibling.behavior.U.log2_oversampling;
sibling_log2_samplings = ...
    min(sibling_log2_resolutions+sibling_log2_oversampling,0);
log2_resolutions = [bank.metas.log2_resolution];
log2_oversampling = bank_behavior.U.log2_oversampling;
log2_samplings = min(log2_resolutions+log2_oversampling,0);
sibling_subscript = sibling.subscripts;
sibling_matrix = zeros(length(sibling.metas),length(bank.metas));
for gamma_index = 1:length(gammas)
    gamma = gammas(gamma_index);
    sibling_range = ranges{1+0}{gamma_index}(:,sibling_subscript);
    sibling_gammas = collect_range(sibling_range);
    sibling_matrix(sibling_gammas,gamma) = 1;
end

%% Dual-scattering implementations
nThetas = size(bank.dual_psis,2);
is_deepest = size(ranges{end},2)==1;
is_oriented = nThetas>1;
subsref_structure = bank.behavior.colons;

%% D. Deepest
% e.g. dual-scattering along time
if is_deepest && ~is_oriented
    sibling_out_ranges = ranges_out{end}(:,1);
    out_sibling_gammas = collect_range(sibling_out_ranges);
    nOut_sibling_gammas = length(out_sibling_gammas);
    data_out = cell(size(data_ft_out));
    for out_sibling_index = 1:nOut_sibling_gammas
        local_data_ft = data_ft_out{out_sibling_index};
        sibling_gamma = out_sibling_gammas(out_sibling_index);
        enabled_gammas = find(sibling_matrix(sibling_gamma,:));
        nEnabled_gammas = length(enabled_gammas);
        if nEnabled_gammas>0
            for enabled_gamma_index = 1:nEnabled_gammas
                enabled_gamma = enabled_gammas(enabled_gamma_index);
                dual_psi = dual_psis(enabled_gamma);
                log2_resampling = sibling_log2_samplings(sibling_gamma) - ...
                    log2_samplings(enabled_gamma);
                gamma_in_range = ranges{1+1}(:,1);
                in_gamma_index = search_range(gamma_in_range,enabled_gamma);
                sibling_in_range = ...
                    ranges{1+0}{in_gamma_index}(:,sibling_subscript);
                in_sibling_index = search_range(sibling_in_range,sibling_gamma);
                subsref_structure.subs{sibling_subscript} = in_sibling_index;
                local_data = subsref(data_in{in_gamma_index},subsref_structure);
                local_data_ft = multiply_fft_inplace(local_data,dual_psi, ...
                    log2_resampling,colons,subscripts,local_data_ft);
            end
        end
        data_out{out_sibling_index} = ...
            multidimensional_ifft(local_data_ft,subscripts);
    end
end
%% D.O. Oriented
% e.g. dual-scattering along 2d space
if is_deepest && is_oriented
    error('oriented dual_secondborn_scatter not ready yet');
    % This is needed e.g. for images
end
end


text:
'''
Updated on August, 2017
@author: Todd Baumeister <tbaumeist@gmail.com>

Main class for running experiments and anaylzing results
'''
import logging
import argparse
import os
import json
import multiprocessing

from lib.utils import timeit
from lib.metric_manager import MetricManager

CONST_EXPERIMENT = 'experiment'
CONST_CONFIG = 'config'
CONST_GROUP = 'repeat_group'
CONST_ID = 'id'

class Manager(object):
    '''
    Manages everything
    '''

    _experiement_configurations = []

    @timeit
    def main(self, args):
        '''
        Main entry point
        '''
        logging.info('Starting ...')

        output_directory = os.path.abspath(args.d)
        total = self.load_experiments(output_directory)
        self.run_analysis(total, args.t, args.a)
        self.run_summations(output_directory, args.t)
        logging.info('Finished!!!')

    @timeit
    def load_experiments(self, output_directory):
        '''
        Generate experiement configurationas and create fiel structure
        '''
        logging.info('loading experiments ...')
        with open(os.path.join(output_directory, 'experiments.json'), 'r') as e_file:
            self._experiement_configurations = json.loads(e_file.read())

        # make the paths absolute
        for exp_files in self._experiement_configurations:
            exp_files[CONST_CONFIG] = os.path.join(
                output_directory, exp_files[CONST_CONFIG])
            exp_files[CONST_EXPERIMENT] = os.path.join(
                output_directory, exp_files[CONST_EXPERIMENT])

        total = len(self._experiement_configurations)
        logging.info('Loaded %s experiment configurations', total)
        return total

    @timeit
    def run_analysis(self, total, thread_count, should_archive):
        '''
        Run the post run analysis on a experiement
        '''

        # multi thread this
        nb_cores = thread_count
        if thread_count <= 0:
            nb_cores = multiprocessing.cpu_count()
        logging.info('Running experiments on %d threads', nb_cores)
        pool = multiprocessing.Pool(processes=nb_cores)

        count = 1
        for exp_files in self._experiement_configurations:
            if nb_cores > 1:
                pool.apply_async(_run_analysis, args=(
                    exp_files, count, total, should_archive))
            else:
                _run_analysis(exp_files, count, total, should_archive)
            count += 1
        pool.close()
        pool.join()

    @timeit
    def run_summations(self, output_directory, thread_count):
        '''
        Run after all experiments are complete. Compare the variables
        '''
        logging.info('Running experiment comparisions')
        # first calculate the average for each repeat group to average out anomylies
        exp_grouped = self._get_experiments_by_group(
            self._experiement_configurations)
        exp_group_count = len(exp_grouped.keys())
        count = 1
        groups = []

        # multi thread this
        nb_cores = thread_count
        if thread_count <= 0:
            nb_cores = multiprocessing.cpu_count()
        logging.info('Running analysis on %d threads', nb_cores)
        pool = multiprocessing.Pool(processes=nb_cores)

        for exp_files in exp_grouped.values():
            if nb_cores > 1:
                groups.append(pool.apply_async(_run_summations, args=(
                    exp_files, count, exp_group_count)))
            else:
                groups.append(_run_summations(
                    exp_files, count, exp_group_count))
            count += 1
        pool.close()
        pool.join()

        # get the async results
        if nb_cores > 1:
            holder = [result.get() for result in groups]
            groups = holder

        logging.info('Running final summation')
        # caluclate the summary comparision of the experiment runs
        manager = MetricManager(output_directory)
        manager.compare_experiments(groups)
        manager.save_data()

    def _get_experiments_by_group(self, experiments):
        by_groups = {}
        for exp in experiments:
            if exp[CONST_GROUP] not in by_groups:
                by_groups[exp[CONST_GROUP]] = []
            by_groups[exp[CONST_GROUP]].append(exp)
        return by_groups

def _get_base(path):
    return os.path.dirname(path)

def _base(base_path, *args):
    path = base_path
    if args:
        for sec in args:
            path = os.path.join(path, sec)
    return path

def _metrics(base_path, *args):
    path = os.path.join(base_path, 'metrics')
    if args:
        for sec in args:
            path = os.path.join(path, sec)
    return path

@timeit
def _run_summations(exp_files, count, total):
    # set log level (can be lost if multiprocessing is used)
    logging.getLogger().setLevel(logging.INFO)

    first_exp = exp_files[0]
    base_path = _get_base(_get_base(first_exp[CONST_CONFIG]))

    # base directory
    logging.info('Averaging group %d of %d', count, total)
    count += 1

    metric_manager = MetricManager(base_path)
    metric_manager.summarize()
    metric_manager.save_data()
    return metric_manager.metric_file_path

@timeit
def _run_analysis(exp_files, count, total, should_archive):
    # set log level (can be lost if multiprocessing is used)
    logging.getLogger().setLevel(logging.INFO)

    logging.info('Running analysis %d of %d : %d',
                 count, total, exp_files[CONST_ID])

    # base directory
    base_path = _get_base(exp_files[CONST_CONFIG])

    # calculate analysis metrics
    metric_manager = MetricManager(base_path, count)
    metric_manager.analyze()
    metric_manager.save_data()
    if should_archive:
        metric_manager.archive_data()

if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    PARSER = argparse.ArgumentParser(
        description='Run some Anonymous P2P DHT experiment analysis.')
    PARSER.add_argument('-d', default='.', type=str,
                        help='Directory to store output in')
    PARSER.add_argument('-t', default='0', type=int,
                        help='Number of threads to run. Default is the # of core CPUs available')
    PARSER.add_argument('-a', default=False, action='store_true',
                        help='Turn on experiment archiving')
    Manager().main(PARSER.parse_args())


text:
module Orderable
  extend ActiveSupport::Concern

  included do
  # validations
    validates :cliente_id,     presence: true
    validates :comprobante_id, presence: true
    validate  :has_order_items

  # scopes
    scope :recent, -> { order(fecha_emision: :desc) }
    scope :pago, ->(forma_de_pago) { where(forma_de_pago: forma_de_pago) }
    scope :efectivo, -> { pago("Efectivo") }
  end

  def has_order_items
    errors.add(:order_items, "Agrega al menos un ítem") unless order_items.length > 0
  end

  def order_items_params=(order_items_params)
    order_items.destroy_all
    self.order_items = Array(order_items_params).map do |order_item|
      OrderItem.new order_item.merge(order: self)
    end
  end

  def retenciones_params=(retenciones_params)
    retenciones.destroy_all
    self.retenciones = Array(retenciones_params).map do |retencion|
      Retencion.new retencion
    end
  end
end


text:
@interface JVFloatLabeledTextField : UITextField

@property (nonatomic, strong, readonly) UILabel * floatingLabel;
@property (nonatomic, strong) UIFont * floatingLabelFont UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor * floatingLabelTextColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor * floatingLabelActiveTextColor UI_APPEARANCE_SELECTOR; // tint color is used by default if not provided

@end


text:
package net.kuujo.vertigo.component;

import java.util.List;

import net.kuujo.vertigo.Config;
import net.kuujo.vertigo.component.impl.DefaultModuleConfig;
import net.kuujo.vertigo.component.impl.DefaultVerticleConfig;
import net.kuujo.vertigo.hook.ComponentHook;

import org.vertx.java.core.json.JsonObject;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

/**
 * Components are synonymous with Vert.x modules and verticles.
 * Each component can have its own configuration and any number
 * of instances.
 *
 * @author Jordan Halterman
 */
@JsonTypeInfo(
  use=JsonTypeInfo.Id.NAME,
  include=JsonTypeInfo.As.PROPERTY,
  property="type"
)
@JsonSubTypes({
  @JsonSubTypes.Type(value=DefaultModuleConfig.class, name="module"),
  @JsonSubTypes.Type(value=DefaultVerticleConfig.class, name="verticle")
})
public interface ComponentConfig<T extends ComponentConfig<T>> extends Config<T> {

  /**
   * name is a string indicating the network unique component name. This
   * name is used as the basis for generating unique event bus addresses.
   */
  public static final String COMPONENT_NAME = "name";

  /**
   * type is a string indicating the type of component that will be deployed.
   * This can be either module or verticle. This field is required.
   */
  public static final String COMPONENT_TYPE = "type";

  /**
   * module is the module component type.
   */
  public static final String COMPONENT_TYPE_MODULE = "module";

  /**
   * verticle is the verticle component type.
   */
  public static final String COMPONENT_TYPE_VERTICLE = "verticle";

  /**
   * config is an object defining the configuration to pass to each instance
   * of the component. If no configuration is provided then an empty configuration will be
   * passed to component instances.
   */
  public static final String COMPONENT_CONFIG = "config";

  /**
   * instances is a number indicating the number of instances of the
   * component to deploy. Defaults to 1
   */
  public static final String COMPONENT_NUM_INSTANCES = "instances";

  /**
   * group is a component deployment group for HA. This option applies when
   * deploying the network to a cluster.
   */
  public static final String COMPONENT_GROUP = "group";

  /**
   * hooks is an array defining component hooks. Each element in the array
   * must be an object containing a hook field which indicates the hook
   * class name.
   */
  public static final String COMPONENT_HOOKS = "hooks";

  /**
   * Component type.
   *
   * @author Jordan Halterman
   */
  public static enum Type {
    MODULE("module"),
    VERTICLE("verticle");

    private final String name;

    private Type(String name) {
      this.name = name;
    }

    /**
     * Returns the component type name.
     *
     * @return The component type name.
     */
    public String getName() {
      return name;
    }

    @Override
    public String toString() {
      return name;
    }

  }

  /**
   * Returns the component type.
   *
   * @return The component type.
   */
  Type getType();

  /**
   * Returns the component name.
   *
   * @return The component name.
   */
  String getName();

  /**
   * Sets the component name.
   *
   * @param name The component name.
   * @return The component configuration.
   */
  T setName(String name);

  /**
   * Returns the component configuration.
   *
   * @return The component configuration.
   */
  JsonObject getConfig();

  /**
   * Sets the component configuration.
   *

   *
   * This configuration will be passed to component implementations as the verticle or
   * module configuration when the component is started.
   *
   * @param config The component configuration.
   * @return The component configuration.
   */
  T setConfig(JsonObject config);

  /**
   * Returns the number of component instances to deploy within the network.
   *
   * @return The number of component instances.
   */
  int getInstances();

  /**
   * Sets the number of component instances to deploy within the network.
   *
   * @param instances The number of component instances.
   * @return The component configuration.
   */
  T setInstances(int instances);

  /**
   * Sets the component deployment group.
   *
   * @param group The component deployment group.
   * @return The component configuration.
   */
  T setGroup(String group);

  /**
   * Returns the component deployment group.
   *
   * @return The component deployment group.
   */
  String getGroup();

  /**
   * Adds a hook to the component.
   *
   * @param hook The hook to add.
   * @return The component configuration.
   */
  T addHook(ComponentHook hook);

  /**
   * Returns a list of component hooks.
   *
   * @return A list of component hooks.
   */
  List<ComponentHook> getHooks();

}


text:
ActiveRecord::Schema.define version: 0 do
    self.verbose = false

    create_table :entities, force: true do |t|
        t.column :filename, :string
        t.column :file_size, :integer
        t.column :content_type, :string
    end

    create_table :custom_fields_entities, force: true do |t|
        t.column :picture_name, :string
        t.column :picture_size, :integer
        t.column :picture_type, :string
    end
end


text:
.class public Landroid/view/Surface$OutOfResourcesException;
.super Ljava/lang/RuntimeException;
.source "Surface.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/view/Surface;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "OutOfResourcesException"
.end annotation

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 494
    invoke-direct {p0}, Ljava/lang/RuntimeException;-><init>()V

    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 0
    .param p1, "name"    # Ljava/lang/String;

    .prologue
    .line 497
    invoke-direct {p0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    .line 496
    return-void
.end method


text:
@implementation IBDesignableView

#pragma mark Border Color

- (UIColor *)borderColor
{
    return [UIColor colorWithCGColor:self.layer.borderColor];
}

- (void)setBorderColor:(UIColor *)borderColor
{
    self.layer.borderColor = borderColor.CGColor;
}

#pragma mark Border Width

- (CGFloat)borderWidth
{
    return self.layer.borderWidth;
}

- (void)setBorderWidth:(CGFloat)borderWidth
{
    self.layer.borderWidth = borderWidth;
}

#pragma mark Corner Radius

- (CGFloat)cornerRadius
{
    return self.layer.cornerRadius;
}

- (void)setCornerRadius:(CGFloat)cornerRadius
{
    self.layer.cornerRadius = cornerRadius;

    if (cornerRadius != 0.0) {
        self.layer.masksToBounds = YES;
    }
}

@end


text:
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'),
    'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
    'Tests\\' => array($baseDir . '/tests'),
    'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
    'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
    'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
    'Slim\\Views\\' => array($vendorDir . '/slim/php-view/src'),
    'Slim\\' => array($vendorDir . '/slim/slim/Slim'),
    'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
    'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
    'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'),
    'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'),
    'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'),
    'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
    'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'),
    'FastRoute\\' => array($vendorDir . '/nikic/fast-route/src'),
    'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
    'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
    'Curl\\' => array($vendorDir . '/php-curl-class/php-curl-class/src/Curl'),
    'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
);


text:
## Hessian和SpringMVC集成

##### `【原创】` :heart_eyes:
---

如果你还在为WebService的性能、配置等烦恼时,不妨试试Hessian,配置就是so 简单

###服务端代码

1. pom配置:

	```xml
	<dependency>
		<groupId>com.caucho</groupId>
		<artifactId>hessian</artifactId>
		<version>4.0.38</version>
	</dependency>
	```

2. ws-server.xml:

	```xml
	<?xml version="1.0" encoding="UTF-8"?>
	<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
		xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
		default-lazy-init="true">

		<bean name="/ws/user" class="org.springframework.remoting.caucho.HessianServiceExporter">
			<property name="service" ref="UserWsServer" />
			<property name="serviceInterface" value="com.xx.ws.UserWsService" />
		</bean>

	</beans>
	```

3. UserWsService 接口:

	```java
	public interface UserWsService {

		/**
		 * ErrorContext为自定义异常类。因为此为通信功能,最好自己实现一个异常类,异常类中包含错误
		 * 的code、msg等信息
		 */
		String hello(String msg) throws ErrorContext;

	}
	```

4. UserWsServiceImpl 实现类:

	```java
	@Service("UserWsServer")
	public class UserWsServiceImpl implements UserWsService {

		/**
		 * ErrorContext为自定义异常类。因为此为通信功能,最好自己实现一个异常类,异常类中包含错误
		 * 的code、msg等信息
		 */
		@Override
		public String hello(String msg) throws ErrorContext {
			return msg + ":hello";
		}

	}
	```

5. web.xml - 只列出相关的配置,其他配置省略:

	```xml
	<?xml version="1.0" encoding="UTF-8"?>
	<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
		xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
		version="2.5">
		<context-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>
				classpath:applicationContext.xml
	        </param-value>
		</context-param>

		<!-- 其他配置省略......... -->

		<servlet>
			<servlet-name>SpringMVC</servlet-name>
			<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
			<init-param>
				<param-name>contextConfigLocation</param-name>
				<param-value>
					classpath*:mvc-*.xml,
					classpath:ws-server.xml
				</param-value>
			</init-param>
		</servlet>
		<servlet-mapping>
			<servlet-name>SpringMVC</servlet-name>
			<url-pattern>/</url-pattern>
		</servlet-mapping>

		<listener>
			<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
		</listener>

	</web-app>
	```

---

###客户端代码

1. pom配置:

	```xml
	<dependency>
		<groupId>com.caucho</groupId>
		<artifactId>hessian</artifactId>
		<version>4.0.38</version>
	</dependency>
	```

2. ws-client.xml

	```xml
	<?xml version="1.0" encoding="UTF-8"?>
	<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
		xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
		default-lazy-init="true">

		<bean id="userWsService" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
			<property name="serviceUrl" value="http://localhost:8080/xx/ws/user" />
			<property name="serviceInterface" value="com.xx.ws.UserWsService" />
		</bean>

	</beans>
	```

3. UserWsService 接口:

	```java
	public interface UserWsService {

		/**
		 * ErrorContext为自定义异常类。因为此为通信功能,最好自己实现一个异常类,异常类中包含错误
		 * 的code、msg等信息
		 */
		String hello(String msg) throws ErrorContext;

	}
	```

5. web.xml - 只列出相关的配置,其他配置省略:

	```xml
	<?xml version="1.0" encoding="UTF-8"?>
	<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
		xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
		version="2.5">
		<context-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>
				classpath:applicationContext.xml,
				classpath:ws-client.xml,
	        </param-value>
		</context-param>

		<!-- 其他配置省略......... -->

	</web-app>
	```


text:
@(id: Long, parent_id: Long, values: Exhibition)

@Messages("file")

Please enable JavaScript to use file uploader.

			<form method="post" class="form-horizontal" role="form" action="@routes.Galleries.insert(id, parent_id)">
					<input type="submit" class="btn btn-primary" value="@Messages("add")">

			</form>

@Messages("preview")

	@defining(Exhibition.Gallery.list(values.id.get)){exh=>
		@exh.map{pic =>

						@if(pic.position>1){
							}
						@if(pic.position< exh.size){

						}
						@Messages("delete")

								<form id="editCaption" action="@routes.Galleries.update(pic.id.get)" method="post">
								<textarea style="width: 100%" rows="25" name="caption">@pic.caption.getOrElse("")</textarea>
								<input type="submit" class="btn btn-primary" value="@Messages("gallery.send")">
								</form>

		}
	}


text:
package com.biglakesystems.quality;

import org.junit.Test;

import java.util.Collection;
import java.util.Collections;

import static org.junit.Assert.*;

public class TestAssert
{
    /**
     * Construct a {@link TestAssert} instance.
     */
    public TestAssert()
    {
        super();
    }

    /**
     * Test the implementation of {@link Assert#argumentNotNull(String, Object)}.
     */
    @Test
    public void testArgumentNotNull_Object()
    {
        Assert.argumentNotNull("testing", "SomeNonNullValue");
        try
        {
            Assert.argumentNotNull("testing", null);
        }
        catch (final IllegalArgumentException expected)
        {
            assertTrue(expected.getMessage().contains("testing"));
        }
    }

    /**
     * Test the implementation of {@link Assert#argumentNotNullOrEmpty(String, Object[])}.
     */
    @Test
    public void testArgumentNotNullOrEmpty_Array()
    {
        Assert.argumentNotNull("testing", new String[] { "abc" });
        try
        {
            Assert.argumentNotNullOrEmpty("testing", (String[]) null);
        }
        catch (final IllegalArgumentException expected)
        {
            assertTrue(expected.getMessage().contains("testing"));
        }
        try
        {
            Assert.argumentNotNullOrEmpty("testing", new String[] {});
        }
        catch (final IllegalArgumentException expected)
        {
            assertTrue(expected.getMessage().contains("testing"));
        }
    }

    /**
     * Test the implementation of {@link Assert#argumentNotNullOrEmpty(String, Collection)}.
     */
    @Test
    public void testArgumentNotNullOrEmpty_Collection()
    {
        Assert.argumentNotNull("testing", Collections.singleton("abc"));
        try
        {
            Assert.argumentNotNullOrEmpty("testing", (Collection<Object>) null);
        }
        catch (final IllegalArgumentException expected)
        {
            assertTrue(expected.getMessage().contains("testing"));
        }
        try
        {
            Assert.argumentNotNullOrEmpty("testing", Collections.emptySet());
        }
        catch (final IllegalArgumentException expected)
        {
            assertTrue(expected.getMessage().contains("testing"));
        }
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Document',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('docfile', models.FileField(upload_to=b'documents/%Y/%m/%d')),
            ],
            options={
            },
            bases=(models.Model,),
        ),
    ]


text:
from bin import ambaribuild

# TODO move this to a proper location
def unittest():
	# parse
	result = ambaribuild.parse(["test"])
	assert result.is_deep_clean == False
	assert result.is_test == True
	assert result.is_rebuild == False
	assert result.stack_distribution == None
	assert result.is_install_server == False
	assert result.is_install_agent == False
	assert result.is_deploy == False
	assert result.is_server_debug == False

	result = ambaribuild.parse(["server"])
	assert result.is_deep_clean == False
	assert result.is_test == False
	assert result.is_rebuild == False
	assert result.stack_distribution == None
	assert result.is_install_server == True
	assert result.is_install_agent == False
	assert result.is_deploy == False
	assert result.is_server_debug == False

	result = ambaribuild.parse(["agent"])
	assert result.is_deep_clean == False
	assert result.is_test == False
	assert result.is_rebuild == False
	assert result.stack_distribution == None
	assert result.is_install_server == True
	assert result.is_install_agent == True
	assert result.is_deploy == False
	assert result.is_server_debug == False

	result = ambaribuild.parse(["agent", "-b"])
	assert result.is_deep_clean == False
	assert result.is_test == False
	assert result.is_rebuild == True
	assert result.stack_distribution == None
	assert result.is_install_server == True
	assert result.is_install_agent == True
	assert result.is_deploy == False
	assert result.is_server_debug == False

	result = ambaribuild.parse(["deploy", "-d"])
	assert result.is_deep_clean == False
	assert result.is_test == False
	assert result.is_rebuild == False
	assert result.stack_distribution == None
	assert result.is_install_server == True
	assert result.is_install_agent == True
	assert result.is_deploy == True
	assert result.is_server_debug == True

	result = ambaribuild.parse(["deploy", "-b", "-s", "BIGTOP", "-d", "-c"])
	assert result.is_deep_clean == True
	assert result.is_test == False
	assert result.is_rebuild == True
	assert result.stack_distribution == "BIGTOP"
	assert result.is_install_server == True
	assert result.is_install_agent == True
	assert result.is_deploy == True
	assert result.is_server_debug == True

if __name__ == "__main__":
	unittest()