text:
import { createPoint, IPoint, distance } from 'cd-utils/geometry';
import { generateFrame } from 'cd-common/utils';
import { isSymbol } from 'cd-common/models';
import { half } from 'cd-utils/numeric';
import * as cd from 'cd-interfaces';

const LINE_EDGE_OFFSET = 20;

type CompassPoints = [IPoint, IPoint, IPoint, IPoint];

enum CardinalDirection {
  North = 0,
  South = 1,
  East = 2,
  West = 3,
}

export interface IPosition {
  point: IPoint;
  direction: CardinalDirection;
}

export interface IActionPath {
  id?: string;
  path?: string;
  from: string;
  to: string;
  fromRect?: cd.IRect;
}

export const getStartAndEndFrames = (rects: cd.RenderRectMap, action: IActionPath) => {
  const fromRect = rects.get(action.from);
  const toRect = rects.get(action.to);
  if (!toRect || !fromRect) return;

  const fromRoot = rects.get(fromRect.rootId);
  const toRoot = rects.get(toRect.rootId);
  if (!fromRoot || !toRoot) return;

  const fromRootIsFromRect = fromRoot.id === fromRect.id;
  const startX = fromRootIsFromRect ? fromRect.frame.x : fromRoot.frame.x + fromRect.frame.x;
  const startY = fromRootIsFromRect ? fromRect.frame.y : fromRoot.frame.y + fromRect.frame.y;

  const toRootIsToRect = toRoot.id === toRect.id;
  const endX = toRootIsToRect ? toRect.frame.x : toRoot.frame.x + toRect.frame.x;
  const endY = toRootIsToRect ? toRect.frame.y : toRoot.frame.y + toRect.frame.y;

  const startFrame = generateFrame(startX, startY, fromRect.frame.width, fromRect.frame.height);
  const endFrame = generateFrame(endX, endY, toRect.frame.width, toRect.frame.height);

  return { startFrame, endFrame };
};

export const generateCompassPoints = (rect: cd.IRect): CompassPoints => {
  const { x, y, width, height } = rect;
  const halfWidth = half(width);
  const halfHeight = half(height);
  const bottom = y + height;
  const right = width + x;
  const centerY = y + halfHeight;
  const centerX = x + halfWidth;
  const north = createPoint(centerX, y);
  const south = createPoint(centerX, bottom);
  const east = createPoint(right, centerY);
  const west = createPoint(x, centerY);
  return [north, south, east, west];
};

export const generateStartAndEndPoints = (
  startPoints: CompassPoints,
  endPoints: CompassPoints
): {
  start: IPosition;
  end: IPosition;
} => {
  let shortestDistance = Number.MAX_SAFE_INTEGER;
  let startPt = createPoint();
  let endPt = createPoint();
  let endDirection = CardinalDirection.North;
  let startDirection = CardinalDirection.North;

  for (let i = 0; i < startPoints.length; i++) {
    const startPoint = startPoints[i];
    for (let j = 0; j < endPoints.length; j++) {
      const endPoint = endPoints[j];
      const dist = distance(startPoint, endPoint);
      if (dist >= shortestDistance) continue;
      endDirection = j;
      startDirection = i;
      startPt = startPoint;
      endPt = endPoint;
      shortestDistance = dist;
    }
  }
  const start = { point: startPt, direction: startDirection };
  const end = { point: endPt, direction: endDirection };
  return { start, end };
};

export const buildPath = (start: IPosition, end: IPosition): string => {
  const nextStart = buildLine(start);
  const nextEnd = buildLine(end);
  const polyline = [start.point, nextStart, nextEnd, end.point].map((item) => [item.x, item.y]);
  return polyline.map((item) => item.toString()).join(' ');
};

export const buildLine = ({ point, direction }: IPosition, offset = LINE_EDGE_OFFSET): IPoint => {
  if (direction === CardinalDirection.North) return createPoint(point.x, point.y - offset);
  if (direction === CardinalDirection.South) return createPoint(point.x, point.y + offset);
  if (direction === CardinalDirection.East) return createPoint(point.x + offset, point.y);
  return createPoint(point.x - offset, point.y);
};

export const paddFrame = (frame: cd.IRect, padding: number) => {
  const halfPadding = half(padding);
  const x = frame.x - halfPadding;
  const y = frame.y - halfPadding;
  const width = frame.width + padding;
  const height = frame.height + padding;
  return generateFrame(x, y, width, height);
};

const buildActionPath = (id: string | undefined, to: string, from: string): IActionPath => {
  return { id, to, from };
};

export const buildActionsFromProps = (elements: cd.ElementPropertiesMap) => {
  // Filter elements without actions and elements who have actions inside a symbol
  const validActionsFromElements = Object.values(elements)
    .filter((item) => item?.actions?.length)
    .filter((item) => {
      const rootId = item?.rootId;
      if (!rootId) return false;
      const rootElement = elements[rootId];
      return rootElement && !isSymbol(rootElement);
    }) as cd.PropertyModel[];

  return validActionsFromElements.reduce<IActionPath[]>((acc, prop) => {
    const from = prop?.id;
    for (const action of prop.actions) {
      const target = action.target;
      if (!target || !elements[target]) continue;
      const actionPath = buildActionPath(action.id, target, from);
      acc.push(actionPath);
    }

    return acc;
  }, []);
};


text:
using System;
using System.Collections.Generic;
using System.Data;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;

namespace Choose4use.CommentsExtention {
    public class Migrations : DataMigrationImpl {

        public int Create() {

            return 1;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
module load python/2.7.9
. ~/simcity/bin/activate
cd $PBS_O_WORKDIR
python run.py -M 5


text:
import os
from flask import Flask

_basedir = os.path.abspath(os.path.dirname(__file__))

app = Flask(__name__)
app.config.from_object('talent_curator.settings.local')

from talent_curator.apps.core.views import main_blueprint
app.register_blueprint(main_blueprint)

from talent_curator.apps.profile.views import profile_blueprint
app.register_blueprint(profile_blueprint, url_prefix="/profile")

from talent_curator.apps.candidates.views import candidates_blueprint
app.register_blueprint(candidates_blueprint, url_prefix="/candidates")


text:
package org.apache.myfaces.trinidadinternal.context.external;

import java.util.Enumeration;
import javax.portlet.PortletContext;

/**
 * portletContext init parameters as Map.
 *
 * @version $Revision: 278654 $ $Date: 2005-09-04 18:32:35 -0600 (Sun, 04 Sep 2005) $
 */
public class PortletInitParameterMap extends AbstractAttributeMap<String, String>
{
  public PortletInitParameterMap(final PortletContext portletContext)
  {
    _portletContext = portletContext;
  }

  @Override
  protected String getAttribute(final Object key)
  {
    if (key.toString().equals(key))
    {
      return _portletContext.getInitParameter(key.toString());
    }
    return null;
  }

  @Override
  @SuppressWarnings("unchecked")
  protected Enumeration<String> getAttributeNames()
  {
    return _portletContext.getInitParameterNames();
  }

  final PortletContext _portletContext;
}


text:
#region Using

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using SharpFont.Cache;
using SharpFont.Internal;
using SharpFont.TrueType;

#endregion

namespace SharpFont
{
    /// <summary>
    ///     <para>
    ///     A handle to a FreeType library instance. Each 'library' is completely independent from the others; it is the
    ///     'root' of a set of objects like fonts, faces, sizes, etc.
    ///     </para>
    ///     <para>
    ///     It also embeds a memory manager (see <see cref="Memory" />), as well as a scan-line converter object (see
    ///     <see cref="Raster" />).
    ///     </para>
    ///     <para>
    ///     For multi-threading applications each thread should have its own <see cref="Library" /> object.
    ///     </para>
    /// </summary>
    public sealed class Library : IDisposable
    {
        #region Fields

        private IntPtr reference;

        private bool customMemory;

        private List<Face> childFaces;
        private List<Glyph> childGlyphs;
        private List<Outline> childOutlines;
        private List<Stroker> childStrokers;
        private List<Manager> childManagers;

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Library" /> class.
        /// </summary>
        /// <remarks>
        /// SharpFont assumes that you have the correct version of FreeType for your operating system and processor
        /// architecture. If you get a <see cref="BadImageFormatException" /> here on Windows, there's a good chance
        /// that you're trying to run your program as a 64-bit process and have a 32-bit version of FreeType or vice
        /// versa. See the SharpFont.Examples project for how to handle this situation.
        /// </remarks>
        public Library()
            : this(false)
        {
            IntPtr libraryRef;
            Error err = FT.FT_Init_FreeType(out libraryRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            Reference = libraryRef;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Library" /> class.
        /// </summary>
        /// <param name="memory">A custom FreeType memory manager.</param>
        public Library(Memory memory)
            : this(false)
        {
            IntPtr libraryRef;
            Error err = FT.FT_New_Library(memory.Reference, out libraryRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            Reference = libraryRef;
            customMemory = true;
        }

        private Library(bool duplicate)
        {
            childFaces = new List<Face>();
            childGlyphs = new List<Glyph>();
            childOutlines = new List<Outline>();
            childStrokers = new List<Stroker>();
            childManagers = new List<Manager>();
        }

        /// <summary>
        /// Finalizes an instance of the <see cref="Library" /> class.
        /// </summary>
        ~Library()
        {
            Dispose(false);
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets a value indicating whether the object has been disposed.
        /// </summary>
        public bool IsDisposed { get; private set; }

        /// <summary>
        /// Gets the version of the FreeType library being used.
        /// </summary>
        public Version Version
        {
            get
            {
                if (IsDisposed)
                    throw new ObjectDisposedException("Version", "Cannot access a disposed object.");

                int major, minor, patch;
                FT.FT_Library_Version(Reference, out major, out minor, out patch);
                return new Version(major, minor, patch);
            }
        }

        internal IntPtr Reference
        {
            get
            {
                if (IsDisposed)
                    throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");

                return reference;
            }

            set
            {
                if (IsDisposed)
                    throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");

                reference = value;
            }
        }

        #endregion

        #region Methods

        #region Base Interface

        /// <summary>
        /// This function calls <see cref="OpenFace" /> to open a font by its pathname.
        /// </summary>
        /// <param name="path">A path to the font file.</param>
        /// <param name="faceIndex">The index of the face within the font. The first face has index 0.</param>
        /// <returns>
        /// A handle to a new face object. If 'faceIndex' is greater than or equal to zero, it must be non-NULL.
        /// </returns>
        /// <see cref="OpenFace" />
        public Face NewFace(string path, int faceIndex)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            return new Face(this, path, faceIndex);
        }

        /// <summary>
        /// This function calls <see cref="OpenFace" /> to open a font which has been loaded into memory.
        /// </summary>
        /// <remarks>
        /// You must not deallocate the memory before calling <see cref="Face.Dispose()" />.
        /// </remarks>
        /// <param name="file">A pointer to the beginning of the font data.</param>
        /// <param name="faceIndex">The index of the face within the font. The first face has index 0.</param>
        /// <returns>
        /// A handle to a new face object. If 'faceIndex' is greater than or equal to zero, it must be non-NULL.
        /// </returns>
        /// <see cref="OpenFace" />
        public Face NewMemoryFace(byte[] file, int faceIndex)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            return new Face(this, file, faceIndex);
        }

        /// <summary>
        /// This function calls <see cref="OpenFace" /> to open a font which has been loaded into memory.
        /// </summary>
        /// <param name="bufferPtr">A pointer to the beginning of the font data.</param>
        /// <param name="length">Length of the buffer</param>
        /// <param name="faceIndex">The index of the face within the font. The first face has index 0.</param>
        /// <returns>
        /// A handle to a new face object. If 'faceIndex' is greater than or equal to zero, it must be non-NULL.
        /// </returns>
        public Face NewMemoryFace(IntPtr bufferPtr, int length, int faceIndex)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            return new Face(this, bufferPtr, length, faceIndex);
        }

        /// <summary>
        /// Create a <see cref="Face" /> object from a given resource described by <see cref="OpenArgs" />.
        /// </summary>
        /// <remarks>
        ///     <para>
        ///     Unlike FreeType 1.x, this function automatically creates a glyph slot for the face object which can be
        ///     accessed directly through <see cref="Face.Glyph" />.
        ///     </para>
        ///     <para>
        ///     OpenFace can be used to quickly check whether the font format of a given font resource is supported by
        ///     FreeType. If the 'faceIndex' field is negative, the function's return value is 0 if the font format is
        ///     recognized, or non-zero otherwise; the function returns a more or less empty face handle in '*aface' (if
        ///     'aface' isn't NULL). The only useful field in this special case is <see cref="Face.FaceCount" /> which gives
        ///     the number of faces within the font file. After examination, the returned <see cref="Face" /> structure
        ///     should be deallocated with a call to <see cref="Face.Dispose()" />.
        ///     </para>
        ///     <para>
        ///     Each new face object created with this function also owns a default <see cref="FTSize" /> object, accessible
        ///     as <see cref="Face.Size" />.
        ///     </para>
        ///     <para>
        ///     See the discussion of reference counters in the description of FT_Reference_Face.
        ///     </para>
        /// </remarks>
        /// <param name="args">
        /// A pointer to an <see cref="OpenArgs" /> structure which must be filled by the caller.
        /// </param>
        /// <param name="faceIndex">The index of the face within the font. The first face has index 0.</param>
        /// <returns>
        /// A handle to a new face object. If 'faceIndex' is greater than or equal to zero, it must be non-NULL.
        /// </returns>
        public Face OpenFace(OpenArgs args, int faceIndex)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            IntPtr faceRef;

            Error err = FT.FT_Open_Face(Reference, args.Reference, faceIndex, out faceRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            return new Face(faceRef, this);
        }

        #endregion

        #region Mac Specific Interface

        /// <summary>
        /// Create a new face object from a FOND resource.
        /// </summary>
        /// <remarks>
        /// This function can be used to create <see cref="Face" /> objects from fonts that are installed in the system
        /// as follows.
        /// <code>
        /// fond = GetResource( 'FOND', fontName );
        /// error = FT_New_Face_From_FOND( library, fond, 0, &face );
        /// </code>
        /// </remarks>
        /// <param name="fond">A FOND resource.</param>
        /// <param name="faceIndex">Only supported for the -1 'sanity check' special case.</param>
        /// <returns>A handle to a new face object.</returns>
        public Face NewFaceFromFond(IntPtr fond, int faceIndex)
        {
            if (!FT.IsMacOS)
                throw new InvalidOperationException(
                    $"{nameof(NewFaceFromFond)} can only be called on macOS.");

            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            IntPtr faceRef;

            Error err = FT.FT_New_Face_From_FOND(Reference, fond, faceIndex, out faceRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            return new Face(faceRef, this);
        }

        /// <summary>
        /// Create a new face object from a given resource and typeface index using an FSSpec to the font file.
        /// </summary>
        /// <remarks>
        /// <see cref="NewFaceFromFSSpec" /> is identical to <see cref="NewFace" /> except it accepts an FSSpec instead
        /// of a path.
        /// </remarks>
        /// <param name="spec">FSSpec to the font file.</param>
        /// <param name="faceIndex">The index of the face within the resource. The first face has index 0.</param>
        /// <returns>A handle to a new face object.</returns>
        public Face NewFaceFromFSSpec(IntPtr spec, int faceIndex)
        {
            if (!FT.IsMacOS)
                throw new InvalidOperationException(
                    $"{nameof(NewFaceFromFSSpec)} can only be called on macOS.");

            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            IntPtr faceRef;

            Error err = FT.FT_New_Face_From_FSSpec(Reference, spec, faceIndex, out faceRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            return new Face(faceRef, this);
        }

        /// <summary>
        /// Create a new face object from a given resource and typeface index using an FSRef to the font file.
        /// </summary>
        /// <remarks>
        /// <see cref="NewFaceFromFSRef" /> is identical to <see cref="NewFace" /> except it accepts an FSRef instead of
        /// a path.
        /// </remarks>
        /// <param name="ref">FSRef to the font file.</param>
        /// <param name="faceIndex">The index of the face within the resource. The first face has index 0.</param>
        /// <returns>A handle to a new face object.</returns>
        public Face NewFaceFromFSRef(IntPtr @ref, int faceIndex)
        {
            if (!FT.IsMacOS)
                throw new InvalidOperationException(
                    $"{nameof(NewFaceFromFSRef)} can only be called on macOS.");

            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            IntPtr faceRef;

            Error err = FT.FT_New_Face_From_FSRef(Reference, @ref, faceIndex, out faceRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            return new Face(faceRef, this);
        }

        #endregion

        #region Module Management

        /// <summary>
        /// Add a new module to a given library instance.
        /// </summary>
        /// <remarks>
        /// An error will be returned if a module already exists by that name, or if the module requires a version of
        /// FreeType that is too great.
        /// </remarks>
        /// <param name="clazz">A pointer to class descriptor for the module.</param>
        public void AddModule(ModuleClass clazz)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            Error err = FT.FT_Add_Module(Reference, clazz.Reference);

            if (err != Error.Ok)
                throw new FreeTypeException(err);
        }

        /// <summary>
        /// Find a module by its name.
        /// </summary>
        /// <remarks>
        /// FreeType's internal modules aren't documented very well, and you should look up the source code for
        /// details.
        /// </remarks>
        /// <param name="moduleName">The module's name (as an ASCII string).</param>
        /// <returns>A module handle. 0 if none was found.</returns>
        public Module GetModule(string moduleName)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            return new Module(FT.FT_Get_Module(Reference, moduleName));
        }

        /// <summary>
        /// Remove a given module from a library instance.
        /// </summary>
        /// <remarks>
        /// The module object is destroyed by the function in case of success.
        /// </remarks>
        /// <param name="module">A handle to a module object.</param>
        public void RemoveModule(Module module)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            if (module == null)
                throw new ArgumentNullException("module");

            Error err = FT.FT_Remove_Module(Reference, module.Reference);

            if (err != Error.Ok)
                throw new FreeTypeException(err);
        }

        /// <summary>
        /// Set a property for a given module.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        ///     <para>
        ///     The property name. Properties are described in the 'Synopsis' subsection
        ///     of the module's documentation.
        ///     </para>
        ///     <para>
        ///     Note that only a few modules have properties.
        ///     </para>
        /// </param>
        /// <param name="value">
        /// A generic pointer to a variable or structure which gives the new value of the property.
        /// The exact definition of 'value' is dependent on the property; see the 'Synopsis' subsection of the module's
        /// documentation.
        /// </param>
        public void PropertySet(string moduleName, string propertyName, IntPtr value)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            Error err = FT.FT_Property_Set(Reference, moduleName, propertyName, value);

            if (err != Error.Ok)
                throw new FreeTypeException(err);
        }

        /// <summary>
        /// Set a property for a given module.
        /// </summary>
        /// <typeparam name="T">The type of property to set.</typeparam>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        ///     <para>
        ///     The property name. Properties are described in the 'Synopsis' subsection
        ///     of the module's documentation.
        ///     </para>
        ///     <para>
        ///     Note that only a few modules have properties.
        ///     </para>
        /// </param>
        /// <param name="value">
        /// A generic pointer to a variable or structure which gives the new value of the property.
        /// The exact definition of 'value' is dependent on the property; see the 'Synopsis' subsection of the module's
        /// documentation.
        /// </param>
        public void PropertySet<T>(string moduleName, string propertyName, ref T value)
            where T : struct
        {
            GCHandle gch = GCHandle.Alloc(value, GCHandleType.Pinned);
            PropertySet(moduleName, propertyName, gch.AddrOfPinnedObject());
            gch.Free();
        }

        /// <summary>
        /// Set a property for a given module.
        /// </summary>
        /// <typeparam name="T">The type of property to set.</typeparam>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        ///     <para>
        ///     The property name. Properties are described in the 'Synopsis' subsection
        ///     of the module's documentation.
        ///     </para>
        ///     <para>
        ///     Note that only a few modules have properties.
        ///     </para>
        /// </param>
        /// <param name="value">
        /// A generic pointer to a variable or structure which gives the new value of the property.
        /// The exact definition of 'value' is dependent on the property; see the 'Synopsis' subsection of the module's
        /// documentation.
        /// </param>
        public void PropertySet<T>(string moduleName, string propertyName, T value)
            where T : struct
        {
            PropertySet(moduleName, propertyName, ref value);
        }

        /// <summary>
        /// Set a property for a given module.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        ///     <para>
        ///     The property name. Properties are described in the 'Synopsis' subsection
        ///     of the module's documentation.
        ///     </para>
        ///     <para>
        ///     Note that only a few modules have properties.
        ///     </para>
        /// </param>
        /// <param name="value">
        /// A generic pointer to a variable or structure which gives the new value of the property.
        /// The exact definition of 'value' is dependent on the property; see the 'Synopsis' subsection of the module's
        /// documentation.
        /// </param>
        public void PropertySet(string moduleName, string propertyName, GlyphToScriptMapProperty value)
        {
            GlyphToScriptMapPropertyRec rec = value.Rec;
            PropertySet(moduleName, propertyName, ref rec);
        }

        /// <summary>
        /// Set a property for a given module.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        ///     <para>
        ///     The property name. Properties are described in the 'Synopsis' subsection
        ///     of the module's documentation.
        ///     </para>
        ///     <para>
        ///     Note that only a few modules have properties.
        ///     </para>
        /// </param>
        /// <param name="value">
        /// A generic pointer to a variable or structure which gives the new value of the property.
        /// The exact definition of 'value' is dependent on the property; see the 'Synopsis' subsection of the module's
        /// documentation.
        /// </param>
        public void PropertySet(string moduleName, string propertyName, IncreaseXHeightProperty value)
        {
            IncreaseXHeightPropertyRec rec = value.Rec;
            PropertySet(moduleName, propertyName, ref rec);
        }

        /// <summary>
        /// Get a module's property value.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        /// The property name. Properties are described in the 'Synopsis' subsection of the
        /// module's documentation.
        /// </param>
        /// <param name="value">
        /// A generic pointer to a variable or structure which gives the value of the property. The
        /// exact definition of 'value' is dependent on the property; see the 'Synopsis' subsection of the module's
        /// documentation.
        /// </param>
        public void PropertyGet(string moduleName, string propertyName, IntPtr value)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            Error err = FT.FT_Property_Get(Reference, moduleName, propertyName, value);

            if (err != Error.Ok)
                throw new FreeTypeException(err);
        }

        /// <summary>
        /// Get a module's property value.
        /// </summary>
        /// <typeparam name="T">The type of property to get.</typeparam>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        /// The property name. Properties are described in the 'Synopsis' subsection of the
        /// module's documentation.
        /// </param>
        /// <param name="value">The value read from the module.</param>
        public void PropertyGet<T>(string moduleName, string propertyName, out T value)
            where T : struct
        {
            value = default;

            GCHandle gch = GCHandle.Alloc(value, GCHandleType.Pinned);
            PropertyGet(moduleName, propertyName, gch.AddrOfPinnedObject());
            value = PInvokeHelper.PtrToStructure<T>(gch.AddrOfPinnedObject());
            gch.Free();
        }

        /// <summary>
        /// Get a module's property value.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        /// The property name. Properties are described in the 'Synopsis' subsection of the
        /// module's documentation.
        /// </param>
        /// <param name="value">The value read from the module.</param>
        [Obsolete("Use PropertyGetGlyphToScriptMap instead")]
        public void PropertyGet(string moduleName, string propertyName, out GlyphToScriptMapProperty value)
        {
            value = PropertyGetGlyphToScriptMap(moduleName, propertyName);
        }

        /// <summary>
        /// Get a module's property value.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        /// The property name. Properties are described in the 'Synopsis' subsection of the
        /// module's documentation.
        /// </param>
        /// <param name="value">The value read from the module.</param>
        [Obsolete("Use PropertyGetIncreaseXHeight instead")]
        public void PropertyGet(string moduleName, string propertyName, out IncreaseXHeightProperty value)
        {
            value = PropertyGetIncreaseXHeight(moduleName, propertyName);
        }

        /// <summary>
        /// Gets a module's property value of the type <see cref="GlyphToScriptMapProperty" />.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        /// The property name. Properties are described in the 'Synopsis' subsection of the
        /// module's documentation.
        /// </param>
        /// <returns>The value read from the module.</returns>
        public GlyphToScriptMapProperty PropertyGetGlyphToScriptMap(string moduleName, string propertyName)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            GlyphToScriptMapPropertyRec rec;
            PropertyGet(moduleName, propertyName, out rec);

            Face face = childFaces.Find(f => f.Reference == rec.face);
            return new GlyphToScriptMapProperty(rec, face);
        }

        /// <summary>
        /// Gets a module's property value of the type <see cref="IncreaseXHeightProperty" />.
        /// </summary>
        /// <param name="moduleName">The module name.</param>
        /// <param name="propertyName">
        /// The property name. Properties are described in the 'Synopsis' subsection of the
        /// module's documentation.
        /// </param>
        /// <returns>The value read from the module.</returns>
        public IncreaseXHeightProperty PropertyGetIncreaseXHeight(string moduleName, string propertyName)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            IncreaseXHeightPropertyRec rec;
            PropertyGet(moduleName, propertyName, out rec);

            Face face = childFaces.Find(f => f.Reference == rec.face);
            return new IncreaseXHeightProperty(rec, face);
        }

        /// <summary>
        /// Set a debug hook function for debugging the interpreter of a font format.
        /// </summary>
        /// <remarks>
        ///     <para>
        ///     Currently, four debug hook slots are available, but only two (for the TrueType and the Type 1 interpreter)
        ///     are defined.
        ///     </para>
        ///     <para>
        ///     Since the internal headers of FreeType are no longer installed, the symbol 'FT_DEBUG_HOOK_TRUETYPE' isn't
        ///     available publicly. This is a bug and will be fixed in a forthcoming release.
        ///     </para>
        /// </remarks>
        /// <param name="hookIndex">
        /// The index of the debug hook. You should use the values defined in 'ftobjs.h', e.g.,
        /// 'FT_DEBUG_HOOK_TRUETYPE'.
        /// </param>
        /// <param name="debugHook">The function used to debug the interpreter.</param>
        public void SetDebugHook(uint hookIndex, IntPtr debugHook)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            FT.FT_Set_Debug_Hook(Reference, hookIndex, debugHook);
        }

        /// <summary>
        /// Add the set of default drivers to a given library object. This is only useful when you create a library
        /// object with <see cref="Library(Memory)" /> (usually to plug a custom memory manager).
        /// </summary>
        public void AddDefaultModules()
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            FT.FT_Add_Default_Modules(Reference);
        }

        /// <summary>
        /// Retrieve the current renderer for a given glyph format.
        /// </summary>
        /// <remarks>
        ///     <para>
        ///     An error will be returned if a module already exists by that name, or if the module requires a version of
        ///     FreeType that is too great.
        ///     </para>
        ///     <para>
        ///     To add a new renderer, simply use <see cref="AddModule" />. To retrieve a renderer by its name, use
        ///     <see cref="GetModule" />.
        ///     </para>
        /// </remarks>
        /// <param name="format">The glyph format.</param>
        /// <returns>A renderer handle. 0 if none found.</returns>
        public Renderer GetRenderer(GlyphFormat format)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            return new Renderer(FT.FT_Get_Renderer(Reference, format));
        }

        /// <summary>
        /// Set the current renderer to use, and set additional mode.
        /// </summary>
        /// <remarks>
        ///     <para>
        ///     In case of success, the renderer will be used to convert glyph images in the renderer's known format into
        ///     bitmaps.
        ///     </para>
        ///     <para>
        ///     This doesn't change the current renderer for other formats.
        ///     </para>
        ///     <para>
        ///     Currently, only the B/W renderer, if compiled with FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels
        ///     anti-aliasing mode; this option must be set directly in 'ftraster.c' and is undefined by default) accepts a
        ///     single tag 'pal5' to set its gray palette as a character string with 5 elements. Consequently, the third
        ///     and fourth argument are zero normally.
        ///     </para>
        /// </remarks>
        /// <param name="renderer">A handle to the renderer object.</param>
        /// <param name="numParams">The number of additional parameters.</param>
        /// <param name="parameters">Additional parameters.</param>
        public unsafe void SetRenderer(Renderer renderer, uint numParams, Parameter[] parameters)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            if (renderer == null)
                throw new ArgumentNullException("renderer");

            if (parameters == null)
                throw new ArgumentNullException("parameters");

            ParameterRec[] paramRecs = new ParameterRec[parameters.Length]; //parameters.Select(x => x.Record).ToArray();
            for (int i = 0; i < paramRecs.Length; i++)
            {
                paramRecs[i] = parameters[i].Record;
            }

            fixed (void* ptr = paramRecs)
            {
                Error err = FT.FT_Set_Renderer(Reference, renderer.Reference, numParams, (IntPtr) ptr);

                if (err != Error.Ok)
                    throw new FreeTypeException(err);
            }
        }

        #endregion

        #region LCD Filtering

        /// <summary>
        /// This function is used to apply color filtering to LCD decimated bitmaps, like the ones used when calling
        /// <see cref="GlyphSlot.RenderGlyph" /> with <see cref="RenderMode.Lcd" /> or
        /// <see cref="RenderMode.VerticalLcd" />.
        /// </summary>
        /// <remarks>
        ///     <para>
        ///     This feature is always disabled by default. Clients must make an explicit call to this function with a
        ///     'filter' value other than <see cref="LcdFilter.None" /> in order to enable it.
        ///     </para>
        ///     <para>
        ///     Due to <b>PATENTS</b> covering subpixel rendering, this function doesn't do anything except returning
        ///     <see cref="Error.UnimplementedFeature" /> if the configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is
        ///     not defined in your build of the library, which should correspond to all default builds of FreeType.
        ///     </para>
        ///     <para>
        ///     The filter affects glyph bitmaps rendered through <see cref="GlyphSlot.RenderGlyph" />,
        ///     <see cref="Outline.GetBitmap(FTBitmap)" />, <see cref="Face.LoadGlyph" />, and <see cref="Face.LoadChar" />.
        ///     </para>
        ///     <para>
        ///     It does not affect the output of <see cref="Outline.Render(RasterParams)" /> and
        ///     <see cref="Outline.GetBitmap(FTBitmap)" />.
        ///     </para>
        ///     <para>
        ///     If this feature is activated, the dimensions of LCD glyph bitmaps are either larger or taller than the
        ///     dimensions of the corresponding outline with regards to the pixel grid. For example, for
        ///     <see cref="RenderMode.Lcd" />, the filter adds up to 3 pixels to the left, and up to 3 pixels to the right.
        ///     </para>
        ///     <para>
        ///     The bitmap offset values are adjusted correctly, so clients shouldn't need to modify their layout and glyph
        ///     positioning code when enabling the filter.
        ///     </para>
        /// </remarks>
        /// <param name="filter">
        ///     <para>
        ///     The filter type.
        ///     </para>
        ///     <para>
        ///     You can use <see cref="LcdFilter.None" /> here to disable this feature, or <see cref="LcdFilter.Default" />
        ///     to use a default filter that should work well on most LCD screens.
        ///     </para>
        /// </param>
        public void SetLcdFilter(LcdFilter filter)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            Error err = FT.FT_Library_SetLcdFilter(Reference, filter);

            if (err != Error.Ok)
                throw new FreeTypeException(err);
        }

        /// <summary>
        /// Use this function to override the filter weights selected by <see cref="SetLcdFilter" />. By default,
        /// FreeType uses the quintuple (0x00, 0x55, 0x56, 0x55, 0x00) for <see cref="LcdFilter.Light" />, and (0x10,
        /// 0x40, 0x70, 0x40, 0x10) for <see cref="LcdFilter.Default" /> and <see cref="LcdFilter.Legacy" />.
        /// </summary>
        /// <remarks>
        ///     <para>
        ///     Due to <b>PATENTS</b> covering subpixel rendering, this function doesn't do anything except returning
        ///     <see cref="Error.UnimplementedFeature" /> if the configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is
        ///     not defined in your build of the library, which should correspond to all default builds of FreeType.
        ///     </para>
        ///     <para>
        ///     This function must be called after <see cref="SetLcdFilter" /> to have any effect.
        ///     </para>
        /// </remarks>
        /// <param name="weights">
        /// A pointer to an array; the function copies the first five bytes and uses them to specify the filter
        /// weights.
        /// </param>
        public void SetLcdFilterWeights(byte[] weights)
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            if (weights == null)
                throw new ArgumentNullException("weights");

            Error err = FT.FT_Library_SetLcdFilterWeights(Reference, weights);

            if (err != Error.Ok)
                throw new FreeTypeException(err);
        }

        #endregion

        #region The TrueType Engine

        /// <summary>
        /// Return an <see cref="EngineType" /> value to indicate which level of the TrueType virtual machine a given
        /// library instance supports.
        /// </summary>
        /// <returns>A value indicating which level is supported.</returns>
        public EngineType GetTrueTypeEngineType()
        {
            if (IsDisposed)
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");

            return FT.FT_Get_TrueType_Engine_Type(Reference);
        }

        #endregion

        /// <summary>
        /// Disposes the Library.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        internal void AddChildFace(Face child)
        {
            childFaces.Add(child);
        }

        internal void RemoveChildFace(Face child)
        {
            childFaces.Remove(child);
        }

        internal void AddChildGlyph(Glyph child)
        {
            childGlyphs.Add(child);
        }

        internal void RemoveChildGlyph(Glyph child)
        {
            childGlyphs.Remove(child);
        }

        internal void AddChildOutline(Outline child)
        {
            childOutlines.Add(child);
        }

        internal void RemoveChildOutline(Outline child)
        {
            childOutlines.Remove(child);
        }

        internal void AddChildStroker(Stroker child)
        {
            childStrokers.Add(child);
        }

        internal void RemoveChildStroker(Stroker child)
        {
            childStrokers.Remove(child);
        }

        internal void AddChildManager(Manager child)
        {
            childManagers.Add(child);
        }

        internal void RemoveChildManager(Manager child)
        {
            childManagers.Remove(child);
        }

        private void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                IsDisposed = true;

                //dipose all the children before disposing the library.
                foreach (Face f in childFaces)
                {
                    f.Dispose();
                }

                foreach (Glyph g in childGlyphs)
                {
                    g.Dispose();
                }

                foreach (Outline o in childOutlines)
                {
                    o.Dispose();
                }

                foreach (Stroker s in childStrokers)
                {
                    s.Dispose();
                }

                foreach (Manager m in childManagers)
                {
                    m.Dispose();
                }

                childFaces.Clear();
                childGlyphs.Clear();
                childOutlines.Clear();
                childStrokers.Clear();
                childManagers.Clear();

                Error err = customMemory ? FT.FT_Done_Library(reference) : FT.FT_Done_FreeType(reference);
                reference = IntPtr.Zero;
            }
        }

        #endregion
    }
}


text:
```json
{
  "_id": "user_197",
  "doc_type": "user",
  "user_id": 197,
  "account": {
    "username": "Eudora43",
    "password": "N8HERvS8btfGbmz",
    "created_on": 1442822452440,
    "modified_on": 1463594223905,
    "last_login": 1463527441638
  },
  "details": {
    "prefix": "Dr.",
    "first_name": "Albin",
    "middle_name": null,
    "last_name": "Price",
    "suffix": null,
    "company": null,
    "job_title": "Forward Markets Director",
    "dob": "2015-09-24",
    "home_country": "GQ"
  },
  "phones": [
    {
      "type": "Home",
      "phone_number": "(570) 615-4605",
      "extension": null,
      "primary": false
    },
    {
      "type": "Mobile",
      "phone_number": "(923) 578-2435",
      "extension": "1735",
      "primary": true
    }
  ],
  "emails": [
    {
      "type": "Other",
      "email_address": "Malvina15@gmail.com",
      "primary": true
    }
  ],
  "addresses": [
    {
      "type": "Home",
      "address_1": "98527 Tromp Light Lodge",
      "address_2": null,
      "locality": "South Selmerhaven",
      "iso_region": "GQ-CS",
      "postal_code": "49540-9412",
      "iso_country": "GQ",
      "primary": true
    },
    {
      "type": "Home",
      "address_1": "5783 Mathilde Vista Parkway",
      "address_2": "Apt. 899",
      "locality": "Schinnerside",
      "iso_region": "GQ-CS",
      "postal_code": "78895",
      "iso_country": "GQ",
      "primary": false
    }
  ]
}
```

### Model Definitions

```yaml
type: object
properties:
  _id:
    type: string
    description: The document id
  doc_type:
    type: string
    description: The document type "user"
  user_id:
    type: integer
    description: The users id
  account:
    type: object
    properties:
      username:
        type: string
        description: The users username
          fake: "{{internet.userName}}"
      password:
        type: string
        description: The users password
          fake: "{{internet.password}}"
      created_on:
        type: integer
        description: An epoch time of when the user was created
      modified_on:
        type: integer
        description: An epoch time of when the user was last modified
      last_login:
        type: integer
        description: An epoch time of when the contact was last modified
  details:
    type: object
    description: An object of the user details
    properties:
      prefix:
        type: string
        description: The users prefix
      first_name:
        type: string
        description: The users first name
          fake: "{{name.firstName}}"
      middle_name:
        type: string
        description: The users middle name
      last_name:
        type: string
        description: The users last name
      suffix:
        type: string
        description: The users suffix
      company:
        type: string
        description: The users company
      job_title:
        type: string
        description: The users job title
      dob:
        type: string
        description: The users date of birth
      home_country:
        type: string
        description: The users ISO home country
  phones:
    type: array
    description: An array of phone numbers for the user
    items:
      type: object
      properties:
        type:
          type: string
          description: The phone type
        phone_number:
          type: string
          description: The phone number
        extension:
          type: string
          description: The phone extension
        primary:
          type: boolean
          description: If the phone is the primary phone or not false
  emails:
    type: array
    description: An array of emails for the user
    items:
      type: object
      properties:
        type:
          type: string
          description: The phone type
        email_address:
          type: string
          description: The email address
        primary:
          type: boolean
          description: If the email address is the primary email address or not false
  addresses:
    type: array
    description: An array of addresses
    items:
      type: object
      properties:
        type:
          type: string
          description: The address type
        address_1:
          type: string
          description: The address 1
        address_2:
          type: string
          description: The address_2
        locality:
          type: string
          description: The locality
        iso_region:
          type: string
          description: The ISO region / state / province code
        postal_code:
          type: string
          description: The zip code / postal code
        iso_country:
          type: string
          description: The ISO country code
        primary:
          type: boolean
          description: If the email address is the primary email address or not false

```


text:
CameraScene::CameraScene(Context * ctx):
EmptyScene(),
 pitch(0),
 yaw(0),
 camera(ctx->getWindowWidth(), ctx->getWindowHeight())
{

}
CameraScene::~CameraScene()
{

}
void CameraScene::update()
{
   camera.update(getContext());
   if(Keyboard::key(GLFW_KEY_L))
   {
      if(Keyboard::isKeyToggled(GLFW_KEY_L))
      {
         glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
      }
      else
      {
         glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
      }
   }

}


text:
@implementation FollowingViewController
@synthesize orderedKeys, followerCell, channelCell;

- (id)initWithStyle:(UITableViewStyle)style andDataModel:(FollowingDataModel *)dataModel {
    if(self = [super initWithStyle:style]) {

		followingList = [dataModel retain];
		[self setOrderedKeys: [followingList orderKeysByUpdated]];

		NSLog(@"Order keys : %@", orderedKeys);
		[[NSNotificationCenter defaultCenter] addObserver: self
												 selector: @selector(onFollowingListUpdated)
													 name: [Events FOLLOWINGLIST_UPDATED]
												   object: nil];
	}

	return self;
}

- (void)viewDidLoad
{
	[super viewDidLoad];

	self.view.backgroundColor = APPSTYLEVAR(appBKgroundColor);
	self.tableView = [[[UITableView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.width, self.view.bottom - TABLE_DISPLAY_HEIGHT)] autorelease];
	self.tableView.backgroundColor = [UIColor clearColor];
}

- (void)viewDidAppear:(BOOL)animated {

}

- (void)dealloc
{
	[[TTNavigator navigator].URLMap removeURL:kcreateNewAcctURLPath];
	[[NSNotificationCenter defaultCenter] removeObserver: self];

	[followingList release];
	[orderedKeys release];

    [super dealloc];
}

- (void)onAddButton
{
	CustomAlert *alertView = nil;

	//Check if user trying to add the topic with anonymous user, then show an alert to please register urself.
	XMPPEngine *xmppEngine = (XMPPEngine *)[[BuddycloudAppDelegate sharedAppDelegate] xmppEngine];

	if([[[xmppEngine.xmppStream myJID] domain] rangeOfString: XMPP_ANONYMOUS_DEFAULT_JID].location != NSNotFound)
	{
		alertView = [[[CustomAlert alloc] initWithTitle:NSLocalizedString(alertPrompt, @"")
												message:NSLocalizedString(registerToFollowNewChannel, @"")
											   delegate:self
									  cancelButtonTitle:NSLocalizedString(cancelBtnLabel, @"")
									  otherButtonTitles:NSLocalizedString(registerBtnLabel, @""), nil] autorelease];
		[alertView show];

		return;
	}

	TextFieldAlertView *followView = [[TextFieldAlertView alloc] initWithTitle: NSLocalizedString(@"Add following", @"")
																	   message: NSLocalizedString(@"Enter Jabber or #Channel ID", @"")
																	  delegate: self
															 cancelButtonTitle: NSLocalizedString(@"Cancel", @"")
															 okButtonTitle:  NSLocalizedString(@"Follow", @"")];

	[[followView textField] setAutocapitalizationType: UITextAutocapitalizationTypeNone];
	[[followView textField] setKeyboardType: UIKeyboardTypeASCIICapable];

	[followView show];
	[followView release];
}

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
	if (buttonIndex != [alertView cancelButtonIndex]) {

		if ([alertView.message isEqualToString:NSLocalizedString(registerToFollowNewChannel, @"")]) {
			//Push the user to register screen.
			[[TTNavigator navigator] openURLAction:[TTURLAction actionWithURLPath:kcreateNewAcctURLPath]];
		}
		else {
			// User adds an item to follow
			[followingList followItem: [(TextFieldAlertView *)alertView enteredText]];
		}
	}
}

- (void)onFollowingListUpdated
{
	[self setOrderedKeys: [followingList orderKeysByUpdated]];

	[[self tableView] reloadData];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
	return [orderedKeys count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	UITableViewCell *cell = nil;

	FollowedItem *item = [followingList getItemByKey: [orderedKeys objectAtIndex: indexPath.row]];

	if (item) {
		if ([item isKindOfClass: [UserItem class]]) {
			FollowerCellController *controller = [[FollowerCellController alloc] initWithNibName:@"FollowerCell" bundle:[NSBundle mainBundle]];

			// Set cell data
			UserItem *userItem = (UserItem *)item;

			// Set table cell
			cell = (UITableViewCell *)controller.view;

			if ([userItem channel]) {
				cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
			}

			[[controller titleLabel] setText: [userItem title]];

			// Adjust & set description
			if ([[userItem description] length] > 0) {
				CGRect descriptionFrame = [[controller descriptionLabel] frame];
				CGSize descriptionSize = [[userItem description] sizeWithFont: [[controller descriptionLabel] font]
											   constrainedToSize: descriptionFrame.size
												   lineBreakMode: [[controller descriptionLabel] lineBreakMode]];

				descriptionFrame.size.height = descriptionSize.height;

				if ([[[userItem geoPrevious] text] length] == 0 || [[[userItem geoFuture] text] length] == 0) {
					descriptionFrame.origin.y -= [[[controller descriptionLabel] font] xHeight];
				}

				[[controller descriptionLabel] setFrame: descriptionFrame];
			}

			[[controller descriptionLabel] setText: [userItem description]];

			// Set geolocation labels
			[[controller geoPreviousLabel] setText: [[userItem geoPrevious] text]];
			[[controller geoCurrentLabel] setText: [[userItem geoCurrent] text]];
			[[controller geoFutureLabel] setText: [[userItem geoFuture] text]];

			if ([[[userItem geoPrevious] text] length] == 0) {
				// If there is no previous set, adjust curent & future frames
				[[controller geoFutureLabel] setFrame: [[controller geoCurrentLabel] frame]];
				[[controller geoCurrentLabel] setFrame: [[controller geoPreviousLabel] frame]];
			}

			//}

			//if ([userItem geoFuture]) {
			//}

			[controller release];
		}
		else if ([item isKindOfClass: [ChannelItem class]]) {
			ChannelCellController *controller = [[ChannelCellController alloc] initWithNibName:@"TopicCell" bundle:[NSBundle mainBundle]];

			// Set table cell
			cell = (UITableViewCell *)controller.view;
			cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

			// Set cell data
			ChannelItem *channelItem = (ChannelItem *)item;

			[[controller titleLabel] setText: [channelItem title]];
			[[controller rankLabel] setText: [NSString stringWithFormat: @"%@: %d", NSLocalizedString(@"Rank", @""), [channelItem rank]]];
			[[controller descriptionLabel] setText: [channelItem description]];

			[controller release];
		}
	}

	return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
	FollowedItem *item = [followingList getItemByKey: [orderedKeys objectAtIndex: indexPath.row]];
	ChannelItem *channel = [followingList getChannelItemForFollowedItem: item];

	if (channel) {
		NSLog(@"Channel : %@ and title = %@", [channel ident], [channel title]);
		PostsViewController *postViewController = [[[PostsViewController alloc] initWithNode: [channel ident]
																					andTitle: [channel title]] autorelease];

		[[TTNavigator navigator].topViewController.navigationController pushViewController:postViewController
																				  animated:YES];
	}
	else {
		[tableView deselectRowAtIndexPath: indexPath animated: YES];
	}
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
	CGFloat result = 64.0f;

	FollowedItem *item = [followingList getItemByKey: [orderedKeys objectAtIndex: indexPath.row]];

	if (item && [item isKindOfClass: [UserItem class]]) {
		UserItem *userItem = (UserItem *)item;

		if ([[userItem description] length] > 0) {
			UIFont *font = [UIFont fontWithName: @"Helvetica" size: 12];
			CGSize descriptionSize = [[userItem description] sizeWithFont: font
														constrainedToSize: CGSizeMake(tableView.bounds.size.width - 18, 30)
															lineBreakMode: UILineBreakModeTailTruncation];

			if ([[[userItem geoPrevious] text] length] == 0 || [[[userItem geoFuture] text] length] == 0) {
				result -= [font xHeight];
			}

			result += (descriptionSize.height + [font xHeight]);
		}
	}

	return ((result < 64.0f) ? 64.0f : result);
}

@end


text:
<?php

namespace RemiSan\Lock\Locker;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;
use RemiSan\Lock\Exceptions\LockingException;
use RemiSan\Lock\Exceptions\UnlockingException;
use RemiSan\Lock\Lock;
use RemiSan\Lock\Locker;
use RemiSan\Lock\LockStore;
use RemiSan\Lock\Quorum;
use RemiSan\Lock\TokenGenerator;
use Symfony\Component\Stopwatch\Stopwatch;

final class MultipleStoreLocker implements Locker, LoggerAwareInterface
{
    use LoggerAwareTrait;

    /** @var LockStore[] */
    private $stores = [];

    /** @var TokenGenerator */
    private $tokenGenerator;

    /** @var Quorum */
    private $quorum;

    /** @var Stopwatch */
    private $stopwatch;

    /**
     * MultipleStoreLocker constructor.
     *
     * @param LockStore[]    $stores         Array of persistence stores for the locks
     * @param TokenGenerator $tokenGenerator The token generator
     * @param Quorum         $quorum         The quorum implementation to use
     * @param Stopwatch      $stopwatch      A way to measure time passed
     */
    public function __construct(
        array $stores,
        TokenGenerator $tokenGenerator,
        Quorum $quorum,
        Stopwatch $stopwatch
    ) {
        $this->setStores($stores);
        $this->setQuorum($quorum);

        $this->tokenGenerator = $tokenGenerator;
        $this->stopwatch = $stopwatch;

        $this->logger = new NullLogger();
    }

    /**
     * {@inheritdoc}
     */
    public function lock($resource, $ttl = null, $retryDelay = 0, $retryCount = 0)
    {
        $lock = new Lock((string) $resource, $this->tokenGenerator->generateToken());

        $tried = 0;
        while (true) {
            try {
                return $this->lockAndCheckQuorumAndTtlOnAllStores($lock, $ttl);
            } catch (LockingException $e) {
                $this->logger->notice($e->getMessage(), ['resource' => $lock->getResource()]);
                $this->resetLock($lock);
            }

            if ($tried++ === $retryCount) {
                break;
            }

            $this->waitBeforeRetrying($retryDelay);
        }

        throw new LockingException('Failed locking the resource.');
    }

    /**
     * {@inheritdoc}
     */
    public function isLocked($resource)
    {
        foreach ($this->stores as $store) {
            if ($store->exists((string) $resource)) {
                return true;
            }
        }

        return false;
    }

    /**
     * {@inheritdoc}
     */
    public function unlock(Lock $lock)
    {
        foreach ($this->stores as $store) {
            if (!$store->delete($lock)) {
                if ($store->exists($lock->getResource())) {
                    // Only throw an exception if the lock is still present
                    throw new UnlockingException('Failed releasing the lock.');
                }
            }
        }
    }

    /**
     * Try locking resource on all stores.
     *
     * Measure the time to do it and reject if not enough stores have successfully
     * locked the resource or if time to lock on all stores have exceeded the ttl.
     *
     * @param Lock $lock The lock instance
     * @param int  $ttl  Time to live in milliseconds
     *
     * @throws LockingException
     *
     * @return Lock
     */
    private function lockAndCheckQuorumAndTtlOnAllStores(Lock $lock, $ttl)
    {
        $timeMeasure = $this->stopwatch->start($lock->getToken());
        $storesLocked = $this->lockOnAllStores($lock, $ttl);
        $timeMeasure->stop();

        $this->checkQuorum($storesLocked);

        if ($ttl) {
            $this->checkTtl($timeMeasure->getDuration(), $ttl);
            $lock->setValidityEndTime($timeMeasure->getOrigin() + $ttl);
        }

        return $lock;
    }

    /**
     * Lock resource on all stores and count how many stores did it with success.
     *
     * @param Lock $lock The lock instance
     * @param int  $ttl  Time to live in milliseconds
     *
     * @return int The number of stores on which the resource has been locked
     */
    private function lockOnAllStores(Lock $lock, $ttl)
    {
        $storesLocked = 0;

        foreach ($this->stores as $store) {
            if ($store->set($lock, $ttl)) {
                ++$storesLocked;
            }
        }

        return $storesLocked;
    }

    /**
     * Unlock the resource on all stores.
     *
     * @param Lock $lock The lock to release
     */
    private function resetLock($lock)
    {
        foreach ($this->stores as $store) {
            $store->delete($lock);
        }
    }

    /**
     * Init all stores passed to the constructor.
     *
     * If no store is given, it will return an InvalidArgumentException.
     *
     * @param LockStore[] $stores The lock stores
     *
     * @throws \InvalidArgumentException
     */
    private function setStores(array $stores)
    {
        if (count($stores) === 0) {
            throw new \InvalidArgumentException('You must provide at least one LockStore.');
        }

        $this->stores = $stores;
    }

    /**
     * Set the quorum based on the number of stores passed to the constructor.
     *
     * @param Quorum $quorum The quorum implementation to use
     */
    private function setQuorum(Quorum $quorum)
    {
        $this->quorum = $quorum;
        $this->quorum->init(count($this->stores));
    }

    /**
     * Check if the number of stores where the resource has been locked meet the quorum.
     *
     * @param int $storesLocked The number of stores on which the resource has been locked
     *
     * @throws LockingException
     */
    private function checkQuorum($storesLocked)
    {
        if (!$this->quorum->isMet($storesLocked)) {
            throw new LockingException('Quorum has not been met.');
        }
    }

    /**
     * Make the script wait before retrying to lock.
     *
     * @param int $retryDelay The retry delay in milliseconds
     */
    private function waitBeforeRetrying($retryDelay)
    {
        usleep($retryDelay * 1000);
    }

    /**
     * Checks if the elapsed time is inferior to the ttl.
     *
     * To the elapsed time is added a drift time to have a margin of error.
     * If this adjusted time is greater than the ttl, it will throw a LockingException.
     *
     * @param int $elapsedTime The time elapsed in milliseconds
     * @param int $ttl         The time to live in milliseconds
     *
     * @throws LockingException
     */
    private function checkTtl($elapsedTime, $ttl)
    {
        $adjustedElapsedTime = ($elapsedTime + $this->getDrift($ttl));

        if ($adjustedElapsedTime >= $ttl) {
            throw new LockingException('Time to lock the resource has exceeded the ttl.');
        }
    }

    /**
     * Get the drift time based on ttl in ms.
     *
     * Return the max drift time of all stores
     *
     * @param int $ttl The time to live in milliseconds
     *
     * @return float
     */
    private function getDrift($ttl)
    {
        return max(array_map(function (LockStore $store) use ($ttl) {
            return $store->getDrift($ttl);
        }, $this->stores));
    }
}


text:
#include "hst/environment.h"

#include <functional>
#include <memory>
#include <ostream>

#include "hst/event.h"
#include "hst/hash.h"
#include "hst/process.h"

namespace hst {

namespace {

class InternalChoice : public Process {
  public:
    explicit InternalChoice(Process::Set ps) : ps_(std::move(ps)) {}
    void initials(std::function<void(Event)> op) const override;
    void afters(Event initial,
                std::function<void(const Process&)> op) const override;
    void subprocesses(std::function<void(const Process&)> op) const override;

    std::size_t hash() const override;
    bool operator==(const Process& other) const override;
    unsigned int precedence() const override { return 7; }
    void print(std::ostream& out) const override;

  private:
    Process::Set ps_;
};

}  // namespace

const Process*
Environment::internal_choice(Process::Set ps)
{
    return register_process(new InternalChoice(std::move(ps)));
}

const Process*
Environment::internal_choice(const Process* p, const Process* q)
{
    return internal_choice(Process::Set{p, q});
}

// Operational semantics for ⊓ Ps
//
// 1) ──────────── P ∈ Ps
//     ⊓ Ps -τ→ P

void
InternalChoice::initials(std::function<void(Event)> op) const
{
    // initials(⊓ Ps) = {τ}
    op(Event::tau());
}

void
InternalChoice::afters(Event initial,
                       std::function<void(const Process&)> op) const
{
    // afters(⊓ Ps, τ) = Ps
    if (initial == Event::tau()) {
        for (const Process* process : ps_) {
            op(*process);
        }
    }
}

void
InternalChoice::subprocesses(std::function<void(const Process&)> op) const
{
    for (const Process* process : ps_) {
        op(*process);
    }
}

std::size_t
InternalChoice::hash() const
{
    static hash_scope internal_choice;
    return hasher(internal_choice).add(ps_).value();
}

bool
InternalChoice::operator==(const Process& other_) const
{
    const InternalChoice* other = dynamic_cast<const InternalChoice*>(&other_);
    if (other == nullptr) {
        return false;
    }
    return ps_ == other->ps_;
}

void
InternalChoice::print(std::ostream& out) const
{
    print_subprocesses(out, ps_, "⊓");
}

}  // namespace hst


text:
package com.mediamath.terminalone.models;

import java.util.ArrayList;

public class VideoCreativeUploadInfo {

  private String status;

  private long size;

  private long percent;

  private String name;

  private ArrayList<String> mirrorPath = new ArrayList<String>();

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public long getSize() {
    return size;
  }

  public void setSize(long size) {
    this.size = size;
  }

  public long getPercent() {
    return percent;
  }

  public void setPercent(long percent) {
    this.percent = percent;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public ArrayList<String> getMirrorPath() {
    return mirrorPath;
  }

  public void setMirrorPath(ArrayList<String> mirrorPath) {
    this.mirrorPath = mirrorPath;
  }

}


text:
var controllers = angular.module('classifyApp.controllers', []);

controllers.controller('UserListController',
		function($scope, $state, popupService, User) {
			$scope.users = User.query(); // fetch all users.
			$scope.deleteUser = function(user) { // Delete a user.
				if (popupService.showPopup('Really delete this?')) {
					user.$delete(function() {
						$scope.users = User.query();
					});
				}
			};
		}).controller('UserViewController',
		function($scope, $stateParams, User) {
			$scope.user = User.get({
				id : $stateParams.id
			}); // Get a single user.
		}).controller('UserCreateController',
		function($scope, $state, $stateParams, User) {
			$scope.user = new User(); // create new user instance. Properties
			// will be set via ng-model on UI
			$scope.addUser = function() { // create a new user.
				$scope.user.$save(function() {
					$state.go('users'); // on success go back to users state.
				});
			};
		}).controller('UserEditController',
		function($scope, $state, $stateParams, User, $rootScope) {
			$scope.updateUser = function() { // Update the edited user.
				$scope.user.$update(function() {
					if ($rootScope.userAuth.id == $scope.user.id) {
						$rootScope.userAuth = $scope.user;
					}
					$state.go('viewUser', {
						id : $scope.user.id
					}); // on success go back to viewUser state.
				});
			};

			$scope.loadUser = function() {
				$scope.user = User.get({
					id : $stateParams.id
				});
			};

			$scope.loadUser(); // Load a user which can be edited on UI
		}).controller('AdListController', function($scope, $state, Ad) {
	$scope.ads = Ad.query(); // fetch all ads.

}).controller('AdViewController', function($scope, $stateParams, Ad) {
	$scope.ad = Ad.get({
		id : $stateParams.id
	}); // Get a single ad.
}).controller('AdCreateController',
		function($scope, $state, $stateParams, Ad, User, $rootScope) {
			$scope.ad = new Ad(); // create new ad instance. Properties
			// will be set via ng-model on UI
			$scope.ad.guy = $rootScope.userAuth;
			$scope.addAd = function() { // create a new ad.
				$scope.ad.$save(function() {
					$state.go('ads'); // on success go back to ads state.
				});
			};
		}).controller('AdEditController',
		function($scope, $state, $stateParams, Ad) {
			$scope.updateAd = function() { // Update the edited ad.
				$scope.ad.$update(function() {
					$state.go('myAds'); // on success go back to myAds state.
				});
			};

			$scope.loadAd = function() {
				$scope.ad = Ad.get({
					id : $stateParams.id
				});
			};

			$scope.loadAd(); // Load a user which can be edited on UI
		}).controller('MyAdsController',
		function($scope, $state, popupService, Ad) {
			$scope.ads = Ad.query(); // fetch all ads.
			$scope.matchGuy = function(query) {
				return function(ad) {
					return (ad.guy.id == query);
				}
			};

			$scope.deleteAdd = function(ad) { // Delete an ad.
				if (popupService.showPopup('Really delete this?')) {
					ad.$delete(function() {
						$scope.ads = Ad.query();
					});
				}
			};

		});


text:
import { ElementRef, OnInit, OnDestroy, OnChanges, SimpleChange, EventEmitter } from 'angular2/core';
export declare class Rating implements OnInit, OnDestroy, OnChanges {
    private el;
    value: number;
    disabled: boolean;
    readonly: boolean;
    stars: number;
    cancel: boolean;
    valueChange: EventEmitter<any>;
    onRate: EventEmitter<any>;
    onCancel: EventEmitter<any>;
    initialized: boolean;
    stopNgOnChangesPropagation: boolean;
    constructor(el: ElementRef);
    ngOnInit(): void;
    ngOnChanges(changes: {
        [key: string]: SimpleChange;
    }): void;
    ngOnDestroy(): void;
}


text:
print ("Loop through and read each line")
my_file_object = open("my-file.txt", "r")
x=1
for line in my_file_object:
    print ("Line " + str(x) + ": " + line)
    x += 1

my_file_object.close()


text:
import _plotly_utils.basevalidators

class PositionValidator(_plotly_utils.basevalidators.EnumeratedValidator):
    def __init__(self, plotly_name="position", parent_name="pie.title", **kwargs):
        super(PositionValidator, self).__init__(
            plotly_name=plotly_name,
            parent_name=parent_name,
            edit_type=kwargs.pop("edit_type", "plot"),
            values=kwargs.pop(
                "values",
                [
                    "top left",
                    "top center",
                    "top right",
                    "middle center",
                    "bottom left",
                    "bottom center",
                    "bottom right",
                ],
            ),
            **kwargs,
        )


text:
import Notifications from 'ghost/utils/notifications';

export default {
    name: 'injectNotifications',

    initialize: function (container, application) {
        application.register('notifications:main', Notifications);

        application.inject('controller', 'notifications', 'notifications:main');
        application.inject('component', 'notifications', 'notifications:main');
        application.inject('route', 'notifications', 'notifications:main');
    }
};


text:
var router = require('express').Router();
var imageCtrl = require('../controllers/images');

router.get('/showProduct', imageCtrl.showProduct);

module.exports = router;