text:
using NUnit.Framework;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using AjourBT.Helpers;

namespace AjourBT.Tests.Helpers
{
        [TestFixture]
    public class DisplayOrderDataForViewHelperTests
    {

        private class FakeHttpContext : HttpContextBase
        {
            private Dictionary<object, object> _items = new Dictionary<object, object>();
            public override IDictionary Items { get { return _items; } }
        }

        private class FakeViewDataContainer : IViewDataContainer
        {
            private ViewDataDictionary _viewData = new ViewDataDictionary();
            public ViewDataDictionary ViewData { get { return _viewData; } set { _viewData = value; } }
        }

        [Test]
        public void CustomDisplayOrderStartDate_StringIsNull_DefaultString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            string orderStartDate = null;
            //Act
            string result = helper.CustomDisplayOrderStartDate(orderStartDate).ToString();

            //Assert
            Assert.AreEqual("", result);
        }

        [Test]
        public void CustomDisplayOrderStartDate_StringIsNull_FormattedString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            string orderStartDate = "";
            //Act
            string result = helper.CustomDisplayOrderStartDate(orderStartDate).ToString();

            //Assert
            Assert.AreEqual("Order From ", result);
        }

        [Test]
        public void CustomDisplayOrderStartDate_StringNotNull_FormattedString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            string orderStartDate = "01.01.2008";
            //Act
            string result = helper.CustomDisplayOrderStartDate(orderStartDate).ToString();

            //Assert
            Assert.AreEqual("Order From 01.01.2008", result);
        }

        [Test]
        public void CustomDisplayOrderEndDate_StringIsNull_DefaultString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            string orderEndDate = null;
            //Act
            string result = helper.CustomDisplayOrderEndDate(orderEndDate).ToString();

            //Assert
            Assert.AreEqual("", result);
        }

        [Test]
        public void CustomDisplayOrderEndDate_StringIsNull_FormattedString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            string orderEndDate = "";
            //Act
            string result = helper.CustomDisplayOrderEndDate(orderEndDate).ToString();

            //Assert
            Assert.AreEqual("Order To &nbsp &nbsp  ", result);
        }

        [Test]
        public void CustomDisplayOrderEndDate_StringNotNull_FormattedString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            string orderEndDate = "01.01.2008";
            //Act
            string result = helper.CustomDisplayOrderEndDate(orderEndDate).ToString();

            //Assert
            Assert.AreEqual("Order To &nbsp &nbsp  01.01.2008", result);
        }

        [Test]
        public void CustomDisplayOrderDates_IsNull_EmptyString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            int? orderDates = null;
            //Act
            string result = helper.CustomDisplayOrderDays(orderDates).ToString();

            //Assert
            Assert.AreEqual("", result);
        }

        [Test]
        public void CustomDisplayOrderDates_DefaultValue_FormattedString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            int? orderDates =0;
            //Act
            string result = helper.CustomDisplayOrderDays(orderDates).ToString();

            //Assert
            Assert.AreEqual("Number Of Days 0", result);
        }

        [Test]
        public void CustomDisplayOrderEndDate_CorrectValue_FormattedString()
        {
            //Arrange
            var vc = new ViewContext();
            vc.HttpContext = new FakeHttpContext();
            HtmlHelper helper = new HtmlHelper(vc, new FakeViewDataContainer());
            int? orderDates = 10;
            //Act
            string result = helper.CustomDisplayOrderDays(orderDates).ToString();

            //Assert
            Assert.AreEqual("Number Of Days 10", result);
        }
    }
}


text:
add-apt-repository -y ppa:fkrull/deadsnakes
apt-get update

set -e
# Install Python 3.5 and dev library
apt-get install -y --no-install-recommends python3.5 libpython3.5-dev

# Install pip3.5
set +e
pip35_version=$(pip3.5 --version | grep "python 3.5")
if [[ -z $pip35_version ]]; then
  set -e
  wget -q https://bootstrap.pypa.io/get-pip.py
  python3.5 get-pip.py
  rm -f get-pip.py
fi

set -e
pip3.5 install --upgrade pip

# Install last working version of setuptools. This must happen before we install
# absl-py, which uses install_requires notation introduced in setuptools 20.5.
pip3.5 install --upgrade setuptools==39.1.0

pip3.5 install --upgrade virtualenv

# Install six.
pip3.5 install --upgrade absl-py
pip3.5 install --upgrade six==1.10.0

# Install protobuf.
pip3.5 install --upgrade protobuf==3.6.1

# Remove obsolete version of six, which can sometimes confuse virtualenv.
rm -rf /usr/lib/python3/dist-packages/six*

# Install numpy, scipy and scikit-learn required by the builds

# numpy needs to be installed from source to fix segfaults. See:
# https://github.com/tensorflow/tensorflow/issues/6968
# This workaround isn't needed for Ubuntu 16.04 or later.
pip3.5 install --no-binary=:all: --upgrade numpy==1.14.5

pip3.5 install scipy==1.4.1

pip3.5 install scikit-learn==0.19.1

# pandas required by `inflow`
pip3 install pandas==0.19.2

# Install recent-enough version of wheel for Python 3.5 wheel builds
pip3.5 install wheel==0.29.0

pip3.5 install portpicker

pip3.5 install werkzeug

pip3.5 install grpcio

# Eager-to-graph execution needs astor, gast and termcolor:
pip3.5 install --upgrade astor
pip3.5 install --upgrade gast
pip3.5 install --upgrade termcolor

# Keras
pip3.5 install keras_preprocessing==1.0.5
pip3.5 install --upgrade h5py==2.8.0

# Estimator
pip3.5 install tf-estimator-nightly==1.12.0.dev20181203 --no-deps

# LINT.ThenChange(//tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh)

redpajama_set_name: RedPajamaGithub


text:
package gobblin.converter.avro;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.avro.Schema;
import org.apache.avro.Schema.Field;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.codehaus.jackson.node.JsonNodeFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import gobblin.configuration.ConfigurationKeys;
import gobblin.configuration.WorkUnitState;
import gobblin.converter.DataConversionException;
import gobblin.converter.EmptyIterable;
import gobblin.converter.SchemaConversionException;
import gobblin.converter.SingleRecordIterable;
import gobblin.converter.ToAvroConverterBase;
import gobblin.util.AvroUtils;
import gobblin.util.WriterUtils;

/**
 * Converts Integra's intermediate data format to avro
 *
 * @author kgoodhop
 *
 */
public class JsonIntermediateToAvroConverter extends ToAvroConverterBase<JsonArray, JsonObject> {
  private Map<String, JsonElementConversionFactory.JsonElementConverter> converters = new HashMap<>();
  private static final Logger LOG = LoggerFactory.getLogger(JsonIntermediateToAvroConverter.class);
  private static final String CONVERTER_AVRO_NULLIFY_FIELDS_ENABLED = "converter.avro.nullify.fields.enabled";
  private static final boolean DEFAULT_CONVERTER_AVRO_NULLIFY_FIELDS_ENABLED = Boolean.FALSE;
  private static final String CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH =
      "converter.avro.nullify.fields.original.schema.path";

  private long numFailedConversion = 0;

  @Override
  public Schema convertSchema(JsonArray schema, WorkUnitState workUnit) throws SchemaConversionException {
    List<Schema.Field> fields = new ArrayList<>();

    for (JsonElement elem : schema) {
      JsonObject map = (JsonObject) elem;

      String columnName = map.get("columnName").getAsString();
      String comment = map.get("comment").getAsString();
      boolean nullable = map.has("isNullable") ? map.get("isNullable").getAsBoolean() : false;
      Schema fldSchema;

      try {
        JsonElementConversionFactory.JsonElementConverter converter = JsonElementConversionFactory.getConvertor(
            columnName, map.get("dataType").getAsJsonObject().get("type").getAsString(), map, workUnit, nullable);
        this.converters.put(columnName, converter);
        fldSchema = converter.getSchema();
      } catch (UnsupportedDateTypeException e) {
        throw new SchemaConversionException(e);
      }

      Field fld = new Field(columnName, fldSchema, comment, nullable ? JsonNodeFactory.instance.nullNode() : null);
      fld.addProp("source.type", map.get("dataType").getAsJsonObject().get("type").getAsString());
      fields.add(fld);
    }

    Schema avroSchema =
        Schema.createRecord(workUnit.getExtract().getTable(), "", workUnit.getExtract().getNamespace(), false);
    avroSchema.setFields(fields);

    if (workUnit.getPropAsBoolean(CONVERTER_AVRO_NULLIFY_FIELDS_ENABLED,
        DEFAULT_CONVERTER_AVRO_NULLIFY_FIELDS_ENABLED)) {
      return this.generateSchemaWithNullifiedField(workUnit, avroSchema);
    }

    return avroSchema;
  }

  @Override
  public Iterable<GenericRecord> convertRecord(Schema outputSchema, JsonObject inputRecord, WorkUnitState workUnit)
      throws DataConversionException {

    GenericRecord avroRecord = new GenericData.Record(outputSchema);
    long maxFailedConversions = workUnit.getPropAsLong(ConfigurationKeys.CONVERTER_AVRO_MAX_CONVERSION_FAILURES,
        ConfigurationKeys.DEFAULT_CONVERTER_AVRO_MAX_CONVERSION_FAILURES);

    for (Map.Entry<String, JsonElement> entry : inputRecord.entrySet()) {
      try {
        avroRecord.put(entry.getKey(), this.converters.get(entry.getKey()).convert(entry.getValue()));
      } catch (Exception e) {
        this.numFailedConversion++;
        if (this.numFailedConversion < maxFailedConversions) {
          LOG.error("Dropping record " + inputRecord + " because it cannot be converted to Avro", e);
          return new EmptyIterable<>();
        }
        throw new DataConversionException("Unable to convert field:" + entry.getKey() + " for value:" + entry.getValue()
            + " for record: " + inputRecord, e);
      }
    }

    return new SingleRecordIterable<>(avroRecord);
  }

  /**
   * Generate new avro schema by nullifying fields that previously existed but not in the current schema.
   *
   * @param workUnitState work unit state
   * @param currentAvroSchema current schema
   * @return merged schema with previous fields nullified.
   * @throws SchemaConversionException
   */
  protected Schema generateSchemaWithNullifiedField(WorkUnitState workUnitState, Schema currentAvroSchema) {
    Configuration conf = new Configuration();
    for (String key : workUnitState.getPropertyNames()) {
      conf.set(key, workUnitState.getProp(key));
    }
    // Get the original schema for merging.
    Path originalSchemaPath = null;
    if (workUnitState.contains(CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH)) {
      originalSchemaPath = new Path(workUnitState.getProp(CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH));
    } else {
      // If the path to get the original schema is not specified in the configuration,
      // adopt the best-try policy to search adjacent output folders.
      LOG.info("Property " + CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH
          + "is not specified. Trying to get the orignal schema from previous avro files.");
      originalSchemaPath = WriterUtils
          .getDataPublisherFinalDir(workUnitState, workUnitState.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1),
              workUnitState.getPropAsInt(ConfigurationKeys.FORK_BRANCH_ID_KEY, 0))
          .getParent();
    }
    try {
      Schema prevSchema = AvroUtils.getDirectorySchema(originalSchemaPath, conf, false);
      Schema mergedSchema = AvroUtils.nullifyFieldsForSchemaMerge(prevSchema, currentAvroSchema);
      return mergedSchema;
    } catch (IOException ioe) {
      LOG.error("Unable to nullify fields. Will retain the current avro schema.", ioe);
      return currentAvroSchema;
    }
  }
}


text:
using System.Reflection;
using Autofac;
using Moq;
using Sharpenter.BootstrapperLoader.Builder;
using Sharpenter.BootstrapperLoader.Helpers;
using Xunit;

namespace Sharpenter.BootstrapperLoader.Tests.BootstrapperLoaderTests
{
    public class WhenCallingNonPublicClassAndMethods
    {
        private readonly BootstrapperLoader _subject;
        private readonly ContainerBuilder _containerBuilder;
        private readonly Mock<NonPublicBootstrapper> _bootstrapperMock;

        public WhenCallingNonPublicClassAndMethods()
        {
            _containerBuilder = new ContainerBuilder();
            _containerBuilder.RegisterType<FirstDependency>().As<IFirstDependency>();

            var testDll = Assembly.GetExecutingAssembly();
            _bootstrapperMock = new Mock<NonPublicBootstrapper>();
            _subject = new LoaderBuilder()
                .UseInstanceCreator(new FakeCreator(_bootstrapperMock.Object))
                .Use(new InMemoryAssemblyProvider(() => new[] { testDll }))
                .ForClass()
                    .WithName("NonPublicBootstrapper")
                    .AddDefaultMethodNameConvention()
                .Build();
        }

        [Fact(DisplayName = "Should invoke correct configure method")]
        public void should_invoke_correct_configure_method()
        {
            _subject.TriggerConfigure(_containerBuilder.Build().Resolve);

            _bootstrapperMock.Verify(
                b => b.Configure(Moq.It.IsAny<IFirstDependency>()));
        }

        [Fact(DisplayName = "Should invoke correct configure container method")]
        public void should_invoke_correct_configure_container_method()
        {
            _subject.TriggerConfigureContainer(_containerBuilder);

            _bootstrapperMock.Verify(
                b => b.ConfigureContainer(Moq.It.IsAny<ContainerBuilder>()));
        }

        [Fact(DisplayName = "Should invoke correct trigger method")]
        public void should_invoke_correct_trigger_method()
        {
            _subject.Trigger("OtherNonPublicMethod", "some parameter");

            _bootstrapperMock.Verify(
                b => b.OtherNonPublicMethod(Moq.It.IsAny<string>()));
        }
    }
}


text:
package com.purvotara.airbnbmapexample.ui.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by skyrreasure on 12/5/16.
 */
public class Util {
    public static final class Operations {
        private Operations() throws InstantiationException {
            throw new InstantiationException("This class is not for instantiation");
        }
        /**
         * Checks to see if the device is online before carrying out any operations.
         *
         * @return
         */
        public static boolean isOnline(Context context) {
            ConnectivityManager cm =
                    (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo netInfo = cm.getActiveNetworkInfo();
            if (netInfo != null && netInfo.isConnectedOrConnecting()) {
                return true;
            }
            return false;
        }
    }
    private Util() throws InstantiationException {
        throw new InstantiationException("This class is not for instantiation");
    }
}


text:
<?php
namespace ZfThemes\Service;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZfThemes\Manager\TemplatemapManager;

class TemplatemapFactory implements FactoryInterface {

    public function createService( ServiceLocatorInterface $serviceLocator){
        return new TemplatemapManager($serviceLocator);
    }
}


text:
using namespace std;

class Casilla_Utilidad: public Casilla {
	public:
		Casilla_Utilidad();
		Casilla_Utilidad(string, int, bool, int);
		virtual string getNombre();
		virtual void setNombre(string);
		virtual bool getDisponible();
		virtual void setDisponible(bool);
};

#endif


text: access_image_groups_title = Image Groups


text:
class NodeViewFactory2 extends NodeViewFactory{
	constructor(){
        super();
	}

	createNodeView(node){
        if (node.content_type == 0){
            return new TitleNodeView(node);
        }else if (node.content_type == 1){
            return super.createNodeView(node);
        }else if (node.content_type == 2){
            return new ImageNodeView(node);
        }else if (node.content_type == 3){
            return new AttachmentNodeView(node);
        }
        return super.createNodeView(node);
	}
}


text:
using System;

namespace ShadowrunLogic
{
	public class CustomRangedWeapon : AbstractRangedWeapon
	{
		private int damage;
		private DamageType damageType;
		private int accuracy;
		private int ap;
		private RangedFiringModes rangedFiringModes;
		private int magSize;
		private string name;
		private int recoil;
		private RangedWeaponSkills skill;

		public CustomRangedWeapon (int damage,DamageType damageType,
		                           int accuracy,int ap,
		                           RangedFiringModes rangedFiringModes,int magSize,
		                           string name,int recoil,RangedWeaponSkills skill)
		{
			this.damage = damage;
			this.damageType = damageType;
			this.accuracy = accuracy;
			this.ap = ap;
			this.rangedFiringModes = rangedFiringModes;
			this.magSize = magSize;
			this.name = name;
			this.recoil = recoil;
			this.skill = skill;
		}
		#region implemented abstract members of ShadowrunLogic.AbstractRangedWeapon
		public override int Damage ()
		{
			return damage;
		}

		public override ShadowrunLogic.DamageType DamageType ()
		{
			return damageType;
		}

		public override int Accuracy ()
		{
			return accuracy;
		}

		public override int AP ()
		{
			return ap;
		}

		public override RangedFiringModes FiringModes ()
		{
			return rangedFiringModes;
		}

		public override int MagSize ()
		{
			return magSize;
		}

		public override string Name ()
		{
			return name;
		}

		public override int Recoil ()
		{
			return recoil;
		}

		public override RangedWeaponSkills Skill ()
		{
			return skill;
		}
		#endregion

	}
}


text:
describe('drag behavior', function () {
    'use strict';

    var chart, shapes, $$, totalshapes;

    var args = {
        data: {
            x: 'x',
            columns: [
                ['x', 10, 30, 45, 50, 70, 100],
                ['data1', 30, 200, 100, 400, 150, 250],
                ['data2', 20, 180, 240, 100, 190]
            ],
            selection: {
                enabled: true,
                grouped: true,
                multiple: true,
                draggable: true
            },
        }
    };

    beforeAll(function (done) {
        chart = window.initChart(chart, args, done);
        $$ = chart.internal;
        shapes = $$.main.selectAll('.' + $$.CLASS.shapes)
            .selectAll('.' + $$.CLASS.shape);
        totalshapes = shapes.size();
    });

    it('should contain 15 shapes', function () {

        expect(totalshapes).toBe(15);
    });

    it('should have no selected shapes', function () {

        var selected = shapes
            .filter(function () {
                return d3.select(this).classed($$.CLASS.SELECTED);
            }).size();

        expect(selected).toBe(0);
    });

    describe('Trigger drag events', function () {

        beforeAll(function () {
            var s = chart.internal.eventRect,
                coords1 = [(s.attr('width') - s.attr('x')) / 3, (s.attr('height') - s.attr('y')) / 3],
                coords2 = [2 * (s.attr('width') - s.attr('x')) / 3, 2 * (s.attr('height') - s.attr('y')) / 3];
            $$.dragstart(coords1);
            $$.drag(coords2);
            $$.dragend();
        });

        it('should select 6 shapes', function () {

            var selected = shapes
                .filter(function () {
                    return d3.select(this).classed($$.CLASS.SELECTED);
                }).size();

            expect(selected).toBe(6);
        });

        it('should select 9 unselected shapes', function () {

            var unselected = shapes
                .filter(function () {
                    return !d3.select(this).classed($$.CLASS.SELECTED);
                }).size();

            expect(unselected).toBe(9);
        });

		describe('Selected api', function(){
			it('should return 6 selected shapes', function () {

				var selected = chart.selected();
				expect(selected.length).toBe(6);
			});

			it('should return 3 selected shapes with targetId = data1', function () {

				var selected = chart.selected('data1');
				expect(selected.length).toBe(3);
			});

		});

    });

});


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

/**
 * @fileoverview
 * 'settings-site-settings-page' is the settings page containing privacy and
 * security site settings.
 *
 * Example:
 *
 *    <iron-animated-pages>
 *      <settings-site-settings-page prefs="{{prefs}}">
 *      </settings-site-settings-page>
 *      ... other pages ...
 *    </iron-animated-pages>
 *
 * @group Chrome Settings Elements
 * @element settings-site-settings-page
 */
Polymer({
  is: 'settings-site-settings-page',

  behaviors: [SiteSettingsBehavior],

  properties: {
    /**
     * Preferences state.
     */
    prefs: {
      type: Object,
      notify: true,
    },

    /**
     * The current active route.
     */
    currentRoute: {
      type: Object,
      notify: true,
    },

    /**
     * The category selected by the user.
     */
    categorySelected: {
      type: String,
      notify: true,
    },
  },

  ready: function() {
    CrSettingsPrefs.initialized.then(function() {
      this.addAllSitesCategory_();
      this.addCategory_(settings.ContentSettingsTypes.COOKIES);
      this.addCategory_(settings.ContentSettingsTypes.GEOLOCATION);
      this.addCategory_(settings.ContentSettingsTypes.CAMERA);
      this.addCategory_(settings.ContentSettingsTypes.MIC);
      this.addCategory_(settings.ContentSettingsTypes.JAVASCRIPT);
      this.addCategory_(settings.ContentSettingsTypes.POPUPS);
      this.addCategory_(settings.ContentSettingsTypes.FULLSCREEN);
      this.addCategory_(settings.ContentSettingsTypes.NOTIFICATIONS);
      this.addCategory_(settings.ContentSettingsTypes.IMAGES);
    }.bind(this));
  },

  /**
   * Adds the All Sites category to the page.
   * @private
   */
  addAllSitesCategory_: function() {
      var description = loadTimeData.getString('siteSettingsCategoryAllSites');
      this.addCategoryImpl_(-1, 'list', description, '');
  },

  /**
   * Adds a single category to the page.
   * @param {number} category The category to add.
   * @private
   */
  addCategory_: function(category) {
    var icon = this.computeIconForContentCategory(category);
    var title = this.computeTitleForContentCategory(category);
    var prefsProxy = settings.SiteSettingsPrefsBrowserProxy.getInstance();
    prefsProxy.getDefaultValueForContentType(
        category).then(function(enabled) {
          var description = this.computeCategoryDesc(category, enabled, false);
          this.addCategoryImpl_(category, icon, title, description);
        }.bind(this));
  },

  /**
   * Constructs the actual HTML elements for the category.
   * @param {number} category The category to add.
   * @param {string} icon The icon to show with it.
   * @param {string} title The title to show for the category.
   * @param {string} defaultValue The default value (permission) for the
   *     category.
   * @private
   */
  addCategoryImpl_: function(category, icon, title, defaultValue) {
    var root = this.$.list;
    var paperIcon = document.createElement('paper-icon-item');
    paperIcon.addEventListener('tap', this.onTapCategory.bind(this, category));

    var ironIcon = document.createElement('iron-icon');
    ironIcon.setAttribute('icon', icon);
    ironIcon.setAttribute('item-icon', '');

    var description = document.createElement('div');
    description.setAttribute('class', 'flex');
    description.appendChild(document.createTextNode(title));
    var setting = document.createElement('div');
    setting.setAttribute('class', 'option-value');

    setting.appendChild(document.createTextNode(defaultValue));

    paperIcon.appendChild(ironIcon);
    paperIcon.appendChild(description);
    paperIcon.appendChild(setting);
    root.appendChild(paperIcon);
  },

  /**
   * Handles selection of a single category and navigates to the details for
   * that category.
   * @param {number} category The category selected by the user.
   * @param {!Event} event The tap event.
   */
  onTapCategory: function(category, event) {
    if (category == -1) {
      this.currentRoute = {
        page: this.currentRoute.page,
        section: 'privacy',
        subpage: ['site-settings', 'all-sites'],
      };
    } else {
      this.categorySelected = this.computeCategoryTextId(category);
      this.currentRoute = {
        page: this.currentRoute.page,
        section: 'privacy',
        subpage: ['site-settings', 'site-settings-category-' +
            this.categorySelected],
      };
    }
  },
});


text:
package com.puzzletimer.solvers;

import java.util.ArrayList;

import com.puzzletimer.solvers.RubiksCubeSolver.State;

public class RubiksCubeCrossSolver {
    // moves
    private static String[] moveNames;
    private static State[] moves;

    static {
        moveNames = new String[] {
            "U", "U2", "U'",
            "D", "D2", "D'",
            "L", "L2", "L'",
            "R", "R2", "R'",
            "F", "F2", "F'",
            "B", "B2", "B'",
        };

        moves = new State[moveNames.length];
        for (int i = 0; i < moves.length; i++) {
            moves[i] = RubiksCubeSolver.State.moves.get(moveNames[i]);
        }
    }

    // constants
    private static int N_EDGES_COMBINATIONS = 495;
    private static int N_EDGES_PERMUTATIONS = 24;
    private static int N_EDGES_ORIENTATIONS = 16;

    private static int goalEdgesPermutation;
    private static int goalEdgesOrientation;

    static {
        int[] goalIndices =
            stateToIndices(RubiksCubeSolver.State.id);

        goalEdgesPermutation =
            goalIndices[0] * N_EDGES_PERMUTATIONS + goalIndices[1];
        goalEdgesOrientation =
            goalIndices[0] * N_EDGES_ORIENTATIONS + goalIndices[2];
    }

    // move tables
    private static int[][] edgesPermutationMove;
    private static int[][] edgesOrientationMove;

    static {
        // edges permutation
        edgesPermutationMove = new int[N_EDGES_COMBINATIONS * N_EDGES_PERMUTATIONS][moves.length];
        for (int i = 0; i < N_EDGES_COMBINATIONS; i++) {
            for (int j = 0; j < N_EDGES_PERMUTATIONS; j++) {
                State state = indicesToState(new int[] { i, j, 0 });
                for (int k = 0; k < moves.length; k++) {
                    int[] indices = stateToIndices(state.multiply(moves[k]));
                    edgesPermutationMove[i * N_EDGES_PERMUTATIONS + j][k] =
                        indices[0] * N_EDGES_PERMUTATIONS + indices[1];
                }
            }
        }

        // edges orientation
        edgesOrientationMove = new int[N_EDGES_COMBINATIONS * N_EDGES_ORIENTATIONS][moves.length];
        for (int i = 0; i < N_EDGES_COMBINATIONS; i++) {
            for (int j = 0; j < N_EDGES_ORIENTATIONS; j++) {
                State state = indicesToState(new int[] { i, 0, j });
                for (int k = 0; k < moves.length; k++) {
                    int[] indices = stateToIndices(state.multiply(moves[k]));
                    edgesOrientationMove[i * N_EDGES_ORIENTATIONS + j][k] =
                        indices[0] * N_EDGES_ORIENTATIONS + indices[2];
                }
            }
        }
    }

    private static int[] stateToIndices(State state) {
        // edges
        boolean[] selectedEdges = {
            false, false, false, false,
            false, false, false, false,
            true,  true,  true,  true,
        };

        byte[] edgesMapping = {
           -1, -1, -1, -1,
           -1, -1, -1, -1,
            0,  1,  2,  3,
        };

        boolean[] edgesCombination = new boolean[state.edgesPermutation.length];
        for (int i = 0; i < edgesCombination.length; i++) {
            edgesCombination[i] = selectedEdges[state.edgesPermutation[i]];
        }
        int edgesCombinationIndex =
            IndexMapping.combinationToIndex(edgesCombination, 4);

        byte[] edgesPermutation = new byte[4];
        byte[] edgesOrientation = new byte[4];
        int next = 0;
        for (int i = 0; i < state.edgesPermutation.length; i++) {
            if (edgesCombination[i]) {
                edgesPermutation[next] = edgesMapping[state.edgesPermutation[i]];
                edgesOrientation[next] = state.edgesOrientation[i];
                next++;
            }
        }
        int edgesPermutationIndex =
            IndexMapping.permutationToIndex(edgesPermutation);
        int edgesOrientationIndex =
            IndexMapping.orientationToIndex(edgesOrientation, 2);

        return new int[] {
            edgesCombinationIndex,
            edgesPermutationIndex,
            edgesOrientationIndex,
        };
    }

    private static State indicesToState(int[] indices) {
        boolean[] combination =
            IndexMapping.indexToCombination(indices[0], 4, 12);
        byte[] permutation =
            IndexMapping.indexToPermutation(indices[1], 4);
        byte[] orientation =
            IndexMapping.indexToOrientation(indices[2], 2, 4);

        byte[] selectedEdges = { 8, 9, 10, 11 };
        int nextSelectedEdgeIndex = 0;
        byte[] otherEdges = { 0, 1, 2, 3, 4, 5, 6, 7 };
        int nextOtherEdgeIndex = 0;

        byte[] edgesPermutation = new byte[12];
        byte[] edgesOrientation = new byte[12];
        for (int i = 0; i < edgesPermutation.length; i++) {
            if (combination[i]) {
                edgesPermutation[i] = selectedEdges[permutation[nextSelectedEdgeIndex]];
                edgesOrientation[i] = orientation[nextSelectedEdgeIndex];
                nextSelectedEdgeIndex++;
            } else {
                edgesPermutation[i] = otherEdges[nextOtherEdgeIndex];
                edgesOrientation[i] = 0;
                nextOtherEdgeIndex++;
            }
        }

        return new State(
            State.id.cornersPermutation,
            State.id.cornersOrientation,
            edgesPermutation,
            edgesOrientation);
    }

    // distance tables
    private static byte[] edgesPermutationDistance;
    private static byte[] edgesOrientationDistance;

    static {
        // edges permutation
        edgesPermutationDistance = new byte[N_EDGES_COMBINATIONS * N_EDGES_PERMUTATIONS];
        for (int i = 0; i < edgesPermutationDistance.length; i++) {
            edgesPermutationDistance[i] = -1;
        }
        edgesPermutationDistance[goalEdgesPermutation] = 0;

        int distance = 0;
        int nVisited = 1;
        while (nVisited < N_EDGES_COMBINATIONS * N_EDGES_PERMUTATIONS) {
            for (int i = 0; i < edgesPermutationDistance.length; i++) {
                if (edgesPermutationDistance[i] != distance) {
                    continue;
                }

                for (int j = 0; j < edgesPermutationMove[i].length; j++) {
                    int next = edgesPermutationMove[i][j];
                    if (edgesPermutationDistance[next] < 0) {
                        edgesPermutationDistance[next] = (byte) (distance + 1);
                        nVisited++;
                    }
                }
            }

            distance++;
        }

        // edges orientation
        edgesOrientationDistance = new byte[N_EDGES_COMBINATIONS * N_EDGES_ORIENTATIONS];
        for (int i = 0; i < edgesOrientationDistance.length; i++) {
            edgesOrientationDistance[i] = -1;
        }
        edgesOrientationDistance[goalEdgesOrientation] = 0;

        distance = 0;
        nVisited = 1;
        while (nVisited < N_EDGES_COMBINATIONS * N_EDGES_ORIENTATIONS) {
            for (int i = 0; i < edgesOrientationDistance.length; i++) {
                if (edgesOrientationDistance[i] != distance) {
                    continue;
                }

                for (int j = 0; j < edgesOrientationMove[i].length; j++) {
                    int next = edgesOrientationMove[i][j];
                    if (edgesOrientationDistance[next] < 0) {
                        edgesOrientationDistance[next] = (byte) (distance + 1);
                        nVisited++;
                    }
                }
            }

            distance++;
        }
    }

    public static ArrayList<String[]> solve(State state) {
        int[] indices = stateToIndices(state);

        int edgesPermutationIndex =
            indices[0] * N_EDGES_PERMUTATIONS + indices[1];
        int edgesOrientationIndex =
            indices[0] * N_EDGES_ORIENTATIONS + indices[2];

        ArrayList<String[]> solutions = new ArrayList<String[]>();

        for (int depth = 0; ; depth++) {
            int[] path = new int[depth];

            search(edgesPermutationIndex,
                   edgesOrientationIndex,
                   depth,
                   path,
                   solutions);

            if (solutions.size() > 0) {
                return solutions;
            }
        }
    }

    private static void search(
            int edgesPermutation,
            int edgesOrientation,
            int depth,
            int[] path,
            ArrayList<String[]> solutions) {
        if (depth == 0) {
            if (edgesPermutation == goalEdgesPermutation &&
                edgesOrientation == goalEdgesOrientation) {
                String[] sequence = new String[path.length];
                for (int i = 0; i < sequence.length; i++) {
                    sequence[i] = moveNames[path[i]];
                }

                solutions.add(sequence);
            }

            return;
        }

        if (edgesPermutationDistance[edgesPermutation] > depth ||
            edgesOrientationDistance[edgesOrientation] > depth) {
            return;
        }

        for (int i = 0; i < moves.length; i++) {
            path[path.length - depth] = i;
            search(
                edgesPermutationMove[edgesPermutation][i],
                edgesOrientationMove[edgesOrientation][i],
                depth - 1,
                path,
                solutions);
        }
    }
}


text:
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">

{{ site.description }}

    Home

1. Introduction

2. Overview of WebRTC Architecture

  2.1. Underlying Technologies

3. Browser-based Security Considerations

   3.1. Browser Trust Model

   3.2. SOP: Same Origin Policy

       3.2.1. Bypassing SOP

4. WebRTC Security Considerations

    4.1. Installation and Updates

    4.2. Access to Media/Local resources

    4.3. Media Encryption & Communication Security

       4.3.1. DTLS: Datagram Transport Layer Security

           4.3.1.1. DTLS over TURN

       4.3.2. SRTP: Secure Real-time Transport Protocol

       4.3.3. Establishment of a secure link

       4.3.4. DTLS-SRTP vs SDES

       4.3.5. A Weakness in SRTP

    4.4. Web-Based Peer Authentication & Identity Management

    4.5. IP Location Privacy

    4.6. Signalling Layer

       4.6.1. SIP Vulnerabilities

    4.7. Additional Security Topics

5. Comparison with competing/similar technologies

6. Secure design practices

7. Conclusion

8. Bibliography

    {% comment %}
      The code below dynamically generates a sidebar nav of pages with
      `layout: page` in the front-matter. See readme for usage.
    {% endcomment %}

    {% assign pages_list = site.pages %}
    {% for node in pages_list %}
      {% if node.title != null %}
        {% if node.layout == "page" %}
          {{ node.title }}
        {% endif %}
      {% endif %}
    {% endfor %}

    GitHub Repository
    Currently v{{ site.version }}


text:
#region Copyright
// Copyright 2014 Myrcon Pty. Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Generic;
using Potato.Net.Shared.Models;

namespace Potato.Net.Shared {
    /// <summary>
    /// Holds data attached to a protocol event
    /// </summary>
    [Serializable]
    public class ProtocolEventData : IProtocolEventData {
        /// <summary>
        /// The chats attached to this event, if any.
        /// </summary>
        public List<ChatModel> Chats { get; set; }

        /// <summary>
        /// The players attached to this event, if any.
        /// </summary>
        public List<PlayerModel> Players { get; set; }

        /// <summary>
        /// The kills attached to this event, if any.
        /// </summary>
        public List<KillModel> Kills { get; set; }

        /// <summary>
        /// The moves attached to this event, if any.
        /// </summary>
        public List<MoveModel> Moves { get; set; }

        /// <summary>
        /// The spawns attached to this event, if any.
        /// </summary>
        public List<SpawnModel> Spawns { get; set; }

        /// <summary>
        /// The kicks attached to this event, if any.
        /// </summary>
        public List<KickModel> Kicks { get; set; }

        /// <summary>
        /// The bans attached to this event, if any.
        /// </summary>
        public List<BanModel> Bans { get; set; }

        /// <summary>
        /// The maps attached to this event, if any.
        /// </summary>
        public List<MapModel> Maps { get; set; }

        /// <summary>
        /// The settings attached to this event, if any.
        /// </summary>
        public List<Settings> Settings { get; set; }

        /// <summary>
        /// The list of points (3d) attached to this event, if any.
        /// </summary>
        public List<Point3DModel> Points { get; set; }

        /// <summary>
        /// List of items attached to this event, if any.
        /// </summary>
        public List<ItemModel> Items { get; set; }
    }
}


text:
(function($) {
  // Our main constructor.
  // Takes a single argument, an HTMLElement (plain, or jQuery-wrapped).
  var TextToggle = function (container) {
    var zipped, delinses, parent_toggle;

    // Wrap our container in a jQuery object if not already so.
    this.$el = container.constructor === $ ? container : $(container);

    // Fetch all the non-nested `<del>` and `<ins>` elements
    // inside our container.
    delinses = this._getDelinses(this.$el);

    // Zip these `<del>`s and `<ins>`es, so that `zipped` is an
    // array that looks like this:
    //
    //   [ [ del1, ins1 ], [ del2, ins2 ], ... ]
    zipped = this._zipDelinses(delinses);

    // Construct an array of `Pair` objects, one for
    // `<del>`/`<ins>` pair in the array.
    this.pairs = $.map(zipped, $.proxy(function (arr) {
      return new Pair(arr[0], arr[1], this);
    }, this));

    // TextToggles can be nested inside one another.
    // If this TextToggle is nested, find its parent.
    this.parent = container.delins ? container.delins.pair.parent : null;

    // If this TextToggle is a top-level TextToggle,
    // attach click-event handlers to it.
    if (!this.parent) {
      this._activateToggling();
    }
  };

  TextToggle.prototype = {
    // Return this TextToggle to its original state.
    reset: function () {
      this.$el.find("del").removeClass("text_toggle_off");
      this.$el.find("ins").addClass("text_toggle_off");
    },
    // Expand all translations, i.e., show all `<ins>`es, hide
    // all `<del>`s.
    translate: function () {
      this.$el.find("del").addClass("text_toggle_off");
      this.$el.find("ins").removeClass("text_toggle_off");
    },
    // Attach the core click handler.
    _activateToggling: function () {
      this.$el.on("click", ".text_toggle", function (e) {
        this.delins.$el.toggleClass("text_toggle_off");
        this.delins.getSibling().$el.toggleClass("text_toggle_off");
        e.stopPropagation();
      });
    },
    // Fetch all `<del>`s and `<ins>`es in the current nesting level.
    // (Hence the lengthy selectors.)
    _getDelinses: function () {
      var del_sel = "del:not(ins:not(.text_toggle) del):not(del:not(.text_toggle) del)",
        ins_sel = "ins:not(ins:not(.text_toggle) ins):not(del:not(.text_toggle) ins)"
      return {
        dels: this.$el.find(del_sel),
        inses: this.$el.find(ins_sel)
      };
    },
    // A custom zip utility.
    _zipDelinses: function (delinses) {
      if (delinses.inses.length !== delinses.dels.length) {
        throw new Error("Each TextToggle must have the same number of es and s.");
      }
      var length = delinses.inses.length;
      var results = new Array(length);
      for (var i = 0; i < length; i++) {
        results[i] = [ delinses.dels[i], delinses.inses[i] ];
      }
      return results;
    }
  };

  // Each `Pair` contains one `<ins>` and one `<del>`
  // that we'll toggle between.
  var Pair = function (del, ins, parent) {
    this.parent = parent;
    this.del = new Delins(del, this);
    this.ins = new Delins(ins, this);
  };

  // The Delins constructor represents a single
  // `<del>` or `<ins>`.
  var Delins = function (el, pair) {
    this.el = el;
    this.$el = $(el);
    this.tag = el.tagName;
    this.el.delins = this;

    // Upon construction, hide `<ins>`es.
    if (this.tag.toLowerCase() === "ins") {
      this.$el.addClass("text_toggle_off");
    }

    // `text_toggle` is the class we give all
    // togglable `<del>`s and `<ins>`es.
    this.$el.addClass("text_toggle");
    this.pair = pair;

    // Here's the recursive bit. If this `<del>` or `<ins>`
    // itself has `<del>`s and `<ins>`es as children, create
    // a nested TextToggle.
    this.children = new TextToggle(this.el);
    if (!this.children.pairs.length) {
      delete this.children;
    }
  };

  Delins.prototype.getSibling = function () {
    if (this.tag.toLowerCase() === "del") {
      return this.pair.ins;
    } else {
      return this.pair.del;
    }
  };

  // Given a JSON array, turn it into a TextToggle. The array,
  // as well as the resulting TextToggle, can be nested ad infinitum.
  // It should take the following structure:
  //
  //  	[
  //  	 "Plain text, not toggleable ",
  //  	 [ "something to sub out", "something to sub in" ],
  //  	 " and then more plain text. ",
  //  	 [ "At first this looks like a normal toggle but ",
  //  	   [ "then you notice", "it's a nested toggle" ]
  //  	 ]
  //  	]
  TextToggle.fromJSON = function (json) {
    var $container, parse, html;
    $container = $("
");
    parse = function (item, is_subitem) {
      if (item.constructor === Array)  {
        if (!is_subitem) {
          return $.map(item, function (subitem, i) {
            return parse(subitem, true);
          }).join("");
        } else {
          return "" + parse(item[0]) + "" +
              "" + parse(item[1]) + "";
        }
      }
      // If item is a string, return it and stop recursing.
      return item;
    };
    html = parse(json);
    $container.html(html);
    return new TextToggle($container);
  };

  // Attach `TextToggle` to the global object.
  this.TextToggle = TextToggle;
}(jQuery));


text:
namespace Magellan.Framework
{
    /// <summary>
    /// A <see cref="ViewResult"/> that represents a child window that will be opened.
    /// </summary>
    public class ChildWindowResult : ViewResult
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ChildWindowResult"/> class.
        /// </summary>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="model">The model that will be bound to the view.</param>
        /// <param name="viewEngines">The set of view engines that can help to activate this view.</param>
        public ChildWindowResult(string viewName, object model, ViewEngineCollection viewEngines)
            : base(viewName, model, viewEngines)
        {
            Options.SetViewType("ChildWindow");
        }
    }
}


text:
/*=================================\
* CWA.DTP\ValidateForm.Designer.cs
*
* The Coestaris licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*
* Created: 06.10.2017 20:19
* Last Edited: 08.10.2017 18:18:21
*=================================*/

namespace CWA.DTP
{
    partial class ValidateForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

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

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.button3 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(186, 96);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(105, 36);
            this.button1.TabIndex = 0;
            this.button1.Text = "Ok";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(75, 96);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(105, 36);
            this.button2.TabIndex = 1;
            this.button2.Text = "Exit";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(15, 70);
            this.textBox1.Name = "textBox1";
            this.textBox1.PasswordChar = '*';
            this.textBox1.Size = new System.Drawing.Size(280, 20);
            this.textBox1.TabIndex = 2;
            this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
            this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
            //
            // label1
            //
            this.label1.Location = new System.Drawing.Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(280, 58);
            this.label1.TabIndex = 3;
            this.label1.Text = "label1";
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(15, 96);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(38, 36);
            this.button3.TabIndex = 4;
            this.button3.Text = "R";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            //
            // ValidateForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(303, 141);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Name = "ValidateForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "ValidateForm";
            this.Load += new System.EventHandler(this.ValidateForm_Load);
            this.Shown += new System.EventHandler(this.ValidateForm_Shown);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button3;
    }
}


text:
import _ from '../../lib/utils'
import App from '../app'
import {getZone} from '../cards'
import {Spaced} from './spacer'
let d = React.DOM

export default React.createClass({
  render() {
    let zones = this.props.zones.map(zone)
    return d.div({}, zones)
  }
})

function zone(zoneName) {
  let zone = getZone(zoneName)
  let values = _.values(zone)
  let cards = _.flat(values)

  let isAutopickable = card => zoneName === 'pack' && card.isAutopick

  let items = cards.map(card =>
    d.span(
      {
        className: `card ${isAutopickable(card) ? 'autopick-card' : ''}`,
        title: isAutopickable(card) ? 'This card will be automatically picked if your time expires.' : '',
        onClick: App._emit('click', zoneName, card.name),
      },
      d.img({
        src: card.url,
        alt: card.name,
      })))

  return d.div({ className: 'zone' },
    d.h1({}, Spaced(
      d.span({}, zoneName),
      d.span({}, `${cards.length} ${cards.length === 1 ? 'card' : 'cards' }`))),
    items)
}


text:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

# install initial packages
apt-get update
apt-get install -y build-essential python-software-properties git mongodb-10gen

# install the latest version of node.js
add-apt-repository -y ppa:chris-lea/node.js
apt-get update
apt-get install -y nodejs

# install super helpful node packages
npm install -g bower supervisor grunt-cli


text:
static PyObject* Raspberry_Pi_Driver_read(PyObject *self, PyObject *args)
{
	// Parse sensor and pin integer arguments.
    int sensor, pin;
    if (!PyArg_ParseTuple(args, "ii", &sensor, &pin)) {
        return NULL;
    }
    // Call dht_read and return result code, humidity, and temperature.
    float humidity = 0, temperature = 0;
    int result = pi_dht_read(sensor, pin, &humidity, &temperature);
    return Py_BuildValue("iff", result, humidity, temperature);
}

// Boilerplate python module method list and initialization functions below.

static PyMethodDef module_methods[] = {
    {"read", Raspberry_Pi_Driver_read, METH_VARARGS, "Read DHT sensor value on a Raspberry Pi."},
    {NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC initRaspberry_Pi_Driver(void)
{
    Py_InitModule("Raspberry_Pi_Driver", module_methods);
}


text:
require "formula"

class Pmd < Formula
  homepage "http://pmd.sourceforge.net/"
  url "https://downloads.sourceforge.net/project/pmd/pmd/5.1.2/pmd-src-5.1.2.zip"
  sha1 "f6d2023bfa75784b08b79fc6cd1900c3352e3499"

  def install
    rm Dir["bin/*.{bat,cmd,dll,exe}"]

    doc.install "LICENSE", "NOTICE", "ReadMe.txt", "licences", Dir["docs/*"]
    libexec.install "bin", "etc", "lib"

    bin.install_symlink "#{libexec}/bin/run.sh" => "pmd"

    # the run script references paths which don't account for the
    # file structure of this brew.
    inreplace "#{libexec}/bin/run.sh", "${script_dir}/../lib", "#{libexec}/lib"
  end

  def caveats; <<-EOS.undent
    Run with `pmd` (instead of `run.sh` as described in the documentation).
    EOS
  end

  test do
    (testpath/"java/testClass.java").write <<-EOS.undent
      public class BrewTestClass {
        // dummy constant
        public String SOME_CONST = "foo";

        public boolean doTest () {
          return true;
        }
      }
    EOS

    system "#{bin}/pmd", "pmd", "-d", "#{testpath}/java", "-R",
      "rulesets/java/basic.xml", "-f", "textcolor", "-l", "java"
  end
end


text:
package org.jretty.util.resource.web;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import javax.servlet.ServletContext;

import org.jretty.util.Assert;
import org.jretty.util.StringUtils;
import org.jretty.util.UrlUtils;
import org.jretty.util.WebUtils;
import org.jretty.util.resource.AbstractFileResolvingResource;
import org.jretty.util.resource.ContextResource;
import org.jretty.util.resource.Resource;

/**
 * {@link org.springframework.core.io.Resource} implementation for
 * {@link javax.servlet.ServletContext} resources, interpreting
 * relative paths within the web application root directory.
 *
 *
Always supports stream access and URL access, but only allows
 * {@code java.io.File} access when the web application archive
 * is expanded.
 *
 * @author Juergen Hoeller
 * @since 28.12.2003
 * @see javax.servlet.ServletContext#getResourceAsStream
 * @see javax.servlet.ServletContext#getResource
 * @see javax.servlet.ServletContext#getRealPath
 */
public class ServletContextResource extends AbstractFileResolvingResource implements ContextResource {

	private final ServletContext servletContext;

	private final String path;

	/**
	 * Create a new ServletContextResource.
	 *
The Servlet spec requires that resource paths start with a slash,
	 * even if many containers accept paths without leading slash too.
	 * Consequently, the given path will be prepended with a slash if it
	 * doesn't already start with one.
	 * @param servletContext the ServletContext to load from
	 * @param path the path of the resource
	 */
	public ServletContextResource(ServletContext servletContext, String path) {
		// check ServletContext
		Assert.notNull(servletContext, "Cannot resolve ServletContextResource without ServletContext");
		this.servletContext = servletContext;

		// check path
		Assert.notNull(path, "Path is required");
		String pathToUse = StringUtils.cleanPath(path);
		if (!pathToUse.startsWith("/")) {
			pathToUse = "/" + pathToUse;
		}
		this.path = pathToUse;
	}

	/**
	 * Return the ServletContext for this resource.
	 */
	public final ServletContext getServletContext() {
		return this.servletContext;
	}

	/**
	 * Return the path for this resource.
	 */
	public final String getPath() {
		return this.path;
	}

	/**
	 * This implementation checks {@code ServletContext.getResource}.
	 * @see javax.servlet.ServletContext#getResource(String)
	 */
	@Override
	public boolean exists() {
		try {
			URL url = this.servletContext.getResource(this.path);
			return (url != null);
		}
		catch (MalformedURLException ex) {
			return false;
		}
	}

	/**
	 * This implementation delegates to {@code ServletContext.getResourceAsStream},
	 * which returns {@code null} in case of a non-readable resource (e.g. a directory).
	 * @see javax.servlet.ServletContext#getResourceAsStream(String)
	 */
	@Override
	public boolean isReadable() {
		InputStream is = this.servletContext.getResourceAsStream(this.path);
		if (is != null) {
			try {
				is.close();
			}
			catch (IOException ex) {
				// ignore
			}
			return true;
		}
		else {
			return false;
		}
	}

	/**
	 * This implementation delegates to {@code ServletContext.getResourceAsStream},
	 * but throws a FileNotFoundException if no resource found.
	 * @see javax.servlet.ServletContext#getResourceAsStream(String)
	 */
	public InputStream getInputStream() throws IOException {
		InputStream is = this.servletContext.getResourceAsStream(this.path);
		if (is == null) {
			throw new FileNotFoundException("Could not open " + getDescription());
		}
		return is;
	}

	/**
	 * This implementation delegates to {@code ServletContext.getResource},
	 * but throws a FileNotFoundException if no resource found.
	 * @see javax.servlet.ServletContext#getResource(String)
	 */
	@Override
	public URL getURL() throws IOException {
		URL url = this.servletContext.getResource(this.path);
		if (url == null) {
			throw new FileNotFoundException(
					getDescription() + " cannot be resolved to URL because it does not exist");
		}
		return url;
	}

	/**
	 * This implementation resolves "file:" URLs or alternatively delegates to
	 * {@code ServletContext.getRealPath}, throwing a FileNotFoundException
	 * if not found or not resolvable.
	 * @see javax.servlet.ServletContext#getResource(String)
	 * @see javax.servlet.ServletContext#getRealPath(String)
	 */
	@Override
	public File getFile() throws IOException {
		URL url = this.servletContext.getResource(this.path);
		if (url != null && UrlUtils.isFileURL(url)) {
			// Proceed with file system resolution...
			return super.getFile();
		}
		else {
			String realPath = WebUtils.getRealPath(this.servletContext, this.path);
			return new File(realPath);
		}
	}

	/**
	 * This implementation creates a ServletContextResource, applying the given path
	 * relative to the path of the underlying file of this resource descriptor.
	 * @see org.springframework.util.StringUtils#applyRelativePath(String, String)
	 */
	@Override
	public Resource createRelative(String relativePath) {
		String pathToUse = StringUtils.applyRelativePath(this.path, relativePath);
		return new ServletContextResource(this.servletContext, pathToUse);
	}

	/**
	 * This implementation returns the name of the file that this ServletContext
	 * resource refers to.
	 * @see org.springframework.util.StringUtils#getFilename(String)
	 */
	@Override
	public String getFilename() {
		return StringUtils.getFilenameFromPath(this.path);
	}

	/**
	 * This implementation returns a description that includes the ServletContext
	 * resource location.
	 */
	public String getDescription() {
		return "ServletContext resource [" + this.path + "]";
	}

	public String getPathWithinContext() {
		return this.path;
	}

	/**
	 * This implementation compares the underlying ServletContext resource locations.
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj == this) {
			return true;
		}
		if (obj instanceof ServletContextResource) {
			ServletContextResource otherRes = (ServletContextResource) obj;
			return (this.servletContext.equals(otherRes.servletContext) && this.path.equals(otherRes.path));
		}
		return false;
	}

	/**
	 * This implementation returns the hash code of the underlying
	 * ServletContext resource location.
	 */
	@Override
	public int hashCode() {
		return this.path.hashCode();
	}

}


text:
<form class='form-signin'>

Enter Passkey

 0'>{{login.err[0]}}

	<input type='password' id='pass' class='form-control' placeholder="passkey" required ng-model='login.pass'>
	<button class ='btn btn-lg btn-primary btn-block' type='submit' ng-click='login.submit()'>Sign in </button>
</form>


text:
:- module(ai_extra_clauses, []).

:- use_module(library(extra_location)).
:- use_module(library(abstract_interpreter), []).

abstract_interpreter:extra_clauses(Goal, CM, CM:true, From) :-
    predicate_property(CM:Goal, dynamic),
    predicate_property(CM:Goal, implementation_module(M)),
    loc_dynamic(Goal, M, dynamic(def, _, _), From).


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Rigel.GUI.Collections;
using Rigel.GUI.Component;

namespace Rigel.GUI
{
    public static class GUILayout
    {

        private static GUIFrame Frame { get { return GUI.m_frame; } }

        internal static int LineHeight = 23;

        #region Layouting

        public static void BeginHorizontal()
        {
            Frame.LayoutStack.Push(GUI.CurLayout);
            GUI.CurLayout.AlignHorizontal = true;
            GUI.CurLayout.SizeMax = Vector3.zero;
            GUI.CurLayout.RemainSize = GUI.CurArea.Rect.Size() - GUI.CurLayout.Offset;
        }
        public static Vector4 EndHorizontal()
        {
            var curLayout = GUI.CurLayout;
            var prevLayout = Frame.LayoutStack.Pop();
            var layoutrect = new Vector4(prevLayout.Offset, curLayout.SizeMax);
            prevLayout.Offset.y += curLayout.SizeMax.y;
            layoutrect.z = curLayout.Offset.x - prevLayout.Offset.x;
            GUI.CurLayout = prevLayout;

            return layoutrect;
        }
        public static void BeginVertical()
        {
            Frame.LayoutStack.Push(GUI.CurLayout);
            GUI.CurLayout.AlignHorizontal = false;
            GUI.CurLayout.SizeMax = Vector3.zero;
            GUI.CurLayout.RemainSize = GUI.CurArea.Rect.Size() - GUI.CurLayout.Offset;
        }
        public static Vector4 EndVertical()
        {
            var curLayout = GUI.CurLayout;
            var prevLayout = Frame.LayoutStack.Pop();
            var layoutrect = new Vector4(prevLayout.Offset, curLayout.SizeMax);
            prevLayout.Offset.x += curLayout.SizeMax.x;
            layoutrect.w = curLayout.Offset.y - prevLayout.Offset.y;
            GUI.CurLayout = prevLayout;

            return layoutrect;
        }

        #endregion

        #region Primitive

        public static void Rect(Vector2 size, Vector4 color)
        {
            GUI.Rect(new Vector4(GUI.CurLayout.Offset, size), color);
            AutoCaculateOffset(size.x, size.y);
        }

        #endregion

        #region Basic Flow Control

        public static void Space(int offset)
        {
            GUI.CurLayout.Offset.y += offset;
        }
        public static void Space(float offset)
        {
            GUI.CurLayout.Offset.y += (int)offset;
        }
        public static void Indent(int offset)
        {
            GUI.CurLayout.Offset.x += offset;
        }
        public static void Indent(float offset)
        {
            GUI.CurLayout.Offset.x += (int)offset;
        }
        internal static void AutoCaculateOffsetWidth(float w)
        {
            AutoCaculateOffset((int)w, LineHeight);
        }
        internal static void AutoCaculateOffsetWidth(int w)
        {
            AutoCaculateOffset(w, LineHeight);
        }
        internal static void AutoCaculateOffsetHeight(float h)
        {
            AutoCaculateOffset(0, (int)h);
        }
        internal static void AutoCaculateOffsetHeight(int h)
        {
            AutoCaculateOffset(0, h);
        }
        public static void AutoCaculateOffset(float w, float h)
        {
            AutoCaculateOffset((int)w, (int)h);
        }
        public static void AutoCaculateOffset(int w, int h)
        {
            var layout = GUI.CurLayout;
            layout.LastDrawRect = new Vector4(layout.Offset, w, h);

            var offsetmax = layout.Offset;
            offsetmax.x += w;
            offsetmax.y += h;

            if (layout.AlignHorizontal)
            {
                layout.Offset.x += w;
            }
            else
            {
                layout.Offset.y += h;

            }

            layout.SizeMax.y = Mathf.Max(h, layout.SizeMax.y);
            layout.SizeMax.x = Mathf.Max(w, layout.SizeMax.x);

            //ContentMax
            GUI.CurArea.ContentMax.Y = Mathf.Max(offsetmax.y, GUI.CurArea.ContentMax.y);
            GUI.CurArea.ContentMax.x = Mathf.Max(offsetmax.x, GUI.CurArea.ContentMax.x);

            GUI.CurLayout = layout;
        }

        #endregion

        #region Button

        /// <summary>
        /// Draw Button
        /// </summary>
        /// <param name="label"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static bool Button(string label, params GUIOption[] options)
        {
            return Button(label, GUIStyle.Current.BtnColor, options);
        }

        /// <summary>
        /// Draw Button
        /// </summary>
        /// <param name="label"></param>
        /// <param name="options">GUIOptionGrid | GUIOptionWidth | GUIOptionHeight | GUIOptionAlign </param>
        /// <returns></returns>
        public static bool Button(string label, Vector4 color, params GUIOption[] options)
        {
            float w = GUI.CurLayout.RemainSize.x;
            float h = LineHeight;

            GUIOptionAlign optAlign = null;

            if (options != null)
            {
                GUIOptionGrid grid = null;
                GUIOptionWidth optWidth = null;
                GUIOptionHeight optHeight = null;
                options.GetOption(out grid, out optWidth, out optHeight);

                options.GetOption(out optAlign);

                if (optWidth != null)
                {
                    w = optWidth.Value;
                }
                else if (grid != null)
                {
                    w *= grid.Value;
                }
                if (optHeight != null)
                {
                    h = optHeight.Value;
                }
            }

            var rect = new Vector4(GUI.CurLayout.Offset, w, h);
            rect = rect.Padding(1);

            bool clicked = false;

            var recta = rect.Move(GUI.CurArea.Rect);
            if (GUI.Event.Used)
            {
                GUI.RectAbsolute(recta, color);
            }
            else
            {
                if (GUIUtility.RectContainsCheck(recta, GUI.Event.Pointer))
                {
                    if (GUI.Event.EventType == RigelGUIEventType.MouseClick)
                    {
                        GUI.RectAbsolute(recta, GUIStyle.Current.ColorActiveD);
                        GUI.Event.Use();
                        clicked = true;
                    }
                    else
                    {
                        GUI.RectAbsolute(recta, GUIStyle.Current.ColorActive);
                        if(GUI.Event.EventType == RigelGUIEventType.MouseMove)
                        {
                            GUI.Event.Use();
                        }
                    }
                }
                else
                {
                    GUI.RectAbsolute(recta, color);
                }
            }

            //Draw label

            Vector2 offset = new Vector2(4, (rect.w - GUI.Font.FontPixelSize) / 2);
            if (optAlign == null || optAlign == GUIOption.AlignCenter)
            {
                offset.x = (int)((rect.z - GUI.Font.GetTextWidth(label)) / 2);
            }
            else if (optAlign == GUIOption.AlignRight)
            {
                offset.x = rect.z - GUI.Font.GetTextWidth(label) - 2;
            }
            GUI.Text(rect, label, RigelColor.White, offset, true);
            AutoCaculateOffset(w, h);

            return clicked;
        }

        #endregion

        #region Text

        public static void Label(string content)
        {
            Label(content, RigelColor.White);
        }
        public static void Label(string content, Vector4 color)
        {
            var offset = new Vector2(2, (int)(LineHeight - GUI.Font.FontPixelSize) / 2);
            GUI.Text(new Vector4(GUI.CurLayout.Offset, GUI.CurLayout.RemainSize.x, LineHeight), content, color, offset);

            int textWidth = GUI.Font.GetTextWidth(content);

            AutoCaculateOffset(textWidth, LineHeight);
        }

        #endregion

        #region TabView

        /// <summary>
        /// Draw TabView Horizontal
        /// </summary>
        /// <param name="index"></param>
        /// <param name="tabnames"></param>
        /// <param name="draw"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static int TabView(int index, List<string> tabnames, Action<int> draw, params GUIOption[] options)
        {
            var sizeRemain = GUI.CurLayout.RemainSize;
            var rect = new Vector4(GUI.CurLayout.Offset, sizeRemain);

            if (options != null)
            {
                GUIOptionHeight optHeight;
                options.GetOption(out optHeight);
                if (optHeight != null)
                {
                    rect.w = optHeight.Value;
                }
            }
            var rectab = GUI.GetAbsoluteRect(rect);
            var tabview = GUI.GetObjTabView(rectab);

            int ret = tabview.Draw(rect, index, tabnames, draw);
            AutoCaculateOffset(rect.z, rect.w);

            return ret;
        }

        /// <summary>
        /// Draw TabView Vertical
        /// </summary>
        /// <param name="index"></param>
        /// <param name="tabnames"></param>
        /// <param name="draw"></param>
        /// <param name="tabWidth"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static int TabViewVertical(int index, List<string> tabnames, Action<int> draw, int tabWidth, params GUIOption[] options)
        {
            var sizeRemain = GUI.CurLayout.RemainSize;
            var rect = new Vector4(GUI.CurLayout.Offset, sizeRemain);

            if (options != null)
            {

            }
            var rectab = GUI.GetAbsoluteRect(rect);
            var tabview = GUI.GetObjTabView(rectab, (tv) => { tv.SetVerticalMode(tabWidth); });

            int ret = tabview.Draw(rect, index, tabnames, draw);
            AutoCaculateOffset(rect.z, rect.w);

            return ret;
        }

        #endregion

        #region ScrollView

        /// <summary>
        ///
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="scrolltype"></param>
        /// <param name="options"></param>
        public static void BeginScrollView(Vector2 pos, GUIScrollType scrolltype = GUIScrollType.Vertical, params GUIOption[] options)
        {
            {
                var sizeremian = GUI.CurLayout.RemainSize;

                if (options != null)
                {
                    GUIOptionHeight optHeight;
                    options.GetOption(out optHeight);
                }

                var rect = new Vector4(GUI.CurLayout.Offset, sizeremian);
                var rectab = GUI.GetAbsoluteRect(rect);

                var scrollview = GUI.GetObjScrollView(rectab);

                scrollview.Draw(rect, rectab, pos, scrolltype);
            }

        }

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static Vector2 EndScrollView()
        {
            var rect = GUI.CurArea.Rect;
            var sv = GUI.GetObjScrollView(rect);

            var pos = sv.LateDraw();

            GUILayout.AutoCaculateOffset(rect.Z, rect.W);
            return pos;
        }

        #endregion

        #region Menu

        /// <summary>
        /// Draw GUIMenuList
        /// </summary>
        /// <param name="menu"></param>
        /// <param name="option"></param>
        public static void DrawMenu(GUIMenuList menu, params GUIOption[] option)
        {
            var clicked = GUILayout.Button(menu.Label, option);
            var lastRect = GUI.CurLayout.LastDrawRect;
            var menuDraw = GUI.GetObjMenuDraw(menu.GetHashCode(), lastRect);
            GUI.SetDepthLayer(GUILayerType.Overlay);
            menuDraw.Draw(clicked, menu, lastRect);
            GUI.RestoreDepthLayer();

        }

        [TODO]
        public static void ContextMenu()
        {

        }

        #endregion

        #region Drag Drop

        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="size"></param>
        /// <param name="dropcontent"></param>
        /// <param name="contract"></param>
        /// <returns>is ondrag</returns>
        public static bool DragRect<T>(Vector2 size,T dropcontent, string contract = "")
        {
            var rect = new Vector4(GUI.CurLayout.Offset, size);

            bool ondrag = GUI.DragRect(rect, dropcontent, contract,true,true);

            AutoCaculateOffset(rect.z, rect.w);
            GUILayout.Space(2);

            return ondrag;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="contract"></param>
        /// <param name="size"></param>
        /// <param name="dropcontent"></param>
        /// <returns>is ondrag</returns>
        public static bool DragRect(string contract,Vector2 size,object dropcontent = null)
        {
            var rect = new Vector4(GUI.CurLayout.Offset, size);
            var onhover = GUI.DragRect(contract, rect, dropcontent, true, true);

            AutoCaculateOffset(rect.z, rect.w);
            GUILayout.Space(2);

            return onhover;
        }

        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="size"></param>
        /// <param name="onDrop"></param>
        /// <param name="contract"></param>
        /// <param name="onHover"></param>
        /// <returns>is onhover</returns>
        public static bool DropRect<T>(Vector2 size,Action<T,object> onDrop, string contract = "")
        {
            var rect = new Vector4(GUI.CurLayout.Offset, size);
            var rectab = GUI.GetAbsoluteRect(rect);

            bool isonhover = GUI.DropRectAbsolute(rectab, onDrop, contract);
            AutoCaculateOffset(size.x, size.y);
            return isonhover;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="size"></param>
        /// <param name="contract"></param>
        /// <param name="onDrop"></param>
        /// <param name="onHover"></param>
        /// <returns>is ondrag</returns>
        public static bool DropRect(Vector2 size,string contract,Action<object,object> onDrop)
        {
            var rect = new Vector4(GUI.CurLayout.Offset, size);
            var rectab = GUI.GetAbsoluteRect(rect);

            bool isonhover = GUI.DropRectAbsolute(rectab, contract, onDrop);
            AutoCaculateOffset(size.x, size.y);
            return isonhover;
        }

        #endregion

    }
}


text:
package com.va.jscp.ui.graphical;

import java.awt.Window;
import static com.va.jscp.ui.i18n.Msg.getString;

public class ProgressDialog extends javax.swing.JDialog {

    private static final long serialVersionUID = 1L;

    private MainWindowFrame mainFrame = null;

    private final ProgressDialogHandler progressDialogHandler;

    /**
     * Creates new form ProgressDialog
     *
     * @param parent
     * @param progressDialogHandler
     */
    public ProgressDialog(Window parent, ProgressDialogHandler progressDialogHandler)
    {
        super(parent);
        this.progressDialogHandler = progressDialogHandler;
        initComponents();
        initState();
    }

    private void initState()
    {
        cancelButton.setEnabled(progressDialogHandler.isAbortable());

        if (getParent() instanceof MainWindowFrame) {
            runInBackgroundButton.setVisible(true);
            mainFrame = (MainWindowFrame)getParent();
        } else {
            runInBackgroundButton.setVisible(false);
        }

        setLocationRelativeTo(getParent());
    }

    public void setDetails(String details)
    {
        this.details.setText(details);
    }

    public void setDetails1(String details1)
    {
        this.details1.setText(details1);
    }

    public void setDetails2(String details2)
    {
        this.details2.setText(details2);
    }

    public void setProgress(int progress)
    {
        this.progress.setValue(progress);
    }

    public void setMaximum(int maximum)
    {
        this.progress.setMaximum(maximum);
    }

    public void setIndeterminate(boolean indeterminate)
    {
        this.progress.setIndeterminate(indeterminate);
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT
     * modify this code. The content of this method is always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        progress = new javax.swing.JProgressBar();
        jSeparator1 = new javax.swing.JSeparator();
        cancelButton = new javax.swing.JButton();
        details1 = new javax.swing.JLabel();
        details2 = new javax.swing.JLabel();
        details = new javax.swing.JLabel();
        runInBackgroundButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setIconImage(com.va.jscp.ui.graphical.GUI.loadImage("app.png"));
        setResizable(false);

        progress.setIndeterminate(true);

        cancelButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/va/jscp/ui/graphical/icons/actions/process-stop.png"))); // NOI18N
        cancelButton.setText(getString("CANCEL")); // NOI18N
        cancelButton.setEnabled(false);
        cancelButton.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cancelButtonActionPerformed(evt);
            }
        });

        details1.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        details1.setText(" ");

        details2.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        details2.setText(" ");

        details.setText(getString("DETAILS")); // NOI18N

        runInBackgroundButton.setText("Run in background");
        runInBackgroundButton.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                runInBackgroundButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(progress, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(details2, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(details, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(details1, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(runInBackgroundButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(cancelButton)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(details)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(details1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(details2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(progress, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelButton)
                    .addComponent(runInBackgroundButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cancelButtonActionPerformed
    {//GEN-HEADEREND:event_cancelButtonActionPerformed
        if (progressDialogHandler.abort()) {
            cancelButton.setEnabled(false);
        }
    }//GEN-LAST:event_cancelButtonActionPerformed

    private void runInBackgroundButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_runInBackgroundButtonActionPerformed
    {//GEN-HEADEREND:event_runInBackgroundButtonActionPerformed
        if (mainFrame != null)
            progressDialogHandler.setProxyDelegate(mainFrame.getProgressHelper().createHandler(progressDialogHandler.isAbortable()));
    }//GEN-LAST:event_runInBackgroundButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cancelButton;
    private javax.swing.JLabel details;
    private javax.swing.JLabel details1;
    private javax.swing.JLabel details2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JProgressBar progress;
    private javax.swing.JButton runInBackgroundButton;
    // End of variables declaration//GEN-END:variables
}


text:
class FSpriteSelectedSocket : public FSelectedItem
{
public:
	FName SocketName;
	TWeakObjectPtr<UPrimitiveComponent> PreviewComponentPtr;

	static const FName SocketTypeID;

public:
	FSpriteSelectedSocket();

	// FSelectedItem interface
	virtual bool Equals(const FSelectedItem& OtherItem) const override;
	virtual void ApplyDelta(const FVector2D& Delta, const FRotator& Rotation, const FVector& Scale3D, FWidget::EWidgetMode MoveMode) override;
	FVector GetWorldPos() const override;
	virtual void DeleteThisItem() override;
	// End of FSelectedItem interface
};

//////////////////////////////////////////////////////////////////////////
// FSocketEditingHelper

class FSocketEditingHelper
{
public:
	static void DrawSockets(class FSpriteGeometryEditMode* GeometryEditMode, UPrimitiveComponent* PreviewComponent, const FSceneView* View, FPrimitiveDrawInterface* PDI);
	static void DrawSocketNames(class FSpriteGeometryEditMode* GeometryEditMode, UPrimitiveComponent* PreviewComponent, FViewport& Viewport, FSceneView& View, FCanvas& Canvas);
};