text:
package signature.converter.doclet;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import java.util.Map.Entry;

import signature.converter.Visibility;
import signature.model.IAnnotation;
import signature.model.IAnnotationElement;
import signature.model.IAnnotationField;
import signature.model.IApi;
import signature.model.IClassDefinition;
import signature.model.IClassReference;
import signature.model.IConstructor;
import signature.model.IEnumConstant;
import signature.model.IField;
import signature.model.IGenericDeclaration;
import signature.model.IMethod;
import signature.model.IPackage;
import signature.model.IParameter;
import signature.model.ITypeReference;
import signature.model.ITypeVariableDefinition;
import signature.model.ITypeVariableReference;
import signature.model.Kind;
import signature.model.Modifier;
import signature.model.impl.SigAnnotation;
import signature.model.impl.SigAnnotationElement;
import signature.model.impl.SigAnnotationField;
import signature.model.impl.SigApi;
import signature.model.impl.SigClassDefinition;
import signature.model.impl.SigClassReference;
import signature.model.impl.SigConstructor;
import signature.model.impl.SigEnumConstant;
import signature.model.impl.SigExecutableMember;
import signature.model.impl.SigField;
import signature.model.impl.SigMethod;
import signature.model.impl.SigPackage;
import signature.model.impl.SigParameter;
import signature.model.impl.SigPrimitiveType;
import signature.model.impl.SigTypeVariableDefinition;
import signature.model.impl.SigTypeVariableReference;
import signature.model.util.TypePool;

import com.sun.javadoc.AnnotationDesc;
import com.sun.javadoc.AnnotationTypeDoc;
import com.sun.javadoc.AnnotationTypeElementDoc;
import com.sun.javadoc.AnnotationValue;
import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.ConstructorDoc;
import com.sun.javadoc.ExecutableMemberDoc;
import com.sun.javadoc.FieldDoc;
import com.sun.javadoc.MethodDoc;
import com.sun.javadoc.PackageDoc;
import com.sun.javadoc.Parameter;
import com.sun.javadoc.ParameterizedType;
import com.sun.javadoc.ProgramElementDoc;
import com.sun.javadoc.RootDoc;
import com.sun.javadoc.Type;
import com.sun.javadoc.TypeVariable;
import com.sun.javadoc.WildcardType;
import com.sun.javadoc.AnnotationDesc.ElementValuePair;

public class DocletToSigConverter {

    TypePool pool;
    Set<String> packageNames;

    /**
     * Converts the signature information javadoc knows about into a
     * signature.model.ISources structure.
     */
    public IApi convertDocletRoot(String name, RootDoc root,
            Visibility visibility, Set<String> packageNames) {
        this.pool = new TypePool();
        this.packageNames = packageNames;

        Set<IPackage> packages = new HashSet<IPackage>();

        for (PackageDoc pack : root.specifiedPackages()) {
            assert packageNames.contains(pack.name());
            packages.add(convertPackage(pack));
        }

        SigApi sources = new SigApi(name, visibility);
        sources.setPackages(packages);
        return sources;
    }

    private IPackage convertPackage(PackageDoc packageDoc) {
        Set<IClassDefinition> classes = new HashSet<IClassDefinition>();
        for (ClassDoc clazz : packageDoc.allClasses()) {
            // classes.add((IClass)convertType(clazz));
            classes.add(convertClass(clazz));
        }

        SigPackage p = new SigPackage(packageDoc.name());
        p.setClasses(classes);
        p.setAnnotations(convertAnnotations(packageDoc.annotations()));
        return p;
    }

    private SigClassDefinition convertClass(ClassDoc classDoc) {

        SigClassDefinition c = pool.getClass(classDoc.containingPackage()
                .name(), classDoc.name());
        if (c.getKind() != Kind.UNINITIALIZED) return c;

        if (classDoc.isEnum())
            c.setKind(Kind.ENUM);
        else if (classDoc.isInterface())
            c.setKind(Kind.INTERFACE);
        else if (classDoc.isClass())
            c.setKind(Kind.CLASS);
        else if (classDoc.isAnnotationType()) c.setKind(Kind.ANNOTATION);

        if (!packageNames.contains(c.getPackageName())) {
            // no additional conversion for this class is necessary
            initializeClass(c);
            return c;
        }

        c.setModifiers(convertModifiers(classDoc.modifierSpecifier()));
        if (Kind.INTERFACE.equals(c.getKind())
                || Kind.ANNOTATION.equals(c.getKind())) {
            c.getModifiers().add(Modifier.ABSTRACT);
        }

        // superclass may be a class or a parameterized type (e.g. extends
        // List<String>),
        // may also be null if classDoc is an interface
        Type superclassType = classDoc.superclassType();
        if (superclassType != null) {
            c.setSuperClass(convertTypeReference(classDoc.superclassType()));
        } else {
            c.setSuperClass(null);
        }

        Set<ITypeReference> interfaces = new HashSet<ITypeReference>();
        for (Type interfaceType : classDoc.interfaceTypes()) {
            interfaces.add(convertTypeReference(interfaceType));
        }
        c.setInterfaces(interfaces);

        ClassDoc containingClass = classDoc.containingClass();
        if (containingClass != null)
            c.setDeclaringClass(convertClass(containingClass));
        else
            c.setDeclaringClass(null);

        Set<IClassDefinition> innerClasses = new HashSet<IClassDefinition>();
        for (ClassDoc innerClass : classDoc.innerClasses()) {
            innerClasses.add(convertClass(innerClass));
        }
        c.setInnerClasses(innerClasses);

        Set<IConstructor> constructors = new HashSet<IConstructor>();
        for (ConstructorDoc constructor : classDoc.constructors()) {
            constructors.add(convertConstructor(constructor));
        }
        c.setConstructors(constructors);

        Set<IMethod> methods = new HashSet<IMethod>();
        for (MethodDoc method : classDoc.methods()) {
            methods.add(convertMethod(method));
        }
        c.setMethods(methods);

        Set<IField> fields = new HashSet<IField>();
        for (FieldDoc field : classDoc.fields()) {
            fields.add(convertField(field));
        }
        c.setFields(fields);

        Set<IEnumConstant> enumConstants = new HashSet<IEnumConstant>();
        int ordinal = 0;
        for (FieldDoc enumConstant : classDoc.enumConstants()) {
            enumConstants.add(convertEnumConstant(enumConstant, ordinal++));
        }
        c.setEnumConstants(enumConstants);

        List<ITypeVariableDefinition> typeParameters =
                new LinkedList<ITypeVariableDefinition>();
        for (TypeVariable typeVariable : classDoc.typeParameters()) {
            typeParameters
                    .add(((ITypeVariableReference) convertTypeReference(
                            typeVariable)).getTypeVariableDefinition());
        }
        c.setTypeParameters(typeParameters);

        if (classDoc.isAnnotationType()) {
            Map<SigAnnotationField, AnnotationTypeElementDoc> annotationFieldAnnotations =
                    new HashMap<SigAnnotationField, AnnotationTypeElementDoc>();

            // AnnotationTypeDoc annotationType =
            // classDoc.asAnnotationTypeDoc(); // bug in Doclet Implementation,
            // has been reported to sun
            AnnotationTypeDoc annotationType = (AnnotationTypeDoc) classDoc;

            Set<IAnnotationField> annotationFields =
                    new HashSet<IAnnotationField>();
            for (AnnotationTypeElementDoc annotationElement : annotationType
                    .elements()) {
                SigAnnotationField annotationField = new SigAnnotationField(
                        annotationElement.name());
                annotationField.setModifiers(convertModifiers(annotationElement
                        .modifierSpecifier()));
                annotationField.setType(convertTypeReference(annotationElement
                        .returnType()));
                annotationField
                        .setDefaultValue(convertAnnotationValue(
                                annotationElement.defaultValue()));

                // the annotations on fields are set later because these
                // annotations may be of
                // the same type and may use fields which are not yet defined
                annotationFieldAnnotations.put(annotationField,
                        annotationElement);

                annotationFields.add(annotationField);
            }
            c.setAnnotationFields(annotationFields);

            // set annotation field annotations
            for (Entry<SigAnnotationField, AnnotationTypeElementDoc> entry :
                    annotationFieldAnnotations.entrySet()) {
                entry.getKey().setAnnotations(
                        convertAnnotations(entry.getValue().annotations()));
            }
        } else { // no annotation type
            c.setAnnotationFields(null);
        }

        // set class annotations
        c.setAnnotations(convertAnnotations(classDoc.annotations()));

        return c;

    }

    private Object convertAnnotationValue(AnnotationValue annotationValue) {
        if (annotationValue == null) {
            return null;
        }
        Object value = annotationValue.value();
        if (value instanceof Type) {
            // Type contains primitive types as well, e.g. void.class
            return convertTypeReference((Type) value);
        } else if (value instanceof String) {
            return value;
        } else if (value instanceof Double || value instanceof Float
                || value instanceof Long || value instanceof Integer
                || value instanceof Short || value instanceof Byte
                || value instanceof Character || value instanceof Boolean) {
            return value;
        } else if (value instanceof FieldDoc) {
            FieldDoc field = (FieldDoc) value;
            String name = field.name();
            ITypeReference fieldType = convertTypeReference(field.type());
            IClassReference fieldClassRef = (IClassReference) fieldType;
            IClassDefinition fieldClass = fieldClassRef.getClassDefinition();

            assert fieldClass.getKind() == Kind.ENUM;
            Set<IEnumConstant> constants = fieldClass.getEnumConstants();
            for (IEnumConstant enumConstant : constants) {
                if (enumConstant.getName().equals(name)) value = enumConstant;
            }
            assert value instanceof IEnumConstant;
            return value;
        } else if (value instanceof AnnotationDesc) {
            return convertAnnotation((AnnotationDesc) value);
        } else if (value instanceof AnnotationValue) {
            return convertAnnotationValue((AnnotationValue) value);
        } else if (value instanceof AnnotationValue[]) {
            AnnotationValue[] arr = (AnnotationValue[]) value;
            int length = arr.length;
            Object[] annotationArray = new Object[length];
            for (int i = 0; i < length; i++) {
                annotationArray[i] = convertAnnotationValue(arr[i]);
            }
            return annotationArray;
        } else {
            throw new RuntimeException("not expected case");
        }
    }

    private ITypeReference convertArrayType(Type type) {
        assert type.asWildcardType() == null;
        assert type.asAnnotationTypeDoc() == null;

        ITypeReference baseType = null;
        if (type.asTypeVariable() != null) {
            baseType = convertTypeReference(type.asTypeVariable());
        } else if (type.asParameterizedType() != null) {
            baseType = convertTypeReference(type.asParameterizedType());
        } else if (type.asClassDoc() != null) {
            baseType = new SigClassReference(convertClass(type.asClassDoc()));
        } else if (type.isPrimitive()) {
            baseType = SigPrimitiveType.valueOfTypeName(type.typeName());
        } else {
            throw new RuntimeException(type.toString());
        }

        ITypeReference arrayType = baseType;
        int dimension = type.dimension().length() / 2;
        while (dimension > 0) {
            arrayType = pool.getArrayType(arrayType);
            dimension--;
        }

        return arrayType;
    }

    private SigTypeVariableDefinition currentTypeVariableDefinition = null;

    private ITypeReference convertTypeReference(Type type) {
        assert type != null;

        if (!"".equals(type.dimension())) {
            return convertArrayType(type);
        }

        ParameterizedType pType = type.asParameterizedType();
        if (pType != null) {
            ITypeReference ownerType = null;
            Type containingType = pType.containingType();
            if (containingType != null)
                ownerType = convertTypeReference(containingType);
            IClassReference rawType = new SigClassReference(convertClass(pType
                    .asClassDoc()));

            List<ITypeReference> typeArguments =
                    new LinkedList<ITypeReference>();
            for (Type typeArgument : pType.typeArguments()) {
                typeArguments.add(convertTypeReference(typeArgument));
            }

            if (typeArguments.size() > 0) {
                return pool.getParameterizedType(ownerType, rawType,
                        typeArguments);
            } else {
                return rawType;
            }
        }

        TypeVariable tv = type.asTypeVariable();
        if (tv != null) {
            String name = tv.typeName();

            if (currentTypeVariableDefinition != null
                    && name.equals(currentTypeVariableDefinition.getName()))
                return new SigTypeVariableReference(
                        currentTypeVariableDefinition);

            IGenericDeclaration genericDeclaration = null;
            ProgramElementDoc programElement = tv.owner();
            if (programElement instanceof ClassDoc) {
                genericDeclaration = convertClass((ClassDoc) programElement);
            } else if (programElement instanceof MethodDoc
                    && currentMethod.size() > 0) {
                genericDeclaration = currentMethod.peek();
            } else if (programElement instanceof ConstructorDoc
                    && currentConstructor.size() > 0) {
                genericDeclaration = currentConstructor.peek();
            } else {
                throw new IllegalStateException("situation not expected");
            }
            SigTypeVariableDefinition typeVariable = pool.getTypeVariable(name,
                    genericDeclaration);

            List<ITypeReference> upperBounds = new LinkedList<ITypeReference>();
            for (Type upperBound : tv.bounds()) {
                // we are converting a type variable declaration which is stored
                // in the
                // field currentTypeVariableDefinition
                assert currentTypeVariableDefinition == null;
                currentTypeVariableDefinition = typeVariable;
                upperBounds.add(convertTypeReference(upperBound));
                currentTypeVariableDefinition = null;
            }
            if (upperBounds.size() == 0) {
                // no explicit bounds, use java.lang.Object
                upperBounds.add(pool.getClassReference("java.lang", "Object"));
            }
            typeVariable.setUpperBounds(upperBounds);

            return new SigTypeVariableReference(typeVariable);
        }

        WildcardType wt = type.asWildcardType();
        if (wt != null) {
            ITypeReference lowerBound = null;
            for (Type superBound : wt.superBounds()) {
                lowerBound = convertTypeReference(superBound);
            }

            List<ITypeReference> upperBounds = new LinkedList<ITypeReference>();
            for (Type upperBound : wt.extendsBounds()) {
                upperBounds.add(convertTypeReference(upperBound));
            }
            if (upperBounds.size() == 0) {
                // no explicit bounds, use java.lang.Object
                upperBounds.add(pool.getClassReference("java.lang", "Object"));
            }

            return pool.getWildcardType(lowerBound, upperBounds);
        }

        ClassDoc c = type.asClassDoc();
        if (c != null) {
            return new SigClassReference(convertClass(c));
        }

        if (type.isPrimitive()) {
            return SigPrimitiveType.valueOfTypeName(type.typeName());
        }

        throw new IllegalStateException(type.toString());
    }

    private void convertExecutableMember(ExecutableMemberDoc member,
            SigExecutableMember m) {
        Set<Modifier> modifiers = convertModifiers(member.modifierSpecifier());

        // Doclet Bug: final values method is not considered as final
        if (member.containingClass().isEnum() && member.name().equals("values")
                && member.parameters().length == 0) {
            modifiers.add(Modifier.FINAL);
        }

        if (member.containingClass().isInterface()) {
            modifiers.add(Modifier.ABSTRACT);
        }

        m.setModifiers(modifiers);
        m.setAnnotations(convertAnnotations(member.annotations()));
        m.setDeclaringClass(convertClass(member.containingClass()));

        List<ITypeVariableDefinition> typeParameters =
                new LinkedList<ITypeVariableDefinition>();
        for (TypeVariable typeParameter : member.typeParameters()) {
            String name = typeParameter.typeName();
            IGenericDeclaration genericDeclaration = null;
            if (currentMethod.size() > 0)
                genericDeclaration = currentMethod.peek();
            else if (currentConstructor.size() > 0)
                genericDeclaration = currentConstructor.peek();
            else
                throw new RuntimeException();
            SigTypeVariableDefinition p = pool.getTypeVariable(name,
                    genericDeclaration);

            List<ITypeReference> upperBounds = new LinkedList<ITypeReference>();
            for (Type u : typeParameter.bounds()) {
                upperBounds.add(convertTypeReference(u));
            }
            p.setUpperBounds(upperBounds);
            typeParameters.add(p);
        }
        m.setTypeParameters(typeParameters);

        List<IParameter> parameters = new LinkedList<IParameter>();
        for (Parameter parameter : member.parameters()) {
            SigParameter p = new SigParameter(convertTypeReference(parameter
                    .type()));
            p.setAnnotations(convertAnnotations(parameter.annotations()));
            parameters.add(p);
        }
        m.setParameters(parameters);

        Set<ITypeReference> exceptions = new HashSet<ITypeReference>();
        for (Type exceptionType : member.thrownExceptionTypes()) {
            exceptions.add(convertTypeReference(exceptionType));
        }
        m.setExceptions(exceptions);
    }

    private Stack<SigMethod> currentMethod = new Stack<SigMethod>();

    private IMethod convertMethod(MethodDoc method) {
        SigMethod m = new SigMethod(method.name());
        currentMethod.push(m);
        convertExecutableMember(method, m);
        m.setReturnType(convertTypeReference(method.returnType()));
        currentMethod.pop();
        return m;
    }

    private Stack<SigConstructor> currentConstructor =
            new Stack<SigConstructor>();

    private IConstructor convertConstructor(ConstructorDoc constructor) {
        SigConstructor c = new SigConstructor(constructor.name());
        currentConstructor.push(c);
        convertExecutableMember(constructor, c);
        currentConstructor.pop();
        return c;
    }

    private IField convertField(FieldDoc field) {
        SigField f = new SigField(field.name());
        f.setAnnotations(convertAnnotations(field.annotations()));
        f.setModifiers(convertModifiers(field.modifierSpecifier()));
        f.setType(convertTypeReference(field.type()));
        return f;
    }

    private IEnumConstant convertEnumConstant(FieldDoc enumConstant,
            int ordinal) {
        SigEnumConstant ec = new SigEnumConstant(enumConstant.name());
        ec.setOrdinal(ordinal);
        ec.setAnnotations(convertAnnotations(enumConstant.annotations()));
        ec.setModifiers(convertModifiers(enumConstant.modifierSpecifier()));
        ec.setType(convertTypeReference(enumConstant.type()));
        return ec;
    }

    private Set<IAnnotation> convertAnnotations(
            AnnotationDesc[] annotationDescs) {
        Set<IAnnotation> annotations = new HashSet<IAnnotation>();
        for (AnnotationDesc annotationDesc : annotationDescs) {
            if (!annotationRetentionIsSource(annotationDesc))
                annotations.add(convertAnnotation(annotationDesc));
        }
        return annotations;
    }

    private boolean annotationRetentionIsSource(AnnotationDesc annotationDesc) {
        AnnotationTypeDoc type = annotationDesc.annotationType();
        AnnotationDesc[] annotations = type.annotations();
        for (AnnotationDesc d : annotations) {
            if ("java.lang.annotation.Retention".equals(d.annotationType()
                    .qualifiedName())) {
                for (ElementValuePair value : d.elementValues()) {
                    if ("value".equals(value.element().name())) {
                        return "java.lang.annotation.RetentionPolicy.SOURCE"
                                .equals(value.value().value().toString());
                    }
                }
            }
        }
        // default retention policy is CLASS
        return false;
    }

    private IAnnotation convertAnnotation(AnnotationDesc annotationDesc) {
        SigAnnotation a = new SigAnnotation();

        IClassReference annotationType = (IClassReference) convertTypeReference(
                annotationDesc.annotationType());
        a.setType(annotationType);

        Set<IAnnotationElement> elements = new HashSet<IAnnotationElement>();
        for (AnnotationDesc.ElementValuePair pair : annotationDesc
                .elementValues()) {
            SigAnnotationElement element = new SigAnnotationElement();
            elements.add(element);

            element.setValue(convertAnnotationValue(pair.value()));
            String name = pair.element().name();
            for (IAnnotationField field : annotationType.getClassDefinition()
                    .getAnnotationFields()) {
                if (field.getName().equals(name)) {
                    element.setDeclaringField(field);
                }
            }
        }
        a.setElements(elements);
        return a;
    }

    private void initializeClass(SigClassDefinition c) {
        c.setAnnotationFields(null);
        c.setAnnotations(null);
        c.setConstructors(null);
        c.setDeclaringClass(null);
        c.setEnumConstants(null);
        c.setFields(null);
        c.setInnerClasses(null);
        c.setInterfaces(null);
        c.setMethods(null);
        c.setModifiers(null);
        c.setSuperClass(null);
        c.setTypeParameters(null);
    }

    private Set<Modifier> convertModifiers(int mod) {
        Set<Modifier> modifiers = EnumSet.noneOf(Modifier.class);
        if (java.lang.reflect.Modifier.isAbstract(mod))
            modifiers.add(Modifier.ABSTRACT);
        if (java.lang.reflect.Modifier.isFinal(mod))
            modifiers.add(Modifier.FINAL);
        // if (java.lang.reflect.Modifier.isNative(mod))
        // modifiers.add(Modifier.NATIVE);
        if (java.lang.reflect.Modifier.isPrivate(mod))
            modifiers.add(Modifier.PRIVATE);
        if (java.lang.reflect.Modifier.isProtected(mod))
            modifiers.add(Modifier.PROTECTED);
        if (java.lang.reflect.Modifier.isPublic(mod))
            modifiers.add(Modifier.PUBLIC);
        if (java.lang.reflect.Modifier.isStatic(mod))
            modifiers.add(Modifier.STATIC);
        // if (java.lang.reflect.Modifier.isStrict(mod))
        // modifiers.add(Modifier.STRICT);
        // if (java.lang.reflect.Modifier.isSynchronized(mod))
        // modifiers.add(Modifier.SYNCHRONIZED);
        // if (java.lang.reflect.Modifier.isTransient(mod))
        // modifiers.add(Modifier.TRANSIENT);
        if (java.lang.reflect.Modifier.isVolatile(mod))
            modifiers.add(Modifier.VOLATILE);

        return modifiers;
    }

}


text:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

if ( ! class_exists('PhpSession'))
  {
    require_once(APPPATH.'libraries/phpsession'.EXT);
  }

$obj =& get_instance();
$obj->phpsession = new PhpSession();
$obj->ci_is_loaded[] = 'phpsession';

?>

redpajama_set_name: RedPajamaGithub


text:
package com.hribol.bromium.common.builder;

import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

/**
 * Created by hvrigazov on 09.06.17.
 */
public class JsFunctionDeclarerBuilderTest {

    @Test
    public void canDeclareAFunctionWithBody() {
        JsCollector jsCollector = mock(JsCollector.class);
        String functionName = "something";

        JsFunctionDeclarerBuilder jsFunctionDeclarerBuilder = new JsFunctionDeclarerBuilder(functionName, jsCollector);

        jsFunctionDeclarerBuilder
                .withParameters("x", "y")
                .write("\tconsole.log(x + y);");

        String expectedFunction = "function something(x, y) {\n" +
                "\tconsole.log(x + y);}\n";
        verify(jsCollector).write(expectedFunction);
    }

    @Test
    public void canDeclareFunctionWithOneParameterAndBody() {
        JsCollector jsCollector = mock(JsCollector.class);
        String functionName = "something";

        JsFunctionDeclarerBuilder jsFunctionDeclarerBuilder = new JsFunctionDeclarerBuilder(functionName, jsCollector);

        jsFunctionDeclarerBuilder
                .withParameters("x")
                .write("\tconsole.log(x);");

        String expectedFunction = "function something(x) {\n" +
                "\tconsole.log(x);}\n";
        verify(jsCollector).write(expectedFunction);
    }

    @Test
    public void canDeclareFunctionWithNoParametersAndBody() {
        JsCollector jsCollector = mock(JsCollector.class);
        String functionName = "something";

        JsFunctionDeclarerBuilder jsFunctionDeclarerBuilder = new JsFunctionDeclarerBuilder(functionName, jsCollector);

        jsFunctionDeclarerBuilder
                .withParameters()
                .write("\tconsole.log('There are no parameters');");

        String expectedFunction = "function something() {\n" +
                "\tconsole.log('There are no parameters');}\n";
        verify(jsCollector).write(expectedFunction);
    }

    @Test
    public void canCreateNotNullBodyBuilder() {
        JsCollector jsCollector = mock(JsCollector.class);
        String functionName = "something";

        JsFunctionDeclarerBuilder jsFunctionDeclarerBuilder = new JsFunctionDeclarerBuilder(functionName, jsCollector);

        assertNotNull(jsFunctionDeclarerBuilder.startBody());
    }
}


text:
require "fusioncharts_exporter/engine"

module FusionchartsExporter
end


text:
{% extends "activity/call_list.html" %}
{% load humanize %}

            {% block pageheader %}

CALL DETAIL

            {% endblock pageheader %}

            {% block searchform %}
            {% endblock searchform %}

            {% block content %}

                        Customer
                        {{ call.customer }}

Rep	{{ call.rep }}

Contact	{{ call.contact|default:"N/A" }}

Position	{{ call.position|default:"N/A" }}

Address	{{ call.address|linebreaks }}

Call Type	{{ call.get_call_type_display }}

Call Date	{{ call.call_date }}

Entered On	{{ call.recorded_date }}

Remarks	{{ call.remarks|linebreaks }}

Products Detailed

                        Product
                        Order Value

                {% for detail in call.call_products.all %}

                      {{ detail.product }}
                      {{ detail.order_value }}

                {% endfor %}

            {% endblock content %}


text:
'use strict';

angular.module('app')

.factory('Reports', ['$rootScope', '$location', '$http', '$q', 'APP_CONFIG', 'Notifications',
    function($rootScope, $location, $http, $q, APP_CONFIG, Notifications) {

	var factory = {},
        summaries = [],
        facilities = [],

		configRestEndpoint = "http://" + APP_CONFIG.DATASTORE_REST_HOSTNAME + '.' + $location.host().replace(/^.*?\.(.*)/g,"$1") + '/api';

	factory.getSummaries = function() {
		return summaries;
	};

	factory.getShipCount = function() {
	    var shipCount = 0;
	    summaries.forEach(function(summary) {
	        if (summary.name == 'packages') {
	            shipCount = summary.count;
            }
        });
	    return shipCount;
    };
	factory.getFacilities = function() {
	    return facilities;
    };

	factory.refresh = function() {

        // get summaries
        $http({
            method: 'GET',
            url: configRestEndpoint + '/utils/summaries'
        }).then(function (response) {
            summaries = response.data;
            if ((summaries == undefined) || (summaries.constructor !== Array)) {
                Notifications.error("Error fetching Summaries  (invalid data). Reload to retry");
                return;
            }

            $rootScope.$broadcast('summaries:updated', summaries);

        }, function err(response) {
            console.log(JSON.stringify(response));
            Notifications.error("Error fetching Summaries Configuration from [" + response.config.url + "]. Reload to retry");
        });

        // get  facilities
        $http({
            method: 'GET',
            url: configRestEndpoint + '/facilities'
        }).then(function (response) {
            facilities = response.data;
            if ((facilities == undefined) || (facilities.constructor !== Array)) {
                Notifications.error("Error fetching Facilities (invalid data). Reload to retry");
                return;
            }

            $rootScope.$broadcast('facilities:updated', facilities);

        }, function err(response) {
            console.log(JSON.stringify(response));
            Notifications.error("Error fetching Facilities from [" + response.config.url + "]. Reload to retry");
        });

    };

	factory.refresh();

	return factory;
}]);


text:
import argparse
import os
import sys

from benchmark import benchmark_single

BENCHMARKS = ["axpy", "gemv", "gemm", "summary", "axpybatched", "gemmbatched"]

def parse_arguments(argv):
    parser = argparse.ArgumentParser(description="Runs all (main) benchmarks in one go for a given device")
    parser.add_argument("-p", "--platform", required=True, type=int, help="The ID of the OpenCL platform to test on")
    parser.add_argument("-d", "--device", required=True, type=int, help="The ID of the OpenCL device to test on")
    parser.add_argument("-x", "--precision", type=int, default=32, help="The precision to test for (choose from 16, 32, 64, 3232, 6464")
    parser.add_argument("-l", "--load_from_disk", action="store_true", help="Increase verbosity of the script")
    parser.add_argument("-t", "--plot_title", default=None, help="The title for the plots, defaults to benchmark name")
    parser.add_argument("-o", "--output_folder", default=os.getcwd(), help="Sets the folder for output plots (defaults to current folder)")
    parser.add_argument("-v", "--verbose", action="store_true", help="Increase verbosity of the script")
    cl_args = parser.parse_args(argv)
    return vars(cl_args)

def benchmark_all(platform, device, precision, load_from_disk,
                  plot_title, output_folder, verbose):
    for bench in BENCHMARKS:
        from_disk = load_from_disk
        for tight_plot in [True, False]:  # two plots for a single benchmark
            benchmark_single(bench, platform, device, None, precision, from_disk,
                             plot_title, tight_plot, output_folder, verbose)
            from_disk = True  # for the next plot of the same data

if __name__ == '__main__':
    parsed_arguments = parse_arguments(sys.argv[1:])
    benchmark_all(**parsed_arguments)


text:
<?xml version="1.0" encoding="utf-8"?>
<alpha android:fromAlpha="1.0"
       android:toAlpha="0.0"
       android:duration="@android:integer/config_mediumAnimTime"
       xmlns:android="http://schemas.android.com/apk/res/android"/>


text:
package com.clockbyte.admobadapter.expressads;

import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;

import com.clockbyte.admobadapter.AdmobFetcherBase;
import com.clockbyte.admobadapter.R;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.NativeExpressAdView;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

public class AdmobFetcherExpress extends AdmobFetcherBase {

    private final String TAG = AdmobFetcherExpress.class.getCanonicalName();

    /**
     * Maximum number of times to try fetch an ad after failed attempts.
     */
    private static final int MAX_FETCH_ATTEMPT = 4;

    public AdmobFetcherExpress(Context context){
        super();
        mContext = new WeakReference<Context>(context);
    }

    private List<NativeExpressAdView> mPrefetchedAdList = new ArrayList<NativeExpressAdView>();

    /**
     * Gets native ad at a particular index in the fetched ads list.
     *
     * @param adPos the index of ad in the fetched ads list
     * @return the native ad in the list
     * @see #getFetchedAdsCount()
     */
    public NativeExpressAdView getAdForIndex(int adPos) {
        if(adPos>=0 && adPos < mPrefetchedAdList.size())
            return mPrefetchedAdList.get(adPos);
        return null;
    }

    /**
     * Fetches a new native ad.
     */
    protected synchronized void fetchAd(final NativeExpressAdView adView) {
        if(mFetchFailCount > MAX_FETCH_ATTEMPT)
            return;

        Context context = mContext.get();

        if (context != null) {
            Log.i(TAG, "Fetching Ad now");
            new Handler(context.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    adView.loadAd(getAdRequest()); //Fetching the ads item
                }
            });
        } else {
            mFetchFailCount++;
            Log.i(TAG, "Context is null, not fetching Ad");
        }
    }

    /**
     * Determines if the native ad can be used.
     *
     * @param adNative the native ad object
     * @return true if the ad object can be used, false otherwise
     */
    private boolean canUseThisAd(NativeExpressAdView adNative) {
        if (adNative == null || adNative.isLoading()) return false;
        return true;
    }

    /**
     * Subscribing to the native ads events
     * @param adView
     */
    protected synchronized void setupAd(final NativeExpressAdView adView) {
        adView.setAdListener(new AdListener() {
            @Override
            public void onAdFailedToLoad(int errorCode) {
                // Handle the failure by logging, altering the UI, etc.
                Log.i(TAG, "onAdFailedToLoad " + errorCode);
                mFetchFailCount++;
            }

            @Override
            public void onAdLoaded() {
                super.onAdLoaded();
                onAdFetched(adView);
            }
        });
    }

    /**
     * A handler for received native ads
     * @param adNative
     */
    private synchronized void onAdFetched(NativeExpressAdView adNative) {
        Log.i(TAG, "onAdFetched");
        if (canUseThisAd(adNative)) {
            mPrefetchedAdList.add(adNative);
            mNoOfFetchedAds++;
        }
        mFetchFailCount = 0;
        notifyObserversOfAdSizeChange();
    }

    @Override
    public synchronized void destroyAllAds() {
        super.destroyAllAds();
        for (NativeExpressAdView ad: mPrefetchedAdList) {
            ad.destroy();
        }
        mPrefetchedAdList.clear();
    }

    /**
     * update all the ads in Map to refresh
     * */
    public synchronized void updateAds() {
        for (NativeExpressAdView ad: mPrefetchedAdList) {
            fetchAd(ad);
        }
    }

}


text:
using System;
using System.Collections.Generic;
using System.Threading;
using System.Reflection;
using Serilog;
using Serilog.Core;
using Xunit.Runners;

namespace ImageBitmask.TestRunner.Net
{
    internal class Program
    {
        // Use an event to know when we're done
        private static ManualResetEvent _finished;

        // Start out assuming success; we'll set this to 1 if we get a failed test
        private static int _result;

        private static int Main(string[] args)
        {
            // Init logger
            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Information()
                .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext:l}] {Message}{NewLine}{Exception}")
                .Enrich.WithProperty(Constants.SourceContextPropertyName, "TestRunner")
                .CreateLogger();

            // Tests to run
            var testAssemblies = new List<Assembly>
            {
                typeof (Test.BitmaskTest).GetTypeInfo().Assembly
            };

            // Loop on test assemblies
            foreach (var testAssembly in testAssemblies)
            {
                RunTests(testAssembly);
            }

            Log.CloseAndFlush();

            Console.ReadLine();
            return _result;
        }

        private static void RunTests(Assembly testAssembly)
        {
            _finished = new ManualResetEvent(false);

            // Run tests
            using (var runner = AssemblyRunner.WithoutAppDomain(testAssembly.Location))
            {
                runner.OnDiscoveryComplete = OnDiscoveryComplete;
                runner.OnExecutionComplete = OnExecutionComplete;
                runner.OnTestFailed = OnTestFailed;
                runner.OnTestPassed = OnTestPassed;
                runner.OnTestSkipped = OnTestSkipped;

                Log.Debug($"Processing {testAssembly.FullName}...");
                runner.Start();

                _finished.WaitOne();
                _finished.Dispose();
            }
        }

        private static void OnDiscoveryComplete(DiscoveryCompleteInfo info)
        {
            Log.Debug($"Running {info.TestCasesToRun} of {info.TestCasesDiscovered} tests...");
        }

        private static void OnExecutionComplete(ExecutionCompleteInfo info)
        {
            Log.Information($"Finished: {info.TotalTests} tests in {Math.Round(info.ExecutionTime, 3)}s ({info.TestsFailed} failed, {info.TestsSkipped} skipped)");
            _finished.Set();
        }

        private static void OnTestFailed(TestFailedInfo info)
        {
            Log.Error($"[FAIL] {info.TestDisplayName}: {info.ExceptionMessage}");
            if (info.ExceptionStackTrace != null)
            {
                Log.Error(info.ExceptionStackTrace);
            }
            _result = 1;
        }

        private static void OnTestPassed(TestPassedInfo info)
        {
            Log.Information($"[PASS] {info.TestDisplayName}");
        }

        private static void OnTestSkipped(TestSkippedInfo info)
        {
            Log.Information($"[SKIP] {info.TestDisplayName}: {info.SkipReason}");
        }
    }
}


text:
namespace app
{
    partial class GUI
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Windows Form-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.btn_send = new System.Windows.Forms.Button();
            this.btn_open = new System.Windows.Forms.Button();
            this.btn_close = new System.Windows.Forms.Button();
            this.box_sendCMD = new System.Windows.Forms.TextBox();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.btn_select = new System.Windows.Forms.Button();
            this.btn_autosearch = new System.Windows.Forms.Button();
            this.label3 = new System.Windows.Forms.Label();
            this.box_selectedDevice = new System.Windows.Forms.TextBox();
            this.box_state = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.btn_refreshList = new System.Windows.Forms.Button();
            this.box_list = new System.Windows.Forms.ComboBox();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.btn_sendAbs = new System.Windows.Forms.Button();
            this.btn_clear = new System.Windows.Forms.Button();
            this.btn_park = new System.Windows.Forms.Button();
            this.box_absolutePos = new System.Windows.Forms.TextBox();
            this.label7 = new System.Windows.Forms.Label();
            this.btn_init = new System.Windows.Forms.Button();
            this.box_receivedData = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            //
            // btn_send
            //
            this.btn_send.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_send.Location = new System.Drawing.Point(12, 195);
            this.btn_send.Name = "btn_send";
            this.btn_send.Size = new System.Drawing.Size(75, 23);
            this.btn_send.TabIndex = 0;
            this.btn_send.Text = "Relative";
            this.btn_send.UseVisualStyleBackColor = true;
            this.btn_send.Click += new System.EventHandler(this.btn_send_Click);
            //
            // btn_open
            //
            this.btn_open.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_open.ForeColor = System.Drawing.Color.OliveDrab;
            this.btn_open.Location = new System.Drawing.Point(6, 298);
            this.btn_open.Name = "btn_open";
            this.btn_open.Size = new System.Drawing.Size(75, 23);
            this.btn_open.TabIndex = 1;
            this.btn_open.Text = "Open";
            this.btn_open.UseVisualStyleBackColor = true;
            this.btn_open.Click += new System.EventHandler(this.btn_open_Click);
            //
            // btn_close
            //
            this.btn_close.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_close.ForeColor = System.Drawing.Color.Maroon;
            this.btn_close.Location = new System.Drawing.Point(147, 298);
            this.btn_close.Name = "btn_close";
            this.btn_close.Size = new System.Drawing.Size(75, 23);
            this.btn_close.TabIndex = 2;
            this.btn_close.Text = "Close";
            this.btn_close.UseVisualStyleBackColor = true;
            this.btn_close.Click += new System.EventHandler(this.btn_close_Click);
            //
            // box_sendCMD
            //
            this.box_sendCMD.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.box_sendCMD.Location = new System.Drawing.Point(12, 160);
            this.box_sendCMD.Name = "box_sendCMD";
            this.box_sendCMD.Size = new System.Drawing.Size(213, 20);
            this.box_sendCMD.TabIndex = 3;
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.btn_select);
            this.groupBox1.Controls.Add(this.btn_autosearch);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.box_selectedDevice);
            this.groupBox1.Controls.Add(this.box_state);
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.btn_refreshList);
            this.groupBox1.Controls.Add(this.btn_open);
            this.groupBox1.Controls.Add(this.box_list);
            this.groupBox1.Controls.Add(this.btn_close);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new System.Drawing.Point(12, 13);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(231, 376);
            this.groupBox1.TabIndex = 9;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Select Device";
            //
            // btn_select
            //
            this.btn_select.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_select.Location = new System.Drawing.Point(9, 195);
            this.btn_select.Name = "btn_select";
            this.btn_select.Size = new System.Drawing.Size(75, 23);
            this.btn_select.TabIndex = 8;
            this.btn_select.Text = "Select";
            this.btn_select.UseVisualStyleBackColor = true;
            this.btn_select.Click += new System.EventHandler(this.button2_Click);
            //
            // btn_autosearch
            //
            this.btn_autosearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_autosearch.Location = new System.Drawing.Point(9, 50);
            this.btn_autosearch.Name = "btn_autosearch";
            this.btn_autosearch.Size = new System.Drawing.Size(75, 23);
            this.btn_autosearch.TabIndex = 7;
            this.btn_autosearch.Text = "Autosearch";
            this.btn_autosearch.UseVisualStyleBackColor = true;
            this.btn_autosearch.Click += new System.EventHandler(this.btn_autosearch_Click);
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(6, 236);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(86, 13);
            this.label3.TabIndex = 6;
            this.label3.Text = "Selected Device";
            //
            // box_selectedDevice
            //
            this.box_selectedDevice.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.box_selectedDevice.Location = new System.Drawing.Point(9, 258);
            this.box_selectedDevice.Name = "box_selectedDevice";
            this.box_selectedDevice.ReadOnly = true;
            this.box_selectedDevice.Size = new System.Drawing.Size(208, 20);
            this.box_selectedDevice.TabIndex = 5;
            //
            // box_state
            //
            this.box_state.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.box_state.Location = new System.Drawing.Point(9, 345);
            this.box_state.Name = "box_state";
            this.box_state.ReadOnly = true;
            this.box_state.Size = new System.Drawing.Size(213, 20);
            this.box_state.TabIndex = 4;
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(6, 329);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(32, 13);
            this.label4.TabIndex = 3;
            this.label4.Text = "State";
            //
            // btn_refreshList
            //
            this.btn_refreshList.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_refreshList.Location = new System.Drawing.Point(9, 113);
            this.btn_refreshList.Name = "btn_refreshList";
            this.btn_refreshList.Size = new System.Drawing.Size(75, 23);
            this.btn_refreshList.TabIndex = 4;
            this.btn_refreshList.Text = "Refresh list";
            this.btn_refreshList.UseVisualStyleBackColor = true;
            this.btn_refreshList.Click += new System.EventHandler(this.btn_refreshList_Click);
            //
            // box_list
            //
            this.box_list.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.box_list.FormattingEnabled = true;
            this.box_list.Location = new System.Drawing.Point(9, 141);
            this.box_list.Name = "box_list";
            this.box_list.Size = new System.Drawing.Size(208, 21);
            this.box_list.TabIndex = 3;
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(6, 96);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(102, 13);
            this.label2.TabIndex = 2;
            this.label2.Text = "List of USB Devices";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(6, 27);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(134, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Autosearch for first Arduino";
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.btn_sendAbs);
            this.groupBox2.Controls.Add(this.btn_clear);
            this.groupBox2.Controls.Add(this.btn_park);
            this.groupBox2.Controls.Add(this.box_absolutePos);
            this.groupBox2.Controls.Add(this.label7);
            this.groupBox2.Controls.Add(this.btn_init);
            this.groupBox2.Controls.Add(this.box_receivedData);
            this.groupBox2.Controls.Add(this.label6);
            this.groupBox2.Controls.Add(this.label5);
            this.groupBox2.Controls.Add(this.box_sendCMD);
            this.groupBox2.Controls.Add(this.btn_send);
            this.groupBox2.Location = new System.Drawing.Point(258, 13);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(231, 376);
            this.groupBox2.TabIndex = 10;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Communication";
            //
            // btn_sendAbs
            //
            this.btn_sendAbs.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_sendAbs.Location = new System.Drawing.Point(150, 195);
            this.btn_sendAbs.Name = "btn_sendAbs";
            this.btn_sendAbs.Size = new System.Drawing.Size(75, 23);
            this.btn_sendAbs.TabIndex = 13;
            this.btn_sendAbs.Text = "Absolute";
            this.btn_sendAbs.UseVisualStyleBackColor = true;
            this.btn_sendAbs.Click += new System.EventHandler(this.btn_sendAbs_Click);
            //
            // btn_clear
            //
            this.btn_clear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_clear.Location = new System.Drawing.Point(150, 236);
            this.btn_clear.Name = "btn_clear";
            this.btn_clear.Size = new System.Drawing.Size(75, 23);
            this.btn_clear.TabIndex = 12;
            this.btn_clear.Text = "clear history";
            this.btn_clear.UseVisualStyleBackColor = true;
            this.btn_clear.Click += new System.EventHandler(this.btn_clear_Click);
            //
            // btn_park
            //
            this.btn_park.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_park.Location = new System.Drawing.Point(150, 27);
            this.btn_park.Name = "btn_park";
            this.btn_park.Size = new System.Drawing.Size(75, 23);
            this.btn_park.TabIndex = 11;
            this.btn_park.Text = "Park mode";
            this.btn_park.UseVisualStyleBackColor = true;
            this.btn_park.Click += new System.EventHandler(this.button1_Click);
            //
            // box_absolutePos
            //
            this.box_absolutePos.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.box_absolutePos.Location = new System.Drawing.Point(12, 88);
            this.box_absolutePos.Name = "box_absolutePos";
            this.box_absolutePos.ReadOnly = true;
            this.box_absolutePos.Size = new System.Drawing.Size(213, 20);
            this.box_absolutePos.TabIndex = 10;
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(9, 65);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(88, 13);
            this.label7.TabIndex = 9;
            this.label7.Text = "Ablosute location";
            //
            // btn_init
            //
            this.btn_init.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btn_init.Location = new System.Drawing.Point(12, 27);
            this.btn_init.Name = "btn_init";
            this.btn_init.Size = new System.Drawing.Size(75, 23);
            this.btn_init.TabIndex = 8;
            this.btn_init.Text = "Initiate";
            this.btn_init.UseVisualStyleBackColor = true;
            this.btn_init.Click += new System.EventHandler(this.btn_init_Click);
            //
            // box_receivedData
            //
            this.box_receivedData.Location = new System.Drawing.Point(12, 265);
            this.box_receivedData.Multiline = true;
            this.box_receivedData.Name = "box_receivedData";
            this.box_receivedData.ReadOnly = true;
            this.box_receivedData.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.box_receivedData.Size = new System.Drawing.Size(213, 100);
            this.box_receivedData.TabIndex = 7;
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(9, 236);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(99, 13);
            this.label6.TabIndex = 6;
            this.label6.Text = "Messages received";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(9, 141);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(117, 13);
            this.label5.TabIndex = 5;
            this.label5.Text = "Send command ( x,y,z )";
            //
            // GUI
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(500, 399);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.Name = "GUI";
            this.Text = "ACC - Arduino Connection Controller";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button btn_send;
        private System.Windows.Forms.Button btn_open;
        private System.Windows.Forms.Button btn_close;
        private System.Windows.Forms.TextBox box_sendCMD;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.TextBox box_selectedDevice;
        private System.Windows.Forms.Button btn_refreshList;
        private System.Windows.Forms.ComboBox box_list;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.TextBox box_state;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Button btn_autosearch;
        private System.Windows.Forms.TextBox box_receivedData;
        private System.Windows.Forms.TextBox box_absolutePos;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Button btn_init;
        private System.Windows.Forms.Button btn_park;
        private System.Windows.Forms.Button btn_select;
        private System.Windows.Forms.Button btn_clear;
        private System.Windows.Forms.Button btn_sendAbs;
    }
}


text: As Seen On


text:
/*
 * Array.prototype built-in description
 */

#include "ecma-builtin-helpers-macro-defines.inc.h"

#ifndef CONFIG_DISABLE_ARRAY_BUILTIN

/* Object properties:
 *  (property name, object pointer getter) */

/* ECMA-262 v5, 15.4.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
              ECMA_BUILTIN_ID_ARRAY,
              ECMA_PROPERTY_CONFIGURABLE_WRITABLE)

/* Number properties:
 *  (property name, object pointer getter) */

/* ECMA-262 v5, 15.4.4 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
              0,
              ECMA_PROPERTY_FLAG_WRITABLE)

/* Routine properties:
 *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_array_prototype_object_to_string, 0, 0)
ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ecma_builtin_array_prototype_object_to_locale_string, 0, 0)
ROUTINE (LIT_MAGIC_STRING_CONCAT, ecma_builtin_array_prototype_object_concat, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_JOIN, ecma_builtin_array_prototype_join, 1, 1)
ROUTINE (LIT_MAGIC_STRING_POP, ecma_builtin_array_prototype_object_pop, 0, 0)
ROUTINE (LIT_MAGIC_STRING_PUSH, ecma_builtin_array_prototype_object_push, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_REVERSE, ecma_builtin_array_prototype_object_reverse, 0, 0)
ROUTINE (LIT_MAGIC_STRING_SHIFT, ecma_builtin_array_prototype_object_shift, 0, 0)
ROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_array_prototype_object_slice, 2, 2)
ROUTINE (LIT_MAGIC_STRING_SORT, ecma_builtin_array_prototype_object_sort, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SPLICE, ecma_builtin_array_prototype_object_splice, NON_FIXED, 2)
ROUTINE (LIT_MAGIC_STRING_UNSHIFT, ecma_builtin_array_prototype_object_unshift, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ecma_builtin_array_prototype_object_index_of, 2, 1)
ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ecma_builtin_array_prototype_object_last_index_of, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_EVERY, ecma_builtin_array_prototype_object_every, 2, 1)
ROUTINE (LIT_MAGIC_STRING_SOME, ecma_builtin_array_prototype_object_some, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ecma_builtin_array_prototype_object_for_each, 2, 1)
ROUTINE (LIT_MAGIC_STRING_MAP, ecma_builtin_array_prototype_object_map, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FILTER, ecma_builtin_array_prototype_object_filter, 2, 1)
ROUTINE (LIT_MAGIC_STRING_REDUCE, ecma_builtin_array_prototype_object_reduce, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, ecma_builtin_array_prototype_object_reduce_right, NON_FIXED, 1)

#endif /* !CONFIG_DISABLE_ARRAY_BUILTIN */

#include "ecma-builtin-helpers-macro-undefs.inc.h"


text:
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { Project } from 'core/lb-services'
import { StoreService } from 'core/store.service'

@Component({
  selector: 'projects',
  styleUrls: [
    './projects.scss'
  ],
  templateUrl: './projects.html'
})

export class ProjectsComponent implements OnInit {
  connections = {}
  projects = []

  constructor(
    public router: Router,
    public project: Project,
    public store: StoreService
  ) {}

  ngOnInit() {
    this.getProjects()
    this.getConnections()
  }

  delete(project) {
    this.project.deleteById(project._id).subscribe((res) => {
      this.store.delete('project', project._id)
      this.getProjects()
    })
  }

  getConnections() {
    this.store.read('connection').subscribe((connections) => {
      for(let connection of connections) {
        this.connections[connection._id] = connection
      }
    })
  }

  getProjects() {
    this.store.read('project').subscribe((projects) => {
      console.log('projects', projects)
      this.projects = projects
    })
  }
}


text:
#pragma once
#include <aws/chime/Chime_EXPORTS.h>
#include <aws/chime/model/TranscribeLanguageCode.h>
#include <aws/chime/model/TranscribeVocabularyFilterMethod.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/chime/model/TranscribeRegion.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Chime
{
namespace Model
{

  /**
   *
Settings specific to the Amazon Transcribe engine.

See Also:

   * AWS
   * API Reference

   */
  class AWS_CHIME_API EngineTranscribeSettings
  {
  public:
    EngineTranscribeSettings();
    EngineTranscribeSettings(Aws::Utils::Json::JsonView jsonValue);
    EngineTranscribeSettings& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The language code specified for the Amazon Transcribe engine.

     */
    inline const TranscribeLanguageCode& GetLanguageCode() const{ return m_languageCode; }

    /**
     *
The language code specified for the Amazon Transcribe engine.

     */
    inline bool LanguageCodeHasBeenSet() const { return m_languageCodeHasBeenSet; }

    /**
     *
The language code specified for the Amazon Transcribe engine.

     */
    inline void SetLanguageCode(const TranscribeLanguageCode& value) { m_languageCodeHasBeenSet = true; m_languageCode = value; }

    /**
     *
The language code specified for the Amazon Transcribe engine.

     */
    inline void SetLanguageCode(TranscribeLanguageCode&& value) { m_languageCodeHasBeenSet = true; m_languageCode = std::move(value); }

    /**
     *
The language code specified for the Amazon Transcribe engine.

     */
    inline EngineTranscribeSettings& WithLanguageCode(const TranscribeLanguageCode& value) { SetLanguageCode(value); return *this;}

    /**
     *
The language code specified for the Amazon Transcribe engine.

     */
    inline EngineTranscribeSettings& WithLanguageCode(TranscribeLanguageCode&& value) { SetLanguageCode(std::move(value)); return *this;}

    /**
     *
The filtering method passed to Amazon Transcribe.

     */
    inline const TranscribeVocabularyFilterMethod& GetVocabularyFilterMethod() const{ return m_vocabularyFilterMethod; }

    /**
     *
The filtering method passed to Amazon Transcribe.

     */
    inline bool VocabularyFilterMethodHasBeenSet() const { return m_vocabularyFilterMethodHasBeenSet; }

    /**
     *
The filtering method passed to Amazon Transcribe.

     */
    inline void SetVocabularyFilterMethod(const TranscribeVocabularyFilterMethod& value) { m_vocabularyFilterMethodHasBeenSet = true; m_vocabularyFilterMethod = value; }

    /**
     *
The filtering method passed to Amazon Transcribe.

     */
    inline void SetVocabularyFilterMethod(TranscribeVocabularyFilterMethod&& value) { m_vocabularyFilterMethodHasBeenSet = true; m_vocabularyFilterMethod = std::move(value); }

    /**
     *
The filtering method passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyFilterMethod(const TranscribeVocabularyFilterMethod& value) { SetVocabularyFilterMethod(value); return *this;}

    /**
     *
The filtering method passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyFilterMethod(TranscribeVocabularyFilterMethod&& value) { SetVocabularyFilterMethod(std::move(value)); return *this;}

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline const Aws::String& GetVocabularyFilterName() const{ return m_vocabularyFilterName; }

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline bool VocabularyFilterNameHasBeenSet() const { return m_vocabularyFilterNameHasBeenSet; }

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline void SetVocabularyFilterName(const Aws::String& value) { m_vocabularyFilterNameHasBeenSet = true; m_vocabularyFilterName = value; }

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline void SetVocabularyFilterName(Aws::String&& value) { m_vocabularyFilterNameHasBeenSet = true; m_vocabularyFilterName = std::move(value); }

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline void SetVocabularyFilterName(const char* value) { m_vocabularyFilterNameHasBeenSet = true; m_vocabularyFilterName.assign(value); }

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyFilterName(const Aws::String& value) { SetVocabularyFilterName(value); return *this;}

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyFilterName(Aws::String&& value) { SetVocabularyFilterName(std::move(value)); return *this;}

    /**
     *
The name of the vocabulary filter passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyFilterName(const char* value) { SetVocabularyFilterName(value); return *this;}

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline const Aws::String& GetVocabularyName() const{ return m_vocabularyName; }

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline bool VocabularyNameHasBeenSet() const { return m_vocabularyNameHasBeenSet; }

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline void SetVocabularyName(const Aws::String& value) { m_vocabularyNameHasBeenSet = true; m_vocabularyName = value; }

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline void SetVocabularyName(Aws::String&& value) { m_vocabularyNameHasBeenSet = true; m_vocabularyName = std::move(value); }

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline void SetVocabularyName(const char* value) { m_vocabularyNameHasBeenSet = true; m_vocabularyName.assign(value); }

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyName(const Aws::String& value) { SetVocabularyName(value); return *this;}

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyName(Aws::String&& value) { SetVocabularyName(std::move(value)); return *this;}

    /**
     *
The name of the vocabulary passed to Amazon Transcribe.

     */
    inline EngineTranscribeSettings& WithVocabularyName(const char* value) { SetVocabularyName(value); return *this;}

    /**
     *
The AWS Region passed to Amazon Transcribe. If you don't specify a Region,
     * Amazon Chime uses the meeting's Region.

     */
    inline const TranscribeRegion& GetRegion() const{ return m_region; }

    /**
     *
The AWS Region passed to Amazon Transcribe. If you don't specify a Region,
     * Amazon Chime uses the meeting's Region.

     */
    inline bool RegionHasBeenSet() const { return m_regionHasBeenSet; }

    /**
     *
The AWS Region passed to Amazon Transcribe. If you don't specify a Region,
     * Amazon Chime uses the meeting's Region.

     */
    inline void SetRegion(const TranscribeRegion& value) { m_regionHasBeenSet = true; m_region = value; }

    /**
     *
The AWS Region passed to Amazon Transcribe. If you don't specify a Region,
     * Amazon Chime uses the meeting's Region.

     */
    inline void SetRegion(TranscribeRegion&& value) { m_regionHasBeenSet = true; m_region = std::move(value); }

    /**
     *
The AWS Region passed to Amazon Transcribe. If you don't specify a Region,
     * Amazon Chime uses the meeting's Region.

     */
    inline EngineTranscribeSettings& WithRegion(const TranscribeRegion& value) { SetRegion(value); return *this;}

    /**
     *
The AWS Region passed to Amazon Transcribe. If you don't specify a Region,
     * Amazon Chime uses the meeting's Region.

     */
    inline EngineTranscribeSettings& WithRegion(TranscribeRegion&& value) { SetRegion(std::move(value)); return *this;}

  private:

    TranscribeLanguageCode m_languageCode;
    bool m_languageCodeHasBeenSet;

    TranscribeVocabularyFilterMethod m_vocabularyFilterMethod;
    bool m_vocabularyFilterMethodHasBeenSet;

    Aws::String m_vocabularyFilterName;
    bool m_vocabularyFilterNameHasBeenSet;

    Aws::String m_vocabularyName;
    bool m_vocabularyNameHasBeenSet;

    TranscribeRegion m_region;
    bool m_regionHasBeenSet;
  };

} // namespace Model
} // namespace Chime
} // namespace Aws