text:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Area2D" inherits="CollisionObject2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		2D area for detection and physics and audio influence.
	</brief_description>
	<description>
		2D area that detects [CollisionObject2D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to custom audio buses.
		To give the area its shape, add a [CollisionShape2D] or a [CollisionPolygon2D] node as a [i]direct[/i] child (or add multiple such nodes as direct children) of the area.
		[b]Warning:[/b] See [ConcavePolygonShape2D] for a warning about possibly unexpected behavior when using that shape for an area.
	</description>
	<tutorials>
		<link title="Using Area2D">$DOCS_URL/tutorials/physics/using_area_2d.html</link>
		<link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
		<link title="2D Pong Demo">https://godotengine.org/asset-library/asset/121</link>
		<link title="2D Platformer Demo">https://godotengine.org/asset-library/asset/120</link>
	</tutorials>
	<methods>
		<method name="get_overlapping_areas" qualifiers="const">
			<return type="Area2D[]" />
			<description>
				Returns a list of intersecting [Area2D]s. The overlapping area's [member CollisionObject2D.collision_layer] must be part of this area's [member CollisionObject2D.collision_mask] in order to be detected.
				For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
			</description>
		</method>
		<method name="get_overlapping_bodies" qualifiers="const">
			<return type="Node2D[]" />
			<description>
				Returns a list of intersecting [PhysicsBody2D]s. The overlapping body's [member CollisionObject2D.collision_layer] must be part of this area's [member CollisionObject2D.collision_mask] in order to be detected.
				For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
			</description>
		</method>
		<method name="overlaps_area" qualifiers="const">
			<return type="bool" />
			<param index="0" name="area" type="Node" />
			<description>
				Returns [code]true[/code] if the given [Area2D] intersects or overlaps this [Area2D], [code]false[/code] otherwise.
				[b]Note:[/b] The result of this test is not immediate after moving objects. For performance, the list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
			</description>
		</method>
		<method name="overlaps_body" qualifiers="const">
			<return type="bool" />
			<param index="0" name="body" type="Node" />
			<description>
				Returns [code]true[/code] if the given physics body intersects or overlaps this [Area2D], [code]false[/code] otherwise.
				[b]Note:[/b] The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
				The [param body] argument can either be a [PhysicsBody2D] or a [TileMap] instance. While TileMaps are not physics bodies themselves, they register their tiles with collision shapes as a virtual physics body.
			</description>
		</method>
	</methods>
	<members>
		<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp" default="1.0">
			The rate at which objects stop spinning in this area. Represents the angular velocity lost per second.
			See [member ProjectSettings.physics/2d/default_angular_damp] for more details about damping.
		</member>
		<member name="angular_damp_space_override" type="int" setter="set_angular_damp_space_override_mode" getter="get_angular_damp_space_override_mode" enum="Area2D.SpaceOverride" default="0">
			Override mode for angular damping calculations within this area. See [enum SpaceOverride] for possible values.
		</member>
		<member name="audio_bus_name" type="StringName" setter="set_audio_bus_name" getter="get_audio_bus_name" default="&"Master"">
			The name of the area's audio bus.
		</member>
		<member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus" default="false">
			If [code]true[/code], the area's audio bus overrides the default audio bus.
		</member>
		<member name="gravity" type="float" setter="set_gravity" getter="get_gravity" default="980.0">
			The area's gravity intensity (in pixels per second squared). This value multiplies the gravity direction. This is useful to alter the force of gravity without altering its direction.
		</member>
		<member name="gravity_direction" type="Vector2" setter="set_gravity_direction" getter="get_gravity_direction" default="Vector2(0, 1)">
			The area's gravity vector (not normalized).
		</member>
		<member name="gravity_point" type="bool" setter="set_gravity_is_point" getter="is_gravity_a_point" default="false">
			If [code]true[/code], gravity is calculated from a point (set via [member gravity_point_center]). See also [member gravity_space_override].
		</member>
		<member name="gravity_point_center" type="Vector2" setter="set_gravity_point_center" getter="get_gravity_point_center" default="Vector2(0, 1)">
			If gravity is a point (see [member gravity_point]), this will be the point of attraction.
		</member>
		<member name="gravity_point_distance_scale" type="float" setter="set_gravity_point_distance_scale" getter="get_gravity_point_distance_scale" default="0.0">
			The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
		</member>
		<member name="gravity_space_override" type="int" setter="set_gravity_space_override_mode" getter="get_gravity_space_override_mode" enum="Area2D.SpaceOverride" default="0">
			Override mode for gravity calculations within this area. See [enum SpaceOverride] for possible values.
		</member>
		<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp" default="0.1">
			The rate at which objects stop moving in this area. Represents the linear velocity lost per second.
			See [member ProjectSettings.physics/2d/default_linear_damp] for more details about damping.
		</member>
		<member name="linear_damp_space_override" type="int" setter="set_linear_damp_space_override_mode" getter="get_linear_damp_space_override_mode" enum="Area2D.SpaceOverride" default="0">
			Override mode for linear damping calculations within this area. See [enum SpaceOverride] for possible values.
		</member>
		<member name="monitorable" type="bool" setter="set_monitorable" getter="is_monitorable" default="true">
			If [code]true[/code], other monitoring areas can detect this area.
		</member>
		<member name="monitoring" type="bool" setter="set_monitoring" getter="is_monitoring" default="true">
			If [code]true[/code], the area detects bodies or areas entering and exiting it.
		</member>
		<member name="priority" type="float" setter="set_priority" getter="get_priority" default="0.0">
			The area's priority. Higher priority areas are processed first.
		</member>
	</members>
	<signals>
		<signal name="area_entered">
			<param index="0" name="area" type="Area2D" />
			<description>
				Emitted when another Area2D enters this Area2D. Requires [member monitoring] to be set to [code]true[/code].
				[param area] the other Area2D.
			</description>
		</signal>
		<signal name="area_exited">
			<param index="0" name="area" type="Area2D" />
			<description>
				Emitted when another Area2D exits this Area2D. Requires [member monitoring] to be set to [code]true[/code].
				[param area] the other Area2D.
			</description>
		</signal>
		<signal name="area_shape_entered">
			<param index="0" name="area_rid" type="RID" />
			<param index="1" name="area" type="Area2D" />
			<param index="2" name="area_shape_index" type="int" />
			<param index="3" name="local_shape_index" type="int" />
			<description>
				Emitted when one of another Area2D's [Shape2D]s enters one of this Area2D's [Shape2D]s. Requires [member monitoring] to be set to [code]true[/code].
				[param area_rid] the [RID] of the other Area2D's [CollisionObject2D] used by the [PhysicsServer2D].
				[param area] the other Area2D.
				[param area_shape_index] the index of the [Shape2D] of the other Area2D used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]area.shape_owner_get_owner(area.shape_find_owner(area_shape_index))[/code].
				[param local_shape_index] the index of the [Shape2D] of this Area2D used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
			</description>
		</signal>
		<signal name="area_shape_exited">
			<param index="0" name="area_rid" type="RID" />
			<param index="1" name="area" type="Area2D" />
			<param index="2" name="area_shape_index" type="int" />
			<param index="3" name="local_shape_index" type="int" />
			<description>
				Emitted when one of another Area2D's [Shape2D]s exits one of this Area2D's [Shape2D]s. Requires [member monitoring] to be set to [code]true[/code].
				[param area_rid] the [RID] of the other Area2D's [CollisionObject2D] used by the [PhysicsServer2D].
				[param area] the other Area2D.
				[param area_shape_index] the index of the [Shape2D] of the other Area2D used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]area.shape_owner_get_owner(area.shape_find_owner(area_shape_index))[/code].
				[param local_shape_index] the index of the [Shape2D] of this Area2D used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
			</description>
		</signal>
		<signal name="body_entered">
			<param index="0" name="body" type="Node2D" />
			<description>
				Emitted when a [PhysicsBody2D] or [TileMap] enters this Area2D. Requires [member monitoring] to be set to [code]true[/code]. [TileMap]s are detected if the [TileSet] has Collision [Shape2D]s.
				[param body] the [Node], if it exists in the tree, of the other [PhysicsBody2D] or [TileMap].
			</description>
		</signal>
		<signal name="body_exited">
			<param index="0" name="body" type="Node2D" />
			<description>
				Emitted when a [PhysicsBody2D] or [TileMap] exits this Area2D. Requires [member monitoring] to be set to [code]true[/code]. [TileMap]s are detected if the [TileSet] has Collision [Shape2D]s.
				[param body] the [Node], if it exists in the tree, of the other [PhysicsBody2D] or [TileMap].
			</description>
		</signal>
		<signal name="body_shape_entered">
			<param index="0" name="body_rid" type="RID" />
			<param index="1" name="body" type="Node2D" />
			<param index="2" name="body_shape_index" type="int" />
			<param index="3" name="local_shape_index" type="int" />
			<description>
				Emitted when one of a [PhysicsBody2D] or [TileMap]'s [Shape2D]s enters one of this Area2D's [Shape2D]s. Requires [member monitoring] to be set to [code]true[/code]. [TileMap]s are detected if the [TileSet] has Collision [Shape2D]s.
				[param body_rid] the [RID] of the [PhysicsBody2D] or [TileSet]'s [CollisionObject2D] used by the [PhysicsServer2D].
				[param body] the [Node], if it exists in the tree, of the [PhysicsBody2D] or [TileMap].
				[param body_shape_index] the index of the [Shape2D] of the [PhysicsBody2D] or [TileMap] used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]body.shape_owner_get_owner(body.shape_find_owner(body_shape_index))[/code].
				[param local_shape_index] the index of the [Shape2D] of this Area2D used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
			</description>
		</signal>
		<signal name="body_shape_exited">
			<param index="0" name="body_rid" type="RID" />
			<param index="1" name="body" type="Node2D" />
			<param index="2" name="body_shape_index" type="int" />
			<param index="3" name="local_shape_index" type="int" />
			<description>
				Emitted when one of a [PhysicsBody2D] or [TileMap]'s [Shape2D]s exits one of this Area2D's [Shape2D]s. Requires [member monitoring] to be set to [code]true[/code]. [TileMap]s are detected if the [TileSet] has Collision [Shape2D]s.
				[param body_rid] the [RID] of the [PhysicsBody2D] or [TileSet]'s [CollisionObject2D] used by the [PhysicsServer2D].
				[param body] the [Node], if it exists in the tree, of the [PhysicsBody2D] or [TileMap].
				[param body_shape_index] the index of the [Shape2D] of the [PhysicsBody2D] or [TileMap] used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]body.shape_owner_get_owner(body.shape_find_owner(body_shape_index))[/code].
				[param local_shape_index] the index of the [Shape2D] of this Area2D used by the [PhysicsServer2D]. Get the [CollisionShape2D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="SPACE_OVERRIDE_DISABLED" value="0" enum="SpaceOverride">
			This area does not affect gravity/damping.
		</constant>
		<constant name="SPACE_OVERRIDE_COMBINE" value="1" enum="SpaceOverride">
			This area adds its gravity/damping values to whatever has been calculated so far (in [member priority] order).
		</constant>
		<constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2" enum="SpaceOverride">
			This area adds its gravity/damping values to whatever has been calculated so far (in [member priority] order), ignoring any lower priority areas.
		</constant>
		<constant name="SPACE_OVERRIDE_REPLACE" value="3" enum="SpaceOverride">
			This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
		</constant>
		<constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4" enum="SpaceOverride">
			This area replaces any gravity/damping calculated so far (in [member priority] order), but keeps calculating the rest of the areas.
		</constant>
	</constants>
</class>


text:
package au.com.ifti;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;

import org.hibernate.Session;

import au.com.ifti.exceptions.BadRequestException;
import au.com.ifti.exceptions.NotFoundException;
import au.com.ifti.utilities.TiramisuRequest;
import au.com.ifti.utilities.TiramisuResponse;

/**
 * The class which handles the routing for the application. The URLDispatcher
 * contains a list of routes which are checked against the HTTP request. If a
 * match is found, it uses Java Reflection to initialise and then call the
 * appropriate controller.
 *
 * @author Chris Hamilton
 */
public class UrlDispatcher {

	/**
	 * Class logger.
	 */
	private static final Logger log = Logger.getLogger(UrlDispatcher.class.getName());

	/**
	 * The hibernate session which this particular request will use.
	 * This does not need to be initialised, as it will be getting assigned.
	 */
	private Session session = null;

	/**
	 * The list of routes, passing in from the Servlet.
	 */
	private ArrayList<Route> routes = new ArrayList<Route>();

	/**
	 * Create the application without any predefined routes.
	 * @param routes
	 */
	public UrlDispatcher(Session session) {
		this.setSession(session);
	}

	/**
	 * Create the URL dispatcher with the list of predefined routes from the Servlet init function.
	 * @param routes The ArrayList of routes for the application.
	 * @param session The hibernate session opened for this request.
	 */
	public UrlDispatcher(ArrayList<Route> routes, Session session) {
		this.setRoutes(routes);
		this.setSession(session);
	}

	/**
	 * The dispatch function called by the servlet to start the routing process.
	 * This function will check the current request with the list of available routes and HTTP methods.
	 * If a match is found, it will create the controller object and call its method with reflection.
	 * If no match is found, the it will set the response to 404.
	 * This function also needs to handle exceptions coming back from the controller.
	 *
	 * @param request The TiramisuRequest object for the request.
	 * @param response The TiramisuResponse object for the request.
	 */
	public TiramisuResponse dispatch(TiramisuRequest tiramisuRequest, TiramisuResponse tiramisuResponse) {

		// Havn't matched anything yet.
		Boolean matched = false;

		// Loop through the routes looking for a match.
		for (Route route : this.getRoutes()) {

			// Do any of the defined routes match the current URI?
			Matcher m = route.getPattern().matcher(tiramisuRequest.getRequestUri());

			// If the URL pattern matches.
			if (m.matches()) {

				// If the HTTP method matches as well.
				if (route.getHttpMethods().contains(tiramisuRequest.getMethod())) {

					// Flag used to output a 404, because the route never
					// matched.
					matched = true;

					try {

						// Create the controller (constructor).
						Object controller = route.getController()
								.getDeclaredConstructor(TiramisuRequest.class, TiramisuResponse.class, Session.class)
								.newInstance(tiramisuRequest, tiramisuResponse, this.getSession());

						// Call the before method function callback here.
						controller.getClass().getMethod("beforeMethod", Route.class).invoke(controller, route);

						// Get the arguments.
						// Can't used named groups, have to loop through the
						// counts or its not generic.
						Object[] arguments = new String[m.groupCount()];
						for (int i = 0; i < m.groupCount(); i++) {
							arguments[i] = m.group(i + 1);
						}

						// Invoke the controller function.
						tiramisuResponse = (TiramisuResponse) route.getMethod().invoke(controller, arguments);

						// Call the after method function callback here.
						controller.getClass().getMethod("afterMethod").invoke(controller);

					} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException
							| IllegalArgumentException e) {
						e.printStackTrace();
					}
					// Innovation exception is the catch-all for inner
					// controller exceptions.
					// These are easily caught an handled here.
					catch (InvocationTargetException e) {
						Throwable cause = e.getCause();
						log.log(Level.SEVERE, cause.toString(), cause);
						if (cause instanceof BadRequestException) {
							log.severe("Bad request exception");
							tiramisuResponse.setStatusCode(400);
							tiramisuResponse.setTemplate("400.vm");
							tiramisuResponse.setPageTitle("400");
						}
						if (cause instanceof NotFoundException) {
							log.severe("Not found exception");
							tiramisuResponse.setStatusCode(404);
							tiramisuResponse.setTemplate("404.vm");
							tiramisuResponse.setPageTitle("404");
						}
					}
					break;
				}
			}
		}

		// Nothing matched any of the routes, 404.
		if (!matched) {
			tiramisuResponse.setStatusCode(404);
			tiramisuResponse.setTemplate("404.vm");
			tiramisuResponse.setPageTitle("404");
		}

		// Return the response.
		return tiramisuResponse;
	}

	public Session getSession() {
		return session;
	}

	public void setSession(Session session) {
		this.session = session;
	}

	public ArrayList<Route> getRoutes() {
		return routes;
	}

	public void setRoutes(ArrayList<Route> routes) {
		this.routes = routes;
	}

	public void addRoutes(ArrayList<Route> routes) {
		this.routes.addAll(routes);
	}

	public void addRoute(Route route) {
		this.routes.add(route);
	}

}

redpajama_set_name: RedPajamaGithub


text:
static CGFloat const kPlaceholderEdgeInset = 8.0f;
static CGFloat const kPlaceholderLeftEdgeInset = 5.0f;

@implementation YAPlaceHolderTextView

@synthesize placeholder = _placeholder;
@synthesize placeholderColor = _placeholderColor;

#pragma mark - init & setup
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupPlaceHolderTextView];
        [self setFont:[UIFont systemFontOfSize:12.0f]];
    }
    return self;
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self setupPlaceHolderTextView];
}

- (void)setupPlaceHolderTextView
{
    [self setPlaceholder:@""];
    [self setPlaceholderColor:[UIColor lightGrayColor]];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(textChanged:)
                                                 name:UITextViewTextDidChangeNotification
                                               object:nil];
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

#pragma mark - Layout
- (void)layoutSubviews
{
    [super layoutSubviews];
    if ([self.placeholder length] > 0 && [self.text length] == 0) {
        [[self _placeHolderLabel] setText:self.placeholder];

        if ([self respondsToSelector:@selector(textContainerInset)]) {
            [[self _placeHolderLabel]
                setFrame:CGRectMake(
                             kPlaceholderLeftEdgeInset + self.textContainerInset.left, self.textContainerInset.top,
                             self.bounds.size.width - self.textContainerInset.left + self.textContainerInset.right, 0)];
        } else {
            [[self _placeHolderLabel] setFrame:CGRectMake(kPlaceholderEdgeInset + self.contentInset.left,
                                                          kPlaceholderEdgeInset + self.contentInset.top,
                                                          self.bounds.size.width - 2 * kPlaceholderEdgeInset, 0)];
        }

        [[self _placeHolderLabel] sizeToFit];
        [[self _placeHolderLabel] setHidden:NO];
    } else {
        [[self _placeHolderLabel] setHidden:YES];
    }
}

#pragma mark - Prop
- (UILabel *)_placeHolderLabel
{
    if (!_placeHolderLabel) {
        _placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        [_placeHolderLabel setLineBreakMode:NSLineBreakByCharWrapping];
        [_placeHolderLabel setNumberOfLines:0];
        [_placeHolderLabel setBackgroundColor:[UIColor clearColor]];
        [_placeHolderLabel setFont:self.font];
        [_placeHolderLabel setTextColor:_placeholderColor];
        [_placeHolderLabel setHidden:YES];
        [self addSubview:_placeHolderLabel];
    }
    return _placeHolderLabel;
}

- (void)setText:(NSString *)text
{
    [super setText:text];
    [self textChanged:nil];
}

- (void)setPlaceholderColor:(UIColor *)placeholderColor
{
    _placeholderColor = placeholderColor;
    [[self _placeHolderLabel] setTextColor:placeholderColor];
}

- (void)setPlaceholder:(NSString *)placeholder
{
    _placeholder = placeholder;
    [self setNeedsLayout];
}

- (void)setFont:(UIFont *)font
{
    [super setFont:font];
    [[self _placeHolderLabel] setFont:font];
}

#pragma mark - Notification
- (void)textChanged:(NSNotification *)notification
{
    if ([self.placeholder length] == 0)
        return;

    if ([self.text length] == 0) {
        [[self _placeHolderLabel] setHidden:NO];
    } else {
        [[self _placeHolderLabel] setHidden:YES];
    }
    [self setNeedsLayout];
}

@end


text:
/* Definitions for the Lapack module.  Not intended for end-user use */

#ifndef R_LAPACK_MODULE_H
#define R_LAPACK_MODULE_H

#include <Rinternals.h>

typedef SEXP (*Rf_do_lapack)(SEXP, SEXP, SEXP, SEXP);

typedef struct {
    Rf_do_lapack do_lapack;
} R_LapackRoutines;

R_LapackRoutines *R_setLapackRoutines(R_LapackRoutines *routines);

#endif /* R_LAPACK_MODULE_H */


text:
<?xml version="1.0" encoding="UTF-8"?>

<decorators defaultdir="/WEB-INF/decorators">

    <excludes>
        <pattern>/static/*</pattern>
        <pattern>*decorator=none*</pattern>
        <pattern>*.rss</pattern>
        <pattern>*.csv</pattern>
        <pattern>*.txt</pattern>
    </excludes>

    <decorator name="default" page="default.ftl">
        <pattern>/*</pattern>
    </decorator>

</decorators>


text:
#ifndef STATEVAL_H
#define STATEVAL_H

/*!
 * stateval library include header
 */

#include "StateMachineAccessor.h"
#include "Variable.h"
#include "Widget.h"
#include "WidgetRenderer.h"

#endif // STATEVAL_H


text:
const { getImageColor } = require('../../utils.js');
const { MessageEmbed } = require('discord.js');
const rp = require('request-promise-native');
const { getGuildString } = require('../../locales.js');
const { googleAPIKey, googleSearchEngineID } =
  require('../../../credentials.json');
const logger = require('../../logger.js');

module.exports = {
  variants: ['googleimg', 'gi'],
  usage: 'googleimg 2 anime girl',
  async action(message, arg) {
    const l = getGuildString(message.guild);
    const result = /^(?:(\d*)\s+)?(.*)$/.exec(arg);
    const channel = message.channel;
    if (!result) {
      channel.send(l('no_query'));
      return;
    }
    const pending = channel.send(l('searching'));
    const [, number, query] = result;
    const options = {
      uri: 'https://www.googleapis.com/customsearch/v1',
      qs: {
        key: googleAPIKey,
        cx: googleSearchEngineID,
        q: query,
        searchType: 'image'
      },
      json: true
    }
    try {
      const { items } = await rp(options);
      if (!items) {
        const reply = await pending;
        reply.edit(l('not_found'));
        return;
      }
      const itemIndex = number ? Math.min(number - 1, items.length - 1) : 0;
      const image = items[itemIndex].link;
      const color = await getImageColor(image);
      const embed = new MessageEmbed()
        .setColor(color) //.setColor(0xFBBC05)
        .setImage(image);
      const reply = await pending;
      reply.edit({ embed });
    } catch (err) {
      logger.warn('Google search error:' + err);
      const reply = await pending;
      reply.edit(l('error'));
    }
  }
}


text:
package io.grpc.internal;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;

import io.grpc.CallOptions;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.Status;

import java.util.concurrent.Executor;

/**
 * A client transport that creates streams that will immediately fail when started.
 */
class FailingClientTransport implements ClientTransport {

  @VisibleForTesting
  final Status error;

  FailingClientTransport(Status error) {
    Preconditions.checkArgument(!error.isOk(), "error must not be OK");
    this.error = error;
  }

  @Override
  public ClientStream newStream(MethodDescriptor<?, ?> method, Metadata headers,
      CallOptions callOptions, StatsTraceContext statsTraceCtx) {
    return new FailingClientStream(error);
  }

  @Override
  public ClientStream newStream(MethodDescriptor<?, ?> method, Metadata headers) {
    return newStream(method, headers, CallOptions.DEFAULT, StatsTraceContext.NOOP);
  }

  @Override
  public void ping(final PingCallback callback, Executor executor) {
    executor.execute(new Runnable() {
        @Override public void run() {
          callback.onFailure(error.asException());
        }
      });
  }
}


text:
namespace Microsoft.Azure.Management.SecurityInsights
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Microsoft.Rest.Azure.OData;
    using Models;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// Extension methods for IncidentCommentsOperations.
    /// </summary>
    public static partial class IncidentCommentsOperationsExtensions
    {
            /// <summary>
            /// Gets all incident comments.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription. The name is
            /// case insensitive.
            /// </param>
            /// <param name='workspaceName'>
            /// The name of the workspace.
            /// </param>
            /// <param name='incidentId'>
            /// Incident ID
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            /// <param name='skipToken'>
            /// Skiptoken is only used if a previous operation returned a partial result.
            /// If a previous response contains a nextLink element, the value of the
            /// nextLink element will include a skiptoken parameter that specifies a
            /// starting point to use for subsequent calls. Optional.
            /// </param>
            public static IPage<IncidentComment> ListByIncident(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, ODataQuery<IncidentComment> odataQuery = default(ODataQuery<IncidentComment>), string skipToken = default(string))
            {
                return operations.ListByIncidentAsync(resourceGroupName, workspaceName, incidentId, odataQuery, skipToken).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets all incident comments.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription. The name is
            /// case insensitive.
            /// </param>
            /// <param name='workspaceName'>
            /// The name of the workspace.
            /// </param>
            /// <param name='incidentId'>
            /// Incident ID
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            /// <param name='skipToken'>
            /// Skiptoken is only used if a previous operation returned a partial result.
            /// If a previous response contains a nextLink element, the value of the
            /// nextLink element will include a skiptoken parameter that specifies a
            /// starting point to use for subsequent calls. Optional.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<IncidentComment>> ListByIncidentAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, ODataQuery<IncidentComment> odataQuery = default(ODataQuery<IncidentComment>), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListByIncidentWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets an incident comment.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription. The name is
            /// case insensitive.
            /// </param>
            /// <param name='workspaceName'>
            /// The name of the workspace.
            /// </param>
            /// <param name='incidentId'>
            /// Incident ID
            /// </param>
            /// <param name='incidentCommentId'>
            /// Incident comment ID
            /// </param>
            public static IncidentComment Get(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId)
            {
                return operations.GetAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets an incident comment.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription. The name is
            /// case insensitive.
            /// </param>
            /// <param name='workspaceName'>
            /// The name of the workspace.
            /// </param>
            /// <param name='incidentId'>
            /// Incident ID
            /// </param>
            /// <param name='incidentCommentId'>
            /// Incident comment ID
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IncidentComment> GetAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Creates the incident comment.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription. The name is
            /// case insensitive.
            /// </param>
            /// <param name='workspaceName'>
            /// The name of the workspace.
            /// </param>
            /// <param name='incidentId'>
            /// Incident ID
            /// </param>
            /// <param name='incidentCommentId'>
            /// Incident comment ID
            /// </param>
            /// <param name='message'>
            /// The comment message
            /// </param>
            public static IncidentComment CreateComment(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message)
            {
                return operations.CreateCommentAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, message).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Creates the incident comment.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription. The name is
            /// case insensitive.
            /// </param>
            /// <param name='workspaceName'>
            /// The name of the workspace.
            /// </param>
            /// <param name='incidentId'>
            /// Incident ID
            /// </param>
            /// <param name='incidentCommentId'>
            /// Incident comment ID
            /// </param>
            /// <param name='message'>
            /// The comment message
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IncidentComment> CreateCommentAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.CreateCommentWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, message, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets all incident comments.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            public static IPage<IncidentComment> ListByIncidentNext(this IIncidentCommentsOperations operations, string nextPageLink)
            {
                return operations.ListByIncidentNextAsync(nextPageLink).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets all incident comments.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<IncidentComment>> ListByIncidentNextAsync(this IIncidentCommentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListByIncidentNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

    }
}


text:
/**
* function createRequest
* @type XMLHttpRequest
* @memberOf Window
*/
Window.prototype.createRequest= function(){return new XMLHttpRequest();};
/**
* Object XMLHttpRequest
* @type constructor
*/
XMLHttpRequest.prototype=new Object();
function XMLHttpRequest(){};

/**
 * function onreadystatechange
 * @memberOf XMLHttpRequest
 */
XMLHttpRequest.prototype.onreadystatechange=function(){};
/**
 * property readyState
 * @type Number
 * @memberOf XMLHttpRequest
 */
XMLHttpRequest.prototype.readyState=0;
/**
 * property responseText
 * @type String
 * @memberOf XMLHttpRequest
 */
XMLHttpRequest.prototype.responseText="";
/**
 * property responseXML
 * @type Document
 * @memberOf XMLHttpRequest
 */
XMLHttpRequest.prototype.responseXML=new Document();
/**
 * property status
 * @type Number
 * @memberOf XMLHttpRequest
 */
XMLHttpRequest.prototype.status=0;
/**
 * property statusText
 * @type String
 * @memberOf XMLHttpRequest
 */
XMLHttpRequest.prototype.statusText="";
/**
 * function abort()
 * @memberOf XMLHttpRequest
 */
XMLHttpRequest.prototype.abort=function(){};
/**
* function getAllResponseHeaders()
* @type String
* @memberOf XMLHttpRequest
*/
XMLHttpRequest.prototype.getAllResponseHeaders=function(){return "";};
/**
* function open(method, url, async, username, password)
* @param {String} method
* @param {String} url
* @param {Boolean} optional async
* @param {String} optional username
* @param {String} optional password
* @memberOf XMLHttpRequest
*/
XMLHttpRequest.prototype.open=function(method, url, async, username, password){};
/**
* function send(body)
* @param {Object} body
* @memberOf XMLHttpRequest
*/
XMLHttpRequest.prototype.send=function(body){};
/**
* function setRequestHeader(header,value)
* @param {String} header
* @param {String} value
* @memberOf XMLHttpRequest
*/
XMLHttpRequest.prototype.setRequestHeader=function(header,value){};
/**
* function getAllResponseHeaders()
* @param {String} header
* @type String
* @memberOf XMLHttpRequest
*/
XMLHttpRequest.prototype.getResponseHeader=function(header){return "";};


text:
<?php

/**
 * RfSlideshow form base class.
 *
 * @method RfSlideshow getObject() Returns the current form's model object
 *
 * @package    runforever
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseRfSlideshowForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'slideshow_title' => new sfWidgetFormInputText(),
      'intro_text'      => new sfWidgetFormTextarea(),
      'cover_img_url'   => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'slideshow_title' => new sfValidatorString(array('max_length' => 250)),
      'intro_text'      => new sfValidatorString(),
      'cover_img_url'   => new sfValidatorString(array('max_length' => 250)),
    ));

    $this->widgetSchema->setNameFormat('rf_slideshow[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'RfSlideshow';
  }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OTFN.Core.Endpoints
{
    public interface IControllerInterface
    {
        int OnInitialize();
        int OnFinalize();
    }
}


text:
package laol.generate.cxx;

import java.io.PrintStream;
import java.util.Objects;

/**
 *
 * @author gburdell
 */
public class ReturnStatement {

    public static void process(final laol.ast.ReturnStatement item, final Context ctx) {
        final PrintStream os = ctx.cxx();
        final laol.ast.Expression expr = item.getExpr();
        if (item.hasStmtModifier()) {
            StatementModifier.process(
                    item.getStmtModifier(),
                    ctx, __->process(os, expr, ctx)
            );
        } else if (item.isAssignStmt()) {
            os.print("return (");
            AssignStatement.process(item.getAssignStmt(), ctx);
            os.println(");");
        } else {
            process(os, expr, ctx);
        }
    }

    private static void process(final PrintStream os, final laol.ast.Expression expr, final Context ctx) {
        os.print("return ");
        if (Objects.nonNull(expr)) {
            Expression.process(expr, ctx);
        }
        os.println(" ;");
    }
}


text:
/*
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 */

/*
 * Copyright (C) 2004 Amit S. Kale <amitkale@linsyssoft.com>
 * Copyright (C) 2000-2001 VERITAS Software Corporation.
 * Copyright (C) 2002 Andi Kleen, SuSE Labs
 * Copyright (C) 2004 LinSysSoft Technologies Pvt. Ltd.
 * Copyright (C) 2007 MontaVista Software, Inc.
 * Copyright (C) 2007-2008 Jason Wessel, Wind River Systems, Inc.
 */
/****************************************************************************
 *  Contributor:     Lake Stevens Instrument Division$
 *  Written by:      Glenn Engel $
 *  Updated by:	     Amit Kale<akale@veritas.com>
 *  Updated by:	     Tom Rini <trini@kernel.crashing.org>
 *  Updated by:	     Jason Wessel <jason.wessel@windriver.com>
 *  Modified for 386 by Jim Kingdon, Cygnus Support.
 *  Origianl kgdb, compatibility with 2.1.xx kernel by
 *  David Grothe <dave@gcom.com>
 *  Integrated into 2.2.5 kernel by Tigran Aivazian <tigran@sco.com>
 *  X86_64 changes from Andi Kleen's patch merged by Jim Houston
 */
#include <linux/spinlock.h>
#include <linux/kdebug.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/kgdb.h>
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/nmi.h>
#include <linux/hw_breakpoint.h>
#include <linux/uaccess.h>
#include <linux/memory.h>

#include <asm/debugreg.h>
#include <asm/apicdef.h>
#include <asm/apic.h>
#include <asm/nmi.h>

struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
{
#ifdef CONFIG_X86_32
	{ "ax", 4, offsetof(struct pt_regs, ax) },
	{ "cx", 4, offsetof(struct pt_regs, cx) },
	{ "dx", 4, offsetof(struct pt_regs, dx) },
	{ "bx", 4, offsetof(struct pt_regs, bx) },
	{ "sp", 4, offsetof(struct pt_regs, sp) },
	{ "bp", 4, offsetof(struct pt_regs, bp) },
	{ "si", 4, offsetof(struct pt_regs, si) },
	{ "di", 4, offsetof(struct pt_regs, di) },
	{ "ip", 4, offsetof(struct pt_regs, ip) },
	{ "flags", 4, offsetof(struct pt_regs, flags) },
	{ "cs", 4, offsetof(struct pt_regs, cs) },
	{ "ss", 4, offsetof(struct pt_regs, ss) },
	{ "ds", 4, offsetof(struct pt_regs, ds) },
	{ "es", 4, offsetof(struct pt_regs, es) },
#else
	{ "ax", 8, offsetof(struct pt_regs, ax) },
	{ "bx", 8, offsetof(struct pt_regs, bx) },
	{ "cx", 8, offsetof(struct pt_regs, cx) },
	{ "dx", 8, offsetof(struct pt_regs, dx) },
	{ "si", 8, offsetof(struct pt_regs, dx) },
	{ "di", 8, offsetof(struct pt_regs, di) },
	{ "bp", 8, offsetof(struct pt_regs, bp) },
	{ "sp", 8, offsetof(struct pt_regs, sp) },
	{ "r8", 8, offsetof(struct pt_regs, r8) },
	{ "r9", 8, offsetof(struct pt_regs, r9) },
	{ "r10", 8, offsetof(struct pt_regs, r10) },
	{ "r11", 8, offsetof(struct pt_regs, r11) },
	{ "r12", 8, offsetof(struct pt_regs, r12) },
	{ "r13", 8, offsetof(struct pt_regs, r13) },
	{ "r14", 8, offsetof(struct pt_regs, r14) },
	{ "r15", 8, offsetof(struct pt_regs, r15) },
	{ "ip", 8, offsetof(struct pt_regs, ip) },
	{ "flags", 4, offsetof(struct pt_regs, flags) },
	{ "cs", 4, offsetof(struct pt_regs, cs) },
	{ "ss", 4, offsetof(struct pt_regs, ss) },
	{ "ds", 4, -1 },
	{ "es", 4, -1 },
#endif
	{ "fs", 4, -1 },
	{ "gs", 4, -1 },
};

int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
{
	if (
#ifdef CONFIG_X86_32
	    regno == GDB_SS || regno == GDB_FS || regno == GDB_GS ||
#endif
	    regno == GDB_SP || regno == GDB_ORIG_AX)
		return 0;

	if (dbg_reg_def[regno].offset != -1)
		memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
		       dbg_reg_def[regno].size);
	return 0;
}

char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
{
	if (regno == GDB_ORIG_AX) {
		memcpy(mem, &regs->orig_ax, sizeof(regs->orig_ax));
		return "orig_ax";
	}
	if (regno >= DBG_MAX_REG_NUM || regno < 0)
		return NULL;

	if (dbg_reg_def[regno].offset != -1)
		memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
		       dbg_reg_def[regno].size);

#ifdef CONFIG_X86_32
	switch (regno) {
	case GDB_SS:
		if (!user_mode_vm(regs))
			*(unsigned long *)mem = __KERNEL_DS;
		break;
	case GDB_SP:
		if (!user_mode_vm(regs))
			*(unsigned long *)mem = kernel_stack_pointer(regs);
		break;
	case GDB_GS:
	case GDB_FS:
		*(unsigned long *)mem = 0xFFFF;
		break;
	}
#endif
	return dbg_reg_def[regno].name;
}

/**
 *	sleeping_thread_to_gdb_regs - Convert ptrace regs to GDB regs
 *	@gdb_regs: A pointer to hold the registers in the order GDB wants.
 *	@p: The &struct task_struct of the desired process.
 *
 *	Convert the register values of the sleeping process in @p to
 *	the format that GDB expects.
 *	This function is called when kgdb does not have access to the
 *	&struct pt_regs and therefore it should fill the gdb registers
 *	@gdb_regs with what has	been saved in &struct thread_struct
 *	thread field during switch_to.
 */
void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
{
#ifndef CONFIG_X86_32
	u32 *gdb_regs32 = (u32 *)gdb_regs;
#endif
	gdb_regs[GDB_AX]	= 0;
	gdb_regs[GDB_BX]	= 0;
	gdb_regs[GDB_CX]	= 0;
	gdb_regs[GDB_DX]	= 0;
	gdb_regs[GDB_SI]	= 0;
	gdb_regs[GDB_DI]	= 0;
	gdb_regs[GDB_BP]	= *(unsigned long *)p->thread.sp;
#ifdef CONFIG_X86_32
	gdb_regs[GDB_DS]	= __KERNEL_DS;
	gdb_regs[GDB_ES]	= __KERNEL_DS;
	gdb_regs[GDB_PS]	= 0;
	gdb_regs[GDB_CS]	= __KERNEL_CS;
	gdb_regs[GDB_PC]	= p->thread.ip;
	gdb_regs[GDB_SS]	= __KERNEL_DS;
	gdb_regs[GDB_FS]	= 0xFFFF;
	gdb_regs[GDB_GS]	= 0xFFFF;
#else
	gdb_regs32[GDB_PS]	= *(unsigned long *)(p->thread.sp + 8);
	gdb_regs32[GDB_CS]	= __KERNEL_CS;
	gdb_regs32[GDB_SS]	= __KERNEL_DS;
	gdb_regs[GDB_PC]	= 0;
	gdb_regs[GDB_R8]	= 0;
	gdb_regs[GDB_R9]	= 0;
	gdb_regs[GDB_R10]	= 0;
	gdb_regs[GDB_R11]	= 0;
	gdb_regs[GDB_R12]	= 0;
	gdb_regs[GDB_R13]	= 0;
	gdb_regs[GDB_R14]	= 0;
	gdb_regs[GDB_R15]	= 0;
#endif
	gdb_regs[GDB_SP]	= p->thread.sp;
}

static struct hw_breakpoint {
	unsigned		enabled;
	unsigned long		addr;
	int			len;
	int			type;
	struct perf_event	* __percpu *pev;
} breakinfo[HBP_NUM];

static unsigned long early_dr7;

static void kgdb_correct_hw_break(void)
{
	int breakno;

	for (breakno = 0; breakno < HBP_NUM; breakno++) {
		struct perf_event *bp;
		struct arch_hw_breakpoint *info;
		int val;
		int cpu = raw_smp_processor_id();
		if (!breakinfo[breakno].enabled)
			continue;
		if (dbg_is_early) {
			set_debugreg(breakinfo[breakno].addr, breakno);
			early_dr7 |= encode_dr7(breakno,
						breakinfo[breakno].len,
						breakinfo[breakno].type);
			set_debugreg(early_dr7, 7);
			continue;
		}
		bp = *per_cpu_ptr(breakinfo[breakno].pev, cpu);
		info = counter_arch_bp(bp);
		if (bp->attr.disabled != 1)
			continue;
		bp->attr.bp_addr = breakinfo[breakno].addr;
		bp->attr.bp_len = breakinfo[breakno].len;
		bp->attr.bp_type = breakinfo[breakno].type;
		info->address = breakinfo[breakno].addr;
		info->len = breakinfo[breakno].len;
		info->type = breakinfo[breakno].type;
		val = arch_install_hw_breakpoint(bp);
		if (!val)
			bp->attr.disabled = 0;
	}
	if (!dbg_is_early)
		hw_breakpoint_restore();
}

static int hw_break_reserve_slot(int breakno)
{
	int cpu;
	int cnt = 0;
	struct perf_event **pevent;

	if (dbg_is_early)
		return 0;

	for_each_online_cpu(cpu) {
		cnt++;
		pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu);
		if (dbg_reserve_bp_slot(*pevent))
			goto fail;
	}

	return 0;

fail:
	for_each_online_cpu(cpu) {
		cnt--;
		if (!cnt)
			break;
		pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu);
		dbg_release_bp_slot(*pevent);
	}
	return -1;
}

static int hw_break_release_slot(int breakno)
{
	struct perf_event **pevent;
	int cpu;

	if (dbg_is_early)
		return 0;

	for_each_online_cpu(cpu) {
		pevent = per_cpu_ptr(breakinfo[breakno].pev, cpu);
		if (dbg_release_bp_slot(*pevent))
			/*
			 * The debugger is responsible for handing the retry on
			 * remove failure.
			 */
			return -1;
	}
	return 0;
}

static int
kgdb_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
{
	int i;

	for (i = 0; i < HBP_NUM; i++)
		if (breakinfo[i].addr == addr && breakinfo[i].enabled)
			break;
	if (i == HBP_NUM)
		return -1;

	if (hw_break_release_slot(i)) {
		printk(KERN_ERR "Cannot remove hw breakpoint at %lx\n", addr);
		return -1;
	}
	breakinfo[i].enabled = 0;

	return 0;
}

static void kgdb_remove_all_hw_break(void)
{
	int i;
	int cpu = raw_smp_processor_id();
	struct perf_event *bp;

	for (i = 0; i < HBP_NUM; i++) {
		if (!breakinfo[i].enabled)
			continue;
		bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
		if (!bp->attr.disabled) {
			arch_uninstall_hw_breakpoint(bp);
			bp->attr.disabled = 1;
			continue;
		}
		if (dbg_is_early)
			early_dr7 &= ~encode_dr7(i, breakinfo[i].len,
						 breakinfo[i].type);
		else if (hw_break_release_slot(i))
			printk(KERN_ERR "KGDB: hw bpt remove failed %lx\n",
			       breakinfo[i].addr);
		breakinfo[i].enabled = 0;
	}
}

static int
kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
{
	int i;

	for (i = 0; i < HBP_NUM; i++)
		if (!breakinfo[i].enabled)
			break;
	if (i == HBP_NUM)
		return -1;

	switch (bptype) {
	case BP_HARDWARE_BREAKPOINT:
		len = 1;
		breakinfo[i].type = X86_BREAKPOINT_EXECUTE;
		break;
	case BP_WRITE_WATCHPOINT:
		breakinfo[i].type = X86_BREAKPOINT_WRITE;
		break;
	case BP_ACCESS_WATCHPOINT:
		breakinfo[i].type = X86_BREAKPOINT_RW;
		break;
	default:
		return -1;
	}
	switch (len) {
	case 1:
		breakinfo[i].len = X86_BREAKPOINT_LEN_1;
		break;
	case 2:
		breakinfo[i].len = X86_BREAKPOINT_LEN_2;
		break;
	case 4:
		breakinfo[i].len = X86_BREAKPOINT_LEN_4;
		break;
#ifdef CONFIG_X86_64
	case 8:
		breakinfo[i].len = X86_BREAKPOINT_LEN_8;
		break;
#endif
	default:
		return -1;
	}
	breakinfo[i].addr = addr;
	if (hw_break_reserve_slot(i)) {
		breakinfo[i].addr = 0;
		return -1;
	}
	breakinfo[i].enabled = 1;

	return 0;
}

/**
 *	kgdb_disable_hw_debug - Disable hardware debugging while we in kgdb.
 *	@regs: Current &struct pt_regs.
 *
 *	This function will be called if the particular architecture must
 *	disable hardware debugging while it is processing gdb packets or
 *	handling exception.
 */
static void kgdb_disable_hw_debug(struct pt_regs *regs)
{
	int i;
	int cpu = raw_smp_processor_id();
	struct perf_event *bp;

	/* Disable hardware debugging while we are in kgdb: */
	set_debugreg(0UL, 7);
	for (i = 0; i < HBP_NUM; i++) {
		if (!breakinfo[i].enabled)
			continue;
		if (dbg_is_early) {
			early_dr7 &= ~encode_dr7(i, breakinfo[i].len,
						 breakinfo[i].type);
			continue;
		}
		bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
		if (bp->attr.disabled == 1)
			continue;
		arch_uninstall_hw_breakpoint(bp);
		bp->attr.disabled = 1;
	}
}

#ifdef CONFIG_SMP
/**
 *	kgdb_roundup_cpus - Get other CPUs into a holding pattern
 *	@flags: Current IRQ state
 *
 *	On SMP systems, we need to get the attention of the other CPUs
 *	and get them be in a known state.  This should do what is needed
 *	to get the other CPUs to call kgdb_wait(). Note that on some arches,
 *	the NMI approach is not used for rounding up all the CPUs. For example,
 *	in case of MIPS, smp_call_function() is used to roundup CPUs. In
 *	this case, we have to make sure that interrupts are enabled before
 *	calling smp_call_function(). The argument to this function is
 *	the flags that will be used when restoring the interrupts. There is
 *	local_irq_save() call before kgdb_roundup_cpus().
 *
 *	On non-SMP systems, this is not called.
 */
void kgdb_roundup_cpus(unsigned long flags)
{
	apic->send_IPI_allbutself(APIC_DM_NMI);
}
#endif

/**
 *	kgdb_arch_handle_exception - Handle architecture specific GDB packets.
 *	@vector: The error vector of the exception that happened.
 *	@signo: The signal number of the exception that happened.
 *	@err_code: The error code of the exception that happened.
 *	@remcom_in_buffer: The buffer of the packet we have read.
 *	@remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into.
 *	@regs: The &struct pt_regs of the current process.
 *
 *	This function MUST handle the 'c' and 's' command packets,
 *	as well packets to set / remove a hardware breakpoint, if used.
 *	If there are additional packets which the hardware needs to handle,
 *	they are handled here.  The code should return -1 if it wants to
 *	process more packets, and a %0 or %1 if it wants to exit from the
 *	kgdb callback.
 */
int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
			       char *remcomInBuffer, char *remcomOutBuffer,
			       struct pt_regs *linux_regs)
{
	unsigned long addr;
	char *ptr;

	switch (remcomInBuffer[0]) {
	case 'c':
	case 's':
		/* try to read optional parameter, pc unchanged if no parm */
		ptr = &remcomInBuffer[1];
		if (kgdb_hex2long(&ptr, &addr))
			linux_regs->ip = addr;
	case 'D':
	case 'k':
		/* clear the trace bit */
		linux_regs->flags &= ~X86_EFLAGS_TF;
		atomic_set(&kgdb_cpu_doing_single_step, -1);

		/* set the trace bit if we're stepping */
		if (remcomInBuffer[0] == 's') {
			linux_regs->flags |= X86_EFLAGS_TF;
			atomic_set(&kgdb_cpu_doing_single_step,
				   raw_smp_processor_id());
		}

		return 0;
	}

	/* this means that we do not want to exit from the handler: */
	return -1;
}

static inline int
single_step_cont(struct pt_regs *regs, struct die_args *args)
{
	/*
	 * Single step exception from kernel space to user space so
	 * eat the exception and continue the process:
	 */
	printk(KERN_ERR "KGDB: trap/step from kernel to user space, "
			"resuming...\n");
	kgdb_arch_handle_exception(args->trapnr, args->signr,
				   args->err, "c", "", regs);
	/*
	 * Reset the BS bit in dr6 (pointed by args->err) to
	 * denote completion of processing
	 */
	(*(unsigned long *)ERR_PTR(args->err)) &= ~DR_STEP;

	return NOTIFY_STOP;
}

static int was_in_debug_nmi[NR_CPUS];

static int kgdb_nmi_handler(unsigned int cmd, struct pt_regs *regs)
{
	switch (cmd) {
	case NMI_LOCAL:
		if (atomic_read(&kgdb_active) != -1) {
			/* KGDB CPU roundup */
			kgdb_nmicallback(raw_smp_processor_id(), regs);
			was_in_debug_nmi[raw_smp_processor_id()] = 1;
			touch_nmi_watchdog();
			return NMI_HANDLED;
		}
		break;

	case NMI_UNKNOWN:
		if (was_in_debug_nmi[raw_smp_processor_id()]) {
			was_in_debug_nmi[raw_smp_processor_id()] = 0;
			return NMI_HANDLED;
		}
		break;
	default:
		/* do nothing */
		break;
	}
	return NMI_DONE;
}

static int __kgdb_notify(struct die_args *args, unsigned long cmd)
{
	struct pt_regs *regs = args->regs;

	switch (cmd) {
	case DIE_DEBUG:
		if (atomic_read(&kgdb_cpu_doing_single_step) != -1) {
			if (user_mode(regs))
				return single_step_cont(regs, args);
			break;
		} else if (test_thread_flag(TIF_SINGLESTEP))
			/* This means a user thread is single stepping
			 * a system call which should be ignored
			 */
			return NOTIFY_DONE;
		/* fall through */
	default:
		if (user_mode(regs))
			return NOTIFY_DONE;
	}

	if (kgdb_handle_exception(args->trapnr, args->signr, cmd, regs))
		return NOTIFY_DONE;

	/* Must touch watchdog before return to normal operation */
	touch_nmi_watchdog();
	return NOTIFY_STOP;
}

int kgdb_ll_trap(int cmd, const char *str,
		 struct pt_regs *regs, long err, int trap, int sig)
{
	struct die_args args = {
		.regs	= regs,
		.str	= str,
		.err	= err,
		.trapnr	= trap,
		.signr	= sig,

	};

	if (!kgdb_io_module_registered)
		return NOTIFY_DONE;

	return __kgdb_notify(&args, cmd);
}

static int
kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
{
	unsigned long flags;
	int ret;

	local_irq_save(flags);
	ret = __kgdb_notify(ptr, cmd);
	local_irq_restore(flags);

	return ret;
}

static struct notifier_block kgdb_notifier = {
	.notifier_call	= kgdb_notify,
};

/**
 *	kgdb_arch_init - Perform any architecture specific initalization.
 *
 *	This function will handle the initalization of any architecture
 *	specific callbacks.
 */
int kgdb_arch_init(void)
{
	int retval;

	retval = register_die_notifier(&kgdb_notifier);
	if (retval)
		goto out;

	retval = register_nmi_handler(NMI_LOCAL, kgdb_nmi_handler,
					0, "kgdb");
	if (retval)
		goto out1;

	retval = register_nmi_handler(NMI_UNKNOWN, kgdb_nmi_handler,
					0, "kgdb");

	if (retval)
		goto out2;

	return retval;

out2:
	unregister_nmi_handler(NMI_LOCAL, "kgdb");
out1:
	unregister_die_notifier(&kgdb_notifier);
out:
	return retval;
}

static void kgdb_hw_overflow_handler(struct perf_event *event,
		struct perf_sample_data *data, struct pt_regs *regs)
{
	struct task_struct *tsk = current;
	int i;

	for (i = 0; i < 4; i++)
		if (breakinfo[i].enabled)
			tsk->thread.debugreg6 |= (DR_TRAP0 << i);
}

void kgdb_arch_late(void)
{
	int i, cpu;
	struct perf_event_attr attr;
	struct perf_event **pevent;

	/*
	 * Pre-allocate the hw breakpoint structions in the non-atomic
	 * portion of kgdb because this operation requires mutexs to
	 * complete.
	 */
	hw_breakpoint_init(&attr);
	attr.bp_addr = (unsigned long)kgdb_arch_init;
	attr.bp_len = HW_BREAKPOINT_LEN_1;
	attr.bp_type = HW_BREAKPOINT_W;
	attr.disabled = 1;
	for (i = 0; i < HBP_NUM; i++) {
		if (breakinfo[i].pev)
			continue;
		breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL, NULL);
		if (IS_ERR((void * __force)breakinfo[i].pev)) {
			printk(KERN_ERR "kgdb: Could not allocate hw"
			       "breakpoints\nDisabling the kernel debugger\n");
			breakinfo[i].pev = NULL;
			kgdb_arch_exit();
			return;
		}
		for_each_online_cpu(cpu) {
			pevent = per_cpu_ptr(breakinfo[i].pev, cpu);
			pevent[0]->hw.sample_period = 1;
			pevent[0]->overflow_handler = kgdb_hw_overflow_handler;
			if (pevent[0]->destroy != NULL) {
				pevent[0]->destroy = NULL;
				release_bp_slot(*pevent);
			}
		}
	}
}

/**
 *	kgdb_arch_exit - Perform any architecture specific uninitalization.
 *
 *	This function will handle the uninitalization of any architecture
 *	specific callbacks, for dynamic registration and unregistration.
 */
void kgdb_arch_exit(void)
{
	int i;
	for (i = 0; i < 4; i++) {
		if (breakinfo[i].pev) {
			unregister_wide_hw_breakpoint(breakinfo[i].pev);
			breakinfo[i].pev = NULL;
		}
	}
	unregister_nmi_handler(NMI_UNKNOWN, "kgdb");
	unregister_nmi_handler(NMI_LOCAL, "kgdb");
	unregister_die_notifier(&kgdb_notifier);
}

/**
 *
 *	kgdb_skipexception - Bail out of KGDB when we've been triggered.
 *	@exception: Exception vector number
 *	@regs: Current &struct pt_regs.
 *
 *	On some architectures we need to skip a breakpoint exception when
 *	it occurs after a breakpoint has been removed.
 *
 * Skip an int3 exception when it occurs after a breakpoint has been
 * removed. Backtrack eip by 1 since the int3 would have caused it to
 * increment by 1.
 */
int kgdb_skipexception(int exception, struct pt_regs *regs)
{
	if (exception == 3 && kgdb_isremovedbreak(regs->ip - 1)) {
		regs->ip -= 1;
		return 1;
	}
	return 0;
}

unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs)
{
	if (exception == 3)
		return instruction_pointer(regs) - 1;
	return instruction_pointer(regs);
}

void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
{
	regs->ip = ip;
}

int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
{
	int err;
	char opc[BREAK_INSTR_SIZE];

	bpt->type = BP_BREAKPOINT;
	err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr,
				BREAK_INSTR_SIZE);
	if (err)
		return err;
	err = probe_kernel_write((char *)bpt->bpt_addr,
				 arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE);
#ifdef CONFIG_DEBUG_RODATA
	if (!err)
		return err;
	/*
	 * It is safe to call text_poke() because normal kernel execution
	 * is stopped on all cores, so long as the text_mutex is not locked.
	 */
	if (mutex_is_locked(&text_mutex))
		return -EBUSY;
	text_poke((void *)bpt->bpt_addr, arch_kgdb_ops.gdb_bpt_instr,
		  BREAK_INSTR_SIZE);
	err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE);
	if (err)
		return err;
	if (memcmp(opc, arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE))
		return -EINVAL;
	bpt->type = BP_POKE_BREAKPOINT;
#endif /* CONFIG_DEBUG_RODATA */
	return err;
}

int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt)
{
#ifdef CONFIG_DEBUG_RODATA
	int err;
	char opc[BREAK_INSTR_SIZE];

	if (bpt->type != BP_POKE_BREAKPOINT)
		goto knl_write;
	/*
	 * It is safe to call text_poke() because normal kernel execution
	 * is stopped on all cores, so long as the text_mutex is not locked.
	 */
	if (mutex_is_locked(&text_mutex))
		goto knl_write;
	text_poke((void *)bpt->bpt_addr, bpt->saved_instr, BREAK_INSTR_SIZE);
	err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE);
	if (err || memcmp(opc, bpt->saved_instr, BREAK_INSTR_SIZE))
		goto knl_write;
	return err;
knl_write:
#endif /* CONFIG_DEBUG_RODATA */
	return probe_kernel_write((char *)bpt->bpt_addr,
				  (char *)bpt->saved_instr, BREAK_INSTR_SIZE);
}

struct kgdb_arch arch_kgdb_ops = {
	/* Breakpoint instruction: */
	.gdb_bpt_instr		= { 0xcc },
	.flags			= KGDB_HW_BREAKPOINT,
	.set_hw_breakpoint	= kgdb_set_hw_break,
	.remove_hw_breakpoint	= kgdb_remove_hw_break,
	.disable_hw_break	= kgdb_disable_hw_debug,
	.remove_all_hw_break	= kgdb_remove_all_hw_break,
	.correct_hw_break	= kgdb_correct_hw_break,
};


text:
package try4j.examples;

import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

public class NicsWithoutTryNoConsoleOutput {
  private static final Logger logger = Logger.getLogger(NicsWithoutTryNoConsoleOutput.class.getName());

  public static void main(String[] args) {
    try {
      List<NetworkInterface> nics = Collections
          .list(NetworkInterface.getNetworkInterfaces()).stream()
          .filter(n -> {
            try {
              return n.supportsMulticast() && n.isUp();
            } catch (SocketException e) {
              logger.log(Level.SEVERE, null, e);
              return false;
            }
          })
          .collect(Collectors.toList());

      // do something with nics
    } catch (SocketException e) {
      logger.log(Level.SEVERE, null, e);
    }
  }
}


text:
import { Range, Position, TextEditor, TextEditorEdit } from 'vscode';
import svgo = require('svgo');

export function svgMinify(textEditor: TextEditor, edit: TextEditorEdit) {
    let optimizer = new svgo({});
    let document = textEditor.document;

    //return new Promise((resolve, reject) => {
        optimizer.optimize(document.getText()).then((result) => {
            let range = new Range(new Position(0, 0), document.lineAt(document.lineCount - 1).range.end)
            textEditor.edit(e=>{
                e.replace(range, result.data);
            });
        });
    //});
}


text:
<LINK REL="stylesheet" HREF="../static/styles.css">

<TITLE>Channel::setDSPIndex</TITLE>

Firelight Technologies FMOD Studio API

Channel::setDSPIndex

Moves the position in the DSP chain of a specified DSP unit.

C++ Syntax

FMOD_RESULT Channel::setDSPIndex(
  DSP *dsp,
  int index
);

C Syntax

FMOD_RESULT FMOD_Channel_SetDSPIndex(
  FMOD_CHANNEL *channel,
  FMOD_DSP *dsp,
  int index
);

C# Syntax

RESULT Channel.setDSPIndex(
  DSP dsp,
  int index
);

Parameters

dsp

Pointer to a DSP unit that exists in the DSP chain.

index

Offset in the DSP chain to move the DSP to, see FMOD_CHANNELCONTROL_DSP_INDEX for special named offsets.

Return Values

If the function succeeds then the return value is FMOD_OK.

If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.

Remarks

This function is useful for reordering DSP units inside a Channel or ChannelGroup so that processing can happen in the desired order.

You can verify the order of the DSP chain using iteration via ChannelControl::getNumDSPs and ChannelControl::getDSP or with the FMOD Profiler tool.

See Also

ChannelControl::getDSPIndex

ChannelControl::getNumDSPs

ChannelControl::getDSP

FMOD_CHANNELCONTROL_DSP_INDEX

Version 1.08.02 Built on Apr 14, 2016


text:
package shorty

import org.easymock.EasyMock._
import org.easymock.EasyMock

import javax.servlet.http._

class TestMethodParser extends BaseTest {

  describe("MethodParser") {
    it ("should be properly parse") {
      testParsing("POST",POST)
      testParsing("GET",GET)
      testParsing("PUT",PUT)
      testParsing("DELETE",DELETE)
    }
    it ("should be case insensitive") {
      val request = createMock(classOf[HttpServletRequest])
      val parser = new AnyRef with MethodParser

      EasyMock.expect(request.getMethod()).andReturn("POST")
      EasyMock.expect(request.getHeader(parser.METHOD_HEADER)).andReturn(null)
      EasyMock.expect(request.getParameter(parser.METHOD_PARAM)).andReturn(null)
      replay(request)

      val method = parser.determineMethod(request)
      method should equal (POST)
    }

    it ("should be favor the header over the method") {
      val request = createMock(classOf[HttpServletRequest])
      val parser = new AnyRef with MethodParser

      EasyMock.expect(request.getMethod()).andReturn("POST")
      EasyMock.expect(request.getHeader(parser.METHOD_HEADER)).andReturn("delete")
      EasyMock.expect(request.getHeader(parser.METHOD_HEADER)).andReturn("delete")
      EasyMock.expect(request.getParameter(parser.METHOD_PARAM)).andReturn(null)
      replay(request)

      val method = parser.determineMethod(request)
      method should equal (DELETE)
    }

    it ("should be favor the param over the method") {
      val request = createMock(classOf[HttpServletRequest])
      val parser = new AnyRef with MethodParser

      EasyMock.expect(request.getMethod()).andReturn("POST")
      EasyMock.expect(request.getHeader(parser.METHOD_HEADER)).andReturn(null)
      EasyMock.expect(request.getParameter(parser.METHOD_PARAM)).andReturn("put")
      EasyMock.expect(request.getParameter(parser.METHOD_PARAM)).andReturn("put")
      replay(request)

      val method = parser.determineMethod(request)
      method should equal (PUT)
    }

    it ("should be favor the param over both") {
      val request = createMock(classOf[HttpServletRequest])
      val parser = new AnyRef with MethodParser

      EasyMock.expect(request.getMethod()).andReturn("POST")
      EasyMock.expect(request.getHeader(parser.METHOD_HEADER)).andReturn("delete")
      EasyMock.expect(request.getHeader(parser.METHOD_HEADER)).andReturn("delete")
      EasyMock.expect(request.getParameter(parser.METHOD_PARAM)).andReturn("put")
      EasyMock.expect(request.getParameter(parser.METHOD_PARAM)).andReturn("put")
      replay(request)

      val method = parser.determineMethod(request)
      method should equal (PUT)
    }
  }

  private def testParsing(methodString:String,methodObject:HTTPMethod) = {

    val request = createMock(classOf[HttpServletRequest])
    val parser = new AnyRef with MethodParser

    EasyMock.expect(request.getMethod()).andReturn(methodString)
    EasyMock.expect(request.getHeader(parser.METHOD_HEADER)).andReturn(null)
    EasyMock.expect(request.getParameter(parser.METHOD_PARAM)).andReturn(null)
    replay(request)

    val method = parser.determineMethod(request)
    method should equal (methodObject)
  }
}


text:
package com.plugtree.dm.proj;

import org.kie.api.runtime.process.WorkItem;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.api.runtime.process.WorkItemManager;

public class TestAsyncWorkItemHandler implements WorkItemHandler {

	private WorkItem workItem;

	public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
		this.workItem = workItem;
	}

	public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
		this.workItem = null;
	}

	public WorkItem getWorkItem() {
		WorkItem retval = workItem;
		workItem = null;
		return retval;
	}
}


text:
from .agendadiaria import AgendaDiaria
from .analisis import Analisis
from .cupo import Cupo
from .documento import Documento
from .empleado import Empleado
from .telefono import Telefono
from .fichapaciente import FichaPaciente
from .institucionmedica import InstitucionMedica
from .laboratorioexterno import LaboratorioExterno
from .reserva_analisis import ReservaAnalisis
from .sucursal import Sucursal
from .tipoanalisis import TipoAnalisis
from .ubicacion_geografica import UbicacionGeografica
from .paciente import Paciente

class Creador(object):
    """
    Clase encargada de crear cada uno de los objetos de la capa de negocio.

    Note:
        Suministra los métodos necesarios para crear.
        Debe ser invocada de forma estática.

    Args:
        Ninguno

    Attributes:
        Ninguno
    """

    @staticmethod
    def agendadiaria(**kwargs):
        return AgendaDiaria()

    @staticmethod
    def analisis(**kwargs):
        return Analisis()

    @staticmethod
    def cupo(**kwargs):
        return Cupo()

    @staticmethod
    def documento(**kwargs):
        return Documento(pk=kwargs["pk"], numero=kwargs["numero_documento"],
                         tipo=kwargs["tipo_documento"])

    @staticmethod
    def telefono(**kwargs):
        return Telefono(pk=kwargs["pk"], numero=kwargs["numero"], baja=0)

    @staticmethod
    def fichapaciente(**kwargs):
        return FichaPaciente()

    @staticmethod
    def institucionmedica(**kwargs):
        obj_ubicacion_geo = Creador.ubicacion_geografica(
            pk=kwargs["obj_ubicacion_geo"][0],
            ciudad=kwargs["obj_ubicacion_geo"][1],
            departamento=kwargs["obj_ubicacion_geo"][2],
            baja=kwargs["obj_ubicacion_geo"][3])
        return InstitucionMedica(pk=kwargs["pk"], nombre=kwargs["nombre"],
                                 direccion=kwargs["domicilio"],
                                 obj_ubicacion_geo=obj_ubicacion_geo)

    @staticmethod
    def laboratorioexterno(**kwargs):
        return LaboratorioExterno()

    @staticmethod
    def empleado(**kwargs):
        obj_documento = Creador.documento(pk=kwargs["documento"][0],
                                          numero_documento=kwargs["documento"]
                                          [2], tipo_documento=kwargs
                                          ["documento"][1])
        col_telefonos = []
        for tel in kwargs["col_telefonos"]:
            obj_telefono = Creador.telefono(pk=tel[0], numero=tel[1])
            col_telefonos.append(obj_telefono)
        obj_sucursal = kwargs["obj_sucursal"]
        if not isinstance(kwargs["obj_sucursal"], Sucursal):
            obj_sucursal = Creador.sucursal(pk=kwargs["obj_sucursal"][0],
                        domicilio=kwargs["obj_sucursal"][1],
                        col_telefonos=kwargs["obj_sucursal"][4],
                        ubicacion_geo=kwargs["obj_sucursal"][2],
                        baja=False)

        obj_ubicacion_geo = kwargs["obj_ubicacion_geo"]
        if not isinstance(kwargs["obj_ubicacion_geo"], UbicacionGeografica):
            obj_ubicacion_geo = Creador.ubicacion_geografica(
                pk=kwargs["obj_ubicacion_geo"][0],
                ciudad=kwargs["obj_ubicacion_geo"][1],
                departamento=kwargs["obj_ubicacion_geo"][2],
                baja=kwargs["obj_ubicacion_geo"][3])
        # kwargs["obj_ubicacion_geo"] trae un objeto
        return Empleado(pk=kwargs["pk"], pk_persona=kwargs["pk_persona"],
                        tipo=kwargs["tipo"],
                        nombres=kwargs["nombres"],
                        apellidos=kwargs["apellidos"],
                        col_telefonos=col_telefonos,
                        domicilio=kwargs["domicilio"],
                        obj_documento=obj_documento,
                        obj_ubicacion_geo=obj_ubicacion_geo,
                        obj_sucursal=obj_sucursal,
                        baja=False)

    @staticmethod
    def paciente(**kwargs):
        obj_documento = Creador.documento(pk=kwargs["documento"][0],
                                          numero_documento=kwargs["documento"]
                                          [2], tipo_documento=kwargs
                                          ["documento"][1])
        col_telefonos = []
        for tel in kwargs["col_telefonos"]:
            obj_telefono = Creador.telefono(pk=tel[0], numero=tel[1])
            col_telefonos.append(obj_telefono)
        obj_ubicacion_geo = Creador.ubicacion_geografica(
            pk=kwargs["ubicacion_geo"][0], ciudad=kwargs
            ["ubicacion_geo"][1], departamento=kwargs["ubicacion_geo"]
            [2], baja=kwargs["ubicacion_geo"][3])
        # kwargs["obj_ubicacion_geo"] trae un objeto
        return Paciente(pk=kwargs["pk"],
                        pk_persona=kwargs["pk_persona"],
                        activo=True, penalizado=False,
                        nombres=kwargs["nombres"],
                        apellidos=kwargs["apellidos"],
                        col_telefonos=col_telefonos,
                        domicilio=kwargs["domicilio"],
                        obj_documento=obj_documento,
                        obj_ubicacion_geo=obj_ubicacion_geo,
                        obj_ficha_paciente=None, baja=False)

    @staticmethod
    def reserva_analisis(**kwargs):
        return ReservaAnalisis()

    @staticmethod
    def sucursal(**kwargs):
        col_telefonos = []
        for tel in kwargs["col_telefonos"]:
            if not isinstance(tel, Telefono):
                obj_telefono = Creador.telefono(pk=tel[0], numero=tel[1])
                col_telefonos.append(obj_telefono)
            else:
                col_telefonos.append(tel)  # tel es un objeto Telefono
        obj_ubicacion_geo = Creador.ubicacion_geografica(
                    pk=kwargs["ubicacion_geo"][0], ciudad=kwargs
                    ["ubicacion_geo"][1], departamento=kwargs["ubicacion_geo"]
                    [2], baja=kwargs["ubicacion_geo"][3])
        # kwargs["obj_ubicacion_geo"] trae un objeto
        return Sucursal(pk=kwargs["pk"],
                        domicilio=kwargs["domicilio"],
                        col_telefonos=col_telefonos,
                        obj_ubicacion_geo=obj_ubicacion_geo,
                        baja=False)

    @staticmethod
    def tipoanalisis(**kwargs):
        return TipoAnalisis()

    @staticmethod
    def ubicacion_geografica(**kwargs):
        return UbicacionGeografica(kwargs['pk'], kwargs['ciudad'],
                                   kwargs['departamento'], kwargs['baja'])


text:
package net.avalara.avatax.rest.client;

import net.avalara.avatax.rest.client.enums.DocumentType;
import net.avalara.avatax.rest.client.models.ErrorResult;

public class AvaTaxClientException extends Exception {
    private ErrorResult errorResult = null;

    private Object erroneousRequest;

    public AvaTaxClientException(String message) {
        super(message);
    }

    public AvaTaxClientException(ErrorResult errorResult, Object erroneousRequest) {
        super(errorResult.toString());
        this.errorResult = errorResult;
        this.erroneousRequest = erroneousRequest;
    }

    public ErrorResult getErrorResult() {
        return this.errorResult;
    }

    public Object getErroneousRequest() {
        return this.erroneousRequest;
    }
}


text:
package org.apache.dubbo.qos.legacy.service.generic;

import java.io.Serializable;

/**
 * User
 */
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    private String name;

    public User() {
    }

    public User(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int hashCode() {
        return name == null ? -1 : name.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof User)) {
            return false;
        }
        User other = (User) obj;
        if (this == other) {
            return true;
        }
        if (name != null && other.name != null) {
            return name.equals(other.name);
        }
        return false;
    }

}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Novon 8:290. 1998

#### Original name
Lavatera assurgentiflora Kellogg

### Remarks
null


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Fl. austral. 2:355. 1864

#### Original name
null

### Remarks
null


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Extensions;

namespace DocumentDBRestApi
{
    /// <summary>
    /// API client is mainly responible for making the HTTP call to the API backend.
    /// </summary>
    public class ApiClient
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class.
        /// </summary>
        /// <param name="basePath">The base path.</param>
        // ReSharper disable once InconsistentNaming
        public ApiClient(string basePath = "https://healthcare.documents.azure.com:443/dbs")
        {
            if (basePath == null) throw new ArgumentNullException(nameof(basePath));
            BasePath = basePath;
            RestClient = new RestClient(BasePath);
        }

        // Creates and sets up a RestRequest prior to a call.
        private RestRequest PrepareRequest(
            string Path, Method Method, Dictionary<string, string> QueryParams, string PostBody,
            Dictionary<string, string> HeaderParams, Dictionary<string, string> FormParams,
            Dictionary<string, FileParameter> FileParams, Dictionary<string, string> PathParams, string[] AuthSettings)
        {
            var request = new RestRequest(Path, Method);

            UpdateParamsForAuth(QueryParams, HeaderParams, AuthSettings);

            // add default header, if any
            foreach (var defaultHeader in DefaultHeader)
                request.AddHeader(defaultHeader.Key, defaultHeader.Value);

            // add path parameter, if any
            foreach (var param in PathParams)
                request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment);

            // add header parameter, if any
            foreach (var param in HeaderParams)
                request.AddHeader(param.Key, param.Value);

            // add query parameter, if any
            foreach (var param in QueryParams)
                request.AddQueryParameter(param.Key, param.Value);

            // add form parameter, if any
            foreach (var param in FormParams)
                request.AddParameter(param.Key, param.Value);

            // add file parameter, if any
            foreach (var param in FileParams)
                request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);

            if (PostBody != null) // http body (model) parameter
                request.AddParameter("application/json", PostBody, ParameterType.RequestBody);

            return request;
        }

        /// <summary>
        /// Add default header.
        /// </summary>
        /// <param name="Key">Header field name.</param>
        /// <param name="Value">Header field value.</param>
        /// <returns></returns>
        public void AddDefaultHeader(string Key, string Value)
        {
            DefaultHeader.Add(Key, Value);
        }

        /// <summary>
        /// Encode string in base64 format.
        /// </summary>
        /// <param name="Text">String to be encoded.</param>
        /// <returns>Encoded string.</returns>
        public static string Base64Encode(string Text)
        {
            var textByte = Encoding.UTF8.GetBytes(Text);
            return Convert.ToBase64String(textByte);
        }

        /// <summary>
        /// Makes the HTTP request (Sync).
        /// </summary>
        /// <param name="Path">URL path.</param>
        /// <param name="Method">HTTP method.</param>
        /// <param name="QueryParams">Query parameters.</param>
        /// <param name="PostBody">HTTP body (POST request).</param>
        /// <param name="HeaderParams">Header parameters.</param>
        /// <param name="FormParams">Form parameters.</param>
        /// <param name="FileParams">File parameters.</param>
        /// <param name="PathParams">Path parameters.</param>
        /// <param name="AuthSettings">Authentication settings.</param>
        /// <returns>Object</returns>
        public Object CallApi(
            string Path, Method Method, Dictionary<string, string> QueryParams, string PostBody,
            Dictionary<string, string> HeaderParams, Dictionary<string, string> FormParams,
            Dictionary<string, FileParameter> FileParams, Dictionary<string, string> PathParams, string[] AuthSettings)
        {
            var request = PrepareRequest(
                Path, Method, QueryParams, PostBody, HeaderParams, FormParams, FileParams, PathParams, AuthSettings);
            var response = RestClient.Execute(request);
            StatusCode = (int)response.StatusCode;
            ResponseHeaders = response.Headers.ToDictionary(X => X.Name, X => X.Value.ToString());
            return response;
        }

        /// <summary>
        /// Makes the asynchronous HTTP request.
        /// </summary>
        /// <param name="Path">URL path.</param>
        /// <param name="Method">HTTP method.</param>
        /// <param name="QueryParams">Query parameters.</param>
        /// <param name="PostBody">HTTP body (POST request).</param>
        /// <param name="HeaderParams">Header parameters.</param>
        /// <param name="FormParams">Form parameters.</param>
        /// <param name="FileParams">File parameters.</param>
        /// <param name="PathParams">Path parameters.</param>
        /// <param name="AuthSettings">Authentication settings.</param>
        /// <returns>The Task instance.</returns>
        public async Task<Object> CallApiAsync(
            string Path, Method Method, Dictionary<string, string> QueryParams, string PostBody,
            Dictionary<string, string> HeaderParams, Dictionary<string, string> FormParams,
            Dictionary<string, FileParameter> FileParams, Dictionary<string, string> PathParams, string[] AuthSettings)
        {
            var request = PrepareRequest(
                Path, Method, QueryParams, PostBody, HeaderParams, FormParams, FileParams, PathParams, AuthSettings);
            var response = await RestClient.ExecuteTaskAsync(request);
            StatusCode = (int)response.StatusCode;
            ResponseHeaders = response.Headers.ToDictionary(X => X.Name, X => X.Value.ToString());
            return response;
        }

        /// <summary>
        /// Dynamically cast the object into target type.
        /// Ref: http://stackoverflow.com/questions/4925718/c-dynamic-runtime-cast
        /// </summary>
        /// <param name="Source">Object to be casted</param>
        /// <param name="Dest">Target type</param>
        /// <returns>Casted object</returns>
        public static dynamic ConvertType(dynamic Source, Type Dest)
        {
            return Convert.ChangeType(Source, Dest);
        }

        /// <summary>
        /// Deserialize the JSON string into a proper object.
        /// </summary>
        /// <param name="Response">The HTTP response.</param>
        /// <param name="Type">Object type.</param>
        /// <returns>Object representation of the JSON string.</returns>
        public object Deserialize(IRestResponse Response, Type Type)
        {
            var data = Response.RawBytes;
            var content = Response.Content;
            var headers = Response.Headers;
            if (Type == typeof (Object)) // return an object
                return content;

            if (Type == typeof(Stream))
            {
                if (headers != null)
                {
                    var filePath = string.IsNullOrEmpty(Configuration.TempFolderPath)
                        ? Path.GetTempPath()
                        : Configuration.TempFolderPath;
                    var regex = new Regex(@"Content-Disposition:.*filename=['""]?([^'""\s]+)['""]?$");
                    var match = regex.Match(headers.ToString());
                    if (match.Success)
                    {
                        var fileName = filePath + match.Value.Replace("\"", "").Replace("'", "");
                        File.WriteAllBytes(fileName, data);
                        return new FileStream(fileName, FileMode.Open);
                    }
                }
                var stream = new MemoryStream(data);
                return stream;
            }

            if (Type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object

                return DateTime.Parse(content, null, DateTimeStyles.RoundtripKind);

            if (Type == typeof(string) || Type.Name.StartsWith("System.Nullable")) // return primitive type

                return ConvertType(content, Type);

            // at this point, it must be a model (json)
            try
            {
                return JsonConvert.DeserializeObject(content, Type);
            }
            catch (Exception e)
            {
                throw new ApiException(500, e.Message);
            }
        }

        /// <summary>
        /// Escape string (url-encoded).
        /// </summary>
        /// <param name="Str">String to be escaped.</param>
        /// <returns>Escaped string.</returns>
        public string EscapeString(string Str)
        {
            return Str.UrlEncode();
        }

        /// <summary>
        /// Get the API key with prefix.
        /// </summary>
        /// <param name="ApiKeyIdentifier">API key identifier (authentication scheme).</param>
        /// <returns>API key with prefix.</returns>
        public string GetApiKeyWithPrefix(string ApiKeyIdentifier)
        {
            string apiKeyValue;
            Configuration.ApiKey.TryGetValue(ApiKeyIdentifier, out apiKeyValue);
            string apiKeyPrefix;
            if (Configuration.ApiKeyPrefix.TryGetValue(ApiKeyIdentifier, out apiKeyPrefix))
                return apiKeyPrefix + " " + apiKeyValue;
            return apiKeyValue;
        }

        /// <summary>
        /// Create FileParameter based on Stream.
        /// </summary>
        /// <param name="Name">Parameter name.</param>
        /// <param name="Stream">Input stream.</param>
        /// <returns>FileParameter.</returns>
        public FileParameter ParameterToFile(string Name, Stream Stream)
        {
            var stream = Stream as FileStream;
            return stream != null ? FileParameter.Create(Name, stream.ReadAsBytes(), Path.GetFileName(stream.Name)) : FileParameter.Create(Name, Stream.ReadAsBytes(), "no_file_name_provided");
        }

        /// <summary>
        /// If parameter is DateTime, output in ISO8601 format.
        /// If parameter is a list, join the list with ",".
        /// Otherwise just return the string.
        /// </summary>
        /// <param name="Obj">The parameter (header, path, query, form).</param>
        /// <returns>Formatted string.</returns>
        public string ParameterToString(object Obj)
        {
            if (Obj is DateTime)
                return ((DateTime)Obj).ToString("u");
            if (!(Obj is IList)) return Convert.ToString(Obj);
            const string separator = ",";
            var flattenString = ((IList)Obj).Cast<object>().Aggregate("", (Current, Param) => Current + (Param + separator));
            return flattenString.Remove(flattenString.Length - 1);
        }

        /// <summary>
        /// Select the Accept header's value from the given accepts array:
        /// if JSON exists in the given array, use it;
        /// otherwise use all of them (joining into a string)
        /// </summary>
        /// <param name="Accepts">The accepts array to select from.</param>
        /// <returns>The Accept header to use.</returns>
        public string SelectHeaderAccept(string[] Accepts)
        {
            if (Accepts.Length == 0)
                return null;
            if (Accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
                return "application/json";
            return string.Join(",", Accepts);
        }

        /// <summary>
        /// Serialize an object into JSON string.
        /// </summary>
        /// <param name="Obj">Object.</param>
        /// <returns>JSON string.</returns>
        public string Serialize(object Obj)
        {
            try
            {
                return Obj != null ? JsonConvert.SerializeObject(Obj) : null;
            }
            catch (Exception e)
            {
                throw new ApiException(500, e.Message);
            }
        }

        /// <summary>
        /// Update parameters based on authentication.
        /// NOT CURRENTLY USED
        /// </summary>
        /// <param name="QueryParams">Query parameters.</param>
        /// <param name="HeaderParams">Header parameters.</param>
        /// <param name="AuthSettings">Authentication settings.</param>
        public void UpdateParamsForAuth(Dictionary<string, string> QueryParams, Dictionary<string, string> HeaderParams, string[] AuthSettings)
        {
            if (AuthSettings == null || AuthSettings.Length == 0)
                return;

            foreach (var auth in AuthSettings)
            {
                // determine which one to use
                switch (auth)
                {

                    default:
                        //TODO show warning about security definition not found
                        throw new ArgumentNullException();

                }
            }
        }

        /// <summary>
        /// Gets or sets the base path.
        /// </summary>
        /// <value>The base path</value>
        public string BasePath { get; set; }

        /// <summary>
        /// Gets the default header.
        /// </summary>
        public Dictionary<string, string> DefaultHeader { get; } = new Dictionary<string, string>();

        /// <summary>
        /// Gets the response headers of the previous request
        /// </summary>
        public Dictionary<string, string> ResponseHeaders { get; private set; }

        /// <summary>
        /// Gets or sets the RestClient.
        /// </summary>
        /// <value>An instance of the RestClient</value>
        public RestClient RestClient { get; set; }

        /// <summary>
        /// Gets the status code of the previous request
        /// </summary>
        public int StatusCode { get; private set; }

    }
}