text:
package de.uniwue.info6.parser.visitors;

import java.util.LinkedList;

import com.akiban.sql.StandardException;
import com.akiban.sql.parser.CursorNode;
import com.akiban.sql.parser.DeleteNode;
import com.akiban.sql.parser.InsertNode;
import com.akiban.sql.parser.NodeTypes;
import com.akiban.sql.parser.OrderByList;
import com.akiban.sql.parser.QueryTreeNode;
import com.akiban.sql.parser.SelectNode;
import com.akiban.sql.parser.UpdateNode;
import com.akiban.sql.parser.Visitable;
import com.akiban.sql.parser.Visitor;

import de.uniwue.info6.parser.structures.ColumnStructure;
import de.uniwue.info6.parser.structures.OrderColumnStructure;
import de.uniwue.info6.parser.structures.Structure;
import de.uniwue.info6.parser.structures.TableStructure;

/**
 * Root visitor, delegates node to an according visitor.
 *
 * @author Christian
 *
 */
public class RootVisitor implements Visitor {

  private String mainKeyWord;
  private LinkedList<OrderColumnStructure> orderBys = new LinkedList<OrderColumnStructure>();
  private LinkedList<ColumnStructure> columns = new LinkedList<ColumnStructure>();
  private LinkedList<TableStructure> tables = new LinkedList<TableStructure>();
  private LinkedList<ColumnStructure> groupBys = new LinkedList<ColumnStructure>();
  private LinkedList<ColumnStructure> targetColumns = new LinkedList<ColumnStructure>();
  private LinkedList<ColumnStructure> valueColumns = new LinkedList<ColumnStructure>();
  private Structure whereConditions;
  private Structure havingConditions;
  private int firstFetch;
  private int numFetch;
  private boolean hasSelect = false;

  /**
   * Main visit function, delegates node to an according sub visit function.
   *
   * @param node
   * @throws StandardException
   * @see com.akiban.sql.parser.Visitor#visit(com.akiban.sql.parser.Visitable)
   */
  @Override
  public Visitable visit(Visitable node) throws StandardException {

    switch (((QueryTreeNode) node).getNodeType()) {
    case NodeTypes.CURSOR_NODE:

      if (((CursorNode) node).getFetchFirstClause() != null) { // limit
        // (offset,
        // fetch
        // first)
        LimitClauseVisitor lvisitor = new LimitClauseVisitor();
        ((CursorNode) node).getFetchFirstClause().accept(lvisitor);

        firstFetch = lvisitor.getOffset();
      }

      if (((CursorNode) node).getOffsetClause() != null) { // limit
        // (offset,
        // fetch
        // first)
        LimitClauseVisitor lvisitor = new LimitClauseVisitor();
        ((CursorNode) node).getOffsetClause().accept(lvisitor);

        numFetch = lvisitor.getOffset();
      }

      break;
    case NodeTypes.SELECT_NODE:
      visit((SelectNode) node);
      break;
    case NodeTypes.DELETE_NODE: // next child is select node
      visit((DeleteNode) node);
      break;
    case NodeTypes.UPDATE_NODE: // next child is select node
      visit((UpdateNode) node);
      break;
    case NodeTypes.INSERT_NODE:
      visit((InsertNode) node);
      break;
    case NodeTypes.ORDER_BY_LIST:
      visit((OrderByList) node);
      break;
    }

    return node;

  }

  /**
   * Select node.
   *
   * @param node
   * @throws StandardException
   */
  public void visit(SelectNode node) throws StandardException {

    if (hasSelect) {
      return;
    } else {
      hasSelect = true;
    }

    setMainKeyWord("SELECT");

    SelectVisitor svisitor = new SelectVisitor(mainKeyWord);
    node.accept(svisitor);

    tables = svisitor.getTables();
    columns = svisitor.getColumns();
    whereConditions = svisitor.getWhereConditions();
    havingConditions = svisitor.getHavingConditions();
    groupBys = svisitor.getGroupBys();

  }

  /**
   * Delete node.
   *
   * @param node
   * @throws StandardException
   */
  public void visit(DeleteNode node) throws StandardException {
    setMainKeyWord("DELETE");
  }

  /**
   * Insert node.
   *
   * @param node
   * @throws StandardException
   */
  public void visit(InsertNode node) throws StandardException {

    setMainKeyWord("INSERT");

    InsertVisitor ivisitor = new InsertVisitor();
    node.accept(ivisitor);

    tables.add(ivisitor.getTable());
    targetColumns = ivisitor.getTargetColumns();
    valueColumns = ivisitor.getValueColumns();

  }

  /**
   * Update node.
   *
   * @param node
   * @throws StandardException
   */
  public void visit(UpdateNode node) throws StandardException {
    setMainKeyWord("UPDATE");
  }

  /**
   * Sub visit function for 'order by' list.
   *
   * @param node
   * @throws StandardException
   */
  public void visit(OrderByList node) throws StandardException {

    OrderByListVisitor ovisitor = new OrderByListVisitor();
    node.accept(ovisitor);

    orderBys.addAll(ovisitor.getOrderBys());

  }

  /**
   * @return first fetch
   */
  public int getFirstFetch() {
    return firstFetch;
  }

  /**
   * @return num fetch
   */
  public int getNumFetch() {
    return numFetch;
  }

  /**
   * @return main keyword
   */
  public String getMainKeyWord() {
    return mainKeyWord;
  }

  /**
   * @return columns
   */
  public LinkedList<ColumnStructure> getColumns() {
    return columns.size() == 0 ? null : columns;
  }

  public LinkedList<ColumnStructure> getTargetColumns() {
    return targetColumns.size() == 0 ? null : targetColumns;
  }

  public LinkedList<ColumnStructure> getValueColumns() {
    return valueColumns.size() == 0 ? null : valueColumns;
  }

  /**
   * @return tables
   */
  public LinkedList<TableStructure> getTables() {
    return tables.size() == 0 ? null : tables;
  }

  /**
   * @return 'group by' list
   */
  public LinkedList<ColumnStructure> getGroupBys() {
    return groupBys.size() == 0 ? null : groupBys;
  }

  /**
   * @return where conditions
   */
  public Structure getWhereConditions() {
    return whereConditions;
  }

  /**
   * @return having conditions
   */
  public Structure getHavingConditions() {
    return havingConditions;
  }

  /**
   * @param keyword
   */
  private void setMainKeyWord(String keyword) {

    if (mainKeyWord == null)
      mainKeyWord = keyword;

  }

  /**
   * @return 'order by' list
   */
  public LinkedList<OrderColumnStructure> getOrderBys() {
    return orderBys;
  }

  /* (non-Javadoc)
   * @see com.akiban.sql.parser.Visitor#visitChildrenFirst(com.akiban.sql.parser.Visitable)
   */
  @Override
  public boolean visitChildrenFirst(Visitable node) {
    return false;
  }

  /* (non-Javadoc)
   * @see com.akiban.sql.parser.Visitor#stopTraversal()
   */
  @Override
  public boolean stopTraversal() {
    return false;
  }

  /* (non-Javadoc)
   * @see com.akiban.sql.parser.Visitor#skipChildren(com.akiban.sql.parser.Visitable)
   */
  @Override
  public boolean skipChildren(Visitable node) throws StandardException {
    return false;
  }

  /*
   * (non-Javadoc)   *
   * @see java.lang.Object#toString()
   */
  public String toString() {
    return mainKeyWord
           + (columns.size() > 0 ? " " + columns.toString() + " " : "")
           + (targetColumns.size() > 0 ? " (" + targetColumns.toString() + ") " : "")
           + (valueColumns.size() > 0 ? "VALUES (" + valueColumns.toString() + ") " : "")
           + (tables.size() > 0 ? " FROM " + tables.toString() : "")
           + (whereConditions != null ? " WHERE " + whereConditions.toString() : "")
           + (groupBys.size() > 0 ? " GROUP BY " + groupBys.toString() : "")
           + (havingConditions != null ? " HAVING " + havingConditions.toString() : "")
           + (orderBys.size() > 0 ? " ORDER BY " + orderBys.toString() : "")
           + " LIMIT (" + numFetch + ", " + firstFetch + ")";
  }

}


text:
#ifndef OCILIB_OCILIB_CHECKS_H_INCLUDED
#define OCILIB_OCILIB_CHECKS_H_INCLUDED

/* ********************************************************************************************* *
                        MACROS FOR CHECKING OCI CALLS
 * ********************************************************************************************* */

#define OCI_RETVAL          call_retval
#define OCI_STATUS          ((ctx)->call_status)

#define OCI_EXEC(fct)                                                          \
    if (OCI_STATUS)                                                            \
    {                                                                          \
        OCI_STATUS = fct;                                                      \
        if (OCI_FAILURE(OCI_STATUS))                                           \
        {                                                                      \
            OCI_STATUS = (OCI_SUCCESS_WITH_INFO == OCI_STATUS);                \
            OCI_ExceptionOCI(ctx->oci_err, ctx->lib_con,                       \
                             ctx->lib_stmt, OCI_STATUS);                       \
        }                                                                      \
        else                                                                   \
        {                                                                      \
           OCI_STATUS = TRUE;                                                  \
        }                                                                      \
    }

#define OCI_GET_ATTRIB(htype, atype, handle, value, size)                                           \
                                                                                \
    OCI_EXEC                                                                                \
    (                                                                                \
        OCIAttrGet((void*)handle, (ub4)htype, (void*)value, (ub4*)size, (ub4)atype, (ctx)->oci_err) \
    )                                                                                \

#define OCI_SET_ATTRIB(htype, atype, handle, value, size)                                           \
                                                                                \
    OCI_EXEC                                                                                \
    (                                                                                \
        OCIAttrSet((void*) handle, (ub4) htype, (void*) value,                                      \
                   (ub4) size, (ub4)atype, (ctx)->oci_err)                                          \
    )                                                                                \

/* ********************************************************************************************* *
                        PARAMETER CHECKING MACROS
 * ********************************************************************************************* */

/**
 * @brief
 * Internal general purpose expression checking
 *
 * @param exp   - Expression
 * @param ret   - Return value if 'exp' is true
 *
 * @note
 * Does not throw an exception.
 *
 */

#define OCI_CHECK(exp, ret) if (exp) return (ret);

/**
 * @brief
 * Checks if a pointer passed to public function is NULL
 *
 * @param type  - Pointer type
 * @param ptr   - Pointer
 *
 * @note
 * Throws an exception if the pointer is null.
 *
 */

#define OCI_CALL_CHECK_PTR(type, ptr)                                          \
                                                                               \
    if (!(ptr))                                                                \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNullPointer(type))                    \
    }

/**
 * @brief
 * Checks if the parameters of a bind call are valid
 *
 * @param stmt      - Statement handle
 * @param name      - Bind name/literal position
 * @param data      - Input pointer to bind
 * @param type      - Input pointer type
 * @param ext_only  - is it an external  bind to check to input checking
 *
 * @note
 * Throws an exception if one of the parameters is invalid and then returns
 * FALSE.
 *
 */

#define OCI_CALL_CHECK_BIND(stmt, name, data, type, ext_only)               \
                                                                            \
    OCI_CALL_CHECK_PTR(OCI_IPC_STATEMENT, stmt)                             \
    OCI_CALL_CHECK_PTR(OCI_IPC_STRING, name)                                \
    OCI_CALL_CHECK_STMT_STATUS(stmt, OCI_STMT_PREPARED)                     \
    {                                                                       \
        boolean ext_only_value = ext_only;                                  \
        if (ext_only_value || OCI_BAM_EXTERNAL == stmt->bind_alloc_mode)    \
        OCI_CALL_CHECK_PTR(type, data)                                      \
    }                                                                       \

/**
 * @brief
 * Checks if the parameters of a register call are valid
 *
 * @param stmt  - Statement handle
 * @param name  - Bind name/literal position
 *
 * @note
 * Throws an exception if one of the parameters is invalid and returns FALSE.
 *
 */
#define OCI_CALL_CHECK_REGISTER(stmt, name)                                    \
                                                                               \
    OCI_CALL_CHECK_PTR(OCI_IPC_STATEMENT, stmt)                                \
    OCI_CALL_CHECK_PTR(OCI_IPC_STRING, name)                                   \

/* ********************************************************************************************* *
                        MISCELLANEOUS CHECKING MACROS
 * ********************************************************************************************* */

/**
 * @brief
 * Checks if an integer parameter value fits into the given bounds
 *
 * @param con - Connection handle
 * @param v   - Integer value
 * @param b1  - Lower bound
 * @param b2  - Upper bound
 *
 * @note
 * Throws an exception if the input value is out of bounds.
 *
 */

#define OCI_CALL_CHECK_BOUND(con, v, b1, b2)                                   \
                                                                               \
    if ((v < (b1)) || (v > (b2)))                                              \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionOutOfBounds((con), (v)))              \
    }

/**
 * @brief
 * Checks if an integer parameter value is >= minimum provided value
 *
 * @param con  - Connection handle
 * @param stmt - Statement handle
 * @param v    - Integer value
 * @param m    - Minimum value
 *
 * @note
 * Throws an exception if the input value is < < m.
 *
 */

#define OCI_CALL_CHECK_MIN(con, stmt, v, m)                                    \
                                                                               \
    if ((v) < (m))                                                             \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionMinimumValue((con), (stmt), (m)))     \
    }

/**
 * @brief
 * Checks if two expressions are compatible
 *
 * @param con - Connection handle
 * @param exp - Equality expression
 *
 * @note
 * Throws an exception if the 2 expressions are not compatible.
 *
 */

#define OCI_CALL_CHECK_COMPAT(con, exp)                                        \
                                                                               \
    if (!(exp))                                                                \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionTypeNotCompatible((con)))             \
    }

/* ********************************************************************************************* *
                  INTERNAL STATES/ATTRIBUTES CHECKING MACROS
 * ********************************************************************************************* */

/**
 * @brief
 * Checks if the input OCILIB object was fetched and not discartable
 *
 * @param obj - OCILIB object handle
 * @param ret - Return value
 *
 * @note
 * Returns the value 'ret' if the object was fetched from a sql statement
 *
 */

#define OCI_CALL_CHECK_OBJECT_FETCHED(obj)                                    \
                                                                              \
    if (OCI_OBJECT_FETCHED_CLEAN == (obj)->hstate)                            \
        OCI_CALL_JUMP_EXIT()

/**
 * @brief
 * Checks if the status of a OCILIB statement matches the provided one
 *
 * @param st  - Statement handle
 * @param v   - Status to compare
 *
 * @note
 * Throws an exception if the status of the statement equals the provided one.
 *
 */

#define OCI_CALL_CHECK_STMT_STATUS(st, v)                                      \
                                                                               \
    if ((((st)->status) & (v)) == 0)                                           \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionStatementState((st), v))              \
    }                                                                          \

/**
 * @brief
 * Checks if the given statement is scrollable
 *
 * @param st  - Statement handle
 *
 * @note
 * Throws an exception if the statement is not scrollable.
 *
 */

#define OCI_CALL_CHECK_SCROLLABLE_CURSOR_ACTIVATED(st)                         \
                                                                               \
    if (((st)->nb_rbinds > 0) ||                                               \
        ((st)->exec_mode != OCI_STMT_SCROLLABLE_READONLY))                     \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionStatementNotScrollable(st))           \
    }

/**
 * @brief
 * Checks if the status of a OCILIB direct path handle is compatible with the
 * given one
 *
 * @param dp  - Direct path handle
 * @param v   - Status to compare
 *
 * @note
 * Throws an exception if the status of the direct path handle is different than
 * the provided one.
 *
 */
#define OCI_CALL_CHECK_DIRPATH_STATUS(dp, v)                                   \
                                                                               \
    if ((dp)->status != (v))                                                   \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionDirPathState((dp), (dp)->status))     \
    }

/* ********************************************************************************************* *
                    INTERNAL FEATURES AVAILABILITY CHECKING MACROS
 * ********************************************************************************************* */

/**
 * @brief
 * Checks the library has been initialized
 *
 * @note
 * Returns 'ret' if the library has not been initialized
 *
 */

#define OCI_CALL_CHECK_INITIALIZED()                                           \
                                                                               \
    if (!OCILib.loaded)                                                        \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotInitialized())                     \
    }

/**
 * @brief
 * Internal check for various features
 *
 * @param con  - Connection handle
 * @param feat - Feature to check
 * @param ver  - OCI version that introduced the feature
 *
 * @note
 * Throws an exception the given feature is not available
 *
 */

#define OCI_CALL_CHECK_FEATURE(con, feat, ver)                                     \
                                                                                \
    if (OCILib.version_runtime < ver || ((con) && (con)->ver_num < ver))           \
    {                                                                              \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotAvailable(con, feat))                  \
    }

/**
 * @brief
 * Checks if multithreading mode is activated
 *
 * @note
 * Throws an exception the library has not been initialized with multithreading
 * mode
 *
 */

#define OCI_CALL_CHECK_THREAD_ENABLED()                                    \
                                                                           \
    if (!(OCI_LIB_THREADED))                                               \
    {                                                                      \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotMultithreaded())               \
    }

/**
 * @brief
 * Checks if the timestamp datatype is supported by the connection
 *
 * @param con - Connection handle
 *
 * @note
 * Throws an exception if the connection (client and server versions) does not
 * support timestamps
 *
 */

#define OCI_CALL_CHECK_TIMESTAMP_ENABLED(con)                                  \
                                                                               \
    OCI_CALL_CHECK_FEATURE(con, OCI_FEATURE_TIMESTAMP, OCI_9_0)

/**
 * @brief
 * Checks if the interval datatype is supported by the connection
 *
 * @param con - Connection handle
 *
 * @note
 * Throws an exception if the connection (client and server versions) does not
 * support intervals
 *
 */

#define OCI_CALL_CHECK_INTERVAL_ENABLED OCI_CALL_CHECK_TIMESTAMP_ENABLED

/**
 * @brief
 * Checks if the connection supports scrollable cursors
 *
 * @param con - Connection handle
 *
 * @note
 * Throws an exception if the connection (client and server versions) does not
 * support scrollable cursors
 *
 */

#define OCI_CALL_CHECK_SCROLLABLE_CURSOR_ENABLED(con)                          \
                                                                               \
    OCI_CALL_CHECK_FEATURE(con, OCI_FEATURE_SCROLLABLE_CURSOR, OCI_9_0)

/**
* @brief
* Checks if the runtime OCI version supports PL SQL Boolean, Records and Index Tables
*
* @note
* Throws an exception if the connection (client and server versions) does not support it
*
*/

#define OCI_CALL_CHECK_EXTENDED_PLSQLTYPES_ENABLED(con)                        \
                                                                               \
    OCI_CALL_CHECK_FEATURE(con, OCI_FEATURE_EXTENDED_PLSQLTYPES, OCI_12_1)

/**
 * @brief
 * Checks if the runtime OCI client supports statement caching
 *
 * @note
 * Throws an exception if the OCI client does not
 * support statement caching
 *
 */

#define OCI_CALL_CHECK_STATEMENT_CACHING_ENABLED()                             \
                                                                               \
    if (OCILib.version_runtime < OCI_9_2)                                      \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotAvailable((dp)->con,               \
                            OCI_FEATURE_STATEMENT_CACHING))                    \
    }

/**
 * @brief
 * Checks if the direct path date caching is available
 *
 * @param dp  - Direct path handle
 *
 * @note
 * Throws an exception if the Oracle client does not support date caching
 *
 */

#define OCI_CALL_CHECK_DIRPATH_DATE_CACHE_ENABLED(dp)                          \
                                                                               \
    if (OCILib.version_runtime < OCI_9_2)                                      \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotAvailable((dp)->con,               \
                            OCI_FEATURE_DIRPATH_DATE_CACHE)                    \
    }

/**
 * @brief
 * Checks if the current OCI client supports remote database startup/shutdown
 *
 * @note
 * Throws an exception if the Oracle client is < 10g R2
 *
 */

#define OCI_CALL_CHECK_REMOTE_DBS_CONTROL_ENABLED()                            \
                                                                               \
    if (OCILib.version_runtime < OCI_10_2)                                     \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotAvailable(NULL,                    \
                            OCI_FEATURE_REMOTE_DBS_CONTROL))                   \
    }

/**
 * @brief
 * Checks if the current OCI client supports database notifications
 *
 * @note
 * Throws an exception if the Oracle client is < 10g R2
 *
 */

#define OCI_CALL_CHECK_DATABASE_NOTIFY_ENABLED()                               \
                                                                               \
    if (OCILib.version_runtime < OCI_10_2)                                     \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotAvailable(NULL,                    \
                            OCI_FEATURE_DATABASE_NOTIFY))                      \
    }

/**
 * @brief
 * Checks if the runtime OCI version supports Oracle high availability
 *
 * @note
 * Throws an exception if the client version does not
 * support Oracle high availability
 *
 */

#define OCI_CALL_CHECK_HIGH_AVAILABILITY_ENABLED()                             \
                                                                               \
    if (OCILib.version_runtime < OCI_10_2)                                     \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotAvailable(NULL,                    \
                            OCI_FEATURE_HIGH_AVAILABILITY))                    \
    }

/**
 * @brief
 * Checks if the OCILIB runtime version supports Oracle XA
 *
 * @note
 * Throws an exception if the OCILIB that not support XA connections
 *
 */

#define OCI_CALL_CHECK_XA_ENABLED(mode)                                        \
                                                                               \
    if ( (mode & OCI_SESSION_XA) && (!OCILib.use_xa) )                         \
    {                                                                          \
        OCI_RAISE_EXCEPTION(OCI_ExceptionNotAvailable(NULL, OCI_FEATURE_XA))   \
    }

#define OCI_CALL_CHECK_ENUM_VALUE(con, stmt, mode, values, name)               \
    {                                                                          \
        size_t ii = 0, nn = sizeof(values) / sizeof(values[0]);                \
        for (; ii < nn; ii++) { if (mode == values[ii]) break; }               \
        if (ii >= nn)                                                          \
        {                                                                      \
            OCI_RAISE_EXCEPTION(OCI_ExceptionArgInvalidValue(con, stmt,        \
                                                             name, mode))      \
        }                                                                      \
    }

#endif    /* OCILIB_OCILIB_CHECKS_H_INCLUDED */

redpajama_set_name: RedPajamaGithub


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

namespace Azure.ResourceManager.Storage.Models
{
    /// <summary> The BlobServiceItems. </summary>
    public partial class BlobServiceItems
    {
        /// <summary> Initializes a new instance of BlobServiceItems. </summary>
        internal BlobServiceItems()
        {
            Value = new ChangeTrackingList<BlobServiceProperties>();
        }

        /// <summary> Initializes a new instance of BlobServiceItems. </summary>
        /// <param name="value"> List of blob services returned. </param>
        internal BlobServiceItems(IReadOnlyList<BlobServiceProperties> value)
        {
            Value = value;
        }

        /// <summary> List of blob services returned. </summary>
        public IReadOnlyList<BlobServiceProperties> Value { get; }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:gravity="center"
    android:orientation="vertical" >

    <ImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@drawable/test" />

    <ImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="10dp"
        android:src="@drawable/test" />

    <TextView
        android:layout_width="200dp"
        android:layout_height="100dp"
        android:background="@drawable/test"
        android:text="@string/for_test_string_long"/>

</LinearLayout>


text:
niclabs.insight.info.ChartistBlock = (function($) {
    /**
     * Configuration options for chartist charts
     *
     * @typedef niclabs.insight.info.ChartistBlock.Chartist
     * @type {Object}
     * @param {Object} class - chartist css class
     * @param {Object} labels - chart labels
     * @param {Object=} options - chartist options
     * @param {Object=} responsiveOptions - chartist responsive options
     */

    /**
     * Construct a new chartist information block
     *
     * For the configuration options see {@link http://gionkunz.github.io/chartist-js/}
     *
     * @class niclabs.insight.info.ChartistBlock
     * @augments niclabs.insight.info.Block
     * @inheritdoc
     * @param {niclabs.insight.Dashboard} dashboard - parent dashboard for the block
     * @param {Object} constructor - chartist object to use as constructor
     * @param {Object} options - configuration options for the block
     * @param {string} options.id - html identifier for the block
     * @param {string=} options.title - title for the block
     * @param {niclabs.insight.info.ChartistBlock.Chartist} options.chartist - chartist configuration
     * @param {boolean} [options.closable=true] - make the block closable
     * @param {boolean} [options.movable=true] - make the block movable
     * @param {Object|Object[]|Function|String} [options.data] - data for the block,
     *  it can be an object or a list of objects, a callable that returns the data for the block, a layer id (preceded by '#')
     *  or a url where to get the data. If a layer is provided, events from the layer ({@link niclabs.insight.MapView#map_element_selected},
     *  {@link niclabs.insight.layer.Layer#layer_sumary}) will update the data in the block. If no data is provided, it is assumed
     *  that all layers affect the block and events from all layers will update the block data. If data depends on a layer
     *  options.defaults can be used to set the default data
     * @param {Function} options.preprocess - function to apply on the data (either from an url or a layer) before refreshing the block
     * @param {Object|Object[]} [options.defaults] - when the data depends on a layer, defaults sets the initial data to show
     *  in the block
     */
     var ChartistBlock = function (dashboard, constructor, options) {
         var self = niclabs.insight.info.Block(dashboard, options);

         var chartist = options.chartist;

         self.content.addClass('chartist-viz').append( $('<div>').addClass(chartist.class));

         var chartistOptions = chartist.options || {};
         var responsiveOptions = chartist.responsiveOptions || {};
         var labels = chartist.labels;

         // Store the chart object
         var chart;

         var refresh = self.refresh;

         self.refresh = function(data) {
             data = typeof data === 'undefined' ? self.data() : data;

             // Call the parent
             refresh(data);

             // Look for 'value' key in data
             data = data.value || data;

             var chartData  = {
               'series': data,
               'labels': typeof labels === 'function' ? labels(data) : labels
             };

             if (chart && chart.optionsProvider) {
                 chart.update(chartData);
             }
             else {
                 chart = new constructor((self.content.find('div'))[0], chartData , chartistOptions, responsiveOptions);
             }
         };

         var remove = self.remove;

         // Override remove method
         self.remove = function() {
             // Call the parent
             remove();

             chart.detach();
         };

         // Refresh the block
         // TODO: what if the data comes from a url that has not finished loading yet?
         self.refresh();

         return self;
     };

     var ChartistLineChartBlock = function(dashboard, options) {
        var self = ChartistBlock(dashboard, Chartist.Line, options);
        return self;
     };

     var ChartistBarChartBlock = function(dashboard, options) {
        var self = ChartistBlock(dashboard, Chartist.Bar, options);
        return self;
    };

    var ChartistPieChartBlock = function(dashboard, options) {
       var self = ChartistBlock(dashboard, Chartist.Pie, options);
       return self;
    };

     // Register the handler
     niclabs.insight.handler('chartist-linechart', 'info-block', ChartistLineChartBlock);
     niclabs.insight.handler('chartist-barchart', 'info-block', ChartistBarChartBlock);
     niclabs.insight.handler('chartist-piechart', 'info-block', ChartistPieChartBlock);

     return ChartistBlock;
 })(jQuery);


text:
package org.gearvrf;

/** A {@link GVRCamera camera} with a perspective projection. */
public class GVRPerspectiveCamera extends GVRCamera implements GVRCameraClippingDistanceInterface {
    /**
     * Constructor.
     *
     * @param gvrContext
     *            {@link GVRContext} the app is using.
     */
    public GVRPerspectiveCamera(GVRContext gvrContext) {
        super(gvrContext, NativePerspectiveCamera.ctor());
    }

    /**
     * @return The global default 'y' field of view, in degrees.
     */
    public static float getDefaultFovY() {
        return NativePerspectiveCamera.getDefaultFovY();
    }

    /**
     * Sets the global default 'y' field of view, in degrees.
     *
     * @param fovY
     *            The default 'y' field of view, in degrees.
     */
    public static void setDefaultFovY(float fovY) {
        NativePerspectiveCamera.setDefaultFovY(fovY);
    }

    /**
     * @return The global default aspect ratio (width/height).
     */
    public static float getDefaultAspectRatio() {
        return NativePerspectiveCamera.getDefaultAspectRatio();
    }

    /**
     * Sets the global default aspect ratio (width/height).
     *
     * @param aspectRatio
     *            The default aspect ratio.
     */
    public static void setDefaultAspectRatio(float aspectRatio) {
        NativePerspectiveCamera.setDefaultAspectRatio(aspectRatio);
    }

    /**
     * @return Distance from the origin to the near clipping plane for this
     *         camera.
     */
    @Override
    public float getNearClippingDistance() {
        return NativePerspectiveCamera.getNearClippingDistance(getNative());
    }

    /**
     * Sets the distance from the origin to the near clipping plane for this
     * camera.
     *
     * @param near
     *            Distance to the near clipping plane.
     */
    @Override
    public void setNearClippingDistance(float near) {
        NativePerspectiveCamera.setNearClippingDistance(getNative(), near);
    }

    /**
     * @return Distance from the origin to the far clipping plane for this
     *         camera.
     */
    @Override
    public float getFarClippingDistance() {
        return NativePerspectiveCamera.getFarClippingDistance(getNative());
    }

    /**
     * Sets the distance from the origin to the far clipping plane for this
     * camera.
     *
     * @param far
     *            Distance to the far clipping plane.
     */
    @Override
    public void setFarClippingDistance(float far) {
        NativePerspectiveCamera.setFarClippingDistance(getNative(), far);
    }

    /**
     * @return The 'y' field of view, in degrees, for this camera.
     */
    public float getFovY() {
        return NativePerspectiveCamera.getFovY(getNative());
    }

    /**
     * Sets the 'y' field of view, in degrees, for this camera.
     *
     * @param fovY
     *            The 'y' field of view, in degrees.
     */
    public void setFovY(float fovY) {
        NativePerspectiveCamera.setFovY(getNative(), fovY);
    }

    /**
     * @return The aspect ratio (width/height) for this camera.
     */
    public float getAspectRatio() {
        return NativePerspectiveCamera.getAspectRatio(getNative());
    }

    /**
     * Sets the aspect ratio (width/height) for this camera.
     *
     * @param aspectRatio
     *            The aspect ratio.
     */
    public void setAspectRatio(float aspectRatio) {
        NativePerspectiveCamera.setAspectRatio(getNative(), aspectRatio);
    }
}

class NativePerspectiveCamera {
    static native long ctor();

    static native float getDefaultFovY();

    static native void setDefaultFovY(float fovY);

    static native float getDefaultAspectRatio();

    static native void setDefaultAspectRatio(float aspectRatio);

    static native float getNearClippingDistance(long camera);

    static native void setNearClippingDistance(long camera, float near);

    static native float getFarClippingDistance(long camera);

    static native void setFarClippingDistance(long camera, float far);

    static native float getFovY(long camera);

    static native void setFovY(long camera, float fovY);

    static native float getAspectRatio(long camera);

    static native void setAspectRatio(long camera, float aspectRatio);
}


text:
package org.wso2.carbon.device.mgt.extensions.device.type.template;

import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceStatusTaskPluginConfig;
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.general.GeneralConfig;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceStatusTaskConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PolicyMonitoring;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PullNotificationSubscriberConfig;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PushNotificationProvider;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.TaskConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException;
import org.wso2.carbon.device.mgt.extensions.utils.Utils;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.xml.sax.SAXException;

import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import static org.powermock.api.mockito.PowerMockito.when;

/**
 * This is the test class for {@link DeviceTypeManagerService}
 */
public class DeviceTypeManagerServiceTest {
    private DeviceTypeManagerService androidDeviceTypeManagerService;
    private DeviceTypeConfiguration androidDeviceConfiguration;
    private DeviceTypeManagerService rasberrypiDeviceTypeManagerService;
    private DeviceTypeConfiguration rasberrypiDeviceConfiguration;
    private DeviceTypeManagerService arduinoDeviceTypeManagerService;
    private DeviceTypeConfiguration arduinoDeviceTypeConfiguration;
    private Method setProvisioningConfig;
    private Method setOperationMonitoringConfig;
    private Method setDeviceStatusTaskPluginConfig;
    private Method populatePushNotificationConfig;
    private Method setPolicyMonitoringManager;
    private Method setPullNotificationSubscriber;
    private Method setGeneralConfig;

    @BeforeClass
    public void setup() throws NoSuchMethodException, SAXException, JAXBException, ParserConfigurationException,
            DeviceTypeConfigurationException, IOException, NoSuchFieldException, IllegalAccessException,
            DeviceManagementException, RegistryException {
        ClassLoader classLoader = getClass().getClassLoader();

        setProvisioningConfig = DeviceTypeManagerService.class
                .getDeclaredMethod("setProvisioningConfig", String.class, DeviceTypeConfiguration.class);
        setProvisioningConfig.setAccessible(true);
        setDeviceStatusTaskPluginConfig = DeviceTypeManagerService.class
                .getDeclaredMethod("setDeviceStatusTaskPluginConfig", DeviceStatusTaskConfiguration.class);
        setDeviceStatusTaskPluginConfig.setAccessible(true);
        setOperationMonitoringConfig = DeviceTypeManagerService.class
                .getDeclaredMethod("setOperationMonitoringConfig", DeviceTypeConfiguration.class);
        setOperationMonitoringConfig.setAccessible(true);
        populatePushNotificationConfig = DeviceTypeManagerService.class
                .getDeclaredMethod("populatePushNotificationConfig", PushNotificationProvider.class);
        populatePushNotificationConfig.setAccessible(true);
        setPolicyMonitoringManager = DeviceTypeManagerService.class
                .getDeclaredMethod("setPolicyMonitoringManager", PolicyMonitoring.class);
        setPolicyMonitoringManager.setAccessible(true);
        setPullNotificationSubscriber = DeviceTypeManagerService.class
                .getDeclaredMethod("setPullNotificationSubscriber", PullNotificationSubscriberConfig.class);
        setPullNotificationSubscriber.setAccessible(true);

        setGeneralConfig = DeviceTypeManagerService.class
                .getDeclaredMethod("setGeneralConfig", DeviceTypeConfiguration.class);
        setGeneralConfig.setAccessible(true);

        Field deviceStatusTaskPluginConfig = DeviceTypeManagerService.class
                .getDeclaredField("deviceStatusTaskPluginConfig");
        deviceStatusTaskPluginConfig.setAccessible(true);

        Field generalConfig = DeviceTypeManagerService.class
                .getDeclaredField("generalConfig");
        generalConfig.setAccessible(true);

        Field operationMonitoringConfigs = DeviceTypeManagerService.class
                .getDeclaredField("operationMonitoringConfigs");
        operationMonitoringConfigs.setAccessible(true);

        Field initialOperationConfig = DeviceTypeManagerService.class.getDeclaredField("initialOperationConfig");
        initialOperationConfig.setAccessible(true);

        Field deviceManager = DeviceTypeManagerService.class.getDeclaredField("deviceManager");
        deviceManager.setAccessible(true);

        androidDeviceTypeManagerService = Mockito.mock(DeviceTypeManagerService.class, Mockito.CALLS_REAL_METHODS);
        deviceStatusTaskPluginConfig.set(androidDeviceTypeManagerService, new DeviceStatusTaskPluginConfig());
        operationMonitoringConfigs.set(androidDeviceTypeManagerService, new OperationMonitoringTaskConfig());
        initialOperationConfig.set(androidDeviceTypeManagerService, new InitialOperationConfig());

        rasberrypiDeviceTypeManagerService = Mockito.mock(DeviceTypeManagerService.class, Mockito.CALLS_REAL_METHODS);
        deviceStatusTaskPluginConfig.set(rasberrypiDeviceTypeManagerService, new DeviceStatusTaskPluginConfig());
        operationMonitoringConfigs.set(rasberrypiDeviceTypeManagerService, new OperationMonitoringTaskConfig());
        initialOperationConfig.set(rasberrypiDeviceTypeManagerService, new InitialOperationConfig());

        URL resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "android.xml");

        File androidConfiguration = null;
        if (resourceUrl != null) {
            androidConfiguration = new File(resourceUrl.getFile());
        }
        androidDeviceConfiguration = Utils.getDeviceTypeConfiguration(androidConfiguration);

        resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "raspberrypi.xml");
        File raspberrypiConfiguration = null;
        if (resourceUrl != null) {
            raspberrypiConfiguration = new File(resourceUrl.getFile());
        }
        rasberrypiDeviceConfiguration = Utils.getDeviceTypeConfiguration(raspberrypiConfiguration);

        PlatformConfiguration platformConfiguration = new PlatformConfiguration();
        platformConfiguration.setType("android");
        List<ConfigurationEntry> configurationEntries = new ArrayList<>();
        ConfigurationEntry configurationEntry = new ConfigurationEntry();
        configurationEntry.setValue("10");
        configurationEntry.setName("frequency");
        configurationEntry.setContentType("Integer");

        configurationEntries.add(configurationEntry);
        platformConfiguration.setConfiguration(configurationEntries);
        DeviceTypeManager deviceTypeManager = Mockito.mock(DeviceTypeManager.class);
        when(deviceTypeManager.getConfiguration()).thenReturn(platformConfiguration);
        deviceManager.set(androidDeviceTypeManagerService, deviceTypeManager);
        setupArduinoDeviceType();
    }

    @Test(description = "This test cases tests the retrieval of provisioning config after providing the configurations "
            + "values")
    public void testWithProvisioningConfig() throws Exception {
        boolean isRasberryPiSharedWithTenants =
                (rasberrypiDeviceConfiguration.getProvisioningConfig() != null) && rasberrypiDeviceConfiguration
                        .getProvisioningConfig().isSharedWithAllTenants();
        setProvisioningConfig.invoke(androidDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME,
                androidDeviceConfiguration);
        ProvisioningConfig provisioningConfig = androidDeviceTypeManagerService.getProvisioningConfig();
        Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(),
                androidDeviceConfiguration.getProvisioningConfig().isSharedWithAllTenants(),
                "Provisioning configs are not correctly set as per the configuration file provided");

        setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME,
                rasberrypiDeviceConfiguration);
        provisioningConfig = rasberrypiDeviceTypeManagerService.getProvisioningConfig();
        Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), isRasberryPiSharedWithTenants,
                "Provisioning configs are not correctly set as per the configuration file provided.");
    }

    @Test (description = "This test case tests the Device task config retrieval")
    public void testDeviceStatusTaskConfig () throws InvocationTargetException, IllegalAccessException {
        setDeviceStatusTaskPluginConfig
                .invoke(androidDeviceTypeManagerService, androidDeviceConfiguration.getDeviceStatusTaskConfiguration());
        DeviceStatusTaskPluginConfig deviceStatusTaskPuginConfig = androidDeviceTypeManagerService
                .getDeviceStatusTaskPluginConfig();
        DeviceStatusTaskConfiguration deviceStatusTaskConfiguration = androidDeviceConfiguration
                .getDeviceStatusTaskConfiguration();

        Assert.assertEquals(deviceStatusTaskPuginConfig.getFrequency(), deviceStatusTaskConfiguration.getFrequency(),
                "Frequency provided in the device task configuration is not set properly.");
        Assert.assertEquals(deviceStatusTaskPuginConfig.getIdleTimeToMarkInactive(),
                deviceStatusTaskConfiguration.getIdleTimeToMarkInactive(),
                "Idle time to mark inactive provided in " + "the device task configuration is not set properly.");
        Assert.assertEquals(deviceStatusTaskPuginConfig.getIdleTimeToMarkUnreachable(),
                deviceStatusTaskConfiguration.getIdleTimeToMarkUnreachable(),
                "Idle time to mark un-reachable " + "provided in the device task configuration is not set properly.");
        Assert.assertEquals(deviceStatusTaskPuginConfig.isRequireStatusMonitoring(),
                deviceStatusTaskConfiguration.isEnabled(),
                "Enabled status provided in the device task configuration" + " is not set properly");

        setDeviceStatusTaskPluginConfig.invoke(rasberrypiDeviceTypeManagerService,
                rasberrypiDeviceConfiguration.getDeviceStatusTaskConfiguration());
        deviceStatusTaskPuginConfig = rasberrypiDeviceTypeManagerService.getDeviceStatusTaskPluginConfig();
        Assert.assertEquals(deviceStatusTaskPuginConfig.getFrequency(), 0);
    }

    @Test(description = "This test case aims to test whether correct operations are listed as per the configuration "
            + "of device types")
    public void testOperationConfig() throws InvocationTargetException, IllegalAccessException {
        setOperationMonitoringConfig.invoke(androidDeviceTypeManagerService, androidDeviceConfiguration);
        OperationMonitoringTaskConfig operationMonitoringTaskConfig = androidDeviceTypeManagerService
                .getOperationMonitoringConfig();
        TaskConfiguration taskConfiguration = androidDeviceConfiguration.getTaskConfiguration();
        Assert.assertEquals(operationMonitoringTaskConfig.getFrequency(), taskConfiguration.getFrequency(),
                "Policy " + "Monitoring frequency does not match with the frequency in the configuration");
        Assert.assertEquals(operationMonitoringTaskConfig.getMonitoringOperation().size(),
                taskConfiguration.getOperations().size(),
                "Number of task configuration operations does not match with the task "
                        + "configuration operations provided in the configuration file");

        setOperationMonitoringConfig.invoke(rasberrypiDeviceTypeManagerService, rasberrypiDeviceConfiguration);
        operationMonitoringTaskConfig = rasberrypiDeviceTypeManagerService.getOperationMonitoringConfig();
        Assert.assertEquals(operationMonitoringTaskConfig.getFrequency(), 0,
                "Frequency is set for a non-existing " + "operation task configuration");
    }

    @Test(description = "This test case tests the populateNotificationConfig method and retrieval of the same.")
    public void testPopulatePushNotificationConfig() throws InvocationTargetException, IllegalAccessException {
        populatePushNotificationConfig
                .invoke(androidDeviceTypeManagerService, androidDeviceConfiguration.getPushNotificationProvider());
        PushNotificationConfig pushNotificationConfig = androidDeviceTypeManagerService.getPushNotificationConfig();
        Assert.assertNotEquals(pushNotificationConfig, null, "Push notification configuration is set even though "
                + "Push notfication configuration was not mentioned.");

        populatePushNotificationConfig.invoke(rasberrypiDeviceTypeManagerService,
                rasberrypiDeviceConfiguration.getPushNotificationProvider());
        pushNotificationConfig = rasberrypiDeviceTypeManagerService.getPushNotificationConfig();
        PushNotificationProvider pushNotificationProvider = rasberrypiDeviceConfiguration.getPushNotificationProvider();
        Assert.assertEquals(pushNotificationConfig.getType(), pushNotificationProvider.getType());
        Assert.assertEquals(pushNotificationConfig.isScheduled(), pushNotificationProvider.isScheduled());
    }

    @Test(description = "This test case tests the initial operation configuration setting and retrieval of the same.")
    public void testSetInitialOperationConfig() throws InvocationTargetException, IllegalAccessException {
        androidDeviceTypeManagerService.setInitialOperationConfig(androidDeviceConfiguration);
        InitialOperationConfig initialOperationConfig = androidDeviceTypeManagerService.getInitialOperationConfig();

        Assert.assertEquals(initialOperationConfig.getOperations().size(),androidDeviceConfiguration.getOperations()
                .size());
    }

    @Test(description = "This test case tests the policy monitoring configuration setting.")
    public void testSetPolicyMonitoring() throws InvocationTargetException, IllegalAccessException {
        setPolicyMonitoringManager
                .invoke(androidDeviceTypeManagerService, androidDeviceConfiguration.getPolicyMonitoring());
        Assert.assertEquals(androidDeviceTypeManagerService.getPolicyMonitoringManager() != null,
                (androidDeviceConfiguration.getPolicyMonitoring() != null && androidDeviceConfiguration
                        .getPolicyMonitoring().isEnabled()),
                "Policy Management configurations are added as per the " + "configuration file");
        setPolicyMonitoringManager
                .invoke(rasberrypiDeviceTypeManagerService, rasberrypiDeviceConfiguration.getPolicyMonitoring());
        Assert.assertEquals(rasberrypiDeviceTypeManagerService.getPolicyMonitoringManager() != null,
                (rasberrypiDeviceConfiguration.getPolicyMonitoring() != null && rasberrypiDeviceConfiguration
                        .getPolicyMonitoring().isEnabled()),
                "Policy Management configurations are added as " + "per the " + "configuration file");
    }

    @Test (description = "This test case tests whether the Pull Notification Subscriber is set correctly.")
    public void testSetPullNotificationSubscriberConfig() throws InvocationTargetException, IllegalAccessException {
        setPullNotificationSubscriber.invoke(androidDeviceTypeManagerService, androidDeviceConfiguration
                .getPullNotificationSubscriberConfig());
        Assert.assertEquals(androidDeviceTypeManagerService.getPullNotificationSubscriber() != null,
                androidDeviceConfiguration.getPullNotificationSubscriberConfig() != null);
        setPullNotificationSubscriber.invoke(rasberrypiDeviceTypeManagerService, rasberrypiDeviceConfiguration
                .getPullNotificationSubscriberConfig());
        Assert.assertEquals(rasberrypiDeviceTypeManagerService.getPullNotificationSubscriber() != null,
                rasberrypiDeviceConfiguration.getPullNotificationSubscriberConfig() != null);

    }

    @Test (description = "This test case tests the addition and retrieval of the license")
    public void testGetLicense () throws LicenseManagementException {
        License license = arduinoDeviceTypeManagerService.getDeviceManager().getLicense("en_Us");
        Assert.assertEquals(license.getText(), arduinoDeviceTypeConfiguration.getLicense().getText(),
                "The retrieved" + " license is different from added license");
        license.setLanguage("eu");
        license.setText("This is a EU License");
        arduinoDeviceTypeManagerService.getDeviceManager().addLicense(license);
        License newLicense = arduinoDeviceTypeManagerService.getDeviceManager().getLicense("eu");
        Assert.assertEquals(newLicense.getText(), license.getText(),
                "The retrieved license is different from added license");
        Assert.assertNull(arduinoDeviceTypeManagerService.getDeviceManager().getLicense("tn"),
                "License is retrieved for a non-existing language code");
    }

    /**
     * Setting the Arduino Device Type
     * @throws RegistryException Registry Exception
     * @throws IOException IO Exception
     * @throws SAXException SAX Exception
     * @throws ParserConfigurationException Parser Configuration Exception
     * @throws DeviceTypeConfigurationException Device Type Configuration Exception
     * @throws JAXBException JAXB Exception
     */
    private void setupArduinoDeviceType()
            throws RegistryException, IOException, SAXException, ParserConfigurationException,
            DeviceTypeConfigurationException, JAXBException {
        ClassLoader classLoader = getClass().getClassLoader();
        URL resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "arduino.xml");
        File arduinoConfiguration = null;
        if (resourceUrl != null) {
            arduinoConfiguration = new File(resourceUrl.getFile());
        }
        arduinoDeviceTypeConfiguration = Utils.getDeviceTypeConfiguration(arduinoConfiguration);
        arduinoDeviceTypeManagerService = new DeviceTypeManagerService(
                new DeviceTypeConfigIdentifier("arduino", "carbon.super"), arduinoDeviceTypeConfiguration);
    }
}


text:
package com.arpnetworking.metrics.common.tailer;

import com.arpnetworking.steno.Logger;
import com.arpnetworking.steno.LoggerFactory;

import java.io.IOException;
import java.nio.channels.SeekableByteChannel;

/**
 * Represents the initial position for a tailer.
 *
 * @author Brandon Arp (brandon dot arp at inscopemetrics dot io)
 */
public enum InitialPosition {
    /**
     * Start at the beginning of a file.
     */
    START {
        @Override
        public long get(final SeekableByteChannel channel) {
            return 0L;
        }
    },
    /**
     * Start at the end of a file.
     */
    END {
        @Override
        public long get(final SeekableByteChannel channel) {
            try {
                return channel.size();
            } catch (final IOException exception) {
                LOGGER.warn()
                        .setMessage("Unable to see to end of byte channel")
                        .addData("channel", channel)
                        .setThrowable(exception)
                        .log();
                return 0;
            }
        }
    };

    InitialPosition() { }

    /**
     * Given a {@link SeekableByteChannel}, returns the position in that stream to start from.
     *
     * @param channel Channel to evaluate the position against
     * @return The position (in bytes) to start reading
     */
    public abstract long get(SeekableByteChannel channel);

    private static final Logger LOGGER = LoggerFactory.getLogger(InitialPosition.class);
}


text:
module.exports = (function(Game) {

  Game.States.GameOver = function(game) {

  };

  Game.States.GameOver.prototype.create = function() {
    if (Game.multiplayer) {
      // Gameover panel
      this.gameoverPanel = new Game.Prefabs.GameoverPanel(this.game);
      this.game.add.existing(this.gameoverPanel);

      this.gameoverPanel.show(Game.score);
    }
  };
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>kumuluzee-jax-rs</artifactId>
        <groupId>com.kumuluz.ee</groupId>
        <version>2.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <name>KumuluzEE JAX-RS Jersey</name>
    <description>KumuluzEE JAX-RS component implemented by Jersey</description>

    <artifactId>kumuluzee-jax-rs-jersey</artifactId>

    <properties>
        <jersey.version>2.17</jersey.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.kumuluz.ee</groupId>
            <artifactId>kumuluzee-common</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <version>${jersey.version}</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
            <version>${jersey.version}</version>
        </dependency>
    </dependencies>

</project>


text:
body {
    background-image: url('../img/background.jpg');
    background-repeat:no-repeat;
    background-position: center;
    font-family: font;
}

@font-face {
    font-family: font;
    src: url('../fonts/dinneuzeitgroteskstd-bdcond-opentype.otf');
}


text:
Sfotipy.Views.Albums = Backbone.View.extend({
  el: $('#albums'),

  template: Handlebars.compile($("#album-template").html()),

  initialize: function () {
    this.listenTo(this.collection, "add", this.addOne, this);
  },

  render: function () {
    this.collection.forEach(this.addOne, this);
  },

  addOne: function (album) {
    var albumView = new Sfotipy.Views.Album({ model: album });
    this.$el.append(albumView.render().el);
  }

});


text:
> Check if something is a promise

Why not [`is-promise`](https://github.com/then/is-promise)? That module [checks for a thenable](https://github.com/then/is-promise/issues/6), not an ES2015 promise. This one is stricter.

You most likely don't need this. Just pass your value to `Promise.resolve()` and let it handle it.

Can be useful if you need to create a fast path for a synchronous operation.

## Install

```
$ npm install p-is-promise
```

## Usage

```js
const pIsPromise = require('p-is-promise');
const Bluebird = require('bluebird');

pIsPromise(Promise.resolve('🦄'));
//=> true

pIsPromise(Bluebird.resolve('🦄'));
//=> true

pIsPromise('🦄');
//=> false
```

## Related

- [More…](https://github.com/sindresorhus/promise-fun)

## License

MIT © [Sindre Sorhus](https://sindresorhus.com)


text:
<?php

namespace Oro\Bundle\InstallerBundle\Migrations;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;

use Oro\Bundle\InstallerBundle\Entity\BundleVersion;

class UpdateBundleVersionFixture extends AbstractFixture
{
    /**
     * @var array
     */
    protected $bundleVersions;

    /**
     * @var bool
     */
    protected $isDemoDataUpdate = false;

    /**
     * Set array with bundle data versions
     *
     * @param $bundleVersions
     */
    public function setBundleVersions($bundleVersions)
    {
        $this->bundleVersions = $bundleVersions;
    }

    /**
     * @param bool $isDemoDataUpdate
     */
    public function setIsDemoDataUpdate($isDemoDataUpdate)
    {
        $this->isDemoDataUpdate = $isDemoDataUpdate;
    }

    /**
     * @inheritdoc
     */
    public function load(ObjectManager $manager)
    {
        if (!empty($this->bundleVersions)) {
            foreach ($this->bundleVersions as $bundleName => $dataVersion) {
                $entity = $manager
                    ->getRepository('OroInstallerBundle:BundleVersion')
                    ->findOneBy(['bundleName' => $bundleName]);
                if ($entity === null) {
                    $entity = new BundleVersion();
                    $entity->setBundleName($bundleName);
                }
                if ($this->isDemoDataUpdate) {
                    $entity->setDemoDataVersion($dataVersion);
                } else {
                    $entity->setDataVersion($dataVersion);
                }
                $manager->persist($entity);
                $manager->flush();
            }
        }
    }
}


text:
package org.vitrivr.cineast.core.data.providers;

/**
 * @author rgasser
 * @version 1.0
 * @created 11.01.17
 */
public interface IdProvider {
    /**
     * @return a unique id of this
     */
    String getId();

    String getSuperId();

    /**
     * @return a unique id of this
     */
    void setId(String id);

    /**
     *
     * @param id
     */
    void setSuperId(String id);
}


text:
/* globals ZiftrApi: true */
"use strict";

ZiftrApi = {};


text:
package org.fest.assertions.error;

import static junit.framework.Assert.assertEquals;
import static org.fest.assertions.error.ShouldNotMatchPattern.shouldNotMatch;

import org.fest.assertions.description.*;
import org.junit.*;

/**
 * Tests for <code>{@link ShouldNotMatchPattern#create(Description)}</code>.
 *
 * @author Alex Ruiz
 */
public class ShouldNotMatchPattern_create_Test {

  private ErrorMessageFactory factory;

  @Before public void setUp() {
    factory = shouldNotMatch("Yoda", "Luke");
  }

  @Test public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"));
    assertEquals("[Test] 'Yoda' matches the pattern 'Luke'", message);
  }
}


text:
title: Resolving Out-of-Memory Issues
---

Occasionally larger Gatsby sites, or moderately-sized sites with unusual characteristics, run into out-of memory errors during `gatsby build` or `gatsby develop` processes.

Depending on the frequency of errors, out-of-memory errors can make it difficult or impossible to deploy new versions of your site.

This document will explain what causes out-of-memory (OOM) issues in Gatsby sites and how to fix or mitigate them.

## How process memory usage works

Gatsby build and develop are Node.js processes, which are allocated some fixed amount of memory by the operating system. Your build has to stay below this limit at all times, otherwise the process will crash.

The amount of memory you're using is the sum of your baseline memory usage, which is proportional to your site size, and memory usage "spikes" which happen during certain memory-intensive parts of the build process. So the maximum amount of memory you'll use is equivalent to your baseline usage plus the max spike, and your goal is to keep:

**Allocated memory < baseline usage + max(spike)**

(A good analogy for this is an electrical power grid; the amount of energy available on the grid at any time is the sum of "baseline" power sources like nuclear power plants that product a fairly constant amount of power at all times, plus "spiky" power sources like wind and solar that produce a variable amount of power depending on environmental conditions like wind speeds, time of day, cloud cover, etc).

## A taxonomy of out-of-memory issues

There are three types of out-of-memory issues that we see occur in Gatsby sites:

- First, image processing with gatsby-plugin-image (Generating image thumbnails). This is related loosely to the number of images. but more related to the dimensions of individual images; overly large images (eg a 3,000 x 3,000 pixel JPG) can cause memory spikes.

- Second, Javascript bundle creation (Building production JavaScript and CSS bundles) and page serialization (Building static HTML for pages). Depending on the size of your templates, serializing them during the page build (SSR) process can cause memory spikes.

- Third, memory usage from the number of "nodes" stored as data in the system. Gatsby represents data you source as "nodes" and keeps all the nodes in memory. This establishes a "baseline" level of memory usage.

## Profiling your memory usage

If you've either experienced, or are worried about OOM memory crashes, we strongly recommend that you profile build memory usage to establish a baseline.

It's a good practice to profile memory periodically once your site crosses 10k or 20k pages, or if you've experienced out-of-memory challenges on smaller sites.

The Gatsby team's recommendation is to run `gatsby` within a profiling tool like [process-top](https://github.com/mafintosh/process-top). Run your site like the following:

`npx process-top ./node_modules/.bin/gatsby build`

This will output every second profile information like the following:

`cpu: 180.5% | rss: 431 MB (5.0%) | heap: 163 MB / 269 MB (60.7%) | ext: 280 MB | delay: 792 ms | 00:00:09 | loadavg: 1.71, 1.65, 1.78`

("RSS" is the total memory being used).

## Options to reduce "out-of-memory" risk

There are a number of options to fix OOM issues; some are specific to OOMs occurring at certain stages in the build process, while others are general solutions that will work at any stage. In addition, while some of these options are universal best practices, others involve tradeoffs against build speed, site performance, site debuggability, or cost.

### 1. General solutions

#### Upgrade Gatsby & gatsby source plugins

The Gatsby team is continually shipping upgrades that reduce the amount of memory footprint. The simplest and first solution should be to upgrade your version of Gatsby and source plugins to the latest version and see what impact that has.

#### Try using Gatsby Cloud

Paid tiers of Gatsby Cloud parallelize image processing and run other parts of the build process in ways that are less memory intensive than comparably sized hardware.

#### Try reducing the number of cores

Gatsby defaults to using the number of physical cores on your machine to speed up builds, and parallelizes during certain steps of the process (image processing, Javascript bundle creation, and HTML generation).

So if you're experiencing out of memory issues during any of those steps, you can try setting the environment variable `GATSBY_CPU_COUNT` to a lower number, like 2. Note that this will slow your builds down!

#### Increase allocated memory and/or upgrade your hardware.

The default node process in node >= 12 has a 2GB "heap size" allocated for memory.

It's plausible that you could increase memory usage significantly. Increasing the max heap size to 4GB or 8GB is quite common (using `NODE_OPTIONS=--max-old-space-size` set to 4096 or 8192).

The theoretical limit on a 64-bit machine is 16 terabytes, but of course the practical limit is much lower. Netflix experimented with raising this limit to 32GB [back in 2014](https://netflixtechblog.com/node-js-in-flames-ddd073803aa4); the Gatsby team is aware of a few sites that run this at 16GB (on machines with 16GB of RAM).

So:

- Some Gatsby build hosts, like Gatsby Cloud, will automatically set the memory limit to the maximum available in memory. Others may require you to use the `NODE_OPTIONS` key if you want to increase the memory limit.

- if you're at the memory limit for your plan tier, and your build host offers more memory at the next tier, you may want to consider upgrading plan tiers.

- Alternatively, if you self-host your CI/CD pipeline, you may need to upgrade to a beefier machine, VM, or container that has the desired amount of memory.

In addition, if you do these in production, when running gatsby develop locally, you'll probably also want to limit the number of nodes used in the development process and/or allocate additional memory locally as well.

Finally, you can't allocate more memory than is available on your machine, so be careful not to set `NODE_OPTIONS=--max-old-space-size` to a value greater than your hardware's RAM, as that may negatively impact the Node process's ability to garbage collect properly.

### 2. Reducing crashes due to gatsby-plugin-image

#### Pre-optimize images by downsampling

Overly large images being used by Gatsby image can cause memory spikes. For example, if your image will only ever be 1000 pixels wide, and you have a 2000 x 3000 pixel source image stored in your repository or headless CMS, it may be worthwhile to convert that source image to a 667 x 1000 pixel version. [This piece on pre-optimizing images](/docs/preoptimizing-images/) can give some guidance.

#### Disable AVIF

Generating AVIFs often causes increased memory usage by gatsby-plugin-image. This option is turned off by default in gatsby-plugin-image; if you've turned it on and are seeing issues, try turning it back off.

### 3. Reducing crashes in generating Javascript bundles & serializing HTML pages

#### Turn off source maps generation

Use Gatsby plugin that disables sourcemap generation by modifying webpack config: [gatsby-plugin-no-sourcemaps](/plugins/gatsby-plugin-no-sourcemaps/) (this can help build speed as well).

The side effect is that this will make any errors happening in production significantly harder to debug by obscuring the stacktrace, so if your team regularly inspects production errors (perhaps using eg Sentry, Rollbar, or comparable tools), you may want to consider other options.

#### Inspect and reduce bundle sizes

Serialization memory spikes are proportional to template sizes. [Optimizations to improve bundle size](/docs/how-to/performance/improving-site-performance/#reduce-your-javascript-bundle-cost), especially of your largest bundle sizes, should have benefits to this.

When you're scanning bundle sizes to see what might be causing out-of-memory issues, rather than focusing on critical paths, focus on anomalously large bundles. If one of your bundles is 3MB and the rest are 300KB, you might have, eg, accidentally imported an 2.5MB image directly into a bundle.

### 4. Reducing crashes due to large number of nodes

#### Examine use of headless CMS

For similar amounts of pages and content, some source plugins cause your site to build more slowly than others. Those same source plugins also have greater memory usage. (The underlying reason, which causes both behaviors, is that these source plugins create a larger number of nodes).

Similar to build speeds, if sourcing and processing content from your CMS is causing these spikes, and there are significantly lower-memory alternative(s), you may want to consider migrating some or all content there.

#### Plan for site growth by examining the number of nodes

The number of nodes being generated is output in the raw logs of every gatsby build, eg:

`22:50:32 PM: info Total nodes: 29, SitePage nodes: 1 (use --verbose for breakdown)`

Because the amount of baseline memory usage is roughly proportional to the number of nodes, and the number of nodes is roughly proportional to the number of pages (assuming the CMS setup stays the same), this can be useful for planning around future growth.

#### Disable cache persistence

When the amount of nodes approaches 1.5 million (typically a 100k page Contentful site, or a 300k page Sanity site), the way Gatsby serializes internal state can cause out of memory issues. If your site is near this, and you're experiencing issues, try setting the environment variable `GATSBY_DISABLE_CACHE_PERSISTENCE=1`.

Note that for sites at this scale, build times may also become a workflow issue for your team, so be sure to spend time thinking about how to improve build times as well.


text:
@interface QNDnsFlow : NSObject

@property(nonatomic, assign)long flowId;
@property(nonatomic,   copy)NSString *server;
@property(nonatomic, strong)QNDnsRequest *dnsRequest;
@property(nonatomic, strong)QNAsyncUdpSocket *socket;
@property(nonatomic,   copy)void(^complete)(QNDnsResponse *response, NSError *error);

@end
@implementation QNDnsFlow
@end

#define kDnsPort 53
@interface QNDnsUdpResolver()<QNAsyncUdpSocketDelegate>

@property(nonatomic, assign)int recordType;
@property(nonatomic, assign)int timeout;
@property(nonatomic,   copy)NSArray *servers;
@property(nonatomic, strong)dispatch_queue_t queue;
@property(nonatomic, strong)NSMutableDictionary *flows;

@end

@implementation QNDnsUdpResolver
@synthesize recordType;
@synthesize timeout;
@synthesize servers;

+ (instancetype)resolverWithServerIP:(NSString *)serverIP {
    return [self resolverWithServerIP:serverIP recordType:kQNTypeA timeout:QN_DNS_DEFAULT_TIMEOUT];
}

+ (instancetype)resolverWithServerIP:(NSString *)serverIP
                          recordType:(int)recordType
                             timeout:(int)timeout {
    return [self resolverWithServerIPs:serverIP ? @[serverIP] : @[] recordType:recordType timeout:timeout];
}

+ (instancetype)resolverWithServerIPs:(NSArray <NSString *> *)serverIPs
                           recordType:(int)recordType
                              timeout:(int)timeout {
    return [self resolverWithServerIPs:serverIPs recordType:recordType queue:nil timeout:timeout];
}

+ (instancetype)resolverWithServerIPs:(NSArray <NSString *> *)servers
                           recordType:(int)recordType
                                queue:(dispatch_queue_t _Nullable)queue
                              timeout:(int)timeout {

    QNDnsUdpResolver *resolver = [[self alloc] init];
    resolver.recordType = recordType;
    resolver.servers = [servers copy] ?: @[];
    resolver.timeout = timeout;
    resolver.queue = queue;
    return resolver;
}

+ (dispatch_queue_t)defaultQueue {
    static dispatch_once_t onceToken;
    static dispatch_queue_t timerQueue;
    dispatch_once(&onceToken, ^{
        timerQueue = dispatch_queue_create("com.qiniu.dns.udp.queue", DISPATCH_QUEUE_CONCURRENT);
    });
    return timerQueue;
}

- (dispatch_queue_t)queue {
    if (_queue == nil) {
        _queue = [QNDnsUdpResolver defaultQueue];
    }
    return _queue;
}

- (NSMutableDictionary *)flows {
    if (_flows == nil) {
        _flows = [NSMutableDictionary dictionary];
    }
    return _flows;
}

- (void)request:(NSString *)server
           host:(NSString *)host
     recordType:(int)recordType
       complete:(void(^)(QNDnsResponse *response, NSError *error))complete {
    if (complete == nil) {
        return;
    }

    int messageId = arc4random()%(0xFFFF);
    QNDnsRequest *dnsRequest = [QNDnsRequest request:messageId recordType:recordType host:host];

    NSError *error = nil;
    NSData *requestData = [dnsRequest toDnsQuestionData:&error];
    if (error) {
        complete(nil, error);
        return;
    }

    QNAsyncUdpSocket *socket = [[QNAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:self.queue];
    // 由系统决定端口号
    [socket bindToPort:0 error: &error];
    if (error) {
        complete(nil, error);
        return;
    }

    [socket beginReceiving:&error];
    if (error) {
        complete(nil, error);
        return;
    }

    QNDnsFlow *flow = [[QNDnsFlow alloc] init];
    flow.flowId = [socket hash];
    flow.server = server;
    flow.dnsRequest = dnsRequest;
    flow.socket = socket;
    flow.complete = complete;
    [self setFlow:flow withId:flow.flowId];

    [socket sendData:requestData toHost:server port:kDnsPort withTimeout:self.timeout tag:flow.flowId];
}

- (void)udpSocketComplete:(QNAsyncUdpSocket *)sock data:(NSData *)data error:(NSError * _Nullable)error {
    [sock close];

    QNDnsFlow *flow = [self getFlowWithId:[sock hash]];
    if (!flow) {
        return;
    }
    [self removeFlowWithId:flow.flowId];

    if (error != nil) {
        flow.complete(nil, error);
    } else if (data != nil) {
        NSError *err = nil;
        QNDnsResponse *response = [QNDnsResponse dnsResponse:flow.server source:QNRecordSourceUdp request:flow.dnsRequest dnsRecordData:data error:&err];
        flow.complete(response, err);
    } else {
        flow.complete(nil, nil);
    }
}

//MARK: -- QNAsyncUdpSocketDelegate
- (void)udpSocket:(QNAsyncUdpSocket *)sock didConnectToAddress:(NSData *)address {
}

- (void)udpSocket:(QNAsyncUdpSocket *)sock didNotConnect:(NSError * _Nullable)error {
    [self udpSocketComplete:sock data:nil error:error];
}

- (void)udpSocket:(QNAsyncUdpSocket *)sock didSendDataWithTag:(long)tag {
}

- (void)udpSocket:(QNAsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError * _Nullable)error {
    [self udpSocketComplete:sock data:nil error:error];
}

- (void)udpSocket:(QNAsyncUdpSocket *)sock
   didReceiveData:(NSData *)data
      fromAddress:(NSData *)address
withFilterContext:(nullable id)filterContext {
    [self udpSocketComplete:sock data:data error:nil];
}

- (void)udpSocketDidClose:(QNAsyncUdpSocket *)sock withError:(NSError  * _Nullable)error {
    [self udpSocketComplete:sock data:nil error:error];
}

//MARK: flows
- (QNDnsFlow *)getFlowWithId:(long)flowId {
    NSString *key = [NSString stringWithFormat:@"%ld", flowId];
    QNDnsFlow *flow = nil;
    @synchronized (self) {
        flow = self.flows[key];
    }
    return flow;
}

- (BOOL)setFlow:(QNDnsFlow *)flow withId:(long)flowId {
    if (flow == nil) {
        return false;
    }

    NSString *key = [NSString stringWithFormat:@"%ld", flowId];
    @synchronized (self) {
        self.flows[key] = flow;
    }
    return true;
}

- (void)removeFlowWithId:(long)flowId {
    NSString *key = [NSString stringWithFormat:@"%ld", flowId];
    @synchronized (self) {
        [self.flows removeObjectForKey:key];
    }
}

@end


text:
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build ignore

// +godefs map struct_in_addr [4]byte /* in_addr */

package ipv4

/*
#include <netinet/in.h>
*/
import "C"

const (
	sysIP_OPTIONS     = C.IP_OPTIONS
	sysIP_HDRINCL     = C.IP_HDRINCL
	sysIP_TOS         = C.IP_TOS
	sysIP_TTL         = C.IP_TTL
	sysIP_RECVOPTS    = C.IP_RECVOPTS
	sysIP_RECVRETOPTS = C.IP_RECVRETOPTS
	sysIP_RECVDSTADDR = C.IP_RECVDSTADDR
	sysIP_RETOPTS     = C.IP_RETOPTS
	sysIP_RECVIF      = C.IP_RECVIF
	sysIP_STRIPHDR    = C.IP_STRIPHDR
	sysIP_RECVTTL     = C.IP_RECVTTL
	sysIP_BOUND_IF    = C.IP_BOUND_IF
	sysIP_PKTINFO     = C.IP_PKTINFO
	sysIP_RECVPKTINFO = C.IP_RECVPKTINFO

	sysIP_MULTICAST_IF           = C.IP_MULTICAST_IF
	sysIP_MULTICAST_TTL          = C.IP_MULTICAST_TTL
	sysIP_MULTICAST_LOOP         = C.IP_MULTICAST_LOOP
	sysIP_ADD_MEMBERSHIP         = C.IP_ADD_MEMBERSHIP
	sysIP_DROP_MEMBERSHIP        = C.IP_DROP_MEMBERSHIP
	sysIP_MULTICAST_VIF          = C.IP_MULTICAST_VIF
	sysIP_MULTICAST_IFINDEX      = C.IP_MULTICAST_IFINDEX
	sysIP_ADD_SOURCE_MEMBERSHIP  = C.IP_ADD_SOURCE_MEMBERSHIP
	sysIP_DROP_SOURCE_MEMBERSHIP = C.IP_DROP_SOURCE_MEMBERSHIP
	sysIP_BLOCK_SOURCE           = C.IP_BLOCK_SOURCE
	sysIP_UNBLOCK_SOURCE         = C.IP_UNBLOCK_SOURCE

	sysSizeofInetPktinfo = C.sizeof_struct_in_pktinfo

	sysSizeofIPMreq       = C.sizeof_struct_ip_mreq
	sysSizeofIPMreqn      = C.sizeof_struct_ip_mreqn
	sysSizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
)

type sysInetPktinfo C.struct_in_pktinfo

type sysIPMreq C.struct_ip_mreq

type sysIPMreqn C.struct_ip_mreqn

type sysIPMreqSource C.struct_ip_mreq_source


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>Class: Rack::Builder</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

          Class
          Rack::Builder

            In:

                lib/rack/builder.rb

            Parent:

                Object

Rack::Builder implements a small DSL to
iteratively construct Rack applications.

Example:

 app = Rack::Builder.new {
   use Rack::CommonLogger
   use Rack::ShowExceptions
   map "/lobster" do
     use Rack::Lint
     run Rack::Lobster.new
   end
 }

Or

 app = Rack::Builder.app do
   use Rack::CommonLogger
   lambda { |env| [200, {'Content-Type' => 'text/plain'}, 'OK'] }
 end

<tt>use</tt> adds a middleware to the
stack, <tt>run</tt> dispatches to an
application. You can use <tt>map</tt> to construct a Rack::URLMap in a convenient way.

Methods

      app
      call
      map
      new
      run
      to_app
      use

Public Class methods

          app(&block)

          new(&block)

Public Instance methods

          call(env)

          map(path, &block)

          run(app)

          to_app()

          use(middleware, *args, &block)

[Validate]


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>PohStorage - Affordable and Accessible</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/stylish-portfolio.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

                PohStorage

                Home

                About

                Services

                Portfolio

                Contact

PohStorage

Affordable and Accessible

Why PohStorage?

                                    Pricing

Highly affordable pricing is definitely one of our main priority. Our extremely low pricing starts from $99 per rack only. Furthermore we do not charge GST, NO admin fee, NO security deposit and NO hidden fees.

                                    Location

Centrally located in Ang Mo Kio Avenue 10, it provides great convenience and accessibility via many expressways for our customers.

                                    Clean and Secured Facility

Our storage facility is clean and secured with 24/7 security CCTV and guards. We also offer extra insurance option to cover specific items for clients with valuable goods.

                                    Flexible Lease

PohStorage can offer as short as 1 week storage. We know sometimes customer need a temporary space urgently last minute. We can cater to all types of lease period request.

About Us

              PohStorage is a affordable, clean and secured storage space located in prime location at Ang Mo Kio Avenue 10 for all types of storage purpose.

              We provide highly affordable storage space for our clients who does not require 24/7 access to their goods, but prefer flexibility on price, size and storage period.

We cater to all types of personal and corporate clients with different storage needs:

 Online E-Commerce Business Storage/Packaging/Delivery Solution

 SME Outsourcing Storage/Delivery Solution

 Temporary Storage during Relocation

We aim to be one of the largest budget storage facility in Singapore by providing highly cost effective and flexible storage space to all retail and corporate customers.

Storage Showcase

Showcase of our customer storage usage

                    View More Items

PohStorage

                      Block 460, Ang Mo Kio Avenue 10, #01-1578

                      Singapore 560460

 (65) 8668-5650

 pohstorage@gmail.com

Copyright © PohStorage 2016


text:
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;

namespace Microsoft.AspNetCore.Routing;

public abstract class LinkGeneratorTestBase
{
    protected HttpContext CreateHttpContext(object ambientValues = null)
    {
        var httpContext = new DefaultHttpContext();
        httpContext.Request.RouteValues = new RouteValueDictionary(ambientValues);
        return httpContext;
    }

    protected ServiceCollection GetBasicServices()
    {
        var services = new ServiceCollection();
        services.AddOptions();
        services.AddRouting();
        services.AddLogging();
        return services;
    }

    protected virtual void AddAdditionalServices(IServiceCollection services)
    {
    }

    private protected DefaultLinkGenerator CreateLinkGenerator(params Endpoint[] endpoints)
    {
        return CreateLinkGenerator(configureServices: null, endpoints);
    }

    private protected DefaultLinkGenerator CreateLinkGenerator(
        Action<IServiceCollection> configureServices,
        params Endpoint[] endpoints)
    {
        return CreateLinkGenerator(configureServices, new[] { new DefaultEndpointDataSource(endpoints ?? Array.Empty<Endpoint>()) });
    }

    private protected DefaultLinkGenerator CreateLinkGenerator(EndpointDataSource[] dataSources)
    {
        return CreateLinkGenerator(configureServices: null, dataSources);
    }

    private protected DefaultLinkGenerator CreateLinkGenerator(
        Action<IServiceCollection> configureServices,
        EndpointDataSource[] dataSources)
    {
        var services = GetBasicServices();
        AddAdditionalServices(services);
        configureServices?.Invoke(services);

        services.Configure<RouteOptions>(o =>
        {
            if (dataSources != null)
            {
                foreach (var dataSource in dataSources)
                {
                    o.EndpointDataSources.Add(dataSource);
                }
            }
        });

        var serviceProvider = services.BuildServiceProvider();
        var routeOptions = serviceProvider.GetRequiredService<IOptions<RouteOptions>>();

        return new DefaultLinkGenerator(
            serviceProvider.GetRequiredService<TemplateBinderFactory>(),
            new CompositeEndpointDataSource(routeOptions.Value.EndpointDataSources),
            routeOptions,
            NullLogger<DefaultLinkGenerator>.Instance,
            serviceProvider);
    }
}


text:
//----------------------------------------------------------------------
//This code is developed as part of the Java CoG Kit project
//The terms of the license can be found at http://www.cogkit.org/license
//This message may not be removed or altered.
//----------------------------------------------------------------------

/*
 * Created on Jul 2, 2014
 */
package org.globus.cog.abstraction.coaster.service;

import java.util.HashMap;
import java.util.Map;

import org.globus.cog.abstraction.coaster.service.job.manager.AbstractBlockWorkerManager;
import org.globus.cog.abstraction.coaster.service.job.manager.BlockQueueProcessor;
import org.globus.cog.coaster.channels.CoasterChannel;

public class BlockRegistry implements RegistrationManager {
    private Map<String, AbstractBlockWorkerManager> managers;
    private BlockQueueProcessor singleQP;

    public BlockRegistry() {
        this.managers = new HashMap<String, AbstractBlockWorkerManager>();
    }

    public void addBlock(String blockId, AbstractBlockWorkerManager bqp) {
        synchronized(managers) {
            managers.put(blockId, bqp);
        }
    }

    private AbstractBlockWorkerManager get(String blockId) {
        if (singleQP != null) {
            return singleQP;
        }
        synchronized(managers) {
            AbstractBlockWorkerManager rm = managers.get(blockId);
            if (rm == null) {
                throw new IllegalArgumentException("No such block registered with dispatcher: " + blockId);
            }
            return rm;
        }
    }

    public void removeBlock(String blockId) {
        synchronized(managers) {
            managers.remove(blockId);
        }
    }

    @Override
    public String registrationReceived(String blockID, String workerID, String workerHostname,
            CoasterChannel channel, Map<String, String> options) {
        return get(blockID).registrationReceived(blockID, workerID, workerHostname, channel, options);
    }

    @Override
    public String nextId(String id) {
        return get(id).nextId(id);
    }

    public AbstractBlockWorkerManager getQueueProcessor(String blockID) {
        return get(blockID);
    }

    public void setSingleQP(BlockQueueProcessor qp) {
        this.singleQP = qp;
    }
}


text:
package org.joda.beans.impl;

import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import org.joda.beans.Bean;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaProperty;
import org.joda.beans.Property;

/**
 * A standard map of properties.
 *

 * This is the standard implementation of a map of properties derived from a meta-bean.
 */
public final class BasicPropertyMap
        extends AbstractMap<String, Property<?>> {

    /** The bean. */
    private final Bean bean;

    /**
     * Factory to create a property map avoiding duplicate generics.
     *
     * @param bean  the bean
     * @return the property map, not null
     */
    public static BasicPropertyMap of(Bean bean) {
        return new BasicPropertyMap(bean);
    }

    /**
     * Creates a property map.
     *
     * @param bean  the bean that the property is bound to, not null
     */
    private BasicPropertyMap(Bean bean) {
        if (bean == null) {
            throw new NullPointerException("Bean must not be null");
        }
        this.bean = bean;
    }

    //-----------------------------------------------------------------------
    @Override
    public int size() {
        return bean.metaBean().metaPropertyCount();
    }

    @Override
    public boolean containsKey(Object obj) {
        return obj instanceof String ? bean.metaBean().metaPropertyExists(obj.toString()) : false;
    }

    @Override
    public Property<?> get(Object obj) {
        return containsKey(obj) ? bean.metaBean().metaProperty(obj.toString()).createProperty(bean) : null;
    }

    @Override
    public Set<String> keySet() {
        return bean.metaBean().metaPropertyMap().keySet();
    }

    @Override
    public Set<Entry<String, Property<?>>> entrySet() {
        return new AbstractSet<Entry<String, Property<?>>>() {
            // TODO: possibly override contains()
            @Override
            public int size() {
                return bean.metaBean().metaPropertyCount();
            }
            @Override
            public Iterator<Entry<String, Property<?>>> iterator() {
                final Iterator<MetaProperty<?>> it = bean.metaBean().metaPropertyMap().values().iterator();
                return new Iterator<Entry<String, Property<?>>>() {
                    @Override
                    public boolean hasNext() {
                        return it.hasNext();
                    }
                    @Override
                    public Entry<String, Property<?>> next() {
                        MetaProperty<?> meta = it.next();
                        return new SimpleImmutableEntry<>(meta.name(), BasicProperty.of(bean, meta));
                    }
                    @Override
                    public void remove() {
                        throw new UnsupportedOperationException("Unmodifiable");
                    }
                };
            }
        };
    }

    //-----------------------------------------------------------------------
    /**
     * Flattens the contents of this property map to a {@code Map}.
     *

     * The returned map will contain all the properties from the bean with their actual values.
     *
     * @return the unmodifiable map of property name to value, not null
     */
    public Map<String, Object> flatten() {
        return JodaBeanUtils.flatten(bean);
    }

}


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

namespace healthbook
{
	public class Patient
	{
		public string Id { get; set; }
		public string Name { get; set; }
		public string Image { get; set; }
		public int BeaconMinor { get; set; }
		public string HealtDataSteps { get; set; }
		public string HealtDataSleepQuality { get; set; }
		public string HealtDataDepression { get; set; }

//		public List<Meeting> Meetings { get; set; }
//		public string NextMeeting {
//			get{
//				if (Meetings != null) {
//					var tmpList = Meetings.Where (i => i.End > DateTime.Now).OrderByDescending (x => x.Start).ToList ();
//					var tmpNextMeeting = tmpList.First ();
//					if (tmpNextMeeting != null) {
//						return tmpNextMeeting.FormattedStart;
//					}
//				}
//				return string.Empty;
//			}
//		}

		public Patient ()
		{
			Id = Guid.NewGuid ().ToString ();
//			Meetings = new List<Meeting> ();
		}

//		public void GenerateRandomMeetings()
//		{
//
//			for (int i = 0; i < 5; i++) {
//				var randomMeeting = new Meeting ();
//				DateTime start = DateTime.Now;
//				Random gen = new Random ();
//
//				int range = (DateTime.Today - start).Days;
//				randomMeeting.Start = start.AddDays (gen.Next (range));
//				randomMeeting.End = randomMeeting.Start.AddMinutes (30.0);
//				Meetings.Add (randomMeeting);
//			}
//		}
	}
}


text:
using System;

    class BitsInverter
    {
        static void Main()
        {
            /*
             This problem come from C# Basics practical exam (10 April 2014 Morning). You may submit your solution here: http://judge.softuni.bg/Contests/2/CSharp-Basics-Exam-10-April-2014-Morning.
            Once Teodor played the following game: he started from a sequence of white and black balls and flipped the color of the 1st ball, then the color of the 4th ball, then the color of the 7th ball, etc. until the last ball. Flipping was performed by replacing a black b all with a white ball and vice versa. Teodor was a smart mathematician so he wanted to generalize his game in a formal way. This is what he invented.
            You are given a sequence of bytes. Consider each byte as sequences of exactly 8 bits.  You are given also a number step. Write a program to invert the bits at positions: 1, 1 + step, 1 + 2*step, ... Print the output as a sequence of bytes.
            Bits in each byte are counted from the leftmost to the rightmost. Bits are numbered starting from 1.
             */

            int n = int.Parse(Console.ReadLine());
            int step = int.Parse(Console.ReadLine());
            short[] num = new short[n];
            int pos = 7;
            for (int index = 0; index < n; index++)
            {
                num[index] = byte.Parse(Console.ReadLine());
                for ( ; ; )
                {
                    if (pos >= 0)
                    {
                        num[index] = changeValue(num[index], pos);
                        pos -= step;
                    }
                    else
                    {
                        pos += 8;
                        break;
                    }
                }
            }
            foreach (int x in num)
            {
                Console.WriteLine(x);
            }
        }

    private static short changeValue(short num, int pos)
    {
        if ((num & (1 << pos)) != 0)
        {
            num -= (short)(1 << pos);
        }
        else
        {
            num += (short)(1 << pos);
        }
        return num;
    }
 }