text:
package org.apache.drill.exec.vector.complex.fn;

import io.netty.buffer.DrillBuf;

import java.io.IOException;
import java.io.InputStream;
import java.util.BitSet;
import java.util.List;

import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.common.expression.PathSegment;
import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.exec.physical.base.GroupScan;
import org.apache.drill.exec.store.easy.json.reader.BaseJsonProcessor;
import org.apache.drill.exec.vector.complex.fn.VectorOutput.ListVectorOutput;
import org.apache.drill.exec.vector.complex.fn.VectorOutput.MapVectorOutput;
import org.apache.drill.exec.vector.complex.writer.BaseWriter;
import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter;
import org.apache.drill.exec.vector.complex.writer.BaseWriter.ListWriter;
import org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;

public class JsonReader extends BaseJsonProcessor {
  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory
      .getLogger(JsonReader.class);
  public final static int MAX_RECORD_SIZE = 128 * 1024;

  private final WorkingBuffer workingBuffer;
  private final List<SchemaPath> columns;
  private final boolean allTextMode;
  private final MapVectorOutput mapOutput;
  private final ListVectorOutput listOutput;
  private final boolean extended = true;
  private final boolean readNumbersAsDouble;

  /**
   * Collection for tracking empty array writers during reading
   * and storing them for initializing empty arrays
   */
  private final List<ListWriter> emptyArrayWriters = Lists.newArrayList();

  /**
   * Describes whether or not this reader can unwrap a single root array record
   * and treat it like a set of distinct records.
   */
  private final boolean skipOuterList;

  /**
   * Whether the reader is currently in a situation where we are unwrapping an
   * outer list.
   */
  private boolean inOuterList;
  /**
   * The name of the current field being parsed. For Error messages.
   */
  private String currentFieldName;

  private FieldSelection selection;

  public JsonReader(DrillBuf managedBuf, boolean allTextMode,
      boolean skipOuterList, boolean readNumbersAsDouble) {
    this(managedBuf, GroupScan.ALL_COLUMNS, allTextMode, skipOuterList,
        readNumbersAsDouble);
  }

  public JsonReader(DrillBuf managedBuf, List<SchemaPath> columns,
      boolean allTextMode, boolean skipOuterList, boolean readNumbersAsDouble) {
    super(managedBuf);
    assert Preconditions.checkNotNull(columns).size() > 0 : "JSON record reader requires at least one column";
    this.selection = FieldSelection.getFieldSelection(columns);
    this.workingBuffer = new WorkingBuffer(managedBuf);
    this.skipOuterList = skipOuterList;
    this.allTextMode = allTextMode;
    this.columns = columns;
    this.mapOutput = new MapVectorOutput(workingBuffer);
    this.listOutput = new ListVectorOutput(workingBuffer);
    this.currentFieldName = "<none>";
    this.readNumbersAsDouble = readNumbersAsDouble;
  }

  @SuppressWarnings("resource")
  @Override
  public void ensureAtLeastOneField(ComplexWriter writer) {
    List<BaseWriter.MapWriter> writerList = Lists.newArrayList();
    List<PathSegment> fieldPathList = Lists.newArrayList();
    BitSet emptyStatus = new BitSet(columns.size());

    // first pass: collect which fields are empty
    for (int i = 0; i < columns.size(); i++) {
      SchemaPath sp = columns.get(i);
      PathSegment fieldPath = sp.getRootSegment();
      BaseWriter.MapWriter fieldWriter = writer.rootAsMap();
      while (fieldPath.getChild() != null && !fieldPath.getChild().isArray()) {
        fieldWriter = fieldWriter.map(fieldPath.getNameSegment().getPath());
        fieldPath = fieldPath.getChild();
      }
      writerList.add(fieldWriter);
      fieldPathList.add(fieldPath);
      if (fieldWriter.isEmptyMap()) {
        emptyStatus.set(i, true);
      }
      if (i == 0 && !allTextMode) {
        // when allTextMode is false, there is not much benefit to producing all
        // the empty
        // fields; just produce 1 field. The reason is that the type of the
        // fields is
        // unknown, so if we produce multiple Integer fields by default, a
        // subsequent batch
        // that contains non-integer fields will error out in any case. Whereas,
        // with
        // allTextMode true, we are sure that all fields are going to be treated
        // as varchar,
        // so it makes sense to produce all the fields, and in fact is necessary
        // in order to
        // avoid schema change exceptions by downstream operators.
        break;
      }

    }

    // second pass: create default typed vectors corresponding to empty fields
    // Note: this is not easily do-able in 1 pass because the same fieldWriter
    // may be
    // shared by multiple fields whereas we want to keep track of all fields
    // independently,
    // so we rely on the emptyStatus.
    for (int j = 0; j < fieldPathList.size(); j++) {
      BaseWriter.MapWriter fieldWriter = writerList.get(j);
      PathSegment fieldPath = fieldPathList.get(j);
      if (emptyStatus.get(j)) {
        if (allTextMode) {
          fieldWriter.varChar(fieldPath.getNameSegment().getPath());
        } else {
          fieldWriter.integer(fieldPath.getNameSegment().getPath());
        }
      }
    }

    for (ListWriter field : emptyArrayWriters) {
      // checks that array has not been initialized
      if (field.getValueCapacity() == 0) {
        if (allTextMode) {
          field.varChar();
        } else {
          field.integer();
        }
      }
    }
  }

  public void setSource(int start, int end, DrillBuf buf) throws IOException {
    setSource(DrillBufInputStream.getStream(start, end, buf));
  }

  @Override
  public void setSource(InputStream is) throws IOException {
    super.setSource(is);
    mapOutput.setParser(parser);
    listOutput.setParser(parser);
  }

  @Override
  public void setSource(JsonNode node) {
    super.setSource(node);
    mapOutput.setParser(parser);
    listOutput.setParser(parser);
  }

  public void setSource(String data) throws IOException {
    setSource(data.getBytes(Charsets.UTF_8));
  }

  @SuppressWarnings("resource")
  public void setSource(byte[] bytes) throws IOException {
    setSource(new SeekableBAIS(bytes));
  }

  @Override
  public ReadState write(ComplexWriter writer) throws IOException {

    ReadState readState = null;
    try {
      JsonToken t = lastSeenJsonToken;
      if (t == null || t == JsonToken.END_OBJECT) {
        t = parser.nextToken();
      }
      while (!parser.hasCurrentToken() && !parser.isClosed()) {
        t = parser.nextToken();
      }
      lastSeenJsonToken = null;

      if (parser.isClosed()) {
        return ReadState.END_OF_STREAM;
      }

      readState = writeToVector(writer, t);

      switch (readState) {
      case END_OF_STREAM:
        break;
      case WRITE_SUCCEED:
        break;
      default:
        throw getExceptionWithContext(UserException.dataReadError(),
            currentFieldName, null).message(
            "Failure while reading JSON. (Got an invalid read state %s )",
            readState.toString()).build(logger);
      }
    } catch (com.fasterxml.jackson.core.JsonParseException ex) {
      if (ignoreJSONParseError()) {
        if (processJSONException() == JsonExceptionProcessingState.END_OF_STREAM) {
          return ReadState.JSON_RECORD_PARSE_EOF_ERROR;
        } else {
          return ReadState.JSON_RECORD_PARSE_ERROR;
        }
      } else {
        throw ex;
      }
    }
    return readState;
  }

  private void confirmLast() throws IOException {
    parser.nextToken();
    if (!parser.isClosed()) {
      throw getExceptionWithContext(UserException.dataReadError(),
          currentFieldName, null)
          .message(
              "Drill attempted to unwrap a toplevel list "
                  + "in your document.  However, it appears that there is trailing content after this top level list.  Drill only "
                  + "supports querying a set of distinct maps or a single json array with multiple inner maps.")
          .build(logger);
    }
  }

  private ReadState writeToVector(ComplexWriter writer, JsonToken t)
      throws IOException {

    switch (t) {
    case START_OBJECT:
      writeDataSwitch(writer.rootAsMap());
      break;
    case START_ARRAY:
      if (inOuterList) {
        throw getExceptionWithContext(UserException.dataReadError(),
            currentFieldName, null)
            .message(
                "The top level of your document must either be a single array of maps or a set "
                    + "of white space delimited maps.").build(logger);
      }

      if (skipOuterList) {
        t = parser.nextToken();
        if (t == JsonToken.START_OBJECT) {
          inOuterList = true;
          writeDataSwitch(writer.rootAsMap());
        } else {
          throw getExceptionWithContext(UserException.dataReadError(),
              currentFieldName, null)
              .message(
                  "The top level of your document must either be a single array of maps or a set "
                      + "of white space delimited maps.").build(logger);
        }

      } else {
        writeDataSwitch(writer.rootAsList());
      }
      break;
    case END_ARRAY:

      if (inOuterList) {
        confirmLast();
        return ReadState.END_OF_STREAM;
      } else {
        throw getExceptionWithContext(UserException.dataReadError(),
            currentFieldName, null).message(
            "Failure while parsing JSON.  Ran across unexpected %s.",
            JsonToken.END_ARRAY).build(logger);
      }

    case NOT_AVAILABLE:
      return ReadState.END_OF_STREAM;
    default:
      throw getExceptionWithContext(UserException.dataReadError(),
          currentFieldName, null)
          .message(
              "Failure while parsing JSON.  Found token of [%s].  Drill currently only supports parsing "
                  + "json strings that contain either lists or maps.  The root object cannot be a scalar.",
              t).build(logger);
    }

    return ReadState.WRITE_SUCCEED;

  }

  private void writeDataSwitch(MapWriter w) throws IOException {
    if (this.allTextMode) {
      writeDataAllText(w, this.selection, true);
    } else {
      writeData(w, this.selection, true);
    }
  }

  private void writeDataSwitch(ListWriter w) throws IOException {
    if (this.allTextMode) {
      writeDataAllText(w);
    } else {
      writeData(w);
    }
  }

  private void consumeEntireNextValue() throws IOException {
    switch (parser.nextToken()) {
    case START_ARRAY:
    case START_OBJECT:
      parser.skipChildren();
      return;
    default:
      // hit a single value, do nothing as the token was already read
      // in the switch statement
      return;
    }
  }

  /**
   *
   * @param map
   * @param selection
   * @param moveForward
   *          Whether or not we should start with using the current token or the
   *          next token. If moveForward = true, we should start with the next
   *          token and ignore the current one.
   * @throws IOException
   */
  private void writeData(MapWriter map, FieldSelection selection,
      boolean moveForward) throws IOException {
    //
    map.start();
    try {
      outside: while (true) {

        JsonToken t;
        if (moveForward) {
          t = parser.nextToken();
        } else {
          t = parser.getCurrentToken();
          moveForward = true;
        }
        if (t == JsonToken.NOT_AVAILABLE || t == JsonToken.END_OBJECT) {
          return;
        }

        assert t == JsonToken.FIELD_NAME : String.format(
            "Expected FIELD_NAME but got %s.", t.name());

        final String fieldName = parser.getText();
        this.currentFieldName = fieldName;
        FieldSelection childSelection = selection.getChild(fieldName);
        if (childSelection.isNeverValid()) {
          consumeEntireNextValue();
          continue outside;
        }

        switch (parser.nextToken()) {
        case START_ARRAY:
          writeData(map.list(fieldName));
          break;
        case START_OBJECT:
          if (!writeMapDataIfTyped(map, fieldName)) {
            writeData(map.map(fieldName), childSelection, false);
          }
          break;
        case END_OBJECT:
          break outside;

        case VALUE_FALSE: {
          map.bit(fieldName).writeBit(0);
          break;
        }
        case VALUE_TRUE: {
          map.bit(fieldName).writeBit(1);
          break;
        }
        case VALUE_NULL:
          // do nothing as we don't have a type.
          break;
        case VALUE_NUMBER_FLOAT:
          map.float8(fieldName).writeFloat8(parser.getDoubleValue());
          break;
        case VALUE_NUMBER_INT:
          if (this.readNumbersAsDouble) {
            map.float8(fieldName).writeFloat8(parser.getDoubleValue());
          } else {
            map.bigInt(fieldName).writeBigInt(parser.getLongValue());
          }
          break;
        case VALUE_STRING:
          handleString(parser, map, fieldName);
          break;

        default:
          throw getExceptionWithContext(UserException.dataReadError(),
              currentFieldName, null).message("Unexpected token %s",
              parser.getCurrentToken()).build(logger);
        }

      }
    } finally {
      map.end();
    }

  }

  private void writeDataAllText(MapWriter map, FieldSelection selection,
      boolean moveForward) throws IOException {
    //
    map.start();
    outside: while (true) {

      JsonToken t;

      if (moveForward) {
        t = parser.nextToken();
      } else {
        t = parser.getCurrentToken();
        moveForward = true;
      }
       if (t == JsonToken.NOT_AVAILABLE || t == JsonToken.END_OBJECT) {
        return;
      }

      assert t == JsonToken.FIELD_NAME : String.format(
          "Expected FIELD_NAME but got %s.", t.name());

      final String fieldName = parser.getText();
      this.currentFieldName = fieldName;
      FieldSelection childSelection = selection.getChild(fieldName);
      if (childSelection.isNeverValid()) {
        consumeEntireNextValue();
        continue outside;
      }

      switch (parser.nextToken()) {
      case START_ARRAY:
        writeDataAllText(map.list(fieldName));
        break;
      case START_OBJECT:
        if (!writeMapDataIfTyped(map, fieldName)) {
          writeDataAllText(map.map(fieldName), childSelection, false);
        }
        break;
      case END_OBJECT:
        break outside;

      case VALUE_EMBEDDED_OBJECT:
      case VALUE_FALSE:
      case VALUE_TRUE:
      case VALUE_NUMBER_FLOAT:
      case VALUE_NUMBER_INT:
      case VALUE_STRING:
        handleString(parser, map, fieldName);
        break;
      case VALUE_NULL:
        // do nothing as we don't have a type.
        break;

      default:
        throw getExceptionWithContext(UserException.dataReadError(),
            currentFieldName, null).message("Unexpected token %s",
            parser.getCurrentToken()).build(logger);
      }
    }
    map.end();

  }

  /**
   * Will attempt to take the current value and consume it as an extended value
   * (if extended mode is enabled). Whether extended is enable or disabled, will
   * consume the next token in the stream.
   * @param writer
   * @param fieldName
   * @return
   * @throws IOException
   */
  private boolean writeMapDataIfTyped(MapWriter writer, String fieldName)
      throws IOException {
    if (extended) {
      return mapOutput.run(writer, fieldName);
    } else {
      parser.nextToken();
      return false;
    }
  }

  /**
   * Will attempt to take the current value and consume it as an extended value
   * (if extended mode is enabled). Whether extended is enable or disabled, will
   * consume the next token in the stream.
   * @param writer
   * @return
   * @throws IOException
   */
  private boolean writeListDataIfTyped(ListWriter writer) throws IOException {
    if (extended) {
      return listOutput.run(writer);
    } else {
      parser.nextToken();
      return false;
    }
  }

  private void handleString(JsonParser parser, MapWriter writer,
      String fieldName) throws IOException {
    writer.varChar(fieldName).writeVarChar(0,
        workingBuffer.prepareVarCharHolder(parser.getText()),
        workingBuffer.getBuf());
  }

  private void handleString(JsonParser parser, ListWriter writer)
      throws IOException {
    writer.varChar().writeVarChar(0,
        workingBuffer.prepareVarCharHolder(parser.getText()),
        workingBuffer.getBuf());
  }

  private void writeData(ListWriter list) throws IOException {
    list.startList();
    outside: while (true) {
      try {
        switch (parser.nextToken()) {
        case START_ARRAY:
          writeData(list.list());
          break;
        case START_OBJECT:
          if (!writeListDataIfTyped(list)) {
            writeData(list.map(), FieldSelection.ALL_VALID, false);
          }
          break;
        case END_ARRAY:
          addIfNotInitialized(list);
        case END_OBJECT:
          break outside;

        case VALUE_EMBEDDED_OBJECT:
        case VALUE_FALSE: {
          list.bit().writeBit(0);
          break;
        }
        case VALUE_TRUE: {
          list.bit().writeBit(1);
          break;
        }
        case VALUE_NULL:
          throw UserException
              .unsupportedError()
              .message(
                  "Null values are not supported in lists by default. "
                      + "Please set `store.json.all_text_mode` to true to read lists containing nulls. "
                      + "Be advised that this will treat JSON null values as a string containing the word 'null'.")
              .build(logger);
        case VALUE_NUMBER_FLOAT:
          list.float8().writeFloat8(parser.getDoubleValue());
          break;
        case VALUE_NUMBER_INT:
          if (this.readNumbersAsDouble) {
            list.float8().writeFloat8(parser.getDoubleValue());
          } else {
            list.bigInt().writeBigInt(parser.getLongValue());
          }
          break;
        case VALUE_STRING:
          handleString(parser, list);
          break;
        default:
          throw UserException.dataReadError()
              .message("Unexpected token %s", parser.getCurrentToken())
              .build(logger);
        }
      } catch (Exception e) {
        throw getExceptionWithContext(e, this.currentFieldName, null).build(
            logger);
      }
    }
    list.endList();

  }

  /**
   * Checks that list has not been initialized and adds it to the emptyArrayWriters collection.
   * @param list ListWriter that should be checked
   */
  private void addIfNotInitialized(ListWriter list) {
    if (list.getValueCapacity() == 0) {
      emptyArrayWriters.add(list);
    }
  }

  private void writeDataAllText(ListWriter list) throws IOException {
    list.startList();
    outside: while (true) {

      switch (parser.nextToken()) {
      case START_ARRAY:
        writeDataAllText(list.list());
        break;
      case START_OBJECT:
        if (!writeListDataIfTyped(list)) {
          writeDataAllText(list.map(), FieldSelection.ALL_VALID, false);
        }
        break;
      case END_ARRAY:
        addIfNotInitialized(list);
      case END_OBJECT:
        break outside;

      case VALUE_EMBEDDED_OBJECT:
      case VALUE_FALSE:
      case VALUE_TRUE:
      case VALUE_NULL:
      case VALUE_NUMBER_FLOAT:
      case VALUE_NUMBER_INT:
      case VALUE_STRING:
        handleString(parser, list);
        break;
      default:
        throw getExceptionWithContext(UserException.dataReadError(),
            currentFieldName, null).message("Unexpected token %s",
            parser.getCurrentToken()).build(logger);
      }
    }
    list.endList();

  }

  public DrillBuf getWorkBuf() {
    return workingBuffer.getBuf();
  }

}


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsCOMPtr.h"
#include "nsString.h"

#include "nsISimpleEnumerator.h"
#include "nsIXULWindow.h"

class nsWindowMediator;

//
// nsWindowInfo
//

struct nsWindowInfo
{
  nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp);
  ~nsWindowInfo();

  nsCOMPtr<nsIXULWindow>    mWindow;
  int32_t                   mTimeStamp;
  uint32_t                  mZLevel;

  // each struct is in two, independent, circular, doubly-linked lists
  nsWindowInfo              *mYounger, // next younger in sequence
                            *mOlder;
  nsWindowInfo              *mLower,   // next lower in z-order
                            *mHigher;

  bool TypeEquals(const nsAString &aType);
  void   InsertAfter(nsWindowInfo *inOlder, nsWindowInfo *inHigher);
  void   Unlink(bool inAge, bool inZ);
  void   ReferenceSelf(bool inAge, bool inZ);
};

//
// virtual enumerators
//

class nsAppShellWindowEnumerator : public nsISimpleEnumerator {

friend class nsWindowMediator;

public:
  nsAppShellWindowEnumerator(const PRUnichar* aTypeString,
                             nsWindowMediator& inMediator);
  virtual ~nsAppShellWindowEnumerator();
  NS_IMETHOD GetNext(nsISupports **retval) = 0;
  NS_IMETHOD HasMoreElements(bool *retval);

  NS_DECL_ISUPPORTS

protected:

  void AdjustInitialPosition();
  virtual nsWindowInfo *FindNext() = 0;

  void WindowRemoved(nsWindowInfo *inInfo);

  nsWindowMediator *mWindowMediator;
  nsString          mType;
  nsWindowInfo     *mCurrentPosition;
};

class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator {

public:
  nsASDOMWindowEnumerator(const PRUnichar* aTypeString,
                          nsWindowMediator& inMediator);
  virtual ~nsASDOMWindowEnumerator();
  NS_IMETHOD GetNext(nsISupports **retval);
};

class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator {

public:
  nsASXULWindowEnumerator(const PRUnichar* aTypeString,
                          nsWindowMediator& inMediator);
  virtual ~nsASXULWindowEnumerator();
  NS_IMETHOD GetNext(nsISupports **retval);
};

//
// concrete enumerators
//

class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator {

public:
  nsASDOMWindowEarlyToLateEnumerator(const PRUnichar* aTypeString,
                                     nsWindowMediator& inMediator);

  virtual ~nsASDOMWindowEarlyToLateEnumerator();

protected:
  virtual nsWindowInfo *FindNext();
};

class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator {

public:
  nsASXULWindowEarlyToLateEnumerator(const PRUnichar* aTypeString,
                                     nsWindowMediator& inMediator);

  virtual ~nsASXULWindowEarlyToLateEnumerator();

protected:
  virtual nsWindowInfo *FindNext();
};

class nsASDOMWindowFrontToBackEnumerator : public nsASDOMWindowEnumerator {

public:
  nsASDOMWindowFrontToBackEnumerator(const PRUnichar* aTypeString,
                                     nsWindowMediator& inMediator);

  virtual ~nsASDOMWindowFrontToBackEnumerator();

protected:
  virtual nsWindowInfo *FindNext();
};

class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator {

public:
  nsASXULWindowFrontToBackEnumerator(const PRUnichar* aTypeString,
                                     nsWindowMediator& inMediator);

  virtual ~nsASXULWindowFrontToBackEnumerator();

protected:
  virtual nsWindowInfo *FindNext();
};

class nsASDOMWindowBackToFrontEnumerator : public nsASDOMWindowEnumerator {

public:
  nsASDOMWindowBackToFrontEnumerator(const PRUnichar* aTypeString,
                                     nsWindowMediator& inMediator);

  virtual ~nsASDOMWindowBackToFrontEnumerator();

protected:
  virtual nsWindowInfo *FindNext();
};

class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator {

public:
  nsASXULWindowBackToFrontEnumerator(const PRUnichar* aTypeString,
                                     nsWindowMediator& inMediator);

  virtual ~nsASXULWindowBackToFrontEnumerator();

protected:
  virtual nsWindowInfo *FindNext();
};

redpajama_set_name: RedPajamaGithub


text:
<?php
declare(strict_types=1);

namespace TileLand\Enum;

use MyCLabs\Enum\Enum;

/**
 * @method static Civilization EGYPTIAN()
 * @method static Civilization INDUS()
 * @method static Civilization INCA()
 * @method static Civilization CHINESE()
 * @method static Civilization IROQUOIS()
 */
class Civilization extends Enum
{
    const EGYPTIAN = 'egyptian';

    const INDUS = 'indus';

    const INCA = 'inca';

    const CHINESE = 'chinese';

    const IROQUOIS = 'iroquois';
}


text:
<?
// Invocation: index.php?assessment_id=<id>&email=<email>

// Make sure we capture the current time as early as possible
$Now = date('c');

if (!isset ($_SERVER['QUERY_STRING']))
{
  print "Thank you";
  error_log ("Missing query string");
  exit;
}
if (empty ($_SERVER['QUERY_STRING']))
{
  print "Thank you";
  error_log ("Empty query string");
  exit;
}
// Decode the query string - it should look similar to this:
// email=consult@btoy1.net&assessment_id=001389724293-000007480011
list($Email_GET, $Assessment_ID_GET) = explode("&", base64_decode($_SERVER['QUERY_STRING']));
if (substr($Email_GET,0,6) != 'email=')
{
  print "Thank you";
  error_log ("Invalid email parameter '$Email_GET'");
  exit;
}
if (substr($Assessment_ID_GET,0,14) != 'assessment_id=')
{
  print "Thank you";
  error_log ("Invalid assessment ID parameter '$Assessment_ID_GET'");
  exit;
}
error_log ("query string = $Email_GET, $Assessment_ID_GET");

// Get the "assessment ID" parameter
list ($dummy, $Assessment_ID) = explode("=", $Assessment_ID_GET);
if (filter_var($Assessment_ID, FILTER_VALIDATE_REGEXP,
    array('options' => array('regexp' => '/\d{12,12}-\d{12,12}/'))) === false)
{
  print "Thank you";
  error_log ("Invalid Assessment ID '$Assessment_ID'");
  exit;
}

// Get the "email" parameter
list ($dummy, $Email) = explode("=", $Email_GET);
if (filter_var($Email, FILTER_VALIDATE_EMAIL) === false)
{
  print "Thank you";
  error_log ("Invalid email '$Email'");
  exit;
}

// Get the assessment parameters from the database
require_once rtrim($_SERVER["DOCUMENT_ROOT"],"/")."/admin/db.inc";
require_once rtrim($_SERVER["DOCUMENT_ROOT"],"/")."/admin/dbfuncs.inc";
$Res_A = GetAssessments($Assessment_ID);
if (($Res_A[0] == 'no error') && (count($Res_A) == 2))
{
  // Setup a default web content
  $BodyContent = '
Thank you
';
  foreach(array_slice($Res_A, 1) as $val_A)
  {
    // Get the URLs
    $WebURL = $val_A['WebURL'];
    $LogoURL = $val_A['CompanyLogoURL'];

    // Get the web template
    $Res_W = GetWebTemplates($val_A['WT_id']);
    if (($Res_W[0] == 'no error') && (count($Res_W) == 2))
    {
      foreach(array_slice($Res_W, 1) as $val_W)
      {
        $BodyContent = preg_replace ('@%%%URL%%%@', $WebURL, $val_W['Template']);
      }
    } else
    {
      print "Thank you";
      error_log ("Unknown web template ID '{$val_A['WT_id']}' for assessment '$Assessment_ID'");
      exit;
    }
  }
} else
{
  print "Thank you";
  error_log ("Unknown assessment ID '$Assessment_ID'");
  exit;
}

// HTML HEADER
header("Refresh: 15; URL=$WebURL");
print <<< END
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">

 <meta http-equiv="Content-Language" content="en-us">
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <title>Thank you</title>
 <meta name="copyright" content="Copyright 2013, Thomas Bullinger">
 <link rel="stylesheet" type="text/css" href="style.css" />

END;

// HTML BODY
print <<< END

    $BodyContent

END;

// Notate the infos in the database

$R_RealIP = (isset ($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $R_RealIP = $_SERVER['HTTP_X_FORWARDED_FOR'] : '';
SaveAssessmentResults($Assessment_ID, $Now, $Email, $_SERVER['HTTP_USER_AGENT'],
  $_SERVER['REMOTE_ADDR'], $R_RealIP, '');
?>


text:
#include "contiki.h"
#include "net/ip/uip.h"
#include "net/ipv6/uip-ds6.h"
#include "tools/rpl-tools.h"
#include "rest-engine.h"
#include "sys/ctimer.h"
#include <stdio.h>
#include "dev/leds.h"

static void ct_callback(void *ptr);
static void put_post_led_toggle_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

static char content[REST_MAX_CHUNK_SIZE];
static int content_len = 0;
static struct ctimer ct;

#define CONTENT_PRINTF(...) { if(content_len < sizeof(content)) { content_len += snprintf(content + content_len, sizeof(content) - content_len, __VA_ARGS__); } }

/* On dongle, LEDs are connected anti-parallel to DIO pins. */

#define TOGGLE_TIME CLOCK_SECOND
/*---------------------------------------------------------------------------*/
PROCESS(start_app, "START_APP");
AUTOSTART_PROCESSES(&start_app);
/*---------------------------------------------------------------------------*/

/* Call back for led toggle timer to toggle leds */
static void
ct_callback(void *ptr)
{
  static uint8 toggle_status = 0;
  if(toggle_status) {
    leds_set(LEDS_RED);
  } else {
    leds_set(LEDS_GREEN);
  } ctimer_restart(&ct);
  toggle_status ^= 0x01;
}
/*********** CoAP sensor/ resource ************************************************/
RESOURCE(resource_led_toggle,
         "title=\"Led_toggle\"",
         NULL,
         put_post_led_toggle_handler,
         put_post_led_toggle_handler,
         NULL);
static void
put_post_led_toggle_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{
  static int led_state = 0;
  unsigned int accept = -1;

  /* Given the way the LEDs are connected to the DIO ports, the LEDs are controlled via direct DIO access. */
  content_len = 0;
  switch(led_state) {
  case (0):
    ctimer_stop(&ct);
    leds_set(LEDS_GREEN);            /* Only LEDS_GREEN on */
    CONTENT_PRINTF("Message from resource: Green LED on");
    led_state = 1;
    break;
  case (1):
    leds_set(LEDS_RED);              /* Only LEDS_RED on */
    CONTENT_PRINTF("Message from resource: Red LED on");
    led_state = 2;
    break;
  case (2):
    leds_set(0);                      /* All LEDS off */
    CONTENT_PRINTF("Message from resource: All LEDs off");
    led_state = 3;
    break;
  case 3:
    /* Both leds toggle */
    CONTENT_PRINTF("Message from resource: LEDs toggle");
    ctimer_restart(&ct);
    led_state = 0;
  default:
    break;
  }
  /* Return message */
  REST.get_header_accept(request, &accept);
  if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
    REST.set_header_content_type(response, REST.type.TEXT_PLAIN);
    REST.set_response_payload(response, (uint8_t *)content, content_len);
  }
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(start_app, ev, data)
{
  PROCESS_BEGIN();
  static int is_coordinator = 0;

  /* Switch off dongle leds */

  /* Initialise ct timer, but don't let it run yet */
  ctimer_set(&ct, TOGGLE_TIME, ct_callback, NULL);
  ctimer_stop(&ct);

  /* Start net stack */
  if(is_coordinator) {
    uip_ipaddr_t prefix;
    uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
    rpl_tools_init(&prefix);
  } else {
    rpl_tools_init(NULL);
  } printf("Starting RPL node\n");

  rest_init_engine();
  rest_activate_resource(&resource_led_toggle, "Dongle/LED-toggle");

  PROCESS_END();
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
<!-- Copyright © 1991-2015 Unicode, Inc.
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
For terms of use, see http://www.unicode.org/copyright.html
-->
<ldml>
	<identity>
		<version number="$Revision: 12291 $"/>
		<language type="en"/>
		<territory type="001"/>
	</identity>
	<dates>
		<calendars>
			<calendar type="chinese">
				<dateFormats>
					<dateFormatLength type="full">
						<dateFormat>
							<pattern>EEEE, d MMMM r(U)</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="long">
						<dateFormat>
							<pattern>d MMMM r(U)</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="medium">
						<dateFormat>
							<pattern>d MMM r</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="short">
						<dateFormat>
							<pattern>dd/MM/r</pattern>
						</dateFormat>
					</dateFormatLength>
				</dateFormats>
				<dateTimeFormats>
					<availableFormats>
						<dateFormatItem id="Ed">E d</dateFormatItem>
						<dateFormatItem id="GyMMMd">d MMM r</dateFormatItem>
						<dateFormatItem id="GyMMMEd">E, d MMM r(U)</dateFormatItem>
						<dateFormatItem id="M">LL</dateFormatItem>
						<dateFormatItem id="Md">dd/MM</dateFormatItem>
						<dateFormatItem id="MEd">E, dd/MM</dateFormatItem>
						<dateFormatItem id="MMMd">d MMM</dateFormatItem>
						<dateFormatItem id="MMMEd">E, d MMM</dateFormatItem>
						<dateFormatItem id="MMMMd">d MMMM</dateFormatItem>
						<dateFormatItem id="UMd">dd/MM/U</dateFormatItem>
						<dateFormatItem id="UMMMd">d MMM U</dateFormatItem>
						<dateFormatItem id="yMd">dd/MM/r</dateFormatItem>
						<dateFormatItem id="yyyyM">MM/r</dateFormatItem>
						<dateFormatItem id="yyyyMd">dd/MM/r</dateFormatItem>
						<dateFormatItem id="yyyyMEd">E, dd/MM/r</dateFormatItem>
						<dateFormatItem id="yyyyMMMd">d MMM r</dateFormatItem>
						<dateFormatItem id="yyyyMMMEd">E, d MMM r(U)</dateFormatItem>
					</availableFormats>
					<intervalFormats>
						<intervalFormatItem id="Md">
							<greatestDifference id="d">dd/MM – dd/MM</greatestDifference>
							<greatestDifference id="M">dd/MM – dd/MM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MEd">
							<greatestDifference id="d">E dd/MM – E dd/MM</greatestDifference>
							<greatestDifference id="M">E dd/MM – E dd/MM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MMMd">
							<greatestDifference id="d">d – d MMM</greatestDifference>
							<greatestDifference id="M">d MMM – d MMM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MMMEd">
							<greatestDifference id="d">E d – E d MMM</greatestDifference>
							<greatestDifference id="M">E d MMM – E d MMM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yM">
							<greatestDifference id="M">MM/y – MM/y</greatestDifference>
							<greatestDifference id="y">MM/y – MM/y</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMd">
							<greatestDifference id="d">dd/MM/y – dd/MM/y</greatestDifference>
							<greatestDifference id="M">dd/MM/y – dd/MM/y</greatestDifference>
							<greatestDifference id="y">dd/MM/y – dd/MM/y</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMEd">
							<greatestDifference id="d">E, dd/MM/y – E, dd/MM/y</greatestDifference>
							<greatestDifference id="M">E, dd/MM/y – E, dd/MM/y</greatestDifference>
							<greatestDifference id="y">E, dd/MM/y – E, dd/MM/y</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMMMd">
							<greatestDifference id="d">d – d MMM U</greatestDifference>
							<greatestDifference id="M">d MMM – d MMM U</greatestDifference>
							<greatestDifference id="y">d MMM U – d MMM U</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMMMEd">
							<greatestDifference id="d">E, d – E, d MMM U</greatestDifference>
							<greatestDifference id="M">E, d MMM – E, d MMM U</greatestDifference>
							<greatestDifference id="y">E, d MMM U – E, d MMM U</greatestDifference>
						</intervalFormatItem>
					</intervalFormats>
				</dateTimeFormats>
			</calendar>
			<calendar type="generic">
				<dateFormats>
					<dateFormatLength type="full">
						<dateFormat>
							<pattern>EEEE, d MMMM y G</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="long">
						<dateFormat>
							<pattern>d MMMM y G</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="medium">
						<dateFormat>
							<pattern>d MMM y G</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="short">
						<dateFormat>
							<pattern>dd/MM/y GGGGG</pattern>
						</dateFormat>
					</dateFormatLength>
				</dateFormats>
				<dateTimeFormats>
					<availableFormats>
						<dateFormatItem id="Ed">E d</dateFormatItem>
						<dateFormatItem id="GyMMMd">d MMM y G</dateFormatItem>
						<dateFormatItem id="GyMMMEd">E, d MMM y G</dateFormatItem>
						<dateFormatItem id="M">LL</dateFormatItem>
						<dateFormatItem id="Md">dd/MM</dateFormatItem>
						<dateFormatItem id="MEd">E, dd/MM</dateFormatItem>
						<dateFormatItem id="MMMd">d MMM</dateFormatItem>
						<dateFormatItem id="MMMEd">E, d MMM</dateFormatItem>
						<dateFormatItem id="MMMMd">d MMMM</dateFormatItem>
						<dateFormatItem id="yyyyM">MM/y GGGGG</dateFormatItem>
						<dateFormatItem id="yyyyMd">dd/MM/y GGGGG</dateFormatItem>
						<dateFormatItem id="yyyyMEd">E, dd/MM/y GGGGG</dateFormatItem>
						<dateFormatItem id="yyyyMMMd">d MMM y G</dateFormatItem>
						<dateFormatItem id="yyyyMMMEd">E, d MMM y G</dateFormatItem>
					</availableFormats>
					<intervalFormats>
						<intervalFormatItem id="Md">
							<greatestDifference id="d">dd/MM – dd/MM</greatestDifference>
							<greatestDifference id="M">dd/MM – dd/MM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MEd">
							<greatestDifference id="d">E dd/MM – E dd/MM</greatestDifference>
							<greatestDifference id="M">E dd/MM – E dd/MM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MMMd">
							<greatestDifference id="d">d – d MMM</greatestDifference>
							<greatestDifference id="M">d MMM – d MMM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MMMEd">
							<greatestDifference id="d">E d – E d MMM</greatestDifference>
							<greatestDifference id="M">E d MMM – E d MMM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yM">
							<greatestDifference id="M">MM/y – MM/y GGGGG</greatestDifference>
							<greatestDifference id="y">MM/y – MM/y GGGGG</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMd">
							<greatestDifference id="d">dd/MM/y – dd/MM/y GGGGG</greatestDifference>
							<greatestDifference id="M">dd/MM/y – dd/MM/y GGGGG</greatestDifference>
							<greatestDifference id="y">dd/MM/y – dd/MM/y GGGGG</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMEd">
							<greatestDifference id="d">E, dd/MM/y – E, dd/MM/y GGGGG</greatestDifference>
							<greatestDifference id="M">E, dd/MM/y – E, dd/MM/y GGGGG</greatestDifference>
							<greatestDifference id="y">E, dd/MM/y – E, dd/MM/y GGGGG</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMMMd">
							<greatestDifference id="d">d – d MMM y G</greatestDifference>
							<greatestDifference id="M">d MMM – d MMM y G</greatestDifference>
							<greatestDifference id="y">d MMM y – d MMM y G</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMMMEd">
							<greatestDifference id="d">E, d – E, d MMM y G</greatestDifference>
							<greatestDifference id="M">E, d MMM – E, d MMM y G</greatestDifference>
							<greatestDifference id="y">E, d MMM y – E, d MMM y G</greatestDifference>
						</intervalFormatItem>
					</intervalFormats>
				</dateTimeFormats>
			</calendar>
			<calendar type="gregorian">
				<dateFormats>
					<dateFormatLength type="full">
						<dateFormat>
							<pattern>EEEE, d MMMM y</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="long">
						<dateFormat>
							<pattern>d MMMM y</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="medium">
						<dateFormat>
							<pattern>d MMM y</pattern>
						</dateFormat>
					</dateFormatLength>
					<dateFormatLength type="short">
						<dateFormat>
							<pattern>dd/MM/y</pattern>
						</dateFormat>
					</dateFormatLength>
				</dateFormats>
				<dateTimeFormats>
					<availableFormats>
						<dateFormatItem id="Ed">E d</dateFormatItem>
						<dateFormatItem id="GyMMMd">d MMM y G</dateFormatItem>
						<dateFormatItem id="GyMMMEd">E, d MMM y G</dateFormatItem>
						<dateFormatItem id="Md">dd/MM</dateFormatItem>
						<dateFormatItem id="MEd">E, dd/MM</dateFormatItem>
						<dateFormatItem id="MMdd">dd/MM</dateFormatItem>
						<dateFormatItem id="MMMd">d MMM</dateFormatItem>
						<dateFormatItem id="MMMEd">E, d MMM</dateFormatItem>
						<dateFormatItem id="MMMMd">d MMMM</dateFormatItem>
						<dateFormatItem id="yM">MM/y</dateFormatItem>
						<dateFormatItem id="yMd">dd/MM/y</dateFormatItem>
						<dateFormatItem id="yMEd">E, dd/MM/y</dateFormatItem>
						<dateFormatItem id="yMMMd">d MMM y</dateFormatItem>
						<dateFormatItem id="yMMMEd">E, d MMM y</dateFormatItem>
					</availableFormats>
					<intervalFormats>
						<intervalFormatItem id="Md">
							<greatestDifference id="d">dd/MM – dd/MM</greatestDifference>
							<greatestDifference id="M">dd/MM – dd/MM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MEd">
							<greatestDifference id="d">E dd/MM – E dd/MM</greatestDifference>
							<greatestDifference id="M">E dd/MM – E dd/MM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MMMd">
							<greatestDifference id="d">d – d MMM</greatestDifference>
							<greatestDifference id="M">d MMM – d MMM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="MMMEd">
							<greatestDifference id="d">E d – E d MMM</greatestDifference>
							<greatestDifference id="M">E d MMM – E d MMM</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yM">
							<greatestDifference id="M">MM/y – MM/y</greatestDifference>
							<greatestDifference id="y">MM/y – MM/y</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMd">
							<greatestDifference id="d">dd/MM/y – dd/MM/y</greatestDifference>
							<greatestDifference id="M">dd/MM/y – dd/MM/y</greatestDifference>
							<greatestDifference id="y">dd/MM/y – dd/MM/y</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMEd">
							<greatestDifference id="d">E, dd/MM/y – E, dd/MM/y</greatestDifference>
							<greatestDifference id="M">E, dd/MM/y – E, dd/MM/y</greatestDifference>
							<greatestDifference id="y">E, dd/MM/y – E, dd/MM/y</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMMMd">
							<greatestDifference id="d">d – d MMM y</greatestDifference>
							<greatestDifference id="M">d MMM – d MMM y</greatestDifference>
							<greatestDifference id="y">d MMM y – d MMM y</greatestDifference>
						</intervalFormatItem>
						<intervalFormatItem id="yMMMEd">
							<greatestDifference id="d">E, d – E, d MMM y</greatestDifference>
							<greatestDifference id="M">E, d MMM – E, d MMM y</greatestDifference>
							<greatestDifference id="y">E, d MMM y – E, d MMM y</greatestDifference>
						</intervalFormatItem>
					</intervalFormats>
				</dateTimeFormats>
			</calendar>
		</calendars>
		<timeZoneNames>
			<zone type="Pacific/Honolulu">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</zone>
			<metazone type="Alaska">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</metazone>
			<metazone type="America_Central">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</metazone>
			<metazone type="America_Eastern">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</metazone>
			<metazone type="America_Mountain">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</metazone>
			<metazone type="America_Pacific">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</metazone>
			<metazone type="Atlantic">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</metazone>
			<metazone type="Hawaii_Aleutian">
				<short>
					<generic>∅∅∅</generic>
					<standard>∅∅∅</standard>
					<daylight>∅∅∅</daylight>
				</short>
			</metazone>
		</timeZoneNames>
	</dates>
	<numbers>
		<currencies>
			<currency type="BYB">
				<displayName>Belarusian New Rouble (1994–1999)</displayName>
				<displayName count="one">Belarusian new rouble (1994–1999)</displayName>
				<displayName count="other">Belarusian new roubles (1994–1999)</displayName>
			</currency>
			<currency type="BYR">
				<displayName>Belarusian Rouble</displayName>
				<displayName count="one">Belarusian rouble</displayName>
				<displayName count="other">Belarusian roubles</displayName>
			</currency>
			<currency type="JPY">
				<symbol>JP¥</symbol>
			</currency>
			<currency type="LVR">
				<displayName>Latvian Rouble</displayName>
				<displayName count="one">Latvian rouble</displayName>
				<displayName count="other">Latvian roubles</displayName>
			</currency>
			<currency type="RUB">
				<displayName>Russian Rouble</displayName>
				<displayName count="one">Russian rouble</displayName>
				<displayName count="other">Russian roubles</displayName>
			</currency>
			<currency type="RUR">
				<displayName>Russian Rouble (1991–1998)</displayName>
				<displayName count="one">Russian rouble (1991–1998)</displayName>
				<displayName count="other">Russian roubles (1991–1998)</displayName>
			</currency>
			<currency type="TJR">
				<displayName>Tajikistani Rouble</displayName>
				<displayName count="one">Tajikistani rouble</displayName>
				<displayName count="other">Tajikistani roubles</displayName>
			</currency>
			<currency type="USD">
				<symbol>US$</symbol>
			</currency>
		</currencies>
	</numbers>
	<units>
		<unitLength type="long">
			<unit type="acceleration-meter-per-second-squared">
				<displayName>metres per second squared</displayName>
				<unitPattern count="one">{0} metre per second squared</unitPattern>
				<unitPattern count="other">{0} metres per second squared</unitPattern>
			</unit>
			<unit type="area-square-kilometer">
				<displayName>square kilometres</displayName>
				<unitPattern count="one">{0} square kilometre</unitPattern>
				<unitPattern count="other">{0} square kilometres</unitPattern>
			</unit>
			<unit type="area-square-meter">
				<displayName>square metres</displayName>
				<unitPattern count="one">{0} square metre</unitPattern>
				<unitPattern count="other">{0} square metres</unitPattern>
				<perUnitPattern>{0} per square metre</perUnitPattern>
			</unit>
			<unit type="area-square-centimeter">
				<displayName>square centimetres</displayName>
				<unitPattern count="one">{0} square centimetre</unitPattern>
				<unitPattern count="other">{0} square centimetres</unitPattern>
				<perUnitPattern>{0} per square centimetre</perUnitPattern>
			</unit>
			<unit type="concentr-milligram-per-deciliter">
				<displayName>milligrams per decilitre</displayName>
				<unitPattern count="one">{0} milligram per decilitre</unitPattern>
				<unitPattern count="other">{0} milligrams per decilitre</unitPattern>
			</unit>
			<unit type="concentr-millimole-per-liter">
				<displayName>millimoles per litre</displayName>
				<unitPattern count="one">{0} millimole per litre</unitPattern>
				<unitPattern count="other">{0} millimoles per litre</unitPattern>
			</unit>
			<unit type="consumption-liter-per-kilometer">
				<displayName>litres per kilometre</displayName>
				<unitPattern count="one">{0} litre per kilometre</unitPattern>
				<unitPattern count="other">{0} litres per kilometre</unitPattern>
			</unit>
			<unit type="consumption-liter-per-100kilometers">
				<displayName>litres per 100 kilometres</displayName>
				<unitPattern count="one">{0} litre per 100 kilometres</unitPattern>
				<unitPattern count="other">{0} litres per 100 kilometres</unitPattern>
			</unit>
			<unit type="consumption-mile-per-gallon">
				<displayName>miles per US gallon</displayName>
				<unitPattern count="one">{0} mile per US gallon</unitPattern>
				<unitPattern count="other">{0} miles per US gallon</unitPattern>
			</unit>
			<unit type="consumption-mile-per-gallon-imperial">
				<displayName>miles per gallon</displayName>
				<unitPattern count="one">{0} mile per gallon</unitPattern>
				<unitPattern count="other">{0} miles per gallon</unitPattern>
			</unit>
			<unit type="length-kilometer">
				<displayName>kilometres</displayName>
				<unitPattern count="one">{0} kilometre</unitPattern>
				<unitPattern count="other">{0} kilometres</unitPattern>
				<perUnitPattern>{0} per kilometre</perUnitPattern>
			</unit>
			<unit type="length-meter">
				<displayName>metres</displayName>
				<unitPattern count="one">{0} metre</unitPattern>
				<unitPattern count="other">{0} metres</unitPattern>
				<perUnitPattern>{0} per metre</perUnitPattern>
			</unit>
			<unit type="length-decimeter">
				<displayName>decimetre</displayName>
				<unitPattern count="one">{0} decimetre</unitPattern>
				<unitPattern count="other">{0} decimetres</unitPattern>
			</unit>
			<unit type="length-centimeter">
				<displayName>centimetres</displayName>
				<unitPattern count="one">{0} centimetre</unitPattern>
				<unitPattern count="other">{0} centimetres</unitPattern>
				<perUnitPattern>{0} per centimetre</perUnitPattern>
			</unit>
			<unit type="length-millimeter">
				<displayName>millimetres</displayName>
				<unitPattern count="one">{0} millimetre</unitPattern>
				<unitPattern count="other">{0} millimetres</unitPattern>
			</unit>
			<unit type="length-micrometer">
				<displayName>micrometre</displayName>
				<unitPattern count="one">{0} micrometre</unitPattern>
				<unitPattern count="other">{0} micrometres</unitPattern>
			</unit>
			<unit type="length-nanometer">
				<displayName>nanometres</displayName>
				<unitPattern count="one">{0} nanometre</unitPattern>
				<unitPattern count="other">{0} nanometres</unitPattern>
			</unit>
			<unit type="length-picometer">
				<displayName>picometres</displayName>
				<unitPattern count="one">{0} picometre</unitPattern>
				<unitPattern count="other">{0} picometres</unitPattern>
			</unit>
			<unit type="pressure-millimeter-of-mercury">
				<displayName>millimetres of mercury</displayName>
				<unitPattern count="one">{0} millimetre of mercury</unitPattern>
				<unitPattern count="other">{0} millimetres of mercury</unitPattern>
			</unit>
			<unit type="speed-kilometer-per-hour">
				<displayName>kilometres per hour</displayName>
				<unitPattern count="one">{0} kilometre per hour</unitPattern>
				<unitPattern count="other">{0} kilometres per hour</unitPattern>
			</unit>
			<unit type="speed-meter-per-second">
				<displayName>metres per second</displayName>
				<unitPattern count="one">{0} metre per second</unitPattern>
				<unitPattern count="other">{0} metres per second</unitPattern>
			</unit>
			<unit type="volume-cubic-kilometer">
				<displayName>cubic kilometres</displayName>
				<unitPattern count="one">{0} cubic kilometre</unitPattern>
				<unitPattern count="other">{0} cubic kilometres</unitPattern>
			</unit>
			<unit type="volume-cubic-meter">
				<displayName>cubic metres</displayName>
				<unitPattern count="one">{0} cubic metre</unitPattern>
				<unitPattern count="other">{0} cubic metres</unitPattern>
				<perUnitPattern>{0} per cubic metre</perUnitPattern>
			</unit>
			<unit type="volume-cubic-centimeter">
				<displayName>cubic centimetres</displayName>
				<unitPattern count="one">{0} cubic centimetre</unitPattern>
				<unitPattern count="other">{0} cubic centimetres</unitPattern>
				<perUnitPattern>{0} per cubic centimetre</perUnitPattern>
			</unit>
			<unit type="volume-megaliter">
				<displayName>megalitres</displayName>
				<unitPattern count="one">{0} megalitre</unitPattern>
				<unitPattern count="other">{0} megalitres</unitPattern>
			</unit>
			<unit type="volume-hectoliter">
				<displayName>hectolitres</displayName>
				<unitPattern count="one">{0} hectolitre</unitPattern>
				<unitPattern count="other">{0} hectolitres</unitPattern>
			</unit>
			<unit type="volume-liter">
				<displayName>litres</displayName>
				<unitPattern count="one">{0} litre</unitPattern>
				<unitPattern count="other">{0} litres</unitPattern>
				<perUnitPattern>{0} per litre</perUnitPattern>
			</unit>
			<unit type="volume-deciliter">
				<displayName>decilitres</displayName>
				<unitPattern count="one">{0} decilitre</unitPattern>
				<unitPattern count="other">{0} decilitres</unitPattern>
			</unit>
			<unit type="volume-centiliter">
				<displayName>centilitres</displayName>
				<unitPattern count="one">{0} centilitre</unitPattern>
				<unitPattern count="other">{0} centilitres</unitPattern>
			</unit>
			<unit type="volume-milliliter">
				<displayName>millilitres</displayName>
				<unitPattern count="one">{0} millilitre</unitPattern>
				<unitPattern count="other">{0} millilitres</unitPattern>
			</unit>
			<unit type="volume-gallon">
				<displayName>US gallons</displayName>
				<unitPattern count="one">{0} US gallon</unitPattern>
				<unitPattern count="other">{0} US gallons</unitPattern>
				<perUnitPattern>{0} per US gallon</perUnitPattern>
			</unit>
			<unit type="volume-gallon-imperial">
				<displayName>gallons</displayName>
				<unitPattern count="one">{0} gallon</unitPattern>
				<unitPattern count="other">{0} gallons</unitPattern>
				<perUnitPattern>{0} per gallon</perUnitPattern>
			</unit>
		</unitLength>
		<unitLength type="short">
			<unit type="acceleration-meter-per-second-squared">
				<displayName>metres/sec²</displayName>
			</unit>
			<unit type="concentr-milligram-per-deciliter">
				<displayName>mg/dl</displayName>
				<unitPattern count="one">{0} mg/dl</unitPattern>
				<unitPattern count="other">{0} mg/dl</unitPattern>
			</unit>
			<unit type="concentr-millimole-per-liter">
				<displayName>millimol/litre</displayName>
				<unitPattern count="one">{0} mmol/l</unitPattern>
				<unitPattern count="other">{0} mmol/l</unitPattern>
			</unit>
			<unit type="consumption-liter-per-kilometer">
				<displayName>litres/km</displayName>
				<unitPattern count="one">{0} l/km</unitPattern>
				<unitPattern count="other">{0} l/km</unitPattern>
			</unit>
			<unit type="consumption-liter-per-100kilometers">
				<displayName>l/100 km</displayName>
				<unitPattern count="one">{0} l/100 km</unitPattern>
				<unitPattern count="other">{0} l/100 km</unitPattern>
			</unit>
			<unit type="consumption-mile-per-gallon">
				<displayName>miles/gal US</displayName>
				<unitPattern count="one">{0} mpg US</unitPattern>
				<unitPattern count="other">{0} mpg US</unitPattern>
			</unit>
			<unit type="consumption-mile-per-gallon-imperial">
				<displayName>miles/gal</displayName>
				<unitPattern count="one">{0} mpg</unitPattern>
				<unitPattern count="other">{0} mpg</unitPattern>
			</unit>
			<unit type="duration-hour">
				<unitPattern count="one">{0} hr</unitPattern>
				<unitPattern count="other">{0} hrs</unitPattern>
			</unit>
			<unit type="duration-minute">
				<unitPattern count="one">{0} min</unitPattern>
				<unitPattern count="other">{0} mins</unitPattern>
			</unit>
			<unit type="duration-second">
				<unitPattern count="one">{0} sec</unitPattern>
				<unitPattern count="other">{0} secs</unitPattern>
			</unit>
			<unit type="length-meter">
				<displayName>metres</displayName>
			</unit>
			<unit type="length-micrometer">
				<displayName>µmetres</displayName>
			</unit>
			<unit type="speed-meter-per-second">
				<displayName>metres/sec</displayName>
			</unit>
			<unit type="volume-megaliter">
				<displayName>Ml</displayName>
				<unitPattern count="one">{0} Ml</unitPattern>
				<unitPattern count="other">{0} Ml</unitPattern>
			</unit>
			<unit type="volume-hectoliter">
				<displayName>hl</displayName>
				<unitPattern count="one">{0} hl</unitPattern>
				<unitPattern count="other">{0} hl</unitPattern>
			</unit>
			<unit type="volume-liter">
				<displayName>litres</displayName>
				<unitPattern count="one">{0} l</unitPattern>
				<unitPattern count="other">{0} l</unitPattern>
			</unit>
			<unit type="volume-deciliter">
				<displayName>dl</displayName>
				<unitPattern count="one">{0} dl</unitPattern>
				<unitPattern count="other">{0} dl</unitPattern>
			</unit>
			<unit type="volume-centiliter">
				<displayName>cl</displayName>
				<unitPattern count="one">{0} cl</unitPattern>
				<unitPattern count="other">{0} cl</unitPattern>
			</unit>
			<unit type="volume-milliliter">
				<displayName>ml</displayName>
				<unitPattern count="one">{0} ml</unitPattern>
				<unitPattern count="other">{0} ml</unitPattern>
			</unit>
			<unit type="volume-gallon">
				<displayName>US gal</displayName>
				<unitPattern count="one">{0} gal US</unitPattern>
				<unitPattern count="other">{0} gal US</unitPattern>
			</unit>
			<unit type="volume-gallon-imperial">
				<displayName>gal</displayName>
				<unitPattern count="one">{0} gal</unitPattern>
				<unitPattern count="other">{0} gal</unitPattern>
			</unit>
		</unitLength>
		<unitLength type="narrow">
			<unit type="concentr-milligram-per-deciliter">
				<displayName>mg/dl</displayName>
				<unitPattern count="one">{0}mg/dl</unitPattern>
				<unitPattern count="other">{0}mg/dl</unitPattern>
			</unit>
			<unit type="concentr-millimole-per-liter">
				<displayName>mmol/l</displayName>
				<unitPattern count="one">{0}mmol/l</unitPattern>
				<unitPattern count="other">{0}mmol/l</unitPattern>
			</unit>
			<unit type="consumption-liter-per-kilometer">
				<displayName>l/km</displayName>
				<unitPattern count="one">{0}l/km</unitPattern>
				<unitPattern count="other">{0}l/km</unitPattern>
			</unit>
			<unit type="consumption-liter-per-100kilometers">
				<displayName>l/100km</displayName>
				<unitPattern count="one">{0}l/100km</unitPattern>
				<unitPattern count="other">{0}l/100km</unitPattern>
			</unit>
			<unit type="consumption-mile-per-gallon">
				<displayName>mpg US</displayName>
				<unitPattern count="one">{0}mpgUS</unitPattern>
				<unitPattern count="other">{0}mpgUS</unitPattern>
			</unit>
			<unit type="consumption-mile-per-gallon-imperial">
				<displayName>mpg</displayName>
				<unitPattern count="one">{0}mpg</unitPattern>
				<unitPattern count="other">{0}mpg</unitPattern>
			</unit>
			<unit type="mass-pound">
				<unitPattern count="one">{0}lb</unitPattern>
				<unitPattern count="other">{0}lb</unitPattern>
			</unit>
			<unit type="temperature-celsius">
				<unitPattern count="one">{0}°</unitPattern>
				<unitPattern count="other">{0}°</unitPattern>
			</unit>
			<unit type="temperature-fahrenheit">
				<unitPattern count="one">{0}°F</unitPattern>
				<unitPattern count="other">{0}°F</unitPattern>
			</unit>
			<unit type="volume-megaliter">
				<displayName>Ml</displayName>
				<unitPattern count="one">{0}Ml</unitPattern>
				<unitPattern count="other">{0}Ml</unitPattern>
			</unit>
			<unit type="volume-hectoliter">
				<displayName>hl</displayName>
				<unitPattern count="one">{0}hl</unitPattern>
				<unitPattern count="other">{0}hl</unitPattern>
			</unit>
			<unit type="volume-liter">
				<displayName>litre</displayName>
				<unitPattern count="one">{0}l</unitPattern>
				<unitPattern count="other">{0}l</unitPattern>
				<perUnitPattern>{0}/l</perUnitPattern>
			</unit>
			<unit type="volume-deciliter">
				<displayName>dl</displayName>
				<unitPattern count="one">{0}dl</unitPattern>
				<unitPattern count="other">{0}dl</unitPattern>
			</unit>
			<unit type="volume-centiliter">
				<displayName>cl</displayName>
				<unitPattern count="one">{0}cl</unitPattern>
				<unitPattern count="other">{0}cl</unitPattern>
			</unit>
			<unit type="volume-milliliter">
				<displayName>ml</displayName>
				<unitPattern count="one">{0}ml</unitPattern>
				<unitPattern count="other">{0}ml</unitPattern>
			</unit>
			<unit type="volume-gallon">
				<displayName>US gal</displayName>
				<unitPattern count="one">{0}galUS</unitPattern>
				<unitPattern count="other">{0}galUS</unitPattern>
				<perUnitPattern>{0}/galUS</perUnitPattern>
			</unit>
			<unit type="volume-gallon-imperial">
				<displayName>gal</displayName>
				<unitPattern count="one">{0}gal</unitPattern>
				<unitPattern count="other">{0}gal</unitPattern>
				<perUnitPattern>{0}/gal</perUnitPattern>
			</unit>
		</unitLength>
	</units>
</ldml>


text:
"use strict";

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };

var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

var _ = require("lodash"),
    Class = require("class-extend"),
    EventEmitter = require("events").EventEmitter,
    Q = require("bluebird");

var RobeUtils = require("./utils");

/**
 * Represents a cursor which streams results.
 *
 * A `result` event will be emitted for each result.
 * An `error` event will be emitted for any errors.
 * A `success` event will be emitted once cursor completes.
 */
var Cursor = (function (EventEmitter) {
  /**
   * Constructor.
   *
   * @param  {Collection} collection Collection being queried.
   * @param  {Promise} promise Promise returned from a monk `find()` call.
   * @param  {Object} [options] Additional options.
   * @param  {Boolean} [options.rawMode] Whether to enable raw query mode by default. Default is false.
   */
  function Cursor(collection, promise) {
    var options = arguments[2] === undefined ? {} : arguments[2];
    _classCallCheck(this, Cursor);

    this.collection = collection;
    this.promise = promise;
    this.options = _.defaults(options, {
      rawMode: false
    });

    this._init();
  }

  _inherits(Cursor, EventEmitter);

  _prototypeProperties(Cursor, null, {
    _init: {

      /**
       * Initialize events.
       * @private
       */
      value: function _init() {
        var self = this;

        self.promise.on("each", function (doc) {
          doc = self.collection._createDocumentFromQueryResult(doc, self.options);

          self.emit("result", doc);
        });

        self.promise.on("error", function (err) {
          self.emit("error", err);
        });

        self.promise.on("success", function () {
          self.emit("success");
        });
      },
      writable: true,
      configurable: true
    },
    close: {

      /**
       * Close this cursor without waiting for it to finish.
       */
      value: function* close() {
        var self = this;

        yield new Q(function (resolve, reject) {
          self.once("success", resolve);

          self.promise.destroy();
        });
      },
      writable: true,
      configurable: true
    }
  });

  return Cursor;
})(EventEmitter);

Cursor.extend = Class.extend;

module.exports = Cursor;


text:
<?php

declare(strict_types=1);

require __DIR__ . '/../vendor/autoload.php';
$config = require_once __DIR__ . '/../config/parameters.php';

Sentry\init(['dsn' => $config['sentry_key']]);

header("Content-Type: application/json");

try {

    $parameters = array_map('htmlspecialchars', $_GET);
    $language   = isset($_GET['lang']) ? strtolower($_GET['lang']) : 'english';

    $weekend = new Weekend\Api();
    $data    = $weekend->fetch();

    $translate = new Weekend\Translate($language);
    $sentence1 = $translate->getSentence1();
    $sentence2 = $translate->getSentence2($data);

    $response = new Weekend\Response();
    echo $response->returnResponse($sentence1, $sentence2);

} catch (Exception $exception) {

    $response = new Weekend\Response();
    echo $response->returnError();

}


text:
/*
 *	author: muggle wei <mugglewei@gmail.com>
 *
 *	Use of this source code is governed by the MIT license that can be
 *	found in the LICENSE file.
 */

#ifndef MUGGLE_C_RING_BUFFER_H_
#define MUGGLE_C_RING_BUFFER_H_

#include "muggle/c/base/macro.h"
#include "muggle/c/base/atomic.h"
#include "muggle/c/sync/mutex.h"
#include "muggle/c/sync/condition_variable.h"

EXTERN_C_BEGIN

enum
{
	MUGGLE_RING_BUFFER_FLAG_WRITE_LOCK = 0x00, // default, write with write lock
	MUGGLE_RING_BUFFER_FLAG_READ_ALL   = 0x00, // default, every reader get all message from all writer
	MUGGLE_RING_BUFFER_FLAG_READ_WAIT  = 0x00, // default, if no message in ring, reader wait

	MUGGLE_RING_BUFFER_FLAG_SINGLE_WRITER = 0x01,   // user guarantee only one writer use this ring_buffer
	MUGGLE_RING_BUFFER_FLAG_SINGLE_READER = 0x02,   // user guarantee only one reader use this ring_buffer
	MUGGLE_RING_BUFFER_FLAG_WRITE_BUSY_LOOP = 0x04, // every writer busy loop until write message into ring
	MUGGLE_RING_BUFFER_FLAG_READ_BUSY_LOOP = 0x08,  // reader busy loop until read message from ring
	MUGGLE_RING_BUFFER_FLAG_MSG_READ_ONCE = 0x10,  // every message will only be read once
};

typedef struct muggle_ring_buffer_tag
{
	MUGGLE_STRUCT_CACHE_LINE_PADDING(0);
	muggle_atomic_int capacity;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(1);
	int flag;
	int write_mode;
	int read_mode;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(2);
	muggle_atomic_int next;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(3);
	muggle_atomic_int cursor;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(4);
	muggle_atomic_int read_cursor; // for MUGGLE_RING_BUFFER_FLAG_MSG_READ_ONCE
	MUGGLE_STRUCT_CACHE_LINE_PADDING(5);
	muggle_mutex_t write_mutex;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(6);
	muggle_mutex_t read_mutex;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(7);
	muggle_condition_variable_t read_cv;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(8);
	void **datas;
	MUGGLE_STRUCT_CACHE_LINE_PADDING(9);
}muggle_ring_buffer_t;

MUGGLE_CC_EXPORT
int muggle_ring_buffer_init(muggle_ring_buffer_t *r, muggle_atomic_int capacity, int flag);

MUGGLE_CC_EXPORT
int muggle_ring_buffer_destroy(muggle_ring_buffer_t *r);

MUGGLE_CC_EXPORT
int muggle_ring_buffer_write(muggle_ring_buffer_t *r, void *data);

MUGGLE_CC_EXPORT
void* muggle_ring_buffer_read(muggle_ring_buffer_t *r, muggle_atomic_int idx);

EXTERN_C_END

#endif


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>git_manager.tool (Javadocs: GitManager)</title>
<meta name="date" content="2015-09-23">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

git_manager.tool

Classes

GitBBOperations

GitGHOperations

GitGUIFrame

GitManager

GitMenuBar

GitOperations

GitOptionToolbar


text:
use strict;
use warnings;

package BenchmarkingIndexer;

use Carp;
use Config;
use File::Spec::Functions qw( catfile catdir );
use POSIX qw( uname );

sub new {
    my $either = shift;
    my $class = ref($either) || $either;
    return bless {
        docs              => undef,
        increment         => undef,
        store             => undef,
        engine            => undef,
        version           => undef,
        index_dir         => undef,
        corpus_dir        => 'extracted_corpus',
        article_filepaths => undef,
        @_,
    }, $class;
}

sub init_indexer { confess "abstract method" }
sub build_index  { confess "abstract method" }

sub delayed_init {
    my $self              = shift;
    my $article_filepaths = $self->{article_filepaths}
        = $self->build_file_list;
    $self->{docs} = @$article_filepaths unless defined $self->{docs};
    $self->{increment} = $self->{docs} + 1 unless defined $self->{increment};
}

# Return a lexically sorted list of all article files from all subdirs.
sub build_file_list {
    my $self       = shift;
    my $corpus_dir = $self->{corpus_dir};
    my @article_filepaths;
    opendir CORPUS_DIR, $corpus_dir
        or confess "Can't opendir '$corpus_dir': $!";
    my @article_dir_names = grep {/articles/} readdir CORPUS_DIR;
    for my $article_dir_name (@article_dir_names) {
        my $article_dir = catdir( $corpus_dir, $article_dir_name );
        opendir ARTICLE_DIR, $article_dir
            or die "Can't opendir '$article_dir': $!";
        push @article_filepaths, map { catfile( $article_dir, $_ ) }
            grep {m/^article\d+\.txt$/} readdir ARTICLE_DIR;
    }
    @article_filepaths = sort @article_filepaths;
    $self->{article_filepaths} = \@article_filepaths;
}

# Print out stats for one run.
sub print_interim_report {
    my ( $self, %args ) = @_;
    printf( "%-3d  Secs: %.3f  Docs: %-4d\n", @args{qw( rep secs count )} );
}

sub start_report {
    # Start the output.
    print '-' x 60 . "\n";
}

# Print out aggregate stats.
sub print_final_report {
    my ( $self, $times ) = @_;

    # Produce mean and truncated mean.
    my @sorted_times = sort @$times;
    my $num_to_chop  = int( @sorted_times >> 2 );
    my $mean         = 0;
    my $trunc_mean   = 0;
    my $num_kept     = 0;
    for ( my $i = 0; $i < @sorted_times; $i++ ) {
        $mean += $sorted_times[$i];
        # Discard fastest 25% and slowest 25% of runs.
        next if $i < $num_to_chop;
        next if $i > ( $#sorted_times - $num_to_chop );
        $trunc_mean += $sorted_times[$i];
        $num_kept++;
    }

    $mean       /= @sorted_times;
    $trunc_mean /= $num_kept;
    my $num_discarded = @sorted_times - $num_kept;
    $mean       = sprintf( "%.3f", $mean );
    $trunc_mean = sprintf( "%.3f", $trunc_mean );

    # Get some info about the system.
    my $thread_support = $Config{usethreads} ? "yes" : "no";
    my @uname_info = (uname)[ 0, 2, 4 ];

    print <<END_REPORT;
------------------------------------------------------------
$self->{engine} $self->{version}
Perl $Config{version}
Thread support: $thread_support
@uname_info
Mean: $mean secs
Truncated mean ($num_kept kept, $num_discarded discarded): $trunc_mean secs
------------------------------------------------------------
END_REPORT
}

package BenchSchema::WhiteSpaceTokenizer;
use base qw( KinoSearch::Analysis::Tokenizer );

sub new { return shift->SUPER::new( pattern => '\S+' ) }

package BenchSchema;
use base qw( KinoSearch::Plan::Schema );
use KinoSearch::Analysis::Tokenizer;

sub new {
    my $self = shift->SUPER::new;
    my $type = KinoSearch::Plan::FullTextType->new(
        analyzer => BenchSchema::WhiteSpaceTokenizer->new, );
    $self->spec_field( name => 'title', type => $type );
    return $self;
}

package BenchmarkingIndexer::KinoSearch;
use base qw( BenchmarkingIndexer );

use Time::HiRes qw( gettimeofday );

sub new {
    my $class = shift;
    my $self  = $class->SUPER::new(@_);

    require KinoSearch;
    require KinoSearch::Index::Indexer;

    # Provide runtime flexibility.
    my $schema = $self->{schema} = BenchSchema->new;
    my $body_type = KinoSearch::Plan::FullTextType->new(
        analyzer      => BenchSchema::WhiteSpaceTokenizer->new,
        highlightable => $self->{store} ? 1 : 0,
        stored        => $self->{store} ? 1 : 0,
    );
    $schema->spec_field( name => 'body', type => $body_type );

    $self->{index_dir} = 'kinosearch_index';
    $self->{engine}    = 'KinoSearch';
    $self->{version}   = $KinoSearch::VERSION;

    return $self;
}

sub init_indexer {
    my ( $self, $count ) = @_;
    my $truncate = $count == 0 ? 1 : 0;
    return KinoSearch::Index::Indexer->new(
        schema   => $self->{schema},
        index    => $self->{index_dir},
        truncate => $truncate,
        create   => 1,
    );
}

# Build an index, stopping at $max docs if $max > 0.
sub build_index {
    my $self = shift;
    $self->delayed_init;
    my ( $max, $increment, $article_filepaths )
        = @{$self}{qw( docs increment article_filepaths )};

    # Start timer.
    my $start = gettimeofday();

    my $indexer = $self->init_indexer(0);

    my $count = 0;
    while ( $count < $max ) {
        for my $article_filepath (@$article_filepaths) {
            # The title is the first line, the body is the rest.
            open( my $article_fh, '<', $article_filepath )
                or die "Can't open file '$article_filepath'";

            my %doc;
            $doc{title} = <$article_fh>;
            $doc{body} = do { local $/; <$article_fh> };

            $indexer->add_doc( \%doc );

            # Bail if we've reached spec'd number of docs.
            $count++;
            last if $count >= $max;
            if ( $count % $increment == 0 and $count ) {
                $indexer->commit;
                undef $indexer;
                $indexer = $self->init_indexer($count);
            }
        }
    }

    # Finish index.
    $indexer->optimize;
    $indexer->commit;

    # Return elapsed seconds.
    my $end  = gettimeofday();
    my $secs = $end - $start;
    return ( $count, $secs );
}

package BenchmarkingIndexer::Plucene;
use base qw( BenchmarkingIndexer );

use Time::HiRes qw( gettimeofday );

sub new {
    my $class = shift;
    my $self  = $class->SUPER::new(@_);

    require Plucene;
    require Plucene::Document;
    require Plucene::Document::Field;
    require Plucene::Index::Writer;
    require Plucene::Analysis::WhitespaceAnalyzer;

    $self->{index_dir} = 'plucene_index';
    $self->{engine}    = 'Plucene';
    $self->{version}   = $Plucene::VERSION;

    return $self;
}

sub init_indexer {
    my ( $self, $count ) = @_;
    my $create = $count ? 0 : 1;
    my $writer = Plucene::Index::Writer->new( $self->{index_dir},
        Plucene::Analysis::WhitespaceAnalyzer->new(), $create );
    $writer->set_mergefactor(1000);
    return $writer;
}

# Build an index, stopping at $max docs if $max > 0.
sub build_index {
    my $self = shift;
    $self->delayed_init;
    my ( $max, $increment, $article_filepaths )
        = @{$self}{qw( docs increment article_filepaths )};

    # Cause text to be stored if spec'd.
    my $field_constructor = $self->{store} ? 'Text' : 'UnStored';

    # Start timer.
    my $start = gettimeofday();

    my $writer = $self->init_indexer(0);

    my $count = 0;
    while ( $count < $max ) {
        for my $article_filepath (@$article_filepaths) {
            # The title is the first line, the body is the rest.
            open( my $article_fh, '<', $article_filepath )
                or die "Can't open file '$article_filepath'";
            my $title = <$article_fh>;
            my $body = do { local $/; <$article_fh> };

            # Add content to index.
            my $doc = Plucene::Document->new;
            $doc->add( Plucene::Document::Field->Text( title => $title ) );
            $doc->add(
                Plucene::Document::Field->$field_constructor( body => $body )
            );
            $writer->add_document($doc);

            # Bail if we've reached spec'd number of docs.
            $count++;
            last if ( $count >= $max );
            if ( $count % $increment == 0 and $count ) {
                undef $writer;
                $writer = $self->init_indexer($count);
            }
        }
    }

    # Finish index.
    $writer->optimize;

    # Return elapsed seconds.
    my $end  = gettimeofday();
    my $secs = $end - $start;
    return ( $count, $secs );
}

1;


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Monograph of Clavaria and allied Genera (Annals of Botany Memoirs No. 1) 291 (1950)

#### Original name
Clavaria mairei Battetta, 1938

### Remarks
null


text:
module Yodatra
  class ApiFormatter

    def initialize(app, &block)
      @app = app
      @block = block if block_given?
    end

    def call(env)
      dup._call(env)
    end

    def _call(env)
      status, headers, response = @app.call(env)

      status, headers, response = @block.yield(status, headers, response) unless @block.nil?

      headers['Content-Length'] = response.first.bytes.count.to_s unless response.nil? || !response.respond_to?(:first) || response.first.nil?

      [status, headers, response]
    end

  end
end


text:
compareimages
=========

A CIDifferenceBlend and a CIAreaMaximum (Core Image filters CIFilter) used in a command line tool to compare image files.

### Uses

Objective-C, Cocoa, OS X, CoreImage.

### Produced

A command line tool "compareimages" to compare images.

### Requirements

10.9, Xcode 5.0.1.

The following is a print usage output produced if you call the command line tool without any parameters.

	Compare image files.

	Find maximum pixel value difference between two images. Compare this difference against distance parameter.
	If image files have different dimensions then return "DIFFERENT".
	If comparison of any pixel between images is greater than -distance return "DIFFERENT" otherwise return "SAME".

	compareimages - usage:
	    ./compareimages [-parameter <value> ...]
	    parameters are all preceded by a -<parameterName>.  The order of the parameters is unimportant.
	    Required parameters are -file1 <File1URL> -file2 <File1URL>.
	    Required parameters:
	        -file1 <File1URL> The first image file for comparison.
	        -file2 <File2URL> The second image file for comparison.
	    Optional parameter:
	        -distance <X> The chromatic difference in any color component for comparison. Default 10. Range 0 to 255.

	    Examples of compareimages usage:
	        A fairly loose idea of what constitutes as two images being the same.
	            ./compareimages -file1 "~/Pictures/file1.png" -file2 "~/Desktop/file2.png" -distance 30
	        The pixel values in image 1 have to be exactly the same as image 2 to report images as the same.
	            ./compareimages -file1 "~/Pictures/file1.png" -file2 "~/Desktop/file2.png" -distance 0


text:
extern "C" double getUnixTimeAsDouble();
#else
double getUnixTimeAsDouble();
#endif

#endif


text:
sidebar_label: FileChooser.isMultiple
---

# FileChooser.isMultiple() method

Whether file chooser allow for [multiple](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple) file selection.

#### Signature:

```typescript
class FileChooser {
  isMultiple(): boolean;
}
```

**Returns:**

boolean


text:
"""
Step implementations for table-related features
"""

from __future__ import absolute_import, print_function, unicode_literals

from behave import given, then, when

from docx import Document
from docx.table import (
    _Cell, _Column, _ColumnCells, _Columns, _Row, _RowCells, _Rows
)

from helpers import test_docx

# given ===================================================

@given('a 2 x 2 table')
def given_a_2x2_table(context):
    context.table_ = Document().add_table(rows=2, cols=2)

@given('a column cell collection having two cells')
def given_a_column_cell_collection_having_two_cells(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    context.cells = document.tables[0].columns[0].cells

@given('a column collection having two columns')
def given_a_column_collection_having_two_columns(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    context.columns = document.tables[0].columns

@given('a row cell collection having two cells')
def given_a_row_cell_collection_having_two_cells(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    context.cells = document.tables[0].rows[0].cells

@given('a row collection having two rows')
def given_a_row_collection_having_two_rows(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    context.rows = document.tables[0].rows

@given('a table')
def given_a_table(context):
    context.table_ = Document().add_table(rows=2, cols=2)

@given('a table having an applied style')
def given_a_table_having_an_applied_style(context):
    docx_path = test_docx('tbl-having-applied-style')
    document = Document(docx_path)
    context.table_ = document.tables[0]

@given('a table having two columns')
def given_a_table_having_two_columns(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    # context.table is used internally by behave, underscore added
    # to distinguish this one
    context.table_ = document.tables[0]

@given('a table having two rows')
def given_a_table_having_two_rows(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    context.table_ = document.tables[0]

@given('a table column having two cells')
def given_a_table_column_having_two_cells(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    context.column = document.tables[0].columns[0]

@given('a table row having two cells')
def given_a_table_row_having_two_cells(context):
    docx_path = test_docx('blk-containing-table')
    document = Document(docx_path)
    context.row = document.tables[0].rows[0]

# when =====================================================

@when('I add a column to the table')
def when_add_column_to_table(context):
    table = context.table_
    context.column = table.add_column()

@when('I add a row to the table')
def when_add_row_to_table(context):
    table = context.table_
    context.row = table.add_row()

@when('I apply a style to the table')
def when_apply_style_to_table(context):
    table = context.table_
    table.style = 'LightShading-Accent1'

# then =====================================================

@then('I can access a cell using its row and column indices')
def then_can_access_cell_using_its_row_and_col_indices(context):
    table = context.table_
    for row_idx in range(2):
        for col_idx in range(2):
            cell = table.cell(row_idx, col_idx)
            assert isinstance(cell, _Cell)

@then('I can access a collection column by index')
def then_can_access_collection_column_by_index(context):
    columns = context.columns
    for idx in range(2):
        column = columns[idx]
        assert isinstance(column, _Column)

@then('I can access a collection row by index')
def then_can_access_collection_row_by_index(context):
    rows = context.rows
    for idx in range(2):
        row = rows[idx]
        assert isinstance(row, _Row)

@then('I can access a column cell by index')
def then_can_access_column_cell_by_index(context):
    cells = context.cells
    for idx in range(2):
        cell = cells[idx]
        assert isinstance(cell, _Cell)

@then('I can access a row cell by index')
def then_can_access_row_cell_by_index(context):
    cells = context.cells
    for idx in range(2):
        cell = cells[idx]
        assert isinstance(cell, _Cell)

@then('I can access the cell collection of the column')
def then_can_access_cell_collection_of_column(context):
    column = context.column
    cells = column.cells
    assert isinstance(cells, _ColumnCells)

@then('I can access the cell collection of the row')
def then_can_access_cell_collection_of_row(context):
    row = context.row
    cells = row.cells
    assert isinstance(cells, _RowCells)

@then('I can access the column collection of the table')
def then_can_access_column_collection_of_table(context):
    table = context.table_
    columns = table.columns
    assert isinstance(columns, _Columns)

@then('I can access the row collection of the table')
def then_can_access_row_collection_of_table(context):
    table = context.table_
    rows = table.rows
    assert isinstance(rows, _Rows)

@then('I can get the length of the column cell collection')
def then_can_get_length_of_column_cell_collection(context):
    column = context.column
    cells = column.cells
    assert len(cells) == 2

@then('I can get the length of the row cell collection')
def then_can_get_length_of_row_cell_collection(context):
    row = context.row
    cells = row.cells
    assert len(cells) == 2

@then('I can get the table style name')
def then_can_get_table_style_name(context):
    table = context.table_
    msg = "got '%s'" % table.style
    assert table.style == 'LightShading-Accent1', msg

@then('I can iterate over the column cells')
def then_can_iterate_over_the_column_cells(context):
    cells = context.cells
    actual_count = 0
    for cell in cells:
        actual_count += 1
        assert isinstance(cell, _Cell)
    assert actual_count == 2

@then('I can iterate over the column collection')
def then_can_iterate_over_column_collection(context):
    columns = context.columns
    actual_count = 0
    for column in columns:
        actual_count += 1
        assert isinstance(column, _Column)
    assert actual_count == 2

@then('I can iterate over the row cells')
def then_can_iterate_over_the_row_cells(context):
    cells = context.cells
    actual_count = 0
    for cell in cells:
        actual_count += 1
        assert isinstance(cell, _Cell)
    assert actual_count == 2

@then('I can iterate over the row collection')
def then_can_iterate_over_row_collection(context):
    rows = context.rows
    actual_count = 0
    for row in rows:
        actual_count += 1
        assert isinstance(row, _Row)
    assert actual_count == 2

@then('the length of the column collection is 2')
def then_len_of_column_collection_is_2(context):
    columns = context.table_.columns
    assert len(columns) == 2

@then('the length of the row collection is 2')
def then_len_of_row_collection_is_2(context):
    rows = context.table_.rows
    assert len(rows) == 2

@then('the new column has 2 cells')
def then_new_column_has_2_cells(context):
    assert len(context.column.cells) == 2

@then('the new row has 2 cells')
def then_new_row_has_2_cells(context):
    assert len(context.row.cells) == 2

@then('the table style matches the name I applied')
def then_table_style_matches_name_applied(context):
    table = context.table_
    tmpl = "table.style doesn't match, got '%s'"
    assert table.style == 'LightShading-Accent1', tmpl % table.style

@then('the table has {count} columns')
def then_table_has_count_columns(context, count):
    column_count = int(count)
    columns = context.table_.columns
    assert len(columns) == column_count

@then('the table has {count} rows')
def then_table_has_count_rows(context, count):
    row_count = int(count)
    rows = context.table_.rows
    assert len(rows) == row_count


text:
"""
Bugsnag
=======

The official Python notifier for `Bugsnag <https://bugsnag.com/>`_.
Provides support for automatically capturing and sending exceptions
in your Django and other Python apps to Bugsnag, to help you find
and solve your bugs as fast as possible.
"""

from setuptools import setup, find_packages

setup(
    name='bugsnag',
    version='3.2.0',
    description='Automatic error monitoring for django, flask, etc.',
    long_description=__doc__,
    author='Simon Maynard',
    author_email='simon@bugsnag.com',
    url='https://bugsnag.com/',
    license='MIT',
    packages=find_packages(),
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Topic :: Software Development'
    ],
    test_suite='nose.collector',
    install_requires=['webob', 'six>=1.9,<2'],
    extras_require={
        'flask': ['flask', 'blinker']
    },
)


text:
@echo off

rem Author:   Andrey Dibrov (andry at inbox dot ru)

rem Description:
rem   Script tryes to call x32 cmd interpreter under any process mode otherwise
rem   it calls a cmd interpreter under current process mode
rem   (x32 under x32 or x64 under x64).

rem   If current process mode is not the x32 process mode, then the cmd.exe
rem   calls with the /C flag.

rem   Doesn't wait started process.

if "%~1" == "" exit /b -1

if "%PROCESSOR_ARCHITECTURE%" == "x86" goto X86

if exist "%SystemRoot%\Syswow64\" (
  rem Workaround:
  rem   The "start" calls cmd.exe with /K parameter, so call cmd.exe explicitly with /C paramater.
  start "" /B "%SystemRoot%\Syswow64\cmd.exe" /C %*
  exit /b
)

:X86
rem Workaround:
rem   The "start" calls cmd.exe with /K parameter, so call cmd.exe explicitly with /C paramater.
start "" /B "%SystemRoot%\System32\cmd.exe" /C %*


text:
namespace llvm {

class raw_ostream;

enum DWARFSectionKind {
  DW_SECT_INFO = 1,
  DW_SECT_TYPES,
  DW_SECT_ABBREV,
  DW_SECT_LINE,
  DW_SECT_LOC,
  DW_SECT_STR_OFFSETS,
  DW_SECT_MACINFO,
  DW_SECT_MACRO,
};

class DWARFUnitIndex {
  struct Header {
    uint32_t Version;
    uint32_t NumColumns;
    uint32_t NumUnits;
    uint32_t NumBuckets = 0;

    bool parse(DataExtractor IndexData, uint64_t *OffsetPtr);
    void dump(raw_ostream &OS) const;
  };

public:
  class Entry {
  public:
    struct SectionContribution {
      uint32_t Offset;
      uint32_t Length;
    };

  private:
    const DWARFUnitIndex *Index;
    uint64_t Signature;
    std::unique_ptr<SectionContribution[]> Contributions;
    friend class DWARFUnitIndex;

  public:
    const SectionContribution *getOffset(DWARFSectionKind Sec) const;
    const SectionContribution *getOffset() const;

    const SectionContribution *getOffsets() const {
      return Contributions.get();
    }

    uint64_t getSignature() const { return Signature; }
  };

private:
  struct Header Header;

  DWARFSectionKind InfoColumnKind;
  int InfoColumn = -1;
  std::unique_ptr<DWARFSectionKind[]> ColumnKinds;
  std::unique_ptr<Entry[]> Rows;
  mutable std::vector<Entry *> OffsetLookup;

  static StringRef getColumnHeader(DWARFSectionKind DS);

  bool parseImpl(DataExtractor IndexData);

public:
  DWARFUnitIndex(DWARFSectionKind InfoColumnKind)
      : InfoColumnKind(InfoColumnKind) {}

  explicit operator bool() const { return Header.NumBuckets; }

  bool parse(DataExtractor IndexData);
  void dump(raw_ostream &OS) const;

  const Entry *getFromOffset(uint32_t Offset) const;
  const Entry *getFromHash(uint64_t Offset) const;

  ArrayRef<DWARFSectionKind> getColumnKinds() const {
    return makeArrayRef(ColumnKinds.get(), Header.NumColumns);
  }

  ArrayRef<Entry> getRows() const {
    return makeArrayRef(Rows.get(), Header.NumBuckets);
  }
};

} // end namespace llvm

#endif // LLVM_DEBUGINFO_DWARF_DWARFUNITINDEX_H


text:
package dao

import (
	"context"

	"go-common/app/infra/canal/model"
	"go-common/library/database/sql"
	"go-common/library/log"
)

const (
	_tidbPositonSQL       = "SELECT name, cluster_id, offset, tso FROM  tidb_info WHERE name = ?"
	_updateTidbPositonSQL = "INSERT INTO tidb_info(name, cluster_id, offset, tso) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE offset = ?, tso = ?"
)

// TiDBPosition get tidb positon
func (d *Dao) TiDBPosition(c context.Context, name string) (res *model.TiDBInfo, err error) {
	res = &model.TiDBInfo{}
	if err = d.db.QueryRow(c, _tidbPositonSQL, name).Scan(&res.Name, &res.ClusterID, &res.Offset, &res.CommitTS); err != nil {
		if err == sql.ErrNoRows {
			res = nil
			err = nil
			return
		}
		log.Error("db.TidbPosition.Query error(%v,%v,%v)", _tidbPositonSQL, name, err)
		return
	}
	return
}

// UpdateTiDBPosition update tidb position
func (d *Dao) UpdateTiDBPosition(c context.Context, info *model.TiDBInfo) (err error) {
	if info == nil {
		return
	}
	if _, err = d.db.Exec(c, _updateTidbPositonSQL, info.Name, info.ClusterID, info.Offset, info.CommitTS, info.Offset, info.CommitTS); err != nil {
		log.Error("db.UpdateTiDBPosition.Exec error(%v,%+v,%v)", _updateTidbPositonSQL, info, err)
	}
	return
}


text:
using System.Diagnostics;

namespace Octokit
{
    [DebuggerDisplay("{DebuggerDisplay,nq}")]
    public class IssueEventPayload : ActivityPayload
    {
        public string Action { get; private set; }
        public Issue Issue { get; private set; }
    }
}


text:
@interface JRCoreTextController ()

@property (nonatomic, strong) JRParagraphView	*paragraphView;

@property (nonatomic, strong) JRTableView	*tableView;

@end

@implementation JRCoreTextController

- (void)viewDidLoad {
    [super viewDidLoad];

	[self drawTextDemo];
}

///
- (void)drawTextDemo {
	/// 0. JRTranslateCTMView
	//	JRTranslateCTMView *imgView = [[JRTranslateCTMView alloc] initWithFrame:CGRectMake(20,
	//															80, SCREEN_W - 40, SCREEN_W - 40)];
	//	imgView.backgroundColor = [UIColor yellowColor];
	//	[self.view addSubview:imgView];

	/// 1. JRParagraphView
	self.paragraphView = [[JRParagraphView alloc] initWithFrame:CGRectMake(20, 80, SCREEN_W - 40, 100)];
	self.paragraphView.backgroundColor = [UIColor lightGrayColor];
	[self.view addSubview:self.paragraphView];

	/// 2. JRSimpleTextView
	JRSimpleTextView *simpleText = [[JRSimpleTextView alloc] initWithFrame:CGRectMake(20,
																					  200, SCREEN_W - 40, 100)];
	simpleText.backgroundColor = [UIColor yellowColor];
	[self.view addSubview:simpleText];

	/// 3. JRColumnarLayoutView
	JRColumnarLayoutView *layoutView = [[JRColumnarLayoutView alloc] initWithFrame:CGRectMake(20,
																							  320, SCREEN_W - 40, 100)];
	layoutView.backgroundColor = [UIColor yellowColor];
	[self.view addSubview:layoutView];

	/// 4. JRManualLineBreakingView
	JRManualLineBreakingView *breakView = [[JRManualLineBreakingView alloc] initWithFrame:CGRectMake(20, 440, SCREEN_W - 40, 100)];
	breakView.backgroundColor = [UIColor orangeColor];
	[self.view addSubview:breakView];

	/// 5. JRParagraphStyleView
	//	JRParagraphStyleView *styleView = [[JRParagraphStyleView alloc] initWithFrame:CGRectMake(20, 560, SCREEN_W - 40, 100)];
	//	styleView.backgroundColor = [UIColor yellowColor];
	//	[self.view addSubview:styleView];

	/// 7. JRNonrectangularRegionView
	JRNonrectangularRegionView *styleView = [[JRNonrectangularRegionView alloc] initWithFrame:CGRectMake(20, 560, SCREEN_W - 40, 100)];
	styleView.backgroundColor = [UIColor yellowColor];
	[self.view addSubview:styleView];

	// CFStringRef
	CFStringRef string = CFSTR("按时阿萨德阿萨德是");
	NSString *s = (__bridge NSString *)(string);
	NSLog(@"%@", s);
	//	CTFontDescriptorRef
}

@end