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

namespace LockUtility
{
    /// <summary>
    /// A utility class for interacting with ReaderWriterLockSlim.
    /// </summary>
    public static class Locker
    {
        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// read locked, while taking the necessary exception precautions.
        /// </summary>
        /// <param name="rwlock">
        /// The ReaderWriterLockSlim
        /// </param>
        /// <param name="whileReadLocked">
        /// The action to perform while read locked
        /// </param>
        public static void ReadLock(
            this ReaderWriterLockSlim rwlock,
            Action whileReadLocked)
        {
            rwlock.EnterReadLock();

            try
            {
                whileReadLocked();
            }
            finally
            {
                rwlock.ExitReadLock();
            }
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// read locked, while taking the necessary exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="timeout">The number of miliseconds to wait</param>
        /// <param name="whileReadLocked">
        /// The action to perform while read locked
        /// </param>
        /// <returns>
        /// true if the lock was acquired successfully false otherwise
        /// </returns>
        public static bool TryReadLock(
            this ReaderWriterLockSlim rwlock,
            int timeout,
            Action whileReadLocked)
        {
            if (rwlock.TryEnterReadLock(timeout))
            {
                try
                {
                    whileReadLocked();
                }
                finally
                {
                    rwlock.ExitReadLock();
                }

                return true;
            }

            return false;
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// read locked, while taking the necessary exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="timeout">The number of miliseconds to wait</param>
        /// <param name="whileReadLocked">
        /// The action to perform while read locked
        /// </param>
        /// <returns>
        /// true if the lock was acquired successfully false otherwise
        /// </returns>
        public static bool TryReadLock(
            this ReaderWriterLockSlim rwlock,
            TimeSpan timeout,
            Action whileReadLocked)
        {
            if (rwlock.TryEnterReadLock(timeout))
            {
                try
                {
                    whileReadLocked();
                }
                finally
                {
                    rwlock.ExitReadLock();
                }

                return true;
            }

            return false;
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// write locked, while taking the necessary exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="whileWriteLocked">
        /// The action to perform while write locked
        /// </param>
        public static void WriteLock(
            this ReaderWriterLockSlim rwlock,
            Action whileWriteLocked)
        {
            rwlock.EnterWriteLock();

            try
            {
                whileWriteLocked();
            }
            finally
            {
                rwlock.ExitWriteLock();
            }
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// write locked, while taking the necessary exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="timeout">The number of miliseconds to wait</param>
        /// <param name="whileWriteLocked">
        /// The action to perform while write locked
        /// </param>
        /// <returns>
        /// true if the lock was acquired successfully false otherwise
        /// </returns>
        public static bool TryWriteLock(
            this ReaderWriterLockSlim rwlock,
            int timeout,
            Action whileWriteLocked)
        {
            if (rwlock.TryEnterWriteLock(timeout))
            {
                try
                {
                    whileWriteLocked();
                }
                finally
                {
                    rwlock.ExitWriteLock();
                }

                return true;
            }

            return false;
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// write locked, while taking the necessary exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="timeout">The number of miliseconds to wait</param>
        /// <param name="whileWriteLocked">
        /// The action to perform while write locked
        /// </param>
        /// <returns>
        /// true if the lock was acquired successfully false otherwise
        /// </returns>
        public static bool TryWriteLock(
            this ReaderWriterLockSlim rwlock,
            TimeSpan timeout,
            Action whileWriteLocked)
        {
            if (rwlock.TryEnterWriteLock(timeout))
            {
                try
                {
                    whileWriteLocked();
                }
                finally
                {
                    rwlock.ExitWriteLock();
                }

                return true;
            }

            return false;
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// upgradeably read locked, while taking the necessary
        /// exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="whileUpgradeableReadLocked">
        /// The action to perform while upgradeably read locked
        /// </param>
        public static void UpgradeableReadLock(
            this ReaderWriterLockSlim rwlock,
            Action whileUpgradeableReadLocked)
        {
            rwlock.EnterUpgradeableReadLock();

            try
            {
                whileUpgradeableReadLocked();
            }
            finally
            {
                rwlock.ExitUpgradeableReadLock();
            }
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// upgradeably read locked, while taking the necessary
        /// exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="timeout">The number of miliseconds to wait</param>
        /// <param name="whileUpgradeableReadLocked">
        /// The action to perform while upgradeably read locked
        /// </param>
        /// <returns>
        /// true if the lock was acquired successfully false otherwise
        /// </returns>
        public static bool TryUpgradeableReadLock(
            this ReaderWriterLockSlim rwlock,
            int timeout,
            Action whileUpgradeableReadLocked)
        {
            if (rwlock.TryEnterUpgradeableReadLock(timeout))
            {
                try
                {
                    whileUpgradeableReadLocked();
                }
                finally
                {
                    rwlock.ExitUpgradeableReadLock();
                }

                return true;
            }

            return false;
        }

        /// <summary>
        /// Performs an action while the provided ReaderWriterLockSlim is
        /// upgradeably read locked, while taking the necessary
        /// exception precautions.
        /// </summary>
        /// <param name="rwlock">The ReaderWriterLockSlim</param>
        /// <param name="timeout">The number of miliseconds to wait</param>
        /// <param name="whileUpgradeableReadLocked">
        /// The action to perform while upgradeably read locked
        /// </param>
        /// <returns>
        /// true if the lock was acquired successfully false otherwise
        /// </returns>
        public static bool TryUpgradeableReadLock(
            this ReaderWriterLockSlim rwlock,
            TimeSpan timeout,
            Action whileUpgradeableReadLocked)
        {
            if (rwlock.TryEnterUpgradeableReadLock(timeout))
            {
                try
                {
                    whileUpgradeableReadLocked();
                }
                finally
                {
                    rwlock.ExitUpgradeableReadLock();
                }

                return true;
            }

            return false;
        }
    }
}


text:
$("#category").change(function (){
   var $categoryId = $(this).val();
   $('.category-specs').hide();
   $('.category-specs').find('.category-spec').prop('disabled', true);
   $('#categorySpecs-' + $categoryId).fadeIn('slow');
   $('#categorySpecs-' + $categoryId).find('.category-spec').prop('disabled', false);
});

redpajama_set_name: RedPajamaGithub


text:
name: "🧐 Support Question"
about: 'This repository is only for reporting bugs or problems. If you need help, see:
  https://github.com/laravel/laravel#learning-laravel'

---

This repository is only for reporting bugs or issues. If you need support, please use the forums:

- https://laracasts.com/discuss
- https://laravel.io/forum

Alternatively, you may use Slack (https://larachat.co/), Discord (https://discordapp.com/invite/mPZNm7A), or Stack Overflow (http://stackoverflow.com/questions/tagged/laravel).

Thanks!


text:
package pasta.music.fragments;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnPageChange;
import pasta.music.Pasta;
import pasta.music.R;
import pasta.music.adapters.FavoritePagerAdapter;
import pasta.music.dialogs.NewPlaylistDialog;
import pasta.music.utils.PreferenceUtils;

public class FavoritesFragment extends FabFragment {

    @Bind(R.id.vp)
    ViewPager vp;
    @Bind(R.id.tl)
    TabLayout tl;

    private FavoritePagerAdapter adapter;
    private Pasta pasta;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = DataBindingUtil.inflate(inflater, R.layout.fragment_favorites, container, false).getRoot();
        ButterKnife.bind(this, rootView);

        pasta = (Pasta) getContext().getApplicationContext();

        ViewCompat.setElevation(tl, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()));

        adapter = new FavoritePagerAdapter(getActivity(), getActivity().getSupportFragmentManager());
        vp.setAdapter(adapter);
        tl.setupWithViewPager(vp);
        tl.setSelectedTabIndicatorColor(PreferenceUtils.getAccentColor(getContext()));

        setFab(true, R.drawable.ic_add, getFabClickListener());

        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnPageChange(R.id.vp)
    public void onPageSelected(int position) {
        if (position == 0) setFab(true, R.drawable.ic_add, getFabClickListener());
        else setFab(false, R.drawable.ic_add, getFabClickListener());
    }

    public View.OnClickListener getFabClickListener() {
        return new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new NewPlaylistDialog(getContext()).setOnCreateListener(new NewPlaylistDialog.OnCreateListener() {
                    @Override
                    public void onCreate() {
                        adapter.load();
                    }
                }).show();
            }
        };
    }
}


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

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * Use these settings to specify static color calibration metadata, as defined by SMPTE ST 2086. These values don't
 * affect the pixel values that are encoded in the video stream. They are intended to help the downstream video player
 * display content in a way that reflects the intentions of the the content creator.
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Hdr10Metadata implements Serializable, Cloneable, StructuredPojo {

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer bluePrimaryX;
    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer bluePrimaryY;
    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer greenPrimaryX;
    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer greenPrimaryY;
    /**
     * Maximum light level among all samples in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     */
    private Integer maxContentLightLevel;
    /**
     * Maximum average light level of any frame in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     */
    private Integer maxFrameAverageLightLevel;
    /** Nominal maximum mastering display luminance in units of of 0.0001 candelas per square meter. */
    private Integer maxLuminance;
    /** Nominal minimum mastering display luminance in units of of 0.0001 candelas per square meter */
    private Integer minLuminance;
    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer redPrimaryX;
    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer redPrimaryY;
    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer whitePointX;
    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     */
    private Integer whitePointY;

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param bluePrimaryX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setBluePrimaryX(Integer bluePrimaryX) {
        this.bluePrimaryX = bluePrimaryX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getBluePrimaryX() {
        return this.bluePrimaryX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param bluePrimaryX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withBluePrimaryX(Integer bluePrimaryX) {
        setBluePrimaryX(bluePrimaryX);
        return this;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param bluePrimaryY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setBluePrimaryY(Integer bluePrimaryY) {
        this.bluePrimaryY = bluePrimaryY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getBluePrimaryY() {
        return this.bluePrimaryY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param bluePrimaryY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withBluePrimaryY(Integer bluePrimaryY) {
        setBluePrimaryY(bluePrimaryY);
        return this;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param greenPrimaryX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setGreenPrimaryX(Integer greenPrimaryX) {
        this.greenPrimaryX = greenPrimaryX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getGreenPrimaryX() {
        return this.greenPrimaryX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param greenPrimaryX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withGreenPrimaryX(Integer greenPrimaryX) {
        setGreenPrimaryX(greenPrimaryX);
        return this;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param greenPrimaryY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setGreenPrimaryY(Integer greenPrimaryY) {
        this.greenPrimaryY = greenPrimaryY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getGreenPrimaryY() {
        return this.greenPrimaryY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param greenPrimaryY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withGreenPrimaryY(Integer greenPrimaryY) {
        setGreenPrimaryY(greenPrimaryY);
        return this;
    }

    /**
     * Maximum light level among all samples in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     *
     * @param maxContentLightLevel
     *        Maximum light level among all samples in the coded video sequence, in units of candelas per square meter.
     *        This setting doesn't have a default value; you must specify a value that is suitable for the content.
     */

    public void setMaxContentLightLevel(Integer maxContentLightLevel) {
        this.maxContentLightLevel = maxContentLightLevel;
    }

    /**
     * Maximum light level among all samples in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     *
     * @return Maximum light level among all samples in the coded video sequence, in units of candelas per square meter.
     *         This setting doesn't have a default value; you must specify a value that is suitable for the content.
     */

    public Integer getMaxContentLightLevel() {
        return this.maxContentLightLevel;
    }

    /**
     * Maximum light level among all samples in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     *
     * @param maxContentLightLevel
     *        Maximum light level among all samples in the coded video sequence, in units of candelas per square meter.
     *        This setting doesn't have a default value; you must specify a value that is suitable for the content.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withMaxContentLightLevel(Integer maxContentLightLevel) {
        setMaxContentLightLevel(maxContentLightLevel);
        return this;
    }

    /**
     * Maximum average light level of any frame in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     *
     * @param maxFrameAverageLightLevel
     *        Maximum average light level of any frame in the coded video sequence, in units of candelas per square
     *        meter. This setting doesn't have a default value; you must specify a value that is suitable for the
     *        content.
     */

    public void setMaxFrameAverageLightLevel(Integer maxFrameAverageLightLevel) {
        this.maxFrameAverageLightLevel = maxFrameAverageLightLevel;
    }

    /**
     * Maximum average light level of any frame in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     *
     * @return Maximum average light level of any frame in the coded video sequence, in units of candelas per square
     *         meter. This setting doesn't have a default value; you must specify a value that is suitable for the
     *         content.
     */

    public Integer getMaxFrameAverageLightLevel() {
        return this.maxFrameAverageLightLevel;
    }

    /**
     * Maximum average light level of any frame in the coded video sequence, in units of candelas per square meter. This
     * setting doesn't have a default value; you must specify a value that is suitable for the content.
     *
     * @param maxFrameAverageLightLevel
     *        Maximum average light level of any frame in the coded video sequence, in units of candelas per square
     *        meter. This setting doesn't have a default value; you must specify a value that is suitable for the
     *        content.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withMaxFrameAverageLightLevel(Integer maxFrameAverageLightLevel) {
        setMaxFrameAverageLightLevel(maxFrameAverageLightLevel);
        return this;
    }

    /**
     * Nominal maximum mastering display luminance in units of of 0.0001 candelas per square meter.
     *
     * @param maxLuminance
     *        Nominal maximum mastering display luminance in units of of 0.0001 candelas per square meter.
     */

    public void setMaxLuminance(Integer maxLuminance) {
        this.maxLuminance = maxLuminance;
    }

    /**
     * Nominal maximum mastering display luminance in units of of 0.0001 candelas per square meter.
     *
     * @return Nominal maximum mastering display luminance in units of of 0.0001 candelas per square meter.
     */

    public Integer getMaxLuminance() {
        return this.maxLuminance;
    }

    /**
     * Nominal maximum mastering display luminance in units of of 0.0001 candelas per square meter.
     *
     * @param maxLuminance
     *        Nominal maximum mastering display luminance in units of of 0.0001 candelas per square meter.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withMaxLuminance(Integer maxLuminance) {
        setMaxLuminance(maxLuminance);
        return this;
    }

    /**
     * Nominal minimum mastering display luminance in units of of 0.0001 candelas per square meter
     *
     * @param minLuminance
     *        Nominal minimum mastering display luminance in units of of 0.0001 candelas per square meter
     */

    public void setMinLuminance(Integer minLuminance) {
        this.minLuminance = minLuminance;
    }

    /**
     * Nominal minimum mastering display luminance in units of of 0.0001 candelas per square meter
     *
     * @return Nominal minimum mastering display luminance in units of of 0.0001 candelas per square meter
     */

    public Integer getMinLuminance() {
        return this.minLuminance;
    }

    /**
     * Nominal minimum mastering display luminance in units of of 0.0001 candelas per square meter
     *
     * @param minLuminance
     *        Nominal minimum mastering display luminance in units of of 0.0001 candelas per square meter
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withMinLuminance(Integer minLuminance) {
        setMinLuminance(minLuminance);
        return this;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param redPrimaryX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setRedPrimaryX(Integer redPrimaryX) {
        this.redPrimaryX = redPrimaryX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getRedPrimaryX() {
        return this.redPrimaryX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param redPrimaryX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withRedPrimaryX(Integer redPrimaryX) {
        setRedPrimaryX(redPrimaryX);
        return this;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param redPrimaryY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setRedPrimaryY(Integer redPrimaryY) {
        this.redPrimaryY = redPrimaryY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getRedPrimaryY() {
        return this.redPrimaryY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param redPrimaryY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withRedPrimaryY(Integer redPrimaryY) {
        setRedPrimaryY(redPrimaryY);
        return this;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param whitePointX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setWhitePointX(Integer whitePointX) {
        this.whitePointX = whitePointX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getWhitePointX() {
        return this.whitePointX;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param whitePointX
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withWhitePointX(Integer whitePointX) {
        setWhitePointX(whitePointX);
        return this;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param whitePointY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     */

    public void setWhitePointY(Integer whitePointY) {
        this.whitePointY = whitePointY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @return HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *         to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *         for color correction.
     */

    public Integer getWhitePointY() {
        return this.whitePointY;
    }

    /**
     * HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0 to
     * 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not for color
     * correction.
     *
     * @param whitePointY
     *        HDR Master Display Information must be provided by a color grader, using color grading tools. Range is 0
     *        to 50,000, each increment represents 0.00002 in CIE1931 color coordinate. Note that this setting is not
     *        for color correction.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Hdr10Metadata withWhitePointY(Integer whitePointY) {
        setWhitePointY(whitePointY);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getBluePrimaryX() != null)
            sb.append("BluePrimaryX: ").append(getBluePrimaryX()).append(",");
        if (getBluePrimaryY() != null)
            sb.append("BluePrimaryY: ").append(getBluePrimaryY()).append(",");
        if (getGreenPrimaryX() != null)
            sb.append("GreenPrimaryX: ").append(getGreenPrimaryX()).append(",");
        if (getGreenPrimaryY() != null)
            sb.append("GreenPrimaryY: ").append(getGreenPrimaryY()).append(",");
        if (getMaxContentLightLevel() != null)
            sb.append("MaxContentLightLevel: ").append(getMaxContentLightLevel()).append(",");
        if (getMaxFrameAverageLightLevel() != null)
            sb.append("MaxFrameAverageLightLevel: ").append(getMaxFrameAverageLightLevel()).append(",");
        if (getMaxLuminance() != null)
            sb.append("MaxLuminance: ").append(getMaxLuminance()).append(",");
        if (getMinLuminance() != null)
            sb.append("MinLuminance: ").append(getMinLuminance()).append(",");
        if (getRedPrimaryX() != null)
            sb.append("RedPrimaryX: ").append(getRedPrimaryX()).append(",");
        if (getRedPrimaryY() != null)
            sb.append("RedPrimaryY: ").append(getRedPrimaryY()).append(",");
        if (getWhitePointX() != null)
            sb.append("WhitePointX: ").append(getWhitePointX()).append(",");
        if (getWhitePointY() != null)
            sb.append("WhitePointY: ").append(getWhitePointY());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof Hdr10Metadata == false)
            return false;
        Hdr10Metadata other = (Hdr10Metadata) obj;
        if (other.getBluePrimaryX() == null ^ this.getBluePrimaryX() == null)
            return false;
        if (other.getBluePrimaryX() != null && other.getBluePrimaryX().equals(this.getBluePrimaryX()) == false)
            return false;
        if (other.getBluePrimaryY() == null ^ this.getBluePrimaryY() == null)
            return false;
        if (other.getBluePrimaryY() != null && other.getBluePrimaryY().equals(this.getBluePrimaryY()) == false)
            return false;
        if (other.getGreenPrimaryX() == null ^ this.getGreenPrimaryX() == null)
            return false;
        if (other.getGreenPrimaryX() != null && other.getGreenPrimaryX().equals(this.getGreenPrimaryX()) == false)
            return false;
        if (other.getGreenPrimaryY() == null ^ this.getGreenPrimaryY() == null)
            return false;
        if (other.getGreenPrimaryY() != null && other.getGreenPrimaryY().equals(this.getGreenPrimaryY()) == false)
            return false;
        if (other.getMaxContentLightLevel() == null ^ this.getMaxContentLightLevel() == null)
            return false;
        if (other.getMaxContentLightLevel() != null && other.getMaxContentLightLevel().equals(this.getMaxContentLightLevel()) == false)
            return false;
        if (other.getMaxFrameAverageLightLevel() == null ^ this.getMaxFrameAverageLightLevel() == null)
            return false;
        if (other.getMaxFrameAverageLightLevel() != null && other.getMaxFrameAverageLightLevel().equals(this.getMaxFrameAverageLightLevel()) == false)
            return false;
        if (other.getMaxLuminance() == null ^ this.getMaxLuminance() == null)
            return false;
        if (other.getMaxLuminance() != null && other.getMaxLuminance().equals(this.getMaxLuminance()) == false)
            return false;
        if (other.getMinLuminance() == null ^ this.getMinLuminance() == null)
            return false;
        if (other.getMinLuminance() != null && other.getMinLuminance().equals(this.getMinLuminance()) == false)
            return false;
        if (other.getRedPrimaryX() == null ^ this.getRedPrimaryX() == null)
            return false;
        if (other.getRedPrimaryX() != null && other.getRedPrimaryX().equals(this.getRedPrimaryX()) == false)
            return false;
        if (other.getRedPrimaryY() == null ^ this.getRedPrimaryY() == null)
            return false;
        if (other.getRedPrimaryY() != null && other.getRedPrimaryY().equals(this.getRedPrimaryY()) == false)
            return false;
        if (other.getWhitePointX() == null ^ this.getWhitePointX() == null)
            return false;
        if (other.getWhitePointX() != null && other.getWhitePointX().equals(this.getWhitePointX()) == false)
            return false;
        if (other.getWhitePointY() == null ^ this.getWhitePointY() == null)
            return false;
        if (other.getWhitePointY() != null && other.getWhitePointY().equals(this.getWhitePointY()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getBluePrimaryX() == null) ? 0 : getBluePrimaryX().hashCode());
        hashCode = prime * hashCode + ((getBluePrimaryY() == null) ? 0 : getBluePrimaryY().hashCode());
        hashCode = prime * hashCode + ((getGreenPrimaryX() == null) ? 0 : getGreenPrimaryX().hashCode());
        hashCode = prime * hashCode + ((getGreenPrimaryY() == null) ? 0 : getGreenPrimaryY().hashCode());
        hashCode = prime * hashCode + ((getMaxContentLightLevel() == null) ? 0 : getMaxContentLightLevel().hashCode());
        hashCode = prime * hashCode + ((getMaxFrameAverageLightLevel() == null) ? 0 : getMaxFrameAverageLightLevel().hashCode());
        hashCode = prime * hashCode + ((getMaxLuminance() == null) ? 0 : getMaxLuminance().hashCode());
        hashCode = prime * hashCode + ((getMinLuminance() == null) ? 0 : getMinLuminance().hashCode());
        hashCode = prime * hashCode + ((getRedPrimaryX() == null) ? 0 : getRedPrimaryX().hashCode());
        hashCode = prime * hashCode + ((getRedPrimaryY() == null) ? 0 : getRedPrimaryY().hashCode());
        hashCode = prime * hashCode + ((getWhitePointX() == null) ? 0 : getWhitePointX().hashCode());
        hashCode = prime * hashCode + ((getWhitePointY() == null) ? 0 : getWhitePointY().hashCode());
        return hashCode;
    }

    @Override
    public Hdr10Metadata clone() {
        try {
            return (Hdr10Metadata) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.mediaconvert.model.transform.Hdr10MetadataMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
Large scale linear learners
===========================

Code for scoring predictions from VW, Liblinear and StreamSVM on _webspam_.

	score.py - compute accuracy, AUC and confusion matrix for VW and Liblinear predictions
	score_streamsvm.py - the same thing for StreamSVM

See:
* [http://fastml.com/comparing-large-scale-linear-learners/](http://fastml.com/comparing-large-scale-linear-learners/)
* [https://www.indiegogo.com/projects/large-scale-linear-learners-compared](https://www.indiegogo.com/projects/large-scale-linear-learners-compared)
* [http://fastml.com/vowpal-wabbit-liblinear-sbm-and-streamsvm-compared/](http://fastml.com/vowpal-wabbit-liblinear-sbm-and-streamsvm-compared/)


text:
***********************
Configuring PushGP Runs
***********************

The primary abstraction for starting PushGP runs with PyshGP is to instantiate a
``PushEstimator`` and call the ``fit()`` method with a dataset of training cases. The
estimator can be configured to use different search algorithms, selection methods,
variation operators, and other hyperparameters. This guide demonstrates a variety
of different ways a ``PushEstimator`` could be configured to change the way
programs are synthesized in PyshGP.

At a minimum, a ``GeneSpawner`` must be provided when creating a ``PushEstimator``. The
spawner is used to generate random genomes during the initialization of an evolutionary
population and random genes during mutation operations. The genes might be produced by
the spawner are samples from a set of inputs, literals, ephemeral random constant
generators, and the ``InstructionSet``.

If only a ``GeneSpawner`` is provided, the hyperparameters of the ``PushEstimator``
will be the defaults listed in the API. See :ref:`api-gp`.

.. code-block:: python

  from pyshgp.gp.estimators import PushEstimator
  from pyshgp.gp.genome import GeneSpawner

  spawner = GeneSpawner(
      n_inputs=1,
      instruction_set="core",
      literals=[],
      erc_generators=[lambda: random.randint(0, 10)]
  )

  est = PushEstimator(spawner=spawner)
  est.fit(X, y)

The ``PushEstimator`` can be further configured with the top-level hyperparameters
that apply directly to the estimator. Examples include ``populaiton_size``,
``max_generations``, and ``initial_genome_size``. More information about these
hyperparameters can be found in the API. See :ref:`api-gp`.

.. code-block:: python

  from pyshgp.gp.estimators import PushEstimator

  est = PushEstimator(
      spawner=spawner,
      populaiton_size=1000,
      max_generations=300,
      initial_genome_size=(40, 200),
      simplification_steps=1000
  )
  est.fit(X, y)

Evolutionary Components
=======================

PyshGP aims to be extensive as much as possible. It is expected that users will want
to implement their own components (selection methods, variation operators, etc) and
use them in coordination with the abstractions provided by PyshGP. To accomplish this,
the ``PushEstimator`` accepts instances of various abstract base classes. Users can
choose to use instances of concrete sub-classes provided by PyshGP, or implement their own.

.. code-block:: python

  from pyshgp.gp.estimators import PushEstimator
  from pyshgp.gp.selection import Lexicase
  from pyshgp.gp.variation import VariationOperator

  class ReverseMutation(VariationOperator):
      """A mutation that reverses the parent genome."""

      def __init__(self):
          super().__init__(1)

      def produce(self, parents: Sequence[Genome], spawner: GeneSpawner) -> Genome:
          return Genome.create(parents[0][::-1])

  est = PushEstimator(
      spawner=spawner,
      selector=Lexicase(epsilon=True),      # This selector has its own configuration.
      variation_strategy=ReverseMutation(),
      population_size=300
  )

This design is in direct conflict with the sci-kit learn philosophy of designing estimators,
where hyperparameters are simple values and all of the configuration exists in the estimator.
In order to bring the ``PushEstimator`` back into towards a simpler (and narrower) API, most
the evolutionary components can be set with a string that corresponds to the name of a
reasonable "preset" value. For example, ``selector="lexicase"`` is the same as ``selector=Lexicase()``.

The following sections describe common ways of configuring the different components
of evolution.

Parent Selection
-----------------

Parent selection is controlled by an instance of a ``Selector`` type, and it's used to
select one or more individuals from evolutionary population. Different selectors apply
different "selection pressure" which guides evolution differently.

The preset selectors that can be referenced by name are:

- ``"roulette"`` : Fitness proportionate selection, also known as roulette wheel selection.
- ``"tournament"`` : Tournament selection. Default tournament size is 7.
- ``"lexicase"`` : Lexicase selection. Default ``epsilon=False``.
- ``"epsilon-lexicase"`` : Epsilon lexicase selection.
- ``"elite"`` : Selects the best ``n`` individuals by total error.

Variation Strategy
------------------

A variation operator is a transformation from parent genomes to a child genome. A
variation pipeline is a variation operator composed of other variation operators
that are applied in a sequence. A variation strategy is a variation operator that
composed of other variation operators that are each associated with a probability.

The preset variation operators that can be referenced by name are:

- ``"deletion"`` : Deletes random genes.
- ``"addition"`` : Adds random genes at random points.
- ``"alternation"`` : Pulls genes from a parent and randomly switches which parent it is pulling from.
- ``"genesis"`` : Creates entirely new random genomes.
- ``"cloning"`` : Returns the parent's genome unchanged.
- ``"umad"`` : Uniform mutation by addition and deletion.
- ``"umad-shrink"`` : Variant of UMAD that biases towards more deletion than addition.
- ``"umad-grow"`` : Variant of UMAD that biases towards more addition than deletion.

For a reference on UMAD, see `this paper <https://dl.acm.org/citation.cfm?id=3205455.3205603>`_.

When configuring a ``PushEstimator``, you can specify a variation strategy containing multiple
possible operators to apply with some probability. For example, the following configuration will
use ``Alternation`` 70% of the time and ``Genesis`` the other 30% of the time.

.. code-block:: python

  from pyshgp.gp.estimators import PushEstimator
  from pyshgp.gp.variation import VariationOperator, Alternation

  est = PushEstimator(
      spawner=spawner,
      variation_strategy=(
        VariationStrategy()
        .add(Alternation(alternation_rate=0.01, alignment_deviation=10), 0.7)
        .add(Genesis(size=(20, 100)), 0.3)
      )
  )

Search Algorithms
-----------------

Documentation TBD.


text:
'use strict'

let Example = require('./example');

module.exports = {
  Example: Example,
}


text:
pip3 install tornado --upgrade
pip3 install pbkdf2 --upgrade
pip3 install PyMySQL --upgrade
pip3 install sqlalchemy --upgrade
pip3 install python3-memcached --upgrade
pip3 install defusedxml --upgrade
pip3 install netaddr --upgrade
pip3 install nose --upgrade
pip3 install future --upgrade


text:
module Finch
  class Error < StandardError

    class Client     < Error; end
    class Server     < Error; end
    class Unexpected < Error; end

    RESPONSE_CODES = {
      400 => 'Bad Request',
      401 => 'Unauthorized',
      403 => 'Forbidden',
      404 => 'Not Found',
      406 => 'Not Acceptable',
      422 => 'Unprocessable Entity',
      429 => 'Too Many Requests',
      500 => 'Internal Server Error',
      502 => 'Bad Gateway',
      503 => 'Service Unavailable',
      504 => 'Gateway Timeout'
    }

    REV_CODES = RESPONSE_CODES.inject({}) { |h,(k,v)| h[ v.gsub(/\s+/, '') ] = k; h }

    RESPONSE_CODES.each do |status, msg|
      base = if 400 <= status && status < 500
        Client
      elsif 500 <= status && status < 600
        Server
      else
        Error
      end
      Finch::Error.const_set(msg.gsub(/\s+/, ''), Class.new(base))
    end

    class AuthenticationError < Client; end

    class ParseError < StandardError
      attr_accessor :original_error
      attr_accessor :original_data
    end

    def initialize(headers={})
      @status = self.class.name.match(/::([^:]+)$/)[1]
      @text   = RESPONSE_CODES[ @status ]

      super "#{@text} (#{@status})"

      @headers = headers
    end

    def headers
      @headers
    end

    def self.[] status
      name = RESPONSE_CODES[status].gsub(/\s+/, '') || 'Unexpected'
      klass = "Finch::Error::#{name}".constantize rescue Finch::Error::Unexpected
      return klass
    end
  end

end


text:
<resources>

    <string name="app_name">MyTweetExample</string>
    <string name="hello_world">Hello world!</string>
    <string name="menu_settings">Settings</string>
    <string name="title_activity_vertweets">Ver Tweets</string>
    <string name="conectar">Conectar</string>

</resources>


text:
package ca.waterloo.dsg.graphflow.query.result;

import ca.waterloo.dsg.graphflow.util.json.JsonKeyConstants;
import ca.waterloo.dsg.graphflow.util.json.JsonOutputable;
import com.google.gson.JsonObject;

/**
 * Abstract class used to represent the output from all queries.
 */
public abstract class AbstractQueryResult implements JsonOutputable {

    public enum ResultType {
        MESSAGE,
        SUBGRAPHS,
        TUPLES,
        EXPLAIN_PLAN
    }

    private Double executionTimeInMillis;

    /**
     * Sets the total execution time for inclusion in the {@link String} or {@code JSON} output.
     *
     * @param executionTimeInMillis The execution time in milliseconds.
     */
    public void setExecutionTimeInMillis(double executionTimeInMillis) {
        this.executionTimeInMillis = executionTimeInMillis;
    }

    /**
     * @return the execution time of the query in a {@code String}.
     */
    String getExecutionTimeString() {
        if (null != executionTimeInMillis) {
            return String.format("\n\nQuery executed in %.3f ms.", executionTimeInMillis);
        }
        return "";
    }

    /**
     * @param jsonObject the json object to which the execution time key value
     */
    void addExecutionTimeToJson(JsonObject jsonObject) {
        if (null != executionTimeInMillis) {
            jsonObject.addProperty(JsonKeyConstants.EXECUTION_TIME.toString(),
                executionTimeInMillis);
        }
    }

    @Override
    public JsonObject toJson() {
        return null;
    }

    public String toString() {
        throw new UnsupportedOperationException(this.getClass().getSimpleName() + " does not " +
            "support the toString() method.");
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/cropper_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusableInTouchMode="true"
    android:gravity="center"
    android:orientation="vertical" >

    <opensource.component.cropper.CropImageView
        xmlns:custom="http://schemas.android.com/apk/res-auto"
        android:id="@+id/crop_imageview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>


text:
#region Foreign-License
//	LumenWorks.Framework.IO.CSV.ValueTrimmingOptions
//	Copyright (c) 2006 Sébastien Lorion
//
//	MIT license (http://en.wikipedia.org/wiki/MIT_License)
//
//	Permission is hereby granted, free of charge, to any person obtaining a copy
//	of this software and associated documentation files (the "Software"), to deal
//	in the Software without restriction, including without limitation the rights
//	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
//	of the Software, and to permit persons to whom the Software is furnished to do so,
//	subject to the following conditions:
//
//	The above copyright notice and this permission notice shall be included in all
//	copies or substantial portions of the Software.
//
//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
//	INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
//	PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
//	FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
//	ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Modified: Sky Morey <moreys@digitalev.com>
//
#endregion
using System;
namespace Contoso.IO.Text
{
    /// <summary>
    /// CsvValueTrimmings
    /// </summary>
	[Flags]
	public enum CsvValueTrimmings
	{
        /// <summary>
        /// None
        /// </summary>
		None = 0,
        /// <summary>
        /// UnquotedOnly
        /// </summary>
		UnquotedOnly = 1,
        /// <summary>
        /// QuotedOnly
        /// </summary>
		QuotedOnly = 2,
        /// <summary>
        /// All
        /// </summary>
		All = UnquotedOnly | QuotedOnly
	}
}


text:
Sida för diskussioner

Detta är en sida där du kan diskutera valfritt ämne.


text:
(function ( global ) {

'use strict';

var simulant;

var defaults = {
	bubbles:       true,
	cancelable:    true,
	view:          global,
	detail:        null,
	screenX:       0,
	screenY:       0,
	clientX:       0,
	clientY:       0,
	ctrlKey:       false,
	altKey:        false,
	shiftKey:      false,
	metaKey:       false,
	button:        0,
	relatedTarget: null,
	locale:        '',
	oldURL:        '',
	newURL:        '',
	origin:        '',
	lastEventId:   '',
	source:        null,
	ports:         [],
	oldValue:      null,
	newValue:      null,
	url:           '',
	storageArea:   null,
	deltaX:        0,
	deltaY:        0,
	deltaZ:        0,
	deltaMode:     0
};

// TODO remove the ones that aren't supported in any browser
var eventTypesByGroup = {
	UIEvent:                     'abort error resize scroll select unload',
	Event:                       'afterprint beforeprint cached canplay canplaythrough change chargingchange chargingtimechange checking close dischargingtimechange DOMContentLoaded downloading durationchange emptied ended fullscreenchange fullscreenerror input invalid levelchange loadeddata loadedmetadata noupdate obsolete offline online open orientationchange pause pointerlockchange pointerlockerror play playing ratechange readystatechange reset seeked seeking stalled submit success suspend timeupdate updateready visibilitychange volumechange waiting',
	AnimationEvent:              'animationend animationiteration animationstart',
	AudioProcessingEvent:        'audioprocess',
	BeforeUnloadEvent:           'beforeunload',
	TimeEvent:                   'beginEvent endEvent repeatEvent',
	FocusEvent:                  'blur focus focusin focusout',
	MouseEvent:                  'click contextmenu dblclick mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup show touchcancel touchend touchenter touchleave touchmove touchstart',
	SensorEvent:                 'compassneedscalibration userproximity',
	OfflineAudioCompletionEvent: 'complete',
	CompositionEvent:            'compositionend compositionstart compositionupdate',
	ClipboardEvent:              'copy cut paste',
	DeviceLightEvent:            'devicelight',
	DeviceMotionEvent:           'devicemotion',
	DeviceOrientationEvent:      'deviceorientation',
	DeviceProximityEvent:        'deviceproximity',
	DragEvent:                   'drag dragend dragenter dragleave dragover dragstart drop',
	GamepadEvent:                'gamepadconnected gamepaddisconnected',
	HashChangeEvent:             'hashchange',
	KeyboardEvent:               'keydown keypress keyup',
	ProgressEvent:               'loadend loadstart progress timeout',
	MessageEvent:                'message',
	PageTransitionEvent:         'pagehide pageshow',
	PopStateEvent:               'popstate',
	StorageEvent:                'storage',
	SVGEvent:                    'SVGAbort SVGError SVGLoad SVGResize SVGScroll SVGUnload',
	SVGZoomEvent:                'SVGZoom',
	TouchEvent:                  '',
	TransitionEvent:             'transitionend',
	WheelEvent:                  'wheel'
};

// The parameters required by event constructors and init methods, in the order the init methods need them.

// There is no initKeyboardEvent or initKeyEvent here. Keyboard events are a goddamned mess. You can't fake them
// well in any browser - the which and keyCode properties are readonly, for example. So we don't actually use the
// KeyboardEvent constructor, or the initKeyboardEvent or initKeyEvent methods. Instead we use a bog standard
// Event and add the required parameters as expando properties.

// TODO I think in some browsers we need to use modifiersList instead of ctrlKey/shiftKey etc?
var initialiserParams = {
	initUIEvent:          'view detail',
	initMouseEvent:       'view detail screenX screenY clientX clientY ctrlKey altKey shiftKey metaKey button relatedTarget',
	initCompositionEvent: 'view detail data locale',
	initHashChangeEvent:  'oldURL newURL',
	initMessageEvent:     'data origin lastEventId source ports',
	initStorageEvent:     'key oldValue newValue url storageArea',
	initWheelEvent:       'view detail screenX screenY clientX clientY ctrlKey altKey shiftKey metaKey button relatedTarget deltaX deltaY deltaZ deltaMode'
};
var initialisersByGroup = {
	UIEvent:             [ global.UIEvent,             'initUIEvent'          ],
	Event:               [ global.Event,               'initEvent'            ],
	FocusEvent:          [ global.FocusEvent,          'initUIEvent'          ],
	MouseEvent:          [ global.MouseEvent,          'initMouseEvent'       ],
	CompositionEvent:    [ global.CompositionEvent,    'initCompositionEvent' ],
	HashChangeEvent:     [ global.HashChangeEvent,     'initHashChangeEvent'  ],
	KeyboardEvent:       [ global.Event,               'initEvent'            ],
	ProgressEvent:       [ global.ProgressEvent,       'initEvent'            ],
	MessageEvent:        [ global.MessageEvent,        'initMessageEvent'     ], // TODO prefixed?
	PageTransitionEvent: [ global.PageTransitionEvent, 'initEvent'            ],
	PopStateEvent:       [ global.PopStateEvent,       'initEvent'            ],
	StorageEvent:        [ global.StorageEvent,        'initStorageEvent'     ],
	TouchEvent:          [ global.TouchEvent,          'initTouchEvent'       ],
	WheelEvent:          [ global.WheelEvent,          'initWheelEvent'       ] // TODO this differs between browsers...
};

var useAncient = function () {
	// create initialisers
	(function () {
		var methodName, makeInitialiser;

		initialisers = {};

		makeInitialiser = function ( methodName, paramsList ) {
			return function ( event, type, params ) {
				var paramName, i;

				event.type = type;

				i = paramsList.length;
				while ( i-- ) {
					paramName = paramsList[i];
					event[ paramName ] = params[ paramName ] || defaults[ paramName ];
				}
			};
		};

		for ( methodName in initialiserParams ) {
			if ( initialiserParams.hasOwnProperty( methodName ) ) {
				initialisers[ methodName ] = makeInitialiser( methodName, initialiserParams[ methodName ] );
			}
		}

		initialisers.initEvent = makeInitialiser( 'initEvent', [] );
	}());

	simulant = function ( type, params ) {
		var event, group, initialiserName, initialise, isKeyboardEvent;

		group = eventGroupByType[ type ];

		if ( group === 'KeyboardEvent' ) {
			isKeyboardEvent = true;
			group = 'Event';
		}

		initialiserName = initialisersByGroup[ group ][1];
		initialise = initialisers[ initialiserName ];

		event = document.createEventObject();
		initialise( event, type, params || {} );

		if ( isKeyboardEvent ) {
			extendWithKeyboardParams( event, params );
		}

		return event;
	};

	simulant.mode = 'ancient';
};

var useLegacy = function () {
	// create initialisers
	(function () {
		var methodName, makeInitialiser;

		initialisers = {};

		makeInitialiser = function ( methodName, paramsList ) {
			return function ( event, type, params ) {
				var args, paramName, i, len;

				// first two args are always bubbles, cancelable
				args = [ true, true ]; // TODO some events don't bubble?

				len = paramsList.length;
				for ( i=0; i<len; i+=1 ) {
					paramName = paramsList[i];
					args[ args.length ] = params[ paramName ] || defaults[ paramName ];
				}

				args.unshift( type );

				event[ methodName ].apply( event, args );
			};
		};

		for ( methodName in initialiserParams ) {
			if ( initialiserParams.hasOwnProperty( methodName ) ) {
				initialisers[ methodName ] = makeInitialiser( methodName, initialiserParams[ methodName ] );
			}
		}

		initialisers.initEvent = makeInitialiser( 'initEvent', [] );
	}());

	simulant = function ( type, params ) {
		var event, group, initialiserName, initialise, isKeyboardEvent;

		group = eventGroupByType[ type ];

		if ( group === 'KeyboardEvent' ) {
			isKeyboardEvent = true;
			group = 'Event';
		}

		initialiserName = initialisersByGroup[ group ][1];
		initialise = initialisers[ initialiserName ];

		event = document.createEvent( group );
		initialise( event, type, params || {} );

		if ( isKeyboardEvent ) {
			extendWithKeyboardParams( event, params );
		}

		return event;
	};

	simulant.mode = 'legacy';
};

var useModern = function () {
	simulant = function ( type, params ) {
		var event, group, Constructor, paramsList, paramName, i, extendedParams, isKeyboardEvent;

		group = eventGroupByType[ type ];

		if ( group === 'KeyboardEvent' ) {
			group = 'Event'; // because you can't fake KeyboardEvents well in any browser
			isKeyboardEvent = true;
		}

		Constructor = initialisersByGroup[ group ][0];

		if ( !params ) {
			params = {};
		}

		extendedParams = {
			bubbles: true, // TODO some events don't bubble?
			cancelable: true
		};

		paramsList = initialiserParams[ initialisersByGroup[ group ][1] ];
		i = ( paramsList ? paramsList.length : 0 );

		while ( i-- ) {
			paramName = paramsList[i];
			extendedParams[ paramName ] = ( params[ paramName ] !== undefined ? params[ paramName ] : defaults[ paramName ] );
		}

		event = new Constructor( type, extendedParams );

		if ( isKeyboardEvent ) {
			extendWithKeyboardParams( event, params );
		}

		return event;
	};

	simulant.mode = 'modern';
};

var keyboardParams = [ 'which', 'keyCode', 'shiftKey', 'ctrlKey', 'altKey', 'metaKey' ];

var extendWithKeyboardParams = function ( event, params ) {
	var i = keyboardParams.length;
	while ( i-- ) {
		event[ keyboardParams[i] ] = params[ keyboardParams[i] ];
	}
};

var eventGroupByType,
	initialisers,
	modern,
	ancient,
	modifiers,
	getModifiersList;

modifiers = [
	[ 'ctrlKey',  'Control' ],
	[ 'shiftKey', 'Shift'   ],
	[ 'altKey',   'Alt'     ],
	[ 'metaKey',  'Meta'    ]
];

getModifiersList = function ( params ) {
	var list = [], i, modifier;

	i = modifiers.length;
	while ( i-- ) {
		modifier = modifiers[i];
		if ( params[ modifier[0] ] ) {
			list[ list.length ] = modifier[1];
		}
	}

	return list.join( ' ' );
};

// unpack event groups
(function () {
	var group, types, i, initMethod;

	eventGroupByType = {};

	for ( group in eventTypesByGroup ) {
		if ( eventTypesByGroup.hasOwnProperty( group ) ) {
			types = eventTypesByGroup[ group ].split( ' ' );

			i = types.length;
			while ( i-- ) {
				eventGroupByType[ types[i] ] = group;
			}
		}
	}

	for ( initMethod in initialiserParams ) {
		if ( initialiserParams.hasOwnProperty( initMethod ) ) {
			initialiserParams[ initMethod ] = initialiserParams[ initMethod ].split( ' ' );
		}
	}
}());

try {
	// event initialisersByGroup
	new MouseEvent( 'click' );
	modern = true;
}

catch ( err ) {
	if ( !document.createEvent ) {
		if ( document.createEventObject ) {
			ancient = true;
		} else {
			throw new Error( 'Events cannot be created in this browser' );
		}
	}
}

if ( modern ) {
	useModern();
}

else if ( !ancient ) {
	useLegacy();
}

else {
	useAncient();
}

simulant.params = function ( type ) {
	var group;

	group = eventGroupByType[ type ];
	return initialiserParams[ initialisersByGroup[ group ][1] ].split( ' ' );
};

if ( document.dispatchEvent ) {
	simulant.fire = function ( node, event, params ) {
		if ( typeof event === 'string' ) {
			event = simulant( event, params );
		}

		node.dispatchEvent( event );
	};
} else if ( document.fireEvent ) {
	simulant.fire = function ( node, event, params ) {
		if ( typeof event === 'string' ) {
			event = simulant( event, params );
		}

		node.fireEvent( 'on' + event.type, event );

		// Special case - checkbox inputs
		if ( node.tagName === 'INPUT' && node.type === 'checkbox' ) {
			node.click();
		}
	};
}

simulant.polyfill = function () {

	// https://gist.github.com/Rich-Harris/6010282 via https://gist.github.com/jonathantneal/2869388
	// addEventListener polyfill IE6+
	var Event, addEventListener, removeEventListener, head, style;

	Event = function ( e, element ) {
		var property, instance = this;

		for ( property in e ) {
			instance[ property ] = e[ property ];
		}

		instance.currentTarget =  element;
		instance.target = e.srcElement || element;
		instance.timeStamp = +new Date();

		instance.preventDefault = function () {
			e.returnValue = false;
		};

		instance.stopPropagation = function () {
			e.cancelBubble = true;
		};
	};

	addEventListener = function ( type, listener ) {
		var element = this, listeners, i;

		listeners = element.listeners || ( element.listeners = [] );
		i = listeners.length;

		listeners[i] = [ listener, function (e) {
			listener.call( element, new Event( e, element ) );
		}];

		element.attachEvent( 'on' + type, listeners[i][1] );
	};

	removeEventListener = function ( type, listener ) {
		var element = this, listeners, i;

		if ( !element.listeners ) {
			return;
		}

		listeners = element.listeners;
		i = listeners.length;

		while ( i-- ) {
			if ( listeners[i][0] === listener ) {
				element.detachEvent( 'on' + type, listeners[i][1] );
			}
		}
	};

	global.addEventListener = document.addEventListener = addEventListener;
	global.removeEventListener = document.removeEventListener = removeEventListener;

	if ( 'Element' in global ) {
		Element.prototype.addEventListener = addEventListener;
		Element.prototype.removeEventListener = removeEventListener;
	} else {
		head = document.getElementsByTagName('head')[0];
		style = document.createElement('style');

		head.insertBefore( style, head.firstChild );

		style.styleSheet.cssText = '*{-ms-event-prototype:expression(!this.addEventListener&&(this.addEventListener=addEventListener)&&(this.removeEventListener=removeEventListener))}';
	}

	addEventListener.simulant = true;

};
// export as AMD module
if ( typeof define === "function" && define.amd ) {
	define( function () {
		return simulant;
	});
}

// ... or as CommonJS module
else if ( typeof module !== 'undefined' && module.exports ) {
	module.exports = simulant;
}

// ... or as browser global
else {
	global.simulant = simulant;
}

}( typeof window !== 'undefined' ? window : this ));


text:
package com.revo.deployr.rbroker.example.data.io.auth.pooled.task;

import com.revo.deployr.client.*;
import com.revo.deployr.client.auth.*;
import com.revo.deployr.client.auth.basic.*;
import com.revo.deployr.client.data.*;
import com.revo.deployr.client.factory.*;
import com.revo.deployr.client.params.*;
import com.revo.deployr.client.broker.*;
import com.revo.deployr.client.broker.config.*;
import com.revo.deployr.client.broker.task.*;
import com.revo.deployr.client.broker.options.*;
import com.revo.deployr.rbroker.example.util.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import org.apache.commons.io.IOUtils;

import org.apache.log4j.Logger;

public class RepoFileInRepoFileOut
                implements RTaskListener, RBrokerListener {

    private static Logger log =
        Logger.getLogger(RepoFileInRepoFileOut.class);
    private static CountDownLatch latch = new CountDownLatch(1);

    /*
     * Hipparcos star dataset URL endpoint.
     */
    private static String HIP_DAT_URL =
        "http://astrostatistics.psu.edu/datasets/HIP_star.dat";

    private RBroker rBroker = null;

    public static void main(String args[]) throws Exception {

        new RepoFileInRepoFileOut();
    }

    public RepoFileInRepoFileOut() {

        try {

            /*
             * Determine DeployR server endpoint.
             */
            String endpoint = System.getProperty("endpoint");
            log.info("[ CONFIGURATION  ] Using endpoint [ " +
                                        endpoint + " ]");

            /*
             * Build configuration to initialize RBroker instance.
             */
            RAuthentication rAuth = new RBasicAuthentication(
                                        System.getProperty("username"),
                                        System.getProperty("password"));
            PooledBrokerConfig brokerConfig =
                new PooledBrokerConfig(endpoint, rAuth,
                    Integer.getInteger("example-max-concurrency"));

            log.info("[ CONFIGURATION  ] Using broker config " +
                                    "[ PooledBrokerConfig ]");

            /*
             * Establish RBroker connection to DeployR server.
             */
            rBroker =
                RBrokerFactory.pooledTaskBroker(brokerConfig);

            /*
             * Register asynchronous listeners for task and
             * broker runtime events.
             */
            rBroker.addTaskListener(this);
            rBroker.addBrokerListener(this);

            log.info("[   CONNECTION   ] Established authenticated " +
                    "pooled broker [ RBroker ].");

            /*
             * Create the PooledTaskOptions object·
             * to specify data inputs and output to the task.
             *
             * This options object can be used to pass standard
             * execution model parameters on execution calls. All
             * fields are optional.
             *
             * See the Standard Execution Model chapter in the
             * Client Library Tutorial on the DeployR website for
             * further details.
             */
            PooledTaskOptions options =
                                    new PooledTaskOptions();

            /*
             * Preload from the DeployR repository the following
             * data input file:
             * /testuser/example-data-io/hipStar.dat
             */
            TaskPreloadOptions preloadWorkspace =
                                new TaskPreloadOptions();
            preloadWorkspace.filename = "hipStar.rData";
            preloadWorkspace.directory = "example-data-io";
            preloadWorkspace.author = "testuser";
            options.preloadWorkspace = preloadWorkspace;

            log.info("[   TASK INPUT   ] Repository binary file input " +
                "set on task, [ PooledTaskOptions.preloadWorkspace ].");

            /*
             * Request repository storage of hip.csv file generated
             * by the dataIO.R script on task execution.
             *
             * Note, you can also use storageOptions.objects
             * to store individual objects from the workspace.
             */
            TaskStorageOptions storageOptions =
                                new TaskStorageOptions();
            storageOptions.files = "hip.csv";
            storageOptions.directory = "example-data-io";
            options.storageOptions = storageOptions;

            log.info("[  TASK OPTION   ] Repository storage request " +
                "set on task [ PooledTaskOptions.storageOptions ].");

            /*
             * Declare task for execution on broker based on
             * repository-managed R script:
             * /testuser/example-data-io/dataIO.R
             */
            RTask rTask = RTaskFactory.pooledTask("dataIO.R",
                                                    "example-data-io",
                                                    "testuser",
                                                    null, options);

            rBroker.submit(rTask);

            log.info("[   EXECUTION    ] Pooled task " +
                    "submitted to broker [ RTask ].");

            /*
             * Simple block on main thread of this sample application
             * until example RTask execution completes.
             */
            latch.await();

        } catch(Exception ex) {
            log.warn("Unexpected error: ex=" + ex);
        } finally {
            /*
             * Clean-up after example completes.
             */
            if(rBroker != null) {
                try{
                    rBroker.shutdown();
                } catch(Exception bex) {
                    log.warn("RBroker.shutdown ex=" + bex);
                }
            }
        }

    }

    /*
     * RBroker asynchronous callback listener on RTask completion.
     */
    public void onTaskCompleted(RTask rTask, RTaskResult rTaskResult) {

        if(rTaskResult.isSuccess()) {

            log.info("[  TASK RESULT   ] Pooled task " +
                        "completed in " + rTaskResult.getTimeOnCall() +
                        "ms [ RTaskResult ].");

            /*
             * Retrieve stored repository-managed file.
             */

            /*
             * Retrieve stored repository-managed file.
             */
            List<URL> repoFiles = rTaskResult.getStoredFiles();
            DeployRUtil.retrieveFileUrls(repoFiles,
                                        "repository file",
                                        null,
                                        log);

            /*
             * Clean up after example completes.
             */
            DeployRUtil.cleanUpAfterRepoStore(rBroker.owner(),
                                              "hip.csv",
                                              "example-data-io",
                                              "testuser", log);

        } else {
            log.info("[  TASK RESULT   ] Pooled task " +
                    "failed, cause " + rTaskResult.getFailure());
        }

        /*
         * Unblock main thread so example application can release
         * resources before exit.
         */
        latch.countDown();
    }

    /*
     * RBroker asynchronous callback listener on RTask error.
     */
    public void onTaskError(RTask rTask, Throwable throwable) {
        log.info("onTaskError: rTask=" + rTask +
                                ", error=" + throwable);
        /*
         * Unblock main thread so example application can release
         * resources before exit.
         */
        latch.countDown();
    }

    public void onRuntimeError(Throwable throwable) {
        log.info("onRuntimeError: cause=" + throwable);
        /*
         * Unblock main thread so example application can release
         * resources before exit.
         */
        latch.countDown();
    }

    public void onRuntimeStats(RBrokerRuntimeStats stats,
                                        int maxConcurrency) {
        /*
         * Log/profile runtime RBroker stats as desired...
         */
    }

}


text:
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import importlib

from django.conf.urls import include, url
from django.views.generic import TemplateView
from future import standard_library

from cartoview.app_manager.rest import (AppInstanceResource, AppResource,
                                        AppStoreResource,
                                        GeonodeMapLayerResource, TagResource)
from cartoview.apps_handler.config import CartoviewApp
from . import views as app_manager_views
from .api import rest_api

standard_library.install_aliases()
rest_api.register(AppResource())
rest_api.register(AppStoreResource())
rest_api.register(AppInstanceResource())
rest_api.register(GeonodeMapLayerResource())
rest_api.register(TagResource())

urlpatterns = [
    url(r'^$', app_manager_views.index, name='app_manager_base_url'),
    url(r'^manage/$', app_manager_views.manage_apps, name='manage_apps'),
    url(r'^install/(?P<store_id>\d+)/(?P<app_name>.*)/(?P<version>.*)/$',
        app_manager_views.install_app,
        name='install_app'),
    url(r'^uninstall/(?P<store_id>\d+)/(?P<app_name>.*)/$',
        app_manager_views.uninstall_app,
        name='cartoview_uninstall_app_url'),
    url(r'^appinstances/$',
        TemplateView.as_view(
            template_name='app_manager/app_instance_list.html'),
        name='appinstance_browse'),
    url(r'^appinstance/(?P<appinstanceid>\d+)/?$',
        app_manager_views.appinstance_detail,
        name='appinstance_detail'),
    url(r'^appinstance/(?P<appinstanceid>\d+)/metadata$',
        app_manager_views.appinstance_metadata,
        name='appinstance_metadata'),
    url(r'^moveup/(?P<app_id>\d+)/$',
        app_manager_views.move_up,
        name='move_up'),
    url(r'^movedown/(?P<app_id>\d+)/$',
        app_manager_views.move_down,
        name='move_down'),
    url(r'^save_app_orders/$',
        app_manager_views.save_app_orders,
        name='save_app_orders'),
    url(r'^(?P<appinstanceid>\d+)/remove$',
        app_manager_views.appinstance_remove,
        name="appinstance_remove"),
    url(r'^rest/', include(rest_api.urls)),
]

def import_app_rest(app_name):
    try:
        # print 'define %s rest api ....' % app_name
        # module_ = importlib.import_module('%s.rest' % app_name)
        importlib.import_module('%s.rest' % app_name)
    except ImportError:
        pass

def app_url(app_name):
    app = str(app_name)
    return url(
        r'^' + app + '/', include('%s.urls' % app), name=app + '_base_url')

def load_apps_urls():
    app_names = CartoviewApp.objects.get_active_apps().keys()
    for app_name in app_names:
        import_app_rest(app_name)
        urlpatterns.append(app_url(app_name))

load_apps_urls()


text:
<?php
declare(strict_types = 1);

namespace FormManager;

/**
 * Interface representing a basic node element
 */
interface NodeInterface
{
    public function getParentNode(): ?NodeInterface;

    public function setParentNode(NodeInterface $parentNode): NodeInterface;

    public function __toString();
}


text:
%% DC Consensus algorithm
% Simple consensus algorithm for distributed solving of DC network

% Add paths
addpath('../formulation/');
addpath('../misc');
addpath('../wind');

%% Load models

% load network model
dc = DC_model('case14');
dc.set_WPG_bus(9);

% load wind model
N_t = 24;           % number of timesteps
penetration = 0.2;  % wind power penetration
all_winds = wind_model(dc, N_t, penetration);

%% Generate scenarios
epsilon = 5e-2;                         % violation parameter
zeta = 5*dc.N_G;                        % Helly-dimsension
beta = 1e-5;                            % confidence parameter

% determine number of scenarios to generate based on Eq (2-4)
N = ceil(2/epsilon*(zeta-1+log(1/beta)));
N = 20;
all_winds.generate(N);

t = 8;              % loop through control horizon later

% generate wind and
% N = 40;
% all_winds.dummy(N);

%% Initialize agents
SPA = 2;                   % number of scenarios per agent
N_a = ceil(N/SPA);

prg = progress(sprintf('Initializing agents'), N_a);
agents = cell(N_a,1);

agent_wind = struct('P_wf', all_winds.P_wf,...
                    'P_w', zeros(N_t, SPA),...
                    'P_m', zeros(N_t, SPA));

for i = 1:N_a-1

    agent_wind.P_w = all_winds.P_w(:, SPA*(i-1)+1:SPA*i);
    agent_wind.P_m = agent_wind.P_w - agent_wind.P_wf*ones(1,SPA);

    agents{i} = DC_agent(dc, agent_wind, t);
    prg.ping();
end

% last one, until the end
agent_wind.P_w = all_winds.P_w(:, SPA*i+1:end);
agent_wind.P_m = agent_wind.P_w - agent_wind.P_wf*ones(1,size(agent_wind.P_w,2));
agents{i+1} = DC_agent(dc, agent_wind, t);
prg.ping();

%% Update agents
k = 1;

% initialize global variables
Z = zeros(5*dc.N_G, 1);

% initialize array of local variables
X = zeros(5*dc.N_G, N_a);

% stopping criterion: if local and global solution are close for all
% agents, stop the algorithm
eps = 1e-1;
max_iter = 50;

while 1
    prg = progress(sprintf('Iteration %3i', k), N_a);

    % average results to get global variable (i.e. all equal weight 1/N)
    Z = mean(X, 2);

    % for the first iteration, don't take consensus into account
    if k == 1
        c = 1e99;
    else
        c = 2/(2*(k+1)^2);
    end

    all_agents_agree = 1;

    % loop over agents
    for i = 1:N_a

        % check if agents previous local and global solution agree
        if k > 1
            disagreement = norm(X(:, i) - Z);
            if disagreement > eps
                all_agents_agree = 0;
            end
        else
            % due to initialization, all agents will 'agree' in the first
            % iteration, this is a workaround
            all_agents_agree = 0;
        end

        % update agents local estimate
        X(:, i) = agents{i}.update(Z, c);

        % output progress
        prg.ping();
    end

    if all_agents_agree || k >= max_iter
        break
    end

    k = k + 1;
end
fprintf('\r');
%% Calculate central solution
prg = progress('Calculating central solution', 1);
central = DC_agent(dc, all_winds, t);
central.update(Z, 1e99);
prg.ping();

%% save
save('results/DC_scenarios_case30.mat', 'agents', 'central');


text:
Userland Vita Loader 1.1.0
===============================================================================

## What's new?

### Version 1.1.0

* Added Unity PSM cleanup code (thanks Netrix)

### Version 1.0.1

* Added support for multiple loads (stacked homebrew loading)

### Version 1.0.0

* Relocatable ELF (ET_SCE_RELEXEC) support
* ARM relocation resolving
* SceLibKernel NID cache database (for NID poison bypass)
* Library reloading (another NID antidote technique)
* UVL custom exports (code alloc, icache flush, logging via USB)

### Version 0.1.0

* Initial release

## What is this?

In short, this is a loader that allows running homebrew games on the Vita using
save-file exploits or similar methods where there is no access to the system
loader functions (which are found in the kernel). UVL does this by hooking on
to functions and API calls imported by the running game and passing them to
the homebrew being loader. This is **not** a way to run backups or pirated
games as that is not only wrong to do, but also because UVL does not and can
not decrypt content nor can it do dynamic linking or other sophisticated things
that the system loader does.

## How do I run it?

UVL is designed to work with any userland exploit with little configuration.
However, you should check with the developer of the exploit who ported UVL
to see how to use it. UVL cannot do anything by itself, it is simply a
payload that is executed by an exploit to run homebrews unmodified.

## How can I call UVL API functions from my homebrew?

Import uvloader.h into your project and you'll have access to the exported
functions.

## How do I port UVL?

If you have an exploit for the Vita (not the PSP emulator as UVL does not work
on that), then you should be able to port the exploit by finding a couple of
memory addresses for some API calls and passing them to the config file.
More information will be available when the time comes...

## How do I compile UVL?

First of all, be aware that it is impossible to use UVL without an exploit,
but once you have that and need a payload, all you need to do is modify
the Makefile to point to your ARM toolchain and run "make". The toolchain
that is tested with is <https://launchpad.net/gcc-arm-embedded/+download>.

## Who's responsible for this?

This project is based heavily off of
[Half Byte Loader](http://valentine-hbl.googlecode.com/) for the PSP.
Some code is ripped from the
[Bionic](https://github.com/android/platform_bionic/) libc project.
The project is started by [Yifan Lu](http://yifan.lu/) with thanks to
the following people for their contribution. (Apologies for those
forgotten.)

### Thanks To

* Davee for many ideas and help
* Proxima for module reloading NID antidote method
* naehrwert for some code snippets and programming help
* roxfan for finding structures
* Netrix for Unity cleanup code
* anyone in #vitadev who answered my stupid questions


text:
package mil.emp3.worldwind.utils;

import mil.emp3.mapengine.interfaces.IMapEngineProperties;

public class MapEngineProperties implements IMapEngineProperties {
    @Override
    public String getName() {
        return "NASA Worldwind Map Engine";
    }

    @Override
    public String getVersion() {
        return "0.2.5";
    }

    @Override
    public String getHelp() {
        return "";
    }
}


text:
package org.hillview.targets;

import org.hillview.*;
import org.hillview.dataset.api.ControlMessage;
import org.hillview.dataset.api.IDataSet;
import org.hillview.sketches.LoadCsvColumnsSketch;
import org.hillview.storage.jdbc.JdbcDatabase;
import org.hillview.table.Schema;
import org.hillview.table.api.ITable;
import org.hillview.utils.Converters;

import javax.annotation.Nullable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

/**
 * This class interfaces with a Greenplum database.  It is very much like a TableTarget, except
 * that for each operation is checks to see first whether the columns that will be operated on
 * have been loaded, and if not loads them explicitly.
 */
public class GreenplumTarget extends TableTarget {
    JdbcDatabase database;

    protected HashSet<String> columnsLoaded;
    protected String tmpTableName;
    protected final Schema schema;

    public GreenplumTarget(IDataSet<ITable> table, HillviewComputation c,
                           @Nullable String metadataDir,
                           String tmpTableName, JdbcDatabase db, Schema schema) {
        super(table, c, metadataDir);
        this.database = db;
        this.schema = schema;
        this.columnsLoaded = new HashSet<String>();
        this.tmpTableName = tmpTableName;
        this.columnsLoaded.add(this.schema.getColumnNames().get(0));
        try {
            this.database.connect();
        } catch (SQLException ex) {
            throw new RuntimeException(ex);
        }
    }

    /**
     * Given a list of columns, find the ones which have not been loaded yet.
     * @param columns  Columns to check.
     * @return         A set of columns that need to be loaded.
     */
    protected List<String> columnsToLoad(Iterable<String> columns) {
        List<String> result = new ArrayList<>();
        for (String c: columns) {
            if (!this.columnsLoaded.contains(c))
                result.add(c);
        }
        return result;
    }

    public static void writeColumns(Iterable<String> columns, JdbcDatabase database,
                                    Schema schema,
                                    String tmpTableName) throws SQLException {
        String tableName = database.connInfo.table;
        String cols = JdbcDatabase.schemaToSQL(columns, schema);
        // Create an external table that will be written into
        String query = "CREATE WRITABLE EXTERNAL WEB TABLE " +
                tmpTableName + " (" + cols + ") EXECUTE '" +
                Configuration.instance.getGreenplumMoveScript() + " fromdb " +
                Configuration.instance.getGreenplumDumpDirectory() + "/" + tmpTableName +
                "' FORMAT 'CSV'";
        database.executeUpdate(query);
        // This triggers the dumping of the data on the workers
        query = "INSERT INTO " + tmpTableName + " SELECT " + String.join(", ", columns) + " FROM " + tableName;
        database.executeUpdate(query);
        // Cleanup: remove temporary table
        query = "DROP EXTERNAL TABLE " + tmpTableName;
        database.executeUpdate(query);
    }

    protected void writeColumns(Iterable<String> columns) throws SQLException {
        writeColumns(columns, this.database, this.schema, this.tmpTableName);
    }

    protected void loadWrittenColumns(List<String> columns) {
        // Ask remote workers to parse their local files
        HashSet<String> set = new HashSet<>(columns);
        Schema toLoad = this.schema.project(set::contains);
        LoadCsvColumnsSketch sketch = new LoadCsvColumnsSketch(toLoad);
        ControlMessage.StatusList sl = this.table.blockingSketch(sketch);
        for (ControlMessage.Status s: Converters.checkNull(sl))
            if (s.isError())
                throw new RuntimeException(s.exception);
        this.columnsLoaded.addAll(columns);
    }

    synchronized protected void ensureColumns(Iterable<String> columns) {
        try {
            List<String> cols = this.columnsToLoad(columns);
            if (cols.isEmpty())
                return;
            this.writeColumns(cols);
            this.loadWrittenColumns(cols);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @HillviewRpc
    public void getNextK(RpcRequest request, RpcRequestContext context) {
        NextKArgs nextKArgs = request.parseArgs(NextKArgs.class);
        Schema schema = nextKArgs.order.toSchema();
        this.ensureColumns(schema.getColumnNames());
        super.getNextK(request, context);
    }
}


text:
#ifndef _RALEIGH_CLIENT_PRIVATE_H_
#define _RALEIGH_CLIENT_PRIVATE_H_

#include <zcl/global.h>
#include <zcl/socket.h>
#include <zcl/iopoll.h>
#include <zcl/rpc.h>

struct raleigh_client {
  __Z_IPC_CLIENT__
  z_ipc_msgbuf_t msgbuf;
  z_rpc_map_t    rpc_map;
  uint64_t       req_id;
};

typedef struct raleigh_global {
  int is_running;
  z_allocator_t allocator;
  z_iopoll_t iopoll;
} raleigh_global_t;

extern raleigh_global_t __global_ctx;

#define __RALEIGH_USE_ASYNC_AND_LATCH       1

#define __raleigh_call(type, callback, udata, ...)						                       \
	((type)callback)(udata, ##__VA_ARGS__)

#define __raleigh_client_push_request(client, ctx, sys_callback, ucallback, udata)	 \
	raleighsl_rpc_client_push_request(&(__global_ctx.iopoll), ctx, 							       \
																	  &((client)->msgbuf), &((client)->rpc_map),       \
                                    sys_callback, ucallback, udata)

#endif /* !_RALEIGH_CLIENT_PRIVATE_H_ */


text:
set -e

GOMAXPROCS=1 go test -timeout 90s ./...
GOMAXPROCS=4 go test -timeout 90s -race ./...

# no tests, but a build is something
for dir in $(find apps bench -maxdepth 1 -type d) nsqadmin; do
    if grep -q '^package main$' $dir/*.go 2>/dev/null; then
        echo "building $dir"
        go build -o $dir/$(basename $dir) ./$dir
    else
        echo "(skipped $dir)"
    fi
done