text:
*Jake VanderPlas*

- email: <jakevdp@uw.edu>
- twitter: [@jakevdp](https://twitter.com/jakevdp)
- github: [jakevdp](http://github.com/jakevdp)

This repository contains notebooks and other files associated with my
[Scikit-learn](http://scikit-learn.org) tutorial.

## Installation Notes
This tutorial requires the following packages:

- Python version 2.6-2.7 or 3.3+
- `numpy` version 1.5 or later: http://www.numpy.org/
- `scipy` version 0.10 or later: http://www.scipy.org/
- `matplotlib` version 1.3 or later: http://matplotlib.org/
- `scikit-learn` version 0.14 or later: http://scikit-learn.org
- `ipython` version 2.0 or later, with notebook support: http://ipython.org
- `seaborn` version 0.5 or later

The easiest way to get these is to use the [conda](https://store.continuum.io/) environment manager.
I suggest downloading and installing [miniconda](http://conda.pydata.org/miniconda.html).

Once this is installed, the following command will install all required packages in your Python environment:
```
Original install (2015)
$ conda install numpy scipy matplotlib scikit-learn ipython-notebook seaborn

Or for current versions of Anaconda (Mar 2018)

$ conda create -n skl_tut python=3.4.5 ipywidgets=5.2.2 numpy scipy matplotlib scikit-learn ipython-notebook seaborn pillow

$ activate skl_tut

$ jupyter notebook --notebook-dir='<tutorial folder>'
```

Alternatively, you can download and install the (very large) Anaconda software distribution, found at https://store.continuum.io/.

## Downloading the Tutorial Materials
I would highly recommend using git, not only for this tutorial, but for the
general betterment of your life.  Once git is installed, you can clone the
material in this tutorial by using the git address shown above:

    git clone git://github.com/jakevdp/sklearn_tutorial.git

If you can't or don't want to install git, there is a link above to download
the contents of this repository as a zip file.  I may make minor changes to
the repository in the days before the tutorial, however, so cloning the
repository is a much better option.

## Notebook Listing
You can [view the tutorial materials](http://nbviewer.ipython.org/github/jakevdp/sklearn_tutorial/blob/master/notebooks/Index.ipynb) using the excellent nbviewer service.

Note, however, that you cannot modify or run the contents within nbviewer.
To modify them, first download the tutorial repository, change to the notebooks directory, and run ``ipython notebook``.
You should see the list in the ipython notebook launch page in your web browser.
For more information on the IPython notebook, see http://ipython.org/notebook.html

Note also that some of the code in these notebooks will not work outside the
directory structure of this tutorial, so it is important to clone the full
repository if possible.


text:
var JGO = JGO || {};

JGO.BOARD = JGO.BOARD || {};

JGO.BOARD.medium = {
    textures: {
        black: '../lib/medium/black.png',
        white: '../lib/medium/white.png',
        shadow:'../lib/medium/shadow.png',
        board: '../lib/medium/shinkaya.jpg'
    },

    // Margins around the board, both on normal edges and clipped ones
    margin: {normal: 20, clipped: 20},

    // Shadow color, blur and offset
    boardShadow: {color: '#ffe0a8', blur: 15, offX: 2.5, offY: 2.5},

    // Lighter border around the board makes it more photorealistic
    border: {color: 'rgba(255, 255, 255, 0.3)', lineWidth: 2},

    // Amount of "extra wood" around the grid where stones lie
    padding: {normal: 10, clipped: 5},

    // Grid color and size, line widths
    grid: {color: '#202020', x: 25, y: 25, smooth: 0,
        borderWidth: 1.2, lineWidth: 0.9},

    // Star point radius
    stars: {radius: 2.5},

    // Coordinate color and font
    coordinates: {color: '#808080', font: 'normal 12px sanf-serif'},

    // Stone radius  and alpha for semi-transparent stones
    stone: {radius: 12, dimAlpha:0.6},

    // Shadow offset from center
    shadow: {xOff: -1, yOff: 1},

    // Mark base size and line width, color and font settings
    mark: {lineWidth: 1.0, blackColor: 'white', whiteColor: 'black',
        clearColor: 'black', font: 'normal 12px sanf-serif'}
};

JGO.BOARD.mediumWalnut = JGO.util.extend(JGO.util.extend({}, JGO.BOARD.medium), {
    textures: {board: '../lib/medium/walnut.jpg', shadow: '../lib/medium/shadow_dark.png'},
    boardShadow: {color: '#e2baa0'},
    grid: {color: '#101010', borderWidth: 1.4, lineWidth: 1.1}
});

JGO.BOARD.mediumBW = JGO.util.extend(JGO.util.extend({}, JGO.BOARD.medium), {
    textures: false
});

redpajama_set_name: RedPajamaGithub


text:
/*! \file AssertError.h
 *  \brief Assertion error
 */

#ifndef ASSERTERROR_H
#define ASSERTERROR_H

#include <exception>

//! Basic assertion error
class AssertError: public std::exception
{
	virtual const char* what() const throw()
	{
		return "Assertion failed";
	}
};

#endif


text:
package com.microsoft.azure.management.network.v2018_08_01.implementation;

import java.util.List;
import com.microsoft.azure.management.network.v2018_08_01.EffectiveRoute;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Response for list effective route API service call.
 */
public class EffectiveRouteListResultInner {
    /**
     * A list of effective routes.
     */
    @JsonProperty(value = "value")
    private List<EffectiveRoute> value;

    /**
     * The URL to get the next set of results.
     */
    @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
    private String nextLink;

    /**
     * Get a list of effective routes.
     *
     * @return the value value
     */
    public List<EffectiveRoute> value() {
        return this.value;
    }

    /**
     * Set a list of effective routes.
     *
     * @param value the value value to set
     * @return the EffectiveRouteListResultInner object itself.
     */
    public EffectiveRouteListResultInner withValue(List<EffectiveRoute> value) {
        this.value = value;
        return this;
    }

    /**
     * Get the URL to get the next set of results.
     *
     * @return the nextLink value
     */
    public String nextLink() {
        return this.nextLink;
    }

}


text:
package ca.uhn.fhir.rest.gclient;

import org.hl7.fhir.instance.model.IBaseResource;

import ca.uhn.fhir.model.primitive.IdDt;

public interface IReadTyped<T extends IBaseResource> {

	IReadExecutable<T> withId(String theId);

	IReadExecutable<T> withIdAndVersion(String theId, String theVersion);

	/**
	 * Search using an ID. Note that even if theId contains a base URL it will be
	 * ignored in favour of the base url for the given client. If you want to specify
	 * an absolute URL including a base and have that base used instead, use
	 * {@link #withUrl(IdDt)}
	 */
	IReadExecutable<T> withId(IdDt theId);

	IReadExecutable<T> withUrl(String theUrl);

	IReadExecutable<T> withUrl(IdDt theUrl);
}


text:
package com.sequenceiq.redbeams.flow.redbeams.start.actions;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.util.Optional;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.statemachine.StateContext;

import com.sequenceiq.cloudbreak.auth.crn.Crn;
import com.sequenceiq.cloudbreak.auth.crn.CrnTestUtil;
import com.sequenceiq.cloudbreak.cloud.context.CloudContext;
import com.sequenceiq.cloudbreak.cloud.model.CloudCredential;
import com.sequenceiq.cloudbreak.cloud.model.DatabaseStack;
import com.sequenceiq.flow.core.Flow;
import com.sequenceiq.flow.core.FlowParameters;
import com.sequenceiq.flow.core.FlowRegister;
import com.sequenceiq.redbeams.api.model.common.DetailedDBStackStatus;
import com.sequenceiq.redbeams.converter.cloud.CredentialToCloudCredentialConverter;
import com.sequenceiq.redbeams.converter.spi.DBStackToDatabaseStackConverter;
import com.sequenceiq.redbeams.domain.stack.DBStack;
import com.sequenceiq.redbeams.dto.Credential;
import com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsContext;
import com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsEvent;
import com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsFailureEvent;
import com.sequenceiq.redbeams.flow.redbeams.start.RedbeamsStartEvent;
import com.sequenceiq.redbeams.flow.redbeams.start.RedbeamsStartState;
import com.sequenceiq.redbeams.metrics.MetricType;
import com.sequenceiq.redbeams.metrics.RedbeamsMetricService;
import com.sequenceiq.redbeams.service.CredentialService;
import com.sequenceiq.redbeams.service.stack.DBStackService;
import com.sequenceiq.redbeams.service.stack.DBStackStatusUpdater;

@ExtendWith(MockitoExtension.class)
public class StartDatabaseServerFailedActionTest {

    private static final Long RESOURCE_ID = 123L;

    private static final String FLOW_ID = "flowId";

    private static final String USER_NAME = "userName";

    private static final String ACCOUNT_ID = "accountId";

    private static final Long DB_STACK_ID = 12345L;

    private static final String DB_STACK_NAME = "dbStackName";

    private static final String DB_STACK_CLOUD_PLATFORM = "dbStackCloudPlatform";

    private static final String DB_STACK_PLATFORM_VARIANT = "dbStackPlatformVariant";

    private static final String DB_STACK_REGION = "dbStackRegion";

    private static final String DB_STACK_AZ = "dbStackAz";

    private static final String DB_STACK_ENV_ID = "dbStackEnvId";

    @Mock
    private DBStackService dbStackService;

    @Mock
    private DBStackStatusUpdater dbStackStatusUpdater;

    @Mock
    private RedbeamsMetricService metricService;

    @Mock
    private DBStack dbStack;

    @Mock
    private Exception exception;

    @Mock
    private Flow flow;

    @Mock
    private FlowRegister runningFlows;

    @Mock
    private FlowParameters flowParameters;

    @Mock
    private StateContext<RedbeamsStartState, RedbeamsStartEvent> stateContext;

    @Mock
    private RedbeamsFailureEvent payload;

    @Mock
    private Crn ownerCrn;

    @Mock
    private CredentialService credentialService;

    @Mock
    private CredentialToCloudCredentialConverter credentialConverter;

    @Mock
    private Credential credential;

    @Mock
    private CloudCredential cloudCredential;

    @Mock
    private DBStackToDatabaseStackConverter databaseStackConverter;

    @Mock
    private DatabaseStack databaseStack;

    @Mock
    private CloudContext cloudContext;

    @InjectMocks
    private StartDatabaseServerFailedAction victim;

    @Test
    public void shouldUpdateStatusAndIncrementMetricOnPrepare() {
        RedbeamsFailureEvent event = new RedbeamsFailureEvent(RESOURCE_ID, exception);
        Optional<DBStack> dbStackOptional = Optional.of(dbStack);
        when(dbStackStatusUpdater.updateStatus(RESOURCE_ID, DetailedDBStackStatus.START_FAILED, null)).thenReturn(dbStackOptional);

        victim.prepareExecution(event, null);

        verify(metricService).incrementMetricCounter(MetricType.DB_START_FAILED, dbStackOptional);
    }

    @Test
    public void shouldUpdateStatusWithUknownErrorAndIncrementMetricOnPrepare() {
        RedbeamsFailureEvent event = new RedbeamsFailureEvent(RESOURCE_ID, null);
        Optional<DBStack> dbStackOptional = Optional.of(dbStack);
        when(dbStackStatusUpdater.updateStatus(RESOURCE_ID, DetailedDBStackStatus.START_FAILED, "Unknown error")).thenReturn(dbStackOptional);

        victim.prepareExecution(event, null);

        verify(metricService).incrementMetricCounter(MetricType.DB_START_FAILED, dbStackOptional);
    }

    @Test
    public void shouldCreateFlowContext() {
        when(flowParameters.getFlowId()).thenReturn(FLOW_ID);
        when(runningFlows.get(FLOW_ID)).thenReturn(flow);
        when(payload.getException()).thenReturn(exception);
        when(payload.getResourceId()).thenReturn(RESOURCE_ID);
        when(dbStackService.getById(RESOURCE_ID)).thenReturn(dbStack);
        when(dbStack.getOwnerCrn()).thenReturn(ownerCrn);
        when(dbStack.getId()).thenReturn(DB_STACK_ID);
        when(dbStack.getName()).thenReturn(DB_STACK_NAME);
        when(dbStack.getCloudPlatform()).thenReturn(DB_STACK_CLOUD_PLATFORM);
        when(dbStack.getPlatformVariant()).thenReturn(DB_STACK_PLATFORM_VARIANT);
        when(dbStack.getRegion()).thenReturn(DB_STACK_REGION);
        when(dbStack.getAvailabilityZone()).thenReturn(DB_STACK_AZ);
        when(dbStack.getEnvironmentId()).thenReturn(DB_STACK_ENV_ID);
        when(dbStack.getResourceCrn()).thenReturn(CrnTestUtil.getDatabaseServerCrnBuilder()
                .setAccountId("acc")
                .setResource("resource")
                .build().toString());
        when(ownerCrn.getUserId()).thenReturn(USER_NAME);
        when(ownerCrn.getAccountId()).thenReturn(ACCOUNT_ID);
        when(credentialService.getCredentialByEnvCrn(DB_STACK_ENV_ID)).thenReturn(credential);
        when(credentialConverter.convert(credential)).thenReturn(cloudCredential);
        when(databaseStackConverter.convert(dbStack)).thenReturn(databaseStack);

        RedbeamsContext redbeamsStartContext = victim.createFlowContext(flowParameters, stateContext, payload);

        verify(flow).setFlowFailed(exception);

        assertEquals(flowParameters, redbeamsStartContext.getFlowParameters());
        assertEquals(DB_STACK_ID, redbeamsStartContext.getCloudContext().getId());
        assertEquals(DB_STACK_NAME, redbeamsStartContext.getCloudContext().getName());
        assertEquals(DB_STACK_CLOUD_PLATFORM, redbeamsStartContext.getCloudContext().getPlatform().value());
        assertEquals(DB_STACK_PLATFORM_VARIANT, redbeamsStartContext.getCloudContext().getVariant().value());
        assertEquals(DB_STACK_REGION, redbeamsStartContext.getCloudContext().getLocation().getRegion().value());
        assertEquals(DB_STACK_AZ, redbeamsStartContext.getCloudContext().getLocation().getAvailabilityZone().value());
        assertEquals(ACCOUNT_ID, redbeamsStartContext.getCloudContext().getAccountId());
        assertEquals(flowParameters, redbeamsStartContext.getFlowParameters());
        assertEquals(cloudCredential, redbeamsStartContext.getCloudCredential());
        assertEquals(databaseStack, redbeamsStartContext.getDatabaseStack());
    }

    @Test
    public void shouldCreateRequest() {
        RedbeamsContext context = new RedbeamsContext(flowParameters, cloudContext, cloudCredential, databaseStack, dbStack);

        RedbeamsEvent request = (RedbeamsEvent) victim.createRequest(context);
        assertEquals(RedbeamsStartEvent.REDBEAMS_START_FAILURE_HANDLED_EVENT.event(), request.selector());
    }
}


text:
package org.opensmartgridplatform.domain.core.valueobjects.smartmetering;

import org.opensmartgridplatform.domain.core.valueobjects.DeviceFunction;
import org.opensmartgridplatform.shared.exceptionhandling.FunctionalException;

public class GetMbusEncryptionKeyStatusRequestData extends MbusActionRequest {

    private static final long serialVersionUID = 3636769765482239443L;

    public GetMbusEncryptionKeyStatusRequestData(final String mbusDeviceIdentification) {
        super(mbusDeviceIdentification);
    }

    @Override
    public void validate() throws FunctionalException {
        // No validation needed

    }

    @Override
    public DeviceFunction getDeviceFunction() {
        return DeviceFunction.GET_MBUS_ENCRYPTION_KEY_STATUS;
    }

}


text:
package main

import (
	"log"
	"sync"
)

type DownloadingManager struct {
	In         chan string
	ClipsMutex sync.Mutex
	Clips      map[string]DmClip
}

type DmClip struct {
	Clip        Clip
	outMutex    sync.Mutex
	errorsMutex sync.Mutex
	Outs        map[string]chan string
	Errs        map[string]chan error
}

func (dmClip DmClip) write(message string) {
	for _, channel := range dmClip.Outs {
		channel <- message
	}
}

func (dmClip DmClip) writeError(err error) {
	for _, channel := range dmClip.Errs {
		channel <- err
	}
}

func CreateDownloadingManager() DownloadingManager {
	log.Println("Initializing DownloadingManager")
	dm := DownloadingManager{
		In:    make(chan string, 8192),
		Clips: make(map[string]DmClip),
	}
	return dm
}

func (this DownloadingManager) addClips(clips Clips) (chan string, chan error) {
	// TODO: Check if the clips exists in the database before adding to the list; if it does exist, write on Out channel

	outChan := make(chan string)
	errChan := make(chan error)

	for _, clip := range clips.Clips {
		this.ClipsMutex.Lock()
		if _, ok := this.Clips[clip.Slug]; ok != true {
			this.Clips[clip.Slug] = DmClip{
				Clip: clip,
				Outs: make(map[string]chan string),
				Errs: make(map[string]chan error),
			}
		}
		this.Clips[clip.Slug].Outs[clips.ID] = outChan
		this.Clips[clip.Slug].Errs[clips.ID] = errChan
		this.ClipsMutex.Unlock()

		this.In <- clip.Slug

	}
	return outChan, errChan
}

func (this DownloadingManager) checkChannelAmount(id string) int {
	amount := 0
	for _, dmClip := range this.Clips  {
		if _, ok := dmClip.Outs[id]; ok == true {
			amount++
		}
	}
	return amount
}

func (this DownloadingManager) run() {
	log.Println("Starting Downloading Manager")
	for true {
		id := <-this.In
		dmClip := this.Clips[id]
		log.Println("[DownloadingManager] Getting and downloading ", dmClip.Clip.Slug)
		err := dmClip.Clip.Get()
		if err != nil {
			dmClip.writeError(err)
		} else {
			err = dmClip.Clip.Download()
			log.Println("[DownloadingManager] Finished: ", dmClip.Clip.Slug)
			if err != nil {
				dmClip.writeError(err)
			} else {
				// TODO: add the clip to the database
				dmClip.write(dmClip.Clip.Slug)
				dmClip.writeError(nil)
			}
		}

		if this.checkChannelAmount(id) == 1 {
			close(dmClip.Outs[id])
			close(dmClip.Errs[id])
		}

		this.ClipsMutex.Lock()
		delete(this.Clips, dmClip.Clip.Slug)
		this.ClipsMutex.Unlock()

		log.Println("[DownladingManager] Done with: ", dmClip.Clip.Slug)
	}
}


text:
package jadx.core.xmlgen;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

public class XmlSecurity {

	private static DocumentBuilderFactory secureDbf = null;

	private XmlSecurity() {
	}

	public static DocumentBuilderFactory getSecureDbf() throws ParserConfigurationException {
		synchronized (XmlSecurity.class) {
			if (secureDbf == null) {
				secureDbf = DocumentBuilderFactory.newInstance();
				secureDbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
				secureDbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
				secureDbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
				secureDbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
				secureDbf.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes", false);
				secureDbf.setXIncludeAware(false);
				secureDbf.setExpandEntityReferences(false);
			}
		}
		return secureDbf;
	}
}


text:
using System;

namespace ExCSS
{
    internal sealed class SkewTransform : ITransform
    {
        internal SkewTransform(float alpha, float beta)
        {
            Alpha = alpha;
            Beta = beta;
        }

        public TransformMatrix ComputeMatrix()
        {
            var a = (float) Math.Tan(Alpha);
            var b = (float) Math.Tan(Beta);
            return new TransformMatrix(1f, a, 0f, b, 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 0f);
        }

        public float Alpha { get; }
        public float Beta { get; }
    }
}


text:
"use strict";
var page = require('webpage').create(),
    system = require('system'),
    address, output, size, pageWidth, pageHeight;

if (system.args.length < 3 || system.args.length > 5) {
    console.log('Usage: rasterize.js URL filename');
    slimer.exit(1);
} else {
    address = system.args[1];
    output = system.args[2];

    page.settings.userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36';
    page.settings.javascriptEnabled = false;

    page.viewportSize = { width: 1280, height: 1080 };

    page.zoomFactor = 1;

    page.open(address, function(status){ // executed after loading
        if (status !== 'success') {
            console.log('Unable to load the address!');
            slimer.exit(1);
        } else {
            // store a screenshot of the page
            page.viewportSize =
                { width:1280, height:1080 };
            page.render(output,
                   {onlyViewport:true});
            slimer.exit();
        }
    });
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<hudson.scm.CVSSCM_-DescriptorImpl>
  <helpRedirect/>
  <generation>1</generation>
  <noCompression>false</noCompression>
</hudson.scm.CVSSCM_-DescriptorImpl>


text:
require "pathname"

require "vagrant/action/builder"

module VagrantPlugins
  module Rackspace
    module Action
      # Include the built-in modules so we can use them as top-level things.
      include Vagrant::Action::Builtin

      # This action is called to destroy the remote machine.
      def self.action_destroy
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use Call, IsCreated do |env, b2|
            if !env[:result]
              b2.use MessageNotCreated
              next
            end

            b2.use ConnectRackspace
            b2.use DeleteServer
          end
        end
      end

      # This action is called to read the SSH info of the machine. The
      # resulting state is expected to be put into the `:machine_ssh_info`
      # key.
      def self.action_read_ssh_info
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use ConnectRackspace
          b.use ReadSSHInfo
        end
      end

      # This action is called to read the state of the machine. The
      # resulting state is expected to be put into the `:machine_state_id`
      # key.
      def self.action_read_state
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use ConnectRackspace
          b.use ReadState
        end
      end

      def self.action_ssh
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use Call, IsCreated do |env, b2|
            if !env[:result]
              b2.use MessageNotCreated
              next
            end

            b2.use SSHExec
          end
        end
      end

      def self.action_up
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use Call, IsCreated do |env, b2|
            if env[:result]
              b2.use MessageAlreadyCreated
              next
            end

            b2.use ConnectRackspace
            b2.use Provision
            b2.use SyncFolders
            b2.use WarnNetworks
            b2.use CreateServer
          end
        end
      end

      # The autoload farm
      action_root = Pathname.new(File.expand_path("../action", __FILE__))
      autoload :ConnectRackspace, action_root.join("connect_rackspace")
      autoload :CreateServer, action_root.join("create_server")
      autoload :DeleteServer, action_root.join("delete_server")
      autoload :IsCreated, action_root.join("is_created")
      autoload :MessageAlreadyCreated, action_root.join("message_already_created")
      autoload :MessageNotCreated, action_root.join("message_not_created")
      autoload :ReadSSHInfo, action_root.join("read_ssh_info")
      autoload :ReadState, action_root.join("read_state")
      autoload :SyncFolders, action_root.join("sync_folders")
      autoload :WarnNetworks, action_root.join("warn_networks")
    end
  end
end


text:
package com.barentine.totalconnect.ws;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for ArrayOfEventTypeInfo complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="ArrayOfEventTypeInfo">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="EventTypeInfo" type="{https://services.alarmnet.com/TC2/}EventTypeInfo" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfEventTypeInfo", propOrder = {
    "eventTypeInfo"
})
public class ArrayOfEventTypeInfo {

    @XmlElement(name = "EventTypeInfo", nillable = true)
    protected List<EventTypeInfo> eventTypeInfo;

    /**
     * Gets the value of the eventTypeInfo property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the eventTypeInfo property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getEventTypeInfo().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link EventTypeInfo }
     *
     *
     */
    public List<EventTypeInfo> getEventTypeInfo() {
        if (eventTypeInfo == null) {
            eventTypeInfo = new ArrayList<EventTypeInfo>();
        }
        return this.eventTypeInfo;
    }

}


text:
import { Meteor } from 'meteor/meteor';

import moment from 'moment';

import { Courses } from '/imports/api/courses/courses';
import { Locations } from '/imports/api/locations/locations';
import { Queues } from '/imports/api/queues/queues';

import { createCourse } from '/imports/api/courses/methods';
import { createLocation } from '/imports/api/locations/methods';
import { createQueue } from '/imports/api/queues/methods';
import { createUser } from '/imports/lib/both/users';

let testCourseId;
let testLocationId;
let testTAId;

function createUsers() {
  const users = Meteor.settings.users;
  users.forEach((user) => {
    const userId = createUser(Object.assign(user, { testCourseId }));
    if (user.type === 'ta') {
      testTAId = userId;
    }
  });
}

function init() {
  // Course
  const testCourse = Courses.findOne({ name: 'cs00' });
  testCourseId = testCourse ? testCourse._id : createCourse.call({
    name: 'cs00',
    description: 'Test Course',
  });

  // Users
  createUsers();

  // Location
  const testLocation = Locations.findOne({ name: 'Test Location' });
  testLocationId = testLocation ? testLocation._id : createLocation.call({
    name: 'Test Location',
  });

  // Queue
  const testQueue = Queues.findOne({ courseId: testCourseId });
  if (!testQueue) {
    createQueue.run.call({ userId: testTAId }, {
      name: 'TA Hours',
      courseId: testCourseId,
      locationId: testLocationId,
      scheduledEndTime: moment().add(4, 'hours').startOf('hour').toDate(),
    });
  }
}

// Note: we must put this inside a Meteor.startup() block because migrations
// only run inside a Meteor.startup block. We can only setup fixtures after
// migrations are done.
Meteor.startup(() => {
  init();
});


text:
package de.oglimmer.game.servlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import de.oglimmer.game.logic.GameManager;

// import javax.servlet.annotation.WebListener;

/**
 * Application Lifecycle Listener implementation class GameContextListener
 *
 */
// @WebListener
public class GameContextListener implements ServletContextListener {

	/**
	 * Default constructor.
	 */
	public GameContextListener() {
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		GameManager.getInstance().clear();
	}

}


text:
package de.mineformers.core.network.serializer

import de.mineformers.core.network.Message.Serializer
import de.mineformers.core.tileentity.{Describable, TileDescription}
import io.netty.buffer.ByteBuf
import net.minecraftforge.fml.common.network.ByteBufUtils

/**
 * TileDescriptionSerializer
 *
 * @author PaleoCrafter
 */
class TileDescriptionSerializer extends Serializer[TileDescription] {
  override def serialize0(target: TileDescription, buffer: ByteBuf): Unit = {
    ByteBufUtils.writeUTF8String(buffer, target.parentClass.getName)
    target.write(buffer)
  }

  override def deserialize0(buffer: ByteBuf): TileDescription = {
    val clazz = Class.forName(ByteBufUtils.readUTF8String(buffer))
    val desc = new TileDescription(clazz.asInstanceOf[Class[Describable]])
    desc.read(buffer)
    desc
  }
}


text:
// Per the Apache License, Section 4b, this file has been modified from its original version for use in this library.
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.Security.Claims;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Provider;

namespace Owin.Security.ActiveDirectoryLDAP
{
    /// <summary>
    /// Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.
    /// </summary>
    public class LDAPAuthenticatedContext : BaseContext
    {
        /// <summary>
        /// Initializes a <see cref="LDAPAuthenticatedContext"/>
        /// </summary>
        /// <param name="context">The OWIN environment</param>
        public LDAPAuthenticatedContext(IOwinContext context)
            : base(context)
        {
        }

        /// <summary>
        /// Gets the <see cref="ClaimsIdentity"/> representing the user
        /// </summary>
        public ClaimsIdentity Identity { get; set; }
        /// <summary>
        /// Gets or sets a property bag for common authentication properties
        /// </summary>
        public AuthenticationProperties Properties { get; set; }
    }
}


text:
namespace ndnboost { namespace detail {

template <class ForwardIter, class Tp>
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
                             const Tp& val)
{
    typedef detail::iterator_traits<ForwardIter> traits;

    typename traits::difference_type len = ndnboost::detail::distance(first, last);
    typename traits::difference_type half;
    ForwardIter middle;

    while (len > 0) {
      half = len >> 1;
      middle = first;
      std::advance(middle, half);
      if (*middle < val) {
        first = middle;
        ++first;
        len = len - half - 1;
      }
      else
        len = half;
    }
    return first;
}

template <class ForwardIter, class Tp, class Compare>
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
                              const Tp& val, Compare comp)
{
  typedef detail::iterator_traits<ForwardIter> traits;

  typename traits::difference_type len = ndnboost::detail::distance(first, last);
  typename traits::difference_type half;
  ForwardIter middle;

  while (len > 0) {
    half = len >> 1;
    middle = first;
    std::advance(middle, half);
    if (comp(*middle, val)) {
      first = middle;
      ++first;
      len = len - half - 1;
    }
    else
      len = half;
  }
  return first;
}

template <class ForwardIter, class Tp>
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
                           const Tp& val)
{
  typedef detail::iterator_traits<ForwardIter> traits;

  typename traits::difference_type len = ndnboost::detail::distance(first, last);
  typename traits::difference_type half;
  ForwardIter middle;

  while (len > 0) {
    half = len >> 1;
    middle = first;
    std::advance(middle, half);
    if (val < *middle)
      len = half;
    else {
      first = middle;
      ++first;
      len = len - half - 1;
    }
  }
  return first;
}

template <class ForwardIter, class Tp, class Compare>
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
                           const Tp& val, Compare comp)
{
  typedef detail::iterator_traits<ForwardIter> traits;

  typename traits::difference_type len = ndnboost::detail::distance(first, last);
  typename traits::difference_type half;
  ForwardIter middle;

  while (len > 0) {
    half = len >> 1;
    middle = first;
    std::advance(middle, half);
    if (comp(val, *middle))
      len = half;
    else {
      first = middle;
      ++first;
      len = len - half - 1;
    }
  }
  return first;
}

template <class ForwardIter, class Tp>
std::pair<ForwardIter, ForwardIter>
equal_range(ForwardIter first, ForwardIter last, const Tp& val)
{
  typedef detail::iterator_traits<ForwardIter> traits;

  typename traits::difference_type len = ndnboost::detail::distance(first, last);
  typename traits::difference_type half;
  ForwardIter middle, left, right;

  while (len > 0) {
    half = len >> 1;
    middle = first;
    std::advance(middle, half);
    if (*middle < val) {
      first = middle;
      ++first;
      len = len - half - 1;
    }
    else if (val < *middle)
      len = half;
    else {
      left = ndnboost::detail::lower_bound(first, middle, val);
      std::advance(first, len);
      right = ndnboost::detail::upper_bound(++middle, first, val);
      return std::pair<ForwardIter, ForwardIter>(left, right);
    }
  }
  return std::pair<ForwardIter, ForwardIter>(first, first);
}

template <class ForwardIter, class Tp, class Compare>
std::pair<ForwardIter, ForwardIter>
equal_range(ForwardIter first, ForwardIter last, const Tp& val,
              Compare comp)
{
  typedef detail::iterator_traits<ForwardIter> traits;

  typename traits::difference_type len = ndnboost::detail::distance(first, last);
  typename traits::difference_type half;
  ForwardIter middle, left, right;

  while (len > 0) {
    half = len >> 1;
    middle = first;
    std::advance(middle, half);
    if (comp(*middle, val)) {
      first = middle;
      ++first;
      len = len - half - 1;
    }
    else if (comp(val, *middle))
      len = half;
    else {
      left = ndnboost::detail::lower_bound(first, middle, val, comp);
      std::advance(first, len);
      right = ndnboost::detail::upper_bound(++middle, first, val, comp);
      return std::pair<ForwardIter, ForwardIter>(left, right);
    }
  }
  return std::pair<ForwardIter, ForwardIter>(first, first);
}

template <class ForwardIter, class Tp>
bool binary_search(ForwardIter first, ForwardIter last,
                   const Tp& val) {
  ForwardIter i = ndnboost::detail::lower_bound(first, last, val);
  return i != last && !(val < *i);
}

template <class ForwardIter, class Tp, class Compare>
bool binary_search(ForwardIter first, ForwardIter last,
                   const Tp& val,
                   Compare comp) {
  ForwardIter i = ndnboost::detail::lower_bound(first, last, val, comp);
  return i != last && !comp(val, *i);
}

}} // namespace ndnboost::detail

#endif // BINARY_SEARCH_NDNBOOST_DWA_122600_H_


text:
import { ServiceClientOptions, RequestOptions, ServiceCallback, ServiceClientCredentials } from 'ms-rest';
import * as operations from "./operations";

declare class AutoRestAzureSpecialParametersTestClient {
    /**
     * @class
     * Initializes a new instance of the AutoRestAzureSpecialParametersTestClient class.
     * @constructor
     *
     * @param {credentials} credentials - Gets Azure subscription credentials.
     *
     * @param {string} subscriptionId - The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'
     *
     * @param {string} [baseUri] - The base URI of the service.
     *
     * @param {object} [options] - The parameter options
     *
     * @param {Array} [options.filters] - Filters to be added to the request pipeline
     *
     * @param {object} [options.requestOptions] - Options for the underlying request object
     * {@link https://github.com/request/request#requestoptions-callback Options doc}
     *
     * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
     *
     * @param {string} [options.apiVersion] - The api version, which appears in the query, the value is always '2015-07-01-preview'
     *
     * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
     *
     * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
     *
     * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
     *
     */
    constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri: string, options: ServiceClientOptions);

    credentials: ServiceClientCredentials;

    subscriptionId: string;

    apiVersion: string;

    acceptLanguage: string;

    longRunningOperationRetryTimeout: number;

    generateClientRequestId: boolean;

    // Operation groups
    xMsClientRequestId: operations.XMsClientRequestId;
    subscriptionInCredentials: operations.SubscriptionInCredentials;
    subscriptionInMethod: operations.SubscriptionInMethod;
    apiVersionDefault: operations.ApiVersionDefault;
    apiVersionLocal: operations.ApiVersionLocal;
    skipUrlEncoding: operations.SkipUrlEncoding;
    odata: operations.Odata;
    header: operations.Header;
    }

export = AutoRestAzureSpecialParametersTestClient;


text:
package leap.orm.dao.query;

import leap.junit.concurrent.ConcurrentRule;
import leap.orm.junit.OrmTestBase;
import leap.orm.tested.model.petclinic.Owner;

import org.junit.Rule;
import org.junit.Test;

public class ConcurrentQueryTest extends OrmTestBase {

	@Rule
	public ConcurrentRule concurrentRule = new ConcurrentRule();

	@Test
	public void testConcurrentSimpleQuery() {
		Owner.all();
	}

}


text:
namespace groupAssignment
{
    partial class frmLoginForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.lblUsername = new System.Windows.Forms.Label();
            this.lblPassword = new System.Windows.Forms.Label();
            this.txtName = new System.Windows.Forms.TextBox();
            this.txtPassword = new System.Windows.Forms.TextBox();
            this.btnExit = new System.Windows.Forms.Button();
            this.btnLogin = new System.Windows.Forms.Button();
            this.grpbx_top = new System.Windows.Forms.GroupBox();
            this.llbl_register = new System.Windows.Forms.LinkLabel();
            this.lbl_register = new System.Windows.Forms.Label();
            this.lbl_forgotpassword = new System.Windows.Forms.Label();
            this.llbl_forgotpassword = new System.Windows.Forms.LinkLabel();
            this.grpbx_bottom = new System.Windows.Forms.GroupBox();
            this.lbl_errors = new System.Windows.Forms.Label();
            this.grpbx_top.SuspendLayout();
            this.grpbx_bottom.SuspendLayout();
            this.SuspendLayout();
            //
            // lblUsername
            //
            this.lblUsername.AutoSize = true;
            this.lblUsername.BackColor = System.Drawing.Color.Transparent;
            this.lblUsername.Font = new System.Drawing.Font("Palatino Linotype", 12.06283F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblUsername.Location = new System.Drawing.Point(6, 9);
            this.lblUsername.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
            this.lblUsername.Name = "lblUsername";
            this.lblUsername.Size = new System.Drawing.Size(182, 45);
            this.lblUsername.TabIndex = 0;
            this.lblUsername.Text = "Username:";
            //
            // lblPassword
            //
            this.lblPassword.AutoSize = true;
            this.lblPassword.BackColor = System.Drawing.Color.Transparent;
            this.lblPassword.Font = new System.Drawing.Font("Palatino Linotype", 12.06283F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblPassword.Location = new System.Drawing.Point(16, 57);
            this.lblPassword.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
            this.lblPassword.Name = "lblPassword";
            this.lblPassword.Size = new System.Drawing.Size(172, 45);
            this.lblPassword.TabIndex = 1;
            this.lblPassword.Text = "Password:";
            //
            // txtName
            //
            this.txtName.Location = new System.Drawing.Point(193, 23);
            this.txtName.Margin = new System.Windows.Forms.Padding(6);
            this.txtName.Name = "txtName";
            this.txtName.Size = new System.Drawing.Size(154, 31);
            this.txtName.TabIndex = 2;
            //
            // txtPassword
            //
            this.txtPassword.Location = new System.Drawing.Point(193, 68);
            this.txtPassword.Margin = new System.Windows.Forms.Padding(6);
            this.txtPassword.Name = "txtPassword";
            this.txtPassword.PasswordChar = '*';
            this.txtPassword.Size = new System.Drawing.Size(154, 31);
            this.txtPassword.TabIndex = 3;
            //
            // btnExit
            //
            this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnExit.Location = new System.Drawing.Point(241, 111);
            this.btnExit.Margin = new System.Windows.Forms.Padding(6);
            this.btnExit.Name = "btnExit";
            this.btnExit.Size = new System.Drawing.Size(106, 40);
            this.btnExit.TabIndex = 5;
            this.btnExit.Text = "&Cancel";
            this.btnExit.UseVisualStyleBackColor = true;
            this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
            //
            // btnLogin
            //
            this.btnLogin.Location = new System.Drawing.Point(111, 111);
            this.btnLogin.Margin = new System.Windows.Forms.Padding(6);
            this.btnLogin.Name = "btnLogin";
            this.btnLogin.Size = new System.Drawing.Size(118, 40);
            this.btnLogin.TabIndex = 4;
            this.btnLogin.Text = "&LogIn";
            this.btnLogin.UseVisualStyleBackColor = true;
            this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
            //
            // grpbx_top
            //
            this.grpbx_top.BackColor = System.Drawing.Color.Transparent;
            this.grpbx_top.Controls.Add(this.btnLogin);
            this.grpbx_top.Controls.Add(this.btnExit);
            this.grpbx_top.Controls.Add(this.txtPassword);
            this.grpbx_top.Controls.Add(this.txtName);
            this.grpbx_top.Controls.Add(this.lblPassword);
            this.grpbx_top.Controls.Add(this.lblUsername);
            this.grpbx_top.Location = new System.Drawing.Point(22, 12);
            this.grpbx_top.Name = "grpbx_top";
            this.grpbx_top.Size = new System.Drawing.Size(373, 176);
            this.grpbx_top.TabIndex = 6;
            this.grpbx_top.TabStop = false;
            //
            // llbl_register
            //
            this.llbl_register.AutoSize = true;
            this.llbl_register.Location = new System.Drawing.Point(254, 26);
            this.llbl_register.Name = "llbl_register";
            this.llbl_register.Size = new System.Drawing.Size(93, 26);
            this.llbl_register.TabIndex = 7;
            this.llbl_register.TabStop = true;
            this.llbl_register.Text = "Register";
            this.llbl_register.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
            //
            // lbl_register
            //
            this.lbl_register.AutoSize = true;
            this.lbl_register.Location = new System.Drawing.Point(9, 26);
            this.lbl_register.Name = "lbl_register";
            this.lbl_register.Size = new System.Drawing.Size(229, 26);
            this.lbl_register.TabIndex = 8;
            this.lbl_register.Text = "Do not have account ?";
            //
            // lbl_forgotpassword
            //
            this.lbl_forgotpassword.AutoSize = true;
            this.lbl_forgotpassword.Location = new System.Drawing.Point(9, 52);
            this.lbl_forgotpassword.Name = "lbl_forgotpassword";
            this.lbl_forgotpassword.Size = new System.Drawing.Size(239, 26);
            this.lbl_forgotpassword.TabIndex = 9;
            this.lbl_forgotpassword.Text = "Forgot your password ?";
            //
            // llbl_forgotpassword
            //
            this.llbl_forgotpassword.AutoSize = true;
            this.llbl_forgotpassword.Location = new System.Drawing.Point(254, 52);
            this.llbl_forgotpassword.Name = "llbl_forgotpassword";
            this.llbl_forgotpassword.Size = new System.Drawing.Size(109, 26);
            this.llbl_forgotpassword.TabIndex = 10;
            this.llbl_forgotpassword.TabStop = true;
            this.llbl_forgotpassword.Text = "Click here";
            this.llbl_forgotpassword.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbl_forgotpassword_LinkClicked);
            //
            // grpbx_bottom
            //
            this.grpbx_bottom.Controls.Add(this.llbl_forgotpassword);
            this.grpbx_bottom.Controls.Add(this.lbl_forgotpassword);
            this.grpbx_bottom.Controls.Add(this.lbl_register);
            this.grpbx_bottom.Controls.Add(this.llbl_register);
            this.grpbx_bottom.Location = new System.Drawing.Point(22, 194);
            this.grpbx_bottom.Name = "grpbx_bottom";
            this.grpbx_bottom.Size = new System.Drawing.Size(373, 90);
            this.grpbx_bottom.TabIndex = 11;
            this.grpbx_bottom.TabStop = false;
            //
            // lbl_errors
            //
            this.lbl_errors.AutoSize = true;
            this.lbl_errors.ForeColor = System.Drawing.Color.Red;
            this.lbl_errors.Location = new System.Drawing.Point(22, 303);
            this.lbl_errors.Name = "lbl_errors";
            this.lbl_errors.Size = new System.Drawing.Size(0, 26);
            this.lbl_errors.TabIndex = 12;
            //
            // frmLoginForm
            //
            this.AcceptButton = this.btnLogin;
            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.btnExit;
            this.ClientSize = new System.Drawing.Size(421, 405);
            this.Controls.Add(this.lbl_errors);
            this.Controls.Add(this.grpbx_bottom);
            this.Controls.Add(this.grpbx_top);
            this.ForeColor = System.Drawing.SystemColors.ControlText;
            this.Margin = new System.Windows.Forms.Padding(6);
            this.Name = "frmLoginForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "LogIn";
            this.grpbx_top.ResumeLayout(false);
            this.grpbx_top.PerformLayout();
            this.grpbx_bottom.ResumeLayout(false);
            this.grpbx_bottom.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label lblUsername;
        private System.Windows.Forms.Label lblPassword;
        private System.Windows.Forms.TextBox txtName;
        private System.Windows.Forms.TextBox txtPassword;
        private System.Windows.Forms.Button btnExit;
        private System.Windows.Forms.Button btnLogin;
        private System.Windows.Forms.GroupBox grpbx_top;
        private System.Windows.Forms.LinkLabel llbl_register;
        private System.Windows.Forms.Label lbl_register;
        private System.Windows.Forms.Label lbl_forgotpassword;
        private System.Windows.Forms.LinkLabel llbl_forgotpassword;
        private System.Windows.Forms.GroupBox grpbx_bottom;
        private System.Windows.Forms.Label lbl_errors;
    }
}


text:
package org.programmiersportgruppe.jgoodies.listadapter;

import com.jgoodies.common.collect.ObservableList;
import javax.swing.event.EventListenerList;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import java.util.*;

/**
 * Implements the Observable list and delegates the calls to
 * collection that is determined by a callback.
 * This is necessary for persistency frameworks that change collection
 * implementations e.g. hibernate
 */
public class ObservationListWrapper<T> implements ObservableList<T> {
    final private List<T> wrappedList;
    private List subjectListListeners=new ArrayList(0);

    public ObservationListWrapper(List<T> wrappedList) {
        this.wrappedList = wrappedList;

    }

    private List<T> getList() {
        if (wrappedList!= null)
            return wrappedList;
        return Collections.emptyList();
    }

    public int hashCode() {
        return getList().hashCode();
    }

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

    public void clear() {
        if (isEmpty())
            return;
        int oldLastIndex = size() - 1;
        getList().clear();
        fireIntervalRemoved(0, oldLastIndex);
        fireSubjectListChanged();
    }

    public boolean isEmpty() {
        return getList().isEmpty();
    }

    public Object[] toArray() {
        return getList().toArray();
    }

    public T get(int index) {
        return getList().get(index);
    }

    public T remove(int index) {
        final T o = getList().remove(index);
        fireIntervalRemoved(index, index);
        fireSubjectListChanged();
        return o;

    }

    public void add(int index, T element) {
        getList().add(index, element);
        fireIntervalAdded(index, index);
        fireSubjectListChanged();
    }

    public int indexOf(Object o) {
        return getList().indexOf(o);
    }

    public int lastIndexOf(Object o) {
        return getList().lastIndexOf(o);
    }

    public boolean add(T o) {
        int newIndex = getList().size();
        final boolean b = getList().add(o);
        fireIntervalAdded(newIndex, newIndex);
        fireSubjectListChanged();
        return b;
    }

    public boolean contains(Object o) {
        return getList().contains(o);
    }

    public boolean equals(Object o) {
        return getList().equals(o);
    }

    public boolean remove(Object o) {
        int index = getList().indexOf(o);
        final boolean b = getList().remove(o);
        fireIntervalRemoved(index, index);
        fireSubjectListChanged();
        return b;
    }

    public boolean addAll(int index, Collection<? extends T> c) {
        final boolean b = getList().addAll(index, c);
        fireIntervalAdded(index, index + c.size() - 1);
        fireSubjectListChanged();
        return b;
    }

    public boolean addAll(Collection<? extends T> c) {
        final int firstIndex = getList().size();
        final boolean b = getList().addAll(c);
        fireIntervalAdded(firstIndex, firstIndex + c.size() - 1);
        fireSubjectListChanged();
        return b;
    }

    public boolean containsAll(Collection c) {
        return getList().containsAll(c);
    }

    public boolean removeAll(Collection c) {
        boolean changed = false;
        for (Iterator iterator = c.iterator(); iterator.hasNext();) {
            Object o = (Object) iterator.next();
            if (this.remove(o)) changed = true;
        }
        fireSubjectListChanged();
        return changed;
    }

    public boolean retainAll(Collection c) {
        boolean modified = false;
        Iterator e = iterator();
        while (e.hasNext()) {
            if (!c.contains(e.next())) {
                e.remove();
                modified = true;
            }
        }
        //todo: bug eventing!
        fireSubjectListChanged();
        return modified;
    }

    public Iterator iterator() {
        return getList().iterator();
    }

    public List subList(int fromIndex, int toIndex) {
        return getList().subList(fromIndex, toIndex);
    }

    public ListIterator listIterator() {
        return getList().listIterator();
    }

    public ListIterator listIterator(int index) {
        return getList().listIterator(index);
    }

    public T set(int index, T element) {
        final T o = getList().set(index, element);
        fireContentsChanged(index, index);
        fireSubjectListChanged();
        return o;
    }

    public Object[] toArray(Object a[]) {
        return getList().toArray(a);
    }

    public void addSubjectListListener(SubjectListListener listener){
        subjectListListeners.add(listener);
    }

    public void removeSubjectListListener(SubjectListListener listener){
        subjectListListeners.remove(listener);
    }

    private void fireSubjectListChanged(){
        for (Iterator iterator = subjectListListeners.iterator(); iterator.hasNext();) {
            SubjectListListener subjectListChangeListener = (SubjectListListener) iterator.next();
            subjectListChangeListener.listChanged();
        }
    }
    // Contained List Change Notification

    // ListModel Field ********************************************************

    protected EventListenerList listenerList = new EventListenerList();

    // ListModel Implementation ***********************************************

    /**
     * Adds a listener to the list that's notified each time a change
     * to the data model occurs.
     *
     * @param l the ListDataListener to be added
     */
    public void addListDataListener(ListDataListener l) {
        listenerList.add(ListDataListener.class, l);
    }

    /**
     * Removes a listener from the list that's notified each time a
     * change to the data model occurs.
     *
     * @param l the ListDataListener to be removed
     */
    public void removeListDataListener(ListDataListener l) {
        listenerList.remove(ListDataListener.class, l);
    }

    /**
     * Returns the value at the specified index.
     *
     * @param index the requested index
     * @return the value at index
     */
    public Object getElementAt(int index) {
        return get(index);
    }

    /**
     * Returns the length of the list or 0 if there's no list.
     *
     * @return the length of the list or 0 if there's no list
     */
    public int getSize() {
        return size();
    }

// Explicit Change Notification *******************************************

    /**
     * Notifies all registered ListDataListeners that the element
     * at the specified index has changed. Useful if there's a content change
     * without any structural change.

     *

     * This method must be called after the element of the list changes.
     *
     * @param index the index of the element that has changed
     * @see javax.swing.event.EventListenerList
     */
    public void fireContentsChanged(int index) {
        fireContentsChanged(index, index);
    }

    // ListModel Helper Code **************************************************

    /**
     * Returns an array of all the list data listeners
     * registered on this ArrayListModel.
     *
     * @return all of this model's ListDataListeners,
     *         or an empty array if no list data listeners
     *         are currently registered
     * @see #addListDataListener(javax.swing.event.ListDataListener)
     * @see #removeListDataListener(javax.swing.event.ListDataListener)
     */
    public ListDataListener[] getListDataListeners() {
        return (ListDataListener[]) listenerList.getListeners(ListDataListener.class);
    }

    /**
     * This method must be called after one or more elements
     * of the list change.  The changed elements
     * are specified by the closed interval index0, index1 -- the end points
     * are included.  Note that index0 need not be less than or equal to index1.
     *
     * @param index0 one end of the new interval
     * @param index1 the other end of the new interval
     * @see javax.swing.event.EventListenerList
     */
    private void fireContentsChanged(int index0, int index1) {
        Object[] listeners = listenerList.getListenerList();
        ListDataEvent e = null;

        for (int i = listeners.length - 2; i >= 0; i -= 2) {
            if (listeners[i] == ListDataListener.class) {
                if (e == null) {
                    e = new ListDataEvent(this,
                            ListDataEvent.CONTENTS_CHANGED, index0, index1);
                }
                ((ListDataListener) listeners[i + 1]).contentsChanged(e);
            }
        }
    }

    /**
     * This method must be called after one or more elements
     * are added to the model.  The new elements
     * are specified by a closed interval index0, index1 -- the end points
     * are included.  Note that index0 need not be less than or equal to index1.
     *
     * @param index0 one end of the new interval
     * @param index1 the other end of the new interval
     * @see javax.swing.event.EventListenerList
     */
    private void fireIntervalAdded(int index0, int index1) {
        Object[] listeners = listenerList.getListenerList();
        ListDataEvent e = null;

        for (int i = listeners.length - 2; i >= 0; i -= 2) {
            if (listeners[i] == ListDataListener.class) {
                if (e == null) {
                    e = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index0, index1);
                }
                ((ListDataListener) listeners[i + 1]).intervalAdded(e);
            }
        }
    }

    /**
     * This method must be called after  one or more elements
     * are removed from the model.
     * index0 and index1 are the end points
     * of the interval that's been removed.  Note that index0
     * need not be less than or equal to index1.
     *
     * @param index0 one end of the removed interval,
     *               including index0
     * @param index1 the other end of the removed interval,
     *               including index1
     * @see javax.swing.event.EventListenerList
     */
    private void fireIntervalRemoved(int index0, int index1) {
        Object[] listeners = listenerList.getListenerList();
        ListDataEvent e = null;

        for (int i = listeners.length - 2; i >= 0; i -= 2) {
            if (listeners[i] == ListDataListener.class) {
                if (e == null) {
                    e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index0, index1);
                }
                ((ListDataListener) listeners[i + 1]).intervalRemoved(e);
            }
        }
    }

}


text:
% Erklärung
\subsection*{Eidesstattliche Erklärung}
Ich erkläre hiermit an Eides Statt, dass ich die vorliegende Arbeit selbständig und ohne Benutzung anderer als der angegebenen Hilfsmittel angefertigt habe. Die aus fremden Quellen (einschließlich elektronischer Quellen) direkt oder indirekt übernommenen Gedanken sind ausnahmslos als solche kenntlich gemacht.

\begin{minipage}{0.3\textwidth}

	\noindent\rule[-14mm]{175px}{1pt}
	\ \\
	Ort, Datum

\end{minipage}
\begin{minipage}{0.2\textwidth}
	\
\end{minipage}
\begin{minipage}{0.3\textwidth}

	\noindent\rule[-14mm]{175px}{1pt}
	\ \\
	\varauthorprename \ \varauthorsurname

\end{minipage}


text:
__author__ = 'LimeQM'

from flask import Blueprint

home = Blueprint('home', __name__, template_folder='./templates', url_prefix='/home')


text:
# Mice

Mice is semantic front-end framework.

## Update your browser
[http://browsehappy.com/](http://browsehappy.com/)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'mice'
```
or

```ruby
gem 'mice', :git => 'git@github.com:miclle/mice.git'
```

And then execute:

`bundle install`

Or install it yourself as:

`$ gem install mice`

## mice with Rails

### CSS

Import Mice in an SCSS file (for example, `application.css.scss`) to get all of Mice's styles

```css
@import "mice";
```

or

```css
/*
 *= require mice
 */
```

## Documentation

Ratchet's documentation is built with [Middleman](http://middlemanapp.com/) and publicly hosted on GitHub Pages at <http://mice.miclle.com/>. The docs may also be run locally.

### Running documentation locally

1. If necessary, `gem install bundler`.
2. From the root `/mice` directory, run `bundle install`
3. Run `middleman server` in the command line.
3. Open <http://localhost:4567> in your browser, and boom!

Learn more about using Middleman by reading its [documentation](http://middlemanapp.com/basics/getting-started/).

## Contributing

1. Fork it ( http://github.com/miclle/mice/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Copyright and license

Code and documentation copyright 2014 Miclle. Code released under the MIT license. Docs released under Creative Commons.


text:
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;

namespace Umbraco.Cms.Infrastructure.Telemetry.Interfaces
{
    internal interface IDetailedTelemetryProvider
    {
        IEnumerable<UsageInformation> GetInformation();
    }
}


text:
# frozen_string_literal: true

require "isolation/abstract_unit"

module ApplicationTests
  module RakeTests
    class RakeMigrationsTest < ActiveSupport::TestCase
      def setup
        build_app
        FileUtils.rm_rf("#{app_path}/config/environments")
      end

      def teardown
        teardown_app
      end

      test "running migrations with given scope" do
        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string`

          app_file "db/migrate/01_a_migration.bukkits.rb", <<-MIGRATION
            class AMigration < ActiveRecord::Migration::Current
            end
          MIGRATION

          output = `bin/rails db:migrate SCOPE=bukkits`
          assert_no_match(/create_table\(:users\)/, output)
          assert_no_match(/CreateUsers/, output)
          assert_no_match(/add_column\(:users, :email, :string\)/, output)

          assert_match(/AMigration: migrated/, output)

          output = `bin/rails db:migrate SCOPE=bukkits VERSION=0`
          assert_no_match(/drop_table\(:users\)/, output)
          assert_no_match(/CreateUsers/, output)
          assert_no_match(/remove_column\(:users, :email\)/, output)

          assert_match(/AMigration: reverted/, output)
        end
      end

      test "migration with empty version" do
        Dir.chdir(app_path) do
          output = `bin/rails db:migrate VERSION= 2>&1`
          assert_match(/Empty VERSION provided/, output)

          output = `bin/rails db:migrate:redo VERSION= 2>&1`
          assert_match(/Empty VERSION provided/, output)

          output = `bin/rails db:migrate:up VERSION= 2>&1`
          assert_match(/VERSION is required/, output)

          output = `bin/rails db:migrate:up 2>&1`
          assert_match(/VERSION is required/, output)

          output = `bin/rails db:migrate:down VERSION= 2>&1`
          assert_match(/VERSION is required - To go down one migration, use db:rollback/, output)

          output = `bin/rails db:migrate:down 2>&1`
          assert_match(/VERSION is required - To go down one migration, use db:rollback/, output)
        end
      end

      test "model and migration generator with change syntax" do
        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string`

          output = `bin/rails db:migrate`
          assert_match(/create_table\(:users\)/, output)
          assert_match(/CreateUsers: migrated/, output)
          assert_match(/add_column\(:users, :email, :string\)/, output)
          assert_match(/AddEmailToUsers: migrated/, output)

          output = `bin/rails db:rollback STEP=2`
          assert_match(/drop_table\(:users\)/, output)
          assert_match(/CreateUsers: reverted/, output)
          assert_match(/remove_column\(:users, :email, :string\)/, output)
          assert_match(/AddEmailToUsers: reverted/, output)
        end
      end

      test "migration status when schema migrations table is not present" do
        output = Dir.chdir(app_path) { `bin/rails db:migrate:status 2>&1` }
        assert_equal "Schema migrations table does not exist yet.\n", output
      end

      test "migration status" do
        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string;
           bin/rails db:migrate`

          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+Add email to users/, output)

          `bin/rails db:rollback STEP=1`
          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/down\s+\d{14}\s+Add email to users/, output)
        end
      end

      test "migration status without timestamps" do
        add_to_config("config.active_record.timestamped_migrations = false")

        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string;
           bin/rails db:migrate`

          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{3,}\s+Create users/, output)
          assert_match(/up\s+\d{3,}\s+Add email to users/, output)

          `bin/rails db:rollback STEP=1`
          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{3,}\s+Create users/, output)
          assert_match(/down\s+\d{3,}\s+Add email to users/, output)
        end
      end

      test "migration status after rollback and redo" do
        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string;
           bin/rails db:migrate`

          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+Add email to users/, output)

          `bin/rails db:rollback STEP=2`
          output = `bin/rails db:migrate:status`

          assert_match(/down\s+\d{14}\s+Create users/, output)
          assert_match(/down\s+\d{14}\s+Add email to users/, output)

          `bin/rails db:migrate:redo`
          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+Add email to users/, output)
        end
      end

      test "migration status after rollback and forward" do
        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string;
           bin/rails db:migrate`

          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+Add email to users/, output)

          `bin/rails db:rollback STEP=2`
          output = `bin/rails db:migrate:status`

          assert_match(/down\s+\d{14}\s+Create users/, output)
          assert_match(/down\s+\d{14}\s+Add email to users/, output)

          `bin/rails db:forward STEP=2`
          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+Add email to users/, output)
        end
      end

      test "raise error on any move when current migration does not exist" do
        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string;
           bin/rails db:migrate
           rm db/migrate/*email*.rb`

          output = `bin/rails db:migrate:status`
          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+\** NO FILE \**/, output)

          output = `bin/rails db:rollback 2>&1`
          assert_match(/rails aborted!/, output)
          assert_match(/ActiveRecord::UnknownMigrationVersionError:/, output)
          assert_match(/No migration with version number\s\d{14}\./, output)

          output = `bin/rails db:migrate:status`
          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+\** NO FILE \**/, output)

          output = `bin/rails db:forward 2>&1`
          assert_match(/rails aborted!/, output)
          assert_match(/ActiveRecord::UnknownMigrationVersionError:/, output)
          assert_match(/No migration with version number\s\d{14}\./, output)

          output = `bin/rails db:migrate:status`
          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+\** NO FILE \**/, output)
        end
      end

      test "migration status after rollback and redo without timestamps" do
        add_to_config("config.active_record.timestamped_migrations = false")

        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string;
           bin/rails db:migrate`

          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{3,}\s+Create users/, output)
          assert_match(/up\s+\d{3,}\s+Add email to users/, output)

          `bin/rails db:rollback STEP=2`
          output = `bin/rails db:migrate:status`

          assert_match(/down\s+\d{3,}\s+Create users/, output)
          assert_match(/down\s+\d{3,}\s+Add email to users/, output)

          `bin/rails db:migrate:redo`
          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{3,}\s+Create users/, output)
          assert_match(/up\s+\d{3,}\s+Add email to users/, output)
        end
      end

      test "running migrations with not timestamp head migration files" do
        Dir.chdir(app_path) do

          app_file "db/migrate/1_one_migration.rb", <<-MIGRATION
            class OneMigration < ActiveRecord::Migration::Current
            end
          MIGRATION

          app_file "db/migrate/02_two_migration.rb", <<-MIGRATION
            class TwoMigration < ActiveRecord::Migration::Current
            end
          MIGRATION

          `bin/rails db:migrate`

          output = `bin/rails db:migrate:status`

          assert_match(/up\s+001\s+One migration/, output)
          assert_match(/up\s+002\s+Two migration/, output)
        end
      end

      test "schema generation when dump_schema_after_migration is set" do
        add_to_config("config.active_record.dump_schema_after_migration = false")

        Dir.chdir(app_path) do
          `bin/rails generate model book title:string`
          output = `bin/rails generate model author name:string`
          version = output =~ %r{[^/]+db/migrate/(\d+)_create_authors\.rb} && $1

          `bin/rails db:migrate db:rollback db:forward db:migrate:up db:migrate:down VERSION=#{version}`
          assert !File.exist?("db/schema.rb"), "should not dump schema when configured not to"
        end

        add_to_config("config.active_record.dump_schema_after_migration = true")

        Dir.chdir(app_path) do
          `bin/rails generate model reviews book_id:integer`
          `bin/rails db:migrate`

          structure_dump = File.read("db/schema.rb")
          assert_match(/create_table "reviews"/, structure_dump)
        end
      end

      test "default schema generation after migration" do
        Dir.chdir(app_path) do
          `bin/rails generate model book title:string;
           bin/rails db:migrate`

          structure_dump = File.read("db/schema.rb")
          assert_match(/create_table "books"/, structure_dump)
        end
      end

      test "migration status migrated file is deleted" do
        Dir.chdir(app_path) do
          `bin/rails generate model user username:string password:string;
           bin/rails generate migration add_email_to_users email:string;
           bin/rails db:migrate
           rm db/migrate/*email*.rb`

          output = `bin/rails db:migrate:status`

          assert_match(/up\s+\d{14}\s+Create users/, output)
          assert_match(/up\s+\d{14}\s+\** NO FILE \**/, output)
        end
      end
    end
  end
end


text:
require 'active_support/all'
require 'mumukit/bridge'

describe 'Server' do

  before(:all) do
    @pid = Process.spawn 'rackup -p 4568', err: ENV['LOG_PATH']  || '/dev/null'
    sleep 2
  end

  after(:all) do
    Process.kill 'TERM', @pid
  end

  shared_examples_for 'a successful submission' do |program, exercise, examples_count: 1|
    let(:response) { run_tests program, exercise['test'], exercise['extra'] }

    it { expect(response[:status]).to eq :passed }
    it { expect(response[:response_type]).to eq :structured }
    it { expect(response[:test_results].size).to eq examples_count }
  end

  shared_examples_for 'a submission where columns do not match' do |program, exercise|
    let(:response) { run_tests program, exercise['test'], exercise['extra'] }

    it { expect(response[:status]).to eq :failed }
    it { expect(response[:response_type]).to eq :structured }
    it { expect(response[:test_results][0][:result]).to include I18n.t 'failure.columns' }
  end

  shared_examples_for 'a submission where rows do not match' do |program, exercise|
    let(:response) { run_tests program, exercise['test'], exercise['extra'] }

    it { expect(response[:status]).to eq :failed }
    it { expect(response[:response_type]).to eq :structured }
    it { expect(response[:test_results][0][:result]).to include I18n.t 'failure.rows' }
  end

  shared_examples_for 'a syntax-error submission' do |program, exercise, error |
    let(:response) { run_tests program, exercise['test'], exercise['extra'] }

    it { expect(response[:status]).to eq :failed }
    it { expect(response[:response_type]).to eq :unstructured }
    it { expect(response[:result]).to match error }
  end

  context 'Runner Test 1' do
    exercise = Sqlite::Exercise.get('00000_runner_test1')

    program = 'select * from test1;'
    it_behaves_like 'a successful submission',
                    program, exercise, examples_count: exercise['count']

    program = 'selec * from test1;'
    error = /Error: near line \d: near "selec": syntax error/
    it_behaves_like 'a syntax-error submission', program, exercise, error
  end

  context 'Runner Test 2' do
    exercise = Sqlite::Exercise.get('00000_runner_test2')

    program = 'select name from test2;'
    it_behaves_like 'a successful submission',
                    program, exercise, examples_count: exercise['count']

    program = 'select from test2;'
    error = /Error: near line \d: near "from": syntax error/
    it_behaves_like 'a syntax-error submission', program, exercise, error
  end

  context 'Runner Test 3' do
    exercise = Sqlite::Exercise.get('00000_runner_test3')

    program = 'select name from test3;'
    it_behaves_like 'a successful submission',
                    program, exercise, examples_count: exercise['count']

    program = 'select * fro test3;'
    error = /Error: near line \d: near "fro": syntax error/
    it_behaves_like 'a syntax-error submission', program, exercise, error
  end

  context 'Runner Test 4' do
    exercise = Sqlite::Exercise.get('00000_runner_test4')

    program = 'select name from test4 limit 0;'
    it_behaves_like 'a successful submission',
                    program, exercise, examples_count: exercise['count']

    program = 'select * from test4'
    error = /Error: incomplete SQL: select \* from test4/
    it_behaves_like 'a syntax-error submission', program, exercise, error
  end

  context 'Prueba MQL' do
    exercise = Sqlite::Exercise.get('00001_prueba_mql')

    program = 'select * from motores;'
    it_behaves_like 'a successful submission',
                    program, exercise, examples_count: exercise['count']
  end

  context 'Hello SELECT!' do
    exercise = Sqlite::Exercise.get('00002_hello_select')

    program = 'select * from bolitas;'
    it_behaves_like 'a successful submission',
                    program, exercise, examples_count: exercise['count']

    program = 'select color from bolitas;'
    it_behaves_like 'a submission where columns do not match', program, exercise

    program = 'select * from bolitas limit 1;'
    it_behaves_like 'a submission where rows do not match', program, exercise
  end

  context 'Datasets Solutions' do
    exercise = Sqlite::Exercise.get('00003_datasets_solutions')

    program = 'select * from bolitas;'
    it_behaves_like 'a successful submission',
                    program, exercise, examples_count: exercise['count']

    program = 'select color from bolitas;'
    it_behaves_like 'a submission where columns do not match', program, exercise

    program = 'select * from bolitas limit 1;'
    it_behaves_like 'a submission where rows do not match', program, exercise
  end

  def run_tests(program, test, extra)
    bridge = Mumukit::Bridge::Runner.new('http://localhost:4568')
    bridge.run_tests! test: test.to_yaml,
                      extra: extra,
                      content: program,
                      expectations: []
  end

end


text:
/* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
/*
 * Copyright (c) 1982, 1986, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	@(#)protosw.h	8.1 (Berkeley) 6/2/93
 * $FreeBSD: src/sys/sys/protosw.h,v 1.28.2.2 2001/07/03 11:02:01 ume Exp $
 */

#ifndef _SYS_PROTOSW_H_
#define	_SYS_PROTOSW_H_

#include <sys/appleapiopts.h>
#include <sys/cdefs.h>

/* XXX: this will go away */
#define	PR_SLOWHZ	2		/* 2 slow timeouts per second */

#endif	/* !_SYS_PROTOSW_H_ */


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using Autofac;
using DatenMeister.Core.EMOF.Interface.Identifiers;
using DatenMeister.Core.EMOF.Interface.Reflection;
using DatenMeister.Core.Helper;
using DatenMeister.Core.Models;
using DatenMeister.Core.Provider.Interfaces;
using DatenMeister.Core.Runtime.Workspaces;
using DatenMeister.Extent.Manager.ExtentStorage;
using DatenMeister.Integration.DotNet;
using DatenMeister.WPF.Forms.Base;
using DatenMeister.WPF.Forms.Lists;
using DatenMeister.WPF.Modules.ViewExtensions;
using DatenMeister.WPF.Modules.ViewExtensions.Definition;
using DatenMeister.WPF.Modules.ViewExtensions.Definition.Buttons;
using DatenMeister.WPF.Modules.ViewExtensions.Information;
using DatenMeister.WPF.Navigation;

namespace DatenMeister.WPF.Modules.ImportExtentManager
{
    /// <summary>
    /// Defines the view extension factory for the Import Extent function
    /// </summary>
    public class ImportExtentViewExtensions : IViewExtensionFactory
    {
        private readonly ImportExtentManagerPlugin _plugin;

        public ImportExtentViewExtensions(ImportExtentManagerPlugin plugin)
        {
            _plugin = plugin;
        }

        public IEnumerable<ViewExtension> GetViewExtensions(ViewExtensionInfo viewExtensionInfo)
        {
            foreach (var viewExtension in OfferExtentLoadingForDetail(viewExtensionInfo))
                yield return viewExtension;

            foreach (var viewExtension in OfferForExtentOverview(viewExtensionInfo))
                yield return viewExtension;
        }

        private IEnumerable<ViewExtension> OfferForExtentOverview(ViewExtensionInfo viewExtensionInfo)
        {
            var itemsInExtentList = viewExtensionInfo.GetItemsInExtentExplorerControl();
            if (itemsInExtentList != null)
            {
                // Adds the import elements
                yield return new ExtentMenuButtonDefinition(
                    "Import existing Extent",
                    ImportExistingExtent,
                    null,
                    NavigationCategories.Extents + ".Import");

                yield return new ExtentMenuButtonDefinition(
                    "Import by new Extent",
                    ImportNewExtent,
                    null,
                    NavigationCategories.Extents + ".Import");

                yield return new ExtentMenuButtonDefinition(
                    "Import from Clipboard",
                    null!,
                    null,
                    NavigationCategories.Extents + ".Import");
            }

            // Imports the existing extent
            async void ImportExistingExtent(IExtent extent)
            {
                if (itemsInExtentList == null)
                    return;

                var navigationHost = viewExtensionInfo.NavigationHost
                                     ?? throw new InvalidOperationException("navigationHost == null");

                var controlNavigation = await NavigatorForItems.NavigateToElementDetailView(
                    navigationHost,
                    new NavigateToItemConfig
                    {
                        Form = new FormDefinition(
                            GiveMe.Scope.WorkspaceLogic.GetInternalFormsExtent()
                                .element("#ImportManagerFindExtent")
                            ?? throw new InvalidOperationException("#ImportManagerFindExtent not found"))
                    });

                if (controlNavigation != null && controlNavigation.Result == NavigationResult.Saved)
                {
                    var detailElement = controlNavigation.DetailElement;

                    if (detailElement == null)
                        return;

                    var selectedExtent = detailElement.getOrDefault<IElement>("selectedExtent");
                    if (selectedExtent == null)
                    {
                        MessageBox.Show("No extent selected");
                        return;
                    }

                    var metaClass = selectedExtent.getMetaClass();
                    if (metaClass?.equals(_DatenMeister.TheOne.Management.__Extent) != true)
                    {
                        MessageBox.Show("Selected element does not reference an extent");
                        return;
                    }

                    var workspace = selectedExtent.container();
                    if (workspace == null)
                    {
                        MessageBox.Show("The extent is not connected to the workspace.");
                        return;
                    }

                    var workspaceName = workspace.getOrDefault<string>(_DatenMeister._Management._Workspace.id);
                    var uri = selectedExtent.getOrDefault<string>(_DatenMeister._Management._Extent.uri);

                    // Gets the extent from which the data shall be imported
                    var sourceExtent = GiveMe.Scope.WorkspaceLogic.FindExtent(workspaceName, uri);
                    if (sourceExtent == null)
                    {
                        MessageBox.Show($"Source extent with {uri} is not found. ");
                        return;
                    }

                    var itemCountBefore = sourceExtent.elements().Count();
                    var elements = (itemsInExtentList.RootItem as IExtent)?.elements()
                                   ?? throw new InvalidOperationException("elements == null");
                    _plugin.PerformImport(sourceExtent, elements);
                    var itemCountAfter = sourceExtent.elements().Count();

                    MessageBox.Show(
                        $"Import has been performed. {itemCountAfter - itemCountBefore} root elements have been added.");
                }
            }

            async void ImportNewExtent(IExtent extent)
            {
                if (itemsInExtentList == null)
                    return;

                var navigationHost = viewExtensionInfo.NavigationHost
                                     ?? throw new InvalidOperationException("navigationHost == null");
                var result = await WorkspaceExtentFormGenerator.QueryExtentConfigurationByUserAsync(
                    navigationHost);
                if (result != null)
                {
                    // Now, we got the item extent...
                    var extentManager = GiveMe.Scope.Resolve<ExtentManager>();
                    var loadedExtent = new ExtentStorageData.LoadedExtentInformation(result);
                    extentManager.LoadExtentWithoutAdding(result, ref loadedExtent);
                    if (loadedExtent != null && loadedExtent.Extent != null &&
                        loadedExtent.LoadingState == ExtentLoadingState.Loaded)
                    {
                        var itemCountBefore = loadedExtent.Extent.elements().Count();
                        var elements = (itemsInExtentList.RootItem as IExtent)?.elements()
                                       ?? throw new InvalidOperationException("elements == null");
                        _plugin.PerformImport(loadedExtent.Extent, elements);
                        var itemCountAfter = loadedExtent.Extent.elements().Count();

                        MessageBox.Show(
                            $"Import has been performed. {itemCountAfter - itemCountBefore} root elements have been added.");
                    }
                    else
                    {
                        MessageBox.Show("Extent could not be loaded");
                    }
                }
            }
        }

        private static IEnumerable<ViewExtension> OfferExtentLoadingForDetail(ViewExtensionInfo viewExtensionInfo)
        {
            // Creates a html report
            var reportInstance =
                viewExtensionInfo.IsItemInDetailWindowOfType(
                _DatenMeister.TheOne.ExtentLoaderConfigs.__ExtentLoaderConfig,
                true);
            if (reportInstance != null)
            {
                yield return
                    new RowItemButtonDefinition(
                        "Load Extent",
                        (x, y) =>
                        {
                            var asElement = y as IElement ?? throw new InvalidOperationException("Not an Element");
                            var workspaceLogic = GiveMe.Scope.WorkspaceLogic;
                            var scopeStorage = GiveMe.Scope.ScopeStorage;

                            var extentManager = new ExtentManager(workspaceLogic, scopeStorage);
                            var result = extentManager.LoadExtent(asElement, ExtentCreationFlags.LoadOrCreate);

                            if (result.LoadingState == ExtentLoadingState.Loaded)
                            {
                                MessageBox.Show("The loader config has been executed");
                            }
                            else if (result.LoadingState == ExtentLoadingState.Failed)
                            {
                                MessageBox.Show("The loading has failed: " + result.FailLoadingMessage);
                            }
                        });
            }
        }
    }
}