text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annales de la Société des Sciences Naturelles et d'Archéologie de Toulon et du Var 44(2): 110 (1992)

#### Original name
Hyalodendron pyrinum Goid.

### Remarks
null


text:
<resources>
    <!-- general strings -->
    <string name="app_name">SolaDroid</string>
    <string name="ok">OK</string>
    <string name="settings">Settings</string>
    <string name="cancel">Cancel</string>
    <string name="retrofit_error_title">Network Request Error</string>
    <string name="retrofit_error_message">We cannot load your Trello data at this time. Please try again later. Your progress could not be saved.</string>
    <string name="network_off_title">WiFi OFF</string>
    <string name="network_off_message">Your WiFi or Data seems to be disabled. We do not support offline mode in this version. Please enable your Internet access, otherwise you may experience data loss.</string>

    <!-- strings for the Trello setup functionality -->
    <string name="trello_access_denied">You have chosen not to allow SolaDroid to access your Trello account.\nIf you changed your mind, please press the "OK" button, otherwise the Android back button will exist the application.</string>
    <string name="trello_setup_boards_section_label">Your Boards</string>
    <string name="trello_setup_todo_section_label">Pick To Do List</string>
    <string name="trello_setup_doing_section_label">Pick Doing List</string>
    <string name="trello_setup_done_section_label">Pick Done List</string>
    <string name="trello_setup_all_done_button">All Done</string>

    <!-- strings for the task status functionality -->
    <string name="task_status_activity_title">Task Status</string>
    <string name="task_status_todo">To Do</string>
    <string name="task_status_doing">Doing</string>
    <string name="task_status_done">Done</string>
    <string name="task_status_action_previous">previous</string>
    <string name="task_status_action_next">next</string>

    <!-- strings for the Pomodoro timer functionality -->
    <string name="timer_pomodoro_counter">Pomodoros: %1$s</string>
    <string name="timer_pomodoro_timer">25:00</string>
    <string name="timer_pomodoro_total">Total: %1$s</string>
    <string name="timer_pomodoro_pause">Pause</string>
    <string name="timer_pomodoro_resume">Resume</string>
    <string name="timer_pomodoro_start">Start</string>
    <string name="timer_pomodoro_stop">Stop</string>
    <string name="timer_pomodoro_done">Done</string>
    <string name="timer_pomodoro_back">Back</string>
    <string name="timer_pomodoro_five">Take Five</string>
    <string name="timer_pomodoro_fifteen">Take Fifteen</string>
</resources>

redpajama_set_name: RedPajamaGithub


text:
package io.gravitee.am.gateway.handler.oidc.service.idtoken;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Base64;

/**
 * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
 * @author GraviteeSource Team
 */
public final class IDTokenUtils {

    private static final Logger logger = LoggerFactory.getLogger(IDTokenUtils.class);

    /**
     * When using the Hybrid Flow, additional hash requirements are mandatory to an ID Token returned from the Authorization Endpoint :
     * - at_hash
     *      Access Token hash value.
     *      Its value is the base64url encoding of the left-most half of the hash of the octets of the ASCII representation of the access_token value,
     *      where the hash algorithm used is the hash algorithm used in the alg Header Parameter of the ID Token's JOSE Header.
     *      For instance, if the alg is RS256, hash the access_token value with SHA-256, then take the left-most 128 bits and base64url encode them.
     *      The at_hash value is a case sensitive string.
     *      If the ID Token is issued from the Authorization Endpoint with an access_token value, which is the case for the response_type value code id_token token, this is REQUIRED;
     *      otherwise, its inclusion is OPTIONAL.
     * - c_hash
     *      Code hash value.
     *      Its value is the base64url encoding of the left-most half of the hash of the octets of the ASCII representation of the code value,
     *      where the hash algorithm used is the hash algorithm used in the alg Header Parameter of the ID Token's JOSE Header.
     *      For instance, if the alg is HS512, hash the code value with SHA-512, then take the left-most 256 bits and base64url encode them.
     *      The c_hash value is a case sensitive string.
     *      If the ID Token is issued from the Authorization Endpoint with a code, which is the case for the response_type values code id_token and code id_token token,
     *      this is REQUIRED; otherwise, its inclusion is OPTIONAL.
     * - s_hash
     *      State hash value.
     *      Its value is the base64url encoding of the left-most half of the hash of the octets of the ASCII representation
     *      of the state value, where the hash algorithm used is the hash algorithm used in the alg header parameter of
     *      the ID Token's JOSE header. For instance, if the alg is HS512, hash the state value with SHA-512, then take
     *      the left-most 256 bits and base64url encode them. The s_hash value is a case sensitive string.
     *
     * @param payload code or access token value
     * @param signingAlgorithm hash algorithm used in the alg Header Parameter of the ID Token's JOSE Header.
     * @return payload hash value
     */
    public static String generateHashValue(String payload, String signingAlgorithm) {
        try {
            MessageDigest md = MessageDigest.getInstance(signingAlgorithm);
            byte[] payloadHash = md.digest(payload.getBytes());
            byte[] leftMostHalfPayloadHash = Arrays.copyOf(payloadHash, payloadHash.length / 2);
            return Base64.getUrlEncoder().withoutPadding().encodeToString(leftMostHalfPayloadHash);
        } catch (Exception e) {
            logger.error("Unable to generate ID token claim hash value", e);
        }
        return null;
    }
}


text:
<?php
// autogenerated file 30.09.2013 15:20
// $Id: $
// $Log: $
//
//
require_once 'FeatureIDCodeType.php';
require_once 'AbstractRequestType.php';

/**
 * Returns information about the features that are applicable to different
 * categories,such as listing durations, shipping term requirements, and Best Offer
 * support.
 *
 * @link http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/types/GetCategoryFeaturesRequestType.html
 *
 */
class GetCategoryFeaturesRequestType extends AbstractRequestType
{
	/**
	 * @var string
	 */
	protected $CategoryID;
	/**
	 * @var int
	 */
	protected $LevelLimit;
	/**
	 * @var boolean
	 */
	protected $ViewAllNodes;
	/**
	 * @var FeatureIDCodeType
	 */
	protected $FeatureID;
	/**
	 * @var boolean
	 */
	protected $AllFeaturesForCategory;

	/**
	 * @return string
	 */
	function getCategoryID()
	{
		return $this->CategoryID;
	}
	/**
	 * @return void
	 * @param string $value
	 */
	function setCategoryID($value)
	{
		$this->CategoryID = $value;
	}
	/**
	 * @return int
	 */
	function getLevelLimit()
	{
		return $this->LevelLimit;
	}
	/**
	 * @return void
	 * @param int $value
	 */
	function setLevelLimit($value)
	{
		$this->LevelLimit = $value;
	}
	/**
	 * @return boolean
	 */
	function getViewAllNodes()
	{
		return $this->ViewAllNodes;
	}
	/**
	 * @return void
	 * @param boolean $value
	 */
	function setViewAllNodes($value)
	{
		$this->ViewAllNodes = $value;
	}
	/**
	 * @return FeatureIDCodeType
	 * @param integer $index
	 */
	function getFeatureID($index = null)
	{
		if ($index !== null) {
			return $this->FeatureID[$index];
		} else {
			return $this->FeatureID;
		}
	}
	/**
	 * @return void
	 * @param FeatureIDCodeType $value
	 * @param  $index
	 */
	function setFeatureID($value, $index = null)
	{
		if ($index !== null) {
			$this->FeatureID[$index] = $value;
		} else {
			$this->FeatureID = $value;
		}
	}
	/**
	 * @return void
	 * @param FeatureIDCodeType $value
	 */
	function addFeatureID($value)
	{
		$this->FeatureID[] = $value;
	}
	/**
	 * @return boolean
	 */
	function getAllFeaturesForCategory()
	{
		return $this->AllFeaturesForCategory;
	}
	/**
	 * @return void
	 * @param boolean $value
	 */
	function setAllFeaturesForCategory($value)
	{
		$this->AllFeaturesForCategory = $value;
	}
	/**
	 * @return
	 */
	function __construct()
	{
		parent::__construct('GetCategoryFeaturesRequestType', 'urn:ebay:apis:eBLBaseComponents');
		if (!isset(self::$_elements[__CLASS__]))
				self::$_elements[__CLASS__] = array_merge(self::$_elements[get_parent_class()],
				array(
					'CategoryID' =>
					array(
						'required' => false,
						'type' => 'string',
						'nsURI' => 'http://www.w3.org/2001/XMLSchema',
						'array' => false,
						'cardinality' => '0..1'
					),
					'LevelLimit' =>
					array(
						'required' => false,
						'type' => 'int',
						'nsURI' => 'http://www.w3.org/2001/XMLSchema',
						'array' => false,
						'cardinality' => '0..1'
					),
					'ViewAllNodes' =>
					array(
						'required' => false,
						'type' => 'boolean',
						'nsURI' => 'http://www.w3.org/2001/XMLSchema',
						'array' => false,
						'cardinality' => '0..1'
					),
					'FeatureID' =>
					array(
						'required' => false,
						'type' => 'FeatureIDCodeType',
						'nsURI' => 'urn:ebay:apis:eBLBaseComponents',
						'array' => true,
						'cardinality' => '0..*'
					),
					'AllFeaturesForCategory' =>
					array(
						'required' => false,
						'type' => 'boolean',
						'nsURI' => 'http://www.w3.org/2001/XMLSchema',
						'array' => false,
						'cardinality' => '0..1'
					)
				));
	}
}
?>


text:
<?php

namespace Oro\Bundle\ScopeBundle\Tests\Unit\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class StubType extends AbstractType
{
    const FIELD_1 = 'field1';
    const FIELD_2 = 'field2';
    const REQUIRED_OPTION = 'required_option';
    const NAME = 'stub_form_type';

    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add(self::FIELD_1, 'text')
            ->add(self::FIELD_2, 'text');
    }

    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            [
                'scope' => null,
                'ownership_disabled' => true
            ]
        );
        $resolver->setRequired(self::REQUIRED_OPTION);
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return self::NAME;
    }
}


text:
using System.Collections.Generic;
using System.Threading.Tasks;
using Casper.Domain.Infrastructure.MarkdownDocuments;

namespace Casper.Domain.Features.Pages
{
    public interface IPageRepository : IMarkdownDocumentRepository<Page>
    {
        Task<IEnumerable<Directory>> FindPublishedDirectoriesAsync(string relativeDirectory);
        Task<IEnumerable<Page>> FindPublishedPagesAsync(string relativeDirectory);
        Task<Page> GetPublishedPageAsync(string relativeUri);
    }
}


text:
<?php
// This is a podPress replacement file.

if (empty($wp)) {
	require_once('wp-config.php');
	wp('feed=atom');
}

header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
//header('Content-type: application/atom+xml; charset=' . get_settings('blog_charset'), true);
$more = 1;
?>
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
<feed
  xmlns="http://www.w3.org/2005/Atom"
  xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="<?php echo get_option('rss_language'); ?>"
  <?php do_action('atom_ns'); ?>
  >
	<id><?php bloginfo_rss('atom_url') ?></id>
	<title><?php bloginfo_rss('name') ?></title>
	<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('atom_url') ?>" />
	<link rel="alternate" type="application/rss+xml" href="<?php bloginfo_rss('rss2_url') ?>" />
	<link rel="alternate" type="text/html" hreflang="<?php echo get_option('rss_language'); ?>" href="<?php bloginfo_rss('home') ?>" />
	<subtitle type="xhtml">

			<?php bloginfo_rss('description') ?>

			Insert more info about your blog here.

	</subtitle>

	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('gmt'), false); ?></updated>
	<rights>Copyright <?php echo mysql2date('Y', get_lastpostdate('gmt'), false); ?> <?php bloginfo_rss('name') ?></rights>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
	<generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>

	<author>
		<name><?php bloginfo_rss('name') ?></name>
		<uri><?php bloginfo_rss('siteurl'); ?></uri>
	</author>
	<?php do_action('atom_head'); ?>
	<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
	<entry>
		<id><?php the_guid(); ?></id>
		<title type="html"><?php the_title_rss() ?></title>
		<link rel="alternate" type="text/html" hreflang="<?php echo get_option('rss_language'); ?>" href="<?php permalink_single_rss() ?>" />
		<link rel="related" type="application/rss+xml" href="<?php echo comments_rss(); ?>" />
		<author>
			<name><?php the_author() ?></name>
			<uri><?php $x = get_the_author_url(); if($x != 'http://' && $x != '') { echo $x; } else { echo bloginfo_rss('siteurl'); } ?></uri>
		</author>
		<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_modified_gmt, false); ?></updated>
		<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
		<?php the_category_rss('rdf') ?>
		<rights>Copyright <?php echo get_post_time('Y', true); ?> <?php the_author() ?></rights>
		<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>

				<?php the_excerpt_rss(); ?>

				(<a href="<?php comments_link(); ?>">Comments)

	<?php if ( !get_settings('rss_use_excerpt') ) : ?>
		<content type="xhtml">

				<?php the_content('', 0, '') ?>

				(<a href="<?php comments_link(); ?>">Comments)

		</content>
	<?php endif; ?>
	<?php rss_enclosure(); ?>
	<?php do_action('atom_entry'); ?>
	</entry>
	<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
</feed>


text:
package me.footlights.ui;

import java.io.*;
import javax.swing.*;

public class StatusDialog
{
	public void status(String status)
	{
		label.setText(status);
		System.out.println(status);
	}

	public PrintStream stream() { return printStream; }

	public static StatusDialog instance()
	{
		if (instance == null) instance =
			new StatusDialog("Footlights Status");

		return instance;
	}

	protected StatusDialog(String name)
	{
		label = new JLabel();
		textArea = new JTextArea();
		textArea.setBackground(java.awt.Color.BLACK);
		textArea.setForeground(java.awt.Color.GRAY);

		JScrollPane scrollPane = new JScrollPane(textArea);

		frame = new JFrame(name);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().add(label, java.awt.BorderLayout.NORTH);
		frame.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
		frame.pack();
		frame.setBounds(0, 0, 480, 240);
		frame.setVisible(true);

		OutputStream outStream = new OutputStream()
		{
			@Override public void write(int b) throws IOException
			{
				textArea.append(new String(new char[] { (char) b }));
				textArea.setCaretPosition(textArea.getDocument().getLength());
			}
		};

		printStream = new PrintStream(outStream);
		System.setOut(printStream);
		System.setErr(printStream);
	}

	private static StatusDialog instance;

	private PrintStream printStream;
	private JFrame frame;
	private JLabel label;
	private JTextArea textArea;
}


text:
'use strict';

module.exports = {
	db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/mean',
	assets: {
		lib: {
			css: [
				'public/lib/bootstrap/dist/css/bootstrap.css',
				'public/lib/bootstrap/dist/css/bootstrap-theme.css',
				'public/lib/bxSlider/jquery.bxslider.css'
			],
			js: [
				'public/lib/jquery/jquery.min.js',
				'public/lib/angular/angular.js',
				'public/lib/angular-resource/angular-resource.js',
				'public/lib/angular-animate/angular-animate.js',
				'public/lib/angular-ui-router/release/angular-ui-router.js',
				'public/lib/angular-ui-utils/ui-utils.js',
				'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
				'public/lib/angular-socket-io/socket.js',
				'public/lib/socket.io-client/socket.io.js',
				'public/lib/bxSlider/jquery.bxslider.js'
			]
		},
		css: [
			'public/modules/**/css/*.css'
		],
		js: [
			'public/config.js',
			'public/application.js',
			'public/modules/*/*.js',
			'public/modules/*/*[!tests]*/*.js'
		]
	},
	instagram: {
		clientID: process.env.INSTAGRAM_ID || 'CLIENT_ID',
		clientSecret: process.env.INSTAGRAM_SECRET || 'APP_SECRET',
		callbackURL: 'http://localhost:3000/auth/instagram/callback'
	},
	facebook: {
		clientID: process.env.FACEBOOK_ID || 'APP_ID',
		clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
		callbackURL: 'http://localhost:3000/auth/facebook/callback'
	},
	twitter: {
		clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
		clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
		callbackURL: 'http://localhost:3000/auth/twitter/callback'
	},
	google: {
		clientID: process.env.GOOGLE_ID || 'APP_ID',
		clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
		callbackURL: 'http://localhost:3000/auth/google/callback'
	},
	linkedin: {
		clientID: process.env.LINKEDIN_ID || 'APP_ID',
		clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
		callbackURL: 'http://localhost:3000/auth/linkedin/callback'
	}
};


text:
define([
    'App',
    'util/Util',
    'util/EventBus',
    'ui/util/Component',
    'ui/widgets/StatusWidget',
    'ui/widgets/EmailEntry',
    'om/User'
], function (App, Util, EventBus, Component, StatusWidget, EmailEntry, User) {
    'use strict';

    var me = {
        __proto__: Component.prototype,

        initComponent: function () {
            // me.emailControl = EmailEntry();
            // me.emailControl.prependTo(me.query('.review-status-right'));
            me.reviewStatusWidget = me.query('.review-status-widget');
            me.reviewerWidget = me.query('.reviewer-widget');
            me.emailEntry.insertBefore(me.reviewerWidget);
        },

        buildUI: function () {
            const visible = me.isVisible();
            me.setVisible(false);

            const descriptionEl = me.query('#review-description-inplace')[0];
            descriptionEl.value = App.review.description;
            descriptionEl.readOnly = !App.user.is(App.review.owningUser);

            StatusWidget(StatusWidget.IconSets.ReviewOwner, App.review.getStatus(), App.review.setStatus.bind(App.review))
                .whenLoaded(function (comp) {
                    me.reviewStatusWidget.setHtml(null);
                    comp.appendTo(me.reviewStatusWidget)
                });

            // Don't empty out the parent element until the widgets have loaded to prevent a double-add race condition
            // when a new reviewer joins a review for the first time.
            let needToEmptyParent = true;

            App.review.reviewers.forEach(function (reviewer) {
                const user = User(reviewer);
                if (!App.review.owningUser.is(user)) {
                    const status = App.review.getReviewerStatus(user) || { user: User(user) };
                    StatusWidget(StatusWidget.IconSets.Reviewer, status, App.review.setReviewerStatus.bind(App.review, user))
                        .whenLoaded(function (comp) {
                            if (needToEmptyParent) {
                                me.reviewerWidget.setHtml(null);
                                needToEmptyParent = false;
                            }
                            comp.appendTo(me.reviewerWidget)
                        });
                }
            });

            me.setVisible(visible);
        },

        handleActiveReviewChanged: function () {
            me.buildUI();
        },

        handleActiveEntryChanged: function(path, leftEntry, rightEntry) {
            me.setVisible(!path);
        },

        handleStatusChanged: function (event) {
            me.buildUI();
        },

        handleAddReviewer: function (reviewer) {
            App.review.addReviewer(reviewer);
        }
    };

    me.emailEntry = EmailEntry(me.handleAddReviewer);
    me.setEl(document.querySelector('.review-status'));

    EventBus.on('active_review_changed', me.handleActiveReviewChanged, me);
    EventBus.on('active_entry_changed', me.handleActiveEntryChanged, me);
    EventBus.on('change_review_status', me.handleStatusChanged, me);
    EventBus.on('change_reviewer_status', me.handleStatusChanged, me);
    EventBus.on('add_reviewer', me.handleStatusChanged, me);

    return me;
});


text:
package xyz.enhorse.cli;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * 09.09.2015.
 */
public class CommandLine {
    private Map<Feature, String> arguments = new HashMap<>(Feature.values().length);

    public CommandLine(final String[] args) {
        parse(args);
    }

    public String getArgumentValue(final Feature arg) {
        return arguments.get(arg);
    }

    public Set<Feature> getArguments() {
        return arguments.keySet();
    }

    private void parse(String[] args) {
        if (args != null) {
            String parameters = concatenateInLowerCase(args);
            String[] strings = parameters.split(Feature.DIVIDER);
            for (Feature feature : Feature.values()) {
                String argument = feature.getArgument();
                String value = parseArgumentValue(argument, strings);
                if (value != null) {
                    arguments.put(feature, value);
                }
            }
        }
    }

    private String concatenateInLowerCase(String[] arguments) {
        StringBuilder result = new StringBuilder();
        for (String argument : arguments) {
            result.append(argument.toLowerCase()).append(" ");
        }
        return result.toString().trim();
    }

    private String parseArgumentValue(final String argument, final String[] arguments) {
        String needed = argument.toLowerCase();
        for (String arg : arguments) {
            if (arg.startsWith(needed)) {
                return arg.substring(argument.length()).trim();
            }
        }
        return null;
    }
}


text:
// Copyright (c) Russlan Akiev. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

namespace ServiceBase.Localization
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using Microsoft.AspNetCore.Builder;
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.AspNetCore.Localization;
    using Microsoft.Extensions.DependencyInjection;
    using Microsoft.Extensions.Hosting;
    using Microsoft.Extensions.Localization;
    using Microsoft.Extensions.Logging;
    using Microsoft.Extensions.Options;
    using ServiceBase.Extensions;
    using ServiceBase.Resources;

    public static class LocalizationServiceCollectionExtensions
    {
        public static IServiceCollection AddJsonFileBasedLocalization(
            this IServiceCollection services,
            Action<LocalizationOptions> localizationOptionsSetupAction = null,
            Action<RequestLocalizationOptions> requestLocalizationOptionsSetupAction = null)
        {
            if (localizationOptionsSetupAction != null)
            {
                services.Configure(localizationOptionsSetupAction);
            }

            services.AddScoped<IResourceStore, InMemoryResourceStore>();
            services.AddSingleton<IStringLocalizerFactory, StringLocalizerFactory>();
            services.AddSingleton<IStringLocalizer, StringLocalizer>();
            services.AddScoped<LocalizationHelper>();

            IServiceProvider serviceProvider = services.BuildServiceProvider();

            IResourceStore resourceStore = serviceProvider
                .GetRequiredService<IResourceStore>();

            ILogger logger = serviceProvider.GetRequiredService<ILoggerFactory>()
                .CreateLogger("LocalizationServiceCollectionExtensions");

            LocalizationOptions localizationOptions = serviceProvider
                .GetRequiredService<IOptions<LocalizationOptions>>().Value;

            IHostEnvironment hostEnvironment = serviceProvider
                  .GetRequiredService<IHostEnvironment>();

            string resourcePath = localizationOptions.ResourcesPath
                .GetFullPath(hostEnvironment.ContentRootPath);

            logger.LogDebug("Loading resources from {0}", resourcePath);

            resourceStore.LoadLocalizationFromDirectoryAsync(resourcePath, null, logger).Wait();

            services.Configure<RequestLocalizationOptions>(options =>
            {
                logger.LogDebug("Setting default request culture to {0}",
                    localizationOptions.DefaultCulture);

                options.DefaultRequestCulture =
                    new RequestCulture(localizationOptions.DefaultCulture);

                IEnumerable<string> cultures =
                    resourceStore.GetAllLocalizationCulturesAsync().Result;

                logger.LogDebug("Setting supported cultures to {0}",
                    String.Join(", ", cultures));

                options.SupportedCultures =
                options.SupportedUICultures =
                    cultures.Select(s => new CultureInfo(s)).ToList();

                requestLocalizationOptionsSetupAction?.Invoke(options);
            });

            return services;
        }
    }
}


text:
import { ref, computed } from '@vue/composition-api'
import { useRoute } from '@front/util/router'
import { useApps } from '@front/features/apps'
import { BridgeEvents, parse, searchDeepInObject, getStorage, setStorage, Bridge } from '@vue-devtools/shared-utils'
import { getBridge, useBridge } from '@front/features/bridge'

export interface InspectorFromBackend {
  id: string
  appId: string
  pluginId: string
  label: string
  icon: string
  treeFilterPlaceholder: string
  stateFilterPlaceholder: string
  noSelectionText: string
  actions?: {
    icon: string
    tooltip?: string
  }[]
}

export interface Inspector extends InspectorFromBackend {
  rootNodes: any[]
  treeFilter: string
  selectedNodeId: string
  selectedNode: any
  stateFilter: string
  state: any
  expandedMap: Record<string, boolean>
}

const SELECTED_NODES_STORAGE = 'custom-inspector-selected-nodes'
let selectedIdsStorage = {}

function inspectorFactory (options: InspectorFromBackend): Inspector {
  return {
    ...options,
    rootNodes: [],
    treeFilter: '',
    selectedNodeId: selectedIdsStorage[options.id] || null,
    selectedNode: null,
    stateFilter: '',
    state: null,
    expandedMap: {}
  }
}

const inspectors = ref<Inspector[]>([])

export function useInspectors () {
  const { currentAppId } = useApps()
  const currentAppInspectors = computed(() => inspectors.value.filter(i => i.appId === currentAppId.value))

  return {
    inspectors: currentAppInspectors
  }
}

export function useCurrentInspector () {
  const route = useRoute()
  const { inspectors } = useInspectors()
  const { bridge } = useBridge()

  const currentInspector = computed(() => inspectors.value.find(i => i.id === route.value.params.inspectorId))

  const filteredState = computed(() => {
    if (currentInspector.value.stateFilter) {
      const result = {}
      for (const groupKey in currentInspector.value.state) {
        const group = currentInspector.value.state[groupKey]
        const groupFields = group.filter(el => searchDeepInObject({
          [el.key]: el.value
        }, currentInspector.value.stateFilter))
        if (groupFields.length) {
          result[groupKey] = groupFields
        }
      }
      return result
    } else {
      return currentInspector.value.state
    }
  })

  function selectNode (node) {
    currentInspector.value.selectedNodeId = node.id
    currentInspector.value.selectedNode = node
    selectedIdsStorage[currentInspector.value.id] = node.id
    setStorage(SELECTED_NODES_STORAGE, selectedIdsStorage)
    fetchState(currentInspector.value)
  }

  function refreshInspector () {
    refreshTree()
    refreshState()
  }

  function refreshTree () {
    fetchTree(currentInspector.value)
  }

  function refreshState () {
    fetchState(currentInspector.value)
  }

  function editState (path: string, payload: any, type: string) {
    bridge.send(BridgeEvents.TO_BACK_CUSTOM_INSPECTOR_EDIT_STATE, {
      inspectorId: currentInspector.value.id,
      appId: currentInspector.value.appId,
      nodeId: currentInspector.value.selectedNodeId,
      path,
      type,
      payload
    })
  }

  return {
    currentInspector,
    filteredState,
    selectNode,
    refreshInspector,
    refreshTree,
    refreshState,
    editState
  }
}

function fetchInspectors () {
  getBridge().send(BridgeEvents.TO_BACK_CUSTOM_INSPECTOR_LIST, {})
}

function fetchTree (inspector: Inspector) {
  if (!inspector) return
  getBridge().send(BridgeEvents.TO_BACK_CUSTOM_INSPECTOR_TREE, {
    inspectorId: inspector.id,
    appId: inspector.appId,
    treeFilter: inspector.treeFilter
  })
}

function fetchState (inspector: Inspector) {
  if (!inspector || !inspector.selectedNodeId) return
  getBridge().send(BridgeEvents.TO_BACK_CUSTOM_INSPECTOR_STATE, {
    inspectorId: inspector.id,
    appId: inspector.appId,
    nodeId: inspector.selectedNodeId
  })
}

export function resetInspectors () {
  inspectors.value = []
  fetchInspectors()
}

export function setupCustomInspectorBridgeEvents (bridge: Bridge) {
  selectedIdsStorage = getStorage(SELECTED_NODES_STORAGE, {})

  bridge.on(BridgeEvents.TO_FRONT_CUSTOM_INSPECTOR_LIST, ({ inspectors: list }) => {
    list.forEach(inspector => {
      if (!inspectors.value.some(i => i.id === inspector.id && i.appId === inspector.appId)) {
        inspectors.value.push(inspectorFactory(inspector))
      }
    })
  })

  bridge.on(BridgeEvents.TO_FRONT_CUSTOM_INSPECTOR_ADD, () => {
    fetchInspectors()
  })

  bridge.on(BridgeEvents.TO_FRONT_CUSTOM_INSPECTOR_TREE, ({ appId, inspectorId, rootNodes }) => {
    const inspector = inspectors.value.find(i => i.id === inspectorId && i.appId === appId)

    if (!inspector) {
      console.error(`Inspector ${inspectorId} not found`)
      return
    }

    inspector.rootNodes = rootNodes
  })

  bridge.on(BridgeEvents.TO_FRONT_CUSTOM_INSPECTOR_STATE, ({ appId, inspectorId, state }) => {
    const inspector = inspectors.value.find(i => i.id === inspectorId && i.appId === appId)

    if (!inspector) {
      console.error(`Inspector ${inspectorId} not found`)
      return
    }

    inspector.state = parse(state)
  })

  bridge.on(BridgeEvents.TO_FRONT_CUSTOM_INSPECTOR_SELECT_NODE, ({ appId, inspectorId, nodeId }) => {
    const inspector = inspectors.value.find(i => i.id === inspectorId && i.appId === appId)

    if (!inspector) {
      console.error(`Inspector ${inspectorId} not found`)
      return
    }

    inspector.selectedNodeId = nodeId
    inspector.selectedNode = null
    selectedIdsStorage[inspector.id] = nodeId
    setStorage(SELECTED_NODES_STORAGE, selectedIdsStorage)
    fetchState(inspector)
  })

  resetInspectors()
}


text:
/*
 * Write a program that extracts from given HTML file its title (if available), and its body text without the HTML tags.
*/

using System;
using System.IO;
using System.Text.RegularExpressions;

class TitleExtraction
{
    static void Main()
    {
        try
        {
            //StreamReader to read the file file.html
            StreamReader reader = new StreamReader("file.html");
            using (reader)
            {
                string htmlText = reader.ReadToEnd();
                string titleRegex = "<title>(?<title>.*?)</title>";
                Console.WriteLine("Title: " + Regex.Match(htmlText, titleRegex, RegexOptions.IgnoreCase).Groups["title"]);
                string bodyRegex = "<body>(?<body>(.|\\s)*?)</body>";
                string bodyWithTags = Regex.Match(htmlText, bodyRegex, RegexOptions.IgnoreCase).Groups["body"].Value;
                string tagRegex = "<.+?>|</.+?>";
                Console.WriteLine("Body: \n" + Regex.Replace(bodyWithTags, tagRegex, g => " "));
            }
        }
        catch (ArgumentException)
        {
            Console.WriteLine("The file does not exist!");
        }
        catch (FileNotFoundException)
        {
            Console.WriteLine("The file does not exist!");
        }
        catch (DirectoryNotFoundException)
        {
            Console.WriteLine("The directory where the file should be does not exist!");
        }
        catch (IOException)
        {
            Console.WriteLine("IO Exception has accured!");
        }
        catch (OutOfMemoryException)
        {
            Console.WriteLine("Out of memory!");
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
McIlvainea 6(2): 62 (1984)

#### Original name
Cortinarius sanguineus var. subcinnabarinus Ammirati & A.H. Sm.

### Remarks
null


text:
import { remove } from "lodash"
import gravity from "lib/loaders/gravity"
import { enhance } from "lib/helpers"
import ArtworkLayer from "./layer"
import { GraphQLList } from "graphql"

export const artworkLayers = id =>
  gravity(`related/layers`, { artwork: [id] }).then(layers => enhance(layers, { artwork_id: id })).then(layers =>
    // Move fair layer to the beginning
    remove(layers, ({ type }) => type === "fair").concat(layers)
  )

export default {
  type: new GraphQLList(ArtworkLayer.type),
}


text:
package org.whale.system.tag;

import org.whale.system.common.util.ListUtil;
import org.whale.system.common.util.Strings;
import org.whale.system.domain.FileInfo;
import org.whale.system.service.FileInfoService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
import java.util.ArrayList;
import java.util.List;

/**
 * 图片上传处理控件
 * 所有文件数据在 filesArr_id 中
 * @author wjs
 *
 */
public class ImageTag extends TagSupport {
	private static final long serialVersionUID = 11343L;
	private static final String LOGIC_TRUE = "true";

	private String ctx;
	private String resource;

	/** ID */
	private String id;
	/** 附件urlPath值 */
	private String value = "";
	/** 只能查看,不能删除,编辑*/
	private String readonly = "false";
	/** 保存方式 DISK|FTP|BOTH|NONE */
	private Integer saveWay = FileInfo.SAVE_DISK;
	/** 保存文件相对路径 */
	private String dirName = "img";
	/** 图片上传处理地址 */
	private String url="fileInfo/doImgUpload";
	/** 自动上传 auto*/
	private String autoSubmit = "true";
	/** 文件大小限制*/
	private Integer fileSizeLimit;
	/** 上传类型限制*/
	private String fileTypeExts = "gif,jpg,jpeg,bmp,png";
	/** 图片上传的最多数量*/
	private Integer maxNum = 1;
	/** 扩展数据*/
	private String extInfo = "{}";

	@Override
	public int doStartTag() throws JspException {
		HttpServletRequest request =(HttpServletRequest) pageContext.getRequest();
		ctx = request.getContextPath();
		resource = (String)request.getSession().getServletContext().getAttribute("html");
		if(this.maxNum < 1){
			this.maxNum = 1;
		}

		boolean isReadonly = LOGIC_TRUE.equals(this.getReadonly());
		if("null".equals(this.value)){
			value = "";
		}
		if(!url.startsWith(request.getContextPath()+"/")){
			url = request.getContextPath()+"/"+url;
		}

		List<FileInfo> upLoadFiles = this.getFileInfos();

		StringBuilder strb = new StringBuilder();
		strb.append(this.bulidHtml(upLoadFiles, isReadonly));
		//
		if(isReadonly){
			strb.append("\n");
		}else{
			strb.append("\n")
				.append("\n");
		}
		try {
			pageContext.getOut().print(strb.toString());
		} catch (java.io.IOException e) {
			e.printStackTrace();
			throw new JspTagException(e.getMessage());
		}
		return SKIP_BODY;
	}

	private String bulidHtml(List<FileInfo> fileInfos, boolean isReadonly){
		StringBuilder strb = new StringBuilder();

		int itemNum = fileInfos == null ? 0 : fileInfos.size();
		strb.append("
\n")
			.append("
\n");
		List<Long> fileIds = new ArrayList<Long>();
		if(fileInfos != null && fileInfos.size() > 0){
			for(FileInfo fileInfo : fileInfos){
				strb.append(this.bulidFileHtml(fileInfo, isReadonly));
				fileIds.add(fileInfo.getId());
			}
		}
		strb.append("
\n");
		if(!isReadonly){
			if(itemNum >= this.maxNum){
				strb.append("
选择图片
\n");
			}else{
				strb.append("
选择图片
\n");
			}
		}

		strb.append("	<input type=\"hidden\" id=\""+this.id+"\" name=\""+this.id+"\" value=\"").append(value.trim()).append("\" imgid=\"").append(ListUtil.join(fileIds)).append("\" />\n")
			.append("
\n\n");

		return strb.toString();
	}

	private String bulidFileHtml(FileInfo fileInfo, boolean isReadonly){
		if(fileInfo == null)
			return "";
		StringBuilder strb = new StringBuilder();

		strb.append("
\n")
			.append("	\n")
			.append(isReadonly ? "" : "
\n")
			.append(isReadonly ? "" : "		编辑\n")
			.append(isReadonly ? "" : "		删除\n")
			.append(isReadonly ? "" : "
\n")
			.append("
\n");

		return strb.toString();
	}

	/**
	 * 初始化Uploadify
	 * @param request
	 * @return
	 */
	private String bulidUploadJs(HttpServletRequest request){
		StringBuilder strb = new StringBuilder();

		strb.append("jQuery(function() {\n")
			//.append("	$(\"img[mark=img]\").imgPreview();\n\n")
			.append("var $ = jQuery,\n")
			.append("	$list_"+this.id+" = $('#imageList_"+this.id+"'),\n")
			.append("	ratio_"+this.id+" = window.devicePixelRatio || 1,\n")
			.append("	thumbnailWidth_"+this.id+" = 100 * ratio_"+this.id+",\n")
			.append("	thumbnailHeight_"+this.id+" = 100 * ratio_"+this.id+",\n")
			.append("	uploader_"+this.id+";\n\n");

		strb.append("uploader_"+this.id+" = WebUploader.create({\n")
			.append("	auto: ").append(this.getAutoSubmit()).append(",\n")
			.append("	swf: '").append(this.resource).append("/plugin/webuploader/Uploader.swf',\n")
			.append("	server: '").append(this.getUrl()).append("',\n")
			.append("	pick: '#imageSel_").append(this.id).append("',\n")
			.append("	duplicate:true,\n");
		if(this.fileSizeLimit != null && this.fileSizeLimit > 1){
		strb.append("	fileSingleSizeLimit:").append(fileSizeLimit).append(",\n");
		}
		strb.append("	accept: {\n")
			.append("		title: 'Images',\n")
			.append("		extensions: '").append(this.getFileTypeExts()).append("',\n")
			.append("		mimeTypes: 'image/*'\n")
			.append("	},\n")
			.append("	formData: {\n")
			.append("		jsessionid: '").append(request.getSession().getId()).append("',\n")
			.append("		fileType: ").append(FileInfo.TYPE_IMG).append(",\n")
			.append("		saveWay: ").append(this.getSaveWay()).append(",\n")
			.append("		dirName: '").append(this.getDirName()).append("',\n")
			.append("		extInfo: ").append(this.extInfo).append("\n")
			.append("	}\n")
			.append("});\n\n");
		return strb.toString();
	}

	private String bulidEventStr(){
		StringBuilder strb = new StringBuilder();
		// 当有文件添加进来的时候
		strb.append("uploader_"+this.id+".on('fileQueued', function(file) {\n")
			.append("	var $li = $('
' +\n")
			.append("		'' +\n")
			.append("		'
' +\n")
			.append("			'编辑'+\n")
			.append("			'删除'+\n")
			.append("		'
'+\n")
			.append("	'
'\n")
			.append("	),\n")
			.append("	$img = $li.find('img');\n")
			.append("	$list_"+this.id+".append( $li );\n")
			.append("	uploader_"+this.id+".makeThumb(file, function(error, src ) {\n")
			.append("		if (error) {\n")
			.append("			$img.replaceWith('不能预览');\n")
			.append("			return;\n")
			.append("		}\n")
			.append("		$img.attr( 'src', src );\n")
			.append("	}, thumbnailWidth_"+this.id+", thumbnailHeight_"+this.id+");\n")
			.append("	var curItemNum = parseInt($('#image_"+this.id+"').attr('itemnum'));\n")
			.append("	if((curItemNum+1) >= parseInt($('#image_"+this.id+"').attr('maxnum'))){\n")
			.append("		$('#imageSel_"+this.id+"').css('visibility','hidden');\n")
			.append("	}\n")
			.append("});\n\n");

		// 文件上传过程中创建进度条实时显示。
		strb.append("uploader_"+this.id+".on('uploadProgress', function(file, percentage) {\n")
			.append("	var $li = $('#'+file.id ),\n")
			.append("	$percent = $li.find('.progress span');\n")
			.append("	if(!$percent.length) {\n")
			.append("		$percent = $('

').appendTo( $li ).find('span');\n")
			.append("	}\n")
			.append("	$percent.css( 'width', percentage * 100 + '%' );\n")
			.append("});\n\n");

		// 文件上传成功,给item添加成功class, 用样式标记上传成功。
		strb.append("uploader_"+this.id+".on('uploadSuccess', function(file, response) {\n")
			.append("	if(response.rs){\n")
			.append("		$( '#'+file.id ).addClass('upload-state-done').attr('imgid',response.datas.id);\n")
			.append("		var $img = $( '#'+file.id ).find('img');\n")
			.append("		$img.attr('imgid',response.datas.id).attr('url', response.datas.urlPath);\n")
			.append("		var imgVal = $('#"+this.getId()+"').val();\n")
			.append("		var imgId = $('#"+this.getId()+"').attr('imgid');\n")
			.append("		if(imgVal == '' || imgVal == null){\n")
			.append("			$('#"+this.getId()+"').val(response.datas.urlPath).attr('imgid',response.datas.id);\n")
			.append("		}else{\n")
			.append("			$('#"+this.getId()+"').val(imgVal+','+response.datas.urlPath).attr('imgid',(imgId+','+response.datas.id));\n")
			.append("		}\n")
			.append("		var newItemNum = parseInt($('#image_"+this.id+"').attr('itemnum'))+1;\n")
			.append("		$('#image_"+this.id+"').attr('itemnum', newItemNum);\n")
			.append("	}else{\n")
			.append("		uploadError(file, response);\n")
			.append("	}\n")
			.append("});\n\n");

		// 文件上传失败,现实上传出错。
		strb.append("uploader_"+this.id+".on('uploadError', function(file, response) {\n")
			.append("	uploadError(file, response);\n")
			.append("});\n\n");

		// 完成上传完了,成功或者失败,先删除进度条。
		strb.append("uploader_"+this.id+".on('uploadComplete', function(file) {\n")
		.append("	$( '#'+file.id ).find('.progress').remove();\n")
		.append("});\n\n");

		strb.append("function uploadError(file, response) {\n")
			.append("	var $li = $('#'+file.id ),\n")
			.append("	$error = $li.find('div.error');\n")
			.append("	if(!$error.length) {\n")
			.append("		$error = $('

').appendTo( $li );\n")
			.append("	}\n")
			.append("	$error.text('上传失败').attr(\"title\",'上传失败:'+response.msg);\n")
			.append("	$('#imageSel_"+this.id+"').css('visibility','visible');")
			.append("}\n\n");

		return strb.toString();
	}

	private String bulidShowImageStr(){
		StringBuilder strb = new StringBuilder();
		strb.append("function showImage_"+id+"(obj){\n")
			.append("	var url = $(obj).attr('url');\n")
			.append("	$.openWin({url: url, title:'查看图片'});\n")
			.append("}\n\n");
		return strb.toString();
	}

	private String bulidEditImageStr(){
		StringBuilder strb = new StringBuilder();
		strb.append("function editImage_"+this.id+"(obj){\n")
			.append("	var fileId = $(obj).parent().parent().attr('imgid');\n")
			.append("	$.openWin({width:700,height:500,url:\""+this.ctx+"/fileInfo/goEditImg?fileId=\"+fileId+\"&tagId="+this.id+"\", title:'编辑图片'});\n")
			.append("}\n\n");
		return strb.toString();
	}

	private String bulidDelImageStr(){
		StringBuilder strb = new StringBuilder();
		strb.append("function delImage_"+this.getId()+"(obj){\n")
			.append("	var fileId = $(obj).parent().parent().attr('imgid');\n")
			.append("	$.del({url: '"+ctx+"/fileInfo/doDelete', datas:{fileId: fileId}, onSuccess: function(){\n")
			.append("		$(\"div[imgid=\"+fileId+\"]\").remove();\n")
			.append("		var imgVal = $('#"+this.getId()+"').val();\n")
			.append("		var imgId = $('#"+this.getId()+"').attr('imgid');\n")
			.append("		if(imgVal != null && imgVal.length > 0){\n")
			.append("			var imgVals = imgVal.split(',');\n")
			.append("			var imgIds = imgId.split(',');\n")
			.append("			for(var i=0; i<imgIds.length; i++){\n")
			.append("				if(parseInt(imgIds[i]) == parseInt(fileId)){\n")
			.append("					imgIds.splice(i, 1);\n")
			.append("					imgVals.splice(i, 1);\n")
			.append("					$('#"+this.getId()+"').val(imgVals.join(',')).attr('imgid',imgIds.join(','));\n")
			.append("				}\n")
			.append("			}\n")
			.append("		}\n")
			.append("		var newItemNum = parseInt($('#image_"+this.id+"').attr('itemnum'))-1;\n")
			.append("		$('#image_"+this.id+"').attr('itemnum', newItemNum);\n")
			.append("		if(newItemNum >= parseInt($('#image_"+this.id+"').attr('maxnum'))){\n")
			.append("			$('#imageSel_"+this.id+"').css('visibility','hidden');\n")
			.append("		}else{\n")
			.append("			$('#imageSel_"+this.id+"').css('visibility','visible');\n")
			.append("		}\n")
			.append("	  }});\n")
			.append("}\n\n");

		return strb.toString();
	}

	private String bulidChangeImgStr(){
		StringBuilder strb = new StringBuilder();
		strb.append("function changeImage_"+this.id+"(fileObj){\n")
			.append("	var url = fileObj.urlPath+\"?\"+new Date().getTime();\n")
			.append("	$(\"img[imgid=\"+fileObj.id+\"]\").attr(\"src\", url);\n")
			.append("}\n\n");
	return strb.toString();
}

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

	private List<FileInfo> getFileInfos(){
		if(Strings.isNotBlank(this.value)){
			FileInfoService fileInfoService = FileInfoService.getThis();

			String[] filePaths = this.value.split(",");
			List<FileInfo> list = new ArrayList<FileInfo>(filePaths.length);
			FileInfo fileInfo = null;
			for(String urlPath : filePaths){
				if(Strings.isNotBlank(urlPath)){
					fileInfo = fileInfoService.getByUrlPath(urlPath);
					if(fileInfo != null){
						list.add(fileInfo);
					}
				}
			}
			return list;
		}
		return null;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getReadonly() {
		return readonly;
	}

	public void setReadonly(String readonly) {
		this.readonly = readonly;
	}

	public Integer getSaveWay() {
		return saveWay;
	}

	public void setSaveWay(Integer saveWay) {
		this.saveWay = saveWay;
	}

	public String getDirName() {
		return dirName;
	}

	public void setDirName(String dirName) {
		this.dirName = dirName;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getAutoSubmit() {
		return autoSubmit;
	}

	public void setAutoSubmit(String autoSubmit) {
		this.autoSubmit = autoSubmit;
	}

	public Integer getFileSizeLimit() {
		return fileSizeLimit;
	}

	public void setFileSizeLimit(Integer fileSizeLimit) {
		this.fileSizeLimit = fileSizeLimit;
	}

	public String getFileTypeExts() {
		return fileTypeExts;
	}

	public void setFileTypeExts(String fileTypeExts) {
		this.fileTypeExts = fileTypeExts;
	}
	public Integer getMaxNum() {
		return maxNum;
	}

	public void setMaxNum(Integer maxNum) {
		this.maxNum = maxNum;
	}

	public String getExtInfo() {
		return extInfo;
	}

	public void setExtInfo(String extInfo) {
		this.extInfo = extInfo;
	}

}


text:
describe("go.apps.dialogue.models", function() {
  var dialogue = go.apps.dialogue,
      modelData = dialogue.testHelpers.modelData;

  var testHelpers = go.testHelpers,
      response = testHelpers.rpc.response,
      assertRequest = testHelpers.rpc.assertRequest;

  afterEach(function() {
    go.testHelpers.unregisterModels();
  });

  describe(".DialogueStateModelCollection", function() {
    var DialogueStateModelCollection = dialogue.models.DialogueStateModelCollection;

    describe("ordering", function() {
      it("should sort states with ordinal fields", function() {
        var data = modelData().states.slice(0, 3);
        data[0].uuid = 'a';
        data[0].ordinal = 2;

        data[1].uuid = 'b';
        data[1].ordinal = 3;

        data[2].uuid = 'c';
        data[2].ordinal = 1;

        var collection = new DialogueStateModelCollection(data);
        assert.deepEqual(collection.pluck('uuid'), ['c', 'a', 'b']);
      });

      it("should move states without ordinal fields to the end", function() {
        var data = modelData().states.slice(0, 4);

        data[0].uuid = 'a';
        data[0].ordinal = 2;

        data[1].uuid = 'b';
        delete data[1].ordinal

        data[2].uuid = 'c';
        data[2].ordinal = 1;

        data[3].uuid = 'd';
        delete data[3].ordinal;

        var collection = new DialogueStateModelCollection(data);
        assert.deepEqual(collection.pluck('uuid'), ['c', 'a', 'b', 'd']);
      });
    });
  });

  describe(".ChoiceEndpointModel", function() {
    var ChoiceEndpointModel = dialogue.models.ChoiceEndpointModel;

    var model;

    beforeEach(function() {
      model = new ChoiceEndpointModel();
    });

    afterEach(function() {
      Backbone.Relational.store.unregister(model);
    });

    describe("when its 'label' attr is changed", function() {
      it("should reset the default 'value' attr if it isn't user defined",
      function() {
        assert(!model.has('value'));
        assert.isFalse(model.get('user_defined_value'));

        model.set('label', 'Message 1');
        assert.equal(model.get('value'), 'message-1');

        model.set('value', 'user-defined-value');
        model.set('user_defined_value', true);
        model.set('label', 'User Defined Message');
        assert.equal(model.get('value'), 'user-defined-value');
      });
    });

    describe(".setValue", function() {
      it("should set its 'value' attr to a slug of the input", function() {
        assert(!model.has('value'));
        model.setValue('Some Value');
        assert.equal(model.get('value'), 'some-value');
      });
    });
  });

  describe(".DialogueStateModel", function() {
    var DialogueStateModel = dialogue.models.DialogueStateModel;

    var model;

    beforeEach(function() {
      model = new DialogueStateModel();
    });

    afterEach(function() {
      Backbone.Relational.store.unregister(model);
    });

    describe("when its 'name' attr is changed", function() {
      it("should reset the default 'store_as' attr if it isn't user defined",
      function() {
        assert(!model.has('store_as'));
        assert.isFalse(model.get('user_defined_store_as'));

        model.set('name', 'State 1');
        assert.equal(model.get('store_as'), 'state-1');

        model.set('store_as', 'user-defined-store-as');
        model.set('user_defined_store_as', true);
        model.set('name', 'User Defined Name');
        assert.equal(model.get('store_as'), 'user-defined-store-as');
      });
    });

    describe(".setStoreAs", function() {
      it("should set its 'store_as' attr to a slug of the input", function() {
        assert(!model.has('store_as'));
        model.setStoreAs('Some Value');
        assert.equal(model.get('store_as'), 'some-value');
      });
    });
  });

  describe(".DialogueModel", function() {
    var DialogueModel = dialogue.models.DialogueModel;

    var server;

    beforeEach(function() {
      server = sinon.fakeServer.create();
    });

    afterEach(function() {
      server.restore();
    });

    describe(".fetch", function() {
      it("should issue the correct api request", function(done) {
        var model = new DialogueModel({
          campaign_id: 'campaign-1',
          conversation_key: 'conversation-1',
        });

        server.respondWith(function(req) {
          assertRequest(
            req,
            '/api/v1/go/api',
            'conversation.dialogue.get_poll',
            ['campaign-1', 'conversation-1']);

          done();
        });

        model.fetch();
        server.respond();
      });

      it("should update the model on the client side", function() {
        var model = new DialogueModel();
        server.respondWith(response({poll: modelData()}));

        model.fetch();
        server.respond();

        assert.deepEqual(model.toJSON(), modelData());
      });
    });

    describe(".save", function() {
      it("should issue the correct api request", function(done) {
        var model = new DialogueModel(modelData());

        server.respondWith(function(req) {
          assertRequest(
            req,
            '/api/v1/go/api',
            'conversation.dialogue.save_poll',
            ['campaign-1', 'conversation-1', {poll: modelData()}]);

          done();
        });

        model.save();
        server.respond();
      });
    });
  });
});


text:
package io.github.karols.units.arrays

import io.github.karols.units._
import scala.collection.mutable._

object Vector2AArray {
	/** Creates an array of given elements */
	def apply[A<:AffineSpace](elems: Vector2A[A]*) = {
		val a = new Array[Double](elems.length * 2)
		(0 until elems.length).foreach{ i =>
			a(i*2)   = elems(i).x.value
			a(i*2+1) = elems(i).y.value
		}
		new Vector2AArray[A](a)
	}

	/** Concatenates all arrays into a single array. */
	def concat[A<:AffineSpace](arrays: Vector2AArray[A]*) =
		new Vector2AArray(
			Array.concat(arrays.map{_.underlying}: _*))

	/** Copy one array to another. */
	def copy[A<:AffineSpace](
		src: Vector2AArray[A], srcPos: Int,
		dest: Vector2AArray[A], destPos: Int,
		length: Int) {
		Array.copy(src.underlying, srcPos*2, dest.underlying, destPos*2, length*2)
	}

	/** Returns an array of length 0. */
	def empty[A<:AffineSpace] = new Vector2AArray[A](Array.empty[Double])

	/** Returns an array that contains the results of some element computation a number of times. */
	def fill[A<:AffineSpace](n: Int)(elem: =>Vector2A[A]) = {
		val a = new Array[Double](n * 2)
		(0 until n).foreach{ i =>
			val e = elem
			a(i*2)   = e.x.value
			a(i*2+1) = e.y.value
		}
		new Vector2AArray(a)
	}

	/** Returns an array that contains a constant element a number of times. */
	def fillUniform[A<:AffineSpace](n: Int)(elem: Vector2A[A]) = {
		val x = elem.x.value
		val y = elem.y.value
		val a = new Array[Double](n*2)
		var i = 0
		(0 until n).foreach{ i =>
			a(i*2)     = x
			a(i*2 + 1) = y
		}
		new Vector2AArray(a)
	}

	def unapplySeq[A<:AffineSpace](arr: Vector2AArray[A]) = Some(arr)

	def at[A<:AffineSpace](values: (Double, Double)*) = apply(values.map(_.at[A]):_*)

	//TODO: more
}

class Vector2AArrayBuilder[A<:AffineSpace] extends Builder[Vector2A[A], Vector2AArray[A]] {
	val underlying = new ArrayBuilder.ofDouble

	def +=(elem: Vector2A[A]) = {
		underlying += elem.x.value
		underlying += elem.y.value
		this
	}
	def clear() = {
		underlying.clear
	}
	def result() = new Vector2AArray[A](underlying.result())
}

/** Mutable fixed-size array of unboxed [[io.github.karols.units.Vector2A]]. */
final class Vector2AArray[A<:AffineSpace] private[arrays] (
	private[arrays] val underlying: Array[Double]
	)
	extends IndexedSeq[Vector2A[A]]
	with ArrayLike[Vector2A[A], Vector2AArray[A]]{

	def this(length: Int) {
		this(new Array[Double](2*length))
	}

	override val length = underlying.length/2
	override def stringPrefix = "Vector2AArray"
	override def newBuilder = new Vector2AArrayBuilder[A]

	def apply(index: Int) =
		new Vector2A[A](underlying(index*2).at, underlying(index*2+1).at)

	def update(index: Int, elem: Vector2A[A]) {
		underlying(index*2) = elem.x.value
		underlying(index*2+1) = elem.y.value
	}

	/** Returns separate arrays for each coordinate. */
	def unzip = (xs, ys)

	/** Returns an array of values of the X coordinate. */
	def xs = {
		val array = new Array[Double](length)
		(0 until length) foreach { i =>
			array(i) = underlying(i*2)
		}
		new DoubleAArray[A](array)
	}

	/** Returns an array of values of the Y coordinate. */
	def ys = {
		val array = new Array[Double](length)
		(0 until length) foreach { i =>
			array(i) = underlying(i*2 + 1)
		}
		new DoubleAArray[A](array)
	}

	/** Returns the value of the X coordinate of given element. */
	def x(index: Int) = underlying(2*index).at[A]

	/** Returns the value of the Y coordinate of given element. */
	def y(index: Int) = underlying(2*index + 1).at[A]

	/** The average of all values in the array */
	def avg = {
		var sx = 0.0
		var sy = 0.0
		var i = 0
		var l = length
		while(i < l){
			sx += underlying(2*i)
			sy += underlying(2*i + 1)
			i += 1
		}
		sx /= l
		sy /= l
		Vector2A[A](sx.at, sy.at)
	}

}


text:
require File.expand_path('../boot', __FILE__)

# require 'rails/all'
require "action_controller/railtie"
require "action_mailer/railtie"
# require "active_resource/railtie"
require "sprockets/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)

module Setup; end

module Cenit
  class Application < Rails::Application

    config.autoload_paths += %W(#{config.root}/lib) #/**/*.rb
    config.enable_dependency_loading = true

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
    #
    config.load_defaults '5.2'

    config.to_prepare do
      # Load application's model / class decorators
      Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end
      Dir.glob(File.join(File.dirname(__FILE__), "../lib/**/*_decorator*.rb")) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end
    end

    config.mongoid.logger.level =
      begin
        Logger.const_get(ENV['MONGOID_LOGGER_LEVEL'])
      rescue
        Logger::FATAL
      end

    config.after_initialize do

      default_user_email = ENV['DEFAULT_USER_EMAIL'] || 'support@cenit.io'

      User.current = User.where(email: default_user_email).first ||
        User.with_role(Role.find_or_create_by(name: :super_admin).name).first ||
        User.create!(
          email: default_user_email,
          password: ENV.fetch('DEFAULT_USER_PASSWORD', 'password')
        )

      unless User.current.super_admin_enabled
        puts "Enabling super admin access for user #{User.current.email}"
        User.current.update!(super_admin_enabled: true)
      end

      ::Setup::Configuration.check!

      eager_load!

      setup_build_in_apps_types

      unless ENV['SKIP_DB_INITIALIZATION'].to_b
        Setup::DelayedMessage.do_load unless ENV['SKIP_LOAD_DELAYED_MESSAGES'].to_b

        Cenit::Hook.init

        puts 'Clearing LOCKS'
        Cenit::Locker.clear

        puts 'DELETING CANCELLED Consumers'
        RabbitConsumer.where(alive: false).delete_all

        Capataz::Cache.clean

      end

      Setup::CenitDataType.init!

      Setup::BuildInFileType.init!

      Mongoff::Model.config do
        before_save ->(record) do
          record.updated_at = DateTime.now
          if record.new_record?
            record.created_at = record.updated_at
          elsif record.orm_model.observable?
            record.instance_variable_set(:@_obj_before, record.orm_model.where(id: record.id).first)
          end
          true
        end

        after_save ->(record) do
          if record.orm_model.observable? && !record.instance_variable_get(:@discard_event_lookup)
            Setup::Observer.lookup(record, record.instance_variable_get(:@_obj_before))
          end
          record.remove_instance_variable(:@discard_event_lookup) if record.instance_variable_defined?(:@discard_event_lookup)
        end
      end

      require 'mongoff/model'
      require 'mongoff/record'

      Mongoff::Model.include(Mongoid::Tracer::Options::ClassMethods)
      Mongoff::Record.class_eval do
        include Mongoid::Tracer::DocumentExtension
        include Mongoid::Tracer::TraceableDocument

        def tracing?
          self.class.data_type.trace_on_default && super
        end

        def set_association_values(association_name, values)
          send("#{association_name}=", values)
        end
      end

      apps = install_build_in_apps

      setup_build_in(apps)

      unless ENV['SKIP_DB_INITIALIZATION'].to_b

        Setup::Oauth2Provider.build_in_provider_id

        Tenant.all.each do |tenant|
          tenant.switch do
            ThreadToken.destroy_all
            Setup::Task.where(:status.in => Setup::Task::ACTIVE_STATUS).update_all(status: :broken)
            Setup::Execution.where(status: :running).update_all(status: :broken, completed_at: Time.now)

            Setup::Application.all.update_all(provider_id: Setup::Oauth2Provider.build_in_provider_id)

            Cenit::Hook.setup_tenant(tenant)
          end
        end
      end
    end unless ARGV.include? "assets:precompile"

    if Rails.env.production? &&
      (notifier_email = ENV['NOTIFIER_EMAIL']) &&
      (exception_recipients = ENV['EXCEPTION_RECIPIENTS'])
      Rails.application.config.middleware.use ExceptionNotification::Rack,
                                              email: {
                                                email_prefix: "[Cenit Error #{Rails.env}] ",
                                                sender_address: %{"notifier" <#{notifier_email}>},
                                                exception_recipients: exception_recipients.split(','),
                                                sections: %w(tenant request session environment backtrace)
                                              }
    end

    def self.setup_build_in_apps_types
      BuildInApps.apps_modules.each do |app_module|
        types = {}
        app_module.document_types_defs.each do |name, spec|
          options = app_module.types_options[name] || {}
          # Model def
          base = options[:base]
          if base
            base =
              if types.key?(base)
                types[base]
              else
                base.constantize
              end
          end
          types[name] = type = Class.new(base || Object)
          app_module.const_set(name.to_s, type)
          unless base
            if !options.key?(:multi_tenant) || options[:multi_tenant]
              type.include(Setup::CenitScoped)
            else
              type.include(Setup::CenitUnscoped)
            end
          end
          type.build_in_data_type
          type.class_eval(&spec) if spec
        end
        app_module.file_types_defs.each do |name, spec|
          # File model def
          type = Class.new
          app_module.const_set(name.to_s, type)
          type.include(Setup::BuildInFileType)
          type.class_eval(&spec) if spec
        end
      end
    end

    def self.install_build_in_apps
      apps = []
      puts 'Creating build-in apps'
      BuildInApps.apps_modules.each do |app_module|
        namespace = app_module.to_s.split('::')
        name = namespace.pop
        namespace = namespace.join('::')
        app = Cenit::BuildInApp.find_or_create_by(namespace: namespace, name: name)
        if app.persisted?
          puts "App #{app_module} is persisted..."
          app.check_tenant &:save!
          app_id = app.application_id
          app_id.slug = app_module.app_key
          app_id.oauth_name = app_module.app_name
          app_id.trusted = true
          app_id.save!
          app_module.instance_variable_set(:@app_id, app.id)
          app_module.initializers.each do |initializer_block|
            app_module.instance_eval(&initializer_block)
          end
          tenant = app.tenant
          meta_key = "app_#{app.id}"
          if (tenant.meta[meta_key] || {})['installed']
            puts "#{app_module} already installed!"
          else
            puts "Installing #{app_module}..."
            tenant.switch do
              app_module.installers.each do |install_block|
                app_module.instance_eval(&install_block)
              end
            end
            tenant.meta[meta_key] = (tenant.meta[meta_key] || {}).merge('installed' => true)
            tenant.save
          end
          apps << app
        else
          puts "Couldn't create build-in app #{app_module}: #{app.errors.full_messages.to_sentence}"
        end
      end
      apps
    end

    def self.setup_build_in(apps)
      apps.each do |app|
        app_module = app.app_module
        puts "Setting up #{app_module}..."
        app.tenant.switch do
          app_module.setups.each do |setup_block|
            app_module.instance_eval(&setup_block)
          end
        end
        puts "App #{app_module} ready!"
      end
    end
  end
end


text:
package gallery.templates.contentful.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.viewpager.widget.ViewPager;

public class LockableViewPager extends ViewPager {
  private boolean locked;

  public LockableViewPager(Context context) {
    super(context);
  }

  public LockableViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  @Override public boolean onInterceptTouchEvent(MotionEvent ev) {
    return !locked && super.onInterceptTouchEvent(ev);
  }

  public void setLocked(boolean locked) {
    this.locked = locked;
  }
}


text:
@interface ViewController_A ()

@end

@implementation ViewController_A

- (void)viewDidLoad {
    [super viewDidLoad];

}

- (IBAction)btnclick:(id)sender {

    if (self.delegateSingnal) {
        [self.delegateSingnal sendNext:nil];
    }
}

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/D:/development/android/projects/mirabilis/br.com.mirabilis.sqlite/br.com.mirabilis.sample/res/values/dimens.xml -->
    <eat-comment/>
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <!-- From: file:/D:/development/android/projects/mirabilis/br.com.mirabilis.sqlite/br.com.mirabilis.sample/res/values/strings.xml -->
    <eat-comment/>
    <string name="action_settings">Settings</string>
    <string name="app_name">br.com.mirabilis.sample</string>
    <string name="hello_world">Hello world!</string>
    <!-- From: file:/D:/development/android/projects/mirabilis/br.com.mirabilis.sqlite/br.com.mirabilis.sample/res/values/styles.xml -->
    <eat-comment/>
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>
</resources>


text:
/* $Id$ */

package ibis.io.jme;

import java.io.IOException;

/**
 * This is the SerializationOutputStream version that is used
 * for data serialization. With data serialization, you can only write
 * basic types and arrays of basic types. It also serves as a base type
 * for Ibis serialization.
 */
public class DataSerializationOutputStream extends ByteSerializationOutputStream {
    /** When true, no buffering in this layer. */
    private static final boolean NO_ARRAY_BUFFERS
            = properties.getBooleanProperty(s_no_array_buffers);

    /** If false, makes all timer calls disappear. */
    private static final boolean TIME_DATA_SERIALIZATION = true;

    /** Boolean count is not used, use it for arrays. */
    static final int TYPE_ARRAY = TYPE_BOOLEAN;

    /** Storage for bytes (or booleans) written. */
    private byte[] byte_buffer;

    /** Storage for chars written. */
    private char[] char_buffer;

    /** Storage for shorts written. */
    private short[] short_buffer;

    /** Storage for ints written. */
    private int[] int_buffer;

    /** Storage for longs written. */
    private long[] long_buffer;

    /** Storage for floats written. */
    private float[] float_buffer;

    /** Storage for doubles written. */
    private double[] double_buffer;

    /** Current index in byte_buffer. */
    private int byte_index;

    /** Current index in char_buffer. */
    private int char_index;

    /** Current index in short_buffer. */
    private int short_index;

    /** Current index in int_buffer. */
    private int int_index;

    /** Current index in long_buffer. */
    private int long_index;

    /** Current index in float_buffer. */
    private int float_index;

    /** Current index in double_buffer. */
    private int double_index;

    /**
     * Register how often we need to acquire a new set of primitive array
     * buffers.
     private int unfinished;

     {
     Runtime.getRuntime().addShutdownHook(new Thread() {
     public void run() {
     logger.info(DataSerializationOutputStream.this +
     ": unfinished calls " + unfinished);
     statistics();
     }
     });
     }
     */
    private final int BYTE_BUFFER_SIZE;

    private final int CHAR_BUFFER_SIZE;

    private final int SHORT_BUFFER_SIZE;

    private final int INT_BUFFER_SIZE;

    private final int LONG_BUFFER_SIZE;

    private final int FLOAT_BUFFER_SIZE;

    private final int DOUBLE_BUFFER_SIZE;

    /** Structure summarizing an array write. */
    private static final class ArrayDescriptor {
        int type;

        Object array;

        int offset;

        int len;
    }

    /** Where the arrays to be written are collected. */
    private ArrayDescriptor[] array;

    /** Index in the array array. */
    private int array_index;

    /** Collects all indices of the _buffer arrays. */
    private short[] indices_short;

    /** For each. */
    private boolean[] touched = new boolean[PRIMITIVE_TYPES];

    /**
     * Constructor with a DataOutputStream.
     * @param out		the underlying DataOutputStream
     * @exception IOException	gets thrown when an IO error occurs.
     */
    public DataSerializationOutputStream(DataOutputStream out)
            throws IOException {
        super(out);
        int bufferSize = out.bufferSize();
        if (bufferSize <= 0) {
            bufferSize = BUFFER_SIZE;
        }
        BYTE_BUFFER_SIZE = DataSerializationInputStream.typedBufferSize(bufferSize, SIZEOF_BYTE);
        CHAR_BUFFER_SIZE = DataSerializationInputStream.typedBufferSize(bufferSize, SIZEOF_CHAR);
        SHORT_BUFFER_SIZE = DataSerializationInputStream.typedBufferSize(bufferSize, SIZEOF_SHORT);
        INT_BUFFER_SIZE = DataSerializationInputStream.typedBufferSize(bufferSize, SIZEOF_INT);
        LONG_BUFFER_SIZE = DataSerializationInputStream.typedBufferSize(bufferSize, SIZEOF_LONG);
        FLOAT_BUFFER_SIZE = DataSerializationInputStream.typedBufferSize(bufferSize, SIZEOF_FLOAT);
        DOUBLE_BUFFER_SIZE = DataSerializationInputStream.typedBufferSize(bufferSize, SIZEOF_DOUBLE);

        if (! NO_ARRAY_BUFFERS) {
            initArrays();
        }
    }

    /**
     * Constructor, may be used when this class is sub-classed.
     */
    protected DataSerializationOutputStream() throws IOException {
        super();
        BYTE_BUFFER_SIZE = 0;
        CHAR_BUFFER_SIZE = 0;
        SHORT_BUFFER_SIZE = 0;
        INT_BUFFER_SIZE = 0;
        LONG_BUFFER_SIZE = 0;
        FLOAT_BUFFER_SIZE = 0;
        DOUBLE_BUFFER_SIZE = 0;
    }

    public String serializationImplName() {
        return "data";
    }

    public void statistics() {
        // No statistics
    }

    /**
     * Method to put a boolean array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayBoolean(boolean[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_BOOLEAN) {
            /* Maybe lift the check from the writeBoolean? */
            for (int i = offset; i < offset + len; i++) {
                writeBoolean(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayBoolean: " + ref + " offset: " + offset
                        + " len: " + len + " type: " + TYPE_BOOLEAN);
            }
            array[array_index].type = TYPE_BOOLEAN;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_BOOLEAN, len);
        }
    }

    /**
     * Method to put a byte array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayByte(byte[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_BYTE) {
            for (int i = offset; i < offset + len; i++) {
                writeByte(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayByte: " + ref + " offset: " + offset
                        + " len: " + len + " type: " + TYPE_BYTE);
            }
            array[array_index].type = TYPE_BYTE;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_BYTE, len);
        }
    }

    /**
     * Method to put a char array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayChar(char[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_CHAR) {
            for (int i = offset; i < offset + len; i++) {
                writeChar(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayChar: " + new String(ref) + " offset: "
                        + offset + " len: " + len + " type: " + TYPE_CHAR);
            }
            array[array_index].type = TYPE_CHAR;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_CHAR, len);
        }
    }

    /**
     * Method to put a short array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayShort(short[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_SHORT) {
            for (int i = offset; i < offset + len; i++) {
                writeShort(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayShort: " + ref + " offset: " + offset
                        + " len: " + len + " type: " + TYPE_SHORT);
            }
            array[array_index].type = TYPE_SHORT;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_SHORT, len);
        }
    }

    /**
     * Method to put a int array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayInt(int[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_INT) {
            for (int i = offset; i < offset + len; i++) {
                writeInt(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayInt: " + ref + " offset: " + offset
                        + " len: " + len + " type: " + TYPE_INT);
            }
            array[array_index].type = TYPE_INT;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_INT, len);
        }
    }

    /**
     * Method to put a long array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayLong(long[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_LONG) {
            for (int i = offset; i < offset + len; i++) {
                writeLong(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayLong: " + ref + " offset: " + offset
                        + " len: " + len + " type: " + TYPE_LONG);
            }
            array[array_index].type = TYPE_LONG;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_LONG, len);
        }
    }

    /**
     * Method to put a float array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayFloat(float[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_FLOAT) {
            for (int i = offset; i < offset + len; i++) {
                writeFloat(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayFloat: " + ref + " offset: " + offset
                        + " len: " + len + " type: " + TYPE_FLOAT);
            }
            array[array_index].type = TYPE_FLOAT;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_FLOAT, len);
        }
    }

    /**
     * Method to put a double array in the "array cache". If the cache is full
     * it is written to the arrayOutputStream.
     * This method is public because it gets called from rewritten code.
     * @param ref	the array to be written
     * @param offset	the offset at which to start
     * @param len	number of elements to write
     *
     * @exception IOException on IO error.
     */
    public void writeArrayDouble(double[] ref, int offset, int len)
            throws IOException {
        if (NO_ARRAY_BUFFERS) {
            out.writeArray(ref, offset, len);
        } else if (len < SMALL_ARRAY_BOUND / SIZEOF_DOUBLE) {
            for (int i = offset; i < offset + len; i++) {
                writeDouble(ref[i]);
            }

        } else {
            if (array_index == ARRAY_BUFFER_SIZE) {
                flush();
            }
            if (DEBUG && logger.isDebugEnabled()) {
                logger.debug("writeArrayDouble: " + ref + " offset: " + offset
                        + " len: " + len + " type: " + TYPE_DOUBLE);
            }
            array[array_index].type = TYPE_DOUBLE;
            array[array_index].offset = offset;
            array[array_index].len = len;
            array[array_index].array = ref;
            array_index++;

            addStatSendArray(ref, TYPE_DOUBLE, len);
        }
    }

    void addStatSendArray(Object ref, int type, int len) {
        // empty
    }

    /**
     * Flushes everything collected sofar.
     * @exception IOException on an IO error.
     */
    public void flush() throws IOException {

        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("doing a flush()");
        }

        if (TIME_DATA_SERIALIZATION) {
            suspendTimer();
        }

        if (! NO_ARRAY_BUFFERS) {
            flushBuffers();

            /* Retain the order in which the arrays were pushed. This
             * costs a cast at receive time.
             */
            for (int i = 0; i < array_index; i++) {
                ArrayDescriptor a = array[i];
                switch (a.type) {
                case TYPE_BOOLEAN:
                    out.writeArray((boolean[]) a.array, a.offset, a.len);
                    break;
                case TYPE_BYTE:
                    out.writeArray((byte[]) a.array, a.offset, a.len);
                    break;
                case TYPE_CHAR:
                    out.writeArray((char[]) a.array, a.offset, a.len);
                    break;
                case TYPE_SHORT:
                    out.writeArray((short[]) a.array, a.offset, a.len);
                    break;
                case TYPE_INT:
                    out.writeArray((int[]) a.array, a.offset, a.len);
                    break;
                case TYPE_LONG:
                    out.writeArray((long[]) a.array, a.offset, a.len);
                    break;
                case TYPE_FLOAT:
                    out.writeArray((float[]) a.array, a.offset, a.len);
                    break;
                case TYPE_DOUBLE:
                    out.writeArray((double[]) a.array, a.offset, a.len);
                    break;
                }
                a.array = null;
            }

            array_index = 0;
        }

        out.flush();

        if (TIME_DATA_SERIALIZATION) {
            resumeTimer();
        }

        if (! NO_ARRAY_BUFFERS && !out.finished()) {
            indices_short = new short[PRIMITIVE_TYPES];
            if (touched[TYPE_BYTE]) {
                byte_buffer = new byte[BYTE_BUFFER_SIZE];
            }
            if (touched[TYPE_CHAR]) {
                char_buffer = new char[CHAR_BUFFER_SIZE];
            }
            if (touched[TYPE_SHORT]) {
                short_buffer = new short[SHORT_BUFFER_SIZE];
            }
            if (touched[TYPE_INT]) {
                int_buffer = new int[INT_BUFFER_SIZE];
            }
            if (touched[TYPE_LONG]) {
                long_buffer = new long[LONG_BUFFER_SIZE];
            }
            if (touched[TYPE_FLOAT]) {
                float_buffer = new float[FLOAT_BUFFER_SIZE];
            }
            if (touched[TYPE_DOUBLE]) {
                double_buffer = new double[DOUBLE_BUFFER_SIZE];
            }
            // unfinished++;
        }

        for (int i = 0; i < PRIMITIVE_TYPES; i++) {
            touched[i] = false;
        }
    }

    /**
     * Writes a boolean value to the accumulator.
     * @param     value             The boolean value to write.
     * @exception IOException on IO error.
     */
    public void writeBoolean(boolean value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeBoolean(value);
        } else {
            if (byte_index == byte_buffer.length) {
                flush();
            }
            byte_buffer[byte_index++] = (byte) (value ? 1 : 0);
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote boolean " + value);
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Writes a byte value to the accumulator.
     * @param     value             The byte value to write.
     * @exception IOException on IO error.
     */
    public void writeByte(byte value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeByte(value);
        } else {
            if (byte_index == byte_buffer.length) {
                flush();
            }
            byte_buffer[byte_index++] = value;
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote byte " + value);
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Writes a char value to the accumulator.
     * @param     value             The char value to write.
     * @exception IOException on IO error.
     */
    public void writeChar(char value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeChar(value);
        } else {
            if (char_index == char_buffer.length) {
                flush();
            }
            char_buffer[char_index++] = value;
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote char " + value);
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Writes a short value to the accumulator.
     * @param     value             The short value to write.
     * @exception IOException on IO error.
     */
    public void writeShort(short value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeShort(value);
        } else {
            if (short_index == short_buffer.length) {
                flush();
            }
            short_buffer[short_index++] = value;
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote short " + value);
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Writes a int value to the accumulator.
     * @param     value             The int value to write.
     * @exception IOException on IO error.
     */
    public void writeInt(int value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeInt(value);
        } else {
            if (int_index == int_buffer.length) {
                flush();
            }
            int_buffer[int_index++] = value;
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote int[HEX] " + value + "[0x"
                    + Integer.toHexString(value) + "]");
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Writes a long value to the accumulator.
     * @param     value             The long value to write.
     * @exception IOException on IO error.
     */
    public void writeLong(long value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeLong(value);
        } else {
            if (long_index == long_buffer.length) {
                flush();
            }
            long_buffer[long_index++] = value;
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote long " + value);
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Writes a float value to the accumulator.
     * @param     value             The float value to write.
     * @exception IOException on IO error.
     */
    public void writeFloat(float value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeFloat(value);
        } else {
            if (float_index == float_buffer.length) {
                flush();
            }
            float_buffer[float_index++] = value;
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote float " + value);
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Writes a double value to the accumulator.
     * @param     value             The double value to write.
     * @exception IOException on IO error.
     */
    public void writeDouble(double value) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (NO_ARRAY_BUFFERS) {
            out.writeDouble(value);
        } else {
            if (double_index == double_buffer.length) {
                flush();
            }
            double_buffer[double_index++] = value;
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("wrote double " + value);
        }
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Allocates buffers.
     */
    private void initArrays() {
        array = new ArrayDescriptor[ARRAY_BUFFER_SIZE];
        for (int i = 0; i < ARRAY_BUFFER_SIZE; i++) {
            array[i] = new ArrayDescriptor();
        }

        indices_short = new short[PRIMITIVE_TYPES];
        byte_buffer = new byte[BYTE_BUFFER_SIZE];
        char_buffer = new char[CHAR_BUFFER_SIZE];
        short_buffer = new short[SHORT_BUFFER_SIZE];
        int_buffer = new int[INT_BUFFER_SIZE];
        long_buffer = new long[LONG_BUFFER_SIZE];
        float_buffer = new float[FLOAT_BUFFER_SIZE];
        double_buffer = new double[DOUBLE_BUFFER_SIZE];
    }

    /* This is the data output / object output part */

    public void writeString(String str) throws IOException {
        writeUTF(str);
    }

    public void writeUTF(String str) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        if (str == null) {
            writeInt(-1);
            if (TIME_DATA_SERIALIZATION) {
                stopTimer();
            }
            return;
        }

        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("write UTF " + str);
        }

        int len = str.length();

        // writeInt(len);
        // writeArray(str.toCharArray(), 0, len);

        int bn = 0;
        // Make sure we have at least enough room for the first char.
        byte[] b = new byte[len + 2];

        for (int i = 0; i < len; i++) {
            int c = str.charAt(i);      // widening char to int zero-extends
            if (c > 0x0000 && c <= 0x007f) {
                b[bn++] = (byte) c;
            } else if (c <= 0x07ff) {
                b[bn++] = (byte) (0xc0 | (0x1f & (c >> 6)));
                b[bn++] = (byte) (0x80 | (0x3f & c));
            } else {
                b[bn++] = (byte) (0xe0 | (0x0f & (c >> 12)));
                b[bn++] = (byte) (0x80 | (0x3f & (c >> 6)));
                b[bn++] = (byte) (0x80 | (0x3f & c));
            }
            // Is the buffer too small?
            if (bn >= b.length - 3 && i < len - 1) {
            	byte [] temp = new byte[b.length + len];
            	System.arraycopy(b, 0, temp, 0, b.length);
            	b = temp;
            }
        }
        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("writeUTF: len = " + bn);
            for (int i = 0; i < bn; i++) {
                logger.debug("writeUTF: b[" + i + "] = " + (b[i] & 0xff));
            }
        }

        writeInt(bn);
        writeArrayByte(b, 0, bn);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    /**
     * Initialize all buffer indices to zero.
     */
    private void reset_indices() {
        byte_index = 0;
        char_index = 0;
        short_index = 0;
        int_index = 0;
        long_index = 0;
        float_index = 0;
        double_index = 0;
    }

    /**
     * Flush the primitive arrays.
     *
     * @exception IOException is thrown when any writeArray
     * throws it.
     */
    private void flushBuffers() throws IOException {
        indices_short[TYPE_ARRAY] = (short) array_index;
        indices_short[TYPE_BYTE] = (short) byte_index;
        indices_short[TYPE_CHAR] = (short) char_index;
        indices_short[TYPE_SHORT] = (short) short_index;
        indices_short[TYPE_INT] = (short) int_index;
        indices_short[TYPE_LONG] = (short) long_index;
        indices_short[TYPE_FLOAT] = (short) float_index;
        indices_short[TYPE_DOUBLE] = (short) double_index;

        if (DEBUG && logger.isDebugEnabled()) {
            logger.debug("writing arrays " + array_index);
            logger.debug("writing bytes " + byte_index);
            logger.debug("writing chars " + char_index);
            logger.debug("writing shorts " + short_index);
            logger.debug("writing ints " + int_index);
            logger.debug("writing longs " + long_index);
            logger.debug("writing floats " + float_index);
            logger.debug("writing doubles " + double_index);
        }

        out.writeArray(indices_short, BEGIN_TYPES, PRIMITIVE_TYPES
                - BEGIN_TYPES);

        if (byte_index > 0) {
            out.writeArray(byte_buffer, 0, byte_index);
            touched[TYPE_BYTE] = true;
        }
        if (char_index > 0) {
            out.writeArray(char_buffer, 0, char_index);
            touched[TYPE_CHAR] = true;
        }
        if (short_index > 0) {
            out.writeArray(short_buffer, 0, short_index);
            touched[TYPE_SHORT] = true;
        }
        if (int_index > 0) {
            out.writeArray(int_buffer, 0, int_index);
            touched[TYPE_INT] = true;
        }
        if (long_index > 0) {
            out.writeArray(long_buffer, 0, long_index);
            touched[TYPE_LONG] = true;
        }
        if (float_index > 0) {
            out.writeArray(float_buffer, 0, float_index);
            touched[TYPE_FLOAT] = true;
        }
        if (double_index > 0) {
            out.writeArray(double_buffer, 0, double_index);
            touched[TYPE_DOUBLE] = true;
        }

        reset_indices();
    }

    public void writeArray(boolean[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayBoolean(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void writeArray(byte[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayByte(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void writeArray(short[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayShort(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void writeArray(char[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayChar(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void writeArray(int[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayInt(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void writeArray(long[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayLong(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void writeArray(float[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayFloat(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void writeArray(double[] ref, int off, int len) throws IOException {
        if (TIME_DATA_SERIALIZATION) {
            startTimer();
        }
        writeArrayDouble(ref, off, len);
        if (TIME_DATA_SERIALIZATION) {
            stopTimer();
        }
    }

    public void close() throws IOException {

        super.close();

        byte_buffer = null;
        char_buffer = null;
        short_buffer = null;
        int_buffer = null;
        long_buffer = null;
        float_buffer = null;
        double_buffer = null;
        array = null;
    }
}