text:
package locale

// FIXME: we need someone who understands Windows code-pages to make sure that
// we can use advanced characters before we move away from just saying
// "err, ASCII, *cough*".
func GetCharmap() string {
	return "US-ASCII"
}


text:
describe('Moment filter', function () {
	'use strict';

	beforeEach(angular.mock.module('data-prep.services.utils'));

	beforeEach(() => {
		moment.locale('en');
	});

	it('should transform timestamp to human readable moment', inject(function ($filter) {
		// given
		const date = new Date();
		date.setDate(date.getDate() - 7);

		// when
		const result = $filter('TDPMoment')(date.getTime());

		// then
		expect(result).toEqual('7 days ago');
	}));

	it('should transform date to human readable moment', inject(function ($filter) {
		// given
		const date = new Date();
		date.setDate(date.getDate() - 7);

		const dateAsString = `${date.getFullYear()}/${date.getMonth() < 9 ? '0' : ''}${date.getMonth() + 1}/${date.getDate() < 10 ? '0' : ''}${date.getDate()} ${date.getHours()}:${date.getMinutes()}`;

		// when
		const result = $filter('TDPMoment')(dateAsString, 'YYYY/MM/DD HH:mm');

		// then
		expect(result).toEqual('7 days ago');
	}));
});

redpajama_set_name: RedPajamaGithub


text:
#include "internal/e_os.h"
#include "crypto/cryptlib.h"

#if defined(_WIN32) || defined(__CYGWIN__)
# ifdef __CYGWIN__
/* pick DLL_[PROCESS|THREAD]_[ATTACH|DETACH] definitions */
#  include <windows.h>
/*
 * this has side-effect of _WIN32 getting defined, which otherwise is
 * mutually exclusive with __CYGWIN__...
 */
# endif

/*
 * All we really need to do is remove the 'error' state when a thread
 * detaches
 */

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason) {
    case DLL_PROCESS_ATTACH:
        OPENSSL_cpuid_setup();
        break;
    case DLL_THREAD_ATTACH:
        break;
    case DLL_THREAD_DETACH:
        OPENSSL_thread_stop();
        break;
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}
#endif


text:
var vizData = {};
var lineGraph = {};
var vizId = null;

window.onload = function(){
	vizId = document.location.search.split("=")[1];

	// creates the elements needed for the visualization with correct id's for usage throughout vizserve.
	initializeDocument();

	fetchConfig();
}

// Init the document for this visualization. For now assumes the presence of the parent error handler.
// Two panels are added: error_panel for displaying any errors that my occur, and a viz_panel for the visualization itself.
function initializeDocument(){
	var body = document.querySelector("#container");
	var fragment = document.createDocumentFragment();

	var error_panel = document.createElement("div");
	error_panel.classList = "hidden error_panel";
	error_panel.id = vizId + "_error_panel";
	fragment.appendChild(error_panel);

	var viz_panel = document.createElement("div");
	// for viz-panel, prefix the id, as an id with leading zero leads to issues with
	// query selector
	viz_panel.id = "viz_panel_" + vizId;

	fragment.appendChild(viz_panel);

	body.appendChild(fragment);
}

function fetchConfig(){
	var request = new XMLHttpRequest();
	request.open('GET', parent.vizServeConfig.apiUrl + "/viz/" + vizId, true);

	request.onload = function(){
		if(request.status >= 200 && request.status < 400){
			vizData.config = JSON.parse(request.responseText);
			fetchData();
		}
	}

	request.onerror = function() {
	  // There was a connection error of some sort
		    parent.errorHandler.serverError(vizId + "_error_panel", "Network error, could not connect to server.")
	};

	try{
		request.send();
	} catch(e){
		parent.errorHandler.serverError(vizId + "_error_panel", "Network error, could not connect to server.")
	}
}

function fetchData(){
	var request = new XMLHttpRequest();
	request.open('GET', parent.vizServeConfig.apiUrl + "/data/" + vizId, true);

	request.onload = function() {
	  if (request.status >= 200 && request.status < 400) {
	    // Success!
	    // TODO: hack by adding ['data']. This should be fixed in the db call, rather than here.
	    vizData.data = JSON.parse(request.responseText)['data'];

	    // TODO: add config in backend for the viz. i.e. axes etc.
	    vizData.config = {};
	    vizData.config.hor_axis = "x";
	    vizData.config.ver_axis = "y";
	    vizData.config.grid_lines = true;
		populateControls();
	    drawLineGraph();
	  } else {
	    // We reached our target server, but it returned an error
	    parent.errorHandler.serverError(vizId + "_error_panel", "Could not fetch data for this visualization")
	  }
	};

	request.onerror = function() {
	  // There was a connection error of some sort
		    parent.errorHandler.serverError(vizId + "_error_panel", "Network error, could not connect to server.")
	};

	try{
		request.send();
	} catch(e){
		parent.errorHandler.serverError(vizId + "_error_panel", "Network error, could not connect to server.")
	}
}

// initial line graph drawing function, should only be used on first use.
// assumes data has been fetched and can be found in vizData.data
function drawLineGraph(){
	console.log(vizData);
	// TODO: inconsistent naming of axes. Should be referred to as either: hor and ver axis or x and y axis.
	// TODO: these sizes need to be relative to the size of the iframe to prevent scrolling
	lineGraph.margin = {top: 20, right: 20, bottom: 30, left: 50};
	lineGraph.width = 700 - lineGraph.margin.left - lineGraph.margin.right;
	lineGraph.height = 400 - lineGraph.margin.top - lineGraph.margin.bottom;
	// var margin = {top: 20, right: 20, bottom: 30, left: 50},
	//     width = 700 - margin.left - margin.right,
	//     height = 400 - margin.top - margin.bottom;

	// TODO: type of axis scale should be fetched from config, not hardcoded to linear.
	lineGraph.x = d3.scale.linear()
					.range([0, lineGraph.width])

	lineGraph.y = d3.scale.linear()
					.range([lineGraph.height, 0]);

	lineGraph.xAxis = d3.svg.axis()
						.scale(lineGraph.x)
						.orient("bottom");

	lineGraph.yAxis = d3.svg.axis()
						.scale(lineGraph.y)
						.orient("left");

	if(vizData.config.grid_lines){
		drawGridLines();
	}

	// TODO: should be possible to define multiple lines?
	lineGraph.line = d3.svg.line()
						.x(function(d) {return lineGraph.x(d[vizData.config.hor_axis]); })
						.y(function(d) {return lineGraph.y(d[vizData.config.ver_axis]); })

	lineGraph.svg = d3.select("#viz_panel_" + vizId).append("svg")
						.attr("width", lineGraph.width + lineGraph.margin.left + lineGraph.margin.right)
						.attr("height", lineGraph.height + lineGraph.margin.top + lineGraph.margin.right)
					.append("g")
					.attr("transform", "translate(" + lineGraph.margin.left + "," + lineGraph.margin.top + ")");

	lineGraph.x.domain(d3.extent(vizData.data, function(d){ return d[vizData.config.hor_axis]; }));
	lineGraph.y.domain(d3.extent(vizData.data, function(d){ return d[vizData.config.ver_axis]; }));

	// TODO: some hardcoded offset values here.
	lineGraph.svg.append("g")
		.attr("class", "x axis")
		.attr("transform", "translate(0," + lineGraph.height + ")")
		.call(lineGraph.xAxis);
		// .append("text")
		// .attr("dy", "-.71em")
		// .attr("x", 650)
		// .attr("text-anchor", "end")
		// .text(vizData.config.hor_axis)
	// svg.append("g")
	// 	.attr("class", "x axis")
	// 	.attr("transform", "translate(0," + height + ")")
	// 	.call(xAxis)
	// 	.append("text")
	// 	.attr("dy", "-.71em")
	// 	.attr("x", 650)
	// 	.style("text-anchor","end")
	// 	.text("X");

	lineGraph.svg.append("g")
		.attr("class", "y axis")
		.call(lineGraph.yAxis);
		// .append("text")
		// .attr("transform", "rotate(-90)")
		// .attr("y", 6)
		// .attr("dy", ".71em")
		// .attr("text-anchor", "end")
		// .text(vizData.config.ver_axis)
	// svg.append("g")
	// 	.attr("class", "y axis")
	// 	.call(yAxis)
	// 	.append("text")
	// 	.attr("transform", "rotate(-90)")
	// 	.attr("y", 6)
	// 	.attr("dy", ".71em")
	// 	.style("text-anchor", "end")
	// 	.text("y");

	lineGraph.svg.append("path")
		.datum(vizData.data)
		.attr("class", "line")
		.attr("d", lineGraph.line);
}

function updateLineGraph(){
	var localSvg = lineGraph.svg.transition()

	lineGraph.x = d3.scale.linear()
			.range([0, lineGraph.width])

	lineGraph.y = d3.scale.linear()
					.range([lineGraph.height, 0]);

	lineGraph.xAxis = d3.svg.axis()
						.scale(lineGraph.x)
						.orient("bottom");

	lineGraph.yAxis = d3.svg.axis()
						.scale(lineGraph.y)
						.orient("left");

	if(vizData.config.grid_lines){
		drawGridLines();
	}

	// TODO: should be possible to define multiple lines?
	lineGraph.line = d3.svg.line()
						.x(function(d) {return lineGraph.x(d[vizData.config.hor_axis]); })
						.y(function(d) {return lineGraph.y(d[vizData.config.ver_axis]); })
	lineGraph.x.domain(d3.extent(vizData.data, function(d){ return d[vizData.config.hor_axis]; }));
	lineGraph.y.domain(d3.extent(vizData.data, function(d){ return d[vizData.config.ver_axis]; }));

	// TODO: some hardcoded offset values here.
	localSvg.select(".x.axis")
				.duration(750)
				.call(lineGraph.xAxis);
	localSvg.select(".y.axis")
				.duration(750)
				.call(lineGraph.yAxis);
	lineGraph.svg.select("path.line").remove()
	lineGraph.svg.append("path")
		.datum(vizData.data)
		.attr("class", "line")
		.attr("d", lineGraph.line);

	// lineGraph.svg.append("g")
	// 	.attr("class", "x axis")
	// 	.attr("transform", "translate(0," + lineGraph.height + ")")
	// 	.call(lineGraph.xAxis)
	// 	.append("text")
	// 	.attr("dy", "-.71em")
	// 	.attr("x", 650)
	// 	.attr("text-anchor", "end")
	// 	.text(vizData.config.hor_axis)

	// lineGraph.svg.append("g")
	// 	.attr("class", "y axis")
	// 	.call(lineGraph.yAxis)
	// 	.append("text")
	// 	.attr("transform", "rotate(-90)")
	// 	.attr("y", 6)
	// 	.attr("dy", ".71em")
	// 	.attr("text-anchor", "end")
	// 	.text(vizData.config.ver_axis)

	// lineGraph.svg.append("path")
	// 	.datum(vizData.data)
	// 	.attr("class", "line")
	// 	.attr("d", lineGraph.line);

}

function drawGridLines(){
	lineGraph.xAxis
		.innerTickSize(-lineGraph.height)
		.outerTickSize(0)
		.tickPadding(10);

	lineGraph.yAxis
		.innerTickSize(-lineGraph.width)
		.outerTickSize(0)
		.tickPadding(10);
}

function populateControls(){
	// this function is called once data has been fetched. The idea is that the control elements should be populated with sensible values/options given the input data.
	var hor_axis_select = document.getElementById("control_hor_axis");
	var ver_axis_select = document.getElementById("control_ver_axis");

	// for both dropdowns the same axes should be available.

	var options = Object.keys(vizData.data[0]);

	var fragment = document.createDocumentFragment();
	var option;
	for (var i = options.length - 1; i >= 0; i--) {
		option = document.createElement("option");
		option.value = options[i];
		option.innerHTML = options[i];
		fragment.appendChild(option);
	}
	var fragment_copy = fragment.cloneNode(true);

	ver_axis_select.appendChild(fragment);
	hor_axis_select.appendChild(fragment_copy);

	// set the value to the current config value.
	ver_axis_select.value = vizData.config.ver_axis;
	hor_axis_select.value = vizData.config.hor_axis;

	document.getElementById("control_grid").checked = vizData.config.grid_lines;

	initializeControlListeners();
}

function initializeControlListeners(){
	document.getElementById("control_hor_axis").addEventListener("change", function(){
		vizData.config.hor_axis = this.value;
		updateLineGraph();
	});
	document.getElementById("control_ver_axis").addEventListener("change", function(){
		vizData.config.ver_axis = this.value;
		updateLineGraph();
	});

	document.getElementById("control_grid").addEventListener("change", function(){
		vizData.config.grid_lines = this.checked;
		updateLineGraph();
	});
}


text:
package net.runelite.client.plugins.timetracking;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.function.BooleanSupplier;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.runelite.api.Constants;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.FontManager;
import net.runelite.client.util.ImageUtil;

class OverviewItemPanel extends JPanel
{
	private static final ImageIcon ARROW_RIGHT_ICON;

	private static final Color HOVER_COLOR = ColorScheme.DARKER_GRAY_HOVER_COLOR;

	private final JPanel textContainer;
	private final JLabel statusLabel;
	private final JLabel arrowLabel;
	private final BooleanSupplier isSelectable;

	private boolean isHighlighted;

	static
	{
		ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "/util/arrow_right.png"));
	}

	OverviewItemPanel(ItemManager itemManager, TimeTrackingPanel pluginPanel, Tab tab, String title)
	{
		this(itemManager, () -> pluginPanel.switchTab(tab), () -> true, tab.getItemID(), title);
	}

	OverviewItemPanel(ItemManager itemManager, Runnable onTabSwitched, BooleanSupplier isSelectable, int iconItemID, String title)
	{
		this.isSelectable = isSelectable;

		setBackground(ColorScheme.DARKER_GRAY_COLOR);
		setLayout(new BorderLayout());
		setBorder(new EmptyBorder(7, 7, 7, 7));

		JLabel iconLabel = new JLabel();
		iconLabel.setMinimumSize(new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT));
		itemManager.getImage(iconItemID).addTo(iconLabel);
		add(iconLabel, BorderLayout.WEST);

		textContainer = new JPanel();
		textContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);
		textContainer.setLayout(new GridLayout(2, 1));
		textContainer.setBorder(new EmptyBorder(5, 7, 5, 7));

		addMouseListener(new MouseAdapter()
		{
			@Override
			public void mousePressed(MouseEvent mouseEvent)
			{
				onTabSwitched.run();

				setHighlighted(false);
			}

			@Override
			public void mouseReleased(MouseEvent e)
			{
				setHighlighted(true);
			}

			@Override
			public void mouseEntered(MouseEvent e)
			{
				setHighlighted(true);
			}

			@Override
			public void mouseExited(MouseEvent e)
			{
				setHighlighted(false);
			}
		});

		JLabel titleLabel = new JLabel(title);
		titleLabel.setForeground(Color.WHITE);
		titleLabel.setFont(FontManager.getRunescapeSmallFont());

		statusLabel = new JLabel();
		statusLabel.setForeground(Color.GRAY);
		statusLabel.setFont(FontManager.getRunescapeSmallFont());

		textContainer.add(titleLabel);
		textContainer.add(statusLabel);

		add(textContainer, BorderLayout.CENTER);

		arrowLabel = new JLabel(ARROW_RIGHT_ICON);
		arrowLabel.setVisible(isSelectable.getAsBoolean());
		add(arrowLabel, BorderLayout.EAST);
	}

	void updateStatus(String text, Color color)
	{
		statusLabel.setText(text);
		statusLabel.setForeground(color);

		arrowLabel.setVisible(isSelectable.getAsBoolean());

		if (isHighlighted && !isSelectable.getAsBoolean())
		{
			setHighlighted(false);
		}
	}

	private void setHighlighted(boolean highlighted)
	{
		if (highlighted && !isSelectable.getAsBoolean())
		{
			return;
		}

		setBackground(highlighted ? HOVER_COLOR : ColorScheme.DARKER_GRAY_COLOR);
		setCursor(new Cursor(highlighted && getMousePosition(true) != null ? Cursor.HAND_CURSOR : Cursor.DEFAULT_CURSOR));
		textContainer.setBackground(highlighted ? HOVER_COLOR : ColorScheme.DARKER_GRAY_COLOR);

		isHighlighted = highlighted;
	}
}


text:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

using VsChromium.Core.Ipc.TypedMessages;

namespace VsChromium.Features.IndexServerInfo {
  public partial class ProjectConfigurationDetailsDialog {
    public ProjectConfigurationDetailsDialog() {
      InitializeComponent();
      DataContext = new ProjectDetails();
    }

    public ProjectDetails ViewModel {
      get { return (ProjectDetails) DataContext; }
      set { DataContext = value; }
    }
  }
}


text:
<?php

namespace React\Tests\Datagram;

use React\Datagram\Socket;

class SocketTest extends TestCase
{
    private $loop;
    private $factory;

    /**
     * @before
     */
    public function setUpFactory()
    {
        $this->loop = \React\EventLoop\Factory::create();
        $this->factory = new \React\Datagram\Factory($this->loop, $this->createResolverMock());
    }

    /**
     * @doesNotPerformAssertions
     */
    public function testCreateClientCloseWillNotBlock()
    {
        $promise = $this->factory->createClient('127.0.0.1:12345');
        $client = \React\Async\await($promise);

        $client->send('test');
        $client->close();

        $this->loop->run();

        return $client;
    }

    /**
     * @doesNotPerformAssertions
     * @param Socket $client
     * @depends testCreateClientCloseWillNotBlock
     */
    public function testClientCloseAgainWillNotBlock(Socket $client)
    {
        $client->close();
        $this->loop->run();
    }

    /**
     * @doesNotPerformAssertions
     */
    public function testCreateClientEndWillNotBlock()
    {
        $promise = $this->factory->createClient('127.0.0.1:12345');
        $client = \React\Async\await($promise);

        $client->send('test');
        $client->end();

        $this->loop->run();

        return $client;
    }

    /**
     * @doesNotPerformAssertions
     * @param Socket $client
     * @depends testCreateClientEndWillNotBlock
     */
    public function testClientEndAgainWillNotBlock(Socket $client)
    {
        $client->end();
        $this->loop->run();

        return $client;
    }

    /**
     * @doesNotPerformAssertions
     * @param Socket $client
     * @depends testClientEndAgainWillNotBlock
     */
    public function testClientSendAfterEndIsNoop(Socket $client)
    {
        $client->send('does not matter');
        $this->loop->run();
    }

    public function testClientSendHugeWillFailWithoutCallingCustomErrorHandler()
    {
        $promise = $this->factory->createClient('127.0.0.1:12345');
        $client = \React\Async\await($promise);

        $client->send(str_repeat(1, 1024 * 1024));
        $client->on('error', $this->expectCallableOnce());
        $client->end();

        $error = null;
        set_error_handler(function ($_, $errstr) use (&$error) {
            $error = $errstr;
        });

        $this->loop->run();

        restore_error_handler();
        $this->assertNull($error);
    }

    public function testClientSendNoServerWillFail()
    {
        $promise = $this->factory->createClient('127.0.0.1:1234');
        $client = \React\Async\await($promise);

        // send a message to a socket that is not actually listening
        // expect the remote end to reject this by sending an ICMP message
        // which we will receive as an error message. This depends on the
        // host to actually reject UDP datagrams, which not all systems do.
        $client->send('hello');
        $client->on('error', $this->expectCallableOnce());

        $loop = $this->loop;
        $client->on('error', function () use ($loop) {
             $loop->stop();
        });

        $that = $this;
        $this->loop->addTimer(1.0, function () use ($that, $loop) {
            $loop->stop();
            $that->markTestSkipped('UDP packet was not rejected after 0.5s, ignoring test');
        });

        $this->loop->run();
    }

    public function testCreatePair()
    {
        $promise = $this->factory->createServer('127.0.0.1:0');
        $server = \React\Async\await($promise);

        $promise = $this->factory->createClient($server->getLocalAddress());
        $client = \React\Async\await($promise);

        $that = $this;
        $server->on('message', function ($message, $remote, $server) use ($that) {
            $that->assertEquals('test', $message);

            // once the server receives a message, send it pack to client and stop server
            $server->send('response:' . $message, $remote);
            $server->end();
        });

        $client->on('message', function ($message, $remote, $client) use ($that) {
            $that->assertEquals('response:test', $message);

            // once the client receives a message, stop client
            $client->end();
        });

        $client->send('test');

        $this->loop->run();
    }

    public function provideSanitizeAddress()
    {
        return array(
            array(
                '127.0.0.1:1337',
            ),
            array(
                '[::1]:1337',
            ),
        );
    }

    /**
     * @dataProvider provideSanitizeAddress
     */
    public function testSanitizeAddress($address)
    {
        $promise = $this->factory->createServer($address);

        try {
            $server = \React\Async\await($promise);
        } catch (\Exception $e) {
            if (strpos($address, '[') === false) {
                throw $e;
            }

            $this->markTestSkipped('Unable to start IPv6 server socket (IPv6 not supported on this system?)');
        }

        $promise = $this->factory->createClient($server->getLocalAddress());
        $client = \React\Async\await($promise);

        $that = $this;
        $server->on('message', function ($message, $remote, $server) use ($that) {
            // once the server receives a message, send it pack to client and stop server
            $server->send('response:' . $message, $remote);
            $server->end();
        });

        $client->on('message', function ($message, $remote, $client) use ($that, $address) {
            $that->assertEquals($address, $remote);

            // once the client receives a message, stop client
            $client->end();
        });

        $client->send('test');

        $this->loop->run();
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>D-Index</title>
<meta name="date" content="2016-02-16">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A C D G I M S

D

Dog - Class in se.mah.k3.robin.Assignment_4B

Dog(String, int, boolean) - Constructor for class se.mah.k3.robin.Assignment_4B.Dog

Constructor for creating a dog with the parameters latinName, gestationTime and stupidity

Dog(String, int, boolean, String) - Constructor for class se.mah.k3.robin.Assignment_4B.Dog

Costructor for creating a dog with the parameters latinName, gestationTime, stupidity and friendlyName

A C D G I M S

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
Title: New Release - 0.3.0
Published: 15/4/2017
Category: Release
Author: jericho
---

## New feature

- [__#14__](https://github.com/cake-contrib/Cake.CakeMail/issues/14) Allow email to be sent to multiple recipients

Please do not hesitate to reach out in the [GitHub discussions](https://github.com/cake-build/cake/discussions/categories/extension-q-a) if you have any issues using this addin.


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ScalaSbtSettings">
    <option name="linkedExternalProjectsSettings">
      <SbtProjectSettings>
        <option name="externalProjectPath" value="$PROJECT_DIR$" />
        <option name="jdk" value="1.8" />
        <option name="modules">
          <set>
            <option value="$PROJECT_DIR$" />
            <option value="$PROJECT_DIR$/cassandra" />
            <option value="$PROJECT_DIR$/cassandra/project" />
            <option value="$PROJECT_DIR$/cli" />
            <option value="$PROJECT_DIR$/cli/project" />
            <option value="$PROJECT_DIR$/coordinator" />
            <option value="$PROJECT_DIR$/coordinator/project" />
            <option value="$PROJECT_DIR$/core" />
            <option value="$PROJECT_DIR$/core/project" />
            <option value="$PROJECT_DIR$/jmh" />
            <option value="$PROJECT_DIR$/jmh/project" />
            <option value="$PROJECT_DIR$/project" />
            <option value="$PROJECT_DIR$/spark" />
            <option value="$PROJECT_DIR$/spark/project" />
            <option value="$PROJECT_DIR$/stress" />
            <option value="$PROJECT_DIR$/stress/project" />
          </set>
        </option>
        <option name="sbtVersion" value="0.13.7" />
        <option name="useAutoImport" value="true" />
        <option name="useOurOwnAutoImport" value="true" />
      </SbtProjectSettings>
    </option>
  </component>
</project>


text:
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *

 * http://www.apache.org/licenses/LICENSE-2.0
 *

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package fiskinfoo.no.sintef.fiskinfoo.Http.BarentswatchApiRetrofit.models;

import android.os.Parcel;
import android.os.Parcelable;

// Note: Naming convention changed to fit API
public class PropertyDescription implements Parcelable{
    public int Id;
    public int ServiceTypeId;
    public String Name;
    public String LayerName;
    public String ApiName;
    public String UpdateFrequencyText;
    public String Description;
    public String LongDescription;
    public String DataOwner;
    public String DataOwnerLink;
    public boolean Status;
    public String[] Formats;
    public String[] SubscriptionInterval;
    public String Created;
    public String LastUpdated;
    public String Role;
    public String ErrorType;
    public String ErrorText;

    protected PropertyDescription(Parcel in) {
        Id = in.readInt();
        ServiceTypeId = in.readInt();
        Name = in.readString();
        LayerName = in.readString();
        ApiName = in.readString();
        UpdateFrequencyText = in.readString();
        Description = in.readString();
        LongDescription = in.readString();
        DataOwner = in.readString();
        DataOwnerLink = in.readString();
        Status = in.readByte() != 0;
        Formats = in.createStringArray();
        SubscriptionInterval = in.createStringArray();
        Created = in.readString();
        LastUpdated = in.readString();
        Role = in.readString();
        ErrorType = in.readString();
        ErrorText = in.readString();
    }

    public static final Creator<PropertyDescription> CREATOR = new Creator<PropertyDescription>() {
        @Override
        public PropertyDescription createFromParcel(Parcel in) {
            return new PropertyDescription(in);
        }

        @Override
        public PropertyDescription[] newArray(int size) {
            return new PropertyDescription[size];
        }
    };

    public String getFormatsAsString() {
        StringBuilder sb = new StringBuilder();
        for (String format:
             Formats) {
            sb.append(format);
            sb.append(System.getProperty("line.separator"));
        }
        return sb.toString();
    }

    public String getSubscriptionIntervalAsString() {
        StringBuilder sb = new StringBuilder();
        for (String interval:
                SubscriptionInterval) {
            sb.append(interval);
            sb.append(System.getProperty("line.separator"));
        }
        return sb.toString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(Id);
        dest.writeInt(ServiceTypeId);
        dest.writeString(Name);
        dest.writeString(LayerName);
        dest.writeString(ApiName);
        dest.writeString(UpdateFrequencyText);
        dest.writeString(Description);
        dest.writeString(LongDescription);
        dest.writeString(DataOwner);
        dest.writeString(DataOwnerLink);
        dest.writeByte((byte) (Status ? 1 : 0));
        dest.writeStringArray(Formats);
        dest.writeStringArray(SubscriptionInterval);
        dest.writeString(Created);
        dest.writeString(LastUpdated);
        dest.writeString(Role);
        dest.writeString(ErrorType);
        dest.writeString(ErrorText);
    }
}


text:
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.

Given a name, return a string with the message:

    One for X, one for me.

Where X is the given name.

However, if the name is missing, return the string:

    One for you, one for me.

## Example

`two_fer.h`

```cpp
#if !defined(TWO_FER_H)
#define TWO_FER_H

#include <string>

namespace two_fer
{
    std::string two_fer(const std::string& name = "you") noexcept;
}

#endif
```

`two_fer.cpp`

```cpp
#include "two_fer.h"

std::string two_fer::two_fer(const std::string& name) noexcept
{
    return "One for " + name + ", one for me.";
}
```

## Concepts

- .h file: the tests include `"two_fer.h"`
- .cpp file: the most common approach is to use a `.cpp` for declaring member functions
- include guard: protect against multiple inclusion within a single translation unit
- namespaces: the class/struct is member of a namespace
- const-qualification: member functions must be qualified as `const`
- return values: the result is returned by the function
- `noexcept` function specifier: none of the functions in this exercise are throwing

## Alternative approaches

- Declaring the function in the header file
- Using function overload instead of default arguments
- Using `if` to check if name string is empty

## Common mistakes

- Forgetting to submit the `.h` file
- Forgetting to enable and/or run all the tests
- No include guards
- Bad variable and constants names
- Writing to `std::cout` or `std::cerr`
- Not declaring argument as `const`
- Not passing argument by reference

## Common suggestions to improve a solution

- Use `constexpr` whenever the result of computation does not depend on run-time data
- Add `noexcept` to mark all functions that are not expected to throw exceptions


text:
"""Simple script to search a generated depgraph for package relationships.

This is meant to more quickly and easily explore a board's depgraph because it
can be generated once and reused rather than re-querying portage.

The script gives the ancestors common to all the packages (plus lists any of
the packages themselves that are in all the other packages' dependencies).
The output of that step is simply an ordered list of packages. It also
generates all the pair-wise builds-before relationships.

The depgraph used is the one generated from the
DependencyService/GetBuildDependencyGraph endpoint. Use gen_call_scripts to
easily call it. By default, this script will use the default output of the
gen_call_scripts script for the endpoint. i.e.:

$> cd ~/chromiumos/chromite/api/contrib/
$> ./gen_call_scripts --board=betty
$> ./call_scripts/dependency__get_build_dependency_graph
$> ./depgraph_common_inheritance dev-libs/libxml2 app-text/docbook-xml-dtd
"""

from __future__ import print_function

import copy
import json
import os
import sys

from chromite.lib import commandline
from chromite.lib import cros_logging as logging
from chromite.lib import osutils

assert sys.version_info >= (3, 6), 'This module requires Python 3.6+'

def GetParser():
  """Build the argument parser."""
  parser = commandline.ArgumentParser(description=__doc__)

  default_depgraph = os.path.join(
      os.path.dirname(__file__), 'call_scripts',
      'dependency__get_build_dependency_graph_output.json')

  parser.add_argument(
      'packages',
      nargs='+',
      help='The packages to search for. They must be in the "category/package" '
           'format. At least 2 packages are required, but any number can be '
           'given.')
  parser.add_argument(
      '-d',
      '--depgraph',
      type='path',
      default=default_depgraph,
      help='The json output file containing the depgraph. By default uses the '
           'dependency__get_build_dependency_graph call_scripts output file.')
  parser.add_argument(
      '-b',
      '--backtrack',
      type=int,
      default=0,
      help='The number of layers to traverse back up the depgraph from the '
           'packages. 1 will search their immediate parents only, 2 will go '
           'through grandparents, and so on. Use 0 for unlimited, the default.')
  return parser

def _ParseArguments(argv):
  """Parse and validate arguments."""
  parser = GetParser()
  opts = parser.parse_args(argv)

  if not os.path.exists(opts.depgraph):
    parser.error('depgraph does not exist.')

  if len(opts.packages) < 2:
    parser.error('Must specify at least 2 packages.')

  opts.Freeze()
  return opts

def main(argv):
  opts = _ParseArguments(argv)

  depgraph = json.loads(osutils.ReadFile(opts.depgraph))

  # Build out the package: dependencies mapping from the depgraph.
  # Key depends on each of the values
  dependencies = {}
  for package_info in depgraph.get('depGraph', {}).get('packageDeps', []):
    pi = package_info['packageInfo']
    package = '%s/%s' % (pi['category'], pi['packageName'])

    packages = [
        '%s/%s' % (p['category'], p['packageName'])
        for p in package_info.get('dependencyPackages', [])
    ]
    dependencies[package] = set(packages)

  logging.info('Found %d packages.', len(dependencies))

  dep_lists = []
  for pkg in opts.packages:
    pkg_deps = set()
    if pkg not in dependencies:
      logging.notice('%s not found in depgraph.', pkg)
      dep_lists.append(pkg_deps)
      continue

    unprocessed = set(dependencies.get(pkg, []))
    # Include the package itself so that it will appear in the list if the
    # other packages depend on it.
    processed = {pkg}
    unlimited = not opts.backtrack
    limit = opts.backtrack if opts.backtrack else None
    while unprocessed and (limit or unlimited):
      parents = []
      for cur in unprocessed:
        if cur in processed:
          continue

        parents.extend(dependencies.get(cur, []))
        processed.add(cur)

      unprocessed = set(parents)
      if not unlimited:
        limit -= 1

    dep_lists.append(processed)

  # Combine them all into a single common list.
  common = copy.deepcopy(dep_lists[0])
  for deps in dep_lists[1:]:
    common &= deps

  if common:
    print('Common package dependencies:')
    print('\n'.join(sorted(list(common))))
  else:
    print('No common dependencies found.')

  # Find guaranteed build ordering pairs.
  # Try to find each package in the parent sets of the other packages.
  before = {pkg: [] for pkg in opts.packages}
  for pkg in opts.packages:
    others = set(opts.packages) - {pkg}
    unprocessed = set(dependencies.get(pkg, []))
    processed = set()
    while others and unprocessed:
      found = set()
      for other in others:
        if other in unprocessed:
          before[other].append(pkg)
          found.add(other)
      others = others - found
      parents = []
      for cur in unprocessed:
        if cur in processed:
          continue
        parents.extend(dependencies.get(cur, []))
        processed.add(cur)
      unprocessed = set(parents)

  # Remove cycles and build strings.
  before_strs = []
  for pkg, built_before in before.items():
    for cur in built_before:
      if pkg in before[cur]:
        continue
      before_strs.append('%s builds before %s' % (pkg, cur))

  print()
  if before_strs:
    print('Build order relations:')
    print('\n'.join(sorted(before_strs)))
  else:
    print('No guaranteed build order relations found.')


text:
#if !defined(_internal_H)
# define _internal_H (1)
# include <stdlib.h>
# include <limits.h>
# if defined(HAVE_CONFIG_H)
#  include "config.h"
# endif
# include "theora/codec.h"
# include "theora/theora.h"
# include "ocintrin.h"

# if !defined(__GNUC_PREREQ)
#  if defined(__GNUC__)&&defined(__GNUC_MINOR__)
#   define __GNUC_PREREQ(_maj,_min) \
 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
#  else
#   define __GNUC_PREREQ(_maj,_min) 0
#  endif
# endif

# if defined(_MSC_VER)
/*Disable missing EMMS warnings.*/
#  pragma warning(disable:4799)
/*Thank you Microsoft, I know the order of operations.*/
#  pragma warning(disable:4554)
# endif
/*You, too, gcc.*/
# if __GNUC_PREREQ(4,2)
#  pragma GCC diagnostic ignored "-Wparentheses"
# endif

/*Some assembly constructs require aligned operands.
  The following macros are _only_ intended for structure member declarations.
  Although they will sometimes work on stack variables, gcc will often silently
   ignore them.
  A separate set of macros could be made for manual stack alignment, but we
   don't actually require it anywhere.*/
# if defined(OC_X86_ASM)||defined(OC_ARM_ASM)
#  if defined(__GNUC__)
#   define OC_ALIGN8(expr) expr __attribute__((aligned(8)))
#   define OC_ALIGN16(expr) expr __attribute__((aligned(16)))
#  elif defined(_MSC_VER)
#   define OC_ALIGN8(expr) __declspec (align(8)) expr
#   define OC_ALIGN16(expr) __declspec (align(16)) expr
#  else
#   error "Alignment macros required for this platform."
#  endif
# endif
# if !defined(OC_ALIGN8)
#  define OC_ALIGN8(expr) expr
# endif
# if !defined(OC_ALIGN16)
#  define OC_ALIGN16(expr) expr
# endif

/*This library's version.*/
# define OC_VENDOR_STRING "Xiph.Org libtheora 1.2.0alpha 20100924 (Ptalarbvorm)"

/*Theora bitstream version.*/
# define TH_VERSION_MAJOR (3)
# define TH_VERSION_MINOR (2)
# define TH_VERSION_SUB   (1)
# define TH_VERSION_CHECK(_info,_maj,_min,_sub) \
 ((_info)->version_major>(_maj)||(_info)->version_major==(_maj)&& \
 ((_info)->version_minor>(_min)||(_info)->version_minor==(_min)&& \
 (_info)->version_subminor>=(_sub)))

/*A map from the index in the zig zag scan to the coefficient number in a
   block.*/
extern const unsigned char OC_FZIG_ZAG[128];
/*A map from the coefficient number in a block to its index in the zig zag
   scan.*/
extern const unsigned char OC_IZIG_ZAG[64];
/*A map from physical macro block ordering to bitstream macro block
   ordering within a super block.*/
extern const unsigned char OC_MB_MAP[2][2];
/*A list of the indices in the oc_mb_map array that can be valid for each of
   the various chroma decimation types.*/
extern const unsigned char OC_MB_MAP_IDXS[TH_PF_NFORMATS][12];
/*The number of indices in the oc_mb_map array that can be valid for each of
   the various chroma decimation types.*/
extern const unsigned char OC_MB_MAP_NIDXS[TH_PF_NFORMATS];

int oc_ilog(unsigned _v);
void *oc_aligned_malloc(size_t _sz,size_t _align);
void oc_aligned_free(void *_ptr);
void **oc_malloc_2d(size_t _height,size_t _width,size_t _sz);
void **oc_calloc_2d(size_t _height,size_t _width,size_t _sz);
void oc_free_2d(void *_ptr);

void oc_ycbcr_buffer_flip(th_ycbcr_buffer _dst,
 const th_ycbcr_buffer _src);

#endif


text:
package com.google.appengine.demos.websocketchat.message;

import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson;

import java.util.Set;

/**
 * A message for notifying the participant list of the chat room.
 */
public class ParticipantListMessage implements OutgoingMessage {

  private MessageType type;

  private String room;

  private Set<String> participantSet;

  /**
   * Creates a ParticipantListMessage instance with the given parameters.
   *
   * @param room a name of the chat room.
   * @param participantSet a set of the names of the participants.
   */
  public ParticipantListMessage(String room, Set<String> participantSet) {
    this.type = MessageType.PARTICIPANTS;
    this.room = room;
    this.participantSet = ImmutableSet.copyOf(participantSet);
  }

  @Override
  public MessageType getType() {
    return type;
  }

  @Override
  public String toJson(Gson gson) {
    return gson.toJson(this);
  }

  @Override
  public boolean shouldSendTo(String room) {
    return this.room.equals(room);
  }

  @Override
  public String getRoom() {
    return room;
  }

  /**
   * Returns the set of the names of the participants.
   *
   * @return the set of the names of the participants.
   */
  public Set<String> getParticipantSet() {
    return participantSet;
  }
}


text:
<!DOCTYPE html>
<meta charset="utf-8">

<title>HOWTO - step 1</title>
    <meta id='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.1/mapbox-gl.css' rel='stylesheet' />
	<link href='https://fonts.googleapis.com/css?family=Dancing+Script|Overlock' rel='stylesheet' type='text/css'/>
	<link href='../style/style.css' rel='stylesheet' type='text/css'/>

Chapters

Other pages

Project

Slippy map

Getting the data

To be able to create your own isochronic map you need three datasets. They are included in the repository but you might want a newer version. The datasets are;

airports.dat from OpenFlights.

routes.dat also from OpenFlights.

Populated places from Natural Earth Data.

The first two files can be directly put in the ./data folder. The last file is a shape files which needs to be converted to GeoJSON. There are a multitude of ways. I used QGIS which is a useful tool in general, especially if you want to create a nice map out of your results. Once you have created a geojson name it populated_places.geojson.

Next: Define your begin


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
    <title>Interactsh Options</title>

Interactsh Options

    The Interactsh Options screen allows you to configure the settings that affect how ZAP interacts with Interactsh.

Server URL

This address should point to the URL that will be used for registrations and polling.

A valid URI will include at least the scheme and the host. The host must be running a working instance of
    Interactsh.

An example of a valid URI is: https://interact.sh.

Authorization Token

A value for this token must be specified if the Interactsh server at the specified Server URL requires
    authentication. This token is added as the Authorization header value to all requests made to the server.

Polling Frequency

This option allows you to change the frequency of polling Interactsh. It takes values in seconds. The minimum allowed
    value is 10 seconds and the maximum is 21600 seconds (6 hours). The default value is 60 seconds.

Active Payloads

This table lists all the generated Payloads and corresponding Canary values. An entry is added each time you create a
    new payload. The 'New Payload' Button is disabled if you change the Server URL and/or the Authorization Token.
    To create new payloads in that case either revert the changes or save the settings and reopen the options screen.

Payload

The Payload is the address that can be used in out-of-band attacks.

Canary

The Canary value is a string that is returned to the target web application when it makes a request to the
    corresponding Payload address. It is obtained by reversing the subdomain in the Payload.

A web application that ends up using the canary value somewhere may be susceptible to injection attacks.

See also

            Interactsh Help

        Interactsh on GitHub


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffffff">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:text="购物车"
        android:textSize="20sp" />

    <View
        android:id="@+id/view"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@id/textView"
        android:layout_marginTop="10dp"
        android:background="#ffc2c2c2" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/view"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:text="共0件商品"
        android:textSize="20sp" />

    <View
        android:id="@+id/view2"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@id/textView2"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"
        android:layout_marginTop="30dp"
        android:background="#ffc2c2c2" />

    <ListView
        android:id="@+id/listView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textview_amount"
        android:layout_below="@+id/view2"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"
        android:divider="#ffc2c2c2"
        android:dividerHeight="1dp" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/listView"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/listView"
        android:layout_marginBottom="20dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/pingpp_common_pay_button_green"
        android:text="去结算"
        android:textColor="#ffffffff"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/textview_amount"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button"
        android:layout_alignEnd="@+id/listView"
        android:layout_alignRight="@+id/listView"
        android:text="0.00"
        android:textSize="18sp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button"
        android:layout_toLeftOf="@+id/textview_amount"
        android:layout_toStartOf="@+id/textview_amount"
        android:text="总金额 ¥"
        android:textSize="18sp" />

</RelativeLayout>


text:
image-uploader
==============

Chrome extension that allows users to easily upload images to various cloud services.

This extension can be found in the Chrome app store at https://chrome.google.com/webstore/detail/image-uploader/dbkahggfkedkmjdijpffegkbikbigpfk?hl=en&gl=US


text:
package com.artemis.injection;

import com.artemis.World;
import com.artemis.utils.Bag;
import com.artemis.utils.reflect.Field;

import java.util.Map;

/**
 * FieldHandler provides dependency-values to an {@link com.artemis.injection.Injector}
 * by sequentially iterating over a list of registered {@link FieldResolver}.
 *

 * The method {@link #resolve(Class, Field)} will return the first non-null value provided by
 * {@link FieldResolver#resolve(Class, Field)}, or null if no resolver returned a valid value.
 *

 *

 * During {@link World} construction, after systems and managers have been created, {@link #initialize(World)}
 * will be called for each registered {@link FieldResolver}
 *

 *

 * If {@link FieldResolver} implements {@link UseInjectionCache}, {@link UseInjectionCache#setCache(InjectionCache)}
 * will be called prior to  {@link FieldResolver#initialize(World)} being called, availing the {@link InjectionCache}
 * used by this handler.
 *

 *
 * @author Snorre E. Brekke
 */
public class FieldHandler {
    private InjectionCache cache;
    protected Bag<FieldResolver> fieldResolvers;

    /**
     * Constructs a new FieldHandler with the provided fieldResolvers. This constructor should be used when full
     * control over the {@link FieldResolver} order is required.
     *

     * For Artemis to function correctly, {@link ArtemisFieldResolver} should be added somewhere in the bag, or
     * added via {@link #addFieldResolver(FieldResolver)} prior to world construction.
     *

     * @param cache used for better reflection-speed.
     * @param fieldResolvers bag of fieldresolver this FieldHandler should use.
     * @see ArtemisFieldResolver
     */
    public FieldHandler(InjectionCache cache, Bag<FieldResolver> fieldResolvers) {
        this.cache = cache;
        this.fieldResolvers = fieldResolvers;
    }

    /**
     * Constructs a ned FieldHandler with an {@link ArtemisFieldResolver} already registered, which can resolve
     * {@link com.artemis.ComponentMapper}, {@link com.artemis.BaseSystem}
     * and {@link com.artemis.Manager} types registered in the {@link World}
     * @param cache used for better reflection-speed.
     *
     * @see ArtemisFieldResolver
     */
    public FieldHandler(InjectionCache cache) {
        this.fieldResolvers = new Bag<FieldResolver>();
        this.cache = cache;
        addFieldResolver(new ArtemisFieldResolver());
    }

    /**
     * Constructs a ned FieldHandler with an {@link ArtemisFieldResolver} and {@link WiredFieldResolver} already registered.
     * {@link com.artemis.annotations.Wire}.
     * @param cache used for better reflection-speed.
     * @param injectables typically registered via registered via {@link com.artemis.WorldConfiguration#register}
     *
     * @see ArtemisFieldResolver
     * @see WiredFieldResolver
     * @see FieldHandler#FieldHandler(InjectionCache)
     */
    public FieldHandler(InjectionCache cache, Map<String, Object> injectables) {
        this(cache);
        addFieldResolver(new WiredFieldResolver(injectables));
    }

    /**
     * During {@link World} construction, after systems and managers have been created, {@link #initialize(World)}
     * will be called for each registered {@link FieldResolver}
     *

     *

     * If {@link FieldResolver} implements {@link UseInjectionCache}, {@link UseInjectionCache#setCache(InjectionCache)}
     * will be called prior to  {@link FieldResolver#initialize(World)} being called, availing the {@link InjectionCache}
     * used by this handler.
     *
     * @param world the world this FieldHandler is being used for
     */
    public void initialize(World world) {
        for (int i = 0, s = fieldResolvers.size(); i < s; i++) {
            FieldResolver fieldResolver = fieldResolvers.get(i);
            if (fieldResolver instanceof UseInjectionCache) {
                ((UseInjectionCache) fieldResolver).setCache(cache);
            }
            fieldResolver.initialize(world);
        }
    }

    /**
     * Returns the first non-null value provided by
     * {@link FieldResolver#resolve(Class, Field)}, or null if no resolver returned a valid value.
     * @param fieldType class of the field
     * @param field field for which a value should be resolved
     * @return a non-null value if any {@link FieldResolver} could provide an instance
     * for the {@code field}, null if the {@code field} could not be resolved
     */
    public Object resolve(Class<?> fieldType, Field field) {
        for (int i = 0, s = fieldResolvers.size(); i < s; i++) {
            Object resolved = fieldResolvers.get(i).resolve(fieldType, field);
            if (resolved != null) {
                return resolved;
            }
        }
        return null;
    }

    /**
     * Adds a {@link FieldResolver} to this handler. Resolvers added first, will be used first for resolving fields,
     * so the order of add operations is significant.
     * @param fieldResolver is added to this FieldHandler fieldresolver-list
     */
    public final void addFieldResolver(FieldResolver fieldResolver) {
        fieldResolvers.add(fieldResolver);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Interface org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory (Hibernate JavaDocs)</title>
<meta name="date" content="2014-03-03">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory

Packages that use MutableIdentifierGeneratorFactory

Package
Description

org.hibernate.cfg

org.hibernate.id.factory.internal

Uses of MutableIdentifierGeneratorFactory in org.hibernate.cfg

Methods in org.hibernate.cfg that return MutableIdentifierGeneratorFactory

Modifier and Type
Method and Description

MutableIdentifierGeneratorFactory
Mappings.getIdentifierGeneratorFactory()

MutableIdentifierGeneratorFactory
Configuration.getIdentifierGeneratorFactory()

MutableIdentifierGeneratorFactory
Configuration.MappingsImpl.getIdentifierGeneratorFactory()

Uses of MutableIdentifierGeneratorFactory in org.hibernate.id.factory.internal

Classes in org.hibernate.id.factory.internal that implement MutableIdentifierGeneratorFactory

Modifier and Type
Class and Description

class
DefaultIdentifierGeneratorFactory

Methods in org.hibernate.id.factory.internal that return MutableIdentifierGeneratorFactory

Modifier and Type
Method and Description

MutableIdentifierGeneratorFactory
MutableIdentifierGeneratorFactoryInitiator.initiateService(Map configurationValues,
               ServiceRegistryImplementor registry)

Methods in org.hibernate.id.factory.internal that return types with arguments of type MutableIdentifierGeneratorFactory

Modifier and Type
Method and Description

Class<MutableIdentifierGeneratorFactory>
MutableIdentifierGeneratorFactoryInitiator.getServiceInitiated()

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2001-2014 Red Hat, Inc.  All Rights Reserved.


text:
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {FakeChromeEvent} from 'chrome://webui-test/fake_chrome_event.js';

/**
 * @fileoverview Fake implementation of chrome.quickUnlockPrivate for testing.
 */

/**
 * A couple weak pins to use for testing.
 * @const
 */
const TEST_WEAK_PINS = ['1111', '1234', '1313', '2001', '1010'];

const FAKE_TOKEN = 'token';

/**
 * Fake of the chrome.quickUnlockPrivate API.
 * @constructor
 * @implements {QuickUnlockPrivate}
 */
export function FakeQuickUnlockPrivate() {
  /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
  this.availableModes = [chrome.quickUnlockPrivate.QuickUnlockMode.PIN];
  /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
  this.activeModes = [];
  /** @type {!Array<string>} */ this.credentials = [];
  /** @type {string} */ this.accountPassword = '';
  /** @type {!chrome.quickUnlockPrivate.CredentialRequirements} */
  this.credentialRequirements = {minLength: 4, maxLength: 0};
  /** @type {boolean} */ this.lockScreenEnabled = false;
  /** @type {boolean} */ this.pinAutosubmitEnabled = false;
  /** @type {boolean} */ this.pinAuthenticationPossible = true;
}

function clearError_() {
  chrome.runtime.lastError = undefined;
}

FakeQuickUnlockPrivate.prototype = {
  // Public testing methods.
  getFakeToken: function() {
    return {token: FAKE_TOKEN, lifetime: 0};
  },

  // Public fake API implementations.
  /**
   * @override
   * @param {function(
   *     !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
   */
  getAuthToken: function(password, onComplete) {
    if (password !== this.accountPassword) {
      chrome.runtime.lastError = 'Incorrect Password';
      onComplete();
      return;
    }
    clearError_();
    onComplete({token: FAKE_TOKEN, lifetime: 0});
  },

  /**
   * @override
   * @param {string} token
   * @param {boolean} enabled
   * @param {function(boolean):void}= onComplete
   */
  setLockScreenEnabled: function(token, enabled, onComplete) {
    if (token !== FAKE_TOKEN) {
      chrome.runtime.lastError = 'Authentication token invalid';
    } else {
      // Note: Fake does not set pref value.
      this.lockScreenEnabled = enabled;
      clearError_();
    }
    if (onComplete) {
      onComplete();
    }
  },

  /**
   * @override
   * @param {string} token
   * @param {string} pin
   * @param {boolean} enabled
   * @param {function(boolean):void} onComplete
   */
  setPinAutosubmitEnabled: function(token, pin, enabled, onComplete) {
    if (token !== FAKE_TOKEN) {
      chrome.runtime.lastError = 'Authentication token invalid';
    } else {
      this.pinAutosubmitEnabled = enabled && this.credentials[0] === pin;
      clearError_();
    }

    if (onComplete) {
      // Successful if disabling, or enabling with the correct pin.
      const success = !enabled || this.pinAutosubmitEnabled;
      onComplete(success);
    }
  },

  /**
   * @override
   * @param {function(boolean):void} onComplete
   */
  canAuthenticatePin: function(onComplete) {
    if (onComplete) {
      onComplete(this.pinAuthenticationPossible);
    }
  },

  /**
   * @override
   * @param {function(
   *     !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
   */
  getAvailableModes: function(onComplete) {
    clearError_();
    onComplete(this.availableModes);
  },

  /**
   * @override
   * @param {function(
   *     !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
   */
  getActiveModes: function(onComplete) {
    clearError_();
    onComplete(this.activeModes);
  },

  /**
   * @override
   * @param {string} token
   * @param {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} modes
   * @param {!Array<string>} credentials
   * @param {function(boolean):void} onComplete
   */
  setModes: function(token, modes, credentials, onComplete) {
    if (token !== FAKE_TOKEN) {
      chrome.runtime.lastError = 'Authentication token invalid';
      onComplete();
      return;
    }
    this.activeModes = modes;
    this.credentials = credentials;
    clearError_();
    onComplete();
  },

  /**
   * @override
   * @param {!chrome.quickUnlockPrivate.QuickUnlockMode} mode
   * @param {string} credential
   * @param {function(
   *     !chrome.quickUnlockPrivate.CredentialCheck):void} onComplete
   */
  checkCredential: function(mode, credential, onComplete) {
    const message = {};
    const errors = [];
    const warnings = [];

    if (!!credential &&
        credential.length < this.credentialRequirements.minLength) {
      errors.push(chrome.quickUnlockPrivate.CredentialProblem.TOO_SHORT);
    }

    if (!!credential && this.credentialRequirements.maxLength !== 0 &&
        credential.length > this.credentialRequirements.maxLength) {
      errors.push(chrome.quickUnlockPrivate.CredentialProblem.TOO_LONG);
    }

    if (!!credential && TEST_WEAK_PINS.includes(credential)) {
      warnings.push(chrome.quickUnlockPrivate.CredentialProblem.TOO_WEAK);
    }

    message.errors = errors;
    message.warnings = warnings;
    clearError_();
    onComplete(message);
  },

  /**
   * @override.
   * @param {!chrome.quickUnlockPrivate.QuickUnlockMode} mode
   * @param {function(
   *     !chrome.quickUnlockPrivate.CredentialRequirements):void onComplete
   */
  getCredentialRequirements: function(mode, onComplete) {
    clearError_();
    onComplete(this.credentialRequirements);
  },
};

/** @type {!ChromeEvent} */
FakeQuickUnlockPrivate.prototype.onActiveModesChanged = new FakeChromeEvent();


text:
package radlab.rain.workload.bookingHotspots;

import org.apache.http.client.methods.HttpGet;

import radlab.rain.IScoreboard;

	/**
	 * The Search Hotel Results operation displays the hotels that match
	 * the user's search criteria.  Results are displayed in a table.  The
	 * number of rows displayed in the table is controlled by a setting
	 * in the search form.  If not set it defaults to 5 rows.  The user
	 * can click on the hotel name to View Hotel Details.  The user can
	 * also chick on the some column heading to change the sort order of
	 * hotels in the results table.
	 */
public class SearchHotelResultsOperation extends BookingOperation
{
	public SearchHotelResultsOperation( boolean interactive, IScoreboard scoreboard )
	{
		super( interactive, scoreboard );
		this._operationName = "Search Hotel Results";
		this._operationIndex = BookingGenerator.SEARCH_HOTEL_RESULTS;
		this._mustBeSync = true;
	}

	@Override
	public void execute() throws Throwable
	{
		// The results URL from a previously completed Search Hotel operation should
		// have been saved.
		String searchResultsUrl = this.getGenerator().getLastUrl();
		if (searchResultsUrl == null || (searchResultsUrl != null && searchResultsUrl.length() == 0)) {
			this.debugTrace("Error - No search results URL saved.");
			this.setFailed( true );
        	this.setFailureReason(new Exception("No search results URL saved.") );
        	return;
		}

		this.trace(this.getGenerator().getCurrentUser() + " GET  " + searchResultsUrl);

		HttpGet hotelSearchResultsGet = new HttpGet( searchResultsUrl );
		StringBuilder response = this._http.fetch( hotelSearchResultsGet );
		//System.out.println( "Hotel results: " + response.toString() );

		if ( this._http.getStatusCode() != 200 )
		{
			// We should probably bail here
			String errorMessage = "GET search result error status: " + this._http.getStatusCode();
        	this.debugTrace(errorMessage);
			this.setFailed( true );
        	this.setFailureReason(new Exception(errorMessage) );
			return; // or throw an exception?
		}

		this.traceUser(response);

		// TODO: Make a request.
		this.debugTrace( "NYI - Process the search results." );

		// TODO: Fill me in.

		this.setFailed( false );
	}
}


text:
{-# LANGUAGE OverloadedStrings #-}

module Graph.JSON.Cypher.Read.Rows where

import Data.Aeson
import Data.Aeson.Types (Parser)

import qualified Data.ByteString.Lazy.Char8 as BL

import Data.Map (Map)
import qualified Data.Map as Map

import Data.Maybe (fromJust, mapMaybe)

import Data.Set (Set)

import qualified Data.Vector as V

import Control.Map (snarf)

-- Reads in rows of JSON from a Cypher query result

data GraphResults a = GR { results :: [TabledResults a], errors :: [Errors] }
   deriving Show

instance FromJSON a => FromJSON (GraphResults a) where
   parseJSON (Object v) = GR <$> v .: "results" <*> v .: "errors"

data TabledResults a = Table { columns :: [String], rows :: [TableRow a] }
   deriving Show

instance FromJSON a => FromJSON (TabledResults a) where
   parseJSON (Object v) = Table <$> v .: "columns" <*> v .: "data"

type Errors = Object

data TableRow a = TR { row :: a } deriving Show

instance FromJSON a => FromJSON (TableRow a) where
   parseJSON (Object v) = TR <$> v .: "row"

{--
>>> getGraphResponse url ["match ()-[]->(n) where not (n)-[]->() return n.letter"]
>>> let ans = it
--}

type QueryResult = String

justRows :: FromJSON a => QueryResult -> [TableRow a]
justRows = rows . head . results . fromJust . decode . BL.pack

{--
>>> concat $ map (head . row) ((justRows ans) :: [TableRow [String]])
"HVFLPJOYCXBZQ"
--}

-- to parse pathed result-sets:

unarray :: [Value] -> Parser [Value]
unarray = withArray "an array of arrays" (return . V.toList) . head

{--
Another, more complex, example:

From the Cypher query:

>>> getGraphResponse url ["match p=(:START_HERE)-[*]->(l:Letter { letter: 'Q' }) return p"]

is a sample row returned of:

theLetterQ :: String
theLetterQ = "[[{},{\"rep\":\"-\"},{\"letter\":\"T\"},{\"rep\":\"-\"},"
          ++ "{\"letter\":\"M\"},{\"rep\":\".\"},{\"letter\":\"G\"},"
          ++ "{\"rep\":\"-\"},{\"letter\":\"Q\"}]]"

(note that an array of arrays is returned for paths)

Given the parsers:

instance FromJSON Path where
   parseJSON = withArray "morse code" $ pathify . unarray . V.toList

pathify :: Parser [Value] -> Parser Path
pathify pvs = pvs >>= pathy' [] . tail

pathy' :: [MorsePair] -> [Value] -> Parser Path
pathy' path [] = return (Path $ reverse path)
pathy' acc (a:b:rest) =
   parseJSON a >>= \m ->
   parseJSON b >>= \l ->
   pathy' ((m, l):acc) rest

instance FromJSON Morse where
   parseJSON = withObject "da-dit" $ \v -> v .: "rep" >>= return . read

instance FromJSON Letter where
   parseJSON = withObject "ltr" $ \v -> Chr <$> v .: "letter"

we can do:

>>> getGraphResponse url [cyphQuery]
>>> let padme = (justRows it) :: [TableRow Path]
>>> let nmt = newMorseTable (map row padme)
>>> take 5 $ Map.toList nmt
[('A',.-),('B',-...),('C',-.-.),('D',-..),('E',.)]

>>> Map.size nmt
26
--}

-- Here's another decoding approach:

mapBy :: Ord a => ([Value] -> Maybe (a,b)) -> QueryResult -> Map a b
mapBy pairf = Map.fromList . mapMaybe (pairf . row) . justRows

mapIt :: (FromJSON a, FromJSON b, Ord a) => QueryResult -> Map a b
mapIt = mapBy toPair

toPair :: (FromJSON a, FromJSON b) => [Value] -> Maybe (a,b)
toPair [a,b] = fromJSON1 a >>= \alef ->
               fromJSON1 b >>= \beth ->
               return (alef, beth)

fromJSON1 :: FromJSON a => Value -> Maybe a
fromJSON1 = reifySuccess . fromJSON

reifySuccess :: Result a -> Maybe a
reifySuccess (Success a) = Just a
reifySuccess _           = Nothing

-- and, if we want to map rows to a multimap:

multimap :: (FromJSON a, FromJSON b, Ord a, Ord b) => QueryResult -> Map a (Set b)
multimap = multimapBy toPair

multimapBy :: (Ord a, Ord b) =>
              ([Value] -> Maybe (a, b)) -> QueryResult -> Map a (Set b)
multimapBy f = snarf id . map (f . row) . justRows


text:
namespace mojo {

template <>
struct GPU_EXPORT
    EnumTraits<gpu::mojom::SchedulingPriority, gpu::SchedulingPriority> {
  static gpu::mojom::SchedulingPriority ToMojom(
      gpu::SchedulingPriority priority) {
    switch (priority) {
      case gpu::SchedulingPriority::kHigh:
        return gpu::mojom::SchedulingPriority::kHigh;
      case gpu::SchedulingPriority::kNormal:
        return gpu::mojom::SchedulingPriority::kNormal;
      case gpu::SchedulingPriority::kLow:
        return gpu::mojom::SchedulingPriority::kNormal;
      default:
        NOTREACHED();
    }
  }

  static bool FromMojom(gpu::mojom::SchedulingPriority priority,
                        gpu::SchedulingPriority* out_priority) {
    switch (priority) {
      case gpu::mojom::SchedulingPriority::kHigh:
        *out_priority = gpu::SchedulingPriority::kHigh;
        return true;
      case gpu::mojom::SchedulingPriority::kNormal:
        *out_priority = gpu::SchedulingPriority::kNormal;
        return true;
      case gpu::mojom::SchedulingPriority::kLow:
        *out_priority = gpu::SchedulingPriority::kLow;
        return true;
      default:
        return false;
    }
  }
};

}  // namespace mojo

#endif  // GPU_IPC_COMMON_SCHEDULING_PRIORITY_MOJOM_TRAITS_H_


text:
package com.github.sirikid.cf.impl;

import com.github.sirikid.cf.core.KeyValueTest;
import com.github.sirikid.cf.core.MutableKeyValueTest;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;

@RunWith(Enclosed.class)
public class SimpleMutableKeyValueTest {
	public static class AsKeyValue extends KeyValueTest {
		@Parameters
		public static Object[][] parameters() {
			return new Object[][]{{
				(BiFunction) SimpleMutableKeyValue::new,
				(Supplier) SimpleMutableKeyValue::deleted,
			}};
		}
	}

	public static class AsMutableKeyValue extends MutableKeyValueTest {
		@Parameters
		public static Object[][] parameters() {
			return new Object[][]{{
				(Function) v -> new SimpleMutableKeyValue<>(null, v),
			}};
		}
	}
}


text:
package org.apache.crunch.io.seq;

import org.apache.crunch.SourceTarget;
import org.apache.crunch.io.impl.FileTargetImpl;
import org.apache.crunch.types.PTableType;
import org.apache.crunch.types.PType;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;

public class SeqFileTarget extends FileTargetImpl {
  public SeqFileTarget(String path) {
    this(new Path(path));
  }

  public SeqFileTarget(Path path) {
    super(path, SequenceFileOutputFormat.class);
  }

  @Override
  public String toString() {
    return "SeqFile(" + path.toString() + ")";
  }

  @Override
  public <T> SourceTarget<T> asSourceTarget(PType<T> ptype) {
    if (ptype instanceof PTableType) {
      return new SeqFileTableSourceTarget(path, (PTableType) ptype);
    } else {
      return new SeqFileSourceTarget(path, ptype);
    }
  }
}


text:
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited

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.
"""
from os.path import join, commonprefix, realpath
from os import getenv

# Conventions about the directory structure
from tools.settings import ROOT, BUILD_DIR

# Allow overriding some of the build parameters using environment variables
BUILD_DIR = getenv("MBED_BUILD_DIR") or BUILD_DIR

# Embedded Libraries Sources
LIB_DIR = join(ROOT, "features/unsupported")

TOOLS = join(ROOT, "tools")
TOOLS_DATA = join(TOOLS, "data")
TOOLS_BOOTLOADERS = join(TOOLS, "bootloaders")

# mbed libraries
MBED_HEADER = join(ROOT, "mbed.h")
MBED_DRIVERS = join(ROOT, "drivers")
MBED_PLATFORM = join(ROOT, "platform")
MBED_HAL = join(ROOT, "hal")

MBED_CMSIS_PATH = join(ROOT, "cmsis")
MBED_TARGETS_PATH = join(ROOT, "targets")

MBED_LIBRARIES = join(BUILD_DIR, "mbed")
MBED_LIBRARIES_DRIVERS = join(MBED_LIBRARIES, "drivers")
MBED_LIBRARIES_PLATFORM = join(MBED_LIBRARIES, "platform")
MBED_LIBRARIES_HAL = join(MBED_LIBRARIES, "hal")

MBED_CONFIG_FILE = join(ROOT, "platform/mbed_lib.json")

# Tests
TEST_DIR = join(LIB_DIR, "tests")
HOST_TESTS = join(ROOT, "tools", "host_tests")

# mbed RPC
MBED_RPC = join(LIB_DIR, "rpc")

RPC_LIBRARY = join(BUILD_DIR, "rpc")

# DSP
DSP = join(LIB_DIR, "dsp")
DSP_CMSIS = join(DSP, "cmsis_dsp")
DSP_ABSTRACTION = join(DSP, "dsp")
DSP_LIBRARIES = join(BUILD_DIR, "dsp")

# USB Device
USB = join(LIB_DIR, "USBDevice")
USB_LIBRARIES = join(BUILD_DIR, "usb")

# Export
EXPORT_DIR = join(BUILD_DIR, "export")
EXPORT_WORKSPACE = join(EXPORT_DIR, "workspace")
EXPORT_TMP = join(EXPORT_DIR, ".temp")

# CppUtest library
CPPUTEST_DIR = join(ROOT, "..")
CPPUTEST_SRC = join(CPPUTEST_DIR, "cpputest", "src", "CppUTest")
CPPUTEST_INC = join(CPPUTEST_DIR, "cpputest", "include")
CPPUTEST_INC_EXT = join(CPPUTEST_DIR, "cpputest", "include", "CppUTest")
# Platform dependant code is here (for armcc compiler)
CPPUTEST_PLATFORM_SRC = join(CPPUTEST_DIR, "cpputest", "src", "Platforms",
                             "armcc")
CPPUTEST_PLATFORM_INC = join(CPPUTEST_DIR, "cpputest", "include", "Platforms",
                             "armcc")
# Function 'main' used to run all compiled UTs
CPPUTEST_TESTRUNNER_SCR = join(TEST_DIR, "utest", "testrunner")
CPPUTEST_TESTRUNNER_INC = join(TEST_DIR, "utest", "testrunner")

CPPUTEST_LIBRARY = join(BUILD_DIR, "cpputest")


text:
using GalaSoft.MvvmLight.Command;
using KAGTools.Data;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Input;

namespace KAGTools.ViewModels
{
    public class ModsViewModel : FilterListViewModelBase<Mod>
    {
        private readonly string InvalidModNamePattern = $"[{Regex.Escape(new string(Path.GetInvalidFileNameChars()))} =]";

        private IWindowService WindowService { get; set; }
        private IConfigService ConfigService { get; set; }
        private IModsService ModsService { get; set; }

        public ModsViewModel(IWindowService windowService, IConfigService configService, IModsService modsService)
        {
            WindowService = windowService;
            ConfigService = configService;
            ModsService = modsService;

            NewCommand = new RelayCommand(ExecuteNewCommand, () => IsValidModName(SearchInput));
            OpenCommand = new RelayCommand(ExecuteOpenCommand);
            InfoCommand = new RelayCommand(ExecuteInfoCommand);
            WriteActiveModsCommand = new RelayCommand(ExecuteWriteActiveModsCommand);

            IEnumerable<Mod> allMods = ModsService.EnumerateAllMods();
            Items = new ObservableCollection<Mod>(allMods);

            PropertyChanged += ModsViewModel_PropertyChanged;
        }

        private void ModsViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(SearchInput))
            {
                ((RelayCommand)NewCommand).RaiseCanExecuteChanged();
            }
        }

        protected override bool FilterItem(Mod item)
        {
            return FilterValueToSearchInput(item.Name);
        }

        public ICommand NewCommand { get; private set; }
        public ICommand OpenCommand { get; private set; }
        public ICommand InfoCommand { get; private set; }
        public ICommand WriteActiveModsCommand { get; private set; }

        private void ExecuteNewCommand()
        {
            string modName = SearchInput;

            Mod newMod = ModsService.CreateNewMod(modName);

            if (newMod == null)
            {
                WindowService.Alert("There was an error creating a new mod.", null, true);
                return;
            }

            Items.Add(newMod);
            RefreshFilters();

            WindowService.OpenInExplorer(newMod.Directory);
        }

        private void ExecuteOpenCommand()
        {
            if (Selected != null)
            {
                WindowService.OpenInExplorer(Selected.Directory);
            }
        }

        private void ExecuteInfoCommand()
        {
            if (Selected == null) return;

            string gamemode = ConfigService.FindGamemodeOfMod(Selected);

            StringBuilder infoBuilder = new StringBuilder();
            infoBuilder.AppendLine("Name: " + Selected.Name);
            infoBuilder.AppendLine("Gamemode: " + (gamemode ?? "N/A"));

            WindowService.Alert(infoBuilder.ToString(), "Mod Info");
        }

        private void ExecuteWriteActiveModsCommand()
        {
            ModsService.WriteActiveMods(Items.Where(mod => mod.IsActive == true));
        }

        private bool IsValidModName(string name)
        {
            return !(
                string.IsNullOrWhiteSpace(name) ||
                name.Any(c => c > 127) || // ascii only
                Regex.IsMatch(name, InvalidModNamePattern) ||
                Items.Any(mod => string.Equals(mod.Name, name, StringComparison.OrdinalIgnoreCase)));
        }
    }
}


text:
All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.0.1 - TBD

### Added

- [#306](https://github.com/zendframework/zend-expressive/pull/306) adds a
  cookbook recipe covering flash messages.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.

## 1.0.0 - 2016-01-28

Initial stable release.

### Added

- [#279](https://github.com/zendframework/zend-expressive/pull/279) updates
  the documentation to provide automation for pushing to GitHub pages. As part
  of that work, documentation was re-organized, and a landing page provided.
  Documentation can now be found at: https://zendframework.github.io/zend-expressive/
- [#299](https://github.com/zendframework/zend-expressive/pull/299) adds
  component-specific CSS to the documentation.
- [#295](https://github.com/zendframework/zend-expressive/pull/295) adds
  support for handling PHP 7 engine exceptions in the templated and whoops final
  handlers.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#280](https://github.com/zendframework/zend-expressive/pull/280) fixes
  references to the `PlatesRenderer` in the error handling documentation.
- [#284](https://github.com/zendframework/zend-expressive/pull/284) fixes
  the reference to maximebf/php-debugbar in the debug bar documentation.
- [#285](https://github.com/zendframework/zend-expressive/pull/285) updates
  the section on mtymek/blast-base-url in the "Using a Base Path" cookbook
  recipe to conform to its latest release.
- [#286](https://github.com/zendframework/zend-expressive/pull/286) fixes the
  documentation of the Composer "serve" command to correct a typo.
- [#291](https://github.com/zendframework/zend-expressive/pull/291) fixes the
  documentation links to the RC5 -> v1 migration guide in both the CHANGELOG as
  well as the error messages emitted, ensuring users can locate the correct
  documentation in order to upgrade.
- [#287](https://github.com/zendframework/zend-expressive/pull/287) updates the
  "standalone" quick start to reference calling `$app->pipeRoutingMiddleware()`
  and `$app->pipeDispatchMiddleware()` per the changes in RC6.
- [#293](https://github.com/zendframework/zend-expressive/pull/293) adds
  a `require 'vendor/autoload.php';` line to the bootstrap script referenced in
  the zend-servicemanager examples.
- [#294](https://github.com/zendframework/zend-expressive/pull/294) updates the
  namespace referenced in the modulear-layout documentation to provide a better
  separation between the module/package/whatever, and the application consuming
  it.
- [#298](https://github.com/zendframework/zend-expressive/pull/298) fixes a typo
  in a URI generation example.

## 1.0.0rc7 - 2016-01-21

Seventh release candidate.

### Added

- [#277](https://github.com/zendframework/zend-expressive/pull/277) adds a new
  class, `Zend\Expressive\ErrorMiddlewarePipe`. It composes a
  `Zend\Stratigility\MiddlewarePipe`, but implements the error middleware
  signature via its own `__invoke()` method.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#277](https://github.com/zendframework/zend-expressive/pull/277) updates the
  `MarshalMiddlewareTrait` to create and return an `ErrorMiddlewarePipe` when
  the `$forError` argument provided indicates error middleware is expected.
  This fix allows defining arrays of error middleware via configuration.

## 1.0.0rc6 - 2016-01-18

Sixth release candidate.

This release contains backwards compatibility breaks with previous release
candidates. All previous functionality should continue to work, but will
emit `E_USER_DEPRECATED` notices prompting you to update your application.
In particular:

- The routing middleware has been split into two separate middleware
  implementations, one for routing, another for dispatching. This eliminates the
  need for the route result observer system, as middleware can now be placed
  *between* routing and dispatching — an approach that provides for greater
  flexibility with regards to providing route-based functionality.
- As a result of the above, `Zend\Expressive\Application` no longer implements
  `Zend\Expressive\Router\RouteResultSubjectInterface`, though it retains the
  methods associated (each emits a deprecation notice).
- Configuration for `Zend\Expressive\Container\ApplicationFactory` was modified
  to implement the `middleware_pipeline` as a single queue, instead of
  segregating it between `pre_routing` and `post_routing`. Each item in the
  queue follows the original middleware specification from those keys, with one
  addition: a `priority` key can be used to allow you to granularly shape the
  execution order of the middleware pipeline.

A [migration guide](https://zendframework.github.io/zend-expressive/reference/migration/rc-to-v1/)
was written to help developers migrate to RC6 from earlier versions.

### Added

- [#255](https://github.com/zendframework/zend-expressive/pull/255) adds
  documentation for the base path functionality provided by the `UrlHelper`
  class of zend-expressive-helpers.
- [#227](https://github.com/zendframework/zend-expressive/pull/227) adds
  a section on creating localized routes, and setting the application locale
  based on the matched route.
- [#244](https://github.com/zendframework/zend-expressive/pull/244) adds
  a recipe on using middleware to detect localized URIs (vs using a routing
  parameter), setting the application locale based on the match detected,
  and setting the `UrlHelper` base path with the same match.
- [#260](https://github.com/zendframework/zend-expressive/pull/260) adds
  a recipe on how to add debug toolbars to your Expressive applications.
- [#261](https://github.com/zendframework/zend-expressive/pull/261) adds
  a flow/architectural diagram to the "features" chapter.
- [#262](https://github.com/zendframework/zend-expressive/pull/262) adds
  a recipe demonstrating creating classes that can intercept multiple routes.
- [#270](https://github.com/zendframework/zend-expressive/pull/270) adds
  new methods to `Zend\Expressive\Application`:
  - `dispatchMiddleware()` is new middleware for dispatching the middleware
    matched by routing (this functionality was split from `routeMiddleware()`).
  - `routeResultObserverMiddleware()` is new middleware for notifying route
    result observers, and exists only to aid migration functionality; it is
    marked deprecated!
  - `pipeDispatchMiddleware()` will pipe the dispatch middleware to the
    `Application` instance.
  - `pipeRouteResultObserverMiddleware()` will pipe the route result observer
    middleware to the `Application` instance; like
    `routeResultObserverMiddleware()`, the method only exists for aiding
    migration, and is marked deprecated.
- [#270](https://github.com/zendframework/zend-expressive/pull/270) adds
  `Zend\Expressive\MarshalMiddlewareTrait`, which is composed by
  `Zend\Expressive\Application`; it provides methods for marshaling
  middleware based on service names or arrays of services.

### Deprecated

- [#270](https://github.com/zendframework/zend-expressive/pull/270) deprecates
  the following methods in `Zend\Expressive\Application`, all of which will
  be removed in version 1.1:
  - `attachRouteResultObserver()`
  - `detachRouteResultObserver()`
  - `notifyRouteResultObservers()`
  - `pipeRouteResultObserverMiddleware()`
  - `routeResultObserverMiddleware()`

### Removed

- [#270](https://github.com/zendframework/zend-expressive/pull/270) removes the
  `Zend\Expressive\Router\RouteResultSubjectInterface` implementation from
  `Zend\Expressive\Application`.
- [#270](https://github.com/zendframework/zend-expressive/pull/270) eliminates
  the `pre_routing`/`post_routing` terminology from the `middleware_pipeline`,
  in favor of individually specified `priority` values in middleware
  specifications.

### Fixed

- [#263](https://github.com/zendframework/zend-expressive/pull/263) typo
  fixes in documentation

## 1.0.0rc5 - 2015-12-22

Fifth release candidate.

### Added

- [#233](https://github.com/zendframework/zend-expressive/pull/233) adds a
  documentation page detailing projects using and tutorials written on
  Expressive.
- [#238](https://github.com/zendframework/zend-expressive/pull/238) adds a
  cookbook recipe detailing how to handle serving an Expressive application from
  a subdirectory of your web root.
- [#239](https://github.com/zendframework/zend-expressive/pull/239) adds a
  cookbook recipe detailing how to create modular Expressive applications.
- [#243](https://github.com/zendframework/zend-expressive/pull/243) adds a
  chapter to the helpers section detailing the new `BodyParseMiddleware`.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#234](https://github.com/zendframework/zend-expressive/pull/234) fixes the
  inheritance tree for `Zend\Expressive\Exception\RuntimeException` to inherit
  from `RuntimeException` and not `InvalidArgumentException`.
- [#237](https://github.com/zendframework/zend-expressive/pull/237) updates the
  Pimple documentation to recommend `xtreamwayz/pimple-container-interop`
  instead of `mouf/pimple-interop`, as the latter consumed Pimple v1, instead of
  the current stable v3.

## 1.0.0rc4 - 2015-12-09

Fourth release candidate.

### Added

- [#217](https://github.com/zendframework/zend-expressive/pull/217) adds a
  cookbook entry to the documentation detailing how to configure zend-view
  helpers from other components, as well as how to add custom view helpers.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#219](https://github.com/zendframework/zend-expressive/pull/219) updates the
  "Hello World Using a Configuration-Driven Container" usage case to use
  zend-stdlib's `Glob::glob()` instead of the `glob()` native function, to
  ensure the documented solution is portable across platforms.
- [#223](https://github.com/zendframework/zend-expressive/pull/223) updates the
  documentation to refer to the `composer serve` command where relevant, and
  also details how to create the command for standalone users.
- [#221](https://github.com/zendframework/zend-expressive/pull/221) splits the
  various cookbook entries into separate files, so each is self-contained.
- [#224](https://github.com/zendframework/zend-expressive/pull/224) adds opening
  `<?php` tags to two configuration file examples, in order to prevent
  copy-paste errors.

## 1.0.0rc3 - 2015-12-07

Third release candidate.

### Added

- [#185](https://github.com/zendframework/zend-expressive/pull/185)
  Support casting zend-view models to arrays.
- [#192](https://github.com/zendframework/zend-expressive/pull/192) adds support
  for specifying arrays of middleware both when routing and when creating
  pipeline middleware. This feature is opt-in and backwards compatible; simply
  specify an array value that does not resolve as a callable. Values in the
  array **must** be callables, service names resolving to callable middleware,
  or fully qualified class names that can be instantiated without arguments, and
  which result in invokable middleware.
- [#200](https://github.com/zendframework/zend-expressive/pull/200),
  [#206](https://github.com/zendframework/zend-expressive/pull/206), and
  [#211](https://github.com/zendframework/zend-expressive/pull/211) add
  functionality for observing computed `RouteResult`s.
  `Zend\Expressive\Application` now implements
  `Zend\Expressive\Router\RouteResultSubjectInterface`, which allows attaching
  `Zend\Expressive\RouteResultObserverInterface` implementations and notifying
  them of computed `RouteResult` instances. The following methods are now
  available on the `Application` instance:
  - `attachRouteResultObserver(Router\RouteResultObserverInterface $observer)`
  - `detachRouteResultObserver(Router\RouteResultObserverInterface $observer)`
  - `notifyRouteResultObservers(RouteResult $result)`; `Application` calls this
    internally within `routeMiddleware`.
  This feature enables the ability to notify objects of the calculated
  `RouteResult` without needing to inject middleware into the system.
- [#81](https://github.com/zendframework/zend-expressive/pull/81) adds a
  cookbook entry for creating 404 handlers.
- [#210](https://github.com/zendframework/zend-expressive/pull/210) adds a
  documentation section on the new [zendframework/zend-expressive-helpers](https://github.com/zendframework/zend-expressive-helpers)
  utilities.

### Deprecated

- Nothing.

### Removed

- [#204](https://github.com/zendframework/zend-expressive/pull/204) removes the
  `Router` and `Template` components, as they are now shipped with the following
  packages, respectively:
  - [zendframework/zend-expressive-router](https://github.com/zendframework/zend-expressive-router)
  - [zendframework/zend-expressive-template](https://github.com/zendframework/zend-expressive-template)
  This package has been updated to depend on each of them.

### Fixed

- [#187](https://github.com/zendframework/zend-expressive/pull/187)
  Inject the route result as an attribute
- [#197](https://github.com/zendframework/zend-expressive/pull/197) updates the
  `Zend\Expressive\Container\ApplicationFactory` to raise exceptions in cases
  where received configuration is unusable, instead of silently ignoring it.
  This is a small backwards compatibility break, but is done to eliminate
  difficult to identify issues due to bad configuration.
- [#202](https://github.com/zendframework/zend-expressive/pull/202) clarifies
  that `RouterInterface` implements **MUST** throw a `RuntimeException` if
  `addRoute()` is called after either `match()` or `generateUri()` have been
  called.

## 1.0.0rc2 - 2015-10-20

Second release candidate.

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Updated branch aliases: dev-master => 1.0-dev, dev-develop => 1.1-dev.
- Point dev dependencies on sub-components to `~1.0-dev`.

## 1.0.0rc1 - 2015-10-19

First release candidate.

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.

## 0.5.3 - 2015-10-19

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#160](https://github.com/zendframework/zend-expressive/pull/160) updates
  `EmitterStack` to throw a component-specific `InvalidArgumentException`
  instead of the generic SPL version.
- [#163](https://github.com/zendframework/zend-expressive/pull/163) change the
  documentation on wiring middleware factories to put them in the `dependencies`
  section of `routes.global.php`; this keeps the routing and middleware
  configuration in the same file.

## 0.5.2 - 2015-10-17

### Added

- [#158](https://github.com/zendframework/zend-expressive/pull/158) documents
  getting started via the [installer + skeleton](https://github.com/zendframework/zend-expressive-skeleton),
  and also documents "next steps" in terms of creating and wiring middleware
  when using the skeleton.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.

## 0.5.1 - 2015-10-13

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#156](https://github.com/zendframework/zend-expressive/pull/156) updates how
  the routing middleware pulls middleware from the container; in order to work
  with zend-servicemanager v3 and allow `has()` queries to query abstract
  factories, a second, boolean argument is now passed.

## 0.5.0 - 2015-10-10

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- [#131](https://github.com/zendframework/zend-expressive/pull/131) modifies the
  repository to remove the concrete router and template renderer
  implementations, along with any related factories; these are now in their own
  packages. The classes removed include:
  - `Zend\Expressive\Container\Template\PlatesRendererFactory`
  - `Zend\Expressive\Container\Template\TwigRendererFactory`
  - `Zend\Expressive\Container\Template\ZendViewRendererFactory`
  - `Zend\Expressive\Router\AuraRouter`
  - `Zend\Expressive\Router\FastRouteRouter`
  - `Zend\Expressive\Router\ZendRouter`
  - `Zend\Expressive\Template\PlatesRenderer`
  - `Zend\Expressive\Template\TwigRenderer`
  - `Zend\Expressive\Template\Twig\TwigExtension`
  - `Zend\Expressive\Template\ZendViewRenderer`
  - `Zend\Expressive\Template\ZendView\NamespacedPathStackResolver`
  - `Zend\Expressive\Template\ZendView\ServerUrlHelper`
  - `Zend\Expressive\Template\ZendView\UrlHelper`

### Fixed

- Nothing.

## 0.4.1 - TBD

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.

## 0.4.0 - 2015-10-10

### Added

- [#132](https://github.com/zendframework/zend-expressive/pull/132) adds
  `Zend\Expressive\Router\ZendRouter`, replacing
  `Zend\Expressive\Router\Zf2Router`.
- [#139](https://github.com/zendframework/zend-expressive/pull/139) adds:
  - `Zend\Expressive\Template\TemplateRendererInterface`, replacing
    `Zend\Expressive\Template\TemplateInterface`.
  - `Zend\Expressive\Template\PlatesRenderer`, replacing
    `Zend\Expressive\Template\Plates`.
  - `Zend\Expressive\Template\TwigRenderer`, replacing
    `Zend\Expressive\Template\Twig`.
  - `Zend\Expressive\Template\ZendViewRenderer`, replacing
    `Zend\Expressive\Template\ZendView`.
- [#143](https://github.com/zendframework/zend-expressive/pull/143) adds
  the method `addDefaultParam($templateName, $param, $value)` to
  `TemplateRendererInterface`, allowing users to specify global and
  template-specific default parameters to use when rendering. To implement the
  feature, the patch also provides `Zend\Expressive\Template\DefaultParamsTrait`
  to simplify incorporating the feature in implementations.
- [#133](https://github.com/zendframework/zend-expressive/pull/133) adds a
  stipulation to `Zend\Expressive\Router\RouterInterface` that `addRoute()`
  should *aggregate* `Route` instances only, and delay injection until `match()`
  and/or `generateUri()` are called; all shipped routers now follow this. This
  allows manipulating `Route` instances before calling `match()` or
  `generateUri()` — for instance, to inject options or a name.
- [#133](https://github.com/zendframework/zend-expressive/pull/133) re-instates
  the `Route::setName()` method, as the changes to lazy-inject routes means that
  setting names and options after adding them to the application now works
  again.

### Deprecated

- Nothing.

### Removed

- [#132](https://github.com/zendframework/zend-expressive/pull/132) removes
  `Zend\Expressive\Router\Zf2Router`, renaming it to
  `Zend\Expressive\Router\ZendRouter`.
- [#139](https://github.com/zendframework/zend-expressive/pull/139) removes:
  - `Zend\Expressive\Template\TemplateInterface`, renaming it to
    `Zend\Expressive\Template\TemplateRendererInterface`.
  - `Zend\Expressive\Template\Plates`, renaming it to
    `Zend\Expressive\Template\PlatesRenderer`.
  - `Zend\Expressive\Template\Twig`, renaming it to
    `Zend\Expressive\Template\TwigRenderer`.
  - `Zend\Expressive\Template\ZendView`, renaming it to
    `Zend\Expressive\Template\ZendViewRenderer`.

### Fixed

- Nothing.

## 0.3.1 - 2015-10-09

### Added

- [#149](https://github.com/zendframework/zend-expressive/pull/149) adds
  verbiage to the `RouterInterface::generateUri()` method, specifying that the
  returned URI **MUST NOT** be escaped. The `AuraRouter` implementation has been
  updated to internally use `generateRaw()` to follow this guideline, and retain
  parity with the other existing implementations.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#140](https://github.com/zendframework/zend-expressive/pull/140) updates the
  AuraRouter to use the request method from the request object, and inject that
  under the `REQUEST_METHOD` server parameter key before passing the server
  parameters for matching. This simplifies testing.

## 0.3.0 - 2015-09-12

### Added

- [#128](https://github.com/zendframework/zend-expressive/pull/128) adds
  container factories for each supported template implementation:
  - `Zend\Expressive\Container\Template\PlatesFactory`
  - `Zend\Expressive\Container\Template\TwigFactory`
  - `Zend\Expressive\Container\Template\ZendViewFactory`
- [#128](https://github.com/zendframework/zend-expressive/pull/128) adds
  custom `url` and `serverUrl` zend-view helper implementations, to allow
  integration with any router and with PSR-7 URI instances. The newly
  added `ZendViewFactory` will inject these into the `HelperPluginManager` by
  default.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#128](https://github.com/zendframework/zend-expressive/pull/128) fixes an
  expectation in the `WhoopsErrorHandler` tests to ensure the tests can run
  successfully.

## 0.2.1 - 2015-09-10

### Added

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#125](https://github.com/zendframework/zend-expressive/pull/125) fixes the
  `WhoopsErrorHandler` to ensure it pushes the "pretty page handler" into the
  Whoops runtime.

## 0.2.0 - 2015-09-03

### Added

- [#116](https://github.com/zendframework/zend-expressive/pull/116) adds
  `Application::any()` to complement the various HTTP-specific routing methods;
  it has the same signature as `get()`, `post()`, `patch()`, et al, but allows
  any HTTP method.
- [#120](https://github.com/zendframework/zend-expressive/pull/120) renames the
  router classes for easier discoverability, to better reflect their usage, and
  for better naming consistency. `Aura` becomes `AuraRouter`, `FastRoute`
  becomes `FastRouteRouter` and `Zf2` becomes `Zf2Router`.

### Deprecated

- Nothing.

### Removed

- [#120](https://github.com/zendframework/zend-expressive/pull/120) removes the
  classes `Zend\Expressive\Router\Aura`, `Zend\Expressive\Router\FastRoute`, and
  `Zend\Expressive\Router\Zf`, per the "Added" section above.

### Fixed

- Nothing.

## 0.1.1 - 2015-09-03

### Added

- [#112](https://github.com/zendframework/zend-expressive/pull/112) adds a
  chapter to the documentation on using Aura.Di (v3beta) with zend-expressive.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#118](https://github.com/zendframework/zend-expressive/pull/118) fixes an
  issue whereby route options specified via configuration were not being pushed
  into generated `Route` instances before being passed to the underlying router.

## 0.1.0 - 2015-08-26

Initial tagged release.

### Added

- Everything.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.


text:
module Namespace
  class NestedExampleModel
    def methud
    end

    def self.methud
    end
  end
end