text:
package gov.nih.nci.cagrid.metadata.xmi;

import gov.nih.nci.cagrid.metadata.common.SemanticMetadata;
import gov.nih.nci.cagrid.metadata.common.UMLAttribute;
import gov.nih.nci.cagrid.metadata.common.UMLClass;
import gov.nih.nci.cagrid.metadata.dataservice.DomainModel;
import gov.nih.nci.cagrid.metadata.dataservice.DomainModelExposedUMLAssociationCollection;
import gov.nih.nci.cagrid.metadata.dataservice.DomainModelExposedUMLClassCollection;
import gov.nih.nci.cagrid.metadata.dataservice.DomainModelUmlGeneralizationCollection;
import gov.nih.nci.cagrid.metadata.dataservice.UMLAssociation;
import gov.nih.nci.cagrid.metadata.dataservice.UMLGeneralization;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

/**
 *  BaseXMIHandler
 *  Base class to organize XMI handlers
 *
 * @author David Ervin
 *
 * @created Apr 22, 2008 3:44:03 PM
 * @version $Id: BaseXMIHandler.java,v 1.5 2009-02-04 14:55:45 dervin Exp $
 */
public abstract class BaseXMIHandler extends DefaultHandler {

    private static Log logger = LogFactory.getLog(BaseXMIHandler.class);

    // parser contains configuration options and information for the handler
    private XMIParser parser = null;

    // element text content
    private StringBuffer chars = null;

    // SAX locator tells us where we are in the document
    private Locator locator = null;

    // lists of domain model components
    private List<UMLClass> classList = null;
    private List<UMLAttribute> attribList = null;
    private List<UMLAssociation> assocList = null;
    private List<UMLGeneralization> generalizationList = null;

    // maps from XMI name to domain model component
    private Map<String, UMLClass> classTable = null; // class ID to class instance
    private Map<String, UMLAttribute> attribTable = null; // attribute ID to attribute instance
    private Map<String, List<SemanticMetadata>> semanticMetadataTable = null; // element ID to semantic metadata list
    private Map<String, String> typeTable = null; // type ID to type name

    public BaseXMIHandler(XMIParser parser) {
        super();
        this.parser = parser;
        this.chars = new StringBuffer();
        // initialize lists
        this.classList = new ArrayList<UMLClass>();
        this.attribList = new ArrayList<UMLAttribute>();
        this.assocList = new ArrayList<UMLAssociation>();
        this.generalizationList = new ArrayList<UMLGeneralization>();
        // initialize tables
        this.classTable = new HashMap<String, UMLClass>();
        this.attribTable = new HashMap<String, UMLAttribute>();
        this.semanticMetadataTable = new HashMap<String, List<SemanticMetadata>>();
        this.typeTable = new HashMap<String, String>();
    }

    /**
     * If the SAX parser supports a Locator, this will get invoked before startDocument()
     */
    public void setDocumentLocator(Locator locator) {
        this.locator = locator;
    }

    /**
     * Gets the current line of the XMI document being parsed
     *
     * @return
     *      The line number, or -1 if no locator was supplied
     */
    public int getCurrentLine() {
        int line = -1;
        if (locator != null) {
            line = locator.getLineNumber();
        }
        return line;
    }

    public void addAssociation(UMLAssociation assoc) {
        assocList.add(assoc);
    }

    public UMLAssociation getLastAssociation() {
        return assocList.get(assocList.size() - 1);
    }

    public void addClass(UMLClass clazz) {
        classList.add(clazz);
        classTable.put(clazz.getId(), clazz);
    }

    public UMLClass getLastClass() {
        return classList.get(classList.size() - 1);
    }

    public UMLClass getClassById(String id) {
        return classTable.get(id);
    }

    public void addAttribute(UMLAttribute attrib) {
        attribList.add(attrib);
        attribTable.put(String.valueOf(attrib.getPublicID()), attrib);
    }

    public UMLAttribute getLastAttribute() {
        return attribList.get(attribList.size() - 1);
    }

    public void clearAttributeList() {
        this.attribList.clear();
    }

    public UMLAttribute[] getAttributes() {
        UMLAttribute[] array = new UMLAttribute[attribList.size()];
        attribList.toArray(array);
        return array;
    }

    public UMLAttribute getAttributeById(String id) {
        return attribTable.get(id);
    }

    public void addGeneralization(UMLGeneralization gen) {
        generalizationList.add(gen);
    }

    public UMLGeneralization getLastGeneralization() {
        return generalizationList.get(generalizationList.size() - 1);
    }

    public StringBuffer getChars() {
        return chars;
    }

    public XMIParser getParser() {
        return parser;
    }

    public Map<String, List<SemanticMetadata>> getSemanticMetadataTable() {
        return semanticMetadataTable;
    }

    public Map<String, String> getTypeTable() {
        return typeTable;
    }

    public void characters(char[] ch, int start, int length) throws SAXException {
        chars.append(ch, start, length);
    }

    public void clearChars() {
        chars.delete(0, chars.length());
    }

    public void endDocument() throws SAXException {
        applySemanticMetadata();
        applyDataTypes();
        flattenAttributes();
        applyFilters();

        DomainModel model = new DomainModel();

        model.setProjectShortName(getParser().getProjectShortName());
        model.setProjectLongName(getParser().getProjectLongName());
        model.setProjectVersion(getParser().getProjectVersion());
        model.setProjectDescription(getParser().getProjectDescription());

        // convert base UML classes to data UML classes
        gov.nih.nci.cagrid.metadata.dataservice.UMLClass[] dataClasses =
            new gov.nih.nci.cagrid.metadata.dataservice.UMLClass[classList.size()];
        int i = 0;
        for (UMLClass commonClass : classList) {
            gov.nih.nci.cagrid.metadata.dataservice.UMLClass dataClass =
                new gov.nih.nci.cagrid.metadata.dataservice.UMLClass();
            dataClass.setClassName(commonClass.getClassName());
            dataClass.setDescription(commonClass.getDescription());
            dataClass.setId(commonClass.getId());
            dataClass.setPackageName(commonClass.getPackageName());
            dataClass.setProjectName(commonClass.getProjectName());
            dataClass.setProjectVersion(commonClass.getProjectVersion());
            dataClass.setSemanticMetadata(commonClass.getSemanticMetadata());
            dataClass.setUmlAttributeCollection(commonClass.getUmlAttributeCollection());
            dataClass.setAllowableAsTarget(true); // NEW attribute for data classes
            dataClasses[i++] = dataClass;
        }
        model.setExposedUMLClassCollection(
            new DomainModelExposedUMLClassCollection(dataClasses));
        model.setExposedUMLAssociationCollection(
            new DomainModelExposedUMLAssociationCollection(assocList.toArray(new UMLAssociation[0])));
        model.setUmlGeneralizationCollection(
            new DomainModelUmlGeneralizationCollection(generalizationList.toArray(new UMLGeneralization[0])));

        getParser().setModel(model);
    }

    // -------------------------------
    // end of document cleanup tooling
    // -------------------------------

    private void applySemanticMetadata() {
        for (String id : semanticMetadataTable.keySet()) {
            if (classTable.containsKey(id)) {
                classTable.get(id).setSemanticMetadata(
                    semanticMetadataTable.get(id).toArray(new SemanticMetadata[0]));
            } else if (attribTable.containsKey(id)) {
                attribTable.get(id).setSemanticMetadata(
                    semanticMetadataTable.get(id).toArray(new SemanticMetadata[0]));
            }
        }
    }

    private void applyDataTypes() {
        for (String id : attribTable.keySet()) {
            UMLAttribute att = attribTable.get(id);
            String typeRef = att.getDataTypeName();

            String umlDataType = null;
            String javaDataType = null;

            // check for class
            if (umlDataType == null) {
                UMLClass typeCl = classTable.get(typeRef);
                if (typeCl != null) {
                    umlDataType = typeCl.getClassName();
                }
            }

            // check type table
            if (umlDataType == null) {
                umlDataType = typeTable.get(typeRef);
            }

            // perform mapping from UML to Java
            logger.debug("UML Data Type: " + umlDataType);
            if (umlDataType != null && XMIParser.DATATYPE_MAP.containsKey(umlDataType)) {
                javaDataType = XMIParser.DATATYPE_MAP.get(umlDataType);
            }
            logger.debug("Java Data Type: " + javaDataType);

            // set data type
            att.setDataTypeName(javaDataType);
        }
    }

    private void flattenAttributes() {
        // build table of class reference IDs from subclass -> superclass
        Map<String, String> parentTable = new HashMap<String, String>();
        for (UMLGeneralization gen : generalizationList) {
            parentTable.put(gen.getSubClassReference().getRefid(),
                gen.getSuperClassReference().getRefid());
        }

        // flatten attributes of each class
        for (String classId : classTable.keySet()) {
            UMLClass clazz = classTable.get(classId);
            List<UMLAttribute> flatAttributes =
                flattenAttributesOfClass(parentTable, classId);
            clazz.getUmlAttributeCollection().setUMLAttribute(
                flatAttributes.toArray(new UMLAttribute[0]));
        }
    }

    private List<UMLAttribute> flattenAttributesOfClass(
        Map<String, String> parentTable, String classId) {
        // if no class ID, don't return any attributes
        if (classId == null) {
            return new ArrayList<UMLAttribute>(0);
        }
        List<UMLAttribute> flatAttributes = new ArrayList<UMLAttribute>();

        // attributes of this class directly
        UMLClass cl = classTable.get(classId);
        if (cl.getUmlAttributeCollection() != null && cl.getUmlAttributeCollection().getUMLAttribute() != null) {
            for (UMLAttribute att : cl.getUmlAttributeCollection().getUMLAttribute()) {
                flatAttributes.add(att);
            }
        }

        // attributes of my parent class (and so on...)
        for (UMLAttribute att : flattenAttributesOfClass(parentTable, parentTable.get(classId))) {
            if (!flatAttributes.contains(att)) {
                flatAttributes.add(att);
            }
        }

        return flatAttributes;
    }

    private boolean shouldExcludeClass(UMLClass clazz, Pattern excludePattern) {
        String pack = clazz.getPackageName();
        return pack.equals("") || pack.startsWith("java")
            || (excludePattern != null && excludePattern.matcher(pack).matches());
    }

    private void applyFilters() {
        // build a set of class IDs which are valid to keep references to
        // from other components of the model
        Set<String> validClassIds = new HashSet<String>();
        List<UMLClass> filteredClasses = new ArrayList<UMLClass>();

        // exclude java.* packages, blank package names, and potentially anything matching the exclude regex
        String excludeRegex = getParser().getPackageExcludeRegex();
        Pattern excludePattern = null;
        if (excludeRegex != null) {
            logger.debug("Excluding packages matching " + excludeRegex);
            excludePattern = Pattern.compile(excludeRegex);
        }
        for (UMLClass clazz : classList) {
            if (!shouldExcludeClass(clazz, excludePattern)) {
                validClassIds.add(clazz.getId());
                filteredClasses.add(clazz);
            }
        }
        this.classList = filteredClasses;

        // filter associations
        List<UMLAssociation> filteredAssociations =
            new ArrayList<UMLAssociation>(this.assocList.size());
        for (UMLAssociation assoc : this.assocList) {
            if (validClassIds.contains(assoc.getSourceUMLAssociationEdge()
                .getUMLAssociationEdge().getUMLClassReference().getRefid())
                && validClassIds.contains(assoc.getTargetUMLAssociationEdge()
                    .getUMLAssociationEdge().getUMLClassReference().getRefid())) {
                filteredAssociations.add(assoc);
            }
        }
        this.assocList = filteredAssociations;

        // filter generalizations
        List<UMLGeneralization> filteredGeneralizations =
            new ArrayList<UMLGeneralization>(this.generalizationList.size());
        for (UMLGeneralization gen : this.generalizationList) {
            if (validClassIds.contains(gen.getSubClassReference().getRefid())
                && validClassIds.contains(gen.getSuperClassReference().getRefid())) {
                filteredGeneralizations.add(gen);
            }
        }
        this.generalizationList = filteredGeneralizations;
    }
}


text:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
            android:fillColor="@color/colorPrimaryText"
            android:pathData="M10,18h4v-2h-4v2zM3,6v2h18V6H3zm3,7h12v-2H6v2z"/>
</vector>

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE css [
	<!ENTITY tizen.css.types SYSTEM "tizen.css.types.xml">
]>

<css>
    <category name="Background">
	    <property name="background" type="string" displayName="Background"></property>
	    <property name="background-attachment" type="string" displayName="Attachment"></property>
	    <property name="background-color" type="string" displayName="Color" default="#F8F6EF"></property>
	    <property name="background-image" type="string" displayName="Image"></property>
	    <property name="background-position" type="background@position" displayName="Position"></property>
	    <property name="background-repeat" type="background@repeat" displayName="Repeat" default=""></property>
	    <property name="background-clip" type="string" displayName="Clip"></property>
	    <property name="background-origin" type="string" displayName="Origin"></property>
	    <property name="background-size" type="string" displayName="Size"></property>
    </category>
    <category name="Border">
        <property name="border" type="string" displayName="Border"></property>
        <property name="border-bottom" type="string" displayName="Border Bottom"></property>
        <property name="border-bottom-color" type="string" displayName="Border Bottom Color"></property>
        <property name="border-bottom-style" type="string" displayName="Border Bottom Style"></property>
        <property name="border-bottom-width" type="string" displayName="Border Bottom Width"></property>
        <property name="border-color" type="string" displayName="Color" default="#000000"></property>
        <property name="border-left" type="string" displayName="Border Left"></property>
        <property name="border-left-color" type="string" displayName="Border Left Color"></property>
        <property name="border-left-style" type="string" displayName="Border Left Style"></property>
        <property name="border-left-width" type="string" displayName="Border Left Width"></property>
        <property name="border-right" type="string" displayName="Border Right"></property>
        <property name="border-right-color" type="string" displayName="Border Right Color"></property>
        <property name="border-right-style" type="string" displayName="Border Right Style"></property>
        <property name="border-right-width" type="string" displayName="Border Right Width"></property>
        <property name="border-style" type="border@style" displayName="Style" default=""></property>
        <property name="border-top" type="string" displayName="Border Top"></property>
        <property name="border-top-color" type="string" displayName="Border Top Color"></property>
        <property name="border-top-style" type="string" displayName="Border Top Style"></property>
        <property name="border-top-width" type="string" displayName="Border Top Width"></property>
        <property name="border-width" type="style@size" displayName="Width">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999" error="integer-max"/>
        </property>
        <property name="border-bottom-left-radius" type="string" displayName="Border Bottom Left Radius"></property>
        <property name="border-bottom-right-radius" type="string" displayName="Border Bottom Right Radius"></property>
        <property name="border-image" type="string" displayName="Border Image"></property>
        <property name="border-radius" type="string" displayName="Border Radius"></property>
        <property name="border-top-left-radius" type="string" displayName="Border Top Left Radius"></property>
        <property name="border-top-right-radius" type="string" displayName="Border Top Right Radius"></property>
    </category>
    <category name="Outline">
        <property name="outline" type="string" displayName="Outline"></property>
        <property name="outline-color" type="string" displayName="Outline Color"></property>
        <property name="outline-style" type="string" displayName="Outline Style"></property>
        <property name="outline-width" type="string" displayName="Outline Width"></property>
    </category>
    <category name="Box">
        <property name="box-shadow" type="string" displayName="Box Shadow"></property>
        <property name="overflow-x" type="string" displayName="Overflow X"></property>
        <property name="overflow-y" type="string" displayName="Overflow Y"></property>
        <property name="overflow-style" type="string" displayName="Overflow Style"></property>
    </category>
    <category name="Color">
    	<property name="color" type="string" displayName="Color" default="#000000"></property>
        <property name="opacity" type="string" displayName="Opacity"></property>
    </category>
    <category name="Dimension">
        <property name="width" type="style@size" displayName="Width">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="height" type="style@size" displayName="Height">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="max-width" type="string" displayName="Max Width">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="max-height" type="string" displayName="Max Height">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="min-width" type="string" displayName="Min Width">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="min-height" type="string" displayName="Min Height">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
    </category>
    <category name="Flexible Box">
        <property name="box-align" type="string" displayName="Box Align"></property>
        <property name="box-direction" type="string" displayName="Box Direction"></property>
        <property name="box-flex" type="string" displayName="Box Flex"></property>
        <property name="box-ordinal-group" type="string" displayName="Box Ordinal Group"></property>
        <property name="box-orient" type="string" displayName="Box Orient"></property>
        <property name="box-pack" type="string" displayName="Box Pack"></property>
    </category>
    <category name="Font">
        <property name="font" type="string" displayName="Font"></property>
        <property name="font-family" type="font@family" displayName="Font Family"></property>
        <property name="font-size" type="font@size" displayName="Font Size">
        	<condition name="integer-min" value="0" error="integer-min"/>
			<condition name="integer-max" value="999" error="integer-max"/>
        </property>
        <property name="font-style" type="string" displayName="Font Style"></property>
        <property name="font-variant" type="string" displayName="Font Variant"></property>
        <property name="font-weight" type="string" displayName="Font Weight"></property>
        <property name="@font-face" type="string" displayName="Font Face"></property>
    </category>
    <category name="Generated Conetent">
        <property name="content" type="string" displayName="Content"></property>
        <property name="counter-increment" type="string" displayName="Counter Increment"></property>
        <property name="counter-reset" type="string" displayName="Counter Reset"></property>
        <property name="quotes" type="string" displayName="Quotes"></property>
    </category>
    <category name="List">
        <property name="list-style" type="string" displayName="List Style"></property>
        <property name="list-style-image" type="string" displayName="List Style Image"></property>
        <property name="list-style-position" type="string" displayName="List Style Position"></property>
        <property name="list-style-type" type="string" displayName="List Style Type"></property>
    </category>
    <category name="Margin">
        <property name="margin" type="string" displayName="Margin"></property>
        <property name="margin-bottom" type="style@size" displayName="Bottom">
        	<condition name="integer-min" value="-999999" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="margin-left" type="style@size" displayName="Left">
        	<condition name="integer-min" value="-999999" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="margin-right" type="style@size" displayName="Right">
        	<condition name="integer-min" value="-999999" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
        <property name="margin-top" type="style@size" displayName="Top">
        	<condition name="integer-min" value="-999999" error="integer-min"/>
			<condition name="integer-max" value="999999" error="integer-max"/>
        </property>
    </category>
    <category name="Multi Coloumn">
        <property name="column-count" type="string" displayName="Column Count"></property>
        <property name="column-gap" type="string" displayName="Column Gap"></property>
        <property name="column-rule" type="string" displayName="Column Rule"></property>
        <property name="column-rule-color" type="string" displayName="Column Rule Color"></property>
        <property name="column-rule-style" type="string" displayName="Column Rule Style"></property>
        <property name="column-rule-width" type="string" displayName="Column Rule Width"></property>
        <property name="column-span" type="string" displayName="Column Span"></property>
        <property name="column-width" type="string" displayName="Column Width"></property>
        <property name="columns" type="string" displayName="Columns"></property>
    </category>
    <category name="Padding">
        <property name="padding" type="string" displayName="Padding"></property>
        <property name="padding-bottom" type="string" displayName="Padding Bottom"></property>
        <property name="padding-left" type="string" displayName="Padding Left"></property>
        <property name="padding-right" type="string" displayName="Padding Right"></property>
        <property name="padding-top" type="string" displayName="Padding Top"></property>
    </category>
    <category name="Positioning">
        <property name="bottom" type="string" displayName="Bottom"></property>
        <property name="clear" type="string" displayName="Clear"></property>
        <property name="clip" type="string" displayName="Clip"></property>
        <property name="cursor" type="string" displayName="Cursor"></property>
        <property name="display" type="string" displayName="Display"></property>
        <property name="float" type="string" displayName="Float"></property>
        <property name="left" type="string" displayName="Left"></property>
        <property name="overflow" type="string" displayName="Overflow"></property>
        <property name="position" type="string" displayName="Position"></property>
        <property name="right" type="string" displayName="Right"></property>
        <property name="top" type="string" displayName="Top"></property>
        <property name="visibility" type="string" displayName="Visibility"></property>
        <property name="z-index" type="string" displayName="Z-Index"></property>
    </category>
    <category name="Text">
        <property name="color" type="string" displayName="Color" default="#000000"></property>
        <property name="direction" type="string" displayName="Direction"></property>
        <property name="letter-spacing" type="string" displayName="Letter Spacing"></property>
        <property name="line-height" type="string" displayName="Line Height"></property>
        <property name="text-align" type="string" displayName="Text Align"></property>
        <property name="text-decoration" type="string" displayName="Text Decoration"></property>
        <property name="text-indent" type="string" displayName="Text Indent"></property>
        <property name="text-transform" type="string" displayName="Text Transform"></property>
        <property name="vertical-align" type="string" displayName="Vertical Align"></property>
        <property name="white-space" type="string" displayName="White Space"></property>
        <property name="word-spacing" type="string" displayName="Word Spacing"></property>
        <property name="text-justify" type="string" displayName="Text Justify"></property>
        <property name="text-overflow" type="string" displayName="Text Overflow"></property>
        <property name="text-shadow" type="string" displayName="Text Shadow"></property>
        <property name="word-break" type="string" displayName="Word Break"></property>
        <property name="word-wrap" type="string" displayName="Word Wrap"></property>
    </category>
    <category name="User Interface">
        <property name="box-sizing" type="string" displayName="Box Sizing"></property>
        <property name="outline-offset" type="string" displayName="Outline Offset"></property>
    </category>
    <!-- type & event type -->
	&tizen.css.types;
</css>


text:
<!DOCTYPE html>

    <meta charset="UTF-8"/>
    <title th:text="#{document.header}">Information</title>

        Three apples

This fragment was translated to English (USA)


text:
package org.lwjgl.opengles;

/**
 * Native bindings to the OES_vertex_half_float extension.
 *
 *
This extension adds a 16-bit floating pt data type (aka half float) to vertex data specified using vertex arrays. The 16-bit floating-point components
 * have 1 sign bit, 5 exponent bits, and 10 mantissa bits.

 *
 *
The half float data type can be very useful in specifying vertex attribute data such as color, normals, texture coordinates etc. By using half floats
 * instead of floats, we reduce the memory requirements by half. Not only does the memory footprint reduce by half, but the memory bandwidth required for
 * vertex transformations also reduces by the same amount approximately. Another advantage of using half floats over short/byte data types is that we do
 * not needto scale the data. For example, using SHORT for texture coordinates implies that we need to scale the input texture coordinates in the shader
 * or set an appropriate scale matrix as the texture matrix for fixed function pipeline. Doing these additional scaling operations impacts vertex
 * transformation performance.

 */
public final class OESVertexHalfFloat {

    /**
     * Accepted by the {@code type} parameter of VertexPointer, NormalPointer, ColorPointer, SecondaryColorPointer, IndexPointer, FogCoordPointer,
     * TexCoordPointer, and VertexAttribPointer.
     */
    public static final int GL_HALF_FLOAT_OES = 0x8D61;

    private OESVertexHalfFloat() {}

}


text:
Tutorial
--------

###  What is a structure

If you start programming code in C++ you'll sooner or later be facing a situation in which you'll need to store coherent data in a structured way.
This is where structures come in place...

A structure is basically a user-defined datatype which consists of other datatypes like int, char, etc. ...

### Defining a structure
    //This is how you'll usually define a structure
    using namespace std;
    struct MyOwnStructure { // keyword "struct" followed by a name, followed by braces containing the datatypes you like, followed by a semicolon
        int property_one;
        int property_two;
        char property_three;
        bool property_four;
        //...
    };

### Using a structure
    int main (void) {
        MyOwnStructure demo1; //Declare demo1 of type MyOwnStructure
        MyOwnStructure demo2; //Declare demo2 of type MyOwnStructure

        //set demo1's with values
        demo1.property_one = 1;
        demo1.property_two = 2;
        demo1.property_three = 'a';
        demo1.property_four = false;

        //set demo2's values
        demo2.property_one = 3;
        demo2.property_two = 4;
        demo2.property_three = 'b';
        demo2.property_four = true;

        cout << "Demo1: " << demo1.property_one << demo1.property_two << demo1.property_three << demo1.property_four << endl;
        cout << "Demo2: " << demo2.property_one << demo2.property_two << demo2.property_three << demo2.property_four << endl;
        /*
        Will output
        Demo1: 12a0
        Demo2: 34b1
        */
        return 0;
    }

Exercise
--------

- Create a structure named "person" with the following fields
  - name (should be string)
  - age (should be int)
  - do_programming (should be bool)
- declare two objects "p1" and "p2" of your structure's datatype
- set the values for "p1" as follows:
    - name: alice
    - age: 20
    - do_programming: true
- set the values for "p2" as follows:
    - name: bob
    - age: 18
    - do_programming: false
- "cout" their informations in the scheme "name (age)" => e.g. tim (23) by getting the values from your structure-objects

Tutorial Code
-------------

    #include <iostream>
    using namespace std;

    //Your structure here...

    int main (void){
        //Declaring person's
        //Your code here...

        //Setting person 1's values
        //Your code here...

        //Setting person 2's values
        //Your code here...

        //Printing out
        //Your code here...
        //cout << name << " (" << age << ")" << endl;

        return 0;
    }

Expected Output
---------------

    alice (20)
    bob (18)

Solution
--------

    #include <iostream>
    using namespace std;

    struct person {
        string name;
        int age;
        bool do_programming;
    };

    int main (void){
        //Declaring person's
        person p1;
        person p2;

        //Setting person 1's values
        p1.name = "alice";
        p1.age = 20;
        p1.do_programming = true;

        //Setting person 2's values
        p2.name = "bob";
        p2.age = 18;
        p2.do_programming = false;

        //Printing out
        cout << p1.name << " (" << p1.age << ")" << endl;
        cout << p2.name << " (" << p2.age << ")" << endl;

        return 0;
    }


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:state_pressed="true"
		android:drawable="@drawable/umeng_fb_list_item_pressed" />
	<item android:state_pressed="false"
		android:drawable="@drawable/umeng_fb_list_item" />
</selector><!-- From: file:/Users/lucas/dev/workspace/umeng/feedback/umeng-feedback-android/sdk/src/main/res/drawable/umeng_fb_list_item_selector.xml -->


text:
package org.olat.presentation.framework.core.components.form.flexible.elements;

import java.util.List;
import java.util.Map;

import org.olat.presentation.framework.core.components.form.flexible.FormItem;

/**
 * Description:

 * TODO: rhaag Class Description for TextBoxListElement
 *

 * Initial Date: 27.08.2010

 *
 * @author Roman Haag, roman.haag@frentix.com, http://www.frentix.com
 */
public interface TextBoxListElement extends FormItem {

    public String getValue();

    public List<String> getValueList();

    public void setAutoCompleteContent(List<String> tagL);

    public void setNoFormSubmit(boolean noFormSubmit);

    public void setAutoCompleteContent(Map<String, String> tagM);

}


text:
package com.netflix.hystrix.contrib.javanica.command;

public class CommandActions {

    private final CommandAction commandAction;
    private final CommandAction fallbackAction;
    private final CommandAction cacheKeyAction;

    public CommandActions(Builder builder) {
        this.commandAction = builder.commandAction;
        this.fallbackAction = builder.fallbackAction;
        this.cacheKeyAction = builder.cacheKeyAction;
    }

    public static Builder builder() {
        return new Builder();
    }

    public CommandAction getCommandAction() {
        return commandAction;
    }

    public CommandAction getFallbackAction() {
        return fallbackAction;
    }

    public CommandAction getCacheKeyAction() {
        return cacheKeyAction;
    }

    public static class Builder {
        private CommandAction commandAction;
        private CommandAction fallbackAction;
        private CommandAction cacheKeyAction;

        public Builder commandAction(CommandAction pCommandAction) {
            this.commandAction = pCommandAction;
            return this;
        }

        public Builder fallbackAction(CommandAction pFallbackAction) {
            this.fallbackAction = pFallbackAction;
            return this;
        }

        public Builder cacheKeyAction(CommandAction pCacheKeyAction) {
            this.cacheKeyAction = pCacheKeyAction;
            return this;
        }

        public CommandActions build() {
            return new CommandActions(this);
        }
    }

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: ww
 * Date: 29.09.15
 * Time: 21:16
 */
namespace React\ProcessManager\LoadManager\Interfaces;

use React\ProcessManager\Interfaces\PmControlDto;

interface Management
{

    /**
     * @param PmControlDto $receivedControlDto
     * @return mixed
     */
    public function processReceivedControlDto(PmControlDto $receivedControlDto);

}


text:
class CreateXmls < ActiveRecord::Migration
  def self.up
    create_table :xmls do |t|
      t.string   :finance_name
      t.string   :ledger_name
      t.timestamps
    end
    create_default
  end

  def self.down
    drop_table :xmls
  end

  def self.create_default
    Xml.create :finance_name =>"Salary", :ledger_name => ""
    Xml.create :finance_name =>"Fee", :ledger_name => ""
    Xml.create :finance_name =>"Donation", :ledger_name => ""
  end
end


text:
package org.mifos.application.meeting.business;

import org.mifos.application.meeting.util.helpers.RecurrenceType;
import org.mifos.framework.business.AbstractEntity;

/**
 * This class encapsulate the RecurrenceType for a meeting See also
 * {@link RecurrenceType}.
 */
public class RecurrenceTypeEntity extends AbstractEntity {

    private Short recurrenceId;

    private String recurrenceName;

    private String description;

    public RecurrenceTypeEntity(RecurrenceType recurrence) {
        this.recurrenceId = recurrence.getValue();
    }

    public RecurrenceTypeEntity() {
    }

    public String getDescription() {
        return description;
    }

    public Short getRecurrenceId() {
        return recurrenceId;
    }

    public String getRecurrenceName() {
        return recurrenceName;
    }

    public boolean isWeekly() {
        return recurrenceId.equals(RecurrenceType.WEEKLY.getValue());
    }

    public boolean isMonthly() {
        return recurrenceId.equals(RecurrenceType.MONTHLY.getValue());
    }

    public RecurrenceType asEnum() {
        return RecurrenceType.fromInt(recurrenceId);
    }
}


text:
A data science tutorial for absolutely Python beginners

This is a code sample for
http://www.codeastar.com/beginner-data-science-tutorial/

Click the above link for more details.

For K-Fold Cross Validation, you can click the *kfold_cross_validation.py* file
and take a look at http://www.codeastar.com/choose-machine-learning-models-python/


text:
As of release 1.3.0, Envoy will follow a
[Breaking Change Policy](https://github.com/lyft/envoy/blob/master//CONTRIBUTING.md#breaking-change-policy).

The following features have been DEPRECATED and will be removed in the specified release cycle.

* Version 1.4.0
  * Config option `statsd_local_udp_port` has been deprecated and has been replaced with
  `statsd_udp_ip_address`.
  * `HttpFilterConfigFactory` filter API has been deprecated in favor of `NamedHttpFilterConfigFactory`.
  * Config option `http_codec_options` has been deprecated and has been replaced with `http2_settings`.
  * The following log macros have been deprecated: `log_trace`, `log_debug`, `conn_log`,
  `conn_log_info`, `conn_log_debug`, `conn_log_trace`, `stream_log`, `stream_log_info`,
  `stream_log_debug`, `stream_log_trace`.  For replacements, please see
  [logger.h](https://github.com/lyft/envoy/blob/master/source/common/common/logger.h).


text:
/* See license.txt for terms of usage */

//
FBL.ns(function() { with (FBL) {

// ************************************************************************************************
// Constants

const Cc = Components.classes;
const Ci = Components.interfaces;

top.Firebug.Console.injector =
{
    isAttached: function(context, win)
    {
		if (FBTrace.DBG_CONSOLE)
			FBTrace.sysout("Console.isAttached :"+context.consoleToken+" vs  "+win.document.getUserData("firebug-Token")+ " in "+safeGetWindowLocation(win.wrappedJSObject));

		if (!context.consoleToken)
			return false;

		var attachedToken = win.document.getUserData("firebug-Token");
		if (!attachedToken)
			return false;

		if (context.consoleToken !== attachedToken)
		{
			Firebug.Console.logFormatted(["Firebug Console token changed!"], FirebugContext, "info");  // XXXTODO NLS
			return false;
		}
		return true;
    },

    attachIfNeeded: function(context, win)
    {
        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("Console.attachIfNeeded has win "+(win? ((win.wrappedJSObject?"YES":"NO")+" wrappedJSObject"):"null") );

        if (this.isAttached(context, win))
            return true;

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("Console.attachIfNeeded found isAttached false " +
                safeGetWindowLocation(win));

        this.attachConsoleInjector(context, win);
        this.addConsoleListener(context, win);

        Firebug.Console.clearReloadWarning(context);

        var attached =  this.isAttached(context, win);
        if (attached)
            dispatch(Firebug.Console.fbListeners, "onConsoleInjected", [context, win]);

        return attached;
    },

    attachConsoleInjector: function(context, win)
    {
        var consoleInjection = this.getConsoleInjectionScript();  // Do it all here.

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("attachConsoleInjector evaluating in "+win.location, consoleInjection);

        Firebug.CommandLine.evaluateInWebPage(consoleInjection, context, win);

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("attachConsoleInjector evaluation completed for "+win.location);
    },

    getConsoleInjectionScript: function() {
        if (!this.consoleInjectionScript)
        {
            var script = "";
            script += "window.__defineGetter__('console', function console() {\n";
            script += " return (window._firebug ? window._firebug : window.loadFirebugConsole()); })\n\n";

            script += "window.loadFirebugConsole = function loadFirebugConsole() {\n";
            script += "window._firebug =  new _FirebugConsole();";

            if (FBTrace.DBG_CONSOLE)
                script += " window.dump('loadFirebugConsole '+window.location+'\\n');\n";

            script += " return window._firebug };\n";

            var theFirebugConsoleScript = getResource("chrome://firebug/content/consoleInjected.js");
            script += theFirebugConsoleScript;

            this.consoleInjectionScript = script;
        }
        return this.consoleInjectionScript;
    },

    forceConsoleCompilationInPage: function(context, win)
    {
        if (!win)
        {
            if (FBTrace.DBG_CONSOLE)
                FBTrace.sysout("no win in forceConsoleCompilationInPage!");
            return;
        }

        var consoleForcer = "window.loadFirebugConsole();";

        if (context.stopped)
            Firebug.Console.injector.evaluateConsoleScript(context);  // todo evaluate consoleForcer on stack
        else
            Firebug.CommandLine.evaluateInWebPage(consoleForcer, context, win);

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("forceConsoleCompilationInPage "+win.location, consoleForcer);
    },

    evaluateConsoleScript: function(context)
    {
        var scriptSource = this.getConsoleInjectionScript(); // TODO XXXjjb this should be getConsoleInjectionScript
        Firebug.Debugger.evaluate(scriptSource, context);
    },

    addConsoleListener: function(context, win)
    {
        if (!context.activeConsoleHandlers)  // then we have not been this way before
            context.activeConsoleHandlers = {};

        if (!win)
            win = context.window;

        if (win.wrappedJSObject)
            win = win.wrappedJSObject;

        if (context.activeConsoleHandlers[win])
            return;

        win.document.setUserData("firebug-Version", Firebug.version, null); // Initialize Firebug version.

        context.consoleToken = Math.random();
        win.document.setUserData("firebug-Token", context.consoleToken, null); // Initialize Firebug token

        var handler = createConsoleHandler(context, win);

        context.activeConsoleHandlers[win] = handler;

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("consoleInjector addConsoleListener attached handler("+handler.handler_name+") to _firebugConsole in : "+win.location+"\n");
        return true;
    },

    detachConsole: function(context, win)
    {
        if (!win)
            win = context.window;

        if (win.wrappedJSObject)
            win = win.wrappedJSObject;

        if (context.activeConsoleHandlers)
        {
            if (context.activeConsoleHandlers[win])
                context.activeConsoleHandlers[win].detach();
            delete context.activeConsoleHandlers[win];
        }

    },
}

var total_handlers = 0;
function createConsoleHandler(context, win)
{
    var handler = {};
    handler.console = Firebug.Console.createConsole(context, win),

    handler.detach = function()
    {
        win.document.removeEventListener('firebugAppendConsole', this.boundHandler, true);

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("consoleInjector FirebugConsoleHandler removeEventListener "+this.handler_name);
    };

    handler.handler_name = ++total_handlers;
    handler.handleEvent = function(event)
    {
        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("FirebugConsoleHandler("+this.handler_name+") "+win.document.getUserData("firebug-methodName")+", event", event);
        if (!Firebug.CommandLine.CommandHandler.handle(event, this.console, win))
        {
            if (FBTrace.DBG_CONSOLE)
                FBTrace.sysout("FirebugConsoleHandler", this);

            var methodName = win.document.getUserData("firebug-methodName");
            Firebug.Console.log($STRF("console.MethodNotSupported", [methodName]));
        }
    };

    handler.setEvaluatedCallback = function( fnOfResult )
    {
        this.console.evaluated = fnOfResult;
    };

    handler.setEvaluateErrorCallback = function( fnOfResultAndContext )
    {
        this.console.evaluateError = fnOfResultAndContext;
    };

    // When raised on our injected element, callback to Firebug and append to console

    win.document.addEventListener('firebugAppendConsole', bind(handler.handleEvent, handler), true); // capturing

    if (FBTrace.DBG_CONSOLE)
        FBTrace.sysout("consoleInjector FirebugConsoleHandler addEventListener "+handler.handler_name);

    return handler;
}

Firebug.Console.createConsole = function createConsole(context, win)
{
    var console = {};
    console.log = function()
    {
        logFormatted(arguments, "log");
    };

    console.debug = function()
    {
        logFormatted(arguments, "debug", true);
    };

    console.info = function()
    {
        logFormatted(arguments, "info", true);
    };

    console.warn = function()
    {
        logFormatted(arguments, "warn", true);
    };

    console.error = function()
    {
        if (arguments.length == 1)
        {
            logAssert("error", arguments);  // add more info based on stack trace
        }
        else
        {
            Firebug.Errors.increaseCount(context);
            logFormatted(arguments, "error", true);  // user already added info
        }
    };

    console.exception = function()
    {
        logAssert("error", arguments);
    };

    console.assert = function(x)
    {
        if (!x)
        {
            var rest = [];
            for (var i = 1; i < arguments.length; i++)
                rest.push(arguments[i]);
            logAssert("assert", rest);
        }
    };

    console.dir = function(o)
    {
        Firebug.Console.log(o, context, "dir", Firebug.DOMPanel.DirTable);
    };

    console.dirxml = function(o)
    {
        if (o instanceof Window)
            o = o.document.documentElement;
        else if (o instanceof Document)
            o = o.documentElement;

        Firebug.Console.log(o, context, "dirxml", Firebug.HTMLPanel.SoloElement);
    };

    console.group = function()
    {
        var sourceLink = getStackLink();
        Firebug.Console.openGroup(arguments, null, "group", null, false, sourceLink);
    };

    console.groupEnd = function()
    {
        Firebug.Console.closeGroup(context);
    };

    console.groupCollapsed = function()
    {
        var sourceLink = getStackLink();
        // noThrottle true is probably ok, openGroups will likely be short strings.
        var row = Firebug.Console.openGroup(arguments, null, "group", null, true, sourceLink);
        removeClass(row, "opened");
    };

    console.profile = function(title)
    {
        Firebug.Profiler.startProfiling(context, title);
    };

    console.profileEnd = function()
    {
        Firebug.Profiler.stopProfiling(context);
    };

    console.count = function(key)
    {
        var frameId = FBL.getStackFrameId();
        if (frameId)
        {
            if (!context.frameCounters)
                context.frameCounters = {};

            if (key != undefined)
                frameId += key;

            var frameCounter = context.frameCounters[frameId];
            if (!frameCounter)
            {
                var logRow = logFormatted(["0"], null, true, true);

                frameCounter = {logRow: logRow, count: 1};
                context.frameCounters[frameId] = frameCounter;
            }
            else
                ++frameCounter.count;

            var label = key == undefined
                ? frameCounter.count
                : key + " " + frameCounter.count;

            frameCounter.logRow.firstChild.firstChild.nodeValue = label;
        }
    };

    console.clear = function()
    {
        Firebug.Console.clear(context);
    };

    console.time = function(name, reset)
    {
        if (!name)
            return;

        var time = new Date().getTime();

        if (!this.timeCounters)
            this.timeCounters = {};

        var key = "KEY"+name.toString();

        if (!reset && this.timeCounters[key])
            return;

        this.timeCounters[key] = time;
    };

    console.timeEnd = function(name)
    {
        var time = new Date().getTime();

        if (!this.timeCounters)
            return;

        var key = "KEY"+name.toString();

        var timeCounter = this.timeCounters[key];
        if (timeCounter)
        {
            var diff = time - timeCounter;
            var label = name + ": " + diff + "ms";

            this.info(label);

            delete this.timeCounters[key];
        }
        return diff;
    };

    console.table = function(data, columns)
    {
        FirebugReps.Table.log(data, columns, context);
    };

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

    // These functions are over-ridden by commandLine
    console.evaluated = function(result, context)
    {
        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("consoleInjector.FirebugConsoleHandler evalutated default called", result);

        Firebug.Console.log(result, context);
    };

    console.evaluateError = function(result, context)
    {
        Firebug.Console.log(result, context, "errorMessage");
    };

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

    function logFormatted(args, className, linkToSource, noThrottle)
    {
        var sourceLink = linkToSource ? getStackLink() : null;
        return Firebug.Console.logFormatted(args, context, className, noThrottle, sourceLink);
    }

    function logAssert(category, args)
    {
        Firebug.Errors.increaseCount(context);

        if (!args || !args.length || args.length == 0)
            var msg = [FBL.$STR("Assertion")];
        else
            var msg = args[0];

        if (msg.stack)
        {
            var trace = parseToStackTrace(msg.stack);
            if (FBTrace.DBG_CONSOLE)
                FBTrace.sysout("logAssert trace from msg.stack", trace);
        }
        else if (context.stackTrace)
        {
            var trace = context.stackTrace
            if (FBTrace.DBG_CONSOLE)
                FBTrace.sysout("logAssert trace from context.window.stackTrace", trace);
        }
        else
        {
            var trace = getJSDUserStack();
            if (FBTrace.DBG_CONSOLE)
                FBTrace.sysout("logAssert trace from getJSDUserStack", trace);
        }

        var url = msg.fileName ? msg.fileName : win.location.href;
        var lineNo = msg.lineNumber ? msg.lineNumber : 0;
        var errorObject = new FBL.ErrorMessage(msg, url, lineNo, "", category, context, trace);

        if (trace && trace.frames && trace.frames[0])
           errorObject.correctWithStackTrace(trace);

        errorObject.resetSource();

        if (args.length > 1)
        {
            errorObject.objects = []
            for (var i = 1; i < args.length; i++)
                errorObject.objects.push(args[i]);
        }

        var row = Firebug.Console.log(errorObject, context, "errorMessage", null, true); // noThrottle
        row.scrollIntoView();
    }

    function getComponentsStackDump()
    {
        // Starting with our stack, walk back to the user-level code
        var frame = Components.stack;
        var userURL = win.location.href.toString();

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("consoleInjector.getComponentsStackDump initial stack for userURL "+userURL, frame);

        // Drop frames until we get into user code.
        while (frame && FBL.isSystemURL(frame.filename) )
            frame = frame.caller;

        // Drop two more frames, the injected console function and firebugAppendConsole()
        if (frame)
            frame = frame.caller;
        if (frame)
            frame = frame.caller;

        if (FBTrace.DBG_CONSOLE)
            FBTrace.sysout("consoleInjector.getComponentsStackDump final stack for userURL "+userURL, frame);

        return frame;
    }

    function getStackLink()
    {
        return FBL.getFrameSourceLink(getComponentsStackDump());
    }

    function getJSDUserStack()
    {
        var trace = FBL.getCurrentStackTrace(context);

        var frames = trace ? trace.frames : null;
        if (frames && (frames.length > 0) )
        {
            var oldest = frames.length - 1;  // 6 - 1 = 5
            for (var i = 0; i < frames.length; i++)
            {
                if (frames[oldest - i].href.indexOf("chrome:") == 0)
                    break;

                // firebug-service scope reached, in some cases the url starts with file://
                if (frames[oldest - i].href.indexOf("modules/firebug-service.js") != -1)
                    break;

                // command line
                var fn = frames[oldest - i].fn + "";
                if (fn && (fn.indexOf("_firebugEvalEvent") != -1))
                    break;
            }

            // take the oldest frames, leave 2 behind they are injection code
            trace.frames = trace.frames.slice(2 - i);

            if (FBTrace.DBG_CONSOLE)
                FBTrace.sysout("consoleInjector getJSDUserStack: "+frames.length+" oldest: "+
                    oldest+" i: "+i+" i - oldest + 2: "+(i - oldest + 2), trace.toString().split('\n'));

            return trace;
        }
        else
        {
            return "Firebug failed to get stack trace with any frames";
        }
    }

    return console;
}

}});


text:
//
//  VICBaseService.h
//  BaoYangHuiTechnician
//
//  Created by 攸广欣 on 14-11-3.
//  Copyright (c) 2014年 VIC. All rights reserved.
//

/**
 *  1. Rest Api提供四个接口, restApi(默认有Hud)、restApiWithoutHud(自己管理Hud)、restApiWithID(参数中包含特殊的ID参数)、restApiWithoutHud(自己管理Hud)
 *  2. download提供两个接口,下载文件到默认文件夹(tmp/download)、下载文件夹到指定文件夹(需传入包含file_name/file_path的字典)
 *  3. upload提供两个接口,根据文件路径上传、根据NSData上传
 */

#import <Foundation/Foundation.h>
#import "MBProgressHUD.h"
#import "VICNetworkKit.h"

@interface VICBaseService : NSObject
#pragma mark - Rest Request

/**
 *  请求数据,默认有Hud
 *
 *  @param api          api地址
 *  @param dict         请求参数
 *  @param successBlock 请求成功回调
 *  @param errorBlock   请求失败回调
 */
+ (void)restApi:(NSString *)api
     parameters:(NSDictionary *)dict
        success:(SuccessBlock)successBlock
          error:(ErrorBlock)errorBlock;
/**
 *  请求数据,没有Hud
 *
 *  @param api          api地址
 *  @param dict         请求参数
 *  @param successBlock 请求成功回调
 *  @param errorBlock   请求失败回调
 */
+ (void)restApiWithOutHud:(NSString *)api
               parameters:(NSDictionary *)dict
                  success:(SuccessBlock)successBlock
                    error:(ErrorBlock)errorBlock;

+ (void)restApi:(NSString *)api
     parameters:(NSDictionary *)dict
        success:(SuccessBlock)successBlock
          error:(ErrorBlock)errorBlock
        showHud:(BOOL)showHud;
#pragma mark - download

/**
 *  下载文件到默认文件夹 tmp/download/
 *
 *  @param fileName      文件名
 *  @param successBlock  下载成功回调
 *  @param errorBlock    下载失败回调
 *  @param progressBlock 进度回调
 */
+ (void)downloadFile:(NSString *)fileName
             success:(SuccessBlock)successBlock
               error:(ErrorBlock)errorBlock
            progress:(ProgressBlock)progressBlock;

/**
 *  下载文件到指定文件夹
 *
 *  @param fileName      文件名
 *  @param filePath      文件夹位置
 *  @param successBlock  下载成功回调
 *  @param errorBlock    下载失败回调
 *  @param progressBlock 进度回调
 */
+ (void)downloadFile:(NSString *)fileName
              AtPath:(NSString *)filePath
             success:(SuccessBlock)successBlock
               error:(ErrorBlock)errorBlock
            progress:(ProgressBlock)progressBlock;

#pragma mark - upload
/**
 *  上传图片文件,提供图片文件data
 *
 *  @param imageData     文件Data
 *  @param params        其它参数
 *  @param successBlock  成功回调
 *  @param errorBlock    失败回调
 *  @param progressBlock 进度回调
 */
+ (void)uploadImageByData:(NSData *)imageData success:(SuccessBlock)successBlock error:(ErrorBlock)errorBlock progress:(ProgressBlock)progressBlock;

/**
 *  批量上传文件,提供文件路径
 *
 *  @param fullPaths     文件全路径
 *  @param params        其它参数
 *  @param successBlock  成功回调
 *  @param errorBlock    失败回调
 *  @param progressBlock 进度回调
 */
+ (void)uploadByPaths:(NSArray *)fullPaths success:(SuccessBlock)successBlock error:(ErrorBlock)errorBlock progress:(ProgressBlock)progressBlock;

/**
 *  获取文件下载的url
 *
 *  @param fileName 下载的文件名
 *
 *  @return 文件完整的url路径
 */
+ (NSString *)setupDownloadURL:(NSString *)fileName;

/**
 *  获取默认下载路径
 *
 *  @return tmp/download/
 */
+ (NSString *)defalutDownloadFilePath;

+ (MBProgressHUD *)sharedHud;
+ (UIWindow *)sharedWindow;
@end


text:
layout: post
title: Tweets
date: 2021-11-23
summary: These are the tweets for November 23, 2021.
categories:
---


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FortranCodeNavCore.Fortran.Elements;
using FortranCodeNavCore.Logging;

namespace FortranCodeNavCore
{
    public static class ScopeDescriptionHelper
    {
        public static string GetScopeDescription(IMember member)
        {
            var description = new StringBuilder();

            try
            {
                var codeFile = member.Root.CodeFile;

                var parent = member.Parent;
                var parents = new List<IMember>();
                while (parent != null)
                {
                    parents.Insert(0, parent);
                    parent = parent.Parent;
                }
                var scope = String.Join(".", parents.Select(p => p.Name).ToArray());
                description.Append(scope);
                description.Append(" (in ");
                description.Append(codeFile.FileName);
                description.Append(", ");
                description.Append(codeFile.ProjectName);
                description.Append(")");
            }
            catch (Exception e)
            {
                Log.Error(String.Format("GetScopeDescription failed for {0} in {1}", member.Name, member.Root.FileName), e);
            }

            return description.ToString();
        }
    }
}


text:
require 'spec_helper'

describe 'User::Role.to_h' do
  let(:enum) { User::Role }

  before { default_user_roles }

  let :only_value do
    {
      'ADMIN'  => 0,
      'EDITOR' => 1,
      'AUTHOR' => 2,
      'USER'   => 3
    }
  end

  let :value_and_label do
    {
      'ADMIN'  => { value: 0, label: 'Admin' },
      'EDITOR' => { value: 1, label: 'Editor' },
      'AUTHOR' => { value: 2, label: 'Author' },
      'USER'   => { value: 3, label: 'User' }
    }
  end

  let :all_keys do
    {
      'ADMIN'  => { key: :admin,  label: 'Admin',  value: 0 },
      'EDITOR' => { key: :editor, label: 'Editor', value: 1 },
      'AUTHOR' => { key: :author, label: 'Author', value: 2 },
      'USER'   => { key: :user,   label: 'User',   value: 3}
    }
  end

  context 'without options' do
    subject { enum.to_h }
    it { should eq all_keys }
  end

  context 'with option `only` as a symbol' do
    subject { enum.to_h(only: :value) }
    it { should eq only_value }
  end

  context 'with option `only` as an array' do
    context 'with no elements' do
      subject { enum.to_h(only: []) }
      it { should eq all_keys }
    end

    context 'with one element' do
      subject { enum.to_h(only: [:value]) }
      it { should eq only_value }
    end

    context 'with more than one element' do
      subject { enum.to_h(only: [:label, :value]) }
      it { should eq value_and_label }
    end

    context 'with an unknown key' do
      it 'should raise an error' do
        expect { enum.to_h(only: :foo) }.to raise_error('Unknown keys for enum')
      end
    end
  end

  context 'with option `except` as a symbol' do
    subject { enum.to_h(except: :key) }
    it { should eq value_and_label }
  end

  context 'with option `except` as an array' do
    context 'with no elements' do
      subject { enum.to_h(except: []) }
      it { should eq all_keys }
    end

    context 'with one element' do
      subject { enum.to_h(except: [:key]) }
      it { should eq value_and_label }
    end

    context 'with more than one element' do
      subject { enum.to_h(except: [:label, :key]) }
      it { should eq only_value }
    end

    context 'with an unknown key' do
      it 'should raise an error' do
        expect { enum.to_h(except: :foo) }.to raise_error('Unknown keys for enum')
      end
    end
  end
end


text:
package io.bootique.docs.programming.configuration;

public interface MyService {
}


text:
# html-to-xlsx
[![NPM Version](http://img.shields.io/npm/v/html-to-xlsx.svg?style=flat-square)](https://npmjs.com/package/html-to-xlsx)
[![License](http://img.shields.io/npm/l/html-to-xlsx.svg?style=flat-square)](http://opensource.org/licenses/MIT)
[![Build Status](https://travis-ci.org/pofider/html-to-xlsx.png?branch=master)](https://travis-ci.org/pofider/html-to-xlsx)

> **node.js html to xlsx transformation**

Transformation only supports html table and several basic style properties. No images or charts are currently supported.

## Usage

```js
const util = require('util')
const fs = require('fs')
const conversionFactory = require('html-to-xlsx')
const puppeteer = require('puppeteer')
const chromeEval = require('chrome-page-eval')({ puppeteer })
const writeFileAsync = util.promisify(fs.writeFile)

const conversion = conversionFactory({
  extract: async ({ html, ...restOptions }) => {
    const tmpHtmlPath = path.join('/path/to/temp', 'input.html')

    await writeFileAsync(tmpHtmlPath, html)

    const result = await chromeEval({
      ...restOptions,
      html: tmpHtmlPath,
      scriptFn: conversionFactory.getScriptFn()
    })

    const tables = Array.isArray(result) ? result : [result]

    return tables.map((table) => ({
      name: table.name,
      getRows: async (rowCb) => {
        table.rows.forEach((row) => {
          rowCb(row)
        })
      },
      rowsCount: table.rows.length
    }))
  }
})

async function run () {
  const stream = await conversion(`<table><tr><td>cell value</td></tr></table>`)

  stream.pipe(fs.createWriteStream('/path/to/output.xlsx'))
}

run()
```

## Supported properties
- `background-color` - cell background color
- `color` - cell foreground color
- `border-left-style` - as well as positions will be transformed into excel cells borders
- `text-align` - text horizontal align in the excel cell
- `vertical-align` - vertical align in the excel cell
- `width` - the excel column will get the highest width, it can be little bit inaccurate because of pixel to excel points conversion
- `height` - the excel row will get the highest height
- `font-size` - font size
- `colspan` - numeric value that merges current column with columns to the right
- `rowspan` - numeric value that merges current row with rows below.
- `overflow` - the excel cell will have text wrap enabled if this is set to `scroll` or `auto`.

## Constructor options

```js
const conversionFactory = require('html-to-xlsx')
const puppeteer = require('puppeteer')
const chromeEval = require('chrome-page-eval')({ puppeteer })
const conversion = conversionFactory({ /*[constructor options here]*/})
```

- `extract` **function** **[required]** - a function that receives some input (an html file path and a script) and should return some data after been evaluated the html passed. the input that the function receives is:
  ```js
  {
    html: <file path to a html file>,
    scriptFn: <string that contains a javascript function to evaluate in the html>,
    timeout: <time in ms to wait for the function to complete, the function should use this value to abort any execution when the time has passed>,
    /*options passed to `conversion` will be propagated to the input of this function too*/
  }
  ```
- `tmpDir` **string** - the directory path that the module is going to use to save temporary files needed during the conversion. defaults to [`require('os').tmpdir()`](https://nodejs.org/dist/latest-v8.x/docs/api/os.html#os_os_tmpdir)
- `timeout` **number** - time in ms to wait for the conversion to complete, when the timeout is reached the conversion is cancelled. defaults to `10000`

## Conversion options

```js
const fs = require('fs')
const conversionFactory = require('html-to-xlsx')
const puppeteer = require('puppeteer')
const chromeEval = require('chrome-page-eval')({ puppeteer })
const conversion = conversionFactory({
  extract: async ({ html, ...restOptions }) => {
    const tmpHtmlPath = path.join('/path/to/temp', 'input.html')

    await writeFileAsync(tmpHtmlPath, html)

    const result = await chromeEval({
      ...restOptions,
      html: tmpHtmlPath,
      scriptFn: conversionFactory.getScriptFn()
    })

    const tables = Array.isArray(result) ? result : [result]

    return tables.map((table) => ({
      name: table.name,
      getRows: async (rowCb) => {
        table.rows.forEach((row) => {
          rowCb(row)
        })
      },
      rowsCount: table.rows.length
    }))
  }
})

async function main () {
  const stream = await conversion(/* html */, /* extract options */)
}

main()
```

- `html` **string** - the html source that will be transformed to an xlsx, the html should contain a table element
- `extractOptions` **object** - additional options to pass to the specified `extract` function

## License
See [license](https://github.com/pofider/html-to-xlsx/blob/master/LICENSE)


text:
var WebApp = require('./app');
var http = require('http');
var monitor = require('node-monitor');

// GameClient implementation
function GameClient(travisCompile) {
	// Test compile
	this.travis = travisCompile;

	// Config
	this.config = require('../../config').server;
}

module.exports = GameClient;

GameClient.prototype.start = function() {
	WebApp.set('port', this.config.serverPort);
	WebApp.setConfigs(this);

	this.webServer = http.createServer(WebApp);
	this.webServer.listen(this.config.serverPort);
	this.webServer.on('error', onError.bind(this));
	this.webServer.on('listening', onListening.bind(this));

	monitor.Monitor(this.webServer, {
		'collect_all': 'yes'
	});

	// functions
	function onError(error) {
		if (error.syscall !== 'listen') {
			throw error;
		}

		// handle specific listen errors with friendly messages
		switch (error.code) {
			case 'EACCES':
				console.log('\u001B[31m[Client]\u001B[0m ' + this.config.webserverPort + ' requires elevated privileges');
				process.exit(1);
				break;
			case 'EADDRINUSE':
				console.log('\u001B[31m[Client]\u001B[0m ' + this.config.webserverPort + ' is already in use');
				process.exit(1);
				break;
			default:
				throw error;
		}
		return false;
	}

	function onListening() {
		if (this.travis) {
			process.exit(0);
			return false;
		}
		var addr = this.webServer.address();
		var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
		console.log('\u001B[31m[Client]\u001B[0m Game Client started at ' + bind);
		return true;
	}
};


text:
#pragma once
#include <vector>
#include <functional>
#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include "VObject.h"
#include "VInterpolate.h"

///The path setting class.
class VPath
{
private:
	std::vector<sf::Vector2f> points;
	std::vector<sf::Vector2f> tmp;
	unsigned int pathType = 0;
	VObject* object = NULL;
	sf::Vector2f lastPos;
	sf::VertexArray vertexArray;
	VInterpolate::VInterpolateType interpolationType = VInterpolate::Linear;

	bool active = false;
	bool angle = false;
	bool dirty = false;
	float t = 0.0f;
	float speed = 1.0f;
	std::function<void()> onComplete;

	sf::Vector2f getBezierPoint(float t);

public:
	/// The types of paths to use.
	enum VPathType
	{
		///Follows a straight line between each point.
		LINE,
		///Follows a curved path based on all defined points.
		CURVE,
		NUMPATHTYPES
	};

	VPath() = default;
	~VPath() = default;

	/**
	* Sets a path based on a list of points.
	* @param points The list of points to set the path. Path follows the points in order of the list.
	*/
	void SetPath(const std::vector<sf::Vector2f>& points);

	/**
	* Add a point to the end of the path.
	* @param point The point to add to the end of the path.
	*/
	void AddPoint(sf::Vector2f point);

	/**
	* Remove a point from the path.
	* @param index The element in the list of points to remove from the path, has to be within range 0 to (size-1).
	*/
	void RemovePoint(unsigned int index);

	///Ckears the entire list of points, effectively removing the path.
	void ClearPath();

	///@return The number of points currently in the path.
	int GetNumPoints();

	///@return True if the current path is being actively used by an object.
	bool IsActive();

	/**
	* Sets the type of path. See VPathType for reference.
	* @param pathType The type of path to set.
	*/
	void SetPathType(VPathType pathType);

	///@return The current path type.
	VPathType GetPathType();

	/**
	* Sets the speed of the current path, defined as 1 / time. Default value is 1, which assumes the object will complete the path in one second. 0.5 = 2 seconds. 2 = 0.5 seconds, etc.
	* @param speed The new speed of the path following.
	*/
	void SetSpeed(float speed);

	///@return The current speed of following the path.
	float GetSpeed();

	/**
	* Sets whether the object following the path should update its angle. Assumes that the object is facing right when angle is 0.
	* @param active Whether updating the angle is active or not.
	*/
	void SetUpdateAngle(bool active);

	/**
	* Sets the kind of interpolation to use for the object following the path, uses the VInterpolate class. The default is Linear.
	* @param type The type of interpolation to use.
	*/
	void SetInterpolationType(VInterpolate::VInterpolateType type);

	///@return The current type of interpolation function being used for the object following the path.
	VInterpolate::VInterpolateType GetInterpolationType();

	/**
	* Activates the path to be followed. It also resets the path to the beginning of each call.
	* @param object The game object that should follow the path. This can be NULL.
	* @param onComplete Function that calls once the object has completed travelling along the path.
	*/
	void StartFollowing(VObject* object, std::function<void()> onComplete);

	///Stops the object from following the path. Good for any sudden events.
	void StopFollowing();

	/**
	* Gets an exact point in the entire path from a single point in time.
	* @param t The position in the point as a point in time. T has to be between 0 and 1.
	*/
	sf::Vector2f GetPoint(float t);

	/**
	* Sets an exact point in the entire path from a single point in time.
	* @param index The position in the point in the points array.
	* @param point The coordinates to set.
	*/
	void SetPoint(unsigned int index, sf::Vector2f point);

	/**
	* Updates the Path following.
	* @param dt Delta Time between the previous and current frame.
	*/
	void Update(float dt);

	/**
	* Render the path (useful for debugging purposes).
	* @param RenderTarget The Render Target to render the path towards.
	*/
	void Draw(sf::RenderTarget& RenderTarget);
};


text:
<resources>

    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">@dimen/keyLine1</dimen>
    <dimen name="activity_vertical_margin">@dimen/keyLine1</dimen>

    <item name="match_parent" format="integer" type="dimen">-1</item>
    <item name="wrap_content" format="integer" type="dimen">-2</item>

    <dimen name="keyLine1">16dp</dimen>
    <dimen name="keyLine2">72dp</dimen>
    <dimen name="text_margin">16dp</dimen>

</resources>


text:
from matching import ContinuousMatch
from matching import StaticContinuousMatch
from matching import Side
from matching import Order
import cProfile

def one_sweep():
    # m = ContinuousMatch()
    m = StaticContinuousMatch(floor_price=10000, ceil_price=30000, price_step=1)
    base_price = 10000
    order_count = 20000
    for i in xrange(order_count):
        price = base_price + i
        m.push(Order(side=Side.Buy, price=price, volume=1000))
    # sweep them all
    m.push(Order(side=Side.Sell, price=base_price, volume=1000 * order_count))

def random_sweep():
    # m = ContinuousMatch()
    m = StaticContinuousMatch(floor_price=16000, ceil_price=17000, price_step=100)
    for i in range(1000):
        for p in range(16000, 17000, 100):
            m.push(Order(side=Side.Buy, price=p, volume=1000))
        for p in range(16000, 17000, 100):
            m.push(Order(side=Side.Sell, price=p, volume=1000))

m = ContinuousMatch()
for i in range(1):
    for p in range(16000, 17000, 500):
        m.push(Order(side=Side.Sell, price=p, volume=1000))

def matching_with_pending_order():
    for i in range(20000):
        m.push(Order(side=Side.Buy, price=16000, volume=1000))
        # m.push(Order(side=Side.Sell, price=16000, volume=1000))
        #

import multiprocessing as mp
def multi_process_random_sweep():
    processes = [mp.Process(target=random_sweep) for x in range(4)]
    for p in processes:
        p.start()
    for p in processes:
        p.join()

if __name__ == '__main__':
    import timeit
    timeit.timeit('multi_process_random_sweep', number=10)
    # cProfile.run('multi_process_random_sweep()', sort='tottime')
    # cProfile.run('random_sweep()', sort='tottime')
    # cProfile.run('one_sweep()', sort='tottime')
    # cProfile.run('matching_with_pending_order()')


text:
@interface ARKFileHandleAdditionsTests : XCTestCase

@property (nonatomic) NSFileHandle *fileHandle;

@property (nonatomic, copy) NSURL *fileURL;

@property (nonatomic) NSData *data_4;
@property (nonatomic) NSData *block_4;

@property (nonatomic) NSData *data_6;
@property (nonatomic) NSData *block_6;

@property (nonatomic) NSData *data_7;
@property (nonatomic) NSData *block_7;

@property (nonatomic) NSData *data_9;
@property (nonatomic) NSData *block_9;

@end

@implementation ARKFileHandleAdditionsTests

#pragma mark - Setup

- (void)setUp;
{
    [super setUp];

    if (self.fileURL == nil) {
        self.fileURL = [NSURL ARK_fileURLWithApplicationSupportFilename:@"FileHandleAdditionsTests.data"];

        // Create sample data blocks. The lengths of each block are numbers that don't occur in the contents.
        uint8_t bytes_4[] = { 1, 1, 2, 3 };
        uint8_t bytes_6[] = { 5, 8, 13, 21, 34, 55 };
        uint8_t bytes_7[] = { 53, 59, 61, 67, 71, 73, 79 };
        uint8_t bytes_9[] = { 83, 89, 101, 103, 107, 109, 113, 127, 131 };

        // The data_x objects are the input, and the dataWithLength_x objects are the expected contents of the file.
        self.data_4 = [[NSData alloc] initWithBytes:bytes_4 length:4];
        self.block_4 = [self _blockForData:self.data_4];

        self.data_6 = [[NSData alloc] initWithBytes:bytes_6 length:6];
        self.block_6 = [self _blockForData:self.data_6];

        self.data_7 = [[NSData alloc] initWithBytes:bytes_7 length:7];
        self.block_7 = [self _blockForData:self.data_7];

        self.data_9 = [[NSData alloc] initWithBytes:bytes_9 length:9];
        self.block_9 = [self _blockForData:self.data_9];
    }

    [[NSFileManager defaultManager] removeItemAtURL:self.fileURL error:NULL];
    [[NSFileManager defaultManager] createFileAtPath:self.fileURL.path contents:nil attributes:nil];

    self.fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:self.fileURL.path];
}

- (void)tearDown;
{
    [self.fileHandle closeFile];
    self.fileHandle = nil;

    [super tearDown];
}

#pragma mark - Behavior Tests

- (void)_assertFileContentsMatchDataList:(NSArray *)dataList failureMessage:(NSString *)failureMessage;
{
    NSMutableData *concatenatedData = [NSMutableData new];
    for (NSData *data in dataList) {
        [concatenatedData appendData:data];
    }

    [self.fileHandle synchronizeFile];
    NSData *fileData = [NSData dataWithContentsOfURL:self.fileURL];
    XCTAssertEqualObjects(fileData, concatenatedData, @"%@", failureMessage);
}

- (void)test_writeDataBlock;
{
    // Check that the file starts empty.
    [self _assertFileContentsMatchDataList:@[] failureMessage:@"File should start out empty."];

    // Write data to empty file.
    [self.fileHandle ARK_writeDataBlock:self.data_6];
    [self _assertFileContentsMatchDataList:@[ self.block_6 ] failureMessage:@"Failed to write block to empty file."];

    // Append data to non-empty file.
    [self.fileHandle ARK_writeDataBlock:self.data_7];
    [self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7 ] failureMessage:@"Failed to write block at end of file."];

    // Over-write data in file (note that 9+4 = 6+7 so the contents line up).
    [self.fileHandle ARK_writeDataBlock:self.data_7];
    [self.fileHandle seekToFileOffset:0];
    [self.fileHandle ARK_writeDataBlock:self.data_9];
    [self.fileHandle ARK_writeDataBlock:self.data_4];
    [self _assertFileContentsMatchDataList:@[ self.block_9, self.block_4, self.block_7 ] failureMessage:@"Failed to over-write data in file."];

    // Write empty-length data.
    [self.fileHandle ARK_writeDataBlock:[NSData data]];
    [self _assertFileContentsMatchDataList:@[ self.block_9, self.block_4, self.block_7 ] failureMessage:@"Writing empty data shouldn't change the file."];
}

- (void)test_appendDataBlock;
{
    // Check that the file starts empty.
    [self _assertFileContentsMatchDataList:@[] failureMessage:@"File should start out empty."];

    // Append to empty file.
    [self.fileHandle ARK_appendDataBlock:self.data_6];
    [self _assertFileContentsMatchDataList:@[ self.block_6 ] failureMessage:@"Failed to append block to empty file."];

    // Seek to beginning and append.
    [self.fileHandle seekToFileOffset:0];
    [self.fileHandle ARK_appendDataBlock:self.data_7];
    [self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7 ] failureMessage:@"Failed to append block after seeking to beginning of file."];

    // Seek to middle and append.
    [self.fileHandle seekToFileOffset:10];
    [self.fileHandle ARK_appendDataBlock:self.data_9];
    [self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7, self.block_9 ] failureMessage:@"Failed to append block after seeking to middle of file."];

    // Seek to end and append.
    (void)[self.fileHandle seekToEndOfFile];
    [self.fileHandle ARK_appendDataBlock:self.data_4];
    [self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7, self.block_9, self.block_4 ] failureMessage:@"Failed to append to block after seeking to end of file."];

    // Append empty data.
    [self.fileHandle ARK_appendDataBlock:[NSData data]];
    [self _assertFileContentsMatchDataList:@[ self.block_6, self.block_7, self.block_9, self.block_4 ] failureMessage:@"Appending empty data shouldn't change the file."];
}

- (void)_assert_seekToDataBlockAtIndex:(NSUInteger)index seeksToIndex:(NSUInteger)expectedIndex atFileOffset:(unsigned long long)expectedFileOffset;
{
    NSUInteger seekIndex = [self.fileHandle ARK_seekToDataBlockAtIndex:index];
    unsigned long long seekOffset = self.fileHandle.offsetInFile;

    XCTAssertEqual(seekIndex, expectedIndex, @"seekToDataBlockAtIndex:%@ didn't seek to expected index.", @(index));
    XCTAssertEqual(seekOffset, expectedFileOffset, "seekToDataBlockAtIndex:%@ didn't seek to expected file offset.", @(index));
}

- (void)test_seekToDataBlockAtIndex;
{
    XCTAssertEqual(self.fileHandle.offsetInFile, 0, @"Offset should start out at 0.");

    // Define these up front for convenience.
    unsigned long long offset0 = 0;
    unsigned long long offset1 = offset0 + self.block_4.length;
    unsigned long long offset2 = offset1 + self.block_7.length;
    unsigned long long offset3 = offset2 + self.block_6.length;

    [self _assert_seekToDataBlockAtIndex:0 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:1 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:NSUIntegerMax seeksToIndex:0 atFileOffset:offset0];

    [self.fileHandle ARK_appendDataBlock:self.data_4];

    [self _assert_seekToDataBlockAtIndex:0 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:1 seeksToIndex:1 atFileOffset:offset1];
    [self _assert_seekToDataBlockAtIndex:2 seeksToIndex:1 atFileOffset:offset1];
    [self _assert_seekToDataBlockAtIndex:NSUIntegerMax seeksToIndex:1 atFileOffset:offset1];

    [self.fileHandle ARK_appendDataBlock:self.data_7];

    [self _assert_seekToDataBlockAtIndex:0 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:1 seeksToIndex:1 atFileOffset:offset1];
    [self _assert_seekToDataBlockAtIndex:2 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:3 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:NSUIntegerMax seeksToIndex:2 atFileOffset:offset2];

    [self.fileHandle ARK_appendDataBlock:self.data_6];

    [self _assert_seekToDataBlockAtIndex:0 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:1 seeksToIndex:1 atFileOffset:offset1];
    [self _assert_seekToDataBlockAtIndex:2 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:3 seeksToIndex:3 atFileOffset:offset3];
    [self _assert_seekToDataBlockAtIndex:4 seeksToIndex:3 atFileOffset:offset3];
    [self _assert_seekToDataBlockAtIndex:NSUIntegerMax seeksToIndex:3 atFileOffset:offset3];
}

- (void)test_seekToDataBlockAtIndex_detectsCorruptedData;
{
    // Define these up front for convenience.
    unsigned long long offset0 = 0;
    unsigned long long offset1 = offset0 + self.block_7.length;
    unsigned long long offset2 = offset1 + self.block_9.length;
    unsigned long long offset3 = offset2 + self.block_4.length;

    [self.fileHandle ARK_appendDataBlock:self.data_7];
    [self.fileHandle ARK_appendDataBlock:self.data_9];
    [self.fileHandle ARK_appendDataBlock:self.data_4];

    // Truncate part of the last data block.
    [self.fileHandle truncateFileAtOffset:(offset3 - 3)];

    [self _assert_seekToDataBlockAtIndex:0 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:1 seeksToIndex:1 atFileOffset:offset1];
    [self _assert_seekToDataBlockAtIndex:2 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:3 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:4 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:NSUIntegerMax seeksToIndex:2 atFileOffset:offset2];

    // Truncate part of the last data length marker.
    [self.fileHandle ARK_seekToDataBlockAtIndex:2];
    [self.fileHandle truncateFileAtOffset:(offset2 + 2)];

    [self _assert_seekToDataBlockAtIndex:0 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:1 seeksToIndex:1 atFileOffset:offset1];
    [self _assert_seekToDataBlockAtIndex:2 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:3 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:4 seeksToIndex:2 atFileOffset:offset2];
    [self _assert_seekToDataBlockAtIndex:NSUIntegerMax seeksToIndex:2 atFileOffset:offset2];

    // Truncate everything but three bytes.
    [self.fileHandle truncateFileAtOffset:3];

    [self _assert_seekToDataBlockAtIndex:0 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:1 seeksToIndex:0 atFileOffset:offset0];
    [self _assert_seekToDataBlockAtIndex:NSUIntegerMax seeksToIndex:0 atFileOffset:offset0];
}

- (void)_assert_readDataBlock_returnsData:(NSData *)expectedData;
{
    BOOL success = NO;
    NSData *data = [self.fileHandle ARK_readDataBlock:&success];

    if (expectedData != nil) {
        XCTAssertEqualObjects(expectedData, data, @"ARK_readDataBlock didn't read expected data.");
    } else {
        XCTAssertNil(data, @"ARK_readDataBlock read unexpected data.");
    }

    XCTAssertTrue(success, @"ARK_readDataBlock didn't pass back success when expected.");
}

- (void)test_readDataBlock;
{
    // Read nil when empty.
    [self _assert_readDataBlock_returnsData:nil];

    [self.fileHandle ARK_appendDataBlock:self.data_9];

    [self.fileHandle seekToFileOffset:0];
    [self _assert_readDataBlock_returnsData:self.data_9];
    [self _assert_readDataBlock_returnsData:nil];

    [self.fileHandle ARK_appendDataBlock:self.data_4];

    [self.fileHandle seekToFileOffset:0];
    [self _assert_readDataBlock_returnsData:self.data_9];
    [self _assert_readDataBlock_returnsData:self.data_4];
    [self _assert_readDataBlock_returnsData:nil];
}

- (void)test_readDataBlock_detectsCorruptedDataOrInvalidOffset;
{
    [self.fileHandle ARK_appendDataBlock:self.data_7];
    [self.fileHandle ARK_appendDataBlock:self.data_9];
    [self.fileHandle ARK_appendDataBlock:self.data_4];

    [self.fileHandle ARK_seekToDataBlockAtIndex:2];

    // Check all the offsets within the last data block.
    unsigned long long startOffset = self.fileHandle.offsetInFile;
    for (NSUInteger blockOffset = 1; blockOffset < self.block_4.length; blockOffset++) {
        [self.fileHandle seekToFileOffset:(startOffset + blockOffset)];

        BOOL success = YES;
        NSData *data = [self.fileHandle ARK_readDataBlock:&success];

        XCTAssertNil(data, @"ARK_readDataBlock should return nil at invalid offset %@.", @(startOffset + blockOffset));
        XCTAssertFalse(success, @"ARK_readDataBlock should pass back !success at invalid offset %@.", @(startOffset + blockOffset));
    }
}

- (void)_test_truncateFileWithData:(NSData *)data toOffset:(unsigned long long)offset;
{
    NSData *expectedData = (offset > data.length) ? [NSData data] : [data subdataWithRange:NSMakeRange((NSUInteger)offset, data.length - (NSUInteger)offset)];

    // Test a variety of chunk sizes.
    NSArray *chunkSizes = @[ @(0), @(1), @(2), @(3), @(4), @(8), @(9), @(1023), @(1024), @(NSUIntegerMax) ];

    // Test several starting offsets, noting that the parameter is allowed to be past EOF but the file offsets cannot.
    NSUInteger constrainedOffset = MIN(data.length, (NSUInteger)offset);
    NSArray *startOffsets = @[ @(0), @(constrainedOffset / 2), @(constrainedOffset), @(constrainedOffset + (data.length - constrainedOffset) / 2), @(data.length) ];
    NSMutableArray *expectedOffsets = [NSMutableArray new];
    for (NSNumber *startOffset in startOffsets) {
        if (constrainedOffset >= startOffset.integerValue) {
            [expectedOffsets addObject:@(0)];
        } else {
            [expectedOffsets addObject:@(startOffset.integerValue - constrainedOffset)];
        }
    }

    for (NSNumber *chunkSize in chunkSizes) {
        for (NSUInteger offsetIndex = 0; offsetIndex < startOffsets.count; offsetIndex++) {
            unsigned long long startOffset = [(NSNumber *)startOffsets[offsetIndex] unsignedLongLongValue];
            unsigned long long expectedOffset = [(NSNumber *)expectedOffsets[offsetIndex] unsignedLongLongValue];

            // Restore the contents.
            [self.fileHandle truncateFileAtOffset:0];
            [self.fileHandle writeData:data];

            // Seek, truncate and check results.
            [self.fileHandle seekToFileOffset:startOffset];
            [self.fileHandle ARK_truncateFileToOffset:offset maximumChunkSize:chunkSize.unsignedIntegerValue];

            unsigned long long resultOffset = self.fileHandle.offsetInFile;
            [self.fileHandle synchronizeFile];
            NSData *resultData = [NSData dataWithContentsOfURL:self.fileURL];

            XCTAssert([resultData isEqualToData:expectedData], @"Truncate data of length %@ to offset %@ with chunk size %@ didn't produce expected result.", @(data.length), @(offset), chunkSize);
            XCTAssert(resultOffset == expectedOffset, @"Truncate data of length %@ to offset %@ with start offset %@ didn't result in expected offset %@.", @(data.length), @(offset), @(startOffset), @(expectedOffset));
        }
    }
}

- (void)test_truncateFileToOffset;
{
    // Test empty data.
    [self _test_truncateFileWithData:[NSData data] toOffset:0];
    [self _test_truncateFileWithData:[NSData data] toOffset:1];

    // Test single-byte data.
    uint8_t oneByte = 120;
    NSData *singleByteData = [[NSData alloc] initWithBytes:&oneByte length:1];
    [self _test_truncateFileWithData:singleByteData toOffset:0];
    [self _test_truncateFileWithData:singleByteData toOffset:1];
    [self _test_truncateFileWithData:singleByteData toOffset:2];

    // Test longer data.
    NSMutableData *sampleData = [NSMutableData new];
    [sampleData appendData:self.block_6];
    [sampleData appendData:self.block_7];

    [self _test_truncateFileWithData:sampleData toOffset:0];
    [self _test_truncateFileWithData:sampleData toOffset:1];
    [self _test_truncateFileWithData:sampleData toOffset:10];
    [self _test_truncateFileWithData:sampleData toOffset:(sampleData.length - 1)];
    [self _test_truncateFileWithData:sampleData toOffset:sampleData.length];
    [self _test_truncateFileWithData:sampleData toOffset:(sampleData.length + 1)];
}

#pragma mark - Private Methods

- (NSData *)_blockForData:(NSData *)data;
{
    NSAssert1(data.length > 0 && data.length <= UINT8_MAX, @"Not set up to create data block of size %@", @(data.length));

    uint8_t lengthBytes[] = { 0, 0, 0, data.length };
    NSMutableData *block = [NSMutableData dataWithBytes:lengthBytes length:4];

    [block appendData:data];

    return block;
}

@end


text:
Cypress.on('uncaught:exception', (err, runnable) => {
    // returning false here prevents Cypress from
    // failing the test
    return false
})

describe('Create trek', () => {
  beforeEach(() => {
    const username = 'admin';
    const password = 'admin';
    cy.setCookie('django_language', 'en');
    cy.loginByCSRF(username, password)
    .then((resp) => {
       expect(resp.status).to.eq(200)
    })
  })

  it('Create trek', () => {
    cy.visit('/trek/list')
    cy.server()
    cy.route('/api/graph.json').as('graph')
    cy.get("a.btn-success[href='/trek/add/']").contains('Add a new trek').click()
    cy.wait('@graph')
    cy.get("a.linetopology-control").click()
    cy.get("textarea[id='id_topology']").type('[{"pk": 2, "kind": "TREK", "offset": 0.0, "paths": [3], "positions": {"0": [0.674882030756843, 0.110030805790642]}}]', {force: true, parseSpecialCharSequences: false})
    cy.get("input[id='id_duration']").type('100')
    cy.get("input[name='name_en']").type('Trek number 1')
    cy.get("a[href='#name_fr']").click()
    cy.get("input[name='name_fr']").type('Randonnée numéro 1')
    cy.get("input[id='id_review']").click({force: true})
    cy.get("input[id='id_departure_en']").type('Departure')
    cy.get("a[href='#departure_fr']").click()
    cy.get("input[id='id_departure_fr']").type('Départ')
    cy.get("input[id='id_arrival_en']").type('Arrival')
    cy.get("a[href='#arrival_fr']").click()
    cy.get("input[id='id_arrival_fr']").type('Arrivée')
    cy.get("input[id='id_duration']").type('100')
    cy.get("select[id='id_practice']").select("Cycling")
    cy.get("select[id='id_difficulty']").select("Very hard")
    cy.get("select[id='id_route']").select("Loop")
    cy.setTinyMceContent('id_access_en', 'Access number 1');
    cy.setTinyMceContent('id_description_teaser_en', 'Description teaser number 1')
    cy.setTinyMceContent('id_ambiance_en', 'Ambiance number 1')
    cy.setTinyMceContent('id_description_en', 'Description number 1')
    cy.get('#save_changes').click()
    cy.url().should('not.include', '/trek/add/')
    cy.get('.content').should('contain', 'Trek number 1')
  })
  it('List trek waiting for publication', () => {
    cy.visit('/trek/list')
    cy.get("a[title='Trek number 1']").should('have.length', 1)
    cy.get("span.badge-warning[title='Waiting for publication']").should('have.length', 1)
  })
  it('Change trek waiting for publication', () => {
    cy.visit('/trek/list')
    cy.get("a[title='Trek number 1']").should('have.attr', 'href')
      .then((href) => {
        cy.visit(href)
    })
    cy.get("div.alert-warning").contains("Waiting for publication").should('have.length', 1)
    cy.get("a.btn-primary").contains("Update").click()
    cy.get("input[id='id_review']").check()
    cy.get("input[name='published_en']").click({force: true})
    cy.get("input[id='id_published_en']").check()
    cy.get('#save_changes').click()
  })
})


text:
using System;
using System.Collections.Generic;

// ReSharper disable CheckNamespace
namespace Simple.OData.ProductService.Models
// ReSharper restore CheckNamespace
{
    public class WorkTaskModel : BaseModel
    {
        public WorkTaskModel()
        {
            Attachments = new List<WorkTaskAttachmentModel>();
            WorkActivityReports = new List<WorkActivityReportModel>();
        }

        public string Code { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public Guid State { get; set; }
        public GeoLocationModel Location { get; set; }
        public Guid WorkerId { get; set; }
        public Guid CustomerId { get; set; }
        public List<WorkTaskAttachmentModel> Attachments { get; set; }
        public List<WorkActivityReportModel> WorkActivityReports { get; set; }

    }
}


text:
function w = Water()
% WATER  Return an object representing water.
% w = Water()
% The object returned by this method implements an accurate equation of
% state for water that can be used in the liquid, vapor, saturated
% liquid/vapor, and supercritical regions of the phase diagram. The
% equation of state is taken from
%
% Reynolds, W. C. *Thermodynamic Properties in SI: graphs, tables, and
% computational equations for forty substances.* Stanford: Stanford
% University, 1979. Print.
%
% For more details, see classes Cantera::PureFluid and tpx::water in the
% Cantera C++ source code documentation.
%
% :return:
%     Instance of class :mat:func:`Solution`
%

w = Solution('liquidvapor.xml', 'water');


text:
using System;
using System.Collections.Generic;
using System.Text;
using wojilu.Web.Mvc.Interface;
using wojilu.Web.Mvc;
using wojilu.Web.Context;
using wojilu.Web.Controller.Common.Admin;
using wojilu.Members.Sites.Domain;
using wojilu.Web.Controller.Admin;
using wojilu.Web.Controller.Admin.Sys;
using wojilu.Members.Interface;
using wojilu.Caching;
using wojilu.Web.Mvc.Utils;

namespace wojilu.Web.Controller.Common.Caching {

    public class ControllerInterceptor : IMvcFilter {

        public void Process( MvcEventPublisher publisher ) {

            publisher.End_ProcessAction += new EventHandler<MvcEventArgs>( publisher_End_ProcessAction );

        }

        void publisher_End_ProcessAction( object sender, MvcEventArgs e ) {

            MvcContext ctx = e.ctx;
            if (ctx.HttpMethod.Equals( "GET" )) return;

            if (!(ctx.owner.obj is Site)) return;

            List<ICacheFilter> dbs = CacheFilterDB.Instance.Renews;
            foreach (ICacheFilter cr in dbs) {

                if (actionSame( cr, ctx )) {
                    cr.Update( ctx );
                    break;
                }

            }

        }

        private bool actionSame( ICacheFilter cr, MvcContext ctx ) {

            Dictionary<String, String> actions = cr.Actions;

            foreach (KeyValuePair<String, String> kv in actions) {

                if (ctx.controller.GetType().FullName.Equals( kv.Key ) == false &&
                    ctx.controller.GetType().BaseType.FullName.Equals( kv.Key ) == false
                    ) continue;

                if (actionSame( kv.Value, ctx )) return true;
            }

            return false;
        }

        private bool actionSame( String strActions, MvcContext ctx ) {
            String[] arrActions = strActions.Split( '/' );
            foreach (String action in arrActions) {
                if (action.Equals( ctx.route.action )) return true;
            }
            return false;
        }

    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Special Publication College of Agriculture, National Taiwan University 8: 60 (1959)

#### Original name
Montagnellina rubi Sawada

### Remarks
null


text:
<?php

declare(strict_types=1);

namespace Kadet\Highlighter\Language\Css;

use Kadet\Highlighter\Matcher\RegexMatcher;
use Kadet\Highlighter\Parser\Rule;
use Kadet\Highlighter\Parser\Token\MetaToken;
use Kadet\Highlighter\Parser\Token\Token;
use Kadet\Highlighter\Parser\TokenFactory;
use Kadet\Highlighter\Parser\Validator\Validator;

class Sass extends Scss
{

    /**
     * Tokenization rules
     */
    public function setupRules()
    {
        parent::setupRules();

        $this->rules->remove('meta.declaration');
        $this->rules->remove('meta.declaration.media');

        $this->rules->add('meta.selector', new Rule(new RegexMatcher('/(?=(?:\n+|^)(\h*)([^\h].*)\n+\1\h+)/', [
            2 => Token::NAME
        ]), [
            'context'  => Validator::everywhere(),
            'priority' => 3,
            'factory'  => new TokenFactory(MetaToken::class)
        ]));

        $this->rules->add('meta.declaration', new Rule(new RegexMatcher('/\n((?:\h+.*?(?>\n|$)+)+)/'), [
            'context'  => Validator::everywhere(),
            'priority' => 2,
            'factory'  => new TokenFactory(MetaToken::class)
        ]));

        $this->rules->add('meta.declaration.media', new Rule(new RegexMatcher('/@media(.*?)\n/'), [
            'context' => Validator::everywhere(),
            'factory' => new TokenFactory(MetaToken::class)
        ]));

        $this->rules->add('symbol.selector.tag', new Rule(new RegexMatcher('/\b([a-z-][\w-]*)/'), [
            'context' => ['meta.selector', '!symbol', '!meta.declaration.media'],
        ]));

        $this->rules->rule('symbol.selector.class')->setContext(['meta.selector']);
        $this->rules->rule('keyword.at-rule')->setContext(['meta.selector']);
        $this->rules->rule('symbol.selector.class.pseudo')->setContext(['meta.selector']);
        $this->rules->rule('symbol.selector.id')->setContext(['meta.selector']);
    }

    public function getIdentifier()
    {
        return 'sass';
    }

    public static function getMetadata()
    {
        return [
            'name'      => ['sass'],
            'mime'      => ['text/x-sass'],
            'extension' => ['*.sass']
        ];
    }
}