text:
@implementation Message (CoreDataProperties)

@dynamic name;
@dynamic title;
@dynamic content;
@dynamic belong;
@dynamic time;

@end


text:
/*
 * To change this template, choose Tools | Templates and open the template in the editor.
 */
package com.blazebit.security.web.bean.main.user;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.apache.commons.lang3.ArrayUtils;
import org.primefaces.event.FlowEvent;
import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;

import com.blazebit.security.PermissionUtils;
import com.blazebit.security.entity.EntityPermissionUtils;
import com.blazebit.security.model.Features;
import com.blazebit.security.model.Permission;
import com.blazebit.security.model.User;
import com.blazebit.security.web.bean.base.ResourceHandlingBaseBean;

/**
 *
 * @author cuszk
 */
@ViewScoped
@ManagedBean(name = "userResourcesBean")
public class UserResourcesBean extends ResourceHandlingBaseBean {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    private TreeNode[] selectedPermissionNodes = new TreeNode[] {};
    private TreeNode[] selectedResourceNodes = new TreeNode[] {};

    private TreeNode newPermissionTreeRoot = new DefaultTreeNode();
    private TreeNode currentPermissionTreeRoot = new DefaultTreeNode();

    private List<Permission> userPermissions = new ArrayList<Permission>();
    private List<Permission> userDataPermissions = new ArrayList<Permission>();
    private List<Permission> allPermissions = new ArrayList<Permission>();

    private DefaultTreeNode resourceRoot;

    private TreeNode permissionViewRoot;

    private Set<Permission> replaced = new HashSet<Permission>();
    private Set<Permission> revokable = new HashSet<Permission>();

    private TreeNode[] storedSelectedResourceNodes = new TreeNode[] {};

    public void init() {
        initPermissions();
        initPermissionTree();
        initResourceTree();
    }

    private String filter;

    public void filterTree() {
        storedSelectedResourceNodes = new TreeNode[selectedResourceNodes.length];
        storedSelectedResourceNodes = Arrays.copyOf(selectedResourceNodes, selectedResourceNodes.length);
        try {
            resourceRoot = getResourceTree(userPermissions, filter);
        } catch (ClassNotFoundException e) {
            System.err.println("Error in resource name provider!");
        }
    }

    private void initResourceTree() {
        try {
            resourceRoot = getResourceTree(userPermissions);
        } catch (ClassNotFoundException e) {
            System.err.println("Error in resource name provider!");
        }
    }

    private void initPermissions() {
        allPermissions = permissionManager.getPermissions(getSelectedUser());
        List<List<Permission>> all = EntityPermissionUtils.getSeparatedPermissionsByResource(allPermissions);
        userPermissions = all.get(0);
        userDataPermissions = all.get(1);
    }

    private void initPermissionTree() {
        this.permissionViewRoot = new DefaultTreeNode();
        permissionViewRoot = getImmutablePermissionTree(userPermissions, userDataPermissions, !isEnabled(Features.FIELD_LEVEL));
    }

    public String resourceWizardListener(FlowEvent event) {
        if (event.getOldStep().equals("resources")) {
            processSelectedResources();
        }
        return event.getNewStep();
    }

    /**
     * wizard step 1
     */
    public void processSelectedResources() {
        selectedPermissionNodes = new TreeNode[] {};
        // read selected resources
        selectedResourceNodes = ArrayUtils.addAll(storedSelectedResourceNodes, selectedResourceNodes);
        Set<Permission> selectedPermissions = getSelectedPermissions(selectedResourceNodes);
        if (!isEnabled(Features.FIELD_LEVEL)) {
            // if field is level is not enabled but the user has field level permissions, these need to be marked as selected,
            // otherwise it would be taken as revoked
            selectedPermissions.addAll(PermissionUtils.getSeparatedParentAndChildPermissions(userPermissions).get(1));
        }
        // check what has been revoked
        List<Set<Permission>> revoke = permissionHandling.getRevokableFromSelected(userPermissions, selectedPermissions);
        revokable = revoke.get(0);
        dialogBean.setNotRevoked(revoke.get(1));

        // remove revoked permissions from current permission list so we can check what can be granted after revoking
        // check what has been granted
        List<Set<Permission>> grant = permissionHandling.getGrantable(PermissionUtils.removeAll(userPermissions, revokable), selectedPermissions);
        Set<Permission> granted = grant.get(0);
        dialogBean.setNotGranted(grant.get(1));

        replaced = permissionHandling.getReplacedByGranting(allPermissions, granted);

        currentPermissionTreeRoot = buildCurrentPermissionTree(userPermissions, userDataPermissions, granted, revokable, replaced, !isEnabled(Features.FIELD_LEVEL));
        newPermissionTreeRoot = buildNewPermissionTree(userPermissions, userDataPermissions, granted, revokable, replaced, !isEnabled(Features.FIELD_LEVEL),
                                                       isEnabled(Features.USER_LEVEL));
    }

    /**
     * wizard step 2: confirm button when adding permissions to user
     *
     */
    public void confirmPermissions() {
        Set<Permission> selectedPermissions = getSelectedPermissions(selectedPermissionNodes);
        executeRevokeAndGrant(getSelectedUser(), allPermissions, selectedPermissions, revokable, replaced);
        init();
    }

    public void rebuildCurrentPermissionTreeSelect(org.primefaces.event.NodeSelectEvent event) {
        rebuildCurrentPermissionTree();
    }

    public void rebuildCurrentPermissionTreeUnselect(org.primefaces.event.NodeUnselectEvent event) {
        rebuildCurrentPermissionTree();
    }

    /**
     * changes after wizard step1, before confirm. listener for select unselect permissons in the new permission tree
     */
    public void rebuildCurrentPermissionTree() {
        // current selected permissions
        Set<Permission> selectedPermissions = getSelectedPermissions(selectedPermissionNodes);
        currentPermissionTreeRoot = rebuildCurrentTree(allPermissions, selectedPermissions, revokable, replaced, !isEnabled(Features.FIELD_LEVEL));
    }

    public DefaultTreeNode getResourceRoot() {
        return resourceRoot;
    }

    public User getSelectedUser() {
        return userSession.getSelectedUser();
    }

    public TreeNode getPermissionViewRoot() {
        return permissionViewRoot;
    }

    public TreeNode getNewPermissionTreeRoot() {
        return newPermissionTreeRoot;
    }

    public void setNewPermissionTreeRoot(DefaultTreeNode newPermissionTreeRoot) {
        this.newPermissionTreeRoot = newPermissionTreeRoot;
    }

    public TreeNode getCurrentPermissionTreeRoot() {
        return currentPermissionTreeRoot;
    }

    public void setCurrentPermissionTreeRoot(DefaultTreeNode currentPermissionTreeRoot) {
        this.currentPermissionTreeRoot = currentPermissionTreeRoot;
    }

    public TreeNode[] getSelectedPermissionNodes() {
        return selectedPermissionNodes;
    }

    public void setSelectedPermissionNodes(TreeNode[] selectedPermissionNodes) {
        this.selectedPermissionNodes = selectedPermissionNodes;
    }

    public TreeNode[] getSelectedResourceNodes() {
        return selectedResourceNodes;
    }

    public void setSelectedResourceNodes(TreeNode[] selectedResourceNodes) {
        this.selectedResourceNodes = selectedResourceNodes;
    }

    public String getFilter() {
        return filter;
    }

    public void setFilter(String filter) {
        this.filter = filter;
    }

}

redpajama_set_name: RedPajamaGithub


text:
"""
[2015-10-30] Challenge #238 [Hard] Searching a Dungeon

https://www.reddit.com/r/dailyprogrammer/comments/3qtr01/20151030_challenge_238_hard_searching_a_dungeon/

# Description
Our hero is lost in a dungeon. You will be given ASCII maps of a few floors, her starting position, and her goal. On
some floors there are holes in the ground/roof, so that you can move between floors. Some only open one way, so going
up doesn't guarantee that you can thereafter go down.
Your goal is to paint the path the hero takes in the dungeon to go from their starting position to the goal.
# Input Description
There are a few characters used to build the ASCII map.
'#' means wall. You cannot go here
' ' means empty. You can go here from adjacent positions on the same floor.
'S' means start. You start here
'G' means goal. You need to go here to find the treasure and complete the challenge!
'U' means up. You can go from floor 'n' to floor 'n+1' here.
'D' means down. You can go from floor 'n' to floor 'n-1' here.
Your output is the same as the input, but with '*' used to paint the route.
The route has to be the shortest possible route.
Lower floors are printed below higher floors
Example input:
    #####
    #S# #
    # # #
    #D#G#
    #####
    #####
    #  U#
    # ###
    #  ##
    #####
# Output Description
Your program should emit the levels of the dungeon with the hero's path painted from start to goal.
Example output:
    #####
    #S#*#
    #*#*#
    #D#G#
    #####
    #####
    #**U#
    #*###
    #* ##
    #####
(It doesn't matter whether you paint over U and D or not)
# Challenge input
(if you want to, you may use the fact that these floors are all 10x10 in size, as well as there being 4 floors, by
either putting this at the top of your input file, or hardcoding it)
    ##########
    #S###    #
    #   # ####
    ### # #D##
    #   # # ##
    #D# # # ##
    ###     ##
    ### ### ##
    ###     ##
    ##########
    ##########
    #   #   D#
    #     ####
    ###   # ##
    #U#   # ##
    # #    D##
    ##########
    #       ##
    #D# # # ##
    ##########
    ##########
    #        #
    # ########
    # #U     #
    # #      #
    # ####   #
    #    #####
    #### ##U##
    # D#    ##
    ##########
    ##########
    #        #
    # ###### #
    # #    # #
    # # ## # #
    # #  #   #
    # ## # # #
    # ##   # #
    #  #####G#
    ##########
# Credit
This challenge was suggested by /u/Darklightos. If you have any challenge ideas, please share them on
/r/dailyprogrammer_ideas and there's a good chance we'll use it.
"""

def main():
    pass

if __name__ == "__main__":
    main()


text: %just comment (no EOL)


text:
namespace Mollie.Api.Models.Subscription {
    public class SubscriptionRequest : SubscriptionUpdateRequest {
        /// <summary>
        /// Optional – The payment method used for this subscription, either forced on creation or null if any of the
        /// customer's valid mandates may be used. See the Mollie.Api.Models.Payment.PaymentMethod class for a full
        /// list of known values.
        /// </summary>
        public string Method { get; set; }

        /// <summary>
        /// Adding an application fee allows you to charge the merchant for each payment in the subscription and
        /// transfer these amounts to your own account.
        /// </summary>
        public ApplicationFee ApplicationFee { get; set; }

        /// <summary>
        /// The website profile's unique identifier, for example pfl_3RkSN1zuPE.
        /// </summary>
        public string ProfileId { get; set; }
    }
}


text:
class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :lockable, :timeoutable

  before_save :ensure_authentication_token

  def ensure_authentication_token
    if authentication_token.blank?
      self.authentication_token = generate_authentication_token
    end
  end

  def as_json(options = {})
    if options[:format] == "sign_in"
      {
        id: self.id,
        email: self.email,
        token: self.authentication_token
      }
    elsif options[:format] == "auth_via_token"
      {
        id: self.id,
        role: self.type
      }
    else
      {
        token: self.authentication_token,
        role: self.type
      }
    end
  end

  def is_admin?
    self.type == "Admin"
  end

  private

  def generate_authentication_token
    loop do
      token = Devise.friendly_token
      break token unless User.where(authentication_token: token).first
    end
  end

end


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

import com.google.common.annotations.VisibleForTesting;
import io.airlift.slice.Murmur3Hash32;
import io.airlift.slice.Slice;
import io.airlift.slice.Slices;
import io.trino.spi.block.Block;
import io.trino.spi.block.BlockBuilder;
import io.trino.spi.block.RunLengthEncodedBlock;
import io.trino.spi.type.DecimalType;
import io.trino.spi.type.FixedWidthType;
import io.trino.spi.type.Int128;
import io.trino.spi.type.LongTimestampWithTimeZone;
import io.trino.spi.type.Type;
import io.trino.spi.type.VarcharType;
import org.apache.iceberg.PartitionField;
import org.joda.time.DateTimeField;
import org.joda.time.chrono.ISOChronology;

import javax.annotation.Nullable;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.function.Function;
import java.util.function.LongUnaryOperator;
import java.util.function.ToLongFunction;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static io.airlift.slice.SliceUtf8.offsetOfCodePoint;
import static io.trino.plugin.iceberg.util.Timestamps.getTimestampTz;
import static io.trino.plugin.iceberg.util.Timestamps.timestampTzToMicros;
import static io.trino.spi.predicate.Utils.nativeValueToBlock;
import static io.trino.spi.type.BigintType.BIGINT;
import static io.trino.spi.type.DateType.DATE;
import static io.trino.spi.type.Decimals.encodeScaledValue;
import static io.trino.spi.type.Decimals.encodeShortScaledValue;
import static io.trino.spi.type.Decimals.isLongDecimal;
import static io.trino.spi.type.Decimals.isShortDecimal;
import static io.trino.spi.type.Decimals.readBigDecimal;
import static io.trino.spi.type.IntegerType.INTEGER;
import static io.trino.spi.type.TimeType.TIME_MICROS;
import static io.trino.spi.type.TimestampType.TIMESTAMP_MICROS;
import static io.trino.spi.type.TimestampWithTimeZoneType.TIMESTAMP_TZ_MICROS;
import static io.trino.spi.type.Timestamps.MICROSECONDS_PER_MILLISECOND;
import static io.trino.spi.type.Timestamps.MILLISECONDS_PER_DAY;
import static io.trino.spi.type.Timestamps.MILLISECONDS_PER_HOUR;
import static io.trino.spi.type.Timestamps.PICOSECONDS_PER_MICROSECOND;
import static io.trino.spi.type.TypeUtils.readNativeValue;
import static io.trino.spi.type.UuidType.UUID;
import static io.trino.spi.type.VarbinaryType.VARBINARY;
import static io.trino.spi.type.VarcharType.VARCHAR;
import static java.lang.Integer.parseInt;
import static java.lang.Math.floorDiv;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.DAYS;

public final class PartitionTransforms
{
    private static final Pattern BUCKET_PATTERN = Pattern.compile("bucket\\[(\\d+)]");
    private static final Pattern TRUNCATE_PATTERN = Pattern.compile("truncate\\[(\\d+)]");

    private static final DateTimeField YEAR_FIELD = ISOChronology.getInstanceUTC().year();
    private static final DateTimeField MONTH_FIELD = ISOChronology.getInstanceUTC().monthOfYear();

    private PartitionTransforms() {}

    public static ColumnTransform getColumnTransform(PartitionField field, Type type)
    {
        String transform = field.transform().toString();

        switch (transform) {
            case "identity":
                return identity(type);
            case "year":
                if (type.equals(DATE)) {
                    return yearsFromDate();
                }
                if (type.equals(TIMESTAMP_MICROS)) {
                    return yearsFromTimestamp();
                }
                if (type.equals(TIMESTAMP_TZ_MICROS)) {
                    return yearsFromTimestampWithTimeZone();
                }
                throw new UnsupportedOperationException("Unsupported type for 'year': " + field);
            case "month":
                if (type.equals(DATE)) {
                    return monthsFromDate();
                }
                if (type.equals(TIMESTAMP_MICROS)) {
                    return monthsFromTimestamp();
                }
                if (type.equals(TIMESTAMP_TZ_MICROS)) {
                    return monthsFromTimestampWithTimeZone();
                }
                throw new UnsupportedOperationException("Unsupported type for 'month': " + field);
            case "day":
                if (type.equals(DATE)) {
                    return daysFromDate();
                }
                if (type.equals(TIMESTAMP_MICROS)) {
                    return daysFromTimestamp();
                }
                if (type.equals(TIMESTAMP_TZ_MICROS)) {
                    return daysFromTimestampWithTimeZone();
                }
                throw new UnsupportedOperationException("Unsupported type for 'day': " + field);
            case "hour":
                if (type.equals(TIMESTAMP_MICROS)) {
                    return hoursFromTimestamp();
                }
                if (type.equals(TIMESTAMP_TZ_MICROS)) {
                    return hoursFromTimestampWithTimeZone();
                }
                throw new UnsupportedOperationException("Unsupported type for 'hour': " + field);
            case "void":
                return voidTransform(type);
        }

        Matcher matcher = BUCKET_PATTERN.matcher(transform);
        if (matcher.matches()) {
            int count = parseInt(matcher.group(1));
            return bucket(type, count);
        }

        matcher = TRUNCATE_PATTERN.matcher(transform);
        if (matcher.matches()) {
            int width = parseInt(matcher.group(1));
            if (type.equals(INTEGER)) {
                return truncateInteger(width);
            }
            if (type.equals(BIGINT)) {
                return truncateBigint(width);
            }
            if (isShortDecimal(type)) {
                DecimalType decimal = (DecimalType) type;
                return truncateShortDecimal(type, width, decimal);
            }
            if (isLongDecimal(type)) {
                DecimalType decimal = (DecimalType) type;
                return truncateLongDecimal(type, width, decimal);
            }
            if (type instanceof VarcharType) {
                return truncateVarchar(width);
            }
            if (type.equals(VARBINARY)) {
                return truncateVarbinary(width);
            }
            throw new UnsupportedOperationException("Unsupported type for 'truncate': " + field);
        }

        throw new UnsupportedOperationException("Unsupported partition transform: " + field);
    }

    private static ColumnTransform identity(Type type)
    {
        return new ColumnTransform(type, Function.identity(), ValueTransform.identity(type));
    }

    @VisibleForTesting
    static ColumnTransform bucket(Type type, int count)
    {
        Hasher hasher = getBucketingHash(type);
        return new ColumnTransform(
                INTEGER,
                block -> bucketBlock(block, count, hasher),
                (block, position) -> {
                    if (block.isNull(position)) {
                        return null;
                    }
                    int hash = hasher.hash(block, position);
                    int bucket = (hash & Integer.MAX_VALUE) % count;
                    return (long) bucket;
                });
    }

    private static Hasher getBucketingHash(Type type)
    {
        if (type.equals(INTEGER)) {
            return PartitionTransforms::hashInteger;
        }
        if (type.equals(BIGINT)) {
            return PartitionTransforms::hashBigint;
        }
        if (isShortDecimal(type)) {
            return hashShortDecimal((DecimalType) type);
        }
        if (isLongDecimal(type)) {
            return hashLongDecimal((DecimalType) type);
        }
        if (type.equals(DATE)) {
            return PartitionTransforms::hashDate;
        }
        if (type.equals(TIME_MICROS)) {
            return PartitionTransforms::hashTime;
        }
        if (type.equals(TIMESTAMP_MICROS)) {
            return PartitionTransforms::hashTimestamp;
        }
        if (type.equals(TIMESTAMP_TZ_MICROS)) {
            return PartitionTransforms::hashTimestampWithTimeZone;
        }
        if (type instanceof VarcharType) {
            return PartitionTransforms::hashVarchar;
        }
        if (type.equals(VARBINARY)) {
            return PartitionTransforms::hashVarbinary;
        }
        if (type.equals(UUID)) {
            return PartitionTransforms::hashUuid;
        }
        throw new UnsupportedOperationException("Unsupported type for 'bucket': " + type);
    }

    private static ColumnTransform yearsFromDate()
    {
        LongUnaryOperator transform = value -> epochYear(DAYS.toMillis(value));
        return new ColumnTransform(
                INTEGER,
                block -> transformBlock(DATE, INTEGER, block, transform),
                ValueTransform.from(DATE, transform));
    }

    private static ColumnTransform monthsFromDate()
    {
        LongUnaryOperator transform = value -> epochMonth(DAYS.toMillis(value));
        return new ColumnTransform(
                INTEGER,
                block -> transformBlock(DATE, INTEGER, block, transform),
                ValueTransform.from(DATE, transform));
    }

    private static ColumnTransform daysFromDate()
    {
        LongUnaryOperator transform = LongUnaryOperator.identity();
        return new ColumnTransform(
                INTEGER,
                block -> transformBlock(DATE, INTEGER, block, transform),
                ValueTransform.from(DATE, transform));
    }

    private static ColumnTransform yearsFromTimestamp()
    {
        LongUnaryOperator transform = epochMicros -> epochYear(floorDiv(epochMicros, MICROSECONDS_PER_MILLISECOND));
        return new ColumnTransform(
                INTEGER,
                block -> transformBlock(TIMESTAMP_MICROS, INTEGER, block, transform),
                ValueTransform.from(TIMESTAMP_MICROS, transform));
    }

    private static ColumnTransform monthsFromTimestamp()
    {
        LongUnaryOperator transform = epochMicros -> epochMonth(floorDiv(epochMicros, MICROSECONDS_PER_MILLISECOND));
        return new ColumnTransform(
                INTEGER,
                block -> transformBlock(TIMESTAMP_MICROS, INTEGER, block, transform),
                ValueTransform.from(TIMESTAMP_MICROS, transform));
    }

    private static ColumnTransform daysFromTimestamp()
    {
        LongUnaryOperator transform = epochMicros -> epochDay(floorDiv(epochMicros, MICROSECONDS_PER_MILLISECOND));
        return new ColumnTransform(
                INTEGER,
                block -> transformBlock(TIMESTAMP_MICROS, INTEGER, block, transform),
                ValueTransform.from(TIMESTAMP_MICROS, transform));
    }

    private static ColumnTransform hoursFromTimestamp()
    {
        LongUnaryOperator transform = epochMicros -> epochHour(floorDiv(epochMicros, MICROSECONDS_PER_MILLISECOND));
        return new ColumnTransform(
                INTEGER,
                block -> transformBlock(TIMESTAMP_MICROS, INTEGER, block, transform),
                ValueTransform.from(TIMESTAMP_MICROS, transform));
    }

    private static ColumnTransform yearsFromTimestampWithTimeZone()
    {
        ToLongFunction<LongTimestampWithTimeZone> transform = value -> epochYear(value.getEpochMillis());
        return new ColumnTransform(
                INTEGER,
                block -> extractTimestampWithTimeZone(block, transform),
                ValueTransform.fromTimestampTzTransform(transform));
    }

    private static ColumnTransform monthsFromTimestampWithTimeZone()
    {
        ToLongFunction<LongTimestampWithTimeZone> transform = value -> epochMonth(value.getEpochMillis());
        return new ColumnTransform(
                INTEGER,
                block -> extractTimestampWithTimeZone(block, transform),
                ValueTransform.fromTimestampTzTransform(transform));
    }

    private static ColumnTransform daysFromTimestampWithTimeZone()
    {
        ToLongFunction<LongTimestampWithTimeZone> transform = value -> epochDay(value.getEpochMillis());
        return new ColumnTransform(
                INTEGER,
                block -> extractTimestampWithTimeZone(block, transform),
                ValueTransform.fromTimestampTzTransform(transform));
    }

    private static ColumnTransform hoursFromTimestampWithTimeZone()
    {
        ToLongFunction<LongTimestampWithTimeZone> transform = value -> epochHour(value.getEpochMillis());
        return new ColumnTransform(
                INTEGER,
                block -> extractTimestampWithTimeZone(block, transform),
                ValueTransform.fromTimestampTzTransform(transform));
    }

    private static Block extractTimestampWithTimeZone(Block block, ToLongFunction<LongTimestampWithTimeZone> function)
    {
        BlockBuilder builder = INTEGER.createFixedSizeBlockBuilder(block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            LongTimestampWithTimeZone value = getTimestampTz(block, position);
            INTEGER.writeLong(builder, function.applyAsLong(value));
        }
        return builder.build();
    }

    private static int hashInteger(Block block, int position)
    {
        return bucketHash(INTEGER.getLong(block, position));
    }

    private static int hashBigint(Block block, int position)
    {
        return bucketHash(BIGINT.getLong(block, position));
    }

    private static Hasher hashShortDecimal(DecimalType decimal)
    {
        return (block, position) -> {
            // TODO: write optimized implementation
            BigDecimal value = readBigDecimal(decimal, block, position);
            return bucketHash(Slices.wrappedBuffer(value.unscaledValue().toByteArray()));
        };
    }

    private static Hasher hashLongDecimal(DecimalType decimal)
    {
        return (block, position) -> {
            // TODO: write optimized implementation
            BigDecimal value = readBigDecimal(decimal, block, position);
            return bucketHash(Slices.wrappedBuffer(value.unscaledValue().toByteArray()));
        };
    }

    private static int hashDate(Block block, int position)
    {
        return bucketHash(DATE.getLong(block, position));
    }

    private static int hashTime(Block block, int position)
    {
        long picos = TIME_MICROS.getLong(block, position);
        return bucketHash(picos / PICOSECONDS_PER_MICROSECOND);
    }

    private static int hashTimestamp(Block block, int position)
    {
        return bucketHash(TIMESTAMP_MICROS.getLong(block, position));
    }

    private static int hashTimestampWithTimeZone(Block block, int position)
    {
        return bucketHash(timestampTzToMicros(getTimestampTz(block, position)));
    }

    private static int hashVarchar(Block block, int position)
    {
        return bucketHash(VARCHAR.getSlice(block, position));
    }

    private static int hashVarbinary(Block block, int position)
    {
        return bucketHash(VARBINARY.getSlice(block, position));
    }

    private static int hashUuid(Block block, int position)
    {
        return bucketHash(UUID.getSlice(block, position));
    }

    private static Block bucketBlock(Block block, int count, Hasher hasher)
    {
        BlockBuilder builder = INTEGER.createFixedSizeBlockBuilder(block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            int hash = hasher.hash(block, position);
            int bucket = (hash & Integer.MAX_VALUE) % count;
            INTEGER.writeLong(builder, bucket);
        }
        return builder.build();
    }

    private static int bucketHash(long value)
    {
        return Murmur3Hash32.hash(value);
    }

    private static int bucketHash(Slice value)
    {
        return Murmur3Hash32.hash(value);
    }

    private static ColumnTransform truncateInteger(int width)
    {
        return new ColumnTransform(
                INTEGER,
                block -> truncateInteger(block, width),
                (block, position) -> {
                    if (block.isNull(position)) {
                        return null;
                    }
                    return truncateInteger(block, position, width);
                });
    }

    private static Block truncateInteger(Block block, int width)
    {
        BlockBuilder builder = INTEGER.createFixedSizeBlockBuilder(block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            INTEGER.writeLong(builder, truncateInteger(block, position, width));
        }
        return builder.build();
    }

    private static long truncateInteger(Block block, int position, int width)
    {
        long value = INTEGER.getLong(block, position);
        return value - ((value % width) + width) % width;
    }

    private static ColumnTransform truncateBigint(int width)
    {
        return new ColumnTransform(
                BIGINT,
                block -> truncateBigint(block, width),
                (block, position) -> {
                    if (block.isNull(position)) {
                        return null;
                    }
                    return truncateBigint(block, position, width);
                });
    }

    private static Block truncateBigint(Block block, int width)
    {
        BlockBuilder builder = BIGINT.createFixedSizeBlockBuilder(block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            BIGINT.writeLong(builder, truncateBigint(block, position, width));
        }
        return builder.build();
    }

    private static long truncateBigint(Block block, int position, int width)
    {
        long value = BIGINT.getLong(block, position);
        return value - ((value % width) + width) % width;
    }

    private static ColumnTransform truncateShortDecimal(Type type, int width, DecimalType decimal)
    {
        BigInteger unscaledWidth = BigInteger.valueOf(width);
        return new ColumnTransform(
                type,
                block -> truncateShortDecimal(decimal, block, unscaledWidth),
                (block, position) -> {
                    if (block.isNull(position)) {
                        return null;
                    }
                    return truncateShortDecimal(decimal, block, position, unscaledWidth);
                });
    }

    private static Block truncateShortDecimal(DecimalType type, Block block, BigInteger unscaledWidth)
    {
        BlockBuilder builder = type.createBlockBuilder(null, block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            type.writeLong(builder, truncateShortDecimal(type, block, position, unscaledWidth));
        }
        return builder.build();
    }

    private static long truncateShortDecimal(DecimalType type, Block block, int position, BigInteger unscaledWidth)
    {
        // TODO: write optimized implementation
        BigDecimal value = readBigDecimal(type, block, position);
        BigDecimal truncated = truncateDecimal(value, unscaledWidth);
        return encodeShortScaledValue(truncated, type.getScale());
    }

    private static ColumnTransform truncateLongDecimal(Type type, int width, DecimalType decimal)
    {
        BigInteger unscaledWidth = BigInteger.valueOf(width);
        return new ColumnTransform(
                type,
                block -> truncateLongDecimal(decimal, block, unscaledWidth),
                (block, position) -> {
                    if (block.isNull(position)) {
                        return null;
                    }
                    return truncateLongDecimal(decimal, block, position, unscaledWidth);
                });
    }

    private static Block truncateLongDecimal(DecimalType type, Block block, BigInteger unscaledWidth)
    {
        BlockBuilder builder = type.createBlockBuilder(null, block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            type.writeObject(builder, truncateLongDecimal(type, block, position, unscaledWidth));
        }
        return builder.build();
    }

    private static Int128 truncateLongDecimal(DecimalType type, Block block, int position, BigInteger unscaledWidth)
    {
        // TODO: write optimized implementation
        BigDecimal value = readBigDecimal(type, block, position);
        BigDecimal truncated = truncateDecimal(value, unscaledWidth);
        return encodeScaledValue(truncated, type.getScale());
    }

    private static BigDecimal truncateDecimal(BigDecimal value, BigInteger unscaledWidth)
    {
        BigDecimal remainder = new BigDecimal(
                value.unscaledValue()
                        .remainder(unscaledWidth)
                        .add(unscaledWidth)
                        .remainder(unscaledWidth),
                value.scale());
        return value.subtract(remainder);
    }

    private static ColumnTransform truncateVarchar(int width)
    {
        return new ColumnTransform(
                VARCHAR,
                block -> truncateVarchar(block, width),
                (block, position) -> {
                    if (block.isNull(position)) {
                        return null;
                    }
                    return truncateVarchar(VARCHAR.getSlice(block, position), width);
                });
    }

    private static Block truncateVarchar(Block block, int width)
    {
        BlockBuilder builder = VARCHAR.createBlockBuilder(null, block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            Slice value = VARCHAR.getSlice(block, position);
            VARCHAR.writeSlice(builder, truncateVarchar(value, width));
        }
        return builder.build();
    }

    private static Slice truncateVarchar(Slice value, int max)
    {
        if (value.length() <= max) {
            return value;
        }
        int end = offsetOfCodePoint(value, 0, max);
        if (end < 0) {
            return value;
        }
        return value.slice(0, end);
    }

    private static ColumnTransform truncateVarbinary(int width)
    {
        return new ColumnTransform(
                VARBINARY,
                block -> truncateVarbinary(block, width),
                (block, position) -> {
                    if (block.isNull(position)) {
                        return null;
                    }
                    return truncateVarbinary(VARBINARY.getSlice(block, position), width);
                });
    }

    private static Block truncateVarbinary(Block block, int width)
    {
        BlockBuilder builder = VARBINARY.createBlockBuilder(null, block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            Slice value = VARBINARY.getSlice(block, position);
            VARBINARY.writeSlice(builder, truncateVarbinary(value, width));
        }
        return builder.build();
    }

    private static Slice truncateVarbinary(Slice value, int width)
    {
        if (value.length() <= width) {
            return value;
        }
        return value.slice(0, width);
    }

    private static ColumnTransform voidTransform(Type type)
    {
        Block nullBlock = nativeValueToBlock(type, null);
        return new ColumnTransform(
                type,
                block -> new RunLengthEncodedBlock(nullBlock, block.getPositionCount()),
                (block, position) -> null);
    }

    private static Block transformBlock(Type sourceType, FixedWidthType resultType, Block block, LongUnaryOperator function)
    {
        BlockBuilder builder = resultType.createFixedSizeBlockBuilder(block.getPositionCount());
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (block.isNull(position)) {
                builder.appendNull();
                continue;
            }
            long value = sourceType.getLong(block, position);
            resultType.writeLong(builder, function.applyAsLong(value));
        }
        return builder.build();
    }

    @VisibleForTesting
    static long epochYear(long epochMilli)
    {
        return YEAR_FIELD.get(epochMilli) - 1970;
    }

    @VisibleForTesting
    static long epochMonth(long epochMilli)
    {
        long year = epochYear(epochMilli);
        int month = MONTH_FIELD.get(epochMilli) - 1;
        return (year * 12) + month;
    }

    @VisibleForTesting
    static long epochDay(long epochMilli)
    {
        return floorDiv(epochMilli, MILLISECONDS_PER_DAY);
    }

    @VisibleForTesting
    static long epochHour(long epochMilli)
    {
        return floorDiv(epochMilli, MILLISECONDS_PER_HOUR);
    }

    private interface Hasher
    {
        int hash(Block block, int position);
    }

    public static class ColumnTransform
    {
        private final Type type;
        private final Function<Block, Block> blockTransform;
        private final ValueTransform valueTransform;

        public ColumnTransform(Type type, Function<Block, Block> blockTransform, ValueTransform valueTransform)
        {
            this.type = requireNonNull(type, "type is null");
            this.blockTransform = requireNonNull(blockTransform, "transform is null");
            this.valueTransform = requireNonNull(valueTransform, "valueTransform is null");
        }

        public Type getType()
        {
            return type;
        }

        public Function<Block, Block> getBlockTransform()
        {
            return blockTransform;
        }

        public ValueTransform getValueTransform()
        {
            return valueTransform;
        }
    }

    public interface ValueTransform
    {
        static ValueTransform identity(Type type)
        {
            return (block, position) -> readNativeValue(type, block, position);
        }

        static ValueTransform from(Type sourceType, LongUnaryOperator transform)
        {
            return (block, position) -> {
                if (block.isNull(position)) {
                    return null;
                }
                return transform.applyAsLong(sourceType.getLong(block, position));
            };
        }

        static ValueTransform fromTimestampTzTransform(ToLongFunction<LongTimestampWithTimeZone> transform)
        {
            return (block, position) -> {
                if (block.isNull(position)) {
                    return null;
                }
                return transform.applyAsLong(getTimestampTz(block, position));
            };
        }

        @Nullable
        Object apply(Block block, int position);
    }
}


text:
using System;

namespace Microsoft.DirectX.Direct3D
{
	public struct RasterCaps
	{
		public bool SupportsMultisampleToggle {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsDepthBias {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsSlopeScaleDepthBias {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsScissorTest {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsColorPerspective {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsZFog {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsWFog {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsWBuffer {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsAnisotropy {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsFogRange {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsZBufferLessHsr {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsMipMapLevelOfDetailBias {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsFogTable {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsFogVertex {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsZBufferTest {
			get {
				throw new NotImplementedException ();
			}
		}

		public bool SupportsDither {
			get {
				throw new NotImplementedException ();
			}
		}

		public override string ToString ()
		{
			throw new NotImplementedException ();
		}
	}
}


text:
Used maven dependencies are:
vertx-web and jackson-databind

To compile and run:

```
mvn clean compile
```

```
mvn org.codehaus.mojo:exec-maven-plugin:exec -Dexec.executable=java \
	-Dexec.args="-cp %classpath io.vertx.core.Launcher run test.project1.Server"
```

Tested using Postman on the following address:
```
http://localhost:8080/analyze
```
Parameters:
```
name: 'text', type: string
```


text:
A Kudo is a simple gesture of thanks, praise, or endorsement from an Ohloh [account](/reference/account.md) to another person. An account may send Kudos to as many people as desired.

Kudos can be sent directly to another Ohloh account, or they may be sent to a contributor on a Project who does not have an Ohloh account. This flexibility makes Kudo records slightly complex.

When a Kudo is sent directly to an Ohloh Account, the recipient is identified by `receiver_account_id`.

When a Kudo is sent to a contributor on a Project who does not have an Account, the Kudo record contains both `contributor_id` and `project_id`, which together uniquely identify the recipient.

Ocassionally, an Ohloh Account holder may claim to be a Project contributor who has some existing Kudos. When this happens, the existing Kudos become linked to the Account, and the Kudos will now have all three properties: `receiver_account_id`, `contributor_id`, and `project_id`.

### Properties
+ __created_at__
    The time at which this Kudo was sent.
+ __sender_account_id__
    The unique ID of the [Account](account.md) sending this Kudo.
+ __sender_account_name__
    The name of the [Account](account.md) sending this Kudo.
+ __receiver_account_id__
    If this Kudo can be linked to an Account, this is the unique ID of the Account receiving this Kudo. Otherwise, this element is omitted.
+ __receiver_account_name__
    If this kudo can be linked to an Account, this is the name of the Account receiving this Kudo. Otherwise, this element is omitted.
+ __project_id__
    If this Kudo was sent to a Project contributor instead of an Account, this is the unique ID of the [Project](project.md). Otherwise, this element is omitted.
+ __project_name__
    If this Kudo was sent to a Project contributor instead of an Account, this is the Project name. Otherwise, this element is omitted.
+ __contributor_id__
    If this Kudo was sent to a Project contributor instead of an Account, this is the unique ID of the contributor. Otherwise, this element is omitted.
+ __contributor_name__
    If this Kudo was sent to a Project contributor instead of an account, this is the name which appears in the source control logs. Otherwise, this element is omitted.

### Collection URL
To get a list of all Kudos received by an Account:
```shell
curl https://www.openhub.net/accounts/{account_id}/kudos.xml
```
To get a list of all Kudos sent by an Account:
```shell
curl https://www.openhub.net/accounts/{account_id}/kudos/sent.xml
```
These methods do not support any sorting, filtering, or paging options. You will always receive the complete list of all Kudos, sorted from new to old.

If you do not know the Account ID, you can also query for Kudos using the MD5 hash of the email address. Read more about email-based queries [here](/email_lookup.md).


text:
This is a net new payload for skipping Setup Assistant screens.

This payload includes:
* Setup Assistant screens to remove

Paste the entire XML snippet (`<dict>...</dict>`) into the Custom XML payload in Workspace ONE UEM.

```xml
<dict>
    <key>SkipAppearance</key>
    <true />
    <key>SkipCloudSetup</key>
    <true />
    <key>SkipiCloudStorageSetup</key>
    <true />
    <key>SkipPrivacySetup</key>
    <true />
    <key>SkipScreenTime</key>
    <true />
    <key>SkipSiriSetup</key>
    <true />
    <key>SkipTouchIDSetup</key>
    <true />
    <key>SkipTrueTone</key>
    <true />
    <key>SkipSetupItems</key>
      <array>
        <string>Accessibility</string>
        <string>Android</string>
        <string>Appearance</string> <!--For full list of keys, see Apple's page https://developer.apple.com/documentation/devicemanagement/skipkeys-->
      </array>
    <key>SkipAppearance</key>
    <true />
    <key>PayloadDisplayName</key>
    <string>SetupAssistant</string>
    <key>PayloadDescription</key>
    <string>SetupAssistant</string>
    <key>PayloadIdentifier</key>
    <string>195c2047-813f-423e-b8c6-56a47a721b6e.SetupAssistant</string>
    <key>PayloadOrganization</key>
    <string></string>
    <key>PayloadType</key>
    <string>com.apple.SetupAssistant.managed</string>
    <key>PayloadUUID</key>
    <string>56238411-4d7b-45c5-a876-4d3geae7XXXX</string> <!--Change last four values XXXX to random alphanumeric characters-->
    <key>PayloadVersion</key>
    <integer>1</integer>
</dict>
```


text:
'use strict';
const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');

const assert = require('assert');
const tls = require('tls');
const fixtures = require('../common/fixtures');

const options = {
  key: fixtures.readKey('rsa_private.pem'),
  cert: fixtures.readKey('rsa_cert.crt')
};

const server = tls.createServer(options, function(socket) {
  socket.pipe(socket);
  // Pipe already ends... but leaving this here tests .end() after .end().
  socket.on('end', () => socket.end());
}).listen(0, common.mustCall(function() {
  unauthorized();
}));

function unauthorized() {
  console.log('connect unauthorized');
  const socket = tls.connect({
    port: server.address().port,
    servername: 'localhost',
    rejectUnauthorized: false
  }, common.mustCall(function() {
    let _data;
    assert(!socket.authorized);
    socket.on('data', common.mustCall((data) => {
      assert.strictEqual(data.toString(), 'ok');
      _data = data;
    }));
    socket.on('end', common.mustCall(() => {
      assert(_data, 'data failed to echo!');
    }));
    socket.on('end', () => rejectUnauthorized());
  }));
  socket.once('session', common.mustCall(() => {
  }));
  socket.on('error', common.mustNotCall());
  socket.end('ok');
}

function rejectUnauthorized() {
  console.log('reject unauthorized');
  const socket = tls.connect(server.address().port, {
    servername: 'localhost'
  }, common.mustNotCall());
  socket.on('data', common.mustNotCall());
  socket.on('error', common.mustCall(function(err) {
    authorized();
  }));
  socket.end('ng');
}

function authorized() {
  console.log('connect authorized');
  const socket = tls.connect(server.address().port, {
    ca: [fixtures.readKey('rsa_cert.crt')],
    servername: 'localhost'
  }, common.mustCall(function() {
    console.log('... authorized');
    assert(socket.authorized);
    socket.on('data', common.mustCall((data) => {
      assert.strictEqual(data.toString(), 'ok');
    }));
    socket.on('end', () => server.close());
  }));
  socket.on('error', common.mustNotCall());
  socket.end('ok');
}


text:
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { Injectable, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule, Routes } from '@angular/router';
import { BasicAuthInformer, HelgolandBasicAuthModule } from '@helgoland/auth';
import { HelgolandCachingModule } from '@helgoland/caching';
import {
  DatasetApiInterface,
  DatasetApiV1ConnectorProvider,
  DatasetApiV2ConnectorProvider,
  DatasetApiV3ConnectorProvider,
  DatasetStaConnectorProvider,
  Settings,
  SettingsService,
  SplittedDataDatasetApiInterface,
} from '@helgoland/core';
import { VocabNercLabelMapperModule } from '@helgoland/depiction';
import { JsonFavoriteExporterService } from '@helgoland/favorite';
import {
  NgbAccordionModule,
  NgbDatepickerModule,
  NgbDropdownModule,
  NgbModalModule,
  NgbTabsetModule,
  NgbTimepickerModule,
} from '@ng-bootstrap/ng-bootstrap';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { PlotlyViaCDNModule } from 'angular-plotly.js';

import { BasicAuthInformerImplService } from '../../../common/components/basic-auth/basic-auth-informer-impl.service';
import { ComponentsModule } from '../../../common/components/components.module';
import { InfoModule } from '../../../common/info/info.module';
import { ProfilesModule } from '../../../common/profiles/profiles.module';
import { TimeseriesRouter } from '../../../common/timeseries/services/timeseries-router.service';
import { nestedTimeseriesRoutes, TimeseriesModule } from '../../../common/timeseries/timeseries.module';
import { TrajectoriesModule } from '../../../common/trajectories/trajectories.module';
import { settings } from '../environments/environment';
import { AppComponent } from './app.component';
import { CustomTimeseriesRouter } from './router.service';

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

const baseRoutes: Routes = [
  ...nestedTimeseriesRoutes
];

@Injectable()
export class ExtendedSettingsService extends SettingsService<Settings> {

  constructor() {
    super();
    this.setSettings(settings);
  }

}

PlotlyViaCDNModule.setPlotlyVersion('1.55.2');
PlotlyViaCDNModule.setPlotlyBundle('basic');

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    }),
    ComponentsModule,
    TimeseriesModule,
    TrajectoriesModule,
    ProfilesModule,
    InfoModule,
    HttpClientModule,
    HelgolandCachingModule,
    HelgolandBasicAuthModule,
    NgbTabsetModule,
    NgbAccordionModule,
    NgbModalModule,
    NgbDropdownModule,
    NgbDatepickerModule,
    NgbTimepickerModule,
    VocabNercLabelMapperModule,
    RouterModule.forRoot(
      baseRoutes
    ),
    PlotlyViaCDNModule
  ],
  providers: [
    JsonFavoriteExporterService,
    {
      provide: SettingsService,
      useClass: ExtendedSettingsService
    },
    {
      provide: BasicAuthInformer,
      useClass: BasicAuthInformerImplService
    },
    {
      provide: DatasetApiInterface,
      useClass: SplittedDataDatasetApiInterface
    },
    {
      provide: TimeseriesRouter,
      useClass: CustomTimeseriesRouter
    },
    DatasetApiV1ConnectorProvider,
    DatasetApiV2ConnectorProvider,
    DatasetApiV3ConnectorProvider,
    DatasetStaConnectorProvider
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }


text:
using System;
using UnityEngine;

namespace UnitySampleAssets.ImageEffects
{
    [ExecuteInEditMode]
    [RequireComponent (typeof(Camera))]
    [AddComponentMenu ("Image Effects/Bloom and Glow/Bloom")]
    public class Bloom : PostEffectsBase
    {
        public enum LensFlareStyle
        {
            Ghosting = 0,
            Anamorphic = 1,
            Combined = 2,
        }

        public enum TweakMode
        {
            Basic = 0,
            Complex = 1,
        }

        public enum HDRBloomMode
        {
            Auto = 0,
            On = 1,
            Off = 2,
        }

        public enum BloomScreenBlendMode
        {
            Screen = 0,
            Add = 1,
        }

        public enum BloomQuality
        {
            Cheap = 0,
            High = 1,
        }

        public TweakMode tweakMode = 0;
        public BloomScreenBlendMode screenBlendMode = BloomScreenBlendMode.Add;

        public HDRBloomMode hdr = HDRBloomMode.Auto;
        private bool doHdr = false;
        public float sepBlurSpread = 2.5f;

        public BloomQuality quality = BloomQuality.High;

        public float bloomIntensity = 0.5f;
        public float bloomThreshold = 0.5f;
        public Color bloomThresholdColor = Color.white;
        public int bloomBlurIterations = 2;

        public int hollywoodFlareBlurIterations = 2;
        public float flareRotation = 0.0f;
        public LensFlareStyle lensflareMode = (LensFlareStyle) 1;
        public float hollyStretchWidth = 2.5f;
        public float lensflareIntensity = 0.0f;
        public float lensflareThreshold = 0.3f;
        public float lensFlareSaturation = 0.75f;
        public Color flareColorA = new Color (0.4f, 0.4f, 0.8f, 0.75f);
        public Color flareColorB = new Color (0.4f, 0.8f, 0.8f, 0.75f);
        public Color flareColorC = new Color (0.8f, 0.4f, 0.8f, 0.75f);
        public Color flareColorD = new Color (0.8f, 0.4f, 0.0f, 0.75f);
        public Texture2D lensFlareVignetteMask;

        public Shader lensFlareShader;
        private Material lensFlareMaterial;

        public Shader screenBlendShader;
        private Material screenBlend;

        public Shader blurAndFlaresShader;
        private Material blurAndFlaresMaterial;

        public Shader brightPassFilterShader;
        private Material brightPassFilterMaterial;

        public override bool CheckResources ()
        {
            CheckSupport (false);

            screenBlend = CheckShaderAndCreateMaterial (screenBlendShader, screenBlend);
            lensFlareMaterial = CheckShaderAndCreateMaterial(lensFlareShader,lensFlareMaterial);
            blurAndFlaresMaterial = CheckShaderAndCreateMaterial (blurAndFlaresShader, blurAndFlaresMaterial);
            brightPassFilterMaterial = CheckShaderAndCreateMaterial(brightPassFilterShader, brightPassFilterMaterial);

            if (!isSupported)
                ReportAutoDisable ();
            return isSupported;
        }

        public void OnRenderImage (RenderTexture source, RenderTexture destination)
        {
            if (CheckResources()==false)
            {
                Graphics.Blit (source, destination);
                return;
            }

            // screen blend is not supported when HDR is enabled (will cap values)

            doHdr = false;
            if (hdr == HDRBloomMode.Auto)
                doHdr = source.format == RenderTextureFormat.ARGBHalf && GetComponent<Camera>().hdr;
            else {
                doHdr = hdr == HDRBloomMode.On;
            }

            doHdr = doHdr && supportHDRTextures;

            BloomScreenBlendMode realBlendMode = screenBlendMode;
            if (doHdr)
                realBlendMode = BloomScreenBlendMode.Add;

            var rtFormat= (doHdr) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.Default;
            var rtW2= source.width/2;
            var rtH2= source.height/2;
            var rtW4= source.width/4;
            var rtH4= source.height/4;

            float widthOverHeight = (1.0f * source.width) / (1.0f * source.height);
            float oneOverBaseSize = 1.0f / 512.0f;

            // downsample
            RenderTexture quarterRezColor = RenderTexture.GetTemporary (rtW4, rtH4, 0, rtFormat);
            RenderTexture halfRezColorDown = RenderTexture.GetTemporary (rtW2, rtH2, 0, rtFormat);
            if (quality > BloomQuality.Cheap) {
                Graphics.Blit (source, halfRezColorDown, screenBlend, 2);
                RenderTexture rtDown4 = RenderTexture.GetTemporary (rtW4, rtH4, 0, rtFormat);
                Graphics.Blit (halfRezColorDown, rtDown4, screenBlend, 2);
                Graphics.Blit (rtDown4, quarterRezColor, screenBlend, 6);
                RenderTexture.ReleaseTemporary(rtDown4);
            }
            else {
                Graphics.Blit (source, halfRezColorDown);
                Graphics.Blit (halfRezColorDown, quarterRezColor, screenBlend, 6);
            }
            RenderTexture.ReleaseTemporary (halfRezColorDown);

            // cut colors (thresholding)
            RenderTexture secondQuarterRezColor = RenderTexture.GetTemporary (rtW4, rtH4, 0, rtFormat);
            BrightFilter (bloomThreshold * bloomThresholdColor, quarterRezColor, secondQuarterRezColor);

            // blurring

            if (bloomBlurIterations < 1) bloomBlurIterations = 1;
            else if (bloomBlurIterations > 10) bloomBlurIterations = 10;

            for (int iter = 0; iter < bloomBlurIterations; iter++)
			{
                float spreadForPass = (1.0f + (iter * 0.25f)) * sepBlurSpread;

                // vertical blur
                RenderTexture blur4 = RenderTexture.GetTemporary (rtW4, rtH4, 0, rtFormat);
                blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 (0.0f, spreadForPass * oneOverBaseSize, 0.0f, 0.0f));
                Graphics.Blit (secondQuarterRezColor, blur4, blurAndFlaresMaterial, 4);
                RenderTexture.ReleaseTemporary(secondQuarterRezColor);
                secondQuarterRezColor = blur4;

                // horizontal blur
                blur4 = RenderTexture.GetTemporary (rtW4, rtH4, 0, rtFormat);
                blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 ((spreadForPass / widthOverHeight) * oneOverBaseSize, 0.0f, 0.0f, 0.0f));
                Graphics.Blit (secondQuarterRezColor, blur4, blurAndFlaresMaterial, 4);
                RenderTexture.ReleaseTemporary (secondQuarterRezColor);
                secondQuarterRezColor = blur4;

                if (quality > BloomQuality.Cheap)
				{
                    if (iter == 0)
                    {
                        Graphics.SetRenderTarget(quarterRezColor);
                        GL.Clear(false, true, Color.black); // Clear to avoid RT restore
                        Graphics.Blit (secondQuarterRezColor, quarterRezColor);
                    }
                    else
                    {
                        quarterRezColor.MarkRestoreExpected(); // using max blending, RT restore expected
                        Graphics.Blit (secondQuarterRezColor, quarterRezColor, screenBlend, 10);
                    }
                }
            }

            if (quality > BloomQuality.Cheap)
            {
                Graphics.SetRenderTarget(secondQuarterRezColor);
                GL.Clear(false, true, Color.black); // Clear to avoid RT restore
                Graphics.Blit (quarterRezColor, secondQuarterRezColor, screenBlend, 6);
            }

            // lens flares: ghosting, anamorphic or both (ghosted anamorphic flares)

            if (lensflareIntensity > Mathf.Epsilon)
			{

                RenderTexture rtFlares4 = RenderTexture.GetTemporary (rtW4, rtH4, 0, rtFormat);

                if (lensflareMode == 0)
				{
                    // ghosting only

                    BrightFilter (lensflareThreshold, secondQuarterRezColor, rtFlares4);

                    if (quality > BloomQuality.Cheap)
					{
                        // smooth a little
                        blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 (0.0f, (1.5f) / (1.0f * quarterRezColor.height), 0.0f, 0.0f));
                        Graphics.SetRenderTarget(quarterRezColor);
                        GL.Clear(false, true, Color.black); // Clear to avoid RT restore
                        Graphics.Blit (rtFlares4, quarterRezColor, blurAndFlaresMaterial, 4);

                        blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 ((1.5f) / (1.0f * quarterRezColor.width), 0.0f, 0.0f, 0.0f));
                        Graphics.SetRenderTarget(rtFlares4);
                        GL.Clear(false, true, Color.black); // Clear to avoid RT restore
                        Graphics.Blit (quarterRezColor, rtFlares4, blurAndFlaresMaterial, 4);
                    }

                    // no ugly edges!
                    Vignette (0.975f, rtFlares4, rtFlares4);
                    BlendFlares (rtFlares4, secondQuarterRezColor);
                }
                else
				{

                    //Vignette (0.975ff, rtFlares4, rtFlares4);
                    //DrawBorder(rtFlares4, screenBlend, 8);

                    float flareXRot = 1.0f * Mathf.Cos(flareRotation);
                    float flareyRot = 1.0f * Mathf.Sin(flareRotation);

                    float stretchWidth = (hollyStretchWidth * 1.0f / widthOverHeight) * oneOverBaseSize;

                    blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 (flareXRot, flareyRot, 0.0f, 0.0f));
                    blurAndFlaresMaterial.SetVector ("_Threshhold", new Vector4 (lensflareThreshold, 1.0f, 0.0f, 0.0f));
                    blurAndFlaresMaterial.SetVector ("_TintColor", new Vector4 (flareColorA.r, flareColorA.g, flareColorA.b, flareColorA.a) * flareColorA.a * lensflareIntensity);
                    blurAndFlaresMaterial.SetFloat ("_Saturation", lensFlareSaturation);

                    // "pre and cut"
                    quarterRezColor.DiscardContents();
                    Graphics.Blit (rtFlares4, quarterRezColor, blurAndFlaresMaterial, 2);
                    // "post"
                    rtFlares4.DiscardContents();
                    Graphics.Blit (quarterRezColor, rtFlares4, blurAndFlaresMaterial, 3);

                    blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 (flareXRot * stretchWidth, flareyRot * stretchWidth, 0.0f, 0.0f));
                    // stretch 1st
                    blurAndFlaresMaterial.SetFloat ("_StretchWidth", hollyStretchWidth);
                    quarterRezColor.DiscardContents();
                    Graphics.Blit (rtFlares4, quarterRezColor, blurAndFlaresMaterial, 1);
                    // stretch 2nd
                    blurAndFlaresMaterial.SetFloat ("_StretchWidth", hollyStretchWidth * 2.0f);
                    rtFlares4.DiscardContents();
                    Graphics.Blit (quarterRezColor, rtFlares4, blurAndFlaresMaterial, 1);
                    // stretch 3rd
                    blurAndFlaresMaterial.SetFloat ("_StretchWidth", hollyStretchWidth * 4.0f);
                    quarterRezColor.DiscardContents();
                    Graphics.Blit (rtFlares4, quarterRezColor, blurAndFlaresMaterial, 1);

                    // additional blur passes
                    for (int iter = 0; iter < hollywoodFlareBlurIterations; iter++)
					{
                        stretchWidth = (hollyStretchWidth * 2.0f / widthOverHeight) * oneOverBaseSize;

                        blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 (stretchWidth * flareXRot, stretchWidth * flareyRot, 0.0f, 0.0f));
                        rtFlares4.DiscardContents();
                        Graphics.Blit (quarterRezColor, rtFlares4, blurAndFlaresMaterial, 4);

                        blurAndFlaresMaterial.SetVector ("_Offsets", new Vector4 (stretchWidth * flareXRot, stretchWidth * flareyRot, 0.0f, 0.0f));
                        quarterRezColor.DiscardContents();
                        Graphics.Blit (rtFlares4, quarterRezColor, blurAndFlaresMaterial, 4);
                    }

                    if (lensflareMode == (LensFlareStyle) 1)
                        // anamorphic lens flares
                        AddTo (1.0f, quarterRezColor, secondQuarterRezColor);
                    else
					{
                        // "combined" lens flares

                        Vignette (1.0f, quarterRezColor, rtFlares4);
                        BlendFlares (rtFlares4, quarterRezColor);
                        AddTo (1.0f, quarterRezColor, secondQuarterRezColor);
                    }
                }
                RenderTexture.ReleaseTemporary (rtFlares4);
            }

            int blendPass = (int) realBlendMode;
            //if (Mathf.Abs(chromaticBloom) < Mathf.Epsilon)
            //	blendPass += 4;

            screenBlend.SetFloat ("_Intensity", bloomIntensity);
            screenBlend.SetTexture ("_ColorBuffer", source);

            if (quality > BloomQuality.Cheap)
			{
                RenderTexture halfRezColorUp = RenderTexture.GetTemporary (rtW2, rtH2, 0, rtFormat);
                Graphics.Blit (secondQuarterRezColor, halfRezColorUp);
                Graphics.Blit (halfRezColorUp, destination, screenBlend, blendPass);
                RenderTexture.ReleaseTemporary (halfRezColorUp);
            }
            else
                Graphics.Blit (secondQuarterRezColor, destination, screenBlend, blendPass);

            RenderTexture.ReleaseTemporary (quarterRezColor);
            RenderTexture.ReleaseTemporary (secondQuarterRezColor);
        }

        private void AddTo (float intensity_, RenderTexture from, RenderTexture to)
        {
            screenBlend.SetFloat ("_Intensity", intensity_);
            to.MarkRestoreExpected(); // additive blending, RT restore expected
            Graphics.Blit (from, to, screenBlend, 9);
        }

        private void BlendFlares (RenderTexture from, RenderTexture to)
        {
            lensFlareMaterial.SetVector ("colorA", new Vector4 (flareColorA.r, flareColorA.g, flareColorA.b, flareColorA.a) * lensflareIntensity);
            lensFlareMaterial.SetVector ("colorB", new Vector4 (flareColorB.r, flareColorB.g, flareColorB.b, flareColorB.a) * lensflareIntensity);
            lensFlareMaterial.SetVector ("colorC", new Vector4 (flareColorC.r, flareColorC.g, flareColorC.b, flareColorC.a) * lensflareIntensity);
            lensFlareMaterial.SetVector ("colorD", new Vector4 (flareColorD.r, flareColorD.g, flareColorD.b, flareColorD.a) * lensflareIntensity);
            to.MarkRestoreExpected(); // additive blending, RT restore expected
            Graphics.Blit (from, to, lensFlareMaterial);
        }

        private void BrightFilter (float thresh, RenderTexture from, RenderTexture to)
        {
            brightPassFilterMaterial.SetVector ("_Threshhold", new Vector4 (thresh, thresh, thresh, thresh));
            Graphics.Blit (from, to, brightPassFilterMaterial, 0);
        }

        private void BrightFilter (Color threshColor,  RenderTexture from, RenderTexture to)
        {
            brightPassFilterMaterial.SetVector ("_Threshhold", threshColor);
            Graphics.Blit (from, to, brightPassFilterMaterial, 1);
        }

        private void Vignette (float amount, RenderTexture from, RenderTexture to)
        {
            if (lensFlareVignetteMask)
            {
                screenBlend.SetTexture ("_ColorBuffer", lensFlareVignetteMask);
                to.MarkRestoreExpected(); // using blending, RT restore expected
                Graphics.Blit (from == to ? null : from, to, screenBlend, from == to ? 7 : 3);
            }
            else if (from != to)
            {
                Graphics.SetRenderTarget (to);
                GL.Clear(false, true, Color.black); // clear destination to avoid RT restore
                Graphics.Blit (from, to);
            }
        }
    }
}


text:
require "rubygems"
require "spec" # Satisfies Autotest and anyone else not using the Rake tasks

require File.join(File.dirname(__FILE__), '..','lib','couchrest')
# check the following file to see how to use the spec'd features.

unless defined?(FIXTURE_PATH)
  FIXTURE_PATH = File.join(File.dirname(__FILE__), '/fixtures')
  SCRATCH_PATH = File.join(File.dirname(__FILE__), '/tmp')

  COUCHHOST = ENV['COUCHHOST'] || "http://127.0.0.1:5984"
  TESTDB    = 'couchrest-test'
  REPLICATIONDB = 'couchrest-test-replication'
  TEST_SERVER    = CouchRest.new COUCHHOST
  TEST_SERVER.default_database = TESTDB
  DB = TEST_SERVER.database(TESTDB)

  ADAPTER = ENV['ADAPTER'] || :restclient
end

def reset_test_db!
  DB.recreate! rescue nil
  DB
end

Spec::Runner.configure do |config|
  config.before(:all) { reset_test_db!; CouchRest.adapter = ADAPTER }

  config.after(:all) do
    cr = TEST_SERVER
    test_dbs = cr.databases.select { |db| db =~ /^#{TESTDB}/ }
    test_dbs.each do |db|
      cr.database(db).delete! rescue nil
    end
  end
end

def couchdb_lucene_available?
  lucene_path = "http://localhost:5985/"
  url = URI.parse(lucene_path)
  req = Net::HTTP::Get.new(url.path)
  res = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
  true
 rescue Exception => e
  false
end


text:
package org.apache.hadoop.hbase.rest.model;

import java.io.StringReader;
import java.io.StringWriter;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

import junit.framework.TestCase;
import org.apache.hadoop.hbase.SmallTests;
import org.junit.experimental.categories.Category;

@Category(SmallTests.class)
public class TestStorageClusterVersionModel extends TestModelBase<StorageClusterVersionModel> {
  private static final String VERSION = "0.0.1-testing";

  public TestStorageClusterVersionModel() throws Exception {
    super(StorageClusterVersionModel.class);
    AS_XML =
      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"+
      "<ClusterVersion>" + VERSION + "</ClusterVersion>";

    AS_JSON = "\"0.0.1-testing\"";
  }

  protected StorageClusterVersionModel buildTestModel() {
    StorageClusterVersionModel model = new StorageClusterVersionModel();
    model.setVersion(VERSION);
    return model;
  }

  protected void checkModel(StorageClusterVersionModel model) {
    assertEquals(model.getVersion(), VERSION);
  }

  @Override
  public void testFromPB() throws Exception {
    //ignore test no pb
  }
}