text:
import logging

from madmin_server import InternalServerError, add_handler
from madmin_db import Query, DatabaseError
from madmin_user import hasPermission

log = logging.getLogger(__name__)

def handle_budget(params, json_data):
    if 'budget_id' not in params:
        return []

    budget_data = []
    try:
        q = Query('SELECT bdgt_id, bdgt_naam, bdgt_minimum, bdgt_current, bdgt_ver_id FROM tblbudget WHERE bdgt_id = %s')
    except DatabaseError:
        raise InternalServerError

    for budget_id in params['budget_id']:
        try:
            q.run((budget_id,))
            cur_result = q.rows()
        except DatabaseError:
            raise InternalServerError

        for row in cur_result:
            if not hasPermission(params, 'budget', row[4]):
                continue

            budget_data.append({
                    'id': row[0],
                    'vereniging_id': row[4],
                    'naam': row[1],
                    'current': row[3],
                    'minimum': row[2]})

    return budget_data

def handle_budget_vereniging(params, json_data):
    if 'vereniging_id' not in params:
        return []

    try:
        q = Query('SELECT bdgt_id, bdgt_naam, bdgt_minimum, bdgt_current FROM tblbudget WHERE bdgt_ver_id = %s')
    except DatabaseError:
        raise InternalServerError

    budget_data = []

    for vereniging_id in params['vereniging_id']:
        if not hasPermission(params, 'budget', vereniging_id):
            continue

        try:
            q.run((vereniging_id,))
            cur_result = q.rows()
        except DatabaseError:
            raise InternalServerError

        for row in cur_result:
            budget_data.append({
                    'id': row[0],
                    'vereniging_id': vereniging_id,
                    'naam': row[1],
                    'current': row[3],
                    'minimum': row[2]})

    return budget_data

def budget_query(budget_id):
    try:
        q = Query("""SELECT bdgt_id, bdgt_current, bdgt_minimum, bdgt_ver_id, bdgt_naam
                     FROM tblbudget
                     WHERE bdgt_id = %s""")
        q.run((budget_id,))
        rows = q.rows()
    except DatabaseError:
        raise InternalServerError

    result = []
    for row in rows:
        result.append({
                'budget_id': row[0],
                'vereniging_id': row[3],
                'minimum': row[2],
                'current': row[1],
                'naam': row[4]
        })

    return result

def budget_vereniging_query(vereniging_id):
    try:
        q = Query('SELECT bdgt_id FROM tblbudget WHERE bdgt_ver_id = %s')
        q.run((vereniging_id,))
        result = q.rows()
    except DatabaseError:
        raise InternalServerError

    budget_ids = []

    for row in result:
        budget_ids.append(result[0][0])

    return budget_ids

def budget_update(budget_id, value_change):
    try:
        q = Query('UPDATE tblbudget SET bdgt_current = bdgt_current + %s WHERE bdgt_id = %s')
        q.run((value_change, budget_id))
    except DatabaseError:
        raise InternalServerError

add_handler('/budget', handle_budget)
add_handler('/budget/vereniging', handle_budget_vereniging)
log.info("Budget module initialized")


text:
from .series import (
    BaseSeriesValidator,
    IntegerSeriesValidator,
    FloatSeriesValidator,
    CharSeriesValidator,
    LambdaSeriesValidator
)

class ColumnValidatorMixin(BaseSeriesValidator):
    def __init__(self, label, *args, **kwargs):
        super(ColumnValidatorMixin, self).__init__(*args, **kwargs)
        self.label = label

    def validate(self, dataframe):
        super(ColumnValidatorMixin, self).validate(dataframe[self.label])

class IntegerColumnValidator(ColumnValidatorMixin, IntegerSeriesValidator):
    pass

class FloatColumnValidator(ColumnValidatorMixin, FloatSeriesValidator):
    pass

class CharColumnValidator(ColumnValidatorMixin, CharSeriesValidator):
    pass

class LambdaColumnValidator(ColumnValidatorMixin, LambdaSeriesValidator):
    pass

redpajama_set_name: RedPajamaGithub


text:
package org.apache.commons.io.input;

import static org.apache.commons.io.IOUtils.EOF;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

/**
 * Data written to this stream is forwarded to a stream that has been associated with this thread.
 */
public class DemuxInputStream extends InputStream {
    private final InheritableThreadLocal<InputStream> inputStreamLocal = new InheritableThreadLocal<>();

    /**
     * Binds the specified stream to the current thread.
     *
     * @param input the stream to bind
     * @return the InputStream that was previously active
     */
    public InputStream bindStream(final InputStream input) {
        final InputStream oldValue = inputStreamLocal.get();
        inputStreamLocal.set(input);
        return oldValue;
    }

    /**
     * Closes stream associated with current thread.
     *
     * @throws IOException if an error occurs
     */
    @SuppressWarnings("resource") // we actually close the stream here
    @Override
    public void close() throws IOException {
        IOUtils.close(inputStreamLocal.get());
    }

    /**
     * Reads byte from stream associated with current thread.
     *
     * @return the byte read from stream
     * @throws IOException if an error occurs
     */
    @SuppressWarnings("resource")
    @Override
    public int read() throws IOException {
        final InputStream inputStream = inputStreamLocal.get();
        if (null != inputStream) {
            return inputStream.read();
        }
        return EOF;
    }
}


text:
module Mongoid #:nodoc:
  module Attributes
    def self.included(base)
      base.class_eval do
        include InstanceMethods
        extend ClassMethods
      end
    end
    module InstanceMethods
      # Get the id associated with this object. This will pull the _id value out
      # of the attributes +Hash+.
      def id
        @attributes["_id"]
      end

      # Set the id of the +Document+ to a new one.
      def id=(new_id)
        @attributes["_id"] = new_id
      end

      alias :_id :id
      alias :_id= :id=

      # Used for allowing accessor methods for dynamic attributes.
      def method_missing(name, *args)
        attr = name.to_s
        return super unless @attributes.has_key?(attr.reader)
        if attr.writer?
          # "args.size > 1" allows to simulate 1.8 behavior of "*args"
          @attributes[attr.reader] = (args.size > 1) ? args : args.first
        else
          @attributes[attr.reader]
        end
      end

      # Process the provided attributes casting them to their proper values if a
      # field exists for them on the +Document+. This will be limited to only the
      # attributes provided in the suppied +Hash+ so that no extra nil values get
      # put into the document's attributes.
      def process(attrs = nil)
        (attrs || {}).each_pair do |key, value|
          if set_allowed?(key)
            @attributes[key.to_s] = value
          else
            send("#{key}=", value) if value
          end
        end
      end

      # Read a value from the +Document+ attributes. If the value does not exist
      # it will return nil.
      #
      # Options:
      #
      # name: The name of the attribute to get.
      #
      # Example:
      #
      # <tt>person.read_attribute(:title)</tt>
      def read_attribute(name)
        access = name.to_s
        fields[access].get(@attributes[access])
      end

      # Remove a value from the +Document+ attributes. If the value does not exist
      # it will fail gracefully.
      #
      # Options:
      #
      # name: The name of the attribute to remove.
      #
      # Example:
      #
      # <tt>person.remove_attribute(:title)</tt>
      def remove_attribute(name)
        @attributes.delete(name.to_s)
      end

      # Returns the object type. This corresponds to the name of the class that
      # this +Document+ is, which is used in determining the class to
      # instantiate in various cases.
      def _type
        @attributes["_type"]
      end

      # Set the type of the +Document+. This should be the name of the class.
      def _type=(new_type)
        @attributes["_type"] = new_type
      end

      # Write a single attribute to the +Document+ attribute +Hash+. This will
      # also fire the before and after update callbacks, and perform any
      # necessary typecasting.
      #
      # Options:
      #
      # name: The name of the attribute to update.
      # value: The value to set for the attribute.
      #
      # Example:
      #
      # <tt>person.write_attribute(:title, "Mr.")</tt>
      #
      # This will also cause the observing +Document+ to notify it's parent if
      # there is any.
      def write_attribute(name, value)
        access = name.to_s
        @attributes[access] = fields[access].set(value)
        notify unless id.blank?
      end

      # Writes the supplied attributes +Hash+ to the +Document+. This will only
      # overwrite existing attributes if they are present in the new +Hash+, all
      # others will be preserved.
      #
      # Options:
      #
      # attrs: The +Hash+ of new attributes to set on the +Document+
      #
      # Example:
      #
      # <tt>person.write_attributes(:title => "Mr.")</tt>
      #
      # This will also cause the observing +Document+ to notify it's parent if
      # there is any.
      def write_attributes(attrs = nil)
        process(attrs || {})
        identify if id.blank?
        notify
      end

      protected
      # Return true is dynamic field setting is enabled.
      def set_allowed?(key)
        Mongoid.allow_dynamic_fields && !respond_to?("#{key}=")
      end

      # Used when supplying a :reject_if block as an option to
      # accepts_nested_attributes_for
      def reject(attributes, options)
        rejector = options[:reject_if]
        if rejector
          attributes.delete_if do |key, value|
            rejector.call(value)
          end
        end
      end

    end

    module ClassMethods
      # Defines attribute setters for the associations specified by the names.
      # This will work for a has one or has many association.
      #
      # Example:
      #
      #   class Person
      #     include Mongoid::Document
      #     has_one :name
      #     has_many :addresses
      #
      #     accepts_nested_attributes_for :name, :addresses
      #   end
      def accepts_nested_attributes_for(*args)
        associations = args.flatten
        options = associations.last.is_a?(Hash) ? associations.pop : {}
        associations.each do |name|
          define_method("#{name}_attributes=") do |attrs|
            reject(attrs, options)
            association = send(name)
            if association
              update(association, true)
              association.nested_build(attrs)
            else
              send("build_#{name}", attrs)
            end
          end
        end
      end
    end
  end
end


text:
'use strict';

const APIS = require('../../src/routes/apis');

let nock = require('nock');

const URL_CLIENT_LOGIN_PAGE = APIS.POST_LOCAL_LOGIN;

class TestUtils {

  constructor(agent) {
    this._agent = agent;
    this._csrftoken = null;
    this._connectionSid = null;
  }

  get agent() {
    return this._agent;
  }
  get csrftoken() {
    return this._csrftoken;
  }
  get connectionSid() {
    return this._connectionSid;
  }

  updateCookiesAndTokens (done, apiUrl = URL_CLIENT_LOGIN_PAGE) {
    this._agent
      .get(apiUrl)
      .end((err, res) => {
        if(err) {
          done(err);
        } else {
          this._csrftoken = (res.headers['set-cookie']).filter(value => value.includes('XSRF-TOKEN'))[0];
          this._connectionSid = (res.headers['set-cookie']).filter(value => value.includes('connect.sid'))[0];
          this._csrftoken = this._csrftoken ? this._csrftoken.split(';')[0].replace('XSRF-TOKEN=','') : '';
          this._connectionSid = this._connectionSid ? this._connectionSid.split(';')[0].replace('connect.sid=','') : '';
          done();
        }
      });
  }

  getPartialPostRequest (apiUrl) {
    return this._agent
      .post(apiUrl)
      .set('Content-Type', 'application/json')
      .set('Accept', 'application/json')
      .set('set-cookie', 'connect.sid=' + this._connectionSid)
      .set('set-cookie', 'XSRF-TOKEN=' + this._csrftoken);
  }

  getPartialGetRequest (apiUrl) {
    return this._agent
      .get(apiUrl)
      .set('Content-Type', 'application/json')
      .set('Accept', 'application/json');
  }

  getPartialNockApiUrl (baseUrl, apiUrl) {
    return nock(baseUrl)
      .post(apiUrl);
  }
}

module.exports = TestUtils;


text:
/*
 * jQuery Recipe Widget
 * 2016 Matt O'Connell <mattoconnell408@gmail.com>
 * License: MIT
 */

(function($) {
	"use strict";

	var widget_name = 'recipes';

	var RecipeWidget = function(el, customOptions) {
		var _ = this;
		_.$el = $(el).addClass('recipe-widget');
		_.defaults = defaults;
		_.getRecipes(customOptions, _.makeWidget);
	};

	/*
	 * Default Values
	 */
	var defaults = {
		rows: 3,
		jsonData: {},
		imgProxy: null
	};

	RecipeWidget.prototype.getRecipes = function(opts, callback) {
		var _ = this;
		_.options = $.extend(defaults, opts);

		$('div').widgetData(_, widget_name, callback, _.options);
	};

	RecipeWidget.prototype.makeWidget = function(apiData) {
		var _ = this;

		var recipes = apiData.recipes.map(function(rec) {
		    return {
				title: rec.title,
				img: rec.image_url,
				url: rec.source_url,
				publisher: {
					name: rec.publisher,
					url: rec.publisher_url
				}
			}
		});

		var limit = _.options.rows * 2;

		recipes.forEach(function(rec, i) {
			if(i < limit) {
				var img = _.options.imgProxy ? _.options.imgProxy + '?url=' + encodeURIComponent(rec.img): rec.img;
				var $recipe = $('<div>').addClass('recipe');
				var $thumb = $('<a>').addClass('thumb').attr('href', rec.url);
				if(!~img.indexOf('Recipeb56a')) {
					$thumb.css('background-image', 'url(' + img + ')');
				}
				var $text = ($('<div>').addClass('text'))
					.append($('<a>').addClass('title').text(rec.title).attr('href', rec.url))
					.append($('<a>').addClass('subtitle').attr('href', rec.publisher.url).text(rec.publisher.name));
				$recipe.append($thumb).append($text);
				_.$el.append($recipe);
			}
		});

	};

	// Extend JQuery fn for $('$id').recipeWidget()
	$.fn.recipeWidget = function(options) {
		return this.each(function() {
			(new RecipeWidget(this, options));
		});
	};

	// Extend JQuery for $.recipeWidget()
	// ONLY prototype(static) methods
	$.extend({
		recipeWidget: RecipeWidget.prototype
	});

})(jQuery);


text:
package alec_wam.CrystalMod.entities.mob.enderman;

import alec_wam.CrystalMod.items.ItemCrystal.CrystalType;
import alec_wam.CrystalMod.items.ModItems;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.World;

public class EntityCrystalEnderman extends EntityEnderman {

	private static final DataParameter<Byte> COLOR = EntityDataManager.<Byte>createKey(EntityCrystalEnderman.class, DataSerializers.BYTE);

	public EntityCrystalEnderman(World worldIn) {
		super(worldIn);
	}

    @Override
	protected void entityInit()
    {
        super.entityInit();
        this.dataManager.register(COLOR, Byte.valueOf((byte)0));
    }

	@Override
	protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60.0D);
        this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(9.0D);
    }

	@Override
	public void writeEntityToNBT(NBTTagCompound tagCompound)
    {
        super.writeEntityToNBT(tagCompound);
        tagCompound.setByte("Color", (byte)this.getColor());
    }

	@Override
	public void readEntityFromNBT(NBTTagCompound tagCompund)
    {
        super.readEntityFromNBT(tagCompund);
        if (tagCompund.hasKey("Color", 99))
        {
            int i = tagCompund.getByte("Color");
            this.setColor(i);
        }
    }

	@Override
	protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier)
    {
        super.dropFewItems(wasRecentlyHit, lootingModifier);

        int i = this.rand.nextInt(3 + lootingModifier);

        for (int k = 0; k < i; ++k)
        {
        	int META = CrystalType.BLUE_SHARD.getMeta() + getColor();
            this.entityDropItem(new ItemStack(ModItems.crystals, 1, META), 0.0f);
        }
    }

	/**
     * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
     * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
     */
    @Override
	public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
    {
        super.onInitialSpawn(difficulty, livingdata);
        setColor(rand.nextInt(4));
        //TODO Add config for pure chance
        if(rand.nextInt(15) == 0){
        	setColor(4);
        }
        return livingdata;
    }

    public int getColor()
    {
        return this.dataManager.get(COLOR);
    }

    public void setColor(int color){
    	this.dataManager.set(COLOR, Byte.valueOf((byte)color));
    }

}


text:
var buffertools = require('./build/Release/buffertools.node');
var SlowBuffer = require('buffer').SlowBuffer;
var Buffer = require('buffer').Buffer;

// requires node 3.1
var events = require('events');
var util = require('util');

// extend object prototypes
for (var key in buffertools) {
	var val = buffertools[key];
	SlowBuffer.prototype[key] = val;
	Buffer.prototype[key] = val;
	exports[key] = val;
}

// bug fix, see https://github.com/bnoordhuis/node-buffertools/issues/#issue/6
Buffer.prototype.concat = SlowBuffer.prototype.concat = function() {
	var args = [this].concat(Array.prototype.slice.call(arguments));
	return buffertools.concat.apply(buffertools, args);
};

//
// WritableBufferStream
//
// - never emits 'error'
// - never emits 'drain'
//
function WritableBufferStream() {
	this.writable = true;
	this.buffer = null;
}

util.inherits(WritableBufferStream, events.EventEmitter);

WritableBufferStream.prototype._append = function(buffer, encoding) {
	if (!this.writable) {
		throw new Error('Stream is not writable.');
	}

	if (Buffer.isBuffer(buffer)) {
		// no action required
	}
	else if (typeof buffer == 'string') {
		// TODO optimize
		buffer = new Buffer(buffer, encoding || 'utf8');
	}
	else {
		throw new Error('Argument should be either a buffer or a string.');
	}

	// FIXME optimize!
	if (this.buffer) {
		this.buffer = buffertools.concat(this.buffer, buffer);
	}
	else {
		this.buffer = new Buffer(buffer.length);
		buffer.copy(this.buffer);
	}
};

WritableBufferStream.prototype.write = function(buffer, encoding) {
	this._append(buffer, encoding);

	// signal that it's safe to immediately write again
	return true;
};

WritableBufferStream.prototype.end = function(buffer, encoding) {
	if (buffer) {
		this._append(buffer, encoding);
	}

	this.emit('close');

	this.writable = false;
};

WritableBufferStream.prototype.getBuffer = function() {
	if (this.buffer) {
		return this.buffer;
	}
	return new Buffer(0);
};

WritableBufferStream.prototype.toString = function() {
	return this.getBuffer().toString();
};

exports.WritableBufferStream = WritableBufferStream;


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

namespace Nrws.Web.IncludeHandling
{
	public class StaticIncludeStorage : IIncludeStorage
	{
		private static readonly IDictionary<string, IncludeCombination> _combinations;
		private static readonly IDictionary<string, Include> _includes;

		private readonly IKeyGenerator _keyGen;

		static StaticIncludeStorage()
		{
			_includes = new Dictionary<string, Include>();
			_combinations = new Dictionary<string, IncludeCombination>();
		}

		public StaticIncludeStorage(IKeyGenerator keyGen)
		{
			_keyGen = keyGen;
		}

		#region IIncludeStorage Members

		public void Store(Include include)
		{
			if (include == null)
			{
				throw new ArgumentNullException("include");
			}
			if (!_includes.ContainsKey(include.Source))
			{
				_includes.Add(include.Source, include);
			}
			else
			{
				_includes[include.Source] = include;
			}
		}

		public string Store(IncludeCombination combination)
		{
			if (combination == null)
			{
				throw new ArgumentNullException("combination");
			}
			var key = _keyGen.Generate(combination.Sources);

			if (!_combinations.ContainsKey(key))
			{
				_combinations.Add(key, combination);
			}
			else
			{
				_combinations[key] = combination;
			}
			return key;
		}

		public IncludeCombination GetCombination(string key)
		{
			try
			{
				return _combinations[key];
			}
			catch (KeyNotFoundException)
			{
				return null;
			}
		}

		public IEnumerable<Include> GetAllIncludes()
		{
			return _includes.Values;
		}

		public IDictionary<string, IncludeCombination> GetAllCombinations()
		{
			return _combinations;
		}

		public void Clear()
		{
			_includes.Clear();
			_combinations.Clear();
		}

		#endregion
	}
}


text:
package org.intellij.lang.xpath.validation.inspections;

import javax.annotation.Nonnull;

import com.intellij.codeInspection.InspectionManager;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.lang.Language;
import org.intellij.lang.xpath.XPathFileType;
import org.intellij.lang.xpath.XPathTokenTypes;
import org.intellij.lang.xpath.psi.*;
import org.intellij.lang.xpath.validation.ExpectedTypeUtil;
import org.jetbrains.annotations.NonNls;

public class IndexZeroPredicate extends XPathInspection {
    protected Visitor createVisitor(InspectionManager manager, boolean isOnTheFly) {
        return new MyVisitor(manager, isOnTheFly);
    }

    @Nonnull
    public String getDisplayName() {
        return "Use of index 0 in XPath predicates";
    }

    @Nonnull
    @NonNls
    public String getShortName() {
        return "IndexZeroUsage";
    }

    public boolean isEnabledByDefault() {
        return true;
    }

  protected boolean acceptsLanguage(Language language) {
    return language == XPathFileType.XPATH.getLanguage() || language == XPathFileType.XPATH2.getLanguage();
  }

  final static class MyVisitor extends Visitor {
        MyVisitor(InspectionManager manager, boolean isOnTheFly) {
            super(manager, isOnTheFly);
        }

        protected void checkPredicate(XPathPredicate predicate) {
            final XPathExpression expr = predicate.getPredicateExpression();
            if (expr != null) {
                if (expr.getType() == XPathType.NUMBER) {
                    if (isZero(expr)) {
                        addProblem(myManager.createProblemDescriptor(expr,
                                "Use of 0 as predicate index", (LocalQuickFix)null,
                                ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myOnTheFly));
                    }
                } else if (expr instanceof XPathBinaryExpression && expr.getType() == XPathType.BOOLEAN) {
                    final XPathBinaryExpression expression = (XPathBinaryExpression)expr;
                    if (!XPathTokenTypes.BOOLEAN_OPERATIONS.contains(expression.getOperator())) {
                        return;
                    }

                    final XPathExpression lOp = expression.getLOperand();
                    final XPathExpression rOp = expression.getROperand();

                    if (isZero(lOp)) {
                        assert lOp != null;

                        if (isPosition(rOp)) {
                            addProblem(myManager.createProblemDescriptor(expr,
                                    "Comparing position() to 0", (LocalQuickFix)null,
                                    ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myOnTheFly));
                        }
                    } else if (isZero(rOp)) {
                        assert rOp != null;

                        if (isPosition(lOp)) {
                            addProblem(myManager.createProblemDescriptor(expr,
                                    "Comparing position() to 0", (LocalQuickFix)null,
                                    ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myOnTheFly));
                        }
                    }
                }
            }
        }

        private static boolean isPosition(XPathExpression expression) {
            expression = ExpectedTypeUtil.unparenthesize(expression);

            if (!(expression instanceof XPathFunctionCall)) {
                return false;
            }

            final XPathFunctionCall call = (XPathFunctionCall)expression;
            final PrefixedName qName = call.getQName();
            if (qName.getPrefix() != null) return false;
            return "position".equals(qName.getLocalName());
        }

        private static boolean isZero(XPathExpression op) {
            op = ExpectedTypeUtil.unparenthesize(op);

            // TODO: compute constant expression
            return op != null && "0".equals(op.getText());
        }
    }
}


text: <!doctype html>


text:
<?php

namespace App\Http\Controllers;

use App\Ticket;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class PaymentController extends Controller
{
    public function prePay(Request $r)
    {
        if (!Ticket::canBuy()) {
            return redirect('/');
        }
        $r->validate([
            'name' => 'required',
            'payment' => 'required',
            'email' => 'required|email'
        ]);
        $ticket = new Ticket();
        $ticket->name = $r->name;
        $ticket->email = $r->email;
        $ticket->card = $r->payment == 1 ? true : false;
        if (!$ticket->card) {
            $ticket->valid = true;
        }
        $low = User::hasTheLowPrice($r->email) === false ? false : true;
        $ticket->reduced = $low;
        $ticket->save();
        if (!$ticket->card) {
            Mail::to($r->email)->send(new \App\Mail\Ticket());
            Mail::to('contact@krl.lnc.ovh')->send(new \App\Mail\AdminRegistered($ticket));
            return redirect()->route('check');
        } else {
            return redirect()->route('pay', ['id' => $ticket->id]);
        }
    }

    public function payForm($id)
    {
        if (!Ticket::canBuy()) {
            return redirect('/');
        }
        $ticket = Ticket::find($id);
        if (is_null($ticket)) return redirect('/');
        if ($ticket->valid) return redirect('/');
        if ($ticket->reduced) {
            return view('pay_reduced', compact('ticket'));
        } else {
            return view('pay', compact('ticket'));
        }
    }

    public function check()
    {
        return view('check');
    }

    public function card()
    {
        return view('card');
    }

    public function pay(Request $r, $id)
    {
        $ticket = Ticket::find($id);
        if (is_null($ticket) || $ticket->valid) return redirect('/');
        \Stripe\Stripe::setApiKey(config('services.stripe.secret'));
        $token = $r->stripeToken;

        $customer = \Stripe\Customer::create(array(
            'email' => $ticket->email,
            'source' => $token
        ));
        $whichPrice = User::hasTheLowPrice($ticket->email);
        $price = $whichPrice ? 2500 : 3500;
        $charge = \Stripe\Charge::create(array(
            'customer' => $customer->id,
            'amount' => $price,
            'currency' => 'eur'
        ));
        $ticket->valid = true;
        $ticket->save();
        Mail::to($ticket->email)->send(new \App\Mail\Ticket($charge->id));
        Mail::to('contact@krl.lnc.ovh')->send(new \App\Mail\AdminRegistered($ticket, $charge->id));
        return redirect()->route('card');
    }

    public function student(Request $r)
    {
        if (!Ticket::canBuy()) {
            return redirect('/');
        }
        $r->validate([
            'name' => 'required',
            'email' => 'required|email'
        ]);
        $ticket = new Ticket();
        $ticket->name = $r->name;
        $ticket->email = $r->email;
        $ticket->card = null;
        $ticket->valid = true;
        $ticket->reduced = null;
        $ticket->save();
        Mail::to($r->email)->send(new \App\Mail\Ticket());
        Mail::to('contact@krl.lnc.ovh')->send(new \App\Mail\AdminRegistered($ticket));
        return redirect()->route('studentPaied');
    }

    public function studentPaied(){
        return view('student');
    }

    public function isRegistered(Request $r)
    {
        $r->validate([
            'name' => 'required'
        ]);
        $t = Ticket::where('name', $r->name)->first();
        if (is_null($t)) {
            return 'f';
        } else {
            if ($t->valid) {
                return 't';
            } else {
                return route('pay', ['id' => $t->id]);
            }
        }
        return (int)!is_null($t);
    }
}


text:
package storage

import (
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apiserver/pkg/registry/generic"
	genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
	"k8s.io/apiserver/pkg/registry/rest"
	api "k8s.io/kubernetes/pkg/apis/core"
	"k8s.io/kubernetes/pkg/registry/core/limitrange"
)

type REST struct {
	*genericregistry.Store
}

// NewREST returns a RESTStorage object that will work against limitranges.
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
	store := &genericregistry.Store{
		NewFunc:                  func() runtime.Object { return &api.LimitRange{} },
		NewListFunc:              func() runtime.Object { return &api.LimitRangeList{} },
		DefaultQualifiedResource: api.Resource("limitranges"),

		CreateStrategy: limitrange.Strategy,
		UpdateStrategy: limitrange.Strategy,
		DeleteStrategy: limitrange.Strategy,
		ExportStrategy: limitrange.Strategy,
	}
	options := &generic.StoreOptions{RESTOptions: optsGetter}
	if err := store.CompleteWithOptions(options); err != nil {
		return nil, err
	}
	return &REST{store}, nil
}

// Implement ShortNamesProvider
var _ rest.ShortNamesProvider = &REST{}

// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource.
func (r *REST) ShortNames() []string {
	return []string{"limits"}
}


text:
<title>ErrorLine</title>

ErrorLine()

Syntax

Result = ErrorLine()

Description

Returns the line number in the source code where the current error occurred.
This command only returns a meaningful value if there was an error handled by OnErrorCall() or OnErrorGoto().

The tracking of line numbers needs to be enabled on compilation for this command to return the actual line number.
To enable this feature, enable the "Enable OnError lines support" checkbox in the compiler options
or specify the /LINENUMBERING (Windows) or --linenumbering (Linux, Mac OSX) command-line switch when compiling
from the command-line.

Parameters

None.

Return value

The line number of the error, or -1 if the OnError lines support is disabled.

Supported OS
All

<- ErrorFile() - OnError Index - ErrorMessage() ->


text:
package com.amazonaws.services.simpledb.model;

import java.io.Serializable;

/**
 * Get Attributes Result
 */
public class GetAttributesResult implements Serializable, Cloneable {

    /**
     * The list of attributes returned by the operation.
     */
    private com.amazonaws.internal.ListWithAutoConstructFlag<Attribute> attributes;

    /**
     * The list of attributes returned by the operation.
     *
     * @return The list of attributes returned by the operation.
     */
    public java.util.List<Attribute> getAttributes() {
        if (attributes == null) {
              attributes = new com.amazonaws.internal.ListWithAutoConstructFlag<Attribute>();
              attributes.setAutoConstruct(true);
        }
        return attributes;
    }

    /**
     * The list of attributes returned by the operation.
     *
     * @param attributes The list of attributes returned by the operation.
     */
    public void setAttributes(java.util.Collection<Attribute> attributes) {
        if (attributes == null) {
            this.attributes = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<Attribute> attributesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Attribute>(attributes.size());
        attributesCopy.addAll(attributes);
        this.attributes = attributesCopy;
    }

    /**
     * The list of attributes returned by the operation.
     *

     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setAttributes(java.util.Collection)} or {@link
     * #withAttributes(java.util.Collection)} if you want to override the
     * existing values.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param attributes The list of attributes returned by the operation.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetAttributesResult withAttributes(Attribute... attributes) {
        if (getAttributes() == null) setAttributes(new java.util.ArrayList<Attribute>(attributes.length));
        for (Attribute value : attributes) {
            getAttributes().add(value);
        }
        return this;
    }

    /**
     * The list of attributes returned by the operation.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param attributes The list of attributes returned by the operation.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public GetAttributesResult withAttributes(java.util.Collection<Attribute> attributes) {
        if (attributes == null) {
            this.attributes = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<Attribute> attributesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Attribute>(attributes.size());
            attributesCopy.addAll(attributes);
            this.attributes = attributesCopy;
        }

        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAttributes() != null) sb.append("Attributes: " + getAttributes() );
        sb.append("}");
        return sb.toString();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;

        if (obj instanceof GetAttributesResult == false) return false;
        GetAttributesResult other = (GetAttributesResult)obj;

        if (other.getAttributes() == null ^ this.getAttributes() == null) return false;
        if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false;
        return true;
    }

    @Override
    public GetAttributesResult clone() {
        try {
            return (GetAttributesResult) super.clone();

        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }

    }

}


text:
<?php
namespace Skeleton\ConfigLoader;

use Skeleton\Base\IConfigLoader;

class DirectoryConfigLoader extends AbstractConfigLoader implements IConfigLoader
{
	/** @var array */
	private $directories;

	/**
	 * @param array|string $directories
	 */
	public function __construct($directories)
	{
		if (!is_array($directories))
			$directories = [$directories];

		$this->directories = $directories;
	}

	/**
	 * This function will try to include files in all directories passed
	 * to the constructor, and return false if at least one directory had a config file.
	 * @param string $path
	 * @return bool
	 */
	public function tryLoad($path)
	{
		$result = false;

		foreach ($this->directories as $directory)
		{
			$fullPath = $this->createPath($directory, $path);
			$fileResult = $this->tryLoadSingleFile($fullPath);

			$result = $result || $fileResult;
		}

		return $result;
	}
}


text:
Fontface
========

The [Fontface](../../../View/Factory/Css/Objects/CssFontface.php) object represents a custom font at-rule in *CSS*.

```php
$fontface = $this->Css->Fontface();
```

Object
------

The class inheritance for the object.

### Extends

* [CtkObject](../../../Lib/CtkObject.php)
* [CtkNode](../../../Lib/CtkNode.php)
* [CssBlock](../../../View/Factory/Css/Objects/CssBlock.php)

### Implements

* [CtkBuildable](../../../Lib/CtkBuildable.php)
* [CtkBindable](../../../Lib/CtkBindable.php)
* [CtkRenderable](../../../Lib/CtkRenderable.php)

Parameters
----------

The configuration parameters for the template.

		Name
		Type
		Default
		Description

		src
		string
		null
		Defines a font name that will be used as the font face value.

		family
		string
		null
		Defines the URL for the font file, or the name of a local font in the form local("Font Name").

		weight
		string
		normal
		Defines the weight or boldness of the font.

		style
		string
		normal
		Defines the "italic" or "oblique" faces from a font.

		stretch
		string
		normal
		Defines a "normal", "condensed", or "expanded" face from a font.

		unicode
		string
		null
		Defines the range of Unicode characters supported by a font.

Properties
----------

The properties affecting object behavior.

		Property
		Value
		Description

		Allow parent
		true
		Determines if the object can have a parent.

		Allow children
		false
		Determines if the object can have children.

		Allow events
		false
		Determines if events can be added to the object.

		Limit parent

		Defines the allowed parents for the object, or any if none specified.

		Limit children

		Defines the allowed children for the object, or any if none specified.

Methods
-------

None.


text:
require File.join(File.dirname(__FILE__), '../../spec_helper')

describe NestedAjax::Pane::AssociationPane do

end


text:
package rapture.ftp.common;

import java.io.IOException;
import java.net.SocketTimeoutException;

import org.apache.commons.net.ftp.FTPConnectionClosedException;
import org.apache.log4j.Logger;

import rapture.common.exception.ExceptionToString;
import rapture.common.exception.RaptureExceptionFactory;

public class FTPService {

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

    /**
     * Attempt to run this action. If it fails, retry several times.
     * The number of times is specified in the FTPConnection retryCount
     * The time to wait between attempts is specified in the FTPConnection retryWait
     *
     * @param errorMessage
     *            The error message to print out if we give up
     * @param connection
     *            The {@link FTPConnection} that we're working on. This will be
     *            used to reconnect, if the reconnectOnFailure flag is on
     * @param reconnectOnFailure
     *            Indicate whether we should reconnect if this fails due to
     *            something other than a timeout (e.g.
     *            {@link FTPConnectionClosedException} If the failure caused a
     *            disconnect, as opposed to a timeout, try disconnecting and
     *            reconnecting
     * @param action
     * @return
     */
    public static <T> T runWithRetry(String errorMessage, FTPConnection connection, boolean reconnectOnFailure, FTPAction<T> action) {
        T retVal = null;
        boolean success = false;
        Throwable lastException = null;
        for (int i = 0; success == false && i < connection.getRetryCount(); i++) {
            if (i > 0) {
                try {
                    Thread.sleep(connection.getRetryWait());
                } catch (InterruptedException e) {
                    log.warn("Sleep interrupted: " + ExceptionToString.format(e));
                }
            }
            try {
                retVal = action.run(i);
                success = true;
            } catch (SocketTimeoutException e) {
                log.debug("Timed out " + ExceptionToString.format(e));
                lastException = e;
            } catch (FTPConnectionClosedException e) {
                lastException = e;
                if (reconnectOnFailure) {
                    log.warn("Connection closed, will try to reconnect: " + e.getMessage());
                    reconnect(connection);
                } else {
                    log.warn("Connection closed: " + e.getMessage());
                }
            } catch (IOException e) {
                lastException = e;
                if (reconnectOnFailure) {
                    log.warn("IOException, will try to reconnect: " + ExceptionToString.format(e));
                    reconnect(connection);
                } else {
                    log.warn("IOException: " + ExceptionToString.format(e));
                }
            }
        }

        if (!success) {
            throw RaptureExceptionFactory.create(errorMessage, lastException);
        }
        return retVal;
    }

    private static void reconnect(final FTPConnection connection) {
        FTPService.runWithRetry("Unable to disconnect!", connection, false, new FTPAction<Boolean>() {

            @Override
            public Boolean run(int attemptNum) throws IOException {
                log.info(String.format("Reconnect -- disconnecting: attempt %s of %s", 1 + attemptNum, connection.getRetryCount()));
                connection.logoffAndDisconnect();
                return true;
            }
        });

        FTPService.runWithRetry("Unable to disconnect!", connection, false, new FTPAction<Boolean>() {

            @Override
            public Boolean run(int attemptNum) throws IOException {
                log.info(String.format("Reconnect -- connecting: attempt %s of %s", 1 + attemptNum, connection.getRetryCount()));
                connection.connectAndLogin();
                return true;
            }
        });

    }
}


text:
class UsersController < ApplicationController
  before_action :set_user, except: [:new, :create]

  # GET /user
  def show
  end

  # GET /users/new
  def new
    @new_user = User.new
  end

  # GET /users/1/edit
  def edit
  end

  # POST /users
  def create
    @new_user = User.new(user_params)
    if @new_user.save
      redirect_to user_path, notice: 'User was successfully created.'
    else
      render :new
    end
  end

  def update
    password_validation = params[:user][:password_validation]
    valid_password = @user.valid_password?(password_validation)
    if valid_password && @user.update(user_params)
      redirect_to user_path, notice: 'User was successfully updated.'
    else
      @user.errors.add(:password)
      render :edit
    end
  end

  def destroy
    @user.destroy
    redirect_to root_path
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_user
      @user = current_user
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def user_params
      params.require(:user).permit(:email, :password)
    end

end


text:
const device_type MAPLE_DC = &device_creator<maple_dc_device>;

void maple_dc_device::static_set_maincpu_tag(device_t &device, const char *maincpu_tag)
{
	maple_dc_device &maple_dc = downcast<maple_dc_device &>(device);
	maple_dc.maincpu_tag = maincpu_tag;
}

maple_dc_device::maple_dc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
	: device_t(mconfig, MAPLE_DC, "MAPLE_DC", tag, owner, clock)
{
	// Do not move that in device_start or there will be a race
	// condition with the maple devices call to register_port.
	memset(devices, 0, sizeof(devices));
	cpu = 0;
}

void maple_dc_device::register_port(int port, maple_device *device)
{
	if(devices[port])
		fatalerror("maple_dc_device: duplicate registration on port %d\n", port);

	devices[port] = device;
}

void maple_dc_device::device_start()
{
	cpu = machine().device<sh4_device>(maincpu_tag);
	timer = timer_alloc(0);

	mdstar = 0;

	save_item(NAME(mdstar));
	save_item(NAME(mden));
	save_item(NAME(mdst));
	save_item(NAME(msys));
	save_item(NAME(dma_state));
	save_item(NAME(dma_adr));
	save_item(NAME(dma_port));
	save_item(NAME(dma_dest));
	save_item(NAME(dma_endflag));
}

void maple_dc_device::device_reset()
{
	mden = 0;
	mdst = 0;
	msys = 0;
	dma_state = DMA_IDLE;
	dma_adr = 0;
	dma_port = 0;
	dma_dest = 0;
	dma_endflag = false;
}

void maple_dc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	timer.adjust(attotime::never);

	switch(dma_state) {
	case DMA_WAIT_REPLY:
		dma_state = DMA_TIMEOUT;
		dma_step();
		break;

	case DMA_WAIT_NOP:
		dma_state = DMA_SEND;
		dma_step();
		break;

	case DMA_DONE:
		dma_state = DMA_IDLE;
		mdst = 0;
		break;

	default:
		logerror("MAPLE: Unexpected timer callback trigger\n");
		break;
	}
}

void maple_dc_device::dma_step()
{
	for(;;) {
		switch(dma_state) {
		case DMA_SEND: {
			sh4_ddt_dma ddtdata;
			UINT32 header[2];
			UINT32 data[512];
			ddtdata.source    = dma_adr; // source address
			ddtdata.length    = 2;       // words to transfer
			ddtdata.size      = 4;       // bytes per word
			ddtdata.buffer    = header;  // destination buffer
			ddtdata.direction = 0;	     // 0 source to buffer, 1 buffer to source
			ddtdata.channel   = -1;	     // not used
			ddtdata.mode      = -1;      // copy from/to buffer
			sh4_dma_ddt(cpu, &ddtdata);
			dma_adr += 8;

			dma_endflag    = header[0] & 0x80000000;
			dma_port       = (header[0] >> 16) & 3;
			UINT32 pattern = (header[0] >> 8) & 7;
			UINT32 length  = (header[0] & 255) + 1;
			dma_dest       = header[1];

			ddtdata.source    = dma_adr; // source address
			ddtdata.length    = length;  // words to transfer
			ddtdata.size      = 4;       // bytes per word
			ddtdata.buffer    = data;    // destination buffer
			ddtdata.direction = 0;	     // 0 source to buffer, 1 buffer to source
			ddtdata.channel   = -1;	     // not used
			ddtdata.mode      = -1;      // copy from/to buffer
			sh4_dma_ddt(cpu, &ddtdata);
			dma_adr += length*4;

			switch(pattern) {
			case 0: // start
				if(devices[dma_port])
					devices[dma_port]->maple_w(data, length);
				else {
					// Avoid spending time on that specific timeout
					dma_state = DMA_TIMEOUT;
					break;
				}
				dma_state = DMA_WAIT_REPLY;

				// the MIE seems too slow for the correct timeout
				// it's rather strange though
				//              timer->adjust(attotime::from_nsec(40000 + 20*(msys>>16))); // The 40us represent the sending and reception time
				timer->adjust(attotime::from_msec(5));
				break;
			case 2: // sdckb occupy permission (light gun protocol)
				logerror("MAPLE: sdckb occupy permission\n");
				break;
			case 3: // reset
				if(devices[dma_port])
					devices[dma_port]->reset();
				break;
			case 4: // sdckb occupy cancel
				logerror("MAPLE: sdckb occupy cancel\n");
				break;
			case 7: // nop
				logerror("MAPLE: nop\n");
				dma_state = DMA_WAIT_NOP;
				break;
			}
			if(dma_state == DMA_SEND && dma_endflag)
				dma_state = DMA_DONE;
			break;
		}

		case DMA_WAIT_REPLY:
			return;

		case DMA_WAIT_NOP:
			return;

		case DMA_TIMEOUT: {
			sh4_ddt_dma ddtdata;
			UINT32 data = 0xffffffff;
			ddtdata.destination = dma_dest; // destination address
			ddtdata.length      = 1;        // words to transfer
			ddtdata.size        = 4;        // bytes per word
			ddtdata.buffer      = &data;    // destination buffer
			ddtdata.direction   = 1;        // 0 source to buffer, 1 buffer to source
			ddtdata.channel     = -1;       // not used
			ddtdata.mode        = -1;       // copy from/to buffer
			sh4_dma_ddt(cpu, &ddtdata);
			dma_state = dma_endflag ? DMA_DONE : DMA_SEND;
			break;
		}

		case DMA_GOT_REPLY: {
			timer->adjust(attotime::never);

			sh4_ddt_dma ddtdata;
			UINT32 data[512];
			UINT32 length = 0;
			bool partial = false;
			if(devices[dma_port])
				devices[dma_port]->maple_r(data, length, partial);
			else
				fatalerror("MAPLE: reading from unconnected device on port %d\n", dma_port);

			if(length) {
				ddtdata.destination = dma_dest; // destination address
				ddtdata.length      = length;   // words to transfer
				ddtdata.size        = 4;        // bytes per word
				ddtdata.buffer      = data;     // destination buffer
				ddtdata.direction   = 1;        // 0 source to buffer, 1 buffer to source
				ddtdata.channel     = -1;       // not used
				ddtdata.mode        = -1;       // copy from/to buffer
				sh4_dma_ddt(cpu, &ddtdata);
				dma_dest += length*4;
			}

			if(partial)
				dma_state = DMA_WAIT_REPLY;
			else
				dma_state = dma_endflag ? DMA_DONE : DMA_SEND;
			break;
		}
		case DMA_DONE:
			timer->adjust(attotime::from_usec(200));
			return;
		}
	}
}

void maple_dc_device::end_of_reply()
{
	if(dma_state == DMA_WAIT_REPLY) {
		dma_state = DMA_GOT_REPLY;
		dma_step();
	} else
		logerror("MAPLE: Unexpected end of reply\n");
}

READ32_MEMBER(maple_dc_device::sb_mdstar_r)
{
	return mdstar;
}

WRITE32_MEMBER(maple_dc_device::sb_mdstar_w)
{
	mdstar = data & ~31;
}

READ32_MEMBER(maple_dc_device::sb_mden_r)
{
	return mden;
}

WRITE32_MEMBER(maple_dc_device::sb_mden_w)
{
	mden = data & 1;
}

READ32_MEMBER(maple_dc_device::sb_mdst_r)
{
	return dma_state != DMA_IDLE ? 1 : 0;
}

WRITE32_MEMBER(maple_dc_device::sb_mdst_w)
{
	UINT32 old = mdst;
	mdst = data & 1;

	if(!old && data && (mden & 1)) {
		// Hardware trigger unhandled.
		dma_adr = mdstar;
		dma_state = DMA_SEND;
		dma_step();
	}
}

READ32_MEMBER(maple_dc_device::sb_msys_r)
{
	return msys;
}

WRITE32_MEMBER(maple_dc_device::sb_msys_w)
{
	msys = data;
}

WRITE32_MEMBER(maple_dc_device::sb_mdapro_w)
{
}


text:
#ifndef NUPLAYER_DECODER_H_
#define NUPLAYER_DECODER_H_

#include "NuPlayer.h"

#include "NuPlayerDecoderBase.h"

namespace android {

class MediaCodecBuffer;

struct NuPlayer::Decoder : public DecoderBase {
    Decoder(const sp<AMessage> &notify,
            const sp<Source> &source,
            pid_t pid,
            uid_t uid,
            const sp<Renderer> &renderer = NULL,
            const sp<Surface> &surface = NULL,
            const sp<CCDecoder> &ccDecoder = NULL);

    virtual sp<AMessage> getStats() const;

    // sets the output surface of video decoders.
    virtual status_t setVideoSurface(const sp<Surface> &surface);

    virtual status_t releaseCrypto();

protected:
    virtual ~Decoder();

    virtual void onMessageReceived(const sp<AMessage> &msg);

    virtual void onConfigure(const sp<AMessage> &format);
    virtual void onSetParameters(const sp<AMessage> &params);
    virtual void onSetRenderer(const sp<Renderer> &renderer);
    virtual void onResume(bool notifyComplete);
    virtual void onFlush();
    virtual void onShutdown(bool notifyComplete);
    virtual bool doRequestBuffers();

private:
    enum {
        kWhatCodecNotify         = 'cdcN',
        kWhatRenderBuffer        = 'rndr',
        kWhatSetVideoSurface     = 'sSur',
        kWhatAudioOutputFormatChanged = 'aofc',
        kWhatDrmReleaseCrypto    = 'rDrm',
    };

    enum {
        kMaxNumVideoTemporalLayers = 32,
    };

    sp<Surface> mSurface;

    sp<Source> mSource;
    sp<Renderer> mRenderer;
    sp<CCDecoder> mCCDecoder;

    sp<AMessage> mInputFormat;
    sp<AMessage> mOutputFormat;
    sp<MediaCodec> mCodec;
    sp<ALooper> mCodecLooper;

    List<sp<AMessage> > mPendingInputMessages;

    Vector<sp<MediaCodecBuffer> > mInputBuffers;
    Vector<sp<MediaCodecBuffer> > mOutputBuffers;
    Vector<sp<ABuffer> > mCSDsForCurrentFormat;
    Vector<sp<ABuffer> > mCSDsToSubmit;
    Vector<bool> mInputBufferIsDequeued;
    Vector<MediaBuffer *> mMediaBuffers;
    Vector<size_t> mDequeuedInputBuffers;

    const pid_t mPid;
    const uid_t mUid;
    int64_t mSkipRenderingUntilMediaTimeUs;
    int64_t mNumFramesTotal;
    int64_t mNumInputFramesDropped;
    int64_t mNumOutputFramesDropped;
    int32_t mVideoWidth;
    int32_t mVideoHeight;
    bool mIsAudio;
    bool mIsVideoAVC;
    bool mIsSecure;
    bool mIsEncrypted;
    bool mIsEncryptedObservedEarlier;
    bool mFormatChangePending;
    bool mTimeChangePending;
    float mFrameRateTotal;
    float mPlaybackSpeed;
    int32_t mNumVideoTemporalLayerTotal;
    int32_t mNumVideoTemporalLayerAllowed;
    int32_t mCurrentMaxVideoTemporalLayerId;
    float mVideoTemporalLayerAggregateFps[kMaxNumVideoTemporalLayers];

    bool mResumePending;
    AString mComponentName;

    void handleError(int32_t err);
    bool handleAnInputBuffer(size_t index);
    bool handleAnOutputBuffer(
            size_t index,
            size_t offset,
            size_t size,
            int64_t timeUs,
            int32_t flags);
    void handleOutputFormatChange(const sp<AMessage> &format);

    void releaseAndResetMediaBuffers();
    void requestCodecNotification();
    bool isStaleReply(const sp<AMessage> &msg);

    void doFlush(bool notifyComplete);
    status_t fetchInputData(sp<AMessage> &reply);
    bool onInputBufferFetched(const sp<AMessage> &msg);
    void onRenderBuffer(const sp<AMessage> &msg);

    bool supportsSeamlessFormatChange(const sp<AMessage> &to) const;
    bool supportsSeamlessAudioFormatChange(const sp<AMessage> &targetFormat) const;
    void rememberCodecSpecificData(const sp<AMessage> &format);
    bool isDiscontinuityPending() const;
    void finishHandleDiscontinuity(bool flushOnTimeChange);

    void notifyResumeCompleteIfNecessary();

    void onReleaseCrypto(const sp<AMessage>& msg);

    DISALLOW_EVIL_CONSTRUCTORS(Decoder);
};

}  // namespace android

#endif  // NUPLAYER_DECODER_H_


text:
/* Twitter Bootstrap fixes */

.alert a { text-decoration: underline }

/* Universal styling */

cite { font-style: italic }

.compact-box { overflow: hidden }
.compact-box > * { float: left }

.label.help { cursor: help }

/* Site specific */

.container { padding: 10px; width: auto; max-width: 40em }

h1 { margin-bottom: 10px }

#feed-form input[name='user'] { width: 20em }

body.feed .items h2 { font-size: 21px; line-height: 27px; margin-bottom: 19px }
body.feed .items h2 a { color: inherit }
body.feed .items .well { background: #fff; border-width: 0; box-shadow: 0 1px 10px rgba(0, 0, 0, .1); padding: 25px }
body.feed .items .image { max-width: 100%; max-height: 300px; display: block; margin: 20px auto 0 auto }


text:
```bash
npm install @pixi/text
```

## Usage

```js
import * as text from '@pixi/text';
```


text:
using namespace System;
using namespace System::Net;
using namespace System::Net::Sockets;

$<EndPoint> EndPoint::Create(const SocketAddress&) const {
  throw NotSupportedException(caller_);
}

string EndPoint::ToString() const {
  return Enum<Sockets::AddressFamily>(this->addressFamily).ToString();
}

SocketAddress EndPoint::Serialize() const {
  return SocketAddress(this->addressFamily, 2);
}


text:
/**
 * The Firebase AuthUI library. See the {@link com.firebase.ui.auth.AuthUI} entry class for
 * information on using the library to manage signed-in user state.
 */
package com.firebase.ui.auth;


text:
package be.peopleware.jsp_I;

import java.util.ResourceBundle;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.jstl.fmt.LocalizationContext;
import org.apache.taglibs.standard.tag.common.fmt.BundleSupport;

import be.peopleware.i18n_I.ResourceBundleLoadStrategy;

/**
 *
Strategy pattern to load i18n resource bundles for JSTL.

 *
 * @author    David Van Keer
 * @author    PeopleWare n.v.
 */
public class JSTLResourceBundleLoadStrategy
    implements ResourceBundleLoadStrategy {

  /*
 */
  //------------------------------------------------------------------

  /** {@value} */
  public static final String CVS_REVISION = "$Revision$"; //$NON-NLS-1$
  /** {@value} */
  public static final String CVS_DATE = "$Date$"; //$NON-NLS-1$
  /** {@value} */
  public static final String CVS_STATE = "$State$"; //$NON-NLS-1$
  /** {@value} */
  public static final String CVS_TAG = "$Name$"; //$NON-NLS-1$

  /*
 */

  // Default constructor

  /* <property name="pageContext"> */
  //------------------------------------------------------------------

  /**
   * @basic
   */
  public final PageContext getPageContext() {
    return $pageContext;
  }

  /**
   * @param     pageContext
   *            The new value for the pageContext.
   * @post      new.getPageContext() == pageContext;
   */
  public final void setPageContext(final PageContext pageContext) {
    $pageContext = pageContext;
  }

  private PageContext $pageContext;

  /* </property> */

  /**
   * @see   ResourceBundleLoadStrategy#loadResourceBundle(String)
   */
  public ResourceBundle loadResourceBundle(final String basename) {
    ResourceBundle result = null;
    if ((basename != null) && !(basename.equals(""))) { //$NON-NLS-1$
      // Copied from SetBundleSupport tag (JSTL 1.x)
      LocalizationContext locCtxt =
          BundleSupport.getLocalizationContext(getPageContext(), basename);
      result = locCtxt.getResourceBundle();
    }
    return result;
  }

}


text:
@extends('front.masterPageServicios')

@section('step1')

<?php
$id_usuario_op = NULL;
$nombre_empresa_operador = NULL;
$direccion_empresa_operador = NULL;
$nombre_contacto_operador_1 = NULL;
$telf_contacto_operador_1 = NULL;
$email_contacto_operador = NULL;
?>
@foreach ($operador as $operadorData)
<?php
$id_usuario_op = $operadorData->id_usuario_op;
$nombre_empresa_operador = $operadorData->nombre_empresa_operador;
$direccion_empresa_operador = $operadorData->direccion_empresa_operador;
$nombre_contacto_operador_1 = $operadorData->nombre_contacto_operador_1;
$telf_contacto_operador_1 = $operadorData->telf_contacto_operador_1;
$email_contacto_operador = $operadorData->email_contacto_operador;
?>
@endforeach

             <?php
                  $prefix="";
        $operadorName="";

          switch (session('tip_oper')) {
    case 1:
        $prefix="Soy un ";
        $operadorName="Negocio";
        break;
    case 2:
        $prefix="Soy una ";
        $operadorName="Agencia";
        break;
    case 3:
        $prefix="Soy solo";
        $operadorName="Yo";
        break;

}
?>

    {!!$prefix!!}             {!!$operadorName!!}

            El Paso 2 es la información personal del responsable del contenido de la página

 Mi info

 Agregar servicios

 Mis servicios

 Detalle

    {!! Form::open(['url' => route('upload-postoperador'),  'id'=>'registro_step1']) !!}

         <input type="hidden" value="{!!$data['tipoOperador']!!}" name="id_tipo_operador" id="id_tipo_operador">
            <input type="hidden" value="{!!$id_usuario_op!!}" name="id_usuario_op" id="id_usuario_op">

            {!!Form::label('nombre_1', 'Nombre del contacto', array('id'=>'iconFormulario-step2'))!!}
            {!!Form::text('nombre_contacto_operador_1', $nombre_contacto_operador_1, array("title"=>"Es el nombre del administrador del servicio o de quien se haga cargo de la información que ésta página despliegue.",'class'=>'inputtext-step2','placeholder'=>'Ingrese Nombre contacto'))!!}

            {!!Form::label('direccion_1', 'Direccion del contacto', array('id'=>'iconFormulario-step2'))!!}
            {!!Form::text('direccion_empresa_operador', $direccion_empresa_operador, array("title"=>"Es la dirección de la matriz del establecimiento.",'class'=>'inputtext-step2','placeholder'=>'Ingrese direccion compania'))!!}

            {!!Form::label('telefono_1', 'Teléfono del contacto', array('id'=>'iconFormulario-step2'))!!}
            {!!Form::text('telf_contacto_operador_1', $telf_contacto_operador_1, array("title"=>"Es el telefono del contacto del servicio, se puede tener varios servicios pero un solo representante al cual le haremos llegar noticias, mercadería, premios, etc.",'class'=>'inputtext-step2','placeholder'=>'Ingrese telefono contacto'))!!}

            {!!Form::label('email_1', 'Email del Contacto', array('id'=>'iconFormulario-step2'))!!}
            {!!Form::text('email_contacto_operador', $email_contacto_operador, array("title"=>"Es el email del contacto del servicio, se puede tener varios servicios pero un solo representante al cual le haremos llegar noticias, mercadería, premios, etc.",'class'=>'inputtext-step2','placeholder'=>'Ingrese email contacto'))!!}

                Siguiente

    {!! Form::close() !!}

@section('scripts')

{!! HTML::script('/js/jsModal/jquery.simplemodal.js') !!}
{!! HTML::script('/js/jsModal/basic.js') !!}

@stop

@stop


text:
(function($){

    $.widget("gadget.dev_gadgetPatterns", {
           options:{

                selection: function(event,ui){ }
               ,createNewItem: function(event,ui){ alert('new Item')}
               ,createNewPattern: function(event,ui){ alert('new Pattern')}
               ,draggable: true
               ,droppable: true
               ,draggableOpts: {
                   zIndex: 10050
                   ,revert: true
                   ,revertDuration: 100
                   ,opacity: 0.7
                   ,scroll: false
                   ,containment: 'body'
               }
               ,droppableOpts:{

                    accept: 'li.ITEM-patterns'
                   ,activeClass: 'CONTAINER-dropzone-active'
                   ,hoverClass: 'CONTAINER-dropzone-hover'
                   ,drop: function(event, ui){
                        var pattern =  $(this).find('strong').text()
                        $('.CONTAINER-patterns').dev_gadgetPatterns('createNewItem', ui.draggable, pattern );
                        ui.draggable.remove();

                   }
               }
           }

           ,_create: function(){

              var self = this;

              self.items = self.element.find('li.ITEM-patterns');
              self.patterns = self.element.find('li.ITEM-patterns-dropzone');
              self.all = self.items.add(self.patterns);

              self.addNewPattern = self.element.find('.BUTTON-AddAsText');
              self.addNewItem = self.element.find('.BUTTON-addFlatMaxi-option');

           }

           ,_init: function(){

              var self = this, o = self.options;

              self._selectItem(self.items.first() )
              self._setEvents();
              //self._loop(self.items, '_createDrag' );
              self._loop(self.patterns, '_createDrop');

           }
           ,destroy: function(){

              $.Widget.prototype.destroy.apply(this);
           }

           ,_setOption: function( key, value ) {

              this.options[ key ] = value;
           }

           ,_loop: function($toLoop, action, options){
               var self = this;
               $toLoop.each(function(){ self[action]($(this), options)});
           }

           ,_selectItem: function(toSelect){
               var self = this;

               if( self.selected) self._unSelectItem(self.selected)

               self.selected = toSelect

               if(toSelect.is('li.ITEM-patterns-dropzone'))
               {
                   toSelect.find('.CONTAINER-dropzone').addClass('CONTAINER-dropzone-selected')
               }
               else if('li.ITEM-patterns')
               {
                   toSelect.find('a.ITEM-patterns').addClass('ITEM-patterns-selected')
                   self._createDrag(toSelect);
               }

               self._trigger( 'selection', null, self.ui() );
           }
           ,_unSelectItem: function(toSelect){
               var self = this;
                if(toSelect.is('li.ITEM-patterns-dropzone'))
                {
                    toSelect.find('.CONTAINER-dropzone').removeClass('CONTAINER-dropzone-selected')
                }
                else if('li.ITEM-patterns')
                {
                    toSelect.find('a.ITEM-patterns').removeClass('ITEM-patterns-selected')
                    self._removeDrag(toSelect);
                }

           }

           ,_setEvents: function(){
               var self = this, o = self.options;
               if(o.disabled == false)
               {
                   var self = this;
                   self.element.delegate('li.ITEM-patterns ,li.ITEM-patterns-dropzone', 'click.SelectClick.patterns', function(){ self._selectItem($(this)) });
                   self.addNewPattern.bind('click.addNewPattern.pattern', function(){ self.createNewPattern() });
                   self.addNewItem.bind('click.addNewItemr.pattern', function(){ self.createNewItem(); });
               }
           }
           ,_removeEvents: function(){

                var self = this;
                self.element.undelegate('li.ITEM-patterns, li.ITEM-patterns-dropzone');
                self.addNewPattern.unbind('click.addNewPattern.pattern');
                self.addNewItem.unbind('click.addNewItemr.pattern');
           }

           ,createNewItem: function(newItem, pattern){

               var self = this;
               self._trigger( 'createNewItem', null, { item: newItem, pattern: pattern } );

           }

           ,createNewPattern: function(pattern){

               var self = this
               self._trigger( 'createNewPattern', null, { pattern: pattern } );
           }

           ,_createDrop: function(toDrop){
               var self = this, o = this.options;

               if(o.disabled == false && o.droppable == true)
               {
                  var self = this;
                  toDrop.find('.CONTAINER-dropzone').droppable(o.droppableOpts)
               }

           }
           ,_removeDrag: function(drag){ drag.draggable('destroy'); }
           ,_createDrag: function(toDrag){
               var self = this, o = this.options;
               if(o.disabled == false && o.draggable == true)
               {
                  var self = this;
                  toDrag.draggable(o.draggableOpts);

               }
           }
           ,ui: function(){ return{ selected: this.selected, funtion: this.element.find('.FUNCTION-patterns')  } }

    });

})(jQuery);


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="io.github.juumixx.weartodo.WearActivity"
    tools:deviceIds="wear_round">

    <android.support.wearable.view.WearableRecyclerView
        android:id="@+id/recycler"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical" />

</LinearLayout>


text:
package main

import "os/exec"

func openURL(url string) error {
	return exec.Command("cmd.exe", "/C", "start "+url).Run()
}


text:
package de.skuzzle.enforcer.restrictimports.formatting;

import static org.assertj.core.api.Assertions.assertThat;

import java.time.Duration;

import org.junit.jupiter.api.Test;

public class DurationFormatTest {

    @Test
    void testLessThan1Second() throws Exception {
        assertThat(DurationFormat.formatDuration(Duration.ofMillis(500))).isEqualTo("less than 1 second");
    }

    @Test
    void testLittleMoreThan1Second() throws Exception {
        assertThat(DurationFormat.formatDuration(Duration.ofMillis(1200))).isEqualTo("1 second");
    }

    @Test
    void testLittleLessThan1Minute() throws Exception {
        assertThat(DurationFormat.formatDuration(Duration.ofMillis(59900))).isEqualTo("59 seconds");
    }

    @Test
    void testLittleMoreThanOneMinute() throws Exception {
        assertThat(DurationFormat.formatDuration(Duration.ofMillis(60950))).isEqualTo("1 minute");

    }

    @Test
    void test1Minute1Second() throws Exception {
        assertThat(DurationFormat.formatDuration(Duration.ofMillis(61000))).isEqualTo("1 minute and 1 second");
    }

    @Test
    void test2MinutesFewSecond() throws Exception {
        assertThat(DurationFormat.formatDuration(Duration.ofMillis(125000))).isEqualTo("2 minutes and 5 seconds");
    }

    @Test
    void testMoreThan1Hour() throws Exception {
        assertThat(DurationFormat.formatDuration(Duration.ofHours(2).plusMinutes(5).plusSeconds(2)))
                .isEqualTo("125 minutes and 2 seconds");
    }
}


text:
Balboa Agents are standalone processes transport metrics that were written to
disk locally to the metrics data store.

## Installation

This project is published as a maven repository and can be utilized and
referenced as such through socrata's public release library.

 SBT:
 1. Add the Socrata release repository to the project's `build.sbt`:

 ```
  resolvers := Seq(
    "socrata maven" at "https://repository-socrata-oss.forge.cloudbees.com/release"
  )
 ```

2. Add the balboa-client dependency to the project's library dependencies:

  ```
  libraryDependencies ++= Seq(
    ...
    "com.socrata" % "balboa-agent" %% "0.17.+",
    ...
  )
 ```

Others: TODO

## Usage and Code Example

### Terminology

* _agent_ : Standalone process that both consumes and emits metrics.
* _amq_ : Active MQ

### Build

Balboa Agent can built into an executable Assembly (Fat) Jar.

```
sbt balboa-agent/assembly
```

This project also incorporates [Sbt Native
Packager](http://www.scala-sbt.org/sbt-native-packager/). And builds a simple
debian package that wraps an assembly jar. This assembly jar can be found at
the debian install root /balboa-agent/bin/balboa-agent-assembly.jar.

#### Building Debian Distributions

```
sbt balboa-agent/debian:packageBin
```

This packages a debian file at
balboa-agent/target/balboa-agent_VERSION_ARCHTYPE.deb. Currently debian is
build with ARCHTYPE = all implying that it can run on all linux distros
supporting debian.

#### Building Docker Containers (In Progress)

Requirements
* docker

Completed
* End to End docker container composition with sbt-native-package, socrata/java
  base image, and socrata user

In Progress
* Configuring docker registry to support `sbt balboa-agent/docker:publish`
* Ensuring SBT-Native-Pacakager and Socrata Ship.d play nice.

Currently docker can be built and published to the local docker server via...
```
sbt balboa-agent/docker:publishLocal
```

Publish Docker to a remote docker repository
```
sbt balboa-agent/docker:publishLocal
```

Stage the docker file and related contents locally at
balboa-agent/target/docker/stage
```
sbt balboa-agent/docker:stage
```

### Configuration

Configuration is done through environmental variables. The list of
configurable variables can be found in each project's reference.conf
file. Defaults can be found in the application.conf files.

### Running out of the box

`cd balboa && sbt assembly`
`sbt balboa-agent/run "Command line arguments"`

## Tests

### Unit Tests

Standard SBT Tests.

```
sbt balboa-agent/test
```

### Integration Tests

sbt balboa-agent/run
sbt balboa-agent/it:test

* Now, the integration tests should be able to write to the file system and
  read from the queue.

## History

Balboa-agent formerly the Metric Consumer started off as a one off project to
help ingest and consolidate metrics on individual servers. This helped manage
the amount of traffic being pushed through activemq.

## License

See root project license.


text:
/* Options:
Date: 2016-04-18 21:52:29
Version: 4.055
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: http://BEING:9999/

//GlobalNamespace:
//MakePartial: True
//MakeVirtual: True
//MakeDataContractsExtensible: False
//AddReturnMarker: True
//AddDescriptionAsComments: True
//AddDataContractAttributes: False
//AddIndexesToDataMembers: False
//AddGeneratedCodeAttributes: False
//AddResponseStatus: False
//AddImplicitVersion:
//InitializeCollections: True
//IncludeTypes:
//ExcludeTypes:
//AddDefaultXmlNamespace: http://schemas.servicestack.net/types
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using TestService2;

namespace TestService2
{

    public partial class ExcludedService2
        : IReturnVoid
    {
    }

    public partial class Service2CallsService1
        : IReturn<string>
    {
        public virtual string From { get; set; }
    }

    public partial class Service2External
        : IReturn<string>
    {
        public virtual string From { get; set; }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using HtmlAgilityPack;

namespace WebImageDownloader.Model
{

    public enum NodeType
    {
        Image,
        Link
    }

    interface IFilter
    {
        NodeType GetNodeType();
        string GetId();
        List<string> GetClasses();
        bool MatchesFilter(HtmlNode node);
    }
}


text:
using System.Web.Mvc;
using FluentValidation.Attributes;
using Nop.Web.Framework;
using Nop.Web.Framework.Mvc;
using Nop.Web.Validators.Vendors;

namespace Nop.Web.Models.Vendors
{
    [Validator(typeof(VendorInfoValidator))]
    public class VendorInfoModel : BaseNopModel
    {
        [NopResourceDisplayName("Account.VendorInfo.Name")]
        [AllowHtml]
        public string Name { get; set; }

        [NopResourceDisplayName("Account.VendorInfo.Email")]
        [AllowHtml]
        public string Email { get; set; }

        [NopResourceDisplayName("Account.VendorInfo.Description")]
        [AllowHtml]
        public string Description { get; set; }

        [NopResourceDisplayName("Account.VendorInfo.Picture")]
        public string PictureUrl { get; set; }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:radius="2dp" />
            <solid android:color="@android:color/transparent" />
            <stroke
                android:width="0.5dp"
                android:color="#ef4836" />
        </shape>
    </item>
</selector>


text:
#pragma once
#include <aws/personalize/Personalize_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/personalize/model/DatasetSchemaSummary.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace Personalize
{
namespace Model
{
  class AWS_PERSONALIZE_API ListSchemasResult
  {
  public:
    ListSchemasResult();
    ListSchemasResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    ListSchemasResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
A list of schemas.

     */
    inline const Aws::Vector<DatasetSchemaSummary>& GetSchemas() const{ return m_schemas; }

    /**
     *
A list of schemas.

     */
    inline void SetSchemas(const Aws::Vector<DatasetSchemaSummary>& value) { m_schemas = value; }

    /**
     *
A list of schemas.

     */
    inline void SetSchemas(Aws::Vector<DatasetSchemaSummary>&& value) { m_schemas = std::move(value); }

    /**
     *
A list of schemas.

     */
    inline ListSchemasResult& WithSchemas(const Aws::Vector<DatasetSchemaSummary>& value) { SetSchemas(value); return *this;}

    /**
     *
A list of schemas.

     */
    inline ListSchemasResult& WithSchemas(Aws::Vector<DatasetSchemaSummary>&& value) { SetSchemas(std::move(value)); return *this;}

    /**
     *
A list of schemas.

     */
    inline ListSchemasResult& AddSchemas(const DatasetSchemaSummary& value) { m_schemas.push_back(value); return *this; }

    /**
     *
A list of schemas.

     */
    inline ListSchemasResult& AddSchemas(DatasetSchemaSummary&& value) { m_schemas.push_back(std::move(value)); return *this; }

    /**
     *
A token used to get the next set of schemas (if they exist).

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
A token used to get the next set of schemas (if they exist).

     */
    inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }

    /**
     *
A token used to get the next set of schemas (if they exist).

     */
    inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }

    /**
     *
A token used to get the next set of schemas (if they exist).

     */
    inline void SetNextToken(const char* value) { m_nextToken.assign(value); }

    /**
     *
A token used to get the next set of schemas (if they exist).

     */
    inline ListSchemasResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
A token used to get the next set of schemas (if they exist).

     */
    inline ListSchemasResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
A token used to get the next set of schemas (if they exist).

     */
    inline ListSchemasResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}

  private:

    Aws::Vector<DatasetSchemaSummary> m_schemas;

    Aws::String m_nextToken;
  };

} // namespace Model
} // namespace Personalize
} // namespace Aws


text:
#ifndef ES_NULLABLE_H_INCLUDED
#define ES_NULLABLE_H_INCLUDED

#include <string>
#include <typeinfo>
#include <type_traits>

class Any;
class Object;

template <typename T>
class Nullable
{
    T    value_;
    bool hasValue_;

    template <typename U>
    Nullable(const Nullable<U>&);

public:
    bool hasValue() const
    {
        return hasValue_;
    }

    T value() const
    {
        if (!hasValue_)
        {
            // TODO: Raise an exception
        }
        return value_;
    }

    operator std::u16string() const;

    Nullable() :
        hasValue_(false)
    {
    }

    Nullable(const T& value) :
        value_(value),
        hasValue_(true)
    {
    }

    Nullable(const Nullable<T>& nullable) :
        value_(nullable.value_),
        hasValue_(nullable.hasValue_)
    {
    }

    bool operator==(const Nullable<T>& other) const
    {
        if (!hasValue_)
            return !other.hasValue_;
        if (!other.hasValue_)
            return false;
        return value_ == other.value_;
    }
    bool operator!=(const Nullable<T>& other) const
    {
        return !(*this == other);
    }

    template<typename U>
    Nullable(U* str);

    Nullable(const Any& any);
};

template<>
template<>
inline Nullable<std::string>::Nullable(const char* str)
{
    if (!str)
        hasValue_ = false;
    else {
        hasValue_ = true;
        value_ = str;
    }
}

template<>
template<>
inline Nullable<std::u16string>::Nullable(const char16_t* str)
{
    if (!str)
        hasValue_ = false;
    else {
        hasValue_ = true;
        value_ = str;
    }
}

// Note maybe it is a bit arguable whether we should have this
// conversion operator. The primary use case of this is to call
// ElementImp::getAttribute from Element's subclasses with a
// specific qualified name.
template<>
inline Nullable<std::u16string>::operator std::u16string() const
{
    if (hasValue_)
        return value_;
    else
        return u"";
}

#endif  // ES_NULLABLE_H_INCLUDED