text:
package models.external.addresslookup

import common.enums.AddressLookupJourneyIdentifier
import config.{AddressLookupConfiguration, FrontendAppConfig}
import play.api.i18n.MessagesApi
import play.api.libs.json.{JsObject, Json}
import play.api.mvc.Call
import testHelpers.VatRegSpec

class AddressLookupInitializationModelSpec extends VatRegSpec {

  val messagesApi = app.injector.instanceOf[MessagesApi]
  val frontendAppConfig = app.injector.instanceOf[FrontendAppConfig]
  val testJourneyId = AddressLookupJourneyIdentifier.homeAddress
  val testContinueUrl = Call("GET", "/continueUrl")

  def addressInitializationModel(ukMode: Boolean = false): AddressLookupConfigurationModel =
    new AddressLookupConfiguration()(frontendAppConfig, messagesApi).apply(testJourneyId, testContinueUrl, ukMode)

  object LookupPageOptions {
    val title = "Find your home address"
    val heading = "Find your home address"
    val filterLabel = "Property name or number"
    val submitLabel = "Continue"
    val manualAddressLinkText = "The address does not have a UK postcode"
  }

  object SelectPageOptions {
    val title = "Choose the address"
    val heading = "Choose the address"
    val editAddressLinkText = "Enter address manually"
    val submitLabel = "Continue"
  }

  object EditPageOptions {
    val title = "Enter your home address"
    val heading = "Enter your home address"
    val line1Label = "Address line 1"
    val line2Label = "Address line 2"
    val line3Label = "Address line 3"
    val internationalLine3Label = "Address line 3 (optional)"
    val countryLabel = "Country"
    val postcodeLabel = "Postcode"
    val internationalPostcodeLabel = "Postcode (optional)"
    val submitLabel = "Continue"
    val townLabel = "Town/City"
  }

  object ConfirmPageLabels {
    val title = "Confirm your home address"
    val heading = "Confirm your home address"
    val submitLabel = "Continue"
    val changeLinkText = "Edit this address"
  }

  object CountryPickerLabels {
    val title = "Find your home address"
    val heading = "Find your home address"
  }

  object LookupPageOptionsCy {
    val title = "Dewch o hyd i'ch cyfeiriad cartref"
    val heading = "Dewch o hyd i'ch cyfeiriad cartref"
    val filterLabel = "Enw neu rif yr eiddo"
    val submitLabel = "Yn eich blaen"
    val manualAddressLinkText = "Nid oes gan y cyfeiriad god post yn y DU"
  }

  object SelectPageOptionsCy {
    val title = "Dewiswch y cyfeiriad"
    val heading = "Dewiswch y cyfeiriad"
    val editAddressLinkText = "Nodwch y cyfeiriad â llaw"
    val submitLabel = "Yn eich blaen"
  }

  object EditPageOptionsCy {
    val title = "Nodwch eich cyfeiriad cartref"
    val heading = "Nodwch eich cyfeiriad cartref"
    val line1Label = "Cyfeiriad – llinell 1"
    val line2Label = "Cyfeiriad – llinell 2"
    val line3Label = "Cyfeiriad – llinell 3"
    val internationalLine3Label = "Cyfeiriad – llinell 3 (dewisol)"
    val countryLabel = "Gwlad"
    val postcodeLabel = "Cod post"
    val internationalPostcodeLabel = "Cod post (dewisol)"
    val submitLabel = "Yn eich blaen"
    val townLabel = "Tref/Dinas"
  }

  object ConfirmPageLabelsCy {
    val title = "Cadarnhewch eich cyfeiriad cartref"
    val heading = "Cadarnhewch eich cyfeiriad cartref"
    val submitLabel = "Yn eich blaen"
    val changeLinkText = "Golygu'r cyfeiriad hwn"
  }

  object CountryPickerLabelsCy {
    val title = "Dewch o hyd i'ch cyfeiriad cartref"
    val heading = "Dewch o hyd i'ch cyfeiriad cartref"
  }

  private val internationalAddressMessages: JsObject = Json.obj(
    "appLevelLabels" -> Json.obj(
      "navTitle" -> "Register for VAT",
      "phaseBannerHtml" -> "This is a new service. Help us improve it - send your feedback."
    ),
    "lookupPageLabels" -> Json.obj(
    ),
    "selectPageLabels" -> Json.obj(
    ),
    "editPageLabels" -> Json.obj(
      "title" -> EditPageOptions.title,
      "heading" -> EditPageOptions.heading,
      "line1Label" -> EditPageOptions.line1Label,
      "line2Label" -> EditPageOptions.line2Label,
      "line3Label" -> EditPageOptions.internationalLine3Label,
      "townLabel" -> EditPageOptions.townLabel,
      "countryLabel" -> EditPageOptions.countryLabel,
      "postcodeLabel" -> EditPageOptions.internationalPostcodeLabel,
      "submitLabel" -> EditPageOptions.submitLabel
    ),
    "confirmPageLabels" -> Json.obj(
      "title" -> ConfirmPageLabels.title,
      "heading" -> ConfirmPageLabels.heading,
      "submitLabel" -> ConfirmPageLabels.submitLabel,
      "changeLinkText" -> ConfirmPageLabels.changeLinkText
    )
  )

  private val internationalAddressMessagesCy: JsObject = Json.obj(
    "appLevelLabels" -> Json.obj(
      "navTitle" -> "Cofrestru ar gyfer TAW",
      "phaseBannerHtml" -> "Gwasanaeth newydd yw hwn. Helpwch ni i'w wella – anfonwch eich adborth."
    ),
    "lookupPageLabels" -> Json.obj(
    ),
    "selectPageLabels" -> Json.obj(
    ),
    "editPageLabels" -> Json.obj(
      "title" -> EditPageOptionsCy.title,
      "heading" -> EditPageOptionsCy.heading,
      "line1Label" -> EditPageOptionsCy.line1Label,
      "line2Label" -> EditPageOptionsCy.line2Label,
      "line3Label" -> EditPageOptionsCy.internationalLine3Label,
      "townLabel" -> EditPageOptionsCy.townLabel,
      "countryLabel" -> EditPageOptionsCy.countryLabel,
      "postcodeLabel" -> EditPageOptionsCy.internationalPostcodeLabel,
      "submitLabel" -> EditPageOptionsCy.submitLabel
    ),
    "confirmPageLabels" -> Json.obj(
      "title" -> ConfirmPageLabelsCy.title,
      "heading" -> ConfirmPageLabelsCy.heading,
      "submitLabel" -> ConfirmPageLabelsCy.submitLabel,
      "changeLinkText" -> ConfirmPageLabelsCy.changeLinkText
    )
  )

  val addressInitializationJson: JsObject = Json.obj(
    "version" -> 2,
    "options" -> Json.obj(
      "continueUrl" -> "http://localhost:9895/continueUrl",
      "signOutHref" -> "http://localhost:9514/feedback/vat-registration",
      "phaseFeedbackLink" -> "http://localhost:9250/contact/beta-feedback?service=vrs",
      "accessibilityFooterUrl" -> "http://localhost:12346/accessibility-statement/vat-registration",
      "deskProServiceName" -> "vrs",
      "showPhaseBanner" -> true,
      "showBackButtons" -> true,
      "includeHMRCBranding" -> false,
      "ukMode" -> false,
      "selectPageConfig" -> Json.obj(
        "showSearchAgainLink" -> false
      ),
      "confirmPageConfig" -> Json.obj(
        "showChangeLinkcontinueUrl" -> true,
        "showSubHeadingAndInfo" -> false,
        "showSearchAgainLink" -> false,
        "showConfirmChangeText" -> false
      )
    ),
    "labels" -> Json.obj(
      "en" -> Json.obj(
        "appLevelLabels" -> Json.obj(
          "navTitle" -> "Register for VAT",
          "phaseBannerHtml" -> "This is a new service. Help us improve it - send your feedback."
        ),
        "lookupPageLabels" -> Json.obj(
          "title" -> LookupPageOptions.title,
          "heading" -> LookupPageOptions.heading,
          "filterLabel" -> LookupPageOptions.filterLabel,
          "submitLabel" -> LookupPageOptions.submitLabel,
          "manualAddressLinkText" -> LookupPageOptions.manualAddressLinkText
        ),
        "selectPageLabels" -> Json.obj(
          "title" -> SelectPageOptions.title,
          "heading" -> SelectPageOptions.heading,
          "submitLabel" -> SelectPageOptions.submitLabel,
          "editAddressLinkText" -> SelectPageOptions.editAddressLinkText
        ),
        "editPageLabels" -> Json.obj(
          "title" -> EditPageOptions.title,
          "heading" -> EditPageOptions.heading,
          "line1Label" -> EditPageOptions.line1Label,
          "line2Label" -> EditPageOptions.line2Label,
          "line3Label" -> EditPageOptions.line3Label,
          "countryLabel" -> EditPageOptions.countryLabel,
          "postcodeLabel" -> EditPageOptions.postcodeLabel,
          "submitLabel" -> EditPageOptions.submitLabel
        ),
        "confirmPageLabels" -> Json.obj(
          "title" -> ConfirmPageLabels.title,
          "heading" -> ConfirmPageLabels.heading,
          "submitLabel" -> ConfirmPageLabels.submitLabel,
          "changeLinkText" -> ConfirmPageLabels.changeLinkText
        ),
        "international" -> internationalAddressMessages
      ),
      "cy" -> Json.obj(
        "appLevelLabels" -> Json.obj(
          "navTitle" -> "Cofrestru ar gyfer TAW",
          "phaseBannerHtml" -> "Gwasanaeth newydd yw hwn. Helpwch ni i'w wella – anfonwch eich adborth."
        ),
        "lookupPageLabels" -> Json.obj(
          "title" -> LookupPageOptionsCy.title,
          "heading" -> LookupPageOptionsCy.heading,
          "filterLabel" -> LookupPageOptionsCy.filterLabel,
          "submitLabel" -> LookupPageOptionsCy.submitLabel,
          "manualAddressLinkText" -> LookupPageOptionsCy.manualAddressLinkText
        ),
        "selectPageLabels" -> Json.obj(
          "title" -> SelectPageOptionsCy.title,
          "heading" -> SelectPageOptionsCy.heading,
          "editAddressLinkText" -> SelectPageOptionsCy.editAddressLinkText,
          "submitLabel" -> SelectPageOptionsCy.submitLabel
        ),
        "editPageLabels" -> Json.obj(
          "title" -> EditPageOptionsCy.title,
          "heading" -> EditPageOptionsCy.heading,
          "line1Label" -> EditPageOptionsCy.line1Label,
          "line2Label" -> EditPageOptionsCy.line2Label,
          "line3Label" -> EditPageOptionsCy.line3Label,
          "countryLabel" -> EditPageOptionsCy.countryLabel,
          "postcodeLabel" -> EditPageOptionsCy.postcodeLabel,
          "submitLabel" -> EditPageOptionsCy.submitLabel
        ),
        "confirmPageLabels" -> Json.obj(
          "title" -> ConfirmPageLabelsCy.title,
          "heading" -> ConfirmPageLabelsCy.heading,
          "submitLabel" -> ConfirmPageLabelsCy.submitLabel,
          "changeLinkText" -> ConfirmPageLabelsCy.changeLinkText
        ),
        "international" -> internationalAddressMessagesCy
      )
    )
  )

  "AddressLookupInitializationModel" must {
    "write to Json correctly when UK mode is false" in {
      val actualResult = Json.toJson(addressInitializationModel())

      actualResult mustBe addressInitializationJson.deepMerge(
        Json.obj(
          "labels" -> Json.obj(
            "en" -> Json.obj(
              "countryPickerLabels" -> Json.obj(
                "title" -> CountryPickerLabels.title,
                "heading" -> CountryPickerLabels.heading
              )
            ),
            "cy" -> Json.obj(
              "countryPickerLabels" -> Json.obj(
                "title" -> CountryPickerLabelsCy.title,
                "heading" -> CountryPickerLabelsCy.heading
              )
            )
          )
        )
      )
    }

    "Send the UK mode flag as true when required" in {
      val actualResult = Json.toJson(addressInitializationModel(ukMode = true))

      actualResult mustBe addressInitializationJson.deepMerge(
        Json.obj("options" ->
          Json.obj("ukMode" -> true)
        )
      )
    }
  }

}


text:
<?php

declare(strict_types=1);
/**
 * This file is part of Just.
 *
 * @license  https://github.com/just-framework/php/blob/master/LICENSE MIT License
 * @link     https://justframework.com/php/
 * @author   Mahmoud Elnezamy <mahmoud@nezamy.com>
 * @package  Just
 */
namespace Just\Http;

use Just\Routing\RouteHandlerInterface;

class Middleware
{
    private array $layers = [];
    private RouteHandlerInterface $handler;

    public function __construct(RouteHandlerInterface $handler)
    {
        $this->handler = $handler;
    }

    public function add(array $layers): void
    {
        $this->layers = array_merge($this->layers, $layers);
    }

    public function handle(callable $core)
    {
        $layers = array_reverse($this->layers);
        $final =  array_reduce($layers, function ($nextLayer, $layer) {
            return $this->createLayer($nextLayer, $layer);
        }, function () use ($core) {
            return $this->handler->call($core);
        });

        return $this->handler->call($final);
    }

    private function createLayer($nextLayer, $layer): callable
    {
        return function () use ($nextLayer, $layer) {
            container()->setVar('next', $nextLayer);
            if(is_string($layer) && class_exists($layer)){
                $layer = [$layer, 'handle'];
            }
            $layer = $this->handler->parse($layer);
            return $this->handler->call($layer);
        };
    }
}

redpajama_set_name: RedPajamaGithub


text:
"""
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

        _______3______
       /              \
    ___5__          ___1__
   /      \        /      \
   6      _2_       0       8
         /   \
         7    4
"""

from Tree import BinaryTree
import sys

class Solution(object):
	def mini_depth(self, root):
		if root is None:
			return 0
		return self.get_min(root)

	def get_min(self, root):
		if root is None:
			return sys.maxsize
		if root.leftChild is None and root.rightChild is None:
			return 1
		return min(self.get_min(root.leftChild), self.get_min(root.rightChild)) + 1

# Construct a binary tree to test
Node_3 = BinaryTree(3)
Node_3.insertLeft(5)
Node_3.insertRight(1)
Node_5 = Node_3.getLeftChild()
Node_1 = Node_3.getRightChild()

Node_5.insertLeft(6)
Node_6 = Node_5.getLeftChild()
Node_5.insertRight(2)
Node_2 = Node_5.getRightChild()

Node_2.insertLeft(7)
Node_7 = Node_2.getLeftChild()
Node_2.insertRight(4)
Node_4 = Node_2.getRightChild()

Node_1.insertLeft(0)
Node_0 = Node_1.getLeftChild()
Node_1.insertRight(8)
Node_8 = Node_1.getRightChild()

obj = Solution()
print(obj.mini_depth(Node_3))
print(obj.mini_depth(Node_5))
print(obj.mini_depth(Node_6))
print(obj.mini_depth(Node_6.getLeftChild()))


text:
package com.apl.trill.ui.full_mine;

import com.apl.trill.R;
import com.apl.trill.ui.full_mine.contrant.MineFragmentContract;
import com.apl.trill.ui.full_mine.model.MineFragmentModel;
import com.apl.trill.ui.full_mine.presenter.MineFragmentPresenter;
import com.apl.trill.ui.main.MainActivity;
import com.vittaw.mvplibrary.base.BaseFragment;

/**
 * Created by Administrator on 2017/4/9.
 */

public class MineFragment extends BaseFragment<MineFragmentModel,MineFragmentPresenter> implements MineFragmentContract.View {
    @Override
    protected int getLayoutId() {
        return R.layout.full_mine;
    }

    @Override
    protected void initPresenter() {
        mPresenter.setVM(this,mModel);

    }

    @Override
    protected void initView() {

    }

    @Override
    public void onStartLoad() {

    }

    @Override
    public void onStopLoad() {

    }

    @Override
    public void onError(String errorInfo) {

    }
}


text:
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <sys/time.h>

#include "../../lib/includes.h"
#include "../../lib/logger.h"
#include "../../lib/xalloc.h"
#include "../fieldset.h"
#include "probe_modules.h"
#include "packet.h"

extern probe_module_t module_tcp_cisco_backdoor;
extern probe_module_t module_tcp_synscan;
extern probe_module_t module_icmp_echo;
extern probe_module_t module_icmp_echo_time;
extern probe_module_t module_udp;
extern probe_module_t module_ntp;
extern probe_module_t module_upnp;
extern probe_module_t module_dns;
// ADD YOUR MODULE HERE

probe_module_t* probe_modules[] = {
	&module_tcp_synscan,
	&module_icmp_echo,
	&module_icmp_echo_time,
	&module_udp,
	&module_ntp,
	&module_upnp,
	&module_dns,
	&module_tcp_cisco_backdoor
	// ADD YOUR MODULE HERE
};

probe_module_t* get_probe_module_by_name(const char* name)
{
	int len = (int) (sizeof(probe_modules)/sizeof(probe_modules[0]));
	for (int i=0; i < len; i++) {
		if (!strcmp(probe_modules[i]->name, name)) {
			return probe_modules[i];
		}
	}
	return NULL;
}

void print_probe_modules(void)
{
	int len = (int) (sizeof(probe_modules)/sizeof(probe_modules[0]));
	for (int i=0; i < len; i++) {
		printf("%s\n", probe_modules[i]->name);
	}
}

void fs_add_ip_fields(fieldset_t *fs, struct ip *ip)
{
	// WARNING: you must update fs_ip_fields_len  as well
	// as the definitions set (ip_fiels) if you
	// change the fields added below:
	fs_add_string(fs, "saddr", make_ip_str(ip->ip_src.s_addr), 1);
	fs_add_uint64(fs, "saddr-raw", (uint64_t) ip->ip_src.s_addr);
	fs_add_string(fs, "daddr", make_ip_str(ip->ip_dst.s_addr), 1);
	fs_add_uint64(fs, "daddr-raw", (uint64_t) ip->ip_dst.s_addr);
	fs_add_uint64(fs, "ipid", ntohs(ip->ip_id));
	fs_add_uint64(fs, "ttl", ip->ip_ttl);
}

#define TIMESTR_LEN 55

void fs_add_system_fields(fieldset_t *fs, int is_repeat, int in_cooldown)
{
	fs_add_uint64(fs, "repeat", is_repeat);
	fs_add_uint64(fs, "cooldown", in_cooldown);

	char *timestr = xmalloc(TIMESTR_LEN+1);
	char *timestr_ms = xmalloc(TIMESTR_LEN+1);
	struct timeval t;
	gettimeofday(&t, NULL);
	struct tm *ptm = localtime(&t.tv_sec);
	strftime(timestr, TIMESTR_LEN, "%Y-%m-%dT%H:%M:%S.%%03d%z", ptm);
	snprintf(timestr_ms, TIMESTR_LEN, timestr, t.tv_usec/1000);
	free(timestr);
	fs_add_string(fs, "timestamp-str", timestr_ms, 1);
	fs_add_uint64(fs, "timestamp-ts", (uint64_t) t.tv_sec);
	fs_add_uint64(fs, "timestamp-us", (uint64_t) t.tv_usec);
}

int ip_fields_len = 6;
fielddef_t ip_fields[] = {
	{.name="saddr", .type="string", .desc="source IP address of response"},
	{.name="saddr-raw", .type="int", .desc="network order integer form of source IP address"},
	{.name="daddr", .type="string", .desc="destination IP address of response"},
	{.name="daddr-raw", .type="int", .desc="network order integer form of destination IP address"},
	{.name="ipid", .type="int", .desc="IP identification number of response"},
	{.name="ttl", .type="int", .desc="time-to-live of response packet"}
};

int sys_fields_len = 5;
fielddef_t sys_fields[] = {
	{.name="repeat", .type="int", .desc="Is response a repeat response from host"},
	{.name="cooldown", .type="int", .desc="Was response received during the cooldown period"},
	{.name="timestamp-str", .type="string", .desc="timestamp of when response arrived in ISO8601 format."},
	{.name="timestamp-ts", .type="int", .desc="timestamp of when response arrived in seconds since Epoch"},
	{.name="timestamp-us", .type="int", .desc="microsecond part of timestamp (e.g. microseconds since 'timestamp-ts')"}
};


text:
#region License

#endregion

#region Imports

using System;
using System.Runtime.Serialization;
using AopAlliance.Aop;
using AopAlliance.Intercept;
using NUnit.Framework;
using Rhino.Mocks;
using Spring.Aop.Interceptor;
using Spring.Aop.Support;
using Spring.Objects;
using Spring.Util;

#endregion

namespace Spring.Aop.Framework
{
    /// <summary>
    /// Unit tests for the ProxyFactory class.
    /// </summary>
    /// <author>Rod Johnson</author>
    /// <author>Choy Rim (.NET)</author>
    /// <author>Rick Evans (.NET)</author>
    [TestFixture]
    public sealed class ProxyFactoryTests
    {

        private MockRepository mocks;

        [SetUp]
        public void Setup()
        {
            mocks = new MockRepository();
        }

        public interface IDoubleClickable
        {
            event EventHandler DoubleClick;

            void FireDoubleClickEvent();
        }

        public interface IDoubleClickableIntroduction :
            IDoubleClickable, IAdvice
        {
        }

        private class DoubleClickableIntroduction :
            IDoubleClickableIntroduction
        {
            public event EventHandler DoubleClick;

            public void FireDoubleClickEvent()
            {
                if (DoubleClick != null)
                {
                    DoubleClick(this, EventArgs.Empty);
                }
            }
        }

        [Test]
        public void AddAndRemoveEventHandlerThroughIntroduction()
        {
            TestObject target = new TestObject();
            DoubleClickableIntroduction dci = new DoubleClickableIntroduction();
            DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor(dci);
            CountingBeforeAdvice countingBeforeAdvice = new CountingBeforeAdvice();
            target.Name = "SOME-NAME";
            ProxyFactory pf = new ProxyFactory(target);
            pf.AddIntroduction(advisor);
            pf.AddAdvisor(new DefaultPointcutAdvisor(countingBeforeAdvice));
            object proxy = pf.GetProxy();
            ITestObject to = proxy as ITestObject;
            Assert.IsNotNull(to);
            Assert.AreEqual("SOME-NAME", to.Name);
            IDoubleClickable doubleClickable = proxy as IDoubleClickable;
            // add event handler through introduction
            doubleClickable.DoubleClick += new EventHandler(OnClick);
            OnClickWasCalled = false;
            doubleClickable.FireDoubleClickEvent();
            Assert.IsTrue(OnClickWasCalled);
            Assert.AreEqual(3, countingBeforeAdvice.GetCalls());
            // remove event handler through introduction
            doubleClickable.DoubleClick -= new EventHandler(OnClick);
            OnClickWasCalled = false;
            doubleClickable.FireDoubleClickEvent();
            Assert.IsFalse(OnClickWasCalled);
            Assert.AreEqual(5, countingBeforeAdvice.GetCalls());
        }

        private bool OnClickWasCalled = false;

        private void OnClick(object sender, EventArgs e)
        {
            OnClickWasCalled = true;
        }

        [Test]
        public void CacheTest()
        {

            for (int i = 0; i < 2; i++)
            {
                TestObject target = new TestObject();
                NopInterceptor nopInterceptor = new NopInterceptor();
                CountingBeforeAdvice countingBeforeAdvice = new CountingBeforeAdvice();
                ProxyFactory pf = new ProxyFactory();
                pf.Target = target;
                pf.AddAdvice(nopInterceptor);
                pf.AddAdvisor(new DefaultPointcutAdvisor(countingBeforeAdvice));
                object proxy = pf.GetProxy();
            }

            // fails when running in resharper/testdriven.net
            // DynamicProxyManager.SaveAssembly();

        }

        [Test]
        public void AddAndRemoveEventHandlerThroughInterceptor()
        {
            TestObject target = new TestObject();
            NopInterceptor nopInterceptor = new NopInterceptor();
            CountingBeforeAdvice countingBeforeAdvice = new CountingBeforeAdvice();
            target.Name = "SOME-NAME";
            ProxyFactory pf = new ProxyFactory(target);
            pf.AddAdvice(nopInterceptor);
            pf.AddAdvisor(new DefaultPointcutAdvisor(countingBeforeAdvice));
            object proxy = pf.GetProxy();
            ITestObject to = proxy as ITestObject;
            // add event handler through proxy
            to.Click += new EventHandler(OnClick);
            OnClickWasCalled = false;
            to.OnClick();
            Assert.IsTrue(OnClickWasCalled);
            Assert.AreEqual(2, countingBeforeAdvice.GetCalls());
            // remove event handler through proxy
            to.Click -= new EventHandler(OnClick);
            OnClickWasCalled = false;
            to.OnClick();
            Assert.IsFalse(OnClickWasCalled);
            Assert.AreEqual(4, countingBeforeAdvice.GetCalls());
        }

        private class TestObject2 : TestObject
        {
            public bool EqualsOverrideWasCalled = false;

            public override bool Equals(object obj)
            {
                EqualsOverrideWasCalled = true;
                return true;
            }

            public override int GetHashCode()
            {
                return base.GetHashCode();
            }
        }

        [Test]
        public void CallsEqualsOverride()
        {
            TestObject2 target = new TestObject2();
            target.Name = "SOME-NAME";
            ProxyFactory pf = new ProxyFactory(target);
            object proxy = pf.GetProxy();
            ITestObject to = proxy as ITestObject;
            Assert.IsNotNull(to);
            Assert.AreEqual("SOME-NAME", to.Name);

            target.EqualsOverrideWasCalled = false;
            Assert.IsTrue(to.Equals(proxy));
            Assert.IsTrue(target.EqualsOverrideWasCalled);

            target.EqualsOverrideWasCalled = false;
            Assert.IsTrue(proxy.Equals(to));
            Assert.IsTrue(target.EqualsOverrideWasCalled);

            target.EqualsOverrideWasCalled = false;
            Assert.IsTrue(target.Equals(to));
            Assert.IsTrue(target.EqualsOverrideWasCalled);

            target.EqualsOverrideWasCalled = false;
            Assert.IsTrue(to.Equals(target));
            Assert.IsTrue(target.EqualsOverrideWasCalled);
        }

        [Test]
        public void CreateProxyFactoryWithoutTargetThenSetTarget()
        {
            TestObject target = new TestObject();
            target.Name = "Adam";
            NopInterceptor nopInterceptor = new NopInterceptor();
            CountingBeforeAdvice countingBeforeAdvice = new CountingBeforeAdvice();
            ProxyFactory pf = new ProxyFactory();
            pf.Target = target;
            pf.AddAdvice(nopInterceptor);
            pf.AddAdvisor(new DefaultPointcutAdvisor(countingBeforeAdvice));
            object proxy = pf.GetProxy();
            ITestObject to = (ITestObject)proxy;
            Assert.AreEqual("Adam", to.Name);
            Assert.AreEqual(1, countingBeforeAdvice.GetCalls());
        }

        [Test]
        [ExpectedException(typeof(AopConfigException))]
        public void InstantiateWithNullTarget()
        {
            new ProxyFactory((object)null);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void AddNullInterface()
        {
            new ProxyFactory().AddInterface(null);
        }

        [Test]
        [ExpectedException(typeof(AopConfigException))]
        public void AddInterfaceWhenConfigurationIsFrozen()
        {
            ProxyFactory factory = new ProxyFactory();
            factory.IsFrozen = true;
            factory.AddInterface(typeof(ITestObject));
        }

        [Test]
        public void IndexOfMethods()
        {
            TestObject target = new TestObject();
            ProxyFactory pf = new ProxyFactory(target);
            NopInterceptor nop = new NopInterceptor();
            IAdvisor advisor = new DefaultPointcutAdvisor(new CountingBeforeAdvice());
            IAdvised advised = (IAdvised)pf.GetProxy();
            // Can use advised and ProxyFactory interchangeably
            advised.AddAdvice(nop);
            pf.AddAdvisor(advisor);
            Assert.AreEqual(-1, pf.IndexOf((IInterceptor)null));
            Assert.AreEqual(-1, pf.IndexOf(new NopInterceptor()));
            Assert.AreEqual(0, pf.IndexOf(nop));
            Assert.AreEqual(-1, advised.IndexOf((IAdvisor)null));
            Assert.AreEqual(1, pf.IndexOf(advisor));
            Assert.AreEqual(-1, advised.IndexOf(new DefaultPointcutAdvisor(null)));
        }

        [Test]
        public void RemoveAdvisorByReference()
        {
            TestObject target = new TestObject();
            ProxyFactory pf = new ProxyFactory(target);
            NopInterceptor nop = new NopInterceptor();
            CountingBeforeAdvice cba = new CountingBeforeAdvice();
            IAdvisor advisor = new DefaultPointcutAdvisor(cba);
            pf.AddAdvice(nop);
            pf.AddAdvisor(advisor);
            ITestObject proxied = (ITestObject)pf.GetProxy();
            proxied.Age = 5;
            Assert.AreEqual(1, cba.GetCalls());
            Assert.AreEqual(1, nop.Count);
            Assert.IsFalse(pf.RemoveAdvisor(null));
            Assert.IsTrue(pf.RemoveAdvisor(advisor));
            Assert.AreEqual(5, proxied.Age);
            Assert.AreEqual(1, cba.GetCalls());
            Assert.AreEqual(2, nop.Count);
            Assert.IsFalse(pf.RemoveAdvisor(new DefaultPointcutAdvisor(null)));
        }

        [Test]
        public void RemoveAdvisorByIndex()
        {
            TestObject target = new TestObject();
            ProxyFactory pf = new ProxyFactory(target);
            NopInterceptor nop = new NopInterceptor();
            CountingBeforeAdvice cba = new CountingBeforeAdvice();
            IAdvisor advisor = new DefaultPointcutAdvisor(cba);
            pf.AddAdvice(nop);
            pf.AddAdvisor(advisor);
            NopInterceptor nop2 = new NopInterceptor(2); // make instance unique (see SPRNET-847)
            pf.AddAdvice(nop2);
            ITestObject proxied = (ITestObject)pf.GetProxy();
            proxied.Age = 5;
            Assert.AreEqual(1, cba.GetCalls());
            Assert.AreEqual(1, nop.Count);
            Assert.AreEqual(1, nop2.Count);
            // Removes counting before advisor
            pf.RemoveAdvisor(1);
            Assert.AreEqual(5, proxied.Age);
            Assert.AreEqual(1, cba.GetCalls());
            Assert.AreEqual(2, nop.Count);
            Assert.AreEqual(2, nop2.Count);
            // Removes Nop1
            pf.RemoveAdvisor(0);
            Assert.AreEqual(5, proxied.Age);
            Assert.AreEqual(1, cba.GetCalls());
            Assert.AreEqual(2, nop.Count);
            Assert.AreEqual(3, nop2.Count);

            // Check out of bounds
            try
            {
                pf.RemoveAdvisor(-1);
                Assert.Fail("Supposed to throw exception");
            }
            catch (AopConfigException)
            {
                // Ok
            }

            try
            {
                pf.RemoveAdvisor(2);
                Assert.Fail("Supposed to throw exception");
            }
            catch (AopConfigException)
            {
                // Ok
            }

            Assert.AreEqual(5, proxied.Age);
            Assert.AreEqual(4, nop2.Count);
        }

        [Test]
        public void TryRemoveNonProxiedInterface()
        {
            ProxyFactory factory = new ProxyFactory(new TestObject());
            Assert.IsFalse(factory.RemoveInterface(typeof(IServiceProvider)));
        }

        [Test]
        public void RemoveProxiedInterface()
        {
            ProxyFactory factory = new ProxyFactory(new TestObject());
            Assert.IsTrue(factory.RemoveInterface(typeof(ITestObject)));
        }

        [Test]
        public void ReplaceAdvisor()
        {
            TestObject target = new TestObject();
            ProxyFactory pf = new ProxyFactory(target);
            NopInterceptor nop = new NopInterceptor();
            CountingBeforeAdvice cba1 = new CountingBeforeAdvice();
            CountingBeforeAdvice cba2 = new CountingBeforeAdvice();
            IAdvisor advisor1 = new DefaultPointcutAdvisor(cba1);
            IAdvisor advisor2 = new DefaultPointcutAdvisor(cba2);
            pf.AddAdvisor(advisor1);
            pf.AddAdvice(nop);
            ITestObject proxied = (ITestObject)pf.GetProxy();
            // Use the type cast feature
            // Replace etc methods on advised should be same as on ProxyFactory
            IAdvised advised = (IAdvised)proxied;
            proxied.Age = 5;
            Assert.AreEqual(1, cba1.GetCalls());
            Assert.AreEqual(0, cba2.GetCalls());
            Assert.AreEqual(1, nop.Count);
            Assert.IsFalse(advised.ReplaceAdvisor(null, null));
            Assert.IsFalse(advised.ReplaceAdvisor(null, advisor2));
            Assert.IsFalse(advised.ReplaceAdvisor(advisor1, null));
            Assert.IsTrue(advised.ReplaceAdvisor(advisor1, advisor2));
            Assert.AreEqual(advisor2, pf.Advisors[0]);
            Assert.AreEqual(5, proxied.Age);
            Assert.AreEqual(1, cba1.GetCalls());
            Assert.AreEqual(2, nop.Count);
            Assert.AreEqual(1, cba2.GetCalls());
            Assert.IsFalse(pf.ReplaceAdvisor(new DefaultPointcutAdvisor(null), advisor1));
        }

        [Test]
        public void IgnoresAdvisorDuplicates()
        {
            CountingBeforeAdvice cba1 = new CountingBeforeAdvice();
            IAdvisor advisor1 = new DefaultPointcutAdvisor(cba1);

            AdvisedSupport advSup = new AdvisedSupport();
            advSup.AddAdvisor(advisor1);
            advSup.AddAdvisor(advisor1);

            Assert.AreEqual(1, advSup.Advisors.Count);
        }

        private class AnonymousClassTimeStamped : ITimeStamped
        {
            public AnonymousClassTimeStamped(ProxyFactoryTests enclosingInstance)
            {
                InitBlock(enclosingInstance);
            }

            private void InitBlock(ProxyFactoryTests enclosingInstance)
            {
                this.enclosingInstance = enclosingInstance;
            }

            private ProxyFactoryTests enclosingInstance;

            public ProxyFactoryTests Enclosing_Instance
            {
                get { return enclosingInstance; }

            }

            public DateTime TimeStamp
            {
                get { throw new NotSupportedException("TimeStamp"); }
            }
        }

        [Test]
        public void AddRepeatedInterface()
        {
            ITimeStamped tst = new AnonymousClassTimeStamped(this);
            ProxyFactory pf = new ProxyFactory(tst);
            // We've already implicitly added this interface.
            // This call should be ignored without error
            pf.AddInterface(typeof(ITimeStamped));
            // All cool
            ITimeStamped ts = (ITimeStamped)pf.GetProxy();
        }

        internal class TestObjectSubclass : TestObject, IComparable
        {
            public override int CompareTo(Object arg0)
            {
                throw new NotSupportedException("compareTo");
            }
        }

        [Test]
        public void GetsAllInterfaces()
        {
            // Extend to get new interface
            TestObjectSubclass raw = new TestObjectSubclass();
            ProxyFactory factory = new ProxyFactory(raw);
            Assert.AreEqual(8, factory.Interfaces.Count, "Found correct number of interfaces");
            //System.out.println("Proxied interfaces are " + StringUtils.arrayToDelimitedString(factory.getProxiedInterfaces(), ","));
            ITestObject tb = (ITestObject)factory.GetProxy();
            Assert.IsTrue(tb is IOther, "Picked up secondary interface");

            raw.Age = 25;
            Assert.IsTrue(tb.Age == raw.Age);

            DateTime t = new DateTime(2004, 8, 1);
            TimestampIntroductionInterceptor ti = new TimestampIntroductionInterceptor(t);

            Console.WriteLine(StringUtils.CollectionToDelimitedString(factory.Interfaces, "/"));

            //factory.addAdvisor(0, new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped)));
            factory.AddIntroduction(
                new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped))
                );

            Console.WriteLine(StringUtils.CollectionToDelimitedString(factory.Interfaces, "/"));

            ITimeStamped ts = (ITimeStamped)factory.GetProxy();
            Assert.IsTrue(ts.TimeStamp == t);
            // Shouldn't fail;
            ((IOther)ts).Absquatulate();
        }

        private class AnonymousClassInterceptor : IInterceptor
        {
        }

        [Test]
        public void CanOnlyAddMethodInterceptors()
        {
            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.AddAdvice(0, new NopInterceptor());
            try
            {
                factory.AddAdvice(0, new AnonymousClassInterceptor());
                Assert.Fail("Should only be able to add MethodInterceptors");
            }
            catch (AopConfigException)
            {
            }

            // Check we can still use it
            IOther other = (IOther)factory.GetProxy();
            other.Absquatulate();
        }

        [Test]
        public void InterceptorInclusionMethods()
        {
            NopInterceptor di = new NopInterceptor();
            NopInterceptor diUnused = new NopInterceptor(1); // // make instance unique (see SPRNET-847)
            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.AddAdvice(0, di);
            ITestObject tb = (ITestObject)factory.GetProxy();
            Assert.IsTrue(factory.AdviceIncluded(di));
            Assert.IsTrue(!factory.AdviceIncluded(diUnused));
            Assert.IsTrue(factory.CountAdviceOfType(typeof(NopInterceptor)) == 1);

            factory.AddAdvice(0, diUnused);
            Assert.IsTrue(factory.AdviceIncluded(diUnused));
            Assert.IsTrue(factory.CountAdviceOfType(typeof(NopInterceptor)) == 2);
        }

        [Test]
        public void AddAdvisedSupportListener()
        {
            //MLP SPRNET-1367
            //IDynamicMock mock = new DynamicMock(typeof(IAdvisedSupportListener));
            //IAdvisedSupportListener listener = (IAdvisedSupportListener)mock.Object;
            IAdvisedSupportListener listener =
                (IAdvisedSupportListener) mocks.CreateMock(typeof (IAdvisedSupportListener));
            listener.Activated(null);
            LastCall.On(listener).IgnoreArguments();
            //listener.Activated();
            //mock.Expect("Activated");

            mocks.ReplayAll();
            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.AddListener(listener);
            factory.GetProxy();
            mocks.VerifyAll();
        }

        [Test]
        public void AdvisedSupportListenerMethodsAreCalledAppropriately()
        {
            IAdvisedSupportListener listener = MockRepository.GenerateMock<IAdvisedSupportListener>();

            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.AddListener(listener);

            // must fire the Activated callback...
            factory.GetProxy();
            // must fire the AdviceChanged callback...
            factory.AddAdvice(new NopInterceptor());
            // must fire the InterfacesChanged callback...
            factory.AddInterface(typeof(ISerializable));

            listener.AssertWasCalled(x => x.Activated(Arg<AdvisedSupport>.Is.NotNull));
            listener.AssertWasCalled(x => x.AdviceChanged(Arg<AdvisedSupport>.Is.NotNull));
            listener.AssertWasCalled(x => x.InterfacesChanged(Arg<AdvisedSupport>.Is.NotNull));
        }

        [Test]
        public void AdvisedSupportListenerMethodsAre_NOT_CalledIfProxyHasNotBeenCreated()
        {
            IAdvisedSupportListener listener = MockRepository.GenerateMock<IAdvisedSupportListener>();

            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.AddListener(listener);

            // must not fire the AdviceChanged callback...
            factory.AddAdvice(new NopInterceptor());
            // must not fire the InterfacesChanged callback...
            factory.AddInterface(typeof(ISerializable));

            listener.AssertWasNotCalled(x => x.AdviceChanged(Arg<AdvisedSupport>.Is.Anything));
            listener.AssertWasNotCalled(x => x.InterfacesChanged(Arg<AdvisedSupport>.Is.Anything));
        }

        [Test]
        public void AddNullAdvisedSupportListenerIsOk()
        {
            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.AddListener(null);
        }

        [Test]
        public void RemoveNullAdvisedSupportListenerIsOk()
        {
            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.RemoveListener(null);
        }

        [Test]
        public void RemoveAdvisedSupportListener()
        {
            IAdvisedSupportListener listener = MockRepository.GenerateMock<IAdvisedSupportListener>();

            ProxyFactory factory = new ProxyFactory(new TestObject());
            factory.AddListener(listener);
            factory.RemoveListener(listener);

            factory.GetProxy();

            // check that no lifecycle callback methods were invoked on the listener...
            listener.AssertWasNotCalled(x => x.Activated(Arg<AdvisedSupport>.Is.Anything));
            listener.AssertWasNotCalled(x => x.AdviceChanged(Arg<AdvisedSupport>.Is.Anything));
            listener.AssertWasNotCalled(x => x.InterfacesChanged(Arg<AdvisedSupport>.Is.Anything));
        }

        [Test]
        [ExpectedException(typeof(AopConfigException))]
        public void Frozen_RemoveAdvisor()
        {
            ProxyFactory factory = new ProxyFactory();
            factory.IsFrozen = true;
            factory.RemoveAdvisor(null);
        }

        public interface IMultiProxyingTestInterface
        {
            string TestMethod(string arg);
        }

        public interface IMultiProxyingTestInterface2 : IMultiProxyingTestInterface { }

        public class MultiProxyingTestClass : IMultiProxyingTestInterface2
        {
            public int InvocationCounter;

            public string TestMethod(string arg)
            {
                InvocationCounter++;
                return arg + "|" + arg;
            }
        }

        public interface ICountingIntroduction
        {
            void Inc();
        }

        public class TestCountingIntroduction : ICountingIntroduction, IAdvice
        {
            public int Counter;

            public void Inc()
            {
                Counter++;
            }
        }

        [Test]
        public void NestedProxiesDontInvokeSameAdviceOrIntroductionTwice()
        {
            MultiProxyingTestClass testObj = new MultiProxyingTestClass();
            ProxyFactory pf1 = new ProxyFactory();
            pf1.Target = testObj;

            NopInterceptor di = new NopInterceptor();
            NopInterceptor diUnused = new NopInterceptor(1); // // make instance unique (see SPRNET-847)
            TestCountingIntroduction countingMixin = new TestCountingIntroduction();

            pf1.AddAdvice(diUnused);
            pf1.AddAdvisor(new DefaultPointcutAdvisor(di));
            pf1.AddIntroduction(new DefaultIntroductionAdvisor(countingMixin));

            object innerProxy = pf1.GetProxy();
            ProxyFactory pf2 = new ProxyFactory();
            pf2.Target = innerProxy;
            pf2.AddAdvice(diUnused);
            pf2.AddAdvisor(new DefaultPointcutAdvisor(di));
            pf2.AddIntroduction(new DefaultIntroductionAdvisor(countingMixin));

            object outerProxy = pf2.GetProxy();

            // any advice instance is invoked once only
            string result = ((IMultiProxyingTestInterface)outerProxy).TestMethod("arg");
            Assert.AreEqual(1, testObj.InvocationCounter);
            Assert.AreEqual("arg|arg", result);
            Assert.AreEqual(1, di.Count);

            // any introduction instance is invoked once only
            ((ICountingIntroduction)outerProxy).Inc();
            Assert.AreEqual(1, countingMixin.Counter);
        }
    }
}


text:
extern "C" {
#endif

// The minimum number of days an installation can be dormant before reactivation
// may be offered.
const int kReactivationMinDaysDormant = 50;

// The minimum number of days an installation can be dormant before a relaunch
// may be offered.
const int kRelaunchMinDaysDormant = 30;

// This function returns TRUE if Google Chrome should be offered.
// If the return is FALSE, the |reasons| DWORD explains why.  If you don't care
// for the reason, you can pass NULL for |reasons|.
// |set_flag| indicates whether a flag should be set indicating that Chrome was
// offered within the last six months; if passed FALSE, this method will not
// set the flag even if Chrome can be offered.  If passed TRUE, this method
// will set the flag only if Chrome can be offered.
// |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or
// GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked
// from an elevated or non-elevated process.
BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
                                              int shell_mode,
                                              DWORD* reasons);

// This function launches Google Chrome after a successful install. Make
// sure COM library is NOT initialized before you call this function (so if
// you called CoInitialize, call CoUninitialize before calling this function).
BOOL __stdcall LaunchGoogleChrome();

// This function launches Google Chrome after a successful install, ensuring
// that any windows that it makes are shunted to the background. Make sure COM
// library is NOT initialized before you call this function (so if you called
// CoInitialize, call CoUninitialize before calling this function).
BOOL __stdcall LaunchGoogleChromeInBackground();

// This function launches Google Chrome after a successful install at the given
// x,y coordinates with size height,length. Pass -1 for x and y to avoid moving
// the window. Pass -1 for width and height to avoid resizing the window. Set
// in_background to true to move Google Chrome behind all other windows or false
// to have it appear at the default z-order. Make sure that COM is NOT
// initialized before you call this function (so if you called CoInitialize,
// call CoUninitialize before calling this function). This call is synchronous,
// meaning it waits for Chrome to launch and appear to resize it before
// returning.
BOOL __stdcall LaunchGoogleChromeWithDimensions(int x,
                                                int y,
                                                int width,
                                                int height,
                                                bool in_background);

// This function returns the number of days since Google Chrome was last run by
// the current user. If both user-level and machine-wide installations are
// present on the system, it will return the lowest last-run-days count of
// the two.
// Returns -1 if Chrome is not installed, the last run date is in the future,
// or we are otherwise unable to determine how long since Chrome was last
// launched.
int __stdcall GoogleChromeDaysSinceLastRun();

// Returns true if a vendor with the specified |brand_code| may offer
// reactivation at this time. Returns false if the vendor may not offer
// reactivation at this time, and places one of the REACTIVATE_ERROR_XXX values
// in |error_code| if |error_code| is non-null.
// |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or
// GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked
// from an elevated or non-elevated process.
BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code,
                                    int shell_mode,
                                    DWORD* error_code);

// Attempts to reactivate Chrome for the specified |brand_code|. Returns false
// if reactivation fails, and places one of the REACTIVATE_ERROR_XXX values
// in |error_code| if |error_code| is non-null.
// |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or
// GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked
// from an elevated or non-elevated process.
BOOL __stdcall ReactivateChrome(const wchar_t* brand_code,
                                int shell_mode,
                                DWORD* error_code);

// Returns true if a vendor may offer relaunch at this time. Returns false if
// the vendor may not offer relaunching at this time, and places one of the
// RELAUNCH_ERROR_XXX values in |error_code| if |error_code| is non-null. The
// installed brandcode must be in |partner_brandcode_list|. |shell_mode| should
// be set to one of GCAPI_INVOKED_STANDARD_SHELL or GCAPI_INVOKED_UAC_ELEVATION
// depending on whether this method is invoked from an elevated or non-elevated
// process.
BOOL __stdcall CanOfferRelaunch(const wchar_t** partner_brandcode_list,
                                int partner_brandcode_list_length,
                                int shell_mode,
                                DWORD* error_code);

// Returns true if a vendor may relaunch at this time (and stores that a
// relaunch was offered). Returns false if the vendor may not relaunch
// at this time, and places one of the RELAUNCH_ERROR_XXX values in |error_code|
// if |error_code| is non-null. As for |CanOfferRelaunch|, the installed
// brandcode must be in |partner_brandcode_list|. |shell_mode| should be set to
// one of GCAPI_INVOKED_STANDARD_SHELL or GCAPI_INVOKED_UAC_ELEVATION depending
// on whether this method is invoked from an elevated or non-elevated process.
// The |relaunch_brandcode| will be stored as the brandcode that was used for
// offering this relaunch.
BOOL __stdcall SetRelaunchOffered(const wchar_t** partner_brandcode_list,
                                  int partner_brandcode_list_length,
                                  const wchar_t* relaunch_brandcode,
                                  int shell_mode,
                                  DWORD* error_code);

// Function pointer type declarations to use with GetProcAddress.
typedef BOOL (__stdcall *GCCC_CompatibilityCheck)(BOOL, int, DWORD *);
typedef BOOL (__stdcall *GCCC_LaunchGC)();
typedef BOOL (__stdcall *GCCC_LaunchGoogleChromeInBackground)();
typedef BOOL (__stdcall *GCCC_LaunchGCWithDimensions)(int, int, int, int, bool);
typedef int (__stdcall *GCCC_GoogleChromeDaysSinceLastRun)();
typedef BOOL (__stdcall *GCCC_CanOfferReactivation)(const wchar_t*,
                                                    int,
                                                    DWORD*);
typedef BOOL (__stdcall *GCCC_ReactivateChrome)(const wchar_t*,
                                                int,
                                                DWORD*);
typedef BOOL (__stdcall *GCCC_CanOfferRelaunch)(const wchar_t**,
                                                int,
                                                int,
                                                DWORD*);
typedef BOOL (__stdcall *GCCC_SetRelaunchOffered)(const wchar_t**,
                                                  int,
                                                  const wchar_t*,
                                                  int,
                                                  DWORD*);

#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // CHROME_INSTALLER_GCAPI_GCAPI_H_


text:
package me.hatter.tools.resourceproxy.dbutils.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Field {

    boolean pk() default false;

    String name() default "";
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2016 Hortoworks, Inc. All rights reserved. Hortonworks, Inc.
	licenses this file to you under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License. You may
	obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
	Unless required by applicable law or agreed to in writing, software distributed
	under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
	OR CONDITIONS OF ANY KIND, either express or implied. See the License for
	the specific language governing permissions and limitations under the License.
	See the associated NOTICE file for additional information regarding copyright
	ownership. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.apache.nifi</groupId>
		<artifactId>nifi-registry-bundle</artifactId>
		<version>1.3.0-SNAPSHOT</version>
	</parent>

	<artifactId>nifi-registry-service</artifactId>
	<packaging>jar</packaging>

	<dependencies>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-schema-registry-service-api</artifactId>
        </dependency>
		<dependency>
			<groupId>org.apache.nifi</groupId>
			<artifactId>nifi-record-serialization-service-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.nifi</groupId>
			<artifactId>nifi-record</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.nifi</groupId>
			<artifactId>nifi-avro-record-utils</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.nifi</groupId>
			<artifactId>nifi-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.nifi</groupId>
			<artifactId>nifi-utils</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>


text:
package com.amazonaws.services.ec2.model;

import java.io.Serializable;

import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.DescribeVpcEndpointServicesRequestMarshaller;

/**
 * Container for the parameters to the {@link com.amazonaws.services.ec2.AmazonEC2#describeVpcEndpointServices(DescribeVpcEndpointServicesRequest) DescribeVpcEndpointServices operation}.
 *

 * Describes all supported AWS services that can be specified when
 * creating a VPC endpoint.
 *

 *
 * @see com.amazonaws.services.ec2.AmazonEC2#describeVpcEndpointServices(DescribeVpcEndpointServicesRequest)
 */
public class DescribeVpcEndpointServicesRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest<DescribeVpcEndpointServicesRequest> {

    /**
     * The maximum number of items to return for this request. The request
     * returns a token that you can specify in a subsequent call to get the
     * next set of results.
Constraint: If the value is greater than 1000,
     * we return only 1000 items.
     */
    private Integer maxResults;

    /**
     * The token for the next set of items to return. (You received this
     * token from a prior call.)
     */
    private String nextToken;

    /**
     * The maximum number of items to return for this request. The request
     * returns a token that you can specify in a subsequent call to get the
     * next set of results.
Constraint: If the value is greater than 1000,
     * we return only 1000 items.
     *
     * @return The maximum number of items to return for this request. The request
     *         returns a token that you can specify in a subsequent call to get the
     *         next set of results.
Constraint: If the value is greater than 1000,
     *         we return only 1000 items.
     */
    public Integer getMaxResults() {
        return maxResults;
    }

    /**
     * The maximum number of items to return for this request. The request
     * returns a token that you can specify in a subsequent call to get the
     * next set of results.
Constraint: If the value is greater than 1000,
     * we return only 1000 items.
     *
     * @param maxResults The maximum number of items to return for this request. The request
     *         returns a token that you can specify in a subsequent call to get the
     *         next set of results.
Constraint: If the value is greater than 1000,
     *         we return only 1000 items.
     */
    public void setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
    }

    /**
     * The maximum number of items to return for this request. The request
     * returns a token that you can specify in a subsequent call to get the
     * next set of results.
Constraint: If the value is greater than 1000,
     * we return only 1000 items.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param maxResults The maximum number of items to return for this request. The request
     *         returns a token that you can specify in a subsequent call to get the
     *         next set of results.
Constraint: If the value is greater than 1000,
     *         we return only 1000 items.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeVpcEndpointServicesRequest withMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
        return this;
    }

    /**
     * The token for the next set of items to return. (You received this
     * token from a prior call.)
     *
     * @return The token for the next set of items to return. (You received this
     *         token from a prior call.)
     */
    public String getNextToken() {
        return nextToken;
    }

    /**
     * The token for the next set of items to return. (You received this
     * token from a prior call.)
     *
     * @param nextToken The token for the next set of items to return. (You received this
     *         token from a prior call.)
     */
    public void setNextToken(String nextToken) {
        this.nextToken = nextToken;
    }

    /**
     * The token for the next set of items to return. (You received this
     * token from a prior call.)
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param nextToken The token for the next set of items to return. (You received this
     *         token from a prior call.)
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeVpcEndpointServicesRequest withNextToken(String nextToken) {
        this.nextToken = nextToken;
        return this;
    }

    /**
     * This method is intended for internal use only.
     * Returns the marshaled request configured with additional parameters to
     * enable operation dry-run.
     */
    @Override
    public Request<DescribeVpcEndpointServicesRequest> getDryRunRequest() {
        Request<DescribeVpcEndpointServicesRequest> request = new DescribeVpcEndpointServicesRequestMarshaller().marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getMaxResults() != null) sb.append("MaxResults: " + getMaxResults() + ",");
        if (getNextToken() != null) sb.append("NextToken: " + getNextToken() );
        sb.append("}");
        return sb.toString();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode());
        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;

        if (obj instanceof DescribeVpcEndpointServicesRequest == false) return false;
        DescribeVpcEndpointServicesRequest other = (DescribeVpcEndpointServicesRequest)obj;

        if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false;
        if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false;
        if (other.getNextToken() == null ^ this.getNextToken() == null) return false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false;
        return true;
    }

    @Override
    public DescribeVpcEndpointServicesRequest clone() {

            return (DescribeVpcEndpointServicesRequest) super.clone();
    }

}


text:
import mongoose from 'mongoose';
import {addressSchema} from '../schema/address';

export const Address = mongoose.model('Address',addressSchema);


text:
package org.apache.helix.messaging;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.apache.helix.Criteria;
import org.apache.helix.HelixDataAccessor;
import org.apache.helix.HelixManager;
import org.apache.helix.HelixProperty;
import org.apache.helix.InstanceType;
import org.apache.helix.Mocks;
import org.apache.helix.NotificationContext;
import org.apache.helix.PropertyKey;
import org.apache.helix.PropertyType;
import org.apache.helix.ZNRecord;
import org.apache.helix.messaging.handling.HelixTaskResult;
import org.apache.helix.messaging.handling.MessageHandler;
import org.apache.helix.messaging.handling.MessageHandlerFactory;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.LiveInstance.LiveInstanceProperty;
import org.apache.helix.model.Message;
import org.apache.helix.tools.IdealStateCalculatorForStorageNode;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;

public class TestDefaultMessagingService
{
  class MockHelixManager extends Mocks.MockManager
  {
    class MockDataAccessor extends Mocks.MockAccessor
    {

      @Override
      public <T extends HelixProperty> T getProperty(PropertyKey key)
      {

        PropertyType type = key.getType();
        if(type == PropertyType.EXTERNALVIEW || type == PropertyType.IDEALSTATES)
        {
          return (T) new ExternalView(_externalView);
        }
        return null;
      }

      @Override
      public <T extends HelixProperty> List<T> getChildValues(PropertyKey key)
      {
        PropertyType type = key.getType();
        List<T> result = new ArrayList<T>();
        Class<? extends HelixProperty> clazz = key.getTypeClass();
        if(type == PropertyType.EXTERNALVIEW || type == PropertyType.IDEALSTATES)
        {
          HelixProperty typedInstance = HelixProperty.convertToTypedInstance(clazz, _externalView);
          result.add((T) typedInstance);
          return result;
        }
        else if(type == PropertyType.LIVEINSTANCES)
        {
          return (List<T>) HelixProperty.convertToTypedList(clazz, _liveInstances);
        }

        return result;
      }
    }

    HelixDataAccessor _accessor = new MockDataAccessor();
    ZNRecord _externalView;
    List<String> _instances;
    List<ZNRecord> _liveInstances;
    String _db = "DB";
    int _replicas = 3;
    int _partitions = 50;

    public MockHelixManager()
    {
      _liveInstances = new ArrayList<ZNRecord>();
      _instances = new ArrayList<String>();
      for(int i = 0;i<5; i++)
      {
        String instance = "localhost_"+(12918+i);
        _instances.add(instance);
        ZNRecord metaData = new ZNRecord(instance);
        metaData.setSimpleField(LiveInstanceProperty.SESSION_ID.toString(),
            UUID.randomUUID().toString());
        _liveInstances.add(metaData);
      }
      _externalView = IdealStateCalculatorForStorageNode.calculateIdealState(
          _instances, _partitions, _replicas, _db, "MASTER", "SLAVE");

    }

    @Override
    public boolean isConnected()
    {
      return true;
    }

    @Override
    public HelixDataAccessor getHelixDataAccessor()
    {
      return _accessor;
    }

    @Override
    public String getInstanceName()
    {
      return "localhost_12919";
    }

    @Override
    public InstanceType getInstanceType()
    {
      return InstanceType.PARTICIPANT;
    }
  }

  class TestMessageHandlerFactory implements MessageHandlerFactory
  {
    class TestMessageHandler extends MessageHandler
    {

      public TestMessageHandler(Message message, NotificationContext context)
      {
        super(message, context);
        // TODO Auto-generated constructor stub
      }

      @Override
      public HelixTaskResult handleMessage() throws InterruptedException
      {
        HelixTaskResult result = new HelixTaskResult();
        result.setSuccess(true);
        return result;
      }

      @Override
      public void onError( Exception e, ErrorCode code, ErrorType type)
      {
        // TODO Auto-generated method stub

      }
    }
    @Override
    public MessageHandler createHandler(Message message,
        NotificationContext context)
    {
      // TODO Auto-generated method stub
      return new TestMessageHandler(message, context);
    }

    @Override
    public String getMessageType()
    {
      // TODO Auto-generated method stub
      return "TestingMessageHandler";
    }

    @Override
    public void reset()
    {
      // TODO Auto-generated method stub

    }
  }

  @Test()
  public void TestMessageSend()
  {
    HelixManager manager = new MockHelixManager();
    DefaultMessagingService svc = new DefaultMessagingService(manager);
    TestMessageHandlerFactory factory = new TestMessageHandlerFactory();
    svc.registerMessageHandlerFactory(factory.getMessageType(), factory);

    Criteria recipientCriteria = new Criteria();
    recipientCriteria.setInstanceName("localhost_12919");
    recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
    recipientCriteria.setSelfExcluded(true);

    Message template = new Message(factory.getMessageType(), UUID.randomUUID().toString());
    AssertJUnit.assertEquals(0, svc.send(recipientCriteria, template));

    recipientCriteria.setSelfExcluded(false);
    AssertJUnit.assertEquals(1, svc.send(recipientCriteria, template));

    recipientCriteria.setSelfExcluded(false);
    recipientCriteria.setInstanceName("%");
    recipientCriteria.setResource("DB");
    recipientCriteria.setPartition("%");
    AssertJUnit.assertEquals(200, svc.send(recipientCriteria, template));

    recipientCriteria.setSelfExcluded(true);
    recipientCriteria.setInstanceName("%");
    recipientCriteria.setResource("DB");
    recipientCriteria.setPartition("%");
    AssertJUnit.assertEquals(159, svc.send(recipientCriteria, template));

    recipientCriteria.setSelfExcluded(true);
    recipientCriteria.setInstanceName("%");
    recipientCriteria.setResource("DB");
    recipientCriteria.setPartition("%");
    AssertJUnit.assertEquals(159, svc.send(recipientCriteria, template));

    recipientCriteria.setSelfExcluded(true);
    recipientCriteria.setInstanceName("localhost_12920");
    recipientCriteria.setResource("DB");
    recipientCriteria.setPartition("%");
    AssertJUnit.assertEquals(39, svc.send(recipientCriteria, template));

    recipientCriteria.setSelfExcluded(true);
    recipientCriteria.setInstanceName("localhost_12920");
    recipientCriteria.setRecipientInstanceType(InstanceType.CONTROLLER);
    recipientCriteria.setResource("DB");
    recipientCriteria.setPartition("%");
    AssertJUnit.assertEquals(1, svc.send(recipientCriteria, template));
  }
}


text:
/**
 * \file
 *         Initialiation file for the Contiki low-layer network stack (NETSTACK)
 * \author
 *         Adam Dunkels <adam@sics.se>
 */

#include "contiki/netstack.h"
/*---------------------------------------------------------------------------*/
void
netstack_init(void)
{
  NETSTACK_RADIO.init();
  NETSTACK_RDC.init();
  NETSTACK_MAC.init();
  NETSTACK_COMPRESS.init();
}
/*---------------------------------------------------------------------------*/


text:
layout: page
title: Hester Tech Executive Retreat
date: 2016-05-24
author: Jason Casey
tags: weekly links, java
status: published
summary: Mauris non sagittis magna. Mauris efficitur lectus sit amet.
banner: images/banner/leisure-04.jpg
booking:
  startDate: 08/06/2016
  endDate: 08/08/2016
  ctyhocn: WRJVTHX
  groupCode: HTER
published: true
---
Phasellus at volutpat ligula. In at turpis ut libero aliquet iaculis. Nam id quam pulvinar, accumsan neque id, ultrices quam. Fusce dignissim elementum consectetur. Vivamus aliquam consequat tortor sit amet scelerisque. In suscipit dapibus ipsum, et cursus quam mattis a. Pellentesque risus diam, ornare nec tempor vel, mollis id massa. Aliquam aliquet ante et nisi maximus ultrices. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc congue placerat vulputate.

* Phasellus non urna faucibus, convallis leo ut, elementum massa
* Mauris finibus quam sit amet congue rhoncus
* Nullam ac massa scelerisque, dignissim lorem non, sollicitudin nisl.

Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut in leo eu velit malesuada blandit. Aenean vel pellentesque nulla. Aenean ultricies mi eget purus vestibulum suscipit. Pellentesque vitae erat tellus. Etiam dolor orci, condimentum sed nisi sed, gravida tincidunt ante. Nulla pellentesque hendrerit ex id volutpat. Etiam in augue metus.
Vivamus ultrices justo semper sapien mattis, eu tempor urna fringilla. Etiam suscipit elit ut nulla vulputate, vel lobortis mauris bibendum. Nunc ut lacinia est. In ac est mollis, consectetur ipsum a, imperdiet diam. Suspendisse in suscipit nisl. Integer interdum, risus vel pellentesque tempus, ligula purus porta elit, sit amet rhoncus eros nisi ac purus. Maecenas pretium mi sapien, sed sagittis nisi pharetra ut. Fusce blandit imperdiet enim in ultrices. Aliquam et nunc non nibh fringilla tempus. Nullam sed odio vel purus facilisis viverra at eget odio. Fusce tempor quam porttitor quam ornare, ut pellentesque nulla vehicula. Donec eu orci ac augue pharetra congue eget sit amet neque. Fusce sed odio in felis convallis scelerisque in id ligula. In commodo nisl velit, quis viverra dolor facilisis sed. Donec vel lectus ac orci malesuada euismod.


text:
package org.apache.spark.deploy.rest

/**
 * An exception thrown in the REST application submission protocol.
 */
private[rest] class SubmitRestProtocolException(message: String, cause: Throwable = null)
  extends Exception(message, cause)

/**
 * An exception thrown if a field is missing from a [[SubmitRestProtocolMessage]].
 */
private[rest] class SubmitRestMissingFieldException(message: String)
  extends SubmitRestProtocolException(message)

/**
 * An exception thrown if the REST client cannot reach the REST server.
 */
private[deploy] class SubmitRestConnectionException(message: String, cause: Throwable)
  extends SubmitRestProtocolException(message, cause)


text:
<?php
/**
 * User: zach
 * Date: 3/22/13
 * Time: 7:09 AM
 */

namespace Sherlock\requests;

/**
 * Class BatchCommandInterface
 */
interface BatchCommandInterface extends \Iterator
{

}


text:
#ifndef TEST_CLEAR_SYSTEM_STATE_H_
#define TEST_CLEAR_SYSTEM_STATE_H_

#include "./vpx_config.h"
#if ARCH_X86 || ARCH_X86_64
#include "vpx_ports/x86.h"
#endif

namespace libvpx_test {

// Reset system to a known state. This function should be used for all non-API
// test cases.
inline void ClearSystemState() {
#if ARCH_X86 || ARCH_X86_64
  vpx_reset_mmx_state();
#endif
}

}  // namespace libvpx_test
#endif  // TEST_CLEAR_SYSTEM_STATE_H_


text:
// Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/

namespace System.Management.Automation
{
    /// <summary>
    /// Verbs dealing with a process or system's lifecycle.
    /// </summary>
    public static class VerbsLifecycle
    {
        public const string Approve = "Approve";
        public const string Assert = "Assert";
        public const string Complete = "Complete";
        public const string Confirm = "Confirm";
        public const string Deny = "Deny";
        public const string Disable = "Disable";
        public const string Enable = "Enable";
        public const string Install = "Install";
        public const string Invoke = "Invoke";
        public const string Register = "Register";
        public const string Request = "Request";
        public const string Restart = "Restart";
        public const string Resume = "Resume";
        public const string Start = "Start";
        public const string Stop = "Stop";
        public const string Submit = "Submit";
        public const string Suspend = "Suspend";
        public const string Uninstall = "Uninstall";
        public const string Unregister = "Unregister";
        public const string Wait = "Wait";
    }
}


text:
from libqtile.config import Screen
from libqtile.bar import Bar
from libqtile.widget import TextBox, ThermalSensor

from .utils import Xephyr
from .test_manager import BareConfig

class ColorChanger(TextBox):

    count = 0

    def update(self, text):
        self.count += 1
        if self.count % 2 == 0:
            self.foreground = "ff0000"
        else:
            self.foreground = "0000ff"
        self.text = text

class WidgetTestConf(BareConfig):
    screens = [Screen(bottom=Bar([ColorChanger(name="colorchanger")], 20))]

@Xephyr(False, WidgetTestConf())
def test_textbox_color_change(self):
    self.c.widget["colorchanger"].update('f')
    print(self.c.widget["colorchanger"].info())
    assert self.c.widget["colorchanger"].info()["foreground"] == "0000ff"

    self.c.widget["colorchanger"].update('f')
    assert self.c.widget["colorchanger"].info()["foreground"] == "ff0000"

def test_thermalsensor_regex_compatibility():
    sensors = ThermalSensor()
    test_sensors_output = """
    coretemp-isa-0000
    Adapter: ISA adapter
    Physical id 0:  +61.0°C  (high = +86.0°C, crit = +100.0°C)
    Core 0:         +54.0°C  (high = +86.0°C, crit = +100.0°C)
    Core 1:         +56.0°C  (high = +86.0°C, crit = +100.0°C)
    Core 2:         +58.0°C  (high = +86.0°C, crit = +100.0°C)
    Core 3:         +61.0°C  (high = +86.0°C, crit = +100.0°C)
    """
    sensors_detected = sensors._format_sensors_output(test_sensors_output)
    assert sensors_detected["Physical id 0"] == ("61.0", "°C")
    assert sensors_detected["Core 0"] == ("54.0", "°C")
    assert sensors_detected["Core 1"] == ("56.0", "°C")
    assert sensors_detected["Core 2"] == ("58.0", "°C")
    assert sensors_detected["Core 3"] == ("61.0", "°C")
    assert not ("Adapter" in sensors_detected.keys())


text:
/**
 *
 */

package com.aniruddhc.xPlod.views;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.aniruddhc.xPlod.R;

/**
 * @author Andrew Neal
 */
public class ViewHolderGrid {

    public final ImageView mViewHolderImage, mPeakOne, mPeakTwo;

    public final TextView mViewHolderLineOne;

    public final TextView mViewHolderLineTwo;

    public final LinearLayout mInfoHolder;

    public ViewHolderGrid(View view) {
        mViewHolderImage = (ImageView)view.findViewById(R.id.gridview_image);
        mViewHolderLineOne = (TextView)view.findViewById(R.id.gridview_line_one);
        mViewHolderLineTwo = (TextView)view.findViewById(R.id.gridview_line_two);
        mPeakOne = (ImageView)view.findViewById(R.id.peak_one);
        mPeakTwo = (ImageView)view.findViewById(R.id.peak_two);
        mInfoHolder = (LinearLayout)view.findViewById(R.id.gridview_info_holder);
        mInfoHolder.setBackgroundColor(view.getResources().getColor(R.color.transparent_black));
    }

}


text:
<!DOCTYPE html>

  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>
    Bridgewalker is now open source ·
    Bridgewalker Blog
  </title>

  <link rel="stylesheet" href="/blog/public/css/hyde.css">
  <link rel="stylesheet" href="/blog/public/css/syntax.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400italic,400,600,700|Abril+Fatface">

  <link rel="shortcut icon" href="/blog/public/favicon.png">

  <link rel="alternate" type="application/rss+xml" title="RSS" href="/blog/atom.xml">

Blog

Bridgewalker is a euro-denominated wallet for the Bitcoin economy. Here I, Jan Vornberger, blog about its development. Fun stuff to do: learn more and follow me.

              All posts

              Home

© 2013 Jan Vornberger

Bridgewalker is now open source

  07 Jan 2014

At Hive we have a strong commitment to open
source. Today, we honor this commitment by open sourcing the Bridgewalker
codebase. I am excited that this has been made possible by the Hive
acquisition
and am very much looking forward to the new possibilities and projects that this
might lead to down the line!

The meat of the Bridgewalker codebase can be found in these three repositories:

https://github.com/javgh/bridgewalker - the Bridgewalker server component

https://github.com/javgh/Bridgewalker-Android - the Bridgewalker Android
client

https://github.com/javgh/bridgewalker-deployment - configuration files and
an Ansible script to deploy Bridgewalker to a server

Then there are a number of support libraries and tools which the Bridgewalker
server depends on:

https://github.com/javgh/mtgoxapi - Haskell library for communicating with
Mt.Gox (also uploaded to
Hackage)

https://github.com/javgh/bitcoin-rpc - Haskell library to communicate with
the Satoshi Bitcoin daemon (also uploaded to
Hackage)

https://github.com/javgh/MtGoxCachingProxy - proxy that can be placed in
front of the Mt.Gox websocket API to add failure detection and history

https://github.com/javgh/watchdog - simple control structure for Haskell
to re-try an action with exponential backoff (also uploaded to
Hackage)

https://github.com/javgh/metricsd-client - Haskell client for the metrics
aggregator Metricsd (also uploaded to
Hackage)

I'm afraid that the documentation is only rudimentary in many places. This was
only a side project for me for a long time. A working Bridgewalker server also
consists of quite a few moving parts, so getting it all set up is somewhat
involved. But each repository contains a brief README file which should
hopefully get you started. If you have any questions, I am happy to try to help
out - just shoot me an email at jan@uos.de.

Happy coding!

    Back

    Comments require JavaScript -
    powered by Disqus


text:
export default {
  name: 'mathlive-mathfield',
  template: '<math-field :id="id"><slot></slot></math-field>',
  props: {
    id: {
      type: String,
      default: '',
    },
    value: {
      type: String,
      default: '',
    },
    options: {
      type: Object,
      default: () => ({}),
    },
  },
  /*
   * To register this component, call:
   * ```
   *     import * as MathLive from './mathlive.mjs';
   *     import MathfieldComponent from './vue-mathlive.mjs';
   *     Vue.use(MathfieldComponent, MathLive);
   * ```
   *
   * The HTML tag for this component is `<mathlive-mathfield>`
   *
   * @param {object} vue - This module, as returned from an import statement
   * @param {object} mathlive - The MathLive module, as returned from an import
   * statement
   */
  install(vue, mathlive) {
    // When the component is installed (with Vue.use()), the first argument
    // should be the component (as received from import) and the second
    // should be the MathLive module (also as received from import).
    // The MathLive module then gets stashed as a property of the Vue
    // object to be accessed later by the component implementation.
    // This allows the user of the component to control which version of
    // the MathLive module gets used.

    if (vue?.version && +vue.version.split('.')[0] >= 3) {
      // Vue >= 3.x
      vue.config.globalProperties.$mathlive = mathlive;
    } else {
      // Vue < 3.x
      Object.defineProperty(vue.prototype, '$mathlive', { value: mathlive });
    }

    vue.component('mathlive-mathfield', this);
  },
  watch: {
    value(newValue, _oldValue) {
      // When the `value` prop (from the model) is modified
      // update the mathfield to stay in sync, but don't send back content
      // change notifications, to avoid infinite loops.
      const oldMathfieldValue = this.$el.getValue();
      if (newValue !== oldMathfieldValue) {
        this.$el.setValue(newValue, {
          suppressChangeNotifications: true,
        });
      }
    },
    options: {
      deep: true,
      handler(newValue, oldValue) {
        if (JSON.stringify(newValue) !== JSON.stringify(oldValue))
          this.$el.setOptions(newValue);
      },
    },
  },
  mounted() {
    // A new instance is being created
    // Wait until the DOM has been constructed...
    // ... then configure the mathfield
    this.$nextTick(() => this.$el.setOptions(this.options));
  },
  methods: {
    /*
     *
     * @param {string} selector
     */
    executeCommand(selector) {
      this.$el.executeCommand(selector);
    },
    /*
     * @return {boolean}
     */
    hasFocus() {
      return this.$el.hasFocus();
    },
    focus() {
      this.$el.focus();
    },
    blur() {
      this.$el.blur();
    },
    getValue(format) {
      return this.$el.getValue(format);
    },
    insert(text, options) {
      this.$el.insert(text, options);
    },
    select() {
      this.$el.select();
    },
  },
};


text:
import AbstractRoute from './abstract';
import ErrorUtils from 'yarn-ui/utils/error-utils';

export default AbstractRoute.extend({
  model() {
    return this.store.findAll('yarn-flow-activity', {reload: true});
  },

  unloadAll() {
    this.store.unloadAll('yarn-flow-activity');
  },

  actions: {
    error(err/*, transition*/) {
      var errObj = ErrorUtils.stripErrorCodeAndMessageFromError(err);
      this.transitionTo('timeline-error', errObj);
    }
  }
});


text:
'use strict';

module.exports = {
  conditions: [''],
  name: 'TemplateMiddle',
  rules: ['RIGHT_TEMPLATE_BRACE LEFT_TEMPLATE_BRACE', 'RIGHT_TEMPLATE_BRACE TemplateCharacters LEFT_TEMPLATE_BRACE'],
  handlers: ['$$ = new (require(\'./ast/Literal\').TemplateElementNode)(\'\', false, { loc: this._$, yy })', '$$ = new (require(\'./ast/Literal\').TemplateElementNode)($2, false, { loc: this._$, yy })'],
  subRules: [require('./TemplateCharacters')]
};


text:
module MongoMapper
  module Plugins
    module Document
      extend ActiveSupport::Concern

      module ClassMethods
        def embeddable?
          false
        end
      end

      def new?
        @_new
      end

      def destroyed?
        @_destroyed == true
      end

      def reload
        if doc = collection.find_one(:_id => id)
          self.class.associations.each_value do |association|
            get_proxy(association).reset
          end
          instance_variables.each { |ivar| instance_variable_set(ivar, nil) }
          load_from_database(doc)
          self
        else
          raise DocumentNotFound, "Document match #{_id.inspect} does not exist in #{collection.name} collection"
        end
      end

      # Used by embedded docs to find root easily without if/respond_to? stuff.
      # Documents are always root documents.
      def _root_document
        self
      end
    end
  end
end


text:
// -*- mode: csharp; encoding: utf-8; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
// $Id$

using System;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.Serialization;
using XSpect.Yacq.Expressions;

namespace XSpect.Yacq.Serialization
{
    [DataContract()]
#if !SILVERLIGHT
    [Serializable()]
#endif
    internal class Vector
        : YacqSequenceNode
    {
        public override Expression Deserialize()
        {
            return YacqExpression.Vector(
                this.Elements.Null(_ => _.Select(n => n.Deserialize()))
            );
        }

        public override String ToString()
        {
            return "[" + this.Elements.Stringify(" ") + "]";
        }
    }

    partial class Node
    {
        internal static Vector Vector(VectorExpression expression)
        {
            return new Vector()
            {
                Elements = expression.Elements.Select(Serialize).ToArray(),
            }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)));
        }
    }
}
// vim:set ft=cs fenc=utf-8 ts=4 sw=4 sts=4 et:


text:
namespace Coelacanth
{
    partial class MainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

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

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.generateButton = new System.Windows.Forms.Button();
            this.clearButton = new System.Windows.Forms.Button();
            this.passwordLabel = new System.Windows.Forms.Label();
            this.ucCheckBox = new System.Windows.Forms.CheckBox();
            this.lcCheckBox = new System.Windows.Forms.CheckBox();
            this.digitsCheckBox = new System.Windows.Forms.CheckBox();
            this.clipboardCheckBox = new System.Windows.Forms.CheckBox();
            this.lengthLabel = new System.Windows.Forms.Label();
            this.passwordTextBox = new System.Windows.Forms.TextBox();
            this.lengthNumericUpDown = new System.Windows.Forms.NumericUpDown();
            ((System.ComponentModel.ISupportInitialize)(this.lengthNumericUpDown)).BeginInit();
            this.SuspendLayout();
            //
            // generateButton
            //
            this.generateButton.Location = new System.Drawing.Point(11, 85);
            this.generateButton.Name = "generateButton";
            this.generateButton.Size = new System.Drawing.Size(78, 23);
            this.generateButton.TabIndex = 1;
            this.generateButton.Text = "Generate";
            this.generateButton.UseVisualStyleBackColor = true;
            this.generateButton.Click += new System.EventHandler(this.generateButton_Click);
            //
            // clearButton
            //
            this.clearButton.Location = new System.Drawing.Point(95, 85);
            this.clearButton.Name = "clearButton";
            this.clearButton.Size = new System.Drawing.Size(78, 23);
            this.clearButton.TabIndex = 2;
            this.clearButton.Text = "Clear";
            this.clearButton.UseVisualStyleBackColor = true;
            this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
            //
            // passwordLabel
            //
            this.passwordLabel.AutoSize = true;
            this.passwordLabel.Location = new System.Drawing.Point(12, 117);
            this.passwordLabel.Name = "passwordLabel";
            this.passwordLabel.Size = new System.Drawing.Size(53, 13);
            this.passwordLabel.TabIndex = 9;
            this.passwordLabel.Text = "Password";
            //
            // ucCheckBox
            //
            this.ucCheckBox.AutoSize = true;
            this.ucCheckBox.Checked = true;
            this.ucCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ucCheckBox.Location = new System.Drawing.Point(11, 12);
            this.ucCheckBox.Name = "ucCheckBox";
            this.ucCheckBox.Size = new System.Drawing.Size(78, 17);
            this.ucCheckBox.TabIndex = 3;
            this.ucCheckBox.Text = "Uppercase";
            this.ucCheckBox.UseVisualStyleBackColor = true;
            //
            // lcCheckBox
            //
            this.lcCheckBox.AutoSize = true;
            this.lcCheckBox.Checked = true;
            this.lcCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.lcCheckBox.Location = new System.Drawing.Point(11, 35);
            this.lcCheckBox.Name = "lcCheckBox";
            this.lcCheckBox.Size = new System.Drawing.Size(78, 17);
            this.lcCheckBox.TabIndex = 4;
            this.lcCheckBox.Text = "Lowercase";
            this.lcCheckBox.UseVisualStyleBackColor = true;
            //
            // digitsCheckBox
            //
            this.digitsCheckBox.AutoSize = true;
            this.digitsCheckBox.Checked = true;
            this.digitsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.digitsCheckBox.Location = new System.Drawing.Point(11, 58);
            this.digitsCheckBox.Name = "digitsCheckBox";
            this.digitsCheckBox.Size = new System.Drawing.Size(52, 17);
            this.digitsCheckBox.TabIndex = 5;
            this.digitsCheckBox.Text = "Digits";
            this.digitsCheckBox.UseVisualStyleBackColor = true;
            //
            // clipboardCheckBox
            //
            this.clipboardCheckBox.AutoSize = true;
            this.clipboardCheckBox.Checked = true;
            this.clipboardCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.clipboardCheckBox.Location = new System.Drawing.Point(95, 12);
            this.clipboardCheckBox.Name = "clipboardCheckBox";
            this.clipboardCheckBox.Size = new System.Drawing.Size(70, 17);
            this.clipboardCheckBox.TabIndex = 6;
            this.clipboardCheckBox.Text = "Clipboard";
            this.clipboardCheckBox.UseVisualStyleBackColor = true;
            //
            // lengthLabel
            //
            this.lengthLabel.AutoSize = true;
            this.lengthLabel.Location = new System.Drawing.Point(92, 59);
            this.lengthLabel.Name = "lengthLabel";
            this.lengthLabel.Size = new System.Drawing.Size(40, 13);
            this.lengthLabel.TabIndex = 12;
            this.lengthLabel.Text = "Length";
            //
            // passwordTextBox
            //
            this.passwordTextBox.Location = new System.Drawing.Point(71, 114);
            this.passwordTextBox.Name = "passwordTextBox";
            this.passwordTextBox.ReadOnly = true;
            this.passwordTextBox.Size = new System.Drawing.Size(163, 20);
            this.passwordTextBox.TabIndex = 13;
            //
            // lengthNumericUpDown
            //
            this.lengthNumericUpDown.Location = new System.Drawing.Point(138, 59);
            this.lengthNumericUpDown.Maximum = new decimal(new int[] {
            20,
            0,
            0,
            0});
            this.lengthNumericUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.lengthNumericUpDown.Name = "lengthNumericUpDown";
            this.lengthNumericUpDown.Size = new System.Drawing.Size(50, 20);
            this.lengthNumericUpDown.TabIndex = 7;
            this.lengthNumericUpDown.Value = new decimal(new int[] {
            8,
            0,
            0,
            0});
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(246, 145);
            this.Controls.Add(this.lengthNumericUpDown);
            this.Controls.Add(this.passwordTextBox);
            this.Controls.Add(this.lengthLabel);
            this.Controls.Add(this.clipboardCheckBox);
            this.Controls.Add(this.passwordLabel);
            this.Controls.Add(this.clearButton);
            this.Controls.Add(this.generateButton);
            this.Controls.Add(this.digitsCheckBox);
            this.Controls.Add(this.lcCheckBox);
            this.Controls.Add(this.ucCheckBox);
            this.Name = "MainForm";
            this.Text = "Coelacanth";
            ((System.ComponentModel.ISupportInitialize)(this.lengthNumericUpDown)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button generateButton;
        private System.Windows.Forms.Button clearButton;
        private System.Windows.Forms.Label passwordLabel;
        private System.Windows.Forms.CheckBox ucCheckBox;
        private System.Windows.Forms.CheckBox lcCheckBox;
        private System.Windows.Forms.CheckBox digitsCheckBox;
        private System.Windows.Forms.CheckBox clipboardCheckBox;
        private System.Windows.Forms.Label lengthLabel;
        private System.Windows.Forms.TextBox passwordTextBox;
        private System.Windows.Forms.NumericUpDown lengthNumericUpDown;

    }
}