text:
sap.ui.define(['sap/ui/core/UIComponent'],
	function(UIComponent) {
	"use strict";

	var Component = UIComponent.extend("sap.m.sample.PopoverControllingCloseBehavior.Component", {

		metadata : {
			manifest: "json"
		}
	});

	return Component;

});

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace SharpNeat.SpeciationStrategies
{
    internal struct GenomeDistancePair<TGenome> : IComparable<GenomeDistancePair<TGenome>>
    {
        internal double _distance;
        internal TGenome _genome;

        internal GenomeDistancePair(double distance, TGenome genome)
        {
            _distance = distance;
            _genome = genome;
        }

        public int CompareTo(GenomeDistancePair<TGenome> other)
        {
            // Sorts in descending order.
            // Just remember, -1 means we don't change the order of x and y.
            if(_distance > other._distance) {
                return -1;
            }
            if(_distance < other._distance) {
                return 1;
            }
            return 0;
        }
    }
}


text:
#ifndef GEOS_GEOMGRAPH_H
#define GEOS_GEOMGRAPH_H

namespace geos {

/** \brief
 * Contains classes that implement topology graphs.
 *
 * The Java Topology Suite (JTS) is a Java API that implements a core
 * set of spatial data operations using an explicit precision model
 * and robust geometric algorithms. JTS is int ended to be used in the
 * development of applications that support the validation, cleaning,
 * integration and querying of spatial datasets.
 *
 * JTS attempts to implement the OpenGIS Simple Features Specification (SFS)
 * as accurately as possible.  In some cases the SFS is unclear or omits a
 * specification; in this case JTS attempts to choose a reasonable and
 * consistent alternative.  Differences from and elaborations of the SFS
 * are documented in this specification.
 *
 *
Package Specification

 *
 *

 *
Java Topology Suite Technical Specifications
 *

 *       OpenGIS Simple Features Specification for SQL
 *

 *
 */
namespace geomgraph { // geos.geomgraph
} // namespace geos.geomgraph
} // namespace geos

//#include <geos/geomgraph/Depth.h>
//#include <geos/geomgraph/DirectedEdge.h>
//#include <geos/geomgraph/DirectedEdgeStar.h>
//#include <geos/geomgraph/Edge.h>
#include <geos/geomgraph/EdgeEnd.h>
#include <geos/geomgraph/EdgeEndStar.h>
//#include <geos/geomgraph/EdgeIntersection.h>
//#include <geos/geomgraph/EdgeIntersectionList.h>
#include <geos/geomgraph/EdgeList.h>
//#include <geos/geomgraph/EdgeNodingValidator.h>
//#include <geos/geomgraph/EdgeRing.h>
#include <geos/geomgraph/GeometryGraph.h>
#include <geos/geomgraph/GraphComponent.h>
//#include <geos/geomgraph/Label.h>
#include <geos/geomgraph/Node.h>
//#include <geos/geomgraph/NodeFactory.h>
#include <geos/geomgraph/NodeMap.h>
#include <geos/geomgraph/PlanarGraph.h>
//#include <geos/geomgraph/Position.h>
//#include <geos/geomgraph/Quadrant.h>
//#include <geos/geomgraph/TopologyLocation.h>

#endif // ifndef GEOS_GEOMGRAPH_H

/**********************************************************************
 * $Log$
 * Revision 1.42  2006/06/01 11:49:35  strk
 * Reduced installed headers form geomgraph namespace
 *
 * Revision 1.41  2006/03/09 16:46:48  strk
 * geos::geom namespace definition, first pass at headers split
 *
 * Revision 1.40  2006/03/06 19:40:46  strk
 * geos::util namespace. New GeometryCollection::iterator interface, many cleanups.
 *
 * Revision 1.39  2006/03/03 10:46:21  strk
 * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
 *
 * Revision 1.38  2006/03/02 14:34:30  strk
 * GeometryGraphOperation::li made a non-static member, and not more a pointer
 *
 * Revision 1.37  2006/02/28 14:34:05  strk
 * Added many assertions and debugging output hunting for a bug in BufferOp
 *
 *
 **********************************************************************/


text:
using System;
using System.ComponentModel;

namespace Azure.IoT.Hub.Service.Models
{
    /// <summary> The authentication type used for connecting to the storage account. </summary>
    public readonly partial struct JobPropertiesStorageAuthenticationType : IEquatable<JobPropertiesStorageAuthenticationType>
    {
        private readonly string _value;

        /// <summary> Determines if two <see cref="JobPropertiesStorageAuthenticationType"/> values are the same. </summary>
        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
        public JobPropertiesStorageAuthenticationType(string value)
        {
            _value = value ?? throw new ArgumentNullException(nameof(value));
        }

        private const string KeyBasedValue = "keyBased";
        private const string IdentityBasedValue = "identityBased";

        /// <summary> keyBased. </summary>
        public static JobPropertiesStorageAuthenticationType KeyBased { get; } = new JobPropertiesStorageAuthenticationType(KeyBasedValue);
        /// <summary> identityBased. </summary>
        public static JobPropertiesStorageAuthenticationType IdentityBased { get; } = new JobPropertiesStorageAuthenticationType(IdentityBasedValue);
        /// <summary> Determines if two <see cref="JobPropertiesStorageAuthenticationType"/> values are the same. </summary>
        public static bool operator ==(JobPropertiesStorageAuthenticationType left, JobPropertiesStorageAuthenticationType right) => left.Equals(right);
        /// <summary> Determines if two <see cref="JobPropertiesStorageAuthenticationType"/> values are not the same. </summary>
        public static bool operator !=(JobPropertiesStorageAuthenticationType left, JobPropertiesStorageAuthenticationType right) => !left.Equals(right);
        /// <summary> Converts a string to a <see cref="JobPropertiesStorageAuthenticationType"/>. </summary>
        public static implicit operator JobPropertiesStorageAuthenticationType(string value) => new JobPropertiesStorageAuthenticationType(value);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => obj is JobPropertiesStorageAuthenticationType other && Equals(other);
        /// <inheritdoc />
        public bool Equals(JobPropertiesStorageAuthenticationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
        /// <inheritdoc />
        public override string ToString() => _value;
    }
}


text:
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2008,2009 IITP RAS
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Authors: Kirill Andreev <andreev@iitp.ru>
 *          Aleksey Kovalenko <kovalenko@iitp.ru>
 */

#ifndef MESH_CONFIGURATION_H
#define MESH_CONFIGURATION_H

#include "ns3/mesh-information-element-vector.h"

namespace ns3 {
namespace dot11s {

//according to IEEE 802.11 - 2012

//in 7.3.2.98.2 Active Path Selection Protocol Identifier - 802.11s-2011
enum dot11sPathSelectionProtocol
{
  PROTOCOL_HWMP = 0x01,
};

//in 7.3.2.98.3 Active Path Selection Metric Identifier - 802.11s-2011
enum dot11sPathSelectionMetric
{
  METRIC_AIRTIME = 0x01,
};

// in 7.3.2.98.4 Congestion Control Mode Identifier - 802.11s-2011
enum dot11sCongestionControlMode
{
  CONGESTION_SIGNALING = 0x01,
  CONGESTION_NULL      = 0x00,
};

// in 7.3.2.98.5 Synchronization Method Identifier - 802.11s-2011
enum dot11sSynchronizationProtocolIdentifier
{
  SYNC_NEIGHBOUR_OFFSET = 0x01,  //Neighbor offset synchronization method
  SYNC_NULL             = 0x00,  //Reserved
};

// in 7.3.2.98.6 Authentication Protocol Identifier - 802.11s-2011
enum dot11sAuthenticationProtocol
{
  AUTH_NULL = 0x00,  //No authentication method is required to establish mesh peerings within the MBSS
  AUTH_SAE  = 0x01,  //SAE defined in 8.2a
  AUTH_IEEE = 0x02,  //IEEE 802.1X authentication
};
/**
 * \ingroup dot11s
 * \brief See 7.3.2.86.7 in 802.11s draft 3.0
 */
class Dot11sMeshCapability
{
public:
  Dot11sMeshCapability ();
  uint8_t  GetSerializedSize () const;
  Buffer::Iterator Serialize (Buffer::Iterator i) const;
  Buffer::Iterator Deserialize (Buffer::Iterator i);
  uint8_t GetUint8 () const;
  bool acceptPeerLinks;
  bool MCCASupported;
  bool MCCAEnabled;
  bool forwarding;
  bool beaconTimingReport;
  bool TBTTAdjustment;
  bool powerSaveLevel;
  bool Is (uint8_t cap,uint8_t n) const;
  friend bool operator== (const Dot11sMeshCapability & a, const Dot11sMeshCapability & b);
};

/**
 * \ingroup dot11s
 * \brief Describes Mesh Configuration Element
 * see 7.3.2.86 of 802.11s draft 3.0
 */
class IeConfiguration : public WifiInformationElement
{
public:
  IeConfiguration ();
  void SetRouting (dot11sPathSelectionProtocol routingId);
  void SetMetric (dot11sPathSelectionMetric metricId);
  bool IsHWMP ();
  bool IsAirtime ();
  void SetNeighborCount (uint8_t neighbors);
  uint8_t GetNeighborCount ();
  Dot11sMeshCapability const& MeshCapability ();

  // Inherited from WifiInformationElement
  virtual WifiInformationElementId ElementId () const;
  virtual uint8_t GetInformationFieldSize () const;
  virtual void SerializeInformationField (Buffer::Iterator i) const;
  virtual uint8_t DeserializeInformationField (Buffer::Iterator i, uint8_t length);
  virtual void Print (std::ostream& os) const;

private:
  /** Active Path Selection Protocol ID */
  dot11sPathSelectionProtocol m_APSPId;
  /** Active Path Metric ID */
  dot11sPathSelectionMetric   m_APSMId;
  /** Congestion Control Mode ID */
  dot11sCongestionControlMode m_CCMId;
  /** Sync protocol ID */
  dot11sSynchronizationProtocolIdentifier m_SPId;
  /** Auth protocol ID */
  dot11sAuthenticationProtocol m_APId;
  Dot11sMeshCapability m_meshCap;
  uint8_t m_neighbors;
  friend bool operator== (const IeConfiguration & a, const IeConfiguration & b);
};
bool operator== (const IeConfiguration & a, const IeConfiguration & b);
bool operator== (const Dot11sMeshCapability & a, const Dot11sMeshCapability & b);
std::ostream &operator << (std::ostream &os, const IeConfiguration &config);
} // namespace dot11s
} // namespace ns3
#endif


text:
package it.gualtierotesta.logging_during_test;

import java.sql.SQLException;

/**
 * Dummy DAO
 *
 * @author gualtiero
 */
public class MyDao {

    int countRecords(String pCondition) throws SQLException {
        throw new SQLException("SQL Syntax error");
    }
}


text:
<form role="form" action="/admin/profile/"  method="post" id="site-form">

			<?php if($errors != array()): ?>

				<button type="button" class="close message-close" aria-hidden="true">×</button>

					<?php foreach($errors as $error): ?>

<?php echo $error; ?>

					<?php endforeach; ?>

			<?php endif; ?>

					<legend>Basic Info</legend>

						First Name
						<input maxlength="24" value="<?php echo $user->getFirstName(); ?>" type="text" class="form-control" id="account-first-name" name="first-name">

						Last Name
						<input maxlength="24" value="<?php echo $user->getLastName(); ?>" type="text" class="form-control" id="account-last-name" name="last-name">

						Title
						<input maxlength="128" value="<?php echo $user->getTitle(); ?>" type="text" class="form-control" id="account-title" name="title">

						Email
						<input required="required" maxlength="24" value="<?php echo $user->getUsername(); ?>" type="email" class="form-control" id="account-email" name="email">

						Change Password
						<input maxlength="1024" placeholder="************" type="password" class="form-control" id="account-password" name="password">
						Must be at least 8 characters long

						Confirm Password
						<input placeholder="************" type="password" class="form-control" id="account-confirm-password" name="confirm-password">

Passwords do not match

					<legend>Preferences</legend>

								Date Format

										<input type="radio" name="date-format" class="date-format" value="MM/DD/YY" <?php echo ($user->getDateFormat() == "m/d/y") ? 'checked="checked"' : ''; ?>> MM/DD/YY

										<input type="radio" name="date-format" class="date-format" value="DD/MM/YY" <?php echo ($user->getDateFormat() == "d/m/y") ? 'checked="checked"' : ''; ?>> DD/MM/YY

								Time Format

										<input type="radio" name="time-format" class="time-format" value="12" <?php echo ($user->getTimeFormat() == "g:i a" || $user->getTimeFormat() == '') ? 'checked="checked"' : ''; ?>> 12 hour

										<input type="radio" name="time-format" class="time-format" value="24" <?php echo ($user->getTimeFormat() == "H:i") ? 'checked="checked"' : ''; ?>> 24 hour

								Time Zone
								<select class="form-control" name="time-zone" id="time-zone">
									<option value="">Select Timezone...</option>
									<?php echo $select_options; ?>
								</select>

		<input type="hidden" name="user-id" id="account-user-id" value="<?php echo $user->getId(); ?>">
		<input type="hidden" name="username" id="account-username" value="<?php echo $user->getUsername(); ?>">

			<button type="submit" class="btn btn-primary btn-save-account">Update Profile</button>
			Cancel Changes

</form>


text:
package com.facebook.buck.apple;

import com.facebook.buck.model.BuildTargets;
import com.facebook.buck.model.Either;
import com.facebook.buck.model.HasBuildTarget;
import com.facebook.buck.model.Pair;
import com.facebook.buck.rules.AbstractBuildRule;
import com.facebook.buck.rules.AddToRuleKey;
import com.facebook.buck.rules.BuildContext;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.BuildRuleParams;
import com.facebook.buck.rules.BuildTargetSourcePath;
import com.facebook.buck.rules.BuildableContext;
import com.facebook.buck.rules.ExternalTestRunnerRule;
import com.facebook.buck.rules.ExternalTestRunnerTestSpec;
import com.facebook.buck.rules.HasRuntimeDeps;
import com.facebook.buck.rules.Label;
import com.facebook.buck.rules.SourcePath;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.TestRule;
import com.facebook.buck.rules.Tool;
import com.facebook.buck.step.ExecutionContext;
import com.facebook.buck.step.Step;
import com.facebook.buck.step.fs.MakeCleanDirectoryStep;
import com.facebook.buck.test.TestCaseSummary;
import com.facebook.buck.test.TestResults;
import com.facebook.buck.test.TestRunningOptions;
import com.facebook.buck.util.HumanReadableException;
import com.facebook.buck.util.MoreCollectors;
import com.facebook.buck.util.OptionalCompat;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.stream.Stream;

import javax.annotation.Nullable;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
public class AppleTest
    extends AbstractBuildRule
    implements TestRule, HasRuntimeDeps, ExternalTestRunnerRule {

  @AddToRuleKey
  private final Optional<SourcePath> xctool;

  @AddToRuleKey
  private Optional<Long> xctoolStutterTimeout;

  @AddToRuleKey
  private final Tool xctest;

  @AddToRuleKey
  private final boolean useXctest;

  @AddToRuleKey
  private final String platformName;

  private final Optional<String> defaultDestinationSpecifier;
  private final Optional<ImmutableMap<String, String>> destinationSpecifier;

  @AddToRuleKey
  private final BuildRule testBundle;

  @AddToRuleKey
  private final Optional<AppleBundle> testHostApp;

  private final ImmutableSet<String> contacts;
  private final ImmutableSet<Label> labels;

  @AddToRuleKey
  private final boolean runTestSeparately;

  @AddToRuleKey
  private final boolean isUiTest;

  private final Path testOutputPath;
  private final Path testLogsPath;

  @AddToRuleKey
  private final Optional<Either<SourcePath, String>> snapshotReferenceImagesPath;

  private Optional<Long> testRuleTimeoutMs;

  private Optional<AppleTestXctoolStdoutReader> xctoolStdoutReader;
  private Optional<AppleTestXctestOutputReader> xctestOutputReader;

  private final String testLogDirectoryEnvironmentVariable;
  private final String testLogLevelEnvironmentVariable;
  private final String testLogLevel;

  /**
   * Absolute path to xcode developer dir.
   *
   * Should not be added to rule key.
   */
  private final Supplier<Optional<Path>> xcodeDeveloperDirSupplier;

  private static class AppleTestXctoolStdoutReader
    implements XctoolRunTestsStep.StdoutReadingCallback {

    private final TestCaseSummariesBuildingXctoolEventHandler xctoolEventHandler;

    public AppleTestXctoolStdoutReader(TestRule.TestReportingCallback testReportingCallback) {
      this.xctoolEventHandler = new TestCaseSummariesBuildingXctoolEventHandler(
          testReportingCallback);
    }

    @Override
    public void readStdout(InputStream stdout) throws IOException {
      try (InputStreamReader stdoutReader =
               new InputStreamReader(stdout, StandardCharsets.UTF_8);
           BufferedReader bufferedReader = new BufferedReader(stdoutReader)) {
        XctoolOutputParsing.streamOutputFromReader(bufferedReader, xctoolEventHandler);
      }
    }

    public ImmutableList<TestCaseSummary> getTestCaseSummaries() {
      return xctoolEventHandler.getTestCaseSummaries();
    }
  }

  private static class AppleTestXctestOutputReader
    implements XctestRunTestsStep.OutputReadingCallback {

    private final TestCaseSummariesBuildingXctestEventHandler xctestEventHandler;

    public AppleTestXctestOutputReader(TestRule.TestReportingCallback testReportingCallback) {
      this.xctestEventHandler = new TestCaseSummariesBuildingXctestEventHandler(
          testReportingCallback);
    }

    @Override
    public void readOutput(InputStream output) throws IOException {
      try (InputStreamReader outputReader =
               new InputStreamReader(output, StandardCharsets.UTF_8);
           BufferedReader outputBufferedReader = new BufferedReader(outputReader)) {
        XctestOutputParsing.streamOutput(
            outputBufferedReader, xctestEventHandler);
      }
    }

    public ImmutableList<TestCaseSummary> getTestCaseSummaries() {
      return xctestEventHandler.getTestCaseSummaries();
    }
  }

  AppleTest(
      Optional<SourcePath> xctool,
      Optional<Long> xctoolStutterTimeout,
      Tool xctest,
      boolean useXctest,
      String platformName,
      Optional<String> defaultDestinationSpecifier,
      Optional<ImmutableMap<String, String>> destinationSpecifier,
      BuildRuleParams params,
      BuildRule testBundle,
      Optional<AppleBundle> testHostApp,
      ImmutableSet<String> contacts,
      ImmutableSet<Label> labels,
      boolean runTestSeparately,
      Supplier<Optional<Path>> xcodeDeveloperDirSupplier,
      String testLogDirectoryEnvironmentVariable,
      String testLogLevelEnvironmentVariable,
      String testLogLevel,
      Optional<Long> testRuleTimeoutMs,
      boolean isUiTest,
      Optional<Either<SourcePath, String>> snapshotReferenceImagesPath) {
    super(params);
    this.xctool = xctool;
    this.xctoolStutterTimeout = xctoolStutterTimeout;
    this.useXctest = useXctest;
    this.xctest = xctest;
    this.platformName = platformName;
    this.defaultDestinationSpecifier = defaultDestinationSpecifier;
    this.destinationSpecifier = destinationSpecifier;
    this.testBundle = testBundle;
    this.testHostApp = testHostApp;
    this.contacts = contacts;
    this.labels = labels;
    this.runTestSeparately = runTestSeparately;
    this.testRuleTimeoutMs = testRuleTimeoutMs;
    this.testOutputPath = getPathToTestOutputDirectory().resolve("test-output.json");
    this.testLogsPath = getPathToTestOutputDirectory().resolve("logs");
    this.xctoolStdoutReader = Optional.empty();
    this.xctestOutputReader = Optional.empty();
    this.xcodeDeveloperDirSupplier = xcodeDeveloperDirSupplier;
    this.testLogDirectoryEnvironmentVariable = testLogDirectoryEnvironmentVariable;
    this.testLogLevelEnvironmentVariable = testLogLevelEnvironmentVariable;
    this.testLogLevel = testLogLevel;
    this.isUiTest = isUiTest;
    this.snapshotReferenceImagesPath = snapshotReferenceImagesPath;
  }

  @Override
  public ImmutableSet<Label> getLabels() {
    return labels;
  }

  @Override
  public ImmutableSet<String> getContacts() {
    return contacts;
  }

  @Override
  public boolean hasTestResultFiles() {
    return getProjectFilesystem().exists(testOutputPath);
  }

  public Pair<ImmutableList<Step>, ExternalTestRunnerTestSpec> getTestCommand(
      ExecutionContext context,
      TestRunningOptions options,
      SourcePathResolver pathResolver,
      TestRule.TestReportingCallback testReportingCallback) {

    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    ExternalTestRunnerTestSpec.Builder externalSpec = ExternalTestRunnerTestSpec.builder()
        .setTarget(getBuildTarget())
        .setLabels(getLabels())
        .setContacts(getContacts());

    Path resolvedTestBundleDirectory = pathResolver.getAbsolutePath(
        Preconditions.checkNotNull(testBundle.getSourcePathToOutput()));

    Path pathToTestOutput = getProjectFilesystem().resolve(
        getPathToTestOutputDirectory());
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), pathToTestOutput));

    Path resolvedTestLogsPath = getProjectFilesystem().resolve(testLogsPath);
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), resolvedTestLogsPath));

    Path resolvedTestOutputPath = getProjectFilesystem().resolve(
        testOutputPath);

    Optional<Path> testHostAppPath = Optional.empty();
    if (testHostApp.isPresent()) {
      Path resolvedTestHostAppDirectory = pathResolver.getAbsolutePath(
          Preconditions.checkNotNull(testHostApp.get().getSourcePathToOutput()));
      testHostAppPath = Optional.of(
          resolvedTestHostAppDirectory.resolve(
              testHostApp.get().getUnzippedOutputFilePathToBinary()));
    }

    if (!useXctest) {
      if (!xctool.isPresent()) {
        throw new HumanReadableException(
            "Set xctool_path = /path/to/xctool or xctool_zip_target = //path/to:xctool-zip " +
                "in the [apple] section of .buckconfig to run this test");
      }

      ImmutableSet.Builder<Path> logicTestPathsBuilder = ImmutableSet.builder();
      ImmutableMap.Builder<Path, Path> appTestPathsToHostAppsBuilder = ImmutableMap.builder();

      if (testHostAppPath.isPresent()) {
        appTestPathsToHostAppsBuilder.put(
            resolvedTestBundleDirectory,
            testHostAppPath.get());
      } else {
        logicTestPathsBuilder.add(resolvedTestBundleDirectory);
      }

      xctoolStdoutReader = Optional.of(new AppleTestXctoolStdoutReader(testReportingCallback));
      Optional<String> destinationSpecifierArg;
      if (!destinationSpecifier.get().isEmpty()) {
        destinationSpecifierArg = Optional.of(
            Joiner.on(',').join(
                Iterables.transform(
                    destinationSpecifier.get().entrySet(),
                    input -> input.getKey() + "=" + input.getValue())));
      } else {
        destinationSpecifierArg = defaultDestinationSpecifier;
      }

      Optional<String> snapshotReferenceImagesPath = Optional.empty();
      if (this.snapshotReferenceImagesPath.isPresent()) {
        if (this.snapshotReferenceImagesPath.get().isLeft()) {
          snapshotReferenceImagesPath = Optional.of(
              pathResolver.getAbsolutePath(
                  this.snapshotReferenceImagesPath.get().getLeft()).toString());
        } else if (this.snapshotReferenceImagesPath.get().isRight()) {
          snapshotReferenceImagesPath = Optional.of(
              getProjectFilesystem().getPathForRelativePath(
                  this.snapshotReferenceImagesPath.get().getRight()).toString());
        }
      }

      XctoolRunTestsStep xctoolStep =
          new XctoolRunTestsStep(
              getProjectFilesystem(),
              pathResolver.getAbsolutePath(xctool.get()),
              options.getEnvironmentOverrides(),
              xctoolStutterTimeout,
              platformName,
              destinationSpecifierArg,
              logicTestPathsBuilder.build(),
              appTestPathsToHostAppsBuilder.build(),
              resolvedTestOutputPath,
              xctoolStdoutReader,
              xcodeDeveloperDirSupplier,
              options.getTestSelectorList(),
              Optional.of(testLogDirectoryEnvironmentVariable),
              Optional.of(resolvedTestLogsPath),
              Optional.of(testLogLevelEnvironmentVariable),
              Optional.of(testLogLevel),
              testRuleTimeoutMs,
              snapshotReferenceImagesPath);
      steps.add(xctoolStep);
      externalSpec.setType("xctool-" + (testHostApp.isPresent() ? "application" : "logic"));
      externalSpec.setCommand(xctoolStep.getCommand());
      externalSpec.setEnv(xctoolStep.getEnv(context));
    } else {
      xctestOutputReader = Optional.of(new AppleTestXctestOutputReader(testReportingCallback));

      HashMap<String, String> environment = new HashMap<>();
      environment.putAll(xctest.getEnvironment());
      environment.putAll(options.getEnvironmentOverrides());
      if (testHostAppPath.isPresent()) {
        environment.put("XCInjectBundleInto", testHostAppPath.get().toString());
      }
      XctestRunTestsStep xctestStep =
          new XctestRunTestsStep(
              getProjectFilesystem(),
              ImmutableMap.copyOf(environment),
              xctest.getCommandPrefix(pathResolver),
              resolvedTestBundleDirectory,
              resolvedTestOutputPath,
              xctestOutputReader,
              xcodeDeveloperDirSupplier);
      steps.add(xctestStep);
      externalSpec.setType("xctest");
      externalSpec.setCommand(xctestStep.getCommand());
      externalSpec.setEnv(xctestStep.getEnv(context));
    }

    return new Pair<>(steps.build(), externalSpec.build());
  }

  @Override
  public ImmutableList<Step> runTests(
      ExecutionContext executionContext,
      TestRunningOptions options,
      SourcePathResolver pathResolver,
      TestReportingCallback testReportingCallback) {
    if (isUiTest()) {
      return ImmutableList.of();
    } else {
      return getTestCommand(executionContext, options, pathResolver, testReportingCallback)
          .getFirst();
    }
  }

  @Override
  public Callable<TestResults> interpretTestResults(
      final ExecutionContext executionContext,
      boolean isUsingTestSelectors) {
    return () -> {
      List<TestCaseSummary> testCaseSummaries;
      if (xctoolStdoutReader.isPresent()) {
        // We've already run the tests with 'xctool' and parsed
        // their output; no need to parse the same output again.
        testCaseSummaries = xctoolStdoutReader.get().getTestCaseSummaries();
      } else if (xctestOutputReader.isPresent()) {
        // We've already run the tests with 'xctest' and parsed
        // their output; no need to parse the same output again.
        testCaseSummaries = xctestOutputReader.get().getTestCaseSummaries();
      } else if (isUiTest()) {
        TestCaseSummary noTestsSummary =
              new TestCaseSummary("XCUITest runs not supported with buck test",
                                  Collections.emptyList());
        testCaseSummaries = Collections.singletonList(noTestsSummary);
      } else {
        Path resolvedOutputPath = getProjectFilesystem().resolve(testOutputPath);
        try (BufferedReader reader =
            Files.newBufferedReader(resolvedOutputPath, StandardCharsets.UTF_8)) {
          if (useXctest) {
            TestCaseSummariesBuildingXctestEventHandler xctestEventHandler =
                new TestCaseSummariesBuildingXctestEventHandler(NOOP_REPORTING_CALLBACK);
            XctestOutputParsing.streamOutput(reader, xctestEventHandler);
            testCaseSummaries = xctestEventHandler.getTestCaseSummaries();
          } else {
            TestCaseSummariesBuildingXctoolEventHandler xctoolEventHandler =
                new TestCaseSummariesBuildingXctoolEventHandler(NOOP_REPORTING_CALLBACK);
            XctoolOutputParsing.streamOutputFromReader(reader, xctoolEventHandler);
            testCaseSummaries = xctoolEventHandler.getTestCaseSummaries();
          }
        }
      }
      TestResults.Builder testResultsBuilder = TestResults.builder()
          .setBuildTarget(getBuildTarget())
          .setTestCases(testCaseSummaries)
          .setContacts(contacts)
          .setLabels(labels.stream()
              .map(Object::toString)
              .collect(MoreCollectors.toImmutableSet()));
      if (getProjectFilesystem().isDirectory(testLogsPath)) {
        for (Path testLogPath : getProjectFilesystem().getDirectoryContents(testLogsPath)) {
          testResultsBuilder.addTestLogPaths(testLogPath);
        }
      }

      return testResultsBuilder.build();
    };
  }

  @Override
  public Path getPathToTestOutputDirectory() {
    // TODO(bhamiltoncx): Refactor the JavaTest implementation; this is identical.
    return BuildTargets.getGenPath(
        getProjectFilesystem(),
        getBuildTarget(),
        "__apple_test_%s_output__");
  }

  @Override
  public boolean runTestSeparately() {
    // Tests which run in the simulator must run separately from all other tests;
    // there's a 20 second timeout hard-coded in the iOS Simulator SpringBoard which
    // is hit any time the host is overloaded.
    return runTestSeparately || testHostApp.isPresent();
  }

  // This test rule just executes the test bundle, so we need it available locally.
  @Override
  public Stream<SourcePath> getRuntimeDeps() {
    return Stream
        .concat(
            Stream
                .concat(Stream.of(testBundle), OptionalCompat.asSet(testHostApp).stream())
                .map(HasBuildTarget::getBuildTarget)
                .map(BuildTargetSourcePath::new),
            OptionalCompat.asSet(xctool).stream());
  }

  @Override
  public boolean supportsStreamingTests() {
    return true;
  }

  @Override
  public ExternalTestRunnerTestSpec getExternalTestRunnerSpec(
      ExecutionContext executionContext,
      TestRunningOptions testRunningOptions,
      SourcePathResolver pathResolver) {
    return getTestCommand(
        executionContext,
        testRunningOptions,
        pathResolver,
        NOOP_REPORTING_CALLBACK)
        .getSecond();
  }

  @Override
  public ImmutableList<Step> getBuildSteps(
      BuildContext context,
      BuildableContext buildableContext) {
    return ImmutableList.of();
  }

  @Nullable
  @Override
  public Path getPathToOutput() {
    return testBundle.getPathToOutput();
  }

  public boolean isUiTest() {
    return isUiTest;
  }
}


text:
<?php
/**
 * Pay Shortcode
 *
 * The pay page. Used for form based gateways to show payment forms and order info.
 *
 * @author 		WooThemes
 * @category 	Shortcodes
 * @package 	WooCommerce/Shortcodes/Pay
 * @version     1.6.4
 */

/**
 * Get the pay shortcode content.
 *
 * @access public
 * @param array $atts
 * @return string
 */
function get_woocommerce_pay( $atts ) {
	global $woocommerce;
	return $woocommerce->shortcode_wrapper('woocommerce_pay', $atts);
}

/**
 * Outputs the pay page - payment gateways can hook in here to show payment forms etc
 *
 * @access public
 * @return void
 */
function woocommerce_pay() {
	global $woocommerce;

	$woocommerce->nocache();

	do_action('before_woocommerce_pay');

	$woocommerce->show_messages();

	if ( isset($_GET['pay_for_order']) && isset($_GET['order']) && isset($_GET['order_id']) ) :

		// Pay for existing order
		$order_key = urldecode( $_GET['order'] );
		$order_id = (int) $_GET['order_id'];
		$order = new WC_Order( $order_id );

		if ($order->id == $order_id && $order->order_key == $order_key && in_array($order->status, array('pending', 'failed'))) :

			// Set customer location to order location
			if ($order->billing_country) $woocommerce->customer->set_country( $order->billing_country );
			if ($order->billing_state) $woocommerce->customer->set_state( $order->billing_state );
			if ($order->billing_postcode) $woocommerce->customer->set_postcode( $order->billing_postcode );

			// Show form
			woocommerce_get_template('checkout/form-pay.php', array('order' => $order));

		elseif (!in_array($order->status, array('pending', 'failed'))) :

			$woocommerce->add_error( __('Your order has already been paid for. Please contact us if you need assistance.', 'woocommerce') );
			$woocommerce->show_messages();

		else :

			$woocommerce->add_error( __('Invalid order.', 'woocommerce') );
			$woocommerce->show_messages();

		endif;

	else :

		// Pay for order after checkout step
		if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0;
		if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = '';

		if ($order_id > 0) :

			$order = new WC_Order( $order_id );

			if ($order->order_key == $order_key && in_array($order->status, array('pending', 'failed'))) :

				?>

						<?php _e('Order:', 'woocommerce'); ?>
						<?php echo $order->get_order_number(); ?>

						<?php _e('Date:', 'woocommerce'); ?>
						<?php echo date_i18n(get_option('date_format'), strtotime($order->order_date)); ?>

						<?php _e('Total:', 'woocommerce'); ?>
						<?php echo $order->get_formatted_order_total(); ?>

					<?php if ($order->payment_method_title) : ?>

						<?php _e('Payment method:', 'woocommerce'); ?>
						<?php
							echo $order->payment_method_title;
						?>

					<?php endif; ?>

				<?php do_action( 'woocommerce_receipt_' . $order->payment_method, $order_id ); ?>

				<?php

			elseif (!in_array($order->status, array('pending', 'failed'))) :

				$woocommerce->add_error( __('Your order has already been paid for. Please contact us if you need assistance.', 'woocommerce') );
				$woocommerce->show_messages();

			endif;

		else :

			$woocommerce->add_error( __('Invalid order.', 'woocommerce') );
			$woocommerce->show_messages();

		endif;

	endif;

	do_action('after_woocommerce_pay');
}


text:
<?php

namespace Fridge\Tests\DBAL\Connection;

use Fridge\Tests\ConnectionUtility;
use Fridge\Tests\Fixture\MySQLFixture;

/**
 * Mysqli connection test.
 *
 * @author GeLo <geloen.eric@gmail.com>
 */
class MysqliConnectionTest extends AbstractConnectionTest
{
    /**
     * {@inheritdoc}
     */
    protected static function hasFixture()
    {
        return ConnectionUtility::hasConnection(ConnectionUtility::MYSQLI);
    }

    /**
     * {@inheritdoc}
     */
    protected static function setUpFixture()
    {
        return new MySQLFixture(ConnectionUtility::MYSQLI);
    }

    /**
     * {@inheritdoc}
     */
    protected function setUpConnection()
    {
        return ConnectionUtility::getConnection(ConnectionUtility::MYSQLI);
    }
}


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

import com.facebook.presto.spi.PageBuilder;
import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.spi.block.Block;
import com.facebook.presto.spi.block.BlockBuilder;
import com.facebook.presto.spi.function.Description;
import com.facebook.presto.spi.function.OperatorDependency;
import com.facebook.presto.spi.function.ScalarFunction;
import com.facebook.presto.spi.function.SqlType;
import com.facebook.presto.spi.function.TypeParameter;
import com.facebook.presto.spi.type.Type;
import com.google.common.collect.ImmutableList;
import com.google.common.primitives.Ints;

import java.lang.invoke.MethodHandle;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED;
import static com.facebook.presto.spi.function.OperatorType.LESS_THAN;

@ScalarFunction("array_sort")
@Description("Sorts the given array in ascending order according to the natural ordering of its elements.")
public final class ArraySortFunction
{
    private final PageBuilder pageBuilder;
    private static final int INITIAL_LENGTH = 128;
    private List<Integer> positions = Ints.asList(new int[INITIAL_LENGTH]);

    @TypeParameter("E")
    public ArraySortFunction(@TypeParameter("E") Type elementType)
    {
        pageBuilder = new PageBuilder(ImmutableList.of(elementType));
    }

    @TypeParameter("E")
    @SqlType("array(E)")
    public Block sort(
            @OperatorDependency(operator = LESS_THAN, argumentTypes = {"E", "E"}) MethodHandle lessThanFunction,
            @TypeParameter("E") Type type,
            @SqlType("array(E)") Block block)
    {
        int arrayLength = block.getPositionCount();
        if (positions.size() < arrayLength) {
            positions = Ints.asList(new int[arrayLength]);
        }
        for (int i = 0; i < arrayLength; i++) {
            positions.set(i, i);
        }

        Collections.sort(positions.subList(0, arrayLength), new Comparator<Integer>()
        {
            @Override
            public int compare(Integer p1, Integer p2)
            {
                boolean nullLeft = block.isNull(p1);
                boolean nullRight = block.isNull(p2);
                if (nullLeft && nullRight) {
                    return 0;
                }
                if (nullLeft) {
                    return 1;
                }
                if (nullRight) {
                    return -1;
                }

                try {
                    //TODO: This could be quite slow, it should use parametric equals
                    return type.compareTo(block, p1, block, p2);
                }
                catch (PrestoException e) {
                    if (e.getErrorCode() == NOT_SUPPORTED.toErrorCode()) {
                        throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Array contains elements not supported for comparison", e);
                    }
                    throw e;
                }
            }
        });

        if (pageBuilder.isFull()) {
            pageBuilder.reset();
        }

        BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0);

        for (int i = 0; i < arrayLength; i++) {
            type.appendTo(block, positions.get(i), blockBuilder);
        }
        pageBuilder.declarePositions(arrayLength);

        return blockBuilder.getRegion(blockBuilder.getPositionCount() - arrayLength, arrayLength);
    }
}


text:
namespace Stripe.Issuing
{
    using Newtonsoft.Json;

    public class TransactionListOptions : ListOptionsWithCreated
    {
        [JsonProperty("cardholder")]
        public string CardholderId { get; set; }

        [JsonProperty("card")]
        public string CardId { get; set; }
    }
}


text:
package com.github.ldaniels528.trifecta.sjs.models

import scala.scalajs.js

/**
  * Represents a Simple Broker object
  * @author lawrence.daniels@gmail.com
  */
@js.native
trait Broker extends js.Object {
  var host: js.UndefOr[String] = js.native
  var port: js.UndefOr[Int] = js.native
  var brokerId: js.UndefOr[Int] = js.native
  var jmx_port: js.UndefOr[Int] = js.native
  var timestamp: js.UndefOr[js.Date]
  var version: js.UndefOr[Int] = js.native

}


text:
esprojection
============

Library for writing GetEventStore projections in C#


text:
<html>
  <head>
    <meta name="viewport" content="width=320,user-scalable=yes" />
  </head>
  <body style="background-color:#ffffff">
      <img src="../../data/nursery.png" />
  </body>
</html>


text:
import controller from './ngbVcfSampleAliases.controller';

export default {
    controller: controller.UID,
    template: require('./ngbVcfSampleAliases.dialog.tpl.html'),
};


text:
package com.airbnb.lottie;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import static junit.framework.Assert.assertNotNull;

class ImageAssetBitmapManager {
  private final Context context;
  private String imagesFolder;
  @Nullable private ImageAssetDelegate assetDelegate;
  private final Map<String, LottieImageAsset> imageAssets;
  private final Map<String, Bitmap> bitmaps = new HashMap<>();

  ImageAssetBitmapManager(Drawable.Callback callback, String imagesFolder,
      ImageAssetDelegate assetDelegate, Map<String, LottieImageAsset> imageAssets) {
    assertNotNull(callback);

    this.imagesFolder = imagesFolder;
    if (!TextUtils.isEmpty(imagesFolder) &&
        this.imagesFolder.charAt(this.imagesFolder.length() - 1) != '/') {
      this.imagesFolder += '/';
    }

    if (!(callback instanceof View)) {
      Log.w(L.TAG, "LottieDrawable must be inside of a view for images to work.");
      this.imageAssets = new HashMap<>();
      context = null;
      return;
    }

    context = ((View) callback).getContext();
    this.imageAssets = imageAssets;
    setAssetDelegate(assetDelegate);
  }

  void setAssetDelegate(@Nullable ImageAssetDelegate assetDelegate) {
    this.assetDelegate = assetDelegate;
  }

  Bitmap bitmapForId(String id) {
    Bitmap bitmap = bitmaps.get(id);
    if (bitmap == null) {
      LottieImageAsset imageAsset = imageAssets.get(id);
      if (imageAsset == null) {
        return null;
      }
      if (assetDelegate != null) {
        bitmap = assetDelegate.fetchBitmap(imageAsset);
        bitmaps.put(id, bitmap);
        return bitmap;
      }

      InputStream is;
      try {
        if (TextUtils.isEmpty(imagesFolder)) {
          throw new IllegalStateException("You must set an images folder before loading an image." +
              " Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder");
        }
        is = context.getAssets().open(imagesFolder + imageAsset.getFileName());
      } catch (IOException e) {
        Log.w(L.TAG, "Unable to open asset.", e);
        return null;
      }
      BitmapFactory.Options opts = new BitmapFactory.Options();
      opts.inScaled = true;
      opts.inDensity = 160;
      bitmap = BitmapFactory.decodeStream(is, null, opts);
      bitmaps.put(id, bitmap);
    }
    return bitmap;
  }

  void recycleBitmaps() {
    Iterator<Map.Entry<String, Bitmap>> it = bitmaps.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String, Bitmap> entry = it.next();
      entry.getValue().recycle();
      it.remove();
    }
  }

  boolean hasSameContext(Context context) {
    return context == null && this.context == null ||
        context != null && this.context.equals(context);
  }
}


text:
DSN = 'dbname=test'

## don't modify anything below this line (except for experimenting)

import sys
import psycopg2

if len(sys.argv) > 1:
    DSN = sys.argv[1]

print "Opening connection using dns:", DSN
conn = psycopg2.connect(DSN)
print "Encoding for this connection is", conn.encoding

curs = conn.cursor()
try:
    curs.execute("CREATE TABLE test_fetch (val int4)")
except:
    conn.rollback()
    curs.execute("DROP TABLE test_fetch")
    curs.execute("CREATE TABLE test_fetch (val int4)")
conn.commit()

# we use this function to format the output

def flatten(l):
    """Flattens list of tuples l."""
    return map(lambda x: x[0], l)

# insert 20 rows in the table

for i in range(20):
    curs.execute("INSERT INTO test_fetch VALUES(%s)", (i,))
conn.commit()

# does some nice tricks with the transaction and postgres cursors
# (remember to always commit or rollback before a DECLARE)
#
# we don't need to DECLARE ourselves, psycopg now supports named
# cursors (but we leave the code here, comments, as an example of
# what psycopg is doing under the hood)
#
#curs.execute("DECLARE crs CURSOR FOR SELECT * FROM test_fetch")
#curs.execute("FETCH 10 FROM crs")
#print "First 10 rows:", flatten(curs.fetchall())
#curs.execute("MOVE -5 FROM crs")
#print "Moved back cursor by 5 rows (to row 5.)"
#curs.execute("FETCH 10 FROM crs")
#print "Another 10 rows:", flatten(curs.fetchall())
#curs.execute("FETCH 10 FROM crs")
#print "The remaining rows:", flatten(curs.fetchall())

ncurs = conn.cursor("crs")
ncurs.execute("SELECT * FROM test_fetch")
print "First 10 rows:", flatten(ncurs.fetchmany(10))
ncurs.scroll(-5)
print "Moved back cursor by 5 rows (to row 5.)"
print "Another 10 rows:", flatten(ncurs.fetchmany(10))
print "Another one:", list(ncurs.fetchone())
print "The remaining rows:", flatten(ncurs.fetchall())
conn.rollback()

curs.execute("DROP TABLE test_fetch")
conn.commit()


text:
Ext.ns('Kwf.Maintenance');
Kwf.Maintenance.UpdateDownloader = Ext.extend(Ext.Panel, {
    border: false,
    initComponent: function() {
        this.libraryUrl = new Ext.form.TextField({
            name: 'libraryUrl',
            fieldLabel: 'Library Url',
            value: this.defaultLibraryUrl,
            width: 600
        });
        this.kwfUrl = new Ext.form.TextField({
            name: 'kwfUrl',
            fieldLabel: 'Kwf Url',
            value: this.defaultKwfUrl,
            width: 600
        });
        this.appUrl = new Ext.form.TextField({
            name: 'appUrl',
            fieldLabel: 'App Url',
            value: this.defaultAppUrl,
            width: 600
        });
        this.layout = 'form',
        this.items = [
            this.libraryUrl,
            this.kwfUrl,
            this.appUrl
        ];
        this.buttons = [{
            text: trlKwf('Download Updates'),
            handler: function() {
                Kwf.application.assetsVersion = null; //unset to avoid checking (which is problematic during update)
                Kwf.Utils.BackgroundProcess.request({
                    url: '/kwf/maintenance/update-downloader/json-download-updates',
                    params: {
                        libraryUrl: this.libraryUrl.getValue(),
                        kwfUrl: this.kwfUrl.getValue(),
                        appUrl: this.appUrl.getValue()
                    },
                    progress: true,
                    scope: this,
                    timeout: 10*60*1000,
                    success: function() {
                        //after download finished execute updates
                        Kwf.Utils.BackgroundProcess.request({
                            url: '/kwf/maintenance/update-downloader/json-execute-updates',
                            progress: true,
                            scope: this,
                            timeout: 10*60*1000,
                            success: function(response, options, r) {
                                if (r.errMsg) {
                                    Ext.Msg.alert(trlKwf('Update Error'), r.message+"
"+r.errMsg.replace("\n", "
"));
                                } else if (r.message) {
                                    Ext.Msg.alert(trlKwf('Updates Finished'), r.message, function() {
                                        location.href = '/kwf/welcome';
                                    }, scope);
                                }
                            }
                        });
                    }
                });
            },
            scope: this
        }];
        Kwf.Maintenance.UpdateDownloader.superclass.initComponent.call(this);
    }
});
Ext.reg('kwf.maintenance.updateDownloader', Kwf.Maintenance.UpdateDownloader);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Proc. Linn. Soc. London 157: 152 (1946)

#### Original name
Meliolina shepherdii Hansf.

### Remarks
null


text:
<!DOCTYPE html>

    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Example Mocha Test</title>
    <link rel="stylesheet" href="assets/css/mocha.css" type="text/css" charset="utf-8" />
    <link rel="stylesheet" href="../build/ui-input-slider.css" type="text/css" charset="utf-8" />

      <input type="number" class="ui-input-slider-input" value="80">


text:
import { expect } from 'chai';
import { describe, it } from 'mocha';

import { execute } from '../executor';
import { parse } from '../../language';
import {
  GraphQLSchema,
  GraphQLObjectType,
  GraphQLInterfaceType,
  GraphQLUnionType,
  GraphQLList,
  GraphQLString,
  GraphQLBoolean
} from '../../type';

class Dog {
  constructor(name, barks) {
    this.name = name;
    this.barks = barks;
  }
}

class Cat {
  constructor(name, meows) {
    this.name = name;
    this.meows = meows;
  }
}

class Person {
  constructor(name, pets, friends) {
    this.name = name;
    this.pets = pets;
    this.friends = friends;
  }
}

var NamedType = new GraphQLInterfaceType({
  name: 'Named',
  fields: {
    name: { type: GraphQLString }
  }
});

var DogType = new GraphQLObjectType({
  name: 'Dog',
  interfaces: [ NamedType ],
  fields: {
    name: { type: GraphQLString },
    barks: { type: GraphQLBoolean }
  },
  isTypeOf: value => value instanceof Dog
});

var CatType = new GraphQLObjectType({
  name: 'Cat',
  interfaces: [ NamedType ],
  fields: {
    name: { type: GraphQLString },
    meows: { type: GraphQLBoolean }
  },
  isTypeOf: value => value instanceof Cat
});

var PetType = new GraphQLUnionType({
  name: 'Pet',
  types: [ DogType, CatType ],
  resolveType(value) {
    if (value instanceof Dog) {
      return DogType;
    }
    if (value instanceof Cat) {
      return CatType;
    }
  }
});

var PersonType = new GraphQLObjectType({
  name: 'Person',
  interfaces: [ NamedType ],
  fields: {
    name: { type: GraphQLString },
    pets: { type: new GraphQLList(PetType) },
    friends: { type: new GraphQLList(NamedType) },
  },
  isTypeOf: value => value instanceof Person
});

var schema = new GraphQLSchema({
  query: PersonType
});

var garfield = new Cat('Garfield', false);
var odie = new Dog('Odie', true);
var liz = new Person('Liz');
var john = new Person('John', [ garfield, odie ], [ liz, odie ]);

describe('Execute: Union and intersection types', () => {

  it('can introspect on union and intersection types', async () => {
    var ast = parse(`
      {
        Named: __type(name: "Named") {
          kind
          name
          fields { name }
          interfaces { name }
          possibleTypes { name }
          enumValues { name }
          inputFields { name }
        }
        Pet: __type(name: "Pet") {
          kind
          name
          fields { name }
          interfaces { name }
          possibleTypes { name }
          enumValues { name }
          inputFields { name }
        }
      }
    `);

    return expect(
      await execute(schema, null, ast)
    ).to.deep.equal({
      data: {
        Named: {
          kind: 'INTERFACE',
          name: 'Named',
          fields: [
            { name: 'name' }
          ],
          interfaces: null,
          possibleTypes: [
            { name: 'Dog' },
            { name: 'Cat' },
            { name: 'Person' }
          ],
          enumValues: null,
          inputFields: null
        },
        Pet: {
          kind: 'UNION',
          name: 'Pet',
          fields: null,
          interfaces: null,
          possibleTypes: [
            { name: 'Dog' },
            { name: 'Cat' }
          ],
          enumValues: null,
          inputFields: null
        }
      }
    });
  });

  it('executes using union types', async () => {

    // NOTE: This is an *invalid* query, but it should be an *executable* query.
    var ast = parse(`
      {
        __typename
        name
        pets {
          __typename
          name
          barks
          meows
        }
      }
    `);

    return expect(
      await execute(schema, john, ast)
    ).to.deep.equal({
      data: {
        __typename: 'Person',
        name: 'John',
        pets: [
          { __typename: 'Cat', name: 'Garfield', meows: false },
          { __typename: 'Dog', name: 'Odie', barks: true }
        ]
      }
    });
  });

  it('executes union types with inline fragments', async () => {

    // This is the valid version of the query in the above test.
    var ast = parse(`
      {
        __typename
        name
        pets {
          __typename
          ... on Dog {
            name
            barks
          }
          ... on Cat {
            name
            meows
          }
        }
      }
    `);

    return expect(
      await execute(schema, john, ast)
    ).to.deep.equal({
      data: {
        __typename: 'Person',
        name: 'John',
        pets: [
          { __typename: 'Cat', name: 'Garfield', meows: false },
          { __typename: 'Dog', name: 'Odie', barks: true }
        ]
      }
    });
  });

  it('executes using interface types', async () => {

    // NOTE: This is an *invalid* query, but it should be an *executable* query.
    var ast = parse(`
      {
        __typename
        name
        friends {
          __typename
          name
          barks
          meows
        }
      }
    `);

    return expect(
      await execute(schema, john, ast)
    ).to.deep.equal({
      data: {
        __typename: 'Person',
        name: 'John',
        friends: [
          { __typename: 'Person', name: 'Liz' },
          { __typename: 'Dog', name: 'Odie', barks: true }
        ]
      }
    });
  });

  it('executes union types with inline fragments', async () => {

    // This is the valid version of the query in the above test.
    var ast = parse(`
      {
        __typename
        name
        friends {
          __typename
          name
          ... on Dog {
            barks
          }
          ... on Cat {
            meows
          }
        }
      }
    `);

    return expect(
      await execute(schema, john, ast)
    ).to.deep.equal({
      data: {
        __typename: 'Person',
        name: 'John',
        friends: [
          { __typename: 'Person', name: 'Liz' },
          { __typename: 'Dog', name: 'Odie', barks: true }
        ]
      }
    });
  });

  it('allows fragment conditions to be abstract types', async () => {

    var ast = parse(`
      {
        __typename
        name
        pets { ...PetFields }
        friends { ...FriendFields }
      }

      fragment PetFields on Pet {
        __typename
        ... on Dog {
          name
          barks
        }
        ... on Cat {
          name
          meows
        }
      }

      fragment FriendFields on Named {
        __typename
        name
        ... on Dog {
          barks
        }
        ... on Cat {
          meows
        }
      }
    `);

    return expect(
      await execute(schema, john, ast)
    ).to.deep.equal({
      data: {
        __typename: 'Person',
        name: 'John',
        pets: [
          { __typename: 'Cat', name: 'Garfield', meows: false },
          { __typename: 'Dog', name: 'Odie', barks: true }
        ],
        friends: [
          { __typename: 'Person', name: 'Liz' },
          { __typename: 'Dog', name: 'Odie', barks: true }
        ]
      }
    });
  });
});


text:
DELETE FROM ROLES_ACTIVITY WHERE ACTIVITY_ID IN (142, 143, 144);
DELETE FROM ACTIVITY WHERE ACTIVITY_ID IN (142, 143, 144);

UPDATE DATABASE_VERSION SET DATABASE_VERSION=193 WHERE DATABASE_VERSION=192;


text:
from jinja2 import Environment, FileSystemLoader
from boto.ses.connection import SESConnection
from config import AWSID, AWSKEY, TEMPLATE
from email.header import Header

conn = SESConnection(AWSID, AWSKEY)
env = Environment(loader=FileSystemLoader(TEMPLATE))

COSCUP_TEAM_ADMIN = u'COSCUP 人事管理中心(行政組)'
COSCUP_TEAM_ADMIN_MAIL = u'secretary@coscup.org'

def mail_header(name, mail):
    ''' Encode header to base64
    :param str name: user name
    :param str mail: user mail
    :rtype: string
    :returns: a string of "name <mail>" in base64.
    '''
    return '"%s" <%s>' % (Header(name, 'utf-8'), mail)

def send_first(info):

    try:
        template = env.get_template('coscup_first.html')

        r = conn.send_email(
                source=mail_header(COSCUP_TEAM_ADMIN, COSCUP_TEAM_ADMIN_MAIL),
                subject=u'COSCUP2015 請先完成資料登錄 - {nickname}'.format(**info),
                to_addresses='{email}'.format(**info),
                format='html',
                body=template.render(**info),
        )
	print r
    except Exception as e:
        print e
        return None

    return r

def send_welcome(info):

    try:
        template = env.get_template('coscup_welcome.html')
        r = conn.send_email(
                source=mail_header(COSCUP_TEAM_ADMIN, COSCUP_TEAM_ADMIN_MAIL),
                subject=u'COSCUP2015 歡迎你 - {nickname}'.format(**info),
                to_addresses='{email}'.format(**info),
                format='html',
                body=template.render(**info),
        )
        print r
    except Exception as e:
        print e
        return None

    return r

def send_new_user_to_admin(info):

    try:
        template = env.get_template('new_user_to_admin.html')

        r = conn.send_email(
                source=mail_header(COSCUP_TEAM_ADMIN, COSCUP_TEAM_ADMIN_MAIL),
                subject=u'新註冊會員 - {date}'.format(**info),
                to_addresses='{email}'.format(**info),
                format='html',
                body=template.render(**info),
        )
        print r
    except Exception as e:
        print e
        return None

    return r

def send_forget_passwd(info):

    try:
        template = env.get_template('forget_passwd.html')

        r = conn.send_email(
                source=mail_header(COSCUP_TEAM_ADMIN, COSCUP_TEAM_ADMIN_MAIL),
                subject=u'COSCUP 2015 - 密碼重置',
                to_addresses='{email}'.format(**info),
                format='html',
                body=template.render(**info),
        )
        print r
    except Exception as e:
        print e
        return None

    return r


text:
package org.apache.sis.internal.storage.xml;

import java.util.Locale;
import java.io.StringReader;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.citation.*;
import org.apache.sis.xml.Namespaces;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;

import static org.opengis.test.Assert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;

// Branch-dependent imports
import java.nio.charset.StandardCharsets;

/**
 * Tests {@link Store}.
 *
 * @author  Martin Desruisseaux (Geomatys)
 * @since   0.4
 * @version 0.7
 * @module
 */
@DependsOn(org.apache.sis.storage.StorageConnectorTest.class)
public final strictfp class StoreTest extends TestCase {
    /**
     * The metadata to unmarshal.
     */
    public static final String XML =
            "<?xml version=\"1.0\" standalone=\"yes\"?>\n" +
            "<gmd:MD_Metadata\n" +
            "  xmlns:gmd = \"" + Namespaces.GMD + "\"\n"  +
            "  xmlns:gco = \"" + Namespaces.GCO + "\"\n"  +
            "  xmlns:xsi = \"" + Namespaces.XSI + "\"\n>" +
            "  <gmd:language>\n" +
            "    <gmd:LanguageCode codeListValue=\"eng\">English</gmd:LanguageCode>\n" +
            "  </gmd:language>\n" +
            "  <gmd:characterSet>\n" +
            "    <gmd:MD_CharacterSetCode codeListValue=\"utf8\">UTF-8</gmd:MD_CharacterSetCode>\n" +
            "  </gmd:characterSet>\n" +
            "  <gmd:contact>\n" +
            "    <gmd:CI_ResponsibleParty>\n" +
            "      <gmd:organisationName>\n" +
            "        <gco:CharacterString>Apache SIS</gco:CharacterString>\n" +
            "      </gmd:organisationName>\n" +
            "      <gmd:contactInfo>\n" +
            "        <gmd:CI_Contact>\n" +
            "          <gmd:onlineResource>\n" +
            "            <gmd:CI_OnlineResource>\n" +
            "              <gmd:linkage>\n" +
            "                <gmd:URL>http://sis.apache.org</gmd:URL>\n" +
            "              </gmd:linkage>\n" +
            "              <gmd:function>\n" +
            "                <gmd:CI_OnLineFunctionCode codeListValue=\"information\" codeSpace=\"fra\">Information</gmd:CI_OnLineFunctionCode>\n" +
            "              </gmd:function>\n" +
            "            </gmd:CI_OnlineResource>\n" +
            "          </gmd:onlineResource>\n" +
            "        </gmd:CI_Contact>\n" +
            "      </gmd:contactInfo>\n" +
            "      <gmd:role>\n" +
            "        <gmd:CI_RoleCode codeListValue=\"principalInvestigator\">Principal investigator</gmd:CI_RoleCode>\n" +
            "      </gmd:role>\n" +
            "    </gmd:CI_ResponsibleParty>\n" +
            "  </gmd:contact>\n" +
            "</gmd:MD_Metadata>\n";

    /**
     * Tests {@link Store#getMetadata()}.
     *
     * @throws DataStoreException if en error occurred while reading the XML.
     */
    @Test
    public void testMetadata() throws DataStoreException {
        final Metadata metadata;
        try (Store store = new Store(new StorageConnector(new StringReader(XML)))) {
            metadata = store.getMetadata();
            assertSame("Expected cached value.", metadata, store.getMetadata());
        }
        final Responsibility resp     = getSingleton(metadata.getContacts());
        final Party          party    = getSingleton(resp.getParties());
        final Contact        contact  = getSingleton(party.getContactInfo());
        final OnlineResource resource = getSingleton(contact.getOnlineResources());

        assertInstanceOf("party", Organisation.class, party);
        assertEquals(Locale.ENGLISH,              getSingleton(metadata.getLanguages()));
        assertEquals(StandardCharsets.UTF_8,      getSingleton(metadata.getCharacterSets()));
        assertEquals(Role.PRINCIPAL_INVESTIGATOR, resp.getRole());
        assertEquals("Apache SIS",                String.valueOf(party.getName()));
        assertEquals("http://sis.apache.org",     String.valueOf(resource.getLinkage()));
        assertEquals(OnLineFunction.INFORMATION,  resource.getFunction());
    }
}


text:
require 'shared_user'
require 'active_model/serializers/xml' if Devise.rails5?
require 'active_model-serializers' if Devise.rails5?

class User < ActiveRecord::Base
  include Shim
  include SharedUser
  include ActiveModel::Serializers::Xml if Devise.rails5?
end


text:
"""
C{django.db.models} adapter module.

@see: U{Django Project<http://www.djangoproject.com>}

@since: 0.4.1
"""

from django.db.models.base import Model
from django.db.models import fields
from django.db.models.fields import related, files

import datetime

import pyamf
from pyamf.util import imports

class DjangoReferenceCollection(dict):
    """
    This helper class holds a dict of klass to pk/objects loaded from the
    underlying db.

    @since: 0.5
    """

    def _getClass(self, klass):
        if klass not in self.keys():
            self[klass] = {}

        return self[klass]

    def getClassKey(self, klass, key):
        """
        Return an instance based on klass/key.

        If an instance cannot be found then L{KeyError} is raised.

        @param klass: The class of the instance.
        @param key: The primary_key of the instance.
        @return: The instance linked to the C{klass}/C{key}.
        @rtype: Instance of L{klass}.
        """
        d = self._getClass(klass)

        return d[key]

    def addClassKey(self, klass, key, obj):
        """
        Adds an object to the collection, based on klass and key.

        @param klass: The class of the object.
        @param key: The datastore key of the object.
        @param obj: The loaded instance from the datastore.
        """
        d = self._getClass(klass)

        d[key] = obj

class DjangoClassAlias(pyamf.ClassAlias):
    """
    """

    def getCustomProperties(self):
        self.fields = {}
        self.relations = {}
        self.columns = []

        self.meta = self.klass._meta

        for x in self.meta.local_fields:
            if isinstance(x, files.FileField):
                self.readonly_attrs.update([x.name])

            if not isinstance(x, related.ForeignKey):
                self.fields[x.name] = x
            else:
                self.relations[x.name] = x

            self.columns.append(x.attname)

        for k, v in self.klass.__dict__.iteritems():
            if isinstance(v, related.ReverseManyRelatedObjectsDescriptor):
                self.fields[k] = v.field

        parent_fields = []

        for field in self.meta.parents.values():
            parent_fields.append(field.attname)
            del self.relations[field.name]

        self.exclude_attrs.update(parent_fields)

        props = self.fields.keys()

        self.static_attrs.update(props)
        self.encodable_properties.update(props)
        self.decodable_properties.update(props)

    def _compile_base_class(self, klass):
        if klass is Model:
            return

        pyamf.ClassAlias._compile_base_class(self, klass)

    def _encodeValue(self, field, value):
        if value is fields.NOT_PROVIDED:
            return pyamf.Undefined

        if value is None:
            return value

        # deal with dates ..
        if isinstance(field, fields.DateTimeField):
            return value
        elif isinstance(field, fields.DateField):
            return datetime.datetime(value.year, value.month, value.day, 0, 0, 0)
        elif isinstance(field, fields.TimeField):
            return datetime.datetime(1970, 1, 1,
                value.hour, value.minute, value.second, value.microsecond)
        elif isinstance(value, files.FieldFile):
            return value.name

        return value

    def _decodeValue(self, field, value):
        if value is pyamf.Undefined:
            return fields.NOT_PROVIDED

        if isinstance(field, fields.AutoField) and value == 0:
            return None
        elif isinstance(field, fields.DateTimeField):
            # deal with dates
            return value
        elif isinstance(field, fields.DateField):
            if not value:
                return None

            return datetime.date(value.year, value.month, value.day)
        elif isinstance(field, fields.TimeField):
            if not value:
                return None

            return datetime.time(value.hour, value.minute, value.second, value.microsecond)

        return value

    def getEncodableAttributes(self, obj, **kwargs):
        sa, da = pyamf.ClassAlias.getEncodableAttributes(self, obj, **kwargs)

        for name, prop in self.fields.iteritems():
            if name not in sa:
                continue

            if isinstance(prop, related.ManyToManyField):
                sa[name] = [x for x in getattr(obj, name).all()]
            else:
                sa[name] = self._encodeValue(prop, getattr(obj, name))

        if not da:
            da = {}

        keys = da.keys()

        for key in keys:
            if key.startswith('_'):
                del da[key]
            elif key in self.columns:
                del da[key]

        for name, relation in self.relations.iteritems():
            if '_%s_cache' % name in obj.__dict__:
                da[name] = getattr(obj, name)
            else:
                da[name] = pyamf.Undefined

        if not da:
            da = None

        return sa, da

    def getDecodableAttributes(self, obj, attrs, **kwargs):
        attrs = pyamf.ClassAlias.getDecodableAttributes(self, obj, attrs, **kwargs)

        for n in self.decodable_properties:
            f = self.fields[n]

            attrs[f.attname] = self._decodeValue(f, attrs[n])

        # primary key of django object must always be set first for
        # relationships with other model objects to work properly
        # and dict.iteritems() does not guarantee order
        #
        # django also forces the use only one attribute as primary key, so
        # our obj._meta.pk.attname check is sufficient)
        try:
            setattr(obj, obj._meta.pk.attname, attrs[obj._meta.pk.attname])
            del attrs[obj._meta.pk.attname]
        except KeyError:
            pass

        return attrs

def getDjangoObjects(context):
    """
    Returns a reference to the C{django_objects} on the context. If it doesn't
    exist then it is created.

    @param context: The context to load the C{django_objects} index from.
    @type context: Instance of L{pyamf.BaseContext}
    @return: The C{django_objects} index reference.
    @rtype: Instance of L{DjangoReferenceCollection}
    @since: 0.5
    """
    if not hasattr(context, 'django_objects'):
        context.django_objects = DjangoReferenceCollection()

    return context.django_objects

def writeDjangoObject(self, obj, *args, **kwargs):
    """
    The Django ORM creates new instances of objects for each db request.
    This is a problem for PyAMF as it uses the id(obj) of the object to do
    reference checking.

    We could just ignore the problem, but the objects are conceptually the
    same so the effort should be made to attempt to resolve references for a
    given object graph.

    We create a new map on the encoder context object which contains a dict of
    C{object.__class__: {key1: object1, key2: object2, .., keyn: objectn}}. We
    use the primary key to do the reference checking.

    @since: 0.5
    """
    if not isinstance(obj, Model):
        self.writeNonDjangoObject(obj, *args, **kwargs)

        return

    context = self.context
    kls = obj.__class__

    s = obj.pk

    django_objects = getDjangoObjects(context)

    try:
        referenced_object = django_objects.getClassKey(kls, s)
    except KeyError:
        referenced_object = obj
        django_objects.addClassKey(kls, s, obj)

    self.writeNonDjangoObject(referenced_object, *args, **kwargs)

def install_django_reference_model_hook(mod):
    """
    Called when L{pyamf.amf0} or L{pyamf.amf3} are imported. Attaches the
    L{writeDjangoObject} method to the C{Encoder} class in that module.

    @param mod: The module imported.
    @since: 0.4.1
    """
    if not hasattr(mod.Encoder, 'writeNonDjangoObject'):
        mod.Encoder.writeNonDjangoObject = mod.Encoder.writeObject
        mod.Encoder.writeObject = writeDjangoObject

# initialise the module here: hook into pyamf

pyamf.register_alias_type(DjangoClassAlias, Model)

# hook the L{writeDjangobject} method to the Encoder class on import
imports.when_imported('pyamf.amf0', install_django_reference_model_hook)
imports.when_imported('pyamf.amf3', install_django_reference_model_hook)