text:
/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)")
@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class RuntimeStat implements org.apache.thrift.TBase<RuntimeStat, RuntimeStat._Fields>, java.io.Serializable, Cloneable, Comparable<RuntimeStat> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RuntimeStat");

  private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField WEIGHT_FIELD_DESC = new org.apache.thrift.protocol.TField("weight", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField PAYLOAD_FIELD_DESC = new org.apache.thrift.protocol.TField("payload", org.apache.thrift.protocol.TType.STRING, (short)3);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new RuntimeStatStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new RuntimeStatTupleSchemeFactory();

  private int createTime; // optional
  private int weight; // required
  private @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer payload; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    CREATE_TIME((short)1, "createTime"),
    WEIGHT((short)2, "weight"),
    PAYLOAD((short)3, "payload");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // CREATE_TIME
          return CREATE_TIME;
        case 2: // WEIGHT
          return WEIGHT;
        case 3: // PAYLOAD
          return PAYLOAD;
        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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __CREATETIME_ISSET_ID = 0;
  private static final int __WEIGHT_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.CREATE_TIME};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.WEIGHT, new org.apache.thrift.meta_data.FieldMetaData("weight", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.PAYLOAD, new org.apache.thrift.meta_data.FieldMetaData("payload", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RuntimeStat.class, metaDataMap);
  }

  public RuntimeStat() {
  }

  public RuntimeStat(
    int weight,
    java.nio.ByteBuffer payload)
  {
    this();
    this.weight = weight;
    setWeightIsSet(true);
    this.payload = org.apache.thrift.TBaseHelper.copyBinary(payload);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public RuntimeStat(RuntimeStat other) {
    __isset_bitfield = other.__isset_bitfield;
    this.createTime = other.createTime;
    this.weight = other.weight;
    if (other.isSetPayload()) {
      this.payload = org.apache.thrift.TBaseHelper.copyBinary(other.payload);
    }
  }

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

  @Override
  public void clear() {
    setCreateTimeIsSet(false);
    this.createTime = 0;
    setWeightIsSet(false);
    this.weight = 0;
    this.payload = null;
  }

  public int getCreateTime() {
    return this.createTime;
  }

  public void setCreateTime(int createTime) {
    this.createTime = createTime;
    setCreateTimeIsSet(true);
  }

  public void unsetCreateTime() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID);
  }

  /** Returns true if field createTime is set (has been assigned a value) and false otherwise */
  public boolean isSetCreateTime() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID);
  }

  public void setCreateTimeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value);
  }

  public int getWeight() {
    return this.weight;
  }

  public void setWeight(int weight) {
    this.weight = weight;
    setWeightIsSet(true);
  }

  public void unsetWeight() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __WEIGHT_ISSET_ID);
  }

  /** Returns true if field weight is set (has been assigned a value) and false otherwise */
  public boolean isSetWeight() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __WEIGHT_ISSET_ID);
  }

  public void setWeightIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __WEIGHT_ISSET_ID, value);
  }

  public byte[] getPayload() {
    setPayload(org.apache.thrift.TBaseHelper.rightSize(payload));
    return payload == null ? null : payload.array();
  }

  public java.nio.ByteBuffer bufferForPayload() {
    return org.apache.thrift.TBaseHelper.copyBinary(payload);
  }

  public void setPayload(byte[] payload) {
    this.payload = payload == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(payload.clone());
  }

  public void setPayload(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer payload) {
    this.payload = org.apache.thrift.TBaseHelper.copyBinary(payload);
  }

  public void unsetPayload() {
    this.payload = null;
  }

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

  public void setPayloadIsSet(boolean value) {
    if (!value) {
      this.payload = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case CREATE_TIME:
      if (value == null) {
        unsetCreateTime();
      } else {
        setCreateTime((java.lang.Integer)value);
      }
      break;

    case WEIGHT:
      if (value == null) {
        unsetWeight();
      } else {
        setWeight((java.lang.Integer)value);
      }
      break;

    case PAYLOAD:
      if (value == null) {
        unsetPayload();
      } else {
        if (value instanceof byte[]) {
          setPayload((byte[])value);
        } else {
          setPayload((java.nio.ByteBuffer)value);
        }
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case CREATE_TIME:
      return getCreateTime();

    case WEIGHT:
      return getWeight();

    case PAYLOAD:
      return getPayload();

    }
    throw new java.lang.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 java.lang.IllegalArgumentException();
    }

    switch (field) {
    case CREATE_TIME:
      return isSetCreateTime();
    case WEIGHT:
      return isSetWeight();
    case PAYLOAD:
      return isSetPayload();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof RuntimeStat)
      return this.equals((RuntimeStat)that);
    return false;
  }

  public boolean equals(RuntimeStat that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_createTime = true && this.isSetCreateTime();
    boolean that_present_createTime = true && that.isSetCreateTime();
    if (this_present_createTime || that_present_createTime) {
      if (!(this_present_createTime && that_present_createTime))
        return false;
      if (this.createTime != that.createTime)
        return false;
    }

    boolean this_present_weight = true;
    boolean that_present_weight = true;
    if (this_present_weight || that_present_weight) {
      if (!(this_present_weight && that_present_weight))
        return false;
      if (this.weight != that.weight)
        return false;
    }

    boolean this_present_payload = true && this.isSetPayload();
    boolean that_present_payload = true && that.isSetPayload();
    if (this_present_payload || that_present_payload) {
      if (!(this_present_payload && that_present_payload))
        return false;
      if (!this.payload.equals(that.payload))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetCreateTime()) ? 131071 : 524287);
    if (isSetCreateTime())
      hashCode = hashCode * 8191 + createTime;

    hashCode = hashCode * 8191 + weight;

    hashCode = hashCode * 8191 + ((isSetPayload()) ? 131071 : 524287);
    if (isSetPayload())
      hashCode = hashCode * 8191 + payload.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetCreateTime(), other.isSetCreateTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreateTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, other.createTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetWeight(), other.isSetWeight());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWeight()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.weight, other.weight);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPayload(), other.isSetPayload());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPayload()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payload, other.payload);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("RuntimeStat(");
    boolean first = true;

    if (isSetCreateTime()) {
      sb.append("createTime:");
      sb.append(this.createTime);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("weight:");
    sb.append(this.weight);
    first = false;
    if (!first) sb.append(", ");
    sb.append("payload:");
    if (this.payload == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.payload, sb);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!isSetWeight()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'weight' is unset! Struct:" + toString());
    }

    if (!isSetPayload()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'payload' is unset! Struct:" + toString());
    }

    // check for sub-struct validity
  }

  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, java.lang.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 RuntimeStatStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public RuntimeStatStandardScheme getScheme() {
      return new RuntimeStatStandardScheme();
    }
  }

  private static class RuntimeStatStandardScheme extends org.apache.thrift.scheme.StandardScheme<RuntimeStat> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, RuntimeStat 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: // CREATE_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.createTime = iprot.readI32();
              struct.setCreateTimeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // WEIGHT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.weight = iprot.readI32();
              struct.setWeightIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // PAYLOAD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.payload = iprot.readBinary();
              struct.setPayloadIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetCreateTime()) {
        oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
        oprot.writeI32(struct.createTime);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(WEIGHT_FIELD_DESC);
      oprot.writeI32(struct.weight);
      oprot.writeFieldEnd();
      if (struct.payload != null) {
        oprot.writeFieldBegin(PAYLOAD_FIELD_DESC);
        oprot.writeBinary(struct.payload);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class RuntimeStatTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public RuntimeStatTupleScheme getScheme() {
      return new RuntimeStatTupleScheme();
    }
  }

  private static class RuntimeStatTupleScheme extends org.apache.thrift.scheme.TupleScheme<RuntimeStat> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, RuntimeStat struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.weight);
      oprot.writeBinary(struct.payload);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetCreateTime()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetCreateTime()) {
        oprot.writeI32(struct.createTime);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, RuntimeStat struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.weight = iprot.readI32();
      struct.setWeightIsSet(true);
      struct.payload = iprot.readBinary();
      struct.setPayloadIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        struct.createTime = iprot.readI32();
        struct.setCreateTimeIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

redpajama_set_name: RedPajamaGithub


text:
import base64

from rest_framework import serializers

from ..models import Project, Snapshot, Value

class ValueSerializer(serializers.ModelSerializer):

    attribute = serializers.CharField(source='attribute.uri', default=None, read_only=True)
    option = serializers.CharField(source='option.uri', default=None, read_only=True)
    file_content = serializers.SerializerMethodField()

    class Meta:
        model = Value
        fields = (
            'attribute',
            'set_index',
            'collection_index',
            'text',
            'option',
            'file_name',
            'file_content',
            'value_type',
            'unit',
            'external_id',
            'created',
            'updated'
        )

    def get_file_content(self, obj):
        if obj.file:
            return base64.b64encode(obj.file.read())

class SnapshotSerializer(serializers.ModelSerializer):

    values = serializers.SerializerMethodField()

    class Meta:
        model = Snapshot
        fields = (
            'title',
            'description',
            'values',
            'created',
            'updated'
        )

    def get_values(self, obj):
        values = Value.objects.filter(snapshot=obj)
        serializer = ValueSerializer(instance=values, many=True)
        return serializer.data

class ProjectSerializer(serializers.ModelSerializer):

    snapshots = SnapshotSerializer(many=True)
    values = serializers.SerializerMethodField()

    catalog = serializers.CharField(source='catalog.uri', default=None, read_only=True)
    tasks = serializers.SerializerMethodField()
    views = serializers.SerializerMethodField()

    class Meta:
        model = Project
        fields = (
            'title',
            'description',
            'catalog',
            'tasks',
            'views',
            'snapshots',
            'values',
            'created',
            'updated'
        )

    def get_values(self, obj):
        values = Value.objects.filter(project=obj, snapshot=None)
        serializer = ValueSerializer(instance=values, many=True)
        return serializer.data

    def get_tasks(self, obj):
        return [task.uri for task in obj.tasks.all()]

    def get_views(self, obj):
        return [view.uri for view in obj.views.all()]


text:
package scutil.regex

object implicits {
	export extensions.*
	export literals.*
}


text:
class RenameMealsHostCommunityIdToCommunityId < ActiveRecord::Migration[4.2]
  def change
    rename_column :meals, :host_community_id, :community_id
  end
end


text:
<?php

namespace JakubZapletal\Payment\WebpayBundle\Exception;

use Symfony\Component\PropertyAccess\Exception\RuntimeException;

/**
 * Thrown when required property is not set.
 */
class RequiredPropertyException extends RuntimeException
{
}


text:
module.exports = {
  Headers: require('./Headers'),
  Message: require('./Message'),
  Mail: require('./Mail'),
  RequestLine: require('./RequestLine'),
  HttpRequest: require('./HttpRequest'),
  StatusLine: require('./StatusLine'),
  HttpResponse: require('./HttpResponse'),
  HttpExchange: require('./HttpExchange'),
  HttpConversation: require('./HttpConversation'),
  formatHeaderName: require('./formatHeaderName'),
  foldHeaderLine: require('./foldHeaderLine'),
  headerNameSpecialCases: require('./headerNameSpecialCases'),
};


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

    var module = angular.module('ngResourceBundle');

    function controller($translate, $dynamicLocale) {
        var model = this;

        var NO_ERROR_CODE = 0;

        model.$onInit = function() {
            model.date = new Date();

            //TODO: Research a better way to expose these constants to templates
            model.TEXT_TOKEN = TEXT_TOKEN;
            model.LANGUAGE_CODE = LANGUAGE_CODE;

            //Current browser langauge cannot be read by JavaScript reliably
            //However, http header would have Accept-Language attributes which can be helped with the help of server or Flash.
            model.currentLanguage = LANGUAGE_CODE.ENGLISH;

            model.availableLanguages = [LANGUAGE_CODE.ENGLISH, LANGUAGE_CODE.CHINESE];

            model.setLocale(model.currentLanguage);

            model.loginStatusLookup = {
                DEFAULT: 0,
                SUCCESS: 1,
                ERROR: -1
            };

            model.loginStatus = model.loginStatusLookup.DEFAULT;
            model.loginErrorCode = NO_ERROR_CODE;
        };

        model.setLocale = function(languageCode) {
            $translate.use(languageCode);
            $dynamicLocale.set(languageCode);
        };

        model.loginSuccess_click = function() {
            model.loginStatus = model.loginStatusLookup.SUCCESS;
            model.loginErrorCode = NO_ERROR_CODE;
        };

        model.loginError_click = function() {
            model.loginStatus = model.loginStatusLookup.ERROR;
            model.loginErrorCode = 101;
        };

        model.language_change = function(language) {
            model.currentLanguage = language;
            model.setLocale(language);
        };
    }

    module.component('superGreeting', {
        templateUrl: 'templates/super-greeting.html',
        controllerAs: 'model',
        controller: ['$translate', 'tmhDynamicLocale', controller]
    });

}());


text:
var path = require('path');
var url = require('url');
var async = require('async');
var _ = require('underscore');
var Smasher = require('./asset-smasher').Smasher;
var send = require('send');

function Middleware(options) {
  this.assetMapLocation = options.assetMapLocation;
  this.prefix = options.prefix;
  var serve = options.serve;
  if (serve) {
    if (typeof(serve) !== 'object') {
      serve = {};
    }
    this.serve = _.defaults(serve, {
      individual: true
    });
  }
  this.debug = options.debug;
  if (this.serve) {
    this.compileQueue = async.queue(this.loadOrCompileAsset.bind(this), 1);
    this.smasher = new Smasher(options);
    this.findAssets();
  }
  this.loadAssetMap();
}
Middleware.prototype = {
  execute:function (req, res, next) {
    this.registerHelpers(res);
    if (!this.serve) {
      next();
    } else {
      var reqUrl = url.parse(req.url).pathname;
      if (reqUrl.indexOf(this.prefix) === 0) {
        var logicalPath = reqUrl.substr(this.prefix.length + 1);
        var asset = this.smasher.getAssetByLogicalPath(logicalPath);
        if (asset) {
          if (asset.compiled) {
            this.serveAsset(req, res, next, asset);
          } else {
            // Assets must be compiled non-concurrently
            this.compileQueue.push({
              req:req,
              res:res,
              asset:asset,
              next:next
            }, function (e) {
              // If there's an error, we need to continue the request
              if (e) {
                next(e);
              }
              // Otherwise the asset will be processed and next() will
              // have already been called.
            });
          }
        } else {
          next();
        }
      } else {
        next();
      }
    }
  },
  loadOrCompileAsset:function(task, done) {
    var self = this;
    // Asset might have been compiled while we were waiting
    if (task.asset.compiled) {
      this.serveAsset(task.req, task.res, task.next, task.asset);
      done();
    } else {
      this.smasher.compileSingleAsset(task.asset.assetFilePath, function (e) {
        if (e) {
          done(e);
        } else {
          self.serveAsset(task.req, task.res, task.next, task.asset);
          done();
        }
      });
    }
  },
  serveAsset:function (req, res, next, asset) {
    function error(err) {
      if (err.status === 404) {
        next();
      } else {
        next(err);
      }
    }
    send(req, asset.compiledAssetFilePath)
      .on('error', error)
      .pipe(res);
  },
  loadAssetMap:function () {
    try {
      if (this.assetMapLocation) {
        this.assetMap = require(this.assetMapLocation);
      } else {
        this.assetMap = {};
      }
    } catch (e) {
      this.assetMap = {};
    }
  },
  findAssets:function () {
    var self = this;
    var st = Date.now();
    this.smasher.findAssets(function (e) {
      if (e) {
        console.error('Error finding assets', e);
      } else if (self.debug) {
        console.log('Assets discovered in ' + (Date.now() - st) + ' ms.');
      }
    });
  },
  registerHelpers:function (res) {
    var self = this;
    res.locals({
      /**
       * Create a script tag (or bunch of script tags for a manifest when serve.individual is true)
       * for a JavaScript asset
       */
      js_asset:function (logicalPath) {
        var assets = self.getAssetsForLogicalPath(logicalPath);
        return assets.map(function (asset) {
          return '<script src="' + self.prefix + '/' + asset + '"></script>';
        }).join('\n');
      },
      /**
       * Create a link tag (or bunch of link tags for a manifest when serve.individual is true)
       * for a CSS asset
       */
      css_asset:function (logicalPath) {
        var assets = self.getAssetsForLogicalPath(logicalPath);
        return assets.map(function (asset) {
          return '<link rel="stylesheet" href="' + self.prefix + '/' + asset + '">';
        }).join('\n');
      },
      /**
       * Return the raw URL for an asset.
       */
      raw_asset:function (logicalPath) {
        return self.prefix + '/' + (self.assetMap[logicalPath] || logicalPath);
      }
    });
  },
  /**
   * Get the assets required for the specified logical path.  This will separate any
   * manifests into their individual files (if not running with an asset map, and
   * serve.individual is true)
   */
  getAssetsForLogicalPath:function (logicalPath) {
    if (this.assetMap[logicalPath]) {
      return [this.assetMap[logicalPath]];
    } else {
      if (this.serve && this.serve.individual) {
        var asset = this.smasher.getAssetByLogicalPath(logicalPath);
        if (asset) {
          return this.smasher.getRequiredLogicalPathsFor(asset);
        } else {
          return [logicalPath];
        }
      } else {
        return [logicalPath];
      }
    }
  }
};

module.exports = function (options) {
  var middleware = new Middleware(options);
  return middleware.execute.bind(middleware);
};


text:
/*
---
description: Code parsing engine for Lighter.

license: MIT-style

authors:
  - Jose Prado

requires:
  - Core/1.3
  - Fuel
  - Wick

provides: [Parser]
...
*/

(function(){

var Parser = this.Parser = new Class({

    Implements: [Options],

    options: {
        strict: false
    },

    /**
     * @constructs
     */
    initialize: function(options)
    {
        this.setOptions(options);
    },

    /**
     * Parses source code using fuel regex rules and returns the array of
     * tokens.
     *
     * @param {Fuel} fuel       The Fuel to use for parsing.
     * @param {String} code     The source code to parse.
     * @param {Number} [offset] Optional offset to add to the found index.
     */
    parse: function(fuel, code, offset)
    {
        var wicks = [],
            text  = null,
            wick  = null;

//        if (this.options.strict && fuel.hasDelimiters()) {
//            var match    = null,
//                endMatch = null,
//                codeBeg  = 0,
//                codeEnd  = code.length,
//                codeSeg  = '';
//
//            while ((match = fuel.delimiters.start.exec(code)) != null) {
//                fuel.delimiters.end.lastIndex = fuel.delimiters.start.lastIndex;
//                if ((endMatch = fuel.delimiters.end.exec(code)) != null) {
//                    wicks.push(new Wick(match[0], 'de1', match.index));
//                    codeBeg = fuel.delimiters.start.lastIndex;
//                    codeEnd = endMatch.index - 1;
//                    codeSeg = code.substring(codeBeg, codeEnd);
//                    wicks.append(this._parse(fuel, codeSeg, codeBeg));
//                    wicks.push(new Wick(endMatch[0], 'de2', endMatch.index));
//                }
//            }
//        } else {
//            wicks.append(this._parse(fuel, code, offset));
//        }

        wicks = this._parse(fuel, code, offset);

        // Add code between matches as an unknown wick to the wick array.
        for (var i = 0, pointer = 0; i < wicks.length; i++) {
            if (pointer < wicks[i].index) {
                text = code.substring(pointer, wicks[i].index);
                wick = new Wick(text, 'unknown', pointer);
                wicks.splice(i, 0, wick);
            }
            pointer = wicks[i].end;
        }

        // Add the final unmatched piece if it exists.
        if (pointer < code.length) {
            text = code.substring(pointer, code.length);
            wick = new Wick(text, 'unknown', pointer);
            wicks.push(wick);
        }

        return wicks;
    },

    /**
     * Parsing strategy method which child classes must override.
     */
    _parse: function(fuel, code, offset)
    {
        throw new Error('Extending classes must override the _parse method.');
    }
});

})();


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

package com.sun.org.apache.xerces.internal.impl.xs;

import com.sun.org.apache.xerces.internal.util.NamespaceSupport;

/**
 * This class customizes the behaviour of the util.NamespaceSupport
 * class in order to easily implement some features that we need for
 * efficient schema handling.  It will not be generally useful.
 *
 * @xerces.internal
 *
 * @author Neil Graham, IBM
 *
 */
public class SchemaNamespaceSupport
    extends NamespaceSupport {

    public SchemaNamespaceSupport () {
        super();
    } // constructor

    // more effecient than NamespaceSupport(NamespaceContext)
    public SchemaNamespaceSupport(SchemaNamespaceSupport nSupport) {
        fNamespaceSize = nSupport.fNamespaceSize;
        if (fNamespace.length < fNamespaceSize)
            fNamespace = new String[fNamespaceSize];
        System.arraycopy(nSupport.fNamespace, 0, fNamespace, 0, fNamespaceSize);
        fCurrentContext = nSupport.fCurrentContext;
        if (fContext.length <= fCurrentContext)
            fContext = new int[fCurrentContext+1];
        System.arraycopy(nSupport.fContext, 0, fContext, 0, fCurrentContext+1);
    } // end constructor

    /**
     * This method takes a set of Strings, as stored in a
     * NamespaceSupport object, and "fools" the object into thinking
     * that this is one unified context.  This is meant to be used in
     * conjunction with things like local elements, whose declarations
     * may be deeply nested but which for all practical purposes may
     * be regarded as being one level below the global <schema>
     * element--at least with regard to namespace declarations.
     * It's worth noting that the context from which the strings are
     * being imported had better be using the same SymbolTable.
     */
    public void setEffectiveContext (String [] namespaceDecls) {
        if(namespaceDecls == null || namespaceDecls.length == 0) return;
        pushContext();
        int newSize = fNamespaceSize + namespaceDecls.length;
        if (fNamespace.length < newSize) {
            // expand namespace's size...
            String[] tempNSArray = new String[newSize];
            System.arraycopy(fNamespace, 0, tempNSArray, 0, fNamespace.length);
            fNamespace = tempNSArray;
        }
        System.arraycopy(namespaceDecls, 0, fNamespace, fNamespaceSize,
                         namespaceDecls.length);
        fNamespaceSize = newSize;
    } // setEffectiveContext(String):void

    /**
     * This method returns an array of Strings, as would be stored in
     * a NamespaceSupport object.  This array contains all
     * declarations except those at the global level.
     */
    public String [] getEffectiveLocalContext() {
        // the trick here is to recognize that all local contexts
        // happen to start at fContext[3].
        // context 1: empty
        // context 2: decls for xml and xmlns;
        // context 3: decls on <xs:schema>: the global ones
        String[] returnVal = null;
        if (fCurrentContext >= 3) {
            int bottomLocalContext = fContext[3];
            int copyCount = fNamespaceSize - bottomLocalContext;
            if (copyCount > 0) {
                returnVal = new String[copyCount];
                System.arraycopy(fNamespace, bottomLocalContext, returnVal, 0,
                                 copyCount);
            }
        }
        return returnVal;
    } // getEffectiveLocalContext():String

    // This method removes from this object all the namespaces
    // returned by getEffectiveLocalContext.
    public void makeGlobal() {
        if (fCurrentContext >= 3) {
            fCurrentContext = 3;
            fNamespaceSize = fContext[3];
        }
    } // makeGlobal
} // class NamespaceSupport


text:
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>

<title>myaddr</title>
<meta name='robots' content='noindex,nofollow' />
<meta name='generator' content='GLOBAL-6.5.2' />
<meta http-equiv='Content-Style-Type' content='text/css' />
<link rel='stylesheet' type='text/css' href='../style.css' />

myaddr             63 ssrp.c         void SSRP_init(SSRP_Address myaddr)
myaddr             71 ssrp.c             my_addr_ = myaddr;


text:
@interface QN_uploadTakeVideoVC : BaseVC<UITextFieldDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>

@property (weak, nonatomic) IBOutlet UIButton *choseBtn;
@property (weak, nonatomic) IBOutlet UIButton *uploadBtn;
@property (weak, nonatomic) IBOutlet UILabel *showLabel;
@property (weak, nonatomic) IBOutlet UIImageView * uploadImage;
@property (weak, nonatomic) IBOutlet UIProgressView *prograssView;
@property (weak, nonatomic) IBOutlet UITextField *fillKey;

@end


text:
#pragma once
#include <aws/cognito-identity/CognitoIdentity_EXPORTS.h>
#include <aws/core/Region.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{

enum class Region;

namespace CognitoIdentity
{
namespace CognitoIdentityEndpoint
{
AWS_COGNITOIDENTITY_API Aws::String ForRegion(Region region);
} // namespace CognitoIdentityEndpoint
} // namespace CognitoIdentity
} // namespace Aws


text:
module TestProf
  # StackProf wrapper.
  #
  # Has 2 modes: global and per-example.
  #
  # Example:
  #
  #   # To activate global profiling you can use env variable
  #   TEST_STACK_PROF=1 rspec ...
  #
  #   # or in your code
  #   TestProf::StackProf.run
  #
  # To profile a specific examples add :sprof tag to it:
  #
  #   it "is doing heavy stuff", :sprof do
  #     ...
  #   end
  #
  module StackProf
    # StackProf configuration
    class Configuration
      FORMATS = %w[html json].freeze

      attr_accessor :mode, :interval, :raw, :target, :format

      def initialize
        @mode = ENV.fetch("TEST_STACK_PROF_MODE", :wall).to_sym
        @target = ENV["TEST_STACK_PROF"] == "boot" ? :boot : :suite
        @raw = ENV["TEST_STACK_PROF_RAW"] != "0"
        @format =
          if FORMATS.include?(ENV["TEST_STACK_PROF_FORMAT"])
            ENV["TEST_STACK_PROF_FORMAT"]
          else
            "html"
          end

        sample_interval = ENV["TEST_STACK_PROF_INTERVAL"].to_i
        @interval = sample_interval > 0 ? sample_interval : nil
      end

      def raw?
        @raw == true
      end

      def boot?
        target == :boot
      end

      def suite?
        target == :suite
      end
    end

    class << self
      include Logging

      def config
        @config ||= Configuration.new
      end

      def configure
        yield config
      end

      # Run StackProf and automatically dump
      # a report when the process exits or when the application is booted.
      def run
        return unless profile

        @locked = true

        log :info, "StackProf#{config.raw? ? " (raw)" : ""} enabled globally: " \
                   "mode – #{config.mode}, target – #{config.target}"

        at_exit { dump("total") } if config.suite?
      end

      def profile(name = nil)
        if locked?
          log :warn, <<~MSG
            StackProf is activated globally, you cannot generate per-example report.

            Make sure you haven's set the TEST_STACK_PROF environmental variable.
          MSG
          return false
        end

        return false unless init_stack_prof

        options = {
          mode: config.mode,
          raw: config.raw
        }

        options[:interval] = config.interval if config.interval

        if block_given?
          options[:out] = build_path(name)
          ::StackProf.run(**options) { yield }
        else
          ::StackProf.start(**options)
        end
        true
      end

      def dump(name)
        ::StackProf.stop

        path = build_path(name)

        ::StackProf.results(path)

        log :info, "StackProf report generated: #{path}"

        return unless config.raw

        send("dump_#{config.format}_report", path)
      end

      private

      def build_path(name)
        TestProf.artifact_path(
          "stack-prof-report-#{config.mode}#{config.raw ? "-raw" : ""}-#{name}.dump"
        )
      end

      def locked?
        @locked == true
      end

      def init_stack_prof
        return @initialized if instance_variable_defined?(:@initialized)
        @locked = false
        @initialized = TestProf.require(
          "stackprof",
          <<~MSG
            Please, install 'stackprof' first:
               # Gemfile
              gem 'stackprof', '>= 0.2.9', require: false
          MSG
        ) { check_stack_prof_version }
      end

      def check_stack_prof_version
        if Utils.verify_gem_version("stackprof", at_least: "0.2.9")
          true
        else
          log :error, <<~MSG
            Please, upgrade 'stackprof' to version >= 0.2.9.
          MSG
          false
        end
      end

      def dump_html_report(path)
        html_path = path.gsub(/\.dump$/, ".html")

        log :info, <<~MSG
          Run the following command to generate a flame graph report:

          stackprof --d3-flamegraph #{path} > #{html_path} && stackprof --flamegraph-viewer=#{html_path}
        MSG
      end

      def dump_json_report(path)
        report = ::StackProf::Report.new(
          Marshal.load(IO.binread(path)) # rubocop:disable Security/MarshalLoad
        )
        json_path = path.gsub(/\.dump$/, ".json")
        File.write(json_path, JSON.generate(report.data))

        log :info, <<~MSG
          StackProf JSON report generated: #{json_path}
        MSG
      end
    end
  end
end

require "test_prof/stack_prof/rspec" if TestProf.rspec?

# Hook to run StackProf globally
TestProf.activate("TEST_STACK_PROF") do
  TestProf::StackProf.run
end


text:
/**
 * You may like to use the {@link org.xmlbeam.util.IOHelper} class to add basic HTTP authentication.
 */
package org.xmlbeam.util;


text:
/**
 *
 * @creatTime 上午10:26:04
 * @author XuYi
 */
package org.eddy.datasource;

import java.lang.annotation.Annotation;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.eddy.annotation.SelectColum;
import org.eddy.annotation.Table;
import org.eddy.exception.HbaseException;
import org.eddy.filter.MineFilter;

/**
 * @author XuYi
 *
 */
public class ConnectionTemplate {

	private static HbaseDataSource dataSource = HbaseDataSource.getInstance();

	/**
	 *
	 * @param annotations
	 * @param param
	 * @param table
	 * @return
	 * @creatTime 下午4:19:53
	 * @author XuYi
	 */
	public Object selectOne(Map<Class<? extends Annotation>, Annotation> annotations, Map<String, Object> param, List<String> keys, Table table, List<MineFilter> filters) {
		String tableName = table.name();
		String pattern = table.keyPattern();
//		String key = RowKeyUtil.createRowkey(colum, mix, param);
		SelectColum selectColum = (SelectColum) annotations.get(SelectColum.class);
		if (null != keys && keys.size() != 0) {
			if (keys.size() != 1) throw new HbaseException("查询单行数据不可定义多个key");
			String rowkey = keys.get(0);
			if (null == selectColum) {
				return dataSource.getConnection(tableName).getString(rowkey, null, null, pattern, filters);
			} else {
				String[][] colum = createColum(selectColum);
				return dataSource.getConnection(tableName).getString(rowkey, colum[0], colum[1], pattern, filters);
			}
		} else {
			if (null == selectColum) {
				List<LinkedHashMap<String, String>> list = dataSource.getConnection(tableName).scanString(null, null, null, null, pattern, filters);
				if(null != list && list.size() != 1) {
					throw new HbaseException("期待返回一行, 结果返回多行");
				}
				return list == null ? null : list.get(0);
			} else {
				String[][] colum = createColum(selectColum);
				List<LinkedHashMap<String, String>> list = dataSource.getConnection(tableName).scanString(null, null, colum[0], colum[1], pattern, filters);
				if(null != list && list.size() != 1) {
					throw new HbaseException("期待返回一行, 结果返回多行");
				}
				return list == null ? null : list.get(0);
			}
		}
	}

	public String[][] createColum(SelectColum selectColum) {
		String[] values = selectColum.value();
		String[] familay = new String[values.length];
		String[] qualifier = new String[values.length];
		int i = 0;
		for (String value : values) {
			if (value.indexOf(":") < 0) {
				continue;
			}
			String[] fq = value.split(":");
			int l = i++;
			familay[l] = fq[0];
			qualifier[l] = fq[1];
		}
		String[][] result = new String[2][];
		result[0] = familay;
		result[1] = qualifier;
		return result;
	}

	/**
	 *
	 * @param annotations
	 * @param param
	 * @param keys
	 * @param table
	 * @return
	 * @creatTime 上午11:50:47
	 * @author XuYi
	 */
	public Object selectMany(Map<Class<? extends Annotation>, Annotation> annotations, Map<String, Object> param, List<String> keys, Table table, List<MineFilter> filters) {
		String tableName = table.name();
		String pattern = table.keyPattern();
		SelectColum selectColum = (SelectColum) annotations.get(SelectColum.class);
		if (keys != null && keys.size() != 0) {
			String[] startEnd = createKeys(keys);
			if (null == selectColum) {
				return dataSource.getConnection(tableName).scanString(startEnd[0], startEnd[1], null, null, pattern, filters);
			} else {
				String[][] colum = createColum(selectColum);
				return dataSource.getConnection(tableName).scanString(startEnd[0], startEnd[1], colum[0], colum[1], pattern, filters);
			}
		} else {
			if (null == selectColum) {
				return dataSource.getConnection(tableName).scanString(null, null, null, null, pattern, filters);
			} else {
				String[][] colum = createColum(selectColum);
				return dataSource.getConnection(tableName).scanString(null, null, colum[0], colum[1], pattern, filters);
			}
		}
	}

	/**
	 *
	 * @param keys
	 * @return
	 * @creatTime 下午2:01:17
	 * @author XuYi
	 */
	private String[] createKeys(List<String> keys) {
		String[] result = new String[2];
		if (keys.size() == 1) {
			result[0] = keys.get(0);
			result[1] = null;
		} else {
			result[0] = keys.get(0);
			result[1] = keys.get(1);
		}
		return result;
	}

	/**
	 *
	 * @param annotations
	 * @param param
	 * @param keys
	 * @param table
	 * @creatTime 下午2:17:35
	 * @author XuYi
	 */
	public void put(List<String> keys, Map<String, Object> insertColums, Table table) {
		String tableName = table.name();
		String pattern = table.keyPattern();
		if (null == keys || keys.size() != 1) {
			throw new HbaseException("不正确的行键, keys:" + keys);
		}
		if (null == insertColums || insertColums.size() < 1) {
			throw new HbaseException("不正确的待插入列");
		}
		String key = keys.get(0);
		String[] familay = new String[insertColums.size()];
		String[] qualifier = new String[insertColums.size()];
		String[] values = new String[insertColums.size()];
		int i = 0;
		for (Entry<String, Object> entry : insertColums.entrySet()) {
			if (entry.getKey().indexOf(":") < 0) {
				continue;
			}
			int j = i++;
			String[] kv = entry.getKey().split(":");
			familay[j] = kv[0];
			qualifier[j] = kv[1];
			if (entry.getValue() == null) {
				throw new HbaseException("插入值为空");
			}
			if (entry.getValue() instanceof Date) values[j] = ((Date)entry.getValue()).getTime() + "";
			else values[j] = entry.getValue().toString();

		}
		dataSource.getConnection(tableName).put(key, familay, qualifier, values, pattern);
	}

}


text:
package vanadis.extrt;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import vanadis.core.collections.Generic;
import vanadis.core.lang.ToString;

import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

final class DependencyTracker<T extends ManagedFeature<?,?>> implements Iterable<T> {

    private static final Logger log = LoggerFactory.getLogger(DependencyTracker.class);

    private final Set<String> complete = Generic.set();

    private final Set<String> requiredIncomplete = Generic.set();

    private final Set<String> incomplete = Generic.set();

    private final Map<String, T> trackees = Generic.map();

    public T track(T trackee) {
        if (trackee.isComplete()) {
            throw new IllegalStateException(this + " is already complete");
        }
        String name = trackee.getFeatureName();
        if (trackees.containsKey(name)) {
            throw new IllegalArgumentException
                    (this + " failed to setup injectorDependencyTracker, duplicate injection: " + name);
        }

        trackees.put(name, trackee);
        if (trackee.isRequired()) {
            requiredIncomplete.add(name);
        }
        incomplete.add(name);
        return trackee;
    }

    public boolean isTracking(String featureName) {
        return trackees.containsKey(featureName);
    }

    public void progress(String name) {
        checkArgument(name);
        if (incomplete.contains(name) && trackee(name).isComplete()) {
            incomplete.remove(name);
            requiredIncomplete.remove(name);
            complete.add(name);
            if (log.isDebugEnabled()) {
                log.debug(this + " completed " + name);
            }
        } else {
            if (log.isDebugEnabled()) {
                log.debug(this + " progressing: " + name);
            }
        }
    }

    public T setback(String name) {
        checkArgument(name);
        T trackee = trackee(name);
        if (complete.contains(name) && !trackee.isComplete()) {
            complete.remove(name);
            incomplete.add(name);
            if (trackee.isRequired()) {
                requiredIncomplete.add(name);
            }
            return trackees.get(name);
        }
        return null;
    }

    @Override
    public Iterator<T> iterator() {
        return trackees.values().iterator();
    }

    public Iterable<T> requiredIncomplete() {
        return trackees(requiredIncomplete);
    }

    public Iterable<T> incomplete() {
        return trackees(incomplete);
    }

    public Iterable<T> complete() {
        return trackees(complete);
    }

    public Collection<String> completeNames() {
        return complete;
    }

    public boolean isRequiredComplete() {
        return requiredIncomplete.isEmpty();
    }

    public void reset() {
        complete.clear();
        requiredIncomplete.clear();
        incomplete.clear();
        trackees.clear();
    }

    private T trackee(String name) {
        return trackees.get(name);
    }

    private Iterable<T> trackees(Collection<String> names) {
        Collection<T> inc = Generic.list(names.size());
        for (String name : names) {
            inc.add(trackee(name));
        }
        return inc;
    }

    private void checkArgument(String name) {
        if (!trackees.containsKey(name)) {
            throw new IllegalStateException("Unknown property: " + name);
        }
    }

    @Override
    public String toString() {
        return ToString.of(this, "tracking", trackees.keySet(),
                           "complete", complete.size(),
                           "requiredIncomplete", requiredIncomplete.size(),
                           "incomplete", incomplete.size());
    }
}


text:
<?php
namespace components;
use yii\caching\MemCache as Mem;

class MemCache extends Mem {

	public function setValues($data, $duration){
		parent::setVales($$data, $duration);
	}

	public function setValue($key, $value, $duration=0)
	{
		return parent::setValue($key, $value, $duration);
	}

	public function getValue($key)
	{
		return parent::getValue($key);
	}
}

?>


text:
package processing.app;

import static processing.app.I18n._;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import jssc.SerialPort;
import jssc.SerialPortEvent;
import jssc.SerialPortEventListener;
import jssc.SerialPortException;

public class Serial implements SerialPortEventListener {

  //PApplet parent;

  // properties can be passed in for default values
  // otherwise defaults to 9600 N81

  // these could be made static, which might be a solution
  // for the classloading problem.. because if code ran again,
  // the static class would have an object that could be closed

  SerialPort port;

  int rate;
  int parity;
  int databits;
  int stopbits;

  public Serial() throws SerialException {
    this(PreferencesData.get("serial.port"),
            PreferencesData.getInteger("serial.debug_rate"),
            PreferencesData.get("serial.parity").charAt(0),
            PreferencesData.getInteger("serial.databits"),
            new Float(PreferencesData.get("serial.stopbits")).floatValue());
  }

  public Serial(int irate) throws SerialException {
    this(PreferencesData.get("serial.port"), irate,
            PreferencesData.get("serial.parity").charAt(0),
            PreferencesData.getInteger("serial.databits"),
            new Float(PreferencesData.get("serial.stopbits")).floatValue());
  }

  public Serial(String iname, int irate) throws SerialException {
    this(iname, irate, PreferencesData.get("serial.parity").charAt(0),
            PreferencesData.getInteger("serial.databits"),
            new Float(PreferencesData.get("serial.stopbits")).floatValue());
  }

  public Serial(String iname) throws SerialException {
    this(iname, PreferencesData.getInteger("serial.debug_rate"),
            PreferencesData.get("serial.parity").charAt(0),
            PreferencesData.getInteger("serial.databits"),
            new Float(PreferencesData.get("serial.stopbits")).floatValue());
  }

  public static boolean touchPort(String iname, int irate) throws SerialException {
    SerialPort serialPort = new SerialPort(iname);
    try {
      serialPort.openPort();
      serialPort.setParams(irate, 8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
      serialPort.closePort();
      return true;
    } catch (SerialPortException e) {
      throw new SerialException(I18n.format(_("Error touching serial port ''{0}''."), iname), e);
    } finally {
      if (serialPort.isOpened()) {
        try {
          serialPort.closePort();
        } catch (SerialPortException e) {
          // noop
        }
      }
    }
  }

  public Serial(String iname, int irate, char iparity, int idatabits, float istopbits) throws SerialException {
    //if (port != null) port.close();
    //this.parent = parent;
    //parent.attach(this);

    this.rate = irate;

    parity = SerialPort.PARITY_NONE;
    if (iparity == 'E') parity = SerialPort.PARITY_EVEN;
    if (iparity == 'O') parity = SerialPort.PARITY_ODD;

    this.databits = idatabits;

    stopbits = SerialPort.STOPBITS_1;
    if (istopbits == 1.5f) stopbits = SerialPort.STOPBITS_1_5;
    if (istopbits == 2) stopbits = SerialPort.STOPBITS_2;

    try {
      port = new SerialPort(iname);
      port.openPort();
      port.setParams(rate, databits, stopbits, parity, true, true);
      port.addEventListener(this);
    } catch (Exception e) {
      throw new SerialException(I18n.format(_("Error opening serial port ''{0}''."), iname), e);
    }

    if (port == null) {
      throw new SerialNotFoundException(I18n.format(_("Serial port ''{0}'' not found. Did you select the right one from the Tools > Serial Port menu?"), iname));
    }
  }

  public void setup() {
    //parent.registerCall(this, DISPOSE);
  }

  public void dispose() throws IOException {
    if (port != null) {
      try {
        if (port.isOpened()) {
          port.closePort();  // close the port
        }
      } catch (SerialPortException e) {
        throw new IOException(e);
      } finally {
        port = null;
      }
    }
  }

  public synchronized void serialEvent(SerialPortEvent serialEvent) {
    if (serialEvent.isRXCHAR()) {
      try {
        byte[] buf = port.readBytes(serialEvent.getEventValue());
        if (buf.length > 0) {
          String msg = new String(buf);
          char[] chars = msg.toCharArray();
          message(chars, chars.length);
        }
      } catch (SerialPortException e) {
        errorMessage("serialEvent", e);
      }
    }
  }

  /**
   * This method is intented to be extended to receive messages
   * coming from serial port.
   *
   * @param chars
   * @param length
   */
  protected void message(char[] chars, int length) {
	// Empty
  }

  /**
   * This will handle both ints, bytes and chars transparently.
   */
  public void write(int what) {  // will also cover char
    try {
      port.writeInt(what & 0xff);
    } catch (SerialPortException e) {
      errorMessage("write", e);
    }
  }

  public void write(byte bytes[]) {
    try {
      port.writeBytes(bytes);
    } catch (SerialPortException e) {
      errorMessage("write", e);
    }
  }

  /**
   * Write a String to the output. Note that this doesn't account
   * for Unicode (two bytes per char), nor will it send UTF8
   * characters.. It assumes that you mean to send a byte buffer
   * (most often the case for networking and serial i/o) and
   * will only use the bottom 8 bits of each char in the string.
   * (Meaning that internally it uses String.getBytes)
   * <p/>
   * If you want to move Unicode data, you can first convert the
   * String to a byte stream in the representation of your choice
   * (i.e. UTF8 or two-byte Unicode data), and send it as a byte array.
   */
  public void write(String what) {
    write(what.getBytes());
  }

  public void setDTR(boolean state) {
    try {
      port.setDTR(state);
    } catch (SerialPortException e) {
      errorMessage("setDTR", e);
    }
  }

  public void setRTS(boolean state) {
    try {
      port.setRTS(state);
    } catch (SerialPortException e) {
      errorMessage("setRTS", e);
    }
  }

  static public List<String> list() {
    return Arrays.asList(SerialPortList.getPortNames());
  }

  /**
   * General error reporting, all corraled here just in case
   * I think of something slightly more intelligent to do.
   */
  static public void errorMessage(String where, Throwable e) {
    System.err.println(I18n.format(_("Error inside Serial.{0}()"), where));
    e.printStackTrace();
  }
}

  /*
  class SerialMenuListener implements ItemListener {
    //public SerialMenuListener() { }

    public void itemStateChanged(ItemEvent e) {
      int count = serialMenu.getItemCount();
      for (int i = 0; i < count; i++) {
        ((CheckboxMenuItem)serialMenu.getItem(i)).setState(false);
      }
      CheckboxMenuItem item = (CheckboxMenuItem)e.getSource();
      item.setState(true);
      String name = item.getLabel();
      //System.out.println(item.getLabel());
      PdeBase.properties.put("serial.port", name);
      //System.out.println("set to " + get("serial.port"));
    }
  }
  */

  /*
  protected Vector buildPortList() {
    // get list of names for serial ports
    // have the default port checked (if present)
    Vector list = new Vector();

    //SerialMenuListener listener = new SerialMenuListener();
    boolean problem = false;

    // if this is failing, it may be because
    // lib/javax.comm.properties is missing.
    // java is weird about how it searches for java.comm.properties
    // so it tends to be very fragile. i.e. quotes in the CLASSPATH
    // environment variable will hose things.
    try {
      //System.out.println("building port list");
      Enumeration portList = CommPortIdentifier.getPortIdentifiers();
      while (portList.hasMoreElements()) {
        CommPortIdentifier portId =
          (CommPortIdentifier) portList.nextElement();
        //System.out.println(portId);

        if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
          //if (portId.getName().equals(port)) {
          String name = portId.getName();
          //CheckboxMenuItem mi =
          //new CheckboxMenuItem(name, name.equals(defaultName));

          //mi.addItemListener(listener);
          //serialMenu.add(mi);
          list.addElement(name);
        }
      }
    } catch (UnsatisfiedLinkError e) {
      e.printStackTrace();
      problem = true;

    } catch (Exception e) {
      System.out.println("exception building serial menu");
      e.printStackTrace();
    }

    //if (serialMenu.getItemCount() == 0) {
      //System.out.println("dimming serial menu");
    //serialMenu.setEnabled(false);
    //}

    // only warn them if this is the first time
    if (problem && PdeBase.firstTime) {
      JOptionPane.showMessageDialog(this, //frame,
                                    "Serial port support not installed.\n" +
                                    "Check the readme for instructions\n" +
                                    "if you need to use the serial port.    ",
                                    "Serial Port Warning",
                                    JOptionPane.WARNING_MESSAGE);
    }
    return list;
  }
  */


text:
Package	slate-haml-coffee

Description
haml-coffee adapter for slate

Node Version
>= 0.4

## Usage

```coffee-script
slate = require 'slate'
hamlc = require 'slate-haml-coffee'

server = slate.create()
server.root "#{__dirname}/public"
server.enable 'mime', 'static'
server.engine 'hamlc', hamlc
server.start 8080
```

## LICENSE

(MIT License)

Copyright (c) 2012 Fractal <contact@wearefractal.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
var request			= require('request');
var should 			= require('chai').should();
var debug 			= require('debug')('tests:Caching');

function Abort (message) {
  this.message = message;
}

Abort.prototype 			= Object.create(Error.prototype);
Abort.prototype.name 		= 'Abort';
Abort.prototype.constructor = Abort;

describe('End Point', function(){
	//console.log("Checking myvars describe:"+ util.inspect(this))

	before( function(done) {
		//console.log("Checking myvars before:"+ util.inspect(this))
		done();
	})

	describe('is valid and available', function() {

		it('should be up and running', function(done) {
			debug("Checking valid endpoint:"+url)
			//console.log("Checking myvars in it:"+ util.inspect(this))

			var start = new Date
			var options = {
				url: 	url,
				method: 'head',
				timeout: 3000
			}

			request.head( options, function(err, resp, _body ) {
				try {
					should.not.exist(err);
					resp.statusCode.should.equal(200);
					//this.ok = true;
					done();
				} catch(e) {
					//this.ok = false;
					console.log(url+"-"+e)
					throw new Abort("INVALID END POINT")
				}
			});
		})
	})

})


text:
local function echo(project, result)
  if result then
    print('[' .. project.name .. '] ' .. result)
  end
end

return echo


text:
package co.edu.uniandes.csw.artwork.dtos.minimum;

import co.edu.uniandes.csw.artwork.entities.ClientEntity;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;

/**
 * @generated
 */
@XmlRootElement
public class ClientDTO  implements Serializable{

    private Long id;
    private String name;

    /**
     * @generated
     */
    public ClientDTO() {
    }

    /**
     * Crea un objeto ClientDTO a partir de un objeto ClientEntity.
     *
     * @param entity Entidad ClientEntity desde la cual se va a crear el nuevo objeto.
     * @generated
     */
    public ClientDTO(ClientEntity entity) {
	   if (entity!=null){
        this.id=entity.getId();
        this.name=entity.getName();
       }
    }

    /**
     * Convierte un objeto ClientDTO a ClientEntity.
     *
     * @return Nueva objeto ClientEntity.
     * @generated
     */
    public ClientEntity toEntity() {
        ClientEntity entity = new ClientEntity();
        entity.setId(this.getId());
        entity.setName(this.getName());
    return entity;
    }

    /**
     * Obtiene el atributo id.
     *
     * @return atributo id.
     * @generated
     */
    public Long getId() {
        return id;
    }

    /**
     * Establece el valor del atributo id.
     *
     * @param id nuevo valor del atributo
     * @generated
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Obtiene el atributo name.
     *
     * @return atributo name.
     * @generated
     */
    public String getName() {
        return name;
    }

    /**
     * Establece el valor del atributo name.
     *
     * @param name nuevo valor del atributo
     * @generated
     */
    public void setName(String name) {
        this.name = name;
    }

}


text:
import { NgZone, ViewContainerRef, ComponentFactoryResolver, Injector, Renderer, ElementRef } from '@angular/core';
import { ComponentLoader } from './component-loader.class';
import { PositioningService } from '../positioning';
export declare class ComponentLoaderFactory {
    private _componentFactoryResolver;
    private _ngZone;
    private _injector;
    private _posService;
    constructor(componentFactoryResolver: ComponentFactoryResolver, ngZone: NgZone, injector: Injector, posService: PositioningService);
    /**
     *
     * @param _elementRef
     * @param _viewContainerRef
     * @param _renderer
     * @returns {ComponentLoader}
     */
    createLoader<T>(_elementRef: ElementRef, _viewContainerRef: ViewContainerRef, _renderer: Renderer): ComponentLoader<T>;
}


text:
package root

import (
	"log"
	"os"

	"github.com/mholt/caddy"
	"github.com/mholt/caddy/caddyhttp/httpserver"
)

func init() {
	caddy.RegisterPlugin("root", caddy.Plugin{
		ServerType: "http",
		Action:     setupRoot,
	})
}

func setupRoot(c *caddy.Controller) error {
	config := httpserver.GetConfig(c)

	for c.Next() {
		if !c.NextArg() {
			return c.ArgErr()
		}
		config.Root = c.Val()
		if c.NextArg() {
			// only one argument allowed
			return c.ArgErr()
		}
	}
	//first check that the path is not a symlink, os.Stat panics when this is true
	info, _ := os.Lstat(config.Root)
	if info != nil && info.Mode()&os.ModeSymlink == os.ModeSymlink {
		//just print out info, delegate responsibility for symlink validity to
		//underlying Go framework, no need to test / verify twice
		log.Printf("[INFO] Root path is symlink: %s", config.Root)
	} else {
		// Check if root path exists
		_, err := os.Stat(config.Root)
		if err != nil {
			if os.IsNotExist(err) {
				// Allow this, because the folder might appear later.
				// But make sure the user knows!
				log.Printf("[WARNING] Root path does not exist: %s", config.Root)
			} else {
				return c.Errf("Unable to access root path '%s': %v", config.Root, err)
			}
		}
	}

	return nil
}


text:
extern "Java"
{
  namespace javax
  {
    namespace transaction
    {
        class Synchronization;
        class Transaction;
      namespace xa
      {
          class XAResource;
      }
    }
  }
}

class javax::transaction::Transaction : public ::java::lang::Object
{

public:
  virtual void commit() = 0;
  virtual jboolean delistResource(::javax::transaction::xa::XAResource *, jint) = 0;
  virtual jboolean enlistResource(::javax::transaction::xa::XAResource *) = 0;
  virtual jint getStatus() = 0;
  virtual void registerSynchronization(::javax::transaction::Synchronization *) = 0;
  virtual void rollback() = 0;
  virtual void setRollbackOnly() = 0;
  static ::java::lang::Class class$;
} __attribute__ ((java_interface));

#endif // __javax_transaction_Transaction__


text:
{% extends "zerver/portico.html" %}

{% block title %}
<title>Zulip: the best group chat for open source projects</title>
{% endblock %}

{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ render_bundle('landing-page') }}
{% endblock %}

{% block portico_content %}

{% include 'zerver/landing_nav.html' %}

{% trans %}Privacy policy{% endtrans %}

                {% if privacy_policy %}
                    {{ render_markdown_path(privacy_policy, pure_markdown=True) }}
                {% else %}
                    {% trans %}
                    This installation of Zulip does not have a configured privacy policy.
                    Contact this server's administrator
                    if you have any questions.
                    {% endtrans %}
                {% endif %}

{% endblock %}


text:
/* python bridge to checkpointing API */

#include <Python.h>

#include <xenstore.h>
#include <xenctrl.h>

#include "checkpoint.h"

#define PKG "xen.lowlevel.checkpoint"

static PyObject* CheckpointError;

typedef struct {
  PyObject_HEAD
  checkpoint_state cps;

  /* milliseconds between checkpoints */
  unsigned int interval;
  int armed;

  PyObject* suspend_cb;
  PyObject* postcopy_cb;
  PyObject* checkpoint_cb;

  PyThreadState* threadstate;
} CheckpointObject;

static int suspend_trampoline(void* data);
static int postcopy_trampoline(void* data);
static int checkpoint_trampoline(void* data);

static PyObject* Checkpoint_new(PyTypeObject* type, PyObject* args,
                               PyObject* kwargs)
{
  CheckpointObject* self = (CheckpointObject*)type->tp_alloc(type, 0);

  if (!self)
    return NULL;

  checkpoint_init(&self->cps);
  self->suspend_cb = NULL;
  self->armed = 0;

  return (PyObject*)self;
}

static int Checkpoint_init(PyObject* obj, PyObject* args, PyObject* kwargs)
{
  return 0;
}

static void Checkpoint_dealloc(CheckpointObject* self)
{
  checkpoint_close(&self->cps);

  self->ob_type->tp_free((PyObject*)self);
}

static PyObject* pycheckpoint_open(PyObject* obj, PyObject* args)
{
  CheckpointObject* self = (CheckpointObject*)obj;
  checkpoint_state* cps = &self->cps;
  unsigned int domid;

  if (!PyArg_ParseTuple(args, "I", &domid))
    return NULL;

  if (checkpoint_open(cps, domid) < 0) {
    PyErr_SetString(CheckpointError, checkpoint_error(cps));

    return NULL;
  }

  Py_INCREF(Py_None);
  return Py_None;
}

static PyObject* pycheckpoint_close(PyObject* obj, PyObject* args)
{
  CheckpointObject* self = (CheckpointObject*)obj;

  if (checkpoint_resume(&self->cps) < 0)
    fprintf(stderr, "%s\n", checkpoint_error(&self->cps));

  checkpoint_close(&self->cps);

  Py_XDECREF(self->suspend_cb);
  self->suspend_cb = NULL;
  Py_XDECREF(self->postcopy_cb);
  self->postcopy_cb = NULL;
  Py_XDECREF(self->checkpoint_cb);
  self->checkpoint_cb = NULL;

  Py_INCREF(Py_None);
  return Py_None;
}

static PyObject* pycheckpoint_start(PyObject* obj, PyObject* args) {
  CheckpointObject* self = (CheckpointObject*)obj;

  PyObject* iofile;
  PyObject* suspend_cb = NULL;
  PyObject* postcopy_cb = NULL;
  PyObject* checkpoint_cb = NULL;
  unsigned int interval = 0;
  unsigned int flags = 0;

  int fd;
  struct save_callbacks callbacks;
  int rc;

  if (!PyArg_ParseTuple(args, "O|OOOII", &iofile, &suspend_cb, &postcopy_cb,
			&checkpoint_cb, &interval, &flags))
    return NULL;

  self->interval = interval;

  Py_INCREF(iofile);
  Py_XINCREF(suspend_cb);
  Py_XINCREF(postcopy_cb);
  Py_XINCREF(checkpoint_cb);

  fd = PyObject_AsFileDescriptor(iofile);
  Py_DECREF(iofile);
  if (fd < 0) {
    PyErr_SetString(PyExc_TypeError, "invalid file handle");
    return NULL;
  }

  if (suspend_cb && suspend_cb != Py_None) {
    if (!PyCallable_Check(suspend_cb)) {
      PyErr_SetString(PyExc_TypeError, "suspend callback not callable");
      goto err;
    }
    self->suspend_cb = suspend_cb;
  } else
    self->suspend_cb = NULL;

  if (postcopy_cb && postcopy_cb != Py_None) {
    if (!PyCallable_Check(postcopy_cb)) {
      PyErr_SetString(PyExc_TypeError, "postcopy callback not callable");
      return NULL;
    }
    self->postcopy_cb = postcopy_cb;
  } else
    self->postcopy_cb = NULL;

  if (checkpoint_cb && checkpoint_cb != Py_None) {
    if (!PyCallable_Check(checkpoint_cb)) {
      PyErr_SetString(PyExc_TypeError, "checkpoint callback not callable");
      return NULL;
    }
    self->checkpoint_cb = checkpoint_cb;
  } else
    self->checkpoint_cb = NULL;

  memset(&callbacks, 0, sizeof(callbacks));
  callbacks.suspend = suspend_trampoline;
  callbacks.postcopy = postcopy_trampoline;
  callbacks.checkpoint = checkpoint_trampoline;
  callbacks.data = self;

  self->threadstate = PyEval_SaveThread();
  rc = checkpoint_start(&self->cps, fd, &callbacks, flags);
  PyEval_RestoreThread(self->threadstate);

  if (rc < 0) {
    PyErr_SetString(CheckpointError, checkpoint_error(&self->cps));
    goto err;
  }

  Py_INCREF(Py_None);
  return Py_None;

  err:
  self->suspend_cb = NULL;
  Py_XDECREF(suspend_cb);
  self->postcopy_cb = NULL;
  Py_XDECREF(postcopy_cb);
  self->checkpoint_cb = NULL;
  Py_XDECREF(checkpoint_cb);

  return NULL;
}

static PyMethodDef Checkpoint_methods[] = {
  { "open", pycheckpoint_open, METH_VARARGS,
    "open connection to xen" },
  { "close", pycheckpoint_close, METH_NOARGS,
    "close connection to xen" },
  { "start", pycheckpoint_start, METH_VARARGS | METH_KEYWORDS,
    "begin a checkpoint" },
  { NULL, NULL, 0, NULL }
};

static PyTypeObject CheckpointType = {
  PyObject_HEAD_INIT(NULL)
  0,                          /* ob_size           */
  PKG ".checkpointer",   /* tp_name           */
  sizeof(CheckpointObject),   /* tp_basicsize      */
  0,                          /* tp_itemsize       */
  (destructor)Checkpoint_dealloc, /* tp_dealloc        */
  NULL,                       /* tp_print          */
  NULL,                       /* tp_getattr        */
  NULL,                       /* tp_setattr        */
  NULL,                       /* tp_compare        */
  NULL,                       /* tp_repr           */
  NULL,                       /* tp_as_number      */
  NULL,                       /* tp_as_sequence    */
  NULL,                       /* tp_as_mapping     */
  NULL,                       /* tp_hash           */
  NULL,                       /* tp_call           */
  NULL,                       /* tp_str            */
  NULL,                       /* tp_getattro       */
  NULL,                       /* tp_setattro       */
  NULL,                       /* tp_as_buffer      */
  Py_TPFLAGS_DEFAULT,         /* tp_flags          */
  "Checkpoint object",        /* tp_doc            */
  NULL,                       /* tp_traverse       */
  NULL,                       /* tp_clear          */
  NULL,                       /* tp_richcompare    */
  0,                          /* tp_weaklistoffset */
  NULL,                       /* tp_iter           */
  NULL,                       /* tp_iternext       */
  Checkpoint_methods,         /* tp_methods        */
  NULL,                       /* tp_members        */
  NULL,                       /* tp_getset         */
  NULL,                       /* tp_base           */
  NULL,                       /* tp_dict           */
  NULL,                       /* tp_descr_get      */
  NULL,                       /* tp_descr_set      */
  0,                          /* tp_dictoffset     */
  (initproc)Checkpoint_init,  /* tp_init           */
  NULL,                       /* tp_alloc          */
  Checkpoint_new,             /* tp_new            */
};

static PyMethodDef methods[] = {
  { NULL }
};

static char doc[] = "checkpoint API";

PyMODINIT_FUNC initcheckpoint(void) {
  PyObject *m;

  if (PyType_Ready(&CheckpointType) < 0)
    return;

  m = Py_InitModule3(PKG, methods, doc);

  if (!m)
    return;

  Py_INCREF(&CheckpointType);
  PyModule_AddObject(m, "checkpointer", (PyObject*)&CheckpointType);

  CheckpointError = PyErr_NewException(PKG ".error", NULL, NULL);
  Py_INCREF(CheckpointError);
  PyModule_AddObject(m, "error", CheckpointError);

  block_timer();
}

/* private functions */

/* bounce C suspend call into python equivalent.
 * returns 1 on success or 0 on failure */
static int suspend_trampoline(void* data)
{
  CheckpointObject* self = (CheckpointObject*)data;

  PyObject* result;

  /* call default suspend function, then python hook if available */
  if (self->armed) {
    if (checkpoint_wait(&self->cps) < 0) {
      fprintf(stderr, "%s\n", checkpoint_error(&self->cps));
      return 0;
    }
  } else {
    if (self->interval) {
      self->armed = 1;
      checkpoint_settimer(&self->cps, self->interval);
    }

    if (!checkpoint_suspend(&self->cps)) {
      fprintf(stderr, "%s\n", checkpoint_error(&self->cps));
      return 0;
    }
  }

  if (!self->suspend_cb)
    return 1;

  PyEval_RestoreThread(self->threadstate);
  result = PyObject_CallFunction(self->suspend_cb, NULL);
  self->threadstate = PyEval_SaveThread();

  if (!result)
    return 0;

  if (result == Py_None || PyObject_IsTrue(result)) {
    Py_DECREF(result);
    return 1;
  }

  Py_DECREF(result);

  return 0;
}

static int postcopy_trampoline(void* data)
{
  CheckpointObject* self = (CheckpointObject*)data;

  PyObject* result;
  int rc = 0;

  if (!self->postcopy_cb)
    goto resume;

  PyEval_RestoreThread(self->threadstate);
  result = PyObject_CallFunction(self->postcopy_cb, NULL);

  if (result && (result == Py_None || PyObject_IsTrue(result)))
    rc = 1;

  Py_XDECREF(result);
  self->threadstate = PyEval_SaveThread();

  resume:
  if (checkpoint_resume(&self->cps) < 0) {
    fprintf(stderr, "%s\n", checkpoint_error(&self->cps));
    return 0;
  }

  return rc;
}

static int checkpoint_trampoline(void* data)
{
  CheckpointObject* self = (CheckpointObject*)data;

  PyObject* result;

  if (checkpoint_postflush(&self->cps) < 0) {
      fprintf(stderr, "%s\n", checkpoint_error(&self->cps));
      return -1;
  }

  if (!self->checkpoint_cb)
    return 0;

  PyEval_RestoreThread(self->threadstate);
  result = PyObject_CallFunction(self->checkpoint_cb, NULL);
  self->threadstate = PyEval_SaveThread();

  if (!result)
    return 0;

  if (result == Py_None || PyObject_IsTrue(result)) {
    Py_DECREF(result);
    return 1;
  }

  Py_DECREF(result);

  return 0;
}


text:
"""
Uses conda to run and test all supported python + numpy versions.
"""

from __future__ import print_function
import itertools
import subprocess
import os
import sys

if '-q' in sys.argv[1:]:
    NPY = '18',
else:
    NPY = '16', '17', '18'
PY = '26', '27', '33'
RECIPE_DIR = "./buildscripts/condarecipe.local"

def main():
    failfast = '-v' in sys.argv[1:]

    args = "conda build %s --no-binstar-upload" % RECIPE_DIR

    failures = []
    for py, npy in itertools.product(PY, NPY):
        if py == '33' and npy == '16':
            # Skip python3 + numpy16
            continue

        os.environ['CONDA_PY'] = py
        os.environ['CONDA_NPY'] = npy

        try:
            subprocess.check_call(args.split())
        except subprocess.CalledProcessError as e:
            failures.append((py, npy, e))
            if failfast:
                break

    print("=" * 80)
    if failures:
        for py, npy, err in failures:
            print("Test failed for python %s numpy %s" % (py, npy))
            print(err)
    else:
        print("All Passed")

if __name__ == '__main__':
    main()


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.eas.window.events;

import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;

/**
 *
 * @author mg
 * @param <T> Type being maximized
 */
public interface HasMaximizeHandlers<T> extends HasHandlers {

    /**
     * Adds a {@link MaximizeEvent} handler.
     *
     * @param handler the handler
     * @return the registration for the event
     */
    HandlerRegistration addMaximizeHandler(MaximizeHandler<T> handler);
}


text:
import {RendererTester, NOT_FITTING} from '../../renderer-service';
import {IPathResolver} from '../../../services/pathresolver/jsonforms-pathresolver';
import {AbstractLayout} from '../abstract-layout';
import {IUISchemaElement} from '../../../../uischema';

class GroupDirective implements ng.IDirective {
    restrict = 'E';
    templateUrl = 'group.html';
    controller = GroupController;
    controllerAs = 'vm';
}
interface GroupControllerScope extends ng.IScope {
}
class GroupController  extends AbstractLayout {
    static $inject = ['$scope'];
    constructor(scope: GroupControllerScope) {
        super(scope);
    }
    private get label() {
        return this.uiSchema.label ? this.uiSchema.label : '';
    }
}
const GroupLayoutRendererTester: RendererTester = function(element: IUISchemaElement,
                                                         dataSchema: any,
                                                         dataObject: any,
                                                         pathResolver: IPathResolver ){
    if (element.type !== 'Group') {
        return NOT_FITTING;
    }
    return 2;
};

const groupTemplate = `<jsonforms-layout>
    <div class="jsf-group">
        <fieldset>
            <legend ng-if="vm.label">{{vm.label}}</legend>
            <jsonforms-inner ng-repeat="child in vm.uiSchema.elements"
                             uischema="child">
            </jsonforms-inner>
         </fieldset>
    </div>
</jsonforms-layout>`;

export default angular
    .module('jsonforms.renderers.layouts.group', ['jsonforms.renderers.layouts'])
    .directive('grouplayout', () => new GroupDirective())
    .run(['RendererService', RendererService =>
        RendererService.register('grouplayout', GroupLayoutRendererTester)
    ])
    .run(['$templateCache', $templateCache => {
        $templateCache.put('group.html', groupTemplate);
    }])
    .name;


text:
FROM resin/rpi-raspbian:latest

# Install Python.
RUN apt-get update && apt-get install -y python python-pip python-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip install RPi.GPIO

COPY . /app

# Start blink app
CMD ["python", "/app/blink.py"]


text:
package com.intellij.openapi.samples;

import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.util.ui.UIUtil;
import com.intellij.peer.PeerFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;

import javax.swing.*;
import java.awt.*;

public class SimpleToolWindowPlugin implements ProjectComponent {
  private final Project myProject;

  private ToolWindow myToolWindow;
  private JPanel myContentPanel;

  public static final String TOOL_WINDOW_ID = "SimpleToolWindow";

  public SimpleToolWindowPlugin(Project project) {
    myProject = project;
  }

  public void projectOpened() {
    initToolWindow();
  }

  public void projectClosed() {
    unregisterToolWindow();
  }

  public void initComponent() {
    // empty
  }

  public void disposeComponent() {
    // empty
  }

  public String getComponentName() {
    return "SimpleToolWindow.SimpleToolWindowPlugin";
  }

  private void initToolWindow() {
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);

    myContentPanel = new JPanel(new BorderLayout());

    myContentPanel.setBackground(UIUtil.getTreeTextBackground());
    myContentPanel.add(new JLabel("Hello World!", JLabel.CENTER), BorderLayout.CENTER);

    myToolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.LEFT);
    ContentFactory contentFactory = PeerFactory.getInstance().getContentFactory();
    Content content = contentFactory.createContent(myContentPanel, "SimpleWindow", false);
    myToolWindow.getContentManager().addContent(content);
  }

  private void unregisterToolWindow() {
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
    toolWindowManager.unregisterToolWindow(TOOL_WINDOW_ID);
  }
}


text:
/*
 * @author Eugene Zhuravlev
 */
package com.intellij.debugger.ui.impl;

import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
import com.intellij.ui.PopupHandler;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;

public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements DataProvider {
  public static final DataKey<DebuggerTreePanel> DATA_KEY = DataKey.create("DebuggerPanel");

  protected final DebuggerTree myTree;

  public DebuggerTreePanel(Project project, DebuggerStateManager stateManager) {
    super(project, stateManager);
    myTree = createTreeView();

    final PopupHandler popupHandler = new PopupHandler() {
      public void invokePopup(Component comp, int x, int y) {
        ActionPopupMenu popupMenu = createPopupMenu();
        if (popupMenu != null) {
          myTree.myTipManager.registerPopup(popupMenu.getComponent()).show(comp, x, y);
        }
      }
    };
    myTree.addMouseListener(popupHandler);

    setFocusTraversalPolicy(new IdeFocusTraversalPolicy() {
      public Component getDefaultComponentImpl(Container focusCycleRoot) {
        return myTree;
      }
    });

    registerDisposable(new Disposable() {
      public void dispose() {
        myTree.removeMouseListener(popupHandler);
      }
    });

    final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark");
    final CustomShortcutSet shortcutSet = shortcuts.length > 0? new CustomShortcutSet(shortcuts) : new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0));
    overrideShortcut(myTree, DebuggerActions.MARK_OBJECT, shortcutSet);
  }

  protected abstract DebuggerTree createTreeView();

  protected void rebuild(int event) {
    DebuggerSession debuggerSession = getContext().getDebuggerSession();
    if(debuggerSession == null) {
      return;
    }

    getTree().rebuild(getContext());
  }

  public void dispose() {
    super.dispose();
    Disposer.dispose(myTree);
  }

  protected abstract ActionPopupMenu createPopupMenu();

  public final DebuggerTree getTree() {
    return myTree;
  }

  public void clear() {
    myTree.removeAllChildren();
  }

  public Object getData(String dataId) {
    if (DebuggerTreePanel.DATA_KEY.is(dataId)) {
      return this;
    }
    return null;
  }

  public void requestFocus() {
    getTree().requestFocus();
  }
}


text:
package com.oneops.inductor.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

/**
 * Helper class for reading file resources.
 *
 * @author Suresh
 */
public class ResourceUtils {

  public static final int DEFAULT_BUFFER_SIZE = 4 * 1024;

  /**
   * Gets the entire content of this resource as a byte array. This method is not recommended on
   * huge files.
   *
   * @param name resource name
   * @return byte array..
   */
  public static byte[] readResourceAsBytes(String name) {
    try (InputStream ins = ResourceUtils.class.getResourceAsStream(name)) {
      ByteArrayOutputStream bos = new ByteArrayOutputStream(ins.available());
      byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];

      int read = ins.read(buffer);
      while (read >= 0) {
        bos.write(buffer, 0, read);
        read = ins.read(buffer);
      }
      return bos.toByteArray();

    } catch (IOException e) {
      throw new IllegalStateException("Error reading resource: " + name, e);
    }
  }

  /**
   * Gets the entire content of this resource as a String using UTF-8 encoding. Returns
   * the {@code defaultValue} if there is any error reading the resource.
   *
   * @param name resource name.
   * @param defaultValue default value.
   */
  public static String readResourceAsString(String name, String defaultValue) {
    try {
      return readResourceAsString(name);
    } catch (Exception e) {
      return defaultValue;
    }
  }

  /**
   * Gets the entire content of this resource as a String using UTF-8 encoding.
   *
   * @param name resource name
   * @return string.
   */
  public static String readResourceAsString(String name) {
    return new String(readResourceAsBytes(name), StandardCharsets.UTF_8);
  }

}


text:
StarMusics API
========

* Overview
    * Coding portfolio for Restful API
    * Continuous deoployment from github to Windows Azure Website Cloud
* Backend
    * Asp.Net Web Api 2
    * Entity Framework 6
    * Asp.Net Identity Framework with bearer token
    * Window Azure SQL Server
* Tests
    * Ms Unit Test with TDD/BDD
    * Integration Tests with WebAPI TestServer , EntityFramework

* Reference
    * [Using Web API 2 (Individual User Account + CORS Enabled) from AngularJS Client](http://www.codeproject.com/Articles/742532/Using-Web-API-Individual-User-Account-plus-CORS-En)
    * [Testing with a mocking framework (EF6 onwards) ](http://msdn.microsoft.com/en-au/data/dn314429.aspx)
    * [How do you truncate all tables in a database using TSQL?](http://stackoverflow.com/a/156813/647636)
    * [Using Traits in the Unit Test Explorer](http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/09/how-to-manage-unit-tests-in-visual-studio-2012-update-1-part-1-using-traits-in-the-unit-test-explorer.aspx)
    * [INTEGRATION TESTING AUTHENTICATED KATANA APPLICATIONS](http://www.aaron-powell.com/posts/2014-01-12-integration-testing-katana-with-auth.html)
    * [OWIN/Katana in-memory integration testing](http://www.strathweb.com/2013/12/owin-memory-integration-testing/)


text:
'''
Wrapper for safely importing Messager with a fallback that will
get _something_ to the user even if Messager itself breaks.
'''

try:
    from realmessage import Messager
except:
    from sosmessage import SosMessager as Messager


text:
<?php

namespace Jstewmc\Api\Exception;

/**
 * Tests for the Exception\Exeption class
 */
class ExceptionTest extends \PHPUnit_Framework_TestCase
{
	/* !getOutput() */

	/**
	 * getOutput() should return false if output does not exist
	 */
	public function test_getOutput_returnsFalse_ifOutputDoesNotExist()
	{
		return $this->assertFalse((new Exception())->getOutput());
	}

	/**
	 * getOutput() should return string if output does exist
	 */
	public function test_getOutput_returnsString_ifOutputDoesExist()
	{
		$output = 'foo';

		$exception = new Exception();
		$exception->setOutput($output);

		$this->assertEquals($output, $exception->getOutput());

		return;
	}

	/* !getResponse() */

	/**
	 * getResponse() should return null if response does not exist
	 */
	public function test_getResponse_returnsNull_ifResponseDoesNotExist()
	{
		return $this->assertNull((new Exception())->getResponse());
	}

	/**
	 * getResponse() should return response if response does exist
	 */
	public function test_getResponse_returnsResponse_ifResponseDoesExist()
	{
		$response = new \Jstewmc\Api\Response\Json();

		$exception = new Exception();
		$exception->setResponse($response);

		$this->assertSame($response, $exception->getResponse());

		return;
	}

	/* !getStatus() */

	/**
	 * getStatus() should return null if status does not exist
	 */
	public function test_getStatus_returnsNull_ifStatusDoesNotExist()
	{
		return $this->assertNull((new Exception())->getStatus());
	}

	/**
	 * getStatus() should return int if status does exist
	 */
	public function test_getStatus_returnsInt_ifStatusDoesExist()
	{
		$status = 500;

		$exception = new Exception();
		$exception->setStatus($status);

		$this->assertEquals($status, $exception->getStatus());

		return;
	}

	/* !setOutput() */

	/**
	 * setOutput() should throw InvalidArgumentException if $output is not a string
	 */
	public function test_setOutput_throwsInvalidArgumentException_ifOutputIsNotAString()
	{
		$this->setExpectedException('InvalidArgumentException');

		(new Exception())->setOutput(999);

		return;
	}

	/**
	 * setOutput() should return self if $output is string
	 */
	public function test_setOutput_returnsSelf_ifOutputIsString()
	{
		$output = 'foo';

		$exception = new Exception();

		$this->assertSame($exception, $exception->setOutput($output));
		$this->assertEquals($output, $exception->getOutput());

		return;
	}

	/* !setReponse() */

	/**
	 * setResponse() should return self
	 */
	public function test_setResponse_returnsSelf()
	{
		$response = new \Jstewmc\Api\Response\Json();

		$exception = new Exception();

		$this->assertSame($exception, $exception->setResponse($response));
		$this->assertSame($response, $exception->getResponse());

		return;
	}

	/* !setStatus() */

	/**
	 * setStatus() should throw InvalidArgumentException if $status is not a positive
	 *     integer
	 */
	public function test_setStatus_throwsInvalidArgumentException_ifStatusIsNotInteger()
	{
		$this->setExpectedException('InvalidArgumentException');

		(new Exception())->setStatus('foo');

		return;
	}

	/**
	 * setStatus() should return self if $status is a positive integer
	 */
	public function test_setStatus_returnsSelf_ifStatusIsInteger()
	{
		$status = 500;

		$exception = new Exception();

		$this->assertSame($exception, $exception->setStatus($status));
		$this->assertEquals($status, $exception->getStatus());

		return;
	}
}


text:
+++
Title = "Propose"
Type = "event"
Description = "Propose a talk for devopsdays Galway 2019"
+++
  {{< cfp_dates >}}

Click here to propose a Talk

If you need examples of CFP abstracts from last years conference, click any of the following links:

- [Example 1](https://devopsdays.org/events/2018-galway/program/kenzie-woodbridge/)
- [Example 2](https://devopsdays.org/events/2018-galway/program/brian-scanlan/)
- [Example 3](https://devopsdays.org/events/2018-galway/program/jennifer-petoff/)

There are two types of talks you can propose:

A 30-minute talk presented during the conference, usually in the mornings.

An Ignite talk presented during the Ignite sessions (scheduling varies). These are 5 minutes slots with slides changing every 15 seconds (20 slides total).

Open Space: If you'd like to lead a group discussion during the attendee-suggested Open Space breakout sessions, it is not necessary to propose it ahead of time. Those topics are suggested in person at the conference. If you'd like to demo your product or service, you should sponsor the event and demo it at your table.

You may also flag your submission as suitable for both an ignite talk and 30 minute and it will automatically be included under both to save you entering it a second time.

DevOps is a common culture being developed in many workplaces, we'd like to help convey how it's possible to adopt for existing projects and improve the workplace culture and experience over time. Any DevOps related topic is also of interest.

What we're especially looking for:

- How did you manage to initially start the transition?
   - What was managements perspective on this?
   - Were you able to show measurable improvements?
   - Did this start spreading after it was shown to work?
- What bumps did you encounter along the way?
   - Were there any approaches that got discarded?
   - Did anything get reworked a few times before it started improving?
   - What areas did you initially leave as-is despite the difficulties they were causing?
- Where on the path to DevOps nirvana do you think you are at?
- What advice would you share for those attending to prioritize and focus on?

Some topics that will be used to group talks to help ensure a wide range for discussions:

- Continuous Integration and Continuous Delivery/Deployment
- DevSecOps
- Culture
- Best Practices
- Tooling
- Observability (logging, monitoring, metrics)
- Containers and Orchestrastion
- Cloud
- Configuration Management - event driven/immutability

Multiple proposals welcome... just follow the other guidelines!

Choosing talks is part art, part science; here are some factors we consider when trying to assemble the best possible program for our local audience:

- _broad appeal_: How will your talk play out in a room of people with a variety of backgrounds? Technical deep dives need more levels to provide value for the whole room, some of whom might not use your specific tool.
- _new local presenters_: You are the only one who can tell your story. We are very interested in the challenges and successes being experienced in our local area. We are happy to provide guidance/coaching for new speakers upon request.
- _under-represented voices_: We want to hear all voices, including those that may speak less frequently at similar events. Whether you're in a field not typically thought of as a technology field, you're in a large, traditional organization, or you're the only person at your organization with your background, we are interested in your unique experience.
- _original content_: We will consider talks that have already been presented elsewhere, but we prefer talks that the local area isn't likely to have already seen.
- _no third-party submissions_: This is a small community-driven event, and speakers need to be directly engaged with the organizers and attendees. If a PR firm or your marketing department is proposing the talk, you've already shown that as a speaker you're distant from the process.
- _no vendor pitches_: As much as we value vendors and sponsors, we are not going to accept a talk that appears to be a pitch for your product.
- _diversity_: The initial review process will be based on an anonymous version of your submission(s), this includes removing name, gender, geography and company.