text:
package com.google.android.exoplayer2.source;

import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.drm.DrmSessionEventListener;
import com.google.android.exoplayer2.upstream.TransferListener;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.MediaSourceEventDispatcher;
import java.util.ArrayList;
import java.util.HashSet;

/**
 * Base {@link MediaSource} implementation to handle parallel reuse and to keep a list of {@link
 * MediaSourceEventListener}s.
 *
 *
Whenever an implementing subclass needs to provide a new timeline, it must call {@link
 * #refreshSourceInfo(Timeline)} to notify all listeners.
 */
public abstract class BaseMediaSource implements MediaSource {

  private final ArrayList<MediaSourceCaller> mediaSourceCallers;
  private final HashSet<MediaSourceCaller> enabledMediaSourceCallers;
  private final MediaSourceEventListener.EventDispatcher eventDispatcher;

  @Nullable private Looper looper;
  @Nullable private Timeline timeline;

  public BaseMediaSource() {
    mediaSourceCallers = new ArrayList<>(/* initialCapacity= */ 1);
    enabledMediaSourceCallers = new HashSet<>(/* initialCapacity= */ 1);
    eventDispatcher = new MediaSourceEventListener.EventDispatcher();
  }

  /**
   * Starts source preparation and enables the source, see {@link #prepareSource(MediaSourceCaller,
   * TransferListener)}. This method is called at most once until the next call to {@link
   * #releaseSourceInternal()}.
   *
   * @param mediaTransferListener The transfer listener which should be informed of any media data
   *     transfers. May be null if no listener is available. Note that this listener should usually
   *     be only informed of transfers related to the media loads and not of auxiliary loads for
   *     manifests and other data.
   */
  protected abstract void prepareSourceInternal(@Nullable TransferListener mediaTransferListener);

  /** Enables the source, see {@link #enable(MediaSourceCaller)}. */
  protected void enableInternal() {}

  /** Disables the source, see {@link #disable(MediaSourceCaller)}. */
  protected void disableInternal() {}

  /**
   * Releases the source, see {@link #releaseSource(MediaSourceCaller)}. This method is called
   * exactly once after each call to {@link #prepareSourceInternal(TransferListener)}.
   */
  protected abstract void releaseSourceInternal();

  /**
   * Updates timeline and manifest and notifies all listeners of the update.
   *
   * @param timeline The new {@link Timeline}.
   */
  protected final void refreshSourceInfo(Timeline timeline) {
    this.timeline = timeline;
    for (MediaSourceCaller caller : mediaSourceCallers) {
      caller.onSourceInfoRefreshed(/* source= */ this, timeline);
    }
  }

  /**
   * Returns a {@link MediaSourceEventListener.EventDispatcher} which dispatches all events to the
   * registered listeners with the specified media period id.
   *
   * @param mediaPeriodId The {@link MediaPeriodId} to be reported with the events. May be null, if
   *     the events do not belong to a specific media period.
   * @return An event dispatcher with pre-configured media period id.
   */
  protected final MediaSourceEventListener.EventDispatcher createEventDispatcher(
      @Nullable MediaPeriodId mediaPeriodId) {
    return eventDispatcher.withParameters(
        /* windowIndex= */ 0, mediaPeriodId, /* mediaTimeOffsetMs= */ 0);
  }

  /**
   * Returns a {@link MediaSourceEventListener.EventDispatcher} which dispatches all events to the
   * registered listeners with the specified media period id and time offset.
   *
   * @param mediaPeriodId The {@link MediaPeriodId} to be reported with the events.
   * @param mediaTimeOffsetMs The offset to be added to all media times, in milliseconds.
   * @return An event dispatcher with pre-configured media period id and time offset.
   */
  protected final MediaSourceEventListener.EventDispatcher createEventDispatcher(
      MediaPeriodId mediaPeriodId, long mediaTimeOffsetMs) {
    Assertions.checkNotNull(mediaPeriodId);
    return eventDispatcher.withParameters(/* windowIndex= */ 0, mediaPeriodId, mediaTimeOffsetMs);
  }

  /**
   * Returns a {@link MediaSourceEventListener.EventDispatcher} which dispatches all events to the
   * registered listeners with the specified window index, media period id and time offset.
   *
   * @param windowIndex The timeline window index to be reported with the events.
   * @param mediaPeriodId The {@link MediaPeriodId} to be reported with the events. May be null, if
   *     the events do not belong to a specific media period.
   * @param mediaTimeOffsetMs The offset to be added to all media times, in milliseconds.
   * @return An event dispatcher with pre-configured media period id and time offset.
   */
  protected final MediaSourceEventListener.EventDispatcher createEventDispatcher(
      int windowIndex, @Nullable MediaPeriodId mediaPeriodId, long mediaTimeOffsetMs) {
    return eventDispatcher.withParameters(windowIndex, mediaPeriodId, mediaTimeOffsetMs);
  }

  /** Returns whether the source is enabled. */
  protected final boolean isEnabled() {
    return !enabledMediaSourceCallers.isEmpty();
  }

  @Override
  public final void addEventListener(Handler handler, MediaSourceEventListener eventListener) {
    addEventListenerInternal(handler, eventListener, MediaSourceEventListener.class);
  }

  @Override
  public final void removeEventListener(MediaSourceEventListener eventListener) {
    removeEventListenerInternal(eventListener, MediaSourceEventListener.class);
  }

  @Override
  public final void addDrmEventListener(Handler handler, DrmSessionEventListener eventListener) {
    addEventListenerInternal(handler, eventListener, DrmSessionEventListener.class);
  }

  @Override
  public final void removeDrmEventListener(DrmSessionEventListener eventListener) {
    removeEventListenerInternal(eventListener, DrmSessionEventListener.class);
  }

  /**
   * Adds a listener to the internal {@link MediaSourceEventDispatcher} with the provided type.
   *
   *
NOTE: Read the caveats on {@link MediaSourceEventDispatcher#addEventListener(Handler,
   * Object, Class)} when deciding what value to pass for {@code listenerClass}.
   *
   * @see MediaSourceEventDispatcher#addEventListener(Handler, Object, Class)
   */
  protected final <T> void addEventListenerInternal(
      Handler handler, T eventListener, Class<T> listenerClass) {
    eventDispatcher.addEventListener(handler, eventListener, listenerClass);
  }

  /**
   * Removes a listener from the internal {@link MediaSourceEventDispatcher}.
   *
   * @see MediaSourceEventDispatcher#removeEventListener(Object, Class)
   */
  protected final <T> void removeEventListenerInternal(T eventListener, Class<T> listenerClass) {
    eventDispatcher.removeEventListener(eventListener, listenerClass);
  }

  @Override
  public final void prepareSource(
      MediaSourceCaller caller, @Nullable TransferListener mediaTransferListener) {
    Looper looper = Looper.myLooper();
    Assertions.checkArgument(this.looper == null || this.looper == looper);
    @Nullable Timeline timeline = this.timeline;
    mediaSourceCallers.add(caller);
    if (this.looper == null) {
      this.looper = looper;
      enabledMediaSourceCallers.add(caller);
      prepareSourceInternal(mediaTransferListener);
    } else if (timeline != null) {
      enable(caller);
      caller.onSourceInfoRefreshed(/* source= */ this, timeline);
    }
  }

  @Override
  public final void enable(MediaSourceCaller caller) {
    Assertions.checkNotNull(looper);
    boolean wasDisabled = enabledMediaSourceCallers.isEmpty();
    enabledMediaSourceCallers.add(caller);
    if (wasDisabled) {
      enableInternal();
    }
  }

  @Override
  public final void disable(MediaSourceCaller caller) {
    boolean wasEnabled = !enabledMediaSourceCallers.isEmpty();
    enabledMediaSourceCallers.remove(caller);
    if (wasEnabled && enabledMediaSourceCallers.isEmpty()) {
      disableInternal();
    }
  }

  @Override
  public final void releaseSource(MediaSourceCaller caller) {
    mediaSourceCallers.remove(caller);
    if (mediaSourceCallers.isEmpty()) {
      looper = null;
      timeline = null;
      enabledMediaSourceCallers.clear();
      releaseSourceInternal();
    } else {
      disable(caller);
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.commons.ssl.util;

import java.io.UnsupportedEncodingException;

public class UTF8 {

    public static String toString(byte[] bytes) {
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException uee) {
            throw new RuntimeException("UTF8 unavailable", uee);
        }
    }

    public static byte[] toBytes(String s) {
        try {
            return s.getBytes("UTF-8");
        } catch (UnsupportedEncodingException uee) {
            throw new RuntimeException("UTF8 unavailable", uee);
        }
    }
}


text:
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#icon {
  list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric.svg");
  max-width: 48px;
  max-height: 48px;
  -moz-margin-end: 6px;
}

#eula-dialog[addontype="theme"] #icon {
  list-style-image: url("chrome://mozapps/skin/extensions/themeGeneric.png");
}

#eula-dialog[addontype="locale"] #icon {
  list-style-image: url("chrome://mozapps/skin/extensions/localeGeneric.png");
}

#eula-dialog[addontype="plugin"] #icon {
  list-style-image: url("chrome://mozapps/skin/plugins/pluginGeneric.png");
}

#eula-dialog[addontype="dictionary"] #icon {
  list-style-image: url("chrome://mozapps/skin/extensions/dictionaryGeneric.png");
}

#heading-container {
  -moz-box-align: center;
}

#heading {
  font-size: 120%;
}

#eula {
  -moz-appearance: none;
  color: -moz-FieldText;
  background-color: -moz-Field;
  margin: 1em;
  border: 1px solid;
  -moz-border-top-colors: ActiveBorder;
  -moz-border-right-colors: ActiveBorder;
  -moz-border-bottom-colors: ActiveBorder;
  -moz-border-left-colors: ActiveBorder;
}


text:
package com.nosolojava.android.fsm.listener;

import java.io.Serializable;

import android.app.Service;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;

import com.nosolojava.android.fsm.bean.PreferenceBean;

public class FSMPreferenceChangeListener implements OnSharedPreferenceChangeListener {

	private final String fsmSessionId;
	private final Context androidContext;
	private final Class<? extends Service> fsmServiceClazz;

	public FSMPreferenceChangeListener(String fsmSessionId, Context androidContext,
			Class<? extends Service> fsmServiceClazz) {
		super();
		this.fsmSessionId = fsmSessionId;
		this.androidContext = androidContext;
		this.fsmServiceClazz = fsmServiceClazz;
	}

	@Override
	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
		PreferenceBean<Serializable> pref = new PreferenceBean<Serializable>(Serializable.class, fsmServiceClazz, key);
		pref.sendUpdateToFSM(this.androidContext, this.fsmSessionId, sharedPreferences);

	}
}


text:
package com.alibaba.dubbo.common.extensionloader;

import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import static org.junit.matchers.JUnitMatchers.containsString;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.extensionloader.activate.ActivateExt1;
import com.alibaba.dubbo.common.extensionloader.activate.impl.ActivateExt1Impl1;
import com.alibaba.dubbo.common.extensionloader.activate.impl.GroupActivateExtImpl;
import com.alibaba.dubbo.common.extensionloader.activate.impl.OrderActivateExtImpl1;
import com.alibaba.dubbo.common.extensionloader.activate.impl.OrderActivateExtImpl2;
import com.alibaba.dubbo.common.extensionloader.activate.impl.ValueActivateExtImpl;
import junit.framework.Assert;

import org.junit.Test;

import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.extension.ExtensionLoader;
import com.alibaba.dubbo.common.extensionloader.ext1.Ext1;
import com.alibaba.dubbo.common.extensionloader.ext1.impl.Ext1Impl1;
import com.alibaba.dubbo.common.extensionloader.ext1.impl.Ext1Impl2;
import com.alibaba.dubbo.common.extensionloader.ext2.Ext2;
import com.alibaba.dubbo.common.extensionloader.ext2.UrlHolder;
import com.alibaba.dubbo.common.extensionloader.ext3.Ext3;
import com.alibaba.dubbo.common.extensionloader.ext4.Ext4;
import com.alibaba.dubbo.common.extensionloader.ext5.Ext5NoAdaptiveMethod;
import com.alibaba.dubbo.common.extensionloader.ext5.impl.Ext5Wrapper1;
import com.alibaba.dubbo.common.extensionloader.ext5.impl.Ext5Wrapper2;
import com.alibaba.dubbo.common.extensionloader.ext6_inject.Ext6;
import com.alibaba.dubbo.common.extensionloader.ext6_inject.impl.Ext6Impl2;
import com.alibaba.dubbo.common.extensionloader.ext7.Ext7;
import com.alibaba.dubbo.common.utils.LogUtil;

/**
 * @author ding.lid
 */
public class ExtensionLoaderTest {
    @Test
    public void test_getDefault() throws Exception {
        Ext1 ext = ExtensionLoader.getExtensionLoader(Ext1.class).getDefaultExtension();
        assertThat(ext, instanceOf(Ext1Impl1.class));

        String name = ExtensionLoader.getExtensionLoader(Ext1.class).getDefaultExtensionName();
        assertEquals("impl1", name);
    }

    @Test
    public void test_getDefault_NULL() throws Exception {
        Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getDefaultExtension();
        assertNull(ext);

        String name = ExtensionLoader.getExtensionLoader(Ext2.class).getDefaultExtensionName();
        assertNull(name);
    }

    @Test
    public void test_getExtension() throws Exception {
        assertTrue(ExtensionLoader.getExtensionLoader(Ext1.class).getExtension("impl1") instanceof Ext1Impl1);
        assertTrue(ExtensionLoader.getExtensionLoader(Ext1.class).getExtension("impl2") instanceof Ext1Impl2);
    }

    @Test
    public void test_getExtension_WithWrapper() throws Exception {
        Ext5NoAdaptiveMethod impl1 = ExtensionLoader.getExtensionLoader(Ext5NoAdaptiveMethod.class).getExtension("impl1");
        assertThat(impl1, anyOf(instanceOf(Ext5Wrapper1.class), instanceOf(Ext5Wrapper2.class)));

        Ext5NoAdaptiveMethod impl2 = ExtensionLoader.getExtensionLoader(Ext5NoAdaptiveMethod.class).getExtension("impl2") ;
        assertThat(impl2, anyOf(instanceOf(Ext5Wrapper1.class), instanceOf(Ext5Wrapper2.class)));

        URL url = new URL("p1", "1.2.3.4", 1010, "path1");
        int echoCount1 = Ext5Wrapper1.echoCount.get();
        int echoCount2 = Ext5Wrapper2.echoCount.get();
        int yellCount1 = Ext5Wrapper1.yellCount.get();
        int yellCount2 = Ext5Wrapper2.yellCount.get();

        assertEquals("Ext5Impl1-echo", impl1.echo(url, "ha"));
        assertEquals(echoCount1 + 1, Ext5Wrapper1.echoCount.get());
        assertEquals(echoCount2 + 1, Ext5Wrapper2.echoCount.get());
        assertEquals(yellCount1, Ext5Wrapper1.yellCount.get());
        assertEquals(yellCount2, Ext5Wrapper2.yellCount.get());

        assertEquals("Ext5Impl2-yell", impl2.yell(url, "ha"));
        assertEquals(echoCount1 + 1, Ext5Wrapper1.echoCount.get());
        assertEquals(echoCount2 + 1, Ext5Wrapper2.echoCount.get());
        assertEquals(yellCount1 + 1, Ext5Wrapper1.yellCount.get());
        assertEquals(yellCount2 + 1, Ext5Wrapper2.yellCount.get());
    }

    @Test
    public void test_getExtension_ExceptionNoExtension() throws Exception {
        try {
            ExtensionLoader.getExtensionLoader(Ext1.class).getExtension("XXX");
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(), containsString("No such extension com.alibaba.dubbo.common.extensionloader.ext1.Ext1 by name XXX"));
        }
    }

    @Test
    public void test_getExtension_ExceptionNoExtension_NameOnWrapperNoAffact() throws Exception {
        try {
            ExtensionLoader.getExtensionLoader(Ext5NoAdaptiveMethod.class).getExtension("XXX");
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(), containsString("No such extension com.alibaba.dubbo.common.extensionloader.ext5.Ext5NoAdaptiveMethod by name XXX"));
        }
    }

    @Test
    public void test_getExtension_ExceptionNullArg() throws Exception {
        try {
            ExtensionLoader.getExtensionLoader(Ext1.class).getExtension(null);
        } catch (IllegalArgumentException expected) {
            assertThat(expected.getMessage(), containsString("Extension name == null"));
        }
    }

    @Test
    public void test_hasExtension() throws Exception {
        assertTrue(ExtensionLoader.getExtensionLoader(Ext1.class).hasExtension("impl1"));
        assertFalse(ExtensionLoader.getExtensionLoader(Ext1.class).hasExtension("impl1,impl2"));
        assertFalse(ExtensionLoader.getExtensionLoader(Ext1.class).hasExtension("xxx"));

        try {
            ExtensionLoader.getExtensionLoader(Ext1.class).hasExtension(null);
            fail();
        } catch (IllegalArgumentException expected) {
            assertThat(expected.getMessage(), containsString("Extension name == null"));
        }
    }

    @Test
    public void test_getSupportedExtensions() throws Exception {
        Set<String> exts = ExtensionLoader.getExtensionLoader(Ext1.class).getSupportedExtensions();

        Set<String> expected = new HashSet<String>();
        expected.add("impl1");
        expected.add("impl2");
        expected.add("impl3");

        assertEquals(expected, exts);
    }

    @Test
    public void test_getSupportedExtensions_NoExtension() throws Exception {
        try {
            ExtensionLoader.getExtensionLoader(ExtensionLoaderTest.class).getSupportedExtensions();
            fail();
        } catch (IllegalArgumentException expected) {
            assertThat(expected.getMessage(),
                    allOf(containsString("com.alibaba.dubbo.common.extensionloader.ExtensionLoaderTest"),
                            containsString("is not extension"),
                            containsString("WITHOUT @SPI Annotation")));

        }
    }

    @Test
    public void test_getAdaptiveExtension_defaultExtension() throws Exception {
        Ext1 ext = ExtensionLoader.getExtensionLoader(Ext1.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        URL url = new URL("p1", "1.2.3.4", 1010, "path1", map);

        String echo = ext.echo(url, "haha");
        assertEquals("Ext1Impl1-echo", echo);
    }

    @Test
    public void test_getAdaptiveExtension() throws Exception {
        Ext1 ext = ExtensionLoader.getExtensionLoader(Ext1.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        map.put("ext1", "impl2");
        URL url = new URL("p1", "1.2.3.4", 1010, "path1", map);

        String echo = ext.echo(url, "haha");
        assertEquals("Ext1Impl2-echo", echo);
    }

    @Test
    public void test_getAdaptiveExtension_customizeKey() throws Exception {
        Ext1 ext = ExtensionLoader.getExtensionLoader(Ext1.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        map.put("key2", "impl2");
        URL url = new URL("p1", "1.2.3.4", 1010, "path1", map);

        String echo = ext.yell(url, "haha");
        assertEquals("Ext1Impl2-yell", echo);

        url = url.addParameter("key1", "impl3"); // 注意: URL是值类型
        echo = ext.yell(url, "haha");
        assertEquals("Ext1Impl3-yell", echo);
    }

    @Test
    public void test_getAdaptiveExtension_UrlNpe() throws Exception {
        Ext1 ext = ExtensionLoader.getExtensionLoader(Ext1.class).getAdaptiveExtension();

        try {
            ext.echo(null, "haha");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("url == null", e.getMessage());
        }
    }

    @Test
    public void test_getAdaptiveExtension_ExceptionWhenNoAdativeMethodOnInterface() throws Exception {
        try {
            ExtensionLoader.getExtensionLoader(Ext5NoAdaptiveMethod.class).getAdaptiveExtension();
            fail();
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(),
                    allOf(containsString("Can not create adaptive extenstion interface com.alibaba.dubbo.common.extensionloader.ext5.Ext5NoAdaptiveMethod"),
                            containsString("No adaptive method on extension com.alibaba.dubbo.common.extensionloader.ext5.Ext5NoAdaptiveMethod, refuse to create the adaptive class")));
        }
        // 多次get,都会报错且相同
        try {
            ExtensionLoader.getExtensionLoader(Ext5NoAdaptiveMethod.class).getAdaptiveExtension();
            fail();
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(),
                    allOf(containsString("Can not create adaptive extenstion interface com.alibaba.dubbo.common.extensionloader.ext5.Ext5NoAdaptiveMethod"),
                            containsString("No adaptive method on extension com.alibaba.dubbo.common.extensionloader.ext5.Ext5NoAdaptiveMethod, refuse to create the adaptive class")));
        }
    }

    @Test
    public void test_getAdaptiveExtension_ExceptionWhenNotAdativeMethod() throws Exception {
        Ext1 ext = ExtensionLoader.getExtensionLoader(Ext1.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        URL url = new URL("p1", "1.2.3.4", 1010, "path1", map);

        try {
            ext.bang(url, 33);
            fail();
        } catch (UnsupportedOperationException expected) {
            assertThat(expected.getMessage(), containsString("method "));
            assertThat(
                    expected.getMessage(),
                    containsString("of interface com.alibaba.dubbo.common.extensionloader.ext1.Ext1 is not adaptive method!"));
        }
    }

    @Test
    public void test_getAdaptiveExtension_ExceptionWhenNoUrlAttrib() throws Exception {
        try {
            ExtensionLoader.getExtensionLoader(Ext4.class).getAdaptiveExtension();
            fail();
        } catch (Exception expected) {
            assertThat(expected.getMessage(), containsString("fail to create adative class for interface "));
            assertThat(expected.getMessage(), containsString(": not found url parameter or url attribute in parameters of method "));
        }
    }

    @Test
    public void test_getAdaptiveExtension_protocolKey() throws Exception {
        Ext3 ext = ExtensionLoader.getExtensionLoader(Ext3.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        URL url = new URL("impl3", "1.2.3.4", 1010, "path1", map);

        String echo = ext.echo(url, "s");
        assertEquals("Ext3Impl3-echo", echo);

        url = url.addParameter("key1", "impl2");
        echo = ext.echo(url, "s");
        assertEquals("Ext3Impl2-echo", echo);

        String yell = ext.yell(url, "d");
        assertEquals("Ext3Impl3-yell", yell);
    }

    @Test
    public void test_getAdaptiveExtension_lastProtocolKey() throws Exception {
        Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        URL url = new URL("impl1", "1.2.3.4", 1010, "path1", map);
        String yell = ext.yell(url, "s");
        assertEquals("Ext2Impl1-yell", yell);

        url = url.addParameter("key1", "impl2");
        yell = ext.yell(url, "s");
        assertEquals("Ext2Impl2-yell", yell);
    }

    @Test
    public void test_urlHolder_getAdaptiveExtension() throws Exception {
        Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        map.put("ext2", "impl1");
        URL url = new URL("p1", "1.2.3.4", 1010, "path1", map);

        UrlHolder holder = new UrlHolder();
        holder.setUrl(url);

        String echo = ext.echo(holder, "haha");
        assertEquals("Ext2Impl1-echo", echo);
    }

    @Test
    public void test_urlHolder_getAdaptiveExtension_noExtension() throws Exception {
        Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension();

        URL url = new URL("p1", "1.2.3.4", 1010, "path1");

        UrlHolder holder = new UrlHolder();
        holder.setUrl(url);

        try {
            ext.echo(holder, "haha");
            fail();
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(), containsString("Fail to get extension("));
        }

        url = url.addParameter("ext2", "XXX");
        holder.setUrl(url);
        try {
            ext.echo(holder, "haha");
            fail();
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(), containsString("No such extension"));
        }
    }

    @Test
    public void test_urlHolder_getAdaptiveExtension_UrlNpe() throws Exception {
        Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension();

        try {
            ext.echo(null, "haha");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("com.alibaba.dubbo.common.extensionloader.ext2.UrlHolder argument == null", e.getMessage());
        }

        try {
            ext.echo(new UrlHolder(), "haha");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("com.alibaba.dubbo.common.extensionloader.ext2.UrlHolder argument getUrl() == null", e.getMessage());
        }
    }

    @Test
    public void test_urlHolder_getAdaptiveExtension_ExceptionWhenNotAdativeMethod() throws Exception {
        Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension();

        Map<String, String> map = new HashMap<String, String>();
        URL url = new URL("p1", "1.2.3.4", 1010, "path1", map);

        try {
            ext.bang(url, 33);
            fail();
        } catch (UnsupportedOperationException expected) {
            assertThat(expected.getMessage(), containsString("method "));
            assertThat(
                    expected.getMessage(),
                    containsString("of interface com.alibaba.dubbo.common.extensionloader.ext2.Ext2 is not adaptive method!"));
        }
    }

    @Test
    public void test_urlHolder_getAdaptiveExtension_ExceptionWhenNameNotProvided() throws Exception {
        Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension();

        URL url = new URL("p1", "1.2.3.4", 1010, "path1");

        UrlHolder holder = new UrlHolder();
        holder.setUrl(url);

        try {
            ext.echo(holder, "impl1");
            fail();
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(), containsString("Fail to get extension("));
        }

        url = url.addParameter("key1", "impl1");
        holder.setUrl(url);
        try {
            ext.echo(holder, "haha");
            fail();
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(), containsString("Fail to get extension(com.alibaba.dubbo.common.extensionloader.ext2.Ext2) name from url"));
        }
    }

    @Test
    public void test_getAdaptiveExtension_inject() throws Exception {
        LogUtil.start();
        Ext6 ext = ExtensionLoader.getExtensionLoader(Ext6.class).getAdaptiveExtension();

        URL url = new URL("p1", "1.2.3.4", 1010, "path1");
        url = url.addParameters("ext6", "impl1");

        assertEquals("Ext6Impl1-echo-Ext1Impl1-echo", ext.echo(url, "ha"));

        Assert.assertTrue("can not find error.", LogUtil.checkNoError());
        LogUtil.stop();

        url = url.addParameters("ext1", "impl2");
        assertEquals("Ext6Impl1-echo-Ext1Impl2-echo", ext.echo(url, "ha"));

    }

    @Test
    public void test_getAdaptiveExtension_InjectNotExtFail() throws Exception {
        Ext6 ext = ExtensionLoader.getExtensionLoader(Ext6.class).getExtension("impl2");

        Ext6Impl2 impl = (Ext6Impl2) ext;
        assertNull(impl.getList());
    }

    @Test
    public void test_InitError() throws Exception {
        ExtensionLoader<Ext7> loader = ExtensionLoader.getExtensionLoader(Ext7.class);

        loader.getExtension("ok");

        try {
            loader.getExtension("error");
            fail();
        } catch (IllegalStateException expected) {
            assertThat(expected.getMessage(), containsString("Failed to load extension class(interface: interface com.alibaba.dubbo.common.extensionloader.ext7.Ext7"));
            assertThat(expected.getCause(), instanceOf(ExceptionInInitializerError.class));
        }
    }

    @Test
    public void testLoadActivateExtension() throws Exception {
        // test default
        URL url = URL.valueOf("test://localhost/test");
        List<ActivateExt1> list = ExtensionLoader.getExtensionLoader(ActivateExt1.class)
                .getActivateExtension(url, new String[]{}, "default_group");
        Assert.assertEquals(1, list.size());
        Assert.assertTrue(list.get(0).getClass() == ActivateExt1Impl1.class);

        // test group
        url = url.addParameter(Constants.GROUP_KEY, "group1");
        list = ExtensionLoader.getExtensionLoader(ActivateExt1.class)
                .getActivateExtension(url, new String[]{}, "group1");
        Assert.assertEquals(1, list.size());
        Assert.assertTrue(list.get(0).getClass() == GroupActivateExtImpl.class);

        // test value
        url = url.removeParameter(Constants.GROUP_KEY);
        url = url.addParameter(Constants.GROUP_KEY, "value");
        url = url.addParameter("value", "value");
        list = ExtensionLoader.getExtensionLoader(ActivateExt1.class)
                .getActivateExtension(url, new String[]{}, "value");
        Assert.assertEquals(1, list.size());
        Assert.assertTrue(list.get(0).getClass() == ValueActivateExtImpl.class);

        // test order
        url = URL.valueOf("test://localhost/test");
        url = url.addParameter(Constants.GROUP_KEY, "order");
        list = ExtensionLoader.getExtensionLoader(ActivateExt1.class)
                .getActivateExtension(url, new String[]{}, "order");
        Assert.assertEquals(2, list.size());
        Assert.assertTrue(list.get(0).getClass() == OrderActivateExtImpl1.class);
        Assert.assertTrue(list.get(1).getClass() == OrderActivateExtImpl2.class);
    }

}


text:
(function () { "use strict";
var samples = {};
samples.headerfooterlayout = {};
samples.headerfooterlayout.Main = function() {
	this._mainContext = famous.core.Engine.createContext();
	var layout = new famous.views.HeaderFooterLayout({ headerSize : 100, footerSize : 50});
	layout.header.add(new famous.core.Surface({ content : "Header", properties : { backgroundColor : "gray", lineHeight : "100px", textAlign : "center"}}));
	layout.content.add(new famous.core.Surface({ content : "Content", properties : { backgroundColor : "#fa5c4f", lineHeight : "400px", textAlign : "center"}}));
	layout.footer.add(new famous.core.Surface({ content : "Footer", properties : { backgroundColor : "gray", lineHeight : "50px", textAlign : "center"}}));
	this._mainContext.add(layout);
};
samples.headerfooterlayout.Main.main = function() {
	new samples.headerfooterlayout.Main();
};
samples.headerfooterlayout.Main.main();
})();


text:
ZXUtilityCode
===============
Provides a few utility codes for iOS.

## Requirements

* Requires iOS 7.0 or later
* Requires Automatic Reference Counting (ARC)

## Components

* AMRPlayer
* BDLocationManager
* Coordinates
* WKWebView+H5Pay
* ZXColorPickerController
* ZXImageView
* ZXRefreshView

## License

`ZXUtilityCode` is available under the MIT license. See the `LICENSE` file for more info.


text:
import { Actions, Effect } from '@ngrx/effects';
import { LogEntryActions } from '../Actions/log-entry.actions';
import { CustomHttp } from '../../Services/customHttp';
import { BASE_URL } from '../../Constants/settings';
import { Observable, Subject } from 'rxjs';
import { Injectable } from '@angular/core';
import { ToastConfig, ToastrConfig, ToastrService } from 'ngx-toastr';
import { XP } from '../Models/user';
import { UserActions } from '../Actions/user.actions';

@Injectable()
export class LogEntryEffects{

  constructor(private actions: Actions, private chttp: CustomHttp, private toastrService: ToastrService) {
  }

  @Effect() getEntries = this.actions
    .ofType(LogEntryActions.GET_ALL_LOG_ENTRIES)
    .map(action => action.payload)
    .switchMap(project_id => this.chttp.get(`${BASE_URL}/projects/${project_id}/logs`)
      .map(res => res.json())
      .map(json => json.logs)
      .switchMap(entries => Observable.of(LogEntryActions.getAllSuccess(entries)))
      .catch(err => Observable.of(LogEntryActions.getAllFail(err)))
    );

  private createEntry$ = this.actions
    .ofType(LogEntryActions.CREATE_LOG_ENTRY)
    .switchMap(action => {
      let json = JSON.stringify(action.payload.entry);
      return this.chttp.post(`${BASE_URL}/projects/${action.payload.id}/logs`, json)
        .map(res => res.json())
    })
    .share();

  @Effect() createEntry =  this.createEntry$
    .map(json => json.log_entry)
    .switchMap(log_entry => Observable.of(LogEntryActions.createSuccess(log_entry)))
    .catch(err => Observable.of(LogEntryActions.createFail(err)));

  @Effect() entryCreatedXP = this.createEntry$
    .switchMap(json => {
      let config: ToastrConfig = {
        autoDismiss: false,
        timeOut: 0
      };

      let points = json.points.points_earned || 0;
      let exp = json.xp.xp_earned || 0;

      this.toastrService.success(`You earned ${points} points for your team, and got ${exp}XP`, 'Success', config);
      return Observable.of(UserActions.userGainedXP(json.xp));
    });

  // @Effect({ dispatch: false }) entryCreated = this.actions
  //   .ofType(LogEntryActions.CREATE_LOG_ENTRY_SUCCESS)
  //   .do(_ => {
  //     let config: ToastConfig = {
  //       extendedTimeOut: 0,
  //       closeButton: true,
  //       tapToDismiss: true,
  //       timeOut: 1500,
  //       positionClass: 'toast-top-right'
  //     };
  //
  //     this.toastrService.success('I successfully created your log entry!', 'Success', config);
  //   });

  @Effect({ dispatch: false }) entryCreateFailed = this.actions
    .ofType(LogEntryActions.CREATE_LOG_ENTRY_FAIL)
    .do(_ => {
      let config: ToastConfig = {
        extendedTimeOut: 0,
        closeButton: true,
        tapToDismiss: true,
        timeOut: 1500,
        positionClass: 'toast-top-right'
      };

      this.toastrService.error('I could not create your log entry!', 'Oops', config);
    });
}


text:
package com.opensymphony.xwork2;

/**
 * All actions may implement this interface, which exposes the execute() method.
 *

 * However, as of XWork 1.1, this is not required and is only here to assist users. You are free to create POJOs
 * that honor the same contract defined by this interface without actually implementing the interface.
 *

 */
public interface Action {

    /**
     * The action execution was successful. Show result
     * view to the end user.
     */
    public static final String SUCCESS = "success";

    /**
     * The action execution was successful but do not
     * show a view. This is useful for actions that are
     * handling the view in another fashion like redirect.
     */
    public static final String NONE = "none";

    /**
     * The action execution was a failure.
     * Show an error view, possibly asking the
     * user to retry entering data.
     */
    public static final String ERROR = "error";

    /**
     *

     * The action execution require more input
     * in order to succeed.
     * This result is typically used if a form
     * handling action has been executed so as
     * to provide defaults for a form. The
     * form associated with the handler should be
     * shown to the end user.
     *

     *
     *

     * This result is also used if the given input
     * params are invalid, meaning the user
     * should try providing input again.
     *

     */
    public static final String INPUT = "input";

    /**
     * The action could not execute, since the
     * user most was not logged in. The login view
     * should be shown.
     */
    public static final String LOGIN = "login";

    /**
     * Where the logic of the action is executed.
     *
     * @return a string representing the logical result of the execution.
     *         See constants in this interface for a list of standard result values.
     * @throws Exception thrown if a system level exception occurs.
     *                   Note: Application level exceptions should be handled by returning
     *                   an error value, such as Action.ERROR.
     */
    public String execute() throws Exception;

}


text:
require 'active_admin/helpers/output_safety_helper'

module ActiveAdmin
  module Views

    class SidebarSection < Panel
      builder_method :sidebar_section
      include OutputSafetyHelper

      # Takes a ActiveAdmin::SidebarSection instance
      def build(section)
        @section = section
        super(@section.title)
        add_class @section.custom_class if @section.custom_class
        self.id = @section.id
        build_sidebar_content
      end

      # Renders attributes_table_for current resource
      def attributes_table(*args, &block)
        attributes_table_for resource, *args, &block
      end

      protected

      def build_sidebar_content
        if @section.block
          rvalue = instance_exec(&@section.block)
          self << rvalue if rvalue.is_a?(String)
        else
          render(@section.partial_name)
        end
      end
    end

  end
end


text:
@interface QYRegisterViewController : QYBasicViewController

@end


text:
Use the latest IntelliJ release.

Make sure the Scala plugin is installed.  (It may come preinstalled;
if not, install it before proceeding.)

## Initial Setup

Do not attempt to import our sbt build into IntelliJ; it won't work.

Instead, create IntelliJ project files as follows.

  - Run `sbt intellij`

The project files are created as copies of the `.SAMPLE` files, which are under version
control. The actual IntelliJ project files are in `.gitignore` so that local changes
are ignored.

Then to start coding:

  - Open `src/intellij/scala.ipr` in IntelliJ
  - Wait for the project to index
  - On the `Build` menu, choose `Build Project`

Everything (library, compiler etc) should build within a few minutes.

## Troubleshooting

Recent versions of IntelliJ are able to find a JDK on your system and select it
automatically. If that doesn't happen:

  - In `File` → `Project Structure` → `Project` → `Project SDK`, create an SDK entry
    named "1.8" containing the Java 1.8 SDK

Note that 8 is the safest choice. If you're having trouble, you might check to see
if IntelliJ selected some later version.

## Switching Branches

If you often work on both the 2.12.x and 2.13.x branches, the safest approach is to
have a separate clone of the repository for each branch.

(But if you find that switching works even in the same clone, consider
submitting an update to this readme with any advice you have on this.)

## IntelliJ and sbt

Note that compilation IntelliJ is performed in a single pass (no
bootstrap), like the sbt build.

Note that the output directory when compiling in IntelliJ is the same as for the
sbt build. This allows building incrementally in IntelliJ
and directly using the changes using the command-line scripts in `build/quick/bin/`.

## Running JUnit Tests

JUnit tests can be executed by right-clicking on a test class or test method and
selecting "Run" or "Debug". The debugger will allow you to stop at breakpoints
within the Scala library.

It is possible to invoke the Scala compiler from a JUnit test (passing the source
code as a string) and inspect the generated bytecode, see for example
`scala.issues.BytecodeTest`. Debugging such a test is an easy way to stop at
breakpoints within the Scala compiler.

## Running the Compiler and REPL

You can create run/debug configurations to run the compiler and REPL directly within
IntelliJ, which might accelerate development and debugging of the compiler.

To debug the Scala codebase you can also use "Remote" debug configuration and pass
the corresponding arguments to the jvm running the compiler / program.

To run the compiler create an "Application" configuration with
  - Main class: `scala.tools.nsc.Main`
  - Program arguments: `-usejavacp -cp sandbox -d sandbox sandbox/Test.scala`
  - Working directory: the path of your checkout
  - Use classpath of module: `compiler`

To run the REPL create an "Application" configuration with
  - Main class: `scala.tools.nsc.MainGenericRunner`
  - Program arguments: `-usejavacp`
  - Working directory: the path of your checkout
  - Use classpath of module: `repl-frontend`

## Dependencies

For every module in the IntelliJ project there is a corresponding `-deps` library, for example `compiler-deps` provides JARs for the compiler codebase.
The `.jar` files in these `-deps` libraries can be easily kept up-to-date by running `sbt intellij` again.
This is necessary whenever the dependencies in the sbt build change, for example when the `starr` version is updated.

Note that this command only patches the dependency lists, all other settings in the IntelliJ project definition are unchanged.

To overwrite the project definition files by copying the `.SAMPLE` files again run `sbt intellijFromSample`.

## Updating the `.SAMPLE` files

The command `intellijToSample` overwrites the `.SAMPLE` files using the current project definition files.


text:
Change your password

<form id="pwd_form" method="post" action="change_password.php">

              New Password
              <input type="password" class="text" name="new_password" />

              Confirm Password
              <input type="password" class="text" name="confirm_password" />

            <input type="submit" id="settings_btn" value="Change" class="btn ajax_submit_btn" />

</form>


text:
'use strict';

var m =  require('mithril');

var home = {
  controller: function() {
  },
  view: function() {
    return m('div', 'Hello world');
  }
};

module.exports = {
  '/': home,
  '/post/create': require('./post/create')
};


text:
package database

import (
	"github.com/pkg/errors"
)

// Book holds a metadata and its notes
type Book struct {
	UUID    string `json:"uuid"`
	Label   string `json:"label"`
	USN     int    `json:"usn"`
	Notes   []Note `json:"notes"`
	Deleted bool   `json:"deleted"`
	Dirty   bool   `json:"dirty"`
}

// Note represents a note
type Note struct {
	RowID    int    `json:"rowid"`
	UUID     string `json:"uuid"`
	BookUUID string `json:"book_uuid"`
	Body     string `json:"content"`
	AddedOn  int64  `json:"added_on"`
	EditedOn int64  `json:"edited_on"`
	USN      int    `json:"usn"`
	Public   bool   `json:"public"`
	Deleted  bool   `json:"deleted"`
	Dirty    bool   `json:"dirty"`
}

// NewNote constructs a note with the given data
func NewNote(uuid, bookUUID, body string, addedOn, editedOn int64, usn int, public, deleted, dirty bool) Note {
	return Note{
		UUID:     uuid,
		BookUUID: bookUUID,
		Body:     body,
		AddedOn:  addedOn,
		EditedOn: editedOn,
		USN:      usn,
		Public:   public,
		Deleted:  deleted,
		Dirty:    dirty,
	}
}

// Insert inserts a new note
func (n Note) Insert(db *DB) error {
	_, err := db.Exec("INSERT INTO notes (uuid, book_uuid, body, added_on, edited_on, usn, public, deleted, dirty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
		n.UUID, n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Public, n.Deleted, n.Dirty)

	if err != nil {
		return errors.Wrapf(err, "inserting note with uuid %s", n.UUID)
	}

	return nil
}

// Update updates the note with the given data
func (n Note) Update(db *DB) error {
	_, err := db.Exec("UPDATE notes SET book_uuid = ?, body = ?, added_on = ?, edited_on = ?, usn = ?, public = ?, deleted = ?, dirty = ? WHERE uuid = ?",
		n.BookUUID, n.Body, n.AddedOn, n.EditedOn, n.USN, n.Public, n.Deleted, n.Dirty, n.UUID)

	if err != nil {
		return errors.Wrapf(err, "updating the note with uuid %s", n.UUID)
	}

	return nil
}

// UpdateUUID updates the uuid of a book
func (n *Note) UpdateUUID(db *DB, newUUID string) error {
	_, err := db.Exec("UPDATE notes SET uuid = ? WHERE uuid = ?", newUUID, n.UUID)

	if err != nil {
		return errors.Wrapf(err, "updating note uuid from '%s' to '%s'", n.UUID, newUUID)
	}

	n.UUID = newUUID

	return nil
}

// Expunge hard-deletes the note from the database
func (n Note) Expunge(db *DB) error {
	_, err := db.Exec("DELETE FROM notes WHERE uuid = ?", n.UUID)
	if err != nil {
		return errors.Wrap(err, "expunging a note locally")
	}

	return nil
}

// NewBook constructs a book with the given data
func NewBook(uuid, label string, usn int, deleted, dirty bool) Book {
	return Book{
		UUID:    uuid,
		Label:   label,
		USN:     usn,
		Deleted: deleted,
		Dirty:   dirty,
	}
}

// Insert inserts a new book
func (b Book) Insert(db *DB) error {
	_, err := db.Exec("INSERT INTO books (uuid, label, usn, dirty, deleted) VALUES (?, ?, ?, ?, ?)",
		b.UUID, b.Label, b.USN, b.Dirty, b.Deleted)

	if err != nil {
		return errors.Wrapf(err, "inserting book with uuid %s", b.UUID)
	}

	return nil
}

// Update updates the book with the given data
func (b Book) Update(db *DB) error {
	_, err := db.Exec("UPDATE books SET label = ?, usn = ?, dirty = ?, deleted = ? WHERE uuid = ?",
		b.Label, b.USN, b.Dirty, b.Deleted, b.UUID)

	if err != nil {
		return errors.Wrapf(err, "updating the book with uuid %s", b.UUID)
	}

	return nil
}

// UpdateUUID updates the uuid of a book
func (b *Book) UpdateUUID(db *DB, newUUID string) error {
	_, err := db.Exec("UPDATE books SET uuid = ? WHERE uuid = ?", newUUID, b.UUID)

	if err != nil {
		return errors.Wrapf(err, "updating book uuid from '%s' to '%s'", b.UUID, newUUID)
	}

	b.UUID = newUUID

	return nil
}

// Expunge hard-deletes the book from the database
func (b Book) Expunge(db *DB) error {
	_, err := db.Exec("DELETE FROM books WHERE uuid = ?", b.UUID)
	if err != nil {
		return errors.Wrap(err, "expunging a book locally")
	}

	return nil
}


text:
"""
    akane
    ~~~~~

    An asynchronous Redis client for Tornado.

    :copyright: (c) 2012 by Frank Smit.
    :license: MIT, see LICENSE for more details.
"""

__authors__ = ('Frank Smit <frank@61924.nl>',)
__version__ = '0.1.0'
__license__ = 'MIT'

from .client import Client
from .connection import Pool
from .exceptions import PoolError

from hiredis import ProtocolError, ReplyError


text:
<?php

declare(strict_types=1);

namespace CQRSTest\CommandHandling\Stubs;

final class DoFailureCommand
{
}


text:
require 'redxml/server/xquery/ext/delete_key_box'

module RedXML
  module Server
    module XQuery
      module Processors
        class DeleteProcessor < KeyPathProcessor
          attr_reader :key_builder

          @@processor_pool = {}

          # rather use static delete_nodes
          def delete_node(key_str)
            if RedXML::Server::Transformer::KeyElementBuilder.element?(key_str)
              key_element_builder = RedXML::Server::Transformer::KeyElementBuilder
                                    .build_from_s(nil, key_str)
              children = get_plainly_children(key_str)
              children.each { |child| delete_node(child) }
              @db.delete_from_hash(@content_hash_key, [key_element_builder.attr, key_str])
            else
              @db.delete_from_hash(@content_hash_key, [key_str])
            end
          end

          def rewrite_parent(parent_key, parent_value)
            @db.add_to_hash(@content_hash_key, [parent_key, parent_value], true)
          end

          def self.delete_nodes(db_interface, extended_keys, _pipelined = true)
            delete_nodes_only(db_interface, extended_keys)
          end

          private

          def self.delete_nodes_only(db_interface, extended_keys)
            delete_box = DeleteKeyBox.new

            extended_keys.each do |extended_key|
              key_builder = extended_key.key_builder
              pool_key = key_builder.to_s
              processor = @@processor_pool[pool_key]
              if processor.nil?
                processor = DeleteProcessor.new(db_interface, key_builder)
                @@processor_pool[pool_key] = processor
              end

              # remove reference of deleted key from his parent
              # so memorize what keys should be deleted and delete in the end all of them
              delete_key = extended_key.key_str
              delete_box.add_delete_key(delete_key, extended_key.parent_key, extended_key.parent_children_array, pool_key)

              # recursively delete node
              processor.delete_node(extended_key.key_str)
            end

            # store new parent contents
            delete_box.beans_to_store.each do |bean|
              processor = @@processor_pool[bean.key_builder_str]
              fail 'not possible' if processor.nil?
              processor.rewrite_parent(bean.parent_key, bean.parent_value)
            end
          end
        end
      end
    end
  end
end


text:
layout: "docs"
page_title: "Frequently Asked Questions"
sidebar_current: "docs-faq"
---

# Frequently Asked Questions

## Q: What is Checkpoint? / Does Consul call home?

Consul makes use of a HashiCorp service called [Checkpoint](http://checkpoint.hashicorp.com)
which is used to check for updates and critical security bulletins.
Only anonymous information, which cannot be used to identify the user or host, is
sent to Checkpoint . An anonymous ID is sent which helps de-duplicate warning messages.
This anonymous ID can be disabled. In fact, using the Checkpoint service is optional
and can be disabled.

See [`disable_anonymous_signature`](/docs/agent/options.html#disable_anonymous_signature)
and [`disable_update_check`](/docs/agent/options.html#disable_update_check).

## Q: How does Atlas integration work?

Hosted Consul Enterprise in Atlas was officially deprecated on March 7th,
2017.

There are strong alternatives available and they are listed below.

For users on supported cloud platform the
[-retry-join](/docs/agent/options.html#_retry_join) option allows bootstrapping
by automatically discovering instances with a given tag key/value at startup.

For users on other cloud platforms [-join and retry-join
functionality](/docs/agent/options.html#_join) can be used to join clusters by
ip address or hostname.

Other features of Consul Enterprise, such as the UI and Alerts also have
suitable open source alternatives.

For replacing the UI, we recommend the [free UI packaged as part of Consul open source](https://www.consul.io/docs/agent/options.html#_ui). A live demo can be access at [https://demo.consul.io/ui/](https://demo.consul.io/ui/).

For replacing alerts, we recommend the [open source Consul alerts daemon](https://github.com/acalephstorage/consul-alerts). This is not maintained or supported by HashiCorp, however there is active development from the community.

## Q: Does Consul rely on UDP Broadcast or Multicast?

Consul uses the [Serf](https://www.serf.io) gossip protocol which relies on
TCP and UDP unicast. Broadcast and Multicast are rarely available in a multi-tenant
or cloud network environment. For that reason, Consul and Serf were both
designed to avoid any dependence on those capabilities.

## Q: Is Consul eventually or strongly consistent?

Consul has two important subsystems, the service catalog and the gossip protocol.
The service catalog stores all the nodes, service instances, health check data,
ACLs, and KV information. It is strongly consistent, and replicated
using the [consensus protocol](/docs/internals/consensus.html).

The [gossip protocol](/docs/internals/gossip.html) is used to track which
nodes are part of the cluster and to detect a node or agent failure. This information
is eventually consistent by nature. When the servers detects a change in membership,
or receive a health update, they update the service catalog appropriately.

Because of this split, the answer to the question is subtle. Almost all client APIs
interact with the service catalog and are strongly consistent. Updates to the
catalog may come via the gossip protocol which is eventually consistent, meaning
the current state of the catalog can lag behind until the state is reconciled.

## Q: Are _failed_ or _left_ nodes ever removed?

To prevent an accumulation of dead nodes (nodes in either _failed_ or _left_
states), Consul will automatically remove dead nodes out of the catalog. This
process is called _reaping_. This is currently done on a configurable
interval of 72 hours. Reaping is similar to leaving, causing all associated
services to be deregistered. Changing the reap interval for aesthetic
reasons to trim the number of _failed_ or _left_ nodes is not advised (nodes
in the _failed_ or _left_ state do not cause any additional burden on
Consul).

## Q: Does Consul support delta updates for watchers or blocking queries?

Consul does not currently support sending a delta or a change only response
to a watcher or a blocking query. The API simply allows for an edge-trigger
return with the full result. A client should keep the results of their last
read and compute the delta client side.

By design, Consul offloads this to clients instead of attempting to support
the delta calculation. This avoids expensive state maintenance on the servers
as well as race conditions between data updates and watch registrations.

## Q: What network ports does Consul use?

The [Ports Used](https://www.consul.io/docs/agent/options.html#ports) section of the Configuration documentation lists all ports that Consul uses.

## Q: Does Consul require certain user process resource limits?

There should be only a small number of open file descriptors required for a
Consul client agent. The gossip layers perform transient connections with
other nodes, each connection to the client agent (such as for a blocking
query) will open a connection, and there will typically be connections to one
of the Consul servers. A small number of file descriptors are also required
for watch handlers, health checks, log files, and so on.

For a Consul server agent, you should plan on the above requirements and
an additional incoming connection from each of the nodes in the cluster. This
should not be the common case, but in the worst case if there is a problem
with the other servers you would expect the other client agents to all
connect to a single server and so preparation for this possibility is helpful.

The default ulimits are usually sufficient for Consul, but you should closely
scrutinize your own environment's specific needs and identify the root cause
of any excessive resource utilization before arbitrarily increasing the limits.

## Q: What is the per-key value size limitation for Consul's key/value store?

The limit on a key's value size is 512KB. This is strictly enforced and an
HTTP 413 status will be returned to any client that attempts to store more
than that limit in a value. It should be noted that the Consul key/value store
is not designed to be used as a general purpose database. See
[Server Performance](/docs/guides/performance.html) for more details.

## Q: What data is replicated between Consul datacenters?

In general, data is not replicated between different Consul datacenters. When a
request is made for a resource in another datacenter, the local Consul servers forward
an RPC request to the remote Consul servers for that resource and return the results.
If the remote datacenter is not available, then those resources will also not be
available, but that won't otherwise affect the local datacenter. There are some special
situations where a limited subset of data can be replicated, such as with Consul's built-in
[ACL replication](/docs/guides/acl.html#outages-and-acl-replication) capability, or
external tools like [consul-replicate](https://github.com/hashicorp/consul-replicate).


text:
import initialState from '../initialState';
import {
  REQUEST_LOGIN,
  LOGGED_IN,
  LOGGED_OUT,
  INVALID_LOGIN,
  TOKEN_EXPIRED,
  REFRESH_TOKEN,
  TOKEN_REFRESHED,
  REQUEST_GET_SETTINGS,
  RETRIEVED_SETTINGS
} from './settings.action-types';

export function settingsReducer(state = initialState.settings, action) {
  switch (action.type) {
    case REQUEST_LOGIN:
      return {...state, isLoggingIn: true, loginFailed: false, isLoggedIn: false};
    case LOGGED_IN:
      return {
        ...state,
        cfInstance: action.cfInstance,
        token: action.token,
        isLoggedIn: true,
        isLoggingIn: false,
        loginFailed: false
      };
    case LOGGED_OUT:
      return {...state, isLoggedIn: false, token: {}};
    case INVALID_LOGIN:
      return {
        ...state,
        loginFailed: true,
        isLoggedIn: false,
        isLoggingIn: false,
        isReadingSettings: false,
        isRefreshingToken: false
      };
    case TOKEN_EXPIRED:
      return {...state, isTokenExpired: true, isLoggedIn: false, isLoggingIn: false};
    case REFRESH_TOKEN:
      return {...state, isRefreshingToken: true};
    case TOKEN_REFRESHED:
      return {...state, isLoggedIn: true, isRefreshingToken: false, token: action.token};
    case REQUEST_GET_SETTINGS:
      return {...state, isReadingSettings: true};
    case RETRIEVED_SETTINGS:
      return {
        ...state,
        cfInstance: action.settings.cfInstance,
        token: action.settings.token,
        isSettingsLoaded: true,
        isReadingSettings: false,
        isRefreshingToken: true
      };
    default:
      return state;
  }
}


text:
<?php
namespace Vks\Models;
use Illuminate\Database\Eloquent\Model as Eloquent;

class RelationLink extends Eloquent
{
    protected $table = 'vks_relations_links';

    protected $fillable = [
        'vks_id','attendance_id',
        'response','secr_id'
    ];

    public function vks() {
        return $this->hasOne(Vks::class,'id','vks_id');
    }
    public function attendance() {
        return $this->hasOne(Attendance::class,'id','attendance_id');
    }
    public function secretary() {
        return $this->hasOne(Secretary::class,'id','secr_id');
    }
}


text:
import os

import gspread

from flask import Flask, redirect, render_template, url_for
from flask.ext.script import Manager
from flask.ext.login import LoginManager, login_user
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtforms.validators import Required

from oauth2client.client import OAuth2WebServerFlow

#
# Free Coding session for 2015-01-11
# Written by Matt Warren
#

CLIENT_ID = os.getenv('GOOGLE_CLIENT_ID')
CLIENT_SECRET = os.getenv('GOOGLE_CLIENT_SECRET')

app = Flask(__name__)
manager = Manager(app)
login_manager = LoginManager(app)

USER_GOOGLE_CREDENTIALS = None

class User:
    pass

class LoginForm(Form):
    name = StringField('Name', validators=[Required()])
    submit = SubmitField('Submit')

@login_manager.user_loader
def load_user(userid):
    return User()

@app.route("/login", methods=["GET", "POST"])
def login():
    form = LoginForm()
    if form.validate_on_submit():
        login_user(form.data.name)
        return redirect(url_for('index'))
    return render_template('login.html', form=form)

def get_credentials():
    global USER_GOOGLE_CREDENTIALS
    if USER_GOOGLE_CREDENTIALS is None or USER_GOOGLE_CREDENTIALS.invalid:
        flow = OAuth2WebServerFlow(client_id=CLIENT_ID,
                                   client_secret=CLIENT_SECRET,
                                   scope='https://spreadsheets.google.com/feeds https://docs.google.com/feeds',
                                   redirect_uri='http://localhost')
        return redirect(flow.step1_get_authorize_url())

    return USER_GOOGLE_CREDENTIALS

def booklist(name="Books"):
    gc = gspread.authorize(get_credentials())

    spreadsheet = gc.open(name)
    books = spreadsheet.sheet1.get_all_values()

    # convert to list of dictionaries using first row as keys
    books = [{books[0][i]: book[i] for i in range(len(books[0]))} for book in books[1:]]
    return books


text:
/// <reference types="request" />

import * as request from 'request';
import { DefaultTransporter } from '../transporters';
import { Credentials } from './credentials';
export declare abstract class AuthClient {
    transporter: DefaultTransporter;
    credentials: Credentials;
    /**
     * Provides an alternative request
     * implementations with auth credentials.
     */
    abstract request(): request.Request | void;
}


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller
{
	public function __construct()
	{
		parent::__construct();
	}

	public function index()
	{
		$data["title"] = "Search Engine RG Community Ahoo ! ";
		$data['description'] = 'Search Engine / RG Community Ahoo !';
		$data['author'] = "B23 RG 3618";

		$data['query'] = '';

		if($_POST)
		{
			if( ! $this->input->post('search')) {
				$data['search_response'] = '
 Please enter search value.
';
			}
			else {
				$data['search'] = $search = $this->input->post('search');
				$data['searches'] = $searches = $this->input->post('searches');

				switch ($searches) {
					case 1:
						$queing = 'vest_no = '.$this->db->escape($search);
						break;
					case 2:
						$queing = 'vest_no = '.$this->db->escape($search);
						break;
					case 3:
						$queing = 'lastname LIKE "%"'.$this->db->escape(strtolower($search)).'"%"';
						break;
					case 4:
						$queing = 'firstname LIKE "%"'.$this->db->escape(strtolower($search)).'"%"';
						break;
					case 5:
						$queing = 'firstname LIKE"%"'.$this->db->escape(strtolower($search)).'"%"';
						break;

					default:
						$queing = '';
						break;
				}

				if($queing) {
					//echo "SELECT * FROM information WHERE ".$queing;
					//die();

					$data['query'] = $query = QModel::query("SELECT * FROM information WHERE ".$queing);

				}
			}
		}

		$this->load->view('body',$data);

	}

	public function search()
	{

		if($_POST)
		{
			if( ! $this->input->post('search')) {
				$data['search_response'] = '
 Please enter search value.
';
			}
			else {
				$data['search'] = $search = $this->input->post('search');
				$data['searches'] = $searches = $this->input->post('searches');

				switch ($searches) {
					case 1:
						$queing = 'vest_no = '.$this->db->escape($search);
						break;
					case 2:
						$queing = 'vest_no = '.$this->db->escape($search);
						break;
					case 3:
						$queing = 'lastname = "%"'.$this->db->escape(strtolower($value))."%";
						break;
					case 4:
						$queing = 'firstname = "%"'.$this->db->escape(strtolower($value))."%";
						break;
					case 5:
						$queing = 'firstname = "%"'.$this->db->escape(strtolower($value))."%";
						break;

					default:
						$queing = '';
						break;
				}

				if($queing) {
					$data['query'] = $query = QModel::query("SELECT * FROM information WHERE ".$queing);

				}
			}
		}
		else
		{
			show_404();
		}
	}

}


text:
namespace ProjectType {

	internal partial class ResolvedSdkReference {

		/// Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.
		private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;

		/// The name of the schema to look for at runtime to fulfill property access.
		internal const string SchemaName = "ResolvedSdkReference";

		/// The ItemType given in the Rule.DataSource property.  May not apply to every Property's individual DataSource.
		internal const string PrimaryDataSourceItemType = "SDKReference";

		/// The Label given in the Rule.DataSource property.  May not apply to every Property's individual DataSource.
		internal const string PrimaryDataSourceLabel = "";

		///  (The "AppXLocation" property).
		internal const string AppXLocationProperty = "AppXLocation";

		///  (The "OriginalItemSpec" property).
		internal const string OriginalItemSpecProperty = "OriginalItemSpec";

		///  (The "DisplayName" property).
		internal const string DisplayNameProperty = "DisplayName";

		///  (The "FrameworkIdentity" property).
		internal const string FrameworkIdentityProperty = "FrameworkIdentity";

		///  (The "CopyPayload" property).
		internal const string CopyPayloadProperty = "CopyPayload";

		///  (The "ExpandContent" property).
		internal const string ExpandContentProperty = "ExpandContent";

		///  (The "ExpandReferenceAssemblies" property).
		internal const string ExpandReferenceAssembliesProperty = "ExpandReferenceAssemblies";

		///  (The "CopyLocalExpandedReferenceAssemblies" property).
		internal const string CopyLocalExpandedReferenceAssembliesProperty = "CopyLocalExpandedReferenceAssemblies";

		/// Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.
		private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;

		/// Backing field for the file name of the rule property.
		private string file;

		/// Backing field for the ItemType property.
		private string itemType;

		/// Backing field for the ItemName property.
		private string itemName;

		/// Configured Project
		private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;

		/// The dictionary of named catalogs.
		private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;

		/// Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.
		private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;

		/// Thread locking object
		private object locker = new object();

		/// Initializes a new instance of the ResolvedSdkReference class.
		internal ResolvedSdkReference(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) {
			this.rule = rule;
		}

		/// Initializes a new instance of the ResolvedSdkReference class.
		internal ResolvedSdkReference(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) :
				this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) {
			if ((configuredProject == null)) {
				throw new System.ArgumentNullException("configuredProject");
			}
			this.configuredProject = configuredProject;
			this.catalogs = catalogs;
			this.file = file;
			this.itemType = itemType;
			this.itemName = itemName;
		}

		/// Initializes a new instance of the ResolvedSdkReference class.
		internal ResolvedSdkReference(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) :
				this(rule) {
			if ((rule == null)) {
				throw new System.ArgumentNullException("rule");
			}
			if ((configuredProject == null)) {
				throw new System.ArgumentNullException("configuredProject");
			}
			this.configuredProject = configuredProject;
			this.rule = rule;
			this.file = this.rule.File;
			this.itemType = this.rule.ItemType;
			this.itemName = this.rule.ItemName;
		}

		/// Initializes a new instance of the ResolvedSdkReference class.
		internal ResolvedSdkReference(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) :
				this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) {
		}

		/// Initializes a new instance of the ResolvedSdkReference class that assumes a project context (neither property sheet nor items).
		internal ResolvedSdkReference(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) :
				this(configuredProject, catalogs, "Project", null, null, null) {
		}

		/// Gets the IRule used to get and set properties.
		public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule {
			get {
				return this.rule;
			}
		}

		/// AppXLocation
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty AppXLocation {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AppXLocationProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AppXLocationProperty)));
				}
				return property;
			}
		}

		/// OriginalItemSpec
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty OriginalItemSpec {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(OriginalItemSpecProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(OriginalItemSpecProperty)));
				}
				return property;
			}
		}

		/// DisplayName
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty DisplayName {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(DisplayNameProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(DisplayNameProperty)));
				}
				return property;
			}
		}

		/// FrameworkIdentity
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty FrameworkIdentity {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(FrameworkIdentityProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(FrameworkIdentityProperty)));
				}
				return property;
			}
		}

		/// CopyPayload
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty CopyPayload {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(CopyPayloadProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(CopyPayloadProperty)));
				}
				return property;
			}
		}

		/// ExpandContent
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty ExpandContent {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExpandContentProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExpandContentProperty)));
				}
				return property;
			}
		}

		/// ExpandReferenceAssemblies
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty ExpandReferenceAssemblies {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExpandReferenceAssembliesProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExpandReferenceAssembliesProperty)));
				}
				return property;
			}
		}

		/// CopyLocalExpandedReferenceAssemblies
		internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty CopyLocalExpandedReferenceAssemblies {
			get {
				Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
				if ((localRule == null)) {
					localRule = this.GeneratedFallbackRule;
				}
				if ((localRule == null)) {
					return null;
				}
				Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(CopyLocalExpandedReferenceAssembliesProperty)));
				if (((property == null)
							&& (this.GeneratedFallbackRule != null))) {
					localRule = this.GeneratedFallbackRule;
					property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(CopyLocalExpandedReferenceAssembliesProperty)));
				}
				return property;
			}
		}

		/// Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing
		private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule {
			get {
				if (((this.fallbackRule == null)
							&& (this.configuredProject != null))) {
					System.Threading.Monitor.Enter(this.locker);
					try {
						if ((this.fallbackRule == null)) {
							this.InitializeFallbackRule();
						}
					}
					finally {
						System.Threading.Monitor.Exit(this.locker);
					}
				}
				return this.fallbackRule;
			}
		}

		private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) {
			if ((catalog == null)) {
				return null;
			}
			return catalog.BindToContext(SchemaName, file, itemType, itemName);
		}

		private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) {
			if ((propertiesContext.IsProjectFile == true)) {
				return null;
			}
			else {
				return propertiesContext.File;
			}
		}

		private void InitializeFallbackRule() {
			if ((this.configuredProject == null)) {
				return;
			}
			Microsoft.Build.Framework.XamlTypes.Rule unboundRule = ResolvedSdkReference.deserializedFallbackRule;
			if ((unboundRule == null)) {
				System.IO.Stream xamlStream = null;
				System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
				try {
					xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:resolvedsdkreference.xaml");
					Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream)));
					System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator();
					for (
					; ((unboundRule == null)
								&& ruleEnumerator.MoveNext());
					) {
						Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current));
						if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) {
							unboundRule = t;
							unboundRule.Name = "26a6ad2e-79cd-4217-bc94-13917700c030";
							ResolvedSdkReference.deserializedFallbackRule = unboundRule;
						}
					}
				}
				finally {
					if ((xamlStream != null)) {
						((System.IDisposable)(xamlStream)).Dispose();
					}
				}
			}
			this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext");
			Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext");
			this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName);
		}
	}

	internal partial class ProjectProperties {

		private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, ResolvedSdkReference> CreateResolvedSdkReferencePropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, ResolvedSdkReference>(CreateResolvedSdkReferenceProperties);

		private static ResolvedSdkReference CreateResolvedSdkReferenceProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state) {
			ProjectProperties that = ((ProjectProperties)(state));
			return new ResolvedSdkReference(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName);
		}

		/// Gets the strongly-typed property accessor used to get and set Resolved SDK reference properties.
		internal System.Threading.Tasks.Task<ResolvedSdkReference> GetResolvedSdkReferencePropertiesAsync() {
			System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync();
			return namedCatalogsTask.ContinueWith(CreateResolvedSdkReferencePropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default);
		}
	}
}


text:
const {spawnLightningCluster} = require('ln-docker-daemons');
const {test} = require('@alexbosworth/tap');

const {getPublicKey} = require('./../../');
const {getWalletInfo} = require('./../../');

const identityKeyFamily = 6;

// Getting a public key out of the seed should return the raw public key
test(`Get public key`, async ({end, equal}) => {
  const [{kill, lnd}] = (await spawnLightningCluster({})).nodes;

  const key = await getPublicKey({
    lnd,
    family: identityKeyFamily,
    index: [].length,
  });

  const wallet = await getWalletInfo({lnd});

  equal(wallet.public_key, key.public_key, 'Derive identity public key');

  await kill({});

  return end();
});