text:
package org.apache.ignite.internal.binary;

import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.cache.CacheKeyConfiguration;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;

import static org.apache.ignite.cache.CacheMode.PARTITIONED;

/**
 * Test for binary object affinity key.
 */
public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
    /** */
    private static final AtomicReference<UUID> nodeId = new AtomicReference<>();

    /** VM ip finder for TCP discovery. */
    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);

    /** */
    private static int GRID_CNT = 5;

    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(gridName);

        BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();

        typeCfg.setTypeName(TestObject.class.getName());

        BinaryConfiguration bCfg = new BinaryConfiguration();

        bCfg.setTypeConfigurations(Collections.singleton(typeCfg));

        cfg.setBinaryConfiguration(bCfg);

        CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject.class.getName(), "affKey");
        CacheKeyConfiguration keyCfg2 = new CacheKeyConfiguration("TestObject2", "affKey");

        cfg.setCacheKeyConfiguration(keyCfg, keyCfg2);

        cfg.setMarshaller(new BinaryMarshaller());

        if (!gridName.equals(getTestGridName(GRID_CNT))) {
            CacheConfiguration cacheCfg = new CacheConfiguration();

            cacheCfg.setCacheMode(PARTITIONED);

            cfg.setCacheConfiguration(cacheCfg);
        }

        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);

        return cfg;
    }

    /** {@inheritDoc} */
    @Override protected void beforeTestsStarted() throws Exception {
        startGridsMultiThreaded(GRID_CNT);
    }

    /** {@inheritDoc} */
    @Override protected void afterTestsStopped() throws Exception {
        stopAllGrids();
    }

    /**
     * @throws Exception If failed.
     */
    public void testAffinity() throws Exception {
        checkAffinity(grid(0));

        try (Ignite igniteNoCache = startGrid(GRID_CNT)) {
            try {
                igniteNoCache.cache(null);
            }
            catch (IllegalArgumentException ignore) {
                // Expected error.
            }

            checkAffinity(igniteNoCache);
        }
    }

    /**
     * @param ignite Ignite.
     * @throws Exception If failed.
     */
    private void checkAffinity(Ignite ignite) throws Exception {
        Affinity<Object> aff = ignite.affinity(null);

        GridAffinityProcessor affProc = ((IgniteKernal)ignite).context().affinity();

        IgniteCacheObjectProcessor cacheObjProc = ((IgniteKernal)ignite).context().cacheObjects();

        CacheObjectContext cacheObjCtx = cacheObjProc.contextForCache(
            ignite.cache(null).getConfiguration(CacheConfiguration.class));

        for (int i = 0; i < 1000; i++) {
            assertEquals(i, aff.affinityKey(i));

            assertEquals(i, aff.affinityKey(new TestObject(i)));

            assertEquals(i, aff.affinityKey(ignite.binary().toBinary(new TestObject(i))));

            BinaryObjectBuilder bldr = ignite.binary().builder("TestObject2");

            bldr.setField("affKey", i);

            assertEquals(i, aff.affinityKey(bldr.build()));

            CacheObject cacheObj = cacheObjProc.toCacheObject(cacheObjCtx, new TestObject(i), true);

            assertEquals(i, aff.affinityKey(cacheObj));

            assertEquals(aff.mapKeyToNode(i), aff.mapKeyToNode(new TestObject(i)));

            assertEquals(aff.mapKeyToNode(i), aff.mapKeyToNode(cacheObj));

            assertEquals(i, affProc.affinityKey(null, i));

            assertEquals(i, affProc.affinityKey(null, new TestObject(i)));

            assertEquals(i, affProc.affinityKey(null, cacheObj));

            assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, new TestObject(i)));

            assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, cacheObj));
        }
    }

    /**
     * @throws Exception If failed.
     */
    public void testAffinityRun() throws Exception {
        Affinity<Object> aff = grid(0).affinity(null);

        for (int i = 0; i < 1000; i++) {
            nodeId.set(null);

            grid(0).compute().affinityRun(null, new TestObject(i), new IgniteRunnable() {
                @IgniteInstanceResource
                private Ignite ignite;

                @Override public void run() {
                    nodeId.set(ignite.configuration().getNodeId());
                }
            });

            assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
        }
    }

    /**
     * @throws Exception If failed.
     */
    public void testAffinityCall() throws Exception {
        Affinity<Object> aff = grid(0).affinity(null);

        for (int i = 0; i < 1000; i++) {
            nodeId.set(null);

            grid(0).compute().affinityCall(null, new TestObject(i), new IgniteCallable<Object>() {
                @IgniteInstanceResource
                private Ignite ignite;

                @Override public Object call() {
                    nodeId.set(ignite.configuration().getNodeId());

                    return null;
                }
            });

            assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
        }
    }

    /**
     */
    private static class TestObject {
        /** */
        @SuppressWarnings("UnusedDeclaration")
        private int affKey;

        /**
         */
        private TestObject() {
            // No-op.
        }

        /**
         * @param affKey Affinity key.
         */
        private TestObject(int affKey) {
            this.affKey = affKey;
        }
    }
}


text:
PrefsAshObserver::PrefsAshObserver(PrefService* local_state)
    : local_state_(local_state) {
  DCHECK(local_state_);
}

PrefsAshObserver::~PrefsAshObserver() = default;

void PrefsAshObserver::Init() {
  // Initial values are obtained when the observers are created, there is no
  // need to do so explcitly.
  doh_mode_observer_ = std::make_unique<CrosapiPrefObserver>(
      crosapi::mojom::PrefPath::kDnsOverHttpsMode,
      base::BindRepeating(&PrefsAshObserver::OnDnsOverHttpsModeChanged,
                          base::Unretained(this)));
  doh_templates_observer_ = std::make_unique<CrosapiPrefObserver>(
      crosapi::mojom::PrefPath::kDnsOverHttpsTemplates,
      base::BindRepeating(&PrefsAshObserver::OnDnsOverHttpsTemplatesChanged,
                          base::Unretained(this)));
}

void PrefsAshObserver::OnDnsOverHttpsModeChanged(base::Value value) {
  if (!value.is_string()) {
    LOG(WARNING) << "Unexpected value type: "
                 << base::Value::GetTypeName(value.type());
    return;
  }
  local_state_->SetString(prefs::kDnsOverHttpsMode, value.GetString());
}

void PrefsAshObserver::OnDnsOverHttpsTemplatesChanged(base::Value value) {
  if (!value.is_string()) {
    LOG(WARNING) << "Unexpected value type: "
                 << base::Value::GetTypeName(value.type());
    return;
  }
  local_state_->SetString(prefs::kDnsOverHttpsTemplates, value.GetString());
}

redpajama_set_name: RedPajamaGithub


text:
package thebob.ja2maptool.util.map.component.interaction.handle;

/**
 *
 * @author starcatter
 */
public interface IMapHandleComponent {

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;

namespace SilentSilver
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        public static int ValueRequestCount = 0;
        public static int PreLoadCalledCount = 0;
        protected void Application_Start(object sender, EventArgs e)
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }

    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            // Configure Web API to use only bearer token authentication.

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
    }

//http://weblogs.asp.net/scottgu/auto-start-asp-net-applications-vs-2010-and-net-4-0-series
//https://technet.microsoft.com/en-us/library/cc772112%28v=ws.10%29.aspx?f=255&MSPPError=-2147217396
}


text:
package com.google.javascript.jscomp;

import com.google.javascript.jscomp.CheckLevel;
import com.google.javascript.jscomp.type.SemanticReverseAbstractInterpreter;
import com.google.javascript.rhino.Node;

/**
 * Tests for {@link RemoveUnusedPrototypeProperties}.
 *
 * @author nicksantos@google.com (Nick Santos)
 */
public class RemoveUnusedNamesTest extends CompilerTestCase {
  private static final String EXTERNS =
      "/** @constructor */\n " +
      "function IFoo() { } \n" +
      "IFoo.prototype.bar; \n" +

      "/** @constructor */\n " +
      "var mExtern; \n" +
      "mExtern.bExtern; \n" +
      "mExtern['cExtern']; \n";

  public RemoveUnusedNamesTest() {
    super(EXTERNS);
  }

  private boolean canRemoveExterns = false;

  @Override
  protected int getNumRepetitions() {
    return 1;
  }

  @Override
  protected CompilerPass getProcessor(final Compiler compiler) {
    return new CompilerPass() {

      @Override
      public void process(Node externs, Node root) {
        new TypeCheck(compiler,
            new SemanticReverseAbstractInterpreter(
                compiler.getCodingConvention(),
                compiler.getTypeRegistry()),
            compiler.getTypeRegistry(),
            CheckLevel.ERROR).processForTesting(externs, root);

        new RemoveUnusedNames(
            compiler, canRemoveExterns).process(externs, root);

        // Use to remove side-effect-free artifacts that are left over.
        new UnreachableCodeElimination(compiler, true).process(externs, root);
      }
    };
  }

  @Override
  public void setUp() {
    canRemoveExterns = false;
  }

  public void testAnalyzeUnusedPrototypeProperties() {
    // Basic removal for prototype properties
    test("/** @constructor */ \n" +
        "function e(){} \n" +
        "e.prototype.a = function(){};" +
        "e.prototype.b = function(){};" +
        "var x = new e; x.a()",

        "function e(){}" +
        " e.prototype.a = function(){};" +
        "var x = new e; x.a()");
  }

  public void testAnalyzeUnusedPrototypeProperties2() {
    // TODO(user): Prototype literal not yet supported.
    // Basic removal for prototype replacement
    //test("/** @constructor */ \n" +
    //    "function e(){} \n" +
    //    "e.prototype = {a: function(){}, b: function(){}};" +
    //    "var x=new e; x.a()",
    //
    //    "function e(){}" +
    //    "e.prototype = {a: function(){}};" +
    //    "var x = new e; x.a()");
  }

  public void testAnalyzeUnusedPrototypeProperties3() {
    // Even if bExtern is out there somewhere. The type system tells us they
    // are unrelated.
    test("/** @constructor */ \n" +
        "function e(){} \n" +
           "e.prototype.a = function(){};" +
           "e.prototype.bExtern = function(){};" +
           "var x = new e;x.a()",
         "function e(){}" +
           "e.prototype.a = function(){};" +
           //"e.prototype.bExtern = function(){};" +
           "var x = new e; x.a()");

    // TODO(user): Prototype literal not yet supported.
    //test("/** @constructor */ \n" +
    //    "function e(){} \n" +
    //       "e.prototype = {a: function(){}, bExtern: function(){}};" +
    //       "var x = new e; x.a()",
    //     "function e(){}" +
    //       "e.prototype = {a: function(){}, bExtern: function(){}};" +
    //       "var x = new e; x.a()");
  }

  public void testAliasing() {
    // TODO(user): Not fully supported.
  }

  public void testStatement() {
    test("/**\n" +
         " * @fileoverview\n" +
         " * @notypecheck\n" +
         " */ \n" +
         "/** @constructor */" +
        "function e(){}" +
           "var x = e.prototype.method1 = function(){};" +
           "var y = new e; x()",
         "function e(){}" +
           "var x = function(){};" +
           "var y = new e; x()");
  }

  public void testExportedMethodsByNamingConvention() {
    // TODO(user): Not fully supported.
  }

  public void testExportedMethodsByNamingConventionAlwaysExported() {
    // TODO(user): Not fully supported.
  }
}


text:
from cStringIO import StringIO

from rest_framework import status
from rest_framework.views import APIView

from drf_pdf.renderer import PDFRenderer
from drf_pdf.response import PDFResponse

from reportlab.pdfgen import canvas

class SimpleExample(APIView):

    renderer_classes = (PDFRenderer, )

    def get(self, request):
        pdf = StringIO()

        gen_pdf = canvas.Canvas(pdf)
        gen_pdf.drawString(100, 100, 'Simple example')
        gen_pdf.showPage()
        gen_pdf.save()

        return PDFResponse(
            pdf.getvalue(),
            file_name='example',
            status=status.HTTP_200_OK
        )


text:
package sdk.chat.demo.activities;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import sdk.chat.demo.R;

public class InfoActivity extends AbstractDemoActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    protected int getLayout() {
        return R.layout.activity_info;
    }

    @Override
    protected void next() {
        Intent intent = new Intent(this, StyleActivity.class);
        startActivity(intent);
    }
}


text:
namespace q {

	// Default code page used by kdb+
	extern UINT const DEFAULT_CP;

	std::string convert(UINT frCP, UINT toCP, char const* str) throw(std::runtime_error);
	std::string convert(UINT frCP, UINT toCP, std::string const& str) throw(std::runtime_error);

	K convert(UINT frCP, UINT toCP, K str) throw();

}//namespace q

#ifdef NDEBUG
#	pragma comment(lib, "kdb+.util.lib")
#else
#	pragma comment(lib, "kdb+.utild.lib")
#endif

#endif//__MULTILANG_H__


text:
using org.omg.dds.type;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DDSTests.XTypes
{
    #region SEALED CLASSES
    public sealed class BoolSealedClass
    {
        private bool m_val;

        public BoolSealedClass(bool v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            BoolSealedClass otherObj = (BoolSealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class CharSealedClass
    {
        private char m_val;

        public CharSealedClass(char v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            CharSealedClass otherObj = (CharSealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class U8SealedClass
    {
        private byte m_val;

        public U8SealedClass(byte v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U8SealedClass otherObj = (U8SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class U16SealedClass
    {
        private ushort m_val;

        public U16SealedClass(ushort v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U16SealedClass otherObj = (U16SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class U32SealedClass
    {
        private uint m_val;

        public U32SealedClass(uint v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U32SealedClass otherObj = (U32SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class U64SealedClass
    {
        private ulong m_val;

        public U64SealedClass(ulong v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U64SealedClass otherObj = (U64SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class S8SealedClass
    {
        private sbyte m_val;

        public S8SealedClass(sbyte v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S8SealedClass otherObj = (S8SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class S16SealedClass
    {
        private short m_val;

        public S16SealedClass(short v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S16SealedClass otherObj = (S16SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class S32SealedClass
    {
        private int m_val;

        public S32SealedClass(int v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S32SealedClass otherObj = (S32SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class S64SealedClass
    {
        private long m_val;

        public S64SealedClass(long v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S64SealedClass otherObj = (S64SealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class SingleSealedClass
    {
        private float m_val;

        public SingleSealedClass(float v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            SingleSealedClass otherObj = (SingleSealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class DoubleSealedClass
    {
        private double m_val;

        public DoubleSealedClass(double v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            DoubleSealedClass otherObj = (DoubleSealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public sealed class PrimitivesSealedClass
    {
        private bool m_bool;

        private char m_char;

        private byte m_byte;

        private ushort m_ushort;

        private uint m_uint;

        private ulong m_ulong;

        private sbyte m_sbyte;

        private short m_short;

        private int m_int;

        private long m_long;

        private float m_single;

        private double m_double;

        public PrimitivesSealedClass(int seed)
        {
            Random r = new Random(seed);
            m_bool = (r.Next() & 1) == 1;
            m_byte = (byte)r.Next();
            m_sbyte = (sbyte)r.Next();
            m_char = (char)r.Next();
            m_ushort = (ushort)r.Next();
            m_short = (short)r.Next();
            m_uint = (uint)r.Next();
            m_int = (int)r.Next();
            m_ulong = (ulong)r.Next();
            m_long = (long)r.Next();

            m_single = (float)r.NextDouble();
            m_double = r.NextDouble();
        }

        public static int Size()
        {
            return sizeof(bool) +
                   sizeof(byte) +
                   sizeof(sbyte) +
                   sizeof(char) +
                   sizeof(ushort) +
                   sizeof(short) +
                   sizeof(uint) +
                   sizeof(int) +
                   sizeof(ulong) +
                   sizeof(long) +
                   sizeof(float) +
                   sizeof(double);
        }

        public override bool Equals(object other)
        {
            PrimitivesSealedClass otherObj = (PrimitivesSealedClass)other;
            return this.m_bool == otherObj.m_bool &&
                    this.m_byte == otherObj.m_byte &&
                    this.m_sbyte == otherObj.m_sbyte &&
                    this.m_char == otherObj.m_char &&
                    this.m_ushort == otherObj.m_ushort &&
                    this.m_short == otherObj.m_short &&
                    this.m_uint == otherObj.m_uint &&
                    this.m_int == otherObj.m_int &&
                    this.m_ulong == otherObj.m_ulong &&
                    this.m_long == otherObj.m_long &&
                    this.m_single == otherObj.m_single &&
                    this.m_double == otherObj.m_double;
        }
        public override Int32 GetHashCode()
        {
            throw new NotImplementedException();
        }
    }

    public sealed class EnumSealedClass
    {
        private MyEnum m_val;

        public EnumSealedClass(MyEnum v)
        {
            m_val = v;
        }
        public static int Size()
        {
            return sizeof(MyEnum);
        }

        public override bool Equals(object other)
        {
            EnumSealedClass otherObj = (EnumSealedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    #endregion

    #region NOT SEALED CLASSES
    public class BoolClass
    {
        private bool m_val;

        public BoolClass(bool v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            BoolClass otherObj = (BoolClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class CharClass
    {
        private char m_val;

        public CharClass(char v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            CharClass otherObj = (CharClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U8Class
    {
        private byte m_val;

        public U8Class(byte v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U8Class otherObj = (U8Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U16Class
    {
        private ushort m_val;

        public U16Class(ushort v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U16Class otherObj = (U16Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U32Class
    {
        private uint m_val;

        public U32Class(uint v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U32Class otherObj = (U32Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U64Class
    {
        private ulong m_val;

        public U64Class(ulong v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U64Class otherObj = (U64Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S8Class
    {
        private sbyte m_val;

        public S8Class(sbyte v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S8Class otherObj = (S8Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S16Class
    {
        private short m_val;

        public S16Class(short v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S16Class otherObj = (S16Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S32Class
    {
        private int m_val;

        public S32Class(int v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S32Class otherObj = (S32Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S64Class
    {
        private long m_val;

        public S64Class(long v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S64Class otherObj = (S64Class)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class SingleClass
    {
        private float m_val;

        public SingleClass(float v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            SingleClass otherObj = (SingleClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class DoubleClass
    {
        private double m_val;

        public DoubleClass(double v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            DoubleClass otherObj = (DoubleClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class PrimitivesClass
    {
        private bool m_bool;

        private char m_char;

        private byte m_byte;

        private ushort m_ushort;

        private uint m_uint;

        private ulong m_ulong;

        private sbyte m_sbyte;

        private short m_short;

        private int m_int;

        private long m_long;

        private float m_single;

        private double m_double;

        public PrimitivesClass(int seed)
        {
            Random r = new Random(seed);
            m_bool = (r.Next() & 1) == 1;
            m_byte = (byte)r.Next();
            m_sbyte = (sbyte)r.Next();
            m_char = (char)r.Next();
            m_ushort = (ushort)r.Next();
            m_short = (short)r.Next();
            m_uint = (uint)r.Next();
            m_int = (int)r.Next();
            m_ulong = (ulong)r.Next();
            m_long = (long)r.Next();

            m_single = (float)r.NextDouble();
            m_double = r.NextDouble();
        }

        public static int Size()
        {
            return sizeof(bool) +
                   sizeof(byte) +
                   sizeof(sbyte) +
                   sizeof(char) +
                   sizeof(ushort) +
                   sizeof(short) +
                   sizeof(uint) +
                   sizeof(int) +
                   sizeof(ulong) +
                   sizeof(long) +
                   sizeof(float) +
                   sizeof(double);
        }

        public override bool Equals(object other)
        {
            PrimitivesClass otherObj = (PrimitivesClass)other;
            return this.m_bool == otherObj.m_bool &&
                    this.m_byte == otherObj.m_byte &&
                    this.m_sbyte == otherObj.m_sbyte &&
                    this.m_char == otherObj.m_char &&
                    this.m_ushort == otherObj.m_ushort &&
                    this.m_short == otherObj.m_short &&
                    this.m_uint == otherObj.m_uint &&
                    this.m_int == otherObj.m_int &&
                    this.m_ulong == otherObj.m_ulong &&
                    this.m_long == otherObj.m_long &&
                    this.m_single == otherObj.m_single &&
                    this.m_double == otherObj.m_double;
        }
        public override Int32 GetHashCode()
        {
            throw new NotImplementedException();
        }
    }

    public class EnumClass
    {
        private MyEnum m_val;

        public EnumClass(MyEnum v)
        {
            m_val = v;
        }
        public static int Size()
        {
            return sizeof(MyEnum);
        }

        public override bool Equals(object other)
        {
            EnumClass otherObj = (EnumClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }
    #endregion

    #region ANNOTATED CLASSES
    public class BoolAnnotatedClass
    {
        [ID(0x0010)]
        public bool m_val;

        public BoolAnnotatedClass(bool v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            BoolAnnotatedClass otherObj = (BoolAnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class CharAnnotatedClass
    {
        private char m_val;

        public CharAnnotatedClass(char v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            CharAnnotatedClass otherObj = (CharAnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U8AnnotatedClass
    {
        private byte m_val;

        public U8AnnotatedClass(byte v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U8AnnotatedClass otherObj = (U8AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U16AnnotatedClass
    {
        private ushort m_val;

        public U16AnnotatedClass(ushort v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U16AnnotatedClass otherObj = (U16AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U32AnnotatedClass
    {
        private uint m_val;

        public U32AnnotatedClass(uint v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U32AnnotatedClass otherObj = (U32AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class U64AnnotatedClass
    {
        private ulong m_val;

        public U64AnnotatedClass(ulong v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            U64AnnotatedClass otherObj = (U64AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S8AnnotatedClass
    {
        private sbyte m_val;

        public S8AnnotatedClass(sbyte v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S8AnnotatedClass otherObj = (S8AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S16AnnotatedClass
    {
        private short m_val;

        public S16AnnotatedClass(short v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S16AnnotatedClass otherObj = (S16AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S32AnnotatedClass
    {
        private int m_val;

        public S32AnnotatedClass(int v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S32AnnotatedClass otherObj = (S32AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class S64AnnotatedClass
    {
        private long m_val;

        public S64AnnotatedClass(long v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            S64AnnotatedClass otherObj = (S64AnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class SingleAnnotatedClass
    {
        private float m_val;

        public SingleAnnotatedClass(float v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            SingleAnnotatedClass otherObj = (SingleAnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class DoubleAnnotatedClass
    {
        private double m_val;

        public DoubleAnnotatedClass(double v)
        {
            m_val = v;
        }

        public override bool Equals(object other)
        {
            DoubleAnnotatedClass otherObj = (DoubleAnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }

    public class PrimitivesAnnotatedClass
    {
        [ID(0x0010)]
        [Optional]
        public bool m_bool;

        [ID(0x0011)]
        [Optional]
        public char m_char;

        [ID(0x0012)]
        public byte m_byte;

        [ID(0x0013)]
        public ushort m_ushort;

        [ID(0x0014)]
        [Key]
        public uint m_uint;

        [ID(0x0015)]
        [Key]
        public ulong m_ulong;

        [ID(0x0016)]
        public sbyte m_sbyte;

        [ID(0x0017)]
        public short m_short;

        [ID(0x0018)]
        public int m_int;

        [ID(0x0019)]
        public long m_long;

        [ID(0x001A)]
        public float m_single;

        [ID(0x001B)]
        public double m_double;

        public PrimitivesAnnotatedClass(int seed)
        {
            Random r = new Random(seed);
            m_bool = (r.Next() & 1) == 1;
            m_byte = (byte)r.Next();
            m_sbyte = (sbyte)r.Next();
            m_char = (char)r.Next();
            m_ushort = (ushort)r.Next();
            m_short = (short)r.Next();
            m_uint = (uint)r.Next();
            m_int = (int)r.Next();
            m_ulong = (ulong)r.Next();
            m_long = (long)r.Next();

            m_single = (float)r.NextDouble();
            m_double = r.NextDouble();
        }

        public static int Size()
        {
            return sizeof(bool) +
                   sizeof(byte) +
                   sizeof(sbyte) +
                   sizeof(char) +
                   sizeof(ushort) +
                   sizeof(short) +
                   sizeof(uint) +
                   sizeof(int) +
                   sizeof(ulong) +
                   sizeof(long) +
                   sizeof(float) +
                   sizeof(double);
        }

        public override bool Equals(object other)
        {
            PrimitivesAnnotatedClass otherObj = (PrimitivesAnnotatedClass)other;
            return this.m_bool == otherObj.m_bool &&
                    this.m_byte == otherObj.m_byte &&
                    this.m_sbyte == otherObj.m_sbyte &&
                    this.m_char == otherObj.m_char &&
                    this.m_ushort == otherObj.m_ushort &&
                    this.m_short == otherObj.m_short &&
                    this.m_uint == otherObj.m_uint &&
                    this.m_int == otherObj.m_int &&
                    this.m_ulong == otherObj.m_ulong &&
                    this.m_long == otherObj.m_long &&
                    this.m_single == otherObj.m_single &&
                    this.m_double == otherObj.m_double;
        }
        public override Int32 GetHashCode()
        {
            throw new NotImplementedException();
        }
    }

    public class EnumAnnotatedClass
    {
        private MyEnum m_val;

        public EnumAnnotatedClass(MyEnum v)
        {
            m_val = v;
        }
        public static int Size()
        {
            return sizeof(MyEnum);
        }

        public override bool Equals(object other)
        {
            EnumAnnotatedClass otherObj = (EnumAnnotatedClass)other;
            return this.m_val == otherObj.m_val;
        }
        public override Int32 GetHashCode()
        {
            return this.m_val.GetHashCode();
        }
    }
    #endregion
}


text:
package k8s

import (
	goerrors "errors"
	"fmt"
	"net"
	"time"

	"github.com/cilium/cilium/api/v1/models"
	"github.com/cilium/cilium/pkg/annotation"
	"github.com/cilium/cilium/pkg/logging/logfields"

	go_version "github.com/hashicorp/go-version"
	"github.com/sirupsen/logrus"
	"k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/wait"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
)

var (
	// ErrNilNode is returned when the Kubernetes API server has returned a nil node
	ErrNilNode = goerrors.New("API server returned nil node")

	// client is the object through which interactions with Kubernetes are
	// performed.
	client kubernetes.Interface
)

// CreateConfig creates a rest.Config for a given endpoint using a kubeconfig file.
func createConfig(endpoint, kubeCfgPath string) (*rest.Config, error) {
	// If the endpoint and the kubeCfgPath are empty then we can try getting
	// the rest.Config from the InClusterConfig
	if endpoint == "" && kubeCfgPath == "" {
		return rest.InClusterConfig()
	}

	if kubeCfgPath != "" {
		return clientcmd.BuildConfigFromFlags("", kubeCfgPath)
	}

	config := &rest.Config{Host: endpoint}
	err := rest.SetKubernetesDefaults(config)

	return config, err
}

// CreateConfigFromAgentResponse creates a client configuration from a
// models.DaemonConfigurationResponse
func CreateConfigFromAgentResponse(resp *models.DaemonConfiguration) (*rest.Config, error) {
	return createConfig(resp.Status.K8sEndpoint, resp.Status.K8sConfiguration)
}

// CreateConfig creates a client configuration based on the configured API
// server and Kubeconfig path
func CreateConfig() (*rest.Config, error) {
	return createConfig(GetAPIServer(), GetKubeconfigPath())
}

// CreateClient creates a new client to access the Kubernetes API
func CreateClient(config *rest.Config) (*kubernetes.Clientset, error) {
	cs, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	stop := make(chan struct{})
	timeout := time.NewTimer(time.Minute)
	defer timeout.Stop()
	wait.Until(func() {
		log.Info("Waiting for k8s api-server to be ready...")
		err = isConnReady(cs)
		if err == nil {
			close(stop)
			return
		}
		select {
		case <-timeout.C:
			log.WithError(err).WithField(logfields.IPAddr, config.Host).Error("Unable to contact k8s api-server")
			close(stop)
		default:
		}
	}, 5*time.Second, stop)
	if err == nil {
		log.WithField(logfields.IPAddr, config.Host).Info("Connected to k8s api-server")
	}
	return cs, err
}

// GetServerVersion returns the kubernetes api-server version.
func GetServerVersion() (ver *go_version.Version, err error) {
	sv, err := Client().Discovery().ServerVersion()
	if err != nil {
		return nil, err
	}

	// Try GitVersion first. In case of error fallback to MajorMinor
	if sv.GitVersion != "" {
		// This is a string like "v1.9.0"
		ver, err = go_version.NewVersion(sv.GitVersion)
		if err == nil {
			return ver, err
		}
	}

	if sv.Major != "" && sv.Minor != "" {
		ver, err = go_version.NewVersion(fmt.Sprintf("%s.%s", sv.Major, sv.Minor))
		if err == nil {
			return ver, nil
		}
	}

	if err != nil {
		return nil, fmt.Errorf("cannot parse k8s server version from %+v: %s", sv, err)
	}
	return nil, fmt.Errorf("cannot parse k8s server version from %+v", sv)
}

// isConnReady returns the err for the controller-manager status
func isConnReady(c *kubernetes.Clientset) error {
	_, err := c.CoreV1().ComponentStatuses().Get("controller-manager", metav1.GetOptions{})
	return err
}

func updateNodeAnnotation(c kubernetes.Interface, node *v1.Node, v4CIDR, v6CIDR *net.IPNet, v4HealthIP, v6HealthIP, v4CiliumHostIP net.IP) (*v1.Node, error) {
	if node.Annotations == nil {
		node.Annotations = map[string]string{}
	}

	if v4CIDR != nil {
		node.Annotations[annotation.V4CIDRName] = v4CIDR.String()
	}
	if v6CIDR != nil {
		node.Annotations[annotation.V6CIDRName] = v6CIDR.String()
	}

	if v4HealthIP != nil {
		node.Annotations[annotation.V4HealthName] = v4HealthIP.String()
	}
	if v6HealthIP != nil {
		node.Annotations[annotation.V6HealthName] = v6HealthIP.String()
	}

	if v4CiliumHostIP != nil {
		node.Annotations[annotation.CiliumHostIP] = v4CiliumHostIP.String()
	}

	node, err := c.CoreV1().Nodes().Update(node)
	if err != nil {
		return nil, err
	}

	if node == nil {
		return nil, ErrNilNode
	}

	return node, nil
}

// AnnotateNode writes v4 and v6 CIDRs and health IPs in the given k8s node name.
// In case of failure while updating the node, this function while spawn a go
// routine to retry the node update indefinitely.
func AnnotateNode(c kubernetes.Interface, nodeName string, v4CIDR, v6CIDR *net.IPNet, v4HealthIP, v6HealthIP, v4CiliumHostIP net.IP) error {
	scopedLog := log.WithFields(logrus.Fields{
		logfields.NodeName:       nodeName,
		logfields.V4Prefix:       v4CIDR,
		logfields.V6Prefix:       v6CIDR,
		logfields.V4HealthIP:     v4HealthIP,
		logfields.V6HealthIP:     v6HealthIP,
		logfields.V4CiliumHostIP: v4CiliumHostIP,
	})
	scopedLog.Debug("Updating node annotations with node CIDRs")

	go func(c kubernetes.Interface, nodeName string, v4CIDR, v6CIDR *net.IPNet, v4HealthIP, v6HealthIP, v4CiliumHostIP net.IP) {
		var node *v1.Node
		var err error

		for n := 1; n <= maxUpdateRetries; n++ {
			node, err = GetNode(c, nodeName)
			switch {
			case err == nil:
				_, err = updateNodeAnnotation(c, node, v4CIDR, v6CIDR, v4HealthIP, v6HealthIP, v4CiliumHostIP)
			case errors.IsNotFound(err):
				err = ErrNilNode
			}

			switch {
			case err == nil:
				return
			case errors.IsConflict(err):
				scopedLog.WithFields(logrus.Fields{
					fieldRetry:    n,
					fieldMaxRetry: maxUpdateRetries,
				}).WithError(err).Debugf("Unable to update node resource with annotation")
			default:
				scopedLog.WithFields(logrus.Fields{
					fieldRetry:    n,
					fieldMaxRetry: maxUpdateRetries,
				}).WithError(err).Warn("Unable to update node resource with annotation")
			}

			time.Sleep(time.Duration(n) * time.Second)
		}
	}(c, nodeName, v4CIDR, v6CIDR, v4HealthIP, v6HealthIP, v4CiliumHostIP)

	return nil
}

// Client returns the default Kubernetes client
func Client() kubernetes.Interface {
	return client
}

func createDefaultClient() error {
	restConfig, err := CreateConfig()
	if err != nil {
		return fmt.Errorf("unable to create k8s client rest configuration: %s", err)
	}

	k8sClient, err := CreateClient(restConfig)
	if err != nil {
		return fmt.Errorf("unable to create k8s client: %s", err)
	}

	client = k8sClient

	return nil
}


text:
textlint internal feature flag manager.

## Install

Install with [npm](https://www.npmjs.com/):

    npm install @textlint/feature-flag

## Usage

```js
import { coreFlags, isFeatureEnabled, setFeature } from "@textlint/feature-flag";
// core flag
assert.ok(coreFlags.runningCLI === false);
assert.ok(coreFlags.runningTester === false); // default loose
coreFlags.runningCLI = true;
coreFlags.runningTester = true;
coreFlags.experimental = true;
assert.ok(coreFlags.runningCLI === true);
assert.ok(coreFlags.runningTester === true);
assert.ok(coreFlags.experimental === true);
// feature-flag
try{
    isFeatureEnabled("test")
}catch(error){
    // default strict
}
setFeature("test", true);
assert.ok(isFeatureEnabled("test") === true);

```

## Changelog

See [Releases page](https://github.com/textlint/textlint/releases).

## Running tests

Install devDependencies and Run `npm test`:

    npm i -d && npm test

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/textlint/textlint/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Mesh face material</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">


text:
package org.wso2.developerstudio.datamapper.diagram.edit.parts;

import org.apache.avro.Schema;
import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.RectangleFigure;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.TitleBarBorder;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.EAttributeImpl;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.DeleteCommand;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.impl.BoundsImpl;
import org.eclipse.gmf.tooling.runtime.edit.policies.reparent.CreationEditPolicyWithCustomReparent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.wso2.developerstudio.datamapper.Attribute;
import org.wso2.developerstudio.datamapper.DataMapperFactory;
import org.wso2.developerstudio.datamapper.DataMapperPackage;
import org.wso2.developerstudio.datamapper.Element;
import org.wso2.developerstudio.datamapper.Output;
import org.wso2.developerstudio.datamapper.SchemaDataType;
import org.wso2.developerstudio.datamapper.TreeNode;
import org.wso2.developerstudio.datamapper.diagram.tree.generator.TreeFromAVSC;
import org.wso2.developerstudio.datamapper.diagram.tree.model.Tree;

/**
 * @generated
 */
public class OutputEditPart extends ShapeNodeEditPart {

	private static final int X = 800;

	private static final int Y = 200;

	/**
	 * @generated
	 */
	public static final int VISUAL_ID = 2003;

	/**
	 * @generated
	 */
	protected IFigure contentPane;

	/**
	 * @generated
	 */
	protected IFigure primaryShape;

	/**
	 * @generated
	 */
	public OutputEditPart(View view) {
		super(view);
	}

	public void activate() {
		super.activate();
	}

	public void resetOutputTreeFromFile(String filePath) {
		EObject parentContainer = ((org.eclipse.gmf.runtime.notation.impl.NodeImpl) (this)
				.getModel()).getElement();
		Output iip = (Output) parentContainer;

		DeleteCommand deleteComand = new DeleteCommand(getEditingDomain(), iip.getTreeNode());
		if (deleteComand.canExecute()) {
			getEditingDomain().getCommandStack().execute(deleteComand);
		}

		TreeNode treeNode = DataMapperFactory.eINSTANCE.createTreeNode();
		Tree tree = TreeFromAVSC.generateInputTreeFromFile(filePath);
		convertTree(tree, treeNode);

		AddCommand addTreeNodeCmd2 = new AddCommand(getEditingDomain(), parentContainer,
				DataMapperPackage.Literals.OUTPUT__TREE_NODE, treeNode);
		if (addTreeNodeCmd2.canExecute()) {
			getEditingDomain().getCommandStack().execute(addTreeNodeCmd2);
		}
		getPrimaryShape().setPreferredSize(250, 15);

	}

	/**
	 * @param schema
	 *            Avro schema that is used to parse to tree
	 */
	public void resetOutputTreeFromSchema(Schema schema) {
		EObject parentContainer = ((org.eclipse.gmf.runtime.notation.impl.NodeImpl) (this)
				.getModel()).getElement();
		Output iip = (Output) parentContainer;

		DeleteCommand deleteComand = new DeleteCommand(getEditingDomain(), iip.getTreeNode());
		if (deleteComand.canExecute()) {
			getEditingDomain().getCommandStack().execute(deleteComand);
		}

		TreeNode treeNode = DataMapperFactory.eINSTANCE.createTreeNode();
		Tree tree = TreeFromAVSC.generateInputTreeFromSchema(schema);
		convertTree(tree, treeNode);

		AddCommand addTreeNodeCmd2 = new AddCommand(getEditingDomain(), parentContainer,
				DataMapperPackage.Literals.OUTPUT__TREE_NODE, treeNode);
		if (addTreeNodeCmd2.canExecute()) {
			getEditingDomain().getCommandStack().execute(addTreeNodeCmd2);
		}
		getPrimaryShape().setPreferredSize(250, 15);
	}

	private void convertTree(Tree tree, TreeNode treeNode) {

		//treeNode.setName(tree.getCount() + "," + tree.getName());
		treeNode.setName(tree.getName());
		treeNode.setLevel(tree.getCount());
		if (tree.getSchemaType() != null) {
			switch (tree.getSchemaType()) {
			case ARRAY:
				treeNode.setSchemaDataType(SchemaDataType.ARRAY);
				break;
			case BOOLEAN:
				treeNode.setSchemaDataType(SchemaDataType.BOOLEAN);
				break;
			case BYTES:
				treeNode.setSchemaDataType(SchemaDataType.BYTES);
				break;
			case DOUBLE:
				treeNode.setSchemaDataType(SchemaDataType.DOUBLE);
				break;
			case ENUM:
				treeNode.setSchemaDataType(SchemaDataType.ENUM);
				break;
			case FIXED:
				treeNode.setSchemaDataType(SchemaDataType.FIXED);
				break;
			case FLOAT:
				treeNode.setSchemaDataType(SchemaDataType.FLOAT);
				break;
			case INT:
				treeNode.setSchemaDataType(SchemaDataType.INT);
				break;
			case LONG:
				treeNode.setSchemaDataType(SchemaDataType.LONG);
				break;
			case MAP:
				treeNode.setSchemaDataType(SchemaDataType.MAP);
				break;
			case NULL:
				treeNode.setSchemaDataType(SchemaDataType.NULL);
				break;
			case RECORD:
				treeNode.setSchemaDataType(SchemaDataType.RECORD);
				break;
			case STRING:
				treeNode.setSchemaDataType(SchemaDataType.STRING);
				break;
			case UNION:
				treeNode.setSchemaDataType(SchemaDataType.UNION);
				break;
			default:
				break;
			}
		}

		if (!(tree.getElements().isEmpty())) {
			for (org.wso2.developerstudio.datamapper.diagram.tree.model.Element element : tree
					.getElements()) {
				createElement(element, treeNode);
			}
		}
		if (!(tree.getAttributes().isEmpty())) {
			for (org.wso2.developerstudio.datamapper.diagram.tree.model.Attribute attribute : tree
					.getAttributes()) {
				createAttribute(attribute, treeNode);
			}
		}
		if (!(tree.getTrees().isEmpty())) {
			for (Tree treeN : tree.getTrees()) {
				createTree(treeN, treeNode);
			}
		}

	}

	private void createElement(
			org.wso2.developerstudio.datamapper.diagram.tree.model.Element element,
			TreeNode treeNode) {
		Element ele = DataMapperFactory.eINSTANCE.createElement();
		//ele.setName(element.getCount() + "," + element.getName());
		ele.setName(element.getName());
		ele.setLevel(element.getCount());
		if (element.getSchemaType() != null) {
			switch (element.getSchemaType()) {
			case ARRAY:
				ele.setSchemaDataType(SchemaDataType.ARRAY);
				break;
			case BOOLEAN:
				ele.setSchemaDataType(SchemaDataType.BOOLEAN);
				break;
			case BYTES:
				ele.setSchemaDataType(SchemaDataType.BYTES);
				break;
			case DOUBLE:
				ele.setSchemaDataType(SchemaDataType.DOUBLE);
				break;
			case ENUM:
				ele.setSchemaDataType(SchemaDataType.ENUM);
				break;
			case FIXED:
				ele.setSchemaDataType(SchemaDataType.FIXED);
				break;
			case FLOAT:
				ele.setSchemaDataType(SchemaDataType.FLOAT);
				break;
			case INT:
				ele.setSchemaDataType(SchemaDataType.INT);
				break;
			case LONG:
				ele.setSchemaDataType(SchemaDataType.LONG);
				break;
			case MAP:
				ele.setSchemaDataType(SchemaDataType.MAP);
				break;
			case NULL:
				ele.setSchemaDataType(SchemaDataType.NULL);
				break;
			case RECORD:
				ele.setSchemaDataType(SchemaDataType.RECORD);
				break;
			case STRING:
				ele.setSchemaDataType(SchemaDataType.STRING);
				break;
			case UNION:
				ele.setSchemaDataType(SchemaDataType.UNION);
				break;
			default:
				break;
			}
		}
		treeNode.getElement().add(ele);
		if (!(element.getAttribute().isEmpty())) {
			for (org.wso2.developerstudio.datamapper.diagram.tree.model.Attribute attribute : element
					.getAttribute()) {
				createAttribute(attribute, treeNode);
			}
		}
	}

	private void createAttribute(
			org.wso2.developerstudio.datamapper.diagram.tree.model.Attribute attribute,
			TreeNode treeNode) {
		Attribute attr = DataMapperFactory.eINSTANCE.createAttribute();
		attr.setName(attribute.getCount() + "," + attribute.getName());
		treeNode.getAttribute().add(attr);
	}

	private void createTree(Tree treeN, TreeNode treeNode) {
		TreeNode treeNodeNew = DataMapperFactory.eINSTANCE.createTreeNode();
		//treeNodeNew.setName(treeN.getCount() + "," + treeN.getName());
		treeNodeNew.setName(treeN.getName());
		treeNodeNew.setLevel(treeN.getCount());
		if (treeN.getSchemaType() != null) {
			switch (treeN.getSchemaType()) {
			case ARRAY:
				treeNodeNew.setSchemaDataType(SchemaDataType.ARRAY);
				break;
			case BOOLEAN:
				treeNodeNew.setSchemaDataType(SchemaDataType.BOOLEAN);
				break;
			case BYTES:
				treeNodeNew.setSchemaDataType(SchemaDataType.BYTES);
				break;
			case DOUBLE:
				treeNodeNew.setSchemaDataType(SchemaDataType.DOUBLE);
				break;
			case ENUM:
				treeNodeNew.setSchemaDataType(SchemaDataType.ENUM);
				break;
			case FIXED:
				treeNodeNew.setSchemaDataType(SchemaDataType.FIXED);
				break;
			case FLOAT:
				treeNodeNew.setSchemaDataType(SchemaDataType.FLOAT);
				break;
			case INT:
				treeNodeNew.setSchemaDataType(SchemaDataType.INT);
				break;
			case LONG:
				treeNodeNew.setSchemaDataType(SchemaDataType.LONG);
				break;
			case MAP:
				treeNodeNew.setSchemaDataType(SchemaDataType.MAP);
				break;
			case NULL:
				treeNodeNew.setSchemaDataType(SchemaDataType.NULL);
				break;
			case RECORD:
				treeNodeNew.setSchemaDataType(SchemaDataType.RECORD);
				break;
			case STRING:
				treeNodeNew.setSchemaDataType(SchemaDataType.STRING);
				break;
			case UNION:
				treeNodeNew.setSchemaDataType(SchemaDataType.UNION);
				break;
			default:
				break;
			}
		}
		treeNode.getNode().add(treeNodeNew);

		if (!(treeN.getElements().isEmpty())) {
			for (org.wso2.developerstudio.datamapper.diagram.tree.model.Element element : treeN
					.getElements()) {
				createElement(element, treeNodeNew);
			}
		}
		if (!(treeN.getAttributes().isEmpty())) {
			for (org.wso2.developerstudio.datamapper.diagram.tree.model.Attribute attribute : treeN
					.getAttributes()) {
				createAttribute(attribute, treeNodeNew);
			}
		}
		if (!(treeN.getTrees().isEmpty())) {
			for (Tree treeNew : treeN.getTrees()) {
				createTree(treeNew, treeNodeNew);
			}
		}
	}

	/**
	 * @generated NOT
	 */
	protected void createDefaultEditPolicies() {
		installEditPolicy(
				EditPolicyRoles.CREATION_ROLE,
				new CreationEditPolicyWithCustomReparent(
						org.wso2.developerstudio.datamapper.diagram.part.DataMapperVisualIDRegistry.TYPED_INSTANCE));
		super.createDefaultEditPolicies();
		installEditPolicy(
				EditPolicyRoles.SEMANTIC_ROLE,
				new org.wso2.developerstudio.datamapper.diagram.edit.policies.OutputItemSemanticEditPolicy());
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
		installEditPolicy(
				EditPolicyRoles.CANONICAL_ROLE,
				new org.wso2.developerstudio.datamapper.diagram.edit.policies.OutputCanonicalEditPolicy());
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());

		removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
	}

	/**
	 * @generated
	 */
	protected LayoutEditPolicy createLayoutEditPolicy() {
		org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {

			protected EditPolicy createChildEditPolicy(EditPart child) {
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
				if (result == null) {
					result = new NonResizableEditPolicy();
				}
				return result;
			}

			protected Command getMoveChildrenCommand(Request request) {
				return null;
			}

			protected Command getCreateCommand(CreateRequest request) {
				return null;
			}
		};
		return lep;
	}

	public void notifyChanged(Notification notification) {
		super.notifyChanged(notification);
		if (notification.getFeature() instanceof EAttributeImpl) {
			if (notification.getNotifier() instanceof BoundsImpl) {
				reposition(((BoundsImpl) notification.getNotifier()).getX(),
						((BoundsImpl) notification.getNotifier()).getY(),
						((BoundsImpl) notification.getNotifier()).getWidth(),
						((BoundsImpl) notification.getNotifier()).getHeight());
				FigureCanvas canvas = (FigureCanvas) getViewer().getControl();
				canvas.getViewport().repaint();
			}
		}
	}

	private void reposition(int x, int y, int width, int height) {
		if (y == 0) {
			y = Y;
			x = X;
		}
		Rectangle constraints = new Rectangle(x, y, width, height);
		((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), constraints);
		FigureCanvas canvas = (FigureCanvas) getViewer().getControl();
		canvas.getViewport().repaint();
	}

	private void reposition() {
		reposition(getFigure().getBounds().x, getFigure().getBounds().y,
				getFigure().getBounds().width, getFigure().getBounds().height);
	}

	/**
	 * @generated NOT
	 */
	protected IFigure createNodeShape() {
		return primaryShape = new OutputFigure() {
			public void setBounds(org.eclipse.draw2d.geometry.Rectangle rect) {
				super.setBounds(rect);
				reposition();
			};
		};
	}

	/**
	 * @generated
	 */
	public RectangleFigure getPrimaryShape() {
		return (RectangleFigure) primaryShape;
	}

	/**
	 * @generated
	 */
	protected NodeFigure createNodePlate() {
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
		return result;
	}

	/**
	 * @generated
	 */
	public EditPolicy getPrimaryDragEditPolicy() {
		EditPolicy result = super.getPrimaryDragEditPolicy();
		if (result instanceof ResizableEditPolicy) {
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
			ep.setResizeDirections(PositionConstants.NONE);
		}
		return result;
	}

	/**
	 * Creates figure for this edit part.
	 *
	 * Body of this method does not depend on settings in generation model
	 * so you may safely remove <i>generated</i> tag and modify it.
	 *
	 * @generated
	 */
	protected NodeFigure createNodeFigure() {
		NodeFigure figure = createNodePlate();
		figure.setLayoutManager(new StackLayout());
		IFigure shape = createNodeShape();
		figure.add(shape);
		contentPane = setupContentPane(shape);
		return figure;
	}

	/**
	 * Default implementation treats passed figure as content pane.
	 * Respects layout one may have set for generated figure.
	 * @param nodeShape instance of generated figure class
	 * @generated
	 */
	protected IFigure setupContentPane(IFigure nodeShape) {
		if (nodeShape.getLayoutManager() == null) {
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
			layout.setSpacing(5);
			nodeShape.setLayoutManager(layout);
		}
		return nodeShape; // use nodeShape itself as contentPane
	}

	/**
	 * @generated
	 */
	public IFigure getContentPane() {
		if (contentPane != null) {
			return contentPane;
		}
		return super.getContentPane();
	}

	/**
	 * @generated
	 */
	protected void setForegroundColor(Color color) {
		if (primaryShape != null) {
			primaryShape.setForegroundColor(color);
		}
	}

	/**
	 * @generated
	 */
	protected void setBackgroundColor(Color color) {
		if (primaryShape != null) {
			primaryShape.setBackgroundColor(color);
		}
	}

	/**
	 * @generated
	 */
	protected void setLineWidth(int width) {
		if (primaryShape instanceof Shape) {
			((Shape) primaryShape).setLineWidth(width);
		}
	}

	/**
	 * @generated
	 */
	protected void setLineType(int style) {
		if (primaryShape instanceof Shape) {
			((Shape) primaryShape).setLineStyle(style);
		}
	}

	/**
	 * @generated NOT
	 */
	public class OutputFigure extends RectangleFigure {

		private WrappingLabel fFigureTargetNameFigure;

		/**
		 * @generated NOT
		 */
		@SuppressWarnings("deprecation")
		public OutputFigure() {

			ToolbarLayout layoutThis = new ToolbarLayout();
			layoutThis.setStretchMinorAxis(true);
			layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
			layoutThis.setSpacing(0);
			layoutThis.setVertical(true);
			this.setLayoutManager(layoutThis);
			this.setPreferredSize(new Dimension(getMapMode().DPtoLP(250), getMapMode().DPtoLP(100)));
			this.setOutline(true);

			TitleBarBorder titleBarBorder = new TitleBarBorder("Output");
			titleBarBorder.setBackgroundColor(new Color(null, 96, 148, 219));
			titleBarBorder.setTextColor(new Color(null, 0, 0, 0));
			titleBarBorder.setFont(new Font(null, "Arial", 10, SWT.NORMAL));
			this.setBorder(titleBarBorder);

		}

		/**
		 * @generated NOT
		 */
		@SuppressWarnings("unused")
		private void createContents() {

			fFigureTargetNameFigure = new WrappingLabel();

			fFigureTargetNameFigure.setText("Output");

			this.add(fFigureTargetNameFigure);

		}

	}

}


text:
<?php

return [

	//Time to store cached pages if not specified.
	'time' => 300,

	//Allow skipping cache using parameters in HTTP request.
	'allowSkipping' => true,

	//Allow clearing the cached response using parameters in HTTP request.
	'allowClearing' => true,

	//Allow flushing all cached pages using parameters in HTTP request.
	'allowFlushing' => false,
];


text:
fiddle-0005-ScanOperator
======

### Title

Scan Operator

### Creation Date

01-05-17

### Issue

[Issue 135](https://github.com/bradyhouse/house/issues/135)

### Location

Chicago, IL

### Description

Fiddle exploring the Observable `scan` operator.

### Published Version Link

N/A

### Tags

rxjs, d3, observable, interval, scan


text:
0)">

      <div tabindex="1" id={{node.elementId}} role="treeitem" (keyup.arrowup)="onArrowUp(data,node,rowindex)"
        (keyup.arrowdown)="onArrowDown($event,data,node,rowindex)" class="tree-node-label tree-node-label-hover"
        [attr.aria-expanded]="node.expand" [ngClass]="{'tree-node-label-selected':node.isSelected ,'tree-node-label-not-selected':node.isSelected==false}"
        [attr.draggable]="enabledrag" (dragleave)="dragleave($event)" (drop)="drop({event:$event,data:node})"
        (dragover)="allowDrop({event:$event,data:node})" (dragstart)="onDragStart({event:$event,data:node})"
        (contextmenu)="loadContextMenu({event:$event,data:node,ref:id})">

          <input type="checkbox" [checked]="'checked'?node.checked:null" (click)="emitCheckedData(node,parentNode,data)" />

              {{node[displaykey]}}
              <ng-container *ngIf="badge && node.badge">
                {{node.badge}}
              </ng-container>

            <ng-template [ngTemplateOutlet]="templates.treeNodeTemplate" [ngTemplateOutletContext]="{ $implicit: { text: node.text } , icon: node.icon,node : node }">
            </ng-template>

0)">
    <amexio-treeview [child-array-key]="childarraykey" [display-key]="displaykey" [enable-drag]="enabledrag"
      [enable-drop]="enabledrop" [word-wrap]="wordwrap"  [parentNode]=node [data]="node[childarraykey]"  [dragData]="dragData" [parentRef]="parentRef" (onDrag)=onDragStart($event)
      (onDrop)=drop($event) (nodeClick)="onNodeClick($event)" (dragleave)="($event)" (nodeRightClick)="loadContextMenu($event)"
      [across-tree]="acrosstree" [templates]="templates"
       [global-tree-data]="globalTreeData"
       [filter-tree-flag]="filtertreeflag"
       [enable-checkbox]="enablecheckbox" [badge]="badge"
      (onTreeNodeChecked)="this.onTreeNodeCheck($event)">
    </amexio-treeview>

<ng-container *ngIf="flag">
  <base-contextmenu [base-context-menu]="contextmenu" [mouse-location-top]="mouseLocation.top" [mouse-location-left]="mouseLocation.left"
    [is-FlagShow]="flag" [right-click-data]="rightClickNodeData" (onRightClick)="rightClickDataEmit($event)"
    [position-up]="posixUp">
  </base-contextmenu>
</ng-container>


text:
<?php

namespace Clue\Tests\React\Docker;

use Clue\React\Block;
use Clue\React\Docker\Client;
use React\EventLoop\Loop;
use React\Promise\Stream;

class FunctionalClientTest extends TestCase
{
    private $client;

    /**
     * @before
     */
    public function setUpClient()
    {
        $this->client = new Client();

        $promise = $this->client->ping();

        try {
            Block\await($promise, Loop::get());
        } catch (\Exception $e) {
            $this->markTestSkipped('Unable to connect to docker ' . $e->getMessage());
        }
    }

    public function testPing()
    {
        $this->expectPromiseResolve($this->client->ping(), 'OK');

        Loop::run();
    }

    /**
     * @doesNotPerformAssertions
     */
    public function testImageInspectCheckIfBusyboxExists()
    {
        $promise = $this->client->imageInspect('busybox:latest');

        try {
            Block\await($promise, Loop::get());
        } catch (\RuntimeException $e) {
            $this->markTestSkipped('Image "busybox" not downloaded yet');
        }
    }

    /**
     * @depends testImageInspectCheckIfBusyboxExists
     */
    public function testCreateStartAndRemoveContainer()
    {
        $config = array(
            'Image' => 'busybox',
            'Cmd' => array('echo', 'test')
        );

        $promise = $this->client->containerCreate($config);
        $container = Block\await($promise, Loop::get());

        $this->assertNotNull($container['Id']);
        $this->assertEmpty($container['Warnings']);

        $start = microtime(true);

        $promise = $this->client->containerStart($container['Id']);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals('', $ret);

        $promise = $this->client->containerLogs($container['Id'], false, true, true);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals("test\n", $ret);

        $promise = $this->client->containerAttach($container['Id'], true, false);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals("test\n", $ret);

        $promise = $this->client->containerRemove($container['Id'], false, true);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals('', $ret);

        $end = microtime(true);

        // get all events between starting and removing for this container
        $promise = $this->client->events($start, $end, array('container' => array($container['Id'])));
        $ret = Block\await($promise, Loop::get());

        // expects "start", "attach", "kill", "die", "destroy" events
        $this->assertEquals(5, count($ret));
        $this->assertEquals('start', $ret[0]['status']);
        $this->assertEquals('attach', $ret[1]['status']);
        $this->assertEquals('kill', $ret[2]['status']);
        $this->assertEquals('die', $ret[3]['status']);
        $this->assertEquals('destroy', $ret[4]['status']);
    }

    /**
     * @depends testImageInspectCheckIfBusyboxExists
     */
    public function testStartRunning()
    {
        $config = array(
            'Image' => 'busybox',
            'Tty' => true,
            'Cmd' => array('sleep', '10')
        );

        $promise = $this->client->containerCreate($config);
        $container = Block\await($promise, Loop::get());

        $this->assertNotNull($container['Id']);
        $this->assertEmpty($container['Warnings']);

        $promise = $this->client->containerStart($container['Id']);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals('', $ret);

        return $container['Id'];
    }

    /**
     * @depends testStartRunning
     * @param string $container
     * @return string
     */
    public function testExecCreateWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, array('echo', '-n', 'hello', 'world'));
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        return $exec['Id'];
    }

    /**
     * @depends testExecCreateWhileRunning
     * @param string $exec
     */
    public function testExecInspectBeforeRunning($exec)
    {
        $promise = $this->client->execInspect($exec);
        $info = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($info));
        $this->assertFalse($info['Running']);
        $this->assertEquals(null, $info['ExitCode']);
    }

    /**
     * @depends testExecCreateWhileRunning
     * @param string $exec
     */
    public function testExecStartWhileRunning($exec)
    {
        $promise = $this->client->execStart($exec);
        $output = Block\await($promise, Loop::get());

        $this->assertEquals('hello world', $output);
    }

    /**
     * @depends testExecCreateWhileRunning
     * @param string $exec
     */
    public function testExecInspectAfterRunning($exec)
    {
        $promise = $this->client->execInspect($exec);
        $info = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($info));
        $this->assertFalse($info['Running']);
        $this->assertEquals(0, $info['ExitCode']);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecStringCommandWithOutputWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, 'echo -n hello world');
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $promise = $this->client->execStart($exec['Id']);
        $output = Block\await($promise, Loop::get());

        $this->assertEquals('hello world', $output);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecStreamOutputInMultipleChunksWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, 'echo -n hello && sleep 0.2 && echo -n world');
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $stream = $this->client->execStartStream($exec['Id']);
        $stream->once('data', $this->expectCallableOnceWith('hello'));
        $stream->on('end', $this->expectCallableOnce());

        $output = Block\await(Stream\buffer($stream), Loop::get());

        $this->assertEquals('helloworld', $output);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecUserSpecificCommandWithOutputWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, 'whoami', false, false, true, true, 'nobody');
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $promise = $this->client->execStart($exec['Id']);
        $output = Block\await($promise, Loop::get());

        $this->assertEquals('nobody', rtrim($output));
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecStringCommandWithStderrOutputWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, 'echo -n hello world >&2');
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $promise = $this->client->execStart($exec['Id']);
        $output = Block\await($promise, Loop::get());

        $this->assertEquals('hello world', $output);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecStreamCommandWithTtyAndStderrOutputWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, 'echo -n hello world >&2', true);
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $stream = $this->client->execStartStream($exec['Id'], true);
        $stream->once('data', $this->expectCallableOnce('hello world'));
        $stream->on('end', $this->expectCallableOnce());

        $output = Block\await(Stream\buffer($stream), Loop::get());

        $this->assertEquals('hello world', $output);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecStreamStderrCustomEventWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, 'echo -n hello world >&2');
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $stream = $this->client->execStartStream($exec['Id'], false, 'err');
        $stream->on('err', $this->expectCallableOnceWith('hello world'));
        $stream->on('data', $this->expectCallableNever());
        $stream->on('error', $this->expectCallableNever());
        $stream->on('end', $this->expectCallableOnce());

        $output = Block\await(Stream\buffer($stream), Loop::get());

        $this->assertEquals('', $output);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecStreamEmptyOutputWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, array('true'));
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $stream = $this->client->execStartStream($exec['Id'], true);
        $stream->on('end', $this->expectCallableOnce());

        $output = Block\await(Stream\buffer($stream), Loop::get());

        $this->assertEquals('', $output);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testExecDetachedWhileRunning($container)
    {
        $promise = $this->client->execCreate($container, array('sleep', '10'));
        $exec = Block\await($promise, Loop::get());

        $this->assertTrue(is_array($exec));
        $this->assertTrue(is_string($exec['Id']));

        $promise = $this->client->execStartDetached($exec['Id'], true);
        $output = Block\await($promise, Loop::get());

        $this->assertEquals('', $output);
    }

    /**
     * @depends testStartRunning
     * @param string $container
     */
    public function testRemoveRunning($container)
    {
        $promise = $this->client->containerRemove($container, true, true);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals('', $ret);
    }

    public function testContainerRemoveInvalid()
    {
        $promise = $this->client->containerRemove('invalid123');
        $this->setExpectedException('RuntimeException');
        Block\await($promise, Loop::get());
    }

    public function testImageSearch()
    {
        $promise = $this->client->imageSearch('clue');
        $ret = Block\await($promise, Loop::get());

        $this->assertGreaterThan(9, count($ret));
    }

    /**
     * @depends testImageInspectCheckIfBusyboxExists
     * @doesNotPerformAssertions
     */
    public function testImageTag()
    {
        // create new tag "bb:now" on "busybox:latest"
        $promise = $this->client->imageTag('busybox', 'bb', 'now');
        Block\await($promise, Loop::get());

        // delete tag "bb:now" again
        $promise = $this->client->imageRemove('bb:now');
        Block\await($promise, Loop::get());
    }

    public function testImageCreateStreamMissingWillEmitJsonError()
    {
        $promise = $this->client->version();
        $version = Block\await($promise, Loop::get());

        // old API reports a progress with error message, newer API just returns 404 right away
        // https://docs.docker.com/engine/api/version-history/
        $old = $version['ApiVersion'] < '1.22';

        $stream = $this->client->imageCreateStream('clue/does-not-exist');

        // one "progress" event, but no "data" events
        $old && $stream->on('progress', $this->expectCallableOnce());
        $old || $stream->on('progress', $this->expectCallableNever());
        $stream->on('data', $this->expectCallableNever());

        // will emit "error" with RuntimeException and close
        $old && $stream->on('error', $this->expectCallableOnceParameter('RuntimeException'));
        $old || $stream->on('error', $this->expectCallableOnceParameter('React\Http\Message\ResponseException'));
        $stream->on('close', $this->expectCallableOnce());

        Loop::run();
    }

    public function testInfo()
    {
        $this->expectPromiseResolve($this->client->info());

        Loop::run();
    }

    public function testVersion()
    {
        $this->expectPromiseResolve($this->client->version());

        Loop::run();
    }

    public function testContainerList()
    {
        $this->expectPromiseResolve($this->client->containerList());

        Loop::run();
    }

    /**
     * @depends testImageInspectCheckIfBusyboxExists
     */
    public function testCreateConnectDisconnectAndRemoveNetwork()
    {
        $containerConfig = array(
            'Image' => 'busybox',
            'Cmd' => array('echo', 'test')
        );
        $networkName = uniqid('reactphp-docker');

        $promise = $this->client->containerCreate($containerConfig);
        $container = Block\await($promise, Loop::get());

        $start = microtime(true);

        $promise = $this->client->networkCreate($networkName);
        $network = Block\await($promise, Loop::get());

        $this->assertNotNull($network['Id']);
        $this->assertEquals('', $network['Warning']);

        $promise = $this->client->networkConnect($network['Id'], $container['Id']);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals('', $ret);

        $promise = $this->client->networkDisconnect($network['Id'], $container['Id'], false);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals('', $ret);

        $promise = $this->client->networkRemove($network['Id']);
        $ret = Block\await($promise, Loop::get());

        $this->assertEquals('', $ret);

        $end = microtime(true);

        $promise = $this->client->containerRemove($container['Id']);
        $ret = Block\await($promise, Loop::get());

        // get all events between starting and removing for this container
        $promise = $this->client->events($start, $end, array('network' => array($network['Id'])));
        $ret = Block\await($promise, Loop::get());

        // expects "create", "disconnect", "destroy" events ("connect" will be skipped because we don't start the container)
        $this->assertEquals(3, count($ret));
        $this->assertEquals('create', $ret[0]['Action']);
        $this->assertEquals('disconnect', $ret[1]['Action']);
        $this->assertEquals('destroy', $ret[2]['Action']);
    }
}


text:
<?php
/**
 * Author: Maxim
 * Date: 30/01/14
 * Time: 21:28
 * Property of MCSuite
 */

namespace Maxim\Module\ForumBundle\Component\Validator;

use Doctrine\ORM\EntityManager;
use Maxim\CMSBundle\Entity\User;
use Maxim\CMSBundle\Helper\MinecraftHelper;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\ExecutionContextInterface;

class PostThresholdValidator extends ConstraintValidator
{
    private $securityContext;
    private $em;
    private $threshold;

    public function __construct(SecurityContext $securityContext, EntityManager $em, $threshold)
    {
        $this->securityContext = $securityContext;
        $this->em = $em;
        $this->threshold = $threshold;
    }

    public function validate($object, Constraint $constraint)
    {
        # get user
        $user = $this->securityContext->getToken()->getUser();

        # get last thread of the user
        $lastPost = $this->em->getRepository("MaximModuleForumBundle:Post")->findLatestPost($user);

        if(isset($lastPost[0]) && (false === $this->securityContext->isGranted('ROLE_STAFF')))
        {
            // check time difference
            $diff = $lastPost[0]->getCreatedOn()->diff(new \DateTime("now"));

            if(!($diff->days > 0 || $diff->i > $this->threshold))
            {
                $this->context->addViolation($constraint->postThresholdMessage, array(
                    '%time%' => $this->threshold,
                    '%string_minutes%' => $this->threshold > 1 ? "minutes" : "minute")
                );
            }
        }
    }

    public function validatedBy()
    {
        return 'maxim_module_forum_validator_postThreshold';
    }
}


text:
namespace tensorflow {
class OpKernelContext;
}

namespace deepmind {
namespace tensorflow {
namespace sonnet {
namespace functor {

// Helper functor for the Resampler Op in 2D
template <typename Device, typename T>
struct Resampler2DFunctor{
  void operator ()(::tensorflow::OpKernelContext* ctx,
                   const Device& d,
                   const T* __restrict__ data,
                   const T* __restrict__ warp,
                   T* __restrict__ output,
                   const int batch_size,
                   const int data_height,
                   const int data_width,
                   const int data_channels,
                   const int num_sampling_points);
};

// Helper functor for the Resampler Gradient Op in 2D
template <typename Device, typename T>
struct ResamplerGrad2DFunctor{
  void operator ()(::tensorflow::OpKernelContext* ctx,
                   const Device& d,
                   const T* __restrict__ data,
                   const T* __restrict__ warp,
                   const T* __restrict__ grad_output,
                   T* __restrict__ grad_data,
                   T* __restrict__ grad_warp,
                   const int batch_size,
                   const int data_height,
                   const int data_width,
                   const int data_channels,
                   const int num_sampling_points);
};

}  // namespace functor
}  // namespace sonnet
}  // namespace tensorflow
}  // namespace deepmind

#endif  // SONNET_CC_KERNELS_RESAMPLER_OP_H_


text:
#!/usr/bin/env node

// requires
var wc      = require('webcredits');
var program = require('commander');

/**
 * version as a command
 */
function bin(argv) {
  // setup config
  var config = wc.getConfig();

  program
  .option('-d, --database <database>', 'Database')
  .option('-w, --wallet <wallet>', 'Wallet')
  .parse(argv);

  var defaultDatabase = 'webcredits';
  var defaultWallet   = 'https://localhost/wallet/test#this';

  config.database = program.database || config.database || defaultDatabase;
  config.wallet   = program.wallet   || config.wallet   || defaultWallet;

  wc.genesis(config, function(err, ret) {
    if (err) {
      console.error(err);
    } else {
      console.log(ret);
    }
  });

}

// If one import this file, this is a module, otherwise a library
if (require.main === module) {
  bin(process.argv);
}

module.exports = bin;


text:
set -e -x -u

SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

PY_VERSION="3.7" NOXSESSION="lint,lint_setup_py,unit" ${SCRIPT_DIR}/docker_tests.sh
PY_VERSION="3.6" NOXSESSION="unit" ${SCRIPT_DIR}/docker_tests.sh
PY_VERSION="3.5" NOXSESSION="unit" ${SCRIPT_DIR}/docker_tests.sh
PY_VERSION="2.7" NOXSESSION="default" ${SCRIPT_DIR}/docker_tests.sh


text:
@implementation UILabel(UIAdditions)

-(void)applyBlurAndShadow
{
    [self applyBlurAndShadowWithOffset:1.0];
}

-(void)applyBlurAndShadowWithOffset:(CGFloat) offset;
{
	self.layer.shadowRadius = 0.0;
	self.layer.shadowOpacity = 1.0;
	self.layer.shadowOffset = CGSizeMake(0, offset);
	self.layer.shadowColor = [UIColor blackColor].CGColor;
}
@end


text:
`elm-make` ultimately needs to run with `node_modules/elm-router/lib/elm/ElmRouter/App.elm` given as one of the apps.

For example:

```
$ elm-make --output elm.js ./App1.elm ./App2.elm ../node_modules/elm-router/lib/elm/ElmRouter/App.elm
```

If you're using a build tool like [Brunch](http://brunch.io/) or [Webpack](https://webpack.js.org/) so that you don't manually run `elm-make`, you'll need to figure out how to make this happen.

## Example: Webpack + [elm-webpack-project-loader](https://github.com/joeandaverde/elm-webpack-project-loader)

With these two tools, you'll need to add the path to `"main-modules"` in your `.elmproj` file:

```javascript
// my-elm-project.elmproj
{
  ...

  "main-modules": [
    ...

    "../../node_modules/elm-router/lib/elm/ElmRouter/App.elm" // Exact path to node_modules may be different
  ]
}
```


text:
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _ATKMM_HYPERLINK_H
#define _ATKMM_HYPERLINK_H

#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>

#include <atkmm/action.h>

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _AtkHyperlink AtkHyperlink;
typedef struct _AtkHyperlinkClass AtkHyperlinkClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Atk
{ class Hyperlink_Class; } // namespace Atk
namespace Atk
{

class Object;

/** Encapsulates a link or set of links in a hypertext document.
 */

class Hyperlink : public Glib::Object, public Atk::Action
{

#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef Hyperlink CppObjectType;
  typedef Hyperlink_Class CppClassType;
  typedef AtkHyperlink BaseObjectType;
  typedef AtkHyperlinkClass BaseClassType;

private:  friend class Hyperlink_Class;
  static CppClassType hyperlink_class_;

private:
  // noncopyable
  Hyperlink(const Hyperlink&);
  Hyperlink& operator=(const Hyperlink&);

protected:
  explicit Hyperlink(const Glib::ConstructParams& construct_params);
  explicit Hyperlink(AtkHyperlink* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~Hyperlink();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;

  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  AtkHyperlink*       gobj()       { return reinterpret_cast<AtkHyperlink*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const AtkHyperlink* gobj() const { return reinterpret_cast<AtkHyperlink*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  AtkHyperlink* gobj_copy();

private:

public:

  /** Get a the URI associated with the anchor specified
   * by @a i of @a link.
   *
   * Multiple anchors are primarily used by client-side image maps.
   * @param i A (zero-index) integer specifying the desired anchor.
   * @return A string specifying the URI.
   */
  Glib::ustring get_uri(int i) const;

  /** Returns the item associated with this hyperlinks nth anchor.
   * For instance, the returned Atk::Object will implement Atk::Text
   * if @a link is a text hyperlink, Atk::Image if @a link is an image
   * hyperlink etc.
   *
   * Multiple anchors are primarily used by client-side image maps.
   * @param i A (zero-index) integer specifying the desired anchor.
   * @return An Atk::Object associated with this hyperlinks i-th anchor.
   */
  Glib::RefPtr<Atk::Object> get_object(int i);

  /** Returns the item associated with this hyperlinks nth anchor.
   * For instance, the returned Atk::Object will implement Atk::Text
   * if @a link is a text hyperlink, Atk::Image if @a link is an image
   * hyperlink etc.
   *
   * Multiple anchors are primarily used by client-side image maps.
   * @param i A (zero-index) integer specifying the desired anchor.
   * @return An Atk::Object associated with this hyperlinks i-th anchor.
   */
  Glib::RefPtr<const Atk::Object> get_object(int i) const;

  /** Gets the index with the hypertext document at which this link ends.
   * @return The index with the hypertext document at which this link ends.
   */
  int get_end_index() const;

  /** Gets the index with the hypertext document at which this link begins.
   * @return The index with the hypertext document at which this link begins.
   */
  int get_start_index() const;

  /** Since the document that a link is associated with may have changed
   * this method returns <tt>true</tt> if the link is still valid (with
   * respect to the document it references) and <tt>false</tt> otherwise.
   * @return Whether or not this link is still valid.
   */
  bool is_valid() const;

  /** Indicates whether the link currently displays some or all of its
   * content inline.  Ordinary HTML links will usually return
   * <tt>false</tt>, but an inline <src> HTML element will return
   * <tt>true</tt>.
   * a *
   * @return Whether or not this link displays its content inline.
   */
  bool is_inline() const;

  /** Gets the number of anchors associated with this hyperlink.
   * @return The number of anchors associated with this hyperlink.
   */
  int get_n_anchors() const;
   // deprecated

  /**
   * @par Prototype:
   * <tt>void on_my_%link_activated()</tt>
   */

  Glib::SignalProxy0< void > signal_link_activated();

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** Specifies whether the AtkHyperlink object is selected.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<bool> property_selected_link() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The number of anchors associated with the AtkHyperlink object.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<int> property_number_of_anchors() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The end index of the AtkHyperlink object.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<int> property_end_index() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The start index of the AtkHyperlink object.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<int> property_start_index() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

protected:
    virtual gchar* get_uri_vfunc(int i) const;

    virtual Glib::RefPtr<Atk::Object> get_object_vfunc(int i);

    virtual int get_end_index_vfunc() const;

    virtual int get_start_index_vfunc() const;

    virtual bool is_valid_vfunc() const;

    virtual int get_n_anchors_vfunc() const;

    virtual guint link_state_vfunc() const;

    virtual bool is_selected_link_vfunc() const;

public:

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::
  virtual void on_link_activated();

};

} // namespace Atk

namespace Glib
{
  /** A Glib::wrap() method for this object.
   *
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Atk::Hyperlink
   */
  Glib::RefPtr<Atk::Hyperlink> wrap(AtkHyperlink* object, bool take_copy = false);
}

#endif /* _ATKMM_HYPERLINK_H */