text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.ComponentModel;
using static OKHOSTING.Core.TypeExtensions;
using System.Linq.Expressions;

namespace OKHOSTING.UI.Animations
{
    /// <summary>
    /// Lets you perform animated transitions of properties on arbitrary objects. These
    /// will often be transitions of UI properties, for example an animated fade-in of
    /// a UI object, or an animated move of a UI object from one position to another.
    ///
    /// Each transition can simulataneously change multiple properties, including properties
    /// across multiple objects.
    ///
    /// Example transition
    /// ------------------
    /// a.      Transition t = new Transition(new TransitionMethod_Linear(500));
    /// b.      t.add(form1, "Width", 500);
    /// c.      t.add(form1, "BackColor", Color.Red);
    /// d.      t.run();
    ///
    /// Line a:         Creates a new transition. You specify the transition method.
    ///
    /// Lines b. and c: Set the destination values of the properties you are animating.
    ///
    /// Line d:         Starts the transition.
    ///
    /// Transition methods
    /// ------------------
    /// TransitionMethod objects specify how the transition is made. Examples include
    /// linear transition, ease-in-ease-out and so on. Different transition methods may
    /// need different parameters.
    /// </summary>
    /// <remarks>
    /// Based on a great project by Uwe Keim https://github.com/UweKeim/dot-net-transitions
    /// </remarks>
    public class Transition
    {
        /// <summary>
        /// The page where the controls are being displayed
        /// </summary>
        public IPage Page { get; set; }

        #region Registration

        /// <summary>
        /// You should register all managed-types here.
        /// </summary>
        static Transition()
        {
            RegisterType(new MemberTypes.Int());
            RegisterType(new MemberTypes.Float());
            RegisterType(new MemberTypes.Double());
            RegisterType(new MemberTypes.Color());
            RegisterType(new MemberTypes.String());
            RegisterType(new MemberTypes.Thickness());
            RegisterType(new MemberTypes.Point());
        }

        #endregion

        #region Events

        /// <summary>
        /// Event raised when the transition hass completed.
        /// </summary>
        public event EventHandler<EventArgs> TransitionCompleted;

        #endregion

        #region Public static methods

        /// <summary>
        /// Creates and immediately runs a transition on the property passed in.
        /// </summary>
        public static void Run<T, TReturn>(T target, Expression<Func<T, TReturn>> expression, TReturn destinationValue, ITimingFunction transitionMethod)
        {
            var member = new Data.MemberExpression<T, TReturn>(expression);
            Transition t = new Transition(transitionMethod);
            t.Add(target, expression, destinationValue);
            t.Run();
        }

        /// <summary>
        /// Sets the property passed in to the initial value passed in, then creates and
        /// immediately runs a transition on it.
        /// </summary>
        public static void Run<T, TReturn>(T target, Expression<Func<T, TReturn>> expression, TReturn initialValue, TReturn destinationValue, ITimingFunction transitionMethod)
        {
            var member = new Data.MemberExpression<T, TReturn>(expression);
            member.SetValue(target, initialValue);
            Run(target, expression, destinationValue, transitionMethod);
        }

        /// <summary>
        /// Creates a TransitionChain and runs it.
        /// </summary>
        public static void RunChain(params Transition[] transitions)
        {
            TransitionChain chain = new TransitionChain(transitions);
        }

        #endregion

        #region Public methods

        /// <summary>
        /// Constructor. You pass in the object that holds the properties
        /// that you are performing transitions on.
        /// </summary>
        public Transition(ITimingFunction transitionMethod)
        {
            TransitionMethod = transitionMethod;
        }

        /// <summary>
        /// Adds a property that should be animated as part of this transition.
        /// </summary>
        public void Add<T, TReturn>(T target, Expression<Func<T, TReturn>> expression, TReturn endValue)
        {
            Add(target, expression, default, endValue);
        }

        /// <summary>
        /// Adds a property that should be animated as part of this transition.
        /// </summary>
        public void Add<T, TReturn>(T target, Expression<Func<T, TReturn>> expression, TReturn startValue, TReturn endValue)
        {
            // We get the property info...
            Type targetType = target.GetType();

            var member = new Data.MemberExpression<T, TReturn>(expression);

            // We check that we support the property type...
            Type propertyType = member.ReturnType;

            if (propertyType.IsNullable())
            {
                propertyType = Nullable.GetUnderlyingType(propertyType);
            }

            if (MemberTypes.ContainsKey(propertyType) == false)
            {
                throw new Exception("Transition does not handle properties of type: " + propertyType.ToString());
            }

            // We can only transition properties that are both getable and setable...
            if (Data.MemberExpression.IsReadOnly(member.FinalMemberInfo))
            {
                throw new Exception("Property is not both getable and setable: " + member);
            }

            IMemberType managedType = MemberTypes[propertyType];

            // We can manage this type, so we store the information for the
            // transition of this property...
            TransitionedMember info = new TransitionedMember();
            info.endValue = endValue;
            info.target = target;
            info.Member = member;
            info.managedType = managedType;

            if (startValue != null && !startValue.Equals(default(TReturn)))
            {
                info.startValue = startValue;
            }

            lock (Lock)
            {
                ListTransitionedProperties.Add(info);
            }
        }

        /// <summary>
        /// Starts the transition.
        /// </summary>
        public void Run()
        {
            // We find the current start values for the properties we
            // are animating...
            foreach (TransitionedMember info in ListTransitionedProperties)
            {
                object value = info.Member.GetValue(info.target);
                info.startValue = info.managedType.Copy(value);
            }

            // We start the stopwatch. We use this when the timer ticks to measure
            // how long the transition has been runnning for...
            Stopwatch.Reset();
            Stopwatch.Start();

            // We register this transition with the transition manager...
            TransitionManager.GetInstance().Register(this);
        }

        #endregion

        #region Internal methods

        /// <summary>
        /// Property that returns a list of information about each property managed
        /// by this transition.
        /// </summary>
        internal IList<TransitionedMember> TransitionedProperties
        {
            get { return ListTransitionedProperties; }
        }

        /// <summary>
        /// We remove the property with the info passed in from the transition.
        /// </summary>
        internal void RemoveProperty(TransitionedMember info)
        {
            lock (Lock)
            {
                ListTransitionedProperties.Remove(info);
            }
        }

        /// <summary>
        /// Called when the transition timer ticks.
        /// </summary>
        internal void OnTimer()
        {
            // When the timer ticks we:
            // a. Find the elapsed time since the transition started.
            // b. Work out the percentage movement for the properties we're managing.
            // c. Find the actual values of each property, and set them.

            // a.
            int iElapsedTime = (int)Stopwatch.ElapsedMilliseconds;

            // b.
            double percentage;
            bool completed;
            TransitionMethod.OnTimer(iElapsedTime, out percentage, out completed);

            // We take a copy of the list of properties we are transitioning, as
            // they can be changed by another thread while this method is running...
            IList<TransitionedMember> listTransitionedProperties = new List<TransitionedMember>();
            lock (Lock)
            {
                foreach (TransitionedMember info in ListTransitionedProperties)
                {
                    listTransitionedProperties.Add(info.Copy());
                }
            }

            // c.
            foreach (TransitionedMember info in listTransitionedProperties)
            {
                // We get the current value for this property...
                object value = info.managedType.GetIntermediateValue(info.startValue, info.endValue, percentage);

                // We set it...
                PropertyUpdateArgs args = new PropertyUpdateArgs(info.target, info.Member, value);

                SetProperty(this, args);
            }

            // Has the transition completed?
            if (completed == true)
            {
                // We stop the stopwatch and the timer...
                Stopwatch.Stop();

                // We raise an event to notify any observers that the transition has completed...
                Utility.RaiseEvent(TransitionCompleted, this, new EventArgs());
            }
        }

        #endregion

        #region Private functions

        /// <summary>
        /// Sets a property on the object passed in to the value passed in. This method
        /// invokes itself on the GUI thread if the property is being invoked on a GUI
        /// object.
        /// </summary>
        private void SetProperty(object sender, PropertyUpdateArgs args)
        {
            try
            {
                // If the target is a control that has been disposed then we don't
                // try to update its properties. This can happen if the control is
                // on a form that has been closed while the transition is running...
                if (IsDisposed(args.target) == true)
                {
                    return;
                }

                ISynchronizeInvoke invokeTarget = args.target as ISynchronizeInvoke;

                if (invokeTarget != null && invokeTarget.InvokeRequired)
                {
                    // There is some history behind the next two lines, which is worth
                    // going through to understand why they are the way they are.

                    // Initially we used BeginInvoke without the subsequent WaitOne for
                    // the result. A transition could involve a large number of updates
                    // to a property, and as this call was asynchronous it would send a
                    // large number of updates to the UI thread. These would queue up at
                    // the GUI thread and mean that the UI could be some way behind where
                    // the transition was.

                    // The line was then changed to the blocking Invoke call instead. This
                    // meant that the transition only proceded at the pace that the GUI
                    // could process it, and the UI was not overloaded with "old" updates.

                    // However, in some circumstances Invoke could block and lock up the
                    // Transitions background thread. In particular, this can happen if the
                    // control that we are trying to update is in the process of being
                    // disposed - for example, it is on a form that is being closed. See
                    // here for details:
                    // http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/7d2c941a-0016-431a-abba-67c5d5dac6a5

                    // To solve this, we use a combination of the two earlier approaches.
                    // We use BeginInvoke as this does not block and lock up, even if the
                    // underlying object is being disposed. But we do want to wait to give
                    // the UI a chance to process the update. So what we do is to do the
                    // asynchronous BeginInvoke, but then wait (with a short timeout) for
                    // it to complete.
                    IAsyncResult asyncResult = invokeTarget.BeginInvoke(new EventHandler<PropertyUpdateArgs>(SetProperty), new object[] { sender, args });
                    asyncResult.AsyncWaitHandle.WaitOne(50);
                }
                else
                {
                    // We are on the correct thread, so we update the property...
                    Page.InvokeOnMainThread(() => args.Member.SetValue(args.target, args.value));
                }
            }
            catch (Exception)
            {
                // We silently catch any exceptions. These could be things like
                // bounds exceptions when setting properties.
            }
        }

        /// <summary>
        /// Returns true if the object passed in is a Control and is disposed
        /// or in the process of disposing. (If this is the case, we don't want
        /// to make any changes to its properties.)
        /// </summary>
        private bool IsDisposed(object target)
        {
            // Is the object passed in a Control?
            var controlTarget = target as IControl;

            if (controlTarget == null)
            {
                return false;
            }

            // Is it disposed or disposing?
            //if (controlTarget.IsDisposed == true || controlTarget.Disposing)
            //{
            //    return true;
            //}
            //else
            {
                return false;
            }
        }

        #endregion

        #region Private static functions

        /// <summary>
        /// Registers a transition-type. We hold them in a map.
        /// </summary>
        private static void RegisterType(IMemberType memberType)
        {
            Type type = memberType.GetManagedType();
            MemberTypes[type] = memberType;
        }

        #endregion

        #region Private static data

        // A map of Type info to IManagedType objects. These are all the types that we
        // know how to perform transitions on...
        private static IDictionary<Type, IMemberType> MemberTypes = new Dictionary<Type, IMemberType>();

        #endregion

        #region Private data

        // The transition method used by this transition...
        private ITimingFunction TransitionMethod = null;

        // The collection of properties that the current transition is animating...
        private readonly IList<TransitionedMember> ListTransitionedProperties = new List<TransitionedMember>();

        // Helps us find the time interval from the time the transition starts to each timer tick...
        private Stopwatch Stopwatch = new Stopwatch();

        // Event args used for the event we raise when updating a property...
        private class PropertyUpdateArgs : EventArgs
        {
            public PropertyUpdateArgs(object t, Data.MemberExpression pi, object v)
            {
                target = t;
                Member = pi;
                value = v;
            }
            public object target;
            public Data.MemberExpression Member;
            public object value;
        }

        // An object used to lock the list of transitioned properties, as it can be
        // accessed by multiple threads...
        private object Lock = new object();

        #endregion
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">

  <rewrite pattern="/person/inventory/{searchPattern}" xmlns="http://xmlns.gluu.org/jsf/pages"/>

  <navigation-rule>
    <from-view-id>/person/personInventory.xhtml</from-view-id>

    <navigation-case>
      <from-action>#{searchPersonAction.start}</from-action>
      <from-outcome>failure</from-outcome>
      <to-view-id>/home.xhtml</to-view-id>
      <redirect/>
    </navigation-case>

    <navigation-case>
      <from-action>#{searchPersonAction.search}</from-action>
      <from-outcome>failure</from-outcome>
      <to-view-id>/home.xhtml</to-view-id>
      <redirect/>
    </navigation-case>
  </navigation-rule>

</faces-config>

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="item_app_logo_height">72dip</dimen>
    <dimen name="item_app_name_height">38dip</dimen>
    <dimen name="item_app_popup_height">152dip</dimen>
    <dimen name="button_font_size">24sp</dimen>
    <dimen name="color_picker_gradient_height">306dip</dimen>
    <dimen name="color_picker_gradient_width">266dip</dimen>
    <dimen name="color_picker_line_color_height">52dip</dimen>
    <dimen name="color_picker_margin">10dip</dimen>
    <dimen name="color_picker_buttons_height">48dip</dimen>
</resources>


text:
package com.jcwhatever.nucleus.utils.coords;

import com.jcwhatever.nucleus.utils.PreCon;
import com.jcwhatever.nucleus.utils.ThreadSingletons;
import com.jcwhatever.nucleus.utils.ThreadSingletons.ISingletonFactory;

import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.util.Vector;

/**
 * 2D mutable coordinates.
 */
public class MutableCoords2D extends Coords2D {

    /**
     * Create a new {@link ThreadSingletons} instance.
     */
    public static ThreadSingletons<MutableCoords2D> createThreadSingletons() {
        return new ThreadSingletons<>(new ISingletonFactory<MutableCoords2D>() {
            @Override
            public MutableCoords2D create(Thread thread) {
                return new MutableCoords2D();
            }
        });
    }

    /**
     * Constructor.
     */
    public MutableCoords2D() {
        super(0, 0);
    }

    /**
     * Constructor.
     *
     * @param x  The x coordinates.
     * @param z  The z coordinates.
     */
    public MutableCoords2D(double x, double z) {
        super(x, z);
    }

    /**
     * Constructor.
     *
     *
Clones values from source coordinates.

     *
     * @param source  The source coordinates.
     */
    public MutableCoords2D(ICoords2D source) {
        super(source);
    }

    /**
     * Constructor.
     *
     *
Clones values from source coordinates and adds delta values.

     *
     * @param source  The source coordinates.
     * @param deltaX  The X coordinate values to add to the source coordinates.
     * @param deltaZ  The Z coordinate values to add to the source coordinates.
     */
    public MutableCoords2D(ICoords2D source, double deltaX, double deltaZ) {
        super(source, deltaX, deltaZ);
    }

    /**
     * Set the X coordinate.
     *
     * @param x  The X coordinate.
     */
    @Override
    public void setX(double x) {
        super.setX(x);
    }

    /**
     * Set the Z coordinate.
     *
     * @param z  The Z coordinate.
     */
    @Override
    public void setZ(double z) {
        super.setZ(z);
    }

    /**
     * Copy values from a {@link ICoords2D} instance.
     *
     * @param coords  The coordinates to copy.
     */
    public void copyFrom(ICoords2D coords) {
        PreCon.notNull(coords);

        super.setX(coords.getX());
        super.setZ(coords.getZ());
    }

    /**
     * Copy values from a {@link ICoords2Di} instance.
     *
     * @param coords  The coordinates to copy.
     */
    public void copyFrom(ICoords2Di coords) {
        PreCon.notNull(coords);

        super.setX(coords.getX());
        super.setZ(coords.getZ());
    }

    /**
     * Copy X and Z values from a {@link org.bukkit.Chunk} instance.
     *
     * @param chunk  The chunk to copy.
     */
    public void copyFrom(Chunk chunk) {
        PreCon.notNull(chunk);

        super.setX(chunk.getX());
        super.setZ(chunk.getZ());
    }

    /**
     * Copy X and Z values from a {@link org.bukkit.Location} instance.
     *
     * @param location  The location to copy.
     */
    public void copyFrom(Location location) {
        PreCon.notNull(location);

        super.setX(location.getX());
        super.setZ(location.getZ());
    }

    /**
     * Copy X and Z values from a {@link org.bukkit.util.Vector} instance.
     *
     * @param vector  The vector to copy.
     */
    public void copyFrom(Vector vector) {
        PreCon.notNull(vector);

        super.setX(vector.getX());
        super.setZ(vector.getZ());
    }

    @Override
    protected void seal() {
        // do nothing, prevent making the object immutable
    }
}


text:
(function () {
  'use strict';

  // define factory
  var serviceId = 'breeze.config';
  angular.module('app').factory(serviceId,
    ['breeze', 'common', 'spContext', configBreeze]);

  // create service
  function configBreeze(breeze, common, spContext) {
    // init service
    init();

    // service public signature
    return {
      dataservice: getDataService()
    };

    // init service
    function init() {

      // configure breeze to use SharePoint OData service
      var dsAdapter = breeze.config.initializeAdapterInstance('dataService', 'SharePointOData', true);

      // when breeze needs the request digest for sharepoint,
      //  this is how it will get it, from our sharepoint context
      dsAdapter.getRequestDigest = function () {
        return spContext.securityValidation;
      };

      common.logger.log("service loaded", null, serviceId);
    }

    function getDataService() {
      // set the data service endpoint
      return new breeze.DataService({
        // point to universal sharepoint rest endpoint for lists
        serviceName: spContext.hostWeb.appWebUrl + '/_api/web/lists/',
        // tell data service to NOT get the $metadata from sharepoint
        //  we will set it ourselves
        hasServerMetadata: false
      });
    }
  }
})();


text:
package io.hops.metadata.hdfs.entity;

import io.hops.metadata.common.CounterType;
import io.hops.metadata.common.FinderType;

/**
 * This class represents the state of an erasure-coded file and its parity file.
 * This includes the health as well as on-going encoding or repairs.
 */
public class EncodingStatus {

  /**
   * The erasure coding state of the file.
   */
  public static enum Status {
    /** This is not an erasure-coded file */
    NOT_ENCODED,
    /** The encoding was requested */
    ENCODING_REQUESTED,
    /** Encoding was requested and the file need to be rewritten to ensure
     * placement constraints */
    COPY_ENCODING_REQUESTED,
    /** The encoding is active */
    ENCODING_ACTIVE,
    /** The encoding was canceled */
    ENCODING_CANCELED,
    /** The encoding failed */
    ENCODING_FAILED,
    /** The file is encoded and healthy */
    ENCODED,
    /** The file is corrupt and a repair was requested  */
    REPAIR_REQUESTED,
    /** A repair is active */
    REPAIR_ACTIVE,
    /** A repair was canceled */
    REPAIR_CANCELED,
    /** A repair attempt failed */
    REPAIR_FAILED,
    /** The file was deleted. Intermediate state before being cleaned. */
    DELETED,
  }

  /**
   * The state of the parity file.
   */
  public static enum ParityStatus {
    /** All blocks are available and not corrupted */
    HEALTHY,
    /** Corruption was detected and a repair was requested */
    REPAIR_REQUESTED,
    /** A repair is active */
    REPAIR_ACTIVE,
    /** A repair was canceled */
    REPAIR_CANCELED,
    /** A repair attempt failed */
    REPAIR_FAILED
  }

  /** Internal counter to collect different statistics. */
  public static enum Counter implements CounterType<EncodingStatus> {
    /** Count all requested encodings */
    RequestedEncodings,
    /** Count all active encodings */
    ActiveEncodings,
    /** Count all active repairs */
    ActiveRepairs,
    /** Count all encoded files */
    Encoded;

    @Override
    public Class getType() {
      return EncodingStatus.class;
    }
  }

  /**
   * Internal finder to retrieve the status from the database.
   */
  public static enum Finder implements FinderType<EncodingStatus> {
    /** Use the file id to find the status */
    ByInodeId,
    /** Use the parity file id to find the status */
    ByParityInodeId;

    @Override
    public Class getType() {
      return EncodingStatus.class;
    }

    @Override
    public Annotation getAnnotated() {
      switch (this) {
        case ByInodeId:
          return Annotation.PrimaryKey;
        case ByParityInodeId:
          return Annotation.IndexScan;
        default:
          throw new IllegalStateException();
      }
    }

  }

  private Integer inodeId;
  private Integer parityInodeId;
  private Status status;
  private ParityStatus parityStatus;
  private EncodingPolicy encodingPolicy;
  private Long statusModificationTime;
  private Long parityStatusModificationTime;
  private String parityFileName;
  private Integer lostBlocks;
  private Integer lostParityBlocks;
  private Boolean revoked;

  /**
   * Construct an EncodingStatus.
   */
  public EncodingStatus() {

  }

  /**
   * Construct an EncodingStatus.
   *
   * @param status
   *    the status of the file
   */
  public EncodingStatus(Status status) {
    this.status = status;
  }

  /**
   * Construct an Encoding status.
   *
   * @param status
   *    the status of the file
   * @param encodingPolicy
   *    the encoding policy of the file
   * @param parityFileName
   *    the name of the parity file
   */
  public EncodingStatus(Status status, EncodingPolicy encodingPolicy,
      String parityFileName) {
    this.status = status;
    this.encodingPolicy = encodingPolicy;
    this.parityFileName = parityFileName;
  }

  /**
   * Construct an EncodingStatus.
   *
   * @param inodeId
   *    the inode id of the file
   * @param status
   *    the status of the file
   * @param encodingPolicy
   *    the encoding policy of the file
   * @param statusModificationTime
   */
  public EncodingStatus(Integer inodeId, Status status,
      EncodingPolicy encodingPolicy, Long statusModificationTime) {
    this.inodeId = inodeId;
    this.status = status;
    this.encodingPolicy = encodingPolicy;
    this.statusModificationTime = statusModificationTime;
  }

  /**
   * Construct an EncodingStatus.
   *
   * @param inodeId
   *    the inode id of the file
   * @param parityInodeId
   *    the inode id of the parity file
   * @param status
   *    the status of the file
   * @param parityStatus
   *    the status of the parity file
   * @param encodingPolicy
   *    the encoding policy of the file
   * @param statusModificationTime
   *    the timestamp representing the latest change of the status
   * @param parityStatusModificationTime
   *    the timestamp representing the latest change of the parity status
   * @param parityFileName
   *    the name of the parity file
   * @param lostBlocks
   *    the number of corrupted blocks
   * @param lostParityBlocks
   *    the number of corrupted parity blockes
   * @param revoked
   *    true if the encoding was revoked
   */
  public EncodingStatus(Integer inodeId, Integer parityInodeId, Status status,
      ParityStatus parityStatus, EncodingPolicy encodingPolicy,
      Long statusModificationTime, Long parityStatusModificationTime,
      String parityFileName, Integer lostBlocks, Integer lostParityBlocks,
      Boolean revoked) {
    this.inodeId = inodeId;
    this.parityInodeId = parityInodeId;
    this.status = status;
    this.parityStatus = parityStatus;
    this.encodingPolicy = encodingPolicy;
    this.statusModificationTime = statusModificationTime;
    this.parityStatusModificationTime = parityStatusModificationTime;
    this.parityFileName = parityFileName;
    this.lostBlocks = lostBlocks;
    this.lostParityBlocks = lostParityBlocks;
    this.revoked = revoked;
  }

  public EncodingStatus(EncodingStatus other) {
    this.inodeId = other.inodeId;
    this.parityInodeId = other.parityInodeId;
    this.status = other.status;
    this.parityStatus = other.parityStatus;
    this.encodingPolicy = other.encodingPolicy;
    this.statusModificationTime = other.statusModificationTime;
    this.parityStatusModificationTime = other.parityStatusModificationTime;
    this.parityFileName = other.parityFileName;
    this.lostBlocks = other.lostBlocks;
    this.lostParityBlocks = other.lostParityBlocks;
    this.revoked = other.revoked;
  }

  /**
   * Get the inode id of the file.
   *
   * @return
   *    the inode id of the file
   */
  public Integer getInodeId() {
    return inodeId;
  }

  /**
   * Set the inode id of the file
   *
   * @param inodeId
   *    the inode id of the file
   */
  public void setInodeId(Integer inodeId) {
    this.inodeId = inodeId;
  }

  /**
   * Get the inode id of the parity file
   *
   * @return
   *    the inode id of the parity file
   */
  public Integer getParityInodeId() {
    return parityInodeId;
  }

  /**
   * Set the inode id of the parity file.
   *
   * @param parityInodeId
   *    the inode id of the parity ifle
   */
  public void setParityInodeId(Integer parityInodeId) {
    this.parityInodeId = parityInodeId;
  }

  /**
   * Get the status of the file.
   *
   * @return
   *    the status of the file
   */
  public Status getStatus() {
    return status;
  }

  /**
   * Set the status of the file.
   *
   * @param status
   *    the status of the file
   */
  public void setStatus(Status status) {
    this.status = status;
  }

  /**
   * Get the status of the parity file.
   *
   * @return
   *    the status of the parity file
   */
  public ParityStatus getParityStatus() {
    return parityStatus;
  }

  /**
   * Set the status of the parity file.
   *
   * @param parityStatus
   *    the status of the parity file
   */
  public void setParityStatus(ParityStatus parityStatus) {
    this.parityStatus = parityStatus;
  }

  /**
   * Get the encoding policy.
   *
   * @return
   *  the encoding policy
   */
  public EncodingPolicy getEncodingPolicy() {
    return encodingPolicy;
  }

  /**
   * Set the encoding policy.
   *
   * @param encodingPolicy
   *    the encoding policy
   */
  public void setEncodingPolicy(EncodingPolicy encodingPolicy) {
    this.encodingPolicy = encodingPolicy;
  }

  /**
   * Get the timestamp representing the time when the status was modified.
   *
   * @return
   *    a unix timestamp representing the time when the status was modified
   */
  public Long getStatusModificationTime() {
    return statusModificationTime;
  }

  /**
   * Set the timestamp representing the time when the status was modified.
   *
   * @param statusModificationTime
   *    a unix timestamp representing the time when the status was modified
   */
  public void setStatusModificationTime(Long statusModificationTime) {
    this.statusModificationTime = statusModificationTime;
  }

  /**
   * Get the timestamp representing the time when the parity status was modified.
   *
   * @return
   *    a unix timestamp representing the time when the parity status was modified
   */
  public Long getParityStatusModificationTime() {
    return parityStatusModificationTime;
  }

  /**
   * Set the timestamp representing the time when the parity status was modified.
   *
   * @param parityStatusModificationTime
   *    a unix timestamp representing the time when the parity status was modified
   */
  public void setParityStatusModificationTime(
      Long parityStatusModificationTime) {
    this.parityStatusModificationTime = parityStatusModificationTime;
  }

  /**
   * Get the name of the parity file.
   *
   * @return
   *    the name of the parity file
   */
  public String getParityFileName() {
    return parityFileName;
  }

  /**
   * Set the name of the parity file.
   *
   * @param parityFileName
   *    the name of the parity file
   */
  public void setParityFileName(String parityFileName) {
    this.parityFileName = parityFileName;
  }

  /**
   * Get the number of corrupted blocks.
   *
   * @return
   *    the number of corrupted blocks.
   */
  public Integer getLostBlocks() {
    return lostBlocks;
  }

  /**
   * Set the number of corrupted blocks.
   *
   * @param lostBlocks
   *    the number of corrupted blocks.
   */
  public void setLostBlocks(Integer lostBlocks) {
    this.lostBlocks = lostBlocks;
  }

  /**
   * Get the number of corrupted parity blocks.
   *
   * @return
   *    the number of corrupted parity blocks.
   */
  public Integer getLostParityBlocks() {
    return lostParityBlocks;
  }

  /**
   * Set the number of corrupted parity blocks.
   *
   * @param lostParityBlocks
   *    the number of corrupted parity blocks.
   */
  public void setLostParityBlocks(Integer lostParityBlocks) {
    this.lostParityBlocks = lostParityBlocks;
  }

  /**
   * Get the revocation status of the file.
   *
   * @return
   *    true if undoing of the encoding was requested
   */
  public Boolean getRevoked() {
    return revoked;
  }

  /**
   * Set the revocation status of the file.
   *
   * @param revoked
   *    revocation status of the file
   */
  public void setRevoked(Boolean revoked) {
    this.revoked = revoked;
  }

  /**
   * Return if the file is encoded or encoding was requested.
   *
   * @return
   *    true if the file is encoded or encoding was requested
   */
  public boolean isEncoded() {
    switch (status) {
      case ENCODED:
      case REPAIR_REQUESTED:
      case REPAIR_ACTIVE:
      case REPAIR_CANCELED:
      case REPAIR_FAILED:
        return true;
      default:
        return false;
    }
  }

  /**
   * Return whether the file is corrupt or not. This does not consider the state
   * of the parity file.
   *
   * @return
   *    true if the file has corrupted blocks
   */
  public boolean isCorrupt() {
    switch (status) {
      case REPAIR_REQUESTED:
      case REPAIR_ACTIVE:
      case REPAIR_CANCELED:
      case REPAIR_FAILED:
        return true;
      default:
        return false;
    }
  }

  /**
   * Return whether a parity file repair is active.
   *
   * @return
   *    true if a parity file repair is active
   */
  public boolean isParityRepairActive() {
    switch (parityStatus) {
      case REPAIR_ACTIVE:
        return true;
      default:
        return false;
    }
  }

  /**
   * Return whether the parity file is corrupt or not.
   *
   * @return
   *    true if the parity file is corrupt
   */
  public boolean isParityCorrupt() {
    switch (parityStatus) {
      case REPAIR_ACTIVE:
      case REPAIR_REQUESTED:
      case REPAIR_CANCELED:
      case REPAIR_FAILED:
        return true;
      default:
        return false;
    }
  }

  @Override
  public String toString() {
    return "EncodingStatus{" +
        "inodeId=" + inodeId +
        ", parityInodeId=" + parityInodeId +
        ", status=" + status +
        ", parityStatus=" + parityStatus +
        ", encodingPolicy=" + encodingPolicy +
        ", statusModificationTime=" + statusModificationTime +
        ", parityStatusModificationTime=" + parityStatusModificationTime +
        ", parityFileName='" + parityFileName + '\'' +
        ", lostBlocks=" + lostBlocks +
        ", lostParityBlocks=" + lostParityBlocks +
        ", revoked=" + revoked +
        '}';
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    EncodingStatus status1 = (EncodingStatus) o;

    if (encodingPolicy != null ?
        !encodingPolicy.equals(status1.encodingPolicy) :
        status1.encodingPolicy != null) {
      return false;
    }
    if (inodeId != null ? !inodeId.equals(status1.inodeId) :
        status1.inodeId != null) {
      return false;
    }
    if (lostBlocks != null ? !lostBlocks.equals(status1.lostBlocks) :
        status1.lostBlocks != null) {
      return false;
    }
    if (lostParityBlocks != null ?
        !lostParityBlocks.equals(status1.lostParityBlocks) :
        status1.lostParityBlocks != null) {
      return false;
    }
    if (parityFileName != null ?
        !parityFileName.equals(status1.parityFileName) :
        status1.parityFileName != null) {
      return false;
    }
    if (parityInodeId != null ? !parityInodeId.equals(status1.parityInodeId) :
        status1.parityInodeId != null) {
      return false;
    }
    if (parityStatus != status1.parityStatus) {
      return false;
    }
    if (parityStatusModificationTime != null ? !parityStatusModificationTime
        .equals(status1.parityStatusModificationTime) :
        status1.parityStatusModificationTime != null) {
      return false;
    }
    if (revoked != null ? !revoked.equals(status1.revoked) :
        status1.revoked != null) {
      return false;
    }
    if (status != status1.status) {
      return false;
    }
    if (statusModificationTime != null ?
        !statusModificationTime.equals(status1.statusModificationTime) :
        status1.statusModificationTime != null) {
      return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int result = inodeId != null ? inodeId.hashCode() : 0;
    result =
        31 * result + (parityInodeId != null ? parityInodeId.hashCode() : 0);
    result = 31 * result + (status != null ? status.hashCode() : 0);
    result = 31 * result + (parityStatus != null ? parityStatus.hashCode() : 0);
    result =
        31 * result + (encodingPolicy != null ? encodingPolicy.hashCode() : 0);
    result = 31 * result +
        (statusModificationTime != null ? statusModificationTime.hashCode() :
            0);
    result = 31 * result + (parityStatusModificationTime != null ?
        parityStatusModificationTime.hashCode() : 0);
    result =
        31 * result + (parityFileName != null ? parityFileName.hashCode() : 0);
    result = 31 * result + (lostBlocks != null ? lostBlocks.hashCode() : 0);
    result = 31 * result +
        (lostParityBlocks != null ? lostParityBlocks.hashCode() : 0);
    result = 31 * result + (revoked != null ? revoked.hashCode() : 0);
    return result;
  }
}


text:
"""
Validate a list of images returning the filepaths and UUIDs of only the
valid images, or optionally, only the invalid images.
"""
import itertools
import logging
import os
import sys

from smqtk.utils.bin_utils import (
    basic_cli_parser,
    initialize_logging,
)
from smqtk.representation.data_element.file_element import DataFileElement
from smqtk.utils.image_utils import is_valid_element
from smqtk.utils import parallel

__author__ = 'dan.lamanna@kitware.com'

def get_cli_parser():
    parser = basic_cli_parser(__doc__, configuration_group=False)

    parser.add_argument('-i', '--invert',
                        default=False, action='store_true',
                        help='Invert results, showing only invalid images.')

    g_required = parser.add_argument_group("Required Arguments")
    g_required.add_argument('-f', '--file-list',
                            type=str, default=None, metavar='PATH',
                            help='Path to a file that lists data file paths.')
    return parser

def main():
    # Print help and exit if no arguments were passed
    if len(sys.argv) == 1:
        get_cli_parser().print_help()
        sys.exit(1)

    args = get_cli_parser().parse_args()
    llevel = logging.INFO if not args.verbose else logging.DEBUG
    initialize_logging(logging.getLogger('smqtk'), llevel)
    initialize_logging(logging.getLogger('__main__'), llevel)

    log = logging.getLogger(__name__)
    log.debug('Showing debug messages.')

    if args.file_list is not None and not os.path.exists(args.file_list):
        log.error('Invalid file list path: %s', args.file_list)
        exit(103)

    def check_image(image_path):
        if not os.path.exists(image_path):
            log.warn('Invalid image path given (does not exist): %s', image_path)
            return (False, False)
        else:
            dfe = DataFileElement(image_path)
            return (is_valid_element(dfe, check_image=True), dfe)

    with open(args.file_list) as infile:
        checked_images = parallel.parallel_map(check_image,
                                               itertools.imap(str.strip, infile),
                                               name='check-image-validity',
                                               use_multiprocessing=True)

        for (is_valid, dfe) in checked_images:
            if dfe != False: # in the case of a non-existent file
                if (is_valid and not args.invert) or (not is_valid and args.invert):
                    print('%s,%s' % (dfe._filepath, dfe.uuid()))

if __name__ == '__main__':
    main()


text:
- Introduced `beforeRender` option to mangle a view model before Taunus renders a server-side view

# v8.0.6 Model

- Fixed a long-standing bug where partials appended to other places would emit events using the wrong `container`

# v8.0.6 Box

- Introduced `taunus.partial.afterOf` method

# v8.0.5 Flex

- Introduced `taunus.partial.beforeOf` method

# v8.0.0 Hot and Heavy

- Upgraded `hget` to `2.0.0`

# v7.1.9 Wet and Dry

- Added `wet` option that avoids history updates on redirects

# v7.1.8 Acceptance

- Upgraded `accepts` to `1.3.0`

# v7.1.6 Render Carnage

- The client-side implementation now emits a `render.error` event whenever a view fails to render. It includes the following arguments: `err, container, model, route`

# v7.1.5 Toothpick

- Upgraded `gradual` to `1.0.7`

# v7.1.4 Idempotency

- Fixed a bug where the prefetched wouldn't work
- Changed `taunus.xhr` so that it can only make identical requests once every second

# v7.1.2 Lipstick

- Fixed a bug where deferral wouldn't work because the global alias was miscalculated

# v7.1.1 Makeup

- Fixed a bug in the prefetcher logic
- Introduced the ability to filter `DEBUG` message types using `DEBUG.filter('name|name|name')`

# v7.1.0 Garbage Truck

- Added a `taunus.track` method that keeps track of things that should be destroyed when a view or partial view gets removed from the document

# v7.0.0 Gradual

- Now using `crossvent` for event handling
- Incorporated `gradual` into Taunus core
- It can be accessed as `taunus.gradual`
- Option to disable `gradual` by setting `forms: false` in the options
- Option to disable link hijacking by setting `links: false` in the options

_For form submissions to be handled properly, make sure to honor the `as-text` query string, returning a plain text response even if the request asks for JSON_

# v6.1.8 Aural Emission

- Replaced `contra.emitter` with `contra@1.9.1/emitter`

# v6.1.6 Ancients

- Fixed `console.log` patch in `taunus/browser/debug` which would fail under IE9

# v6.1.5 Omnibox

- Replaced `fast-url-parser` with `omnibox` to broaden browser support

# v6.1.3 Body Double

- `taunus.partial.replace` changes the `container` to the first topmost element after replacement
- `partial(...).on('render', fn)` changed so that `fn` now receives `container` in addition to `html`

# v6.1.2 Pay Per View

- `taunus.partial.replace` now gets rid of the target DOM element entirely, as originally intended

# v6.1.1 Version Eagle

- Exposed a `versionCheck(version, url?)` method on the client-side that will redirect to `url` (or refresh the page), if there's a version mismatch. Returns `true` if the check passes
- Exposed a `state` object on the server-side containing the `version` that was used to mount Taunus

# v6.0.1 Carbon Emissions

- The `router` event is now properly emitted after a timeout

# v6.0.0 ViewState of the Art

- Partial view templates can now interact with the `route` model property just like master views
- Added `taunus.partial.appendTo`, `taunus.partial.beforeOf`, and `taunus.partial.replace` methods to complement `taunus.partial`
- Added `dry` option to `taunus.go`, which only updates the URL and relevant state components
- Added a `router(route)` event whenever the history route changes through Taunus

# v5.4.7 Literally

- Added an optional `as-text` query parameter for Taunus view responses to return JSON responses as plain-text HTML

# v5.4.6 Trailer Park

- `taunus.resolve` no longer returns routes with trailing slashes if they have a missing optional parameter

# v5.4.4 Lopsided Landslide

- All deferred templates and controllers are stored in memory, sorted by version

# v5.4.3 Two Bedroom Apartment

- Fixed an issue where versioning mismatches wouldn't refresh the page

# v5.4.2 Likable Links

- Taunus now ignores anchor tags with a `download` attribute
- Taunus now ignores anchor tags with `target='_blank'`
- Taunus now ignores anchor tags with a `data-taunus-ignore` attribute

# v5.3.4 Sans Lyrics

- Introduced ability to call `taunus.xhr` with `(options, done)` in addition to `(url, done)` and `(url, options, done)`

# v5.3.2 Gas Leak

- Added ability for redirects to be forced even if redirecting to the same URL

# v5.3.1 Gas Leak

- Fixed a bug where views wouldn't emit an event asynchronously if the view could be rendered immediately

# v5.3.0 Shale Gas

- Introduced a view-level event emitter. You can now do `taunus.partial(div, 'tags', ['a', 'b']).on('render', fn)` and `fn` will be eventually invoked when the partial is rendered. Useful for situations where a partial view may be rendered asynchronously because it was deferred.

# v5.2.0 Medal of Honor

- Exposed `taunus.redirect` method on the client-side

# v5.1.1 Casual Tuesday

- `taunus.xhr` now allows you to issue requests with content other than JSON _(e.g `multipart/form-data`)_ and still get a JSON response back

# v5.1.0 Twisted Transistor

- `taunus.redirect` now takes an `options` object, where you can set a `hard` option. If it's set to `true`, AJAX redirects will be followed using `location.href = url` rather than `taunus.navigate(url)`

# v5.0.0 Package Router

##### Views

- Exposed `route` information directly on view models, for convenience.
  - Most useful for accessing `route.query` parameters
  - Has `toJSON` no-op so that it doesn't bloat the model itself after use on templates

##### `.route(url?)`

- Removed `parts` from the result
- Introduced `hash` as a string containing the `#hash` part of a URL (equivalent of `parts.hash`, except it's `''` if empty)
- Introduced `path` (equivalent of `parts.path`)
- Introduced `pathname` (equivalent of `parts.pathname`)
- Introduced `search` (equivalent of `parts.search`)
- Introduced `query` as an equivalent of `parts.query`. Parsed according to input values:
  - `''` and `'true'` are converted to `true`
  - `'false'` is converted to `false`
  - `'123'`, `'-123'`, and `'+123'` are all converted to base-10 integers
  - Anything else stays a string

##### `.route.equals(a?, b?)`

- Faster and simpler, now compares on `route.path` _(ignoring hashes as usual)_

# v4.1.8 Deferred Globalization

- `require('taunus')` is automatically transformed into `require('taunus/global')` in deferred modules

# v4.1.7 Intense Database Bickering

- Fixed an issue in the underlying IndexedDB caching layer where it would throw on WebKit-based devices _(Safari, Chrome for iOS, etc)_

# v4.1.6 Hashcow

- Hash navigation no longer triggers a Taunus activation. Navigating from `/foo` to `/foo#bar` has no effect, while navigating from /foo#bar to `/baz#bar` still triggers an activation

# v4.1.5 Clown Clone

- The `taunus` API that's available in view templates will no longer leave a trace in the view model
- Partial templates can no longer modify the view model, and they have access to a cloned copy instead

# v4.1.3 Set Sail

- If loading a server-side controller results in an error other than `'MODULE_NOT_FOUND'`, the error is now thrown

# v4.1.1 Imperverance

- Exposed `version` property on client-side API
- Fixed an issue where routes with the same path but different query part would be considered identical

# v4.1.0 Transaction Reversal

- Removed `startIndex` parameter to Router API introduced in `4.0.0`

# v4.0.0 Roomba Loompa

- Navigating to the same route over and over no longer pushes new history states, uses `replaceState` instead
- Added `startIndex` parameter to Router API
- Taunus notices redirects and renders the appropriate view
- Introduced `taunus.redirect` API on the server-side

# v3.3.1 ER

- Fixes a bug caused by `v3.3.0`

# v3.3.0 Hack Journalism

- Internal `taunus.render` method _(consumed by `taunus-express` and `taunus-hapi`)_ changed signature. Upgrade to `taunus-express@1.2.0` or `taunus-hapi@1.4.0`.

# v3.2.5 Ruta 3

- Fix a bug on the client-side where you couldn't have multiple routes with the same route pattern
- Internal: Replaced `routes` with `ruta3` for flexibility and convenience

# v3.2.4 Test Run

- Fix failing test in `taunus.resolve` where optional parameters would be enforced

# v3.2.3 Major Resolve

- Fixed an issue where `taunus.resolve` would replace named regular expression parameters such as `:hash(d+)` and keep the regular expression part, resulting in `/hashes/5499cf5f(d+)` instead of  `/hashes/5499cf5f`

# v3.2.1 Optional Options

- Fixed an issue where `taunus.resolve` would replace falsy values with empty strings

# v3.2.0 Routing Solution

- Introduced `taunus.resolve(action, data)` method to resolve routes without manually constructing them, on both client-side and server-side

# v3.1.4 Action Figure

- Layout gets access to rendered `action` _(partials can always use JavaScript!)_

# v3.1.3 Spring Cleaning

- Removed `uglifyify` dependency
- Removed duplicate `uglify-js` dependency

# v3.1.2 Bumper Sticker

- Bumped `hget` to `1.1.0`

# v3.1.0 Prefetch Party

- Public `taunus.prefetch(url, element)` API exposed

# v3.0.2 Mirror Entity

- ETag is now computed out of the HTML (or text) and not just the model in non-JSON responses

# v3.0.1 Contractual Terms

- Added dependency on `contra`

# v3.0.0 Deferred Execution

- Taunus exposes itself as a global to simplify script deferral
- Introduced `taunus/browser/debug` and `taunus/global` alternative entry points
- Introduced deferred loading for view templates and view controllers
- Added `--defer` flag to the CLI
- Added `deferMinified` option to `taunus.mount` to minify deferred bundles
- Changed `taunus.route()`, now exposes query string as an object in `route.parts`
- Created `'change'` event, emitted whenever a view navigation occurs
- Created `taunus.state.clear()` method to clear the cache
- Renamed `--standalone` to `--bundle` in the CLI
- Created `getPartial` option for `taunus.mount` on the server-side

# v2.10.4 Version Tracker

- Fixed an issue where Taunus version-tracking was updating the wrong file

# v2.10.3 Cache Buster

- Reduced maximum interceptor latency to `50ms`, from previous `200ms` maximum
- Force directory creation when using the `taunus` CLI

# v2.10.2 Event Planner

- Improved consistency across event handler arguments

# v2.10.1 Consistent Baker

- Routes baked by the CLI are an array similar to the server-side routes created by the consumer, avoiding confusion

# v2.9.3 Exposed Request

- Exposed an `.xhr(url, options?, done)` method on the client-side Taunus API

# v2.9.2 Hash Awareness

- When navigating to a hashed route on a different view, the scroll position will be properly updated

# v2.9.1 Version Awareness

- Introduced versioning API, Taunus now has the ability to work through application version changes

# v2.8.6 Window Breaker

- Fixed an issue where the Taunus CLI would generate invalid CommonJS wiring modules

# v2.8.4 Scroll Acrobat

- Introduced `scroll` option for `taunus.navigate`, allowing the consumer to control whether scroll position should be modified
- Use `document.documentElement` as the default scroll target

# v2.8.0 Posted Bail

- Created `router.equals(route, route)` method
- Router now works even when passed partial routes such as `'#foo'` or `''`, using `location.href` as reference
- `taunus.navigate` won't fetch the model for a route that has the same parameters as the last route
- A `force` option on `taunus.navigate` can be used to request a model anyways
- A `strict` option on `taunus.navigate` can be used to ignore unmatched URLs
- `taunus.state` now exposes the current `route` alongside its model
- Fixed a bug where the caching layer would never pull cached results for hashed routes

# v2.7.2 Caching Miracles

- The `ETag` is now calculated using the full `viewModel`, and not just the `partial` view model

# v2.7.0 Treasure Cache

- Routes now properly override caching on an individual basis
- CLI flag `--replacements` renamed `--resolvers` for consistency
- Shortened resolver names for simplicity and to mitigate confusion
  - `getViewTemplatePath` is now `getView`
  - `getViewControllerPath` is now `getClientController`
  - `getControllerActionPath` is now `getServerController`
- On the client-side, throw if `bootstrap` is unsupported when `taunus.mount` is called
- If `taunus.navigate` is called with an URL that doesn't match any route, then the user will be redirected via `location.href`
- Added `canPreventDefault` property to interceptor `event` parameters

# v2.6.0 Event Bar

- Client-side controller signature changed to `controller(model, container, route)`

# v2.5.0 Public Speaking

- Renamed public `hget` option into `plaintext`
- Fixed link behavior where hash navigation _(as in `/foo#comments`)_ would trigger unnecessary AJAX requests
- Introduced simpler `manual` bootstrap option

# v2.4.1 Nitpick

- Added additional safe-guards against failed IndexedDB bootstrapping
- Fixed a bug when resolving relative paths in the Taunus CLI
- Fixed a bug when omitting the `options` object when invoking `taunus.mount` in the client-side
- `document.title` only changes if it's defined in the model
- The `container` object passed to `taunus.mount` on the client-side must be a DOM element

# v2.4.0 Bootstrap Overload

- Removed `manual` bootstrap option
- Introduced automatic bootstrap that fetches the model for you
- Reinstated inline bootstrap that expects model to be inline in a `<script type='text/taunus'>` tag
- Reduced maximum caching latency to `200ms` from `500ms`

# v2.3.0 Clickety Click

- Got rid of `localStorage` cache, relying solely on memory and IndexedDB cache stores
- Introduced link prefetching on `mouseover` and `touchstart` for anchor links with valid Taunus routes
- Default cache half-life set to `30` seconds
- Simplified interface to `'fetcher.*'` events

# v2.2.1 Back-End Portability

- Introduced ability to use different backends through `taunus-express` or `taunus-hapi`
- CLI arguments now have proper shorthand one-character aliases
- CLI supports transforming routes, e.g using `hapiify` to transform Hapi routes into something the client-side Taunus router understands
- Reasonable defaults using a dedicated `.bin` directory

# v2.0.0 Carrier Interceptor

- Interceptors are now event-drived
- Introduced blind-caching engine based on interceptors, disabled by default

# v1.8.3 Evented XHR

- Introduced more XHR-tracking events

# v1.8.2 Defer All The Things

- Model is now expected to load asynchronously via `taunusReady` global
- Introduced `jsonp` support
- Reduced amount of data transferred over JSON

# v1.7.6 Refund

- Requesting a new page provokes Taunus to `.abort` the request currently being made

# v1.7.5 Dependency Hoarder

- Removed dependency on `lodash.unescape`

# v1.7.3 Cache Driver

- A `max-age=0` header prevents stale content from never being refreshed

# v1.7.2 Cache Driver

- Changed `max-age` to only 1 hour

# v1.7.1 Slave Driver

- Add ability to rebuild default view model at a later point in time

# v1.6.21 Early Bird

Wait for `defaults` to become available before serving any responses

# v1.6.20 Negotiator

- Use `accepts` for content negotiation

# v1.6.19 Hollow Point

- Fixed an issue when navigating to hashes

# v1.6.8 Cat Food

- Fixed an issue with links being reloaded
- Fixed an issue when navigating backwards

# v1.6.4 Crash Course

- Changed caching model to `private, must-revalidate`, and set `max-age` to a day

# v1.6.3 Golf Cart

- Default view model no longer request-based, more memory efficient

# v1.5.1 Cache Negotiation

- Use a different URL when hijacking AJAX requests so that browsers properly cache JSON vs HTML

# v1.5.0 Cache Machine

- Introduced server-side view caching, setting `ETag`, `Vary`, and `cache-control` HTTP headers

# v1.4.10 Ancient Browsing

- Fix a bug where old browsers would change the `location.href` and execute AJAX code afterwards
- Fix a bug where `ignore` wouldn't be propagated by the CLI to client-side routes

# v1.4.8 Hollow Point

- Anchor links containing `<span>` or any other child elements that may be event targets now get hijacked as well

# v1.4.7 Sleepy Hollow

- Print the stack trace of captured template rendering errors

# v1.4.6 Skeptic Magician

- Fix a bug in browsers without history API
- Prevent `.mount` to be called more than once in the client-side
- Friendly error message if view rendering fails

# v1.4.5 Shy Shoulder

- Fix a bug where links wouldn't be ajax-enhanced

# v1.4.4 Sankara Stones

- Introduced `skip` to skip over view routes in certain situations

# v1.4.3 Dividing Line

- Added `ignore` option to allow routes that go straight to the server

# v1.4.2 Fancy Treat

- Introduced ability to set response status code in model

# v1.4.0 Responsive Design

- Implemented public API method that allows generating a response using the Taunus API

# v1.3.0 Ion Drive

- Browser support when `history` API is missing

# v1.2.2 Switcheroo

- Moved around arguments for `'error'` event

# v1.1.1 Silent Killer

- Event emitter no longer throws on errors

# v1.1.0 Renderist

- Renders views using `function(model)` on the server-side as well

# v1.0.6 Anchor Fighters

- Play nice on links with `href='#...'`

# v1.0.3 Rafael

- Fixed a missing reference to `raf`

# v1.0.2 Broken Promises

- Taunus now expects `data-taunus` attributes to match a `<script>` tag containing the view model

# v0.5.5 Backwards Compatibility

- Navigating through history properly triggers the corresponding scroll towards the route hash, or the top of the document

# v0.5.4 Logic Route

- Improved routing logic so that it remembers `search` and `hash` parts of a URL, while these won't factor into routing itself

# v0.5.3 Model of the State

- `taunus.state.model` now exposes the current view's model

# v0.5.2 Wary Goblin

- Introduced middleware option to modify base view model on a request basis

# v0.5.1 State of the Art

- Publish `state` on public API

# v0.4.5 Honorary Title

- Fix a bug when navigating backwards where the `document.title` wouldn't be updated

# v0.4.4 Brokeback Mountain

- Fix a bug when navigating backwards to a view that re-routed the action through `model.action`

# v0.4.3 User Matters

- `req.user` is automatically copied into `model.user`

# v0.4.2 Foo Fighters

- Relative paths for convenience

# v0.4.1 Action Figure

- Ability to change the default action through a property in the model

# v0.4.0 High Seas

- Introduced public API method `.navigate(url)`

# v0.3.6 Route 66

- Added an optional `route` parameter for internal use

# v0.3.5 Contextual Tasting

- Fixed a bug where the initial `start` and `render` events would broadcast the wrong context

# v0.3.3 Logical Perplexion

- Fixed navigation when clicking links that don't match a route

# v0.3.2 Steady Navigation

- Fixed navigation when clicking links

# v0.3.1 Boob Flash

- `res.viewModel.action` allows you to change the view to be rendered
- If the request has a `.flash` method, then it'll get consumed when generating a response

# v0.3.0 Exposed Parts

- Expose partials on the core API in the client-side

# v0.1.10 Lock Picking

- Use `'` intead of `"` in auto-generated wiring

# v0.1.9 Word Smith

- Reworded standalone CLI usage

# v0.1.8 Bug Crusher

Fixes

- Fixed an issue with controllers not running on the client-side

# v0.1.7 Enviroment Activism

- Separated concerns in routing, templating, and controllers in the client-side

# v0.1.6 XML Vulnerability

- Added ability to intercept model requests and return a cached response before they server is queried

# v0.1.5 Packaging

- `.taunusrc` options can also be configured in `package.json`, as the `taunus` property

# v0.1.4 Emancipation

- `taunus --standalone taunus.js` eliminates dependency on Common.JS and Browserify

# v0.1.3 Spare Change

Fixes

- Fixed an issue when clicking on links

# v0.1.2 Town Car

- Turned into an event emitter
- Link click route-checking is delegated from `document.body`
- Implemented replaceable module path resolvers for customization

# v0.1.1 Saucy Studio

- Fixed a CLI issue forming paths on Windows

# v0.1.0 Fiery Pony

- Initial Public Release


text:
layout: image
title: "#windsorinthewild"
tags: Research
discription: A visual compendium of a multi-year photographic and research project documenting the use of the typeface Windsor. The book collects over 100 usages of Windsor seen around the country from book covers to stickers to product packaging. An accopmanying essay considers Windsor's history in relationship to graphic design and notes its popular usage and rise and fall in popularity.
categories:
- Design
- Writing
- Photography
- Research
year: 2019
image: '/images/projects/windsor-book_04.jpg'
permalink: projects/windsorinthewild
---

↑ The book is divided into major sections including book covers, album covers, signage, and product packaging.


text:
use azure_sdk_auth_aad::*;
use azure_sdk_storage_blob::prelude::*;
use azure_sdk_storage_core::prelude::*;
use futures::stream::StreamExt;
use oauth2::ClientId;
use std::env;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client_id =
        ClientId::new(env::var("CLIENT_ID").expect("Missing CLIENT_ID environment variable."));
    let tenant_id = env::var("TENANT_ID").expect("Missing TENANT_ID environment variable.");

    let storage_account_name = std::env::args()
        .nth(1)
        .expect("please specify the storage account name as first command line parameter");

    let client = reqwest::Client::new();

    // the process requires two steps. The first is to ask for
    // the code to show to the user. This is done with the following
    // function. Notice you can pass as many scopes as you want.
    // Since we are asking for the "offline_access" scope we will
    // receive the refresh token as well.
    // We are requesting access to the storage account passed as parameter.
    let device_code_flow = begin_authorize_device_code_flow(
        &client,
        &tenant_id,
        &client_id,
        &[
            &format!(
                "https://{}.blob.core.windows.net/user_impersonation",
                storage_account_name
            ),
            "offline_access",
        ],
    )
    .await?;

    // now we must show the user the authentication message. It
    // will point the user to the login page and show the code
    // they have to specify.
    println!("{}", device_code_flow.message());

    // now we poll the auth endpoint until the user
    // completes the authentication. The following stream can
    // return, besides errors, a success meaning either
    // Success or Pending. The loop will continue until we
    // get either a Success or an error.
    let mut stream = Box::pin(device_code_flow.stream());
    let mut authorization = None;
    while let Some(resp) = stream.next().await {
        println!("{:?}", resp);

        // if we have the authorization, let's store it for later use.
        if let DeviceCodeResponse::AuthorizationSucceded(auth) = resp? {
            authorization = Some(auth);
        }
    }

    // remove the option (this is safe since we
    // unwrapped the errors before).
    let authorization = authorization.unwrap();

    println!(
        "\nReceived valid bearer token: {}",
        &authorization.access_token().secret()
    );

    if let Some(refresh_token) = authorization.refresh_token().as_ref() {
        println!("Received valid refresh token: {}", &refresh_token.secret());
    }

    // we can now spend the access token in other crates. In
    // this example we are creating an Azure Storage client
    // using the access token.
    let storage_client = client::with_bearer_token(
        &storage_account_name,
        &authorization.access_token().secret() as &str,
    );

    // now we enumerate the containers in the
    // specified storage account.
    let containers = storage_client.list_containers().finalize().await?;
    println!("\nList containers completed succesfully: {:?}", containers);

    // now let's refresh the token, if available
    if let Some(refresh_token) = authorization.refresh_token() {
        let refreshed_token =
            exchange_refresh_token(&client, &tenant_id, &client_id, None, refresh_token).await?;
        println!("refreshed token == {:#?}", refreshed_token);
    }

    Ok(())
}


text:
import App from './App.js'
import saga from './saga'
import reducer from './reducer'

import startApp from '../shared/index.js'

startApp(App, reducer, saga)


text:
import wx
from pagina import paginaSemplice

class pagina4 ( paginaSemplice ) :
	def __init__ ( self, parent , grandParent , index ) :
		paginaSemplice.__init__ ( self, parent , grandParent , index )

		#caricaImmagineDiSfondo (nome)
		self.caricaImmagineDiSfondo ("04_tessile/schermo.png")

		self.caricaImmagine("04_tessile/storiaArazzo.png",0);
		self.caricaVideo("04_tessile/videoPittrici.mp4",1);
		self.caricaVideo("04_tessile/videoCasarosa.mp4",2);
		self.caricaVideo("04_tessile/videoPieri.mp4",3);

		#associazioni.append ( (idVideo,linguetta,timeout=0) )
		self.associazioni.append((0,5,30000))
		self.associazioni.append((1,2))
		self.associazioni.append((2,16))
		self.associazioni.append((3,13))


text:
#ifndef RSCRIPTGENERATOR_H
#define RSCRIPTGENERATOR_H

#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <list>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "utilities.h"

class RScriptGenerator
{

public:
    RScriptGenerator(const std::string& filename, const std::string& resultPdfFile, std::string& resultTextFile);
    ~RScriptGenerator();
    bool generateScriptForStream(const std::list<int64_t>* transmitTimesToClients,  const std::list<int64_t>* transmitTimesToServer,
                                 const std::list<int64_t>* transmitTimesFromServer, uint16_t maxStreams);
    bool generateScriptForClientMessage(std::list<int> clientRecvTimes, std::list<int> serverRecvTimes, std::list<int> sendIntervals,
                                        const std::string& name, int serverTimeReq, int clientTimeReq, uint32_t numberOfClientsForwarded,
                                        std::list<uint16_t> sizes);
    bool generateScriptForServerMessage(std::list<int> clientRecvTimes, std::list<int> sendIntervals, const std::string& name,
                                        int clientTimeReq, uint16_t numberOfClientsForwarded, std::list<uint16_t> sizes);
    bool writeAndExecuteResultScript();
    bool generateBandwidthHistogram(double clientDownlink, double clientUplink, double serverDownlink, double serverUplink);
    bool addClientBandwidth(const Ipv4Address& addr, double downLink, double upLink, bool isClient = true);
    bool parseSingleNodePcapStats(const std::string& sourceFile, bool size, const Ipv4Address &addr, int clientNumber, bool isServer);
    bool parseOverallPcapStats(const std::string& sourceFile, const Ipv4Address& addr, int clientNumber, bool isServer, int startTime = 0, int joinTime = 0);

private:
    std::ofstream* filestream;
    std::string resultPdf;
    std::string resultTxt;
    std::string streamScript;
    std::string messageScript;
    static std::string colors[];
    static std::string lineTypes[];

    template <typename T> void writeRVectorToStream(const T& container, const std::string& name, std::stringstream& stream);

};

#endif // RSCRIPTGENERATOR_H


text:
<script>
	window.declaranime.CssClassBehavior = {
		properties: {
			fromClassName: {
				type: String
			},
			toClassName: {
				type: String
			}
		}
	};
</script>


text:
declare class Nightmare {
    constructor(options?: Nightmare.IConstructorOptions);

    // Interact
    userAgent(agent: string): Nightmare;
    end(): Nightmare;
    then<T, R>(fn: (value: T) => R): Promise<R>;
    halt(error: string, cb: () => void): Nightmare;
    goto(url: string): Nightmare;
    goto(url: string, headers: Object): Nightmare;
    back(): Nightmare;
    forward(): Nightmare;
    refresh(): Nightmare;
    click(selector: string): Nightmare;
    mousedown(selector: string): Nightmare;
    mouseup(selector: string): Nightmare;
    mouseover(selector: string): Nightmare;
    type(selector: string, text: string): Nightmare;
    insert(selector: string, text: string): Nightmare;
    check(seletor: string): Nightmare;
    uncheck(seletor: string): Nightmare;
    select(seletor: string, option: string): Nightmare;
    upload(selector: string, path: string): Nightmare;
    scrollTo(top: number, left: number): Nightmare;
    viewport(width: number, height: number): Nightmare;
    inject(type: string, file: string): Nightmare;
    evaluate<T1, T2, T3, R>(fn: (arg1: T1, arg2: T2, arg3: T3) => R, cb: (result: R) => void, arg1: T1, arg2: T2, arg3: T3): Nightmare;
    evaluate<T1, T2, R>(fn: (arg1: T1, arg2: T2) => R, cb: (result: R) => void, arg1: T1, arg2: T2): Nightmare;
    evaluate<T, R>(fn: (arg: T) => R, cb: (result: R) => void, arg: T): Nightmare;
    evaluate<T>(fn: (arg: T) => void, cb: () => void, arg: T): Nightmare;
    evaluate<R>(fn: () => R, cb: (result: R) => void): Nightmare;
    evaluate(fn: () => void): Nightmare;
    wait(): Nightmare;
    wait(ms: number): Nightmare;
    wait(selector: string): Nightmare;
    wait(fn: () => any, value: any, delay?: number): Nightmare;
    header(header: string, value: string): Nightmare;
    use(plugin: (nightmare: Nightmare) => void): Nightmare;
    run(cb?: (err: any, nightmare: Nightmare) => void): Nightmare;

    // Extract
    exists(selector: string, cb: (result: boolean) => void): Nightmare;
    visible(selector: string, cb: (result: boolean) => void): Nightmare;
    on(event: string, cb: () => void): Nightmare;
    on(event: 'initialized', cb: () => void): Nightmare;
    on(event: 'loadStarted', cb: () => void): Nightmare;
    on(event: 'loadFinished', cb: (status: string) => void): Nightmare;
    on(event: 'urlChanged', cb: (targetUrl: string) => void): Nightmare;
    on(event: 'navigationRequested', cb: (url: string, type: string, willNavigate: boolean, main: boolean) => void): Nightmare;
    on(event: 'resourceRequested', cb: (requestData: Nightmare.IRequest, networkRequest: Nightmare.INetwordRequest) => void): Nightmare;
    on(event: 'resourceReceived', cb: (response: Nightmare.IResponse) => void): Nightmare;
    on(event: 'resourceError', cb: (resourceError: Nightmare.IResourceError) => void): Nightmare;
    on(event: 'consoleMessage', cb: (msg: string, lineNumber: number, sourceId: number) => void): Nightmare;
    on(event: 'alert', cb: (msg: string) => void): Nightmare;
    on(event: 'confirm', cb: (msg: string) => void): Nightmare;
    on(event: 'prompt', cb: (msg: string, defaultValue?: string) => void): Nightmare;
    on(event: 'error', cb: (msg: string, trace?: Nightmare.IStackTrace[]) => void): Nightmare;
    on(event: 'timeout', cb: (msg: string) => void): Nightmare;
    once(event: string, cb: () => void): Nightmare;
    once(event: 'initialized', cb: () => void): Nightmare;
    once(event: 'loadStarted', cb: () => void): Nightmare;
    once(event: 'loadFinished', cb: (status: string) => void): Nightmare;
    once(event: 'urlChanged', cb: (targetUrl: string) => void): Nightmare;
    once(event: 'navigationRequested', cb: (url: string, type: string, willNavigate: boolean, main: boolean) => void): Nightmare;
    once(event: 'resourceRequested', cb: (requestData: Nightmare.IRequest, networkRequest: Nightmare.INetwordRequest) => void): Nightmare;
    once(event: 'resourceReceived', cb: (response: Nightmare.IResponse) => void): Nightmare;
    once(event: 'resourceError', cb: (resourceError: Nightmare.IResourceError) => void): Nightmare;
    once(event: 'consoleMessage', cb: (msg: string, lineNumber: number, sourceId: number) => void): Nightmare;
    once(event: 'alert', cb: (msg: string) => void): Nightmare;
    once(event: 'confirm', cb: (msg: string) => void): Nightmare;
    once(event: 'prompt', cb: (msg: string, defaultValue?: string) => void): Nightmare;
    once(event: 'error', cb: (msg: string, trace?: Nightmare.IStackTrace[]) => void): Nightmare;
    once(event: 'timeout', cb: (msg: string) => void): Nightmare;
    removeListener(event: string, cb: () => void): Nightmare;
    removeListener(event: 'initialized', cb: () => void): Nightmare;
    removeListener(event: 'loadStarted', cb: () => void): Nightmare;
    removeListener(event: 'loadFinished', cb: (status: string) => void): Nightmare;
    removeListener(event: 'urlChanged', cb: (targetUrl: string) => void): Nightmare;
    removeListener(event: 'navigationRequested', cb: (url: string, type: string, willNavigate: boolean, main: boolean) => void): Nightmare;
    removeListener(event: 'resourceRequested', cb: (requestData: Nightmare.IRequest, networkRequest: Nightmare.INetwordRequest) => void): Nightmare;
    removeListener(event: 'resourceReceived', cb: (response: Nightmare.IResponse) => void): Nightmare;
    removeListener(event: 'resourceError', cb: (resourceError: Nightmare.IResourceError) => void): Nightmare;
    removeListener(event: 'consoleMessage', cb: (msg: string, lineNumber: number, sourceId: number) => void): Nightmare;
    removeListener(event: 'alert', cb: (msg: string) => void): Nightmare;
    removeListener(event: 'confirm', cb: (msg: string) => void): Nightmare;
    removeListener(event: 'prompt', cb: (msg: string, defaultValue?: string) => void): Nightmare;
    removeListener(event: 'error', cb: (msg: string, trace?: Nightmare.IStackTrace[]) => void): Nightmare;
    removeListener(event: 'timeout', cb: (msg: string) => void): Nightmare;
    screenshot(done?: (err: any, buffer: Buffer) => void): Nightmare;
    screenshot(path: string, done?: (err: any) => void): Nightmare;
    screenshot(clip: { x: number, y: number, width: number, height: number }, done?: (err: any, buffer: Buffer) => void): Nightmare;
    screenshot(path: string, clip?: { x: number, y: number, width: number, height: number }, done?: (err: any) => void): Nightmare;
    html(path: string, saveType: string): Nightmare;
    html(path: string, saveType: 'HTMLOnly'): Nightmare;
    html(path: string, saveType: 'HTMLComplete'): Nightmare;
    html(path: string, saveType: 'MHTML'): Nightmare;
    pdf(path: string): Nightmare;
    pdf(path: string, options: Object): Nightmare;
    title(): string;
    title(cb: (title: string) => void): Nightmare;
    url(cb: (url: string) => void): Nightmare;
    url(): string;
    path(): string;

    readonly cookies: Nightmare.Cookies;

    // Settings
    authentication(user: string, password: string): Nightmare;
    useragent(useragent: string): Nightmare;
    viewport(width: number, height: number): Nightmare;
    zoom(zoomFactor: number): Nightmare;
    headers(headers: Object): Nightmare;
}

declare namespace Nightmare {
    export interface IConstructorOptions {
        timeout?: any;  // number | string;
        interval?: any; // number | string;
        port?: number;
        weak?: boolean;
        loadImages?: boolean;
        ignoreSslErrors?: boolean;
        sslProtocol?: string;
        webSecurity?: boolean;
        proxy?: string;
        proxyType?: string;
        proxyAuth?: string;
        cookiesFile?: string;
        phantomPath?: string;
        show?: boolean;
        typeInterval?: number;
        x?: number;
        y?: number;
    }

    export interface IRequest {
        id: number;
        method: string;
        url: string;
        time: Date;
        headers: Object;
    }
    export interface INetwordRequest {
        abort(): void;
        changeUrl(url: string): void;
        setHeader(key: string, value: string): void;
    }
    export interface IResponse {
        id: number;
        url: string;
        time: Date;
        headers: Object;
        bodySize: number;
        contentType: string;
        redirectURL: string;
        stage: string;
        status: number;
        statusText: string;
    }
    export interface IResourceError {
        id: number;
        url: string;
        errorCode: number;
        errorString: string;
    }
    export interface IStackTrace {
        file: string;
        line: number;
        function?: string;
    }
    export class Cookies {
        get(): [Nightmare.ICookie];
        get(name: string): Nightmare.ICookie;
        get(query: Nightmare.ICookieQuery): [Nightmare.ICookie];
        set(name: string, value: string): Nightmare;
        set(cookie: Nightmare.ICookie): Nightmare;
        set(cookies: [Nightmare.ICookie]): Nightmare;
        clear(): Nightmare;
        clear(name: string): Nightmare;
        clearAll(): Nightmare;
    }
    export interface ICookieQuery {
        url?: string;
        name?: string;
        domain?: string;
        path?: string;
        secure?: boolean;
        session?: boolean;

    }
    export interface ICookie {
        name: string;
        value: string;
        url?: string
        domain?: string;
        hostOnly?: boolean;
        path?: string;
        secure?: boolean;
        httpOnly?: boolean;
        session?: boolean;
        expirationDate?: number;
    }
}

export = Nightmare;


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GeometricPrimitive.cs" company="nGratis">
//   The MIT License (MIT)
//
//   Copyright (c) 2014 - 2015 Cahya Ong
//
//   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
//   associated documentation files (the "Software"), to deal in the Software without restriction, including
//   without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//   copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
//   following conditions:
//
//   The above copyright notice and this permission notice shall be included in all copies or substantial
//   portions of the Software.
//
//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
//   LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
//   EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
//   IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
//   THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
// <author>Cahya Ong - cahya.ong@gmail.com</author>
// <creation_timestamp>Monday, 27 July 2015 2:26:46 PM UTC</creation_timestamp>
// --------------------------------------------------------------------------------------------------------------------

namespace nGratis.Cop.Gaia.Client.Wpf.Sdk
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
    using nGratis.Cop.Core.Contract;
    using nGratis.Cop.Gaia.Engine;

    public abstract class GeometricPrimitive : IRenderPrimitive, IDisposable
    {
        private readonly IList<VertexPositionNormal> vertices = new List<VertexPositionNormal>();

        private readonly IList<ushort> indices = new List<ushort>();

        private VertexBuffer vertexBuffer;

        private IndexBuffer indexBuffer;

        private BasicEffect effect;

        private bool isDisposed;

        ~GeometricPrimitive()
        {
            this.Dispose(false);
        }

        public void Initialize(IDrawingCanvas drawingCanvas)
        {
            Guard.AgainstNullArgument(() => drawingCanvas);

            var graphicsDevice = drawingCanvas.GetDrawingContext<GraphicsDevice>();

            this.vertexBuffer = new VertexBuffer(
                graphicsDevice,
                typeof(VertexPositionNormal),
                this.vertices.Count,
                BufferUsage.None);

            this.vertexBuffer.SetData(this.vertices.ToArray());

            this.indexBuffer = new IndexBuffer(
                graphicsDevice,
                typeof(ushort),
                this.indices.Count,
                BufferUsage.None);

            this.indexBuffer.SetData(this.indices.ToArray());

            this.effect = new BasicEffect(graphicsDevice);
            this.effect.EnableDefaultLighting();
        }

        public void Render()
        {
            this.effect.World = Matrix.CreateFromYawPitchRoll(0.5F, 0.5F, 0) * Matrix.CreateTranslation(new Vector3());
            this.effect.View = Matrix.CreateLookAt(new Vector3(0, 0, 2.5F), Vector3.Zero, Vector3.Up);
            this.effect.DiffuseColor = Color.CornflowerBlue.ToVector3();
            this.effect.Alpha = 1.0F;

            var graphicsDevice = this.effect.GraphicsDevice;
            graphicsDevice.DepthStencilState = DepthStencilState.Default;
            graphicsDevice.BlendState = BlendState.Opaque;
            graphicsDevice.SetVertexBuffer(this.vertexBuffer);
            graphicsDevice.Indices = this.indexBuffer;

            this.effect.Projection = Matrix.CreatePerspectiveFieldOfView(1, graphicsDevice.Viewport.AspectRatio, 1, 10);

            var numTriangles = this.indices.Count / 3;

            foreach (var pass in this.effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                graphicsDevice.DrawIndexedPrimitives(
                    PrimitiveType.TriangleList,
                    0,
                    0,
                    this.vertices.Count,
                    0,
                    numTriangles);
            }
        }

        public void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected void AddVertex(Vector3 position, Vector3 normal)
        {
            this.vertices.Add(new VertexPositionNormal(position, normal));
        }

        protected void AddIndex(int index)
        {
            Guard.AgainstInvalidArgument(index > ushort.MaxValue, () => index);

            this.indices.Add((ushort)index);
        }

        protected virtual void Dispose(bool isDisposing)
        {
            if (this.isDisposed)
            {
                return;
            }

            if (isDisposing)
            {
                if (this.vertexBuffer != null)
                {
                    this.vertexBuffer.Dispose();
                    this.vertexBuffer = null;
                }

                if (this.indexBuffer != null)
                {
                    this.indexBuffer.Dispose();
                    this.indexBuffer = null;
                }

                if (this.effect != null)
                {
                    this.effect.Dispose();
                    this.effect = null;
                }
            }

            this.isDisposed = true;
        }
    }
}


text:
@implementation RXInitializeParentObject
+ (void)initialize {
    NSLog(@"Parent initialize");
}
- (void)print {
}
@end


text:
package com.entertailion.android.slideshow.rss;

import android.content.Context;

import com.entertailion.android.slideshow.images.ImageItem;

public class RssImageItem extends ImageItem {
	private static final String LOG_TAG = "RssImageItem";

	public RssImageItem(Context context, String thumbUrl, String imageUrl, String title, String owner, String ownerUrl, String pageUrl, String location) {
		super(context, thumbUrl, imageUrl, title, owner, ownerUrl, pageUrl, location);
	}

}


text:
```console
$ /usr/local/opt/terraform@0.12/bin/terraform state rm module.iam_admin
Removed module.iam_admin.aws_iam_access_key.key[0]
Removed module.iam_admin.aws_iam_group.group
Removed module.iam_admin.aws_iam_group_membership.membership
Removed module.iam_admin.aws_iam_group_policy.policy
Removed module.iam_admin.aws_iam_user.user[0]
Successfully removed 5 resource instance(s).
Releasing state lock. This may take a few moments...
```

## IAM AWS Account

### Forget

```console
$ /usr/local/opt/terraform@0.12/bin/terraform state rm aws_iam_account_password_policy.this
Removed aws_iam_account_password_policy.this
Successfully removed 1 resource instance(s).
Releasing state lock. This may take a few moments..
$ /usr/local/opt/terraform@0.12/bin/terraform state rm aws_iam_account_alias.this
Removed aws_iam_account_alias.this
Successfully removed 1 resource instance(s).
Releasing state lock. This may take a few moments...
```

## Route53 hyperbo.la zone

### Forget

```console
/usr/local/opt/terraform@0.12/bin/terraform state rm aws_route53_zone.hyperbola
Removed aws_route53_zone.hyperbola
Successfully removed 1 resource instance(s).
Releasing state lock. This may take a few moments...
```

## Route53 hyperbo.la email

### Forget

```console
$ /usr/local/opt/terraform@0.12/bin/terraform state rm module.hyperbola_email_dns
Removed module.hyperbola_email_dns.aws_route53_record.dkim
Removed module.hyperbola_email_dns.aws_route53_record.mx
Removed module.hyperbola_email_dns.aws_route53_record.txt
Successfully removed 3 resource instance(s).
Releasing state lock. This may take a few moments...
```


text:
Run records and reports from your overloadimpact suite.

The results and reports from program_runs, config_runs can be found here, as well as combined reports for various program runs.


text:
namespace benchmark {
std::ostream & operator << (std::ostream & out, const EvalVariants v){
  switch (v) {
    case EvalVariants::Eval:
      out << "Eval";
      break;
    case EvalVariants::EvalJacobian:
      out << "eJac";
      break;
  }
  return out;
}
}


text:
class WidgetFactory : protected Factory<Widget>, public Singleton<WidgetFactory>
{
    friend class Singleton<WidgetFactory>;
    WidgetFactory();
public:
    std::auto_ptr<Widget> operator()( std::string const& Name, Json::Value& Initer );
};

#endif//INCLUDED_UI_WIDGET_FACTORY_H


text:
<!DOCTYPE html>

  <link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.1/css/jspsych.css">
  <link rel="stylesheet" href="docs-demo.css" type="text/css">


text:
//    Copyright 2018 Google Inc.
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        https://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.

package com.google.fhir.wrappers;

import com.google.fhir.common.AnnotationUtils;
import com.google.fhir.common.ProtoUtils;
import com.google.fhir.r4.core.String;
import com.google.protobuf.MessageOrBuilder;
import java.util.regex.Pattern;

/** A wrapper around the String FHIR primitive type. */
public class StringWrapper extends PrimitiveWrapper<String> {
  private static final Pattern REGEX_PATTERN =
      Pattern.compile(AnnotationUtils.getValueRegexForPrimitiveType(String.getDefaultInstance()));

  @Override
  protected Pattern getPattern() {
    return REGEX_PATTERN;
  }

  private static final String NULL_STRING =
      String.newBuilder().addExtension(getNoValueExtension()).build();

  /** Create an StringWrapper from a String. */
  public StringWrapper(String string) {
    super(string);
  }

  public StringWrapper(MessageOrBuilder message) {
    super(ProtoUtils.fieldWiseCopy(message, String.newBuilder()).build());
  }

  /** Create an StringWrapper from a java String. */
  public StringWrapper(java.lang.String input) {
    super(input == null ? NULL_STRING : parseAndValidate(input));
  }

  private static String parseAndValidate(java.lang.String input) {
    validateUsingPattern(REGEX_PATTERN, input);
    return String.newBuilder().setValue(input).build();
  }

  @Override
  protected java.lang.String printValue() {
    return getWrapped().getValue();
  }
}


text:
using System.Threading.Tasks;

namespace Salesforce.Common
{
    public interface IServiceHttpClient
    {
        Task<T> HttpGetAsync<T>(string urlSuffix);
        //Task<T> HttpGetAsync<T>(string urlSuffix, string nodeName);
        Task<T> HttpPostAsync<T>(object inputObject, string urlSuffix);
        Task<bool> HttpPatchAsync(object inputObject, string urlSuffix);
        Task<bool> HttpDeleteAsync(string urlSuffix);
        void Dispose();
    }
}


text:
//----------------------------------*-C++-*----------------------------------//

//---------------------------------------------------------------------------//

#ifndef detran_SWEEPER1D_I_HH_
#define detran_SWEEPER1D_I_HH_

#include <iostream>
#ifdef DETRAN_ENABLE_OPENMP
#include <omp.h>
#endif

namespace detran
{

//---------------------------------------------------------------------------//
template <class EQ>
inline void Sweeper1D<EQ>::sweep(moments_type &phi)
{
  Require(d_g < d_material->number_groups());

  // Reset the flux moments
  phi.assign(phi.size(), 0.0);

#ifdef DETRAN_ENABLE_OPENMP
  moments_type phi_local;
#else
  moments_type &phi_local = phi;
#endif

  #pragma omp parallel default(shared) private(phi_local)
  {

  // Initialize equation and setup for this group.
  Equation_T equation(d_mesh, d_material, d_quadrature, d_update_psi);
  equation.setup_group(d_g);

  // Reset the flux moments
  phi_local.resize(d_mesh->number_cells(), 0.0);

  // Reset the boundary flux tally
  if (d_tally) d_tally->reset(d_g);

  // Initialize discrete sweep source vector.
  SweepSource<_1D>::sweep_source_type source(d_mesh->number_cells(), 0.0);

  // Temporary edge fluxes
  typename Equation_T::face_flux_type psi_in = 0.0;
  typename Equation_T::face_flux_type psi_out = 0.0;

  // Reference to boundary to simplify clutter.
  Boundary_T &b = *d_boundary;

  // Sweep over all octants
  for (size_t oo = 0; oo < 2; oo++)
  {
    size_t o = d_ordered_octants[oo];

    // Setup equation for this octant.
    equation.setup_octant(o);

    // Sweep over all angles.
    #pragma omp for
    for (size_t a = 0; a < d_quadrature->number_angles_octant(); ++a)
    {

      // Get sweep source for this angle.
      d_sweepsource->source(d_g, o, a, source);

      // Setup equation for this angle.
      equation.setup_angle(a);

      // Get psi if update requested.
      State::angular_flux_type psi;
      if (d_update_psi) psi = d_state->psi(d_g, o, a);

      // Update the boundary for this angle.
      if (d_update_boundary) b.update(d_g, o, a);

      // Get boundary fluxes.
      psi_out = b(d_face_index[o][Mesh::VERT][Boundary_T::IN], o, a, d_g);

      // Get index and increment
      int i  = d_space_ranges[o][0][0];
      int di = d_space_ranges[o][0][1];

      // Tally the incident flux.
      if (d_tally)
        d_tally->tally(i, 0, 0, d_g, o, a, Tally_T::X_DIRECTED, psi_out);

      // Sweep over all cells.
      for (size_t ii = 0; ii < d_mesh->number_cells_x(); ++ii, i += di)
      {
        // Set the incident cell surface flux.
        psi_in = psi_out;

        // Solve the equation in this cell.
        equation.solve(i, 0, 0, source, psi_in, psi_out, phi, psi);

        // Tally the outgoing cell flux
        if (d_tally)
          d_tally->tally(i, 0, 0, d_g, o, a, psi_out);

      } // end x loop

      // Update boundary.
      b(d_face_index[o][Mesh::VERT][Boundary_T::OUT], o, a, d_g) = psi_out;

      // Update the angular flux.
      if (d_update_psi) d_state->psi(d_g, o, a) = psi;

    } // end angle loop
    // end omp do

  } // end octant loop

#ifdef DETRAN_ENABLE_OPENMP
  // Sum local thread fluxes.
  #pragma omp critical
  {
    for (int i = 0; i < d_mesh->number_cells(); i++)
    {
      phi[i] += phi_local[i];
    }
  }
#endif

  } // end omp parallel

  #pragma omp master
  {
    d_number_sweeps++;
  }
  return;
}

} // end namespace detran

#endif /* detran_SWEEPER1D_I_HH_ */


text:
package com.qiudao.demo.mvcModule.interceptor;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by hdfs on 2016/5/31.
 */
public class HandlerInterceptor1 extends HandlerInterceptorAdapter {
    private static Logger logger = LogManager.getLogger(HandlerInterceptor1.class);
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        logger.info("HandlerInterceptor1 preHandle");
        return true;
        //return super.preHandle(request, response, handler);
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        logger.info("HandlerInterceptor1 postHandle");
        //super.postHandle(request, response, handler, modelAndView);
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        logger.info("HandlerInterceptor1 afterCompletion");
        //super.afterCompletion(request, response, handler, ex);
    }
}


text:
TOOL.Category = "Construction"
TOOL.Name = "#tool.luachip.name"

TOOL.RequiresTraceHit = true

TOOL.DefaultModel = "models/beer/wiremod/gate_e2.mdl"
TOOL.ClientConVar = {
	model = TOOL.DefaultModel
}

cleanup.Register("luachips")

if SERVER then
	CreateConVar("sbox_maxluachips", 5)

	function TOOL:LeftClick(trace)
		local owner = self:GetOwner()
		if not owner:IsAdmin() then -- for now only allow admins to use this
			return false
		end

		if not util.IsValidPhysicsObject(trace.Entity, trace.PhysicsBone) then
			return false
		end

		if luachip.RequestCode(owner, trace.Entity) then
			return true
		end

		if not owner:CheckLimit("luachips") then
			return false
		end

		local entity = ents.Create("luachip")
		if not IsValid(entity) then
			return false
		end

		local model = self:GetClientInfo("model")
		if not util.IsValidModel(model) then
			model = self.DefaultModel
		end

		entity:SetModel(model)
		local ang = trace.HitNormal:Angle()
		ang.pitch = ang.pitch + 90
		entity:SetAngles(ang)
		entity:SetPos(trace.HitPos)
		entity:SetPlayer(owner)
		entity:Spawn()

		entity:SetPos(trace.HitPos - trace.HitNormal * entity:OBBMins().z)

		local weld = constraint.Weld(entity, trace.Entity, 0, trace.PhysicsBone, 0, true, false)
		undo.Create("luachip")
			undo.AddEntity(entity)
			undo.AddEntity(weld)
			undo.SetPlayer(owner)
		undo.Finish()

		owner:AddCount("luachips", entity)
		owner:AddCleanup("luachips", entity)

		return luachip.RequestCode(owner, entity)
	end

	function TOOL:RightClick(trace)
		local owner = self:GetOwner()
		if not owner:IsAdmin() then -- for now only allow admins to use this
			return false
		end

		if luachip.SendCode(owner, trace.Entity) then
			return true
		end

		return luachip.OpenEditor(owner)
	end

	function TOOL:Reload(trace)
		local owner = self:GetOwner()
		if not owner:IsAdmin() then -- for now only allow admins to use this
			return false
		end

		if luachip.Reset(owner, trace.Entity) then
			return true
		end

		return false
	end
else
	language.Add("tool.luachip.name", "LuaChip")
	language.Add("tool.luachip.desc", "Creates LuaChips that allow you to execute Lua on the server")
	language.Add("tool.luachip.0", "Left click to spawn/update LuaChips. Right click to edit LuaChips or open the editor. Reload to reset LuaChips.")

	function TOOL.BuildCPanel(CPanel, FaceEntity)
		CPanel:AddControl("Header", {Description = "#tool.luachip.desc"})
	end
end


text:
ifndef LG_RT_DIR
$(error LG_RT_DIR variable is not defined, aborting build)
endif

#Flags for directing the runtime makefile what to include
DEBUG ?= 0                   # Include debugging symbols
OUTPUT_LEVEL ?= LEVEL_PRINT  # Compile time print level

# GASNet and CUDA off by default for now
USE_GASNET ?= 0
USE_CUDA ?= 0

# Put the binary file name here
OUTFILE		:= reducetest
# List all the application source files here
GEN_SRC		:= reducetest.cc # .cc files
GEN_GPU_SRC	:=		    # .cu files

# You can modify these variables, some will be appended to by the runtime makefile
INC_FLAGS	:=
NVCC_FLAGS	:= -Xptxas -v
GASNET_FLAGS	:=
LD_FLAGS	:=

include $(LG_RT_DIR)/runtime.mk

ifndef NVCC
NVCC	= $(CUDA)/bin/nvcc
endif

TESTARGS.default =
TESTARGS.short = -batches 1
TESTARGS.long = -batches 1024
RUNMODE ?= default

run : $(OUTFILE)
	@echo $(dir $(OUTFILE))$(notdir $(OUTFILE)) $(TESTARGS.$(RUNMODE))
	@$(dir $(OUTFILE))$(notdir $(OUTFILE)) $(TESTARGS.$(RUNMODE))