text:
package org.lwjgl.openxr;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.system.*;

import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;

/**
 * Returns the scene component locations.
 *
 *
Valid Usage (Implicit)

 *
 *

 *
The {@link MSFTSceneUnderstanding XR_MSFT_scene_understanding} extension must be enabled prior to using {@link XrSceneComponentLocationsMSFT}

 *
{@code type} must be {@link MSFTSceneUnderstanding#XR_TYPE_SCENE_COMPONENT_LOCATIONS_MSFT TYPE_SCENE_COMPONENT_LOCATIONS_MSFT}

 *
{@code next} must be {@code NULL} or a valid pointer to the next structure in a structure chain

 *
If {@code locationCount} is not 0, {@code locations} must be a pointer to an array of {@code locationCount} {@link XrSceneComponentLocationMSFT} structures

 *

 *
 *
See Also

 *
 *
{@link XrSceneComponentLocationMSFT}, {@link MSFTSceneUnderstanding#xrLocateSceneComponentsMSFT LocateSceneComponentsMSFT}

 *
 *
Layout

 *
 *

 * struct XrSceneComponentLocationsMSFT {
 *     XrStructureType {@link #type};
 *     void * {@link #next};
 *     uint32_t {@link #locationCount};
 *     {@link XrSceneComponentLocationMSFT XrSceneComponentLocationMSFT} * {@link #locations};
 * }

 */
public class XrSceneComponentLocationsMSFT extends Struct implements NativeResource {

    /** The struct size in bytes. */
    public static final int SIZEOF;

    /** The struct alignment in bytes. */
    public static final int ALIGNOF;

    /** The struct member offsets. */
    public static final int
        TYPE,
        NEXT,
        LOCATIONCOUNT,
        LOCATIONS;

    static {
        Layout layout = __struct(
            __member(4),
            __member(POINTER_SIZE),
            __member(4),
            __member(POINTER_SIZE)
        );

        SIZEOF = layout.getSize();
        ALIGNOF = layout.getAlignment();

        TYPE = layout.offsetof(0);
        NEXT = layout.offsetof(1);
        LOCATIONCOUNT = layout.offsetof(2);
        LOCATIONS = layout.offsetof(3);
    }

    /**
     * Creates a {@code XrSceneComponentLocationsMSFT} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
     * visible to the struct instance and vice versa.
     *
     *
The created instance holds a strong reference to the container object.

     */
    public XrSceneComponentLocationsMSFT(ByteBuffer container) {
        super(memAddress(container), __checkContainer(container, SIZEOF));
    }

    @Override
    public int sizeof() { return SIZEOF; }

    /** the {@code XrStructureType} of this structure. */
    @NativeType("XrStructureType")
    public int type() { return ntype(address()); }
    /** {@code NULL} or a pointer to the next structure in a structure chain. No such structures are defined in core OpenXR or this extension. */
    @NativeType("void *")
    public long next() { return nnext(address()); }
    /** a {@code uint32_t} describing the count of elements in the {@code locations} array. */
    @NativeType("uint32_t")
    public int locationCount() { return nlocationCount(address()); }
    /** an array of {@link XrSceneComponentLocationMSFT} scene component locations. */
    @Nullable
    @NativeType("XrSceneComponentLocationMSFT *")
    public XrSceneComponentLocationMSFT.Buffer locations() { return nlocations(address()); }

    /** Sets the specified value to the {@link #type} field. */
    public XrSceneComponentLocationsMSFT type(@NativeType("XrStructureType") int value) { ntype(address(), value); return this; }
    /** Sets the {@link MSFTSceneUnderstanding#XR_TYPE_SCENE_COMPONENT_LOCATIONS_MSFT TYPE_SCENE_COMPONENT_LOCATIONS_MSFT} value to the {@link #type} field. */
    public XrSceneComponentLocationsMSFT type$Default() { return type(MSFTSceneUnderstanding.XR_TYPE_SCENE_COMPONENT_LOCATIONS_MSFT); }
    /** Sets the specified value to the {@link #next} field. */
    public XrSceneComponentLocationsMSFT next(@NativeType("void *") long value) { nnext(address(), value); return this; }
    /** Sets the specified value to the {@link #locationCount} field. */
    public XrSceneComponentLocationsMSFT locationCount(@NativeType("uint32_t") int value) { nlocationCount(address(), value); return this; }
    /** Sets the address of the specified {@link XrSceneComponentLocationMSFT.Buffer} to the {@link #locations} field. */
    public XrSceneComponentLocationsMSFT locations(@Nullable @NativeType("XrSceneComponentLocationMSFT *") XrSceneComponentLocationMSFT.Buffer value) { nlocations(address(), value); return this; }

    /** Initializes this struct with the specified values. */
    public XrSceneComponentLocationsMSFT set(
        int type,
        long next,
        int locationCount,
        @Nullable XrSceneComponentLocationMSFT.Buffer locations
    ) {
        type(type);
        next(next);
        locationCount(locationCount);
        locations(locations);

        return this;
    }

    /**
     * Copies the specified struct data to this struct.
     *
     * @param src the source struct
     *
     * @return this struct
     */
    public XrSceneComponentLocationsMSFT set(XrSceneComponentLocationsMSFT src) {
        memCopy(src.address(), address(), SIZEOF);
        return this;
    }

    // -----------------------------------

    /** Returns a new {@code XrSceneComponentLocationsMSFT} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
    public static XrSceneComponentLocationsMSFT malloc() {
        return wrap(XrSceneComponentLocationsMSFT.class, nmemAllocChecked(SIZEOF));
    }

    /** Returns a new {@code XrSceneComponentLocationsMSFT} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
    public static XrSceneComponentLocationsMSFT calloc() {
        return wrap(XrSceneComponentLocationsMSFT.class, nmemCallocChecked(1, SIZEOF));
    }

    /** Returns a new {@code XrSceneComponentLocationsMSFT} instance allocated with {@link BufferUtils}. */
    public static XrSceneComponentLocationsMSFT create() {
        ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
        return wrap(XrSceneComponentLocationsMSFT.class, memAddress(container), container);
    }

    /** Returns a new {@code XrSceneComponentLocationsMSFT} instance for the specified memory address. */
    public static XrSceneComponentLocationsMSFT create(long address) {
        return wrap(XrSceneComponentLocationsMSFT.class, address);
    }

    /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static XrSceneComponentLocationsMSFT createSafe(long address) {
        return address == NULL ? null : wrap(XrSceneComponentLocationsMSFT.class, address);
    }

    /**
     * Returns a new {@link XrSceneComponentLocationsMSFT.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static XrSceneComponentLocationsMSFT.Buffer malloc(int capacity) {
        return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
    }

    /**
     * Returns a new {@link XrSceneComponentLocationsMSFT.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
     *
     * @param capacity the buffer capacity
     */
    public static XrSceneComponentLocationsMSFT.Buffer calloc(int capacity) {
        return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
    }

    /**
     * Returns a new {@link XrSceneComponentLocationsMSFT.Buffer} instance allocated with {@link BufferUtils}.
     *
     * @param capacity the buffer capacity
     */
    public static XrSceneComponentLocationsMSFT.Buffer create(int capacity) {
        ByteBuffer container = __create(capacity, SIZEOF);
        return wrap(Buffer.class, memAddress(container), capacity, container);
    }

    /**
     * Create a {@link XrSceneComponentLocationsMSFT.Buffer} instance at the specified memory.
     *
     * @param address  the memory address
     * @param capacity the buffer capacity
     */
    public static XrSceneComponentLocationsMSFT.Buffer create(long address, int capacity) {
        return wrap(Buffer.class, address, capacity);
    }

    /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
    @Nullable
    public static XrSceneComponentLocationsMSFT.Buffer createSafe(long address, int capacity) {
        return address == NULL ? null : wrap(Buffer.class, address, capacity);
    }

    /**
     * Returns a new {@code XrSceneComponentLocationsMSFT} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack the stack from which to allocate
     */
    public static XrSceneComponentLocationsMSFT malloc(MemoryStack stack) {
        return wrap(XrSceneComponentLocationsMSFT.class, stack.nmalloc(ALIGNOF, SIZEOF));
    }

    /**
     * Returns a new {@code XrSceneComponentLocationsMSFT} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack the stack from which to allocate
     */
    public static XrSceneComponentLocationsMSFT calloc(MemoryStack stack) {
        return wrap(XrSceneComponentLocationsMSFT.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
    }

    /**
     * Returns a new {@link XrSceneComponentLocationsMSFT.Buffer} instance allocated on the specified {@link MemoryStack}.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static XrSceneComponentLocationsMSFT.Buffer malloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
    }

    /**
     * Returns a new {@link XrSceneComponentLocationsMSFT.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
     *
     * @param stack    the stack from which to allocate
     * @param capacity the buffer capacity
     */
    public static XrSceneComponentLocationsMSFT.Buffer calloc(int capacity, MemoryStack stack) {
        return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
    }

    // -----------------------------------

    /** Unsafe version of {@link #type}. */
    public static int ntype(long struct) { return UNSAFE.getInt(null, struct + XrSceneComponentLocationsMSFT.TYPE); }
    /** Unsafe version of {@link #next}. */
    public static long nnext(long struct) { return memGetAddress(struct + XrSceneComponentLocationsMSFT.NEXT); }
    /** Unsafe version of {@link #locationCount}. */
    public static int nlocationCount(long struct) { return UNSAFE.getInt(null, struct + XrSceneComponentLocationsMSFT.LOCATIONCOUNT); }
    /** Unsafe version of {@link #locations}. */
    @Nullable public static XrSceneComponentLocationMSFT.Buffer nlocations(long struct) { return XrSceneComponentLocationMSFT.createSafe(memGetAddress(struct + XrSceneComponentLocationsMSFT.LOCATIONS), nlocationCount(struct)); }

    /** Unsafe version of {@link #type(int) type}. */
    public static void ntype(long struct, int value) { UNSAFE.putInt(null, struct + XrSceneComponentLocationsMSFT.TYPE, value); }
    /** Unsafe version of {@link #next(long) next}. */
    public static void nnext(long struct, long value) { memPutAddress(struct + XrSceneComponentLocationsMSFT.NEXT, value); }
    /** Sets the specified value to the {@code locationCount} field of the specified {@code struct}. */
    public static void nlocationCount(long struct, int value) { UNSAFE.putInt(null, struct + XrSceneComponentLocationsMSFT.LOCATIONCOUNT, value); }
    /** Unsafe version of {@link #locations(XrSceneComponentLocationMSFT.Buffer) locations}. */
    public static void nlocations(long struct, @Nullable XrSceneComponentLocationMSFT.Buffer value) { memPutAddress(struct + XrSceneComponentLocationsMSFT.LOCATIONS, memAddressSafe(value)); if (value != null) { nlocationCount(struct, value.remaining()); } }

    // -----------------------------------

    /** An array of {@link XrSceneComponentLocationsMSFT} structs. */
    public static class Buffer extends StructBuffer<XrSceneComponentLocationsMSFT, Buffer> implements NativeResource {

        private static final XrSceneComponentLocationsMSFT ELEMENT_FACTORY = XrSceneComponentLocationsMSFT.create(-1L);

        /**
         * Creates a new {@code XrSceneComponentLocationsMSFT.Buffer} instance backed by the specified container.
         *
         * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
         * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
         * by {@link XrSceneComponentLocationsMSFT#SIZEOF}, and its mark will be undefined.
         *
         *
The created buffer instance holds a strong reference to the container object.

         */
        public Buffer(ByteBuffer container) {
            super(container, container.remaining() / SIZEOF);
        }

        public Buffer(long address, int cap) {
            super(address, null, -1, 0, cap, cap);
        }

        Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
            super(address, container, mark, pos, lim, cap);
        }

        @Override
        protected Buffer self() {
            return this;
        }

        @Override
        protected XrSceneComponentLocationsMSFT getElementFactory() {
            return ELEMENT_FACTORY;
        }

        /** @return the value of the {@link XrSceneComponentLocationsMSFT#type} field. */
        @NativeType("XrStructureType")
        public int type() { return XrSceneComponentLocationsMSFT.ntype(address()); }
        /** @return the value of the {@link XrSceneComponentLocationsMSFT#next} field. */
        @NativeType("void *")
        public long next() { return XrSceneComponentLocationsMSFT.nnext(address()); }
        /** @return the value of the {@link XrSceneComponentLocationsMSFT#locationCount} field. */
        @NativeType("uint32_t")
        public int locationCount() { return XrSceneComponentLocationsMSFT.nlocationCount(address()); }
        /** @return a {@link XrSceneComponentLocationMSFT.Buffer} view of the struct array pointed to by the {@link XrSceneComponentLocationsMSFT#locations} field. */
        @Nullable
        @NativeType("XrSceneComponentLocationMSFT *")
        public XrSceneComponentLocationMSFT.Buffer locations() { return XrSceneComponentLocationsMSFT.nlocations(address()); }

        /** Sets the specified value to the {@link XrSceneComponentLocationsMSFT#type} field. */
        public XrSceneComponentLocationsMSFT.Buffer type(@NativeType("XrStructureType") int value) { XrSceneComponentLocationsMSFT.ntype(address(), value); return this; }
        /** Sets the {@link MSFTSceneUnderstanding#XR_TYPE_SCENE_COMPONENT_LOCATIONS_MSFT TYPE_SCENE_COMPONENT_LOCATIONS_MSFT} value to the {@link XrSceneComponentLocationsMSFT#type} field. */
        public XrSceneComponentLocationsMSFT.Buffer type$Default() { return type(MSFTSceneUnderstanding.XR_TYPE_SCENE_COMPONENT_LOCATIONS_MSFT); }
        /** Sets the specified value to the {@link XrSceneComponentLocationsMSFT#next} field. */
        public XrSceneComponentLocationsMSFT.Buffer next(@NativeType("void *") long value) { XrSceneComponentLocationsMSFT.nnext(address(), value); return this; }
        /** Sets the specified value to the {@link XrSceneComponentLocationsMSFT#locationCount} field. */
        public XrSceneComponentLocationsMSFT.Buffer locationCount(@NativeType("uint32_t") int value) { XrSceneComponentLocationsMSFT.nlocationCount(address(), value); return this; }
        /** Sets the address of the specified {@link XrSceneComponentLocationMSFT.Buffer} to the {@link XrSceneComponentLocationsMSFT#locations} field. */
        public XrSceneComponentLocationsMSFT.Buffer locations(@Nullable @NativeType("XrSceneComponentLocationMSFT *") XrSceneComponentLocationMSFT.Buffer value) { XrSceneComponentLocationsMSFT.nlocations(address(), value); return this; }

    }

}


text:
module ExecHelper
end

redpajama_set_name: RedPajamaGithub


text:
import '@firebase/polyfill';
import firebase from '@firebase/app';
import '@firebase/auth';
import '@firebase/database';
import '@firebase/firestore';
import '@firebase/functions';
import '@firebase/messaging';
import '@firebase/storage';

/**
 * @license
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @license
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @license
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @license
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @license
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @license
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
console.warn("\nIt looks like you're using the development build of the Firebase JS SDK.\nWhen deploying Firebase apps to production, it is advisable to only import\nthe individual SDK components you intend to use.\n\nFor the module builds, these are available in the following manner\n(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):\n\nCommonJS Modules:\nconst firebase = require('firebase/app');\nrequire('firebase/<PACKAGE>');\n\nES Modules:\nimport firebase from 'firebase/app';\nimport 'firebase/<PACKAGE>';\n\nTypescript:\nimport * as firebase from 'firebase/app';\nimport 'firebase/<PACKAGE>';\n");

export default firebase;


text:
package com.ai.dialog.builder.activitylifecycle;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;

/**
 * Dialog with Activity Life Cycle.
 * This dialog will
 *
 * @author leo
 *
 */
public class DialogWithActivityLifeCycle extends Dialog {

	public DialogWithActivityLifeCycle(Context context, boolean cancelable,
			OnCancelListener cancelListener) {
		super(context, cancelable, cancelListener);
		// TODO Auto-generated constructor stub
	}

	public DialogWithActivityLifeCycle(Context context, int theme) {
		super(context, theme);
		if (context instanceof Activity) {
			setOwnerActivity((Activity) context);
		}
	}

	public DialogWithActivityLifeCycle(Context context) {
		super(context);
		if (context instanceof Activity) {
			setOwnerActivity((Activity) context);
		}
	}

	@Override
	public void show() {
		super.show();
		Activity owner = getOwnerActivity();
		if (owner instanceof DoodleDialogActivity) {
			DoodleDialogActivity dda = (DoodleDialogActivity) owner;
			dda.startManageDialog(this);
		}
	}

	@Override
	public void dismiss() {
		super.dismiss();
		Activity owner = getOwnerActivity();
		if (owner instanceof DoodleDialogActivity) {
			DoodleDialogActivity dda = (DoodleDialogActivity) owner;
			dda.stopManageDialog(this);
		}
	}

}


text:
#region License
//
// Copyright (c) 2013, Kooboo team
//
// Licensed under the BSD License
// See the file LICENSE.txt for details.
//
#endregion
using Kooboo.Web.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Kooboo.CMS.Web.Areas.Contents.Models.DataSources
{
    public class RolesDatasource : ISelectListDataSource
    {
        public IEnumerable<System.Web.Mvc.SelectListItem> GetSelectListItems(RequestContext requestContext, string filter)
        {
            var roles = Kooboo.CMS.Account.Services.ServiceFactory.RoleManager.All();
            return roles.Select(it => new SelectListItem() { Text = it.Name, Value = it.Name });
        }
    }
}


text:
<?php

namespace ApplicationFeatureApi\Listener;

use ApplicationCoreAcl\Service\AclService;
use ApplicationFeatureApi\Controller\AbstractApiActionController;
use ApplicationFeatureApi\Exception;
use Zend\EventManager\Event;
use Zend\EventManager\SharedEventManagerInterface;
use Zend\EventManager\SharedListenerAggregateInterface;

class AclIsNotAllowedListener implements SharedListenerAggregateInterface
{

    private $listeners = array();

    public function onIsNotAllowed(Event $e)
    {
        if ($e->getTarget() instanceof AbstractApiActionController) {
            throw new Exception\UnauthorizedException();
        }
    }

    /**
     * @inheritdoc
     */
    public function attachShared(SharedEventManagerInterface $events)
    {
        $this->listeners[] = $events->attach(
            AclService::class,
            AclService::EVENT_IS_NOT_ALLOWED,
            array($this, 'onIsNotAllowed'),
            1
        );
    }

    /**
     * @inheritdoc
     */
    public function detachShared(SharedEventManagerInterface $events)
    {
        foreach ($this->listeners as $index => $listener) {
            if ($events->detach(AclService::class, $listener)) {
                unset($this->listeners[$index]);
            }
        }
    }
}


text:
package com.twitter.jvm

import org.scalatest.funsuite.AnyFunSuite

class EstimatorTest extends AnyFunSuite {
  test("LoadAverage") {
    // This makes LoadAverage.a = 1/2 for easy testing.
    val interval = -1d / math.log(0.5)
    val e = new LoadAverage(interval)
    assert(e.estimate.isNaN)

    e.measure(0)
    assert(e.estimate == 0)
    e.measure(1)
    assert(e.estimate == 0.5)
    e.measure(1)
    assert(e.estimate == 0.75)
    e.measure(-0.75)
    assert(e.estimate == 0)
  }
}


text:
'''
mirrormanager2 tests for the `Update Master Directory List` (UMDL) cron.
'''

__requires__ = ['SQLAlchemy >= 0.7']
import pkg_resources

import unittest
import subprocess
import sys
import os

sys.path.insert(0, os.path.join(os.path.dirname(
    os.path.abspath(__file__)), '..'))

import mirrormanager2.lib
import tests

FOLDER = os.path.dirname(os.path.abspath(__file__))

CONFIG = """
DB_URL = '%(db_path)s'

# Specify whether the crawler should send a report by email
CRAWLER_SEND_EMAIL =  False

umdl_master_directories = [
    {
        'type': 'directory',
        'path': '%(folder)s/../testdata/pub/epel/',
        'category': 'Fedora EPEL'
    },
    {
        'type': 'directory',
        'path': '%(folder)s/../testdata/pub/fedora/linux/',
        'category': 'Fedora Linux'
    },
    {
        'type': 'directory',
        'path': '%(folder)s/../testdata/pub/fedora-secondary/',
        'category': 'Fedora Secondary Arches'
    },
    {
        'type': 'directory',
        'path': '%(folder)s/../testdata/pub/archive/',
        'category': 'Fedora Archive'
    },
    {
        'type': 'directory',
        'path': '%(folder)s/../testdata/pub/alt/',
        'category': 'Fedora Other'
    }
]
""" % {'db_path': tests.DB_PATH, 'folder': FOLDER}

class UMDLTest(tests.Modeltests):
    """ UMDL tests. """

    def setUp(self):
        """ Set up the environnment, ran before every test. """
        super(UMDLTest, self).setUp()

        self.logfile = os.path.join(FOLDER, 'umdl.log')
        if os.path.exists(self.logfile):
            os.unlink(self.logfile)

        self.configfile = os.path.join(FOLDER, 'mirrormanager2_tests.cfg')
        with open(self.configfile, 'w') as stream:
            stream.write(CONFIG)

        self.umdlscript = os.path.join(
            FOLDER, '..', 'utility', 'mm2_update-master-directory-list')

        self.umdl_command = '%s -c %s --logfile=%s' % (
            self.umdlscript, self.configfile, self.logfile)

        self.assertTrue(os.path.exists(self.configfile))
        self.assertFalse(os.path.exists(self.logfile))

    def test_0_umdl_empty_db(self):
        """ Test the umdl cron against an empty database. """

        process = subprocess.Popen(args=self.umdl_command.split(),
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        stdout, stderr = process.communicate()

        self.assertEqual(stdout, '')
        self.assertEqual(stderr, '')

        with open(self.logfile) as stream:
            logs = stream.readlines()
        self.assertEqual(len(logs), 5)
        logs = ''.join([
            log.split(' ', 3)[-1]
            for log in logs
        ])
        exp ="""umdl_master_directories Category Fedora EPEL does not exist in the database, skipping
umdl_master_directories Category Fedora Linux does not exist in the database, skipping
umdl_master_directories Category Fedora Secondary Arches does not exist in the database, skipping
umdl_master_directories Category Fedora Archive does not exist in the database, skipping
umdl_master_directories Category Fedora Other does not exist in the database, skipping
"""
        self.assertEqual(logs, exp)

    def test_1_umdl(self):
        """ Test the umdl cron. """

        # Fill the DB a little bit
        tests.create_base_items(self.session)
        tests.create_directory(self.session)
        tests.create_category(self.session)
        tests.create_categorydirectory(self.session)

        # Run the UDML

        process = subprocess.Popen(args=self.umdl_command.split(),
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        stdout, stderr = process.communicate()

        self.assertEqual(stdout, '')
        self.assertEqual(stderr, '')

        with open(self.logfile) as stream:
            logs = stream.readlines()
        self.assertEqual(len(logs), 3)
        logs = ''.join([
            log.split(' ', 3)[-1]
            for log in logs
        ])
        exp ="""umdl_master_directories Category Fedora Secondary Arches does not exist in the database, skipping
umdl_master_directories Category Fedora Archive does not exist in the database, skipping
umdl_master_directories Category Fedora Other does not exist in the database, skipping
"""
        self.assertEqual(logs, exp)

        # The DB should now be filled with what UMDL added, so let's check it
        results = mirrormanager2.lib.query_directories(self.session)
        self.assertEqual(len(results), 0)

        results = mirrormanager2.lib.get_versions(self.session)
        self.assertEqual(len(results), 2)
        self.assertEqual(results[0].name, 'development')
        self.assertEqual(results[0].product.name, 'Fedora')
        self.assertEqual(results[1].name, '21')
        self.assertEqual(results[1].product.name, 'Fedora')

        results = mirrormanager2.lib.get_categories(self.session)
        self.assertEqual(len(results), 2)
        self.assertEqual(results[0].name, 'Fedora Linux')
        self.assertEqual(results[1].name, 'Fedora EPEL')

        results = mirrormanager2.lib.get_products(self.session)
        self.assertEqual(len(results), 2)
        self.assertEqual(results[0].name, 'EPEL')
        self.assertEqual(results[1].name, 'Fedora')

        results = mirrormanager2.lib.get_repositories(self.session)
        self.assertEqual(len(results), 2)
        self.assertEqual(
            results[0].name, 'pub/fedora/linux/releases/atomic/rawhide')
        self.assertEqual(results[0].category.name, 'Fedora Linux')
        self.assertEqual(results[0].version.name, 'development')
        self.assertEqual(results[0].arch.name, 'x86_64')
        self.assertEqual(
            results[0].directory.name,
            'pub/fedora/linux/releases/atomic/rawhide')
        self.assertEqual(results[0].prefix, 'atomic-unknown')

        self.assertEqual(
            results[1].name, 'pub/fedora/linux/releases/atomic/21')
        self.assertEqual(results[1].category.name, 'Fedora Linux')
        self.assertEqual(results[1].version.name, '21')
        self.assertEqual(results[1].arch.name, 'x86_64')
        self.assertEqual(
            results[1].directory.name, 'pub/fedora/linux/releases/atomic/21')
        self.assertEqual(results[1].prefix, 'atomic-21')

        results = mirrormanager2.lib.get_arches(self.session)
        self.assertEqual(len(results), 4)
        self.assertEqual(results[0].name, 'i386')
        self.assertEqual(results[1].name, 'ppc')
        self.assertEqual(results[2].name, 'source')
        self.assertEqual(results[3].name, 'x86_64')

        results = mirrormanager2.lib.get_directories(self.session)
        # tree testdata/pub says there are 84 directories and 150 files
        # There are 7 directories added by create_directory which are not
        # present on the FS, 84 + 7 = 91, so we are good \ó/
        self.assertEqual(len(results), 91)
        self.assertEqual(results[0].name, 'pub/fedora/linux/releases')
        self.assertEqual(results[1].name, 'pub/fedora/linux/extras')
        self.assertEqual(results[2].name, 'pub/epel')
        self.assertEqual(results[3].name, 'pub/fedora/linux/releases/20')
        self.assertEqual(results[4].name, 'pub/fedora/linux/releases/21')
        self.assertEqual(
            results[5].name,
            'pub/archive/fedora/linux/releases/20/Fedora/source')
        self.assertEqual(
            results[20].name,
            'pub/fedora/linux/releases/atomic/21/refs/heads/fedora-atomic/f21')
        self.assertEqual(
            results[21].name,
            'pub/fedora/linux/releases/atomic/21/refs/heads/'
            'fedora-atomic/f21/x86_64')
        self.assertEqual(
            results[22].name,
            'pub/fedora/linux/releases/atomic/21/refs/heads/'
            'fedora-atomic/f21/x86_64/updates')
        self.assertEqual(
            results[23].name,
            'pub/fedora/linux/releases/atomic/21/refs/remotes')
        self.assertEqual(
            results[24].name,
            'pub/fedora/linux/releases/atomic/21/remote-cache')

        results = mirrormanager2.lib.get_file_detail(
            self.session, 'repomd.xml', 7)
        self.assertEqual(results, None)

        results = mirrormanager2.lib.get_file_details(self.session)
        self.assertEqual(len(results), 9)

        cnt = 0
        self.assertEqual(results[cnt].filename, 'Fedora-20-x86_64-DVD.iso')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/releases/20/Fedora/x86_64/iso')
        self.assertEqual(results[cnt].sha512, None)
        self.assertEqual(
            results[cnt].sha256,
            'f2eeed5102b8890e9e6f4b9053717fe73031e699c4b76dc7028749ab66e7f917')

        cnt = 1
        self.assertEqual(results[cnt].filename, 'Fedora-20-x86_64-netinst.iso')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/releases/20/Fedora/x86_64/iso')
        self.assertEqual(results[cnt].sha512, None)
        self.assertEqual(
            results[cnt].sha256,
            '376be7d4855ad6281cb139430606a782fd6189dcb01d7b61448e915802cc350f')

        cnt = 2
        self.assertEqual(
            results[cnt].filename, 'Fedora-Live-Desktop-x86_64-20-1.iso')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/releases/20/Live/x86_64')
        self.assertEqual(results[cnt].sha512, None)
        self.assertEqual(
            results[cnt].sha256,
            'cc0333be93c7ff2fb3148cb29360d2453f78913cc8aa6c6289ae6823372a77d2')

        cnt = 3
        self.assertEqual(
            results[cnt].filename, 'Fedora-Live-KDE-x86_64-20-1.iso')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/releases/20/Live/x86_64')
        self.assertEqual(results[cnt].sha512, None)
        self.assertEqual(
            results[cnt].sha256,
            '08360a253b4a40dff948e568dba1d2ae9d931797f57aa08576b8b9f1ef7e4745')

        cnt = 4
        self.assertEqual(results[cnt].filename, 'repomd.xml')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/development/22/x86_64/os/repodata')
        self.assertEqual(
            results[cnt].sha256,
            '108b4102829c0839c7712832577fe7da24f0a9491f4dc25d4145efe6aced2ebf')
        self.assertEqual(
            results[cnt].sha512,
            '50ed8cb8f4daf8bcd1d0ccee1710b8a87ee8de5861fb15a1023d6558328795'
            'f42dade3e025c09c20ade36c77a3a82d9cdce1a2e2ad171f9974bc1889b591'
            '8020')

        cnt = 5
        self.assertEqual(results[cnt].filename, 'summary')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/atomic/rawhide')
        self.assertEqual(
            results[cnt].sha256,
            '6b439b70ecb1941e0e2e0ea0817a66715067cbd96d4367f4cd23ca287aeb14cb')
        self.assertEqual(
            results[cnt].sha512,
            '6f3cafa7f16b796a6051f740de17344542feb8b2285e3ccd9b141217fbb5f0'
            'b602c2389e4a40fe3b1aeac6f853b4c6d2d6c863e3649f567bd1af2aea502f'
            'd9e8')

        cnt = 6
        self.assertEqual(results[cnt].filename, 'summary')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/atomic/21')
        self.assertEqual(
            results[cnt].sha256,
            '6b439b70ecb1941e0e2e0ea0817a66715067cbd96d4367f4cd23ca287aeb14cb')
        self.assertEqual(
            results[cnt].sha512,
            '6f3cafa7f16b796a6051f740de17344542feb8b2285e3ccd9b141217fbb5f0'
            'b602c2389e4a40fe3b1aeac6f853b4c6d2d6c863e3649f567bd1af2aea502f'
            'd9e8')

        cnt = 7
        self.assertEqual(results[cnt].filename, 'repomd.xml')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/releases/20/Fedora/source/SRPMS/repodata')
        self.assertEqual(
            results[cnt].sha256,
            '9a4738934092cf17e4540ee9cab741e922eb8306875ae5621feb01ebeb1f67f2')
        self.assertEqual(
            results[cnt].sha512,
            '3351c7a6b1d2bd94e375d09324a9280b8becfe4dea40a227c3b270ddcedb19'
            'f420eec3f2c6a39a1edcdf52f80d31eb47a0ba25057ced2e3182dd212bc746'
            '6ba2')

        cnt = 8
        self.assertEqual(results[cnt].filename, 'repomd.xml')
        self.assertEqual(
            results[cnt].directory.name,
            'pub/fedora/linux/releases/releases/20/Fedora/x86_64/os/repodata')
        self.assertEqual(
            results[cnt].sha256,
            '108b4102829c0839c7712832577fe7da24f0a9491f4dc25d4145efe6aced2ebf')
        self.assertEqual(
            results[cnt].sha512,
            '50ed8cb8f4daf8bcd1d0ccee1710b8a87ee8de5861fb15a1023d6558328795'
            'f42dade3e025c09c20ade36c77a3a82d9cdce1a2e2ad171f9974bc1889b591'
            '8020')

        results = mirrormanager2.lib.get_host_category_dirs(self.session)
        self.assertEqual(len(results), 0)

if __name__ == '__main__':
    SUITE = unittest.TestLoader().loadTestsFromTestCase(UMDLTest)
    unittest.TextTestRunner(verbosity=10).run(SUITE)


text:
layout: archive
title: "Civano Interactive Map"
permalink: /civano/
author_profile: true
---

Interactive map of 25 field measurements from sample sites located in the Civano neighborhood of Tucson, AZ.
Interact with the map to see figures with air temperature, surface temperature, and mean radiant temperature readings overlaid on each site.

This map is associated with work published in the Journal of Land Use Science  (Turner et al. 2022). Funding for this work was provided by the UCLA Luskin Center for Innovation.

Turner, V. K., Rogers, M. L., Zhang, Y., Middel, A., Schneider, F. A., Ocón, J. P., Seeley, M., & J. Dialesandro (2022). More than surface temperature: Mitigating thermal exposure in hyper-local land system. Journal of Land Use Science. DOI: 10.1080/1747423X.2021.2015003.


text:
int main(int argc, char **argv) {
    printf("I'm a subproject bar.\n");
    return 0;
}


text:
div.jquery-gdakram-tooltip {
  width: 340px;
  color: white;
  font-size: 12px;
	position: absolute;
	z-index: 10000;
	top: 0px;
	left: 0px;
	display: none;
}

div.jquery-gdakram-tooltip div.content {
  -moz-border-radius: 1em;
  -webkit-border-radius: 1em;
  background-color: #C4C4C4;
  width: 180px;
  min-height:70px;
  float: left;
  padding: 10px;
  position: absolute;
  top:6.4em;
  left:-5.5em;

}

div.jquery-gdakram-tooltip div.content h1 {
  font-size: 16px;
  border-bottom: 1px solid #C4C4C4;
  padding-bottom: 5px;
}

div.jquery-gdakram-tooltip div.up_arrow {
  background : url('../images/up_arrow.png') 60px 0px no-repeat;
  width: 100%;
  height: 20px;
}

div.jquery-gdakram-tooltip div.down_arrow {
  background : url('images/down_arrow.png') 60px 0px no-repeat;
  width: 100%;
  height: 20px;
}

div.jquery-gdakram-tooltip div.left_arrow {
  height: 100%;
}

div.jquery-gdakram-tooltip div.left_arrow {
  float:left;
  background : url('images/left_arrow.png') 0px 0px no-repeat;
  width: 20px;
  height: 20px;
  position: relative;
  top: 40px;
  left: 0px;
}


text:
#include <aws/workspaces/model/RegisterWorkspaceDirectoryRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::WorkSpaces::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

RegisterWorkspaceDirectoryRequest::RegisterWorkspaceDirectoryRequest() :
    m_directoryIdHasBeenSet(false),
    m_subnetIdsHasBeenSet(false),
    m_enableWorkDocs(false),
    m_enableWorkDocsHasBeenSet(false),
    m_enableSelfService(false),
    m_enableSelfServiceHasBeenSet(false),
    m_tenancy(Tenancy::NOT_SET),
    m_tenancyHasBeenSet(false),
    m_tagsHasBeenSet(false)
{
}

Aws::String RegisterWorkspaceDirectoryRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_directoryIdHasBeenSet)
  {
   payload.WithString("DirectoryId", m_directoryId);

  }

  if(m_subnetIdsHasBeenSet)
  {
   Array<JsonValue> subnetIdsJsonList(m_subnetIds.size());
   for(unsigned subnetIdsIndex = 0; subnetIdsIndex < subnetIdsJsonList.GetLength(); ++subnetIdsIndex)
   {
     subnetIdsJsonList[subnetIdsIndex].AsString(m_subnetIds[subnetIdsIndex]);
   }
   payload.WithArray("SubnetIds", std::move(subnetIdsJsonList));

  }

  if(m_enableWorkDocsHasBeenSet)
  {
   payload.WithBool("EnableWorkDocs", m_enableWorkDocs);

  }

  if(m_enableSelfServiceHasBeenSet)
  {
   payload.WithBool("EnableSelfService", m_enableSelfService);

  }

  if(m_tenancyHasBeenSet)
  {
   payload.WithString("Tenancy", TenancyMapper::GetNameForTenancy(m_tenancy));
  }

  if(m_tagsHasBeenSet)
  {
   Array<JsonValue> tagsJsonList(m_tags.size());
   for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex)
   {
     tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize());
   }
   payload.WithArray("Tags", std::move(tagsJsonList));

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection RegisterWorkspaceDirectoryRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "WorkspacesService.RegisterWorkspaceDirectory"));
  return headers;

}


text:
TOP=`pwd`
CND_CONF=default
CND_DISTDIR=dist
TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/CustomDemo.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
OUTPUT_BASENAME=CustomDemo.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
PACKAGE_TOP_DIR=customdemo.x/

# Functions
function checkReturnCode
{
    rc=$?
    if [ $rc != 0 ]
    then
        exit $rc
    fi
}
function makeDirectory
# $1 directory path
# $2 permission (optional)
{
    mkdir -p "$1"
    checkReturnCode
    if [ "$2" != "" ]
    then
      chmod $2 "$1"
      checkReturnCode
    fi
}
function copyFileToTmpDir
# $1 from-file path
# $2 to-file path
# $3 permission
{
    cp "$1" "$2"
    checkReturnCode
    if [ "$3" != "" ]
    then
        chmod $3 "$2"
        checkReturnCode
    fi
}

# Setup
cd "${TOP}"
mkdir -p ${CND_DISTDIR}/${CND_CONF}/package
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}

# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/customdemo.x/bin
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755

# Generate tar file
cd "${TOP}"
rm -f ${CND_DISTDIR}/${CND_CONF}/package/customdemo.x.tar
cd ${TMPDIR}
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/customdemo.x.tar *
checkReturnCode

# Cleanup
cd "${TOP}"
rm -rf ${TMPDIR}


text:
    <link href="default.css" rel="stylesheet" type="text/css" />

Sitebricks

a fast, light web framework from Google

Google Sitebricks

source

doc

guice

examples

                    Example of the @Case widget, which is similar to a java switch() statement (we use it to choose between 3 colors):

                    @Case(choice=color)

                        @When("red")

                            Red

                        @When("yellow")

                            Yellow

                        @When("green")

                            Green

Google Sitebricks.


text:
/**
 * generated by Xtext 2.9.2
 */
package org.xtuml.bp.xtext.masl.masl.types;

import org.xtuml.bp.xtext.masl.masl.behavior.ConstExpression;

/**
 *
 * A representation of the model object 'Digits Constraint'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link org.xtuml.bp.xtext.masl.masl.types.DigitsConstraint#getDigits Digits}

 *
{@link org.xtuml.bp.xtext.masl.masl.types.DigitsConstraint#getConstraint Constraint}

 *

 *
 * @see org.xtuml.bp.xtext.masl.masl.types.TypesPackage#getDigitsConstraint()
 * @model
 * @generated
 */
public interface DigitsConstraint extends AbstractTypeConstraint {
	/**
	 * Returns the value of the 'Digits' containment reference.
	 *
	 *

	 * If the meaning of the 'Digits' containment reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Digits' containment reference.
	 * @see #setDigits(ConstExpression)
	 * @see org.xtuml.bp.xtext.masl.masl.types.TypesPackage#getDigitsConstraint_Digits()
	 * @model containment="true"
	 * @generated
	 */
	ConstExpression getDigits();

	/**
	 * Sets the value of the '{@link org.xtuml.bp.xtext.masl.masl.types.DigitsConstraint#getDigits Digits}' containment reference.
	 *
	 *
	 * @param value the new value of the 'Digits' containment reference.
	 * @see #getDigits()
	 * @generated
	 */
	void setDigits(ConstExpression value);

	/**
	 * Returns the value of the 'Constraint' containment reference.
	 *
	 *

	 * If the meaning of the 'Constraint' containment reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Constraint' containment reference.
	 * @see #setConstraint(RangeConstraint)
	 * @see org.xtuml.bp.xtext.masl.masl.types.TypesPackage#getDigitsConstraint_Constraint()
	 * @model containment="true"
	 * @generated
	 */
	RangeConstraint getConstraint();

	/**
	 * Sets the value of the '{@link org.xtuml.bp.xtext.masl.masl.types.DigitsConstraint#getConstraint Constraint}' containment reference.
	 *
	 *
	 * @param value the new value of the 'Constraint' containment reference.
	 * @see #getConstraint()
	 * @generated
	 */
	void setConstraint(RangeConstraint value);

} // DigitsConstraint


text:
    angular.module('merchello').controller('Merchello.Backoffice.NotificationProvidersController',
        ['$scope', '$location', 'notificationsService', 'dialogService', 'merchelloTabsFactory', 'dialogDataFactory', 'gatewayResourceDisplayBuilder',
        'notificationGatewayProviderResource', 'notificationGatewayProviderDisplayBuilder', 'notificationMethodDisplayBuilder',
        'notificationMonitorDisplayBuilder', 'notificationMessageDisplayBuilder',
        function($scope, $location, notificationsService, dialogService, merchelloTabsFactory, dialogDataFactory, gatewayResourceDisplayBuilder,
        notificationGatewayProviderResource, notificationGatewayProviderDisplayBuilder, notificationMethodDisplayBuilder,
        notificationMonitorDisplayBuilder, notificationMessageDisplayBuilder) {

            $scope.loaded = false;
            $scope.preValuesLoaded = false;
            $scope.notificationMonitors = [];
            $scope.tabs = [];

            $scope.notificationGatewayProviders = [];

            // exposed methods
            $scope.addNotificationMethod = addNotificationMethod;
            $scope.editNotificationMethod = editNotificationMethod;
            $scope.deleteNotificationMethod = deleteNotificationMethod;
            $scope.addNotificationMessage = addNotificationMessage;
            $scope.deleteNotificationMessage = deleteNotificationMessage;

            $scope.goToEditor = goToEditor;

            function init() {
                loadAllNotificationGatewayProviders();
                loadAllNotificationMonitors();
                $scope.tabs = merchelloTabsFactory.createGatewayProviderTabs();
                $scope.tabs.setActive('notification');
            }

            /**
             * @ngdoc method
             * @name getProviderByKey
             * @function
             *
             * @description
             * Helper method to get a provider from the notificationGatewayProviders array using the provider key passed in.
             */
            function getProviderByKey(providerkey) {
                return _.find($scope.notificationGatewayProviders, function (gatewayprovider) { return gatewayprovider.key == providerkey; });
            }

            /**
             * @ngdoc method
             * @name loadAllNotificationGatewayProviders
             * @function
             *
             * @description
             * Load the notification gateway providers from the notification gateway service, then wrap the results
             * in Merchello models and add to the scope via the notificationGatewayProviders collection.
             */
            function loadAllNotificationGatewayProviders() {
                var promiseAllProviders = notificationGatewayProviderResource.getAllGatewayProviders();
                promiseAllProviders.then(function (allProviders) {
                    $scope.notificationGatewayProviders = notificationGatewayProviderDisplayBuilder.transform(allProviders);
                    angular.forEach($scope.notificationGatewayProviders, function(provider) {
                        loadNotificationGatewayResources(provider.key);
                        loadNotificationMethods(provider.key);
                    });
                    $scope.loaded = true;
                    $scope.preValuesLoaded = true;
                }, function (reason) {
                    notificationsService.error("Available Notification Providers Load Failed", reason.message);
                });
            }

            /**
             * @ngdoc method
             * @name loadNotificationGatewayResources
             * @function
             *
             * @description
             * Load the notification gateway resources from the notification gateway service, then wrap the results
             * in Merchello models and add to the provider in the resources collection.  This will only
             * return resources that haven't already been added via other methods on the provider.
             */
            function loadNotificationGatewayResources(providerKey) {
                var provider = getProviderByKey(providerKey);
                var promiseAllResources = notificationGatewayProviderResource.getGatewayResources(provider.key);
                promiseAllResources.then(function (allResources) {
                    provider.gatewayResources = gatewayResourceDisplayBuilder.transform(allResources);
                    if (provider.gatewayResources.length > 0) {
                        provider.selectedGatewayResource = provider.gatewayResources[0];
                    }
                }, function (reason) {
                    notificationsService.error("Available Notification Provider Resources Load Failed", reason.message);
                });
            }

            /**
             * @ngdoc method
             * @name loadAllNotificationTriggers
             * @function
             *
             * @description
             * Loads the triggers for the notification messages.
             */
            function loadAllNotificationMonitors() {
                var promise = notificationGatewayProviderResource.getAllNotificationMonitors();
                promise.then(function (notificationMonitors) {
                    $scope.notificationMonitors = notificationMonitorDisplayBuilder.transform(notificationMonitors);
                });
            }

            /**
             * @ngdoc method
             * @name loadNotificationMethods
             * @function
             *
             * @description
             * Load the notification gateway methods from the notification gateway service, then wrap the results
             * in Merchello models and add to the provider in the methods collection.
             */
            function loadNotificationMethods(providerKey) {

                var provider = getProviderByKey(providerKey);
                var promiseAllResources = notificationGatewayProviderResource.getNotificationProviderNotificationMethods(providerKey);
                promiseAllResources.then(function (allMethods) {
                    provider.notificationMethods = notificationMethodDisplayBuilder.transform(allMethods);
                }, function (reason) {
                    notificationsService.error("Notification Methods Load Failed", reason.message);
                });
            }

            //--------------------------------------------------------------------------------------
            // Dialog methods
            //--------------------------------------------------------------------------------------

            /**
             * @ngdoc method
             * @name addNotificationsDialogConfirm
             * @function
             *
             * @description
             * Handles the save after recieving the notification to add from the dialog view/controller
             */
            function addNotificationsDialogConfirm(dialogData) {
                $scope.preValuesLoaded = false;
                var promiseNotificationMethod = notificationGatewayProviderResource.addNotificationMethod(dialogData.notificationMethod);
                promiseNotificationMethod.then(function(notificationFromServer) {
                    notificationsService.success("Notification Method saved.", "");
                    init();
                }, function(reason) {
                    notificationsService.error("Notification Method save Failed", reason.message);
                });
            }

            function saveNotificationDialogConfirm(dialogData) {
                $scope.preValuesLoaded = false;
                var promiseNotificationMethod = notificationGatewayProviderResource.saveNotificationMethod(dialogData.notificationMethod);
                promiseNotificationMethod.then(function(notificationFromServer) {
                    notificationsService.success("Notification Method saved.", "");
                    init();
                }, function(reason) {
                    notificationsService.error("Notification Method save Failed", reason.message);
                });
            }

            /**
             * @ngdoc method
             * @name addNotificationMethod
             * @function
             *
             * @description
             * Opens the add notification method dialog via the Umbraco dialogService.
             */
            function addNotificationMethod(provider, resource) {
                var dialogData = dialogDataFactory.createAddEditNotificationMethodDialogData();
                var method = notificationMethodDisplayBuilder.createDefault();
                method.name = resource.name;
                method.serviceCode = resource.serviceCode;
                method.providerKey = provider.key;
                dialogData.notificationMethod = method;
                dialogService.open({
                    template: '/App_Plugins/Merchello/Backoffice/Merchello/Dialogs/notification.notificationmethod.addedit.html',
                    show: true,
                    callback: addNotificationsDialogConfirm,
                    dialogData: dialogData
                });
            }

            function editNotificationMethod(method) {
                var dialogData = {
                    notificationMethod: angular.extend(notificationMethodDisplayBuilder.createDefault(), method)
                };

                dialogService.open({
                    template: '/App_Plugins/Merchello/Backoffice/Merchello/Dialogs/notification.notificationmethod.addedit.html',
                    show: true,
                    callback: saveNotificationDialogConfirm,
                    dialogData: dialogData
                });
            }

            /**
             * @ngdoc method
             * @name notificationsMethodDeleteDialogConfirm
             * @function
             *
             * @description
             * Handles the delete after recieving the deleted command from the dialog view/controller
             */
            function notificationsMethodDeleteDialogConfirm(dialogData) {
                $scope.preValuesLoaded = false;
                var promiseNotificationMethod = notificationGatewayProviderResource.deleteNotificationMethod(dialogData.notificationMethod.key);
                promiseNotificationMethod.then(function () {
                    notificationsService.success("Notification Deleted");
                    init();
                }, function (reason) {
                    notificationsService.error("Notification Method Deletion Failed", reason.message);
                });
            }

            /**
             * @ngdoc method
             * @name deleteNotificationMethod
             * @function
             *
             * @description
             * Opens the delete dialog via the Umbraco dialogService
             */
            function deleteNotificationMethod(method) {
                var dialogData = dialogDataFactory.createDeleteNotificationMethodDialogData();
                dialogData.notificationMethod = method;
                dialogData.name = method.name;
                dialogService.open({
                    template: '/App_Plugins/Merchello/Backoffice/Merchello/Dialogs/delete.confirmation.html',
                    show: true,
                    callback: notificationsMethodDeleteDialogConfirm,
                    dialogData: dialogData
                });
            }

            /**
             * @ngdoc method
             * @name notificationsMessageDeleteDialogConfirm
             * @function
             *
             * @description
             * Handles the delete after recieving the deleted command from the dialog view/controller
             */
            function notificationsMessageDeleteDialogConfirm(dialogData) {
                var promiseNotificationMethod = notificationGatewayProviderResource.deleteNotificationMessage(dialogData.notificationMessage.key);
                promiseNotificationMethod.then(function () {
                    notificationsService.success("Notification Deleted");
                    init();
                }, function (reason) {
                    notificationsService.error("Notification Method Deletion Failed", reason.message);
                });
            }

            /**
             * @ngdoc method
             * @name deleteNotificationMessage
             * @function
             *
             * @description
             * Opens the delete dialog via the Umbraco dialogService
             */
            function deleteNotificationMessage(message) {
                var dialogData = dialogDataFactory.createDeleteNotificationMessageDialogData();
                dialogData.notificationMessage = message;
                dialogData.name = message.name;

                dialogService.open({
                    template: '/App_Plugins/Merchello/Backoffice/Merchello/Dialogs/delete.confirmation.html',
                    show: true,
                    callback: notificationsMessageDeleteDialogConfirm,
                    dialogData: dialogData
                });
            }

            /**
             * @ngdoc method
             * @name notificationsMessageAddDialogConfirm
             * @function
             *
             * @description
             * Handles the save after recieving the save command from the dialog view/controller
             */
            function notificationsMessageAddDialogConfirm(dialogData) {
                var promiseNotificationMethod = notificationGatewayProviderResource.saveNotificationMessage(dialogData.notificationMessage);
                promiseNotificationMethod.then(function (keyFromServer) {
                    notificationsService.success("Notification Saved", "");
                    init();
                }, function (reason) {
                    notificationsService.error("Notification Message Saved Failed", reason.message);
                });
            }

            /**
             * @ngdoc method
             * @name addNotificationMessage
             * @function
             *
             * @description
             * Opens the add notification dialog via the Umbraco dialogService
             */
            function addNotificationMessage(method) {
                var dialogData = dialogDataFactory.createAddEditNotificationMessageDialogData();
                dialogData.notificationMessage = notificationMessageDisplayBuilder.createDefault();
                console.info(method);
                dialogData.notificationMessage.methodKey = method.key;
                dialogData.notificationMessage.name = method.name;
                dialogData.notificationMonitors = $scope.notificationMonitors;
                dialogData.selectedMonitor = $scope.notificationMonitors[0];
                dialogService.open({
                    template: '/App_Plugins/Merchello/Backoffice/Merchello/Dialogs/notification.notificationmessage.add.html',
                    show: true,
                    callback: notificationsMessageAddDialogConfirm,
                    dialogData: dialogData
                });
            }

            function goToEditor(message) {
                var monitor = _.find($scope.notificationMonitors, function(m) {
                    return m.monitorKey === message.monitorKey;
                });

                if (monitor !== undefined) {
                    $location.url('merchello/merchello/notificationmessageeditor/' + message.key, true);
                }
            }

            // Initialize the controller
            init();
    }]);


text:
FactoryGirl.define do
  factory :jefit_activity_date do
    active_on Date.today
  end
end


text:
AliAnalysisTask *AddEventMixingTestTask(TString format = "esd", Bool_t useMC = kFALSE,TString postfix="")
{
   // create manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) mgr = new AliAnalysisManager("MIX test");

   // create our task
   AliAnalysisTaskEx02 *task = new AliAnalysisTaskEx02("AliAnalysisTaskEx02");

   // create output container
   AliAnalysisDataContainer *output1 = mgr->CreateContainer("cEx2", TList::Class(), AliAnalysisManager::kOutputContainer, "MixTestOutput.root");

   // add our task to the manager
   mgr->AddTask(task);

   // finaly connect input and output
   mgr->ConnectInput(task, 0,  mgr->GetCommonInputContainer());
   mgr->ConnectOutput(task, 1, output1);

   return task;
}


text:
<?php namespace NymphTesting;

// phpcs:disable Generic.Files.LineLength.TooLong

class EntityTest extends \PHPUnit\Framework\TestCase {
  public function testHookPHP() {
    $this->assertTrue(
      class_exists('\SciActive\Hook'),
      'HookPHP must be installed to run these tests.'
    );
  }

  public function testInstantiate() {
    $testEntity = TestModel::factory();

    $this->assertInstanceOf('SciActive\HookOverride_NymphTesting_TestModel', $testEntity);

    $this->assertInstanceOf('NymphTesting\TestModel', $testEntity->_hookObject());

    $this->assertTrue($testEntity->hasTag('test'));

    $this->assertTrue($testEntity->boolean);

    return $testEntity;
  }

  /**
   * @depends testInstantiate
   * @param \NymphTesting\TestModel $testEntity
   */
  public function testAssignment($testEntity) {
    // Assign some variables.
    $testEntity->name = 'Entity Test';
    $testEntity->null = null;
    $testEntity->string = 'test';
    $testEntity->array = ['full', 'of', 'values', 500];
    $testEntity->number = 30;

    $this->assertSame('Entity Test', $testEntity->name);
    $this->assertNull($testEntity->null);
    $this->assertSame('test', $testEntity->string);
    $this->assertSame(['full', 'of', 'values', 500], $testEntity->array);
    $this->assertSame(30, $testEntity->number);

    $this->assertTrue($testEntity->save());

    $entityReferenceTest = TestModel::factory();
    $entityReferenceTest->string = 'wrong';
    $this->assertTrue($entityReferenceTest->save());
    $entityReferenceGuid = $entityReferenceTest->guid;
    $testEntity->reference = $entityReferenceTest;
    $testEntity->refArray = [0 => ['entity' => $entityReferenceTest]];
    $testEntity->refObject = (object) [
      'thing' => (object) ['entity' => $entityReferenceTest]
    ];
    $this->assertTrue($testEntity->save());

    $entityReferenceTest->test = 'good';
    $this->assertTrue($entityReferenceTest->save());

    return ['entity' => $testEntity, 'refGuid' => $entityReferenceGuid];
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testUndefinedProperty($arr) {
    $testEntity = $arr['entity'];

    try {
      $string = $testEntity->undefinedProperty;
    } catch (\PHPUnit\Framework\Error\Notice $e) {
      $this->assertEquals(8, $e->getCode());
      $this->assertEquals(
        'Undefined property: Nymph\EntityData::$undefinedProperty',
        $e->getMessage()
      );
    }
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testComparison($arr) {
    $testEntity = $arr['entity'];
    $compare = TestModel::factory($testEntity->guid);

    $this->assertTrue($testEntity->is($compare));
    $testEntity->refresh();
    $compare->refresh();
    $this->assertTrue($testEntity->equals($compare));

    $compare->string = 'different';

    $this->assertTrue($testEntity->is($compare));
    $this->assertFalse($testEntity->equals($compare));
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testArraySearching($arr) {
    $testEntity = $arr['entity'];
    $array = ['thing', TestModel::factory($testEntity->guid)];

    $this->assertTrue($testEntity->inArray($array));
    $testEntity->refresh();
    $array[1]->refresh();
    $this->assertTrue($testEntity->inArray($array, true));
    $this->assertFalse($testEntity->inArray([0, 1, 2, 3, 4, 5]));
    $this->assertFalse($testEntity->inArray([0, 1, 2, 3, 4, 5], true));

    $array[1]->string = 'different';

    $this->assertTrue($testEntity->inArray($array));
    $this->assertFalse($testEntity->inArray($array, true));

    $this->assertSame(1, $testEntity->arraySearch($array));
    $testEntity->refresh();
    $array[1]->refresh();
    $this->assertSame(1, $testEntity->arraySearch($array, true));
    $this->assertSame(false, $testEntity->arraySearch([0, 1, 2, 3, 4, 5]));
    $this->assertSame(
      false,
      $testEntity->arraySearch([0, 1, 2, 3, 4, 5], true)
    );

    $array[1]->string = 'different';

    $this->assertSame(1, $testEntity->arraySearch($array));
    $this->assertSame(false, $testEntity->arraySearch($array, true));
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testRefresh($arr) {
    $testEntity = $arr['entity'];

    $testEntity->null = true;
    $this->assertTrue($testEntity->null);
    $this->assertTrue($testEntity->refresh());
    $this->assertNull($testEntity->null);
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testUpdateRefresh($arr) {
    $testEntity = $arr['entity'];

    $this->assertSame('test', $testEntity->string);
    $testEntity->string = 'updated';
    $this->assertTrue($testEntity->save());
    $testEntity->refresh();
    $this->assertTrue($testEntity->save());

    $retrieve = TestModel::factory($testEntity->guid);
    $this->assertSame('updated', $retrieve->string);
    $testEntity->string = 'test';
    $this->assertTrue($testEntity->save());

    $testEntity->refresh();
    $this->assertSame('test', $testEntity->string);
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testConflictFailsToSave($arr) {
    $testEntity = $arr['entity'];

    $testEntityCopy = TestModel::factory($testEntity->guid);
    $this->assertTrue($testEntityCopy->save());

    $this->assertFalse($testEntity->save());

    $testEntity->refresh();

    $this->assertLessThan(
      .001,
      abs($testEntityCopy->mdate - $testEntity->mdate)
    );
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testToReference($arr) {
    $testEntity = $arr['entity'];

    $reference = $testEntity->toReference();

    $this->assertEquals(
      ['nymph_entity_reference', $testEntity->guid, 'NymphTesting\TestModel'],
      $reference
    );
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testTags($arr) {
    $testEntity = $arr['entity'];

    $this->assertTrue($testEntity->hasTag('test'));
    $testEntity->addTag('test', 'test2');
    $this->assertTrue($testEntity->hasTag('test', 'test2'));
    $testEntity->addTag(['test', 'test3', 'test4', 'test5', 'test6']);
    $this->assertTrue(
      $testEntity->hasTag(['test', 'test3', 'test4', 'test5', 'test6'])
    );
    $testEntity->removeTag('test2');
    $this->assertFalse($testEntity->hasTag('test2'));
    $testEntity->removeTag('test3', 'test4');
    $this->assertFalse($testEntity->hasTag('test3', 'test4'));
    $testEntity->removeTag(['test5', 'test6']);
    $this->assertFalse($testEntity->hasTag(['test5', 'test6']));
    $this->assertEquals(['test'], $testEntity->getTags());

    // Remove all tags.
    $testEntity->removeTag('test');
    $this->assertTrue($testEntity->save());
    $this->assertTrue($testEntity->refresh());
    $this->assertFalse($testEntity->hasTag('test'));
    $this->assertEquals([], $testEntity->getTags());
    $testEntity->addTag('test');
    $this->assertTrue($testEntity->save());
    $this->assertTrue($testEntity->hasTag('test'));
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testReferences($arr) {
    $testEntity = $arr['entity'];

    $testEntity->refresh();

    $this->assertSame($arr['refGuid'], $testEntity->reference->guid);
    $this->assertSame(
      $arr['refGuid'],
      $testEntity->refArray[0]['entity']->guid
    );
    $this->assertSame(
      $arr['refGuid'],
      $testEntity->refObject->thing->entity->guid
    );

    $entity = TestModel::factory($testEntity->guid);

    $this->assertSame($arr['refGuid'], $entity->reference->guid);
    $this->assertSame($arr['refGuid'], $entity->refArray[0]['entity']->guid);
    $this->assertSame(
      $arr['refGuid'],
      $entity->refObject->thing->entity->guid
    );
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testSleepingReferences($arr) {
    $testEntity = $arr['entity'];

    $entity = TestModel::factoryReference(
      ['nymph_entity_reference', $testEntity->guid, 'NymphTesting\TestModel']
    );

    $this->assertSame($testEntity->guid, $entity->guid);
    $this->assertSame($testEntity->cdate, $entity->cdate);
    $this->assertSame($testEntity->mdate, $entity->mdate);
    $this->assertSame($testEntity->tags, $entity->tags);
    $this->assertSame('Entity Test', $entity->name);
    $this->assertNull($entity->null);
    $this->assertSame('test', $entity->string);
    $this->assertSame(['full', 'of', 'values', 500], $entity->array);
    $this->assertSame(30, $entity->number);
    $this->assertSame($arr['refGuid'], $entity->reference->guid);
    $this->assertSame($arr['refGuid'], $entity->refArray[0]['entity']->guid);
    $this->assertSame(
      $arr['refGuid'],
      $entity->refObject->thing->entity->guid
    );
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testJSON($arr) {
    $testEntity = $arr['entity'];

    $json = json_encode($testEntity);

    $this->assertJsonStringEqualsJsonString(
      '{"guid":'.$testEntity->guid.',"cdate":'.
        json_encode($testEntity->cdate).',"mdate":'.
        json_encode($testEntity->mdate).',"tags":["test"],"data":'.
        '{"reference":["nymph_entity_reference",'.
        $arr['refGuid'].',"NymphTesting\\\\TestModel"],"refArray":[{"entity":'.
        '["nymph_entity_reference",'.
        $arr['refGuid'].',"NymphTesting\\\\TestModel"]}],"refObject":{"thing":'.
        '{"entity":["nymph_entity_reference",'.$arr['refGuid'].
        ',"NymphTesting\\\\TestModel"]}},"name":"Entity Test","number":30,"array":'.
        '["full","of","values",500],"string":"test","null":null},'.
        '"class":"NymphTesting\\\\TestModel"}',
      $json
    );
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testAcceptJSON($arr) {
    $testEntity = $arr['entity'];

    // Test that a property can be deleted.
    $json = json_encode($testEntity);

    $entityDataDelete = json_decode($json, true);

    unset($entityDataDelete['data']['string']);
    $testEntity->jsonAcceptData($entityDataDelete);

    $this->assertFalse(isset($testEntity->string));

    $this->assertTrue($testEntity->refresh());

    // Test whitelisted data.
    $json = json_encode($testEntity);

    $entityData = json_decode($json, true);

    $testEntity->cdate = 13;
    $testEntity->mdate = 14;
    $entityData['cdate'] = 13;
    $entityData['mdate'] = 14.00009;
    $entityData['tags'] = ['test', 'notag', 'newtag'];
    $entityData['data']['name'] = 'bad';
    $entityData['data']['string'] = 'good';
    $entityData['data']['null'] = true;
    $entityData['data']['array'] = ['imanarray'];
    $entityData['data']['number'] = 4;
    $entityData['data']['reference'] = false;
    $entityData['data']['refArray'] = [false];
    $entityData['data']['refObject'] = (object) ["thing" => false];
    $testEntity->jsonAcceptData($entityData);

    $this->assertFalse($testEntity->hasTag('notag'));
    $this->assertTrue($testEntity->hasTag('newtag'));
    $this->assertSame(13.0, $testEntity->cdate);
    $this->assertSame(14.00009, $testEntity->mdate);
    $this->assertSame('Entity Test', $testEntity->name);
    $this->assertNull($testEntity->null);
    $this->assertSame('good', $testEntity->string);
    $this->assertSame(['imanarray'], $testEntity->array);
    $this->assertSame(30, $testEntity->number);
    $this->assertSame($arr['refGuid'], $testEntity->reference->guid);
    $this->assertSame(
      $arr['refGuid'],
      $testEntity->refArray[0]['entity']->guid
    );
    $this->assertSame(
      $arr['refGuid'],
      $testEntity->refObject->thing->entity->guid
    );

    $this->assertTrue($testEntity->refresh());

    // Test no whitelist, but protected data instead.
    $testEntity->useProtectedData();

    $testEntity->cdate = 13;
    $testEntity->mdate = 14;
    $testEntity->jsonAcceptData($entityData);

    $this->assertFalse($testEntity->hasTag('notag'));
    $this->assertTrue($testEntity->hasTag('newtag'));
    $this->assertSame(13.0, $testEntity->cdate);
    $this->assertSame(14.00009, $testEntity->mdate);
    $this->assertSame('bad', $testEntity->name);
    $this->assertTrue($testEntity->null);
    $this->assertSame('good', $testEntity->string);
    $this->assertSame(['imanarray'], $testEntity->array);
    $this->assertSame(30, $testEntity->number);
    $this->assertFalse($testEntity->reference);
    $this->assertSame([false], $testEntity->refArray);
    $this->assertEquals((object) ["thing" => false], $testEntity->refObject);

    $this->assertTrue($testEntity->refresh());
  }

  /**
   * @depends testAssignment
   * @param array $arr
   */
  public function testConflictJSON($arr) {
    $testEntity = $arr['entity'];

    // Test that an old JSON payload causes a conflict.
    $json = json_encode($testEntity);

    $this->assertTrue($testEntity->save());

    $thrown = false;
    $data = json_decode($json, true);

    try {
      $testEntity->jsonAcceptData($data);
    } catch (\Nymph\Exceptions\EntityConflictException $e) {
      $thrown = true;
    }

    $this->assertTrue($thrown);

    $thrown = false;

    try {
      $testEntity->jsonAcceptPatch(
        [
          'guid' => $data['guid'],
          'mdate' => $data['mdate'],
          'set' => [
            'test' => true
          ],
          'unset' => [],
          'addTags' => [],
          'removeTags' => []
        ]
      );
    } catch (\Nymph\Exceptions\EntityConflictException $e) {
      $thrown = true;
    }

    $this->assertTrue($thrown);
  }
}


text:
import unittest

from vodem.api import wan_ipaddr

class TestWanIpaddr(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.valid_response = {
            'wan_ipaddr': '',
        }

    def test_call(self):
        resp = wan_ipaddr()
        self.assertEqual(self.valid_response, resp)


text:
layout:     post
title:      "Great Developer Habits"
date:       2020-06-23 16:08:00
author:     "Daniel Vela"
header-img: "img/post-bg-03.jpg"
locale:       en
lang-ref:   good-programming-habits
---

# Great Developer Habits

[Great Developer Habits - WWDC 2019](https://developer.apple.com/videos/play/wwdc2019/239/)

Successful app development requires mastering a lot of different things. Discover practices you can incorporate into your development workflow to enhance your productivity, and improve your app's performance and stability. Learn how to improve the quality of code you write with Xcode. Gain a practical understanding of some valuable development techniques.

## Habits

* **Organize**
    - Use *groups* in Xcode to organize everything: **functionally**
    - Match *groups* with file system.
    - Storyboards: use several using links.
    - Keep up-to-date project configuration.
    - Remove scrap code.
    - Remove warnings.
* **Track**
    - Use source control.
    - Commits small, localize and self-contained.
    - Write usefull comments messages.
    - Use branches for bugs and feature work.
* **Document**
    - It's important to describe the **why** the code is written. Document it. Comments are criticial for future understanding.
    - A good comment explains the **why**. Good comments provide background and reasoning.
    - Use Command+option+/ to add a funtion or class commentary. Use descriptive variable and constant names.
    - Include documentation.
* **Test**
    - Write unit tests.
    - Run unit tests before commiting code.
    - Build a foundation for continuous integration.
* **Analyze**
    - Simulate poor networks with Network Link Conditioner.
    - Use sanitizers and checkers.
    - Measure performance and efficiency with Debug Gauges.
    - Investigate issues with Intruments.
* **Evaluate**
    - Include code review as part of your practice.
    - Understand each line.
    - Build it.
    - Run tests.
* **Decouple**
    - Determine functional segments and break them out.
    - Scale your work across multiple apps.
    - Improve efficiency with extensions.
    - Share your efforts with the broader community.
* **Manage**
    - Use community and open source projects responsability.
    - Understand dependencies thoroughly.
    - Ensure that privacy is respected.
    - Have a plan if a dependency goes away or is no longer maintained.


text:
<?php

namespace GithubExample;

use Amp\Artax\Client as ArtaxClient;
use Auryn\Injector;
use ASM\Session;
use ASM\SessionConfig;
use ASM\SessionManager;
use GithubService\AuthToken;
use FastRoute\Dispatcher;
use GithubExample\Config;
use Jig\Jig;
use Jig\JigConfig;
use Predis\Client as RedisClient;
use Room11\HTTP\Response;
use Room11\Caching\LastModifiedStrategy;
use Room11\HTTP\HeadersSet;
use Tier\InjectionParams;
use Tier\TierApp;
use Tier\TierException;
use GithubService\AuthToken\Oauth2Token;
use GithubExample\Context\OauthContext;
use GithubService\AuthToken\NullToken;
use GithubExample\Route;

class App
{
    /**
     * @return JigConfig
     */
    public static function createJigConfig(
        Config $config,
        \Jig\JigTemplatePath $templatePath,
        \Jig\JigCompilePath $compilePath
    ) {
        $jigConfig = new JigConfig(
            $templatePath,
            $compilePath,
            $config->getKey(Config::JIG_COMPILE_CHECK),
            'tpl'
        );

        return $jigConfig;
    }

    public static function authorizedRoutesFunction(\FastRoute\RouteCollector $r)
    {

        self::commonRoutesFunction($r);

        $r->addRoute('GET', Route::showEmails(), 'GithubExample\Controller\Controller::showEmails');

        $r->addRoute('GET', Route::showAddEmailForm(), 'GithubExample\Controller\Controller::showAddEmailForm');
        $r->addRoute('POST', Route::processAddEmailForm(), 'GithubExample\Controller\Controller::processAddEmailForm');

        $r->addRoute('GET', Route::showRepoTags(), 'GithubExample\Controller\Controller::showRepoTags');
        $r->addRoute('GET', Route::showMultiRepoTags(), 'GithubExample\Controller\Controller::showMultiRepoTags');
        $r->addRoute('GET', Route::listRepoCommits(), 'GithubExample\Controller\Controller::listRepoCommits');
        $r->addRoute('GET', Route::listRepoCommitsPages(), 'GithubExample\Controller\Controller::listRepoCommitsPages');
        $r->addRoute('GET', Route::listRepoCommitsIterator(), 'GithubExample\Controller\Controller::listRepoCommitsIterator');
        $r->addRoute('GET', Route::showAuthorizations(), 'GithubExample\Controller\Controller::showAuthorizations');
        $r->addRoute('GET', Route::showUser(), 'GithubExample\Controller\Controller::showUser');
        $r->addRoute('GET', Route::oauthForget(), 'GithubExample\Controller\Controller::forget');
        $r->addRoute('GET', Route::oauthrevoke(), 'GithubExample\Controller\Controller::revoke');
    }

    public static function commonRoutesFunction(\FastRoute\RouteCollector $r)
    {
        $r->addRoute('GET', '/', 'GithubExample\Controller\Controller::index');
        $r->addRoute('GET', '/debug', 'GithubExample\Controller\Controller::debug');
        $r->addRoute('GET', Route::showRepoTags(), 'GithubExample\Controller\Controller::showRepoTags');
        $r->addRoute('GET', Route::showUser(), 'GithubExample\Controller\Controller::showUser');
    }

    public static function notAuthorizedRoutesFunction(\FastRoute\RouteCollector $r)
    {
        $r->addRoute('GET', Route::oauthStart(), 'GithubExample\Controller\Controller::oauthStart');
        $r->addRoute('GET', Route::oauthConfirm(), 'GithubExample\Controller\Controller::oauthConfirm');
        $r->addRoute('GET', Route::oauthReturn(), 'GithubExample\Controller\Controller::oauthReturn');

        self::commonRoutesFunction($r);
    }

    /**
     * @param Jig $jig
     * @param $injector
     */
    public static function prepareJig(Jig $jig, $injector)
    {
        // This is where default plugins are added.
        $jig->addDefaultPlugin('GithubExample\GithubPlugin');
    }

    /**
     * @return RedisClient
     */
    public static function createRedisClient()
    {
        $redisParameters = array(
            "scheme" => "tcp",
            "host" => '127.0.0.1',
            "port" => 6379
        );

        $redisOptions = array(
            'profile' => '2.6'
        );

        $redisClient = new RedisClient($redisParameters, $redisOptions);

        return $redisClient;
    }

    /**
     * @param \ASM\Driver $driver
     * @return Session
     */
    public static function createSession(\ASM\Driver $driver)
    {
        $sessionConfig = new SessionConfig(
            'SessionTest',
            1000,
            10
        );

        $sessionManager = new SessionManager(
            $sessionConfig,
            $driver
        );

        $session = $sessionManager->createSession($_COOKIE);

        return $session;
    }

    public static function createCaching(Config $config)
    {
        $cacheSetting = $config->getKey(Config::CACHING_SETTING);

        switch ($cacheSetting) {
            case LastModifiedStrategy::CACHING_DISABLED: {
                return new \Room11\Caching\LastModified\Disabled();
            }
            case LastModifiedStrategy::CACHING_REVALIDATE: {
                return new \Room11\Caching\LastModified\Revalidate(3600 * 2, 3600);
            }
            case LastModifiedStrategy::CACHING_TIME: {
                return new \Room11\Caching\LastModified\Time(3600 * 10, 3600);
            }
            default: {
                throw new TierException("Unknown caching setting '$cacheSetting'.");
            }
        }
    }

    public static function createScriptInclude(
        Config $config,
        \ScriptHelper\ScriptURLGenerator $scriptURLGenerator
    ) {
        $packScript = $config->getKey(Config::SCRIPT_PACKING);

        if ($packScript) {
            return new \ScriptHelper\ScriptInclude\ScriptIncludePacked($scriptURLGenerator);
        }
        else {
            return new \ScriptHelper\ScriptInclude\ScriptIncludeIndividual($scriptURLGenerator);
        }
    }

    /**
     * @param Session $session
     * @param HeadersSet $headerSet
     * @return int
     */
    public static function addSessionHeader(Session $session, HeadersSet $headerSet)
    {
        $headers = $session->getHeaders(\ASM\SessionManager::CACHE_PRIVATE);
        foreach ($headers as $key => $value) {
            $headerSet->addHeader($key, $value);
        }
        $session->save();

        return TierApp::PROCESS_CONTINUE;
    }

    public static function createDispatcher(OauthContext $oauthContext)
    {
        if ($oauthContext->isAuthenticated === true) {
            $dispatcher = \FastRoute\simpleDispatcher(['GithubExample\App', 'authorizedRoutesFunction']);
        }
        else {
            $dispatcher = \FastRoute\simpleDispatcher(['GithubExample\App', 'notAuthorizedRoutesFunction']);
        }

        return $dispatcher;
    }

    public static function createServerRequest()
    {
        $request = \Zend\Diactoros\ServerRequestFactory::fromGlobals(
            $_SERVER,
            $_GET,
            $_POST,
            $_COOKIE,
            $_FILES
        );

        return $request;
    }

    function prepareArtaxClient(ArtaxClient $client, Injector $provider) {
        $client->setOption(ArtaxClient::OP_MS_CONNECT_TIMEOUT, 25);
    }

    public static function initialExecutable(Session $session)
    {
        $data = $session->getSessionVariable(GITHUB_ACCESS_RESPONSE_KEY, null);
        $token = new NullToken();
        $oauthContext = new OauthContext(false, $token);

        if (strlen($data) > 0) {
            if (strpos($data, 'token ') === 0) {
                $data = substr($data, strlen('token '));
            }
            $token = new Oauth2Token($data);
            $oauthContext = new OauthContext(true, $token);
        }

        $aliases = [];
        $aliases['GithubService\AuthToken'] = get_class($token);
        return new InjectionParams([$oauthContext, $token], $aliases);
    }
}


text:
require 'test_helper'

class ConfigureTest < Test::Unit::TestCase
  def test_api_key_setup
    GoGoodreads.configure do |config|
      config.api_key = "someapikey"
      config.secret = "secret"
    end

    assert_equal "someapikey", GoGoodreads::Config.api_key
    assert_equal "secret", GoGoodreads::Config.secret
  end
end


text:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <script/particlconsensus.h>

#include <primitives/transaction.h>
#include <pubkey.h>
#include <script/interpreter.h>
#include <version.h>

namespace {

/** A class that deserializes a single CTransaction one time. */
class TxInputStream
{
public:
    TxInputStream(int nVersionIn, const unsigned char *txTo, size_t txToLen) :
    m_version(nVersionIn),
    m_data(txTo),
    m_remaining(txToLen)
    {}

    void read(Span<std::byte> dst)
    {
        if (dst.size() > m_remaining) {
            throw std::ios_base::failure(std::string(__func__) + ": end of data");
        }

        if (dst.data() == nullptr) {
            throw std::ios_base::failure(std::string(__func__) + ": bad destination buffer");
        }

        if (m_data == nullptr) {
            throw std::ios_base::failure(std::string(__func__) + ": bad source buffer");
        }

        memcpy(dst.data(), m_data, dst.size());
        m_remaining -= dst.size();
        m_data += dst.size();
    }

    template<typename T>
    TxInputStream& operator>>(T&& obj)
    {
        ::Unserialize(*this, obj);
        return *this;
    }

    int GetVersion() const { return m_version; }
private:
    const int m_version;
    const unsigned char* m_data;
    size_t m_remaining;
};

inline int set_error(bitcoinconsensus_error* ret, bitcoinconsensus_error serror)
{
    if (ret)
        *ret = serror;
    return 0;
}

struct ECCryptoClosure
{
    ECCVerifyHandle handle;
};

ECCryptoClosure instance_of_eccryptoclosure;
} // namespace

/** Check that all specified flags are part of the libconsensus interface. */
static bool verify_flags(unsigned int flags)
{
    return (flags & ~(bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL)) == 0;
}

static int verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, std::vector<uint8_t> amount,
                                    const unsigned char *txTo        , unsigned int txToLen,
                                    unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
{
    if (!verify_flags(flags)) {
        return set_error(err, bitcoinconsensus_ERR_INVALID_FLAGS);
    }
    try {
        TxInputStream stream(PROTOCOL_VERSION, txTo, txToLen);
        CTransaction tx(deserialize, stream);
        if (nIn >= tx.vin.size())
            return set_error(err, bitcoinconsensus_ERR_TX_INDEX);
        if (GetSerializeSize(tx, PROTOCOL_VERSION) != txToLen)
            return set_error(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);

        // Regardless of the verification result, the tx did not error.
        set_error(err, bitcoinconsensus_ERR_OK);
        PrecomputedTransactionData txdata(tx);
        return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), &tx.vin[nIn].scriptWitness, flags, TransactionSignatureChecker(&tx, nIn, amount, txdata, MissingDataBehavior::FAIL), nullptr);
    } catch (const std::exception&) {
        return set_error(err, bitcoinconsensus_ERR_TX_DESERIALIZE); // Error deserializing
    }
}

int bitcoinconsensus_verify_script_with_amount(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount,
                                    const unsigned char *txTo        , unsigned int txToLen,
                                    unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
{
    std::vector<uint8_t> am(8);
    part::SetAmount(am, amount);
    return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, nIn, flags, err);
}

int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
                                   const unsigned char *txTo        , unsigned int txToLen,
                                   unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
{
    if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
        return set_error(err, bitcoinconsensus_ERR_AMOUNT_REQUIRED);
    }

    //CAmount am(0); [aml]
    std::vector<uint8_t> am;
    return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, nIn, flags, err);
}

unsigned int bitcoinconsensus_version()
{
    // Just use the API version for now
    return BITCOINCONSENSUS_API_VER;
}


text:
layout: event
categories:
  - events
links:
title: "Potluck & Open Hack"
description: "No presentation this week. Instead, we're going to have another civic hacking potluck! If you'd like, please bring drinks, snacks or desserts! We'll provide the usual empanadas too. While we eat, we'll build, share, and learn about civic tech!"
speakers:
image: /images/blog/2015-11-23-10-lessons-from-organizing-the-chi-hack-night/img10.jpg
date: 2017-02-14T18:00:00-06:00
event_id: 241
youtube_id:
agenda: https://docs.google.com/document/d/1YY55LDGAPGPLHiFJMuzyWvU4QBYRAeQST46K2nGpbfw/edit#
sponsor: Metis
asl_provided: true
tags:
 - openhack
published: true
---

There will be no presentation this week. Instead, we're going to have another civic hacking potluck! If you'd like to bring drinks, snacks or desserts, [fill out your name and what you're bringing here](https://docs.google.com/spreadsheets/d/1tZOLTZDar7wKlkUrvNF9-_EDT65G2ezaCaTjbX-aWSU/edit#gid=0)! We'll provide the usual empanadas too.

While we eat, we'll build, share, and learn about civic tech!

**ASL** This event will {% unless page.asl_provided %} not {% endunless %}have an American Sign Language interpreter.


text:
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.

// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.

// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_GEOMETRY_ALGORITHMS_ASSIGN_HPP
#define BOOST_GEOMETRY_ALGORITHMS_ASSIGN_HPP

#include <cstddef>

#include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/type_traits.hpp>

#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
#include <boost/geometry/algorithms/detail/assign_values.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/tags.hpp>

#include <boost/geometry/geometries/concepts/check.hpp>

#include <boost/geometry/util/for_each_coordinate.hpp>

namespace boost { namespace geometry
{

/*!
\brief Assign a range of points to a linestring, ring or polygon
\note The point-type of the range might be different from the point-type of the geometry
\ingroup assign
\tparam Geometry \tparam_geometry
\tparam Range \tparam_range_point
\param geometry \param_geometry
\param range \param_range_point

\qbk{
[heading Notes]
[note Assign automatically clears the geometry before assigning (use append if you don't want that)]
[heading Example]
[assign_points] [assign_points_output]

[heading See also]
\* [link geometry.reference.algorithms.append append]
}
 */
template <typename Geometry, typename Range>
inline void assign_points(Geometry& geometry, Range const& range)
{
    concept::check<Geometry>();

    clear(geometry);
    geometry::append(geometry, range, -1, 0);
}

/*!
\brief assign to a box inverse infinite
\details The assign_inverse function initialize a 2D or 3D box with large coordinates, the
min corner is very large, the max corner is very small. This is a convenient starting point to
collect the minimum bounding box of a geometry.
\ingroup assign
\tparam Geometry \tparam_geometry
\param geometry \param_geometry

\qbk{
[heading Example]
[assign_inverse] [assign_inverse_output]

[heading See also]
\* [link geometry.reference.algorithms.make.make_inverse make_inverse]
}
 */
template <typename Geometry>
inline void assign_inverse(Geometry& geometry)
{
    concept::check<Geometry>();

    dispatch::assign_inverse
        <
            typename tag<Geometry>::type,
            Geometry
        >::apply(geometry);
}

/*!
\brief assign zero values to a box, point
\ingroup assign
\details The assign_zero function initializes a 2D or 3D point or box with coordinates of zero
\tparam Geometry \tparam_geometry
\param geometry \param_geometry

 */
template <typename Geometry>
inline void assign_zero(Geometry& geometry)
{
    concept::check<Geometry>();

    dispatch::assign_zero
        <
            typename tag<Geometry>::type,
            Geometry
        >::apply(geometry);
}

/*!
\brief Assigns one geometry to another geometry
\details The assign algorithm assigns one geometry, e.g. a BOX, to another geometry, e.g. a RING. This only
if it is possible and applicable.
\ingroup assign
\tparam Geometry1 \tparam_geometry
\tparam Geometry2 \tparam_geometry
\param geometry1 \param_geometry (target)
\param geometry2 \param_geometry (source)

\qbk{
[heading Example]
[assign] [assign_output]

[heading See also]
\* [link geometry.reference.algorithms.convert convert]
}
 */
template <typename Geometry1, typename Geometry2>
inline void assign(Geometry1& geometry1, Geometry2 const& geometry2)
{
    concept::check_concepts_and_equal_dimensions<Geometry1, Geometry2 const>();

    bool const same_point_order =
            point_order<Geometry1>::value == point_order<Geometry2>::value;
    bool const same_closure =
            closure<Geometry1>::value == closure<Geometry2>::value;

    BOOST_MPL_ASSERT_MSG
        (
            same_point_order, ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_POINT_ORDER
            , (types<Geometry1, Geometry2>)
        );
    BOOST_MPL_ASSERT_MSG
        (
            same_closure, ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_CLOSURE
            , (types<Geometry1, Geometry2>)
        );

    dispatch::convert<Geometry2, Geometry1>::apply(geometry2, geometry1);
}

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_ALGORITHMS_ASSIGN_HPP