text:
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Net.Security;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace TwitchChatSharp
{
    internal class IrcConnection
    {
        private static string[] _messageSeparators = new string[] { "\r\n" };

        private TcpClient _client;
        private SslStream _sslstream;
        private NetworkStream _networkstream;
        private bool _secure;
        private ConcurrentQueue<string> _sendQ = new ConcurrentQueue<string>();
        private ConcurrentQueue<string> _prioritySendQ = new ConcurrentQueue<string>();
        private int _rateLimit;
        private System.Timers.Timer _pinger;

        // Events
        internal delegate void Irc_Connected(object sender, IrcConnectedEventArgs e);
        internal delegate void Irc_MessageReceived(object sender, IrcMessageEventArgs e);
        internal delegate void Irc_Disconnected(object sender = null, EventArgs e = null);

        internal event Irc_Connected Connected;
        internal event Irc_MessageReceived MessageReceived;
        internal event Irc_Disconnected Disconnected;

        // Methods

        /// <summary>
        /// Is the client currently connected?
        /// </summary>
        /// <returns></returns>
        internal bool IsConnected()
        {
            return _client.Connected;
        }

        /// <summary>
        /// Create a new IRC connection
        /// </summary>
        /// <param name="rateLimit"></param>
        internal IrcConnection(int rateLimit = 1500)
        {
            _rateLimit = rateLimit;
        }

        internal async Task ConnectAsync(string address, int port, bool secure)
        {
            _pinger = new System.Timers.Timer();
            _pinger.Interval = 30000;
            _pinger.Elapsed += (object o, System.Timers.ElapsedEventArgs e) =>
            {
                EnqueueMessage("PING " + (DateTime.Now.Ticks / TimeSpan.TicksPerSecond), true);
            };
            _pinger.Start();

            _secure = secure;
            _client = new TcpClient();
            try
            {
                await _client.ConnectAsync(address, port);
            }
            catch (Exception ex) when (ex is SocketException || ex is ObjectDisposedException)
            {
                Disconnect();
                return;
            }
            try
            {
                if (_secure)
                {
                    var sslstream = new SslStream(_client.GetStream());
                    sslstream.AuthenticateAsClient(address);
                    _sslstream = sslstream;
                }
                _networkstream = _client.GetStream();
            }
            catch (ObjectDisposedException)
            {
                Disconnect();
                return;
            }

            string endpoint = "";
            try
            {
                endpoint = _client.Client.RemoteEndPoint.ToString();
            }
            catch (NullReferenceException) { }

            Connected(this, new IrcConnectedEventArgs(endpoint));

            Thread tlisten = new Thread(() => ListenerAsync());
            Thread tsend = new Thread(() => Sender());
            tlisten.Start();
            tsend.Start();
        }

        private void Disconnect()
        {
            _pinger.Stop();
            _pinger.Dispose();
            _client.Close();
            Disconnected();
        }

        private async void ListenerAsync()
        {
            byte[] buffer = new byte[1024];
            StringBuilder msg = new StringBuilder();

            int badMessagesReceived = 0;

            Stream stream;
            if (_secure)
            {
                stream = _sslstream;
            }
            else
            {
                stream = _networkstream;
            }

            while (_client.Connected)
            {
                if (_networkstream.DataAvailable)
                {
                    Array.Clear(buffer, 0, buffer.Length);

                    try
                    {
                        await stream.ReadAsync(buffer, 0, buffer.Length);
                    }
                    catch (ObjectDisposedException)
                    {
                        Disconnect();
                        break;
                    }

                    string text = Encoding.UTF8.GetString(buffer).TrimEnd('\0');

                    msg.Append(text);

                    string msgstr = msg.ToString();
                    if (!msgstr.EndsWith("\r\n"))
                    {
                        bool all0 = true;
                        foreach (var b in buffer)
                        {
                            if (b != 0)
                            {
                                all0 = false;
                                break;
                            }
                        }

                        if (all0)
                        {
                            if (++badMessagesReceived <= 2)
                                continue;
                            else
                            {
                                Disconnect();
                                break;
                            }
                        }
                        else
                        {
                            var idx = msgstr.LastIndexOf("\r\n");
                            if (idx != -1)
                            {
                                idx += 2;
                                msg.Remove(0, idx);
                                msgstr = msgstr.Substring(0, idx);
                            }
                            else
                                continue;
                        }
                    }
                    else
                        msg.Clear();

                    string[] messages = msgstr.Split(_messageSeparators, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string message in messages)
                    {
                        var ircMsg = IrcMessage.FromRawMessage(message);

                        MessageReceived(this, new IrcMessageEventArgs(ircMsg));

                        switch (ircMsg.Command)
                        {
                            case IrcCommand.Ping:
                                EnqueueMessage(message.Replace("PING", "PONG"), true);
                                break;
                            case IrcCommand.Reconnect:
                                Disconnect();
                                break;
                        }
                    }
                }
                else
                {
                    Thread.Sleep(5);
                }
            }
        }

        internal void EnqueueMessage(string message, bool hasPriority = false)
        {
            (hasPriority ? _prioritySendQ : _sendQ).Enqueue(message);
        }

        private void Sender()
        {
            while (_client.Connected)
            {
                string message;
                if (!_prioritySendQ.IsEmpty && _prioritySendQ.TryDequeue(out message))
                {
                    TransmitMessage(message);
                }
                else if (!_sendQ.IsEmpty && _sendQ.TryDequeue(out message))
                {
                    TransmitMessage(message);

                    Thread.Sleep(_rateLimit);
                }

                Thread.Sleep(1);
            }
        }

        private void TransmitMessage(string message)
        {
            message = message.Replace("\r\n", " ");

            byte[] buffer = Encoding.UTF8.GetBytes(message + "\r\n");
            try
            {
                if (_secure)
                {
                    _sslstream.Write(buffer, 0, buffer.Length);
                }
                else
                {
                    _networkstream.Write(buffer, 0, buffer.Length);
                }
            }
            catch (ObjectDisposedException) { Disconnect(); }
            catch (IOException) { Disconnect(); }
        }
    }
}


text:
<?php

/**
 * This file is part of the Miny framework.
 * (c) Dániel Buga <daniel@bugadani.hu>
 *
 * For licensing information see the LICENSE file.
 */

namespace Modules\OAuth\Client;

use Modules\OAuth\AccessToken;
use Modules\OAuth\Exceptions;
use Modules\OAuth\Exceptions\OAuthException;
use Modules\OAuth\HTTP\Client;
use Modules\OAuth\HTTP\Response;
use Modules\OAuth\OAuthClient;
use Modules\OAuth\ProviderDescriptor\OAuth20Descriptor;
use Modules\OAuth\Request;
use Modules\OAuth\Utils;
use UnexpectedValueException;

class OAuth20 extends OAuthClient
{
    /**
     * @var OAuth20Descriptor
     */
    private $descriptor;

    public function __construct(OAuth20Descriptor $pd, Request $request)
    {
        $this->descriptor = $pd;
        parent::__construct($pd, $request);
    }

    /**
     * Interact with the OAuth provider.
     * This function redirects the user to the service provider and request an access token.
     *
     * @throws OAuthException
     */
    public function process()
    {
        //$this->log('Initializing OAuth 2.0');
        $token = $this->getAccessToken();
        if ($token instanceof AccessToken && $token->authorized) {
            //$this->log('An authorized access token is set.');

            return; //we already have a token, so stop here
        }
        $storedState = $this->getStoredState();
        $state       = $this->getRequestVar('state');
        if ($state === $storedState) {
            //$this->log('Request state matches the stored state.');
            $code = $this->getRequestVar('code');
            if (empty($code)) {
                //$this->log('Access code is empty.');
                $error = $this->getRequestVar('error');
                if ($error != null) {
                    throw new OAuthException('An error has occurred.');
                }
            }
            $this->fetchAccessToken($code);
        } else {
            $values = [
                'state' => $storedState,
                'redirect_uri' => $this->getRedirectUri()
            ];
            //$this->log('Request state does not match the stored state.');
            //$this->log('Request a new access code.');
            if (isset($this->descriptor->scope) && !empty($this->descriptor->scope)) {
                $values['scope'] = $this->descriptor->getScopeString();
                //$this->log('Access token scope: ' . $values['scope']);
            }
            //$this->log('Redirecting to %s', $dialog_url);
            $this->redirect(
                $this->descriptor->getUrl('dialog', '', $values)
            );
        }
    }

    /**
     * @return string
     */
    protected function getStoredState()
    {
        $storage = $this->getTokenStorage();
        if (!$storage->has('oauth_state')) {
            $state = md5(time() . rand());
            //$message = 'Setting stored state: %s';

            $storage->set('oauth_state', $state);
        } else {
            $state = $storage->get('oauth_state');
            //$message = 'Stored state: %s';
        }
        //$this->log($message, $state);

        return $state;
    }

    /**
     *
     * @param string $url
     * @param string $method
     * @param array $parameters
     * @param array $options
     * @return Response
     * @throws OAuthException
     */
    public function sendApiCall(
        $url,
        $method = Client::METHOD_GET,
        array $parameters = [],
        array $options = []
    ) {
        $http = new Client($this->descriptor->certificateFile);

        //$this->log('Sending API call to [%s] %s', $method, $url);

        if (isset($options['request_content_type'])) {
            $type = strtolower(trim(strtok($options['request_content_type'], ';')));
        } else {
            $type = 'application/x-www-form-urlencoded';
        }

        $post_values = $parameters;

        $http->setUrl($url);
        $http->setRequestMethod($method);
        $http->addPostFields($post_values);

        if (!isset($authorization)) {
            $accessToken = $this->getAccessToken();
            if ($accessToken instanceof AccessToken) {
                if (strcasecmp($accessToken->type, 'bearer') == 0) {
                    $authorization = 'Bearer ' . $accessToken;
                }
            }
        }
        if (isset($authorization)) {
            //$this->log('Authorization header: %s', $authorization);
            $http->addHeader('Authorization: ' . $authorization);
        }
        //$this->log('Content type: %s', $type);
        $http->addHeader('Content-Type: ' . $type);

        $response = $http->send($this->descriptor->curlOptions);

        $statusCode     = $response->getStatusCode();
        $responseReason = $response->getResponseReason();

        //$this->log('Response status: [%s] %s', $statusCode, $responseReason);
        if ($statusCode < 200 || $statusCode >= 300) {
            $details = $this->processResponse($response);
            //$this->log('Response headers: %s', print_r($response->getHeaders(), 1));
            //$this->log('Exception details: %s', print_r($details, 1));
            throw new OAuthException(
                "An error has occured. The error code is {$statusCode} and the message is \"{$responseReason}\"",
                $details
            );
        }

        return $response;
    }

    /**
     * @param string $url
     * @param string $method
     * @param array $parameters
     * @param array $options
     * @return Response
     * @throws UnexpectedValueException
     */
    public function call($url, $method = Client::METHOD_GET, array $parameters = [], array $options = [])
    {
        $accessToken = $this->getAccessToken();
        if ($accessToken == null) {
            throw new UnexpectedValueException('Access token is not set.');
        }

        if ($accessToken->isExpired()) {
            //$this->log('Access token is expired. Trying to refresh');
            if (!isset($accessToken->refresh_token)) {
                throw new OAuthException('Access token has expired but no refresh token is set.');
            }
            $this->refreshToken();
        }

        if (strcasecmp($accessToken->type, 'bearer')) {
            $url = Utils::addURLParams(
                $url,
                ['access_token' => (string)$accessToken]
            );
        }

        return $this->sendApiCall($url, $method, $parameters, $options);
    }

    /**
     * @param array $values
     */
    public function processTokenRequest(array $values = [])
    {
        //$this->log('Processing access token request. Parameters: ' . print_r($values, 1));
        $access_token_url = $this->descriptor->getUrl('access_token', '', [], $values);
        $http_response    = $this->sendApiCall(
            $access_token_url,
            Client::METHOD_POST,
            $values,
            []
        );

        $this->processResponse($http_response);

        $old_access_token = $this->getAccessToken();
        if ($old_access_token == null) {
            $stored_refresh_token = null;
        } else {
            $stored_refresh_token = $old_access_token->refresh_token;
        }

        $token = AccessToken::fromResponse($http_response, true, $stored_refresh_token);
        $this->storeAccessToken($token);
    }

    /**
     * Refresh an access token
     */
    public function refreshToken()
    {
        $accessToken = $this->getAccessToken();
        if ($accessToken === null) {
            throw new OAuthException('Cannot refresh. Access token is not set');
        }

        $values = [
            'client_id' => $this->descriptor->clientId,
            'client_secret' => $this->descriptor->clientSecret,
            'refresh_token' => $accessToken->refresh_token,
            'grant_type' => 'refresh_token'
        ];
        if (isset($this->scope)) {
            $values['scope'] = $this->scope;
        }
        $this->processTokenRequest($values);
    }

    /**
     * Fetches an access token from the remote provider.
     *
     * @param string $access_code
     */
    public function fetchAccessToken($access_code)
    {
        $values = [
            'code' => $access_code,
            'client_id' => $this->descriptor->clientId,
            'client_secret' => $this->descriptor->clientSecret,
            'redirect_uri' => $this->getRedirectUri(),
            'grant_type' => 'authorization_code'
        ];
        if (isset($this->descriptor->scope)) {
            if (is_array($this->descriptor->scope)) {
                $values['scope'] = implode(',', $this->descriptor->scope);
            } else {
                $values['scope'] = $this->descriptor->scope;
            }
        }
        $this->processTokenRequest($values);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package main

import "sync"

// Visited tracks whether web pages have been visited.
// Its methods may be used concurrently with one another.
type Visited struct {
	// mu guards the visited map.
	mu      sync.Mutex
	visited map[string]int
}

// VisitLink tracks that the page with the given URL has
// been visited, and returns the updated link count.
func (v *Visited) VisitLink(url string) int {
	v.mu.Lock()
	defer v.mu.Unlock()
	count := v.visited[url]
	count++
	v.visited[url] = count
	return count
}

func main() {
}


text:
package ehpc

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// ClusterInfo is a nested struct in ehpc response
type ClusterInfo struct {
	Name               string                              `json:"Name" xml:"Name"`
	VolumeProtocol     string                              `json:"VolumeProtocol" xml:"VolumeProtocol"`
	VolumeId           string                              `json:"VolumeId" xml:"VolumeId"`
	SecurityGroupId    string                              `json:"SecurityGroupId" xml:"SecurityGroupId"`
	AccountType        string                              `json:"AccountType" xml:"AccountType"`
	ImageId            string                              `json:"ImageId" xml:"ImageId"`
	ImageOwnerAlias    string                              `json:"ImageOwnerAlias" xml:"ImageOwnerAlias"`
	CreateTime         string                              `json:"CreateTime" xml:"CreateTime"`
	VolumeMountpoint   string                              `json:"VolumeMountpoint" xml:"VolumeMountpoint"`
	RegionId           string                              `json:"RegionId" xml:"RegionId"`
	SchedulerType      string                              `json:"SchedulerType" xml:"SchedulerType"`
	BaseOsTag          string                              `json:"BaseOsTag" xml:"BaseOsTag"`
	Id                 string                              `json:"Id" xml:"Id"`
	VpcId              string                              `json:"VpcId" xml:"VpcId"`
	DeployMode         string                              `json:"DeployMode" xml:"DeployMode"`
	Description        string                              `json:"Description" xml:"Description"`
	ClientVersion      string                              `json:"ClientVersion" xml:"ClientVersion"`
	SccClusterId       string                              `json:"SccClusterId" xml:"SccClusterId"`
	ClusterId          string                              `json:"ClusterId" xml:"ClusterId"`
	VSwitchId          string                              `json:"VSwitchId" xml:"VSwitchId"`
	RemoteDirectory    string                              `json:"RemoteDirectory" xml:"RemoteDirectory"`
	VolumeType         string                              `json:"VolumeType" xml:"VolumeType"`
	HaEnable           bool                                `json:"HaEnable" xml:"HaEnable"`
	Location           string                              `json:"Location" xml:"Location"`
	EcsChargeType      string                              `json:"EcsChargeType" xml:"EcsChargeType"`
	InstanceCount      int                                 `json:"InstanceCount" xml:"InstanceCount"`
	KeyPairName        string                              `json:"KeyPairName" xml:"KeyPairName"`
	OsTag              string                              `json:"OsTag" xml:"OsTag"`
	ImageName          string                              `json:"ImageName" xml:"ImageName"`
	Status             string                              `json:"Status" xml:"Status"`
	EcsInfo            EcsInfo                             `json:"EcsInfo" xml:"EcsInfo"`
	OnPremiseInfo      OnPremiseInfo                       `json:"OnPremiseInfo" xml:"OnPremiseInfo"`
	PostInstallScripts PostInstallScriptsInDescribeCluster `json:"PostInstallScripts" xml:"PostInstallScripts"`
	Applications       ApplicationsInDescribeCluster       `json:"Applications" xml:"Applications"`
}


text:
package org.assertj.core.api.abstract_;

import static org.assertj.core.api.Assertions.catchThrowable;
import static org.assertj.core.api.BDDAssertions.then;
import static org.assertj.core.api.InstanceOfAssertFactories.LONG;
import static org.assertj.core.error.ShouldNotBeNull.shouldNotBeNull;
import static org.mockito.Mockito.verify;

import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.AbstractAssertBaseTest;
import org.assertj.core.api.AbstractLongAssert;
import org.assertj.core.api.ConcreteAssert;
import org.assertj.core.api.InstanceOfAssertFactory;
import org.assertj.core.api.NavigationMethodBaseTest;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

/**
 * @author Stefano Cordio
 */
class AbstractAssert_asInstanceOf_with_InstanceOfAssertFactory_Test extends AbstractAssertBaseTest
    implements NavigationMethodBaseTest<ConcreteAssert> {

  @Override
  protected ConcreteAssert invoke_api_method() {
    assertions.asInstanceOf(LONG);
    return null;
  }

  @Override
  protected void verify_internal_effects() {
    verify(objects).assertIsInstanceOf(getInfo(assertions), getActual(assertions), Long.class);
  }

  @Override
  public void should_return_this() {
    // Test disabled since asInstanceOf does not return this.
  }

  @Override
  public ConcreteAssert getAssertion() {
    return assertions;
  }

  @Override
  public AbstractAssert<?, ?> invoke_navigation_method(ConcreteAssert assertion) {
    return assertion.asInstanceOf(LONG);
  }

  @Test
  void should_throw_npe_if_no_factory_is_given() {
    // WHEN
    Throwable thrown = catchThrowable(() -> assertions.asInstanceOf(null));
    // THEN
    then(thrown).isInstanceOf(NullPointerException.class)
                .hasMessage(shouldNotBeNull("instanceOfAssertFactory").create());
  }

  @Test
  void should_return_narrowed_assert_type() {
    // WHEN
    AbstractAssert<?, ?> result = assertions.asInstanceOf(LONG);
    // THEN
    then(result).isInstanceOf(AbstractLongAssert.class);
  }

}


text:
//
//  NSNumber+Times
//
//  Created by Ian Keen on 2/06/2015.
//  Copyright (c) 2015 IanKeen. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^timesBlock)(NSInteger index);

@interface NSNumber (Times)
/**
 *  Using the receiver as the count, you can perform a block that many times
 *
 *  i.e.: To print the numbers: 1, 2, 3 simply write:
 *  [@(3) times:^(NSInteger index) {
 *      NSLog(@"%@", @(index + 1));
 *  }];
 *
 *  @param block Block of code to execute, an index is also available
 */
-(void)times:(timesBlock)block;
@end


text:
import validator from '../';
export type IsURLOptions = validator.IsURLOptions;
export default validator.isURL;


text:
import * as React from "react";
import { assert } from "chai";
import { shallow } from "enzyme";

import assemble from "./assemble";
import defaultProps from "./defaultProps";
import Component from "../test/component";

describe("defaultProps", () => {
  it("should render with default props", () => {
    const defaults = {
      test1: true,
      test2: false,
      test3: 5,
    };
    const input = {
      test1: false,
      test3: 7,
    };
    const output = {
      test1: false,
      test2: false,
      test3: 7,
    };
    const composable = defaultProps(defaults);
    const Assembly = assemble(composable)(Component);
    const wrapper = shallow(<Assembly {...input} />);
    assert.deepEqual(wrapper.props(), output);
  });
});


text:
/**
 * Dependencies
 */

var parsePackageJson = require('./parse-package-json'),
    Promise = require('bluebird'),
    join = require('path').join,
    fs = require('fs'),

    statFile = Promise.promisify(fs.stat),
    readDir = Promise.promisify(fs.readdir);

/**
 * Recursively read directory
 */

function readDirectory(dir, options) {
    var ignore;

    if (!options) {
        options = {};
    }

    ignore = options.ignore || [];
    ignore.push('node_modules', 'bower_components', '.DS_Store');

    return readDir(dir)
        .filter(function (filename) {
            return ignore.indexOf(filename) === -1;
        })
        .map(function (filename) {
            var absolutePath = join(dir, filename);

            return statFile(absolutePath).then(function (stat) {
                var item = {
                    name: filename,
                    path: absolutePath,
                    stat: stat
                };

                return item;
            });
        })
        .map(function (item) {
            if (item.name === 'package.json') {
                return parsePackageJson(item.path).then(function (pkg) {
                    item.content = pkg;

                    return item;
                });
            }

            if (item.stat.isDirectory()) {
                return readDirectory(item.path).then(function (files) {
                    item.content = files;

                    return item;
                });
            }

            // if there's no custom handling needed
            // set absolute path as `item`'s `content`
            item.content = item.path;

            return item;
        })
        .then(function (items) {
            var tree = {};

            items.forEach(function (item) {
                tree[item.name] = item.content;
            });

            return tree;
        });
}

/**
 * Expose `readDirectory`
 */

module.exports = readDirectory;


text:
local site_config = {}
site_config.LUAROCKS_PREFIX=[[/app/.heroku]]
site_config.LUA_INCDIR=[[/app/.heroku/include/luajit-2.0]]
site_config.LUA_LIBDIR=[[/app/.heroku/lib]]
site_config.LUA_BINDIR=[[/app/.heroku/bin]]
site_config.LUA_INTERPRETER=[[luajit]]
site_config.LUAROCKS_SYSCONFDIR=[[/app/.heroku/etc/luarocks]]
site_config.LUAROCKS_ROCKS_TREE=[[/app/.heroku]]
site_config.LUAROCKS_ROCKS_SUBDIR=[[/lib/luarocks/rocks]]
site_config.LUA_DIR_SET=true
site_config.LUAROCKS_UNAME_S=[[Linux]]
site_config.LUAROCKS_UNAME_M=[[x86_64]]
site_config.LUAROCKS_DOWNLOADER=[[curl]]
site_config.LUAROCKS_MD5CHECKER=[[md5sum]]
site_config.LUAROCKS_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[lib/x86_64-linux-gnu]] }, include="include" }
site_config.LUAROCKS_RUNTIME_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[lib/x86_64-linux-gnu]] }, include="include" }
return site_config


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Material Admin</title>

        <link href="vendors/bower_components/animate.css/animate.min.css" rel="stylesheet">
        <link href="vendors/bower_components/sweetalert2/dist/sweetalert2.min.css" rel="stylesheet">
        <link href="vendors/bower_components/material-design-iconic-font/dist/css/material-design-iconic-font.min.css" rel="stylesheet">
        <link href="vendors/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css" rel="stylesheet">

        <link href="css/app_1.min.css" rel="stylesheet">
        <link href="css/app_2.min.css" rel="stylesheet">

                    Material Admin

                                6

                                        Messages

David Belle

                                                Cum sociis natoque penatibus et magnis dis parturient montes

Jonathan Morris

                                                Nunc quis diam diamurabitur at dolor elementum, dictum turpis vel

Fredric Mitchell Jr.

                                                Phasellus a ante et est ornare accumsan at vel magnauis blandit turpis at augue ultricies

Glenn Jecobs

                                                Ut vitae lacus sem ellentesque maximus, nunc sit amet varius dignissim, dui est consectetur neque

Bill Phillips

                                                Proin laoreet commodo eros id faucibus. Donec ligula quam, imperdiet vel ante placerat

                                    View All

                                9

                                        Notification

David Belle

                                                Cum sociis natoque penatibus et magnis dis parturient montes

Jonathan Morris

                                                Nunc quis diam diamurabitur at dolor elementum, dictum turpis vel

Fredric Mitchell Jr.

                                                Phasellus a ante et est ornare accumsan at vel magnauis blandit turpis at augue ultricies

Glenn Jecobs

                                                Ut vitae lacus sem ellentesque maximus, nunc sit amet varius dignissim, dui est consectetur neque

Bill Phillips

                                                Proin laoreet commodo eros id faucibus. Donec ligula quam, imperdiet vel ante placerat

                                    View Previous

                                2

                                        Tasks

HTML5 Validation Report

                                                    95% Complete (success)

Google Chrome Extension

                                                    80% Complete (success)

Social Intranet Projects

                                                    20% Complete

Bootstrap Admin Template

                                                    60% Complete (warning)

Youtube Client App

                                                    80% Complete (danger)

                                    View All

                                     Toggle Fullscreen

                                     Clear Local Storage

                                     Privacy Settings

                                     Other Settings

                    <input type="text">

                            Malinda Hollaway

                             View Profile

                             Privacy Settings

                             Settings

                             Logout

 Home

                         Dashboards

Analytics

School

                         Headers

Textual menu

Image logo

Mainmenu on top

 Typography

                         Widgets

Templates

Widgets

                         Tables

Normal Tables

Data Tables

                         Forms

Basic Form Elements

Form Components

Form Examples

Form Validation

                        User Interface

Colors

Animations

Buttons

Icons

Alerts

Preloaders

Notifications & Dialogs

Media

Components

Others

                        Charts & Maps

Flot Charts

Other Charts

Maps

 Calendar

                        Photo Gallery

Default

Timeline

 Generic Classes

                         Sample
                            Pages

Profile

List View

Messages

Pricing Table

Contacts

Wall

Invoice

Login and Sign Up

Lockscreen

Error 404

                         3 Level Menu

Level 2 link

Another level 2 Link

                                I have children too

Level 3 link

Another Level 3 link

Third one

One more 2

                        <input type="text" class="form-control" placeholder="Search People">

Jonathan Morris

                                Available

David Belle

                                Last seen 3 hours ago

Fredric Mitchell Jr.

                                Availble

Glenn Jecobs

                                Availble

Bill Phillips

                                Last seen 3 days ago

Wendy Mitchell

                                Last seen 2 minutes ago

jQuery Vector Maps
                            JQVMap is a jQuery plugin that renders Vector Maps.  It uses resizable Scalable Vector Graphics (SVG) for modern browsers.

World

Algeria

Argentina

Brazil

Canada

Europe

France

Germany

Greece

Iran

Iraq

Russia

Tunisia

Turkey

Europe

USA

            Copyright © 2015 Material Admin

Home

Dashboard

Reports

Support

Contact

                <svg class="pl-circular" viewBox="25 25 50 50">
                    <circle class="plc-path" cx="50" cy="50" r="20" />
                </svg>

Please wait...


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Orlandia2015.Models;
using Orlandia2015.Services;
using PagedList;

// TODO: (Next year) Move all business logic into service classes. Code is becoming too difficult to maintain as is.

namespace Orlandia2015.Controllers
{
    public class PlayersController : AsyncController
    {
        private OrlandiaDbContext db = new OrlandiaDbContext();

        // GET: Players
        //public async Task<ActionResult> IndexAsync()
        //{
        //    var players = db.Players.Include(p => p.Faction);
        //    return View("Index", await players.ToListAsync());
        //}

        public async Task<ActionResult> IndexAsync(string sortOrder, string currentFilter, string searchString, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.FactionSortParm = sortOrder == "faction" ? "faction_desc" : "faction";
            ViewBag.RankSortParm = sortOrder == "rank" ? "rank_desc" : "rank";
            ViewBag.PointsSortParm = sortOrder == "points" ? "points_desc" : "points";

            if(searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;

            var players = db.Players.Include(p => p.Faction);

            if(!string.IsNullOrEmpty(searchString))
            {
                players = players.Where(p => p.sName.Contains(searchString));
            }

            switch(sortOrder)
            {
                case "name_desc":
                    players = players.OrderByDescending(p => p.sName);
                    break;
                case "faction":
                    players = players.OrderBy(p => p.Faction.sName);
                    break;
                case "faction_desc":
                    players = players.OrderByDescending(p => p.Faction.sName);
                    break;
                case "rank":
                    players = players.OrderBy(p => p.Rank.sRankName);
                    break;
                case "rank_desc":
                    players = players.OrderByDescending(p => p.Rank.sRankName);
                    break;
                case "points":
                    players = players.OrderBy(p => p.iPoints);
                    break;
                case "points_desc":
                    players = players.OrderByDescending(p => p.iPoints);
                    break;

                default:
                    players = players.OrderBy(p => p.sName);
                    break;
            }

            int pageSize = 15;
            int pageNumber = (page ?? 1);

            return View("Index", (await players.ToListAsync()).ToPagedList(pageNumber, pageSize));

        }

        // GET: Players/Details/5
        public async Task<ActionResult> DetailsAsync(Guid? id, bool? LeveledUp, Guid? EarnedAchievement)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var player = await db.Players.FindAsync(id);
            if (player == null)
            {
                return HttpNotFound();
            }

            var nextRank = await db.Ranks.OrderBy(r => r.iRankNumber).FirstOrDefaultAsync(r => r.uFactionID == player.uFactionID && r.iRankPoints > player.iPoints);
            var maxRank = await db.Ranks.OrderByDescending(r => r.iRankNumber).FirstOrDefaultAsync(r => r.uFactionID == player.uFactionID);

            if (nextRank != null && nextRank.iRankPoints != player.Rank.iRankPoints)
            {
                ViewBag.NextRankPercent = ((player.iPoints - player.Rank.iRankPoints) * 100) / (nextRank.iRankPoints - player.Rank.iRankPoints);
                ViewBag.NextRankPoints = nextRank.iRankPoints;
                ViewBag.TotalPercent = (player.iPoints * 100) / maxRank.iRankPoints;

                if (ViewBag.TotalPercent > 100)
                    ViewBag.TotalPercent = 100;

            }

            if(maxRank.iRankPoints <= player.iPoints)
            {
                ViewBag.NextRankPercent = -1;
                ViewBag.NextRankPoints = 0;
                ViewBag.TotalPercent = 100;
            }

            var playerRanks = await db.Ranks.OrderBy(r => r.iRankNumber).Where(r => r.uFactionID == player.uFactionID && r.iRankPoints <= player.iPoints).Select(r => r.sRankName).ToListAsync();
            ViewBag.PlayerRanks = playerRanks;

            if (LeveledUp.HasValue)
                ViewBag.LeveledUp = LeveledUp.Value;
            else
                ViewBag.LeveledUp = false;

            if (EarnedAchievement.HasValue)
            {
                ViewBag.EarnedAchievement = true;
                ViewBag.EarnedAchievementName = player.Achievements.FirstOrDefault(pa => pa.uAchievementID == EarnedAchievement.Value).Achievement.sName;
            }
            else
            {
                ViewBag.EarnedAchievement = false;
            }

            return View(player);
        }

        // GET: Players/Create
        public async Task<ActionResult> CreateAsync()
        {
            ViewBag.uFactionID = new SelectList(await db.Factions.ToListAsync(), "uFactionID", "sName");
            return View();
        }

        // POST: Players/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> CreateAsync([Bind(Include = "uPlayerID,uFactionID,sName")] Player player)
        {
            if (ModelState.IsValid)
            {
                player.uPlayerID = Guid.NewGuid();
                Rank rank = await db.Ranks.FirstAsync(r => r.uFactionID == player.uFactionID && r.iRankNumber == 0);
                player.uRankID = rank.uRankID;
                db.Players.Add(player);
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            ViewBag.uFactionID = new SelectList(await db.Factions.ToListAsync(), "uFactionID", "sName", player.uFactionID);
            return View(player);
        }

        // GET: Players/Edit/5
        public async Task<ActionResult> EditAsync(Guid? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var player = await db.Players.FindAsync(id);
            if (player == null)
            {
                return HttpNotFound();
            }
            ViewBag.uFactionID = new SelectList(await db.Factions.ToListAsync(), "uFactionID", "sName", player.uFactionID);
            return View(player);
        }

        // POST: Players/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> EditAsync([Bind(Include = "uPlayerID,uFactionID,sName")] Player player)
        {
            if (ModelState.IsValid)
            {
                //db.Entry(player).State = EntityState.Modified;
                db.Players.Attach(player);
                db.Entry(player).Property(x => x.sName).IsModified = true;

                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }
            ViewBag.uFactionID = new SelectList(await db.Factions.ToListAsync(), "uFactionID", "sName", player.uFactionID);
            return View(player);
        }

        // GET: Players/Delete/5
        public async Task<ActionResult> DeleteAsync(Guid? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var player = await db.Players.FindAsync(id);
            if (player == null)
            {
                return HttpNotFound();
            }
            return View(player);
        }

        // POST: Players/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> DeleteConfirmedAsync(Guid id)
        {
            var player = await db.Players.FindAsync(id);
            db.Players.Remove(player);
            await db.SaveChangesAsync();
            return RedirectToAction("Index");
        }

        public async Task<ActionResult> AddPointsAsync(Guid id)
        {
            var player = await db.Players.FindAsync(id);

            if (player == null)
            {
                return HttpNotFound();
            }

            return View(player);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> AddPointsAsync(Guid? id, int iPoints)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var player = await db.Players.FindAsync(id);

            if (player == null)
            {
                return HttpNotFound();
            }

            if (iPoints < 0)
            {
                return new HttpStatusCodeResult(400, "Invalid number of points to add");
            }

            var bLeveledUp = await AddPointsToPlayerAsync(player, iPoints);

            if (bLeveledUp)
                return new RedirectResult(Url.Action("Details", "Players", new { @id = id, LeveledUp = true }));

            return new RedirectResult(Url.Action("Details", "Players", new { @id = id }));

        }

        // TODO: Implement These
        public async Task<ActionResult> AddAchievementAsync(Guid? id)
        {
            if(!id.HasValue)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var player = await db.Players.FirstOrDefaultAsync(p => p.uPlayerID == id);

            if(player == null)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var playerAchievements = await db.PlayerAchievements.Where(pa => pa.uPlayerID == id).Select(pa => pa.uAchievementID).ToListAsync();
            var achievements = await db.Achievements.Where(a => !playerAchievements.Contains(a.uAchievementID) && a.bCanBeManuallySet).OrderBy(a => a.iSortOrder).ToListAsync();

            ViewBag.id = id;

            return View(achievements);
        }

        [ActionName("AddAchievementToPlayer")]
        public async Task<ActionResult> AddAchievementAsync(Guid? id, Guid uAchievementID)
        {
            if (!id.HasValue)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Invalid User ID");

            var player = await db.Players.FirstOrDefaultAsync(p => p.uPlayerID == id);

            if (player == null)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "User Not Found: " + id.ToString());

            PlayerAchievements playerAchievement = new PlayerAchievements();
            playerAchievement.uAchievementID = uAchievementID;
            playerAchievement.uPlayerID = id.Value;
            playerAchievement.uPlayerAchievementID = Guid.NewGuid();
            db.PlayerAchievements.Add(playerAchievement);
            await db.SaveChangesAsync();

            return RedirectToAction("Details", new { id = id });
        }

        public async Task<ActionResult> AddMissionAsync(Guid? id)
        {
            if(!id.HasValue)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var player = await db.Players.FirstOrDefaultAsync(p => p.uPlayerID == id);

            if(player == null)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var rank = player.Rank;
            var playerMissions = player.Missions.Select(pm => pm.uMissionID);

            var missions = db.Missions.Where(m => m.iMissionLevel <= rank.iRankNumber);

            var incompleteMissions = await missions.Where(m => !playerMissions.Contains(m.uMissionID) || m.bIsMissionQuest).ToListAsync();

            ViewBag.id = id;
            return View(incompleteMissions);
        }

        [ActionName("AddMissionToPlayer")]
        public async Task<ActionResult> AddMissionAsync(Guid? id, Guid uMissionID)
        {
            if(!id.HasValue)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Invalid User ID");

            var player = await db.Players.FirstOrDefaultAsync(p => p.uPlayerID == id);

            if (player == null)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "User Not Found: " + id.ToString());

            var mission = await db.Missions.FirstOrDefaultAsync(m => m.uMissionID == uMissionID);

            // Handles adding points to player and faction. Also maintains ranks.
            var bLeveledUp = await AddPointsToPlayerAsync(player, mission.iMissionPoints);

            // Add record of completing mission
            PlayerMission playerMission = new PlayerMission();
            playerMission.uMissionID = uMissionID;
            playerMission.uPlayerID = id.Value;
            playerMission.uPlayerMissionID = Guid.NewGuid();

            // Add completion achievement, if earned.
            bool bEarnedAchievement = false;
            var completedMissions = player.Missions.Count() + 1;

            var missionAchievement = await db.MissionAchievements.FirstOrDefaultAsync(ma => ma.iMissionCount == completedMissions);

            if (missionAchievement != null)
            {
                if (!player.Achievements.Any(pa => pa.uAchievementID == missionAchievement.uAchievementID))
                {
                    PlayerAchievements playerAchievement = new PlayerAchievements();
                    playerAchievement.uAchievementID = missionAchievement.uAchievementID;
                    playerAchievement.uPlayerID = id.Value;
                    playerAchievement.uPlayerAchievementID = Guid.NewGuid();

                    db.PlayerAchievements.Add(playerAchievement);
                    bEarnedAchievement = true;
                }
            }

            db.PlayerMissions.Add(playerMission);

            await db.SaveChangesAsync();

            if (bLeveledUp || bEarnedAchievement)
                return new RedirectResult(Url.Action("Details", "Players", new { @id = id, LeveledUp = bLeveledUp, EarnedAchievement = bEarnedAchievement ? (Guid?)missionAchievement.uAchievementID : null  }));

            return RedirectToAction("Details", new { id = id });
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="player"></param>
        /// <param name="iPoints"></param>
        /// <returns>True if player levels up</returns>
        private async Task<bool> AddPointsToPlayerAsync(Player player, int iPoints)
        {
            bool retVal = false;
            player.iPoints += iPoints;
            db.Players.Attach(player);
            db.Entry(player).Property(p => p.iPoints).IsModified = true;

            var currRank = player.Rank;

            // Check Rank
            var nextRank =
                await
                    db.Ranks.OrderByDescending(r => r.iRankNumber)
                        .FirstOrDefaultAsync(r => r.uFactionID == player.uFactionID && r.iRankNumber > currRank.iRankNumber && r.iRankPoints <= player.iPoints);

            if (nextRank != null)
            {
                player.uRankID = nextRank.uRankID;
                db.Entry(player).Property(p => p.uRankID).IsModified = true;
                retVal = true;
            }

            // Add Faction points
            var faction = await db.Factions.FirstOrDefaultAsync(f => f.uFactionID == player.uFactionID);
            faction.iPoints += iPoints;
            db.Factions.Attach(faction);
            db.Entry(faction).Property(f => f.iPoints).IsModified = true;

            await db.SaveChangesAsync();

            return retVal;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}


text:
package main

import (
	"os/exec"
	"strings"

	"github.com/docker/docker/runconfig"
	"github.com/go-check/check"
)

// GH14530. Validates combinations of --net= with other options

// stringCheckPS is how the output of PS starts in order to validate that
// the command executed in a container did really run PS correctly.
const stringCheckPS = "PID   USER"

// checkContains is a helper function that validates a command output did
// contain what was expected.
func checkContains(expected string, out string, c *check.C) {
	if !strings.Contains(out, expected) {
		c.Fatalf("Expected '%s', got '%s'", expected, out)
	}
}

func (s *DockerSuite) TestNetHostname(c *check.C) {
	testRequires(c, DaemonIsLinux)

	var (
		out    string
		err    error
		runCmd *exec.Cmd
	)

	runCmd = exec.Command(dockerBinary, "run", "-h=name", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err != nil {
		c.Fatalf(out, err)
	}
	checkContains(stringCheckPS, out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=host", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err != nil {
		c.Fatalf(out, err)
	}
	checkContains(stringCheckPS, out, c)

	runCmd = exec.Command(dockerBinary, "run", "-h=name", "--net=bridge", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err != nil {
		c.Fatalf(out, err)
	}
	checkContains(stringCheckPS, out, c)

	runCmd = exec.Command(dockerBinary, "run", "-h=name", "--net=none", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err != nil {
		c.Fatalf(out, err)
	}
	checkContains(stringCheckPS, out, c)

	runCmd = exec.Command(dockerBinary, "run", "-h=name", "--net=host", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkHostname.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "-h=name", "--net=container:other", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err, c)
	}
	checkContains(runconfig.ErrConflictNetworkHostname.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=container", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err, c)
	}
	checkContains("--net: invalid net mode: invalid container format container:<name|id>", out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=weird", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains("invalid --net: weird", out, c)
}

func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *check.C) {
	testRequires(c, DaemonIsLinux)
	var (
		out    string
		err    error
		runCmd *exec.Cmd
	)

	runCmd = exec.Command(dockerBinary, "run", "--net=container:other", "--link=zip:zap", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictContainerNetworkAndLinks.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=host", "--link=zip:zap", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictHostNetworkAndLinks.Error(), out, c)
}

func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *check.C) {
	testRequires(c, DaemonIsLinux)
	var (
		out    string
		err    error
		runCmd *exec.Cmd
	)

	runCmd = exec.Command(dockerBinary, "run", "--net=host", "--dns=8.8.8.8", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkAndDNS.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=container:other", "--dns=8.8.8.8", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkAndDNS.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=host", "--add-host=name:8.8.8.8", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkHosts.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=container:other", "--add-host=name:8.8.8.8", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkHosts.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictContainerNetworkAndMac.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=container:other", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictContainerNetworkAndMac.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=container:other", "-P", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkPublishPorts.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=container:other", "-p", "8080", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkPublishPorts.Error(), out, c)

	runCmd = exec.Command(dockerBinary, "run", "--net=container:other", "--expose", "8000-9000", "busybox", "ps")
	if out, _, err = runCommandWithOutput(runCmd); err == nil {
		c.Fatalf(out, err)
	}
	checkContains(runconfig.ErrConflictNetworkExposePorts.Error(), out, c)
}


text:
      Polymer('grid-toc', {
        selectedChanged: function(old) {
          this.lastSelected = old;
        },
        selectView: function(e) {
          var item = e.target.templateInstance.model.item;
          if (item !== undefined) {
            this.fire('grid-toc-select', {item: item});
          }
        }
      });


text:
#include "globals.h"

// ---------------------------------------------------------------------------
// ChildWndProc
// ---------------------------------------------------------------------------
// Description:         Main window procedure.
// Arguments:
//  HWND [in]           Window handle.
//  UINT [in]           Message identifier.
//  WPARAM [in]         Depends on message.
//  LPARAM [in]         Depends on message.
// Returns:
//  LPARAM              Depends on message.
LPARAM CALLBACK ChildWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    HDC                 hdc=NULL, hmemDC=NULL;
    PAINTSTRUCT         ps;
	HBRUSH				hbrBkGnd=NULL;
    RECT                rect;

    // Call the appropriate message handler
    switch(uMsg)
    {
    case WM_PAINT:
        {
            // Get the Display Context so we have someplace to blit.
            hdc = BeginPaint( hWnd, &ps );

		    // Create a compatible DC.
            hmemDC = CreateCompatibleDC( hdc );

            GetClientRect( hWnd, &rect );
            // Create a bitmap big enough for our client rectangle.
            HBITMAP hmemBMP = CreateCompatibleBitmap( hdc,
                                        rect.right - rect.left,
                                        rect.bottom - rect.top );

            // Select the bitmap into the off-screen DC.
            HGDIOBJ hobjOld = SelectObject( hmemDC, hmemBMP );

		    // Erase the background.
		    hbrBkGnd = CreateSolidBrush( GetSysColor(COLOR_3DFACE) );
		    FillRect( hmemDC, &rect, hbrBkGnd );
		    DeleteObject( hbrBkGnd );

            // Draw into memory DC
            ImageList_Draw( g_hListBmp, 0, hmemDC, 0, 0, INDEXTOOVERLAYMASK(g_iBmp) );
            if( g_iBmp%6 == 2 )
            {
                ImageList_Draw( g_hListBmp, WEYESNAR, hmemDC, 0, 0, 0 );
            }
            if( g_iBmp%6 == 5 )
            {
                ImageList_Draw( g_hListBmp, WEYESCLO, hmemDC, 0, 0, 0 );
            }

            // Blit to window DC
            StretchBlt( hdc, 0, 0, rect.right, rect.bottom,
                        hmemDC, 0, 0, rect.right, rect.bottom, SRCCOPY );

            // Replace the previous GDI object to the DC
            SelectObject( hmemDC, hobjOld );

            // Done with off-screen bitmap and DC.
            DeleteObject( hmemBMP );

		    DeleteDC( hmemDC );

            DeleteDC( hdc );

            // Clean up and get outta here
            EndPaint( hWnd, &ps );
        }
        break;

    case WM_DESTROY:
        // Delete Mouth Bitmaps
        ImageList_Destroy( g_hListBmp );
        break;

    }

    // Call the default message handler
    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}


text:
package de.uni.freiburg.iig.telematik.swat.bpmn2pn.gateways;

import java.util.HashMap;
import java.util.HashSet;

import de.invation.code.toval.types.Multiset;
import de.uni.freiburg.iig.telematik.sepia.petrinet.ifnet.IFNet;
import de.uni.freiburg.iig.telematik.sepia.petrinet.ifnet.IFNetMarking;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.PTMarking;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.PTNet;
import de.uni.freiburg.iig.telematik.swat.bpmn2pn.BpmnElement;

public class StartEvent extends AbstractEvent implements BpmnElement {
	private String name;
	private HashSet<String> inBound;
	private HashSet<String> outBound;

	private HashMap<String, String> start = new HashMap();
	private HashMap<String, String> end = new HashMap();
	public StartEvent(String name, HashSet<String> inBound,
			HashSet<String> outBound) {
		super(name, inBound, outBound);
		this.name=name;
		this.inBound=inBound;
		this.outBound=outBound;
	}

	public StartEvent() {
		super();
	}

	public String getStart(String identifier) {
		return this.start.get(identifier);
	}
	public String getEnd(String identifier) {
		return this.end.get(identifier);
	}

	public HashMap<String, String> getStart() {
		return this.start;
	}
	public HashMap<String, String> getEnd() {
		return this.end;
	}

	public void renameStart(String a, String b) {
		String h = this.start.get(a);
		this.start.remove(a);
		this.start.put(b, h);
	}

	public void renameEnd(String a, String b) {
		String h = this.end.get(a);
		this.end.remove(a);
		this.end.put(b, h);
	}

	public PTNet create(PTNet ifnc) {

		// the start event directly corresponds to a transition
		ifnc.addTransition(name);
		int i;

		// add a single preplace with a single black token indicating that the event is enabled and can be fired when there is no incoming message flow
		ifnc.addPlace(name+"pre");

		// IFNetMarking h = ifnc.getMarking(); //for ifnet
		PTMarking h = ifnc.getMarking(); //for ptnet

		Multiset<String> pInMarking = new Multiset<String>();
		pInMarking.add("black");
		//h.set(name+"pre", pInMarking);
		h.set(name+"pre", 1);

		ifnc.setMarking(h);

		ifnc.addFlowRelationPT(name+"pre", name);

		// create a postplace for each outgoing sequence flow (parallel flow)
		i=0;
		for(String k : this.outBound) {
			ifnc.addPlace(name+"post"+k+"_"+i+"_");
			ifnc.addFlowRelationTP(name, name+"post"+k+"_"+i+"_");
			end.put(k, name+"post"+k+"_"+i+"_");
		}

		return ifnc;
	}
}


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

<title>Constant Field Values</title>
<meta name="date" content="2014-01-26">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Constant Field Values

Contents

config.*

config.*

config.ArmConfig

Modifier and Type
Constant Field
Value

public static final int
ARM_VICTOR_ONE
0

public static final int
ARM_VICTOR_TWO
0

public static final int
d
0

public static final int
i
0

public static final int
p
0

public static final int
POT_PORT
0

public static final int
ROLLER_SPEED
0

public static final int
ROLLER_VICTOR_ONE
0

public static final int
ROLLER_VICTOR_TWO
0

config.CompressorConfig

Modifier and Type
Constant Field
Value

public static final int
COMPRESSOR_RELAY_CHANNEL
0

public static final int
PRESSURE_SWITCH_CHANNEL
0

config.DriveConfig

Modifier and Type
Constant Field
Value

public static final double
DISTANCE_PER_TICK
0.0

public static final int
ENCODER_D
0

public static final int
ENCODER_I
0

public static final int
ENCODER_P
0

public static final int
LEFT_ENCODER_A
0

public static final int
LEFT_ENCODER_B
0

public static final int
LEFT_VICTOR_ONE
0

public static final int
LEFT_VICTOR_TWO
0

public static final int
RIGHT_ENCODER_A
0

public static final int
RIGHT_ENCODER_B
0

public static final int
RIGHT_VICTOR_ONE
0

public static final int
RIGHT_VICTOR_TWO
0

public static final int
SOLENOID_PORT
0

config.RobotConfig

Modifier and Type
Constant Field
Value

public static final int
REVERSE_BUTTON
0

public static final int
ROLLER_BUTTON
0

public static final int
SHIFT_BUTTON
0

public static final int
SHOOT_BUTTON
0

config.ShooterConfig

Modifier and Type
Constant Field
Value

public static final int
LIFTER
0

public static final int
ROLLER
0

public static final int
SHIFTER
0

public static final int
TOUCH_SENSOR
0

public static final double
WINCH_SPEED
0.0

public static final int
WINCH1
0

public static final int
WINCH2
0

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
<select class="form-control">
    @foreach ($teams as $team)
        <option value="{!! $team->id !!}">
            {!! $team->title !!}
        </option>
    @endforeach
</select>


text:
title:  Weiterführendes Studium
date:   17/05/2019
---

_Ellen White, "A Sacred Circle," S. 177–180, in The Adventist Home; Testimonies for the Church, Bd. 6, S. 236–238._

_Einheit – die wichtigste Aufgabe:_ "Die wichtigste Aufgabe von Christen besteht darin, in der Familie eins zu sein ...

Je stärker die Mitglieder einer Familie vereint sind in ihren Aufgaben in der Familie, desto aufbauender und hilfreicher wird der Einfluss sein, den Vater und Mutter und Söhne und Töchter außerhalb der Familie ausüben." (Ellen White, The Adventist Home, S. 37.)

_Das Geheimnis der Einheit in der Familie:_ "Der Grund für Uneinigkeit und Unstimmigkeit in Familien und in der Gemeinde ist die Trennung von Christus. Sich Christus zu nähern bedeutet, sich einander zu nähern. Das Geheimnis echter Einheit in der Gemeinde und in der Familie ist nicht Diplomatie, nicht Management, nicht übermenschliches Bemühen, Schwierigkeiten zu überwinden – obwohl es genau das reichlich zu tun gibt – sondern Einheit mit Christus." (ebd., S. 179)

**Fragen für ein Gespräch**

`1. Sprecht über die Kräfte in eurer Gesellschaft, die gegen die Einheit der Familie arbeiten. Welche praktischen Lösungen könnt ihr einer Familie anbieten, die gegen diese Einflüsse kämpft?`

`2. Gibt es in eurer Gemeinde gegenwärtig eine Familie, die auseinandergefallen ist? Wenn ja, was könnt ihr als Gruppe tun, um jedem der Betroffenen in dieser Krisenzeit zu helfen?`

`3. Diskutiert über den Fragenkomplex Unterordnung. Wie ist er im christlichen Kontext zu verstehen? Auf welche Art und Weise wurde das Prinzip missbraucht?`

`4. Welche Prinzipien in Bezug auf Einheit in der Familie können auch auf die Vorstellung von Einheit in der Gemeinde übertragen werden?`


text:
PIDS=$(pgrep java -lf | grep maestro | cut -d" " -f1);

if [ -n "$PIDS" ]
then
  echo "Killing $PIDS";
  echo $PIDS | xargs kill;
else
  echo "No running instances found";
fi


text:
require "rbconfig"
require "shellwords"
require "tempfile"
require "tmpdir"
require "log4r"

require "vagrant/util/subprocess"
require "vagrant/util/powershell"
require "vagrant/util/which"

module Vagrant
  module Util
    # This class just contains some platform checking code.
    class Platform
      class << self

        def logger
          if !defined?(@_logger)
            @_logger = Log4r::Logger.new("vagrant::util::platform")
          end
          @_logger
        end

        def cygwin?
          if !defined?(@_cygwin)
            @_cygwin = ENV["VAGRANT_DETECTED_OS"].to_s.downcase.include?("cygwin") ||
              platform.include?("cygwin") ||
              ENV["OSTYPE"].to_s.downcase.include?("cygwin")
          end
          @_cygwin
        end

        def msys?
          if !defined?(@_msys)
            @_msys = ENV["VAGRANT_DETECTED_OS"].to_s.downcase.include?("msys") ||
              platform.include?("msys") ||
              ENV["OSTYPE"].to_s.downcase.include?("msys")
          end
          @_msys
        end

        def wsl?
          if !defined?(@_wsl)
            @_wsl = false
            SilenceWarnings.silence! do
              # Find 'microsoft' in /proc/version indicative of WSL
              if File.file?('/proc/version')
                osversion = File.open('/proc/version', &:gets)
                if osversion.downcase.include?("microsoft")
                  @_wsl = true
                end
              end
            end
          end
          @_wsl
        end

        [:darwin, :bsd, :freebsd, :linux, :solaris].each do |type|
          define_method("#{type}?") do
            platform.include?(type.to_s)
          end
        end

        def windows?
          return @_windows if defined?(@_windows)
          @_windows = %w[mingw mswin].any? { |t| platform.include?(t) }
          return @_windows
        end

        # Checks if the user running Vagrant on Windows has administrative
        # privileges.
        #
        # From: https://support.microsoft.com/en-us/kb/243330
        # SID: S-1-5-19
        #
        # @return [Boolean]
        def windows_admin?
          return @_windows_admin if defined?(@_windows_admin)

          @_windows_admin = -> {
            ps_cmd = '(new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)'
            output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
            return output == 'True'
          }.call

          return @_windows_admin
        end

        # Checks if Hyper-V is accessible to the local user. It will check
        # if user is in the "Hyper-V Administrators" group, is a Domain
        # administrator, and finally will run a manual interaction with
        # Hyper-V to determine if Hyper-V is usable for the current user.
        #
        # From: https://support.microsoft.com/en-us/kb/243330
        # SID: S-1-5-32-578
        # Name: BUILTIN\Hyper-V Administrators
        # SID: S-1-5-21DOMAIN-512
        # Name: Domain Admins
        #
        # @return [Boolean]
        def windows_hyperv_admin?
          return @_windows_hyperv_admin if defined?(@_windows_hyperv_admin)

          if ENV["VAGRANT_IS_HYPERV_ADMIN"]
            return @_windows_hyperv_admin = true
          end

          ps_cmd = "Write-Output ([System.Security.Principal.WindowsIdentity]::GetCurrent().Groups | " \
            "Select-Object Value | ConvertTo-JSON)"
          output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
          if output
            groups = begin
                       JSON.load(output)
                     rescue JSON::ParserError
                       []
                     end
            admin_group = groups.detect do |g|
              g["Value"].to_s == "S-1-5-32-578" ||
                (g["Value"].start_with?("S-1-5-21") && g["Value"].to_s.end_with?("-512"))
            end

            if admin_group
              return @_windows_hyperv_admin = true
            end
          end

          ps_cmd = "$x = (Get-VMHost).Name; if($x -eq [System.Net.Dns]::GetHostName()){ Write-Output 'true'}"
          output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
          result = output == "true"

          return @_windows_hyperv_admin = result
        end

        # Checks if Hyper-V is enabled on the host system and returns true
        # if enabled.
        #
        # @return [Boolean]
        def windows_hyperv_enabled?
          return @_windows_hyperv_enabled if defined?(@_windows_hyperv_enabled)

          @_windows_hyperv_enabled = -> {
            ["Get-WindowsOptionalFeature", "Get-WindowsFeature"].each do |cmd_name|
              ps_cmd = "$(#{cmd_name} -FeatureName Microsoft-Hyper-V-Hypervisor).State"
              begin
                output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
                return true if output == "Enabled"
              rescue Errors::PowerShellInvalidVersion
                logger.warn("Invalid PowerShell version detected during Hyper-V enable check")
                return false
              end
            end
            return false
          }.call

          return @_windows_hyperv_enabled
        end

        # This takes any path and converts it from a Windows path to a
        # Cygwin style path.
        #
        # @param [String] path
        # @return [String]
        def cygwin_path(path)
          begin
            cygpath = Vagrant::Util::Which.which("cygpath")
            if cygpath.nil?
              # If Which can't find it, just attempt to invoke it directly
              cygpath = "cygpath"
            else
              cygpath.gsub!("/", '\\')
            end

            process = Subprocess.execute(
              cygpath, "-u", "-a", path.to_s)
            return process.stdout.chomp
          rescue Errors::CommandUnavailableWindows => e
            # Sometimes cygpath isn't available (msys). Instead, do what we
            # can with bash tricks.
            process = Subprocess.execute(
              "bash",
              "--noprofile",
              "--norc",
              "-c", "cd #{Shellwords.escape(path)} && pwd")
            return process.stdout.chomp
          end
        end

        # This takes any path and converts it from a Windows path to a
        # msys style path.
        #
        # @param [String] path
        # @return [String]
        def msys_path(path)
          begin
            # We have to revert to the old env
            # path here, otherwise it looks like
            # msys2 ends up using the wrong cygpath
            # binary and ends up with a `/cygdrive`
            # when it doesn't exist in msys2
            original_path_env = ENV['PATH']
            ENV['PATH'] = ENV['VAGRANT_OLD_ENV_PATH']
            cygwin_path(path)
          ensure
            ENV['PATH'] = original_path_env
          end
        end

        # This takes any path and converts it to a full-length Windows
        # path on Windows machines in Cygwin.
        #
        # @return [String]
        def cygwin_windows_path(path)
          return path if !cygwin?

          # Replace all "\" with "/", otherwise cygpath doesn't work.
          path = unix_windows_path(path)

          # Call out to cygpath and gather the result
          process = Subprocess.execute("cygpath", "-w", "-l", "-a", path.to_s)
          return process.stdout.chomp
        end

        # This takes any path and converts Windows-style path separators
        # to Unix-like path separators.
        # @return [String]
        def unix_windows_path(path)
          path.gsub("\\", "/")
        end

        # This checks if the filesystem is case sensitive. This is not a
        # 100% correct check, since it is possible that the temporary
        # directory runs a different filesystem than the root directory.
        # However, this works in many cases.
        def fs_case_sensitive?
          return @_fs_case_sensitive if defined?(@_fs_case_sensitive)
          @_fs_case_sensitive = Dir.mktmpdir("vagrant-fs-case-sensitive") do |dir|
            tmp_file = File.join(dir, "FILE")
            File.open(tmp_file, "w") do |f|
              f.write("foo")
            end

            # The filesystem is case sensitive if the lowercased version
            # of the filename is NOT reported as existing.
            !File.file?(File.join(dir, "file"))
          end
          return @_fs_case_sensitive
        end

        # This expands the path and ensures proper casing of each part
        # of the path.
        def fs_real_path(path, **opts)
          path = Pathname.new(File.expand_path(path))

          if path.exist? && !fs_case_sensitive?
            # If the path contains a Windows short path, then we attempt to
            # expand. The require below is embedded here since it requires
            # windows to work.
            if windows? && path.to_s =~ /~\d(\/|\\)/
              require_relative "windows_path"
              path = Pathname.new(WindowsPath.longname(path.to_s))
            end

            # Build up all the parts of the path
            original = []
            while !path.root?
              original.unshift(path.basename.to_s)
              path = path.parent
            end

            # Traverse each part and join it into the resulting path
            original.each do |single|
              Dir.entries(path).each do |entry|
                begin
                  single = single.encode("filesystem").to_s
                rescue ArgumentError => err
                  Vagrant.global_logger.warn("path encoding failed - part=#{single} err=#{err.class} msg=#{err}")
                  # NOTE: Depending on the Windows environment the above
                  # encode will generate an "input string invalid" when
                  # attempting to encode. If that happens, continue on
                end
                if entry.downcase == single.downcase
                  path = path.join(entry)
                end
              end
            end
          end

          if windows?
            # Fix the drive letter to be uppercase.
            path = path.to_s
            if path[1] == ":"
              path[0] = path[0].upcase
            end

            path = Pathname.new(path)
          end

          path
        end

        # Converts a given path to UNC format by adding a prefix and converting slashes.
        # @param [String] path Path to convert to UNC for Windows
        # @return [String]
        def windows_unc_path(path)
          path = path.gsub("/", "\\")

          # Convert to UNC path
          if path =~ /^[a-zA-Z]:\\?$/
            # If the path is just a drive letter, then return that as-is
            path + "\\"
          elsif path.start_with?("\\\\")
            # If the path already starts with `\\` assume UNC and return as-is
            path
          else
            "\\\\?\\" + path.gsub("/", "\\")
          end
        end

        # Returns a boolean noting whether the terminal supports color.
        # output.
        def terminal_supports_colors?
          return @_terminal_supports_colors if defined?(@_terminal_supports_colors)
          @_terminal_supports_colors = -> {
            if windows?
              return true if ENV.key?("ANSICON")
              return true if cygwin?
              return true if ENV["TERM"] == "cygwin"
              return false
            end

            return true
          }.call
          return @_terminal_supports_colors
        end

        def platform
          return @_platform if defined?(@_platform)
          @_platform = RbConfig::CONFIG["host_os"].downcase
          return @_platform
        end

        # Determine if given path is within the WSL rootfs. Returns
        # true if within the subsystem, or false if outside the subsystem.
        #
        # @param [String] path Path to check
        # @return [Boolean] path is within subsystem
        def wsl_path?(path)
          wsl? && !path.to_s.downcase.start_with?("/mnt/")
        end

        # Compute the path to rootfs of currently active WSL.
        #
        # @return [String] A path to rootfs of a current WSL instance.
        def wsl_rootfs
          return @_wsl_rootfs if defined?(@_wsl_rootfs)

          if wsl?
            # Mark our filesystem with a temporary file having an unique name.
            marker = Tempfile.new(Time.now.to_i.to_s)
            logger = Log4r::Logger.new("vagrant::util::platform::wsl")

            # Check for lxrun installation first
            lxrun_path = [wsl_windows_appdata_local, "lxss"].join("\\")
            paths = [lxrun_path]

            logger.debug("checking registry for WSL installation path")
            paths += PowerShell.execute_cmd(
              '(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss ' \
                '| ForEach-Object {Get-ItemProperty $_.PSPath}).BasePath').to_s.split("\r\n").map(&:strip)
            paths.delete_if{|path| path.to_s.empty?}

            paths.each do |path|
              # Lowercase the drive letter, skip the next symbol (which is a
              # colon from a Windows path) and convert path to UNIX style.
              check_path = "/mnt/#{path[0, 1].downcase}#{path[2..-1].tr('\\', '/')}/rootfs"
              begin
                process = Subprocess.execute("wslpath", "-u", "-a", path)
                check_path = "#{process.stdout.chomp}/rootfs" if process.exit_code == 0
              rescue Errors::CommandUnavailable => e
                # pass
              end

              logger.debug("checking `#{path}` for current WSL instance")
              begin
                # https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support
                # Current WSL instance doesn't have an access to its mount from
                # within itself despite all others are available. That's the
                # hacky way we're using to determine current instance.
                # For example we have three WSL instances:
                # A -> C:\User\USER\AppData\Local\Packages\A\LocalState\rootfs
                # B -> C:\User\USER\AppData\Local\Packages\B\LocalState\rootfs
                # C -> C:\User\USER\AppData\Local\Packages\C\LocalState\rootfs
                # If we're in "A" WSL at the moment, then its path will not be
                # accessible since it's mounted for exactly the instance we're
                # in. All others can be opened.
                Dir.open(check_path) do |fs|
                  # A fallback for a case if our trick will stop working. For
                  # that we've created a temporary file with an unique name in
                  # a current WSL and now seeking it among all WSL.
                  if File.exist?("#{fs.path}/#{marker.path}")
                    @_wsl_rootfs = path
                    break
                  end
                end
              rescue Errno::EACCES
                @_wsl_rootfs = path
                # You can create and simultaneously run multiple WSL instances,
                # comment out the "break", run this script within each one and
                # it'll return only single value.
                break
              rescue Errno::ENOENT
                # Warn about data discrepancy between Winreg and file system
                # states. For the sake of justice, it's worth mentioning that
                # it is possible only when someone will manually break WSL by
                # removing a directory of its base path (kinda "stupid WSL
                # uninstallation by removing hidden and system directory").
                logger.warn("WSL instance at `#{path} is broken or no longer exists")
              end
              # All other exceptions have to be raised since they will mean
              # something unpredictably terrible.
            end

            marker.close!

            raise Vagrant::Errors::WSLRootFsNotFoundError if @_wsl_rootfs.nil?
          end

          # Attach the rootfs leaf to the path
          if @_wsl_rootfs != lxrun_path
            @_wsl_rootfs = "#{@_wsl_rootfs}\\rootfs"
          end

          logger.debug("detected `#{@_wsl_rootfs}` as current WSL instance")

          @_wsl_rootfs
        end

        # Convert a WSL path to the local Windows path. This is useful
        # for conversion when calling out to Windows executables from
        # the WSL
        #
        # @param [String, Pathname] path Path to convert
        # @return [String]
        def wsl_to_windows_path(path)
          path = path.to_s
          if wsl? && wsl_windows_access? && !path.match(/^[a-zA-Z]:/)
            path = File.expand_path(path)
            begin
              process = Subprocess.execute("wslpath", "-w", "-a", path)
              return process.stdout.chomp if process.exit_code == 0
            rescue Errors::CommandUnavailable => e
              # pass
            end
            if wsl_path?(path)
              parts = path.split("/")
              parts.delete_if(&:empty?)
              root_path = wsl_rootfs
              # lxrun splits home separate so we need to account
              # for it's specialness here when we build the path
              if root_path.end_with?("lxss") && !(["root", "home"].include?(parts.first))
                root_path = "#{root_path}\\rootfs"
              end
              path = [root_path, *parts].join("\\")
            else
              path = path.sub("/mnt/", "")
              parts = path.split("/")
              parts.first << ":"
              path = parts.join("\\")
            end
          end
          path
        end

        # Takes a windows path and formats it to the
        # 'unix' style (i.e. `/cygdrive/c` or `/c/`)
        #
        # @param [Pathname, String] path Path to convert
        # @param [Hash] hash of arguments
        # @return [String]
        def format_windows_path(path, *args)
          path = cygwin_path(path) if cygwin?
          path = msys_path(path) if msys?
          path = wsl_to_windows_path(path) if wsl?
          if windows? || wsl?
            path = windows_unc_path(path) if !args.include?(:disable_unc)
          end

          path
        end

        # Automatically convert a given path to a Windows path. Will only
        # be applied if running on a Windows host. If running on Windows
        # host within the WSL, the actual Windows path will be returned.
        #
        # @param [Pathname, String] path Path to convert
        # @return [String]
        def windows_path(path)
          path = cygwin_windows_path(path)
          path = wsl_to_windows_path(path)
          if windows? || wsl?
            path = windows_unc_path(path)
          end
          path
        end

        # Allow Vagrant to access Vagrant managed machines outside the
        # Windows Subsystem for Linux
        #
        # @return [Boolean]
        def wsl_windows_access?
          if !defined?(@_wsl_windows_access)
            @_wsl_windows_access = wsl? && ENV["VAGRANT_WSL_ENABLE_WINDOWS_ACCESS"]
          end
          @_wsl_windows_access
        end

        # The allowed windows system path Vagrant can manage from the Windows
        # Subsystem for Linux
        #
        # @return [Pathname]
        def wsl_windows_accessible_path
          if !defined?(@_wsl_windows_accessible_path)
            access_path = ENV["VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH"]
            if access_path.to_s.empty?
              begin
                process = Subprocess.execute("wslpath", "-u", "-a", wsl_windows_home)
                access_path = process.stdout.chomp if process.exit_code == 0
              rescue Errors::CommandUnavailable => e
                # pass
              end
            end
            if access_path.to_s.empty?
              access_path = wsl_windows_home.gsub("\\", "/").sub(":", "")
              access_path[0] = access_path[0].downcase
              access_path = "/mnt/#{access_path}"
            end
            @_wsl_windows_accessible_path = Pathname.new(access_path)
          end
          @_wsl_windows_accessible_path
        end

        # Checks given path to determine if Vagrant is allowed to bypass checks
        #
        # @param [String] path Path to check
        # @return [Boolean] Vagrant is allowed to bypass checks
        def wsl_windows_access_bypass?(path)
          wsl? && wsl_windows_access? &&
            path.to_s.start_with?(wsl_windows_accessible_path.to_s)
        end

        # Mount pattern for extracting local mount information
        MOUNT_PATTERN = /^(?<device>.+?) on (?<mount>.+?) type (?<type>.+?) \((?<options>.+)\)/.freeze

        # Get list of local mount paths that are DrvFs file systems
        #
        # @return [Array<String>]
        # @todo(chrisroberts): Constantize types for check
        def wsl_drvfs_mounts
          if !defined?(@_wsl_drvfs_mounts)
            @_wsl_drvfs_mounts = []
            if wsl?
              result = Util::Subprocess.execute("mount")
              result.stdout.each_line do |line|
                info = line.match(MOUNT_PATTERN)
                if info && (info[:type] == "drvfs" || info[:type] == "9p")
                  @_wsl_drvfs_mounts << info[:mount]
                end
              end
            end
          end
          @_wsl_drvfs_mounts
        end

        # Check if given path is located on DrvFs file system
        #
        # @param [String, Pathname] path Path to check
        # @return [Boolean]
        def wsl_drvfs_path?(path)
          if wsl?
            wsl_drvfs_mounts.each do |mount_path|
              return true if path.to_s.start_with?(mount_path)
            end
          end
          false
        end

        # If running within the Windows Subsystem for Linux, this will provide
        # simple setup to allow sharing of the user's VAGRANT_HOME directory
        # within the subsystem
        #
        # @param [Environment] env
        # @param [Logger] logger Optional logger to display information
        def wsl_init(env, logger=nil)
          if wsl?
            if ENV["VAGRANT_WSL_ENABLE_WINDOWS_ACCESS"]
              wsl_validate_matching_vagrant_versions!
              shared_user = ENV["VAGRANT_WSL_WINDOWS_ACCESS_USER"]
              if shared_user.to_s.empty?
                shared_user = wsl_windows_username
              end
              if logger
                logger.warn("Windows Subsystem for Linux detected. Allowing access to user: #{shared_user}")
                logger.warn("Vagrant will be allowed to control Vagrant managed machines within the user's home path.")
              end
              if ENV["VAGRANT_HOME"] || ENV["VAGRANT_WSL_DISABLE_VAGRANT_HOME"]
                logger.warn("VAGRANT_HOME environment variable already set. Not overriding!") if logger
              else
                home_path = wsl_windows_accessible_path.to_s
                ENV["VAGRANT_HOME"] = File.join(home_path, ".vagrant.d")
                if logger
                  logger.info("Overriding VAGRANT_HOME environment variable to configured windows user. (#{ENV["VAGRANT_HOME"]})")
                end
                true
              end
            else
              if env.local_data_path.to_s.start_with?("/mnt/")
                raise Vagrant::Errors::WSLVagrantAccessError
              end
            end
          end
        end

        # Fetch the Windows username currently in use
        #
        # @return [String, Nil]
        def wsl_windows_username
          if !@_wsl_windows_username
            result = Util::Subprocess.execute("cmd.exe", "/c", "echo %USERNAME%")
            if result.exit_code == 0
              @_wsl_windows_username = result.stdout.strip
            end
          end
          @_wsl_windows_username
        end

        # Fetch the Windows user home directory
        #
        # @return [String, Nil]
        def wsl_windows_home
          if !@_wsl_windows_home
            result = Util::Subprocess.execute("cmd.exe", "/c" "echo %USERPROFILE%")
            if result.exit_code == 0
              @_wsl_windows_home = result.stdout.gsub("\"", "").strip
            end
          end
          @_wsl_windows_home
        end

        # Fetch the Windows user local app data directory
        #
        # @return [String, Nil]
        def wsl_windows_appdata_local
          if !@_wsl_windows_appdata_local
            result = Util::Subprocess.execute("cmd.exe", "/c", "echo %LOCALAPPDATA%")
            if result.exit_code == 0
              @_wsl_windows_appdata_local = result.stdout.gsub("\"", "").strip
            end
          end
          @_wsl_windows_appdata_local
        end

        # Confirm Vagrant versions installed within the WSL and the Windows system
        # are the same. Raise error if they do not match.
        def wsl_validate_matching_vagrant_versions!
          valid = false
          if Util::Which.which("vagrant.exe")
            result = Util::Subprocess.execute("vagrant.exe", "--version")
            if result.exit_code == 0
              windows_version = result.stdout.match(/Vagrant (?<version>[\w.-]+)/)
              if windows_version
                windows_version = windows_version[:version].strip
                valid = windows_version == Vagrant::VERSION
              end
            end
            if !valid
              raise Vagrant::Errors::WSLVagrantVersionMismatch,
                wsl_version: Vagrant::VERSION,
                windows_version: windows_version || "unknown"
            end
          end
        end

        # systemd is in use
        def systemd?
          if !defined?(@_systemd)
            if !windows?
              result = Vagrant::Util::Subprocess.execute("ps", "-o", "comm=", "1")
              @_systemd = result.stdout.chomp == "systemd"
            else
              @_systemd = false
            end
          end
          @_systemd
        end

        # @private
        # Reset the cached values for platform. This is not considered a public
        # API and should only be used for testing.
        def reset!
          instance_variables.each(&method(:remove_instance_variable))
        end
      end
    end
  end
end


text:
<head>
  {% include meta.html %}
  <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
  <title>{% if page.title %}blog | {{ page.title }}{% else %}{{ site.name }}{%endif%}</title>
  <!-- Google Tag Manager -->
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  })(window,document,'script','dataLayer','GTM-52S896V');</script>
  <!-- End Google Tag Manager -->
  <link rel="alternate" type="application/rss+xml" title="{{ site.name }} - {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="{{ '/css/bootstrap.min.css' | prepend: site.baseurl }}">
  <link rel="stylesheet" href="{{ '/css/bootstrap-responsive.min.css' | prepend: site.baseurl }}">
  <link rel="stylesheet" href="{{ '/css/style.css' | prepend: site.baseurl }}">
  <link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
</head>