text:
package org.nohope.cassandra.mapservice;

import com.google.common.collect.Sets;
import org.nohope.cassandra.mapservice.columns.CColumn;

import java.text.MessageFormat;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.stream.Collectors;

/**
 */
final class CFilterCheckTransporter {
    private static final String VERIFY_COLUMNS_EXCEPTION_MESSAGE = "{2}: Not all columns passed in Query.\n Were passed: {0}.\n Were missed: {1}";
    private static final String NO_SUCH_COLUMN_ERROR_MESSAGE = "No such column {0}. Has columns {1}";
    private static final String NOT_A_CLUSTERING_KEY_ERROR_MESSAGE = "Column {0} is not a clustering/partition key. Clustering keys is {1}, partition keys is {2}";
    private static final String NOT_EXISTING_FILTERED_COLUMNS_ERROR_MESSAGE = "Filtered columns {0} don't exist in current table scheme. Existed columns {1}.";
    private static final String PARTITIONED_KEYS_ERROR_MESSAGE = "Not all primary keys defined in query. Defined {0}. Primaries: {1}.";

    private CFilterCheckTransporter() {
    }

    static void verifyQueryDueToScheme(final TableScheme scheme, final CQuery cQuery) {
        if (!cQuery.getFilters().isEmpty()) {
            performFiltersCheck(scheme, cQuery);
        }

        verifyKeysDefinesOneRow(cQuery, scheme);
        performOrderingsCheck(cQuery, scheme);
    }

    private static void performFiltersCheck(final TableScheme scheme, final CQuery cQuery) {
        final Set<CColumn<?, ?>> filteredColumns = getFilteredColumnSet(cQuery);
        if (notAllMandatoryPrimaryKeysDefinedInFilters(filteredColumns, scheme, cQuery)) {
            throw new CQueryException(
                    MessageFormat.format(
                            PARTITIONED_KEYS_ERROR_MESSAGE,
                            filteredColumns,
                            scheme.getPartitionKeys())
            );
        }

        if (notAllFiltersColumnsFromQueryExistInCurrentTableScheme(filteredColumns, scheme)) {
            throw new CQueryException(
                    MessageFormat.format(
                            NOT_EXISTING_FILTERED_COLUMNS_ERROR_MESSAGE,
                            Sets.difference(filteredColumns, scheme.getColumnsSet()),
                            scheme.getColumnsSet()));
        }
    }

    private static Set<CColumn<?, ?>> getFilteredColumnSet(final CQuery cQuery) {
        return cQuery.getFilters()
                     .stream().map(filter -> filter.getValue().getColumn())
                     .collect(Collectors.toCollection(LinkedHashSet::new));
    }

    private static boolean notAllFiltersColumnsFromQueryExistInCurrentTableScheme(
            final Iterable<CColumn<?, ?>> filteredColumns,
            final TableScheme scheme) {

        for (final CColumn<?, ?> filter : filteredColumns) {
            if (!scheme.getColumnNames().contains(filter.getName())) {
                return true;
            }
        }
        return false;
    }

    private static void performOrderingsCheck(final CQuery cQuery, final TableScheme scheme)
            throws CMapServiceException {
        for (final COrdering ordering : cQuery.getCOrderingCollection()) {
            final CColumn<?, ?> column = ordering.getColumn();
            if (!scheme.containsColumn(column)) {
                throw new CQueryException(
                        MessageFormat.format(NO_SUCH_COLUMN_ERROR_MESSAGE,
                                column,
                                scheme.getColumnsSet())
                );
            }
            if (!scheme.isClusteringKey(column) && !scheme.isPartitionKey(column)) {
                throw new CQueryException(
                        MessageFormat.format(NOT_A_CLUSTERING_KEY_ERROR_MESSAGE,
                                column,
                                scheme.getClusteringKeys(),
                                scheme.getPartitionKeys())
                );
            }
        }
    }

    private static boolean notAllMandatoryPrimaryKeysDefinedInFilters(
            final Iterable<CColumn<?, ?>> filteredColumns,
            final TableScheme scheme, final CQuery cQuery) {

        final Collection<String> primaries =
                scheme.getPartitionKeys().stream()
                      .map(CColumn::getName)
                      .collect(Collectors.toList());

        for (final CColumn<?, ?> filter : filteredColumns) {
            final String name = filter.getName();
            if (primaries.contains(name)) {
                primaries.remove(name);
            }
        }

        return !primaries.isEmpty() && !cQuery.isAllowFiltering();
    }

    private static void verifyKeysDefinesOneRow(final CQuery cQuery, final TableScheme scheme) {
        final Set<CColumn<?, ?>> columns = cQuery.getExpectedColumnsCollection().getColumns();
        verifyColumns(columns, scheme);
    }

    private static void verifyColumns(final Set<CColumn<?, ?>> columns,
                                      final TableScheme scheme) {
        if (!scheme.getColumnsSet().containsAll(columns)) {
            throw new CQueryException(
                    MessageFormat.format(
                            VERIFY_COLUMNS_EXCEPTION_MESSAGE,
                            columns,
                            Sets.difference(scheme.getColumnsSet(), columns),
                            scheme.getTableName())
            );
        }
    }
}


text:
<?php

namespace Hackzilla\TicketMessage\Tests\Entity;

use Hackzilla\TicketMessage\Entity\Ticket;
use Hackzilla\TicketMessage\Model\TicketMessageInterface;

class TicketTest extends \PHPUnit\Framework\TestCase
{
    private $object;

    public function setUp()
    {
        $this->object = new Ticket();
    }

    public function tearDown()
    {
        unset($this->object);
    }

    public function testObjectCreated()
    {
        $this->assertInstanceOf(Ticket::class, $this->object);
    }

    public function testStatus()
    {
        $this->object->setStatus(TicketMessageInterface::STATUS_INVALID);
        $this->assertSame(TicketMessageInterface::STATUS_INVALID, $this->object->getStatus());
    }
}

redpajama_set_name: RedPajamaGithub


text:
{% extends 'base.html' %}

{% block body %}

{{ g.user.name }}

				Profile

Member Since: {{ g.user.sign_up_date }}

General

Goals

Password

Name

{{ g.user.name }}
							Update

Email

{{ g.user.email }}
							Update

				{% if g.user.goal_weight != 0.0 %}

Current Weight Goal: {{ g.user.goal_weight }}lbs
							Update Goal

				{% else %}

Weight

Set your goal weight here! Set Goal

				{% endif %}

				{% if g.user.goal_bodyfat != 0.0 %}

Current Body Fat Goal: {{ g.user.goal_bodyfat }}%
							Update Goal

				{% else %}

Body Fat

Set your goal body fat here! Set Goal

				{% endif %}

				{% if g.user.calorie_goal != 0 %}

Current Daily Calorie Goal: {{ g.user.calorie_goal }}kcal
							Update Goal

				{% else %}

Daily Calories

Set your daily calorie intake goal here! Set Goal

				{% endif %}

                {% if g.user.greek_wrist != 0 %}

Golden Ratio Goal (switch to cm)
                            Update Goals

                                    Chest
                                    {{ g.user.greek_chest|round(2, 'floor') }}in

                                    Forearm
                                    {{ g.user.greek_forearm|round(2, 'floor') }}in

                                    Waist
                                    {{ g.user.greek_waist|round(2, 'floor') }}in

                                    Thigh
                                    {{ g.user.greek_thigh|round(2, 'floor') }}in

                                    Hip
                                    {{ g.user.greek_hip|round(2, 'floor') }}in

                                    Calf
                                    {{ g.user.greek_calf|round(2, 'floor') }}in

                                    Bicep
                                    {{ g.user.greek_bicep|round(2, 'floor') }}in

                                    Neck
                                    {{ g.user.greek_neck|round(2, 'floor') }}in

                {% else %}

Golden Ratio

Find out your Greek god-like measurements! Discover

                {% endif %}

					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Update Goal Weight

					<form class="form-horizontal" method="post" action="/profile/goal_weight">
						<fieldset>

								New Weight Goal

									<input type="text" class="form-control" id="inputGoalWeight" name="inputGoalWeight" placeholder="weight">
									lbs

									<button class="btn btn-default">Cancel</button>
									<button type="submit" class="btn btn-primary">Submit</button>

						</fieldset>
					</form>

					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Update Golden Ratio Goals

					<form class="form-horizontal" id="formGreekGod" method="post" action="/profile/goldenratio">
						<fieldset>

								Wrist Circumference

									<input type="text" class="form-control" id="inputGreekWrist" name="inputGreekWrist" placeholder="circumference">
									in

									<button class="btn btn-default">Cancel</button>
									<button type="submit" class="btn btn-primary">Submit</button>

						</fieldset>
					</form>

					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Update Your Name

					<form class="form-horizontal" method="post" action="/profile/update/name">
						<fieldset>

								Name

									<input type="text" class="form-control" id="inputName" name="inputName" placeholder="{{ g.user.name }}">

									<button class="btn btn-default">Cancel</button>
									<button type="submit" class="btn btn-primary">Submit</button>

						</fieldset>
					</form>

					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Update Your Email

					<form class="form-horizontal" method="post" action="/profile/update/email">
						<fieldset>

								Email

									<input type="text" class="form-control" id="inputEmail" name="inputEmail" placeholder="{{ g.user.email }}">

									<button class="btn btn-default">Cancel</button>
									<button type="submit" class="btn btn-primary">Submit</button>

						</fieldset>
					</form>

					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Update Your Daily Calorie Goal

					<form class="form-horizontal" method="post" action="/profile/goal_calories">
						<fieldset>

								Calories

									<input type="text" class="form-control" id="inputCalories" name="inputCalories" placeholder="{{ g.user.calorie_goal }}">

									<button class="btn btn-default">Cancel</button>
									<button type="submit" class="btn btn-primary">Submit</button>

						</fieldset>
					</form>

					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Update Your Name

					<form class="form-horizontal" method="post" action="/profile/update/name">
						<fieldset>

								Name

									<input type="text" class="form-control" id="inputName" name="inputName" placeholder="{{ g.user.name }}">

									<button class="btn btn-default">Cancel</button>
									<button type="submit" class="btn btn-primary">Submit</button>

						</fieldset>
					</form>

{% endblock %}


text:
package com.diary.services;

import com.diary.dao.GradeDAO;
import com.diary.model.Grade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by JaroLP on 2016-11-06.
 */

@Service
public class GradeService {

    @Autowired
    private GradeDAO gradeDAO;

    @Transactional
    public Grade findGradeById(Long gradeId) {
        return gradeDAO.getById(Grade.class, gradeId);
    }

    @Transactional
    public Grade addGrade(Grade grade) {
        return gradeDAO.create(grade);
    }

    @Transactional
    public List<Grade> findAll() {
        return gradeDAO.findAll(Grade.class);
    }

    @Transactional
    public List<Grade> findGradesByStudentAndSubject(Long studentID, Long subjectID) {
        return gradeDAO.findGradesByStudentAndSubject(studentID, subjectID);
    }

    @Transactional
    public void removeGrade(Grade grade) {
        gradeDAO.delete(grade);
    }

    @Transactional
    public List<Grade> findGradesByStudent(Long studentID) {
        return gradeDAO.findGradesByStudentID(studentID);
    }
}


text:
@interface NSString (XHMD5)
- (NSString *)MD5Hash;
@end


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/scheduler/v1/target.proto

package com.google.cloud.scheduler.v1;

/**
 *
 *
 *

 * Contains information needed for generating an
 * [OpenID Connect
 * token](https://developers.google.com/identity/protocols/OpenIDConnect).
 * This type of authorization can be used for many scenarios, including
 * calling Cloud Run, or endpoints where you intend to validate the token
 * yourself.
 *

 *
 * Protobuf type {@code google.cloud.scheduler.v1.OidcToken}
 */
public final class OidcToken extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.scheduler.v1.OidcToken)
    OidcTokenOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use OidcToken.newBuilder() to construct.
  private OidcToken(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private OidcToken() {
    serviceAccountEmail_ = "";
    audience_ = "";
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new OidcToken();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.scheduler.v1.TargetProto
        .internal_static_google_cloud_scheduler_v1_OidcToken_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.scheduler.v1.TargetProto
        .internal_static_google_cloud_scheduler_v1_OidcToken_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.scheduler.v1.OidcToken.class,
            com.google.cloud.scheduler.v1.OidcToken.Builder.class);
  }

  public static final int SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER = 1;
  private volatile java.lang.Object serviceAccountEmail_;
  /**
   *
   *
   *

   * [Service account email](https://cloud.google.com/iam/docs/service-accounts)
   * to be used for generating OIDC token.
   * The service account must be within the same project as the job. The caller
   * must have iam.serviceAccounts.actAs permission for the service account.
   *

   *
   * string service_account_email = 1;
   *
   * @return The serviceAccountEmail.
   */
  @java.lang.Override
  public java.lang.String getServiceAccountEmail() {
    java.lang.Object ref = serviceAccountEmail_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      serviceAccountEmail_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * [Service account email](https://cloud.google.com/iam/docs/service-accounts)
   * to be used for generating OIDC token.
   * The service account must be within the same project as the job. The caller
   * must have iam.serviceAccounts.actAs permission for the service account.
   *

   *
   * string service_account_email = 1;
   *
   * @return The bytes for serviceAccountEmail.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getServiceAccountEmailBytes() {
    java.lang.Object ref = serviceAccountEmail_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      serviceAccountEmail_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int AUDIENCE_FIELD_NUMBER = 2;
  private volatile java.lang.Object audience_;
  /**
   *
   *
   *

   * Audience to be used when generating OIDC token. If not specified, the URI
   * specified in target will be used.
   *

   *
   * string audience = 2;
   *
   * @return The audience.
   */
  @java.lang.Override
  public java.lang.String getAudience() {
    java.lang.Object ref = audience_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      audience_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * Audience to be used when generating OIDC token. If not specified, the URI
   * specified in target will be used.
   *

   *
   * string audience = 2;
   *
   * @return The bytes for audience.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getAudienceBytes() {
    java.lang.Object ref = audience_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      audience_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccountEmail_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, serviceAccountEmail_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(audience_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, audience_);
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccountEmail_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, serviceAccountEmail_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(audience_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, audience_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.scheduler.v1.OidcToken)) {
      return super.equals(obj);
    }
    com.google.cloud.scheduler.v1.OidcToken other = (com.google.cloud.scheduler.v1.OidcToken) obj;

    if (!getServiceAccountEmail().equals(other.getServiceAccountEmail())) return false;
    if (!getAudience().equals(other.getAudience())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER;
    hash = (53 * hash) + getServiceAccountEmail().hashCode();
    hash = (37 * hash) + AUDIENCE_FIELD_NUMBER;
    hash = (53 * hash) + getAudience().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.scheduler.v1.OidcToken parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.cloud.scheduler.v1.OidcToken prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   *

   * Contains information needed for generating an
   * [OpenID Connect
   * token](https://developers.google.com/identity/protocols/OpenIDConnect).
   * This type of authorization can be used for many scenarios, including
   * calling Cloud Run, or endpoints where you intend to validate the token
   * yourself.
   *

   *
   * Protobuf type {@code google.cloud.scheduler.v1.OidcToken}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.scheduler.v1.OidcToken)
      com.google.cloud.scheduler.v1.OidcTokenOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.scheduler.v1.TargetProto
          .internal_static_google_cloud_scheduler_v1_OidcToken_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.scheduler.v1.TargetProto
          .internal_static_google_cloud_scheduler_v1_OidcToken_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.scheduler.v1.OidcToken.class,
              com.google.cloud.scheduler.v1.OidcToken.Builder.class);
    }

    // Construct using com.google.cloud.scheduler.v1.OidcToken.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      serviceAccountEmail_ = "";

      audience_ = "";

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.scheduler.v1.TargetProto
          .internal_static_google_cloud_scheduler_v1_OidcToken_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.scheduler.v1.OidcToken getDefaultInstanceForType() {
      return com.google.cloud.scheduler.v1.OidcToken.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.scheduler.v1.OidcToken build() {
      com.google.cloud.scheduler.v1.OidcToken result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.scheduler.v1.OidcToken buildPartial() {
      com.google.cloud.scheduler.v1.OidcToken result =
          new com.google.cloud.scheduler.v1.OidcToken(this);
      result.serviceAccountEmail_ = serviceAccountEmail_;
      result.audience_ = audience_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.scheduler.v1.OidcToken) {
        return mergeFrom((com.google.cloud.scheduler.v1.OidcToken) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.scheduler.v1.OidcToken other) {
      if (other == com.google.cloud.scheduler.v1.OidcToken.getDefaultInstance()) return this;
      if (!other.getServiceAccountEmail().isEmpty()) {
        serviceAccountEmail_ = other.serviceAccountEmail_;
        onChanged();
      }
      if (!other.getAudience().isEmpty()) {
        audience_ = other.audience_;
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                serviceAccountEmail_ = input.readStringRequireUtf8();

                break;
              } // case 10
            case 18:
              {
                audience_ = input.readStringRequireUtf8();

                break;
              } // case 18
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private java.lang.Object serviceAccountEmail_ = "";
    /**
     *
     *
     *

     * [Service account email](https://cloud.google.com/iam/docs/service-accounts)
     * to be used for generating OIDC token.
     * The service account must be within the same project as the job. The caller
     * must have iam.serviceAccounts.actAs permission for the service account.
     *

     *
     * string service_account_email = 1;
     *
     * @return The serviceAccountEmail.
     */
    public java.lang.String getServiceAccountEmail() {
      java.lang.Object ref = serviceAccountEmail_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        serviceAccountEmail_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * [Service account email](https://cloud.google.com/iam/docs/service-accounts)
     * to be used for generating OIDC token.
     * The service account must be within the same project as the job. The caller
     * must have iam.serviceAccounts.actAs permission for the service account.
     *

     *
     * string service_account_email = 1;
     *
     * @return The bytes for serviceAccountEmail.
     */
    public com.google.protobuf.ByteString getServiceAccountEmailBytes() {
      java.lang.Object ref = serviceAccountEmail_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        serviceAccountEmail_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * [Service account email](https://cloud.google.com/iam/docs/service-accounts)
     * to be used for generating OIDC token.
     * The service account must be within the same project as the job. The caller
     * must have iam.serviceAccounts.actAs permission for the service account.
     *

     *
     * string service_account_email = 1;
     *
     * @param value The serviceAccountEmail to set.
     * @return This builder for chaining.
     */
    public Builder setServiceAccountEmail(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      serviceAccountEmail_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * [Service account email](https://cloud.google.com/iam/docs/service-accounts)
     * to be used for generating OIDC token.
     * The service account must be within the same project as the job. The caller
     * must have iam.serviceAccounts.actAs permission for the service account.
     *

     *
     * string service_account_email = 1;
     *
     * @return This builder for chaining.
     */
    public Builder clearServiceAccountEmail() {

      serviceAccountEmail_ = getDefaultInstance().getServiceAccountEmail();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * [Service account email](https://cloud.google.com/iam/docs/service-accounts)
     * to be used for generating OIDC token.
     * The service account must be within the same project as the job. The caller
     * must have iam.serviceAccounts.actAs permission for the service account.
     *

     *
     * string service_account_email = 1;
     *
     * @param value The bytes for serviceAccountEmail to set.
     * @return This builder for chaining.
     */
    public Builder setServiceAccountEmailBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      serviceAccountEmail_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object audience_ = "";
    /**
     *
     *
     *

     * Audience to be used when generating OIDC token. If not specified, the URI
     * specified in target will be used.
     *

     *
     * string audience = 2;
     *
     * @return The audience.
     */
    public java.lang.String getAudience() {
      java.lang.Object ref = audience_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        audience_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * Audience to be used when generating OIDC token. If not specified, the URI
     * specified in target will be used.
     *

     *
     * string audience = 2;
     *
     * @return The bytes for audience.
     */
    public com.google.protobuf.ByteString getAudienceBytes() {
      java.lang.Object ref = audience_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        audience_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * Audience to be used when generating OIDC token. If not specified, the URI
     * specified in target will be used.
     *

     *
     * string audience = 2;
     *
     * @param value The audience to set.
     * @return This builder for chaining.
     */
    public Builder setAudience(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      audience_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Audience to be used when generating OIDC token. If not specified, the URI
     * specified in target will be used.
     *

     *
     * string audience = 2;
     *
     * @return This builder for chaining.
     */
    public Builder clearAudience() {

      audience_ = getDefaultInstance().getAudience();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Audience to be used when generating OIDC token. If not specified, the URI
     * specified in target will be used.
     *

     *
     * string audience = 2;
     *
     * @param value The bytes for audience to set.
     * @return This builder for chaining.
     */
    public Builder setAudienceBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      audience_ = value;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.scheduler.v1.OidcToken)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.scheduler.v1.OidcToken)
  private static final com.google.cloud.scheduler.v1.OidcToken DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.scheduler.v1.OidcToken();
  }

  public static com.google.cloud.scheduler.v1.OidcToken getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<OidcToken> PARSER =
      new com.google.protobuf.AbstractParser<OidcToken>() {
        @java.lang.Override
        public OidcToken parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<OidcToken> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<OidcToken> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.scheduler.v1.OidcToken getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}


text:
#pragma once
#include <aws/iot/IoT_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace IoT
{
namespace Model
{
  enum class DetectMitigationActionsTaskStatus
  {
    NOT_SET,
    IN_PROGRESS,
    SUCCESSFUL,
    FAILED,
    CANCELED
  };

namespace DetectMitigationActionsTaskStatusMapper
{
AWS_IOT_API DetectMitigationActionsTaskStatus GetDetectMitigationActionsTaskStatusForName(const Aws::String& name);

AWS_IOT_API Aws::String GetNameForDetectMitigationActionsTaskStatus(DetectMitigationActionsTaskStatus value);
} // namespace DetectMitigationActionsTaskStatusMapper
} // namespace Model
} // namespace IoT
} // namespace Aws


text:
module.exports = {
  title: 'Form checkbox group',
  status: 'wip',
  context: {
    id: 'contact',
    name: 'contact-group',
    legend: 'How do you want to be contacted?',
    legendIsVisuallyHidden: false,
    checkboxGroup: [{
      id: 'example-contact-by-email',
      value: 'contact-by-email',
      label: 'Email'
    }, {
      id: 'example-contact-by-phone',
      value: 'contact-by-phone',
      label: 'Phone'
    }, {
      id: 'example-contact-by-text',
      value: 'contact-by-text',
      label: 'Text'
    }]
  },
  variants: [{
    name: 'has hint',
    context: {
      hint: 'Select all that apply'
    }
  },
  {
    name: 'has error',
    context: {
      error: 'Error text in here'
    }
  },
  {
    name: 'has hint and error',
    context: {
      hint: 'Select all that apply',
      error: 'Error text in here'
    }
  }],
  arguments: ['id', 'name', 'legend', 'legendIsVisuallyHidden', 'hint', 'error', 'checkboxGroup', 'value']
}


text:
<?php

use DTS\eBaySDK\Trading\Enums\PricingTreatmentCodeType;

class PricingTreatmentCodeTypeTest extends \PHPUnit_Framework_TestCase
{
    private $obj;

    protected function setUp()
    {
        $this->obj = new PricingTreatmentCodeType();
    }

    public function testCanBeCreated()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\Trading\Enums\PricingTreatmentCodeType', $this->obj);
    }
}


text:
layout: about
permalink: /
title: Koustuv Sinha
description: McGill University / Montreal Institute of Learning Algorithms.

profile:
  align: right
  image: prof_pic.jpg
  address: >

Room 108,

McConnell Engineering Bldg

3480 University St.

Montreal, Quebec H3A OE9

news: true
social: true
---

My primary research interests are Generative Language Modeling (Dialog Systems) and Language Reasoning. I am also interested in other areas of Natural Language Processing (NLP) as well such as Text classification, Text representation, and Entailment. I am also interested in exploring strong linguistic priors in designing machine learning systems for text generation and representation.

Currently, I live in the wonderful city of [Montreal](https://www.lonelyplanet.com/canada/montreal), Canada, working as a Research Associate in [McGill University](http://mcgill.ca/), while pursuing PhD at the [School of Computer Science](http://cs.mcgill.ca). Previously, I worked at [Indian Institute of Technology, Kanpur](http://iitk.ac.in) at the position of Senior Project Associate, as well as [NRI Fintech](http://www.nrifintech.com/), Kolkata, as Front End Developer. I graduated B.Tech in Computer Science & Engineering from [Institute of Engineering & Management, Kolkata](http://iem.edu.in) in 2014. You can find my detailed [CV here](assets/files/cv.pdf)


text:
ChatSession::ChatSession()
{
}

ChatSession::~ChatSession()
{
}

void ChatSession::Release(void)
{
	//LogFun(LT_Screen, LogLv_Debug, "ip : %s, port : %d", GetRemoteIPStr(), GetRemotePort());
	CSocketSession::Release();
	CSessionFactory::Instance()->Release(this);
}

void ChatSession::OnRecv(const char* pBuf, UINT32 dwLen)
{

}


text:
@class NSBezierPath, NSColor, NSImage;

@interface DVTLineGraphLayerStyle : NSObject
{
    NSImage *_symbolImage;
    NSBezierPath *_symbolPath;
    NSImage *_selectedSymbolImage;
    BOOL _fillSymbol;
    int _symbolStyle;
    double _lineWidth;
    NSColor *_lineColor;
    double _symbolSize;
}

@property(nonatomic) BOOL fillSymbol; // @synthesize fillSymbol=_fillSymbol;
@property(nonatomic) double symbolSize; // @synthesize symbolSize=_symbolSize;
@property(nonatomic) int symbolStyle; // @synthesize symbolStyle=_symbolStyle;
@property(copy, nonatomic) NSColor *lineColor; // @synthesize lineColor=_lineColor;
@property(nonatomic) double lineWidth; // @synthesize lineWidth=_lineWidth;
- (void).cxx_destruct;
- (void)_sendStyleChangedNotification;
@property(readonly) NSImage *selectedSymbolImage;
- (id)_createSymbolPathForSymbolStyle:(int)arg1;
@property(readonly) NSBezierPath *symbolPath;
@property(readonly) NSImage *symbolImage;
- (void)_resetSymbol;
- (id)init;

@end


text:
package com.microsoft.sqlserver.jdbc;

import java.net.Socket;
import java.sql.BatchUpdateException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Shims for JDBC 4.2 JAR.
 *
 * JDBC 4.2 public methods should always check the SQLServerJdbcVersion first to make sure that they are not operable in
 * any earlier driver version. That is, they should throw an exception, be a no-op, or whatever.
 */

final class DriverJDBCVersion {
    // The 4.2 driver is compliant to JDBC 4.2.
    static final int major = 4;
    static final int minor = 2;

    private static final Logger logger = Logger.getLogger("com.microsoft.sqlserver.jdbc.internals.DriverJDBCVersion");

    static final boolean checkSupportsJDBC43() {
        return false;
    }

    static final void throwBatchUpdateException(SQLServerException lastError,
            long[] updateCounts) throws BatchUpdateException {
        throw new BatchUpdateException(lastError.getMessage(), lastError.getSQLState(), lastError.getErrorCode(),
                updateCounts, new Throwable(lastError.getMessage()));
    }

    static SQLServerConnection getSQLServerConnection(String parentInfo) throws SQLServerException {
        return new SQLServerConnection(parentInfo);
    }

    /** Client process ID sent during login */
    private static int pid = 0;

    static int getProcessId() {
        return pid;
    }

    static void setSocketOptions(Socket tcpSocket, TDSChannel channel) {
        if (logger.isLoggable(Level.FINER)) {
            logger.finer(
                    "Socket.supportedOptions() not available on this JVM. Extended KeepAlive options will not be set.");
        }
    }
}


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

namespace FluentSecurity
{
	public interface ISecurityContext
	{
		Guid Id { get; }
		dynamic Data { get; }
		bool CurrentUserIsAuthenticated();
		IEnumerable<object> CurrentUserRoles();
		ISecurityRuntime Runtime { get; }
	}
}


text:
int
main(int argc, char* argv[]) {
	if (argc < 2) {
		getUsage(argv[0]);
		return 1;
	}

	try {
		std::cout << "Test1 (setRes, setFps, start): START" << std::endl;
		Camera cam(argc, argv);
		cam.openDevice();
		cam.setResolution();
		cam.setFrameRate();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.writePPM("FpsAfterRes.ppm");
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.closeDevice();
		std::cout << "Test1: DONE" << std::endl;
	} catch (std::exception& e) {
		std::cout << "Test1: FAIL" << std::endl;
	}

	try {
		std::cout << "Test2 (setFps, setRes, start): START" << std::endl;
		Camera cam(argc, argv);
		cam.openDevice();
		cam.setFrameRate();
		cam.setResolution();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.writePPM("FpsBeforeRes.ppm");
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.closeDevice();
		std::cout << "Test2: DONE" << std::endl;
	} catch (std::exception& e) {
		std::cout << "Test2: FAIL" << std::endl;
	}

	try {
		std::cout << "Test3 (stop, start): START" << std::endl;
		Camera cam(argc, argv);
		cam.openDevice();
		cam.setFrameRate();
		cam.setResolution();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		// stop camera, then restart it.
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.writePPM("StopStart.ppm");
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.closeDevice();
		std::cout << "Test3: DONE" << std::endl;
	} catch (std::exception& e) {
		std::cout << "Test3: FAIL" << std::endl;
	}

	try {
		std::cout << "Test4 (stop, setRes, start): START" << std::endl;
		Camera cam(argc, argv);
		cam.openDevice();
		cam.setResolution();
		cam.setFrameRate();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.stopStreaming();
		cam.unInitMmapStreaming();

		cam.setResolution();

		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.writePPM("ResUpdate.ppm");
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.closeDevice();
		std::cout << "Test4: DONE" << std::endl;
	} catch (std::exception& e) {
		std::cout << "Test4: FAIL" << std::endl;
	}

	try {
		std::cout << "Test5 (stop, setFps, start): START" << std::endl;
		Camera cam(argc, argv);
		cam.openDevice();
		cam.setResolution();
		cam.setFrameRate();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.stopStreaming();
		cam.unInitMmapStreaming();

		cam.setFrameRate();

		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.writePPM("FpsUpdate.ppm");
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.closeDevice();
		std::cout << "Test5: DONE" << std::endl;
	} catch (std::exception& e) {
		std::cout << "Test5: FAIL" << std::endl;
	}

	try {
		std::cout << "Test6 (stop, setFps, setRes, start): START" << std::endl;
		Camera cam(argc, argv);
		cam.openDevice();
		cam.setResolution();
		cam.setFrameRate();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.stopStreaming();
		cam.unInitMmapStreaming();

		cam.setFrameRate();
		cam.setResolution();

		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.writePPM("FpsResUpdate.ppm");
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.closeDevice();
		std::cout << "Test6: DONE" << std::endl;
	} catch (std::exception& e) {
		std::cout << "Test6: FAIL" << std::endl;
	}

	try {
		std::cout << "Test7 (stop, setRes, setFps, start): START" << std::endl;
		Camera cam(argc, argv);
		cam.openDevice();
		cam.setResolution();
		cam.setFrameRate();
		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.stopStreaming();
		cam.unInitMmapStreaming();

		cam.setResolution();
		cam.setFrameRate();

		cam.initMmapStreaming();
		cam.startStreaming();
		std::this_thread::sleep_for(std::chrono::milliseconds(
		  1000 * (cam.bufferNb() + 2) / cam.fps())); // Fill all buffer
		cam.flushBuffer();
		cam.writePPM("ResFpsUpdate.ppm");
		cam.stopStreaming();
		cam.unInitMmapStreaming();
		cam.closeDevice();
		std::cout << "Test7: DONE" << std::endl;
	} catch (std::exception& e) {
		std::cout << "Test7: FAIL" << std::endl;
	}

	return 0;
}


text:
import React from 'react';

import './Header.scss';
import WingButton from '../WingButton/WingButton';
import FieldEditor from '../FieldEditor/FieldEditor';

const Header = (props) => (
  <div className="header-wrapper">
    <WingButton onClick={props.autoPlay}></WingButton>
    <FieldEditor value={props.email} onChange= {props.editEmail}></FieldEditor>
  </div>
);

Header.propTypes = {
  autoPlay: React.PropTypes.func.isRequired,
  editEmail: React.PropTypes.func.isRequired,
  email: React.PropTypes.string.isRequired
};

export default Header;


text:
A `Class` identifies a single instance of a type that is exposed to ZenScript. Almost everything in ZenScript is, in fact, an instance of a class, be it an `IItemStack` (which is an instance of that class) or an array of strings (which is an instance of `string[]`).

## Class details
The class is situated in the `zenscriptx.reflect` package, making `zenscriptx.reflect.Class` the fully qualified name for importing.

## Creating a new Instance
The only possible way to create a new `Class` instance is through one of the two static methods, which take either the name of the class or an object to inspect. The snippe that follows shows the signatures of the two methods that can be used:

```zenscript
function byName(name as string) as Class?;
function from(instance as any) as Class?;
```

Both methods are allowed to return `null` (as shown by the `?` at the end of the type) because there is the possibility for some classes not to have a ZenScript equivalent or are literally unable to be represented as instances of `Class`.

The following are some examples of usage of the two factory methods:

```zenscript
Class.byName("crafttweaker.item.IItemStack"); # returns a Class that represents IItemStack
Class.from(<blockstate:minecraft:pumpkin>); # returns a Class that represents IBlockState
Class.byName("123"); # returns null because no class with that name exists (or can exist, for that matter)
```

## Свойства
A `Class` provides read-only access to a certain set of properties, as outlined in the following table:

| Property Name   | Тип      | Описание                                                                                |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `simpleName`    | `string` | "Shortest" name that can be used to refer to the class (i.e. `IItemStack` for `crafttweaker.item.IItemStack`, `string` for `string`) |
| `qualifiedName` | `string` | Full name that uniquely identifies this class in the ZenScript environment (i.e. `crafttweaker.item.IItemStack` or `string`)         |

## Методы
`Class` also provides access to a single method that allows conversion to the "native" equivalent (refer to [`NativeClass`](/Mods/Boson/Reflection/NativeClass/) for more information). The signature of the method is as follows:

```zenscript
function toNativeClass() as NativeClass?;
```

The method may return `null` because not all ZenScript types may have a native equivalent, e.g. certain associative arrays may not be perfectly represented in a native environment, requiring some mangling.


text:
"""Spector and Mazzeo (1980) - Program Effectiveness Data"""
from statsmodels.datasets import utils as du

__docformat__ = 'restructuredtext'

COPYRIGHT   = """Used with express permission of the original author, who
retains all rights. """
TITLE       = __doc__
SOURCE      = """
http://pages.stern.nyu.edu/~wgreene/Text/econometricanalysis.htm

The raw data was downloaded from Bill Greene's Econometric Analysis web site,
though permission was obtained from the original researcher, Dr. Lee Spector,
Professor of Economics, Ball State University."""

DESCRSHORT  = """Experimental data on the effectiveness of the personalized
system of instruction (PSI) program"""

DESCRLONG   = DESCRSHORT

NOTE        = """::

    Number of Observations - 32

    Number of Variables - 4

    Variable name definitions::

        Grade - binary variable indicating whether or not a student's grade
                improved.  1 indicates an improvement.
        TUCE  - Test score on economics test
        PSI   - participation in program
        GPA   - Student's grade point average
"""

def load(as_pandas=None):
    """
    Load the Spector dataset and returns a Dataset class instance.

    Parameters
    ----------
    as_pandas : bool
        Flag indicating whether to return pandas DataFrames and Series
        or numpy recarrays and arrays.  If True, returns pandas.

    Returns
    -------
    Dataset instance:
        See DATASET_PROPOSAL.txt for more information.
    """
    return du.as_numpy_dataset(load_pandas(), as_pandas=as_pandas)

def load_pandas():
    """
    Load the Spector dataset and returns a Dataset class instance.

    Returns
    -------
    Dataset instance:
        See DATASET_PROPOSAL.txt for more information.
    """
    data = _get_data()
    return du.process_pandas(data, endog_idx=3)

def _get_data():
    data = du.load_csv(__file__, 'spector.csv', sep=r'\s')
    data = du.strip_column_names(data)
    data = data.iloc[:, [1, 2, 3, 4]]
    return data.astype(float)


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.monitoring.v3.model;

/**
 * A condition type that checks that monitored resources are reporting data. The configuration
 * defines a metric and a set of monitored resources. The predicate is considered in violation when
 * a time series for the specified metric of a monitored resource does not include any data in the
 * specified duration.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Stackdriver Monitoring API. For a detailed
 * explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class MetricAbsence extends com.google.api.client.json.GenericJson {

  /**
   * Specifies the alignment of data points in individual time series as well as how to combine the
   * retrieved time series together (such as when aggregating multiple streams on each resource to a
   * single stream for each resource or when aggregating streams across all members of a group of
   * resrouces). Multiple aggregations are applied in the order specified.This field is similar to
   * the one in the MetricService.ListTimeSeries request. It is advisable to use the ListTimeSeries
   * method when debugging this field.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<Aggregation> aggregations;

  static {
    // hack to force ProGuard to consider Aggregation used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(Aggregation.class);
  }

  /**
   * The amount of time that a time series must fail to report new data to be considered failing.
   * Currently, only values that are a multiple of a minute--e.g. 60, 120, or 300 seconds--are
   * supported. If an invalid value is given, an error will be returned. The Duration.nanos field is
   * ignored.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String duration;

  /**
   * A filter that identifies which time series should be compared with the threshold.The filter is
   * similar to the one that is specified in the MetricService.ListTimeSeries request (that call is
   * useful to verify the time series that will be retrieved / processed) and must specify the
   * metric type and optionally may contain restrictions on resource type, resource labels, and
   * metric labels. This field may not exceed 2048 Unicode characters in length.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String filter;

  /**
   * The number/percent of time series for which the comparison must hold in order for the condition
   * to trigger. If unspecified, then the condition will trigger if the comparison is true for any
   * of the time series that have been identified by filter and aggregations.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Trigger trigger;

  /**
   * Specifies the alignment of data points in individual time series as well as how to combine the
   * retrieved time series together (such as when aggregating multiple streams on each resource to a
   * single stream for each resource or when aggregating streams across all members of a group of
   * resrouces). Multiple aggregations are applied in the order specified.This field is similar to
   * the one in the MetricService.ListTimeSeries request. It is advisable to use the ListTimeSeries
   * method when debugging this field.
   * @return value or {@code null} for none
   */
  public java.util.List<Aggregation> getAggregations() {
    return aggregations;
  }

  /**
   * Specifies the alignment of data points in individual time series as well as how to combine the
   * retrieved time series together (such as when aggregating multiple streams on each resource to a
   * single stream for each resource or when aggregating streams across all members of a group of
   * resrouces). Multiple aggregations are applied in the order specified.This field is similar to
   * the one in the MetricService.ListTimeSeries request. It is advisable to use the ListTimeSeries
   * method when debugging this field.
   * @param aggregations aggregations or {@code null} for none
   */
  public MetricAbsence setAggregations(java.util.List<Aggregation> aggregations) {
    this.aggregations = aggregations;
    return this;
  }

  /**
   * The amount of time that a time series must fail to report new data to be considered failing.
   * Currently, only values that are a multiple of a minute--e.g. 60, 120, or 300 seconds--are
   * supported. If an invalid value is given, an error will be returned. The Duration.nanos field is
   * ignored.
   * @return value or {@code null} for none
   */
  public String getDuration() {
    return duration;
  }

  /**
   * The amount of time that a time series must fail to report new data to be considered failing.
   * Currently, only values that are a multiple of a minute--e.g. 60, 120, or 300 seconds--are
   * supported. If an invalid value is given, an error will be returned. The Duration.nanos field is
   * ignored.
   * @param duration duration or {@code null} for none
   */
  public MetricAbsence setDuration(String duration) {
    this.duration = duration;
    return this;
  }

  /**
   * A filter that identifies which time series should be compared with the threshold.The filter is
   * similar to the one that is specified in the MetricService.ListTimeSeries request (that call is
   * useful to verify the time series that will be retrieved / processed) and must specify the
   * metric type and optionally may contain restrictions on resource type, resource labels, and
   * metric labels. This field may not exceed 2048 Unicode characters in length.
   * @return value or {@code null} for none
   */
  public java.lang.String getFilter() {
    return filter;
  }

  /**
   * A filter that identifies which time series should be compared with the threshold.The filter is
   * similar to the one that is specified in the MetricService.ListTimeSeries request (that call is
   * useful to verify the time series that will be retrieved / processed) and must specify the
   * metric type and optionally may contain restrictions on resource type, resource labels, and
   * metric labels. This field may not exceed 2048 Unicode characters in length.
   * @param filter filter or {@code null} for none
   */
  public MetricAbsence setFilter(java.lang.String filter) {
    this.filter = filter;
    return this;
  }

  /**
   * The number/percent of time series for which the comparison must hold in order for the condition
   * to trigger. If unspecified, then the condition will trigger if the comparison is true for any
   * of the time series that have been identified by filter and aggregations.
   * @return value or {@code null} for none
   */
  public Trigger getTrigger() {
    return trigger;
  }

  /**
   * The number/percent of time series for which the comparison must hold in order for the condition
   * to trigger. If unspecified, then the condition will trigger if the comparison is true for any
   * of the time series that have been identified by filter and aggregations.
   * @param trigger trigger or {@code null} for none
   */
  public MetricAbsence setTrigger(Trigger trigger) {
    this.trigger = trigger;
    return this;
  }

  @Override
  public MetricAbsence set(String fieldName, Object value) {
    return (MetricAbsence) super.set(fieldName, value);
  }

  @Override
  public MetricAbsence clone() {
    return (MetricAbsence) super.clone();
  }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
类 org.xml.sax.SAXException 的使用 (Java Platform SE 6)
</TITLE>

<META NAME="date" CONTENT="2007-03-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      概述
      软件包
      类
    使用
      树
      已过时
      索引
      帮助

JavaTM Platform
Standard Ed. 6

 上一个
 下一个

  框架
 无框架

  所有类

类 org.xml.sax.SAXException
的使用

使用 SAXException 的软件包

javax.xml.bind.helpers

仅由 JAXB 提供者用于: 提供某些 <tt>javax.xml.bind</tt> 接口的部分默认实现。

javax.xml.parsers

提供允许处理 XML 文档的类。

javax.xml.validation

此包提供了用于 XML 文档验证的 API。

org.xml.sax
 此包提供了核心 SAX API。

org.xml.sax.ext

此包包含适合的 SAX 驱动程序不一定支持的 SAX2 设施的接口。

org.xml.sax.helpers
此包包含“帮助器”类,其中包括对引导基于 SAX 的应用程序的支持。

javax.xml.bind.helpers 中 SAXException 的使用

参数类型为 SAXException 的 javax.xml.bind.helpers 中的方法

protected  UnmarshalException
AbstractUnmarshallerImpl.createUnmarshalException(SAXException e)

          从 SAXException 创建 UnmarshalException。

javax.xml.parsers 中 SAXException 的使用

抛出 SAXException 的 javax.xml.parsers 中的方法

abstract  Parser
SAXParser.getParser()

          返回由此类的实现封装的 SAX 解析器。

abstract  XMLReader
SAXParser.getXMLReader()

          返回由此类的实现封装的 XMLReader。

abstract  SAXParser
SAXParserFactory.newSAXParser()

          使用当前配置的工厂参数创建 SAXParser 的一个新实例。

 Document
DocumentBuilder.parse(File f)

          将给定文件的内容解析为一个 XML 文档,并且返回一个新的 DOM Document 对象。

 void
SAXParser.parse(File f,
      DefaultHandler dh)

          使用指定的 DefaultHandler 将指定文件的内容解析为 XML。

 void
SAXParser.parse(File f,
      HandlerBase hb)

          使用指定的 HandlerBase 将指定文件的内容解析为 XML。

abstract  Document
DocumentBuilder.parse(InputSource is)

          将给定输入源的内容解析为一个 XML 文档,并且返回一个新的 DOM Document 对象。

 void
SAXParser.parse(InputSource is,
      DefaultHandler dh)

          使用指定的 DefaultHandler 将给定 InputSource 的内容解析为 XML。

 void
SAXParser.parse(InputSource is,
      HandlerBase hb)

          使用指定的 HandlerBase 将给定 InputSource 的内容解析为 XML。

 Document
DocumentBuilder.parse(InputStream is)

          将给定 InputStream 的内容解析为一个 XML 文档,并且返回一个新的 DOM Document 对象。

 void
SAXParser.parse(InputStream is,
      DefaultHandler dh)

          使用指定的 DefaultHandler 将给定的 InputStream 实例的内容解析为 XML。

 void
SAXParser.parse(InputStream is,
      DefaultHandler dh,
      String systemId)

          使用指定的 DefaultHandler 将给定的 InputStream 实例的内容解析为 XML。

 void
SAXParser.parse(InputStream is,
      HandlerBase hb)

          使用指定的 HandlerBase 将给定的 InputStream 实例的内容解析为 XML。

 void
SAXParser.parse(InputStream is,
      HandlerBase hb,
      String systemId)

          使用指定的 HandlerBase 将给定的 InputStream 实例的内容解析为 XML。

 Document
DocumentBuilder.parse(InputStream is,
      String systemId)

          将给定 InputStream 的内容解析为一个 XML 文档,并且返回一个新的 DOM Document 对象。

 Document
DocumentBuilder.parse(String uri)

          将给定 URI 的内容解析为一个 XML 文档,并且返回一个新的 DOM Document 对象。

 void
SAXParser.parse(String uri,
      DefaultHandler dh)

          使用指定的 DefaultHandler 将给定统一资源标识符 (URI) 描述的内容解析为 XML。

 void
SAXParser.parse(String uri,
      HandlerBase hb)

          使用指定的 HandlerBase 将给定统一资源标识符 (URI) 描述的内容解析为 XML。

javax.xml.validation 中 SAXException 的使用

抛出 SAXException 的 javax.xml.validation 中的方法

abstract  Schema
SchemaFactory.newSchema()

          创建特殊的 Schema 对象。

 Schema
SchemaFactory.newSchema(File schema)

          解析作为模式的指定 File 并以 Schema 的形式返回它。

 Schema
SchemaFactory.newSchema(Source schema)

          解析作为模式的指定源并以模式形式返回它。

abstract  Schema
SchemaFactory.newSchema(Source[] schemas)

          解析作为模式的指定源(或多个源),并以模式形式返回它。

 Schema
SchemaFactory.newSchema(URL schema)

          解析作为模式的指定 URL 并以 Schema 形式返回它。

 void
Validator.validate(Source source)

          验证指定的输入。

abstract  void
Validator.validate(Source source,
         Result result)

          验证指定输入并将扩充的验证结果发送到指定输出。

org.xml.sax 中 SAXException 的使用

org.xml.sax 中 SAXException 的子类

 class
SAXNotRecognizedException

          用于未识别的标识符的 Exception 类。

 class
SAXNotSupportedException

          用于不被支持的操作的 Exception 类。

 class
SAXParseException

          封装 XML 解析错误或警告。

抛出 SAXException 的 org.xml.sax 中的方法

 void
ContentHandler.characters(char[] ch,
           int start,
           int length)

          接收字符数据的通知。

 void
DocumentHandler.characters(char[] ch,
           int start,
           int length)

          已过时。 接收字符数据的通知。

 void
HandlerBase.characters(char[] ch,
           int start,
           int length)

          已过时。 接收元素内字符数据的通知。

 void
ContentHandler.endDocument()

          接收文档的结尾的通知。

 void
DocumentHandler.endDocument()

          已过时。 接收文档结束的通知。

 void
HandlerBase.endDocument()

          已过时。 接收文档结束的通知。

 void
DocumentHandler.endElement(String name)

          已过时。 接收元素结束的通知。

 void
HandlerBase.endElement(String name)

          已过时。 接收元素结束的通知。

 void
ContentHandler.endElement(String uri,
           String localName,
           String qName)

          接收元素结束的通知。

 void
ContentHandler.endPrefixMapping(String prefix)

          结束前缀 URI 范围的映射。

 void
HandlerBase.error(SAXParseException e)

          已过时。 接收可恢复的解析器错误的通知。

 void
ErrorHandler.error(SAXParseException exception)

          接收可恢复的错误的通知。

 void
HandlerBase.fatalError(SAXParseException e)

          已过时。 报告严重的 XML 解析错误。

 void
ErrorHandler.fatalError(SAXParseException exception)

          接收不可恢复的错误的通知。

 void
ContentHandler.ignorableWhitespace(char[] ch,
                    int start,
                    int length)

          接收元素内容中可忽略的空白的通知。

 void
DocumentHandler.ignorableWhitespace(char[] ch,
                    int start,
                    int length)

          已过时。 接收元素内容中可忽略的空白的通知。

 void
HandlerBase.ignorableWhitespace(char[] ch,
                    int start,
                    int length)

          已过时。 接收元素内容中可忽略的空白的通知。

 void
DTDHandler.notationDecl(String name,
             String publicId,
             String systemId)

          接收注释声明事件的通知。

 void
Parser.parse(InputSource source)

          已过时。 解析 XML 文档。

 void
XMLReader.parse(InputSource input)

          解析 XML 文档。

 void
Parser.parse(String systemId)

          已过时。 从系统标识符 (URI) 解析 XML 文档。

 void
XMLReader.parse(String systemId)

          从系统标识符 (URI) 解析 XML 文档。

 void
ContentHandler.processingInstruction(String target,
                      String data)

          接收处理指令的通知。

 void
DocumentHandler.processingInstruction(String target,
                      String data)

          已过时。 接收处理指令的通知。

 void
HandlerBase.processingInstruction(String target,
                      String data)

          已过时。 接收处理指令的通知。

 InputSource
HandlerBase.resolveEntity(String publicId,
              String systemId)

          已过时。 解析外部实体。

 InputSource
EntityResolver.resolveEntity(String publicId,
              String systemId)

          允许应用程序解析外部实体。

 void
Parser.setLocale(Locale locale)

          已过时。 允许应用程序请求错误和警告的环境。

 void
ContentHandler.skippedEntity(String name)

          接收跳过的实体的通知。

 void
ContentHandler.startDocument()

          接收文档的开始的通知。

 void
DocumentHandler.startDocument()

          已过时。 接收文档的开始的通知。

 void
HandlerBase.startDocument()

          已过时。 接收文档开始的通知。

 void
DocumentHandler.startElement(String name,
             AttributeList atts)

          已过时。 接收元素开始的通知。

 void
HandlerBase.startElement(String name,
             AttributeList attributes)

          已过时。 接收元素开始的通知。

 void
ContentHandler.startElement(String uri,
             String localName,
             String qName,
             Attributes atts)

          接收元素开始的通知。

 void
ContentHandler.startPrefixMapping(String prefix,
                   String uri)

          开始前缀 URI 名称空间范围映射。

 void
DTDHandler.unparsedEntityDecl(String name,
                   String publicId,
                   String systemId,
                   String notationName)

          接收未解析的实体声明事件的通知。

 void
HandlerBase.warning(SAXParseException e)

          已过时。 接收解析器警告的通知。

 void
ErrorHandler.warning(SAXParseException exception)

          接收警告的通知。

org.xml.sax.ext 中 SAXException 的使用

抛出 SAXException 的 org.xml.sax.ext 中的方法

 void
DeclHandler.attributeDecl(String eName,
              String aName,
              String type,
              String mode,
              String value)

          报告属性类型声明。

 void
DefaultHandler2.attributeDecl(String eName,
              String aName,
              String type,
              String mode,
              String value)

 void
DefaultHandler2.comment(char[] ch,
        int start,
        int length)

 void
LexicalHandler.comment(char[] ch,
        int start,
        int length)

          报告文档的任何位置的 XML 注释。

 void
DeclHandler.elementDecl(String name,
            String model)

          报告元素类型声明。

 void
DefaultHandler2.elementDecl(String name,
            String model)

 void
DefaultHandler2.endCDATA()

 void
LexicalHandler.endCDATA()

          报告 CDATA 节的结束。

 void
DefaultHandler2.endDTD()

 void
LexicalHandler.endDTD()

          报告 DTD 声明的结束。

 void
DefaultHandler2.endEntity(String name)

 void
LexicalHandler.endEntity(String name)

          报告实体的结束。

 void
DeclHandler.externalEntityDecl(String name,
                   String publicId,
                   String systemId)

          报告解析的外部实体声明。

 void
DefaultHandler2.externalEntityDecl(String name,
                   String publicId,
                   String systemId)

 InputSource
DefaultHandler2.getExternalSubset(String name,
                  String baseURI)

          告知解析器如果在文档文本中没有声明任何外部子集,则不应使用任何外部子集。

 InputSource
EntityResolver2.getExternalSubset(String name,
                  String baseURI)

          允许应用程序为不能显式定义外部子集的文档提供外部子集。

 void
DeclHandler.internalEntityDecl(String name,
                   String value)

          报告内部实体声明。

 void
DefaultHandler2.internalEntityDecl(String name,
                   String value)

 InputSource
DefaultHandler2.resolveEntity(String publicId,
              String systemId)

          使用 null 实体名称和基 URI 调用 EntityResolver2.resolveEntity()。

 InputSource
DefaultHandler2.resolveEntity(String name,
              String publicId,
              String baseURI,
              String systemId)

          告知解析器根据 baseURI 解析 systemId,并从产生的绝对 URI 读取实体文本。

 InputSource
EntityResolver2.resolveEntity(String name,
              String publicId,
              String baseURI,
              String systemId)

          允许应用程序把对外部实体的引用映射到输入源,或告知解析器它应使用常规 URI 解析。

 void
DefaultHandler2.startCDATA()

 void
LexicalHandler.startCDATA()

          报告 CDATA 节的开始。

 void
DefaultHandler2.startDTD(String name,
         String publicId,
         String systemId)

 void
LexicalHandler.startDTD(String name,
         String publicId,
         String systemId)

          报告 DTD 声明的开始(如果存在)。

 void
DefaultHandler2.startEntity(String name)

 void
LexicalHandler.startEntity(String name)

          报告一些内部和外部 XML 实体的开始。

org.xml.sax.helpers 中 SAXException 的使用

抛出 SAXException 的 org.xml.sax.helpers 中的方法

 void
DefaultHandler.characters(char[] ch,
           int start,
           int length)

          接收元素中字符数据的通知。

 void
ParserAdapter.characters(char[] ch,
           int start,
           int length)

          适配器实现方法;不调用。

 void
XMLFilterImpl.characters(char[] ch,
           int start,
           int length)

          过滤一个字符数据事件。

 void
XMLReaderAdapter.characters(char[] ch,
           int start,
           int length)

          适配 SAX2 字符事件。

static XMLReader
XMLReaderFactory.createXMLReader()

          尝试从系统默认值创建一个 XMLReader。

static XMLReader
XMLReaderFactory.createXMLReader(String className)

          尝试从类名称创建一个 XML 阅读器。

 void
DefaultHandler.endDocument()

          接收文档结束的通知。

 void
ParserAdapter.endDocument()

          适配器实现方法;不调用。

 void
XMLFilterImpl.endDocument()

          过滤一个结束文档事件。

 void
XMLReaderAdapter.endDocument()

          结束文档事件。

 void
ParserAdapter.endElement(String qName)

          适配器实现方法;不调用。

 void
DefaultHandler.endElement(String uri,
           String localName,
           String qName)

          接收元素结束的通知。

 void
XMLFilterImpl.endElement(String uri,
           String localName,
           String qName)

          过滤一个结束元素事件。

 void
XMLReaderAdapter.endElement(String uri,
           String localName,
           String qName)

          适配 SAX2 结束元素事件。

 void
DefaultHandler.endPrefixMapping(String prefix)

          接收名称空间映射结束的通知。

 void
XMLFilterImpl.endPrefixMapping(String prefix)

          过滤一个结束名称空间前缀映射事件。

 void
DefaultHandler.error(SAXParseException e)

          接收可恢复的解析器错误的通知。

 void
XMLFilterImpl.error(SAXParseException e)

          过滤一个错误事件。

 void
DefaultHandler.fatalError(SAXParseException e)

          报告严重的 XML 解析错误。

 void
XMLFilterImpl.fatalError(SAXParseException e)

          过滤一个严重的错误事件。

 void
DefaultHandler.ignorableWhitespace(char[] ch,
                    int start,
                    int length)

          接收元素内容中可忽略空白的通知。

 void
ParserAdapter.ignorableWhitespace(char[] ch,
                    int start,
                    int length)

          适配器实现方法;不调用。

 void
XMLFilterImpl.ignorableWhitespace(char[] ch,
                    int start,
                    int length)

          过滤一个可忽略空格的事件。

 void
XMLReaderAdapter.ignorableWhitespace(char[] ch,
                    int start,
                    int length)

          适配 SAX2 忽略空白事件。

 void
DefaultHandler.notationDecl(String name,
             String publicId,
             String systemId)

          接收注释声明的通知。

 void
XMLFilterImpl.notationDecl(String name,
             String publicId,
             String systemId)

          过滤一个注释声明事件。

 void
ParserAdapter.parse(InputSource input)

          解析 XML 文档。

 void
XMLFilterImpl.parse(InputSource input)

          解析一个文档。

 void
XMLReaderAdapter.parse(InputSource input)

          解析文档。

 void
ParserAdapter.parse(String systemId)

          解析 XML 文档。

 void
XMLFilterImpl.parse(String systemId)

          解析一个文档。

 void
XMLReaderAdapter.parse(String systemId)

          解析文档。

 void
DefaultHandler.processingInstruction(String target,
                      String data)

          接收处理指令的通知。

 void
ParserAdapter.processingInstruction(String target,
                      String data)

          适配器实现方法;不调用。

 void
XMLFilterImpl.processingInstruction(String target,
                      String data)

          过滤一个处理指令事件。

 void
XMLReaderAdapter.processingInstruction(String target,
                      String data)

          适配 SAX2 处理指令事件。

 InputSource
DefaultHandler.resolveEntity(String publicId,
              String systemId)

          解析外部实体。

 InputSource
XMLFilterImpl.resolveEntity(String publicId,
              String systemId)

          过滤一个外部实体解析。

 void
XMLReaderAdapter.setLocale(Locale locale)

          设置错误报告的语言环境。

 void
DefaultHandler.skippedEntity(String name)

          接收跳过的实体的通知。

 void
XMLFilterImpl.skippedEntity(String name)

          过滤一个跳过的实体事件。

 void
XMLReaderAdapter.skippedEntity(String name)

          适配 SAX2 跳过的实体事件。

 void
DefaultHandler.startDocument()

          接收文档开始的通知。

 void
ParserAdapter.startDocument()

          适配器实现方法;不调用。

 void
XMLFilterImpl.startDocument()

          过滤一个开始文档事件。

 void
XMLReaderAdapter.startDocument()

          开始文档事件。

 void
ParserAdapter.startElement(String qName,
             AttributeList qAtts)

          适配器实现方法;不调用。

 void
DefaultHandler.startElement(String uri,
             String localName,
             String qName,
             Attributes attributes)

          接收元素开始的通知。

 void
XMLFilterImpl.startElement(String uri,
             String localName,
             String qName,
             Attributes atts)

          过滤一个开始元素事件。

 void
XMLReaderAdapter.startElement(String uri,
             String localName,
             String qName,
             Attributes atts)

          适配 SAX2 开始元素事件。

 void
DefaultHandler.startPrefixMapping(String prefix,
                   String uri)

          接收名称空间映射开始的通知。

 void
XMLFilterImpl.startPrefixMapping(String prefix,
                   String uri)

          过滤一个开始名称空间前缀映射事件。

 void
DefaultHandler.unparsedEntityDecl(String name,
                   String publicId,
                   String systemId,
                   String notationName)

          接收未解析实体声明的通知。

 void
XMLFilterImpl.unparsedEntityDecl(String name,
                   String publicId,
                   String systemId,
                   String notationName)

          过滤一个未解析实体声明事件。

 void
DefaultHandler.warning(SAXParseException e)

          接收解析器警告的通知。

 void
XMLFilterImpl.warning(SAXParseException e)

          过滤一个警告事件。

抛出 SAXException 的 org.xml.sax.helpers 中的构造方法

ParserAdapter()

          构造一个新解析器适配器。

XMLReaderAdapter()

          创建一个新的适配器。

      概述
      软件包
      类
    使用
      树
      已过时
      索引
      帮助

JavaTM Platform
Standard Ed. 6

 上一个
 下一个

  框架
 无框架

  所有类

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Fl. Neotrop. , Monogr. 17: 206 (1976)

#### Original name
Marasmius allocystis Singer

### Remarks
null


text:
DOUBTFUL

#### According to
GRIN Taxonomy for Plants

#### Published in
Candollea 66:102. 2011

#### Original name
null

### Remarks
null


text:
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BookCollection.Tests
{
    public static class MockExtensions
    {
        public static void SetupIQueryable<T>(this Mock<T> mock, IQueryable queryable)
            where T : class, IQueryable
        {
            mock.Setup(r => r.GetEnumerator()).Returns(queryable.GetEnumerator());
            mock.Setup(r => r.Provider).Returns(queryable.Provider);
            mock.Setup(r => r.ElementType).Returns(queryable.ElementType);
            mock.Setup(r => r.Expression).Returns(queryable.Expression);
        }
    }
}


text:
"""
Models for recommending items given a sequence of previous items
a user has interacted with.
"""

import numpy as np

import torch

import torch.optim as optim

from spotlight.helpers import _repr_model
from spotlight.losses import (adaptive_hinge_loss,
                              bpr_loss,
                              hinge_loss,
                              pointwise_loss)
from spotlight.sequence.representations import (PADDING_IDX, CNNNet,
                                                LSTMNet,
                                                MixtureLSTMNet,
                                                PoolNet)
from spotlight.sampling import sample_items
from spotlight.torch_utils import cpu, gpu, minibatch, set_seed, shuffle

class ImplicitSequenceModel(object):
    """
    Model for sequential recommendations using implicit feedback.

    Parameters
    ----------

    loss: string, optional
        The loss function for approximating a softmax with negative sampling.
        One of 'pointwise', 'bpr', 'hinge', 'adaptive_hinge', corresponding
        to losses from :class:`spotlight.losses`.
    representation: string or instance of :class:`spotlight.sequence.representations`, optional
        Sequence representation to use. If string, it must be one
        of 'pooling', 'cnn', 'lstm', 'mixture'; otherwise must be one of the
        representations from :class:`spotlight.sequence.representations`
    embedding_dim: int, optional
        Number of embedding dimensions to use for representing items.
        Overridden if representation is an instance of a representation class.
    n_iter: int, optional
        Number of iterations to run.
    batch_size: int, optional
        Minibatch size.
    l2: float, optional
        L2 loss penalty.
    learning_rate: float, optional
        Initial learning rate.
    optimizer_func: function, optional
        Function that takes in module parameters as the first argument and
        returns an instance of a PyTorch optimizer. Overrides l2 and learning
        rate if supplied. If no optimizer supplied, then use ADAM by default.
    use_cuda: boolean, optional
        Run the model on a GPU.
    sparse: boolean, optional
        Use sparse gradients for embedding layers.
    random_state: instance of numpy.random.RandomState, optional
        Random state to use when fitting.
    num_negative_samples: int, optional
        Number of negative samples to generate for adaptive hinge loss.

    Notes
    -----

    During fitting, the model computes the loss for each timestep of the
    supplied sequence. For example, suppose the following sequences are
    passed to the ``fit`` function:

    .. code-block:: python

       [[1, 2, 3, 4, 5],
        [0, 0, 7, 1, 4]]

    In this case, the loss for the first example will be the mean loss
    of trying to predict ``2`` from ``[1]``, ``3`` from ``[1, 2]``,
    ``4`` from ``[1, 2, 3]`` and so on. This means that explicit padding
    of all subsequences is not necessary (although it is possible by using
    the ``step_size`` parameter of
    :func:`spotlight.interactions.Interactions.to_sequence`.
    """

    def __init__(self,
                 loss='pointwise',
                 representation='pooling',
                 embedding_dim=32,
                 n_iter=10,
                 batch_size=256,
                 l2=0.0,
                 learning_rate=1e-2,
                 optimizer_func=None,
                 use_cuda=False,
                 sparse=False,
                 random_state=None,
                 num_negative_samples=5):

        assert loss in ('pointwise',
                        'bpr',
                        'hinge',
                        'adaptive_hinge')

        if isinstance(representation, str):
            assert representation in ('pooling',
                                      'cnn',
                                      'lstm',
                                      'mixture')

        self._loss = loss
        self._representation = representation
        self._embedding_dim = embedding_dim
        self._n_iter = n_iter
        self._learning_rate = learning_rate
        self._batch_size = batch_size
        self._l2 = l2
        self._use_cuda = use_cuda
        self._sparse = sparse
        self._optimizer_func = optimizer_func
        self._random_state = random_state or np.random.RandomState()
        self._num_negative_samples = num_negative_samples

        self._num_items = None
        self._net = None
        self._optimizer = None
        self._loss_func = None

        set_seed(self._random_state.randint(-10**8, 10**8),
                 cuda=self._use_cuda)

    def __repr__(self):

        return _repr_model(self)

    @property
    def _initialized(self):
        return self._net is not None

    def _initialize(self, interactions):

        self._num_items = interactions.num_items

        if self._representation == 'pooling':
            self._net = PoolNet(self._num_items,
                                self._embedding_dim,
                                sparse=self._sparse)
        elif self._representation == 'cnn':
            self._net = CNNNet(self._num_items,
                               self._embedding_dim,
                               sparse=self._sparse)
        elif self._representation == 'lstm':
            self._net = LSTMNet(self._num_items,
                                self._embedding_dim,
                                sparse=self._sparse)
        elif self._representation == 'mixture':
            self._net = MixtureLSTMNet(self._num_items,
                                       self._embedding_dim,
                                       sparse=self._sparse)
        else:
            self._net = self._representation

        self._net = gpu(self._net, self._use_cuda)

        if self._optimizer_func is None:
            self._optimizer = optim.Adam(
                self._net.parameters(),
                weight_decay=self._l2,
                lr=self._learning_rate
            )
        else:
            self._optimizer = self._optimizer_func(self._net.parameters())

        if self._loss == 'pointwise':
            self._loss_func = pointwise_loss
        elif self._loss == 'bpr':
            self._loss_func = bpr_loss
        elif self._loss == 'hinge':
            self._loss_func = hinge_loss
        else:
            self._loss_func = adaptive_hinge_loss

    def _check_input(self, item_ids):

        if isinstance(item_ids, int):
            item_id_max = item_ids
        else:
            item_id_max = item_ids.max()

        if item_id_max >= self._num_items:
            raise ValueError('Maximum item id greater '
                             'than number of items in model.')

    def fit(self, interactions, verbose=False):
        """
        Fit the model.

        When called repeatedly, model fitting will resume from
        the point at which training stopped in the previous fit
        call.

        Parameters
        ----------

        interactions: :class:`spotlight.interactions.SequenceInteractions`
            The input sequence dataset.
        """

        sequences = interactions.sequences.astype(np.int64)

        if not self._initialized:
            self._initialize(interactions)

        self._check_input(sequences)

        for epoch_num in range(self._n_iter):

            sequences = shuffle(sequences,
                                random_state=self._random_state)

            sequences_tensor = gpu(torch.from_numpy(sequences),
                                   self._use_cuda)

            epoch_loss = 0.0

            for minibatch_num, batch_sequence in enumerate(minibatch(sequences_tensor,
                                                                     batch_size=self._batch_size)):

                sequence_var = batch_sequence

                user_representation, _ = self._net.user_representation(
                    sequence_var
                )

                positive_prediction = self._net(user_representation,
                                                sequence_var)

                if self._loss == 'adaptive_hinge':
                    negative_prediction = self._get_multiple_negative_predictions(
                        sequence_var.size(),
                        user_representation,
                        n=self._num_negative_samples)
                else:
                    negative_prediction = self._get_negative_prediction(sequence_var.size(),
                                                                        user_representation)

                self._optimizer.zero_grad()

                loss = self._loss_func(positive_prediction,
                                       negative_prediction,
                                       mask=(sequence_var != PADDING_IDX))
                epoch_loss += loss.item()

                loss.backward()

                self._optimizer.step()

            epoch_loss /= minibatch_num + 1

            if verbose:
                print('Epoch {}: loss {}'.format(epoch_num, epoch_loss))

            if np.isnan(epoch_loss) or epoch_loss == 0.0:
                raise ValueError('Degenerate epoch loss: {}'
                                 .format(epoch_loss))

    def _get_negative_prediction(self, shape, user_representation):

        negative_items = sample_items(
            self._num_items,
            shape,
            random_state=self._random_state)
        negative_var = gpu(torch.from_numpy(negative_items), self._use_cuda)

        negative_prediction = self._net(user_representation, negative_var)

        return negative_prediction

    def _get_multiple_negative_predictions(self, shape, user_representation,
                                           n=5):
        batch_size, sliding_window = shape
        size = (n,) + (1,) * (user_representation.dim() - 1)
        negative_prediction = self._get_negative_prediction(
            (n * batch_size, sliding_window),
            user_representation.repeat(*size))

        return negative_prediction.view(n, batch_size, sliding_window)

    def predict(self, sequences, item_ids=None):
        """
        Make predictions: given a sequence of interactions, predict
        the next item in the sequence.

        Parameters
        ----------

        sequences: array, (1 x max_sequence_length)
            Array containing the indices of the items in the sequence.
        item_ids: array (num_items x 1), optional
            Array containing the item ids for which prediction scores
            are desired. If not supplied, predictions for all items
            will be computed.

        Returns
        -------

        predictions: array
            Predicted scores for all items in item_ids.
        """

        self._net.train(False)

        sequences = np.atleast_2d(sequences)

        if item_ids is None:
            item_ids = np.arange(self._num_items).reshape(-1, 1)

        self._check_input(item_ids)
        self._check_input(sequences)

        sequences = torch.from_numpy(sequences.astype(np.int64).reshape(1, -1))
        item_ids = torch.from_numpy(item_ids.astype(np.int64))

        sequence_var = gpu(sequences, self._use_cuda)
        item_var = gpu(item_ids, self._use_cuda)

        _, sequence_representations = self._net.user_representation(sequence_var)
        size = (len(item_var),) + sequence_representations.size()[1:]
        out = self._net(sequence_representations.expand(*size),
                        item_var)

        return cpu(out).detach().numpy().flatten()


text:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include "jni.h"

JavaVM* gp_jvm  = NULL;
__thread JNIEnv* _tlp_jenv = 0;
__thread bool  _tlv_jenv_set = false;

struct TestJavaMethodInit {
  std::string   jm_name;       // The method name.
  std::string   jm_signature;  // The method signature.
  jmethodID     methodID;      // The JNI methodID
};

enum JAVA_METHODS {
  JM_ISHBASEAVAILABLE=0,
  JM_LAST
};

TestJavaMethodInit CheckHBJavaMethods_[JM_LAST];

typedef enum {
  TestJOI_OK = 0
 ,TestJOI_ERROR_CHECK_JVM           // Cannot check existing JVMs
 ,TestJOI_ERROR_JVM_VERSION         // Attaching to JVM of wrong version.
 ,TestJOI_ERROR_ATTACH_JVM          // Cannot attach to an existing JVM
 ,TestJOI_ERROR_CREATE_JVM          // Cannot create JVM
 ,TestJOI_ERROR_FINDCLASS           // JNI FindClass() failed
 ,TestJOI_ERROR_GETMETHOD           // JNI GetMethodID() failed
 ,TestJOI_ERROR_NEWOBJ              // JNI NewObject() failed
 ,TestJOI_LAST
} TestJOI_RetCode;

char* test_buildClassPath()
{
  char* classPath = getenv("CLASSPATH");
  int   size = strlen(classPath) + 4096;
  char* classPathBuffer = (char*)malloc(size);

  strcpy(classPathBuffer, "-Djava.class.path=");
  strcat(classPathBuffer, classPath);
  return classPathBuffer;
}

int test_createJVM()
{
  JavaVMInitArgs jvm_args;
  JavaVMOption jvm_options[4];

  char* classPathArg = test_buildClassPath();
  int numJVMOptions = 0;
  jvm_options[numJVMOptions].optionString = classPathArg;
  numJVMOptions++;

  char maxHeapOptions[64];
  bool passMaxHeapToJVM = true;
  int maxHeapEnvvarMB = 4096;
  jvm_options[numJVMOptions].optionString = (char *) "-Xmx1024m";
  numJVMOptions++;

  jvm_args.version            = JNI_VERSION_1_6;
  jvm_args.options            = jvm_options;
  jvm_args.nOptions           = numJVMOptions;
  jvm_args.ignoreUnrecognized = 1;

  int ret = JNI_CreateJavaVM(&gp_jvm, (void**)&_tlp_jenv, &jvm_args);
  free(classPathArg);
  return ret;
}

short initJVM()
{
  jint result;

  if ((_tlp_jenv != 0) && (_tlv_jenv_set)) {
    return TestJOI_OK;
  }

  if (gp_jvm == NULL)
  {
    jsize jvm_count = 0;
    // Is there an existing JVM?
    result = JNI_GetCreatedJavaVMs (&gp_jvm, 1, &jvm_count);
    if (result != JNI_OK)
      return TestJOI_ERROR_CHECK_JVM;

    if (jvm_count == 0)
    {
      test_createJVM();
      return 0;
    }
  }

  // We found a JVM, can we use it?
  result = gp_jvm->GetEnv((void**) &_tlp_jenv, JNI_VERSION_1_6);
  switch (result)
  {
    case JNI_OK:
      break;

    case JNI_EDETACHED:
      printf("initJVM: Detached, Try 2 attach\n");
      result = gp_jvm->AttachCurrentThread((void**) &_tlp_jenv, NULL);
      if (result != JNI_OK)
	{
	  printf("initJVM: Error in attaching\n");
	  return TestJOI_ERROR_ATTACH_JVM;
	}

      break;

    case JNI_EVERSION:
      return TestJOI_ERROR_JVM_VERSION;
      break;

    default:
      return TestJOI_ERROR_ATTACH_JVM;
      break;
  }

  _tlv_jenv_set = true;

  return TestJOI_OK;
}

bool isHBaseAvailable()
{
  static bool sv_class_initialized = false;
  static bool sv_methods_initialized = false;
  static jclass sv_jclass_class;

  char lv_class_name[] = "CheckHBase";
  jthrowable jexception;

  if (initJVM() != TestJOI_OK) {
    exit(1);
  }

  if (! sv_class_initialized) {

    sv_jclass_class = _tlp_jenv->FindClass(lv_class_name);

    if (_tlp_jenv->ExceptionCheck()) {
      _tlp_jenv->ExceptionDescribe();
      _tlp_jenv->ExceptionClear();
      exit(1);
    }

    if (sv_jclass_class == 0) {
      exit(1);
    }

    sv_class_initialized = true;

  }

  if (! sv_methods_initialized) {

    CheckHBJavaMethods_[JM_ISHBASEAVAILABLE].jm_name      = "isHBaseAvailable";
    CheckHBJavaMethods_[JM_ISHBASEAVAILABLE].jm_signature = "()Z";
    CheckHBJavaMethods_[JM_ISHBASEAVAILABLE].methodID     =
      _tlp_jenv->GetStaticMethodID(sv_jclass_class,
				   CheckHBJavaMethods_[JM_ISHBASEAVAILABLE].jm_name.data(),
				   CheckHBJavaMethods_[JM_ISHBASEAVAILABLE].jm_signature.data());

    if (CheckHBJavaMethods_[JM_ISHBASEAVAILABLE].methodID == 0 || _tlp_jenv->ExceptionCheck()) {
      _tlp_jenv->ExceptionDescribe();
      _tlp_jenv->ExceptionClear();
      exit(1);
    }

    sv_methods_initialized = true;
  }

  jlong j_tid = 100;         ;
  jboolean jv_ret = _tlp_jenv->CallStaticBooleanMethod(sv_jclass_class,
						       CheckHBJavaMethods_[JM_ISHBASEAVAILABLE].methodID);

  jexception = _tlp_jenv->ExceptionOccurred();
  if(jexception) {
    _tlp_jenv->ExceptionDescribe();
    _tlp_jenv->ExceptionClear();
    exit(1);
  }

  return jv_ret;
}

main ()
{
  if (isHBaseAvailable()) {
    printf("HBase is available!\n");
    exit(0);
  }

  exit(1);
}