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

#include <grpc/support/port_platform.h>

#include "src/core/ext/filters/message_size/message_size_filter.h"

#include <new>

#include "absl/status/status.h"
#include "absl/strings/str_format.h"

#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/status.h>
#include <grpc/support/log.h>

#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channel_stack_builder.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/service_config/service_config_call_data.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/transport.h"

static void recv_message_ready(void* user_data, grpc_error_handle error);
static void recv_trailing_metadata_ready(void* user_data,
                                         grpc_error_handle error);

namespace grpc_core {

//
// MessageSizeParsedConfig
//

const MessageSizeParsedConfig* MessageSizeParsedConfig::GetFromCallContext(
    const grpc_call_context_element* context,
    size_t service_config_parser_index) {
  if (context == nullptr) return nullptr;
  auto* svc_cfg_call_data = static_cast<ServiceConfigCallData*>(
      context[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value);
  if (svc_cfg_call_data == nullptr) return nullptr;
  return static_cast<const MessageSizeParsedConfig*>(
      svc_cfg_call_data->GetMethodParsedConfig(service_config_parser_index));
}

MessageSizeParsedConfig MessageSizeParsedConfig::GetFromChannelArgs(
    const ChannelArgs& channel_args) {
  MessageSizeParsedConfig limits;
  limits.max_send_size_ = GetMaxSendSizeFromChannelArgs(channel_args);
  limits.max_recv_size_ = GetMaxRecvSizeFromChannelArgs(channel_args);
  return limits;
}

absl::optional<uint32_t> GetMaxRecvSizeFromChannelArgs(
    const ChannelArgs& args) {
  if (args.WantMinimalStack()) return absl::nullopt;
  int size = args.GetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH)
                 .value_or(GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH);
  if (size < 0) return absl::nullopt;
  return static_cast<uint32_t>(size);
}

absl::optional<uint32_t> GetMaxSendSizeFromChannelArgs(
    const ChannelArgs& args) {
  if (args.WantMinimalStack()) return absl::nullopt;
  int size = args.GetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH)
                 .value_or(GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH);
  if (size < 0) return absl::nullopt;
  return static_cast<uint32_t>(size);
}

const JsonLoaderInterface* MessageSizeParsedConfig::JsonLoader(
    const JsonArgs&) {
  static const auto* loader =
      JsonObjectLoader<MessageSizeParsedConfig>()
          .OptionalField("maxRequestMessageBytes",
                         &MessageSizeParsedConfig::max_send_size_)
          .OptionalField("maxResponseMessageBytes",
                         &MessageSizeParsedConfig::max_recv_size_)
          .Finish();
  return loader;
}

//
// MessageSizeParser
//

std::unique_ptr<ServiceConfigParser::ParsedConfig>
MessageSizeParser::ParsePerMethodParams(const ChannelArgs& /*args*/,
                                        const Json& json,
                                        ValidationErrors* errors) {
  return LoadFromJson<std::unique_ptr<MessageSizeParsedConfig>>(
      json, JsonArgs(), errors);
}

void MessageSizeParser::Register(CoreConfiguration::Builder* builder) {
  builder->service_config_parser()->RegisterParser(
      std::make_unique<MessageSizeParser>());
}

size_t MessageSizeParser::ParserIndex() {
  return CoreConfiguration::Get().service_config_parser().GetParserIndex(
      parser_name());
}

}  // namespace grpc_core

namespace {
struct channel_data {
  grpc_core::MessageSizeParsedConfig limits;
  const size_t service_config_parser_index{
      grpc_core::MessageSizeParser::ParserIndex()};
};

struct call_data {
  call_data(grpc_call_element* elem, const channel_data& chand,
            const grpc_call_element_args& args)
      : call_combiner(args.call_combiner), limits(chand.limits) {
    GRPC_CLOSURE_INIT(&recv_message_ready, ::recv_message_ready, elem,
                      grpc_schedule_on_exec_ctx);
    GRPC_CLOSURE_INIT(&recv_trailing_metadata_ready,
                      ::recv_trailing_metadata_ready, elem,
                      grpc_schedule_on_exec_ctx);
    // Get max sizes from channel data, then merge in per-method config values.
    // Note: Per-method config is only available on the client, so we
    // apply the max request size to the send limit and the max response
    // size to the receive limit.
    const grpc_core::MessageSizeParsedConfig* config_from_call_context =
        grpc_core::MessageSizeParsedConfig::GetFromCallContext(
            args.context, chand.service_config_parser_index);
    if (config_from_call_context != nullptr) {
      absl::optional<uint32_t> max_send_size = limits.max_send_size();
      absl::optional<uint32_t> max_recv_size = limits.max_recv_size();
      if (config_from_call_context->max_send_size().has_value() &&
          (!max_send_size.has_value() ||
           *config_from_call_context->max_send_size() < *max_send_size)) {
        max_send_size = *config_from_call_context->max_send_size();
      }
      if (config_from_call_context->max_recv_size().has_value() &&
          (!max_recv_size.has_value() ||
           *config_from_call_context->max_recv_size() < *max_recv_size)) {
        max_recv_size = *config_from_call_context->max_recv_size();
      }
      limits = grpc_core::MessageSizeParsedConfig(max_send_size, max_recv_size);
    }
  }

  ~call_data() {}

  grpc_core::CallCombiner* call_combiner;
  grpc_core::MessageSizeParsedConfig limits;
  // Receive closures are chained: we inject this closure as the
  // recv_message_ready up-call on transport_stream_op, and remember to
  // call our next_recv_message_ready member after handling it.
  grpc_closure recv_message_ready;
  grpc_closure recv_trailing_metadata_ready;
  // The error caused by a message that is too large, or absl::OkStatus()
  grpc_error_handle error;
  // Used by recv_message_ready.
  absl::optional<grpc_core::SliceBuffer>* recv_message = nullptr;
  // Original recv_message_ready callback, invoked after our own.
  grpc_closure* next_recv_message_ready = nullptr;
  // Original recv_trailing_metadata callback, invoked after our own.
  grpc_closure* original_recv_trailing_metadata_ready;
  bool seen_recv_trailing_metadata = false;
  grpc_error_handle recv_trailing_metadata_error;
};

}  // namespace

// Callback invoked when we receive a message.  Here we check the max
// receive message size.
static void recv_message_ready(void* user_data, grpc_error_handle error) {
  grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
  call_data* calld = static_cast<call_data*>(elem->call_data);
  if (calld->recv_message->has_value() &&
      calld->limits.max_recv_size().has_value() &&
      (*calld->recv_message)->Length() >
          static_cast<size_t>(*calld->limits.max_recv_size())) {
    grpc_error_handle new_error = grpc_error_set_int(
        GRPC_ERROR_CREATE(absl::StrFormat(
            "Received message larger than max (%u vs. %d)",
            (*calld->recv_message)->Length(), *calld->limits.max_recv_size())),
        grpc_core::StatusIntProperty::kRpcStatus,
        GRPC_STATUS_RESOURCE_EXHAUSTED);
    error = grpc_error_add_child(error, new_error);
    calld->error = error;
  }
  // Invoke the next callback.
  grpc_closure* closure = calld->next_recv_message_ready;
  calld->next_recv_message_ready = nullptr;
  if (calld->seen_recv_trailing_metadata) {
    /* We might potentially see another RECV_MESSAGE op. In that case, we do not
     * want to run the recv_trailing_metadata_ready closure again. The newer
     * RECV_MESSAGE op cannot cause any errors since the transport has already
     * invoked the recv_trailing_metadata_ready closure and all further
     * RECV_MESSAGE ops will get null payloads. */
    calld->seen_recv_trailing_metadata = false;
    GRPC_CALL_COMBINER_START(calld->call_combiner,
                             &calld->recv_trailing_metadata_ready,
                             calld->recv_trailing_metadata_error,
                             "continue recv_trailing_metadata_ready");
  }
  grpc_core::Closure::Run(DEBUG_LOCATION, closure, error);
}

// Callback invoked on completion of recv_trailing_metadata
// Notifies the recv_trailing_metadata batch of any message size failures
static void recv_trailing_metadata_ready(void* user_data,
                                         grpc_error_handle error) {
  grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
  call_data* calld = static_cast<call_data*>(elem->call_data);
  if (calld->next_recv_message_ready != nullptr) {
    calld->seen_recv_trailing_metadata = true;
    calld->recv_trailing_metadata_error = error;
    GRPC_CALL_COMBINER_STOP(calld->call_combiner,
                            "deferring recv_trailing_metadata_ready until "
                            "after recv_message_ready");
    return;
  }
  error = grpc_error_add_child(error, calld->error);
  // Invoke the next callback.
  grpc_core::Closure::Run(DEBUG_LOCATION,
                          calld->original_recv_trailing_metadata_ready, error);
}

// Start transport stream op.
static void message_size_start_transport_stream_op_batch(
    grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
  call_data* calld = static_cast<call_data*>(elem->call_data);
  // Check max send message size.
  if (op->send_message && calld->limits.max_send_size().has_value() &&
      op->payload->send_message.send_message->Length() >
          static_cast<size_t>(*calld->limits.max_send_size())) {
    grpc_transport_stream_op_batch_finish_with_failure(
        op,
        grpc_error_set_int(GRPC_ERROR_CREATE(absl::StrFormat(
                               "Sent message larger than max (%u vs. %d)",
                               op->payload->send_message.send_message->Length(),
                               *calld->limits.max_send_size())),
                           grpc_core::StatusIntProperty::kRpcStatus,
                           GRPC_STATUS_RESOURCE_EXHAUSTED),
        calld->call_combiner);
    return;
  }
  // Inject callback for receiving a message.
  if (op->recv_message) {
    calld->next_recv_message_ready =
        op->payload->recv_message.recv_message_ready;
    calld->recv_message = op->payload->recv_message.recv_message;
    op->payload->recv_message.recv_message_ready = &calld->recv_message_ready;
  }
  // Inject callback for receiving trailing metadata.
  if (op->recv_trailing_metadata) {
    calld->original_recv_trailing_metadata_ready =
        op->payload->recv_trailing_metadata.recv_trailing_metadata_ready;
    op->payload->recv_trailing_metadata.recv_trailing_metadata_ready =
        &calld->recv_trailing_metadata_ready;
  }
  // Chain to the next filter.
  grpc_call_next_op(elem, op);
}

// Constructor for call_data.
static grpc_error_handle message_size_init_call_elem(
    grpc_call_element* elem, const grpc_call_element_args* args) {
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
  new (elem->call_data) call_data(elem, *chand, *args);
  return absl::OkStatus();
}

// Destructor for call_data.
static void message_size_destroy_call_elem(
    grpc_call_element* elem, const grpc_call_final_info* /*final_info*/,
    grpc_closure* /*ignored*/) {
  call_data* calld = static_cast<call_data*>(elem->call_data);
  calld->~call_data();
}

// Constructor for channel_data.
static grpc_error_handle message_size_init_channel_elem(
    grpc_channel_element* elem, grpc_channel_element_args* args) {
  GPR_ASSERT(!args->is_last);
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
  new (chand) channel_data();
  chand->limits = grpc_core::MessageSizeParsedConfig::GetFromChannelArgs(
      grpc_core::ChannelArgs::FromC(args->channel_args));
  return absl::OkStatus();
}

// Destructor for channel_data.
static void message_size_destroy_channel_elem(grpc_channel_element* elem) {
  channel_data* chand = static_cast<channel_data*>(elem->channel_data);
  chand->~channel_data();
}

const grpc_channel_filter grpc_message_size_filter = {
    message_size_start_transport_stream_op_batch,
    nullptr,
    grpc_channel_next_op,
    sizeof(call_data),
    message_size_init_call_elem,
    grpc_call_stack_ignore_set_pollset_or_pollset_set,
    message_size_destroy_call_elem,
    sizeof(channel_data),
    message_size_init_channel_elem,
    grpc_channel_stack_no_post_init,
    message_size_destroy_channel_elem,
    grpc_channel_next_get_info,
    "message_size"};

// Used for GRPC_CLIENT_SUBCHANNEL
static bool maybe_add_message_size_filter_subchannel(
    grpc_core::ChannelStackBuilder* builder) {
  if (builder->channel_args().WantMinimalStack()) {
    return true;
  }
  builder->PrependFilter(&grpc_message_size_filter);
  return true;
}

// Used for GRPC_CLIENT_DIRECT_CHANNEL and GRPC_SERVER_CHANNEL. Adds the filter
// only if message size limits or service config is specified.
static bool maybe_add_message_size_filter(
    grpc_core::ChannelStackBuilder* builder) {
  auto channel_args = builder->channel_args();
  if (channel_args.WantMinimalStack()) {
    return true;
  }
  grpc_core::MessageSizeParsedConfig limits =
      grpc_core::MessageSizeParsedConfig::GetFromChannelArgs(channel_args);
  const bool enable =
      limits.max_send_size().has_value() ||
      limits.max_recv_size().has_value() ||
      channel_args.GetString(GRPC_ARG_SERVICE_CONFIG).has_value();
  if (enable) builder->PrependFilter(&grpc_message_size_filter);
  return true;
}

namespace grpc_core {
void RegisterMessageSizeFilter(CoreConfiguration::Builder* builder) {
  MessageSizeParser::Register(builder);
  builder->channel_init()->RegisterStage(
      GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
      maybe_add_message_size_filter_subchannel);
  builder->channel_init()->RegisterStage(GRPC_CLIENT_DIRECT_CHANNEL,
                                         GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
                                         maybe_add_message_size_filter);
  builder->channel_init()->RegisterStage(GRPC_SERVER_CHANNEL,
                                         GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
                                         maybe_add_message_size_filter);
}
}  // namespace grpc_core


text:
<?php

namespace doc\MotoBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * MarqueRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class MarqueRepository extends EntityRepository
{
}

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls Sci. Nat. , Bot. , sér. 2 13: 342 (1840)

#### Original name
Hypoxylon enterogenum Mont.

### Remarks
null


text:
import sqlite3
import json
import re

conn = sqlite3.connect('repos-sm.sqlite')
c = conn.cursor()

sql_key_list = ["id", "name", "full_name", "owner", "languages_url", "issue_events_url", "forks_url", "commits_url"]
attrs = ",".join(map(lambda s: s+" text",sql_key_list))
c.execute("DROP TABLE IF EXISTS repos")
c.execute("CREATE TABLE repos ({})".format(attrs))

## repos_0, create table
def insert_data(start=0, end=49):
	for idir in range(start, end):
		dir_name="repos/part{}".format(idir)
		for ifile in range(0,100):
			file_number = idir*100+ifile
			file_name = "repos_{}.json".format(file_number)
			with open(dir_name+"/"+file_name) as f:
				repos = json.loads(f.read())
				for repo in repos:
					c.execute("INSERT INTO repos VALUES(?,?,?,?,?,?,?,?)", \
						(repo["id"], repo["name"], repo["full_name"], \
							repo["owner"]["login"], \
							repo["languages_url"], \
							re.sub("{.*}", "", repo["issue_events_url"]), \
							repo["forks_url"], re.sub("{.*}", "", repo["commits_url"])))

insert_data(0,3)
conn.commit()
conn.close()


text:
{% extends sitebase.html %}
{% block head %}
{% from amgut import text_locale, media_locale %}

{% end %}
{% block content %}

    {% set tl = text_locale['chage_pass_verify.html'] %}
    {% set fmt = {'kitid': skid,
                  'help_email': media_locale['HELP_EMAIL']} %}
    {% if result == 'valid' %}
    <form id="reset_password" name="reset_password" method="post" action="{% raw media_locale['SITEBASE'] %}/authed/change_password/">

{% raw tl['TITLE'] %}

                {% raw tl['NEW_PASSWORD'] %}:	<input type="password" id="new_password" name="new_password" />
                (?)

                {% raw tl['CONFIRM_PASSWORD'] %}:	<input type="password" id="confirm_password" name="confirm_password"/>
                (?)

        <input type="hidden" id="email" name="email" value={{email}} >
        <input type="button" name="submit_button" id="submit_button" value="{% raw tl['BUTTON_TEXT'] %}" onclick="validatePasswords()">
    </form>

    {% elif result == 4 %}

{% raw tl['SUCCESS'] %}

    {% elif result == 5 %}

{% raw tl['NO_EMAIL_1'] %}

{% raw tl['NO_EMAIL_2'] %}

{% raw tl['NO_EMAIL_3'] % fmt %}

    {% end %}

{% end %}


text:
import React, {Component} from 'react';

export const appendLifeCycle = ({
  componentWillMount,
  componentDidMount,
  componentWillReceiveProps,
  shouldComponentUpdate,
  componentWillUpdate,
  componentDidUpdate,
  componentWillUnmount
}) => (LambdaComponent) => (

  class AppendedLifeCycle extends Component {

    componentWillMount() {
      return componentWillMount && componentWillMount.call(this);
    }

    componentDidMount() {
      return componentDidMount && componentDidMount.call(this);
    }

    componentWillReceiveProps(nextProps) {
      return componentWillReceiveProps && componentWillReceiveProps.call(this, nextProps);
    }

    shouldComponentUpdate(nextProps, nextState) {
      return shouldComponentUpdate
        ? shouldComponentUpdate.call(this, nextProps, nextState)
        : true;
    }

    componentWillUpdate(nextProps, nextState) {
      return componentWillUpdate && componentWillUpdate.call(this, nextProps, nextState);
    }

    componentDidUpdate(prevProps, prevState) {
      return componentDidUpdate && componentDidUpdate.call(this, prevProps, prevState);
    }

    componentWillUnmount() {
      return componentWillUnmount && componentWillUnmount.call(this);
    }

    render() {
      return <LambdaComponent {...this.props} />
    }

  }
)

export default appendLifeCycle;


text:
/*
 *
 */
package org.processmining.openslex.metamodel;

import org.processmining.openslex.utils.MMUtils;

// TODO: Auto-generated Javadoc
/**
 * The Class SLEXMMCaseAttribute.
 *
 * @author Eduardo Gonzalez Lopez de Murillas
 * @see OpenSLEX
 */
public class SLEXMMCaseAttribute extends AbstractAttDBElement {

	/**
	 *
	 */
	private static final long serialVersionUID = 2261653976293276421L;
	/** The name. */
	private String name = null;

	/**
	 * Instantiates a new SLEXMM case attribute.
	 *
	 * @param storage the storage
	 */
	protected SLEXMMCaseAttribute(SLEXMMStorageMetaModel storage) {
		super(storage);
	}

	/**
	 * Gets the storage.
	 *
	 * @return the storage
	 */
	public SLEXMMStorageMetaModel getStorage() {
		return (SLEXMMStorageMetaModel) super.storage;
	}

	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	protected void setName(String name) {
		this.name = MMUtils.intern(name);
		setDirty(true);
	}

	/* (non-Javadoc)
	 * @see org.processmining.openslex.metamodel.SLEXMMAbstractDatabaseObject#insert(org.processmining.openslex.metamodel.SLEXMMAbstractDatabaseObject)
	 */
	@Override
	boolean insert(AbstractDBElement at) {
		return getStorage().insert((SLEXMMCaseAttribute) at);
	}

	/* (non-Javadoc)
	 * @see org.processmining.openslex.metamodel.SLEXMMAbstractDatabaseObject#update(org.processmining.openslex.metamodel.SLEXMMAbstractDatabaseObject)
	 */
	@Override
	boolean update(AbstractDBElement at) {
		return getStorage().update((SLEXMMCaseAttribute) at);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
//	@Override
//	public int hashCode() {
//		return ("case_attribute#"+getId()).hashCode();
//	}
}


text:
        Characters

        <button type="button" class="btn btn-default dropdown-toggle sort-dropdown col-right" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          {{sortBy}}
        </button>

Modified

Name

    <app-character *ngFor="let character of characters" [char]="character" ></app-character>
    <app-hero-detail *ngFor="let character of characters" [char]="character" > </app-hero-detail>

            «

{{pager}}

            »


text:
injectcc.medication = (function () {
    'use strict';

    // These are basically private statics, works but figure out better org maybe
    var _$canvas;

    // Public interface that is returned to consumer.  Just need init for this module.
    var _this = {
        init: init
    }

    function init() {
        // constructor code
        console.log('Initializing sitepicker...');
        $('.injection-diagram').sitepicker({
            'locations': $('.injection-site'),
            'enabled': false
        });

        // Sortable injection sites.
        $('.injection-site').parent()
            .sortable()
            .disableSelection();

        // Enable injection site delete button.
        $(document).on('click', '.injection-site .remove-site', function () {
            var $location = $(this).parents('.injection-site');
            var ordinal = $location.find('[name$=Ordinal]').val();
            var $point = _$canvas.find('.canvas-point-' + ordinal);
            if ($point) {
                $point.remove();
            }

            $location.remove();
        });

        // Validation
        var locationValidator = $('#LocationForm').validate({
            messages: {
                timeUntilNext: {
                    required: true,
                    number: true,
                    min: 0
                },
                locationName: {
                    required: true
                }
            }
        });

        $('#AddLocationButton').click(function () {
            if (!$('#LocationForm').valid()) {
                return;
            }

            // Synthesize a location object and render it to DOM.
            var timeValue = $('#ValueUntilNextInjectionField').val();
            var timeUnit = $('#UnitUntilNextInjectionField').val();
            var location = {
                name: $('#LocationNameField').val(),
                timeValue: timeValue,
                timeUnit: timeUnit,
                minutesUntilNextInjection: getMinutes(timeValue, timeUnit),
                injectionPointX: _selectedPoint.attr('cx') / _$canvas.width(),
                injectionPointY: _selectedPoint.attr('cy') / _$canvas.height(),
                referenceImageUrl: $('#ReferenceImageSelector').val(),
                ordinal: $('.injection-site').length
            };
            var locationCompactTemplate = _.template($('#_LocationCompact').html());
            var newListItem = locationCompactTemplate(location);
            $('.injection-sites').append(newListItem);
            var $location = $('.injection-sites :last-child');

            // Mark the point on the canvas and get rid of the selection marker.
            markSelectedPoint();
            markExistingPoint($location);

            // Clear out form.
            $('#LocationNameTextBox').val('');
            $(this).parents('form').removeClass('error');
        });

        $('form').submit(function () {
            $('.injection-site').each(function (i) {
                var ordinal = i;
                $(this).find('[name^="Location"]').each(function () {
                    var name = $(this).attr('name').replace(/{ordinal}/, i);
                    $(this).attr('name', name);
                });
            });
        });
    }

    function getMinutes(timeValue, timeUnit) {
        var minutesUntilNextInjection = timeValue;
        if (minutesUntilNextInjection === NaN) {
            return NaN;
        }
        if (timeUnit === 'days') {
            minutesUntilNextInjection *= 24;
            timeUnit = 'hours';
        }
        if (timeUnit === 'hours') {
            minutesUntilNextInjection *= 60;
            timeUnit = 'minutes';
        }
        if (timeUnit === 'minutes') {
            minutesUntilNextInjection = Math.round(minutesUntilNextInjection);
        }

        return minutesUntilNextInjection;
    }

    return _this;
})();


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/parallax"
        android:layout_width="match_parent"
        android:layout_height="500dp"
        android:scaleType="centerCrop"
        android:src="@mipmap/slient"
        app:layout_collapseMode="parallax" />

    <com.lzx.demo.view.PullScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:overScrollMode="never"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <android.support.design.widget.CollapsingToolbarLayout
                    android:id="@+id/collapse"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:contentScrim="?attr/colorPrimary"
                    app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
                    app:titleEnabled="false">

                    <RelativeLayout
                        android:id="@+id/panel_lyt"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="bottom"
                        android:layout_marginTop="150dp"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="40dp"
                            android:text="@string/app_name"
                            android:textColor="#ffffff"
                            android:textSize="20sp" />
                    </RelativeLayout>

                </android.support.design.widget.CollapsingToolbarLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:paddingBottom="0dp"
                    app:layout_scrollFlags="scroll">

                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/white"
                android:orientation="vertical">

                <ScrollView
                    android:id="@+id/sv"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#f1f1f1"
                    android:gravity="center"
                    android:overScrollMode="never">

                    <LinearLayout
                        android:id="@+id/ll"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="46dp"
                            android:gravity="center"
                            android:padding="10dp"
                            android:text="horizontal" />

                        <HorizontalScrollView
                            android:id="@+id/hsv"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content">

                                <android.support.v7.widget.CardView
                                    android:layout_width="200dp"
                                    android:layout_height="160dp"
                                    android:layout_margin="10dp">

                                    <ImageView
                                        android:id="@+id/iv1"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:scaleType="centerCrop" />
                                </android.support.v7.widget.CardView>

                                <android.support.v7.widget.CardView
                                    android:layout_width="200dp"
                                    android:layout_height="160dp"
                                    android:layout_margin="10dp">

                                    <ImageView
                                        android:id="@+id/iv2"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:scaleType="centerCrop" />
                                </android.support.v7.widget.CardView>

                                <android.support.v7.widget.CardView
                                    android:layout_width="200dp"
                                    android:layout_height="160dp"
                                    android:layout_margin="10dp">

                                    <ImageView
                                        android:id="@+id/iv3"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent"
                                        android:scaleType="centerCrop" />
                                </android.support.v7.widget.CardView>
                            </LinearLayout>
                        </HorizontalScrollView>

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:padding="10dp"
                            android:text="vertical" />

                        <android.support.v7.widget.CardView
                            android:layout_width="match_parent"
                            android:layout_height="160dp"
                            android:layout_margin="10dp">

                            <ImageView
                                android:id="@+id/iv4"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:scaleType="centerCrop" />
                        </android.support.v7.widget.CardView>

                        <android.support.v7.widget.CardView
                            android:layout_width="match_parent"
                            android:layout_height="160dp"
                            android:layout_margin="10dp">

                            <ImageView
                                android:id="@+id/iv5"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:scaleType="centerCrop" />
                        </android.support.v7.widget.CardView>

                        <android.support.v7.widget.CardView
                            android:layout_width="match_parent"
                            android:layout_height="160dp"
                            android:layout_margin="10dp">

                            <ImageView
                                android:id="@+id/iv6"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:scaleType="centerCrop" />
                        </android.support.v7.widget.CardView>

                        <android.support.v7.widget.CardView
                            android:layout_width="match_parent"
                            android:layout_height="160dp"
                            android:layout_margin="10dp">

                            <ImageView
                                android:id="@+id/iv7"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:scaleType="centerCrop" />
                        </android.support.v7.widget.CardView>
                    </LinearLayout>
                </ScrollView>
            </LinearLayout>
        </LinearLayout>

    </com.lzx.demo.view.PullScrollView>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_marginBottom="0dp"
        android:background="@android:color/transparent"
        app:layout_collapseMode="pin"
        app:navigationIcon="?attr/homeAsUpIndicator"
        app:popupTheme="@style/AppTheme.PopupOverlay">

        <android.support.v7.widget.ButtonBarLayout
            android:id="@+id/buttonBarLayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center">

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="@string/app_name"
                android:textColor="#ffffff"
                android:textSize="16sp" />
        </android.support.v7.widget.ButtonBarLayout>
    </android.support.v7.widget.Toolbar>

</FrameLayout>


text:
from django.contrib import admin

from .models import Job

class JobAdmin(admin.ModelAdmin):
    save_on_top = True
    prepopulated_fields = {'slug': ('name',)}
    list_filter = ('is_live', 'organization',)
    list_display = ('name', 'organization', 'will_show_on_site', 'listing_start_date', 'listing_end_date', 'tweeted_at')
    search_fields = ('name', 'organization__name',)
    fieldsets = (
        ('', {'fields': (('name', 'slug'), 'description', 'organization', 'location', 'url', 'contact_name', 'email', 'tweeted_at', 'listing_start_date', 'listing_end_date', 'is_live',)}),
    )

    def formfield_for_dbfield(self, db_field, **kwargs):
        # More usable heights and widths in admin form fields
        field = super(JobAdmin, self).formfield_for_dbfield(db_field, **kwargs)
        if db_field.name == 'description':
            field.widget.attrs['style'] = 'height: 3em;'
        return field

admin.site.register(Job, JobAdmin)


text:
<?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android">
    <subtype android:label="@string/tb_desktop_mode_ime_fix"
             android:icon="@mipmap/tb_launcher"
             android:imeSubtypeLocale="en_US"
             android:imeSubtypeMode="keyboard" />
</input-method>


text:
"""This module allows you to connect to the Google Discovery API Service and query it."""
from typing import Optional, Sequence, Union

from googleapiclient.discovery import Resource, build

from airflow.providers.google.common.hooks.base_google import GoogleBaseHook

class GoogleDiscoveryApiHook(GoogleBaseHook):
    """
    A hook to use the Google API Discovery Service.

    :param api_service_name: The name of the api service that is needed to get the data
        for example 'youtube'.
    :type api_service_name: str
    :param api_version: The version of the api that will be requested for example 'v3'.
    :type api_version: str
    :param gcp_conn_id: The connection ID to use when fetching connection info.
    :type gcp_conn_id: str
    :param delegate_to: The account to impersonate using domain-wide delegation of authority,
        if any. For this to work, the service account making the request must have
        domain-wide delegation enabled.
    :type delegate_to: str
    :param impersonation_chain: Optional service account to impersonate using short-term
        credentials, or chained list of accounts required to get the access_token
        of the last account in the list, which will be impersonated in the request.
        If set as a string, the account must grant the originating account
        the Service Account Token Creator IAM role.
        If set as a sequence, the identities from the list must grant
        Service Account Token Creator IAM role to the directly preceding identity, with first
        account from the list granting this role to the originating account.
    :type impersonation_chain: Union[str, Sequence[str]]
    """

    _conn = None  # type: Optional[Resource]

    def __init__(
        self,
        api_service_name: str,
        api_version: str,
        gcp_conn_id: str = "google_cloud_default",
        delegate_to: Optional[str] = None,
        impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
    ) -> None:
        super().__init__(
            gcp_conn_id=gcp_conn_id,
            delegate_to=delegate_to,
            impersonation_chain=impersonation_chain,
        )
        self.api_service_name = api_service_name
        self.api_version = api_version

    def get_conn(self) -> Resource:
        """
        Creates an authenticated api client for the given api service name and credentials.

        :return: the authenticated api service.
        :rtype: Resource
        """
        self.log.info("Authenticating Google API Client")

        if not self._conn:
            http_authorized = self._authorize()
            self._conn = build(
                serviceName=self.api_service_name,
                version=self.api_version,
                http=http_authorized,
                cache_discovery=False,
            )
        return self._conn

    def query(self, endpoint: str, data: dict, paginate: bool = False, num_retries: int = 0) -> dict:
        """
        Creates a dynamic API call to any Google API registered in Google's API Client Library
        and queries it.

        :param endpoint: The client libraries path to the api call's executing method.
            For example: 'analyticsreporting.reports.batchGet'

            .. seealso:: https://developers.google.com/apis-explorer
                for more information on what methods are available.
        :type endpoint: str
        :param data: The data (endpoint params) needed for the specific request to given endpoint.
        :type data: dict
        :param paginate: If set to True, it will collect all pages of data.
        :type paginate: bool
        :param num_retries: Define the number of retries for the requests being made if it fails.
        :type num_retries: int
        :return: the API response from the passed endpoint.
        :rtype: dict
        """
        google_api_conn_client = self.get_conn()

        api_response = self._call_api_request(google_api_conn_client, endpoint, data, paginate, num_retries)
        return api_response

    def _call_api_request(self, google_api_conn_client, endpoint, data, paginate, num_retries):
        api_endpoint_parts = endpoint.split('.')

        google_api_endpoint_instance = self._build_api_request(
            google_api_conn_client, api_sub_functions=api_endpoint_parts[1:], api_endpoint_params=data
        )

        if paginate:
            return self._paginate_api(
                google_api_endpoint_instance, google_api_conn_client, api_endpoint_parts, num_retries
            )

        return google_api_endpoint_instance.execute(num_retries=num_retries)

    def _build_api_request(self, google_api_conn_client, api_sub_functions, api_endpoint_params):
        for sub_function in api_sub_functions:
            google_api_conn_client = getattr(google_api_conn_client, sub_function)
            if sub_function != api_sub_functions[-1]:
                google_api_conn_client = google_api_conn_client()
            else:
                google_api_conn_client = google_api_conn_client(**api_endpoint_params)

        return google_api_conn_client

    def _paginate_api(
        self, google_api_endpoint_instance, google_api_conn_client, api_endpoint_parts, num_retries
    ):
        api_responses = []

        while google_api_endpoint_instance:
            api_response = google_api_endpoint_instance.execute(num_retries=num_retries)
            api_responses.append(api_response)

            google_api_endpoint_instance = self._build_next_api_request(
                google_api_conn_client, api_endpoint_parts[1:], google_api_endpoint_instance, api_response
            )

        return api_responses

    def _build_next_api_request(
        self, google_api_conn_client, api_sub_functions, api_endpoint_instance, api_response
    ):
        for sub_function in api_sub_functions:
            if sub_function != api_sub_functions[-1]:
                google_api_conn_client = getattr(google_api_conn_client, sub_function)
                google_api_conn_client = google_api_conn_client()
            else:
                google_api_conn_client = getattr(google_api_conn_client, sub_function + '_next')
                google_api_conn_client = google_api_conn_client(api_endpoint_instance, api_response)

        return google_api_conn_client


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sia.airblio.beans;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author CedricBm
 */
@Entity
@Table(name = "nb_heures_loues")
public class NbHeuresLoues implements Serializable {

    @Id
    @GeneratedValue
    private int id;
    @Column(name = "nb_heures")
    private int nbHeures;
    @Column(name = "prix_par_heures")
    private double prixParHeures;
    // Domains = [prevues, reels, supplementaires]
    private String statut;

    @ManyToOne
    @JoinColumn(name = "technicien_id")
    private Technicien technicien;

    @ManyToOne
    @JoinColumn(name = "pv_reception_id")
    private PVReception pvReception;

    @ManyToOne
    @JoinColumn(name = "mission_intervention_id")
    private MissionIntervention missionIntervention;

    @Temporal(javax.persistence.TemporalType.DATE)
    private Date created = new Date();
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date updated = new Date();

    @PreUpdate
    public void setLastUpdate() {
        this.updated = new Date();
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @return the nbHeures
     */
    public int getNbHeures() {
        return nbHeures;
    }

    /**
     * @param nbHeures the nbHeures to set
     */
    public void setNbHeures(int nbHeures) {
        this.nbHeures = nbHeures;
    }

    /**
     * @return the prixParHeures
     */
    public double getPrixParHeures() {
        return prixParHeures;
    }

    /**
     * @param prixParHeures the prixParHeures to set
     */
    public void setPrixParHeures(double prixParHeures) {
        this.prixParHeures = prixParHeures;
    }

    /**
     * @return the created
     */
    public Date getCreated() {
        return created;
    }

    /**
     * @return the updated
     */
    public Date getUpdated() {
        return updated;
    }

    /**
     * @return the statut
     */
    public String getStatut() {
        return statut;
    }

    /**
     * @param statut the statut to set
     */
    public void setStatut(String statut) {
        this.statut = statut;
    }

    /**
     * @return the technicien
     */
    public Technicien getTechnicien() {
        return technicien;
    }

    /**
     * @param technicien the technicien to set
     */
    public void setTechnicien(Technicien technicien) {
        this.technicien = technicien;
    }

    /**
     * @return the pvReception
     */
    public PVReception getPvReception() {
        return pvReception;
    }

    /**
     * @param pvReception the pvReception to set
     */
    public void setPvReception(PVReception pvReception) {
        this.pvReception = pvReception;
    }

    /**
     * @return the missionIntervention
     */
    public MissionIntervention getMissionIntervention() {
        return missionIntervention;
    }

    /**
     * @param missionIntervention the missionIntervention to set
     */
    public void setMissionIntervention(MissionIntervention missionIntervention) {
        this.missionIntervention = missionIntervention;
    }
}


text:
module CloudModel
  module Components
    class Neo4jComponent < BaseComponent
      def requirements
        [:java]
      end
    end
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lophium mytilinum var. intricatum P. Karst.

### Remarks
null


text:
using System;
using Org.Json;
using Newtonsoft.Json.Linq;
using Android.App;

namespace Uniforms.Amplitude.Droid
{
    using NativeImplementation = Com.Amplitude.Api.AmplitudeClient;

    public class Amplitude : IAmplitude
    {
        static Activity _mainActivity;

        /// <summary>
        /// Register platform implementation for using via `Uniforms.Amplitude`.
        /// </summary>
        public static void Register(Activity mainActivity)
        {
            _mainActivity = mainActivity;

            Uniforms.Amplitude.Amplitude.Register(typeof(Amplitude));
        }

        /// <summary>
        /// Amplitude native implementation instance for Android.
        /// </summary>
        public NativeImplementation Native
        {
            get
            {
                if (_native == null)
                {
                    _native = String.IsNullOrEmpty(_name) ?
                                    new NativeImplementation() :
                                    new NativeImplementation(_name);
                }

                return _native;
            }
        }
        NativeImplementation _native;

        #region IAmplitude implementation

        public void Initialize(string apiKey, string userId = null)
        {
            if (userId == null)
            {
                Native.Initialize(_mainActivity, apiKey);
            }
            else
            {
                Native.Initialize(_mainActivity, apiKey, userId);
            }

            Native.EnableForegroundTracking(_mainActivity.Application);
			Native.DisableLocationListening();
        }

        public void LogEvent(string eventType, object properties = null, bool outOfSession = false)
        {
            _native.LogEvent(eventType, GetProperties(properties), outOfSession);
        }

        public void LogRevenue(double amount)
        {
            _native.LogRevenue(amount);
        }

        public void LogRevenue(string productIdentifier, int quantity, double price, byte[] receipt = null)
        {
            _native.LogRevenue(productIdentifier, quantity, price);

            if (receipt != null)
            {
                Console.WriteLine("Warning! Receipt is not supported yet, sorry.");
            }
        }

        public void SetUserProperties(object userProperties, bool replace = false)
        {
            _native.SetUserProperties(GetProperties(userProperties));
        }

        public void ClearUserProperties()
        {
            _native.ClearUserProperties();
        }

        public void UploadEvents()
        {
            _native.UploadEvents();
        }

        public void EnableLocationListening()
        {
            _native.EnableLocationListening();
        }

        public void DisableLocationListening()
        {
            _native.DisableLocationListening();
        }

        public void UpdateLocation()
        {
            Console.WriteLine("Update location not supported on Android.");
        }

        public void UseAdvertisingIdForDeviceId()
        {
            _native.UseAdvertisingIdForDeviceId();
        }

        public void PrintEventsCount()
        {
            Console.WriteLine("Print events count not supported on Android.");
        }

        /// <summary>
        /// Name to initialize Amplitude instance with.
        /// </summary>
        /// <description>
        /// Must be set before Initialize() call.
        /// </description>
        public string InstanceName
        {
            get
            {
                return _name ?? "";
            }
            set
            {
                if (_native != null)
                {
                    throw new Exception("Amplitude instance is already initialized!");
                }

                _name = String.IsNullOrEmpty(value) ? null : value;
            }
        }
        string _name;

        /// <summary>
        /// Gets ot sets the userId.
        /// </summary>
        public string UserId
        {
            get { return _native.UserId; }
            set { _native.SetUserId(value); }
        }

        /// <summary>
        /// Gets or sets the deviceId.
        /// </summary>
        public string DeviceId
        {
            get { return _native.DeviceId; }
            set { _native.SetDeviceId(value); }
        }

        /// <summary>
        /// Gets or sets tracking opt out.
        /// </summary>
        public bool OptOut
        {
            get { return _native.IsOptedOut; }
            set { _native.SetOptOut(value); }
        }

        /// <summary>
        /// Disables sending logged events to Amplitude servers.
        /// </summary>
        public bool Offline
        {
            set { _native.SetOffline(value); }
        }

        #endregion

        static JSONObject GetProperties(object properties)
        {
            if (properties == null)
            {
                return null;
            }

            var json = (properties as JObject) != null ?
                (properties as JObject).ToString() :
                Newtonsoft.Json.JsonConvert.SerializeObject(properties);

            return new JSONObject(json);
        }
    }
}


text:
package com.bing.excel.writer;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.poi.ss.usermodel.Workbook;

import com.bing.excel.writer.exception.ExcelOutException;

/**
 * 不是线程安全的
 * @author shizhongtao
 *
 */
public class DefaultFileWriteHandler extends AbstractWriteHandler {

	private transient OutputStream os;

	 DefaultFileWriteHandler(Workbook wb, File file)
			throws FileNotFoundException {
		super(wb,new FileOutputStream(file));
		this.os=super.os;
	}

	 DefaultFileWriteHandler(Workbook wb, String path) {
		super(wb, path);
		this.os=super.os;
	}

	@Override
	public void flush() {
		try {
			if (os != null) {
				super.flush();
				this.os.close();
			}
		} catch (IOException e) {
			throw new ExcelOutException("Happen exception when flush", e);
		}
	}
}


text:
package de.tomsplayground.dividendenpirat.googlesheet;

import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.google.gdata.client.spreadsheet.CellQuery;
import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.data.spreadsheet.CellEntry;
import com.google.gdata.data.spreadsheet.CellFeed;
import com.google.gdata.data.spreadsheet.WorksheetEntry;
import com.google.gdata.util.ServiceException;

import de.tomsplayground.dividendenpirat.cache.CacheUpdater;
import de.tomsplayground.dividendenpirat.cache.ICacheUpdateListener;

@Component
public class WatchlistDataService implements ICacheUpdateListener {

	private static final String WATCHLIST_SORTIERUNG = "Watchlist-Sortierung";

	@Autowired
	private WorksheetService worksheetService;

	@Autowired
	private CacheUpdater cacheUpdater;

	private static Map<Integer, WatchlistEntry> entries = new HashMap<Integer, WatchlistEntry>();

	@PostConstruct
	public void init() {
		cacheUpdater.addListener(this);
	}

	public List<WatchlistEntry> getEntries(){
		synchronized (entries) {
			if (entries.isEmpty()) {
				try {
					SpreadsheetService service = worksheetService.getService();
					WorksheetEntry worksheet = worksheetService.findWorksheetEntryByName(service, WATCHLIST_SORTIERUNG);

					// Fetch the cell feed of the worksheet.
					CellQuery cellFeedUrl = new CellQuery(worksheet.getCellFeedUrl());
					cellFeedUrl.setMinimumRow(5);
					cellFeedUrl.setMinimumCol(3);
					cellFeedUrl.setMaximumCol(23);
					for (CellEntry cell : service.getFeed(cellFeedUrl, CellFeed.class).getEntries()) {
						WatchlistEntry entryByRow = getEntryByRow(cell.getCell().getRow());
						int col = cell.getCell().getCol();
						if (col == 3) {
							entryByRow.setName(cell.getCell().getValue());
						} else if (col == 7) {
							entryByRow.setPePosition(cell.getCell().getNumericValue().intValue());
						} else if (col == 14) {
							entryByRow.setPaybackTime(cell.getCell().getNumericValue().intValue());
						} else if (col == 17) {
							entryByRow.setGrowthPosition(cell.getCell().getNumericValue().intValue());
						} else if (col == 20) {
							entryByRow.setRobustnessPosition(cell.getCell().getNumericValue().intValue());
						} else if (col == 23) {
							entryByRow.setSizePosition(cell.getCell().getNumericValue().intValue());
						}
					}
				} catch (IOException e) {
					throw new RuntimeException(e);
				} catch (GeneralSecurityException e) {
					throw new RuntimeException(e);
				} catch (ServiceException e) {
					throw new RuntimeException(e);
				}
			}
			return new ArrayList<WatchlistEntry>(entries.values());
		}
	}

	private WatchlistEntry getEntryByRow(int row) {
		if (entries.containsKey(row)) {
			return entries.get(row);
		}
		WatchlistEntry entry = new WatchlistEntry();
		entries.put(row, entry);
		return entry;
	}

	@Override
	public void flush() {
		synchronized (entries) {
			entries.clear();
		}
	}
}


text:
/*********************************************************************
 * $Id: sysutil.cc,v 1.2 2001/07/12 17:14:09 ulucs Exp $
 *
 * RHexLib OS utility functions.
 *
 * This file implements the functions defined in sysutil.hh
 *
 * Created       : Uluc Saranli, 01/16/2001
 * Last Modified : Uluc Saranli, 06/27/2001
 *
 ********************************************************************/

// System includes
#ifdef _LINUX_
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#endif

// Local includes
#include "sysutil.hh"

#ifdef _LINUX_ // Need to implement the kbhit() functionality

// keyboardIO class. Used to implement the kbhit() function
class keyboardIO {

private:
  struct termios origTerm, newTerm;
  int peek;

public:
  keyboardIO( void );
  ~keyboardIO();

  int kbhit( void );
  int getch( void );

};

static keyboardIO globalKBIO;

// keyboardIO::keyboardIO : Sets stdin appropriately for kbhit() functionality
keyboardIO::keyboardIO( void ) {

  peek = -1;

  // Save the old terminal properties
  tcgetattr( 0, &origTerm );
  newTerm = origTerm;

  newTerm.c_lflag &= ~ICANON; //Disable canonical mode.(Do not buffer by line )
  newTerm.c_lflag &= ~ECHO;   // Do not echo input characters

  // uluc: I dont think we need this. Removed Jan 16, 2001
  //  newTerm.c_lflag &= ~ISIG;   //Do not generate signals on INTR, QUIT, etc.

  newTerm.c_cc[ VMIN ] = 1;
  newTerm.c_cc[ VTIME ] = 0;

  tcsetattr( 0, TCSANOW, &newTerm );
}

// keyboardIO::keyboardIO : Undoes what the constructor does
keyboardIO::~keyboardIO( ) {

  // Restore the old terminal properties
  tcsetattr( 0, TCSANOW, &origTerm );

}

int keyboardIO::kbhit() {

  char ch;
  int nread;

  if( peek != -1 ) return 1;

  // Set terminal timeout to 0
  newTerm.c_cc[ VMIN ] = 0;
  tcsetattr( 0, TCSANOW, &newTerm );

  // Attempt to read characters
  nread = read( 0, &ch, 1 );

  // Set terminal timeout to 1
  newTerm.c_cc[ VMIN ] = 1;
  tcsetattr( 0, TCSANOW, &newTerm );

  // Buffer the character if any is read
  if ( nread == 1 ) {
   peek = ch;
   return 1;
  }

  // Failure. Keyboard is not hit.
  return 0;
}

int keyboardIO::getch() {

  char ch;

  if( peek != -1 ) {
    // Return any buffered value
    ch = peek;
    peek = -1;
    return ch;
  }

  // If there weren't any buffered values, attempt to read
  read( 0, &ch,1 );

  return ch;
}

// The extern interface
int kbhit( void ) { return globalKBIO.kbhit(); }
int getch( void ) { return globalKBIO.getch(); }

#endif


text:
#ifndef SQUID_ADAPTATION__SERVICE_FILTER_H
#define SQUID_ADAPTATION__SERVICE_FILTER_H

#include "adaptation/Elements.h"

class HttpRequest;
class HttpReply;

namespace Adaptation
{

/// information used to search for adaptation services
class ServiceFilter
{
public:
    ServiceFilter(Method, VectPoint, HttpRequest *, HttpReply *); // locks
    ServiceFilter(const ServiceFilter &f);
    ~ServiceFilter(); // unlocks

    ServiceFilter &operator =(const ServiceFilter &f);

public:
    Method method; ///< adaptation direction
    VectPoint point; ///< adaptation location
    HttpRequest *request; ///< HTTP request being adapted or cause; may be nil
    HttpReply *reply; ///< HTTP response being adapted; may be nil
};

} // namespace Adaptation

#endif /* SQUID_ADAPTATION__SERVICE_FILTER_H */


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Flora, Jena 54: 50 (1871)

#### Original name
Lecidea carneola Ach.

### Remarks
null


text:
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution.  The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
;   ReadMm2.Asm
;
; Abstract:
;
;   AsmReadMm2 function
;
; Notes:
;
;------------------------------------------------------------------------------

    .code

;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMm2 (
;   VOID
;   );
;------------------------------------------------------------------------------
AsmReadMm2  PROC
    ;
    ; 64-bit MASM doesn't support MMX instructions, so use opcode here
    ;
    DB      48h, 0fh, 7eh, 0d0h
    ret
AsmReadMm2  ENDP

    END


text:
#region License
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Philipp Bobek
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
#endregion

using System;
using System.IO;
using BitmapFontLibrary.Loader.Exception;
using BitmapFontLibrary.Loader.Parser;
using BitmapFontLibrary.Model;
using Ninject;

namespace BitmapFontLibrary.Loader
{
    /// <summary>
    /// Loader for fonts.
    /// </summary>
    public class FontLoader : IFontLoader
    {
        private readonly IFontFileParser _binaryFontFileParser;
        private readonly IFontFileParser _textFontFileParser;
        private readonly IFontFileParser _xmlFontFileParser;

        /// <summary>
        /// Loader for fonts.
        /// </summary>
        /// <param name="binaryFontFileParser">Object of a class that implements the IFontFileParser interface</param>
        /// <param name="textFontFileParser">Object of a class that implements the IFontFileParser interface</param>
        /// <param name="xmlFontFileParser">Object of a class that implements the IFontFileParser interface</param>
        public FontLoader([Named("Binary")] IFontFileParser binaryFontFileParser, [Named("Text")] IFontFileParser textFontFileParser,
            [Named("Xml")] IFontFileParser xmlFontFileParser)
        {
            if (binaryFontFileParser == null) throw new ArgumentNullException("binaryFontFileParser");
            if (textFontFileParser == null) throw new ArgumentNullException("textFontFileParser");
            if (xmlFontFileParser == null) throw new ArgumentNullException("xmlFontFileParser");
            _binaryFontFileParser = binaryFontFileParser;
            _textFontFileParser = textFontFileParser;
            _xmlFontFileParser = xmlFontFileParser;
        }

        /// <summary>
        /// Loads a font from an Angelcode Bitmap Font file.
        /// </summary>
        /// <param name="path">Path to the file</param>
        /// <returns>The loaded font</returns>
        public IFont Load(string path)
        {
            try
            {
                IFontFileParser fontFileParser;
                switch (Path.GetExtension(path))
                {
                    case ".fnt":
                        fontFileParser = _binaryFontFileParser;
                        break;
                    case ".txt":
                        fontFileParser = _textFontFileParser;
                        break;
                    case ".xml":
                        fontFileParser = _xmlFontFileParser;
                        break;
                    default:
                        throw new ArgumentException("Unsupported extension: " + Path.GetExtension(path));
                }

                return fontFileParser.Parse(new FileStream(path, FileMode.Open, FileAccess.Read), Path.GetDirectoryName(path));
            }
            catch (System.Exception exception)
            {
                throw new FontLoaderException("Failed loading a font", exception);
            }
        }
    }
}


text:
package com.cilogi.cart;

import java.math.BigDecimal;

public interface ILineItem {
    public String getUid();
    public ISku getSku();
    public int getQuantity();
    public BigDecimal getCost();
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{{ .Site.Title }} : {{ .Title }}</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/github.min.css">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans|Roboto" rel="stylesheet">
    <link rel="stylesheet" href="{{ .Site.BaseURL }}css/styles.css">
    {{ .Hugo.Generator }}

{{ .Site.Title }} : {{ .Title }}


text:
import React from "react";
import PropTypes from "prop-types";
import styled from "styled-components";
import { colors } from "constants/theme";

const StyledLabel = styled.label`
  display: ${props => (props.inline ? "inline-block" : "block")};
  margin-bottom: ${props => (props.inline ? "0" : "0.4em")};
  font-weight: ${props => (props.bold ? "bold" : "normal")};
  vertical-align: middle;
  color: ${colors.darkGrey};
  line-height: 1.3;
`;

const Label = ({ htmlFor, children, ...otherProps }) => (
  <StyledLabel htmlFor={htmlFor} {...otherProps}>
    {children}
  </StyledLabel>
);

Label.propTypes = {
  htmlFor: PropTypes.string,
  children: PropTypes.node.isRequired,
  bold: PropTypes.bool
};

Label.defaultProps = {
  bold: true
};

export default Label;


text:
/* open-sans-regular - cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: local('Open Sans Regular'), local('OpenSans-Regular'),
       url('./open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
       url('./open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}


text:
package com.epam.dlab.backendapi.service.impl;

import com.epam.dlab.backendapi.service.ComputationalService;
import com.epam.dlab.backendapi.service.EdgeService;
import com.epam.dlab.backendapi.service.ExploratoryService;
import com.epam.dlab.dto.UserInstanceDTO;
import com.epam.dlab.dto.base.DataEngineType;
import com.epam.dlab.dto.computational.UserComputationalResource;
import com.epam.dlab.model.ResourceData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import static com.epam.dlab.dto.UserInstanceStatus.*;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;

@RunWith(MockitoJUnitRunner.class)
public class UserResourceServiceImplTest {

	private final String USER = "test";
	private final String EXPLORATORY_NAME = "explName";

	@Mock
	private ExploratoryService exploratoryService;
	@Mock
	private ComputationalService computationalService;
	@Mock
	private EdgeService edgeService;

	@InjectMocks
	private UserResourceServiceImpl userResourceService;

	@Test
	public void convertToResourceData() {
		List<UserInstanceDTO> userInstances = Collections.singletonList(getUserInstance());
		List<ResourceData> expectedResourceList = Arrays.asList(
				ResourceData.exploratoryResource("explId", EXPLORATORY_NAME),
				ResourceData.computationalResource("compId", EXPLORATORY_NAME, "compName")
		);
		List<ResourceData> actualResourceList = userResourceService.convertToResourceData(userInstances);
		assertEquals(2, actualResourceList.size());
		assertEquals(expectedResourceList.get(0).toString(), actualResourceList.get(0).toString());
		assertEquals(expectedResourceList.get(1).toString(), actualResourceList.get(1).toString());
	}

	@Test
	@SuppressWarnings("unchecked")
	public void updateReuploadKeyFlagForUserResources() {
		doNothing().when(exploratoryService).updateExploratoriesReuploadKeyFlag(anyString(), anyBoolean(), anyVararg
				());
		doNothing().when(computationalService).updateComputationalsReuploadKeyFlag(anyString(), any(List.class),
				any(List.class), anyBoolean(), anyVararg());
		doNothing().when(edgeService).updateReuploadKeyFlag(anyString(), anyBoolean(), anyVararg());

		userResourceService.updateReuploadKeyFlagForUserResources(USER, false);

		verify(exploratoryService).updateExploratoriesReuploadKeyFlag(USER, false,
				CREATING, CONFIGURING, STARTING, RUNNING, STOPPING, STOPPED);
		verify(computationalService).updateComputationalsReuploadKeyFlag(USER,
				Arrays.asList(STARTING, RUNNING, STOPPING, STOPPED),
				Collections.singletonList(DataEngineType.SPARK_STANDALONE),
				false,
				CREATING, CONFIGURING, STARTING, RUNNING, STOPPING, STOPPED);
		verify(computationalService).updateComputationalsReuploadKeyFlag(USER,
				Collections.singletonList(RUNNING),
				Collections.singletonList(DataEngineType.CLOUD_SERVICE),
				false,
				CREATING, CONFIGURING, STARTING, RUNNING);
		verify(edgeService).updateReuploadKeyFlag(USER, false, STARTING, RUNNING, STOPPING, STOPPED);
		verifyNoMoreInteractions(exploratoryService, computationalService, edgeService);
	}

	private UserInstanceDTO getUserInstance() {
		UserComputationalResource computationalResource = new UserComputationalResource();
		computationalResource.setComputationalId("compId");
		computationalResource.setComputationalName("compName");
		return new UserInstanceDTO()
				.withUser(USER)
				.withExploratoryId("explId")
				.withExploratoryName(EXPLORATORY_NAME)
				.withResources(Collections.singletonList(computationalResource));
	}
}


text:
package aceim.app.view.page.chat;

import aceim.api.dataentity.Message;
import aceim.api.dataentity.MessageAckState;
import aceim.api.dataentity.tkv.MessageAttachment;
import aceim.api.utils.Logger;
import android.os.Parcel;
import android.os.Parcelable;
import android.widget.ArrayAdapter;

public final class ChatMessageHolder implements Parcelable{

	private final Message mMessage;
	private final String mSenderName;
	private ArrayAdapter<MessageAttachment> mAttachmentsAdapter;
	private MessageAckState mAckState = null;

	public ChatMessageHolder(Message message, String senderName) {
		super();
		this.mMessage = message;
		this.mSenderName = senderName;
	}

	/**
	 * @return the mMessage
	 */
	public Message getMessage() {
		return mMessage;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeString(mSenderName);
		out.writeString(mMessage.getClass().getName());
		out.writeParcelable(mMessage, flags);
	}

	public static final Parcelable.Creator<ChatMessageHolder> CREATOR = new Parcelable.Creator<ChatMessageHolder>() {
		public ChatMessageHolder createFromParcel(Parcel in) {
			return new ChatMessageHolder(in);
		}

		public ChatMessageHolder[] newArray(int size) {
			return new ChatMessageHolder[size];
		}
	};

	private ChatMessageHolder(Parcel in) {
		mSenderName = in.readString();
		String className = in.readString();
		Class<?> cls;
		try {
			cls = (Class<?>) Class.forName(className);
		} catch (ClassNotFoundException e) {
			Logger.log(e);
			cls = null;
		}

		mMessage = (Message) (cls!=null ? in.readParcelable(cls.getClassLoader()) : null);
	}

	/**
	 * @return the mAckState
	 */
	public MessageAckState getAckState() {
		return mAckState;
	}

	/**
	 * @param mAckState the mAckState to set
	 */
	public void setAckState(MessageAckState ackState) {
		this.mAckState = ackState;
	}

	/**
	 * @return the mSenderName
	 */
	public String getSenderName() {
		return mSenderName;
	}

	/**
	 * @return the mAttachmentsAdapter
	 */
	public ArrayAdapter<MessageAttachment> getAttachmentsAdapter() {
		return mAttachmentsAdapter;
	}

	/**
	 * @param mAttachmentsAdapter the mAttachmentsAdapter to set
	 */
	public void setAttachmentsAdapter(ArrayAdapter<MessageAttachment> mAttachmentsAdapter) {
		this.mAttachmentsAdapter = mAttachmentsAdapter;
	}

}


text:
/*
 * DBriefDescriptorExtractor_test.cpp
 *
 *  Created on: Aug 22, 2013
 *      Author: andresf
 */

#include <DBriefDescriptorExtractor.h>

#include <gtest/gtest.h>
#include <opencv2/extensions/features2d.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>

TEST(DBriefFeatureExtractor,Init) {

	cv::initModule_features2d_extensions();

	std::vector<std::string> algorithms;
	cv::Algorithm::getList(algorithms);

	std::string candidateAlgorithm = "Feature2D.DBRIEF";

	bool isValid = false;

	for (std::string& algorithm : algorithms) {
		isValid |= algorithm.compare(candidateAlgorithm) == 0;
	}

	ASSERT_TRUE(isValid);

}

TEST(DBriefFeatureExtractor,Extract) {

	cv::Mat img = cv::imread("test.jpg", CV_LOAD_IMAGE_GRAYSCALE);

	cv::Ptr<cv::FeatureDetector> detector = cv::FeatureDetector::create("FAST");

	std::vector<cv::KeyPoint> keypoints;
	detector->detect(img, keypoints);

	cv::Ptr<cv::DescriptorExtractor> extractor =
			cv::DescriptorExtractor::create("DBRIEF");

	cv::Mat descriptors;

	ASSERT_TRUE(descriptors.empty());

	extractor->compute(img, keypoints, descriptors);

	ASSERT_FALSE(descriptors.empty());

}