text:
import numpy as np
from impyute.ops import matrix
from impyute.ops import wrapper
# pylint: disable=invalid-name, too-many-arguments, too-many-locals, too-many-branches, broad-except, len-as-condition

@wrapper.wrappers
@wrapper.checks
def moving_window(data, nindex=None, wsize=5, errors="coerce", func=np.mean,
        inplace=False):
    """ Interpolate the missing values based on nearby values.

    For example, with an array like this:

        array([[-1.24940, -1.38673, -0.03214945,  0.08255145, -0.007415],
               [ 2.14662,  0.32758 , -0.82601414,  1.78124027,  0.873998],
               [-0.41400, -0.977629,         nan, -1.39255344,  1.680435],
               [ 0.40975,  1.067599,  0.29152388, -1.70160145, -0.565226],
               [-0.54592, -1.126187,  2.04004377,  0.16664863, -0.010677]])

    Using a `k` or window size of 3. The one missing value would be set
    to -1.18509122. The window operates on the horizontal axis.

    Usage
    -----

    The parameters default the function to a moving mean. You may want to change
    the default window size:

        moving_window(data, wsize=10)

    To only look at past data (null value is at the rightmost index in the window):

        moving_window(data, nindex=-1)

    To use a custom function:

        moving_window(data, func=np.median)

    You can also do something like take 1.5x the max of previous values in the window:

        moving_window(data, func=lambda arr: max(arr) * 1.50, nindex=-1)

    Parameters
    ----------
    data: numpy.ndarray
        2D matrix to impute.
    nindex: int
        Null index. Index of the null value inside the moving average window.
        Use cases: Say you wanted to make value skewed toward the left or right
        side. 0 would only take the average of values from the right and -1
        would only take the average of values from the left
    wsize: int
        Window size. Size of the moving average window/area of values being used
        for each local imputation. This number includes the missing value.
    errors: {"raise", "coerce", "ignore"}
        Errors will occur with the indexing of the windows - for example if there
        is a nan at data[x][0] and `nindex` is set to -1 or there is a nan at
        data[x][-1] and `nindex` is set to 0. `"raise"` will raise an error,
        `"coerce"` will try again using an nindex set to the middle and `"ignore"`
        will just leave it as a nan.
    inplace: {True, False}
        Whether to return a copy or run on the passed-in array

    Returns
    -------
    numpy.ndarray
        Imputed data.

    """
    if errors == "ignore":
        raise Exception("`errors` value `ignore` not implemented yet. Sorry!")

    if not inplace:
        data = data.copy()

    if nindex is None: # If using equal window side lengths
        assert wsize % 2 == 1, "The parameter `wsize` should not be even "\
        "if the value `nindex` is not set since it defaults to the midpoint "\
        "and an even `wsize` makes the midpoint ambiguous"
        wside_left = wsize // 2
        wside_right = wsize // 2
    else: # If using custom window side lengths
        assert nindex < wsize, "The null index must be smaller than the window size"
        if nindex == -1:
            wside_left = wsize - 1
            wside_right = 0
        else:
            wside_left = nindex
            wside_right = wsize - nindex - 1

    while True:
        nan_xy = matrix.nan_indices(data)
        n_nan_prev = len(nan_xy)
        for x_i, y_i in nan_xy:
            left_i = max(0, y_i-wside_left)
            right_i = min(len(data), y_i+wside_right+1)
            window = data[x_i, left_i: right_i]
            window_not_null = window[~np.isnan(window)]

            if len(window_not_null) > 0:
                try:
                    data[x_i][y_i] = func(window_not_null)
                    continue
                except Exception as e:
                    if errors == "raise":
                        raise e

            if errors == "coerce":
                # If either the window has a length of 0 or the aggregate function fails somehow,
                # do a fallback of just trying the best we can by using it as the middle and trying
                # to recalculate. Use temporary wside_left/wside_right, for only the calculation of
                # this specific problamatic value
                wside_left_tmp = wsize // 2
                wside_right_tmp = wside_left_tmp

                left_i_tmp = max(0, y_i-wside_left_tmp)
                right_i_tmp = min(len(data), y_i+wside_right_tmp+1)

                window = data[x_i, left_i_tmp:right_i_tmp]
                window_not_null = window[~np.isnan(window)]
                try:
                    data[x_i][y_i] = func(window_not_null)
                except Exception as e:
                    print("Exception:", e)
        if n_nan_prev == len(matrix.nan_indices(data)):
            break

    return data


text:
namespace MagicExpression
{
	using System;
	using System.Collections.Generic;
	using System.Text;
	using System.Text.RegularExpressions;
	using MagicExpression.Elements;

    public class Magex : IRepeatable, IRepeat, ILasiness, IBuilder
	{
		#region Fields

		private List<IExpressionElement> expression;

		#endregion

		#region Ctors

		private Magex()
		{
			this.expression = new List<IExpressionElement>();
		}

		#endregion

		#region Static constructor

		/// <summary>
		/// Creates a new instance of Magic Expression
		/// </summary>
		/// <returns>New instance of IMagex</returns>
		public static IMagex New()
		{
			return new Magex();
		}

		#endregion

		#region Properties

		/// <summary>
		/// Gets the regular expression string. Can be used to create a regular expression
		/// from the Magex.
		/// </summary>
		/// <value>
		/// The regular expression string.
		/// </value>
		public string Expression
		{
			get
			{
				StringBuilder s = new StringBuilder();

				foreach (IExpressionElement element in this.expression)
				{
					s.Append(element.Expression);
				}

				return s.ToString();
			}
		}

		/// <summary>
		/// Gets or sets the options.
		/// </summary>
		/// <value>
		/// The regular expression options.
		/// </value>
		public RegexOptions Options { get; set; }

		/// <summary>
		/// Gets the regular expression constructed with this instance of Magic Expression
		/// </summary>
		/// <value>
		/// The Regex object
		/// </value>
		public Regex Regex
		{
			get
			{
				return new Regex(this.Expression, this.Options);
			}
		}

		/// <summary>
		/// Gets the repetition possibilities on the last element
		/// added to the Magic expression.
		/// </summary>
		/// <value>
		/// Repetitions on the last element
		/// </value>
		public IRepeat Repeat
		{
			get
			{
				return this;
			}
		}

		public IBuilder Builder
		{
			get
			{
				return this;
			}
		}

        #endregion

        #region Utils
        /// <summary>
        /// Returns the regular expression produced by the Magex
        /// </summary>
        public override string ToString()
        {
            return this.Expression;
        }
        #endregion

        #region Characters

        /// <summary>
        /// Adds a character within a list of allowed chars
        /// </summary>
        /// <param name="chars">The allowed special chars.</param>
        /// <param name="otherChars">The allowed chars (escaped, if necessary).</param>
        /// <returns>This, as a repeatable object.</returns>
        public IRepeatable CharacterIn(Characters chars, string otherChars)
		{
			return this.CharacterIn(chars, otherChars.ToCharArray());
		}

		/// <summary>
		/// Adds a character within a list of allowed chars
		/// </summary>
		/// <param name="chars">The allowed special chars.</param>
		/// <param name="otherChars">The allowed chars (escaped, if necessary).</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable CharacterIn(Characters chars, params char[] otherChars)
		{
			this.expression.Add(new PossibleChars(chars, otherChars));
			return this;
		}

		/// <summary>
		/// Adds a character within a list of allowed chars
		/// </summary>
		/// <param name="otherChars">The allowed chars (escaped, if necessary).</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable CharacterIn(string otherChars)
		{
			return this.CharacterIn(Characters.None, otherChars.ToCharArray());
		}

		/// <summary>
		/// Adds a character within a list of allowed chars
		/// </summary>
		/// <param name="otherChars">The allowed chars (escaped, if necessary).</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable CharacterIn(params char[] otherChars)
		{
			return this.CharacterIn(Characters.None, otherChars);
		}

		/// <summary>
		/// Adds a character not belonging to a list of forbidden chars
		/// </summary>
		/// <param name="chars">The forbidden special chars</param>
		/// <param name="otherChars">The forbidden chars, escaped if necessary.</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable CharacterNotIn(Characters chars, string otherChars)
		{
			return this.CharacterNotIn(chars, otherChars.ToCharArray());
		}

		/// <summary>
		/// Adds a character not belonging to a list of forbidden chars
		/// </summary>
		/// <param name="chars">The forbidden special chars</param>
		/// <param name="otherChars">The forbidden chars, escaped if necessary.</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable CharacterNotIn(Characters chars, params char[] otherChars)
		{
			this.expression.Add(new ForbiddenChars(chars, otherChars));
			return this;
		}

		/// <summary>
		/// Adds a character not belonging to a list of forbidden chars
		/// </summary>
		/// <param name="otherChars">The forbidden chars, escaped if necessary.</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable CharacterNotIn(string otherChars)
		{
			return this.CharacterNotIn(Characters.None, otherChars.ToCharArray());
		}

		/// <summary>
		/// Adds a character not belonging to a list of forbidden chars
		/// </summary>
		/// <param name="otherChars">The forbidden chars, escaped if necessary.</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable CharacterNotIn(params char[] otherChars)
		{
			return this.CharacterNotIn(Characters.None, otherChars);
		}

		/// <summary>
		/// Adds a character, matching any character.
		/// </summary>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable Character()
		{
			this.expression.Add(new Literal("."));
			return this;
		}

		/// <summary>
		/// Adds a specific character
		/// </summary>
		/// <param name="theChar">The character, escaped if necessary.</param>
		/// <returns>This, as a repeatable object.</returns>
		public IRepeatable Character(char theChar)
		{
			this.expression.Add(new StringElement(theChar.ToString()));
			return this;
		}

        /// <summary>
        /// Adds a specific character set
        /// </summary>
        /// <param name="theChar">A Characters enum.</param>
        /// <returns>This, as a repeatable object.</returns>
        public IRepeatable Character(Characters charEnsemble)
        {
            this.expression.Add(new UnescapedStringElement(RegexCharacters.Get(charEnsemble)));
            return this;
        }

		/// <summary>
		/// Adds a line start/chain start (depending on options)
		/// </summary>
		/// <returns>This</returns>
		public IMagex StartOfLine()
		{
			this.expression.Add(new Literal("^"));
			return this;
		}

		/// <summary>
		/// Adds an end of line/end of string (depending on options)
		/// </summary>
		/// <returns>this</returns>
		public IMagex EndOfLine()
		{
			this.expression.Add(new Literal("$"));
			return this;
		}

		#endregion

		#region String

		/// <summary>
		/// Adds a specific string
		/// </summary>
		/// <param name="val">The string to be added, escaped if necessary.</param>
		/// <remarks>Cannot be repeated as is: you need to create a group. If you want to repeat the last char, add a character and apply repetition on it.</remarks>
		/// <returns>This</returns>
		public IMagex String(string val)
		{
			this.expression.Add(new StringElement(val));
			return this;
		}

		#endregion

		#region Repeat

		public ILasiness Any()
		{
			this.expression.Add(new Literal("*"));
			return this;
		}

		public IMagex Once()
		{
			return this;
		}

		public IMagex Times(uint number)
		{
			this.expression.Add(new Literal("{" + number.ToString() + "}"));
			return this;
		}

		public ILasiness AtMostOnce()
		{
			this.expression.Add(new Literal("?"));
			return this;
		}

		public ILasiness Between(uint min, uint max)
		{
			this.expression.Add(new Literal("{" + min.ToString() + "," + max.ToString() + "}"));
			return this;
		}

		public ILasiness AtLeastOnce()
		{
			this.expression.Add(new Literal("+"));
			return this;
		}

		#endregion

		#region Groups

		/// <summary>
		/// Creates a non capturing group
		/// </summary>
		/// <param name="grouped">The grouped element.</param>
		/// <returns>this as a repeatable object.</returns>
		public IRepeatable Group(IExpressionElement grouped)
		{
			this.expression.Add(new NonCapturingGroup(grouped));
			return this;
		}

		/// <summary>
		/// Creates an indexed capture
		/// </summary>
		/// <param name="captured">The captured element.</param>
		/// <returns>this as a repeatable object.</returns>
		public IRepeatable Capture(IExpressionElement captured)
		{
			this.expression.Add(new CapturingGroup(captured));
			return this;
		}

		/// <summary>
		/// Creates a named capture
		/// </summary>
		/// <param name="name">The capture name.</param>
		/// <param name="captured">The captured element.</param>
		/// <returns>this as a repeatable object.</returns>
		public IRepeatable CaptureAs(string name, IExpressionElement captured)
		{
			this.expression.Add(new NamedGroup(name, captured));
			return this;
		}

		/// <summary>
		/// Creates a non capturing group
		/// </summary>
		/// <param name="expression">The magex creation lambda.</param>
		/// <returns>this as a repeatable object.</returns>
		public IRepeatable Group(Action<IMagex> expression)
		{
			var magex = Magex.New();
			expression(magex);

			return this.Group(magex);
		}

		/// <summary>
		/// Creates an indexed capture
		/// </summary>
		/// <param name="expression">The magex creation lambda.</param>
		/// <returns>this as a repeatable object.</returns>
		public IRepeatable Capture(Action<IMagex> expression)
		{
			var magex = Magex.New();
			expression(magex);

			return this.Capture(magex);
		}

		/// <summary>
		/// Creates a named capture
		/// </summary>
		/// <param name="name">The capture name.</param>
		/// <param name="expression">The magex creation lambda.</param>
		/// <returns>this as a repeatable object.</returns>
		public IRepeatable CaptureAs(string name, Action<IMagex> expression)
		{
			var magex = Magex.New();
			expression(magex);

			return this.CaptureAs(name, magex);
		}

		#endregion

		#region Alt

		/// <summary>
		/// Creates an alternative element
		/// </summary>
		/// <param name="alternatives">The alternatives.</param>
		/// <returns>This, as a repeatable object</returns>
		public IRepeatable Alternative(params IExpressionElement[] alternatives)
		{
			this.expression.Add(new Alternative(alternatives));
			return this;
		}

		/// <summary>
		/// Creates an alternative element
		/// </summary>
		/// <param name="alternatives">The alternatives, as lambda expressions.</param>
		/// <returns>This, as a repeatable object</returns>
		public IRepeatable Alternative(params Action<IMagex>[] alternatives)
		{
			IExpressionElement[] constructedAlternatives = new IExpressionElement[alternatives.Length];

			for (var i = 0; i < alternatives.Length; i++)
			{
				var possibility = Magex.New();
				alternatives[i](possibility);
				constructedAlternatives[i] = possibility;
			}

			return this.Alternative(constructedAlternatives);
		}

		#endregion

		#region Laziness

		/// <summary>
		/// Specifies that the last operator must be interpreted with laziness.
		/// </summary>
		/// <returns>this</returns>
		public IMagex Lazy()
		{
			this.expression.Add(new Literal("?"));
			return this;
		}

		#endregion

		#region References

		/// <summary>
		/// Creates a named backreference. To be used with a named capture.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <returns>This as a repeatable object</returns>
		public IRepeatable BackReference(string name)
		{
			this.expression.Add(new NamedBackReference(name));
			return this;
		}

		/// <summary>
		/// Creates an indexed backreference. To be used with an indexed capture.
		/// </summary>
		/// <param name="index">Capture index, starting from 1</param>
		/// <returns>This as a repeatable object</returns>
		public IRepeatable BackReference(uint index)
		{
			this.expression.Add(new IndexedBackReference(index));
			return this;
		}

		#endregion

		#region Literal

		/// <summary>
		/// Adds a literal regex.
		/// </summary>
		/// <param name="regex">The regex.</param>
		/// <returns>this</returns>
		public IMagex Literal(string regex)
		{
			this.expression.Add(new Literal(regex));
			return this;
		}

		public IRepeatable NumericRange(ulong from, ulong to)
		{
			this.expression.Add(new Literal(MagexBuilder.NumericRange(from, to)));
			return this;
		}

        public IRepeatable NumericRange(ulong from, ulong to, RangeOptions options)
        {
            this.expression.Add(new Literal(MagexBuilder.NumericRange(from, to, options)));
            return this;
        }

		#endregion
	}
}

redpajama_set_name: RedPajamaGithub


text:
package com.kahkong.wikicontacts.service;

/**
 *
 * @author Poh Kah Kong
 *
 */
public interface WebService {
	public String getSiteUrl();

	public boolean isFromSite(String url);

	public String getISOCountryCode(String ipAddress);

}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>微信传播</title>
  <link rel="stylesheet" href="/wxms/css/reset.css"/>
  <link rel="stylesheet" href="/wxms/css/common.css"/>
  <link rel="stylesheet" href="/wxms/css/font/fonts.css"/>
  <link rel="stylesheet" href="/wxms/css/wxui.css"/>
  <link rel="stylesheet" href="/wxms/css/animate.css"/>
  <link rel="stylesheet" href="/wxms/lib/jqueryui/jquery-ui.min.css"/>
  <link rel="stylesheet" href="/wxms/lib/jquerycolorpicker/spectrum.css"/>
  <link rel="stylesheet" href="/wxms/lib/jquerypagination/jquery.jui_pagination.css"/>
  <link rel="stylesheet" href="/wxms/css/resetjqueryui.css"/>
  <link rel="stylesheet" href="/wxms/css/ui-dialog.css"/>
  <link rel="stylesheet" href="/wxms/css/editor.css"/>
  <link rel="stylesheet" href="/wxms/lib/jquerycontextmenu/jquery.contextMenu.css"/>

    微信传播模板

      添加文本

      添加图片

      添加按钮

      背景音乐

        发布

        分享

        预览

        反馈

        退出

+

        <% include prototype_content.html %>

<% include templeate_content.html %>

<% include select_img.html%>

<% include select_audio.html %>

<% include select_tempate.html %>

<% include wxshare.html %>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syst. alg. 47 (1824)

#### Original name
Leptomitus lacteus var. lacteus C. Agardh

### Remarks
null


text:
package org.hawkular.agent.monitor.extension;

import java.util.Collection;

import org.hawkular.agent.monitor.service.MonitorService;
import org.jboss.as.controller.AbstractWriteAttributeHandler;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.OperationContext;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceRegistry;

/**
 * Base class to all the write attribute handlers. Simply provides a method to obtain the service.
 *
 * @param <T> used to assist in the revert functionality. Can be Void if not needed.
 */
public abstract class MonitorServiceWriteAttributeHandler<T> extends AbstractWriteAttributeHandler<T> {

    public MonitorServiceWriteAttributeHandler(AttributeDefinition... definitions) {
        super(definitions);
    }

    public MonitorServiceWriteAttributeHandler(Collection<AttributeDefinition> definitions) {
        super(definitions);
    }

    protected MonitorService getMonitorService(OperationContext opContext) {
        ServiceName name = SubsystemExtension.SERVICE_NAME;
        ServiceRegistry serviceRegistry = opContext.getServiceRegistry(true);
        MonitorService service = (MonitorService) serviceRegistry.getRequiredService(name).getValue();
        return service;
    }

}


text:
package tw.alphacamp.tripphotoapp.fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.*;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.MarkerOptions;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseQuery;
import tw.alphacamp.tripphotoapp.R;
import tw.alphacamp.tripphotoapp.object.Photo;

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

/**
 * Created by edward_chiang on 15/1/24.
 */
public class MapFragment extends PlaceholderFragment implements OnMapReadyCallback {

    private static View rootView;

    private List<Photo> photoList;

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

        photoList = new ArrayList<>();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (rootView != null) {
            ViewGroup parentViewGroup = (ViewGroup) rootView.getParent();
            if (parentViewGroup != null) {
                parentViewGroup.removeAllViews();
            }
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        if (rootView!=null) {
            ViewGroup containerParent = (ViewGroup)container.getParent();
            if (containerParent !=null) {
                containerParent.removeView(rootView);
            }
        }
        try {
            rootView = inflater.inflate(R.layout.fragment_map, container, false);
        } catch (InflateException ex ){
            Log.e("TripPhoto", ex.getLocalizedMessage());
        }

        SupportMapFragment mapFragment = (SupportMapFragment)
                getChildFragmentManager().findFragmentById(R.id.google_map_view);
        mapFragment.getMapAsync(this);

        return rootView;
    }

    @Override
    public void onMapReady(final GoogleMap googleMap) {

        ParseQuery<Photo> photoParseQuery = ParseQuery.getQuery(Photo.class);
        photoParseQuery.setCachePolicy(ParseQuery.CachePolicy.CACHE_ELSE_NETWORK);
        photoParseQuery.findInBackground(new FindCallback<Photo>() {
            @Override
            public void done(List<Photo> photos, ParseException e) {
                if (e == null) {
                    photoList.clear();
                    photoList.addAll(photos);

                    List<MarkerOptions> markerOptionsList = new ArrayList<MarkerOptions>();
                    for (Photo eachPhoto : photos) {
                        if (eachPhoto.getLocation() != null) {

                            MarkerOptions markerOptions = new MarkerOptions()
                                    .title(eachPhoto.getName())
                                    .position(new LatLng(eachPhoto.getLocation().getLatitude(),
                                            eachPhoto.getLocation().getLongitude()
                                            ));
                            markerOptionsList.add(markerOptions);
                            googleMap.addMarker(markerOptions);

                        }
                    }

                    //Calculate the markers to get their position
                    LatLngBounds.Builder builder = new LatLngBounds.Builder();
                    for (MarkerOptions marker : markerOptionsList) {
                        builder.include(marker.getPosition());
                    }
                    LatLngBounds bounds = builder.build();
                    // Change the padding as per needed
                    CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, 0);
                    googleMap.moveCamera(cameraUpdate);
                }
            }
        });
    }
}


text:
set -eu
bash_source_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"

# Read variable definitions output by _env.sh
source <("${bash_source_dir}/_env.sh")

: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"
: "${BSIM_COMPONENTS_PATH:?BSIM_COMPONENTS_PATH must be defined}"
: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}"

WORK_DIR="${WORK_DIR:-${ZEPHYR_BASE}/bsim_bt_out}"
BOARD="${BOARD:-nrf52_bsim}"
BOARD_ROOT="${BOARD_ROOT:-${ZEPHYR_BASE}}"
INCR_BUILD=1
mkdir -p ${WORK_DIR}
source ${ZEPHYR_BASE}/tests/bluetooth/bsim_bt/compile.source
app="tests/bluetooth/bsim_bt/$test_name" compile


text:
package org.burroloco.donkey.demo.watcher;

import au.net.netstorm.boost.spider.api.config.wire.Wire;
import org.burroloco.config.core.Config;
import org.burroloco.donkey.exception.job.JobExceptionHandler;
import org.burroloco.donkey.exception.job.ShiftyJobExceptionHandler;
import org.burroloco.donkey.exception.job.SwallowingJobExceptionHandler;
import org.burroloco.donkey.gargle.NoOpTupleGargler;
import org.burroloco.donkey.gargle.TupleGargler;
import org.burroloco.donkey.job.ConsumeTransformProduce;
import org.burroloco.donkey.job.DirectoryWatcher;
import org.burroloco.donkey.job.ExceptionWrapper;
import org.burroloco.donkey.job.Job;
import org.burroloco.donkey.job.Poller;
import org.burroloco.donkey.slurp.core.Slurper;
import org.burroloco.donkey.slurp.csv.CsvSlurper;
import org.burroloco.donkey.spit.core.Spitter;
import org.burroloco.donkey.spit.file.DefaultOutputFileWizard;
import org.burroloco.donkey.spit.file.FileSpitter;
import org.burroloco.donkey.spit.file.FileWizard;
import org.burroloco.donkey.spit.file.ShiftySpitter;
import org.burroloco.donkey.spit.file.UniqueFileWizard;
import org.burroloco.donkey.trebuchet.Wirer;
import org.burroloco.util.wire.Dna;

public class DirectoryWatcherWirer implements Wirer {
    Wire wire;
    Dna dna;

    public void wire(Config config) {
        dna.strand(JobExceptionHandler.class, ShiftyJobExceptionHandler.class, SwallowingJobExceptionHandler.class);
        dna.strand(Job.class, Poller.class, DirectoryWatcher.class, ExceptionWrapper.class, ConsumeTransformProduce.class);
        wire.cls(CsvSlurper.class).to(Slurper.class);
        wire.cls(NoOpTupleGargler.class).to(TupleGargler.class);
        spitter();
    }

    private void spitter() {
        wire.cls(UniqueFileWizard.class).to(FileWizard.class, DefaultOutputFileWizard.class);
        dna.strand(Spitter.class, ShiftySpitter.class, FileSpitter.class);
    }
}


text:
'use strict';

var assign          = require('es5-ext/object/assign')
  , processingSteps = require('eregistrations/processing-steps-meta');

module.exports = assign(processingSteps, require('./meta'));

require('../apps/official-revision/business-processes/map');
require('../apps/official-processing/business-processes/map');
require('../apps/official-social-security/business-processes/map');
require('../apps/official-front-desk/business-processes/map');


text:
package org.apache.directory.fortress.realm;

import java.util.List;
import java.security.Principal;

import org.apache.directory.fortress.core.model.User;
import org.apache.directory.fortress.core.model.Role;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.model.Session;

/**
 * This interface is for components that use Websphere and Tomcat Container SPI's to provide
 * Java EE Security capabilities.  These APIs may be called by external programs as needed though the recommended
 * practice is to use Fortress Core APIs like {@link org.apache.directory.fortress.core.AccessMgr} and {@link org.apache.directory.fortress.core.ReviewMgr}.
 *
 * @author Apache Directory Project
 */
public interface J2eePolicyMgr
{
    /**
     * Perform user authentication and evaluate password policies.
     *
     * @param userId   Contains the userid of the user signing on.
     * @param password Contains the user's password.
     * @return boolean true if succeeds, false otherwise.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          in the event of data validation failure, security policy violation or DAO error.
     */
    boolean authenticate( String userId, String password ) throws SecurityException;

    /**
     * Perform user authentication {@link User#password} and role activations.

     * This method must be called once per user prior to calling other methods within this class.
     * The successful result is {@link org.apache.directory.fortress.core.model.Session} that contains target user's RBAC {@link User#roles} and Admin role {@link User#adminRoles}.

     * In addition to checking user password validity it will apply configured password policy checks {@link org.apache.directory.fortress.core.model.User#pwPolicy}..

     * Method may also store parms passed in for audit trail {@link org.apache.directory.fortress.core.model.FortEntity}.
     *
 This API will...

     *

     *
 authenticate user password if trusted == false.
     *
 perform OpenLDAP password policy evaluation.
     *
 fail for any user who is locked by OpenLDAP's policies {@link org.apache.directory.fortress.core.model.User#isLocked()}, regardless of trusted flag being set as parm on API.
     *
 evaluate temporal {@link org.apache.directory.fortress.core.model.Constraint}(s) on {@link User}, {@link org.apache.directory.fortress.core.model.UserRole} and {@link org.apache.directory.fortress.core.model.UserAdminRole} entities.
     *
 process selective role activations into User RBAC Session {@link User#roles}.
     *
 check Dynamic Separation of Duties {@link org.apache.directory.fortress.core.impl.DSDChecker#validate(org.apache.directory.fortress.core.model.Session, org.apache.directory.fortress.core.model.Constraint, org.apache.directory.fortress.core.util.time.Time), org.apache.directory.fortress.core.util.VUtil#ConstraintType} on {@link org.apache.directory.fortress.core.model.User#roles}.
     *
 process selective administrative role activations {@link User#adminRoles}.
     *
 return a {@link org.apache.directory.fortress.core.model.Session} containing {@link org.apache.directory.fortress.core.model.Session#getUser()}, {@link org.apache.directory.fortress.core.model.Session#getRoles()} and {@link org.apache.directory.fortress.core.model.Session#getAdminRoles()} if everything checks out good.
     *
 throw a checked exception that will be {@link org.apache.directory.fortress.core.SecurityException} or its derivation.
     *
 throw a {@link SecurityException} for system failures.
     *
 throw a {@link org.apache.directory.fortress.core.PasswordException} for authentication and password policy violations.
     *
 throw a {@link org.apache.directory.fortress.core.ValidationException} for data validation errors.
     *
 throw a {@link org.apache.directory.fortress.core.FinderException} if User id not found.
     *

     *

     * The function is valid if and only if:
     *

     *

     *
 the user is a member of the USERS data set
     *
 the password is supplied (unless trusted).
     *
 the (optional) active role set is a subset of the roles authorized for that user.
     *

     *

     * The following attributes may be set when calling this method
     *

     *

     *
 {@link User#userId} - required
     *
 {@link org.apache.directory.fortress.core.model.User#password}
     *
 {@link org.apache.directory.fortress.core.model.User#roles} contains a list of RBAC role names authorized for user and targeted for activation within this session.  Default is all authorized RBAC roles will be activated into this Session.
     *
 {@link org.apache.directory.fortress.core.model.User#adminRoles} contains a list of Admin role names authorized for user and targeted for activation.  Default is all authorized ARBAC roles will be activated into this Session.
     *
 {@link User#props} collection of name value pairs collected on behalf of User during signon.  For example hostname:myservername or ip:192.168.1.99
     *

     *

     * Notes:
     *

     *

     *
 roles that violate Dynamic Separation of Duty Relationships will not be activated into session.
     *
 role activations will proceed in same order as supplied to User entity setter, see {@link User#setRoleName(String)}.
     *

     *

     *
     * @param userId   maps to {@link org.apache.directory.fortress.core.model.User#userId}.
     * @param password maps to {@link org.apache.directory.fortress.core.model.User#password}.
     * @return TcPrincipal which contains the User's RBAC Session data formatted into a java.security.Principal that is used by Tomcat runtime.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          in the event of data validation failure, security policy violation or DAO error.
     */
    TcPrincipal createSession( String userId, String password ) throws SecurityException;

    /**
     * Perform user authentication {@link User#password} and role activations.

     * This method must be called once per user prior to calling other methods within this class.
     * The successful result is {@link org.apache.directory.fortress.core.model.Session} that contains target user's RBAC {@link User#roles} and Admin role {@link User#adminRoles}.

     * In addition to checking user password validity it will apply configured password policy checks {@link org.apache.directory.fortress.core.model.User#pwPolicy}..

     * Method may also store parms passed in for audit trail {@link org.apache.directory.fortress.core.model.FortEntity}.
     *
 This API will...

     *

     *
 authenticate user password if trusted == false.
     *
 perform OpenLDAP password policy evaluation.
     *
 fail for any user who is locked by OpenLDAP's policies {@link org.apache.directory.fortress.core.model.User#isLocked()}, regardless of trusted flag being set as parm on API.
     *
 evaluate temporal {@link org.apache.directory.fortress.core.model.Constraint}(s) on {@link User}, {@link org.apache.directory.fortress.core.model.UserRole} and {@link org.apache.directory.fortress.core.model.UserAdminRole} entities.
     *
 process selective role activations into User RBAC Session {@link User#roles}.
     *
 check Dynamic Separation of Duties {@link org.apache.directory.fortress.core.impl.DSDChecker#validate(org.apache.directory.fortress.core.model.Session, org.apache.directory.fortress.core.model.Constraint, org.apache.directory.fortress.core.util.time.Time)} on {@link org.apache.directory.fortress.core.model.User#roles}.
     *
 process selective administrative role activations {@link User#adminRoles}.
     *
 return a {@link org.apache.directory.fortress.core.model.Session} containing {@link org.apache.directory.fortress.core.model.Session#getUser()}, {@link org.apache.directory.fortress.core.model.Session#getRoles()} and {@link org.apache.directory.fortress.core.model.Session#getAdminRoles()} if everything checks out good.
     *
 throw a checked exception that will be {@link org.apache.directory.fortress.core.SecurityException} or its derivation.
     *
 throw a {@link SecurityException} for system failures.
     *
 throw a {@link org.apache.directory.fortress.core.PasswordException} for authentication and password policy violations.
     *
 throw a {@link org.apache.directory.fortress.core.ValidationException} for data validation errors.
     *
 throw a {@link org.apache.directory.fortress.core.FinderException} if User id not found.
     *

     *

     * The function is valid if and only if:
     *

     *

     *
 the user is a member of the USERS data set
     *
 the password is supplied (unless trusted).
     *
 the (optional) active role set is a subset of the roles authorized for that user.
     *

     *

     * The following attributes may be set when calling this method
     *

     *

     *
 {@link User#userId} - required
     *
 {@link org.apache.directory.fortress.core.model.User#password}
     *
 {@link org.apache.directory.fortress.core.model.User#roles} contains a list of RBAC role names authorized for user and targeted for activation within this session.  Default is all authorized RBAC roles will be activated into this Session.
     *
 {@link org.apache.directory.fortress.core.model.User#adminRoles} contains a list of Admin role names authorized for user and targeted for activation.  Default is all authorized ARBAC roles will be activated into this Session.
     *
 {@link User#props} collection of name value pairs collected on behalf of User during signon.  For example hostname:myservername or ip:192.168.1.99
     *

     *

     * Notes:
     *

     *

     *
 roles that violate Dynamic Separation of Duty Relationships will not be activated into session.
     *
 role activations will proceed in same order as supplied to User entity setter, see {@link User#setRoleName(String)}.
     *

     *

     *
     * @param userId   maps to {@link org.apache.directory.fortress.core.model.User#userId}.
     * @param password maps to {@link org.apache.directory.fortress.core.model.User#password}.
     * @param roles constains list of role names to activate.
     * @return TcPrincipal which contains the User's RBAC Session data formatted into a java.security.Principal that is used by Tomcat runtime.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          in the event of data validation failure, security policy violation or DAO error.
     */
    TcPrincipal createSession( String userId, String password, List<String> roles ) throws SecurityException;

    /**
     * Perform user authentication {@link User#password} and role activations.

     * This method must be called once per user prior to calling other methods within this class.
     * The successful result is {@link org.apache.directory.fortress.core.model.Session} that contains target user's RBAC {@link User#roles} and Admin role {@link User#adminRoles}.

     * In addition to checking user password validity it will apply configured password policy checks {@link org.apache.directory.fortress.core.model.User#pwPolicy}..

     * Method may also store parms passed in for audit trail {@link org.apache.directory.fortress.core.model.FortEntity}.
     *
 This API will...

     *

     *
 authenticate user password if trusted == false.
     *
 perform OpenLDAP password policy evaluation.
     *
 fail for any user who is locked by OpenLDAP's policies {@link org.apache.directory.fortress.core.model.User#isLocked()}, regardless of trusted flag being set as parm on API.
     *
 evaluate temporal {@link org.apache.directory.fortress.core.model.Constraint}(s) on {@link User}, {@link org.apache.directory.fortress.core.model.UserRole} and {@link org.apache.directory.fortress.core.model.UserAdminRole} entities.
     *
 process selective role activations into User RBAC Session {@link User#roles}.
     *
 check Dynamic Separation of Duties {@link org.apache.directory.fortress.core.impl.DSDChecker#validate(org.apache.directory.fortress.core.model.Session, org.apache.directory.fortress.core.model.Constraint, org.apache.directory.fortress.core.util.time.Time)} on {@link org.apache.directory.fortress.core.model.User#roles}.
     *
 process selective administrative role activations {@link User#adminRoles}.
     *
 return a {@link org.apache.directory.fortress.core.model.Session} containing {@link org.apache.directory.fortress.core.model.Session#getUser()}, {@link org.apache.directory.fortress.core.model.Session#getRoles()} and {@link org.apache.directory.fortress.core.model.Session#getAdminRoles()} if everything checks out good.
     *
 throw a checked exception that will be {@link org.apache.directory.fortress.core.SecurityException} or its derivation.
     *
 throw a {@link SecurityException} for system failures.
     *
 throw a {@link org.apache.directory.fortress.core.PasswordException} for authentication and password policy violations.
     *
 throw a {@link org.apache.directory.fortress.core.ValidationException} for data validation errors.
     *
 throw a {@link org.apache.directory.fortress.core.FinderException} if User id not found.
     *

     *

     * The function is valid if and only if:
     *

     *

     *
 the user is a member of the USERS data set
     *
 the password is supplied (unless trusted).
     *
 the (optional) active role set is a subset of the roles authorized for that user.
     *

     *

     * The following attributes may be set when calling this method
     *

     *

     *
 {@link User#userId} - required
     *
 {@link org.apache.directory.fortress.core.model.User#password}
     *
 {@link org.apache.directory.fortress.core.model.User#roles} contains a list of RBAC role names authorized for user and targeted for activation within this session.  Default is all authorized RBAC roles will be activated into this Session.
     *
 {@link org.apache.directory.fortress.core.model.User#adminRoles} contains a list of Admin role names authorized for user and targeted for activation.  Default is all authorized ARBAC roles will be activated into this Session.
     *
 {@link User#props} collection of name value pairs collected on behalf of User during signon.  For example hostname:myservername or ip:192.168.1.99
     *

     *

     * Notes:
     *

     *

     *
 roles that violate Dynamic Separation of Duty Relationships will not be activated into session.
     *
 role activations will proceed in same order as supplied to User entity setter, see {@link User#setRoleName(String)}.
     *

     *

     *
     * @param user      Contains {@link User#userId}, {@link org.apache.directory.fortress.core.model.User#password} (optional if {@code isTrusted} is 'true'), optional {@link User#roles}, optional {@link org.apache.directory.fortress.core.model.User#adminRoles}
     * @param isTrusted if true password is not required.
     * @return Session object will contain authentication result code {@link org.apache.directory.fortress.core.model.Session#errorId}, RBAC role activations {@link org.apache.directory.fortress.core.model.Session#getRoles()}, Admin Role activations {@link org.apache.directory.fortress.core.model.Session#getAdminRoles()},OpenLDAP pw policy codes {@link org.apache.directory.fortress.core.model.Session#warnings}, {@link org.apache.directory.fortress.core.model.Session#expirationSeconds}, {@link org.apache.directory.fortress.core.model.Session#graceLogins} and more.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          in the event of data validation failure, security policy violation or DAO error.
     */
    Session createSession( User user, boolean isTrusted ) throws SecurityException;

    /**
     * Determine if given Role is contained within User's Tomcat Principal object.  This method does not need to hit
     * the ldap server as the User's activated Roles are loaded into {@link TcPrincipal#setContext(java.util.HashMap)}
     *
     * @param principal Contains User's Tomcat RBAC Session data that includes activated Roles.
     * @param roleName  Maps to {@link org.apache.directory.fortress.core.model.Role#name}.
     * @return True if Role is found in TcPrincipal, false otherwise.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          data validation failure or system error..
     */
    boolean hasRole( Principal principal, String roleName ) throws SecurityException;

    /**
     * Method reads Role entity from the role container in directory.
     *
     * @param roleName maps to {@link Role#name}, to be read.
     * @return Role entity that corresponds with role name.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          will be thrown if role not found or system error occurs.
     */
    Role readRole( String roleName ) throws SecurityException;

    /**
     * Search for Roles assigned to given User.
     *
     * @param userId Maps to {@link org.apache.directory.fortress.core.model.User#userId}.
     * @param limit  controls the size of ldap result set returned.
     * @return List of type String containing the {@link org.apache.directory.fortress.core.model.Role#name} of all assigned Roles.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          in the event of data validation failure or DAO error.
     */
    List<String> searchRoles( String userId, int limit ) throws SecurityException;

    /**
     * Method returns matching User entity that is contained within the people container in the directory.
     *
     * @param userId maps to {@link User#userId} that matches record in the directory.  userId is globally unique in
     *               people container.
     * @return entity containing matching user data.
     * @throws SecurityException if record not found or system error occurs.
     */
    User readUser( String userId ) throws SecurityException;

    /**
     * Return a list of type String of all users in the people container that match the userId field passed in User entity.
     * This method is used by the Websphere sentry component.  The max number of returned users may be set by the integer limit arg.
     *
     * @param userId contains all or some leading chars that correspond to users stored in the directory.
     * @param limit  integer value sets the max returned records.
     * @return List of type String containing matching userIds.
     * @throws SecurityException in the event of system error.
     */
    List<String> searchUsers( String userId, int limit ) throws SecurityException;

    /**
     * This function returns the set of users assigned to a given role. The function is valid if and
     * only if the role is a member of the ROLES data set.
     * The max number of users returned is constrained by limit argument.
     * This method is used by the Websphere sentry component.  This method does NOT use hierarchical rbac.
     *
     * @param roleName maps to {@link Role#name} of Role entity assigned to user.
     * @param limit    integer value sets the max returned records.
     * @return List of type String containing userIds assigned to a particular role.
     * @throws org.apache.directory.fortress.core.SecurityException
     *          in the event of data validation or system error.
     */
    List<String> assignedUsers( String roleName, int limit ) throws SecurityException;

    /**
     * This function returns the set of roles authorized for a given user. The function is valid if
     * and only if the user is a member of the USERS data set.
     *
     * @param userId maps to {@link User#userId} matching User entity stored in the directory.
     * @return Set of type String containing the roles assigned and roles inherited.
     * @throws SecurityException If user not found or system error occurs.
     */
    List<String> authorizedRoles( String userId ) throws SecurityException;

    /**
     * This utility method can deserialize java.security.Principal to Fortress RBAC session object.
     *
     * @param str contains String to deserialize
     * @return deserialization target object
     */
    Session deserialize( String str ) throws SecurityException;

    /**
     * Use this method to set the tenant id onto function call into Fortress which allows segregation of data by customer.
     * The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT.
     * Setting contextId into this object will render this class' implementer thread unsafe.
     *
     * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
     */
    public void setContextId(String contextId);
}


text:
import React from 'react';
import LinearProgress from 'material-ui/LinearProgress';
import PropTypes from 'prop-types';
import { createContainer } from 'meteor/react-meteor-data';
import { Meteor } from 'meteor/meteor';

import { AvatarUploader } from '/imports/avatar/client/avatar_client_utils.js';
import { sendSnack } from '/imports/ui/components/shared/SnackAttack/SnackAttack';

class AvatarEditor extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			avatarUrl: props.defaultAvatarUrl,
			isDefault: true,
			progress: 0,
			isProgressShown: false,
		};

		this.preventDefault = this.preventDefault.bind(this);
		this.handleDrop = this.handleDrop.bind(this);
		this.handleSelectFile = this.handleSelectFile.bind(this);
		this.handleDeleteAvatar = this.handleDeleteAvatar.bind(this);
	}

	componentWillReceiveProps(nextProps) {
		const isDefault = !nextProps.avatar.url;
		this.setState({
			isDefault,
			avatarUrl: isDefault ? nextProps.defaultAvatarUrl : nextProps.avatar.url,
		});
	}

	preventDefault(event) {
		event.preventDefault();
	}

	uploadAvatar(data, context) {
		const self = this;
		const uploader = new AvatarUploader({
			data,
			context,
			onStart() {
				self.setState({
					progress: 0,
					isProgressShown: true,
				});
			},
			onError(err) {
				console.error(err);
				sendSnack(err.reason);
			},
			onComplete() {
				self.setState({
					isProgressShown: false,
				});
				sendSnack('Profile pic has been uploaded');
			},
			onProgress: (progress) => {
				if (progress > 100) {
					self.setState({ progress: 100 });
				} else {
					self.setState({ progress: Math.floor(progress * 100) });
				}
			},
		});

		uploader.start();
	}

	handleDrop(event) {
		event.preventDefault();
		this.uploadAvatar(event.dataTransfer.files[0], { type: 'user' });
	}

	handleSelectFile() {
		UploadFS.selectFile(data => this.uploadAvatar(data, { type: 'user' }));
	}

	handleDeleteAvatar() {
		if (!this.state.isDefault && this.props.avatar._id) {
			Meteor.call('avatar.delete', { avatarId: this.props.avatar._id });
		}
	}

	render() {
		let progressStyle = {
			display: 'none',
		};
		if (this.state.isProgressShown) {
			progressStyle = {
				display: 'block',
			};
		}
		return (

							Select to upload or drag and drop.

				<LinearProgress mode="determinate" value={this.state.progress} style={progressStyle} />

		);
	}
}

AvatarEditor.propTypes = {
	defaultAvatarUrl: PropTypes.string.isRequired,
	avatar: PropTypes.object,
	avatarLoading: PropTypes.bool,
	user: PropTypes.object,
};

AvatarEditor.defaultProps = {
	defaultAvatarUrl: '',
	avatar: {},
	avatarLoading: false,
};

export default createContainer((props) => {
	const myAvatarHandle = Meteor.subscribe('users.myAvatar');
	let userAvatar = {};
	if (props.user) {
		userAvatar = props.user.avatar || {};
	} else if (Meteor.user()) {
		userAvatar = Meteor.user().avatar || {};
	}

	return {
		defaultAvatarUrl: props.defaultAvatarUrl,
		avatar: userAvatar,
		avatarLoading: !myAvatarHandle.ready(),
	};
}, AvatarEditor);


text:
package org.gearvrf;

import org.gearvrf.utility.TextFile;
import org.joml.Matrix4f;

import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Illuminates object in the scene with a cone shaped beam.
 *
 * The apex of the cone is at the position of the scene object
 * the light is attached to. The direction of the cone is the
 * forward direction of that scene object.
 *
 * There are two angles for the cone. Beyond the "outer angle"
 * no light is emitted. Inside the "inner angle" the light is
 * at full intensity. Between the two angles the light linearly
 * decreases allowing for soft edges.
 *
 * The intensity of the light diminishes with distance from the
 * cone apex. Three attenuation factors are provided to specify how
 * the intensity of the light falls off with distance:
 * {@code I = attenuation_constant + attenuation_linear * D * attenuation_quadratic * D ** 2}
 *
 * Spot light uniforms:
 * {@literal
 *   enabled               1 = light is enabled, 0 = light is disabled
 *   world_position        position of spot light in world coordinates
 *                         derived from scene object position
 *   world_direction       direction of spot light in world coordinates
 *                         derived from scene object orientation
 *   ambient_intensity     intensity of ambient light emitted
 *   diffuse_intensity     intensity of diffuse light emitted
 *   specular_intensity    intensity of specular light emitted
 *   attenuation_constant  constant attenuation factor
 *   attenuation_linear    linear attenuation factor
 *   attenuation_quadratic quadratic attenuation factor
 *   inner_cone_angle      cosine of inner cone angle
 *   outer_cone_angle      cosine of outer cone angle
 *   sm0                   shadow matrix column 1
 *   sm1                   shadow matrix column 2
 *   sm2                   shadow matrix column 3
 *   sm3                   shadow matrix column 4
 * }
 *
 * Note: some mobile GPU drivers do not correctly pass a mat4 thru so we currently
 * use 4 vec4's instead.
 *
 * @see GVRPointLight
 * @see GVRLightBase
 */
public class GVRSpotLight extends GVRPointLight
{
    private static String fragmentShader = null;
    private static String vertexShader = null;
    private boolean useShadowShader = true;
    private AtomicBoolean mChanged = new AtomicBoolean();

    public GVRSpotLight(GVRContext gvrContext, GVRSceneObject owner)
    {
        super(gvrContext, owner);
        mChanged.set(true);
        mUniformDescriptor += " float inner_cone_angle; float outer_cone_angle; ";
        if (useShadowShader)
        {
            mUniformDescriptor += " float shadow_map_index; vec4 sm0; vec4 sm1; vec4 sm2; vec4 sm3";
            mVertexDescriptor = "vec4 shadow_position";
            if (fragmentShader == null)
                fragmentShader = TextFile.readTextFile(gvrContext.getContext(), R.raw.spotshadowlight);
            if (vertexShader == null)
                vertexShader = TextFile.readTextFile(gvrContext.getContext(), R.raw.vertex_shadow);
            mVertexShaderSource = vertexShader;
            setFloat("shadow_map_index", -1.0f);
        }
        else if (fragmentShader == null)
            fragmentShader = TextFile.readTextFile(gvrContext.getContext(), R.raw.spotlight);
        mFragmentShaderSource = fragmentShader;
        setInnerConeAngle(90.0f);
        setOuterConeAngle(90.0f);
    }

    public GVRSpotLight(GVRContext gvrContext)
    {
        this(gvrContext, null);
        mChanged.set(true);
    }

    /**
     * Get the inner angle of the spotlight cone in degrees.
     *
     * Inside the inner cone angle the light is at full intensity.
     * @see #setInnerConeAngle(float)
     * @see #setOuterConeAngle(float)
     */
    public float getInnerConeAngle()
    {
        return (float) Math.toDegrees(Math.acos(getFloat("inner_cone_angle")));
    }

    /**
     * Set the inner angle of the spotlight cone in degrees.
     *
     * Inside the inner cone angle the light is at full intensity.
     * The underlying uniform "inner_cone_angle" is the cosine
     * of this input angle. If the inner cone angle is larger than the outer cone angle
     * there will be unexpected results.
     * @see #getInnerConeAngle()
     * @see #getOuterConeAngle()
     */
    public void setInnerConeAngle(float angle)
    {
        setFloat("inner_cone_angle", (float) Math.cos(Math.toRadians(angle)));
    }

    /**
     * Get the outer angle of the spotlight cone in degrees.
     *
     * Beyond the outer cone angle there is no illumination.
     * @see #setInnerConeAngle(float)
     * @see #setOuterConeAngle(float)
     */
    public float getOuterConeAngle()
    {
        return (float) Math.toDegrees(Math.acos(getFloat("outer_cone_angle")));
    }

    /**
     * Set the inner angle of the spotlight cone in degrees.
     *
     * Beyond the outer cone angle there is no illumination.
     * The underlying uniform "outer_cone_angle" is the cosine
     * of this input angle. If the inner cone angle is larger than the outer cone angle
     * there will be unexpected results.
     * @see #setInnerConeAngle(float)
     * @see #getOuterConeAngle()
     */
    public void setOuterConeAngle(float angle)
    {
        setFloat("outer_cone_angle", (float) Math.cos(Math.toRadians(angle)));
        mChanged.set(true);
    }

    /**
     * Enables or disabled shadow casting for a spot light.
     * Enabling shadows attaches a GVRShadowMap component to the
     * GVRSceneObject which owns the light and provides the
     * component with an perspective camera for shadow casting.
     * @param enableFlag true to enable shadow casting, false to disable
     */
    public void setCastShadow(boolean enableFlag)
    {
        GVRSceneObject owner = getOwnerObject();

        if (owner != null)
        {
            GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType());
            if (enableFlag)
            {
                if (shadowMap != null)
                {
                    shadowMap.setEnable(true);
                }
                else
                {
                    float angle = (float) Math.acos(getFloat("outer_cone_angle")) * 2.0f;
                    GVRCamera shadowCam = GVRShadowMap.makePerspShadowCamera(getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), angle);
                    shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);
                    owner.attachComponent(shadowMap);
                }
                mChanged.set(true);
            }
            else if (shadowMap != null)
            {
                shadowMap.setEnable(false);
            }
        }
        mCastShadow = enableFlag;
    }

    /**
     * Sets the near and far range of the shadow map camera.
     * <p>
     * This function enables shadow mapping and sets the shadow map
     * camera near and far range, controlling which objects affect
     * the shadow map. To modify other properties of the shadow map
     * camera's projection, you can call {@link GVRShadowMap#getCamera}
     * and update them.
     * @param near near shadow camera clipping plane
     * @param far far shadow camera clipping plane
     * @see GVRShadowMap#getCamera()
     */
    public void setShadowRange(float near, float far)
    {
        GVRSceneObject owner = getOwnerObject();
        GVRPerspectiveCamera shadowCam = null;

        if (owner == null)
        {
            throw new UnsupportedOperationException("Light must have an owner to set the shadow range");
        }
        GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType());
        if (shadowMap != null)
        {
            shadowCam = (GVRPerspectiveCamera) shadowMap.getCamera();
            shadowCam.setNearClippingDistance(near);
            shadowCam.setFarClippingDistance(far);
            shadowMap.setEnable(true);
        }
        else
        {
            shadowCam = GVRShadowMap.makePerspShadowCamera(
                    getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), getOuterConeAngle());
            shadowCam.setNearClippingDistance(near);
            shadowCam.setFarClippingDistance(far);
            shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);
            owner.attachComponent(shadowMap);
        }
        mCastShadow = true;
    }

    /**
     * Updates the position, direction and shadow matrix
     * of this light from the transform of scene object that owns it.
     * The shadow matrix is the model/view/projection matrix
     * from the point of view of the light.
     */
    public void onDrawFrame(float frameTime)
    {
        if (!isEnabled() || (getFloat("enabled") <= 0.0f) || (owner == null)) { return; }
        Matrix4f worldmtx = owner.getTransform().getModelMatrix4f();
        boolean changed = mChanged.getAndSet(false);

        mNewDir.x = 0.0f;
        mNewDir.y = 0.0f;
        mNewDir.z = -1.0f;
        worldmtx.getTranslation(mNewPos);
        worldmtx.mul(mLightRot);
        worldmtx.transformDirection(mNewDir);
        mNewDir.normalize();
        if ((mOldDir.x != mNewDir.x) || (mOldDir.y != mNewDir.y) || (mOldDir.z != mNewDir.z))
        {
            changed = true;
            setVec3("world_direction", mNewDir.x, mNewDir.y, mNewDir.z);
            mOldDir.set(mNewDir);
            mChanged.set(false);
        }
        if ((mOldPos.x != mNewPos.x) || (mOldPos.y != mNewPos.y) || (mOldPos.z != mNewPos.z))
        {
            changed = true;
            setVec3("world_position", mNewPos.x, mNewPos.y, mNewPos.z);
            mOldPos.set(mNewPos);
            mChanged.set(false);
        }
        GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRShadowMap.getComponentType());
        if ((shadowMap != null) && changed && shadowMap.isEnabled())
        {
            shadowMap.setPerspShadowMatrix(worldmtx, this);
        }
    }
}


text:
package ljfa.glassshards;

import java.io.File;

import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class Config {
    public static Configuration conf;

    public static final String CATEGORY_GENERAL = "general";
    public static final String CATEGORY_CHISEL = "chisel";
    public static final String CATEGORY_TCONSTRUCT = "tconstruct";
    public static final String CATEGORY_MFR = "mfr";

    public static float shardsChance;
    public static float shardsFortuneChance;
    public static boolean recipesRecolor;
    public static boolean recipeUncolor;
    public static boolean renderTransparent;
    public static boolean enableSword;

    public static boolean chiselEnable;
    public static boolean chiselFixPaneDrops;

    public static boolean tinkersEnable;

    public static boolean mfrEnable;

    public static void loadConfig(File file) {
        if(conf == null)
            conf = new Configuration(file);

        conf.load();
        loadValues();

        FMLCommonHandler.instance().bus().register(new ChangeHandler());
    }

    public static void loadValues() {
        conf.getCategory(CATEGORY_GENERAL).setComment("General options");

        shardsChance = (float)conf.get(CATEGORY_GENERAL, "shardsChance", 0.66, "Base chance that a block of glass drops shards", 0.0, 1.0).getDouble();
        shardsFortuneChance = (float)conf.get(CATEGORY_GENERAL, "shardsFortuneChance", 0.08, "Chance per fortune level that a block of glass drops shards", 0.0, 1.0).getDouble();
        recipesRecolor = conf.get(CATEGORY_GENERAL, "recipesColor", true, "Add recipes for coloring shards").setRequiresMcRestart(true).getBoolean();
        recipeUncolor = conf.get(CATEGORY_GENERAL, "recipeUncolor", true, "Add recipe to remove the color from shards").setRequiresMcRestart(true).getBoolean();
        renderTransparent = conf.get(CATEGORY_GENERAL, "renderTransparent", true, "The shards will be transparent when lying on the ground or held in the hand (fancy graphics only)").setRequiresMcRestart(true).getBoolean();
        enableSword = conf.get(CATEGORY_GENERAL, "enableSword", true, "Enables the glass sword").setRequiresMcRestart(true).getBoolean();
        //----------------
        conf.getCategory(CATEGORY_CHISEL).setComment("Compatibility options for Chisel 2. Tested with version 2.2.1.");

        chiselEnable = conf.get(CATEGORY_CHISEL, "activate", true, "Activates compatibility if Chisel is present.\n"
                + "Note that not activating this even though Chisel is present might lead to unexpected behavior.\n"
                + "Deactivating this doesn't mean Chisel glass will not drop shards. The shards will just not be stained.").setRequiresMcRestart(true).getBoolean();
        chiselFixPaneDrops = conf.get(CATEGORY_CHISEL, "fixStainedPanesDrops", true,
                "By default, Chisel stained glass panes are behaving inconsistently as in they drop themselves\n"
                + "when broken, unlike all the other Chisel glass types.\n"
                + "This option changes this behavior and makes them drop shards instead.").getBoolean();
        //----------------
        conf.getCategory(CATEGORY_TCONSTRUCT).setComment("Compatibility options for Tinkers Construct. Tested with version 1.8.2a.");

        tinkersEnable = conf.get(CATEGORY_TCONSTRUCT, "activate", false, "Activates compatibility if Tinkers Construct is present.\n"
                + "This will make Clear Glass and Stained Glass drop shards rather than themselves.").setRequiresMcRestart(true).getBoolean();
        //----------------
        conf.getCategory(CATEGORY_MFR).setComment("Compatibility options for MineFactory Reloaded. Tested with version 2.8.0RC6-5.");

        mfrEnable = conf.get(CATEGORY_MFR, "activate", true, "Activates compatibility if MineFactory Reloaded is present.\n"
                + "When activated, stained glass blocks will drop stained shards.").setRequiresMcRestart(true).getBoolean();
        //----------------
        if(conf.hasChanged())
            conf.save();
    }

    /** Reloads the config values upon change */
    public static class ChangeHandler {
        @SubscribeEvent
        public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
            if(event.modID.equals(Reference.MODID))
                loadValues();
        }
    }
}


text:
#import "MXLRUCache.h"

@interface MXLRUCacheItem : NSObject

/**
 The item counter
 */
@property NSUInteger refCount;

/**
 The cached object
 */
@property NSObject* object;

/**
 The object key
 */
@property NSString* key;

@end

@implementation MXLRUCacheItem
@end

@interface MXLRUCache ()
{
    // the cached objects list
    // sorted by regCount
    NSMutableArray<MXLRUCacheItem *> *cachedObjects;

    // the cached objects keys
    NSMutableArray<NSString*> *cachedKeys;

    //
    NSUInteger capacity;
}
@end

@implementation MXLRUCache

- (id)initWithCapacity:(NSUInteger)aCapacity
{
    self = [super init];
    if (self)
    {
        capacity = aCapacity;
        cachedObjects = [[NSMutableArray alloc] initWithCapacity:capacity];
        cachedKeys = [[NSMutableArray alloc] initWithCapacity:capacity];
    }
    return self;
}

- (void)sortCachedItems
{
    cachedObjects = [[cachedObjects sortedArrayUsingComparator:^NSComparisonResult(id a, id b)
     {
         MXLRUCacheItem* item1 = (MXLRUCacheItem*)a;
         MXLRUCacheItem* item2 = (MXLRUCacheItem*)b;

         return item2.refCount - item1.refCount;
     }] mutableCopy];

    [cachedKeys removeAllObjects];

    for(MXLRUCacheItem* item in cachedObjects)
    {
        [cachedKeys addObject:item.key];
    }
}

/**
 Retrieve an object from its key.
 @param key the object key
 @return the cached object if it is found else nil
 */
- (NSObject*)get:(NSString*)key
{
    NSObject* object = nil;

    if (key)
    {
        @synchronized(cachedObjects)
        {
            NSUInteger pos = [cachedKeys indexOfObject:key];

            if (pos != NSNotFound)
            {
                MXLRUCacheItem* item = [cachedObjects objectAtIndex:pos];

                object = item.object;

                // update the count order
                item.refCount++;
                [self sortCachedItems];
            }
        }
    }

    return object;
}

/**
 Put an object from its key.
 @param key the object key
 @param object the object to store
 */
- (void)put:(NSString*)key object:(NSObject*)object
{
    if (key)
    {
        @synchronized(cachedObjects)
        {
            NSUInteger pos = [cachedKeys indexOfObject:key];

            if (pos == NSNotFound)
            {
                MXLRUCacheItem* item = [[MXLRUCacheItem alloc] init];

                item.object = object;
                item.refCount = 1;
                item.key = key;

                // remove the less used object
                if (cachedKeys.count >= capacity)
                {
                    [cachedObjects removeLastObject];
                    [cachedKeys removeLastObject];

                }

                [cachedObjects addObject:item];
                [cachedKeys addObject:key];
            }
            else
            {
                MXLRUCacheItem* item = [cachedObjects objectAtIndex:pos];
                item.object = object;
            }
        }
    }
}

/**
 Clear the LRU cache.
 */
- (void)clear
{
    @synchronized(cachedObjects)
    {
        [cachedObjects removeAllObjects];
        [cachedKeys removeAllObjects];
    }
}

@end


text:
package cn.elvea.platform.commons.oapis.feishu.config;

import cn.elvea.platform.commons.oapis.core.storage.ConfigStorage;

import java.util.concurrent.locks.Lock;

/**
 * @author elvea
 * @since 0.0.1
 */
public interface FeiShuConfigStorage extends ConfigStorage {

    String getAppId();

    void setAppId(String appId);

    String getAppSecret();

    void setAppSecret(String appSecret);

    void setBaseApiUrl(String baseUrl);

    String getApiUrl(String path);

    String getAccessToken();

    boolean isAccessTokenExpired();

    void expireAccessToken();

    void updateAccessToken(String accessToken, int expiresIn);

    Lock getAccessTokenLock();

    String getJsapiTicket();

    boolean isJsapiTicketExpired();

    void expireJsapiTicket();

    void updateJsapiTicket(String jsapiTicket, int expiresInSeconds);

    Lock getJsapiTicketLock();

}