text:
package org.springframework.cloud.function.adapter.azure;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.microsoft.azure.functions.ExecutionContext;
import com.microsoft.azure.functions.HttpMethod;
import com.microsoft.azure.functions.HttpRequestMessage;
import com.microsoft.azure.functions.HttpResponseMessage.Builder;
import com.microsoft.azure.functions.HttpStatus;
import com.microsoft.azure.functions.OutputBinding;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.cloud.function.context.FunctionCatalog;
import org.springframework.cloud.function.context.FunctionRegistration;
import org.springframework.cloud.function.context.FunctionRegistry;
import org.springframework.cloud.function.context.FunctionType;
import org.springframework.cloud.function.context.catalog.FunctionTypeUtils;
import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry;
import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper;
import org.springframework.cloud.function.context.config.FunctionContextUtils;
import org.springframework.cloud.function.context.config.JsonMessageConverter;
import org.springframework.cloud.function.context.config.SmartCompositeMessageConverter;
import org.springframework.cloud.function.json.JacksonMapper;
import org.springframework.cloud.function.json.JsonMapper;
import org.springframework.cloud.function.utils.FunctionClassUtils;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

/**
 * @param <I> input type
 * @param <O> result type
 * @author Oleg Zhurakousky
 * @since 3.2
 */
public class FunctionInvoker<I, O> {

	private static Log logger = LogFactory.getLog(FunctionInvoker.class);

	private static String EXECUTION_CONTEXT = "executionContext";

	private static FunctionCatalog FUNCTION_CATALOG;

	private static ConfigurableApplicationContext APPLICATION_CONTEXT;

	private final static Object LOCK = new Object();

	private static JsonMapper OBJECT_MAPPER;

	public FunctionInvoker(Class<?> configurationClass) {
		try {
			initialize(configurationClass);
		}
		catch (Exception e) {
			this.close();
			throw new IllegalStateException("Failed to initialize", e);
		}
	}

	public FunctionInvoker() {
		this(FunctionClassUtils.getStartClass());
	}

	public O handleRequest(ExecutionContext context) {
		return this.handleRequest(null, context);
	}

	public void close() {
		FUNCTION_CATALOG = null;
	}

	public void handleOutput(I input, OutputBinding<O> binding,
			ExecutionContext context) {
		O result = handleRequest(input, context);
		binding.setValue(result);
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public O handleRequest(I input, ExecutionContext executionContext) {
		String functionDefinition = executionContext.getFunctionName();
		FunctionInvocationWrapper function = FUNCTION_CATALOG.lookup(functionDefinition);
		if (function == null && StringUtils.hasText(functionDefinition) && APPLICATION_CONTEXT.containsBean(functionDefinition)) {
			this.registerFunction(functionDefinition);
			function = FUNCTION_CATALOG.lookup(functionDefinition);
		}
		Object enhancedInput = enhanceInputIfNecessary(input, executionContext);

		Object output = function.apply(enhancedInput);
		if (output instanceof Publisher && !function.isOutputTypePublisher()) {
			List resultList = new ArrayList<>();
			for (Object resultItem : Flux.from((Publisher) output).toIterable()) {
				if (resultItem instanceof Collection) {
					resultList.addAll((Collection) resultItem);
				}
				else {
					if (Collection.class.isAssignableFrom(FunctionTypeUtils.getRawType(function.getInputType()))
							&& !Collection.class.isAssignableFrom(FunctionTypeUtils.getRawType(function.getOutputType()))) {
						return (O) this.convertOutputIfNecessary(input, resultItem);
					}
					else {
						resultList.add(resultItem);
					}
				}
			}
			return (O) this.convertOutputIfNecessary(input, resultList);
		}
		return (O) this.convertOutputIfNecessary(input, output);
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	private void registerFunction(String functionDefinition) {
		FunctionRegistration functionRegistration =
				new FunctionRegistration(APPLICATION_CONTEXT.getBean(functionDefinition), functionDefinition);

		Type type = FunctionContextUtils.
				findType(functionDefinition, APPLICATION_CONTEXT.getBeanFactory());

		functionRegistration = functionRegistration.type(new FunctionType(type));

		((FunctionRegistry) FUNCTION_CATALOG).register(functionRegistration);
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	private Object enhanceInputIfNecessary(Object input, ExecutionContext executionContext) {
		if (input == null) { // Supplier
			return input;
		}
		if (input instanceof Publisher) {
			return Flux.from((Publisher) input).map(item -> {
				if (item instanceof Message) {
					return MessageBuilder.fromMessage((Message<I>) item)
							.setHeaderIfAbsent(EXECUTION_CONTEXT, executionContext).build();
				}
				else {
					return constructInputMessageFromItem(input, executionContext);
				}
			});
		}
		else if (input instanceof Message) {
			return MessageBuilder.fromMessage((Message<I>) input)
					.setHeaderIfAbsent(EXECUTION_CONTEXT, executionContext).build();
		}
		else if (input instanceof Iterable) {
			return Flux.fromIterable((Iterable) input).map(item -> {
				return constructInputMessageFromItem(item, executionContext);
			});
		}
		return constructInputMessageFromItem(input, executionContext);
	}

	@SuppressWarnings("unchecked")
	private Object convertOutputIfNecessary(Object input, Object output) {
		if (input instanceof HttpRequestMessage) {
			HttpRequestMessage<I> requestMessage = (HttpRequestMessage<I>) input;
			Map<String, Object> headers = null;
			if (output instanceof Message) {
				headers = ((Message<I>) output).getHeaders();
				output = ((Message<I>) output).getPayload();
			}
			Builder responseBuilder = requestMessage.createResponseBuilder(HttpStatus.OK).body(output);
			if (headers != null) {
				for (Entry<String, Object> headersEntry : headers.entrySet()) {
					if (headersEntry.getValue() != null) {
						responseBuilder.header(headersEntry.getKey(), headersEntry.getValue().toString());
					}
				}
			}
			return responseBuilder.build();
		}
		return output;
	}

	@SuppressWarnings("unchecked")
	private Message<?> constructInputMessageFromItem(Object input, ExecutionContext executionContext) {
		MessageBuilder<?> messageBuilder = null;
		if (input instanceof HttpRequestMessage) {
			HttpRequestMessage<I> requestMessage = (HttpRequestMessage<I>) input;
			Object payload = requestMessage.getHttpMethod() != null && requestMessage.getHttpMethod().equals(HttpMethod.GET)
					? requestMessage.getQueryParameters()
							: requestMessage.getBody();

			if (payload == null) {
				payload = Optional.empty();
			}
			messageBuilder = MessageBuilder.withPayload(payload).copyHeaders(this.getHeaders(requestMessage));
		}
		else {
			messageBuilder = MessageBuilder.withPayload(input);
		}
		return messageBuilder.setHeaderIfAbsent(EXECUTION_CONTEXT, executionContext).build();
	}

	private MessageHeaders getHeaders(HttpRequestMessage<I> event) {
		Map<String, Object> headers = new HashMap<String, Object>();

		if (event.getHeaders() != null) {
			headers.putAll(event.getHeaders());
		}
		if (event.getQueryParameters() != null) {
			headers.putAll(event.getQueryParameters());
		}
		if (event.getUri() != null) {
			headers.put("path", event.getUri().getPath());
		}

		if (event.getHttpMethod() != null) {
			headers.put("httpMethod", event.getHttpMethod().toString());
		}

		headers.put("request", event.getBody());
		return new MessageHeaders(headers);
	}

	private static void initialize(Class<?> configurationClass) {
		synchronized (LOCK) {
			if (FUNCTION_CATALOG == null) {
				logger.info("Initializing: " + configurationClass);
				SpringApplication builder = springApplication(configurationClass);
				APPLICATION_CONTEXT = builder.run();

				Map<String, FunctionCatalog> mf = APPLICATION_CONTEXT.getBeansOfType(FunctionCatalog.class);
				if (CollectionUtils.isEmpty(mf)) {
					OBJECT_MAPPER = new JacksonMapper(new ObjectMapper());
					JsonMessageConverter jsonConverter = new JsonMessageConverter(OBJECT_MAPPER);
					SmartCompositeMessageConverter messageConverter = new SmartCompositeMessageConverter(Collections.singletonList(jsonConverter));
					FUNCTION_CATALOG = new SimpleFunctionRegistry(APPLICATION_CONTEXT.getBeanFactory().getConversionService(),
							messageConverter, OBJECT_MAPPER);
				}
				else {
					OBJECT_MAPPER = APPLICATION_CONTEXT.getBean(JsonMapper.class);
					FUNCTION_CATALOG = mf.values().iterator().next();
				}
			}
		}

	}

	private static SpringApplication springApplication(Class<?> configurationClass) {
		SpringApplication application = new org.springframework.cloud.function.context.FunctionalSpringApplication(
				configurationClass);
		application.setWebApplicationType(WebApplicationType.NONE);
		return application;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".activities.variables.editor.VariableEditorActivity">

    <include layout="@layout/toolbar_layout" />

    <androidx.core.widget.NestedScrollView
        android:id="@+id/main_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:animateLayoutChanges="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:orientation="vertical"
            android:paddingStart="16dp"
            android:paddingEnd="16dp"
            android:paddingBottom="10dp">

            <TextView
                style="@style/SubHeader"
                android:text="@string/section_basic_variable_settings" />

            <TextView
                style="@style/Label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/label_variable_name" />

            <EditText
                android:id="@+id/input_variable_key"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textNoSuggestions"
                android:maxLength="30"
                android:maxLines="1" />

            <LinearLayout
                android:id="@+id/dialog_title_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone">

                <TextView
                    style="@style/Label"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/label_variable_title" />

                <EditText
                    android:id="@+id/input_variable_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textNoSuggestions"
                    android:maxLength="20"
                    android:maxLines="1" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/dialog_message_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:visibility="gone">

                <TextView
                    style="@style/Label"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/label_variable_text" />

                <EditText
                    android:id="@+id/input_variable_message"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textMultiLine|textNoSuggestions"
                    android:maxLength="200"
                    android:maxLines="3" />

            </LinearLayout>

            <FrameLayout
                android:id="@+id/variable_type_fragment_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                style="@style/SubHeader"
                android:text="@string/section_advanced_settings" />

            <CheckBox
                android:id="@+id/input_url_encode"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/label_url_encode" />

            <TextView
                style="@style/InfoLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/message_url_encode_instructions" />

            <CheckBox
                android:id="@+id/input_json_encode"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/label_json_encode" />

            <TextView
                style="@style/InfoLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/message_json_encode_instructions" />

            <CheckBox
                android:id="@+id/input_allow_share"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/label_allow_share_into" />

            <TextView
                style="@style/InfoLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/message_allow_share_instructions" />

            <ch.rmy.android.framework.ui.views.LabelledSpinner
                android:id="@+id/input_share_support"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:text="@string/label_share_support" />

        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

    <include
        android:id="@+id/loading_indicator"
        layout="@layout/loading_indicator"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

redpajama_set_name: RedPajamaGithub


text:
package org.cloudcmp.tasks.store;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.cloudcmp.Adaptor;

public class QueueGetTask extends StoreTask {
	private int queueSize;
	private String queueName;

	public QueueGetTask(Adaptor adaptor) {
		super(adaptor);
		configs.put("queue_size", "100");
		// TODO Auto-generated constructor stub
	}

	public List<String> getConfigItems() {
		List<String> items = super.getConfigItems();
		items.add("queue_size");
		return items;
	}

	public String getTaskName() {
		return "queueget";
	}

	public boolean requiresQueueStore() {
		return true;
	}

	public Map<String, String> run() {
		Map<String, String> results = new HashMap<String, String>();
		queueSize = Integer.parseInt(configs.get("queue_size"));
		if (queueSize <= 0) {
			results.put("exception", "wrong queue_size value");
			return results;
		}

		queueName = "queue" + String.valueOf(queueSize);
		try {
			long startTime = System.nanoTime();
			adaptor.queueGetMessage(queueName);
			long endTime = System.nanoTime();
			results.put("time", String.valueOf((endTime - startTime) / 1000));
			results.put("cost", String.valueOf(adaptor.getLastOperationCost()));
			adaptor.queueDeleteLastMessage(queueName);
		}
		catch (IOException e) {
			results.put("exception", "IOException: " + e.getMessage());
		}
		return results;
	}
}


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

using DataStructures.Common;

namespace DataStructures.Trees
{
    /// <summary>
    /// Binary Search Tree node.
    /// This node extends the vanilla BSTNode class and adds an extra field to it for augmentation.
    /// The BST now augments the subtree-sizes on insert, delete and get-height.
    /// </summary>

    public class BSTRankedNode<T> : BSTNode<T> where T : IComparable<T>
    {
        private int _subtreeSize = 0;

        public BSTRankedNode() : this(default(T), 0, null, null, null) { }
        public BSTRankedNode(T value) : this(value, 0, null, null, null) { }
        public BSTRankedNode(T value, int subtreeSize, BSTRankedNode<T> parent, BSTRankedNode<T> left, BSTRankedNode<T> right)
        {
            base.Value = value;
            SubtreeSize = subtreeSize;
            Parent = parent;
            LeftChild = left;
            RightChild = right;
        }

        // Size of subtrees
        public virtual int SubtreeSize
        {
            get { return this._subtreeSize; }
            set { this._subtreeSize = value; }
        }

        public new BSTRankedNode<T> Parent
        {
            get { return (BSTRankedNode<T>)base.Parent; }
            set { base.Parent = value; }
        }

        public new BSTRankedNode<T> LeftChild
        {
            get { return (BSTRankedNode<T>)base.LeftChild; }
            set { base.LeftChild = value; }
        }

        public new BSTRankedNode<T> RightChild
        {
            get { return (BSTRankedNode<T>)base.RightChild; }
            set { base.RightChild = value; }
        }
    }

    /******************************************************************************/

    /// <summary>
    /// Binary Search Tree Data Structure.
    /// This is teh augmented version of BST. It is augmented to keep track of the nodes subtrees-sizes.
    /// </summary>

    public class AugmentedBinarySearchTree<T> : BinarySearchTree<T> where T : IComparable<T>
    {
        /// <summary>
        /// TREE INSTANCE VARIABLES
        /// </summary>

        // Casted-root getter and setter
        public new BSTRankedNode<T> Root
        {
            get { return (BSTRankedNode<T>)base.Root; }
            set { base.Root = value; }
        }

        public AugmentedBinarySearchTree() : base() { }

        /// <summary>
        /// Returns the Subtrees size for a tree node if node exists; otherwise 0 (left and right nodes of leafs).
        /// This is used in the recursive function UpdateSubtreeSize.
        /// </summary>
        /// <returns>The size.</returns>
        /// <param name="node">BST Node.</param>
        protected int _subtreeSize(BSTRankedNode<T> node)
        {
            if (node == null)
                return 0;
            else
                return node.SubtreeSize;
        }

        /// <summary>
        /// Updates the Subtree Size of a tree node.
        /// Used in recusively calculating the Subtrees Sizes of nodes.
        /// </summary>
        /// <param name="node">BST Node.</param>
        protected void _updateSubtreeSize(BSTRankedNode<T> node)
        {
            if (node == null)
                return;

            node.SubtreeSize = _subtreeSize(node.LeftChild) + _subtreeSize(node.RightChild) + 1;

            _updateSubtreeSize(node.Parent);
        }

        /// <summary>
        /// Remove the specified node.
        /// </summary>
        /// <param name="node">Node.</param>
        /// <returns>>True if removed successfully; false if node wasn't found.</returns>
        protected bool _remove(BSTRankedNode<T> node)
        {
            if (node == null)
                return false;

            var parent = node.Parent;

            if (node.ChildrenCount == 2) // if both children are present
            {
                var successor = node.RightChild;
                node.Value = successor.Value;
                return (true && _remove(successor));
            }
            else if (node.HasLeftChild) // if the node has only a LEFT child
            {
                base._replaceNodeInParent(node, node.LeftChild);
                _updateSubtreeSize(parent);
                _count--;

            }
            else if (node.HasRightChild) // if the node has only a RIGHT child
            {
                base._replaceNodeInParent(node, node.RightChild);
                _updateSubtreeSize(parent);
                _count--;
            }
            else //this node has no children
            {
                base._replaceNodeInParent(node, null);
                _updateSubtreeSize(parent);
                _count--;
            }

            return true;
        }

        /// <summary>
        /// Calculates the tree height from a specific node, recursively.
        /// </summary>
        /// <param name="node">Node</param>
        /// <returns>Height of node's longest subtree</returns>
        protected int _getTreeHeight(BSTRankedNode<T> node)
        {
            if (node == null || node.HasChildren == false)
                return 0;

            if (node.ChildrenCount == 2) // it has both a right child and a left child
            {
                if (node.LeftChild.SubtreeSize > node.RightChild.SubtreeSize)
                    return (1 + _getTreeHeight(node.LeftChild));
                else
                    return (1 + _getTreeHeight(node.RightChild));
            }
            else if (node.HasLeftChild)
            {
                return (1 + _getTreeHeight(node.LeftChild));
            }
            else if (node.HasRightChild)
            {
                return (1 + _getTreeHeight(node.RightChild));
            }

            // return-functions-fix
            return 0;
        }

        /// <summary>
        /// Returns the height of the tree.
        /// </summary>
        /// <returns>Hight</returns>
        public override int Height()
        {
            if (IsEmpty())
                return 0;

            var currentNode = this.Root;
            return this._getTreeHeight(currentNode);
        }

        /// <summary>
        /// Inserts an element to the tree
        /// </summary>
        /// <param name="item">Item to insert</param>
        public override void Insert(T item)
        {
            var newNode = new BSTRankedNode<T>(item);

            // Insert node recursively starting from the root.
            // Handles increasing the Count of elements
            base._insertNode(newNode);

            // Update the subtree-size for the newNode's parent.
            _updateSubtreeSize(newNode.Parent);
        }

        /// <summary>
        /// Inserts an array of elements to the tree.
        /// </summary>
        public override void Insert(T[] collection)
        {
            if (collection == null)
                throw new ArgumentNullException();

            if (collection.Length > 0)
            {
                for (int i = 0; i < collection.Length; ++i)
                {
                    this.Insert(collection[i]);
                }
            }
        }

        /// <summary>
        /// Inserts a list of elements to the tree.
        /// </summary>
        public override void Insert(List<T> collection)
        {
            if (collection == null)
                throw new ArgumentNullException();

            if (collection.Count > 0)
            {
                for (int i = 0; i < collection.Count; ++i)
                {
                    this.Insert(collection[i]);
                }
            }
        }

        /// <summary>
        /// Deletes an element from the tree
        /// </summary>
        /// <param name="item">item to remove.</param>
        public override void Remove(T item)
        {
            if (IsEmpty())
                throw new Exception("Tree is empty.");

            var node = (BSTRankedNode<T>)base._findNode(this.Root, item);
            bool status = _remove(node);
            this._updateSubtreeSize(node.Parent);

            // If the element was found, remove it.
            if (status == false)
                throw new Exception("Item was not found.");
        }

        /// <summary>
        /// Removes the min value from tree.
        /// </summary>
        public override void RemoveMin()
        {
            if (IsEmpty())
                throw new Exception("Tree is empty.");

            var node = (BSTRankedNode<T>)_findMinNode(this.Root);
            var parent = node.Parent;
            this._remove(node);

            // Update the subtrees-sizes
            this._updateSubtreeSize(parent);
        }

        /// <summary>
        /// Removes the max value from tree.
        /// </summary>
        public override void RemoveMax()
        {
            if (IsEmpty())
                throw new Exception("Tree is empty.");

            var node = (BSTRankedNode<T>)_findMaxNode(this.Root);
            var parent = node.Parent;
            this._remove(node);

            // Update the subtrees-sizes
            this._updateSubtreeSize(parent);
        }

        /// <summary>
        /// Returns the rank of the specified element
        /// </summary>
        /// <param name="item">Tree element</param>
        /// <returns>Rank(item) if found; otherwise throws an exception.</returns>
        public virtual int Rank(T item)
        {
            var node = (BSTRankedNode<T>)base._findNode(this.Root, item);

            if (node == null)
                throw new Exception("Item was not found.");
            else
                return (this._subtreeSize(node.LeftChild) + 1);
        }

    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VVVV.PluginInterfaces.V2;
using BulletSharp;
using VVVV.Utils.VMath;
using BulletSharp.SoftBody;

namespace VVVV.Nodes.Bullet
{
	[PluginInfo(Name = "AppendAnchor", Category = "Bullet", Author = "vux",
		Help = "Pins a soft body node to a rigid body", AutoEvaluate = true)]
	public class BulletAppendAnchorNode : AbstractBodyInteractionNode<RigidBody>
	{
		[Input("Soft Body")]
        protected ISpread<SoftBody> FSoft;

		[Input("Node Index")]
        protected ISpread<int> FNodeIndex;

		[Input("Collide Connected")]
        protected ISpread<bool> FCollide;

		protected override void ProcessObject(RigidBody obj, int slice)
		{
			SoftBody sb = this.FSoft[slice];
			this.FSoft[slice].AppendAnchor(this.FNodeIndex[slice] % sb.Nodes.Count, obj, FCollide[slice]);
		}
	}
}


text:
package com.github.jengelman.gradle.plugins.shadow.tasks;

import com.github.jengelman.gradle.plugins.shadow.ShadowStats;
import com.github.jengelman.gradle.plugins.shadow.internal.*;
import com.github.jengelman.gradle.plugins.shadow.relocation.CacheableRelocator;
import com.github.jengelman.gradle.plugins.shadow.relocation.Relocator;
import com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator;
import com.github.jengelman.gradle.plugins.shadow.transformers.*;
import org.gradle.api.Action;
import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.file.ConfigurableFileCollection;
import org.gradle.api.file.DuplicatesStrategy;
import org.gradle.api.file.FileCollection;
import org.gradle.api.internal.DocumentationRegistry;
import org.gradle.api.internal.file.FileResolver;
import org.gradle.api.internal.file.copy.CopyAction;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.*;
import org.gradle.api.tasks.bundling.Jar;
import org.gradle.api.tasks.util.PatternSet;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

@CacheableTask
public class ShadowJar extends Jar implements ShadowSpec {

    private List<Transformer> transformers;
    private List<Relocator> relocators;
    private List<FileCollection> configurations;
    private transient DependencyFilter dependencyFilter;

    private boolean minimizeJar;
    private transient DependencyFilter dependencyFilterForMinimize;
    private FileCollection toMinimize;
    private FileCollection apiJars;
    private FileCollection sourceSetsClassesDirs;

    private final ShadowStats shadowStats = new ShadowStats();
    private final GradleVersionUtil versionUtil;

    private final ConfigurableFileCollection includedDependencies = getProject().files(new Callable<FileCollection>() {

        @Override
        public FileCollection call() throws Exception {
            return dependencyFilter.resolve(configurations);
        }
    });

    public ShadowJar() {
        super();
        setDuplicatesStrategy(DuplicatesStrategy.INCLUDE); //shadow filters out files later. This was the default behavior in  Gradle < 6.x
        versionUtil = new GradleVersionUtil(getProject().getGradle().getGradleVersion());
        dependencyFilter = new DefaultDependencyFilter(getProject());
        dependencyFilterForMinimize = new MinimizeDependencyFilter(getProject());
        setManifest(new DefaultInheritManifest(getServices().get(FileResolver.class)));
        transformers = new ArrayList<>();
        relocators = new ArrayList<>();
        configurations = new ArrayList<>();

        this.getInputs().property("minimize", new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                return minimizeJar;
            }
        });
        this.getOutputs().doNotCacheIf("Has one or more transforms or relocators that are not cacheable", new Spec<Task>() {
            @Override
            public boolean isSatisfiedBy(Task task) {
                for (Transformer transformer : transformers) {
                    if (!isCacheableTransform(transformer.getClass())) {
                        return true;
                    }
                }
                for (Relocator relocator : relocators) {
                    if (!isCacheableRelocator(relocator.getClass())) {
                        return true;
                    }
                }
                return false;
            }
        });
    }

    public ShadowJar minimize() {
        minimizeJar = true;
        return this;
    }

    public ShadowJar minimize(Action<DependencyFilter> c) {
        minimize();
        if (c != null) {
            c.execute(dependencyFilterForMinimize);
        }
        return this;
    }

    @Override
    @Internal
    public ShadowStats getStats() {
        return shadowStats;
    }

    @Override
    public InheritManifest getManifest() {
        return (InheritManifest) super.getManifest();
    }

    @Override
    protected CopyAction createCopyAction() {
        DocumentationRegistry documentationRegistry = getServices().get(DocumentationRegistry.class);
        final UnusedTracker unusedTracker = minimizeJar ? UnusedTracker.forProject(getApiJars(), getSourceSetsClassesDirs().getFiles(), getToMinimize()) : null;
        return new ShadowCopyAction(getArchiveFile().get().getAsFile(), getInternalCompressor(), documentationRegistry,
                this.getMetadataCharset(), transformers, relocators, getRootPatternSet(), shadowStats,
                versionUtil, isPreserveFileTimestamps(), minimizeJar, unusedTracker);
    }

    @Classpath
    FileCollection getToMinimize() {
        if (toMinimize == null) {
            toMinimize = minimizeJar
                    ? dependencyFilterForMinimize.resolve(configurations).minus(getApiJars())
                    : getProject().getObjects().fileCollection();
        }
        return toMinimize;
    }

    @Classpath
    FileCollection getApiJars() {
        if (apiJars == null) {
            apiJars = minimizeJar
                    ? UnusedTracker.getApiJarsFromProject(getProject())
                    : getProject().getObjects().fileCollection();
        }
        return apiJars;
    }

    @InputFiles
    @PathSensitive(PathSensitivity.RELATIVE)
    FileCollection getSourceSetsClassesDirs() {
        if (sourceSetsClassesDirs == null) {
            ConfigurableFileCollection allClassesDirs = getProject().getObjects().fileCollection();
            if (minimizeJar) {
                for (SourceSet sourceSet : getProject().getExtensions().getByType(SourceSetContainer.class)) {
                    FileCollection classesDirs = sourceSet.getOutput().getClassesDirs();
                    allClassesDirs.from(classesDirs);
                }
            }
            sourceSetsClassesDirs = allClassesDirs.filter(new Spec<File>() {
                @Override
                public boolean isSatisfiedBy(File file) {
                    return file.isDirectory();
                }
            });
        }
        return sourceSetsClassesDirs;
    }

    @Internal
    protected ZipCompressor getInternalCompressor() {
        return versionUtil.getInternalCompressor(getEntryCompression(), this);
    }

    @TaskAction
    protected void copy() {
        from(getIncludedDependencies());
        super.copy();
        getLogger().info(shadowStats.toString());
    }

    @Classpath
    public FileCollection getIncludedDependencies() {
        return includedDependencies;
    }

    /**
     * Utility method for assisting between changes in Gradle 1.12 and 2.x.
     *
     * @return this
     */
    @Internal
    protected PatternSet getRootPatternSet() {
        return versionUtil.getRootPatternSet(getMainSpec());
    }

    /**
     * Configure inclusion/exclusion of module and project dependencies into uber jar.
     *
     * @param c the configuration of the filter
     * @return this
     */
    public ShadowJar dependencies(Action<DependencyFilter> c) {
        if (c != null) {
            c.execute(dependencyFilter);
        }
        return this;
    }

    /**
     * Add a Transformer instance for modifying JAR resources and configure.
     *
     * @param clazz the transformer to add. Must have a no-arg constructor
     * @return this
     */
    public ShadowJar transform(Class<? extends Transformer> clazz) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        return transform(clazz, null);
    }

    /**
     * Add a Transformer instance for modifying JAR resources and configure.
     *
     * @param clazz the transformer class to add. Must have no-arg constructor
     * @param c the configuration for the transformer
     * @return this
     */
    public <T extends Transformer> ShadowJar transform(Class<T> clazz, Action<T> c) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        T transformer = clazz.getDeclaredConstructor().newInstance();
        addTransform(transformer, c);
        return this;
    }

    private boolean isCacheableTransform(Class<? extends Transformer> clazz) {
        return clazz.isAnnotationPresent(CacheableTransformer.class);
    }

    /**
     * Add a preconfigured transformer instance.
     *
     * @param transformer the transformer instance to add
     * @return this
     */
    public ShadowJar transform(Transformer transformer) {
        addTransform(transformer, null);
        return this;
    }

    private <T extends Transformer> void addTransform(T transformer, Action<T> c) {
        if (c != null) {
            c.execute(transformer);
        }

        transformers.add(transformer);
    }

    /**
     * Syntactic sugar for merging service files in JARs.
     *
     * @return this
     */
    public ShadowJar mergeServiceFiles() {
        try {
            transform(ServiceFileTransformer.class);
        } catch (IllegalAccessException e) {
        } catch (InstantiationException e) {
        } catch (NoSuchMethodException e) {
        } catch (InvocationTargetException e) {
        }
        return this;
    }

    /**
     * Syntactic sugar for merging service files in JARs.
     *
     * @return this
     */
    public ShadowJar mergeServiceFiles(final String rootPath) {
        try {
            transform(ServiceFileTransformer.class, new Action<ServiceFileTransformer>() {

                @Override
                public void execute(ServiceFileTransformer serviceFileTransformer) {
                    serviceFileTransformer.setPath(rootPath);
                }
            });
        } catch (IllegalAccessException e) {
        } catch (InstantiationException e) {
        } catch (NoSuchMethodException e) {
        } catch (InvocationTargetException e) {
        }
        return this;
    }

    /**
     * Syntactic sugar for merging service files in JARs.
     *
     * @return this
     */
    public ShadowJar mergeServiceFiles(Action<ServiceFileTransformer> configureClosure) {
        try {
            transform(ServiceFileTransformer.class, configureClosure);
        } catch (IllegalAccessException e) {
        } catch (InstantiationException e) {
        } catch (NoSuchMethodException e) {
        } catch (InvocationTargetException e) {
        }
        return this;
    }

    /**
     * Syntactic sugar for merging Groovy extension module descriptor files in JARs
     *
     * @return this
     */
    public ShadowJar mergeGroovyExtensionModules() {
        try {
            transform(GroovyExtensionModuleTransformer.class);
        } catch (IllegalAccessException e) {
        } catch (InstantiationException e) {
        } catch (NoSuchMethodException e) {
        } catch (InvocationTargetException e) {
        }
        return this;
    }

    /**
     * Syntax sugar for merging service files in JARs
     *
     * @return this
     */
    public ShadowJar append(final String resourcePath) {
        try {
            transform(AppendingTransformer.class, new Action<AppendingTransformer>() {
                @Override
                public void execute(AppendingTransformer transformer) {
                    transformer.setResource(resourcePath);
                }
            });
        } catch (IllegalAccessException e) {
        } catch (InstantiationException e) {
        } catch (NoSuchMethodException e) {
        } catch (InvocationTargetException e) {
        }
        return this;
    }

    /**
     * Add a class relocator that maps each class in the pattern to the provided destination.
     *
     * @param pattern the source pattern to relocate
     * @param destination the destination package
     * @return this
     */
    public ShadowJar relocate(String pattern, String destination) {
        return relocate(pattern, destination, null);
    }

    /**
     * Add a class relocator that maps each class in the pattern to the provided destination.
     *
     * @param pattern the source pattern to relocate
     * @param destination the destination package
     * @param configure the configuration of the relocator
     * @return this
     */
    public ShadowJar relocate(String pattern, String destination, Action<SimpleRelocator> configure) {
        SimpleRelocator relocator = new SimpleRelocator(pattern, destination, new ArrayList<String>(), new ArrayList<String>());
        addRelocator(relocator, configure);
        return this;
    }

    /**
     * Add a relocator instance.
     *
     * @param relocator the relocator instance to add
     * @return this
     */
    public ShadowJar relocate(Relocator relocator) {
        addRelocator(relocator, null);
        return this;
    }

    /**
     * Add a relocator of the provided class.
     *
     * @param relocatorClass the relocator class to add. Must have a no-arg constructor.
     * @return this
     */
    public ShadowJar relocate(Class<? extends Relocator> relocatorClass) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        return relocate(relocatorClass, null);
    }

    private <R extends Relocator> void addRelocator(R relocator, Action<R> configure) {
        if (configure != null) {
            configure.execute(relocator);
        }

        relocators.add(relocator);
    }

    /**
     * Add a relocator of the provided class and configure.
     *
     * @param relocatorClass the relocator class to add. Must have a no-arg constructor
     * @param configure the configuration for the relocator
     * @return this
     */
    public <R extends Relocator> ShadowJar relocate(Class<R> relocatorClass, Action<R> configure) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        R relocator = relocatorClass.getDeclaredConstructor().newInstance();
        addRelocator(relocator, configure);
        return this;
    }

    private boolean isCacheableRelocator(Class<? extends Relocator> relocatorClass) {
        return relocatorClass.isAnnotationPresent(CacheableRelocator.class);
    }

    @Nested
    public List<Transformer> getTransformers() {
        return this.transformers;
    }

    public void setTransformers(List<Transformer> transformers) {
        this.transformers = transformers;
    }

    @Nested
    public List<Relocator> getRelocators() {
        return this.relocators;
    }

    public void setRelocators(List<Relocator> relocators) {
        this.relocators = relocators;
    }

    @Classpath @Optional
    public List<FileCollection> getConfigurations() {
        return this.configurations;
    }

    public void setConfigurations(List<FileCollection> configurations) {
        this.configurations = configurations;
    }

    @Internal
    public DependencyFilter getDependencyFilter() {
        return this.dependencyFilter;
    }

    public void setDependencyFilter(DependencyFilter filter) {
        this.dependencyFilter = filter;
    }
}


text:
<?php

namespace ONGR\ElasticsearchBundle\DependencyInjection;

use Psr\Log\LogLevel;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;

/**
 * This is the class that validates and merges configuration from app/config files.
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('ongr_elasticsearch');

        $rootNode
            ->children()
                ->scalarNode('document_dir')
                    ->info("Sets directory name from which documents will be loaded from bundles.'Document' by default")
                    ->defaultValue('Document')
                ->end()
                ->append($this->getConnectionsNode())
                ->append($this->getManagersNode())
            ->end();

        return $treeBuilder;
    }

    /**
     * Connections configuration node.
     *
     * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition
     *
     * @throws InvalidConfigurationException
     */
    private function getConnectionsNode()
    {
        $builder = new TreeBuilder();
        $node = $builder->root('connections');

        $node
            ->isRequired()
            ->requiresAtLeastOneElement()
            ->info('Defines connections to indexes and its settings.')
            ->prototype('array')
                ->children()
                    ->arrayNode('hosts')
                        ->info('Defines hosts to connect to.')
                        ->requiresAtLeastOneElement()
                        ->defaultValue(['127.0.0.1:9200'])
                        ->prototype('scalar')
                            ->beforeNormalization()
                                ->ifArray()
                                ->then(
                                    function ($value) {
                                        if (!array_key_exists('host', $value)) {
                                            throw new InvalidConfigurationException(
                                                'Host must be configured under hosts configuration tree.'
                                            );
                                        }

                                        return $value['host'];
                                    }
                                )
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('auth')
                        ->info('holds information for http authentication.')
                        ->children()
                            ->scalarNode('username')
                                ->isRequired()
                                ->example('john')
                            ->end()
                            ->scalarNode('password')
                                ->isRequired()
                                ->example('mytopsecretpassword')
                            ->end()
                            ->scalarNode('option')
                                ->defaultValue('Basic')
                                ->info('authentication type')
                            ->end()
                        ->end()
                    ->end()
                    ->scalarNode('index_name')
                        ->isRequired()
                        ->info('Sets index name for connection.')
                    ->end()
                    ->arrayNode('settings')
                        ->defaultValue([])
                        ->info('Sets index settings for connection.')
                        ->prototype('variable')->end()
                    ->end()
                ->end()
            ->end();

        return $node;
    }

    /**
     * Managers configuration node.
     *
     * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition
     */
    private function getManagersNode()
    {
        $builder = new TreeBuilder();
        $node = $builder->root('managers');

        $node
            ->isRequired()
            ->requiresAtLeastOneElement()
            ->info('Maps managers to connections and bundles')
            ->prototype('array')
                ->children()
                    ->scalarNode('connection')
                        ->isRequired()
                        ->info('Sets connection for manager.')
                    ->end()
                    ->arrayNode('debug')
                        ->info('Enables logging')
                        ->addDefaultsIfNotSet()
                        ->beforeNormalization()
                            ->ifTrue(
                                function ($v) {
                                    return is_bool($v);
                                }
                            )
                            ->then(
                                function ($v) {
                                    return ['enabled' => $v];
                                }
                            )
                        ->end()
                        ->children()
                            ->booleanNode('enabled')
                                ->info('enables logging')
                                ->defaultFalse()
                            ->end()
                            ->scalarNode('level')
                                ->info('Sets psr logging level')
                                ->defaultValue(LogLevel::WARNING)
                                ->validate()
                                ->ifNotInArray((new \ReflectionClass('Psr\Log\LogLevel'))->getConstants())
                                    ->thenInvalid('Invalid Psr log level.')
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                    ->booleanNode('readonly')
                        ->info('Sets manager to read only state.')
                        ->defaultFalse()
                    ->end()
                    ->arrayNode('mappings')
                        ->info('Maps manager to bundles. f.e. AcmeDemoBundle')
                        ->prototype('scalar')->end()
                    ->end()
                ->end()
            ->end();

        return $node;
    }
}


text:
casacontrol.py
==============

A small python library that allows to communicate with the Casa Control system http://www.casacontrol.info/

usage
-----

```
from casacontrol import CasaControl

# sn is the serial number of the base station
c = CasaControl("192.168.0.123", sn="023456789000")

p = c.PowerPlug(0)

# Now press the button on the device until it starts to blink
p.pair()

p.on()
p.off()
```


text:
cask 'sqlectron' do
  version '1.5.0'
  sha256 'f5c2960cdbec32c8c8d4803b1d09e01be9e75ac1169030c3eac99b7d25e02fec'

  # github.com/sqlectron/sqlectron-gui was verified as official when first introduced to the cask
  url "https://github.com/sqlectron/sqlectron-gui/releases/download/v#{version}/Sqlectron-darwin-x64.zip"
  appcast 'https://github.com/sqlectron/sqlectron-gui/releases.atom',
          checkpoint: 'a81a8512c35464dc1c1167fd27a15fa561251c88f7a991ef097f2d150f821eec'
  name 'Sqlectron'
  homepage 'https://sqlectron.github.io/'
  license :mit

  depends_on macos: '>= :mountain_lion'
  container nested: 'Sqlectron.dmg'

  app 'Sqlectron.app'

  postflight do
    suppress_move_to_applications
  end

  zap delete: [
                '~/.sqlectron.json',
                '~/Library/Application Support/Sqlectron',
              ]
end


text:
var KanaRow = Backbone.Model.extend({
    getStatus: function(){
        var q = this.get('row')[0];
        if (q.locked) {
            return 'locked';
        }
        else if (q.score){
            return 'unlocked';
        }
        else{
            return 'pristine';
        }
    },
    lock: function(){
        _.forEach(this.get('row'), function(q){
            q.locked = true;
        });
    },
    unlock: function(){
        _.forEach(this.get('row'), function(q){
            q.locked = false;
            if(!q.score){
                q.score = {correct: 0, incorrect: 0};
            }
        });
    },
    reset: function(){
        _.forEach(this.get('row'), function(q){
            q.locked = false;
            q.score = undefined;
        });
    }
});

var KanaRowCollection = Backbone.Collection.extend({
    model: KanaRow
});

module.exports = {
    KanaRow: KanaRow,
    KanaRowCollection: KanaRowCollection
};


text:
layout: post
title: Happy Pi Day
---

Welcome to Release Notes. Please come back for more information.