text:
namespace shaka {

namespace {
struct Base : BackingObject {
  static std::string name() {
    return "Base";
  }

  ReturnVal<JsValue> JsThis() {
    CHECK(false);
  }
  void Trace(memory::HeapTracer*) const override {}
  BackingObjectFactoryBase* factory() const override {
    return nullptr;
  }

  int i = 12;
  std::string j = "abc";
};
struct Derived : Base {};

}  // namespace

class RefPtrTest : public testing::Test {
 public:
  ~RefPtrTest() override {
    tracker_.Dispose();
  }

 protected:
  uint32_t GetRefCount(memory::Traceable* object) const {
    return tracker_.GetRefCount(object);
  }

  void ExpectEmptyTracker() {
    EXPECT_EQ(0u, tracker_.GetRefCount(base1_));
    EXPECT_EQ(0u, tracker_.GetRefCount(base2_));
    EXPECT_EQ(0u, tracker_.GetRefCount(derived_));
  }

  memory::ObjectTracker::UnsetForTesting unset_;
  memory::HeapTracer heap_tracer_;
  memory::ObjectTracker tracker_{&heap_tracer_};
  Base* base1_ = new Base;
  Base* base2_ = new Base;
  Derived* derived_ = new Derived;
};

TEST_F(RefPtrTest, BasicFlow) {
  {
    RefPtr<Base> ptr1(base1_);
    EXPECT_EQ(1u, GetRefCount(base1_));
    EXPECT_EQ(0u, GetRefCount(base2_));

    ptr1 = base2_;
    EXPECT_EQ(0u, GetRefCount(base1_));
    EXPECT_EQ(1u, GetRefCount(base2_));

    RefPtr<Base> ptr2(base2_);
    EXPECT_EQ(0u, GetRefCount(base1_));
    EXPECT_EQ(2u, GetRefCount(base2_));
  }

  ExpectEmptyTracker();
}

TEST_F(RefPtrTest, SupportsCopyAndMove) {
  {
    RefPtr<Base> ptr1(base1_);
    RefPtr<Base> ptr2(ptr1);
    RefPtr<Base> ptr3;
    EXPECT_TRUE(ptr3.empty());
    ptr3 = ptr1;
    EXPECT_EQ(3u, GetRefCount(base1_));
    EXPECT_EQ(0u, GetRefCount(base2_));
    EXPECT_EQ(ptr1, ptr2);
    EXPECT_EQ(ptr1, ptr3);

    EXPECT_FALSE(ptr2.empty());
    RefPtr<Base> ptr4(std::move(ptr2));
    EXPECT_TRUE(ptr2.empty());
    EXPECT_FALSE(ptr4.empty());
    EXPECT_EQ(3u, GetRefCount(base1_));
    EXPECT_EQ(ptr1, ptr4);
    EXPECT_NE(ptr2, ptr4);

    ptr2 = std::move(ptr4);
    EXPECT_TRUE(ptr4.empty());
    EXPECT_FALSE(ptr2.empty());
    EXPECT_EQ(3u, GetRefCount(base1_));

    ptr1 = ptr2;
    EXPECT_EQ(3u, GetRefCount(base1_));

    ptr1 = nullptr;
    EXPECT_EQ(2u, GetRefCount(base1_));
    EXPECT_TRUE(ptr1.empty());

    ptr2.reset();
    EXPECT_EQ(1u, GetRefCount(base1_));
    EXPECT_TRUE(ptr2.empty());
    EXPECT_FALSE(ptr3.empty());
  }

  ExpectEmptyTracker();
}

TEST_F(RefPtrTest, SupportsCallingMethods) {
  auto VerifyMethodArguments = [this](RefPtr<Base> copy, RefPtr<Base> move) {
    // Cannot use an rvalue reference for |move| because the ref count would
    // not be correct.  When we don't use a reference, the value will be
    // move-constructed into the argument, which is why the ref count is 1.
    // When the method returns, the argument is destroyed, dropping the ref
    // count to 0.
    //
    // If we used an rvalue reference, we would pass a reference and not
    // create a temporary.  What makes the ref count change is the
    // constructor so because no constructor is invoked, the original
    // variable would remain unchanged.
    EXPECT_EQ(2u, GetRefCount(copy.get()));
    EXPECT_EQ(1u, GetRefCount(move.get()));
  };

  {
    RefPtr<Base> ptr1(base1_);
    RefPtr<Base> ptr2(base2_);
    EXPECT_EQ(1u, GetRefCount(base1_));
    EXPECT_EQ(1u, GetRefCount(base2_));

    VerifyMethodArguments(ptr1, std::move(ptr2));

    EXPECT_FALSE(ptr1.empty());
    EXPECT_TRUE(ptr2.empty());
    EXPECT_EQ(1u, GetRefCount(base1_));
    EXPECT_EQ(0u, GetRefCount(base2_));
  }

  ExpectEmptyTracker();
}

TEST_F(RefPtrTest, SupportsComparisons) {
  RefPtr<Base> ptr1(base1_);

  EXPECT_FALSE(ptr1.empty());
  EXPECT_TRUE(ptr1 == base1_);
  EXPECT_TRUE(base1_ == ptr1);
  EXPECT_FALSE(ptr1 != base1_);
  EXPECT_FALSE(base1_ != ptr1);
  EXPECT_FALSE(ptr1 == base2_);
  EXPECT_TRUE(ptr1 != base2_);
  EXPECT_FALSE(ptr1 == derived_);
  EXPECT_TRUE(ptr1 != derived_);
  EXPECT_FALSE(ptr1 == nullptr);
  EXPECT_TRUE(ptr1 != nullptr);
  EXPECT_FALSE(nullptr == ptr1);
  EXPECT_TRUE(nullptr != ptr1);

  ptr1 = derived_;

  EXPECT_FALSE(ptr1.empty());
  EXPECT_FALSE(ptr1 == base1_);
  EXPECT_TRUE(ptr1 != base1_);
  EXPECT_TRUE(ptr1 == derived_);
  EXPECT_FALSE(ptr1 != derived_);
  EXPECT_FALSE(ptr1 == nullptr);
  EXPECT_TRUE(ptr1 != nullptr);

  ptr1 = nullptr;

  EXPECT_TRUE(ptr1.empty());
  EXPECT_FALSE(ptr1 == base1_);
  EXPECT_TRUE(ptr1 != base1_);
  EXPECT_FALSE(ptr1 == derived_);
  EXPECT_TRUE(ptr1 != derived_);
  EXPECT_TRUE(ptr1 == nullptr);
  EXPECT_FALSE(ptr1 != nullptr);

  Member<Base> mem1(base1_);
  Member<Derived> mem2(derived_);
  ptr1 = base1_;
  EXPECT_TRUE(ptr1 == mem1);
  EXPECT_TRUE(mem1 == ptr1);
  EXPECT_FALSE(ptr1 == mem2);
  EXPECT_FALSE(mem2 == ptr1);
  EXPECT_FALSE(ptr1 != mem1);
  EXPECT_FALSE(mem1 != ptr1);
  EXPECT_TRUE(ptr1 != mem2);
  EXPECT_TRUE(mem2 != ptr1);
}

TEST_F(RefPtrTest, InteractsWithMember) {
  {
    RefPtr<Base> ptr1(base1_);
    Member<Base> mem1(ptr1);
    EXPECT_EQ(mem1, ptr1);
    EXPECT_EQ(ptr1, mem1);

    Member<Base> mem2(std::move(ptr1));
    EXPECT_TRUE(ptr1.empty());
    EXPECT_TRUE(mem2 == base1_);

    ptr1 = mem1;
    EXPECT_FALSE(ptr1.empty());
    EXPECT_EQ(ptr1, base1_);

    ptr1.reset();
    ptr1 = std::move(mem1);
    EXPECT_TRUE(mem1.empty());
    EXPECT_FALSE(ptr1.empty());
    EXPECT_EQ(ptr1, base1_);

    RefPtr<Base> ptr2(std::move(mem2));
    EXPECT_TRUE(mem2.empty());
    EXPECT_FALSE(ptr2.empty());
    EXPECT_EQ(ptr2, base1_);

    mem2 = ptr1;
    EXPECT_FALSE(mem2.empty());
    EXPECT_FALSE(ptr1.empty());
    EXPECT_EQ(mem2, base1_);

    Member<Derived> mem3(derived_);
    ptr1 = mem3;
    EXPECT_FALSE(ptr1.empty());
    EXPECT_EQ(ptr1, derived_);

    ptr1.reset();
    EXPECT_TRUE(ptr1.empty());
    ptr1 = std::move(mem3);
    EXPECT_TRUE(mem3.empty());
    EXPECT_FALSE(ptr1.empty());
    EXPECT_EQ(ptr1, derived_);

    mem3 = derived_;
    RefPtr<Base> ptr3(mem3);
    EXPECT_FALSE(ptr3.empty());
    EXPECT_EQ(ptr3, mem3);
  }

  ExpectEmptyTracker();
}

}  // namespace shaka


text: State HTML5 Video Player

redpajama_set_name: RedPajamaGithub


text: <!DOCTYPE html>


text:
function [lags,ck,cc,td] = xcorrTD(x,y)
%
%   TIME-DOMAIN CROSS-CORRELATION FUNCTION
%
%   Description: xcorrTD takes two discrete time signals as input and
%   calculates cross-correlation values, cross-correlation correlation
%   coefficients and delay between two signals. The computation is
%   performed in the time domain. The results of xcorrTD is validated
%   against the MatLAB's xcorr function.
%
%   For cross-correlation in frequency domain see xcorrFD.
%
%   Syntax:
%         [lags,ck,cc,td] = xcorrTD(x,y)
%
%   Input:
%         x = input signal 1 (must be a Nx1 or 1xN vector)
%
%         y = input signal 2 (must be a Nx1 or 1xN vector)
%
%   Output:
%
%         lags = a vector of lags with a length of 2xN-1 (N = number of
%         data points in signal x or y)
%
%           ck = cross-correlation values (MatLAB xcorr gives them as
%           output)
%
%           cc = correlation coefficients
%
%           td = delay (i.e., number of lags) between two signals
%
%   Reference: Gubbins, D. (2004). Time Series Analysis and Inverse Theory
%   for Geophysicists, Cambridge University Press, 255 p.
%
%   Example: Input acceleration signals are base and roof motions from a
%   building during earthquake shaking. Let us compute the delay between
%   two signals, which can be used to compute average shear-wave velocity
%   in the building.
%
%       data = importdata('input.txt');
%       x = data(:,2); y = data(:,3);
%       [lag,ck,cc,td] = xcorrTD(x,y);
%       plot(lag,ck,'r'); grid on;
%       xlabel('Lag'); ylabel('Cross correlation values');
%       title('Cross-correlation in time domain by xcorrTD');
%       print('-dpng','-painters','-r600','xcorrTD.png')
%
%   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
%   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
%   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
%   NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY DIRECT, INDIRECT,
%   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
%   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
%   OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
%   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
%   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
%   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
%   DAMAGE.
%
%   Written by Dr. Erol Kalkan, P.E. (ekalkan@usgs.gov)
%   $Revision: 1.0 $  $Date: 2017/06/14 14:03:00 $
ndata = length(x);
sx = sum(x.^2); sy = sum(y.^2);

maxlag = ndata-1;
cnt = 0;
for lag = -maxlag:maxlag
    cnt = cnt + 1;
    sxy = 0;
    for i=1:ndata
        j = i + lag;
        if j>0 && j<=ndata
            sxy = sxy + x(i) * y(j);
        end
    end
    cc(cnt) = sxy / sqrt(sx*sy);  % correlation coefficient
    ck(cnt) = sxy;                % cross-correlation value
    lags(cnt) = lag;
end
[~,i] = max(cc);
td = i - ndata;


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

namespace Gallio.Common.Xml
{
    /// <summary>
    /// Represents an XML node with a name.
    /// </summary>
    public interface INamed
    {
        /// <summary>
        /// Gets the name of the node.
        /// </summary>
        string Name
        {
            get;
        }

        /// <summary>
        /// Determines whether the name of the current node is equal to the specified name,
        /// by respecting the specified equality options.
        /// </summary>
        /// <param name="otherName">The name to compare.</param>
        /// <param name="options">Equality options.</param>
        /// <returns>True if the names are equal; false otherwise.</returns>
        bool AreNamesEqual(string otherName, Options options);
    }
}


text:
package org.jcoderz.phoenix.cmpgen2;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.jcoderz.commons.util.Constants;
import org.jcoderz.phoenix.sqlparser.ColumnSpec;
import org.jcoderz.phoenix.sqlparser.NumericAttribute;

/**
 * @author Albrecht Messner
 */
public final class TypeMapping
{
   private static final String[] JAVA_PRIMITIVE_TYPES = {
      Byte.TYPE.getName(),
      Short.TYPE.getName(),
      Integer.TYPE.getName(),
      Long.TYPE.getName(),
      Float.TYPE.getName(),
      Double.TYPE.getName(),
      Character.TYPE.getName(),
      Boolean.TYPE.getName(),
      "byte[]"
   };

   private static final String[] PRIMITIVE_TYPE_WRAPPERS = {
      Byte.class.getName(),
      Short.class.getName(),
      Integer.class.getName(),
      Long.class.getName(),
      Float.class.getName(),
      Double.class.getName(),
      Character.class.getName(),
      Boolean.class.getName(),
      "byte[]"
   };

   // these get mapped to java.lang.String
   private static final String[] STRING_TYPES = {
      "CHAR",
      "CHAR2",
      "NCHAR",
      "NCHAR2",
      "VARCHAR",
      "VARCHAR2",
      "NVARCHAR",
      "NVARCHAR2"
      };

   private static final String[] TIMESTAMP_TYPES = {
      "TIMESTAMP"
      };

   private static final String[] DATE_TYPES = {
      "DATE"
      };

   // these get mapped to numeric types
   private static final String[] NUMERIC_TYPES = {
      "NUMBER",
      "NUMERIC",
      "DECIMAL",
      "INTEGER",
      "INT",
      "FLOAT",
      "REAL"
      };

   private static final String[] FLOAT_TYPES = {
      "FLOAT",
      "REAL"
   };

   private static final int INTEGER_PRECISION_LIMIT = 10;
   private static final int LONG_PRECISION_LIMIT = 19;

   // put all arrays into hash sets for faster lookup
   private static final Set STRING_TYPE_SET = new HashSet();
   private static final Set NUMERIC_TYPE_SET = new HashSet();
   private static final Set TIMESTAMP_TYPE_SET = new HashSet();
   private static final Set DATE_TYPE_SET = new HashSet();
   private static final Set FLOAT_TYPE_SET = new HashSet();
   private static final Set JAVA_PRIMITIVE_TYPE_SET = new HashSet();

   static
   {
      STRING_TYPE_SET.addAll(Arrays.asList(STRING_TYPES));
      NUMERIC_TYPE_SET.addAll(Arrays.asList(NUMERIC_TYPES));
      TIMESTAMP_TYPE_SET.addAll(Arrays.asList(TIMESTAMP_TYPES));
      DATE_TYPE_SET.addAll(Arrays.asList(DATE_TYPES));
      FLOAT_TYPE_SET.addAll(Arrays.asList(FLOAT_TYPES));
      JAVA_PRIMITIVE_TYPE_SET.addAll(Arrays.asList(JAVA_PRIMITIVE_TYPES));
   }

   /**
    * private constructor to avoid instantiation
    */
   private TypeMapping ()
   {
   }

   /**
    * Finds the appropriate type mapping from a given column spec.
    *
    * Note that the type returned here is the "simple" type as it is stored
    * in the database, not the "complex" type.
    *
    * @param column the column specification
    * @param fullyQualified whether the type should contain the package
    *        name or not
    * @return the simple java type used to store the column in the db
    * @throws CmpGeneratorException if no type mapping can be found
    */
   public static String getJavaType (
         ColumnSpec column,
         boolean fullyQualified)
         throws CmpGeneratorException
   {
      String javaType = column.getJavaType();
      if (javaType == null)
      {
         // this gets a mapping for character data types
         javaType = getTypeMapping(column.getColumnType());

         // no character type, try to find a numeric type
         if (javaType == null)
         {
            final List sqlTypeAttributes = column.getDatatypeAttributes();
            int att1 = 0, att2 = 0;
            if (sqlTypeAttributes.size() > 0)
            {
               att1 = ((NumericAttribute) sqlTypeAttributes.get(0)).getNumber();
               if (sqlTypeAttributes.size() > 1)
               {
                  att2 = ((NumericAttribute) sqlTypeAttributes.get(1))
                      .getNumber();
               }
            }
            javaType =
               getNumberTypeMapping(
                  column.getColumnType(),
                  att1,
                  att2);
         }
      }
      else
      {
         // a java type has been specified
         final String loadMethod = column.getLoadMethod();
         if (loadMethod != null)
         {
            // hey! it's a complex type
            // the "simple" java type can be found in the signature of the
            // load method
            final int openParen = loadMethod.indexOf('(');
            final int closeParen = loadMethod.indexOf(')');
            if (openParen == -1
               || closeParen == -1
               || closeParen <= openParen)
            {
               throw new CmpGeneratorException(
                  loadMethod + " is an invalid load method signature");
            }
            javaType = loadMethod.substring(openParen + 1, closeParen).trim();
            if (javaType.length() <= 0)
            {
               throw new CmpGeneratorException(
                  loadMethod + " is an invalid load method signature");
            }
         }
      }

      if (javaType == null)
      {
         throw new CmpGeneratorException("No type mapping found for column "
            + column);
      }

      // ok, now we've got a java type. if it is a primitive type
      // and the column is nullable, then we must use the wrapper object
      // instead
      if (isPrimitiveType(javaType) && !column.isNotNull())
      {
         javaType = primitiveToObject(javaType);
      }

      // check if we should return the type fully qualified
      if (!fullyQualified)
      {
         javaType = unqualifyType(javaType);
      }

      return javaType;
   }

   /**
    * Returns everything after the last dot in a type name.
    * @param typeName a java type name
    * @return the unqualified type name, or the argument if
    *         it was not a qualified java type name
    */
   public static String unqualifyType (String typeName)
   {
      final int dotIndex = typeName.lastIndexOf('.');
      return typeName.substring(dotIndex + 1);
   }

   /**
    * Returns the fully qualified java type to which an SQL type is mapped.
    *
    * @param sqlType the name of the sql type
    * @return the FQ type name of the java type, or null if this method can not
    *         find a type mapping
    */
   public static String getTypeMapping (String sqlType)
   {
      String javaType;

      final String s = sqlType.toUpperCase(Constants.SYSTEM_LOCALE);
      if (STRING_TYPE_SET.contains(s))
      {
         javaType = String.class.getName();
      }
      else if (TIMESTAMP_TYPE_SET.contains(s))
      {
         javaType = Timestamp.class.getName();
      }
      else if (DATE_TYPE_SET.contains(s))
      {
         javaType = Date.class.getName();
      }
      else if (NUMERIC_TYPE_SET.contains(s))
      {
         javaType = null;
      }
      else
      {
         javaType = Object.class.getName();
      }

      return javaType;
   }

   /**
    * Returns a type mapping for numeric types.
    *
    * @param sqlType the name of the sql type
    * @param precision the precision of the sql type
    * @param scale the scale of the sql type, or 0 if no scale given
    * @return the name of the appropriate java type
    */
   public static String getNumberTypeMapping (
      String sqlType,
      int precision,
      int scale)
   {
      String javaType;
      final String s = sqlType.toUpperCase(Constants.SYSTEM_LOCALE);

      if (precision < 0 || scale < 0)
      {
         throw new IllegalArgumentException(
                 "Scale and precision must be non-negative");
      }

      if (NUMERIC_TYPE_SET.contains(s))
      {
         if (scale > 0 || FLOAT_TYPE_SET.contains(s))
         {
            return BigDecimal.class.getName();
         }
         else
         {
            if (precision < INTEGER_PRECISION_LIMIT)
            {
               javaType = Integer.TYPE.getName();
            }
            else if (precision < LONG_PRECISION_LIMIT)
            {
               javaType = Long.TYPE.getName();
            }
            else
            {
               javaType = BigDecimal.class.getName();
            }
         }
      }
      else
      {
         throw new IllegalArgumentException(s + " is not a numeric SQL type");
      }

      return javaType;
   }

   /**
    * Determines whether a given type is primitive.
    *
    * @param type the name of a java type
    * @return true if the type is primitive, false otherwise
    */
   public static boolean isPrimitiveType (String type)
   {
      boolean result = false;
      if (JAVA_PRIMITIVE_TYPE_SET.contains(type))
      {
         result = true;
      }
      return result;
   }

   /**
    * Maps a java primitive type to its corresponding wrapper object.
    * @param primitiveType the name of a primitive type
    * @return the corresponding wrapper object
    * @throws IllegalArgumentException if primitiveType is not a primitive type
    */
   public static String primitiveToObject (String primitiveType)
   {
      if (!isPrimitiveType(primitiveType))
      {
         throw new IllegalArgumentException(
               "Can't map "
               + primitiveType
               + " to its Object wrapper because it is not a primitive type");
      }
      String objectWrapperName = null;
      for (int i = 0; i < JAVA_PRIMITIVE_TYPES.length; i++)
      {
         if (JAVA_PRIMITIVE_TYPES[i].equals(primitiveType))
         {
            objectWrapperName = PRIMITIVE_TYPE_WRAPPERS[i];
            break;
         }
      }
      return objectWrapperName;
   }

}


text:
package org.apache.camel.component.netty.http;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Assert;
import org.junit.Test;

/**
 * Tests https://issues.apache.org/jira/browse/CAMEL-10409
 */
public class NettyRequestManagementTest extends BaseNettyTest {

    @Test
    public void testBufferManagement() {
        Exchange exchange = template.send("direct:start", e -> e.getIn().setBody("World"));
        Assert.assertEquals("Bye World", exchange.getIn().getBody(String.class));
        exchange.getProperty("buffer", ByteBuf.class).release();
    }

    private static void requestBuffer(Exchange exchange) {
        exchange.setProperty("buffer", PooledByteBufAllocator.DEFAULT.directBuffer());
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("netty-http:http://0.0.0.0:{{port}}/foo")
                        .transform(body().prepend("Bye "));

                from("direct:start")
                        .to("netty-http:http://localhost:{{port}}/foo?synchronous=true")
                        .process(NettyRequestManagementTest::requestBuffer);
            }
        };
    }
}


text:
using System;
using System.Runtime.InteropServices;
using System.Diagnostics.Contracts;

namespace NSynth.Imaging
{
    /// <summary>
    /// Represents a color using three color channels (Red, Green, Blue), using 24 bits of color information per pixel (8 bits per channel).
    /// </summary>
    [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 3)]
    public struct ColorRGB24 : IColor
    {
        #region Fields
        /// <summary>
        /// Backing field for the <see cref="ColorRGB24.Blue"/> property.
        /// </summary>
        [FieldOffset(0x0)]
        private byte blue;

        /// <summary>
        /// Backing field for the <see cref="ColorRGB24.Green"/> property.
        /// </summary>
        [FieldOffset(0x1)]
        private byte green;

        /// <summary>
        /// Backing field for the <see cref="ColorRGB24.Red"/> property.
        /// </summary>
        [FieldOffset(0x2)]
        private byte red;
        #endregion
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorRGB24"/> struct.
        /// </summary>
        /// <param name="red">The value of the red color component.</param>
        /// <param name="green">The value of the green color component.</param>
        /// <param name="blue">The value of the blue color component.</param>
        public ColorRGB24(byte red, byte green, byte blue)
        {
            this.red = red;
            this.green = green;
            this.blue = blue;
        }
        #endregion
        #region Properties
        /// <summary>
        /// Gets or sets the value of the blue color component of the current <see cref="ColorRGB24"/>.
        /// </summary>
        public byte Blue
        {
            get
            {
                return this.blue;
            }
            set
            {
                this.blue = value;
            }
        }

        /// <summary>
        /// Gets or sets the value of the green color component of the current <see cref="ColorRGB24"/>.
        /// </summary>
        public byte Green
        {
            get
            {
                return this.green;
            }
            set
            {
                this.green = value;
            }
        }

        /// <summary>
        /// Gets or sets the value of the red color component of the current <see cref="ColorRGB24"/>.
        /// </summary>
        public byte Red
        {
            get
            {
                return this.red;
            }
            set
            {
                this.red = value;
            }
        }

        float IColor.Red
        {
            get
            {
                return this.red / 255.0f;
            }
            set
            {
                this.red = (byte)(value * 255);
            }
        }

        float IColor.Green
        {
            get
            {
                return this.green / 255.0f;
            }
            set
            {
                this.green = (byte)(value * 255);
            }
        }

        float IColor.Blue
        {
            get
            {
                return this.blue / 255.0f;
            }
            set
            {
                this.blue = (byte)(value * 255);
            }
        }

        float IColor.Alpha
        {
            get
            {
                return 1.0f;
            }
            set
            {
                throw new NotSupportedException("The ColorRGB24 type does not support an alpha (opacity) channel.");
            }
        }
        #endregion
        #region Methods
        /// <summary>
        /// Indicates whether this instance and a specified object are equal.
        /// </summary>
        /// <param name="obj">Another object to compare to.</param>
        /// <returns>true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            if (obj is ColorRGB24)
                return this == (ColorRGB24)obj;
            return false;
        }

        /// <summary>
        /// Indicates whether this <see cref="ColorRGB24"/> and a specified <see cref="ColorRGB24"/> instance represent the same color value.
        /// </summary>
        /// <param name="other">A <see cref="ColorRGB24"/> instance to compare to the current instance.</param>
        /// <returns>true if both instances represent the same color value; otherwise false.</returns>
        public bool Equals(ColorRGB24 other)
        {
            return this == other;
        }

        /// <summary>
        /// Returns the hash code for this instance.
        /// </summary>
        /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns>
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        /// <summary>
        /// Calculates the linear interpolation between the current color and the specified color.
        /// </summary>
        /// <param name="other">The other <see cref="ColorRGB24"/> to interpolate against.</param>
        /// <param name="t">The interpolation factor, 0.0 to 1.0.</param>
        /// <returns>A new <see cref="ColorRGB24"/> that is the result of the interpolation.</returns>
        public ColorRGB24 LinearInterpolate(ColorRGB24 other, float t)
        {
            Contract.Requires(t <= 1.0f);
            Contract.Requires(0.0f <= t);
            return this.LinearInterpolate(other, t, t, t);
        }
        /// <summary>
        /// Calculates the linear interpolation between the current color and the specified color.
        /// </summary>
        /// <param name="other">The <see cref="ColorRGB24"/> to interpolate against.</param>
        /// <param name="tr">The interpolation factor for the red channel, 0.0 to 1.0.</param>
        /// <param name="tg">The interpolation factor for the green channel, 0.0 to 1.0.</param>
        /// <param name="tb">The interpolation factor for the blue channel, 0.0 to 1.0.</param>
        /// <returns>A new <see cref="ColorRGB24"/> that is the result of the interpolation.</returns>
        public ColorRGB24 LinearInterpolate(ColorRGB24 other, float tr, float tg, float tb)
        {
            Contract.Requires(tr <= 1.0f);
            Contract.Requires(0.0f <= tr);
            Contract.Requires(tg <= 1.0f);
            Contract.Requires(0.0f <= tg);
            Contract.Requires(tb <= 1.0f);
            Contract.Requires(0.0f <= tb);

            return new ColorRGB24(
                (byte)((this.red * tr) + (other.red * (1.0f - tr))),
                (byte)((this.green * tg) + (other.green * (1.0f - tg))),
                (byte)((this.blue * tb) + (other.blue * (1.0f - tb))));
        }
        #endregion
        #region Operators
        /// <summary>
        /// Indicates if the two <see cref="ColorRGB24"/> instances represent the same color value.
        /// </summary>
        /// <param name="left">The left-hand operand.</param>
        /// <param name="right">The right-hand operand.</param>
        /// <returns>true if <paramref name="left"/> represents the same color value as <paramref name="right"/>; otherwise false.</returns>
        public static bool operator ==(ColorRGB24 left, ColorRGB24 right)
        {
            return left.Red == right.Red && left.Green == right.Green && left.Blue == right.Blue;
        }

        /// <summary>
        /// Indicates if two <see cref="ColorRGB24"/> instances do not represent the same color value.
        /// </summary>
        /// <param name="left">The left-hand operand.</param>
        /// <param name="right">The right-hand operand.</param>
        /// <returns>true if <paramref name="left"/> represents a different color value than <paramref name="right"/>; otherwise false.</returns>
        public static bool operator !=(ColorRGB24 left, ColorRGB24 right)
        {
            return left.Red != right.Red || left.Green != right.Green || left.Blue != right.Blue;
        }

        /// <summary>
        /// Adds two color values together.
        /// </summary>
        /// <param name="left">The first color value to add.</param>
        /// <param name="right">The second color value to add.</param>
        /// <returns>A new <see cref="ColorRGB24"/> instance that is the result of the addition.</returns>
        public static ColorRGB24 operator +(ColorRGB24 left, ColorRGB24 right)
        {
            return new ColorRGB24(
                (byte)(left.Red + right.Red),
                (byte)(left.Green + right.Green),
                (byte)(left.Blue + right.Blue));
        }

        /// <summary>
        /// Subtracts one color value from another.
        /// </summary>
        /// <param name="left">The color value to be subtracted from.</param>
        /// <param name="right">The color value to subtract.</param>
        /// <returns>A new <see cref="ColorRGB24"/> instance that is the result of the subtraction.</returns>
        public static ColorRGB24 operator -(ColorRGB24 left, ColorRGB24 right)
        {
            return new ColorRGB24(
                (byte)(left.Red - right.Red),
                (byte)(left.Green - right.Green),
                (byte)(left.Blue - right.Blue));
        }

        /// <summary>
        /// Multiplies a color by a scalar value.
        /// </summary>
        /// <param name="color">A <see cref="ColorRGB24"/> that contains the color value to be multiplied.</param>
        /// <param name="scalar">A scalar value to multiply the color by.</param>
        /// <returns>A new <see cref="ColorRGB24"/> instance that contains the result of the multiplication.</returns>
        public static ColorRGB24 operator *(ColorRGB24 color, double scalar)
        {
            return new ColorRGB24(
                (byte)(color.Red * scalar),
                (byte)(color.Green * scalar),
                (byte)(color.Blue * scalar));
        }
        #endregion
    }
}


text:
class CreateVotes < ActiveRecord::Migration[5.0]
  def change
    #投票,积攒
    create_table :votes do |t|
      t.integer :game_player_id
      t.string :openid
      t.date :voted_at
      t.timestamps
    end
    add_column :game_players,:votes_count, :integer, null: false, default: 0    #玩家生日

  end
end


text:
package com.webcohesion.enunciate.javac.decorations.type;

import com.webcohesion.enunciate.javac.decorations.DecoratedProcessingEnvironment;
import com.webcohesion.enunciate.javac.decorations.TypeMirrorDecoration;

import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVisitor;

@SuppressWarnings ( "unchecked" )
public class DecoratedTypeMirror<T extends TypeMirror> implements TypeMirror {

  protected final T delegate;
  protected final DecoratedProcessingEnvironment env;
  private String docComment = "";

  public DecoratedTypeMirror(T delegate, DecoratedProcessingEnvironment env) {
    while (delegate instanceof DecoratedTypeMirror) {
      delegate = (T) ((DecoratedTypeMirror) delegate).delegate;
    }

    this.delegate = delegate;
    this.env = env;

    if (this.env.getTypeMirrorDecorations() != null) {
      for (TypeMirrorDecoration decoration : this.env.getTypeMirrorDecorations()) {
        decoration.applyTo(this);
      }
    }
  }

  @Override
  public TypeKind getKind() {
    return this.delegate.getKind();
  }

  @Override
  public <R, P> R accept(TypeVisitor<R, P> v, P p) {
    return this.delegate.accept(v, p);
  }

  public boolean equals(Object obj) {
    if (obj instanceof DecoratedTypeMirror) {
      return equals(((DecoratedTypeMirror) obj).delegate);
    }
    return delegate.equals(obj);
  }

  public String toString() {
    return delegate.toString();
  }

  public boolean isInstanceOf(Class<?> clazz) {
    return isInstanceOf(TypeMirrorUtils.mirrorOf(clazz, this.env));
  }

  public boolean isInstanceOf(String typeName) {
    return isInstanceOf(TypeMirrorUtils.mirrorOf(typeName, this.env));
  }

  public boolean isInstanceOf(Element type) {
    return type != null && isInstanceOf(type.asType());
  }

  public boolean isInstanceOf(TypeMirror candidate) {
    return candidate != null &&
      getKind() != TypeKind.EXECUTABLE &&
      getKind() != TypeKind.PACKAGE &&
      candidate.getKind() != TypeKind.EXECUTABLE &&
      candidate.getKind() != TypeKind.PACKAGE &&
      this.env.getTypeUtils().isAssignable(this.delegate, candidate);
  }

  public boolean isAnnotation() {
    return isDeclared() && ((DeclaredType)this.delegate).asElement().getKind() == ElementKind.ANNOTATION_TYPE;
  }

  public boolean isArray() {
    return getKind() == TypeKind.ARRAY;
  }

  public boolean isCollection() {
    return isInstanceOf(TypeMirrorUtils.collectionTypeErasure(this.env));
  }

  public boolean isList() {
    return isInstanceOf(TypeMirrorUtils.listTypeErasure(this.env));
  }

  public boolean isNull() {
    return getKind() == TypeKind.NULL;
  }

  public boolean isReferenceType() {
    return false;
  }
  public boolean isClass() {
    return isDeclared() && ((DeclaredType)this.delegate).asElement().getKind() == ElementKind.CLASS;
  }

  public boolean isDeclared() {
    return getKind() == TypeKind.DECLARED;
  }

  public boolean isEnum() {
    return isDeclared() && ((DeclaredType)this.delegate).asElement().getKind() == ElementKind.ENUM;
  }

  public boolean isInterface() {
    return isDeclared() && ((DeclaredType)this.delegate).asElement().getKind() == ElementKind.INTERFACE;
  }

  public boolean isPrimitive() {
    return getKind().isPrimitive();
  }

  public boolean isTypeVariable() {
    return getKind() == TypeKind.TYPEVAR;
  }

  public boolean isVoid() {
    return getKind() == TypeKind.VOID;
  }

  public boolean isWildcard() {
    return getKind() == TypeKind.WILDCARD;
  }

  public T getDelegate() {
    return this.delegate;
  }

  public String getDocComment() {
    return this.docComment;
  }

  public void setDocComment(String docComment) {
    this.docComment = docComment;
  }

  public String getDocValue() {
    String value = getDocComment();
    if (value != null) {
      value = value.trim();

      if ("".equals(value)) {
        value = null;
      }
    }
    return value;
  }

}


text:
package MachineLearning.AdaBoost;

/*****************************************************************************/
/*                                                                           */
/*  Theodore O. Brundage                                                     */
/*  Brian Matejek                                                            */
/*  COS 511, Theoretical Machine Learning, Professor Elad Hazan              */
/*  Final Project, 5/17/15                                                   */
/*                                                                           */
/*  Description: This code implements the AdaBoost ensemble learner. While   */
/*   AB can be used with any learner, we implement it here specifically with */
/*   Decision Stumps.                                                        */
/*                                                                           */
/*****************************************************************************/

import java.util.ArrayList;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import MachineLearning.*;
import MachineLearning.DecisionStump.*;

public class AdaBoost implements Learner {
  private final boolean print_verbose;
  private double eps = 1.0e-4; // Accuracy of error rate for convergence
  private int K; // Number of hypotheses
  private static final int K_DEFAULT_VALUE = 1000;
  private int[][] X; // Training examples
  private int[] labels; // Training example labels
  private boolean[] missed; // Misclassified examples on this round
  private double[] w; // Training weights
  private ArrayList<DecisionStump> l; // Array of Weak learners
  private ArrayList<Double> al; // Classifier weights
  private double err; // Error rate of full ensemble
  private DataSet training; // Pointer to the training dataset.
  private final int learning_time = 600000; // (time in milliseconds)

  // constructors for AdaBoost, boosting solely on Decision Stumps
  public AdaBoost(DataSet train, DataSet test, int k) {
    this(train, false, k, test);
  }

  public AdaBoost(DataSet train, boolean print_verbose) {
    this(train, print_verbose, K_DEFAULT_VALUE, null);
  }

  public AdaBoost(DataSet train, boolean print_verbose, int learners, DataSet test) {
    this.K = learners;
    this.print_verbose = print_verbose;
    this.training = train;
    // Set up local copy of training data and labels
    this.X = new int[train.NDataPoints()][train.KthDataPoint(0).NAttributes()];
    this.labels = new int[X.length];
    for (int i = 0; i < X.length; i++) {
      DataPoint temp = train.KthDataPoint(i);
      labels[i] = temp.Label();
      // Set each attribute for example i
      for (int j = 0; j < X[0].length; j++) {
        X[i][j] = temp.KthAttribute(j);
      }
    }

    // Initialize weights
    this.w = new double[X.length];
    double val = 1.0 / this.w.length;
    for (int i = 0; i < this.w.length; i++) {
      this.w[i] = val;
    }

    // train on the DataSet as long as we have not exceeded the max number of learners,
    // or we have reached small enough error on the training set, or we run out of time.
    l  = new ArrayList<DecisionStump>();
    al = new ArrayList<Double>();
    missed = new boolean[this.labels.length];
    this.err = Double.MAX_VALUE;
    Timer timer = new Timer(learning_time);
    for (int i = 0; i < this.K && this.err > this.eps && timer.getTimeRemaining() >= 0; i++) {
      DecisionStump DS = new DecisionStump(train, this.w, print_verbose);
      double DS_err = this.getErr(DS);
      if (print_verbose && DS_err > 0.5) {
        System.out.println("stump error too high: " + DS_err);
        break;
      }
      l.add(DS);
      al.add(getAlpha(DS_err));
      this.updateWeights(DS_err);
      this.updateErr();
      if (test != null) {
        int[] output = this.Classify(test);
        int right = 0;
        int wrong = 0;
        for (int j = 0; j < output.length; j++) {
          if (output[j] == test.KthBinaryDataPoint(j).Label()) {
            right++;
          }
          else {
            wrong++;
          }
        }
        if (l.size() % 50 == 0) {
          System.out.printf("%15f   ", ((double) wrong / (wrong + right)));
        }
      }
      //System.out.printf("%15f\n", this.err);

    }
  }

  public int NLearners() {
    return this.l.size();
  }

  // Returns error rate of a particular candidate for the current weights
  // of the test samples. Error rate is simply the sum of misclassified
  // weights.
  private double getErr(DecisionStump ds) {
    int[] predictions = ds.Classify(this.training);
    double errorWeight = 0.0;
    for (int i = 0; i < predictions.length; i++) {
      if (predictions[i] != labels[i]) {
        errorWeight += w[i];
        missed[i] = true;
      }
      else {
        missed[i] = false;
      }
    }
    return errorWeight;
  }

  // Updates error rate of the ensemble on the training set
  private void updateErr() {
    int[] predictions = this.Classify(this.training);
    double errorWeight = 0.0;
    for (int i = 0; i < predictions.length; i++) {
      if (predictions[i] != labels[i]) {
        errorWeight += w[i];
      }

    }
    if (this.print_verbose && errorWeight > this.err){
      System.out.printf("Increase in full hypothesis error rate from %f to %f\n", this.err, errorWeight);
    }
    this.err = errorWeight;
  }

  // return WL coefficient given its performance error
  private double getAlpha(double error) {
    return 0.5 * Math.log((1 - error)/error);
  }

  // Adjust all weights, given the error of the most recently added WL
  private void updateWeights(double error) {
    for (int i = 0; i < this.w.length; i++) {
      if (this.missed[i]) {
        w[i] = 0.5 * w[i] / error;
      }
      else {
        w[i] = 0.5 * w[i] / (1.0 - error);
      }
    }

    if (print_verbose) {
      double total = 0.0;
      for (int i = 0; i < this.w.length; i++) {
        total += w[i];
      }
      if (print_verbose && Math.abs(total - 1.0) > 1.0e-10) {
        System.out.println("Weights sum to " + total);
      }
    }
  }

  // classify a particular dataset
  public int[] Classify(DataSet test) {
    double[] sum = new double[test.NDataPoints()];
    for (int i = 0; i < this.l.size(); i++) {
      int[] results = l.get(i).Classify(test);
      for (int j = 0; j < results.length; j++) {
        if (results[j] == 0) {
          sum[j] -= this.al.get(i);
        }
        else {
          sum[j] += this.al.get(i);
        }
      }
    }
    int[] ret = new int[sum.length];
    for (int i = 0; i < ret.length; i++) {
      if (sum[i] < 0.0) {
        ret[i] = 0;
      }
      else {
        ret[i] = 1;
      }
    }
    return ret;
  }

  // Borrowed from assignment 2, COS402, Fall 2014, timer class
  private class Timer {
    public Timer(long max_time) {
      tb = ManagementFactory.getThreadMXBean();
        cpu_time = tb.isThreadCpuTimeSupported();
        start_time = get_time();
        end_time = start_time + max_time;
    }
    public long getTimeElapsed() {
        return (get_time() - start_time);
    }

    public long getTimeRemaining() {
        return (end_time - get_time());
    }

    private long start_time, end_time;
    private static final long milli_to_nano = 1000000;
    private ThreadMXBean tb;
    private boolean cpu_time;

    private long get_time() {
        if (cpu_time)
            return tb.getCurrentThreadCpuTime() / milli_to_nano;
        else
            return System.currentTimeMillis();
    }
  }

}


text:
module Admin4rails
  class Attribute
    attr_reader :resource, :type, :name, :display_text

    def initialize(resource, column)
      @resource = resource
      @type = column.sql_type
      @name = column.name
      @display_text = resource.klass.human_attribute_name(column.name)
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="6728674e-b9f3-4037-878d-7050f8adbbb8" name="Default" comment="">
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/_layouts/blog_post.html" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/_layouts/default.html" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/_includes/footer.html" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/_includes/header.html" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/about/index.html" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/watcherTasks.xml" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/_config.yml" afterPath="$PROJECT_DIR$/_config.yml" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
    </list>
    <ignored path="jekyll-portfolio.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="jekyll-portfolio" />
  </component>
  <component name="FileEditorManager">
    <leaf>
      <file leaf-file-name="blog_post.html" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/_layouts/blog_post.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-14.727273">
              <caret line="18" column="3" selection-start-line="18" selection-start-column="3" selection-end-line="18" selection-end-column="3" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="index.html" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-3.2727273">
              <caret line="4" column="4" selection-start-line="4" selection-start-column="4" selection-end-line="11" selection-end-column="10" />
              <folding>
                <element signature="n#style#0;n#div#0;n#div#0;n#!!top" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_config.yml" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/_config.yml">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="9" column="0" selection-start-line="9" selection-start-column="1" selection-end-line="10" selection-end-column="75" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_frame.scss" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scss/base/_frame.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="25.954546">
              <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="index.html" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/about/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-1.6363636">
              <caret line="2" column="7" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
              <folding>
                <element signature="n#style#0;n#div#0;n#div#0;n#html#0;n#!!top" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="header.html" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/_includes/header.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.5062344">
              <caret line="42" column="44" selection-start-line="42" selection-start-column="44" selection-end-line="42" selection-end-column="44" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="main.scss" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scss/main.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-19.636364">
              <caret line="31" column="0" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="89" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_homepage.scss" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scss/pages/_homepage.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="50.727272">
              <caret line="19" column="37" selection-start-line="19" selection-start-column="37" selection-end-line="19" selection-end-column="37" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_navigation.scss" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scss/components/_navigation.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-9.0">
              <caret line="41" column="31" selection-start-line="41" selection-start-column="31" selection-end-line="41" selection-end-column="31" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="main.css" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/css/main.css">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="205" column="6" selection-start-line="203" selection-start-column="1" selection-end-line="203" selection-end-column="6" />
              <folding>
                <marker date="1429494624000" expanded="true" signature="4226:4423" placeholder="{...}" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FileTemplateManagerImpl">
    <option name="RECENT_TEMPLATES">
      <list>
        <option value="Html5" />
      </list>
    </option>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/footer.html" />
        <option value="$APPLICATION_CONFIG_DIR$/scratches/scratch_1" />
        <option value="$APPLICATION_CONFIG_DIR$/scratches/scratch_3" />
        <option value="$PROJECT_DIR$/default.html" />
        <option value="$PROJECT_DIR$/_layouts/default.html" />
        <option value="$PROJECT_DIR$/_layouts/blog_post.html" />
        <option value="$PROJECT_DIR$/_includes/footer.html" />
        <option value="$PROJECT_DIR$/scss/helpers/_variables.scss" />
        <option value="$PROJECT_DIR$/scss/base/_normalize.scss" />
        <option value="$PROJECT_DIR$/css/scss/main.scss" />
        <option value="$PROJECT_DIR$/css/main.scss" />
        <option value="$PROJECT_DIR$/_site/scss/main.css" />
        <option value="$PROJECT_DIR$/scss/mixins/_mixins.scss" />
        <option value="$PROJECT_DIR$/scss/main.scss" />
        <option value="$PROJECT_DIR$/_config.yml" />
        <option value="$PROJECT_DIR$/index.html" />
        <option value="$PROJECT_DIR$/scss/pages/_homepage.scss" />
        <option value="$PROJECT_DIR$/about/index.html" />
        <option value="$PROJECT_DIR$/scss/components/_navigation.scss" />
        <option value="$PROJECT_DIR$/_includes/header.html" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
  </component>
  <component name="NamedScopeManager">
    <order />
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="-11" />
    <option name="y" value="23" />
    <option name="width" value="1280" />
    <option name="height" value="741" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="scss" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="scss" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="pages" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="scss" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="mixins" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="scss" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="components" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="jekyll-portfolio" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="css" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
      <pane id="Scratches" />
      <pane id="Scope" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="settings.editor.selected.configurable" value="File.Encoding" />
    <property name="HbShouldOpenHtmlAsHb" value="" />
    <property name="settings.editor.splitter.proportion" value="0.2" />
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="DefaultHtmlFileTemplate" value="Html5" />
    <property name="com.intellij.ide.scratch.NewScratchFileAction" value="HTML" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$/_includes" />
    <property name="recentsLimit" value="5" />
  </component>
  <component name="RecentsManager">
    <key name="CopyFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/_includes" />
    </key>
    <key name="MoveFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/css" />
      <recent name="$PROJECT_DIR$/scss" />
      <recent name="$PROJECT_DIR$" />
      <recent name="$PROJECT_DIR$/_layouts" />
      <recent name="$PROJECT_DIR$/_includes" />
    </key>
  </component>
  <component name="RunManager">
    <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
      <method />
    </configuration>
    <configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
      <method />
    </configuration>
    <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" config-file="">
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="JsTestDriver-test-runner" factoryName="JsTestDriver">
      <setting name="configLocationType" value="CONFIG_FILE" />
      <setting name="settingsFile" value="" />
      <setting name="serverType" value="INTERNAL" />
      <setting name="preferredDebugBrowser" value="Chrome" />
      <method />
    </configuration>
    <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" working-dir="">
      <method />
    </configuration>
    <configuration default="true" type="cucumber.js" factoryName="Cucumber.js">
      <option name="cucumberJsArguments" value="" />
      <option name="executablePath" />
      <option name="filePath" />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <method />
    </configuration>
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="6728674e-b9f3-4037-878d-7050f8adbbb8" name="Default" comment="" />
      <created>1429465758804</created>
      <option name="number" value="Default" />
      <updated>1429465758804</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="-11" y="23" width="1280" height="741" extended-state="0" />
    <editor active="true" />
    <layout>
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32886904" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$APPLICATION_CONFIG_DIR$/scratches/scratch_1">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$APPLICATION_CONFIG_DIR$/scratches/scratch_2">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$APPLICATION_CONFIG_DIR$/scratches/scratch_3">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-26.636364">
          <caret line="59" column="6" selection-start-line="59" selection-start-column="6" selection-end-line="59" selection-end-column="6" />
          <folding>
            <element signature="n#style#0;n#div#0;n#div#0;n#body#0;n#!!top" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/gulpfile.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/_layouts/default.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-3.2727273">
          <caret line="4" column="25" selection-start-line="4" selection-start-column="25" selection-end-line="4" selection-end-column="25" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/_includes/footer.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-1.6363636">
          <caret line="2" column="6" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scss/components/_dropdowns.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scss/helpers/_functions.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scss/mixins/_mixins.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-23.863636">
          <caret line="410" column="36" selection-start-line="410" selection-start-column="36" selection-end-line="410" selection-end-column="36" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/main.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="205" column="6" selection-start-line="203" selection-start-column="1" selection-end-line="203" selection-end-column="6" />
          <folding>
            <marker date="1429494624000" expanded="true" signature="4226:4423" placeholder="{...}" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/_config.yml">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="9" column="0" selection-start-line="9" selection-start-column="1" selection-end-line="10" selection-end-column="75" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/_layouts/blog_post.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-14.727273">
          <caret line="18" column="3" selection-start-line="18" selection-start-column="3" selection-end-line="18" selection-end-column="3" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scss/main.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-19.636364">
          <caret line="31" column="0" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="89" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/about/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-1.6363636">
          <caret line="2" column="7" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
          <folding>
            <element signature="n#style#0;n#div#0;n#div#0;n#html#0;n#!!top" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-3.2727273">
          <caret line="4" column="4" selection-start-line="4" selection-start-column="4" selection-end-line="11" selection-end-column="10" />
          <folding>
            <element signature="n#style#0;n#div#0;n#div#0;n#!!top" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scss/pages/_homepage.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="50.727272">
          <caret line="19" column="37" selection-start-line="19" selection-start-column="37" selection-end-line="19" selection-end-column="37" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scss/base/_frame.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="25.954546">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scss/components/_navigation.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-9.0">
          <caret line="41" column="31" selection-start-line="41" selection-start-column="31" selection-end-line="41" selection-end-column="31" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/_includes/header.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.5062344">
          <caret line="42" column="44" selection-start-line="42" selection-start-column="44" selection-end-line="42" selection-end-column="44" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
set -x

# Create the home directory
mkdir -p /home/vagrant
chown vagrant /home/vagrant
cd /home/vagrant

# Install ssh certificates
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
chown -R vagrant /home/vagrant/.ssh
cd ..

# Install rpm,apt-get like code for cygwin
# http://superuser.com/questions/40545/upgrading-and-installing-packages-through-the-cygwin-command-line
wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg
chmod +x apt-cyg
mv apt-cyg /usr/local/bin/

# 7zip will allow us to extract a file from an ISO
wget http://downloads.sourceforge.net/sevenzip/7z920-x64.msi
msiexec /qb /i 7z920-x64.msi

# Download Virtualbox Additions
VBOX_VERSION="4.1.8" #"4.0.8"
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso

# Extract the installer from the ISO (WHY WHY WHY isn't this available not bundled within an ISO)
/cygdrive/c/Program\ Files/7-Zip/7z.exe x VBoxGuestAdditions_$VBOX_VERSION.iso VBoxWindowsAdditions-amd64.exe

# Mark Oracle as a trusted installer
#http://blogs.msdn.com/b/steverac/archive/2009/07/09/adding-certificates-to-the-local-certificates-store-and-setting-local-policy-using-a-command-line-system-center-updates-publisher-example.aspx

certutil -addstore -f "TrustedPublisher" a:oracle-cert.cer

# Install the Virtualbox Additions
./VBoxWindowsAdditions-amd64.exe /S

#Rather than do the manual install of ruby and chef, just use the opscode msi
curl -L http://www.opscode.com/chef/install.msi -o chef-client-latest.msi
msiexec /qb /i chef-client-latest.msi

#http://www.msfn.org/board/topic/105277-howto-create-a-fully-up-to-date-xp-x64-dvd/

#Making aliases
cat <<EOF > /home/vagrant/.bash_profile
alias chef-client="chef-client.bat"
alias gem="gem.bat"
alias ruby="ruby.exe"
alias puppet="puppet.bat"
alias ohai="ohai.bat"
alias irb="irb.bat"
alias facter="facter.bat"
EOF

cat <<'EOF' > /bin/sudo
#!/usr/bin/bash
exec "$@"
EOF
chmod 755 /bin/sudo

# Mounting a directory
net.exe use  '\\vboxsvr\veewee-validation'

# Reboot
# http://www.techrepublic.com/blog/datacenter/restart-windows-server-2003-from-the-command-line/245
shutdown.exe /r /t 0 /d p:2:4 /c "Vagrant initial reboot"


text:
mysql_create_db()
--SKIPIF--
<?php
require_once('skipif.inc');
if (!function_exists('mysql_create_db'))
	die("Skip mysql_create_db() exists only in old versions of the libmysql.");
?>
--FILE--
<?php
include "connect.inc";

$link   = NULL;
$tmp    = null;

if (false !== ($tmp = mysql_create_db()))
	printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);

if (false !== ($tmp = mysql_create_db($link, $link, $link)))
	printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);

if ($link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
	printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
		$host, $user . 'unknown_really', $db, $port, $socket);

if (!mysql_query("CREATE DATABASE mysqlcreatedb", $link))
	die(sprintf("[004] Cannot create database, aborting test, [%d] %s\n", mysql_errno($link), mysql_error($link)));

if (!mysql_query("DROP DATABASE mysqlcreatedb", $link))
	printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));

if (true !== ($tmp = mysql_create_db("mysqlcreatedb", $link)))
	printf("[006] Expecting boolean/true, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link));

if (false !== ($tmp = mysql_create_db("mysqlcreatedb", $link)))
	printf("[007] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, mysql_errno($link), mysql_error($link));

if (!mysql_query("DROP DATABASE mysqlcreatedb", $link))
	printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link));

print "done!";
?>
--CLEAN--
<?php
require_once('connect.inc');
if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
	printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
		$host, $user, $db, $port, $socket);

if (!mysql_query("DROP DATABASE IF EXISTS mysqlcreatedb", $link))
	printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

mysql_close($link);
?>
--EXPECTF--
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
done!


text:
package com.google.common.testing;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Simple utility for when you want to create a {@link TearDown} that may throw
 * an exception but should not fail a test when it does. Use it just like a
 * {@link TearDown}, except override {@link #sloppyTearDown()} instead.
 *
 * @author Luiz-Otavio Zorzella
 */
public abstract class SloppyTearDown implements TearDown {

  public static final Logger logger = Logger.getLogger(SloppyTearDown.class.getName());

  public final void tearDown() {
    try {
      sloppyTearDown();
    } catch (Throwable t) {
      logger.log(Level.INFO,
          "exception thrown during tearDown: " + t.getMessage(), t);
    }
  }

  public abstract void sloppyTearDown() throws Exception;

}