text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <display-name>RabbitMQ Peek</display-name>
    <description>Exposes the contents (read-only) of a RabbitMQ queue via a servlet</description>

    <servlet>
        <servlet-name>RabbitMQPeekServlet</servlet-name>
        <servlet-class>net.community.apps.tomcat.rabbitmq.peek.RabbitMQPeekServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

      <servlet-mapping>
        <servlet-name>RabbitMQPeekServlet</servlet-name>
        <url-pattern>/RabbitMQPeekServlet</url-pattern>
      </servlet-mapping>
</web-app>


text:
-- phpMyAdmin SQL Dump
-- version 4.0.9
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Oct 26, 2015 at 12:19 PM
-- Server version: 5.5.34
-- PHP Version: 5.4.22

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `lookup`
--

-- --------------------------------------------------------

--
-- Table structure for table `formdata`
--

CREATE TABLE IF NOT EXISTS `formdata` (
  `formdata_id` tinyint(4) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `number` int(11) NOT NULL,
  `country` varchar(20) NOT NULL,
  PRIMARY KEY (`formdata_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

redpajama_set_name: RedPajamaGithub


text:
package com.android.systemui.statusbar.policy;

public interface WeatherController {
    void addCallback(Callback callback);
    void removeCallback(Callback callback);
    WeatherInfo getWeatherInfo();

    public interface Callback {
        void onWeatherChanged(WeatherInfo temp);
    }
    public static class WeatherInfo {
        public String temp = null;
        public String city = null;
        public String condition = null;
    }
}


text:
module Reru
  module Sink
    module Validations
      def validate_sink(sink)
        raise ArgumentError, "A Reru::Sink expected. Got: #{sink.class}" unless sink.is_a?(Reru::Sink)
      end
    end
  end
end


text:
Ext4.define('Kwf.Ext4.Controller.Grid.DragDropOrder', {
    mixins: {
        observable: 'Ext.util.Observable'
    },
    autoSync: true,
    constructor: function(config) {
        this.mixins.observable.constructor.call(this, config);
        this.init();
    },

    init: function()
    {
        if (!this.gridController) Ext4.Error.raise('gridController config is required');
        if (!(this.gridController instanceof Kwf.Ext4.Controller.Grid)) Ext4.Error.raise('gridController config needs to be a Kwf.Ext4.Controller.Grid');

        var plugin = this.gridController.grid.view.findPlugin('gridviewdragdrop');
        if (!plugin) Ext4.Error.raise('Didn\'t find gridviewdragdrop plugin in grid view');
        this.gridController.grid.view.on('drop', function(node, data, overRow, dropPosition, eOpts) {
            var pos = 1;
            this.gridController.grid.getStore().each(function(i) {
                if (data.records[0] == i) {
                    //skip
                    return;
                }
                if (i == overRow) {
                    data.records[0].set('pos', null);
                    if (dropPosition == 'before') {
                        data.records[0].set('pos', pos);
                    } else {
                        data.records[0].set('pos', pos+1);
                    }
                }
                pos++;
            }, this);
            if (this.autoSync) {
                this.gridController.grid.getStore().sync();
            }
        }, this);
    }
});


text:
static NSString * const kMixpanelTimingPropertyKey = @"$duration";

@implementation MixpanelProvider

- (id)initWithIdentifier:(NSString *)identifier {
    return [self initWithIdentifier:identifier andHost:nil];
}

- (id)initWithIdentifier:(NSString *)identifier andHost:(NSString *)host {
#ifdef AR_MIXPANEL_EXISTS

    NSAssert([Mixpanel class], @"Mixpanel is not included");
    [Mixpanel sharedInstanceWithToken:identifier];

    if (host) {
        [[Mixpanel sharedInstance] setServerURL:host];
    }
#endif
    return [super init];
}

#ifdef AR_MIXPANEL_EXISTS
- (void)identifyUserWithID:(NSString *)userID andEmailAddress:(NSString *)email {
    if (userID) {
        [[Mixpanel sharedInstance] identify:userID];
    }

    if (email) {
        [[[Mixpanel sharedInstance] people] set:@"$email" to:email];
    }
}

- (void)setUserProperty:(NSString *)property toValue:(NSString *)value {
    [[[Mixpanel sharedInstance] people] set:property to:value];
}

- (void)incrementUserProperty:(NSString *)counterName byInt:(NSNumber *)amount {
    [[[Mixpanel sharedInstance] people] increment:counterName by:amount];
}

- (void)event:(NSString *)event withProperties:(NSDictionary *)properties {
    [[Mixpanel sharedInstance] track:event properties:properties];
}

- (void)logTimingEvent:(NSString *)event withInterval:(NSNumber *)interval properties:(NSDictionary *)properties {

    if (properties[kMixpanelTimingPropertyKey]) {
        NSString *warning = [NSString stringWithFormat:@"Properties for timing event '%@' contains a key that clashes with the key used for reporting the time: %@", event, kMixpanelTimingPropertyKey];
        NSLog(@"%@", warning);
        NSAssert(properties[kMixpanelTimingPropertyKey], @"%@", warning);
    }

    NSMutableDictionary *mutableProperties = [NSMutableDictionary dictionaryWithDictionary:properties];
    if (interval) {
        mutableProperties[kMixpanelTimingPropertyKey] = interval;
    }

    [self event:event withProperties:mutableProperties];
}

#endif
@end


text:
@XmlSchema(
        namespace = EssentialConst.URI_JCR_NAMESPACE,
        xmlns = {
                @XmlNs(namespaceURI = EssentialConst.URI_JCR_NAMESPACE, prefix = "sv"),
                @XmlNs(namespaceURI = EssentialConst.URI_AUTOEXPORT_NAMESPACE, prefix = "h")
        },
        elementFormDefault = XmlNsForm.QUALIFIED) package org.onehippo.cms7.essentials.dashboard.utils.xml;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;

import org.onehippo.cms7.essentials.dashboard.utils.EssentialConst;


text:
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class WP_Email_Template_Exclude_Subject_Data
{
	/**
	 * @var data table name
	 */
	public $table_name = 'a3_exclude_email_subject';

	public function __construct() {
		if ( is_admin() ) {
			// Ajax Update Portfolio Feature Order
			add_action( 'wp_ajax_portfolio_update_feature_order', array( $this, 'portfolio_update_feature_order' ) );
			add_action( 'wp_ajax_nopriv_portfolio_update_feature_order', array( $this, 'portfolio_update_feature_order' ) );
		}
	}

	public function install_database() {
		global $wpdb;
		$collate = '';
		if ( $wpdb->has_cap( 'collation' ) ) {
			if( ! empty($wpdb->charset ) ) $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
			if( ! empty($wpdb->collate ) ) $collate .= " COLLATE $wpdb->collate";
		}

		$table_database = $wpdb->prefix . $this->table_name;
		if($wpdb->get_var("SHOW TABLES LIKE '$table_database'") != $table_database){
			$sql = "CREATE TABLE " . $table_database . " (
					   	  `id` bigint(20) NOT NULL auto_increment,
						  `email_sent_by` varchar(250) NOT NULL,
						  `email_subject` text NOT NULL,
						  PRIMARY KEY  (`id`)
						) $collate ;";

			$wpdb->query($sql);
		}

	}

	public function get_all_exclude_subjects() {
		global $wpdb;

		$exclude_subjects = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . $this->table_name . " ORDER BY `id` ASC" );

		return $exclude_subjects;
	}

	public function get_all_exclude_subject_titles( $exclude_subjects=array() ) {
		$exclude_subject_titles = array();
		if ( is_array( $exclude_subjects ) && count( $exclude_subjects ) > 0 ) {
			foreach ( $exclude_subjects as $subject_data ) {
				$exclude_subject_titles[] = trim( $subject_data->email_subject );
			}
		}

		return $exclude_subject_titles;
	}

	public function get_exclude_subject( $id ) {
		global $wpdb;

		$exclude_subject = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . $this->table_name . " WHERE `id` = %d ", $id ) );

		return $exclude_subject;
	}

	public function add_subject( $subject_data = array() ) {
		global $wpdb;
		extract( $subject_data );

		$result = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $wpdb->prefix . $this->table_name . "(`email_sent_by`, `email_subject`) VALUES ( %s, %s )", $email_sent_by, $email_subject ) );

		return $result;
	}

	public function delete_subject( $id ) {
		global $wpdb;
		$result = false;

		$exclude_subject = $this->get_exclude_subject( $id );
		if ( $exclude_subject ) {
			$result = $wpdb->query( $wpdb->prepare( "DELETE FROM " . $wpdb->prefix . $this->table_name . " WHERE `id` = %d ", $id ) );
		}

		return $result;
	}

	public function delete_all_subjects() {
		global $wpdb;

		$result = $wpdb->query( "TRUNCATE " . $wpdb->prefix . $this->table_name );

		return $result;
	}

}

global $wp_email_template_exclude_subject_data;
$wp_email_template_exclude_subject_data = new WP_Email_Template_Exclude_Subject_Data();


text:
package io.cdap.wrangler.codec;

/**
 * This exception is thrown when there are issues related decoder.
 */
public class DecoderException extends Exception {
  public DecoderException(String message) {
    super(message);
  }
}


text:
package javax.naming.directory;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Map;
import java.util.Vector;
import java.util.Iterator;
import java.util.Hashtable;
import java.util.Enumeration;
import javax.naming.NamingEnumeration;

import org.apache.harmony.jndi.internal.nls.Messages;

/**
 * A simple implementation of the Attributes interface.
 *

 * The BasicAttributes provides operations on any types of
 * attribute. When a new attribute is created the BasicAttributes
 * class will create a new BasicAttribute and add it to the
 * attribute collection.

 *

 * A particular instance of BasicAttributes can be either
 * case-sensitive or case-insensitive, as defined by the isCaseIgnored()
 *  method.

 *

 * Note that changes to the BasicAttributes are local -- they do
 * not modify the directory. The directory is only modified by API calls on the
 * {@link DirContext} object.

 *
 * @see Attributes
 *
 */
public class BasicAttributes implements Attributes {

    /*
     * -------------------------------------------------------------------
     * Constants
     * -------------------------------------------------------------------
     */

    /*
     * This constant is used during deserialization to check the J2SE version
     * which created the serialized object.
     */
    static final long serialVersionUID = 0x451d18d6a95539d8L; //J2SE 1.4.2

    /*
     * -------------------------------------------------------------------
     * Instance variables
     * -------------------------------------------------------------------
     */

    /**
     * Flag indicating whether the case of attribute identifier is ignored.
     *
     * @serial
     */
    private boolean ignoreCase;

    // A map, Id => Attribute
    private transient Hashtable<String,Attribute> attrMap = new Hashtable<String,Attribute>();

    /*
     * -------------------------------------------------------------------
     * Constructors
     * -------------------------------------------------------------------
     */

    /**
     * Constructs a BasicAttributes instance which is
     * case-sensitive.
     */
    public BasicAttributes() {
        this(false);
    }

    /**
     * Constructs a BasicAttributes instance which is
     * case-sensitive if flag is false.
     *
     * @param flag          Indicates whether this instance is
     *                      case-insensitive.
     */
    public BasicAttributes(boolean flag) {
        this.ignoreCase = flag;
    }

    /**
     * Constructs a case-sensitive BasicAttributes instance
     * with one attribute.
     *
     * @param attrId        the ID of the first attribute
     * @param attrObj       the value of the first attribute
     */
    public BasicAttributes(String attrId, Object attrObj) {
        this(attrId, attrObj, false);
    }

    /**
     * Constructs a BasicAttributes instance with one attribute
     * which is case-sensitive if flag is false.
     *
     * @param attrId        the ID of the first attribute
     * @param attrObj       the value of the first attribute
     * @param flag          Indicates whether this instance is
     *                      case-insensitive.
     */
    public BasicAttributes(String attrId, Object attrObj, boolean flag) {
        this.ignoreCase = flag;
        this.attrMap.put(convertId(attrId),
            new BasicAttribute(attrId, attrObj));
    }

    /*
     * -------------------------------------------------------------------
     * Methods
     * -------------------------------------------------------------------
     */

    /*
     * Convert an attribute ID to lower case if this attribute collection is
     * case-insensitive.
     */
    private String convertId(String id) {
        return ignoreCase ? id.toLowerCase() : id;
    }

    /*
     * -------------------------------------------------------------------
     * Methods of Interface Attributes
     * -------------------------------------------------------------------
     */

    public Attribute get(String id) {
        return attrMap.get(convertId(id));
    }

    public NamingEnumeration<Attribute> getAll() {
        return new BasicNamingEnumeration<Attribute>(attrMap.elements());
    }

    public NamingEnumeration<String> getIDs() {
        if (ignoreCase) {
            Enumeration<Attribute> e = this.attrMap.elements();
            Vector<String> v = new Vector<String>(attrMap.size());

            while (e.hasMoreElements()) {
                v.add((e.nextElement()).getID());
            }

            return new BasicNamingEnumeration<String>(v.elements());
        }
        return new BasicNamingEnumeration<String>(this.attrMap.keys());
    }

    public boolean isCaseIgnored() {
        return ignoreCase;
    }

    public Attribute put(Attribute attribute) {
        String id = convertId(attribute.getID());
        return attrMap.put(id, attribute);
    }

    public Attribute put(String id, Object obj) {
        return put(new BasicAttribute(id, obj));
    }

    public Attribute remove(String id) {
        return attrMap.remove(convertId(id));
    }

    public int size() {
        return attrMap.size();
    }

    /*
     * -------------------------------------------------------------------
     * Methods override parent class Object
     * -------------------------------------------------------------------
     */

    /*
     * Serialization of the BasicAttributes class is as follows:
     *      ignore attribute case (boolean)
     *      number of attributes (int)
     *      list of attribute objects
     */
    private void readObject(ObjectInputStream ois)
        throws IOException, ClassNotFoundException {
        int size;

        ois.defaultReadObject();
        size = ois.readInt();
        attrMap = new Hashtable<String,Attribute>();
        for (int i = 0; i < size; i++) {
            BasicAttribute attr = (BasicAttribute) ois.readObject();
            attrMap.put(convertId(attr.getID()), attr);
        }
    }

    /*
     * Serialization of the BasicAttributes class is as follows:
     *      ignore attribute case (boolean)
     *      number of attributes (int)
     *      list of attribute objects
     */
    private void writeObject(ObjectOutputStream oos) throws IOException {
        oos.defaultWriteObject();
        oos.writeInt(attrMap.size());
        for (Enumeration<Attribute> enumeration = attrMap.elements(); enumeration.hasMoreElements();) {
            oos.writeObject(enumeration.nextElement());
        }
    }

    /**
     * Returns a deep copy of this attribute collection.
     * The returned copy contains the same attribute objects. The attribute
     * objects are not cloned.
     *
     * @return              a deep copy of this attribute collection
     */
    @SuppressWarnings("unchecked") //$NON-NLS-1$
    @Override
    public Object clone() {
        try {
            BasicAttributes c = (BasicAttributes) super.clone();
            c.attrMap = (Hashtable<String,Attribute>) this.attrMap.clone();
            return c;
        } catch (CloneNotSupportedException e) {
            // jndi.15=Failed to clone object of BasicAttributes class.
            throw new AssertionError(Messages.getString("jndi.15"));  //$NON-NLS-1$
        }
    }

    /**
     * Returns true if this BasicAttributes instance is equal to
     * the supplied object obj.
     * They are considered equal if they handle case the same way and have equal
     * attributes. Attribute equality is tested by calling
     * equals on each attribute, which may be overridden.
     *
     * @param obj           the object to compare with
     * @return              true if this object is equal to obj,
     *                      otherwise false
     */
    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Attributes)) {
            return false;
        }

        // compare case & size
        Attributes o = (Attributes) obj;
        if (isCaseIgnored() != o.isCaseIgnored() || size() != o.size()) {
            return false;
        }

        // compare each attribute
        Iterator<Map.Entry<String,Attribute>> it = attrMap.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<String,Attribute> e = it.next();
            if (!e.getValue().equals(o.get(e.getKey()))) {
                return false;
            }
        }

        return true;
    }

    /**
     * Returns the hashcode for this BasicAttributes instance.
     * The result is calculated by summing the hashcodes of all attributes,
     * incremented by one if this instance is not case-sensitive.
     *
     * @return              the hashcode of this BasicAttributes
     *                      instance
     */
    @Override
    public int hashCode() {
        Enumeration<Attribute> e = attrMap.elements();
        int i = (ignoreCase ? 1 : 0);

        while (e.hasMoreElements()) {
            i += e.nextElement().hashCode();
        }

        return i;
    }

    /**
     * Returns the string representation of this BasicAttributes
     * instance.
     * The result contains the attribute identifiers and values' string
     * representations.
     *
     * @return              the string representation of this object
     */
    @Override
    public String toString() {
        String s = null;
        Iterator<Map.Entry<String,Attribute>> it = attrMap.entrySet().iterator();
        Map.Entry<String,Attribute> e = null;

        if (it.hasNext()) {
            // If there are one or more attributes, print them all.
            e = it.next();
            s = "{\n"; //$NON-NLS-1$
            s += e.getKey();
            s += "=" + e.getValue().toString(); //$NON-NLS-1$
            while (it.hasNext()) {
                e = it.next();
                s += "; "; //$NON-NLS-1$
                s += e.getKey();
                s += "=" + e.getValue().toString(); //$NON-NLS-1$
            }
            s += "}\n"; //$NON-NLS-1$
        } else {
            // Otherwise, print an indication that no attributes are stored.
            s = "This Attributes does not have any attributes.\n"; //$NON-NLS-1$
        }
        return s;
    }
}


text:
<?php
require 'connect.php';
require 'advisorlog.php';
	//gets the GPA for student advisor is advising
	$stud_id = $_SESSION['user_id'];
	$query = "SELECT  `gpa` FROM  `students` WHERE  `student_id` =  '$stud_id'";
	//echo $query;
	if($query_run = mysql_query($query)){
	if($query_result = mysql_result($query_run, 0, 'gpa')){
	echo 'Student\'s GPA is: ' .$query_result. '
';
	echo 'Main
';
		}
	}

?>


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Framework.Testing;
using osuTK;
using osuTK.Graphics;

namespace osu.Framework.Tests.Visual.UserInterface
{
    public class TestSceneTooltip : ManualInputManagerTestScene
    {
        private TestTooltipContainer tooltipContainer;

        private TooltipSpriteText tooltipText;
        private TooltipSpriteText instantTooltipText;
        private CustomTooltipSpriteText customTooltipTextA;
        private CustomTooltipSpriteText customTooltipTextB;
        private CustomTooltipSpriteTextAlt customTooltipTextAlt;
        private TooltipSpriteText emptyTooltipText;
        private TooltipSpriteText nullTooltipText;
        private TooltipTextBox tooltipTextBox;

        [SetUpSteps]
        public void SetUpSteps()
        {
            AddToggleStep("add tooltips (cursor/cursor-less)", generateTest);
        }

        [Test]
        public void TestTooltip()
        {
            ITooltip originalInstance = null;

            hoverTooltipProvider(() => tooltipText);

            AddStep("get tooltip instance", () => originalInstance = tooltipContainer.CurrentTooltip);
            assertTooltipText(() => tooltipText.TooltipText);

            hoverTooltipProvider(() => tooltipText);

            AddAssert("tooltip reused", () => tooltipContainer.CurrentTooltip == originalInstance);
            assertTooltipText(() => tooltipText.TooltipText);
        }

        [Test]
        public void TestInstantTooltip()
        {
            hoverTooltipProvider(() => instantTooltipText, false);
            assertTooltipText(() => instantTooltipText.TooltipText);
        }

        [Test]
        public void TestCustomTooltip()
        {
            ITooltip originalInstance = null;

            hoverTooltipProvider(() => customTooltipTextA);

            AddStep("get tooltip instance", () => originalInstance = tooltipContainer.CurrentTooltip);
            AddAssert("custom tooltip used", () => originalInstance.GetType() == typeof(CustomTooltip));
            assertTooltipText(() => ((CustomContent)customTooltipTextA.TooltipContent).Text);

            hoverTooltipProvider(() => customTooltipTextB);

            AddAssert("custom tooltip reused", () => tooltipContainer.CurrentTooltip == originalInstance);
            assertTooltipText(() => ((CustomContent)customTooltipTextB.TooltipContent).Text);
        }

        [Test]
        public void TestDifferentCustomTooltips()
        {
            hoverTooltipProvider(() => customTooltipTextA);
            assertTooltipText(() => ((CustomContent)customTooltipTextA.TooltipContent).Text);

            AddAssert("current tooltip type normal", () => tooltipContainer.CurrentTooltip.GetType() == typeof(CustomTooltip));

            hoverTooltipProvider(() => customTooltipTextAlt);
            assertTooltipText(() => ((CustomContent)customTooltipTextAlt.TooltipContent).Text);

            AddAssert("current tooltip type alt", () => tooltipContainer.CurrentTooltip.GetType() == typeof(CustomTooltipAlt));

            hoverTooltipProvider(() => customTooltipTextB);
            assertTooltipText(() => ((CustomContent)customTooltipTextB.TooltipContent).Text);

            AddAssert("current tooltip type normal", () => tooltipContainer.CurrentTooltip.GetType() == typeof(CustomTooltip));
        }

        [Test]
        public void TestEmptyTooltip()
        {
            AddStep("hover empty tooltip", () => InputManager.MoveMouseTo(emptyTooltipText));
            AddAssert("tooltip not shown", () => tooltipContainer.CurrentTooltip?.IsPresent != true);
        }

        [Test]
        public void TestNullTooltip()
        {
            AddStep("hover null tooltip", () => InputManager.MoveMouseTo(nullTooltipText));
            AddAssert("tooltip not shown", () => tooltipContainer.CurrentTooltip?.IsPresent != true);
        }

        [Test]
        public void TestUpdatingTooltip()
        {
            hoverTooltipProvider(() => tooltipTextBox);
            assertTooltipText(() => tooltipTextBox.Text);

            AddStep("update text", () => tooltipTextBox.Text = "updated!");

            assertTooltipText(() => "updated!");
        }

        private void hoverTooltipProvider(Func<Drawable> getProvider, bool waitForDisplay = true)
        {
            AddStep("hover away from tooltips", () => InputManager.MoveMouseTo(Vector2.Zero));
            AddAssert("tooltip hidden", () => tooltipContainer.CurrentTooltip?.IsPresent != true);

            AddStep("hover tooltip", () => InputManager.MoveMouseTo(getProvider()));

            if (waitForDisplay)
                AddUntilStep("wait for tooltip", () => tooltipContainer.CurrentTooltip?.IsPresent == true);
            else
                AddAssert("tooltip instantly displayed", () => tooltipContainer.CurrentTooltip?.IsPresent == true);
        }

        private void assertTooltipText(Func<LocalisableString> expected)
        {
            AddAssert("tooltip text matching", () =>
            {
                var drawableTooltip = (Drawable)tooltipContainer.CurrentTooltip;
                return drawableTooltip.ChildrenOfType<IHasText>().Count(t => t.Text == expected()) == 1;
            });
        }

        private TooltipBox makeBox(Anchor anchor) => new TooltipBox
        {
            RelativeSizeAxes = Axes.Both,
            Size = new Vector2(0.2f),
            Anchor = anchor,
            Origin = anchor,
            Colour = Color4.Blue,
            TooltipText = $"{anchor}",
        };

        private void generateTest(bool cursorlessTooltip)
        {
            Clear();

            CursorContainer cursor = null;

            if (!cursorlessTooltip)
            {
                cursor = new RectangleCursorContainer();
                Add(cursor);
            }

            Add(tooltipContainer = new TestTooltipContainer(cursor)
            {
                RelativeSizeAxes = Axes.Both,
                Children = new Drawable[]
                {
                    new Container
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        AutoSizeAxes = Axes.Both,
                        Children = new[]
                        {
                            new TooltipBox
                            {
                                TooltipText = "Outer Tooltip",
                                Colour = Color4.CornflowerBlue,
                                Size = new Vector2(300, 300),
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre
                            },
                            new TooltipBox
                            {
                                TooltipText = "Inner Tooltip",
                                Size = new Vector2(150, 150),
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre
                            },
                        }
                    },
                    new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Direction = FillDirection.Vertical,
                        Spacing = new Vector2(0, 10),
                        Children = new Drawable[]
                        {
                            tooltipText = new TooltipSpriteText("this text has a tooltip!"),
                            instantTooltipText = new InstantTooltipSpriteText("this text has an instant tooltip!"),
                            customTooltipTextA = new CustomTooltipSpriteText("this one is custom!"),
                            customTooltipTextB = new CustomTooltipSpriteText("this one is also!"),
                            customTooltipTextAlt = new CustomTooltipSpriteTextAlt("but this one is different."),
                            emptyTooltipText = new InstantTooltipSpriteText("this text has an empty tooltip!", string.Empty),
                            nullTooltipText = new InstantTooltipSpriteText("this text has a nulled tooltip!", null),
                            tooltipTextBox = new TooltipTextBox
                            {
                                Text = "with real time updates!",
                                Size = new Vector2(400, 30),
                            },
                            new TooltipContainer
                            {
                                AutoSizeAxes = Axes.Both,
                                Child = new TooltipSpriteText("Nested tooltip; uses no cursor in all cases!"),
                            },
                            new TooltipTooltipContainer("This tooltip container has a tooltip itself!")
                            {
                                AutoSizeAxes = Axes.Both,
                                Child = new Container
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Child = new TooltipSpriteText("Nested tooltip; uses no cursor in all cases; parent TooltipContainer has a tooltip"),
                                }
                            },
                            new Container
                            {
                                Child = new FillFlowContainer
                                {
                                    Direction = FillDirection.Vertical,
                                    Spacing = new Vector2(0, 8),
                                    Children = new[]
                                    {
                                        new Container
                                        {
                                            Child = new Container
                                            {
                                                Child = new TooltipSpriteText("Tooltip within containers with zero size; i.e. parent is never hovered."),
                                            }
                                        },
                                        new Container
                                        {
                                            Child = new TooltipSpriteText("Other tooltip within containers with zero size; different nesting; overlap."),
                                        }
                                    }
                                }
                            }
                        },
                    }
                }
            });

            tooltipContainer.Add(makeBox(Anchor.BottomLeft));
            tooltipContainer.Add(makeBox(Anchor.TopRight));
            tooltipContainer.Add(makeBox(Anchor.BottomRight));
        }

        private class TestTooltipContainer : TooltipContainer
        {
            public new ITooltip CurrentTooltip => base.CurrentTooltip;

            public TestTooltipContainer(CursorContainer cursor)
                : base(cursor)
            {
            }
        }

        private class CustomTooltipSpriteText : Container, IHasCustomTooltip
        {
            public object TooltipContent { get; }

            public CustomTooltipSpriteText(string displayedContent, string tooltipContent = null)
            {
                TooltipContent = new CustomContent(tooltipContent ?? displayedContent);

                AutoSizeAxes = Axes.Both;
                Children = new[]
                {
                    new SpriteText
                    {
                        Text = displayedContent,
                    }
                };
            }

            public virtual ITooltip GetCustomTooltip() => new CustomTooltip();
        }

        private class CustomTooltipSpriteTextAlt : CustomTooltipSpriteText
        {
            public CustomTooltipSpriteTextAlt(string displayedContent, string tooltipContent = null)
                : base(displayedContent, tooltipContent)
            {
            }

            public override ITooltip GetCustomTooltip() => new CustomTooltipAlt();
        }

        private class CustomContent
        {
            public readonly LocalisableString Text;

            public CustomContent(string text)
            {
                Text = text;
            }
        }

        private class CustomTooltip : CompositeDrawable, ITooltip<CustomContent>
        {
            private static int i;

            private readonly SpriteText text;

            public CustomTooltip()
            {
                AutoSizeAxes = Axes.Both;

                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour = FrameworkColour.GreenDark,
                    },
                    text = new SpriteText
                    {
                        Font = FrameworkFont.Regular.With(size: 16),
                        Padding = new MarginPadding(5),
                    },
                    new SpriteText
                    {
                        Anchor = Anchor.BottomLeft,
                        Font = FontUsage.Default.With(size: 12),
                        Colour = Color4.Yellow,
                        Text = $"Custom tooltip instance {i++}"
                    },
                };
            }

            public void SetContent(CustomContent content) => text.Text = content.Text;

            public void Move(Vector2 pos) => Position = pos;
        }

        private class CustomTooltipAlt : CustomTooltip
        {
            public CustomTooltipAlt()
            {
                AutoSizeAxes = Axes.Both;

                Colour = Color4.Red;
            }
        }

        private class TooltipSpriteText : Container, IHasTooltip
        {
            public LocalisableString TooltipText { get; }

            public TooltipSpriteText(string displayedContent)
                : this(displayedContent, displayedContent)
            {
            }

            protected TooltipSpriteText(string displayedContent, string tooltipContent)
            {
                TooltipText = tooltipContent;

                AutoSizeAxes = Axes.Both;
                Children = new[]
                {
                    new SpriteText
                    {
                        Text = displayedContent,
                    }
                };
            }
        }

        private class InstantTooltipSpriteText : TooltipSpriteText, IHasAppearDelay
        {
            public InstantTooltipSpriteText(string tooltipContent)
                : base(tooltipContent, tooltipContent)
            {
            }

            public InstantTooltipSpriteText(string displayedContent, string tooltipContent)
                : base(displayedContent, tooltipContent)
            {
            }

            public double AppearDelay => 0;
        }

        private class TooltipTooltipContainer : TooltipContainer, IHasTooltip
        {
            public LocalisableString TooltipText { get; set; }

            public TooltipTooltipContainer(string tooltipText)
            {
                TooltipText = tooltipText;
            }
        }

        private class TooltipTextBox : BasicTextBox, IHasTooltip
        {
            public LocalisableString TooltipText => Text;
        }

        private class TooltipBox : Box, IHasTooltip
        {
            public LocalisableString TooltipText { get; set; }
        }

        private class RectangleCursorContainer : CursorContainer
        {
            protected override Drawable CreateCursor() => new RectangleCursor();

            private class RectangleCursor : Box
            {
                public RectangleCursor()
                {
                    Size = new Vector2(20, 40);
                }
            }
        }
    }
}


text:
<object-stream>
  <com.fatwire.realtime.ResourceDataImpl>
    <id class="string">OpenMarket/Xcelerate/AssetType/PageDefinition/RemotePost</id>
    <resourceType>ELEMENTCATALOG</resourceType>
    <deps class="empty-set"/>
    <data class="com.openmarket.xcelerate.common.ElementCatalogEntry" serialization="custom">
      <com.openmarket.xcelerate.common.ElementCatalogEntry>
        <int>1</int>
        <string>OpenMarket/Xcelerate/AssetType/PageDefinition/RemotePost</string>
        <string></string>
        <string></string>
        <string></string>
        <string>OpenMarket\Xcelerate\AssetType\PageDefinition\RemotePost.xml</string>
        <string></string>
        <string></string>
      </com.openmarket.xcelerate.common.ElementCatalogEntry>
    </data>
  </com.fatwire.realtime.ResourceDataImpl>
</object-stream>
<!--==================___ METADATA ___================
<dependencies>
  <list/>
</dependencies>
==================______________________==================
#
#Mon Dec 16 23:39:34 UTC 2013
storable0=/ELEMENTS/OpenMarket/Xcelerate/AssetType/PageDefinition/RemotePost.xml|null|_storable_type\=%2FELEMENTS%2FOpenMarket%2FXcelerate%2FAssetType%2FPageDefinition%2FRemotePost.xml
@hashval=-1103144555
key=@ELEMENTCATALOG-OpenMarket/Xcelerate/AssetType/PageDefinition/RemotePost
type=ELEMENTCATALOG

==================___ END METADATA ___==================-->


text:
class LandingController < ApplicationController
  def index
  end

  def stats
    response_set_count = ResponseSet.analytics_count(current_user)
    question_count = Question.analytics_count(current_user)
    section_count = Section.analytics_count(current_user)
    survey_count = Survey.analytics_count(current_user)

    my_response_set_count = current_user ? ResponseSet.where(created_by: current_user.id).all.count : 0
    my_question_count = current_user ? Question.where(created_by: current_user.id).all.count : 0
    my_section_count = current_user ? Section.where(created_by: current_user.id).all.count : 0
    my_survey_count = current_user ? Survey.where(created_by: current_user.id).all.count : 0

    render json: { response_set_count: response_set_count, question_count: question_count,
                   section_count: section_count, survey_count: survey_count, version: Settings.app_version,
                   my_response_set_count: my_response_set_count, my_question_count: my_question_count,
                   my_section_count: my_section_count, my_survey_count: my_survey_count }
  end
end
# rubocop:enable Metrics/AbcSize


text:
using System.Linq;
using System.Threading.Tasks;
using MichaelBrandonMorris.KingsportMillSafetyTraining.Db;
using MichaelBrandonMorris.KingsportMillSafetyTraining.Db.Models;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;

namespace MichaelBrandonMorris.KingsportMillSafetyTraining
{
    /// <summary>
    ///     Class SlideManager.
    /// </summary>
    /// <seealso cref="EntityManager{TEntity, TKey}" />
    /// TODO Edit XML Comment Template for SlideManager
    public class SlideManager : EntityManager<Slide, int>
    {
        /// <summary>
        ///     Initializes a new instance of the
        ///     <see cref="SlideManager" /> class.
        /// </summary>
        /// <param name="store">The store.</param>
        /// TODO Edit XML Comment Template for #ctor
        public SlideManager(SlideStore store)
            : base(store)
        {
            Store = store;
        }

        /// <summary>
        ///     Gets the slides.
        /// </summary>
        /// <value>The slides.</value>
        /// TODO Edit XML Comment Template for Slides
        public IQueryable<Slide> Slides => Store.Entities;

        /// <summary>
        ///     Gets or sets the store.
        /// </summary>
        /// <value>The store.</value>
        /// TODO Edit XML Comment Template for Store
        protected new SlideStore Store
        {
            get;
        }

        /// <summary>
        ///     Creates the specified options.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="context">The context.</param>
        /// <returns>SlideManager.</returns>
        /// TODO Edit XML Comment Template for Create
        public static SlideManager Create(
            IdentityFactoryOptions<SlideManager> options,
            IOwinContext context)
        {
            var manager = new SlideManager(
                new SlideStore(
                    context.Get<KingsportMillSafetyTrainingDbContext>()));

            return manager;
        }
    }
}


text:
import argparse
import subprocess
import os
import tempfile
import sys
import time
import signal
import yaml

argp = argparse.ArgumentParser(
    description='Runs a DNS server for LB interop tests')
argp.add_argument('-l',
                  '--grpclb_ips',
                  default=None,
                  type=str,
                  help='Comma-separated list of IP addresses of balancers')
argp.add_argument(
    '-f',
    '--fallback_ips',
    default=None,
    type=str,
    help='Comma-separated list of IP addresses of fallback servers')
argp.add_argument(
    '-c',
    '--cause_no_error_no_data_for_balancer_a_record',
    default=False,
    action='store_const',
    const=True,
    help=('Used for testing the case in which the grpclb '
          'balancer A record lookup results in a DNS NOERROR response '
          'but with no ANSWER section i.e. no addresses'))
args = argp.parse_args()

balancer_records = []
grpclb_ips = args.grpclb_ips.split(',')
if grpclb_ips[0]:
    for ip in grpclb_ips:
        balancer_records.append({
            'TTL': '2100',
            'data': ip,
            'type': 'A',
        })
fallback_records = []
fallback_ips = args.fallback_ips.split(',')
if fallback_ips[0]:
    for ip in fallback_ips:
        fallback_records.append({
            'TTL': '2100',
            'data': ip,
            'type': 'A',
        })
records_config_yaml = {
    'resolver_tests_common_zone_name':
        'test.google.fr.',
    'resolver_component_tests': [{
        'records': {
            '_grpclb._tcp.server': [{
                'TTL': '2100',
                'data': '0 0 12000 balancer',
                'type': 'SRV'
            },],
            'balancer': balancer_records,
            'server': fallback_records,
        }
    }]
}
if args.cause_no_error_no_data_for_balancer_a_record:
    balancer_records = records_config_yaml['resolver_component_tests'][0][
        'records']['balancer']
    assert not balancer_records
    # Insert a TXT record at the balancer.test.google.fr. domain.
    # This TXT record won't actually be resolved or used by gRPC clients;
    # inserting this record is just a way get the balancer.test.google.fr.
    # A record queries to return NOERROR DNS responses that also have no
    # ANSWER section, in order to simulate this failure case.
    balancer_records.append({
        'TTL': '2100',
        'data': 'arbitrary string that wont actually be resolved',
        'type': 'TXT',
    })
# Generate the actual DNS server records config file
records_config_path = tempfile.mktemp()
with open(records_config_path, 'w') as records_config_generated:
    records_config_generated.write(yaml.dump(records_config_yaml))

with open(records_config_path, 'r') as records_config_generated:
    sys.stderr.write('===== DNS server records config: =====\n')
    sys.stderr.write(records_config_generated.read())
    sys.stderr.write('======================================\n')

# Run the DNS server
# Note that we need to add the extra
# A record for metadata.google.internal in order for compute engine
# OAuth creds and ALTS creds to work.
# TODO(apolcyn): should metadata.google.internal always resolve
# to 169.254.169.254?
subprocess.check_output([
    '/var/local/git/grpc/test/cpp/naming/utils/dns_server.py',
    '--port=53',
    '--records_config_path',
    records_config_path,
    '--add_a_record=metadata.google.internal:169.254.169.254',
])


text:
package net.jawr.web.resource.bundle.iterator;

/**
 * This class defines the resource bundle path which will be rendered by the
 * BundleRenderer
 *
 * @author ibrahim Chaehoi
 *
 */
public class BundlePath {

	/** The bundle prefix */
	private String bundlePrefix;

	/** The bundle path */
	private String path;

	/** The flag indicating if it's an external URL or not */
	private boolean externalURL;

	/**
	 * Constructor
	 *
	 * @param bundlePrefix
	 *            the bundle prefix
	 * @param path
	 *            the bundle path, which is not a production URL
	 */
	public BundlePath(String bundlePrefix, String path) {
		this(bundlePrefix, path, false);
	}

	/**
	 * Constructor
	 *
	 * @param prefix
	 *            the bundle prefix
	 * @param path
	 *            the bundle path
	 * @param isExternalURL
	 *            flag indicating if it's an external URL or not
	 */
	public BundlePath(String prefix, String path, boolean isExternalURL) {
		super();
		this.bundlePrefix = prefix;
		this.path = path;
		this.externalURL = isExternalURL;
	}

	/**
	 * Returns the bundle prefix
	 *
	 * @return the bundle prefix
	 */
	public String getBundlePrefix() {
		return bundlePrefix;
	}

	/**
	 * Sets the bundle prefix
	 *
	 * @param bundlePrefix
	 *            the bundle prefix to set
	 */
	public void setBundlePrefix(String bundlePrefix) {
		this.bundlePrefix = bundlePrefix;
	}

	/**
	 * Returns the bundle path
	 *
	 * @return the bundle path
	 */
	public String getPath() {
		return path;
	}

	/**
	 * Sets the bundle path
	 *
	 * @param path
	 *            the path to set
	 */
	public void setPath(String path) {
		this.path = path;
	}

	/**
	 * Returns true if the path is the path for an external URL
	 *
	 * @return true if the path is the path for an external URL
	 */
	public boolean isExternalURL() {
		return externalURL;
	}

	/**
	 * Sets the production URL
	 *
	 * @param externalURL
	 *            the flag indicating if it's an external URL
	 */
	public void setExternalURL(boolean externalURL) {
		this.externalURL = externalURL;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Bundle Path : [" + bundlePrefix + "; " + path + " ; "
				+ (externalURL ? "alternale external URL" : "Not external URL") + "]";
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((bundlePrefix == null) ? 0 : bundlePrefix.hashCode());
		result = prime * result + ((path == null) ? 0 : path.hashCode());
		result = prime * result + (externalURL ? 1231 : 1237);
		return result;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BundlePath other = (BundlePath) obj;
		if (bundlePrefix == null) {
			if (other.bundlePrefix != null)
				return false;
		} else if (!bundlePrefix.equals(other.bundlePrefix))
			return false;
		if (path == null) {
			if (other.path != null)
				return false;
		} else if (!path.equals(other.path))
			return false;
		if (externalURL != other.externalURL)
			return false;
		return true;
	}

}


text:
package sivan.yue.quarrier.load;

import sivan.yue.quarrier.ITask;

/**
 * description: 所有load任务的基类
 * Created by xiwen.yxw on 2017/2/15.
 */
public abstract class LoadTask implements ITask {
}


text:
package io.apiman.test.suite;

import io.apiman.test.common.util.TestPlanRunner;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * A full apiman test suite.  Run this against an empty apiman installation as a smoke
 * test.  The suite will do the following:
 *
 *

 * 1) Global configuration
 *     a) Add policy definitions
 *     b) Add role definitions
 *     c) Create a Gateway
 * 2) Create a Test organization
 * 3) Add two Plans (Gold, Silver)
 * 4) Add an "Echo" service
 * 5) Create an application
 * 6) Create a contract from the app to the service via the Gold plan
 * 7) Create a contract from the app to the service via the Silver plan
 * 8) Publish and Register the service and app
 * 9) Send requests to the gateway
 *

 *
 * The following are pre-requisites for this test suite:
 *
 *

 * 1) apiman must be running :)
 * 2) a valid user must exist with admin privs (role = apiadmin)
 * 3) no data exists yet in apiman (empty database)
 * 4) the echo REST service must be running somewhere (can be found in apiman-quickstarts)
 *

 *
 * @author eric.wittmann@redhat.com
 */
@SuppressWarnings({"nls", "javadoc"})
public class FullTestSuite {

    /**
     * The test suite main entry point.
     * @param args
     * @throws Exception
     */
    public static void main(String [] args) throws Exception {
        String apiEndpoint = param("apiman.suite.api-endpoint", "API Endpoint", "http://localhost:8080/apiman");
        param("apiman.suite.api-username", "  Username", "admin");
        param("apiman.suite.api-password", "  Password", "admin123!");
        param("apiman.suite.gateway-config-endpoint", "Gateway Config Endpoint", "http://localhost:8080/apiman-gateway-api");
        param("apiman.suite.gateway-config-username", "  Username", "admin");
        param("apiman.suite.gateway-config-password", "  Password", "admin123!");
        String gatewayEndpoint = param("apiman.suite.gateway-endpoint", "Gateway HTTP Endpoint", "http://localhost:8080/apiman-gateway");
        param("apiman.suite.echo-endpoint", "Echo Service Endpoint", "http://localhost:8080/services/echo");

        TestPlanRunner runner = new TestPlanRunner();
        runner.runTestPlan("scripts/api-manager-testPlan.xml", FullTestSuite.class.getClassLoader(), apiEndpoint);
        runner.runTestPlan("scripts/api-gateway-testPlan.xml", FullTestSuite.class.getClassLoader(), gatewayEndpoint);
    }

    /**
     * Gets a param value, updates the system properties if necessary.
     * @param propertyName
     * @param prompt
     * @param defaultValue
     * @throws Exception
     */
    private static String param(String propertyName, String prompt, String defaultValue) throws Exception {
        if (System.getProperty(propertyName) != null) {
            return System.getProperty(propertyName);
        }
        System.out.print(prompt + " [" + defaultValue + "]: ");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        if (input == null || input.trim().isEmpty()) {
            input = defaultValue;
        }

        System.setProperty(propertyName, input);
        return input;
    }

}


text:
TEST(IO, IO) {
  // init log
  InitGoogleTestLogging();
}


text:
<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Dart tests" type="JUnit" factoryName="JUnit" singleton="true">
    <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
    <module name="Dart-community" />
    <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
    <option name="ALTERNATIVE_JRE_PATH" value="" />
    <option name="PACKAGE_NAME" value="" />
    <option name="MAIN_CLASS_NAME" value="" />
    <option name="METHOD_NAME" value="" />
    <option name="TEST_OBJECT" value="package" />
    <option name="VM_PARAMETERS" value="-ea -Didea.home.path=../ -Didea.system.path=../test-system -Didea.config.path=../test-config -XX:+HeapDumpOnOutOfMemoryError -Xmx350m -Djava.system.class.loader=com.intellij.util.lang.UrlClassLoader" />
    <option name="PARAMETERS" value="" />
    <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bin" />
    <option name="ENV_VARIABLES" />
    <option name="PASS_PARENT_ENVS" value="true" />
    <option name="TEST_SEARCH_SCOPE">
      <value defaultName="singleModule" />
    </option>
    <envs />
    <patterns />
    <method />
  </configuration>
</component>


text:
declare namespace javax {
  namespace swing {
    namespace colorchooser {

      class DefaultColorSelectionModel implements javax.swing.colorchooser.ColorSelectionModel, java.io.Serializable {
        protected changeEvent: javax.swing.event.ChangeEvent
        protected listenerList: javax.swing.event.EventListenerList
        public constructor()
        public constructor(arg0: java.awt.Color)
        public getSelectedColor(): java.awt.Color
        public setSelectedColor(arg0: java.awt.Color): void
        public addChangeListener(arg0: javax.swing.event.ChangeListener | javax.swing.event.ChangeListener$$lambda): void
        public removeChangeListener(arg0: javax.swing.event.ChangeListener | javax.swing.event.ChangeListener$$lambda): void
        public getChangeListeners(): javax.swing.event.ChangeListener[]
        protected fireStateChanged(): void
      }

    }
  }
}


text:
<?php

namespace MongoDB\Tests\Operation;

use MongoDB\Driver\BulkWrite;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern;
use MongoDB\Exception\UnsupportedException;
use MongoDB\Model\BSONDocument;
use MongoDB\Operation\FindAndModify;
use MongoDB\Tests\CommandObserver;

use function version_compare;

class FindAndModifyFunctionalTest extends FunctionalTestCase
{
    /**
     * @see https://jira.mongodb.org/browse/PHPLIB-344
     */
    public function testManagerReadConcernIsOmitted(): void
    {
        $manager = static::createTestManager(null, ['readConcernLevel' => 'majority']);
        $server = $manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));

        (new CommandObserver())->observe(
            function () use ($server): void {
                $operation = new FindAndModify(
                    $this->getDatabaseName(),
                    $this->getCollectionName(),
                    ['remove' => true]
                );

                $operation->execute($server);
            },
            function (array $event): void {
                $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand());
            }
        );
    }

    public function testDefaultWriteConcernIsOmitted(): void
    {
        (new CommandObserver())->observe(
            function (): void {
                $operation = new FindAndModify(
                    $this->getDatabaseName(),
                    $this->getCollectionName(),
                    ['remove' => true, 'writeConcern' => $this->createDefaultWriteConcern()]
                );

                $operation->execute($this->getPrimaryServer());
            },
            function (array $event): void {
                $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
            }
        );
    }

    public function testHintOptionUnsupportedClientSideError(): void
    {
        if (version_compare($this->getServerVersion(), '4.2.0', '>=')) {
            $this->markTestSkipped('server reports error for unsupported findAndModify options');
        }

        $operation = new FindAndModify(
            $this->getDatabaseName(),
            $this->getCollectionName(),
            ['remove' => true, 'hint' => '_id_']
        );

        $this->expectException(UnsupportedException::class);
        $this->expectExceptionMessage('Hint is not supported by the server executing this operation');

        $operation->execute($this->getPrimaryServer());
    }

    public function testHintOptionAndUnacknowledgedWriteConcernUnsupportedClientSideError(): void
    {
        if (version_compare($this->getServerVersion(), '4.4.0', '>=')) {
            $this->markTestSkipped('hint is supported');
        }

        $operation = new FindAndModify(
            $this->getDatabaseName(),
            $this->getCollectionName(),
            ['remove' => true, 'hint' => '_id_', 'writeConcern' => new WriteConcern(0)]
        );

        $this->expectException(UnsupportedException::class);
        $this->expectExceptionMessage('Hint is not supported by the server executing this operation');

        $operation->execute($this->getPrimaryServer());
    }

    public function testSessionOption(): void
    {
        (new CommandObserver())->observe(
            function (): void {
                $operation = new FindAndModify(
                    $this->getDatabaseName(),
                    $this->getCollectionName(),
                    ['remove' => true, 'session' => $this->createSession()]
                );

                $operation->execute($this->getPrimaryServer());
            },
            function (array $event): void {
                $this->assertObjectHasAttribute('lsid', $event['started']->getCommand());
            }
        );
    }

    public function testBypassDocumentValidationSetWhenTrue(): void
    {
        (new CommandObserver())->observe(
            function (): void {
                $operation = new FindAndModify(
                    $this->getDatabaseName(),
                    $this->getCollectionName(),
                    ['remove' => true, 'bypassDocumentValidation' => true]
                );

                $operation->execute($this->getPrimaryServer());
            },
            function (array $event): void {
                $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
                $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation);
            }
        );
    }

    public function testBypassDocumentValidationUnsetWhenFalse(): void
    {
        (new CommandObserver())->observe(
            function (): void {
                $operation = new FindAndModify(
                    $this->getDatabaseName(),
                    $this->getCollectionName(),
                    ['remove' => true, 'bypassDocumentValidation' => false]
                );

                $operation->execute($this->getPrimaryServer());
            },
            function (array $event): void {
                $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand());
            }
        );
    }

    /**
     * @dataProvider provideTypeMapOptionsAndExpectedDocument
     */
    public function testTypeMapOption(?array $typeMap, $expectedDocument): void
    {
        $this->createFixtures(1);

        $operation = new FindAndModify(
            $this->getDatabaseName(),
            $this->getCollectionName(),
            [
                'remove' => true,
                'typeMap' => $typeMap,
            ]
        );
        $document = $operation->execute($this->getPrimaryServer());

        $this->assertEquals($expectedDocument, $document);
    }

    public function provideTypeMapOptionsAndExpectedDocument()
    {
        return [
            [
                null,
                (object) ['_id' => 1, 'x' => (object) ['foo' => 'bar']],
            ],
            [
                ['root' => 'array', 'document' => 'array'],
                ['_id' => 1, 'x' => ['foo' => 'bar']],
            ],
            [
                ['root' => 'object', 'document' => 'array'],
                (object) ['_id' => 1, 'x' => ['foo' => 'bar']],
            ],
            [
                ['root' => 'array', 'document' => 'stdClass'],
                ['_id' => 1, 'x' => (object) ['foo' => 'bar']],
            ],
            [
                ['root' => BSONDocument::class, 'document' => 'object'],
                new BSONDocument(['_id' => 1, 'x' => (object) ['foo' => 'bar']]),
            ],
            [
                ['root' => 'array', 'document' => 'stdClass', 'fieldPaths' => ['x' => 'array']],
                ['_id' => 1, 'x' => ['foo' => 'bar']],
            ],
        ];
    }

    /**
     * Create data fixtures.
     *
     * @param integer $n
     */
    private function createFixtures(int $n): void
    {
        $bulkWrite = new BulkWrite(['ordered' => true]);

        for ($i = 1; $i <= $n; $i++) {
            $bulkWrite->insert([
                '_id' => $i,
                'x' => (object) ['foo' => 'bar'],
            ]);
        }

        $result = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite);

        $this->assertEquals($n, $result->getInsertedCount());
    }
}


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

<!--

 This file is part of the Sylius package.

 (c) Paweł Jędrzejewski

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <defaults public="true" />

        <service id="sylius.behat.page.admin.login" class="Sylius\Behat\Page\Admin\Account\LoginPage" parent="sylius.behat.symfony_page" public="false" />

        <service id="sylius.behat.page.admin.request_password_reset" class="Sylius\Behat\Page\Admin\Account\RequestPasswordResetPage" parent="sylius.behat.symfony_page" public="false" />
    </services>
</container>


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var express = require('express');
var review_controller_1 = require("./review.controller");
var controller = new review_controller_1.default();
var auth_service_1 = require("../../auth/auth.service");
var auth = new auth_service_1.default();
var router = express.Router();
router.get('/my', auth.attachUserInfo(), controller.myReviewOfProduct);
router.get('/updateAllQ', controller.updateAllQ);
router.get('/', controller.index);
router.get('/product/:id', controller.productReview);
router.get('/my/product/:id', auth.hasRole('user'), controller.index);
router.get('/:id', controller.get);
router.post('/', auth.hasRole('user'), controller.create);
router.put('/:id', auth.hasRole('manager'), controller.update);
router.patch('/:id', auth.hasRole('manager'), controller.update);
router.delete('/:id', auth.hasRole('user'), controller.delete);
module.exports = router;
//# sourceMappingURL=index.js.map


text:
<?php

namespace Never5\DownloadMonitor\Dependencies\Pimple;

use Never5\DownloadMonitor\Dependencies\Pimple\Exception\ExpectedInvokableException;
use Never5\DownloadMonitor\Dependencies\Pimple\Exception\FrozenServiceException;
use Never5\DownloadMonitor\Dependencies\Pimple\Exception\InvalidServiceIdentifierException;
use Never5\DownloadMonitor\Dependencies\Pimple\Exception\UnknownIdentifierException;

/**
 * Container main class.
 *
 * @author Fabien Potencier
 */
class Container implements \ArrayAccess
{
    private $values = array();
    private $factories;
    private $protected;
    private $frozen = array();
    private $raw = array();
    private $keys = array();

    /**
     * Instantiates the container.
     *
     * Objects and parameters can be passed as argument to the constructor.
     *
     * @param array $values The parameters or objects
     */
    public function __construct(array $values = array())
    {
        $this->factories = new \SplObjectStorage();
        $this->protected = new \SplObjectStorage();

        foreach ($values as $key => $value) {
            $this->offsetSet($key, $value);
        }
    }

    /**
     * Sets a parameter or an object.
     *
     * Objects must be defined as Closures.
     *
     * Allowing any PHP callable leads to difficult to debug problems
     * as function names (strings) are callable (creating a function with
     * the same name as an existing parameter would break your container).
     *
     * @param string $id    The unique identifier for the parameter or object
     * @param mixed  $value The value of the parameter or a closure to define an object
     *
     * @throws FrozenServiceException Prevent override of a frozen service
     */
    public function offsetSet($id, $value)
    {
        if (isset($this->frozen[$id])) {
            throw new FrozenServiceException($id);
        }

        $this->values[$id] = $value;
        $this->keys[$id] = true;
    }

    /**
     * Gets a parameter or an object.
     *
     * @param string $id The unique identifier for the parameter or object
     *
     * @return mixed The value of the parameter or an object
     *
     * @throws UnknownIdentifierException If the identifier is not defined
     */
    public function offsetGet($id)
    {
        if (!isset($this->keys[$id])) {
            throw new UnknownIdentifierException($id);
        }

        if (
            isset($this->raw[$id])
            || !\is_object($this->values[$id])
            || isset($this->protected[$this->values[$id]])
            || !\method_exists($this->values[$id], '__invoke')
        ) {
            return $this->values[$id];
        }

        if (isset($this->factories[$this->values[$id]])) {
            return $this->values[$id]($this);
        }

        $raw = $this->values[$id];
        $val = $this->values[$id] = $raw($this);
        $this->raw[$id] = $raw;

        $this->frozen[$id] = true;

        return $val;
    }

    /**
     * Checks if a parameter or an object is set.
     *
     * @param string $id The unique identifier for the parameter or object
     *
     * @return bool
     */
    public function offsetExists($id)
    {
        return isset($this->keys[$id]);
    }

    /**
     * Unsets a parameter or an object.
     *
     * @param string $id The unique identifier for the parameter or object
     */
    public function offsetUnset($id)
    {
        if (isset($this->keys[$id])) {
            if (\is_object($this->values[$id])) {
                unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]);
            }

            unset($this->values[$id], $this->frozen[$id], $this->raw[$id], $this->keys[$id]);
        }
    }

    /**
     * Marks a callable as being a factory service.
     *
     * @param callable $callable A service definition to be used as a factory
     *
     * @return callable The passed callable
     *
     * @throws ExpectedInvokableException Service definition has to be a closure or an invokable object
     */
    public function factory($callable)
    {
        if (!\method_exists($callable, '__invoke')) {
            throw new ExpectedInvokableException('Service definition is not a Closure or invokable object.');
        }

        $this->factories->attach($callable);

        return $callable;
    }

    /**
     * Protects a callable from being interpreted as a service.
     *
     * This is useful when you want to store a callable as a parameter.
     *
     * @param callable $callable A callable to protect from being evaluated
     *
     * @return callable The passed callable
     *
     * @throws ExpectedInvokableException Service definition has to be a closure or an invokable object
     */
    public function protect($callable)
    {
        if (!\method_exists($callable, '__invoke')) {
            throw new ExpectedInvokableException('Callable is not a Closure or invokable object.');
        }

        $this->protected->attach($callable);

        return $callable;
    }

    /**
     * Gets a parameter or the closure defining an object.
     *
     * @param string $id The unique identifier for the parameter or object
     *
     * @return mixed The value of the parameter or the closure defining an object
     *
     * @throws UnknownIdentifierException If the identifier is not defined
     */
    public function raw($id)
    {
        if (!isset($this->keys[$id])) {
            throw new UnknownIdentifierException($id);
        }

        if (isset($this->raw[$id])) {
            return $this->raw[$id];
        }

        return $this->values[$id];
    }

    /**
     * Extends an object definition.
     *
     * Useful when you want to extend an existing object definition,
     * without necessarily loading that object.
     *
     * @param string   $id       The unique identifier for the object
     * @param callable $callable A service definition to extend the original
     *
     * @return callable The wrapped callable
     *
     * @throws UnknownIdentifierException        If the identifier is not defined
     * @throws FrozenServiceException            If the service is frozen
     * @throws InvalidServiceIdentifierException If the identifier belongs to a parameter
     * @throws ExpectedInvokableException        If the extension callable is not a closure or an invokable object
     */
    public function extend($id, $callable)
    {
        if (!isset($this->keys[$id])) {
            throw new UnknownIdentifierException($id);
        }

        if (isset($this->frozen[$id])) {
            throw new FrozenServiceException($id);
        }

        if (!\is_object($this->values[$id]) || !\method_exists($this->values[$id], '__invoke')) {
            throw new InvalidServiceIdentifierException($id);
        }

        if (isset($this->protected[$this->values[$id]])) {
            @\trigger_error(\sprintf('How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "%s" should be protected?', $id), \E_USER_DEPRECATED);
        }

        if (!\is_object($callable) || !\method_exists($callable, '__invoke')) {
            throw new ExpectedInvokableException('Extension service definition is not a Closure or invokable object.');
        }

        $factory = $this->values[$id];

        $extended = function ($c) use ($callable, $factory) {
            return $callable($factory($c), $c);
        };

        if (isset($this->factories[$factory])) {
            $this->factories->detach($factory);
            $this->factories->attach($extended);
        }

        return $this[$id] = $extended;
    }

    /**
     * Returns all defined value names.
     *
     * @return array An array of value names
     */
    public function keys()
    {
        return \array_keys($this->values);
    }

    /**
     * Registers a service provider.
     *
     * @param ServiceProviderInterface $provider A ServiceProviderInterface instance
     * @param array                    $values   An array of values that customizes the provider
     *
     * @return static
     */
    public function register(ServiceProviderInterface $provider, array $values = array())
    {
        $provider->register($this);

        foreach ($values as $key => $value) {
            $this[$key] = $value;
        }

        return $this;
    }
}


text:
package com.handmark.pulltorefresh.library.internal;

import android.annotation.TargetApi;
import android.view.View;

@TargetApi(16)
public class SDK16 {

	public static void postOnAnimation(View view, Runnable runnable) {
		view.postOnAnimation(runnable);
	}

}


text:
package com.atinternet.tracker;

import java.util.Date;

/**
 * Wrapper class to manage Screen instances
 */
public class DynamicScreens extends Helper {

    DynamicScreens(Tracker tracker) {
        super(tracker);
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @return the DynamicScreen instance
     * @deprecated Since 2.2.1, use {@link #add(String, String, Date)} instead.
     */
    @Deprecated
    public DynamicScreen add(int screenId, String name, Date update) {
        return add(String.valueOf(screenId), name, update);
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @return the DynamicScreen instance
     */
    public DynamicScreen add(String screenId, String name, Date update) {
        DynamicScreen dynamicScreen = new DynamicScreen(tracker)
                .setScreenId(screenId)
                .setName(name)
                .setUpdate(update);

        tracker.getBusinessObjects().put(dynamicScreen.getId(), dynamicScreen);

        return dynamicScreen;
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @param chapter1 dynamic screen first chapter
     * @return the DynamicScreen instance
     * @deprecated Since 2.2.1, use {@link #add(String, String, Date, String)} instead.
     */
    @Deprecated
    public DynamicScreen add(int screenId, String name, Date update, String chapter1) {
        return add(String.valueOf(screenId), name, update).setChapter1(chapter1);
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @param chapter1 dynamic screen first chapter
     * @return the DynamicScreen instance
     */
    public DynamicScreen add(String screenId, String name, Date update, String chapter1) {
        return add(screenId, name, update).setChapter1(chapter1);
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @param chapter1 dynamic screen first chapter
     * @param chapter2 dynamic screen second chapter
     * @return the DynamicScreen instance
     * @deprecated Since 2.2.1, use {@link #add(String, String, Date, String, String)} instead.
     */
    @Deprecated
    public DynamicScreen add(int screenId, String name, Date update, String chapter1, String chapter2) {
        return add(String.valueOf(screenId), name, update, chapter1).setChapter2(chapter2);
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @param chapter1 dynamic screen first chapter
     * @param chapter2 dynamic screen second chapter
     * @return the DynamicScreen instance
     */
    public DynamicScreen add(String screenId, String name, Date update, String chapter1, String chapter2) {
        return add(screenId, name, update, chapter1).setChapter2(chapter2);
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @param chapter1 dynamic screen first chapter
     * @param chapter2 dynamic screen second chapter
     * @param chapter3 dynamic screen third chapter
     * @return the DynamicScreen instance
     * @deprecated Since 2.2.1, use {@link #add(String, String, Date, String, String, String)} instead.
     */
    @Deprecated
    public DynamicScreen add(int screenId, String name, Date update, String chapter1, String chapter2, String chapter3) {
        return add(String.valueOf(screenId), name, update, chapter1, chapter2).setChapter3(chapter3);
    }

    /**
     * Add a new dynamic screen
     *
     * @param screenId dynamic screen identifier
     * @param name     dynamic screen name
     * @param update   dynamic screen update date
     * @param chapter1 dynamic screen first chapter
     * @param chapter2 dynamic screen second chapter
     * @param chapter3 dynamic screen third chapter
     * @return the DynamicScreen instance
     */
    public DynamicScreen add(String screenId, String name, Date update, String chapter1, String chapter2, String chapter3) {
        return add(screenId, name, update, chapter1, chapter2).setChapter3(chapter3);
    }
}


text:
#![crate_name = "chroot"]
#![feature(collections, core, old_io, os, old_path, rustc_private, std_misc)]

extern crate getopts;
extern crate libc;

use getopts::{optflag, optopt, getopts, usage};
use c_types::{get_pw_from_args, get_group};
use libc::funcs::posix88::unistd::{execvp, setuid, setgid};
use std::ffi::{CStr, CString};
use std::old_io::fs::PathExtensions;
use std::iter::FromIterator;

#[path = "../common/util.rs"] #[macro_use] mod util;
#[path = "../common/c_types.rs"] mod c_types;

extern {
    fn chroot(path: *const libc::c_char) -> libc::c_int;
}

#[cfg(any(target_os = "macos", target_os = "freebsd"))]
extern {
    fn setgroups(size: libc::c_int, list: *const libc::gid_t) -> libc::c_int;
}

#[cfg(target_os = "linux")]
extern {
    fn setgroups(size: libc::size_t, list: *const libc::gid_t) -> libc::c_int;
}

static NAME: &'static str = "chroot";
static VERSION: &'static str = "1.0.0";

pub fn uumain(args: Vec<String>) -> i32 {
    let program = &args[0];

    let options = [
        optopt("u", "user", "User (ID or name) to switch before running the program", "USER"),
        optopt("g", "group", "Group (ID or name) to switch to", "GROUP"),
        optopt("G", "groups", "Comma-separated list of groups to switch to", "GROUP1,GROUP2…"),
        optopt("", "userspec", "Colon-separated user and group to switch to. \
                                Same as -u USER -g GROUP. \
                                Userspec has higher preference than -u and/or -g", "USER:GROUP"),
        optflag("h", "help", "Show help"),
        optflag("V", "version", "Show program's version")
    ];

    let opts = match getopts(args.tail(), &options) {
        Ok(m) => m,
        Err(f) => {
            show_error!("{}", f);
            help_menu(program.as_slice(), &options);
            return 1
        }
    };

    if opts.opt_present("V") { version(); return 0 }
    if opts.opt_present("h") { help_menu(program.as_slice(), &options); return 0 }

    if opts.free.len() == 0 {
        println!("Missing operand: NEWROOT");
        println!("Try `{} --help` for more information.", program.as_slice());
        return 1
    }

    let default_shell: &'static str = "/bin/sh";
    let default_option: &'static str = "-i";
    let user_shell = std::os::getenv("SHELL");

    let newroot = Path::new(opts.free[0].as_slice());
    if !newroot.is_dir() {
        crash!(1, "cannot change root directory to `{}`: no such directory", newroot.display());
    }

    let command: Vec<&str> = match opts.free.len() {
        1 => {
            let shell: &str = match user_shell {
                None => default_shell,
                Some(ref s) => s.as_slice()
            };
            vec!(shell, default_option)
        }
        _ => opts.free[1..opts.free.len()].iter().map(|x| x.as_slice()).collect()
    };

    set_context(&newroot, &opts);

    unsafe {
        let executable = CString::new(command[0]).unwrap().as_bytes_with_nul().as_ptr();
        let mut command_parts: Vec<*const u8> = command.iter().map(|x| CString::new(x.as_bytes()).unwrap().as_bytes_with_nul().as_ptr()).collect();
        command_parts.push(std::ptr::null());
        execvp(executable as *const libc::c_char, command_parts.as_ptr() as *mut *const libc::c_char) as i32
    }
}

fn set_context(root: &Path, options: &getopts::Matches) {
    let userspec_str = options.opt_str("userspec");
    let user_str = options.opt_str("user").unwrap_or_default();
    let group_str = options.opt_str("group").unwrap_or_default();
    let groups_str = options.opt_str("groups").unwrap_or_default();
    let userspec = match userspec_str {
        Some(ref u) => {
            let s: Vec<&str> = u.as_slice().split(':').collect();
            if s.len() != 2 {
                crash!(1, "invalid userspec: `{}`", u.as_slice())
            };
            s
        }
        None => Vec::new()
    };
    let user = if userspec.is_empty() { user_str.as_slice() } else { userspec[0].as_slice() };
    let group = if userspec.is_empty() { group_str.as_slice() } else { userspec[1].as_slice() };

    enter_chroot(root);

    set_groups_from_str(groups_str.as_slice());
    set_main_group(group);
    set_user(user);
}

fn enter_chroot(root: &Path) {
    let root_str = root.display();
    std::os::change_dir(root).unwrap();
    let err = unsafe {
        chroot(CString::new(b".").unwrap().as_bytes_with_nul().as_ptr() as *const libc::c_char)
    };
    if err != 0 {
        crash!(1, "cannot chroot to {}: {}", root_str, strerror(err).as_slice())
    };
}

fn set_main_group(group: &str) {
    if !group.is_empty() {
        let group_id = match get_group(group) {
            None => crash!(1, "no such group: {}", group),
            Some(g) => g.gr_gid
        };
        let err = unsafe { setgid(group_id) };
        if err != 0 {
            crash!(1, "cannot set gid to {}: {}", group_id, strerror(err).as_slice())
        }
    }
}

#[cfg(any(target_os = "macos", target_os = "freebsd"))]
fn set_groups(groups: Vec<libc::gid_t>) -> libc::c_int {
    unsafe {
        setgroups(groups.len() as libc::c_int,
                  groups.as_slice().as_ptr())
    }
}

#[cfg(target_os = "linux")]
fn set_groups(groups: Vec<libc::gid_t>) -> libc::c_int {
    unsafe {
        setgroups(groups.len() as libc::size_t,
                  groups.as_slice().as_ptr())
    }
}

fn set_groups_from_str(groups: &str) {
    if !groups.is_empty() {
        let groups_vec: Vec<libc::gid_t> = FromIterator::from_iter(
            groups.split(',').map(
                |x| match get_group(x) {
                    None => crash!(1, "no such group: {}", x),
                    Some(g) => g.gr_gid
                })
            );
        let err = set_groups(groups_vec);
        if err != 0 {
            crash!(1, "cannot set groups: {}", strerror(err).as_slice())
        }
    }
}

fn set_user(user: &str) {
    if !user.is_empty() {
        let user_id = get_pw_from_args(&vec!(String::from_str(user))).unwrap().pw_uid;
        let err = unsafe { setuid(user_id as libc::uid_t) };
        if err != 0 {
            crash!(1, "cannot set user to {}: {}", user, strerror(err).as_slice())
        }
    }
}

fn strerror(errno: i32) -> String {
    unsafe {
        let err = libc::funcs::c95::string::strerror(errno) as *const libc::c_char;
        let bytes= CStr::from_ptr(err).to_bytes();
        String::from_utf8_lossy(bytes).to_string()
    }
}

fn version() {
    println!("{} v{}", NAME, VERSION)
}

fn help_menu(program: &str, options: &[getopts::OptGroup]) {
    version();
    println!("Usage:");
    println!("  {} [OPTION]… NEWROOT [COMMAND [ARG]…]", program);
    println!("");
    print!("{}", usage(
            "Run COMMAND with root directory set to NEWROOT.\n\
             If COMMAND is not specified, it defaults to '${SHELL} -i'. \
             If ${SHELL} is not set, /bin/sh is used.", options))
}


text:
/**
 *
 */
package com.thinkbiganalytics.kylo.catalog.credential.spi;

/*-
 * #%L
 * kylo-catalog-credential-api
 * %%
 * Copyright (C) 2017 - 2018 ThinkBig Analytics, a Teradata Company
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import com.thinkbiganalytics.kylo.catalog.rest.model.DataSource;

import org.springframework.core.annotation.Order;

import java.security.Principal;
import java.util.Map;
import java.util.Set;

/**
 * A service provider interface to be implemented by providers of data source authentication credentials.
 */
@Order(DataSourceCredentialProvider.DEFAULT_ORDER)
public interface DataSourceCredentialProvider {

    int MIN_ORDER = Integer.MAX_VALUE - 100;
    int DEFAULT_ORDER = 100;

    /**
     * Indicates whether this provider supplies credentials for a given data source.
     * @param ds the data source
     * @return true if credentials may be accessed for this data source
     */
    boolean accepts(DataSource ds);

    /**
     * Retrieves the credentials for the specified data source based upon the requester's
     * security principals.
     * @param ds the data source
     * @param principals the requester's principals
     * @return the credential properties applicable for the data source
     */
    Map<String, String> getCredentials(DataSource ds, Set<Principal> principals);

    /**
     * Removes credentials for given data source
     * @param ds the data source
     */
    Void removeCredentials(DataSource ds);

    /**
     * Creates/modifies the data source properties by inserting placeholders for the data
     * source's credentials based upon configured authentication scheme.
     * @param ds the data source
     * @param principals the requester's principals
     * @return a modified data source containing the placeholders
     */
    DataSource applyPlaceholders(DataSource ds, Set<Principal> principals);

    /**
     * Modifies the specified data source by embedding the appropriate credentials
     * into its properties based upon configured authentication scheme.
     * @param ds the data source
     * @param principals the requester's principals
     * @return a modified data source containing authentication credentials
     */
    DataSource applyCredentials(DataSource ds, Set<Principal> principals);
}


text:
var FormEditTenantController = function(tenant, $scope, $controller, $uibModal, $anchorScroll, locationUtils, tenantService, messageModel) {

    // extends the FormTenantController to inherit common methods
    angular.extend(this, $controller('FormTenantController', { tenant: tenant, $scope: $scope }));

    var deleteTenant = function(tenant) {
        tenantService.deleteTenant(tenant.id)
            .then(function(result) {
                messageModel.setMessages(result.data.alerts, true);
                locationUtils.navigateToPath('/tenants');
            });
    };

    $scope.tenantName = angular.copy(tenant.name);

    $scope.settings = {
        isNew: false,
        saveLabel: 'Update'
    };

    $scope.save = function(tenant) {
        tenantService.updateTenant(tenant).
            then(function() {
                $scope.tenantName = angular.copy(tenant.name);
                $anchorScroll(); // scrolls window to top
            });
    };

    $scope.confirmDelete = function(tenant) {
        var params = {
            title: 'Delete Tenant: ' + tenant.name,
            key: tenant.name
        };
        var modalInstance = $uibModal.open({
            templateUrl: 'common/modules/dialog/delete/dialog.delete.tpl.html',
            controller: 'DialogDeleteController',
            size: 'md',
            resolve: {
                params: function () {
                    return params;
                }
            }
        });
        modalInstance.result.then(function() {
            deleteTenant(tenant);
        }, function () {
            // do nothing
        });
    };

};

FormEditTenantController.$inject = ['tenant', '$scope', '$controller', '$uibModal', '$anchorScroll', 'locationUtils', 'tenantService', 'messageModel'];
module.exports = FormEditTenantController;


text:
package main

import (
	"encoding/json"
	"fmt"
	"math/rand"
	"os"
	"os/signal"
	"strings"
	"sync"
	"time"

	"github.com/Sirupsen/logrus"
)

const (
	prefixLength           = 2
	savedHeadlinesFileName = "headlines.json"
)

var (
	ChainLock     sync.RWMutex
	HeadlineChain *Chain
	Logger        *logrus.Logger
)

func init() {
	Logger = logrus.New()
}

func main() {
	// Catch interrupts
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		for range c {
			SaveHeadlines()
			os.Exit(0)
		}
	}()

	ParseConfig()

	rand.Seed(time.Now().UnixNano())

	// Create the markov chain
	HeadlineChain = NewChain(prefixLength)

	// Start fetching new headlines
	feeds := CreateFeeds()
	pollChan := feeds.Poll(10 * time.Second)
	nextTweetChan := time.After(1 * time.Millisecond)

	LoadExistingHeadlines()

	for {
		// Wait until RSS feeds have been updated
		<-pollChan

		avg := Headlines(FetchedHeadlines).AverageWords()

		// dump out some headlines for sample use
		for i := 0; i < 10; i++ {
			fmt.Println(HeadlineChain.Generate(avg))
		}

		if GlobalConfig.Twitter.PostTweet {
			// If we can't tweet within one second, continue
			select {
			case <-time.After(1 * time.Second):
				break
			case <-nextTweetChan:
				var result string
				for {
					result = HeadlineChain.Generate(avg)
					if strings.HasSuffix(result, "?") || strings.HasSuffix(result, ".") ||
						strings.HasSuffix(result, "!") || strings.HasSuffix(result, ":") {
						break
					}
				}
				PostTweet(result)
				nextTweetChan = time.After(timeBetweenTweets())
				break
			}
		}
	}
}

// Time to wait between tweets
func timeBetweenTweets() time.Duration {
	return 1 * time.Hour
}

// Loads saved BuzzFeed headlines
func LoadExistingHeadlines() {
	var headlines []string

	file, err := os.Open(savedHeadlinesFileName)
	if err != nil {
		return
	}

	defer file.Close()

	decoder := json.NewDecoder(file)

	err = decoder.Decode(&headlines)

	if err != nil {
		Logger.Errorln(err)
		return
	}

	ChainLock.Lock()
	FetchedHeadlinesLock.Lock()
	defer ChainLock.Unlock()
	defer FetchedHeadlinesLock.Unlock()

	for _, line := range headlines {
		reader := strings.NewReader(line)
		FetchedHeadlines = append(FetchedHeadlines, line)
		HeadlineChain.Build(reader)
	}
}

// Saves grabbed headlines to the output file for use at a later date (like after a restart)
func SaveHeadlines() {
	file, err := os.OpenFile(savedHeadlinesFileName, os.O_CREATE|os.O_WRONLY, 0775)
	if err != nil {
		Logger.Errorln(err)
		return
	}

	defer file.Close()

	encoder := json.NewEncoder(file)

	FetchedHeadlinesLock.RLock()
	defer FetchedHeadlinesLock.RUnlock()

	err = encoder.Encode(FetchedHeadlines)

	if err != nil {
		Logger.Errorln(err)
	}
}