text:
//-----------------------------------------------
//
//	This file is part of the Siv3D Engine.
//
//	Copyright (c) 2008-2019 Ryo Suzuki
//	Copyright (c) 2016-2019 OpenSiv3D Project
//
//	Licensed under the MIT License.
//
//-----------------------------------------------

# include <Siv3D/Script.hpp>
# include <Siv3D/Shape2D.hpp>
# include "ScriptBind.hpp"

namespace s3d
{
	using namespace AngelScript;

	using ShapeType = Shape2D;

	static void DefaultConstruct(ShapeType* self)
	{
		new(self) ShapeType();
	}

	static void CopyConstruct(const Shape2D& other, ShapeType* self)
	{
		new(self) ShapeType(other);
	}

	static void Destruct(ShapeType* self)
	{
		self->~Shape2D();
	}

	void RegisterShape2D(asIScriptEngine* engine)
	{
		constexpr char TypeName[] = "Shape2D";

		int32 r = 0;
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(DefaultConstruct), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const Shape2D& in)", asFUNCTION(CopyConstruct), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_DESTRUCT, "void f()", asFUNCTION(Destruct), asCALL_CDECL_OBJLAST); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Shape2D& opAssign(const Shape2D& in)", asMETHODPR(ShapeType, operator =, (const ShapeType&), ShapeType&), asCALL_THISCALL); assert(r >= 0);

		r = engine->SetDefaultNamespace("Shape2D"); assert(r >= 0);
		{
			engine->RegisterGlobalFunction("Shape2D Cross(double r, double width, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::Cross), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Plus(double r, double width, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::Plus), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Ngon(uint32 n, double r, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::Ngon), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Pentagon(double r, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::Pentagon), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Hexagon(double r, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::Hexagon), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Star(double r, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::Star), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D NStar(uint32 n, double rOuter, double rInner, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::NStar), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Arrow(const Vec2& in from, const Vec2& in to, double width, const Vec2& in headSize)", asFUNCTIONPR(Shape2D::Arrow, (const Vec2&, const Vec2&, double, const Vec2&), Shape2D), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Arrow(const Line& in line, double width, const Vec2& in headSize)", asFUNCTIONPR(Shape2D::Arrow, (const Line&, double, const Vec2&), Shape2D), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Rhombus(double w, double h, const Vec2& in center = Vec2(0, 0), double angle = 0.0)", asFUNCTION(Shape2D::Rhombus), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D RectBalloon(const RectF& in rect, const Vec2& in target, double pointingRootRatio = 0.5)", asFUNCTION(Shape2D::RectBalloon), asCALL_CDECL); assert(r >= 0);
			engine->RegisterGlobalFunction("Shape2D Stairs(const Vec2& in base, double w, double h, int32 steps, bool upStairs = true)", asFUNCTION(Shape2D::Stairs), asCALL_CDECL); assert(r >= 0);
		}
		r = engine->SetDefaultNamespace(""); assert(r >= 0);

		// const Array<Float2>& vertices() const
		// const Array<uint32> indices() const

		r = engine->RegisterObjectMethod(TypeName, "const Shape2D& draw(const ColorF& in color = Palette::White) const", asMETHOD(ShapeType, draw), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "const Shape2D& drawFrame(double thickness = 1.0, const ColorF& in color = Palette::White) const", asMETHOD(ShapeType, drawFrame), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Polygon asPolygon() const", asMETHOD(ShapeType, asPolygon), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Polygon opImplConv() const", asMETHOD(ShapeType, asPolygon), asCALL_THISCALL); assert(r >= 0);

	}
}


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

namespace Console.AutoSyntax
{
	internal static class ConsoleInputParser
	{
		public static void Run<TApp>(TApp instance, string[] args) where TApp : class
		{
			var consoleMethods = Parse<TApp>();
			if (args == null || !args.Any())
			{
				ShowSyntax(consoleMethods);
				return;
			}

			var method = consoleMethods.FirstOrDefault(p => p.Name == args[0]);
			if(method == null)
			{
				ShowSyntax(consoleMethods);
				return;
			}

			var parameters = ExtractParameterSets(args);
			if (!method.CanRun(parameters.Select(x => x.Key).ToList()))
			{
				var missing = String.Join($" {ConsoleAutoSyntax.ParameterSwitch}",method.Parameters.Where(p=>!p.IsOptional).Select(x => x.Name).Except(parameters.Select(p => p.Key)));
				$"Missing parameters: {ConsoleAutoSyntax.ParameterSwitch}{missing}".Out(ConsoleColor.Red);

				method.ShowSyntax();
				return;
			}

			method.Execute(instance, parameters);
		}

		private static void ShowSyntax(List<ConsoleMethod> consoleMethods)
		{
			"Invalid input!".Out(ConsoleColor.DarkYellow);

			foreach (var m in consoleMethods)
				m.ShowSyntax();
		}

		private static List<ConsoleMethod> Parse<TApp>()
		{
			var defaultMethods = typeof(object).GetMethods().Select(m => m.Name).ToList();
			var functions = typeof(TApp).GetMethods().Where(x => !defaultMethods.Contains(x.Name)).ToList();
			return functions.Select(f => new ConsoleMethod(f)).ToList();
		}

		private static Dictionary<string, string> ExtractParameterSets(string[] args)
		{
			var parameters = new Dictionary<string, string>();
			if (args.Length <= 1)
				return parameters;

			for (var i = 1; i < args.Length; i++)
			{
				var arg = args[i];
				if (string.IsNullOrEmpty(arg))
				{
					i++;
					continue;
				}

				if (arg[0] != ConsoleAutoSyntax.ParameterSwitch)
					continue;

				arg = arg.Substring(1);
				var next = i + 1;
				if (arg.Contains(':'))
				{
					var parts = arg.Split(':');
					parameters.Add(parts[0].ToLower(), parts[1]);
				}
				else if (args.Length > next && !string.IsNullOrEmpty(args[next]) && args[next][0] != ConsoleAutoSyntax.ParameterSwitch)
				{
					parameters.Add(arg.ToLower(), args[next]);
					i++;
				}
				else
				{
					parameters.Add(arg.ToLower(), null);
				}
			}
			return parameters;
		}

	}
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

		<meta charset="utf-8">

		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

		<title>portfolio</title>
		<link rel="stylesheet" type="text/css" href="local.css"/>

		<meta name="description" content="">
		<meta name="author" content="vchou5">

		<meta name="viewport" content="width=device-width; initial-scale=1.0">

		<link rel="shortcut icon" href="/favicon.ico">
		<link rel="apple-touch-icon" href="/apple-touch-icon.png">

Investment Vault

				<form>
					<input type="radio" class="sensexNse" value="nse">NSE
					<input type="radio" class="sensexBse" value="bse">BSE
				</form>

				<form>
					<input type="text" class="searchRounded" placeholder="Enter Script Name">

					<input type="button" class="buttonClass" value="Get Quote">
				</form>


text:
/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.cloudera.impala.extdatasource.thrift;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TGetNextResult implements org.apache.thrift.TBase<TGetNextResult, TGetNextResult._Fields>, java.io.Serializable, Cloneable, Comparable<TGetNextResult> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetNextResult");

  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField EOS_FIELD_DESC = new org.apache.thrift.protocol.TField("eos", org.apache.thrift.protocol.TType.BOOL, (short)2);
  private static final org.apache.thrift.protocol.TField ROWS_FIELD_DESC = new org.apache.thrift.protocol.TField("rows", org.apache.thrift.protocol.TType.STRUCT, (short)3);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new TGetNextResultStandardSchemeFactory());
    schemes.put(TupleScheme.class, new TGetNextResultTupleSchemeFactory());
  }

  public com.cloudera.impala.thrift.TStatus status; // required
  public boolean eos; // required
  public TRowBatch rows; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    STATUS((short)1, "status"),
    EOS((short)2, "eos"),
    ROWS((short)3, "rows");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // STATUS
          return STATUS;
        case 2: // EOS
          return EOS;
        case 3: // ROWS
          return ROWS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __EOS_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private _Fields optionals[] = {_Fields.ROWS};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.cloudera.impala.thrift.TStatus.class)));
    tmpMap.put(_Fields.EOS, new org.apache.thrift.meta_data.FieldMetaData("eos", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.ROWS, new org.apache.thrift.meta_data.FieldMetaData("rows", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TRowBatch.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetNextResult.class, metaDataMap);
  }

  public TGetNextResult() {
  }

  public TGetNextResult(
    com.cloudera.impala.thrift.TStatus status,
    boolean eos)
  {
    this();
    this.status = status;
    this.eos = eos;
    setEosIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TGetNextResult(TGetNextResult other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetStatus()) {
      this.status = new com.cloudera.impala.thrift.TStatus(other.status);
    }
    this.eos = other.eos;
    if (other.isSetRows()) {
      this.rows = new TRowBatch(other.rows);
    }
  }

  public TGetNextResult deepCopy() {
    return new TGetNextResult(this);
  }

  @Override
  public void clear() {
    this.status = null;
    setEosIsSet(false);
    this.eos = false;
    this.rows = null;
  }

  public com.cloudera.impala.thrift.TStatus getStatus() {
    return this.status;
  }

  public TGetNextResult setStatus(com.cloudera.impala.thrift.TStatus status) {
    this.status = status;
    return this;
  }

  public void unsetStatus() {
    this.status = null;
  }

  /** Returns true if field status is set (has been assigned a value) and false otherwise */
  public boolean isSetStatus() {
    return this.status != null;
  }

  public void setStatusIsSet(boolean value) {
    if (!value) {
      this.status = null;
    }
  }

  public boolean isEos() {
    return this.eos;
  }

  public TGetNextResult setEos(boolean eos) {
    this.eos = eos;
    setEosIsSet(true);
    return this;
  }

  public void unsetEos() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EOS_ISSET_ID);
  }

  /** Returns true if field eos is set (has been assigned a value) and false otherwise */
  public boolean isSetEos() {
    return EncodingUtils.testBit(__isset_bitfield, __EOS_ISSET_ID);
  }

  public void setEosIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EOS_ISSET_ID, value);
  }

  public TRowBatch getRows() {
    return this.rows;
  }

  public TGetNextResult setRows(TRowBatch rows) {
    this.rows = rows;
    return this;
  }

  public void unsetRows() {
    this.rows = null;
  }

  /** Returns true if field rows is set (has been assigned a value) and false otherwise */
  public boolean isSetRows() {
    return this.rows != null;
  }

  public void setRowsIsSet(boolean value) {
    if (!value) {
      this.rows = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((com.cloudera.impala.thrift.TStatus)value);
      }
      break;

    case EOS:
      if (value == null) {
        unsetEos();
      } else {
        setEos((Boolean)value);
      }
      break;

    case ROWS:
      if (value == null) {
        unsetRows();
      } else {
        setRows((TRowBatch)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case STATUS:
      return getStatus();

    case EOS:
      return Boolean.valueOf(isEos());

    case ROWS:
      return getRows();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case STATUS:
      return isSetStatus();
    case EOS:
      return isSetEos();
    case ROWS:
      return isSetRows();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof TGetNextResult)
      return this.equals((TGetNextResult)that);
    return false;
  }

  public boolean equals(TGetNextResult that) {
    if (that == null)
      return false;

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    boolean this_present_eos = true;
    boolean that_present_eos = true;
    if (this_present_eos || that_present_eos) {
      if (!(this_present_eos && that_present_eos))
        return false;
      if (this.eos != that.eos)
        return false;
    }

    boolean this_present_rows = true && this.isSetRows();
    boolean that_present_rows = true && that.isSetRows();
    if (this_present_rows || that_present_rows) {
      if (!(this_present_rows && that_present_rows))
        return false;
      if (!this.rows.equals(that.rows))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  @Override
  public int compareTo(TGetNextResult other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEos()).compareTo(other.isSetEos());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEos()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eos, other.eos);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRows()).compareTo(other.isSetRows());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRows()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rows, other.rows);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("TGetNextResult(");
    boolean first = true;

    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      sb.append(this.status);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("eos:");
    sb.append(this.eos);
    first = false;
    if (isSetRows()) {
      if (!first) sb.append(", ");
      sb.append("rows:");
      if (this.rows == null) {
        sb.append("null");
      } else {
        sb.append(this.rows);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (status == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'eos' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
    if (status != null) {
      status.validate();
    }
    if (rows != null) {
      rows.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TGetNextResultStandardSchemeFactory implements SchemeFactory {
    public TGetNextResultStandardScheme getScheme() {
      return new TGetNextResultStandardScheme();
    }
  }

  private static class TGetNextResultStandardScheme extends StandardScheme<TGetNextResult> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TGetNextResult struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.status = new com.cloudera.impala.thrift.TStatus();
              struct.status.read(iprot);
              struct.setStatusIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // EOS
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.eos = iprot.readBool();
              struct.setEosIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // ROWS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.rows = new TRowBatch();
              struct.rows.read(iprot);
              struct.setRowsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetEos()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'eos' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TGetNextResult struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        struct.status.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(EOS_FIELD_DESC);
      oprot.writeBool(struct.eos);
      oprot.writeFieldEnd();
      if (struct.rows != null) {
        if (struct.isSetRows()) {
          oprot.writeFieldBegin(ROWS_FIELD_DESC);
          struct.rows.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TGetNextResultTupleSchemeFactory implements SchemeFactory {
    public TGetNextResultTupleScheme getScheme() {
      return new TGetNextResultTupleScheme();
    }
  }

  private static class TGetNextResultTupleScheme extends TupleScheme<TGetNextResult> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TGetNextResult struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      struct.status.write(oprot);
      oprot.writeBool(struct.eos);
      BitSet optionals = new BitSet();
      if (struct.isSetRows()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetRows()) {
        struct.rows.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TGetNextResult struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.status = new com.cloudera.impala.thrift.TStatus();
      struct.status.read(iprot);
      struct.setStatusIsSet(true);
      struct.eos = iprot.readBool();
      struct.setEosIsSet(true);
      BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        struct.rows = new TRowBatch();
        struct.rows.read(iprot);
        struct.setRowsIsSet(true);
      }
    }
  }

}


text:
<?php

namespace Doctrine\Tests\ORM\Functional\Ticket;

use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\ToolsException;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
 * @group DDC-3634
 */
class DDC3634Test extends OrmFunctionalTestCase {

    protected function setUp() {
        parent::setUp();

        $metadata = $this->_em->getClassMetadata(DDC3634Entity::CLASSNAME);

        if ( ! $metadata->idGenerator->isPostInsertGenerator()) {
            $this->markTestSkipped('Need a post-insert ID generator in order to make this test work correctly');
        }

        try {
            $this->_schemaTool->createSchema([
                $metadata,
                $this->_em->getClassMetadata(DDC3634JTIBaseEntity::CLASSNAME),
                $this->_em->getClassMetadata(DDC3634JTIChildEntity::CLASSNAME),
            ]);
        } catch (ToolsException $e) {
            // schema already in place
        }
    }

    public function testSavesVeryLargeIntegerAutoGeneratedValue()
    {
        $veryLargeId = PHP_INT_MAX . PHP_INT_MAX;

        $entityManager = EntityManager::create(
            new DDC3634LastInsertIdMockingConnection($veryLargeId, $this->_em->getConnection()),
            $this->_em->getConfiguration()
        );

        $entity = new DDC3634Entity();

        $entityManager->persist($entity);
        $entityManager->flush();

        $this->assertSame($veryLargeId, $entity->id);
    }

    public function testSavesIntegerAutoGeneratedValueAsString()
    {
        $entity = new DDC3634Entity();

        $this->_em->persist($entity);
        $this->_em->flush();

        $this->assertInternalType('string', $entity->id);
    }

    public function testSavesIntegerAutoGeneratedValueAsStringWithJoinedInheritance()
    {
        $entity = new DDC3634JTIChildEntity();

        $this->_em->persist($entity);
        $this->_em->flush();

        $this->assertInternalType('string', $entity->id);
    }
}

/** @Entity */
class DDC3634Entity
{
    const CLASSNAME = __CLASS__;

    /** @Id @Column(type="bigint") @GeneratedValue(strategy="AUTO") */
    public $id;
}

/**
 * @Entity
 * @InheritanceType("JOINED")
 * @DiscriminatorMap({
 *  DDC3634JTIBaseEntity::class  = DDC3634JTIBaseEntity::class,
 *  DDC3634JTIChildEntity::class = DDC3634JTIChildEntity::class,
 * })
 */
class DDC3634JTIBaseEntity
{
    const CLASSNAME = __CLASS__;

    /** @Id @Column(type="bigint") @GeneratedValue(strategy="AUTO") */
    public $id;
}

/** @Entity */
class DDC3634JTIChildEntity extends DDC3634JTIBaseEntity
{
    const CLASSNAME = __CLASS__;
}

class DDC3634LastInsertIdMockingConnection extends Connection
{
    /**
     * @var Connection
     */
    private $realConnection;

    /**
     * @var int
     */
    private $identifier;

    /**
     * @param int        $identifier
     * @param Connection $realConnection
     */
    public function __construct($identifier, Connection $realConnection)
    {
        $this->realConnection = $realConnection;
        $this->identifier     = $identifier;
    }

    private function forwardCall()
    {
        $trace = debug_backtrace(0, 2)[1];

        return call_user_func_array([$this->realConnection, $trace['function']], $trace['args']);
    }

    public function getParams()
    {
        return $this->forwardCall();
    }

    public function getDatabase()
    {
        return $this->forwardCall();
    }

    public function getHost()
    {
        return $this->forwardCall();
    }

    public function getPort()
    {
        return $this->forwardCall();
    }

    public function getUsername()
    {
        return $this->forwardCall();
    }

    public function getPassword()
    {
        return $this->forwardCall();
    }

    public function getDriver()
    {
        return $this->forwardCall();
    }

    public function getConfiguration()
    {
        return $this->forwardCall();
    }

    public function getEventManager()
    {
        return $this->forwardCall();
    }

    public function getDatabasePlatform()
    {
        return $this->forwardCall();
    }

    public function getExpressionBuilder()
    {
        return $this->forwardCall();
    }

    public function connect()
    {
        return $this->forwardCall();
    }

    public function isAutoCommit()
    {
        return $this->forwardCall();
    }

    public function setAutoCommit($autoCommit)
    {
        return $this->forwardCall();
    }

    public function setFetchMode($fetchMode)
    {
        return $this->forwardCall();
    }

    public function fetchAssoc($statement, array $params = [], array $types = [])
    {
        return $this->forwardCall();
    }

    public function fetchArray($statement, array $params = [], array $types = [])
    {
        return $this->forwardCall();
    }

    public function fetchColumn($statement, array $params = [], $column = 0, array $types = [])
    {
        return $this->forwardCall();
    }

    public function isConnected()
    {
        return $this->forwardCall();
    }

    public function isTransactionActive()
    {
        return $this->forwardCall();
    }

    public function delete($tableExpression, array $identifier, array $types = [])
    {
        return $this->forwardCall();
    }

    public function close()
    {
        return $this->forwardCall();
    }

    public function setTransactionIsolation($level)
    {
        return $this->forwardCall();
    }

    public function getTransactionIsolation()
    {
        return $this->forwardCall();
    }

    public function update($tableExpression, array $data, array $identifier, array $types = [])
    {
        return $this->forwardCall();
    }

    public function insert($tableExpression, array $data, array $types = [])
    {
        return $this->forwardCall();
    }

    public function quoteIdentifier($str)
    {
        return $this->forwardCall();
    }

    public function quote($input, $type = null)
    {
        return $this->forwardCall();
    }

    public function fetchAll($sql, array $params = [], $types = [])
    {
        return $this->forwardCall();
    }

    public function prepare($statement)
    {
        return $this->forwardCall();
    }

    public function executeQuery($query, array $params = [], $types = [], QueryCacheProfile $qcp = null)
    {
        return $this->forwardCall();
    }

    public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qcp)
    {
        return $this->forwardCall();
    }

    public function project($query, array $params, \Closure $function)
    {
        return $this->forwardCall();
    }

    public function query()
    {
        return $this->forwardCall();
    }

    public function executeUpdate($query, array $params = [], array $types = [])
    {
        return $this->forwardCall();
    }

    public function exec($statement)
    {
        return $this->forwardCall();
    }

    public function getTransactionNestingLevel()
    {
        return $this->forwardCall();
    }

    public function errorCode()
    {
        return $this->forwardCall();
    }

    public function errorInfo()
    {
        return $this->forwardCall();
    }

    public function lastInsertId($seqName = null)
    {
        return $this->identifier;
    }

    public function transactional(\Closure $func)
    {
        return $this->forwardCall();
    }

    public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints)
    {
        return $this->forwardCall();
    }

    public function getNestTransactionsWithSavepoints()
    {
        return $this->forwardCall();
    }

    protected function _getNestedTransactionSavePointName()
    {
        return $this->forwardCall();
    }

    public function beginTransaction()
    {
        return $this->forwardCall();
    }

    public function commit()
    {
        return $this->forwardCall();
    }

    public function rollBack()
    {
        return $this->forwardCall();
    }

    public function createSavepoint($savepoint)
    {
        return $this->forwardCall();
    }

    public function releaseSavepoint($savepoint)
    {
        return $this->forwardCall();
    }

    public function rollbackSavepoint($savepoint)
    {
        return $this->forwardCall();
    }

    public function getWrappedConnection()
    {
        return $this->forwardCall();
    }

    public function getSchemaManager()
    {
        return $this->forwardCall();
    }

    public function setRollbackOnly()
    {
        return $this->forwardCall();
    }

    public function isRollbackOnly()
    {
        return $this->forwardCall();
    }

    public function convertToDatabaseValue($value, $type)
    {
        return $this->forwardCall();
    }

    public function convertToPHPValue($value, $type)
    {
        return $this->forwardCall();
    }

    public function resolveParams(array $params, array $types)
    {
        return $this->forwardCall();
    }

    public function createQueryBuilder()
    {
        return $this->forwardCall();
    }

    public function ping()
    {
        return $this->forwardCall();
    }
}


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>UserFilter</title>
<meta name="date" content="2017-08-19">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

filter

Class UserFilter

java.lang.Object

filter.UserFilter

All Implemented Interfaces:

javax.servlet.Filter

public class UserFilter
extends java.lang.Object
implements javax.servlet.Filter

This Filter implementation validates that a requester is authorized to access
 the destination resource before forwarding the request.

Constructor Summary

Constructors

Constructor and Description

UserFilter()

Default constructor

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

void
destroy()

Destroy method for this filter

void
doFilter(javax.servlet.ServletRequest request,
        javax.servlet.ServletResponse response,
        javax.servlet.FilterChain chain)

This method verifies that the user is signed in before allowing the user
 to proceed to the user pages.

void
init(javax.servlet.FilterConfig filterConfig)

Init method for this filter

void
log(java.lang.String msg)

The message logger method

java.lang.String
toString()

Return a String representation of this object.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

UserFilter

public UserFilter()

Default constructor

Method Detail

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException

This method verifies that the user is signed in before allowing the user
 to proceed to the user pages.

Specified by:

doFilter in interface javax.servlet.Filter

Parameters:

request - The servlet request we are processing

response - The servlet response we are creating

chain - The filter chain we are processing

Throws:

java.io.IOException - if an input/output error occurs

javax.servlet.ServletException - if a servlet error occurs

destroy

public void destroy()

Destroy method for this filter

Specified by:

destroy in interface javax.servlet.Filter

init

public void init(javax.servlet.FilterConfig filterConfig)

Init method for this filter

Specified by:

init in interface javax.servlet.Filter

Parameters:

filterConfig - the filter configuration object

toString

public java.lang.String toString()

Return a String representation of this object.

Overrides:

toString in class java.lang.Object

log

public void log(java.lang.String msg)

The message logger method

Parameters:

msg - the message

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package fi.csc.microarray.messaging.admin;

import java.io.Serializable;

public class StorageAggregate implements Serializable {

	private String username;
	private long size;

	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public long getSize() {
		return size;
	}
	public void setSize(long size) {
		this.size = size;
	}
}


text:
package org.javarosa.core.model;

import org.javarosa.core.model.actions.ActionController;
import org.javarosa.core.services.locale.Localizable;
import org.javarosa.core.util.externalizable.Externalizable;
import org.javarosa.model.xform.XPathReference;

import java.util.Vector;

/**
 * An IFormDataElement is an element of the physical interaction for
 * a form, an example of an implementing element would be the definition
 * of a Question.
 *
 * @author Drew Roos
 */
public interface IFormElement extends Localizable, Externalizable {

    /**
     * @return The unique ID of this element
     */
    int getID();

    /**
     * @param id The new unique ID of this element
     */
    void setID(int id);

    /**
     * get the TextID for this element used for localization purposes
     *
     * @return the TextID (bare, no ;form appended to it!!)
     */
    String getTextID();

    /**
     * Set the textID for this element for use with localization.
     *
     * @param id the plain TextID WITHOUT any form specification (e.g. ;long)
     */
    void setTextID(String id);

    /**
     * @return A vector containing any children that this element
     * might have. Null if the element is not able to have child
     * elements.
     */
    Vector<IFormElement> getChildren();

    /**
     * @param v the children of this element, if it is capable of having
     *          child elements.
     * @throws IllegalStateException if the element is incapable of
     *                               having children.
     */
    void setChildren(Vector<IFormElement> v);

    /**
     * @param fe The child element to be added
     * @throws IllegalStateException if the element is incapable of
     *                               having children.
     */
    void addChild(IFormElement fe);

    IFormElement getChild(int i);

    /**
     * @return A recursive count of how many elements are ancestors of this element.
     */
    int getDeepChildCount();

    /**
     * @return The data reference for this element
     */
    XPathReference getBind();

    /**
     * Registers a state observer for this element.
     */
    void registerStateObserver(FormElementStateListener qsl);

    /**
     * Unregisters a state observer for this element.
     */
    void unregisterStateObserver(FormElementStateListener qsl);

    /**
     * This method returns the regular
     * innertext betweem label tags (if present) (&ltlabel&gtinnertext&lt/label&gt).
     *
     * @return &ltlabel&gt innertext or null (if innertext is not present).
     */
    String getLabelInnerText();

    String getAppearanceAttr();

    void setAppearanceAttr(String appearanceAttr);

    ActionController getActionController();
}


text:
<?php

/*
 * This file is copied from the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 */

namespace Composer\Autoload;

use Composer\Pcre\Preg;
use Symfony\Component\Finder\Finder;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;

/**
 * ClassMapGenerator
 *
 * @author Gyula Sallai <salla016@gmail.com>
 * @author Jordi Boggiano <j.boggiano@seld.be>
 */
class ClassMapGenerator
{
    /**
     * Generate a class map file
     *
     * @param \Traversable<string>|array<string> $dirs Directories or a single path to search in
     * @param string                     $file The name of the class map file
     * @return void
     */
    public static function dump($dirs, $file)
    {
        $maps = array();

        foreach ($dirs as $dir) {
            $maps = array_merge($maps, static::createMap($dir));
        }

        file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
    }

    /**
     * Iterate over all files in the given directory searching for classes
     *
     * @param \Traversable<\SplFileInfo>|string|array<string> $path The path to search in or an iterator
     * @param string              $excluded     Regex that matches file paths to be excluded from the classmap
     * @param ?IOInterface        $io           IO object
     * @param ?string             $namespace    Optional namespace prefix to filter by
     * @param ?string             $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules
     * @param array<string, true> $scannedFiles
     * @return array<class-string, string> A class map array
     * @throws \RuntimeException When the path is neither an existing file nor directory
     */
    public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())
    {
        $basePath = $path;
        if (is_string($path)) {
            if (is_file($path)) {
                $path = array(new \SplFileInfo($path));
            } elseif (is_dir($path) || strpos($path, '*') !== false) {
                $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
            } else {
                throw new \RuntimeException(
                    'Could not scan for classes inside "'.$path.
                    '" which does not appear to be a file nor a folder'
                );
            }
        } elseif (null !== $autoloadType) {
            throw new \RuntimeException('Path must be a string when specifying an autoload type');
        }

        $map = array();
        $filesystem = new Filesystem();
        $cwd = realpath(getcwd());

        foreach ($path as $file) {
            $filePath = $file->getPathname();
            if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
                continue;
            }

            if (!$filesystem->isAbsolutePath($filePath)) {
                $filePath = $cwd . '/' . $filePath;
                $filePath = $filesystem->normalizePath($filePath);
            } else {
                $filePath = Preg::replace('{[\\\\/]{2,}}', '/', $filePath);
            }

            $realPath = realpath($filePath);

            // if a list of scanned files is given, avoid scanning twice the same file to save cycles and avoid generating warnings
            // in case a PSR-0/4 declaration follows another more specific one, or a classmap declaration, which covered this file already
            if (isset($scannedFiles[$realPath])) {
                continue;
            }

            // check the realpath of the file against the excluded paths as the path might be a symlink and the excluded path is realpath'd so symlink are resolved
            if ($excluded && Preg::isMatch($excluded, strtr($realPath, '\\', '/'))) {
                continue;
            }
            // check non-realpath of file for directories symlink in project dir
            if ($excluded && Preg::isMatch($excluded, strtr($filePath, '\\', '/'))) {
                continue;
            }

            $classes = self::findClasses($filePath);
            if (null !== $autoloadType) {
                $classes = self::filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath, $io);

                // if no valid class was found in the file then we do not mark it as scanned as it might still be matched by another rule later
                if ($classes) {
                    $scannedFiles[$realPath] = true;
                }
            } else {
                // classmap autoload rules always collect all classes so for these we definitely do not want to scan again
                $scannedFiles[$realPath] = true;
            }

            foreach ($classes as $class) {
                // skip classes not within the given namespace prefix
                if (null === $autoloadType && null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) {
                    continue;
                }

                if (!isset($map[$class])) {
                    $map[$class] = $filePath;
                } elseif ($io && $map[$class] !== $filePath && !Preg::isMatch('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
                    $io->writeError(
                        '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
                        ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
                    );
                }
            }
        }

        return $map;
    }

    /**
     * Remove classes which could not have been loaded by namespace autoloaders
     *
     * @param  array<int, class-string> $classes       found classes in given file
     * @param  string                   $filePath      current file
     * @param  string                   $baseNamespace prefix of given autoload mapping
     * @param  string                   $namespaceType psr-0|psr-4
     * @param  string                   $basePath      root directory of given autoload mapping
     * @param  ?IOInterface             $io            IO object
     * @return array<int, class-string> valid classes
     */
    private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io)
    {
        $validClasses = array();
        $rejectedClasses = array();

        $realSubPath = substr($filePath, strlen($basePath) + 1);
        $dotPosition = strrpos($realSubPath, '.');
        $realSubPath = substr($realSubPath, 0, $dotPosition === false ? PHP_INT_MAX : $dotPosition);

        foreach ($classes as $class) {
            // silently skip if ns doesn't have common root
            if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
                continue;
            }
            // transform class name to file path and validate
            if ('psr-0' === $namespaceType) {
                $namespaceLength = strrpos($class, '\\');
                if (false !== $namespaceLength) {
                    $namespace = substr($class, 0, $namespaceLength + 1);
                    $className = substr($class, $namespaceLength + 1);
                    $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
                        . str_replace('_', DIRECTORY_SEPARATOR, $className);
                } else {
                    $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
                }
            } elseif ('psr-4' === $namespaceType) {
                $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
                $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
            } else {
                throw new \RuntimeException("namespaceType must be psr-0 or psr-4, $namespaceType given");
            }
            if ($subPath === $realSubPath) {
                $validClasses[] = $class;
            } else {
                $rejectedClasses[] = $class;
            }
        }
        // warn only if no valid classes, else silently skip invalid
        if (empty($validClasses)) {
            foreach ($rejectedClasses as $class) {
                if ($io) {
                    $io->writeError("<warning>Class $class located in ".Preg::replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. Skipping.</warning>");
                }
            }

            return array();
        }

        return $validClasses;
    }

    /**
     * Extract the classes in the given file
     *
     * @param  string            $path The file to check
     * @throws \RuntimeException
     * @return array<int, class-string> The found classes
     */
    private static function findClasses($path)
    {
        $extraTypes = self::getExtraTypes();

        // Use @ here instead of Silencer to actively suppress 'unhelpful' output
        // @link https://github.com/composer/composer/pull/4886
        $contents = @php_strip_whitespace($path);
        if (!$contents) {
            if (!file_exists($path)) {
                $message = 'File at "%s" does not exist, check your classmap definitions';
            } elseif (!Filesystem::isReadable($path)) {
                $message = 'File at "%s" is not readable, check its permissions';
            } elseif ('' === trim((string) file_get_contents($path))) {
                // The input file was really empty and thus contains no classes
                return array();
            } else {
                $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
            }
            $error = error_get_last();
            if (isset($error['message'])) {
                $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
            }
            throw new \RuntimeException(sprintf($message, $path));
        }

        // return early if there is no chance of matching anything in this file
        Preg::matchAll('{\b(?:class|interface|trait'.$extraTypes.')\s}i', $contents, $matches);
        if (!$matches) {
            return array();
        }

        $p = new PhpFileCleaner($contents, count($matches[0]));
        $contents = $p->clean();
        unset($p);

        Preg::matchAll('{
            (?:
                 \b(?<![\$:>])(?P<type>class|interface|trait'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
               | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
            )
        }ix', $contents, $matches);

        $classes = array();
        $namespace = '';

        for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
            if (!empty($matches['ns'][$i])) {
                $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
            } else {
                $name = $matches['name'][$i];
                // skip anon classes extending/implementing
                if ($name === 'extends' || $name === 'implements') {
                    continue;
                }
                if ($name[0] === ':') {
                    // This is an XHP class, https://github.com/facebook/xhp
                    $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
                } elseif ($matches['type'][$i] === 'enum') {
                    // In Hack, something like:
                    //   enum Foo: int { HERP = '123'; }
                    // The regex above captures the colon, which isn't part of
                    // the class name.
                    $name = rtrim($name, ':');
                }
                $classes[] = ltrim($namespace . $name, '\\');
            }
        }

        return $classes;
    }

    /**
     * @return string
     */
    private static function getExtraTypes()
    {
        static $extraTypes = null;

        if (null === $extraTypes) {
            $extraTypes = '';
            if (PHP_VERSION_ID >= 80100 || (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>='))) {
                $extraTypes .= '|enum';
            }

            PhpFileCleaner::setTypeConfig(array_merge(['class', 'interface', 'trait'], array_filter(explode('|', $extraTypes))));
        }

        return $extraTypes;
    }
}


text:
<?php
/**
 * User: hackbee
 * Date: 2017/7/29
 * Time: 7:34
 */

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Repositories\LinkRepository;
use App\Transformers\LinkTransformer;
use App\Http\Validators\LinkValidator;

class LinkController extends BaseController
{
    protected $link;

    public function __construct(LinkRepository $link)
    {
        $this->link = $link;
    }

    public function index(Request $request)
    {
        $pageSize = $request->input('pageSize');
        $page = $request->input('page');

        return $this->response($this->link->page($page, $pageSize));
    }

    public function store(Request $request)
    {
        $validator = LinkValidator::make($request);
        if ($validator->fails()) {
            return $this->response($validator->errors(), self::STATUS_WRONG_ARGS);
        }

        $data = LinkTransformer::transform($request->all());
        if (!$this->link->save($data)) {
            return $this->responseError(self::STATUS_INTERNAL_ERROR);
        }

        return $this->response();
    }

    public function edit($id)
    {
        if (!($data = $this->link->find($id))) {
            return $this->responseError(self::STATUS_NOT_FOUND);
        }

        return $this->response($data);
    }

    public function update(Request $request, $id)
    {
        $validator = LinkValidator::make($request, 'store');
        if ($validator->fails()) {
            return $this->response($validator->errors(), self::STATUS_WRONG_ARGS);
        }

        $data = LinkTransformer::transform($request->all());
        if (!$this->link->update($id, $data)) {
            return $this->responseError(self::STATUS_UPDATE_FAIL);
        }

        return $this->response();
    }

    public function destroy($id)
    {
        if (!$this->link->delete($id)) {
            return $this->responseError(self::STATUS_NOT_FOUND);
        }
        return $this->response();
    }
}


text:
from __future__ import print_function
"""

.. moduleauthor:: easygui developers and Stephen Raymond Ferg
.. default-domain:: py
.. highlight:: python

Version |release|
"""

import os
try:
    from . import utils as ut
    from . import fileboxsetup as fbs
except (SystemError, ValueError, ImportError):
    import utils as ut
    import fileboxsetup as fbs

tk = ut.tk

# -------------------------------------------------------------------
# fileopenbox
# -------------------------------------------------------------------

def fileopenbox(msg=None, title=None, default='*', filetypes=None, multiple=False):
    """
    A dialog to get a file name.

    **About the "default" argument**

    The "default" argument specifies a filepath that (normally)
    contains one or more wildcards.
    fileopenbox will display only files that match the default filepath.
    If omitted, defaults to "\*" (all files in the current directory).

    WINDOWS EXAMPLE::

        ...default="c:/myjunk/*.py"

    will open in directory c:\\myjunk\\ and show all Python files.

    WINDOWS EXAMPLE::

        ...default="c:/myjunk/test*.py"

    will open in directory c:\\myjunk\\ and show all Python files
    whose names begin with "test".

    Note that on Windows, fileopenbox automatically changes the path
    separator to the Windows path separator (backslash).

    **About the "filetypes" argument**

    If specified, it should contain a list of items,
    where each item is either:

    - a string containing a filemask          # e.g. "\*.txt"
    - a list of strings, where all of the strings except the last one
      are filemasks (each beginning with "\*.",
      such as "\*.txt" for text files, "\*.py" for Python files, etc.).
      and the last string contains a filetype description

    EXAMPLE::

        filetypes = ["*.css", ["*.htm", "*.html", "HTML files"]  ]

    .. note:: If the filetypes list does not contain ("All files","*"), it will be added.

    If the filetypes list does not contain a filemask that includes
    the extension of the "default" argument, it will be added.
    For example, if default="\*abc.py"
    and no filetypes argument was specified, then
    "\*.py" will automatically be added to the filetypes argument.

    :param str msg: the msg to be displayed.
    :param str title: the window title
    :param str default: filepath with wildcards
    :param object filetypes: filemasks that a user can choose, e.g. "\*.txt"
    :param bool multiple: If true, more than one file can be selected
    :return: the name of a file, or None if user chose to cancel
    """
    localRoot = tk.Tk()
    localRoot.withdraw()

    initialbase, initialfile, initialdir, filetypes = fbs.fileboxSetup(
        default, filetypes)

    # ------------------------------------------------------------
    # if initialfile contains no wildcards; we don't want an
    # initial file. It won't be used anyway.
    # Also: if initialbase is simply "*", we don't want an
    # initialfile; it is not doing any useful work.
    # ------------------------------------------------------------
    if (initialfile.find("*") < 0) and (initialfile.find("?") < 0):
        initialfile = None
    elif initialbase == "*":
        initialfile = None

    func = ut.tk_FileDialog.askopenfilenames if multiple else ut.tk_FileDialog.askopenfilename
    ret_val = func(parent=localRoot,
                   title=ut.getFileDialogTitle(msg, title),
                   initialdir=initialdir, initialfile=initialfile,
                   filetypes=filetypes
                   )
    if not ret_val or ret_val == '':
        return None
    if multiple:
        f = [os.path.normpath(x) for x in localRoot.tk.splitlist(ret_val)]
    else:
        try:
            f = os.path.normpath(ret_val)
        except AttributeError as e:
            print("ret_val is {}".format(ret_val))
            raise e
    localRoot.destroy()

    if not f:
        return None
    return f

if __name__ == '__main__':
    print("Hello from file open box")
    ret_val = fileopenbox("Please select a file", "My File Open dialog")
    print("Return value is:{}".format(ret_val))


text:
*    **lodash:** Upgraded lodash to 4.17.0 to fix low severity vulnerability.

#### Upgraded Features

*   **Accordion:** Takes flexible dataArray input by passing `item` as callback parameter instead of `title` and `content`.
*   **Toast:** Added `hide` function for hiding toast.
*   **Typescript:** Updated extended prop names.

#### Bug Fixes

*   **Card:** Fixed Card flexes with wrapping Content.
*   **Footer:** Vue Native - Footer issue fixed for iPhoneX.
*   **Header:**
    -  Fixed vertical alignment of elements in Header on iPhoneX.
    -  Vue Native - Header issue fixed for iPhoneX.
*   **Icon:** Fixed Ionicons, Feather and MaterialCommunityIcons font issue of 2.7.1.
*   **Input:** Modified assertion on the `Item` component to use the `displayName` prop to support HOC.
*   **Tabs:** Allow overriding of theme variable with explicit styles prop on Tab.
*   **TypeScript:** Fixed date picker props.

<hr>


text:
package O2::Lang::I18N;

# Provides support for I18N resource files
# I'm using the O2 config.pm object as my RESOURCE handler
# But I really should implement XLIFF standard or something similar,
# cause this will allows us to send the XML files to translators for translating.
# It is also heaps of Open source software to edit XLIFF files
#
# NOTE: this is the base implementation, we need to create own tablibs for templates handling
# The I18N will outline the API and when we change the underlaying resource implementation
# all overlaying components should be able work transparently.

use strict;

use constant DEBUG => 0;
use O2 qw($context);

#------------------------------------------------------------------
sub new {
  my ($package, %init) = @_;
  my $obj = bless \%init, $package;
  $obj->{defaultLocale}    ||= 'en';
  $obj->{locale}           ||= $context->getLocaleCode() || $obj->getLocale();
  $obj->{resourcePathPrefix} = '';
  return $obj;
}
#------------------------------------------------------------------
sub getString {
  my ($obj, $keyId, %params) = @_;
  my $locale = $params{locale};
  $locale  ||= $context->getLocaleCode(); # If context->{localeCode} has been updated after the constructor was called, we probably want to use that localeCode.
  $locale  ||= $obj->getLocale();
  if (!$obj->{$locale}) {
    require O2::Config;
    $obj->{$locale} = O2::Config->new( split /;/, $obj->{resourcePath} );
  }

  my $string = $obj->_getConfStringFromKey($keyId, $locale, %params);

  # Parse variables in the string
  if ($string) {
    $string =~ s{ \$   (\w+)    }{ exists $params{$1} ? $obj->encode( $params{$1} ) : $obj->getErrorString('$'.$1) }xge;
    $string =~ s{ \$\{ (\w+) \} }{ exists $params{$1} ? $obj->encode( $params{$1} ) : $obj->getErrorString('$'.$1) }xge;
  }
  return $string               if defined $string;
  return $params{missingValue} if exists $params{missingValue}; # custom return value for missing text

  my $warnMsg = "Missing language key: $keyId [$locale]";
  $warnMsg   .= "
\nResource path prefix is $obj->{resourcePathPrefix}" if $obj->{resourcePathPrefix} && $keyId !~ m{$obj->{resourcePathPrefix}}xms;
  warning $warnMsg;

  return $obj->_getErrorLink($keyId, $locale); # return error message (with link)
}
#------------------------------------------------------------------
# error message for missing texts (will display a link to locale editor)
sub _getErrorLink {
  my ($obj, $keyId, $locale) = @_;
  return "$keyId [$locale]";
  return "$keyId [$locale]";
}
#------------------------------------------------------------------
sub keyExists {
  my ($obj, $key) = @_;
  my $locale = $obj->{locale} || $obj->{defaultLocale};
  if (!$obj->{$locale}) {
    require O2::Config;
    $obj->{$locale} = O2::Config->new( $context, split /;/, $obj->{resourcePath} );
  }
  return  $obj->_getConfStringFromKey($key, $locale, useOnlyGivenLocale => 1)  ?  1  :  0;
}
#------------------------------------------------------------------
sub _getConfStringFromKey {
  my ($obj, $keyId, $locale, %params) = @_;
  my ($lang, $terr) = split /_/, $locale; # eg. en_US

  my $string;

  debug "GET: $keyId $locale";
  debug "resourcePath: $obj->{resourcePath}";
  debug "resourcePathPrefix: $obj->{resourcePathPrefix}";

  if ($obj->{resourcePathPrefix}) {
    debug "GET: $locale.$obj->{resourcePathPrefix}.$keyId->" . ($string || 'not found') . '';
    $string = $obj->{$locale}->get("$locale.$obj->{resourcePathPrefix}.$keyId");
  }

  $string ||= $obj->{$locale}->get("$locale.$keyId");
  debug "GET: $locale.$keyId->" . ($string || 'not found') . '' unless $string;
  # eg. en
  return $string if $params{useOnlyGivenLocale};

  $string ||= $obj->{$locale}->get("$lang.$obj->{resourcePathPrefix}.$keyId")                   if             $obj->{resourcePathPrefix};
  debug "GET: $lang.$obj->{resourcePathPrefix}.$keyId->" . ($string || 'not found') . '' if !$string && $obj->{resourcePathPrefix};

  $string ||= $obj->{$locale}->get("$lang.$keyId");
  debug "GET: $lang.$keyId->" . ($string || 'not found') . '' unless $string;

  $string ||= $obj->{$locale}->get("$obj->{defaultLocale}.$obj->{resourcePathPrefix}.$keyId")                   if             $obj->{resourcePathPrefix};
  debug "GET: $obj->{defaultLocale}.$obj->{resourcePathPrefix}.$keyId->" . ($string || 'not found') . '' if !$string && $obj->{resourcePathPrefix};

  # default locale
  $string ||= $obj->{$locale}->get("$obj->{defaultLocale}.$keyId");
  debug "GET: $obj->{defaultLocale}.$keyId->" . ($string || 'not found') . '' unless $string;
  return $string;
}
#------------------------------------------------------------------
# Same as getString
sub getArrayRef {
  my ($obj, $keyId, %params) = @_;
  return $obj->getString($keyId, %params);
}
#------------------------------------------------------------------
sub getLocale {
  my ($obj) = @_;
  return $obj->{locale} || $obj->{defaultLocale};
}
#------------------------------------------------------------------
sub setLocale {
  my ($obj, $locale) = @_;
  $obj->{locale} = $locale;
  return;
}
#------------------------------------------------------------------
sub setResourcePath {
  my ($obj, $resPath) = @_;
  debug "setResourcePath: $resPath";
  $obj->{resourcePathPrefix} = $resPath;
  return;
}
#------------------------------------------------------------------
sub getErrorString {
  my ($obj, $errString) = @_;
  return "$errString";
}
#------------------------------------------------------------------
sub getClassname {
  my ($obj, $className) = @_;
  return $obj->getString("o2.className.$className");
}
#------------------------------------------------------------------
sub encode {
  my ($obj, $str) = @_;
  $str =~ s{ &  }{&}xms;
  $str =~ s{ <  }{<}xms;
  $str =~ s{ >  }{>}xms;
  $str =~ s{ \" }{"}xms;
  $str =~ s{ \' }{'}xms;
  $str =~ s{ \$ }{$}xms;
  return $str;
}
#------------------------------------------------------------------
1;


text:
import {module} from 'angular';
import {react2angular} from 'react2angular';
import {Variable} from './Variable';

export const VARIABLE = 'spinnaker.core.pipelineTemplate.variable.component';
module(VARIABLE, [])
  .component('variable', react2angular(Variable, ['variableMetadata', 'variable', 'onChange']));


text:
package org.zerhusen.security.rest;

import org.junit.Test;
import org.springframework.http.MediaType;
import org.zerhusen.util.AbstractRestControllerTest;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

public class AuthenticationRestControllerTest extends AbstractRestControllerTest {

   @Test
   public void successfulAuthenticationWithUser() throws Exception {
      getMockMvc().perform(post("/api/authenticate")
         .contentType(MediaType.APPLICATION_JSON)
         .content("{\"password\": \"password\", \"username\": \"user\"}"))
         .andExpect(status().isOk())
         .andExpect(content().string(containsString("id_token")));
   }

   @Test
   public void successfulAuthenticationWithAdmin() throws Exception {
      getMockMvc().perform(post("/api/authenticate")
         .contentType(MediaType.APPLICATION_JSON)
         .content("{\"password\": \"admin\", \"username\": \"admin\"}"))
         .andExpect(status().isOk())
         .andExpect(content().string(containsString("id_token")));
   }

   @Test
   public void unsuccessfulAuthenticationWithDisabled() throws Exception {
      getMockMvc().perform(post("/api/authenticate")
         .contentType(MediaType.APPLICATION_JSON)
         .content("{\"password\": \"password\", \"username\": \"disabled\"}"))
         .andExpect(status().isUnauthorized())
         .andExpect(content().string(not(containsString("id_token"))));
   }

   @Test
   public void unsuccessfulAuthenticationWithWrongPassword() throws Exception {
      getMockMvc().perform(post("/api/authenticate")
         .contentType(MediaType.APPLICATION_JSON)
         .content("{\"password\": \"wrong\", \"username\": \"user\"}"))
         .andExpect(status().isUnauthorized())
         .andExpect(content().string(not(containsString("id_token"))));
   }

   @Test
   public void unsuccessfulAuthenticationWithNotExistingUser() throws Exception {
      getMockMvc().perform(post("/api/authenticate")
         .contentType(MediaType.APPLICATION_JSON)
         .content("{\"password\": \"password\", \"username\": \"not_existing\"}"))
         .andExpect(status().isUnauthorized())
         .andExpect(content().string(not(containsString("id_token"))));
   }

}


text:
import Ember from 'ember'
const { computed, get, set } = Ember

export default Ember.Component.extend({
  tagName: 'fieldset',
  classNames: ['check-boxes', 'group-element-wrap'],
  selected: computed.filterBy('options', 'checked', true),
  didReceiveAttrs () {
    this._super(...arguments)
    set(this, 'clonedOptions', JSON.parse(JSON.stringify(get(this, 'options'))))
  },
  actions: {
    onUpdate (option, isChecked) {
      set(option, 'checked', isChecked)
      get(this, 'update')(get(this, 'clonedOptions'), option, isChecked)
    }
  }
})


text:
package org.elasticsearch.gateway.none;

import com.google.common.collect.ImmutableSet;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.block.ClusterBlock;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
import org.junit.Test;

import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;

/**
 *
 */
@ClusterScope(scope = Scope.TEST, numNodes = 0)
public class RecoverAfterNodesTests extends ElasticsearchIntegrationTest {

    private final static TimeValue BLOCK_WAIT_TIMEOUT = TimeValue.timeValueSeconds(1);

    public ImmutableSet<ClusterBlock> waitForNoBlocksOnNode(TimeValue timeout, Client nodeClient) throws InterruptedException {
        long start = System.currentTimeMillis();
        ImmutableSet<ClusterBlock> blocks;
        do {
            blocks = nodeClient.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                    .getState().blocks().global(ClusterBlockLevel.METADATA);
        }
        while (!blocks.isEmpty() && (System.currentTimeMillis() - start) < timeout.millis());
        return blocks;
    }

    public Client startNode(Settings.Builder settings) {
        String name = cluster().startNode(settings);
        return cluster().clientNodeClient(name);
    }

    @Test
    public void testRecoverAfterNodes() throws Exception {
        logger.info("--> start node (1)");
        Client clientNode1 = startNode(settingsBuilder().put("gateway.recover_after_nodes", 3));
        assertThat(clientNode1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start node (2)");
        Client clientNode2 = startNode(settingsBuilder().put("gateway.recover_after_nodes", 3));
        Thread.sleep(BLOCK_WAIT_TIMEOUT.millis());
        assertThat(clientNode1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
        assertThat(clientNode2.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start node (3)");
        Client clientNode3 = startNode(settingsBuilder().put("gateway.recover_after_nodes", 3));

        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clientNode1).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clientNode2).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clientNode3).isEmpty(), equalTo(true));
    }

    @Test
    public void testRecoverAfterMasterNodes() throws Exception {
        logger.info("--> start master_node (1)");
        Client master1 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put("node.data", false).put("node.master", true));
        assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start data_node (1)");
        Client data1 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put("node.data", true).put("node.master", false));
        assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
        assertThat(data1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start data_node (2)");
        Client data2 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put("node.data", true).put("node.master", false));
        assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
        assertThat(data1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
        assertThat(data2.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start master_node (2)");
        Client master2 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put("node.data", false).put("node.master", true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master1).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master2).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data1).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data2).isEmpty(), equalTo(true));
    }

    @Test
    public void testRecoverAfterDataNodes() throws Exception {
        logger.info("--> start master_node (1)");
        Client master1 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put("node.data", false).put("node.master", true));
        assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start data_node (1)");
        Client data1 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put("node.data", true).put("node.master", false));
        assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
        assertThat(data1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start master_node (2)");
        Client master2 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put("node.data", false).put("node.master", true));
        assertThat(master2.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
        assertThat(data1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
        assertThat(master2.admin().cluster().prepareState().setLocal(true).execute().actionGet()
                .getState().blocks().global(ClusterBlockLevel.METADATA),
                hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

        logger.info("--> start data_node (2)");
        Client data2 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put("node.data", true).put("node.master", false));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master1).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master2).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data1).isEmpty(), equalTo(true));
        assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data2).isEmpty(), equalTo(true));
    }
}


text:
package com.twitter.util.validation.metadata

import java.lang.annotation.Annotation
import org.json4s.reflect.ScalaType

case class PropertyDescriptor private[validation] (
  scalaType: ScalaType,
  cascadedScalaType: Option[ScalaType],
  annotations: Array[Annotation],
  isCascaded: Boolean = false)
    extends Descriptor


text:
require 'test/unit'
require  './Models/database.rb'

class DatabaseTest < Test::Unit::TestCase
  def test_initialize
    db = SnapshotComparer::Models::PostgresDatabase.new(File.expand_path("config/test_config.yaml", Dir.pwd))
  end
=begin
	def test_initialize
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
	end

	def test_initialize_with_diff_name
		database = Models::Database.new "new_db"
		assert_not_nil(database, "Database construction failed")
	end

	def test_upgrade
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
		database.upgrade(1)
		assert_equal(true,database.db.results_as_hash)
	end

	def test_upgrade_version_not_specified
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
		database.upgrade
		assert_equal(true,database.db.results_as_hash)
	end

	def test_upgrade_new_database
		database = Models::Database.new "new_db"
		assert_not_nil(database, "Database construction failed")
		database.upgrade
		assert_equal(true,database.db.results_as_hash)
	end

	def test_load_apps
		app_list = {
			:app1 => Models::Application.new(:app1,'app1','desc1'),
			:app2 => Models::Application.new(:app2,'app2','desc2'),
			:app3 => Models::Application.new(:app3,'app3','desc3'),
			:app4 => Models::Application.new(:app4,'app4','desc4')
		}
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
		database.upgrade
		database.load_apps app_list
	end

	def test_load_apps_empty_app_list
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
		database.upgrade
		database.load_apps []
	end

	def test_load_apps_no_app_list
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
		database.upgrade
		database.load_apps
	end

	def test_retrieve_apps
		app_list = {
			:app1 => Models::Application.new(:app1,'app1','desc1'),
			:app2 => Models::Application.new(:app2,'app2','desc2'),
			:app3 => Models::Application.new(:app3,'app3','desc3'),
			:app4 => Models::Application.new(:app4,'app4','desc4')
		}
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
		database.upgrade
		database.load_apps app_list
		apps = database.retrieve_apps
		assert_equal(4, apps.keys.length)
		assert_equal([:app1,:app2,:app3,:app4], apps.keys)
		apps.each do |key,value|
			assert_equal(key, value.name.to_sym)
			assert_not_nil(value.id)
		end
	end

	def test_retrieve_apps_no_apps
		database = Models::Database.new
		assert_not_nil(database, "Database construction failed")
		database.upgrade
		apps = database.retrieve_apps
		assert_equal({}, apps)
	end
=end
end


text:
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
        <title>Prinz von Toten</title>
        <meta name="viewport" content="width=device-width, initial scale=1.0">
        <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
        <link rel="stylesheet" href="css/custom.css" type="text/css" />
    </head>
    <body>
        <div class="container">
            Prinz von Toten

        </div>
        <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
    </body>
</html>


text:
var mongoose = require('mongoose'),
    Schema = mongoose.Schema;

var BlockSchema = new Schema({
    type: { type: String, required: true },
    name: { type: String },
    source: { type: String },
    content: mongoose.Schema.Types.Mixed,
    tags: { type: [String] },
    date: { type: Date, default: Date.now }
});

BlockSchema.methods.store = function(item, callback) {

    if(!callback) callback = function(){};

    var Block = this.model('Block');
    var entry = new Block(item).save(function(err, entry) {
        callback(err, entry);
    });
}

BlockSchema.statics.retrieve = function(parameters, callback) {

    if(!callback) callback = function(){};

    this.find(parameters, function(err, results) {
        callback(err, results);
    });
}

BlockSchema.statics.lastWas = function(type, source, callback) {

    if(!callback) callback = function(){};

    this.findOne({ type: type, source: source })
        .sort({date : -1}).exec(function(err, result) {
        if(err || !result) {
            callback(err, null);
        } else {
            callback(err, result.date);
        }
    });
}

module.exports = mongoose.model('Block', BlockSchema);


text:
namespace IsPrime
{
    using System;

    public class Startup
    {
        public static void Main(string[] args)
        {
            Console.Write("Enter a positive integer number: ");

            var number = uint.Parse(Console.ReadLine());
            var divisor = 2u;
            var maxDivisor = (uint)Math.Sqrt(number);
            var isPrime = true;

            while (isPrime && (divisor <= maxDivisor))
            {
                if (number % divisor == 0)
                {
                    isPrime = false;
                }

                divisor++;
            }

            Console.WriteLine($"Prime? {isPrime}");
        }
    }
}


text:
/**************************************************************************/
/*!
    @file     cli_tbl.h
    @author   K. Townsend (microBuilder.eu)

    @brief    Command lookup table for the CLI
    @ingroup  CLI

    @section LICENSE

    Software License Agreement (BSD License)

    Copyright (c) 2013, K. Townsend
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:
    1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
    3. Neither the name of the copyright holders nor the
    names of its contributors may be used to endorse or promote products
    derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''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 HOLDER 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.
*/
/**************************************************************************/

#ifndef __CLI_TBL_H__
#define __CLI_TBL_H__

#ifdef __cplusplus
extern "C" {
#endif

#define CMD_COUNT (sizeof(cli_tbl)/sizeof(cli_t))

#include <stdio.h>

#ifdef CFG_INTERFACE_UART
#include "core/uart/uart.h"
#endif

/* Function prototypes for the command table */
void cmd_help(uint8_t argc, char **argv);         /* handled by cli/cli.c */
void cmd_sysinfo(uint8_t argc, char **argv);
void cmd_dbg_memrd(uint8_t argc, char **argv);
void cmd_eeprom_read(uint8_t argc, char **argv);
void cmd_eeprom_write(uint8_t argc, char **argv);

#ifdef CFG_ENABLE_I2C
void cmd_i2c_scan(uint8_t argc, char **argv);
void cmd_i2c_write(uint8_t argc, char **argv);
void cmd_i2c_read(uint8_t argc, char **argv);
#endif

#ifdef CFG_PN532
void cmd_nfc_mifareclassic_memdump(uint8_t argc, char **argv);
void cmd_nfc_mifareultralight_memdump(uint8_t argc, char **argv);
void cmd_nfc_mifareclassic_valueblock_create(uint8_t argc, char **argv);
void cmd_nfc_mifareclassic_valueblock_increment(uint8_t argc, char **argv);
void cmd_nfc_mifareclassic_valueblock_decrement(uint8_t argc, char **argv);
void cmd_nfc_mifareclassic_valueblock_read(uint8_t argc, char **argv);
void cmd_nfc_mfc_ndef_memdump(uint8_t argc, char **argv);
void cmd_nfc_mfc_ndef_blankFormat(uint8_t argc, char **argv);
void cmd_nfc_mfc_ndef_nfcFormat(uint8_t argc, char **argv);
void cmd_nfc_mfc_ndef_write_ndef(uint8_t argc, char **argv);
void cmd_nfc_mfc_ndef_prepare_ndefMessage(uint8_t argc, char **argv);
#endif

#ifdef CFG_SDCARD
void cmd_sd_dir(uint8_t argc, char **argv);
#endif

#ifdef CFG_CHIBI
void cmd_chibi_addr(uint8_t argc, char **argv);
void cmd_chibi_ieeeaddr(uint8_t argc, char **argv);
void cmd_chibi_tx(uint8_t argc, char **argv);
#endif

#ifdef CFG_RTC
void cmd_rtc_read(uint8_t argc, char **argv);
void cmd_rtc_write(uint8_t argc, char **argv);
#endif

#ifdef CFG_CC3000
void cmd_wifi_moduleinfo(uint8_t argc, char **argv);
void cmd_wifi_smartConfig(uint8_t argc, char **argv);
void cmd_wifi_ssidscan(uint8_t argc, char **argv);
void cmd_wifi_connect(uint8_t argc, char **argv);
void cmd_wifi_disconnect(uint8_t argc, char **argv);
void cmd_wifi_ping(uint8_t argc, char **argv);
void cmd_wifi_gethostnameip(uint8_t argc, char **argv);
#endif

#define CMD_NOPARAMS ( "This command has no parameters" )

/**************************************************************************/
/*!
    Command list for the command-line interpreter and the name of the
    corresponding method that handles the command.

    Note that a trailing ',' is required on the last entry, which will
    cause a NULL entry to be appended to the end of the table.
*/
/**************************************************************************/
cli_t cli_tbl[] =
{
  // command name, min args, max args, hidden, function name, command description, syntax
  { "?",            0,  0,  0, cmd_help                                   , "Help"                              , CMD_NOPARAMS },
  { "V",            0,  0,  0, cmd_sysinfo                                , "System Info"                       , CMD_NOPARAMS },
  { "mr",           1,  3,  0, cmd_dbg_memrd                              , "Memory read"                       , "'mr <addr> [<len> <size(1..8)>]'" },
  { "er",           1,  1,  0, cmd_eeprom_read                            , "EEPROM read"                       , "'er <addr>'" },
  { "ew",           2,  2,  0, cmd_eeprom_write                           , "EEPROM write"                      , "'ew <addr> <val>'" },
  #ifdef CFG_ENABLE_I2C
  { "is",           0,  0,  0, cmd_i2c_scan                               , "I2C bus scan"                      , CMD_NOPARAMS },
  { "ir",           2,  2,  0, cmd_i2c_read                               , "I2C read"                          , "'ir <addr> <len>'" },
  { "iw",           2,  99, 0, cmd_i2c_write                              , "I2C write"                         , "'iw <addr> <value(s)>'" },
  #endif
  #ifdef CFG_PN532
  { "du",           0,  1,  0, cmd_nfc_mifareultralight_memdump           , "Dump Mifare Ultralight card"       , "'du [<timeout>]'" },
  { "dc",           0,  1,  0, cmd_nfc_mifareclassic_memdump              , "Dump Mifare Classic card"          , "'dc [<timeout>]'" },
  { "dn",           0,  0,  0, cmd_nfc_mfc_ndef_memdump                   , "Dump Mifare Classic NFC messages"  , CMD_NOPARAMS },
  { "fn",           0,  0,  0, cmd_nfc_mfc_ndef_nfcFormat                 , "Format Mifare Classic as NFC Tag"  , CMD_NOPARAMS },
  { "fb",           0,  0,  0, cmd_nfc_mfc_ndef_blankFormat               , "Format NFC Tag as Mifare Classic"  , CMD_NOPARAMS },
  { "npn",          0,  0,  0, cmd_nfc_mfc_ndef_prepare_ndefMessage       , "Create NDEF msg in mem for 'nw'"   , CMD_NOPARAMS },
  { "nw",           0,  0,  0, cmd_nfc_mfc_ndef_write_ndef                , "Write msg from 'npn' to MFC card"  , "'nw [<sector>]'"},
  { "vc",           2,  2,  0, cmd_nfc_mifareclassic_valueblock_create    , "Create Mifare value block"         , "'vc <block> <value>'" },
  { "vi",           2,  2,  0, cmd_nfc_mifareclassic_valueblock_increment , "Increment Mifare value block"      , "'vi <block> <value>'" },
  { "vd",           2,  2,  0, cmd_nfc_mifareclassic_valueblock_decrement , "Decrement Mifare value block"      , "'vd <block> <value>'" },
  { "vr",           1,  1,  0, cmd_nfc_mifareclassic_valueblock_read      , "Read Mifare value block"           , "'vr <block> <value>'" },
  #endif
  #ifdef CFG_SDCARD
  { "d",            0,  1,  0, cmd_sd_dir                                 , "Dir (SD Card)"                     , "'d [<path>]'" },
  #endif
  #ifdef CFG_CHIBI
  { "ca",           0,  1,  0, cmd_chibi_addr                             , "Get/set node address"              , "'ca [<1-65534>|<OxFFFE>]'" },
  { "cs",           2, 99,  0, cmd_chibi_tx                               , "Send msg to node"                  , "'cs <destaddr> <msg>'" },
  #endif
  #ifdef CFG_RTC
  { "tr",           0, 0,  0, cmd_rtc_read                                , "RTC read"                           , CMD_NOPARAMS },
  { "tw",           6, 7,  0, cmd_rtc_write                               , "RTC write"                          , "'tw <yr> <mon> <day> <hr> <min> <sec>'" },
  #endif
  #ifdef CFG_CC3000
  { "wi",           0, 0,  0, cmd_wifi_moduleinfo                         , "Wifi module info"                   , CMD_NOPARAMS },
  { "wsc",          0, 1,  0, cmd_wifi_smartConfig                        , "Wifi SmartConnect"                  , "'wsc [<usekey(0|1)>]'" },
  { "ws",           0, 0,  0, cmd_wifi_ssidscan                           , "Wifi SSID scan"                     , CMD_NOPARAMS },
  { "wc",           2, 3,  0, cmd_wifi_connect                            , "Wifi connect"                       , "'wc <sec[0|1|2|3]> <ssid> <key>'" },
  { "wd",           0, 0,  0, cmd_wifi_disconnect                         , "Wifi disconnect"                    , CMD_NOPARAMS },
  { "wp",           1, 1,  0, cmd_wifi_ping                               , "Wifi ping"                          , "'wp <ipaddress>'" },
  { "wl",           1, 1,  0, cmd_wifi_gethostnameip                      , "Wifi host name lookup"              , "'wl <hostname>'" },
  #endif
};

#ifdef __cplusplus
}
#endif

#endif


text:
<!DOCTYPE html>

  <title>
  The background color of #backgournd_color_container div MUST be drawn below all children.
  However, the background color is drawn over the child #issue div.
  It's a minimal case of https://www.google.com/maps/views/explore?gl=us
  See crbug.com/345613
  </title>