text:
package fuse.android.graphics;

import android.util.Xml;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

/**
 * Parser for font config files.
 *
 * @hide
 */
public class FontListParser {

    public static class Config {
        Config() {
            this(-1, new ArrayList<Family>(), new ArrayList<Alias>());
        }
        Config(int version, List<Family> families, List<Alias> aliases) {
            this.version = version;
            this.families = families;
            this.aliases = aliases;
        }
        public final int version;
        public final List<Family> families;
        public final List<Alias> aliases;

        public void append(Config other) {
            this.families.addAll(other.families);
            this.aliases.addAll(other.aliases);
        }

        public void mixin(Config other) {
            int lastOrder = -1;
            for (Family family : other.families) {
                int order = family.order;
                if (order >= 0) {
                    this.families.add(order, family);
                    lastOrder = order + 1;
                } else {
                    if (lastOrder >= 0) {
                        this.families.add(lastOrder, family);
                        ++lastOrder;
                    } else {
                        this.families.add(family);
                    }
                }
            }
            this.aliases.addAll(other.aliases);
        }
    }

    public static class Font {
        Font(String fontName, int ttcIndex, int weight, boolean isItalic) {
            this.fontName = fontName;
            this.ttcIndex = ttcIndex;
            this.weight = weight;
            this.isItalic = isItalic;
        }
        public final String fontName;
        public final int ttcIndex;
        public final int weight;
        public final boolean isItalic;
    }

    public static class Alias {
        Alias(String name, String toName, int weight) {
            this.name = name;
            this.toName = toName;
            this.weight = weight;
        }

        public final String name;
        public final String toName;
        public final int weight;
    }

    public static class Family {
        public Family(List<String> names, List<Font> fonts, String lang, String variant) {
            this(names, fonts, lang, variant, -1);
        }

        public Family(List<String> names, List<Font> fonts, String lang, String variant, int order) {
            this.names = names;
            this.fonts = fonts;
            this.lang = lang;
            this.variant = variant;
            this.order = order;
        }

        public final List<String> names;
        public final List<Font> fonts;
        public final String lang;
        public final String variant;
        public final int order;
    }

    public static final int NormalWeight = 400;
    public static final int BoldWeight = 700;

    // Dispatches between new and old format
    public static Config getFontConfig()
            throws FileNotFoundException, XmlPullParserException, IOException {
        File newXmlFile = new File("/system/etc/fonts.xml");
        File oldXmlFile = new File("/system/etc/system_fonts.xml");
        File oldFallbackXmlFile = new File("/system/etc/fallback_fonts.xml");
        File oldVendorXmlFile = new File("/vendor/etc/fallback_fonts.xml");

        Config result = new Config();
        if (newXmlFile.exists()) {
            try {
                result = parse(new FileInputStream(newXmlFile.getAbsolutePath()));
            } catch (XmlPullParserException e) {
                // Fall through
            }

            // Version 21 and up doesn't need fallback config
            if (result.version >= 21) {
                return result;
            }
        } else if (oldXmlFile.exists()) {
            result.append(parseOld(new FileInputStream(oldXmlFile.getAbsolutePath())));
        } else {
            throw new FileNotFoundException("No Android font configuration file found");
        }

        Config fallback = new Config();

        if (oldFallbackXmlFile.exists()) {
            fallback.append(parseOld(new FileInputStream(oldFallbackXmlFile.getAbsolutePath())));

            if (oldVendorXmlFile.exists()) {
                fallback.mixin(parseOld(new FileInputStream(oldVendorXmlFile.getAbsolutePath())));
            }
        }

        result.append(fallback);
        return result;
    }

    // ------------------------------------------------------------------------
    // New format (/system/etc/fonts.xml)

    /* Parse fallback list (no names) */
    public static Config parse(InputStream in) throws XmlPullParserException, IOException {
        try {
            XmlPullParser parser = Xml.newPullParser();
            parser.setInput(in, null);
            parser.nextTag();
            return readFamilies(parser);
        } finally {
            in.close();
        }
    }

    private static Config readFamilies(XmlPullParser parser)
            throws XmlPullParserException, IOException {
        parser.require(XmlPullParser.START_TAG, null, "familyset");
        String versionString = parser.getAttributeValue(null, "version");
        int version = versionString == null ? -1 : Integer.parseInt(versionString);
        List<Family> families = new ArrayList<Family>();
        List<Alias> aliases = new ArrayList<Alias>();
        while (parser.next() != XmlPullParser.END_TAG) {
            if (parser.getEventType() != XmlPullParser.START_TAG) continue;
            if (parser.getName().equals("family")) {
                families.add(readFamily(parser));
            } else if (parser.getName().equals("alias")) {
                aliases.add(readAlias(parser));
            } else {
                skip(parser);
            }
        }
        return new Config(version, families, aliases);
    }

    private static Family readFamily(XmlPullParser parser)
            throws XmlPullParserException, IOException {
        String name = parser.getAttributeValue(null, "name");
        String lang = parser.getAttributeValue(null, "lang");
        String variant = parser.getAttributeValue(null, "variant");
        List<Font> fonts = new ArrayList<Font>();
        while (parser.next() != XmlPullParser.END_TAG) {
            if (parser.getEventType() != XmlPullParser.START_TAG) continue;
            if (parser.getName().equals("font")) {
                String indexStr = parser.getAttributeValue(null, "index");
                int index = indexStr == null ? 0 : Integer.parseInt(indexStr);
                String weightStr = parser.getAttributeValue(null, "weight");
                int weight = weightStr == null ? NormalWeight : Integer.parseInt(weightStr);
                boolean isItalic = "italic".equals(parser.getAttributeValue(null, "style"));
                String fileName = parser.nextText();
                fonts.add(new Font(absoluteFontPath(fileName), index, weight, isItalic));
            } else {
                skip(parser);
            }
        }
        List<String> names = new ArrayList<String>();
        if (name != null)
            names.add(name);
        return new Family(names, fonts, lang, variant);
    }

    private static Alias readAlias(XmlPullParser parser)
            throws XmlPullParserException, IOException {
        String name = parser.getAttributeValue(null, "name");
        String toName = parser.getAttributeValue(null, "to");
        String weightStr = parser.getAttributeValue(null, "weight");
        int weight = weightStr == null ? NormalWeight : Integer.parseInt(weightStr);
        skip(parser);  // alias tag is empty, ignore any contents and consume end tag
        return new Alias(name, toName, weight);
    }

    // ------------------------------------------------------------------------
    // Old (Jellybean and earlier) format (/system/etc/{system_fonts.xml,fallback_fonts.xml}, etc)

    public static Config parseOld(InputStream in) throws XmlPullParserException, IOException {
        try {
            XmlPullParser parser = Xml.newPullParser();
            parser.setInput(in, null);
            parser.nextTag();
            return readOldFamilies(parser);
        } finally {
            in.close();
        }
    }

    private static Config readOldFamilies(XmlPullParser parser)
            throws XmlPullParserException, IOException {
        parser.require(XmlPullParser.START_TAG, null, "familyset");
        String versionString = parser.getAttributeValue(null, "version");
        int version = versionString == null ? -1 : Integer.parseInt(versionString);
        List<Family> families = new ArrayList<Family>();
        while (parser.next() != XmlPullParser.END_TAG) {
            if (parser.getEventType() != XmlPullParser.START_TAG) continue;
            if (parser.getName().equals("family")) {
                families.add(readOldFamily(parser));
            } else {
                skip(parser);
            }
        }
        return new Config(version, families, new ArrayList<Alias>());
    }

    private static Family readOldFamily(XmlPullParser parser)
            throws XmlPullParserException, IOException {
        List<String> names = new ArrayList<String>();
        List<String> files = new ArrayList<String>();
        String orderString = parser.getAttributeValue(null, "order");
        int order = orderString == null ? -1 : Integer.parseInt(orderString);

        while (parser.next() != XmlPullParser.END_TAG) {
            if (parser.getEventType() != XmlPullParser.START_TAG) continue;
            if (parser.getName().equals("nameset")) {
                readNameSet(parser, names);
            }
            else if (parser.getName().equals("fileset")) {
                readFileSet(parser, files);
            } else {
                skip(parser);
            }
        }

        List<Font> fonts = createOldFontList(files);
        return new Family(names, fonts, null, null, order);
    }

    private static List<Font> createOldFontList(List<String> files)
    {
        List<Font> result = new ArrayList<Font>();
        int len = Math.min(files.size(), 4);
        for (int i = 0; i < len; ++i) {
            // The fonts are listed in order: regular, bold, italic, bold-italic
            int weight = i % 2 == 0 ? NormalWeight : BoldWeight;
            boolean isItalic = i >= 2;
            result.add(new Font(files.get(i), 0, weight, isItalic));
        }
        return result;
    }

    private static void readNameSet(XmlPullParser parser, List<String> names)
            throws XmlPullParserException, IOException {
        while (parser.next() != XmlPullParser.END_TAG) {
            if (parser.getEventType() != XmlPullParser.START_TAG) continue;
            if (parser.getName().equals("name")) {
                String name = parser.nextText();
                names.add(name);
            } else {
                skip(parser);
            }
        }
    }

    private static void readFileSet(XmlPullParser parser, List<String> files)
            throws XmlPullParserException, IOException {
        while (parser.next() != XmlPullParser.END_TAG) {
            if (parser.getEventType() != XmlPullParser.START_TAG) continue;
            if (parser.getName().equals("file")) {
                String file = parser.nextText();
                files.add(absoluteFontPath(file));
            } else {
                skip(parser);
            }
        }
    }

    // ------------------------------------------------------------------------
    // Helpers

    private static void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
        int depth = 1;
        while (depth > 0) {
            switch (parser.next()) {
            case XmlPullParser.START_TAG:
                depth++;
                break;
            case XmlPullParser.END_TAG:
                depth--;
                break;
            }
        }
    }

    private static String absoluteFontPath(String relative) {
            return "/system/fonts/" + relative;
    }
}

redpajama_set_name: RedPajamaGithub


text:
    <title>{% block title %}Boston Green - Find Your Space!{% endblock %}</title>

    <meta content="width=device-width,minimum-scale=1,maximum-scale=1" name="viewport">
    <meta name="description" content="{% block meta_description %}{% endblock %}" >
    <meta name="keywords" content="{% block meta_keywords %}{% endblock %} " >

    <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic|Carter+One" rel="stylesheet" type="text/css">

    <link rel="stylesheet" href="{{ STATIC_URL }}libs/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="{{ STATIC_URL }}libs/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="{{ STATIC_URL }}libs/chosen/chosen.css" />

    <link rel="stylesheet" href="{{ STATIC_URL }}libs/leaflet/leaflet.css" />

    <link rel="stylesheet" href="{{ STATIC_URL }}css/style.css">

    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ STATIC_URL }}ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="{{ STATIC_URL }}ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="{{ STATIC_URL }}ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="{{ STATIC_URL }}ico/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="{{ STATIC_URL }}ico/favicon.png">

              Boston Green

                    <select data-placeholder="Select Your Neighborhood" class="parkfilter chzn-select" id="neighborhoods">
                      <option value=""></option>
                      <option value="">All Neighborhoods</option>
                      {% for n in neighborhoods %}
                        <option value="{{ n.pk }}">{{ n.name }}</option>
                      {% endfor %}
                    </select>

                    <select data-placeholder="Select Your Activity" class="parkfilter chzn-select" id="facility__activity">
                      <option value=""></option>
                      <option value="">All Activities</option>
                      {% for a in activities %}
                        <option value="{{ a.pk }}">{{ a.name }}</option>
                      {% endfor %}
                    </select>

                    <input type="text" class="search-query" name="parkname" id="parkname" placeholder="Type a Park Name">

    {% block javascript %}

    {% verbatim %}

    {% endverbatim %}

    {% endblock %}

    {% block footerscripts %}{% endblock %}

    {% if ga_tracking_id %}

    {% endif %}

    {% if uservoice_forum_id %}

    {% endif %}


text:
<?php

namespace Sulfur\Node\Queries;

class HasChild extends \Twig_Node
{
    public function __construct($name, \Twig_Node_Expression $value, $lineno, $tag = null)
    {
        parent::__construct(array('value' => $value), array('name' => $name), $lineno, $tag);
    }

    public function compile(\Twig_Compiler $compiler)
    {
        $compiler
            ->addDebugInfo($this)
            ->write('$context[\''.$this->getAttribute('name').'\'] = ')
            ->subcompile($this->getNode('value'))
            ->raw(";\n")
        ;
    }
}


text:
/*
 * Port pin interrupt stuff
 * PD5 - PCINT21 - Pin change interrupt 21 - Using PCINT2
 * PD4 - PCINT20 - Pin change interrupt 20 - Using PCINT2
 * PD3 - PCINT19 - Pin change interrupt 19 - Using INT1
 * PC5 - PCINT13 - Pin change interrupt 13 - Using PCINT1
*/

/*
 * Pin definitions
 * AC Input 1 - PD4 - Arduino pin D4
 * AC Input 2 - PD3 - Arduino pin D3
 * AC Input 3 - PC5 - Arduino pin A5
 * AC voltage detect input - PD5/OC0B/T1 - Arduino pin D5
 */

#include "acInput.h"
#include <Arduino.h>
#include <avr/io.h>
#include <avr/interrupt.h>

#define AC_POWER_PIN (PIND & (1<<PD5))
#define AC_INPUT_1_PIN (PIND & (1<<PD4))

static volatile uint8_t acPowerPinLastValue = AC_POWER_PIN;
static volatile uint8_t acInput1PinLastValue = AC_INPUT_1_PIN;

static uint32_t oldTime = 0;
static bool powerButtonState = false;
static bool sailSwitchState = false;
static bool tcoState = false;
static bool acPowerPinState = false;
static volatile uint32_t powerButtonCount = 0;
static volatile uint32_t sailSwitchCount = 0;
static volatile uint32_t tcoCount = 0;
static volatile uint32_t acPowerPinCount = 0;

static void pciSetup(byte pin)
{
  *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin));  // enable pin
  PCIFR  |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
  PCICR  |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group
}

ISR (PCINT2_vect)
{
  if(acInput1PinLastValue != AC_INPUT_1_PIN)
  {
    powerButtonCount++;
    acInput1PinLastValue = AC_INPUT_1_PIN;
  }
  if(acPowerPinLastValue != AC_POWER_PIN)
  {
    acPowerPinCount++;
    acPowerPinLastValue = AC_POWER_PIN;
  }
}

ISR (PCINT1_vect)
{
  tcoCount++;
}

void myINT1_vect(void)
{
  sailSwitchCount++;
}

void acInputsInit(void)
{
  pinMode(A5, INPUT);
  // Arduino pin 4 is tied to 328P port pin PD4, use the pin change interrupt for input
  pciSetup(4);
  pinMode(5, INPUT);
  pciSetup(5);
  // Arduino pin 3 is tied to 328P port pin PD3, use the INT1 interrupt for input
  attachInterrupt(digitalPinToInterrupt(3), myINT1_vect, CHANGE);
  // Arduino pin A5 is tied to 328P port pin PC5, use the pin change interrupt for input
  pciSetup(A5);
}

void acInputsRun(void)
{
  uint32_t newTime = millis();
  static uint32_t oldAcTime = 0;

  if ((newTime - oldAcTime) >= 60)
  {
    oldAcTime = newTime;
    noInterrupts();
    acPowerPinState = acPowerPinCount > 4;
    acPowerPinCount = 0;
    interrupts();
  }

  if ((newTime - oldTime) >= 120)
  {
    oldTime = newTime;
    oldAcTime = newTime;
    noInterrupts();
    powerButtonState = (powerButtonCount > 5) && acPowerPinState;
    sailSwitchState = (sailSwitchCount > 5) && acPowerPinState;
    tcoState = (tcoCount > 5) && acPowerPinState;
    powerButtonCount = 0;
    sailSwitchCount = 0;
    tcoCount = 0;
    interrupts();
  }
}

bool powerButtonIsOn(void)
{
  return powerButtonState;
}

bool sailSwitchIsOn(void)
{
  return sailSwitchState;
}

bool tcoInputIsOn(void)
{
  return tcoState;
}

bool acPowerIsPresent(void)
{
  return acPowerPinState;
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using FileHelpers.Helpers;
using FileHelpers.Options;

namespace FileHelpers
{
    /// <summary>
    /// Base class for all Field Types.
    /// Implements all the basic functionality of a field in a typed file.
    /// </summary>
    public abstract class FieldBase
    {
        #region "  Private & Internal Fields  "

        // --------------------------------------------------------------
        // WARNING !!!
        //    Remember to add each of these fields to the clone method !!
        // --------------------------------------------------------------

        /// <summary>
        /// type of object to be created,  eg DateTime
        /// </summary>
        public Type FieldType { get; private set; }

        /// <summary>
        /// Provider to convert to and from text
        /// </summary>
        public ConverterBase Converter { get; private set; }

        /// <summary>
        /// Number of extra characters used,  delimiters and quote characters
        /// </summary>
        internal virtual int CharsToDiscard => 0;

        /// <summary>
        /// Field type of an array or it is just fieldType.
        /// What actual object will be created
        /// </summary>
        internal Type FieldTypeInternal { get; private set; }

        /// <summary>
        /// Is this field an array?
        /// </summary>
        public bool IsArray { get; private set; }

        /// <summary>
        /// Array must have this many entries
        /// </summary>
        public int ArrayMinLength { get; set; }

        /// <summary>
        /// Array may have this many entries,  if equal to ArrayMinLength then
        /// it is a fixed length array
        /// </summary>
        public int ArrayMaxLength { get; set; }

        /// <summary>
        /// Seems to be duplicate of FieldTypeInternal except it is ONLY set
        /// for an array
        /// </summary>
        private Type ArrayType { get; set; }

        /// <summary>
        /// Do we process this field but not store the value
        /// </summary>
        public bool Discarded { get; set; }

        /// <summary>
        /// Value to use if input is null or empty
        /// </summary>
        internal object NullValue { get; private set; }

        /// <summary>
        /// Are we a simple string field we can just assign to
        /// </summary>
        private bool IsStringField { get; set; }

        /// <summary>
        /// Details about the extraction criteria
        /// </summary>
        internal FieldInfo FieldInfo { get; private set; }

        /// <summary>
        /// indicates whether we trim leading and/or trailing whitespace
        /// </summary>
        public TrimMode TrimMode { get; set; }

        /// <summary>
        /// Character to chop off front and / rear of the string
        /// </summary>
        internal char[] TrimChars { get; set; }

        /// <summary>
        /// The field may not be present on the input data (line not long enough)
        /// </summary>
        public bool IsOptional
        {
            get; set;
        }

        /// <summary>
        /// The next field along is optional,  optimise processing next records
        /// </summary>
        internal bool NextIsOptional
        {
            get
            {
                if (Parent.FieldCount > ParentIndex + 1)
                    return Parent.Fields[ParentIndex + 1].IsOptional;
                return false;
            }
        }

        /// <summary>
        /// Am I the first field in an array list
        /// </summary>
        internal bool IsFirst => ParentIndex == 0;

        /// <summary>
        /// Am I the last field in the array list
        /// </summary>
        internal bool IsLast => ParentIndex == Parent.FieldCount - 1;

        /// <summary>
        /// Set from the FieldInNewLIneAtribute.  This field begins on a new
        /// line of the file
        /// </summary>
        internal bool InNewLine { get; private set; }

        /// <summary>
        /// Order of the field in the file layout
        /// </summary>
        internal int? FieldOrder { get; private set; }

        /// <summary>
        /// Can null be assigned to this value type, for example not int or
        /// DateTime
        /// </summary>
        internal bool IsNullableType { get; private set; }

        /// <summary>
        /// Name of the field without extra characters (eg property)
        /// </summary>
        internal string FieldFriendlyName { get; private set; }

        /// <summary>
        /// The field must be not be empty
        /// </summary>
        public bool IsNotEmpty { get; set; }

        /// <summary>
        /// Do not include the field value to the output
        /// </summary>
        public bool IsNotIncluded { get; set; }

        /// <summary>
        /// Caption of the field displayed in header row (see EngineBase.GetFileHeader)
        /// </summary>
        internal string FieldCaption { get; private set; }

        // --------------------------------------------------------------
        // WARNING !!!
        //    Remember to add each of these fields to the clone method !!
        // --------------------------------------------------------------

        /// <summary>
        /// Fieldname of the field we are storing
        /// </summary>
        internal string FieldName => FieldInfo.Name;

        #endregion

        #region "  CreateField  "

        /// <summary>
        /// Check the Attributes on the field and return a structure containing
        /// the settings for this file.
        /// </summary>
        /// <param name="fi">Information about this field</param>
        /// <param name="recordAttribute">Type of record we are reading</param>
        /// <returns>Null if not used</returns>
        public static FieldBase CreateField(FieldInfo fi, TypedRecordAttribute recordAttribute)
        {
            FieldBase res = null;
            MemberInfo mi = fi;
            //bool isField = true;
            var memberName = /*"The field: '" + */fi.Name;
            Type fieldType = fi.FieldType;
            string fieldFriendlyName = AutoPropertyName(fi);
            if (string.IsNullOrEmpty(fieldFriendlyName)==false)
            {
                var prop = fi.DeclaringType.GetProperty(fieldFriendlyName);
                if (prop != null)
                {
                    //isField = false;
                    memberName = /*"The property: '" + */prop.Name;
                    mi = prop;
                }
                else
                {
                    fieldFriendlyName = null;
                }
            }
            // If ignored, return null
#pragma warning disable 612,618 // disable obsolete warning
            if (mi.IsDefined(typeof (FieldNotInFileAttribute), true) ||
                mi.IsDefined(typeof (FieldIgnoredAttribute), true) ||
                mi.IsDefined(typeof (FieldHiddenAttribute), true))
#pragma warning restore 612,618
                return null;

            var attributes = (FieldAttribute[]) mi.GetCustomAttributes(typeof (FieldAttribute), true);

            // CHECK USAGE ERRORS !!!

            // Fixed length record and no attributes at all
            if (recordAttribute is FixedLengthRecordAttribute &&
                attributes.Length == 0)
            {
                //?NoFieldFixedLengthAttr"The field or property '{0}' must be marked the FieldFixedLength attribute because the record class is marked with FixedLengthRecord."
                throw new BadUsageException("FileHelperMsg_NoFieldFixedLengthAttr", new List<string>() { memberName });
            }

            if (attributes.Length > 1)
            {
                //?FieldFixedLengthAttrConflict"The field or property '{0}' has a FieldFixedLength and a FieldDelimiter attribute."
                throw new BadUsageException("FileHelperMsg_FieldFixedLengthAttrConflict", new List<string>() { memberName });
            }

            if (recordAttribute is DelimitedRecordAttribute &&
                mi.IsDefined(typeof (FieldAlignAttribute), false))
            {
                //?FieldAlignAttrIsWrong"The field or property '{0}' can't be marked with FieldAlign attribute, it is only valid for fixed length records and are used only for write purpose."
                throw new BadUsageException("FileHelperMsg_FieldAlignAttrIsWrong", new List<string>() { memberName });
            }

            if (fieldType.IsArray == false &&
                mi.IsDefined(typeof (FieldArrayLengthAttribute), false))
            {
                //?FieldArrayLengthAttrIsWrong"The field or property '{0}' can't be marked with FieldArrayLength attribute is only valid for array fields."
                throw new BadUsageException("FileHelperMsg_FieldArrayLengthAttrIsWrong", new List<string>() { memberName });
            }

            // PROCESS IN NORMAL CONDITIONS
            if (attributes.Length > 0)
            {
                FieldAttribute fieldAttb = attributes[0];

                if (fieldAttb is FieldFixedLengthAttribute)
                {
                    // Fixed Field
                    if (recordAttribute is DelimitedRecordAttribute)
                    {
                        //?FieldFixedLengthAttrIsWrong"The field or property '{0}' can't be marked with FieldFixedLength attribute, it is only for the FixedLengthRecords not for delimited ones."
                        throw new BadUsageException("FileHelperMsg_FieldFixedLengthAttrIsWrong", new List<string>() { memberName });
                    }

                    var attbFixedLength = (FieldFixedLengthAttribute) fieldAttb;
                    var attbAlign = Attributes.GetFirst<FieldAlignAttribute>(mi);

                    res = new FixedLengthField(fi,
                        attbFixedLength.Length,
                        attbAlign,
                        recordAttribute.DefaultCultureName);
                    ((FixedLengthField) res).FixedMode = ((FixedLengthRecordAttribute) recordAttribute).FixedMode;
                }
                else if (fieldAttb is FieldDelimiterAttribute)
                {
                    // Delimited Field
                    if (recordAttribute is FixedLengthRecordAttribute)
                    {
                        //?FieldDelimiterAttrIsWrong"The field or property '{0}' can't be marked with FieldDelimiter attribute, it is only for DelimitedRecords not for fixed ones."
                        throw new BadUsageException("FileHelperMsg_FieldDelimiterAttrIsWrong", new List<string>() { memberName });
                    }

                    res = new DelimitedField(fi,
                        ((FieldDelimiterAttribute)fieldAttb).Delimiter,
                        recordAttribute.DefaultCultureName);
                }
                else
                {
                    //?CustomAttrNotSupported"Custom field attributes are not currently supported. Unknown attribute: {0} on field: {1}"
                    throw new BadUsageException("FileHelperMsg_CustomAttrNotSupported", new List<string>() { fieldAttb.GetType().Name, fi.Name });
                }
            }
            else // attributes.Length == 0
            {
                var delimitedRecordAttribute = recordAttribute as DelimitedRecordAttribute;

                if (delimitedRecordAttribute != null)
                {
                    res = new DelimitedField(fi,
                        delimitedRecordAttribute.Separator,
                        recordAttribute.DefaultCultureName);
                }
            }

            if (res != null)
            {
                // FieldDiscarded
                res.Discarded = mi.IsDefined(typeof (FieldValueDiscardedAttribute), false);

                // FieldTrim
                Attributes.WorkWithFirst<FieldTrimAttribute>(mi,
                    (x) =>
                    {
                        res.TrimMode = x.TrimMode;
                        res.TrimChars = x.TrimChars;
                    });

                // FieldQuoted
                Attributes.WorkWithFirst<FieldQuotedAttribute>(mi,
                    (x) =>
                    {
                        if (res is FixedLengthField)
                        {
                            //?FieldQuotedAttrIsWrong"The field or property '{0}' can't be marked with FieldQuoted attribute, it is only for the delimited records."
                            throw new BadUsageException("FileHelperMsg_FieldQuotedAttrIsWrong", new List<string>() { memberName });
                        }

                        ((DelimitedField) res).QuoteChar =
                            x.QuoteChar;
                        ((DelimitedField) res).QuoteMode =
                            x.QuoteMode;
                        ((DelimitedField) res).QuoteMultiline =
                            x.QuoteMultiline;
                    });

                // FieldOrder
                Attributes.WorkWithFirst<FieldOrderAttribute>(mi, x => res.FieldOrder = x.Order);

                // FieldCaption
                Attributes.WorkWithFirst<FieldCaptionAttribute>(mi, x => res.FieldCaption = x.Caption);

                // FieldOptional
                res.IsOptional = mi.IsDefined(typeof(FieldOptionalAttribute), false);

                // FieldInNewLine
                res.InNewLine = mi.IsDefined(typeof(FieldInNewLineAttribute), false);

                // FieldNotEmpty
                res.IsNotEmpty = mi.IsDefined(typeof(FieldNotEmptyAttribute), false);

                // FieldNotIncluded
                res.IsNotIncluded = mi.IsDefined(typeof(FieldNotIncludedAttribute), false);

                // FieldArrayLength
                if (fieldType.IsArray)
                {
                    res.IsArray = true;
                    res.ArrayType = fieldType.GetElementType();

                    // MinValue indicates that there is no FieldArrayLength in the array
                    res.ArrayMinLength = int.MinValue;
                    res.ArrayMaxLength = int.MaxValue;

                    Attributes.WorkWithFirst<FieldArrayLengthAttribute>(mi,
                        (x) =>
                        {
                            res.ArrayMinLength = x.MinLength;
                            res.ArrayMaxLength = x.MaxLength;

                            if (res.ArrayMaxLength < res.ArrayMinLength ||
                                res.ArrayMinLength < 0 ||
                                res.ArrayMaxLength <= 0)
                            {
                                //?FieldArrayLengthAttrIsInvalid"The field or property '{0}' has invalid length values in the [FieldArrayLength] attribute."
                                throw new BadUsageException("FileHelperMsg_FieldArrayLengthAttrIsInvalid", new List<string>() { memberName });
                            }
                        });
                }
            }

            if (string.IsNullOrEmpty(res.FieldFriendlyName))
                res.FieldFriendlyName = res.FieldName;

            return res;
        }

        internal RecordOptions Parent { private get; set; }
        internal int ParentIndex { private get; set; }

        internal static string AutoPropertyName(FieldInfo fi)
        {
            if (fi.IsDefined(typeof(CompilerGeneratedAttribute), false))
            {
                if (fi.Name.EndsWith("__BackingField") &&
                    fi.Name.StartsWith("<") &&
                    fi.Name.Contains(">"))
                    return fi.Name.Substring(1, fi.Name.IndexOf(">") - 1);

            }

            if (fi.IsDefined(typeof(DebuggerBrowsableAttribute), false))
            {
                if (fi.Name.EndsWith("@") && !fi.IsPublic)
                {
                    var name = fi.Name.Substring(0, fi.Name.Length - 1);

                    if (fi.DeclaringType?.GetProperty(name) != null)
                        return name;
                }
            }

            return "";
        }

        internal bool IsAutoProperty { get; set; }

        #endregion

        #region "  Constructor  "

        /// <summary>
        /// Create a field base without any configuration
        /// </summary>
        internal FieldBase()
        {
            IsNullableType = false;
            TrimMode = TrimMode.None;
            FieldOrder = null;
            InNewLine = false;
            IsOptional = false;
            TrimChars = null;
            NullValue = null;
            IsArray = false;
            IsNotEmpty = false;
            IsNotIncluded = false;
        }

        /// <summary>
        /// Create a field base from a fieldinfo object
        /// Verify the settings against the actual field to ensure it will work.
        /// </summary>
        /// <param name="fi">Field Info Object</param>
        /// <param name="defaultCultureName">Default culture name used for each properties if no converter is specified otherwise. If null, the default decimal separator (".") will be used.</param>
        internal FieldBase(FieldInfo fi, string defaultCultureName = null)
            : this()
        {

            FieldInfo = fi;
            FieldType = FieldInfo.FieldType;
            MemberInfo attibuteTarget = fi;
            FieldFriendlyName = AutoPropertyName(fi);
            if (string.IsNullOrEmpty(FieldFriendlyName) == false)
            {
                var prop = fi.DeclaringType.GetProperty(FieldFriendlyName);
                if (prop == null)
                {
                    FieldFriendlyName = null;
                }
                else
                {
                    this.IsAutoProperty = true;
                    attibuteTarget = prop;
                }
            }

            if (FieldType.IsArray)
                FieldTypeInternal = FieldType.GetElementType();
            else
                FieldTypeInternal = FieldType;

            IsStringField = FieldTypeInternal == typeof (string);

            object[] attribs = attibuteTarget.GetCustomAttributes(typeof (FieldConverterAttribute), true);

            if (attribs.Length > 0)
            {
                var conv = (FieldConverterAttribute) attribs[0];
                Converter = conv.Converter;
                conv.ValidateTypes(FieldInfo);
            }
            else
                Converter = ConvertHelpers.GetDefaultConverter(FieldFriendlyName ?? fi.Name,
                    FieldType,
                    defaultCultureName: defaultCultureName);

            if (Converter != null)
                Converter.mDestinationType = FieldTypeInternal;

            attribs = attibuteTarget.GetCustomAttributes(typeof (FieldNullValueAttribute), true);

            if (attribs.Length > 0)
            {
                NullValue = ((FieldNullValueAttribute) attribs[0]).NullValue;

                if (NullValue != null)
                {
                    if (!FieldTypeInternal.IsAssignableFrom(NullValue.GetType()))
                    {
                        //?NullValueWrongType"The NullValue is of type: {0} that is not asignable to the field {1} of type: {2}"
                        throw new BadUsageException("FileHelperMsg_NullValueWrongType",
                            new List<string>() { NullValue.GetType().Name, FieldInfo.Name, FieldTypeInternal.Name },
                            FieldInfo.Name);
                    }
                }
            }

            IsNullableType = FieldTypeInternal.IsValueType &&
                             FieldTypeInternal.IsGenericType &&
                             FieldTypeInternal.GetGenericTypeDefinition() == typeof (Nullable<>);
        }

        #endregion

        #region "  MustOverride (String Handling)  "

        /// <summary>
        /// Extract the string from the underlying data, removes quotes
        /// characters for example
        /// </summary>
        /// <param name="line">Line to parse data from</param>
        /// <returns>Slightly processed string from the data</returns>
        internal abstract ExtractedInfo ExtractFieldString(LineInfo line);

        /// <summary>
        /// Create a text block containing the field from definition
        /// </summary>
        /// <param name="sb">Append string to output</param>
        /// <param name="fieldValue">Field we are adding</param>
        /// <param name="isLast">Indicates if we are processing last field</param>
        internal abstract void CreateFieldString(StringBuilder sb, object fieldValue, bool isLast);

        /// <summary>
        /// Convert a field value to a string representation
        /// </summary>
        /// <param name="fieldValue">Object containing data</param>
        /// <returns>String representation of field</returns>
        internal string CreateFieldString(object fieldValue)
        {
            if (IsNotIncluded)
                return string.Empty;

            if (Converter == null)
            {
                if (fieldValue == null)
                    return string.Empty;
                else
                    return fieldValue.ToString();
            }
            else
                return Converter.FieldToString(fieldValue);
        }

        #endregion

        #region "  ExtractValue  "

        /// <summary>
        /// Get the data out of the records
        /// </summary>
        /// <param name="line">Line handler containing text</param>
        /// <returns></returns>
        internal object ExtractFieldValue(LineInfo line, ErrorManager ErrorManager, int detailIndex, out Tuple<int, int> valuePosition)
        {
            valuePosition = new Tuple<int, int>(line.mCurrentPos, 0);
            //-> extract only what I need
            try
            {
                if (InNewLine)
                {
                    // Any trailing characters, terminate
                    if (line.EmptyFromPos() == false)
                    {
                        //?TextBeforeNewLine"Text '{0}' found before the new line of the field: {1} (this is not allowed when you use [FieldInNewLine])"
                        throw new BadUsageException(line, "FileHelperMsg_TextBeforeNewLine", new List<string>() { line.CurrentString, FieldInfo.Name });
                    }

                    line.ReLoad(line.mReader.ReadNextLine());

                    if (line.mLineStr == null)
                    {
                        //?EndOfStreamInsideField"End of stream found parsing the field {0}. Please check the class record."
                        throw new BadUsageException(line, "FileHelperMsg_EndOfStreamInsideField", new List<string>() { FieldInfo.Name });
                    }
                }

                if (IsArray == false)
                {
                    if (line.IsEOL())
                    {
                        ExtractedInfo info = new ExtractedInfo(line);
                        return AssignFromString(info, line, ErrorManager, detailIndex).Value;
                    }
                    else
                    {
                        ExtractedInfo info = ExtractFieldString(line);
                        if (info.mCustomExtractedString == null)
                            line.mCurrentPos = info.ExtractedTo + 1;

                        line.mCurrentPos += CharsToDiscard; //total;

                        if (Discarded)
                            return GetDiscardedNullValue();
                        else
                            return AssignFromString(info, line, ErrorManager, detailIndex).Value;
                    }
                }
                else
                {
                    if (ArrayMinLength <= 0)
                        ArrayMinLength = 0;

                    int i = 0;

                    var res = new ArrayList(Math.Max(ArrayMinLength, 10));

                    while (line.mCurrentPos - CharsToDiscard < line.mLineStr.Length &&
                       i < ArrayMaxLength)
                {
                        ExtractedInfo info = ExtractFieldString(line);
                        if (info.mCustomExtractedString == null)
                            line.mCurrentPos = info.ExtractedTo + 1;

                        line.mCurrentPos += CharsToDiscard;

                        try {
                            var value = AssignFromString(info, line, ErrorManager, detailIndex);

                            if (value.NullValueUsed &&
                                i == 0 &&
                                line.IsEOL())
                                break;

                            res.Add(value.Value);
                        }
                    catch (NullValueNotFoundException)
                    {
                            if (i == 0)
                                break;
                            else
                                throw;
                        }
                        i++;
                    }

                    if (res.Count < ArrayMinLength)
                    {
                        //?ArrayLengthLessThanMin"Line: {0} Column: {1} Field: {2}. The array has only {3} values, less than the minimum length of {4}"
                        throw new FileHelpersException("FileHelperMsg_ArrayLengthLessThanMin", new List<string>() { line.mReader.LineNumber.ToString(), line.mCurrentPos.ToString(), FieldInfo.Name, res.Count.ToString(), ArrayMinLength.ToString() });
                    }
                    else if (IsLast && line.IsEOL() == false)
                    {
                        //?ArrayLengthGreaterThanMin"Line: {0} Column: {1} Field: {2}. The array has more values than the maximum length of {3}"
                        throw new FileHelpersException("FileHelperMsg_ArrayLengthGreaterThanMin", new List<string>() { line.mReader.LineNumber.ToString(), line.mCurrentPos.ToString(), FieldInfo.Name, ArrayMaxLength.ToString() });
                    }

                    // TODO:   is there a reason we go through all the array processing then discard it
                    if (Discarded)
                        return null;
                    else
                        return res.ToArray(ArrayType);
                }
            }
            finally
            {
                valuePosition = new Tuple<int, int>(valuePosition.Item1, line.mCurrentPos - valuePosition.Item1);
            }
        }

        #region "  AssignFromString  "

        private struct AssignResult
        {
            public object Value;
            public bool NullValueUsed;
        }

        /// <summary>
        /// Create field object after extracting the string from the underlying
        /// input data
        /// </summary>
        /// <param name="fieldString">Information extracted?</param>
        /// <param name="line">Underlying input data</param>
        /// <returns>Object to assign to field</returns>
        private AssignResult AssignFromString(ExtractedInfo fieldString, LineInfo line, ErrorManager ErrorManager, int detailIndex)
        {
            object val;

            var extractedString = fieldString.ExtractedString();
            try
            {
                try
                {
                    /*
                    if (IsNotEmpty && String.IsNullOrEmpty(extractedString))
                    {
                        //?ValueNonPopulated"The value is empty and must be populated."
                        throw new FileHelpersException("FileHelperMsg_ValueNonPopulated", null);
                    }
                    else */
                    if (IsStringField)
                    {
                        if (IsNotEmpty && String.IsNullOrEmpty(extractedString))
                        {
                            var nullVal = GetNullValue(line);
                            if ((nullVal == null) || (string.IsNullOrEmpty(nullVal.ToString())))
                                throw new FileHelpersException("FileHelperMsg_ValueNonPopulated", null);
                            else
                                return new AssignResult
                                {
                                    Value = nullVal.ToString(),
                                    NullValueUsed = true
                                };
                        }
                        else if (this.Converter != null)
                            val = this.Converter.StringToField(TrimString(extractedString));
                        else
                            val = TrimString(extractedString);
                    }
                    else if (this.Converter == null)
                    {
                        extractedString = extractedString.Trim();

                        if (extractedString.Length == 0)
                        {
                            var nullVal = GetNullValue(line);
                            if ((nullVal == null) && (IsNotEmpty))
                                throw new FileHelpersException("FileHelperMsg_ValueNonPopulated", null);

                            return new AssignResult
                            {
                                Value = nullVal,
                                NullValueUsed = true
                            };
                        }
                        else
                            val = Convert.ChangeType(extractedString, FieldTypeInternal, null);
                    }
                    else
                    {
                        var trimmedString = extractedString.Trim();

                        if (this.Converter.CustomNullHandling == false &&
                            trimmedString.Length == 0)
                        {
                            var nullVal = GetNullValue(line);
                            if ((nullVal == null) && (IsNotEmpty))
                                throw new FileHelpersException("FileHelperMsg_ValueNonPopulated", null);

                            return new AssignResult
                            {
                                Value = nullVal,
                                NullValueUsed = true
                            };
                        }
                        else
                        {
                            if (TrimMode == TrimMode.Both)
                                val = this.Converter.StringToField(trimmedString);
                            else
                                val = this.Converter.StringToField(TrimString(extractedString));

                            if (val == null)
                            {
                                return new AssignResult
                                {
                                    Value = GetNullValue(line),
                                    NullValueUsed = true
                                };
                            }
                        }
                    }

                    return new AssignResult
                    {
                        Value = val
                    };
                }
                catch (ConvertException ex)
                {
                    ex.FieldName = FieldInfo.Name;
                    ex.LineNumber = line.mReader.LineNumber;
                    ex.ColumnNumber = fieldString.ExtractedFrom + 1;
                    throw;
                }
                catch (BadUsageException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                if (Converter == null ||
                    Converter.GetType().Assembly == typeof(FieldBase).Assembly)
                    {
                        throw new ConvertException(extractedString,
                            FieldTypeInternal,
                            FieldInfo.Name,
                            line.mReader.LineNumber,
                            fieldString.ExtractedFrom + 1,
                            ex.Message,//FileHelpersException.NonLocalizedCode,
                            null,
                            ex);
                    }
                    else
                    {
                        throw new ConvertException(extractedString,
                            FieldTypeInternal,
                            FieldInfo.Name,
                            line.mReader.LineNumber,
                            fieldString.ExtractedFrom + 1,
                            "FileHelperMsg_ConvertExceptionCustomConverterException",
                            //!"Your custom converter: {0} throws an {1} with the message: {2}"
                            new List<string>() { this.Converter.GetType().Name, ex.GetType().Name, ex.Message },
                            ex);
                    }
                }
            }
            catch (Exception exception)
            {
                if (ErrorManager.ErrorMode == ErrorMode.ThrowException)
                    throw;
                else
                {
                    ErrorManager.AddError(new ErrorInfo()
                    {
                        mErrorType = ErrorInfo.ErrorTypeEnum.Unknown,
                        mExceptionInfo = exception,
                        mFailedOnType = FieldInfo.DeclaringType,
                        //mRecordString = extractedString,
                        mRecordString = line.mLineStr,
                        mLineNumber = line.mReader.LineNumber,
                        mDetailIndex = detailIndex,
                        mStart = fieldString.ExtractedFrom + 1,
                        mLength = fieldString.Length,
                        mFieldName = FieldInfo.Name
                    });
                    return new AssignResult
                    {
                        Value = FieldInfo.FieldType.IsValueType ? Activator.CreateInstance(FieldInfo.FieldType) : null,
                        NullValueUsed = !FieldInfo.FieldType.IsValueType
                    };
                }
            }
        }

        private String TrimString(string extractedString)
        {
            switch (TrimMode)
            {
                case TrimMode.None:
                    return extractedString;

                case TrimMode.Both:
                    return extractedString.Trim();

                case TrimMode.Left:
                    return extractedString.TrimStart();

                case TrimMode.Right:
                    return extractedString.TrimEnd();

                default:
                    //?TrimModeIsInvalid"Trim mode invalid in FieldBase.TrimString"
                    throw new FileHelpersException("FileHelperMsg_TrimModeIsInvalid", new List<string>() { TrimMode.ToString() });
            }
        }

        /// <summary>
        /// Convert a null value into a representation,
        /// allows for a null value override
        /// </summary>
        /// <param name="line">input line to read, used for error messages</param>
        /// <returns>Null value for object</returns>
        private object GetNullValue(LineInfo line)
        {
            if (NullValue == null)
            {
                if (FieldTypeInternal.IsValueType)
                {
                    if (IsNullableType)
                        return null;

                    //?FieldNullValueIsMissing"No value found for the value type field: '{0}' Class: '{1}'. {2}You must use the [FieldNullValue] attribute because this is a value type and can't be null or use a Nullable Type instead of the current type.";
                    //new List<string>() { FieldInfo.Name, FieldInfo.DeclaringType.Name, Environment.NewLine); }
                    throw new NullValueNotFoundException(line, "FileHelperMsg_FieldNullValueIsMissing", null);
                }
                else
                    return null;
            }
            else
                return NullValue;
        }

        /// <summary>
        /// Get the null value that represent a discarded value
        /// </summary>
        /// <returns>null value of discard?</returns>
        private object GetDiscardedNullValue()
        {
            if (NullValue == null)
            {
                if (FieldTypeInternal.IsValueType)
                {
                    if (IsNullableType)
                        return null;

                    //?ValueIsDiscarded"The field: '{0}' Class: '{1}' is from a value type: {2} and is discarded (null) you must provide a [FieldNullValue] attribute.";
                    throw new BadUsageException("FileHelperMsg_ValueIsDiscarded", new List<string>() { FieldInfo.Name, FieldInfo.DeclaringType.Name, FieldInfo.FieldType.Name });
                }
                else
                    return null;
            }
            else
                return NullValue;
        }

        #endregion

        #region "  CreateValueForField  "

        /// <summary>
        /// Convert a field value into a write able value
        /// </summary>
        /// <param name="fieldValue">object value to convert</param>
        /// <returns>converted value</returns>
        public object CreateValueForField(object fieldValue)
        {
            object val = null;

            if (fieldValue == null)
            {
                if (NullValue == null)
                {
                    if (FieldTypeInternal.IsValueType &&
                        Nullable.GetUnderlyingType(FieldTypeInternal) == null) {
                        //?NullValueFoundNoFieldNullValueAttribute"Null Value found. You must specify a FieldNullValueAttribute in the {0} field of type {1}, because this is a ValueType."
                        throw new BadUsageException("FileHelperMsg_NullValueFoundNoFieldNullValueAttribute", new List<string>() { FieldInfo.Name, FieldTypeInternal.Name });
                    }
                    else
                        val = null;
                }
                else
                    val = NullValue;
            }
            else if (FieldTypeInternal == fieldValue.GetType())
                val = fieldValue;
            else
            {
                if (Converter == null)
                    val = Convert.ChangeType(fieldValue, FieldTypeInternal, null);
                else
                {
                    try
                    {
                        if (Nullable.GetUnderlyingType(FieldTypeInternal) != null &&
                            Nullable.GetUnderlyingType(FieldTypeInternal) == fieldValue.GetType())
                            val = fieldValue;
                        else
                            val = Convert.ChangeType(fieldValue, FieldTypeInternal, null);
                    }
                    catch
                    {
                        val = Converter.StringToField(fieldValue.ToString());
                    }
                }
            }

            return val;
        }

        #endregion

        #endregion

        #region "  AssignToString  "

        /// <summary>
        /// convert field to string value and assign to a string builder
        /// buffer for output
        /// </summary>
        /// <param name="sb">buffer to collect record</param>
        /// <param name="fieldValue">value to convert</param>
        internal void AssignToString(StringBuilder sb, object fieldValue)
        {
            if (InNewLine)
                sb.Append(StringHelper.NewLine);

            if (IsArray)
            {
                if (fieldValue == null)
                {
                    if (0 < ArrayMinLength)
                    {
                        //?ArrayIsNullMinLen"Field: {0}. The array is null, but the minimum length is {1}"
                        throw new FileHelpersException("FileHelperMsg_ArrayIsNullMinLen", new List<string>() { FieldInfo.Name, ArrayMinLength.ToString() });
                    }

                    return;
                }

                var array = (IList) fieldValue;

                if (array.Count < ArrayMinLength)
                {
                    //?ArrayLenWrongMin"Field: {0}. The array has {1} values, but the minimum length is {2}"
                    throw new FileHelpersException("FileHelperMsg_ArrayLenWrongMin", new List<string>() { FieldInfo.Name, array.Count.ToString(), ArrayMinLength.ToString() });
                }

                if (array.Count > ArrayMaxLength)
                {
                    //?ArrayLenWrongMax"Field: {0}. The array has {1} values, but the maximum length is {2}"
                    throw new FileHelpersException("FileHelperMsg_ArrayLenWrongMax", new List<string>() { FieldInfo.Name, array.Count.ToString(), ArrayMaxLength.ToString() });
                }

                for (int i = 0; i < array.Count; i++)
                {
                    object val = array[i];
                    CreateFieldString(sb, val, IsLast && i == array.Count - 1);
                }
            }
            else
                CreateFieldString(sb, fieldValue, IsLast);
        }

        #endregion

        /// <summary>
        /// Copy the field object
        /// </summary>
        /// <returns>a complete copy of the Field object</returns>
        internal FieldBase Clone()
        {
            var res = CreateClone();

            res.FieldType = FieldType;
            res.Converter = Converter;
            res.FieldTypeInternal = FieldTypeInternal;
            res.IsArray = IsArray;
            res.ArrayType = ArrayType;
            res.ArrayMinLength = ArrayMinLength;
            res.ArrayMaxLength = ArrayMaxLength;
            res.NullValue = NullValue;
            res.IsStringField = IsStringField;
            res.FieldInfo = FieldInfo;
            res.TrimMode = TrimMode;
            res.TrimChars = TrimChars;
            res.IsOptional = IsOptional;
            res.InNewLine = InNewLine;
            res.FieldOrder = FieldOrder;
            res.IsNullableType = IsNullableType;
            res.Discarded = Discarded;
            res.FieldFriendlyName = FieldFriendlyName;
            res.IsNotEmpty = IsNotEmpty;
            res.IsNotIncluded = IsNotIncluded;
            res.FieldCaption = FieldCaption;
            res.Parent = Parent;
            res.ParentIndex = ParentIndex;
            return res;
        }

        /// <summary>
        /// Add the extra details that derived classes create
        /// </summary>
        /// <returns>field clone of right type</returns>
        protected abstract FieldBase CreateClone();
    }
}


text:
package org.gradle.internal.composite;

import org.gradle.api.internal.GradleInternal;
import org.gradle.api.internal.SettingsInternal;
import org.gradle.initialization.SettingsLoader;
import org.gradle.internal.build.BuildStateRegistry;

public class CompositeBuildSettingsLoader implements SettingsLoader {
    private final SettingsLoader delegate;
    private final BuildStateRegistry buildRegistry;

    public CompositeBuildSettingsLoader(SettingsLoader delegate, BuildStateRegistry buildRegistry) {
        this.delegate = delegate;
        this.buildRegistry = buildRegistry;
    }

    @Override
    public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
        SettingsInternal settings = delegate.findAndLoadSettings(gradle);

        // Lock-in explicitly included builds
        buildRegistry.registerRootBuild(settings);

        return settings;
    }
}


text:
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "TSystem.h"
#include "TROOT.h"

using std::cout;
using std::endl;

#include "runAnalysis.H"

Bool_t bOptionsLoaded = kFALSE;
void CleanOptions();

/* tasks to execute: keep the same order than in teh runoptions file */
const Int_t nNoOfTasks = 7;
const char *taskNameInFile[nNoOfTasks] = {
    "Tender", "CDB", "PhysicsSelection", "PIDResponse", "PIDCombinedTask", "CentralityTask", "MultiplicityTask"
};
Bool_t *taskVar[nNoOfTasks] = {
    &bUseTender, &bUseCDB, &bUsePhysicsSelection, &bUsePIDResponse, &bRunPIDCombinedTask, &bUseCentralityTask, &bUseMultiplicityTask
};

const Int_t nNoOfDetectors = 7;
const char *detectorNameInFile[nNoOfDetectors] = {
    "TPC", "SPD", "VZERO", "TZERO", "FMD", "rawFMD", "ZDC"
};
Bool_t *detectorVar[nNoOfDetectors] = {
    &bUseTPC, &bUseSPD, &bUseVZERO, &bUseTZERO, &bUseFMD, &bUseRawFMD, &bUseZDC
};

/// \brief get the condition of "Use name: yes/no"
/// The search for "Use name:" is started on the first read line and on.
/// The file name is left after reading the line that contains "Use name:"
/// or the last read line if not found.
/// \param optionsfile the options file
/// \param name the name to insert to search for its use
/// \return 1 if use = yes, 0 if use = no, -1 if not found or error
Int_t getUse(const ifstream &optionsfile, const char *name) {
  TString currline;
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith(Form("Use %s: ",name))) {
    currline.Remove(0,strlen(Form("Use %s: ",name)));
    if (currline.Contains("yes"))
      return 1;
    else if (currline.Contains("no"))
      return 0;
    else
      { printf("ERROR: wrong Use %s option in options file\n", name); return -1; }
  }
  else
    { printf("ERROR: wrong Use %s option in options file\n", name); return -1; }
}

/// \brief Load the run options for the current task
/// The run options as present in the input file are taken over the global variables
/// \param verb flag for verbose output
/// \param path the path to the configuration files
Bool_t loadRunOptions(Bool_t verb,const char *path) {
  ifstream optionsfile;
  TString currline;

  if (bOptionsLoaded) CleanOptions();

  TString szTheFileName = "runoptions.txt";
  TString szFullFileName(Form("%s/%s", path, szTheFileName.Data()));

  if (szFullFileName.Contains("alien:")) {
    /* oops! we have to bring the file here before we open it */
    TGrid::Connect("alien://");
    gSystem->Exec(Form("alien_cp %s .",szFullFileName.Data()));
    szFullFileName = Form("%s/%s", gSystem->pwd(), szTheFileName.Data());
  }

  listOfRuns.SetOwner(kTRUE);
  optionsfile.open(szFullFileName.Data());

  if (!optionsfile.is_open()) { printf("ERROR: cannot open options file %s in path %s\n", szTheFileName.Data(), path); return kFALSE; }

  /* let's recover the original file name for the error printouts */
  szFullFileName = Form("%s/%s", path, szTheFileName.Data());
  const char *filename = szFullFileName.Data();

  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);

  /* Load run options */
  if (!currline.EqualTo("Run options:")) { printf("ERROR: wrong run options file %s\n", filename); return kFALSE; }
  /* run option */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.EqualTo("grid")) {
    bGRIDPlugin = kTRUE;
    bTrainScope = kFALSE;
  }
  else if (currline.EqualTo("local")) {
    bGRIDPlugin = kFALSE;
    bTrainScope = kFALSE;
  }
  else if (currline.EqualTo("train")) {
    bGRIDPlugin = kFALSE;
    bTrainScope = kTRUE;
  }
  else
    { printf("ERROR: wrong run option in options file %s\n", filename); return kFALSE; }
  printf("  Running in %s\n", bTrainScope ? "train" : (bGRIDPlugin ? "grid" : "local"));

  /* MC option */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.EqualTo("real"))
    bMC = kFALSE;
  else if (currline.EqualTo("MC"))
    bMC = kTRUE;
  else
    { printf("ERROR: wrong MC option in options file %s\n", filename); return kFALSE; }
  printf("  with %s data\n", bMC ? "simulated MC" : "real");

  /* SW versions */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("AliPhysicsVersion: ")) {
    szAliPhysicsVersion = currline.Remove(0,strlen("AliPhysicsVersion: "));
  }
  else
    { printf("ERROR: wrong Aliphysics SW version in options file %s\n", filename); return kFALSE; }
  if (bGRIDPlugin)
    cout << "    Grid AliPhysics version: " << szAliPhysicsVersion << endl;

  /* tasks to execute */
  for (Int_t itask = 0; itask < nNoOfTasks; itask++) {
    Int_t use = getUse(optionsfile,taskNameInFile[itask]);
    switch (use) {
    case 0: *taskVar[itask] = kFALSE; break;
    case 1: *taskVar[itask] = kTRUE; break;
    default: return kFALSE;
    }
    printf("  Use %s: %s\n", taskNameInFile[itask], *taskVar[itask] ? "yes" : "no");
  }

  /* Execution conditions */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("Use multiplicity: ")) {
    currline.Remove(0,strlen("Use multiplicity: "));
    if (currline.Contains("yes"))
      bUseMultiplicity = kTRUE;
    else if (currline.Contains("no"))
      bUseMultiplicity = kFALSE;
    else
      { printf("ERROR: wrong Use multiplicity option in options file %s\n", filename); return kFALSE; }
  }
  else
    { printf("ERROR: wrong Use multiplicity option in options file %s\n", filename); return kFALSE; }
  printf("  Use multiplicity: %s\n", bUseMultiplicity ? "yes" : "no");

  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("Is 2015 dataset")) {
    currline.Remove(0,strlen("Is 2015 dataset"));
    if (currline.Contains("yes"))
      b2015DataSet = kTRUE;
    else if (currline.Contains("no"))
      b2015DataSet = kFALSE;
    else
      { printf("ERROR: wrong Is 2015 dataset option in options file %s\n", filename); return kFALSE; }
  }
  else
    { printf("ERROR: wrong Is 2015 dataset option in options file %s\n", filename); return kFALSE; }
  printf("  Is 2015 dataset: %s\n", b2015DataSet ? "yes" : "no");

  /* ESD input format */
  Int_t useESDinput = getUse(optionsfile, "ESD");
  switch (useESDinput) {
  case 0: bUseESD = kFALSE; break;
  case 1: bUseESD = kTRUE; break;
  default: return kFALSE;
  }
  printf(" Use ESD: %s\n", bUseESD ? "yes" : "no");

  /* AOD input format */
  Int_t useAODinput = getUse(optionsfile, "AOD");
  switch (useAODinput) {
  case 0: bUseAOD = kFALSE; break;
  case 1: bUseAOD = kTRUE; break;
  default: return kFALSE;
  }
  printf(" Use AOD: %s\n", bUseAOD ? "yes" : "no");

  /* task level cuts */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.EqualTo("Task level:")) {
    printf(" Task cuts: \n");
    currline.ReadLine(optionsfile);
    while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
    while(!currline.EqualTo("end")) {
      /* centrality cuts */
      if (currline.BeginsWith("Centrality: ")) {
        currline.Remove(0, strlen("Centrality: "));
        if (verb) cout << "    Centrality cut string: " << currline << endl;
        Double_t min;
        Double_t max;
        sscanf(currline.Data(), "%lf-%lf", &min, &max);
        centralityMin = min;
        centralityMax = max;
        printf ("      centrality cut: %.1f-%.1f\n",centralityMin,centralityMax);
        currline.ReadLine(optionsfile);
        while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
      } /* end centrality cuts */

      /* z Vertex cuts */
      if (currline.BeginsWith("zvertex: ")) {
        currline.Remove(0, strlen("zvertex: "));
        if (verb) cout << "    z vertex cut string: " << currline << endl;
        Double_t min;
        Double_t max;
        sscanf(currline.Data(), "%lf:%lf", &min, &max);
        zvertexMin = min;
        zvertexMax = max;
        printf ("      z vertex cut: %.1f:%.1f\n",zvertexMin,zvertexMax);
        currline.ReadLine(optionsfile);
        while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
      } /* end z Vertex cuts */

      /* use only events validated for centrality calibration */
      if (currline.BeginsWith("Use OnlyCentCalibEvents: ")) {
        currline.Remove(0, strlen("Use OnlyCentCalibEvents: "));
        if (currline.Contains("yes"))
          bUseOnlyCentCalibEvents = kTRUE;
        else if (currline.Contains("no"))
          bUseOnlyCentCalibEvents = kFALSE;
        else
          { printf("ERROR: wrong Use OnlyCentCalibEvents option in options file %s\n", filename); return -1; }
        printf ("      Use OnlyCentCalibEvents: %s\n", bUseOnlyCentCalibEvents ? "yes" : "no");
        currline.ReadLine(optionsfile);
        while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
      } /* end use only events validated for centrality calibration */
    }
  }
  else
    { printf("ERROR: wrong Task cuts section in options file %s\n", filename); return kFALSE; }

  /* now the detector selected */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.EqualTo("Detectors:")) {
    printf(" Detectors: \n");
    for (Int_t idetector = 0; idetector < nNoOfDetectors; idetector++) {
      Int_t use = getUse(optionsfile,detectorNameInFile[idetector]);
      switch (use) {
      case 0: *detectorVar[idetector] = kFALSE; break;
      case 1: *detectorVar[idetector] = kTRUE; break;
      default: return kFALSE;
      }
      printf("  Use %s: %s\n", detectorNameInFile[idetector], *detectorVar[idetector] ? "yes" : "no");
    }
  }
  else
    { printf("ERROR: wrong Detectors section in options file %s\n", filename); return kFALSE; }

  /* now the corrections file */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (!currline.EqualTo("Corrections file:")) { printf("ERROR: wrong corrections file location in options file %s\n", filename); return kFALSE; }
  printf(" Corrections file:\n");
  /* source option */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("source: ")) {
    currline.Remove(0,strlen("source: "));
    if (currline.Contains("local"))
      szCorrectionsSource = "local";
    else if (currline.Contains("aliensingle"))
      szCorrectionsSource = "aliensingle";
    else if (currline.Contains("alienmultiple"))
      szCorrectionsSource = "alienmultiple";
    else if (currline.Contains("OADBsingle"))
      szCorrectionsSource = "OADBsingle";
    else if (currline.Contains("OADBmultiple"))
      szCorrectionsSource = "OADBmultiple";
    else
      { printf("ERROR: wrong corrections file source in options file %s\n", filename); return kFALSE; }
  }
  else
    { printf("ERROR: wrong corrections file source in options file %s\n", filename); return kFALSE; }
  printf("  source: %s\n", (const char *) szCorrectionsSource);
  /* path option */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("path: ")) {
    currline.Remove(0,strlen("path: "));
    szCorrectionsFilePath = currline;
  }
  else
    { printf("ERROR: wrong corrections file path in options file %s\n", filename); return kFALSE; }
  printf("  path: %s\n", (const char *) szCorrectionsFilePath);

  /* file name option */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("filename: ")) {
    currline.Remove(0,strlen("filename: "));
    szCorrectionsFileName = currline;
  }
  else
    { printf("ERROR: wrong corrections file name in options file %s\n", filename); return kFALSE; }
  printf("  filename: %s\n", (const char *) szCorrectionsFileName);

  /* the Qn vector analysis task */
  Int_t useQnTask = getUse(optionsfile, "QnVectorAnalysisTask");
  switch (useQnTask) {
  case 0: bRunQnVectorAnalysisTask = kFALSE; break;
  case 1: bRunQnVectorAnalysisTask = kTRUE; break;
  default: return kFALSE;
  }
  printf(" Use QnVectorAnalysisTask: %s\n", bRunQnVectorAnalysisTask ? "yes" : "no");

  /* the expected correction step on the Qn vector */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("Expected correction step: ")) {
    currline.Remove(0,strlen("Expected correction step: "));
    if (currline.EqualTo("raw")) szCorrectionPass = "raw";
    else if (currline.EqualTo("plain")) szCorrectionPass = "plain";
    else if (currline.EqualTo("rec")) szCorrectionPass = "rec";
    else if (currline.EqualTo("align")) szCorrectionPass = "align";
    else if (currline.EqualTo("twist")) szCorrectionPass = "twist";
    else if (currline.EqualTo("scale")) szCorrectionPass = "scale";
    else if (currline.EqualTo("latest")) szCorrectionPass = "latest";
    else
      { printf("ERROR: wrong Expected correction step %s in options file %s\n", currline.Data(), filename); return kFALSE; }
  }
  else
    { printf("ERROR: wrong Expected correction step option in options file %s\n", filename); return kFALSE; }
  printf("  Expected correction step: %s\n", szCorrectionPass.Data());

  /* the alternative expected correction step on the Qn vector */
  currline.ReadLine(optionsfile);
  while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(optionsfile);
  if (currline.BeginsWith("Alternative correction step: ")) {
    currline.Remove(0,strlen("Alternative correction step: "));
    if (currline.EqualTo("raw")) szAltCorrectionPass = "raw";
    else if (currline.EqualTo("plain")) szAltCorrectionPass = "plain";
    else if (currline.EqualTo("rec")) szAltCorrectionPass = "rec";
    else if (currline.EqualTo("align")) szAltCorrectionPass = "align";
    else if (currline.EqualTo("twist")) szAltCorrectionPass = "twist";
    else if (currline.EqualTo("scale")) szAltCorrectionPass = "scale";
    else if (currline.EqualTo("latest")) szAltCorrectionPass = "latest";
    else
      { printf("ERROR: wrong Alternative correction step %s in options file %s\n", currline.Data(), filename); return kFALSE; }
  }
  else
    { printf("ERROR: wrong Alternative correction step option in options file %s\n", filename); return kFALSE; }
  printf("  Alternative correction step: %s\n", szAltCorrectionPass.Data());

  /* closing the options file */
  if (verb) printf(" Closing the options file\n");
  optionsfile.close();
  if (verb) printf(" Options file closed\n");

  /* now get the data files location */
  if (bGRIDPlugin || bTrainScope) {
    TString szDataLocFilename;
    ifstream datalocfile;

    if (bMC) { szDataLocFilename = "GRIDMCdata.txt"; }
    else { szDataLocFilename = "GRIDrealdata.txt"; }

    TString szDataLocFullFilename = Form("%s/%s", path, szDataLocFilename.Data());

    if (szDataLocFullFilename.Contains("alien:")) {
      /* oops! we have to bring the file here before opening it */
      TGrid::Connect("alien");
      gSystem->Exec(Form("alien_cp %s .", szDataLocFullFilename.Data()));
      szDataLocFullFilename = Form("%s/%s", gSystem->pwd(), szDataLocFilename.Data());
    }

    if (verb) printf(" Opening the data location file: %s\n", szDataLocFullFilename.Data());
    datalocfile.open(szDataLocFullFilename.Data());
    if (datalocfile.fail()) { printf("ERROR: cannot open data location file %s in path %s\n", szDataLocFilename, path); return kFALSE; }

    /* let's recover the original full file name for the error printouts */
    szDataLocFullFilename = Form("%s/%s", path, szDataLocFilename.Data());

    /* the data pattern */
    currline.ReadLine(datalocfile);
    while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(datalocfile);
    if (currline.BeginsWith("Data pattern: ")) {
      szDataPattern = currline.Remove(0,strlen("Data pattern: "));
    }
    else
      { cout << "ERROR: wrong Data pattern in data location file " << szDataLocFullFilename << endl; return kFALSE; }
    cout << " GRID data pattern: " << szDataPattern << endl;
    /* the grid data dir */
    currline.ReadLine(datalocfile);
    while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(datalocfile);
    if (currline.BeginsWith("Grid data dir: ")) {
      szDataDir = currline.Remove(0,strlen("Grid data dir: "));
    }
    else
      { cout << "ERROR: wrong GRID Data dir in data location file " << szDataLocFullFilename << endl; return kFALSE; }
    cout << " GRID data dir: " << szDataDir << endl;
    /* the number of input files */
    currline.ReadLine(datalocfile);
    while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(datalocfile);
    if (currline.BeginsWith("Number of input files: ")) {
      currline.Remove(0,strlen("Number of input files: "));
      nNoOfInputFiles = currline.Atoi();
    }
    else
      { cout << "ERROR: wrong number of input files in data location file " << szDataLocFullFilename << endl; return kFALSE; }
    cout << "  GRID number of input files: " << nNoOfInputFiles << endl;
    /* the run prefix */
    currline.ReadLine(datalocfile);
    while (currline.BeginsWith("#") || currline.IsWhitespace()) currline.ReadLine(datalocfile);
    if (currline.BeginsWith("Run prefix: ")) {
      szRunPrefix = currline.Remove(0,strlen("Run prefix: "));
    }
    else
      { cout << "ERROR: wrong Run prefix in data location file " << szDataLocFullFilename << endl; return kFALSE; }
    if (szRunPrefix.IsWhitespace())
      printf("  NO run prefix\n");
    else
      cout << "  Run prefix: " << szRunPrefix << endl;

    /* now the list of runs to process */
    TObjString *pszRunNo;
    TObjString *pszActiveRunNo;
    currline.ReadLine(datalocfile);
    while (!currline.IsWhitespace()) {
      if (!currline.BeginsWith("#")) {
        pszRunNo = new TObjString(currline);
        if (pszRunNo->GetString().BeginsWith(">")) {
          /* the run is included in the current analysis */
          pszActiveRunNo = new TObjString(pszRunNo->GetString().Remove(0,1));
          listOfActiveRuns.Add(pszActiveRunNo);
          listOfRuns.Add(pszActiveRunNo->Clone());
          delete pszRunNo;
        }
        else {
          /* the run is included as a potential concurrent run */
          listOfRuns.Add(pszRunNo);
        }
      }
      currline.ReadLine(datalocfile);
    }
    printf("  List of concurrent runs: ");
    for (Int_t i=0;i<listOfRuns.GetEntriesFast();i++) {
      if (i%8 == 0) {
        printf("\n    ");
      }
      printf("%s, ", ((TObjString*) listOfRuns.At(i))->GetString().Data());
    }
    printf("\n");
    printf("  List of runs to analyze: ");
    for (Int_t i=0;i<listOfActiveRuns.GetEntriesFast();i++) {
      if (i%8 == 0) {
        printf("\n    ");
      }
      printf("%s, ", ((TObjString*) listOfActiveRuns.At(i))->GetString().Data());
    }
    printf("\n");
    if (verb) printf(" Closing the data location file: %s\n", szDataLocFullFilename.Data());
    datalocfile.close();
  }
  else {
    if (bMC) {
      szLocalFileList = "filelist_mc.txt";
    }
    else
      szLocalFileList = "filelist.txt";
    printf("  Local data list file: %s\n", (const char*) szLocalFileList);
  }
  bOptionsLoaded = kTRUE;
  return kTRUE;
}

void CleanOptions() {
  listOfRuns.Clear();
  listOfActiveRuns.Clear();
}


text:
/**
 * @fileoverview Cookies utility methods.
 *
 * @see https://google.github.io/styleguide/javascriptguide.xml
 * @see https://developers.google.com/closure/compiler/docs/js-for-compiler
 * @module glize/dom/cookies
 * @requires glize/utils/number
 */

import { uint32 } from '../utils/number.js';

/**
 * Sets a cookie.
 * @param {string} key The name of the cookie.
 * @param {string} value The value of the cookie.
 * @param {number} expiration The days after the cookie expires.
 * @param {string=} opt_domain Optional, domain that the cookie belongs to.
 * @method
 */
export const set = (key, value, expiration, opt_domain) => {
  const expires = new Date(expiration * 864E5 + Date.now()).toGMTString();
  document.cookie = escape(key) + '=' + escape(value || '') +
    '; expires=' + expires +
    '; path=/; domain=' + (opt_domain || document.domain);
};

/**
 * Gets the value for the first cookie with the given name.
 * @param {string} key The name of the cookie to get.
 * @param {string=} opt_default The optional default value.
 * @return {string} The value of the cookie. If no cookie is set this
 *     returns opt_default or undefined if opt_default is not provided.
 * @method
 */
export const get = (key, opt_default = '') => {
  const re = key + '=([^;].+?)(;|$)';
  return unescape((document.cookie.match(re) || [])[1] || opt_default);
};

/**
 * Removes and expires a cookie.
 * @param {string} key The cookie name.
 * @return {boolean} Whether the cookie existed before it was removed.
 * @method
 */
export const remove = (key) => {
  const value = get(key);

  set(key, '', 0);
  return !!value;
};

/**
 * Removes and expires all cookie.
 * @method
 */
export const clear = () => {
  const names = keys();
  let length = uint32(names.length);

  while (length--) {
    remove(names[length]);
  }
};

/**
 * Gets list of stored keys.
 * @return {!Array<string>} Returns list of stored keys.
 * @method
 */
export const keys = () => {
  const re = /;\s*/;
  const parts = document.cookie.split(re);
  let length = uint32(parts.length);
  const keys = new Array(length - 1);

  while (length--) {
    keys[length] = (parts[length].split('=')[0]);
  }

  return keys;
};


text:
<?php

require_once __DIR__ . '/TwitterOAuth/TwitterOAuth.php';
require_once __DIR__ . '/TwitterOAuth/Exception/TwitterException.php';

use TwitterOAuth\TwitterOAuth;

date_default_timezone_set('UTC');

/**
 * Array with the OAuth tokens provided by Twitter when you create application
 *
 * output_format - Optional - Values: text|json|array|object - Default: object
 */
$config = array(
    'consumer_key' => '01b307acba4f54f55aafc33bb06bbbf6ca803e9a',
    'consumer_secret' => '926ca39b94e44e5bdd4a8705604b994ca64e1f72',
    'oauth_token' => 'e98c603b55646a6d22249d9b0096e9af29bafcc2',
    'oauth_token_secret' => '07cfdf42835998375e71b46d96b4488a5c659c2f',
    'output_format' => 'object'
);

/**
 * Instantiate TwitterOAuth class with set tokens
 */
$tw = new TwitterOAuth($config);

/**
 * Returns a collection of the most recent Tweets posted by the user
 * https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
 */
$params = array(
    'screen_name' => 'ricard0per',
    'count' => 5,
    'exclude_replies' => true
);

/**
 * Send a GET call with set parameters
 */
$response = $tw->get('statuses/user_timeline', $params);

var_dump($response);

/**
 * Creates a new list for the authenticated user
 * https://dev.twitter.com/docs/api/1.1/post/lists/create
 */
$params = array(
    'name' => 'TwOAuth',
    'mode' => 'private',
    'description' => 'Test List',
);

/**
 * Send a POST call with set parameters
 */
$response = $tw->post('lists/create', $params);

var_dump($response);


text:
/** @externs */

// Just to satisfy the compiler while doing a compilation check.
// We don't use the Closure Library, but the compiler expects it.
const goog = {};


text: hhmmmmkay


text:
package com.formkiq.vision.pdf;

import java.util.ArrayList;
import java.util.List;

import org.apache.pdfbox.pdmodel.common.PDRectangle;

/**
 * Transform {@link PdfToken} to {@link PDRectangle} boxes, by looking
 * at the "lines" of a PDF.
 *
 */
public class PdfTokenToPDRectangleTransformer
        implements PdfTokenTransformer<PDRectangle> {

    @Override
    public List<PDRectangle> transform(final List<PdfToken> tokens) {

    	List<PDRectangle> list = new ArrayList<>();

        PdfTokenReTransformer re = new PdfTokenReTransformer();
        List<PDRectangle> relist = re.transform(tokens);
        list.addAll(relist);

        PdfTokenLine2Transformer ltransformer = new PdfTokenLine2Transformer();
        List<PDRectangle> lt = ltransformer.transform(tokens);
		list.addAll(lt);

		return list;
    }
}


text:
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
                        print_function, unicode_literals)

import io
import sys
from twitter.common.collections import maybe_list
from twitter.common.lang import Compatibility

from pants.base.config import Config
from pants.base.target import Target
from pants.goal.context import Context
from pants.goal.run_tracker import RunTracker
from pants.reporting.plaintext_reporter import PlainTextReporter
from pants.reporting.report import Report
from pants.util.dirutil import safe_mkdtemp

def create_new_options(new_options):
  """Create a fake new-style options object for testing.

  Note that the returned object only provides access to the provided options values. There is
  no registration mechanism on this object. Code under test shouldn't care  about resolving
  cmd-line flags vs. config vs. env vars etc. etc.

  :param dict new_options: An optional dict of scope -> (dict of option name -> value).
  """
  class TestOptions(object):
    def for_scope(self, scope):
      class TestOptionValues(object):
        def __init__(self):
          self.__dict__ = new_options[scope]
      return TestOptionValues()

    def for_global_scope(self):
      return self.for_scope('')

  return TestOptions()

def create_config(sample_ini='', defaults=None):
  """Creates a ``Config`` from the ``sample_ini`` file contents.

  :param string sample_ini: The contents of the ini file containing the config values.
  :param dict defaults: An optional dict of global default ini values to seed.
  """
  if not isinstance(sample_ini, Compatibility.string):
    raise ValueError('The sample_ini supplied must be a string, given: %s' % sample_ini)

  parser = Config.create_parser(defaults)
  with io.BytesIO(sample_ini.encode('utf-8')) as ini:
    parser.readfp(ini)
  return Config(parser)

def create_run_tracker(info_dir=None):
  """Creates a ``RunTracker`` and starts it.

  :param string info_dir: An optional director for the run tracker to store state; defaults to a
    new temp dir that will be be cleaned up on interpreter exit.
  """
  # TODO(John Sirois): Rework uses around a context manager for cleanup of the info_dir in a more
  # disciplined manner
  info_dir = info_dir or safe_mkdtemp()
  run_tracker = RunTracker(info_dir)
  report = Report()
  settings = PlainTextReporter.Settings(outfile=sys.stdout,
                                        log_level=Report.INFO,
                                        color=False,
                                        indent=True,
                                        timing=False,
                                        cache_stats=False)
  report.add_reporter('test_debug', PlainTextReporter(run_tracker, settings))
  run_tracker.start(report)
  return run_tracker

def create_context(config='', new_options=None, target_roots=None, **kwargs):
  """Creates a ``Context`` with no config values, options, or targets by default.

  :param config: Either a ``Context`` object or else a string representing the contents of the
    pants.ini to parse the config from.
  :param new_options: An optional dict of scope -> (dict of name -> new-style option values).
  :param target_roots: An optional list of target roots to seed the context target graph from.
  :param ``**kwargs``: Any additional keyword arguments to pass through to the Context constructor.
  """
  config = config if isinstance(config, Config) else create_config(config)
  run_tracker = create_run_tracker()
  target_roots = maybe_list(target_roots, Target) if target_roots else []
  return Context(config, create_new_options(new_options or {}),
                 run_tracker, target_roots, **kwargs)


text:
layout: post
title: Practical Kanban – some Kanban boards in practices
date: 2010-03-28T10:07:00.001Z
author: Marcus Hammarberg
tags:
  - Kanban
  - Agile
modified_time: 2010-03-28T10:22:41.725Z
blogger_id: tag:blogger.com,1999:blog-36533086.post-4252109985727479839
blogger_orig_url: http://www.marcusoft.net/2010/03/practical-kanban-some-kanban-boards-in.html
---

Together with
Joakim Sundén
and
Christophe Achouiantz I've been doing some talks on
Kanban. We have included some practicality in the talk – Build your own
Kanban-board sort of.

For the first few talks I tried to draw as fast as Joakim (in that case)
talked. Not an easy task – try it. And also my drawings were not always
optimal.

So Joakim and I did some stop-motion-action and created slides for this
part instead. It took the better part of a complete day… But the result
was alright I think.

Here are the slides with some short comments to illustrate what we talk
about.

**[Kanbanboards](http://www.slideshare.net/marcusoftnet/kanbanboards "Kanbanboards")**

View more [presentations](http://www.slideshare.net/) from [Marcus
Hammarberg](http://www.slideshare.net/marcusoftnet).


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.folio.okapi</groupId>
    <artifactId>okapi</artifactId>
    <version>5.0.0-SNAPSHOT</version>
  </parent>
  <artifactId>okapi-common</artifactId>
  <dependencies>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-1.2-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web-client</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-micrometer-metrics</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-influx</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-prometheus</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-jmx</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.z3950.zing</groupId>
      <artifactId>cql-java</artifactId>
      <version>1.13</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.folio.okapi</groupId>
      <artifactId>okapi-testing</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-unit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <Automatic-Module-Name>org.folio.okapi.common</Automatic-Module-Name>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <executions>
          <execution>
            <id>get-the-git-infos</id>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <generateGitPropertiesFile>true</generateGitPropertiesFile>
          <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
package org.cloudfoundry.uaa;

import org.cloudfoundry.AbstractIntegrationTest;
import org.cloudfoundry.uaa.serverinformation.AutoLoginRequest;
import org.cloudfoundry.uaa.serverinformation.GetAutoLoginAuthenticationCodeRequest;
import org.cloudfoundry.uaa.serverinformation.GetAutoLoginAuthenticationCodeResponse;
import org.cloudfoundry.uaa.serverinformation.GetInfoRequest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;

import java.time.Duration;
import java.util.function.Consumer;

import static org.assertj.core.api.Assertions.assertThat;

public final class ServerInformationTest extends AbstractIntegrationTest {

    @Autowired
    private String clientId;

    @Autowired
    private String clientSecret;

    @Autowired
    private String password;

    @Autowired
    private UaaClient uaaClient;

    @Autowired
    private String username;

    @Test
    public void autoLogin() {
        getAuthenticationCode(this.uaaClient, this.clientId, this.clientSecret, this.password, this.username)
            .flatMap(code -> this.uaaClient.serverInformation()
                .autoLogin(AutoLoginRequest.builder()
                    .clientId(this.clientId)
                    .code(code)
                    .build()))
            .as(StepVerifier::create)
            .expectComplete()
            .verify(Duration.ofMinutes(5));
    }

    @Test
    public void getAutoLoginAuthenticationCode() {
        this.uaaClient.serverInformation()
            .getAuthenticationCode(GetAutoLoginAuthenticationCodeRequest.builder()
                .clientId(this.clientId)
                .clientSecret(this.clientSecret)
                .password(this.password)
                .username(this.username)
                .build())
            .map(GetAutoLoginAuthenticationCodeResponse::getPath)
            .as(StepVerifier::create)
            .expectNext("/oauth/authorize")
            .expectComplete()
            .verify(Duration.ofMinutes(5));
    }

    @Test
    public void getInfo() {
        this.uaaClient.serverInformation()
            .getInfo(GetInfoRequest.builder()
                .build())
            .map(response -> response.getLinks().getPassword())
            .as(StepVerifier::create)
            .consumeNextWith(endsWithExpectation("password"))
            .expectComplete()
            .verify(Duration.ofMinutes(5));
    }

    private static Consumer<String> endsWithExpectation(String suffix) {
        return actual -> assertThat(actual).endsWith(suffix);
    }

    private static Mono<String> getAuthenticationCode(UaaClient uaaClient, String clientId, String clientSecret, String password, String username) {
        return requestAuthenticationCode(uaaClient, clientId, clientSecret, password, username)
            .map(GetAutoLoginAuthenticationCodeResponse::getCode);
    }

    private static Mono<GetAutoLoginAuthenticationCodeResponse> requestAuthenticationCode(UaaClient uaaClient, String clientId, String clientSecret, String password, String username) {
        return uaaClient.serverInformation()
            .getAuthenticationCode(GetAutoLoginAuthenticationCodeRequest.builder()
                .clientId(clientId)
                .clientSecret(clientSecret)
                .password(password)
                .username(username)
                .build());
    }

}