text:
package kubectl

import (
	"bytes"
	"fmt"
	"io"
	"net"
	"net/url"
	"os/exec"
	"strings"
	"syscall"
	"time"

	"k8s.io/client-go/tools/clientcmd"
	uexec "k8s.io/utils/exec"

	"k8s.io/kubernetes/test/e2e/framework"
)

// KubectlBuilder is used to build, customize and execute a kubectl Command.
// Add more functions to customize the builder as needed.
type KubectlBuilder struct {
	cmd     *exec.Cmd
	timeout <-chan time.Time
}

// NewKubectlCommand returns a KubectlBuilder for running kubectl.
func NewKubectlCommand(namespace string, args ...string) *KubectlBuilder {
	b := new(KubectlBuilder)
	tk := NewTestKubeconfig(framework.TestContext.CertDir, framework.TestContext.Host, framework.TestContext.KubeConfig, framework.TestContext.KubeContext, framework.TestContext.KubectlPath, namespace)
	b.cmd = tk.KubectlCmd(args...)
	return b
}

// WithEnv sets the given environment and returns itself.
func (b *KubectlBuilder) WithEnv(env []string) *KubectlBuilder {
	b.cmd.Env = env
	return b
}

// WithTimeout sets the given timeout and returns itself.
func (b *KubectlBuilder) WithTimeout(t <-chan time.Time) *KubectlBuilder {
	b.timeout = t
	return b
}

// WithStdinData sets the given data to stdin and returns itself.
func (b KubectlBuilder) WithStdinData(data string) *KubectlBuilder {
	b.cmd.Stdin = strings.NewReader(data)
	return &b
}

// WithStdinReader sets the given reader and returns itself.
func (b KubectlBuilder) WithStdinReader(reader io.Reader) *KubectlBuilder {
	b.cmd.Stdin = reader
	return &b
}

// ExecOrDie runs the kubectl executable or dies if error occurs.
func (b KubectlBuilder) ExecOrDie(namespace string) string {
	str, err := b.Exec()
	// In case of i/o timeout error, try talking to the apiserver again after 2s before dying.
	// Note that we're still dying after retrying so that we can get visibility to triage it further.
	if isTimeout(err) {
		framework.Logf("Hit i/o timeout error, talking to the server 2s later to see if it's temporary.")
		time.Sleep(2 * time.Second)
		retryStr, retryErr := RunKubectl(namespace, "version")
		framework.Logf("stdout: %q", retryStr)
		framework.Logf("err: %v", retryErr)
	}
	framework.ExpectNoError(err)
	return str
}

func isTimeout(err error) bool {
	switch err := err.(type) {
	case *url.Error:
		if err, ok := err.Err.(net.Error); ok && err.Timeout() {
			return true
		}
	case net.Error:
		if err.Timeout() {
			return true
		}
	}
	return false
}

// Exec runs the kubectl executable.
func (b KubectlBuilder) Exec() (string, error) {
	stdout, _, err := b.ExecWithFullOutput()
	return stdout, err
}

// ExecWithFullOutput runs the kubectl executable, and returns the stdout and stderr.
func (b KubectlBuilder) ExecWithFullOutput() (string, string, error) {
	var stdout, stderr bytes.Buffer
	cmd := b.cmd
	cmd.Stdout, cmd.Stderr = &stdout, &stderr

	framework.Logf("Running '%s %s'", cmd.Path, strings.Join(cmd.Args[1:], " ")) // skip arg[0] as it is printed separately
	if err := cmd.Start(); err != nil {
		return "", "", fmt.Errorf("error starting %v:\nCommand stdout:\n%v\nstderr:\n%v\nerror:\n%v", cmd, cmd.Stdout, cmd.Stderr, err)
	}
	errCh := make(chan error, 1)
	go func() {
		errCh <- cmd.Wait()
	}()
	select {
	case err := <-errCh:
		if err != nil {
			var rc = 127
			if ee, ok := err.(*exec.ExitError); ok {
				rc = int(ee.Sys().(syscall.WaitStatus).ExitStatus())
				framework.Logf("rc: %d", rc)
			}
			return stdout.String(), stderr.String(), uexec.CodeExitError{
				Err:  fmt.Errorf("error running %v:\nCommand stdout:\n%v\nstderr:\n%v\nerror:\n%v", cmd, cmd.Stdout, cmd.Stderr, err),
				Code: rc,
			}
		}
	case <-b.timeout:
		b.cmd.Process.Kill()
		return "", "", fmt.Errorf("timed out waiting for command %v:\nCommand stdout:\n%v\nstderr:\n%v", cmd, cmd.Stdout, cmd.Stderr)
	}
	framework.Logf("stderr: %q", stderr.String())
	framework.Logf("stdout: %q", stdout.String())
	return stdout.String(), stderr.String(), nil
}

// RunKubectlOrDie is a convenience wrapper over kubectlBuilder
func RunKubectlOrDie(namespace string, args ...string) string {
	return NewKubectlCommand(namespace, args...).ExecOrDie(namespace)
}

// RunKubectl is a convenience wrapper over kubectlBuilder
func RunKubectl(namespace string, args ...string) (string, error) {
	return NewKubectlCommand(namespace, args...).Exec()
}

// RunKubectlWithFullOutput is a convenience wrapper over kubectlBuilder
// It will also return the command's stderr.
func RunKubectlWithFullOutput(namespace string, args ...string) (string, string, error) {
	return NewKubectlCommand(namespace, args...).ExecWithFullOutput()
}

// RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlOrDieInput(namespace string, data string, args ...string) string {
	return NewKubectlCommand(namespace, args...).WithStdinData(data).ExecOrDie(namespace)
}

// RunKubectlInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlInput(namespace string, data string, args ...string) (string, error) {
	return NewKubectlCommand(namespace, args...).WithStdinData(data).Exec()
}

// RunKubemciWithKubeconfig is a convenience wrapper over RunKubemciCmd
func RunKubemciWithKubeconfig(args ...string) (string, error) {
	if framework.TestContext.KubeConfig != "" {
		args = append(args, "--"+clientcmd.RecommendedConfigPathFlag+"="+framework.TestContext.KubeConfig)
	}
	return RunKubemciCmd(args...)
}

// RunKubemciCmd is a convenience wrapper over kubectlBuilder to run kubemci.
// It assumes that kubemci exists in PATH.
func RunKubemciCmd(args ...string) (string, error) {
	// kubemci is assumed to be in PATH.
	kubemci := "kubemci"
	b := new(KubectlBuilder)
	args = append(args, "--gcp-project="+framework.TestContext.CloudConfig.ProjectID)

	b.cmd = exec.Command(kubemci, args...)
	return b.Exec()
}


text:
using System;
using System.Collections;
namespace _15BitsExchange
{
    class Program
    {
        static void Main()
        {
            Console.Write("Enter number n = ");
            uint n = uint.Parse(Console.ReadLine());

            BitArray temp = new BitArray(new int[] { (int)n });
            bool tempThree = temp[3];
            bool tempFour = temp[4];
            bool tempFive = temp[5];
            temp[3] = temp[24];
            temp[4] = temp[25];
            temp[5] = temp[26];
            temp[24] = tempThree;
            temp[25] = tempFour;
            temp[26] = tempFive;

            int[] array = new int[1];
            temp.CopyTo(array, 0);
            Console.WriteLine((uint)array[0]);

        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Tecnocreaciones\Bundle\ToolsBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Carga la configuracion de los filtros de busqueda
 *
 * @author Carlos Mendoza <inhack20@gmail.com>
 */
class SearchPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        if($container->getParameter('tecnocreaciones_tools.service.search.enable') === false){
            return;
        }
        $config = $container->getParameter("tecnocreaciones_tools.search.config");
        $definition = $container->getDefinition('tecnocreaciones_tools.search');

        $definition->addMethodCall("setStandardFilters",[$config["standard_filters"]]);
        $definition->addMethodCall("setTemplateFilters",[$config["template_filters"]]);
        $definition->addMethodCall("setTransDefaultDomains",[$config["trans_default_domain"]]);
        $filters = $container->findTaggedServiceIds("search.filter");

        foreach ($filters as $filterId => $value) {
            $definition->addMethodCall("addGroupFilter",[new \Symfony\Component\DependencyInjection\Reference($filterId)]);
        }
    }
}


text:
#pragma once
#include <QListWidget>

class RDListWidget : public QListWidget
{
private:
  Q_OBJECT
public:
  explicit RDListWidget(QWidget *parent = 0);
  ~RDListWidget();

signals:
  void mouseClicked(QMouseEvent *event);
  void mouseDoubleClicked(QMouseEvent *event);

public slots:

protected:
  void mousePressEvent(QMouseEvent *event) override;
  void mouseDoubleClickEvent(QMouseEvent *event) override;
};


text:
// Copyright (c) 2003-present, Jodd Team (http://jodd.org)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

package jodd.lagarto.dom;

import jodd.lagarto.TagWriterUtil;
import jodd.util.HtmlEncoder;

import java.io.IOException;

/**
 * {@link jodd.lagarto.dom.NodeVisitor} that renders DOM tree to string.
 */
public class LagartoHtmlRendererNodeVisitor implements NodeVisitor {

	protected final Appendable appendable;

	public LagartoHtmlRendererNodeVisitor(Appendable appendable) {
		this.appendable = appendable;
	}

	public void cdata(CData cdata) {
		String nodeValue = cdata.getNodeValue();
		try {
			TagWriterUtil.writeCData(appendable, nodeValue);
		} catch (IOException ioex) {
			throw new LagartoDOMException(ioex);
		}
	}

	public void comment(Comment comment) {
		String nodeValue = comment.getNodeValue();

		try {
			TagWriterUtil.writeComment(appendable, nodeValue);
		} catch (IOException ioex) {
			throw new LagartoDOMException(ioex);
		}
	}

	public void document(Document document) {
		document.visitChildren(this);
	}

	public void documentType(DocumentType documentType) {
		try {
			TagWriterUtil.writeDoctype(appendable,
					documentType.nodeValue,
					documentType.publicId,
					documentType.systemId);
		} catch (IOException ioex) {
			throw new LagartoDOMException(ioex);
		}
	}

	public void text(Text text) {
		String nodeValue = text.getTextValue();

		try {
			appendable.append(nodeValue);
		} catch (IOException ioex) {
			throw new LagartoDOMException(ioex);
		}
	}

	public void xmlDeclaration(XmlDeclaration xmlDeclaration) {
		try {
			TagWriterUtil.writeXml(appendable,
					xmlDeclaration.getVersion(), xmlDeclaration.getEncoding(), xmlDeclaration.getStandalone());
		} catch (IOException ioex) {
			throw new LagartoDOMException(ioex);
		}
	}

	// ---------------------------------------------------------------- element

	/**
	 * Enumeration of case options for output name.
	 */
	public enum Case {
		/**
		 * Default case, depends on parser case sensitivity.
		 */
		DEFAULT,
		/**
		 * Raw name, no modifications.
		 */
		RAW,
		/**
		 * Lowercase name.
		 */
		LOWERCASE,
		/**
		 * Uppercase name.
		 */
		UPPERCASE,
	}

	/**
	 * Letter case of tag names.
	 */
	protected Case tagCase = Case.DEFAULT;

	/**
	 * Letter case of attributes names.
	 */
	protected Case attributeCase = Case.DEFAULT;

	/**
	 * Sets {@link Case case} of tag names.
	 */
	public void setTagCase(Case tagCase) {
		this.tagCase = tagCase;
	}

	public Case getTagCase() {
		return tagCase;
	}

	/**
	 * Sets {@link Case case} of attribute names.
	 */
	public void setAttributeCase(Case attributeCase) {
		this.attributeCase = attributeCase;
	}

	public Case getAttributeCase() {
		return attributeCase;
	}

	/**
	 * Resets all cases to default.
	 */
	public void reset() {
		tagCase = Case.DEFAULT;
		attributeCase = Case.DEFAULT;
	}

	/**
	 * Renders node name.
	 */
	protected String resolveNodeName(Node node) {
		switch (tagCase) {
			case DEFAULT: return node.getNodeName();
			case RAW: return node.getNodeRawName();
			case LOWERCASE: return node.getNodeRawName().toLowerCase();
			case UPPERCASE: return node.getNodeRawName().toUpperCase();
		}
		return null;
	}

	/**
	 * Renders attribute name.
	 */
	protected String resolveAttributeName(Node node, Attribute attribute) {
		switch (attributeCase) {
			case DEFAULT: return attribute.getName();
			case RAW: return attribute.getRawName();
			case LOWERCASE: return attribute.getRawName().toLowerCase();
			case UPPERCASE: return attribute.getRawName().toUpperCase();
		}
		return null;
	}

	/**
	 * Renders attribute.
	 */
	protected void renderAttribute(Node node, Attribute attribute, Appendable appendable) throws IOException {
		String name = resolveAttributeName(node, attribute);
		String value = attribute.getValue();

		appendable.append(name);
		if (value != null) {
			appendable.append('=');
			appendable.append('\"');
			appendable.append(HtmlEncoder.attributeDoubleQuoted(value));
			appendable.append('\"');
		}
	}

	public void element(Element element) {
		try {
			_element(element);
		} catch (IOException ioex) {
			throw new LagartoDOMException(ioex);
		}
	}

	protected void _element(Element element) throws IOException {
		String nodeName = resolveNodeName(element);

		appendable.append('<');
		appendable.append(nodeName);

		int attrCount = element.getAttributesCount();

		if (attrCount != 0) {
			for (int i = 0; i < attrCount; i++) {
				Attribute attr = element.getAttribute(i);
				appendable.append(' ');
				renderAttribute(element, attr, appendable);
			}
		}

		int childCount = element.getChildNodesCount();

		if (element.selfClosed && childCount == 0) {
			appendable.append("/>");
			return;
		}

		appendable.append('>');

		if (element.voidElement) {
			return;
		}

		if (childCount != 0) {
			elementBody(element);
		}

		appendable.append("</");
		appendable.append(nodeName);
		appendable.append('>');
	}

	protected void elementBody(Element element) throws IOException {
		int childCount = element.getChildNodesCount();

		if (element.isRawTag()) {
			for (int i = 0; i < childCount; i++) {
				Node childNode = element.getChild(i);

				if (childNode.getNodeType() == Node.NodeType.TEXT) {
					appendable.append(childNode.getNodeValue());
				} else {
					childNode.visit(this);
				}
			}
		} else {
			element.visitChildren(this);
		}
	}

}


text:
using Microsoft.Band;
using Microsoft.Band.Admin;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Threading;
using unBand.CargoClientEditor;

namespace unBand.BandHelpers
{
    class BandManager : INotifyPropertyChanged
    {

        #region Singleton

        /// <summary>
        /// Call BandManager.Start() to kick things off htere
        /// TODO: Consider an exception if Start() is not called
        /// </summary>
        public static BandManager Instance { get; private set; }

        #endregion

        private bool _isConnected = false;
        private bool _isDesktopSyncAppRunning = false;
        private IBandInfo _deviceInfo;
        private ICargoClient _cargoClient;
        private BandProperties _properties;
        private BandTheme _theme;
        private BandSensors _sensors;
        private BandTiles _tiles;

        public bool IsConnected
        {
            get { return _isConnected; }
            set
            {
                if (_isConnected != value)
                {
                    _isConnected = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public bool IsDesktopSyncAppRunning
        {
            get { return _isDesktopSyncAppRunning; }
            set
            {
                if (_isDesktopSyncAppRunning != value)
                {
                    _isDesktopSyncAppRunning = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public ICargoClient CargoClient
        {
            get { return _cargoClient; }
            set
            {
                if (_cargoClient != value)
                {
                    _cargoClient = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public BandProperties Properties
        {
            get { return _properties; }
            set
            {
                if (_properties != value)
                {
                    _properties = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public BandTheme Theme
        {
            get { return _theme; }
            set
            {
                if (_theme != value)
                {
                    _theme = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public BandSensors Sensors
        {
            get { return _sensors; }
            set
            {
                if (_sensors != value)
                {
                    _sensors = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public BandTiles Tiles
        {
            get { return _tiles; }
            set
            {
                if (_tiles != value)
                {
                    _tiles = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public BandLogger Log { get { return BandLogger.Instance; } }

        private BandManager()
        {
        }

        public static bool CanRun(ref string message)
        {
            string msg = null;

            if (!CargoDll.BandDllsExist(ref msg))
            {
                message = "Couldn't find the latest Microsoft Band Desktop Sync app.\n\nInstall it from: http://bit.ly/desktopband and try again.\n\nSadly we're going to have to exit now.\n\nDiagnostiscs: " + msg;

                return false;
            }

            return true;
        }

        public static void Create()
        {
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

            Instance = new BandManager();

            Instance.InitializeCargoLogging();
        }

        static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            if (args.Name.StartsWith("Microsoft.Band"))
            {
                // an exception will be thrown on Microsoft.Band.Desktop.resources, ignore it
                try
                {
                    var curDir = Directory.GetCurrentDirectory();
                    Directory.SetCurrentDirectory(CargoDll.GetOfficialBandDllPath());

                    var asm = Assembly.LoadFrom(CargoDll.GetUnBandBandDll(args.Name.Substring(0, args.Name.IndexOf(','))));

                    Directory.SetCurrentDirectory(curDir);

                    return asm;
                }
                catch
                {
                    // TODO: log exception?
                }
            }

            return null;
        }

        private static DispatcherTimer _timer;

        public static void Start()
        {
            if (Instance == null)
                Create();

            // While I don't love the whole Interval = 1ms thing, it simply means that we trigger the first run immediately
            // TODO: Since this could potentially cause race conditions if someone really wanted to garauntee order
            //       of execution we could split out object creation from Start().
            _timer = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromMilliseconds(1);

            _timer.Tick += async (sender, e) =>
            {
                _timer.IsEnabled = false;

                if (!Instance.IsConnected)
                {
                    await Instance.ConnectDevice();
                }
                else
                {
                    // make sure we still have the current device
                    var devices = await GetConnectedDevicesAsync();

                    if (!devices.Any(i => i.Name == Instance._deviceInfo.Name))
                    {
                        Instance.IsConnected = false;
                    }
                }

                // only reset once we finished processing
                _timer.Interval = TimeSpan.FromSeconds(10);
                _timer.IsEnabled = true;
            };

            _timer.Start();
        }

        private async Task ConnectDevice()
        {
            if (DesktopSyncAppIsRunning())
                return;

            // We support connecting to a device over USB and Bluetooth.
            // Since USB is super fast (the device is either there or not), search there first and then fallback
            // on Bluetooth, since that can take a little longer.

            var device = await GetUSBBand();

            if (device == null)
            {
                // now try Bluetooth
                device = await GetBluetoothBand();
            }

            if (device != null)
            {
                // since this will trigger binding, invoke on the UI thread
                Application.Current.Dispatcher.BeginInvoke(new Action(async () =>
                {
                    // TODO: support more than one device?
                    CargoClient = device;

                    IsConnected = true;

                    //TODO: call an "OnConnected" function

                    // Bluetooth is sensitive to multiple things going on at once across different threads
                    // so let's make sure we go about this serially

                    Properties = new BandProperties(CargoClient);
                    await Properties.InitAsync();

                    Theme = new BandTheme(CargoClient);
                    await Theme.InitAsync();

                    Sensors = new BandSensors(CargoClient);
                    await Sensors.InitAsync();

                    Tiles = new BandTiles(CargoClient);
                    await Tiles.InitAsync();
                }));
            }
        }

        private static async Task<IBandInfo[]> GetConnectedDevicesAsync()
        {
            var devices = new List<IBandInfo>();

            devices.AddRange(await GetConnectedUSBDevicesAsync());
            devices.AddRange(await GetConnectedBluetoothDevicesAsync());

            return devices.ToArray();
        }

        private static async Task<IBandInfo[]> GetConnectedUSBDevicesAsync()
        {
            return await BandAdminClientManager.Instance.GetBandsAsync();
        }

        private static async Task<IBandInfo[]> GetConnectedBluetoothDevicesAsync()
        {
            return new IBandInfo[] {};// Temporary BT removal: await CargoClientExtender.BluetoothClient.GetConnectedDevicesAsync();
        }

        private async Task<ICargoClient> GetUSBBand()
        {
            var devices = await GetConnectedUSBDevicesAsync();

            if (devices != null && devices.Length > 0)
            {
                _deviceInfo = devices[0];

                return (await BandAdminClientManager.Instance.ConnectAsync(_deviceInfo)) as ICargoClient;
            }

            return null;
        }

        private async Task<ICargoClient> GetBluetoothBand()
        {
            /* temporarily removed until BT can be re-enabled on the new DLLs
            var btDevices = await GetConnectedBluetoothDevicesAsync();

            if (btDevices != null && btDevices.Length > 0)
            {
                _deviceInfo = btDevices[0];

                return await BluetoothClient.CreateAsync(_deviceInfo);
            }
            */
            return null;
        }

        private bool DesktopSyncAppIsRunning()
        {
            return IsDesktopSyncAppRunning = (System.Diagnostics.Process.GetProcessesByName("Microsoft Band Sync").Length > 0);
        }

        private void InitializeCargoLogging()
        {
            // get log instance
            var field = typeof(Logger).GetField("traceListenerInternal", BindingFlags.Static | BindingFlags.NonPublic);
            field.SetValue(null, BandLogger.Instance);
        }

        #region INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }));
            }
        }

        #endregion
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="rripp.android.glass.speedometer"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="15" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_speedo_50"
        android:label="@string/app_name">
        <activity
            android:name="rripp.android.glass.speedometer.MenuActivity"
            android:label="@string/app_name"
            android:enabled="true">
        </activity>
        <service android:name="rripp.android.glass.speedometer.SpeedometerService"
                        android:label="@string/app_name"
            android:theme="@style/MenuTheme"
            android:enabled="true" >
            <intent-filter>
                <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
            </intent-filter>
            <meta-data
                android:name="com.google.android.glass.VoiceTrigger"
                android:resource="@xml/voice_trigger_start" />
        </service>
    </application>
</manifest>


text:
<?php

namespace Mangati\Ldap\Schema;

/**
 * OrganizationPerson
 *
 * @author Rogério Lino <rogeriolino@gmail.com>
 */
class OrganizationalUnit extends Top
{

    public function objectClasses()
    {
        $base = parent::objectClasses();
        $base[] = 'organizationalUnit';
        return $base;
    }

    public function rdnAttributeName()
    {
        return 'ou';
    }

    public function requiredAttributes()
    {
        $base = parent::requiredAttributes();
        return array_merge($base, [
            'ou',
        ]);
    }

    public function availableAttributes()
    {
        $base = parent::availableAttributes();
        return array_merge($base, [
            'ou' => [
                'class' => \Mangati\Ldap\Attribute\TextAttribute::class,
                'single_valued' => true
            ],
            'description' => [
                'class' => \Mangati\Ldap\Attribute\TextAttribute::class,
                'single_valued' => false
            ]
        ]);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="9168acc6-0aed-417d-8631-92eb0efabaa4" name="Default" comment="">
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/_canvas.scss" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/_element.scss" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/_layout.scss" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/_mixin.scss" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/_responsive.scss" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/_section.scss" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/_setting.scss" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/css/fonts.css" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/css/style.css" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sass/style.scss" />
    </list>
    <ignored path="08.08.14.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="DaemonCodeAnalyzer">
    <disable_hints />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="08.08.14" />
  </component>
  <component name="FileEditorManager">
    <leaf>
      <file leaf-file-name="index.html" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-7.576923" vertical-offset="1027" max-vertical-offset="2992">
              <caret line="72" column="37" selection-start-line="72" selection-start-column="37" selection-end-line="72" selection-end-column="37" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="main.js" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/js/main.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="493">
              <caret line="3" column="56" selection-start-line="3" selection-start-column="56" selection-end-line="3" selection-end-column="56" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_section.scss" pinned="false" current="true" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/sass/_section.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-5.375" vertical-offset="5400" max-vertical-offset="5984">
              <caret line="133" column="27" selection-start-line="133" selection-start-column="27" selection-end-line="133" selection-end-column="27" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_setting.scss" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/sass/_setting.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-10.692307" vertical-offset="96" max-vertical-offset="782">
              <caret line="22" column="20" selection-start-line="22" selection-start-column="13" selection-end-line="22" selection-end-column="20" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_mixin.scss" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/sass/_mixin.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-10.461538" vertical-offset="0" max-vertical-offset="391">
              <caret line="16" column="21" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_canvas.scss" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/sass/_canvas.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-6.5384617" vertical-offset="0" max-vertical-offset="272">
              <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_layout.scss" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/sass/_layout.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-9.153846" vertical-offset="0" max-vertical-offset="459">
              <caret line="14" column="26" selection-start-line="14" selection-start-column="26" selection-end-line="14" selection-end-column="26" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_responsive.scss" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/sass/_responsive.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-1.3076923" vertical-offset="0" max-vertical-offset="221">
              <caret line="2" column="1" selection-start-line="2" selection-start-column="1" selection-end-line="2" selection-end-column="1" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_element.scss" pinned="false" current="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/sass/_element.scss">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-3.9230769" vertical-offset="0" max-vertical-offset="204">
              <caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FindManager">
    <FindUsagesManager>
      <setting name="OPEN_NEW_TAB" value="true" />
    </FindUsagesManager>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="changedFiles">
      <list>
        <option value="$PROJECT_DIR$/sass/_responsive.scss" />
        <option value="$PROJECT_DIR$/sass/_element.scss" />
        <option value="$PROJECT_DIR$/sass/canvas.scss" />
        <option value="$PROJECT_DIR$/sass/style.scss" />
        <option value="$PROJECT_DIR$/sass/_mixin.scss" />
        <option value="$PROJECT_DIR$/sass/_layout.scss" />
        <option value="$PROJECT_DIR$/sass/_canvas.scss" />
        <option value="$PROJECT_DIR$/sass/_setting.scss" />
        <option value="$PROJECT_DIR$/js/main.js" />
        <option value="$PROJECT_DIR$/index.html" />
        <option value="$PROJECT_DIR$/sass/_section.scss" />
      </list>
    </option>
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="-8" />
    <option name="y" value="-8" />
    <option name="width" value="1382" />
    <option name="height" value="744" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="2" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectReloadState">
    <option name="STATE" value="0" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="sass" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="js" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="img" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="font" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="08.08.14" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="css" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
      <pane id="Scope" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="last_opened_file_path" value="$PROJECT_DIR$/../NEW" />
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="FullScreen" value="false" />
  </component>
  <component name="RunManager">
    <configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
      <option name="VMOptions" />
      <option name="arguments" />
      <option name="filePath" />
      <option name="scope" value="ALL" />
      <option name="testName" />
      <method />
    </configuration>
    <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
      <option name="VMOptions" />
      <option name="arguments" />
      <option name="filePath" />
      <option name="name" value="Dart" />
      <option name="saveOutputToFile" value="false" />
      <option name="showConsoleOnStdErr" value="false" />
      <option name="showConsoleOnStdOut" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="CucumberJavaScriptRunConfigurationType" factoryName="Cucumber.js">
      <option name="cucumberJsArguments" />
      <option name="executablePath" />
      <option name="filePath" />
      <method />
    </configuration>
    <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" config-file="">
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="JSTestDriver:ConfigurationType" factoryName="JsTestDriver">
      <setting name="configLocationType" value="CONFIG_FILE" />
      <setting name="settingsFile" value="" />
      <setting name="serverType" value="INTERNAL" />
      <setting name="preferredDebugBrowser" value="Chrome" />
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" working-dir="">
      <method />
    </configuration>
    <list size="0" />
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="9168acc6-0aed-417d-8631-92eb0efabaa4" name="Default" comment="" />
      <created>1407512257904</created>
      <updated>1407512257904</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="-8" y="-8" width="1382" height="744" extended-state="7" />
    <editor active="false" />
    <layout>
      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32861635" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24963397" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
    </layout>
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="VcsManagerConfiguration">
    <option name="myTodoPanelSettings">
      <TodoPanelSettings />
    </option>
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/css/fonts.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="610">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/_responsive.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-1.3076923" vertical-offset="0" max-vertical-offset="221">
          <caret line="2" column="1" selection-start-line="2" selection-start-column="1" selection-end-line="2" selection-end-column="1" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/font/Lato-LigIta.ttf">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="14535">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/style.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-0.42131147" vertical-offset="1141" max-vertical-offset="1972">
          <caret line="52" column="0" selection-start-line="52" selection-start-column="0" selection-end-line="52" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/style.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.45617172" vertical-offset="0" max-vertical-offset="646">
          <caret line="15" column="15" selection-start-line="15" selection-start-column="15" selection-end-line="15" selection-end-column="15" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/_element.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-3.9230769" vertical-offset="0" max-vertical-offset="204">
          <caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/_mixin.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-10.461538" vertical-offset="0" max-vertical-offset="391">
          <caret line="16" column="21" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/_canvas.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-6.5384617" vertical-offset="0" max-vertical-offset="272">
          <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/_layout.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-9.153846" vertical-offset="0" max-vertical-offset="459">
          <caret line="14" column="26" selection-start-line="14" selection-start-column="26" selection-end-line="14" selection-end-column="26" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/_setting.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-10.692307" vertical-offset="96" max-vertical-offset="782">
          <caret line="22" column="20" selection-start-line="22" selection-start-column="13" selection-end-line="22" selection-end-column="20" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/main.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="493">
          <caret line="3" column="56" selection-start-line="3" selection-start-column="56" selection-end-line="3" selection-end-column="56" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-7.576923" vertical-offset="1027" max-vertical-offset="2992">
          <caret line="72" column="37" selection-start-line="72" selection-start-column="37" selection-end-line="72" selection-end-column="37" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/sass/_section.scss">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-5.375" vertical-offset="5400" max-vertical-offset="5984">
          <caret line="133" column="27" selection-start-line="133" selection-start-column="27" selection-end-line="133" selection-end-column="27" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
require 'rails_helper'

describe Admin::TracksController, type: :controller do
  it 'requires admin' do
    visit admin_tracks_path
    expect(page).to have_content('Not authorized')
  end

  describe 'index' do
    before :each do
      log_in admin: true
    end

    it 'renders' do
      visit admin_tracks_path
      Instructable::TRACKS.keys.each { |track|
        expect(page).to have_content track
      }
    end

    it "displays 'No classes'" do
      visit admin_tracks_path
      first('.badge') do
        should have_content 'No classes'
      end
    end

    it 'renders 50% for a track' do
      i1 = create(:instructable, track: 'Middle Eastern')
      i1.instances.create!(start_time: get_date(0), location: 'Touch the Earch')
      create(:instructable, track: 'Middle Eastern')
      visit admin_tracks_path
      first('.badge.badge-warning') do
        should have_content('50.00%')
      end
    end

    it 'renders 100% for a track' do
      i1 = create(:instructable, track: 'Middle Eastern')
      i1.instances.create!(start_time: get_date(0), location: 'Touch the Earch')
      visit admin_tracks_path
      first('.badge.badge-success') do
        should have_content('100.00%')
      end
    end
  end
end


text:
import site
import os
import sys
import json
import datetime

PATH_NAME = "paths.json"
BOARD_NAME = "nyx"
SITE_NYSA = os.path.join(site.getuserbase(), "nysa")
SITE_PATH = os.path.join(SITE_NYSA, PATH_NAME)
PLATFORM_PATH = os.path.abspath(os.path.dirname(__file__))
CONFIG_PATH = os.path.join(PLATFORM_PATH, BOARD_NAME, "board", "config.json")

if __name__ == "__main__":
    f = open(CONFIG_PATH, "r")
    config_dict = json.load(f)
    f.close()

    name = config_dict["board_name"].lower()
    now = datetime.datetime.now()
    #timestamp = now.strftime("%m/%d/%Y %X")
    timestamp = now.strftime("%x %X")

    try:
        f = open(SITE_PATH, "r")
        path_dict = json.load(f)
        f.close()
    except IOError as e:
        print "site directories are not created, install Nysa before installing the board package"
        sys.exit(1)

    path_dict["boards"][name] = {}
    path_dict["boards"][name]["path"] = PLATFORM_PATH
    path_dict["boards"][name]["timestamp"] =timestamp

    f = open(SITE_PATH, "w")
    f.write(json.dumps(path_dict, sort_keys = True, indent = 2, separators=(",", ": ")))
    f.close()


text:
namespace _3.Printing_Triangle
{
    using System;

    /// Print triangle of numbers
    public class Program
    {
        public static void Main()
        {
            int triangleSize = int.Parse(Console.ReadLine());
            TriangleTopPrint(triangleSize);
            TriangleBottomPrint(triangleSize - 1);
        }

        public static void TriangleTopPrint(int triangleSize)
        {
            for (int row = 1; row <= triangleSize; row++)
            {
                for (int col = 1; col <= row; col++)
                {
                    Console.Write(col + " ");
                }

                Console.WriteLine();
            }
        }

        public static void TriangleBottomPrint(int triangleSize)
        {
            for (int row = triangleSize; row >= 1; row--)
            {
                for (int col = 1; col <= row; col++)
                {
                    Console.Write(col + " ");
                }

                Console.WriteLine();
            }
        }
    }
}


text:
package com.izforge.izpack.panels.userinput.console.text;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verifyNoMoreInteractions;

import org.junit.Test;

import com.izforge.izpack.panels.userinput.console.AbstractConsoleFieldTest;
import com.izforge.izpack.panels.userinput.field.TestFieldConfig;
import com.izforge.izpack.panels.userinput.field.text.TextField;

/**
 * Tests the {@link ConsoleTextField}.
 *
 * @author Tim Anderson
 */
public class ConsoleTextFieldTest extends AbstractConsoleFieldTest
{

    /**
     * Tests selection of the default value.
     */
    @Test
    public void testSelectDefaultValue()
    {
        String defaultValue = "default value";
        ConsoleTextField field = createField(defaultValue);
        checkValid(field, "\n");
        assertEquals(defaultValue, installData.getVariable("text"));
        verifyNoMoreInteractions(prompt);
    }

    /**
     * Tests selection of the default value.
     */
    @Test
    public void testSetValue()
    {
        ConsoleTextField field = createField(null);
        String expected = "new value";
        checkValid(field, expected);
        assertEquals(expected, installData.getVariable("text"));
        verifyNoMoreInteractions(prompt);
    }

    /**
     * Creates a new {@link ConsoleTextField}.
     *
     * @param defaultValue the default value. May be {@code null}
     * @return a new field
     */
    private ConsoleTextField createField(String defaultValue)
    {
        TestFieldConfig config = new TestFieldConfig("text");
        config.setLabel("Enter value:");
        config.setDefaultValue(defaultValue);
        return new ConsoleTextField(new TextField(config, installData), console, prompt);
    }
}


text:
module KafkaRest
  module Sender
    class KafkaSender

      @@instance = nil

      class << self
        def instance
          @@instance ||= self.new(Client.new)
        end

        def send!(message)
          instance.send!(message)
        end
      end

      attr_reader :key_schema_cache, :value_schema_cache

      def initialize(client, opts = {})
        @lock = Mutex.new
        @client = client
        @key_schema_cache = {}
        @value_schema_cache = {}
      end

      # TODO: back-off retry if offset[i].errors is a retriable error
      def send!(message)
        send_produce_request!(
          message.topic,
          message.payload,
          message.format,
          build_params(message)
        )
      end

      private

      # replace key and value schemas with
      # their ids if those are found in cache
      def build_params(message)
        return message.params unless message.format == 'avro'

        topic, params, format = message.topic, message.params, message.format

        {}.tap do |_p|
          if format == 'avro'
            if key_schema = params[:key_schema]
              if key_schema_id = @key_schema_cache[topic]
                _p[:key_schema_id] = key_schema_id
              else
                _p[:key_schema] = key_schema
              end
            end

            if value_schema_id = @value_schema_cache[topic]
              _p[:value_schema_id] = value_schema_id
            else
              _p[:value_schema] = params[:value_schema]
            end
          end
        end
      end

      def send_produce_request!(topic, payload, format, params)
        @client.topic_produce_message(topic, payload, format, params).body.tap do |re|
          # this too (line 27)
          cache_schema_ids!(re, topic) if format == 'avro'
        end['offsets']
      end

      def cache_schema_ids!(resp, topic)
        @lock.synchronize do
          if @key_schema_cache[topic].nil? && kid = resp['key_schema_id']
            @key_schema_cache[topic] = kid
          end

          if @value_schema_cache[topic].nil? && vid = resp['value_schema_id']
            @value_schema_cache[topic] = vid
          end
        end
      end
    end
  end
end


text:
<?php

namespace Yosymfony\Spress\Core\ContentManager\Collection;

/**
 * Collection.
 *
 * @author Victor Puertas <vpgugr@gmail.com>
 */
class Collection implements CollectionInterface
{
    private $name;
    private $path;
    private $attributes;

    /**
     * Constructor.
     *
     * @param string $name       The collection's name
     * @param string $path       The collection's relative path
     * @param array  $attributes
     */
    public function __construct($name, $path, array $attributes = [])
    {
        if (is_string($name) === false) {
            throw new \RuntimeException('Expected string as the name of the collection.');
        }

        if (is_string($path) === false) {
            throw new \RuntimeException('Expected string as the path of the collection.');
        }

        $this->name = $name;
        $this->path = $path;
        $this->attributes = $attributes;
    }

    /**
     * @inheritDoc
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @inheritDoc
     */
    public function getAttributes()
    {
        return $this->attributes;
    }

    /**
     * @inheritDoc
     */
    public function getPath()
    {
        return $this->path;
    }
}


text:
package pt.psantos.phd.polarity.propagation.loaders;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.jgrapht.graph.ClassBasedEdgeFactory;
import org.jgrapht.graph.SimpleGraph;
import pt.psantos.phd.polarity.propagation.algorithm.LexicalRelation;
import pt.psantos.phd.polarity.propagation.algorithm.Word;

/**
 * This class represents a triple loader.
 * This loader reads a file of triples and load them as an undirected graph.
 * Each line of the file must be in the format:
 *

 * {@code <word1> <relation_name> <word2>}
 *

 * WHERE
 *

 *
 {@code <word1> and <word2>} are sequence of character with no spaces.

 *
 {@code <relation_name>} are sequence of character with no spaces. It represents
 * a synonym or an antonym relation between {@code <word1> and <word2>}.
 * Valid names are: "syn.*" and "sin.*" for specifying a synonym relation.
 * And the string "ant.*" for specifying an antonym relation.
 * The relation names are case insensitive.

 *

 *
 *

 * Example of a valid file:
 *
{@code
 * # This is a file of triples. Lines starting by # are ignored.
 * bad synonym_of evil
 * bad synonym_of unpleasant
 * bad antonym_of enjoyable
 * god synonym_of pleasant
 * pleasant synonym_of enjoyable
 * }
 *

 *

 *
 * @since 0.6.0
 * @version 0.6.0
 * @author PSantos
 */
public class TriplesLoader {

    /**
     * Allows to ignore lines from file that have self relations. PAPEL contains
     * a few self relations. For instance:
     * {@code ferreiro SINONIMO_N_DE ferreiro}. For building a
     * {@link org.jgrapht.graph.SimpleGraph} from the PAPEL relations we need to
     * ignore "self relations" because this kind of graph does not allow self
     * loops.
     */
    protected boolean ignoreSelfRelations = true;

    /**
     * List of filters that allows to choose what triples are loaded.
     * An empty list means that all the triples should be loaded from file.
     * @see #loadWorker(java.io.File, java.lang.String)
     */
    private List<LoadingFilter> filters = null;

    /**
     * Add a filter that allows to choose the triples to load.
     * If no filter is added, all valid triples will be loaded from file.
     *
     * @param filter a filter that allows to choose the triples to load.
     * @return this object.
     * @see LoadingFilter
     */
    public TriplesLoader addFilter(LoadingFilter filter) {
        if(filters == null) {
            this.filters = new ArrayList<LoadingFilter>();
        }

        filters.add(filter);
        return this;
    }

    public void setIgnoreSelfRelations(boolean ignoreSelfRelations) {
        this.ignoreSelfRelations = ignoreSelfRelations;
    }

    /**
     * Loads a set of triples from file. Each line of the file must be in the
     * form of: {@literal <word1> <RELATION> <word2>}.
     *
     *

     *
Lines starting by "#" are ignored.

     *
Self loops are not allowed (nodes/words pointing to itself).

     *

     *
     * @param file file to load.
     * @param charsetName a charset name or {@code null} to use the default charset.
     * @returna an undirected graph.
     * @throws java.io.FileNotFoundException
     * @throws java.lang.IllegalArgumentException if there are direct loops.
     * This is if there are words pointing to itself.
     */
    public SimpleGraph load(File file, String charsetName) throws FileNotFoundException, IOException {
        return loadWorker(file
                , (charsetName != null ? charsetName : Charset.defaultCharset().name()));
    }

    private SimpleGraph loadWorker(File file, String charsetName) throws FileNotFoundException, IOException {

        SimpleGraph simpleGraph
                = new SimpleGraph<Word, LexicalRelation>(
                        new ClassBasedEdgeFactory<Word, LexicalRelation>(LexicalRelation.class));

        Reader reader = new InputStreamReader(new FileInputStream(file), charsetName);
        BufferedReader br = new BufferedReader(reader);
        String line;
        String[] fields = null;

        while ((line = br.readLine()) != null) {

            // Ignore comments (lines starting by "#")
            if (line.startsWith("#")) {
                continue;
            }

            // Split the triple in fields
            fields = line.split("\\s+");

            // Ignore relations such as: {@code ferreiro SINONIMO_N_DE ferreiro}
            // because the word "ferreiro" is pointing to itself throught the
            // relation "SINONIMO_N_DE" (synonym of).
            if (this.ignoreSelfRelations && fields[0].equals(fields[2])) {
                continue;
            }

            // If we want to filter relations by part of speech
            if(filters != null && !filters.isEmpty()) {
                boolean loadThisTriple = true;
                for(LoadingFilter filter : filters) {
                    // If there is a filter that return false
                    if(!filter.loadThis(fields)) {
                        loadThisTriple = false;
                        break;
                    }
                }
                // If we do not want to load this triple
                if(!loadThisTriple) {
                    continue;
                }
            }

            // Get the relation type
            LexicalRelation.Type relType = relationType(fields[1]);
            // Check the relation type
            if(relType.equals(LexicalRelation.Type.UNKNOWN)) {
                continue; // Unknown relation type. Ignore it.
            }

            // Create two temporary nodes
            Word node1 = new Word(fields[0]);
            Word node2 = new Word(fields[2]);

            // If the graph contains node1
            if (simpleGraph.containsVertex(node1)) {
                // Get all the edges touching node1
                Set<LexicalRelation> edges = simpleGraph.edgesOf(node1);
                // If node1 already exists in the graph
                if (edges != null && !edges.isEmpty()) {
                    // Get the first edge
                    LexicalRelation edge = edges.iterator().next();
                        // Replace the temporary node1 by the node already on the graph.
                    // The temporary node1 and the returned have the word but
                    // are diffrent Java objects.
                    node1 = edge.getNodeSelf(node1);
                }
            }

            // If the graph contains node2
            if (simpleGraph.containsVertex(node2)) {
                Set<LexicalRelation> edges = simpleGraph.edgesOf(node2);
                if (edges != null && !edges.isEmpty()) {
                    LexicalRelation edge = edges.iterator().next();
                    node2 = edge.getNodeSelf(node2);
                }
            }

            simpleGraph.addVertex(node1);
            simpleGraph.addVertex(node2);

            //System.out.println(node1 + " -> " + node2);
            simpleGraph.addEdge(node1, node2
                    , new LexicalRelation(node1, node2, relType));

        } // End while
        return simpleGraph;
    } // End method

    protected LexicalRelation.Type relationType(String relation) {

            relation = relation.toLowerCase();
            LexicalRelation.Type relType = LexicalRelation.Type.UNKNOWN;

            // Check the relation type
            if(relation.startsWith("syn") || relation.startsWith("sin")) {
                relType = LexicalRelation.Type.SYNONYM;
            } else if(relation.startsWith("ant")) {
                relType = LexicalRelation.Type.ANTONYM;
            }

            return relType;
    }
}


text:
<?php

require('init.php');
htmlHeader();

// check solarium version available
echo 'Solarium library version: ' . Solarium_Version::VERSION . ' - ';

// create a client instance
$client = new Solarium_Client($config);

// create a ping query
$ping = $client->createPing();

// execute the ping query
try{
    $result = $client->ping($ping);
    echo 'Ping query successful';
    echo '<br/><pre>';
    var_dump($result->getData());
}catch(Solarium_Exception $e){
    echo 'Ping query failed';
}

htmlFooter();


text:
package org.ohdsi.webapi.estimation.specification;

import java.util.ArrayList;
import java.util.List;
import org.ohdsi.analysis.estimation.design.NegativeControlOutcomeCohortExpression;

/**
 *
 * @author asena5
 */
public class NegativeControlOutcomeCohortExpressionImpl implements NegativeControlOutcomeCohortExpression {
  private String occurrenceType = null;
  private Boolean detectOnDescendants = null;
  private List<String> domains = null;

  /**
   * The type of occurrence of the event when selecting from the domain. The options are \"All\" or \"First\"
   * @return occurrenceType
   **/
  @Override
  public String getOccurrenceType() {
    return occurrenceType;
  }

    /**
     *
     * @param occurrenceType
     */
    public void setOccurrenceType(String occurrenceType) {
    this.occurrenceType = occurrenceType;
  }

  /**
   * When true, descendant concepts for the conceptId will be used to detect the exposure/outcome and roll up the occurrence to the conceptId
   * @return detectOnDescendants
   **/
  @Override
  public Boolean getDetectOnDescendants() {
    return detectOnDescendants;
  }

    /**
     *
     * @param detectOnDescendants
     */
    public void setDetectOnDescendants(Boolean detectOnDescendants) {
    this.detectOnDescendants = detectOnDescendants;
  }

    /**
     *
     * @param domainsItem
     * @return
     */
    public NegativeControlOutcomeCohortExpressionImpl addDomainsItem(String domainsItem) {
    if (this.domains == null) {
      this.domains = new ArrayList<>();
    }
    this.domains.add(domainsItem);
    return this;
  }

  /**
   * Specifies to the domains to use when evaluating negative control events.
   * @return domains
   **/
  @Override
  public List<String> getDomains() {
    return domains;
  }

    /**
     *
     * @param domains
     */
    public void setDomains(List<String> domains) {
    this.domains = domains;
  }
}


text:
package hooks;

import cucumber.api.Scenario;
import cucumber.api.java.After;
import cucumber.api.java.Before;

/**
 * Created by Winiar on 04.06.2017.
 */
public class SomeTestHooks {

    @Before("@manual")
    public void beforeCallingScenario() {
        System.out.println("*********** About to start the scenario.");
    }

    @After("@manual")
    public void afterRunningScenario(Scenario scenario) {
        System.out.println("*********** Just finished running scenario: " + scenario.getStatus());

    }

}


text:
import abc
import datetime
import json
import logging
import os

log = logging.getLogger(__name__)

class CommandChain():
    '''
    Add command to execute on a remote host.

    :param cmd: String, command to execute
    :param rollback: String (optional) a rollback command
    :param stage: String (optional)
    :return:
    '''
    execute_flag = 'execute'
    copy_flag = 'copy'

    def __init__(self, namespace):
        self.commands_stack = []
        self.namespace = namespace

    def add_execute(self, cmd, rollback=None, stage=None):
        assert isinstance(cmd, list) or callable(cmd)
        self.commands_stack.append((self.execute_flag, cmd, rollback, stage))

    def add_copy(self, local_path, remote_path, remote_to_local=False, recursive=False, stage=None):
        self.commands_stack.append((self.copy_flag, local_path, remote_path, remote_to_local, recursive, stage))

    def get_commands(self):
        # Return all commands
        return self.commands_stack

    def prepend_command(self, cmd, rollback=None, stage=None):
        # We can specify a command to be executed before the main chain of commands, for example some setup commands
        assert isinstance(cmd, list)
        self.commands_stack.insert(0, (self.execute_flag, cmd, rollback, stage))

class AbstractSSHLibDelegate(metaclass=abc.ABCMeta):
    @abc.abstractmethod
    def on_update(self, future, callback):
        '''
        A method called on update
        :param future: An instance of asyncio.Future() passed by a callback
        :param callback: should run callback.set_result(True) to indicate that callback was successfully executed
        :return:
        '''
        pass

    @abc.abstractmethod
    def on_done(self, name, result, host_status_count=None, host_status=None):
        '''
        A method called when chain execution is finished
        :param name: A unique chain identifier
        :param result: asyncio.Future().result()
        :param host_status_count: String
        :param host_status: String
        :return:
        '''
        pass

    @abc.abstractmethod
    def prepare_status(self, name, nodes):
        '''
        A method called before executing commands from a chain. Used to prepare status json file.
        :param name: A unique chain identifier
        :param nodes: A list of nodes of type ssh.Node
        :return:
        '''

class JsonDelegate(AbstractSSHLibDelegate):
    def __init__(self, state_dir, targets_len, total_hosts=None, total_masters=None, total_agents=None, **kwargs):
        self.state_dir = state_dir
        self.total_hosts = total_hosts if total_hosts else targets_len
        self.total_masters = total_masters
        self.total_agents = total_agents

    def _update_chain_props(self, status_json, name):
        # Update chain properties. We may update the properties
        if 'hosts' not in status_json:
            status_json['hosts'] = {}

        # Use this hack to update number of total hosts/masters/agent on the fly. This is used on deploy 'retry'.
        if status_json.get('total_hosts') != self.total_hosts:
            status_json['total_hosts'] = self.total_hosts

        if status_json.get('total_masters') != self.total_masters:
            status_json['total_masters'] = self.total_masters

        if status_json.get('total_agents') != self.total_agents:
            status_json['total_agents'] = self.total_agents

        status_json['chain_name'] = name

    def _read_json_state(self, name):
        status_file = os.path.join(self.state_dir, '{}.json'.format(name))
        if os.path.isfile(status_file):
            with open(status_file) as f:
                return json.load(f)
        return {}

    def _dump_json_state(self, name, status_json):
        status_file = os.path.join(self.state_dir, '{}.json'.format(name))

        with open(status_file, 'w') as f:
            try:
                json.dump(status_json, f)
            except IOError:
                log.error('Could not update state file {}'.format(status_file))

    def on_update(self, future, callback_called):
        self._update_json_file(*future.result(), future_update=True, callback_called=callback_called)

    def on_done(self, name, result, host_status=None):
        self._update_json_file(name, result, None, host_status=host_status)

    def _update_json_file(self, name, result, host_object, future_update=None, host_status=None, callback_called=None):
        status_json = self._read_json_state(name)
        self._update_chain_props(status_json, name)

        for host, return_values in result.items():
            # Block is executed for on_update callback
            if future_update:
                return_values.update({
                    'date': str(datetime.datetime.now())
                })

                # Append to commands
                if host in status_json['hosts']:
                    status_json['hosts'][host]['commands'].append(return_values)
                else:
                    status_json['hosts'][host] = {
                        'commands': [return_values]
                    }

                if host_object.tags and 'tags' not in status_json['hosts'][host]:
                    status_json['hosts'][host]['tags'] = host_object.tags

                # Update chain status to running if not other state found or the status is unstarted.
                if ('host_status' not in status_json['hosts'][host] or
                        status_json['hosts'][host]['host_status'] == 'unstarted'):
                    status_json['hosts'][host]['host_status'] = 'running'

        # Update chain status: success or fail
        if host_status:
            status_json['hosts'][host]['host_status'] = host_status

        self._dump_json_state(name, status_json)
        if callback_called:
                callback_called.set_result(True)

    # When the function is invoked the json status file will be populated with a list of nodes passed as a parameter.
    # In this case a node should not be in any state and should just wait to be processed.
    def prepare_status(self, name, nodes):
        assert isinstance(name, str)
        assert isinstance(nodes, list)

        json_status = self._read_json_state(name)

        # if status file already exists we should not proceed.
        if json_status:
            return

        json_status['hosts'] = {}
        for node in nodes:
            ip_port = '{}:{}'.format(node.ip, node.port)
            json_status['hosts'][ip_port] = {}
            json_status['hosts'][ip_port]['commands'] = []
            json_status['hosts'][ip_port]['tags'] = node.tags
            json_status['hosts'][ip_port]['host_status'] = 'unstarted'

        self._dump_json_state(name, json_status)

class SyncCmdDelegate(AbstractSSHLibDelegate):
    """Used for running synchronous commands in CLI or general orchestration
    without a long-running server process
    """
    def on_update(self, future, callback_called):
        chain_name, result_object, host = future.result()
        callback_called.set_result(True)

    def on_done(self, name, result, host_status=None):
        pass

    def prepare_status(self, name, nodes):
        pass


text:
package org.apache.flink.runtime.webmonitor.handlers;

import org.apache.flink.api.common.JobID;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.jobgraph.jsonplan.JsonPlanGenerator;
import org.apache.flink.runtime.rest.handler.HandlerRequest;
import org.apache.flink.runtime.rest.messages.JobPlanInfo;
import org.apache.flink.runtime.webmonitor.testutils.ParameterProgram;

import org.junit.BeforeClass;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/** Tests for the parameter handling of the {@link JarPlanHandler}. */
public class JarPlanHandlerParameterTest
        extends JarHandlerParameterTest<JarPlanRequestBody, JarPlanMessageParameters> {
    private static JarPlanHandler handler;

    @BeforeClass
    public static void setup() throws Exception {
        init();
        handler =
                new JarPlanHandler(
                        gatewayRetriever,
                        timeout,
                        responseHeaders,
                        JarPlanGetHeaders.getInstance(),
                        jarDir,
                        new Configuration(),
                        executor,
                        jobGraph -> {
                            LAST_SUBMITTED_JOB_GRAPH_REFERENCE.set(jobGraph);
                            return new JobPlanInfo(JsonPlanGenerator.generatePlan(jobGraph));
                        });
    }

    @Override
    JarPlanMessageParameters getUnresolvedJarMessageParameters() {
        return handler.getMessageHeaders().getUnresolvedMessageParameters();
    }

    @Override
    JarPlanMessageParameters getJarMessageParameters(ProgramArgsParType programArgsParType) {
        final JarPlanMessageParameters parameters = getUnresolvedJarMessageParameters();
        parameters.entryClassQueryParameter.resolve(
                Collections.singletonList(ParameterProgram.class.getCanonicalName()));
        parameters.parallelismQueryParameter.resolve(Collections.singletonList(PARALLELISM));
        if (programArgsParType == ProgramArgsParType.String
                || programArgsParType == ProgramArgsParType.Both) {
            parameters.programArgsQueryParameter.resolve(
                    Collections.singletonList(String.join(" ", PROG_ARGS)));
        }
        if (programArgsParType == ProgramArgsParType.List
                || programArgsParType == ProgramArgsParType.Both) {
            parameters.programArgQueryParameter.resolve(Arrays.asList(PROG_ARGS));
        }
        return parameters;
    }

    @Override
    JarPlanMessageParameters getWrongJarMessageParameters(ProgramArgsParType programArgsParType) {
        List<String> wrongArgs =
                Arrays.stream(PROG_ARGS).map(a -> a + "wrong").collect(Collectors.toList());
        String argsWrongStr = String.join(" ", wrongArgs);
        final JarPlanMessageParameters parameters = getUnresolvedJarMessageParameters();
        parameters.entryClassQueryParameter.resolve(
                Collections.singletonList("please.dont.run.me"));
        parameters.parallelismQueryParameter.resolve(Collections.singletonList(64));
        if (programArgsParType == ProgramArgsParType.String
                || programArgsParType == ProgramArgsParType.Both) {
            parameters.programArgsQueryParameter.resolve(Collections.singletonList(argsWrongStr));
        }
        if (programArgsParType == ProgramArgsParType.List
                || programArgsParType == ProgramArgsParType.Both) {
            parameters.programArgQueryParameter.resolve(wrongArgs);
        }
        return parameters;
    }

    @Override
    JarPlanRequestBody getDefaultJarRequestBody() {
        return new JarPlanRequestBody();
    }

    @Override
    JarPlanRequestBody getJarRequestBody(ProgramArgsParType programArgsParType) {
        return new JarPlanRequestBody(
                ParameterProgram.class.getCanonicalName(),
                getProgramArgsString(programArgsParType),
                getProgramArgsList(programArgsParType),
                PARALLELISM,
                null);
    }

    @Override
    JarPlanRequestBody getJarRequestBodyWithJobId(JobID jobId) {
        return new JarPlanRequestBody(null, null, null, null, jobId);
    }

    @Override
    void handleRequest(HandlerRequest<JarPlanRequestBody> request) throws Exception {
        handler.handleRequest(request, restfulGateway).get();
    }
}


text:
package savvytodo.model.task;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class DescriptionTest {

    @Test
    public void isValidDescription() {
        // blank description
        assertTrue(Description.isValidDescription("")); // empty string
        assertTrue(Description.isValidDescription(" ")); // spaces only
        assertTrue(Description.isValidDescription("Some optional description")); // some description
    }
}


text:
package myq

import (
	"encoding/json"
	"errors"
	"strconv"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"time"
	"os"
	"net/http/cookiejar"
)

var _Culture string = "en-US"
var _BaseURL = "https://www.myliftmaster.com/"
var _BrandName = "LiftMaster"

// Desired state (ie, I want the door to open)
const (
	desiredState_Closed = 0
	desiredState_Open   = 1
)

type devices []Device
type Device struct {
	// JSON representation
	Gatewayid int `json:"GatewayId"`
	Errorstatus string `json:"ErrorStatus"`
	Errormessage string `json:"ErrorMessage"`
	Lastupdateddatetime time.Time `json:"LastUpdatedDateTime"`
	Gateway string `json:"Gateway"`
	Myqdeviceid int `json:"MyQDeviceId"`
	Imagesource string `json:"Imagesource"`
	Statesince int64 `json:"Statesince"`
	Displaystatesince string `json:"DisplayStatesince"`
	Name string `json:"Name"`
	State string `json:"State"`
	Error bool `json:"Error"`
	Connectserverdeviceid string `json:"ConnectServerDeviceId"`
	Monitoronly bool `json:"MonitorOnly"`
	Lowbattery bool `json:"LowBattery"`
	Sensorerror bool `json:"SensorError"`
	Openerror bool `json:"OpenError"`
	Closeerror bool `json:"CloseError"`
	Disablecontrol bool `json:"DisableControl"`
	Statename string `json:"StateName"`
	Devicetypeid int `json:"DeviceTypeId"`
	Toggleattributename string `json:"ToggleAttributeName"`
	Toggleattributevalue string `json:"ToggleAttributeValue"`
	//  local additions
	location string
}

type triggerStateChangeReturn struct {
	Errormessage string `json:"errormessage"`
}

// There's something odd about this JSON structure. I don't understand
// why PlacesList needs to be a structure, rather than just a type
// []Places.  As a workaround, I've defined two structures, the actual
// JSON->Go representation, and a "shadow" type (type places) to allow range()
// operations to work as expected.  getAllGateways() converts from one
// to the other.
type placeList struct {		// This is the JSON representation
	P []struct {
		Gatewayid int `json:"GatewayId"`
		Name string `json:"Name"`
		Connectserverid string `json:"ConnectServerId"`
		Devicelist string `json:"DeviceList"`
		Isdetonator bool `json:"IsDetonator"`
	}  `json:"Placeslist"`
}
type places map[int]place // Local mapping of PlacesList
type place struct {
	Gatewayid int `json:"GatewayId"`
	Name string `json:"Name"`
	Connectserverid string `json:"ConnectServerId"`
	Devicelist string `json:"DeviceList"`
	Isdetonator bool `json:"IsDetonator"`
}

type MyQ struct {
	c http.Client
	devices devices
	locations places
	debug bool
	machineReadable bool
}

// Helpers

func (m *MyQ) debugf(format string, a ...interface{}) (n int, err error) {
	if m.debug {
		format = "# " + format
		return fmt.Fprintf(os.Stderr, format, a...)
	}
	return 0, nil
}

// Do a HTTPS GET and parse the JSON response
func (m *MyQ) doGet(rawurl string, v url.Values, s interface{}) (err error) {
	var r []byte
	var res *http.Response

	u, _ := url.Parse(rawurl)
	u.RawQuery = v.Encode()
	m.debugf("doGet():  URL -  %s\n", u.String())

	t := time.Now()
	if res, err = m.c.Get(u.String()); err != nil {
		m.debugf("Get() failed: %s\n", err)
		return err
	}
	d := time.Since(t)
	m.debugf("   HTTP Response: %s, in %s\n", res.Status, d)
	if res.StatusCode != http.StatusOK {
		return errors.New(res.Status)
	}
	r, err = ioutil.ReadAll(res.Body)
	res.Body.Close()

	if err != nil {
		m.debugf("ReadAll() failed: %s\n", err)
		return err
	}
	return json.Unmarshal(r, &s)
}

// Do a HTTPS POST and unmarshal the JSON result, if we're expecting a result (ie, s != nil)
func (m *MyQ) doPost(rawurl string, v url.Values, s interface{}) (err error) {
	var res *http.Response

	if m.debug {
		u, _ := url.Parse(rawurl)
		u.RawQuery = v.Encode()
		m.debugf("doPost(): URL - %s\n", u)
	}
	t := time.Now()
	if res, err = m.c.PostForm(rawurl, v); err != nil {
		m.debugf("Post() failed: %s\n", err)
		return err
	}
	d := time.Since(t)
	m.debugf("   HTTP Response: %s, in %s\n", res.Status, d)
	if res.StatusCode != http.StatusOK {
		return fmt.Errorf("HTTP Error: %s", res.Status)
	}

	r, err := ioutil.ReadAll(res.Body)
	res.Body.Close()

	if s != nil {
		return json.Unmarshal(r, &s)
	}
	return nil
}

// Functions to handle type place
func (p *place) print(machinereadable bool) string {
	if machinereadable {
	return fmt.Sprintf("%s,%d", p.Name, p.Gatewayid)
	}
	return fmt.Sprintf("%s (ID %d)", p.Name, p.Gatewayid)
}

func (p *place) string() string {
	return p.print(false)
}

// Functions to handle type Device
func (d Device) print(machinereadable bool) string {
	var s string

	d.Lastupdateddatetime = d.Lastupdateddatetime.Local()
	if machinereadable {
		s = fmt.Sprintf("%s,%s,%d,%s,%d,%s,%s", d.Name, d.location,
			d.Myqdeviceid, d.Statename,
			d.Lastupdateddatetime.Unix(), d.Errorstatus,
			d.Errormessage)
		if d.Monitoronly {
			s += ",Monitor"
		}
		if d.Lowbattery {
			s += ",LowBat"
		}
		if d.Sensorerror {
			s += ",SensorErr"
		}
		if d.Openerror {
			s += ",OpenErr"
		}
		if d.Closeerror {
			s += ",CloseErr"
		}
		if d.Disablecontrol {
			s += ",Disabled"
		}
	} else {
		s = fmt.Sprintf("%s at %s is %s since %v",
			d.Name, d.location, d.Statename,
			d.Lastupdateddatetime.Format(time.Stamp))
		if d.Error {
			s += fmt.Sprintf(", ERROR: status = %s, message = %s",
				d.Errorstatus, d.Errormessage)
		}
		if d.Monitoronly {
			s += ",Monitor Only"
		}
		if d.Lowbattery {
			s += ", LowBat"
		}
		if d.Sensorerror {
			s += ", Sensor Error"
		}
		if d.Openerror {
			s += ", Open Error"
		}
		if d.Closeerror {
			s += ", Close Error"
		}
		if d.Disablecontrol {
			s += ", Control disabled"
		}
	}
	return s
}

func (d Device) String() string {
	return d.print(false)
}

// MyQ REST API
func (m *MyQ) getAllGateways() (err error) {
	var j placeList

	// The only option is a current timestamp in ms
	v := url.Values{}
	v.Add("_", strconv.FormatInt(time.Now().UnixNano()/1000000, 10))
	if err = m.doGet(_BaseURL + "Gateway/GetAllGateways", v, &j);
	err != nil {
		return err
	}

	// Convert the JSON array to a map
	m.locations = make(places)
	for _, p := range(j.P) {
		m.locations[p.Gatewayid] = p
	}

	return err
}

func (m *MyQ) getAllDevices() (err error) {
	var d devices

	if err = m.getAllGateways(); err != nil {
		return err
	}

	v := url.Values{}
	v.Add("culture", _Culture)
	v.Add("brandName", _BrandName)
	if err = m.doGet(_BaseURL + "api/MyQDevices/GetAllDevices", v, &d);
	err != nil {
		return err
	}

	// Fixup the json decoding.  This isn't an issue with the Go
	// JSON parser but rather bugs/implementation details in the
	// MyQ service (from what I can tell).
	for i, x := range(d) {
		// Set the location for each device
		d[i].location = m.locations[x.Gatewayid].Name
		// Fix unknown doorstates
		if d[i].Statename == "" {
			d[i].Statename = "Unknown"
		}
	}

	m.devices = d
	return nil
}

func (m *MyQ) setDoorState(d Device, desiredstate int) (err error) {
	var t triggerStateChangeReturn

	m.debugf("SetDoorState: desiredstate = %d\n", desiredstate)
	if desiredstate != desiredState_Open &&
	   desiredstate != desiredState_Closed {
		return errors.New("Invalid door state")
	}

	v := url.Values{}
	v.Add("myQDeviceId", strconv.Itoa(d.Myqdeviceid))
	v.Add("attributename", "desireddoorstate")
	v.Add("attributevalue", strconv.Itoa(desiredstate))

	err = m.doPost(_BaseURL + "Device/TriggerStateChange", v, t)
	if t.Errormessage != "" {
		return errors.New(t.Errormessage)
	}
	return err
}

func (m *MyQ) login(username string, password string) (err error) {

	v := url.Values{}
	v.Add("Email", username)
	v.Add("Password", password)

	if m.c.Jar, err = cookiejar.New(nil); err != nil {
		return fmt.Errorf("login(): Can't create CookieJar: %s", err)
	}
	m.c.Timeout = 60 * time.Second

	if  err = m.doPost(_BaseURL, v, nil); err != nil {
		return fmt.Errorf("Post() failed: %s\n", err)
	}
	return nil
}

////////////////////////////////////////////////////////////////////////////
// Public API

// Create a new MyQ Session
func (m *MyQ) New(username string, password string, debug bool,
	machineReadable bool) (err error) {
	m.debug = debug
	m.machineReadable = machineReadable

	if err = m.login(username, password); err != nil {
		m.debugf("login error: %s", err)
		return errors.New("Login failed")
	}

	if err = m.getAllDevices(); err != nil {
		m.debugf("getAllDevices() error: %s", err)
		return errors.New("Can't get device list")
	}

	return err
}

// Find a device/door by its name
func (m *MyQ) FindDoorByName(name string) (d Device, err error) {
	for _, d = range m.devices {
		if d.Name == name {
			return d, nil
		}
	}
	return d, fmt.Errorf("Device named '%s' not found", name)
}

// Show all devices/doors
func (m *MyQ) ShowDoors() {
	for _, d := range m.devices {
		fmt.Println(d.print(m.machineReadable))
	}
}

// Show all locations associated with this MyQ account
func (m *MyQ) ShowLocations() {
	for _, x := range m.locations {
		fmt.Println(x.print(m.machineReadable))
	}
}

// Show details & current state for a specific door/device
func (m *MyQ) DoorDetails(d Device){
	fmt.Println(d.print(m.machineReadable))
}

// Show the state (open, closed, ... ) of a specfic door/device
func (m *MyQ) GetState(d Device) {
	fmt.Println(d.Statename)
}

// Open a specific door/device
func (m *MyQ) Open(d Device) error {
	if d.Statename == "Open" {
		return errors.New("Door is already open")
	} else if d.Statename != "Closed" {
		return fmt.Errorf("Can't open, door is currently %s",
			d.Statename)
	}
	return m.setDoorState(d, desiredState_Open)
}

// Close a specific door/device
func (m *MyQ) Close(d Device) error {
	if d.Statename == "Closed" {
		return errors.New("Door already closed")
	} else if d.Statename != "Open" {
		return fmt.Errorf("Can't close, door is currently %s",
			d.Statename)
	}
	return m.setDoorState(d, desiredState_Closed)
}

// Show devices currently in state /state/ (Open, Closed, ... )
func (m *MyQ) ShowByState(state string) {
	for _, d := range m.devices {
		if d.Statename == state {
			fmt.Println(d.print(m.machineReadable))
		}
	}
}


text:
include_recipe 'apt::default' # http://stackoverflow.com/questions/15080876/apt-get-update-and-apt-get-upgrade-in-chef
include_recipe 'chef-client::default'
include_recipe 'bcs_network::default'
package 'nano'
timezone node['tz']
include_recipe 'bcs_locale::default'
include_recipe 'git::default'

git_config 'color' do
  key 'color.ui'
  value 'auto'
end

include_recipe 'ntp::default'


text:
NSException* FLLogTestException(NSException* ex) {

    id logger = [[FLTestLoggingManager instance] logger];

    [logger appendLineWithFormat:[ex.error description]];

//    [ appendLineWithFormat logObject:ex];
    return ex;
}