text:
package org.apache.druid.indexing.worker.shuffle;

import com.google.common.collect.Iterators;
import com.google.common.io.Files;
import com.google.inject.Inject;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.druid.client.indexing.IndexingServiceClient;
import org.apache.druid.client.indexing.TaskStatus;
import org.apache.druid.common.utils.IdUtils;
import org.apache.druid.guice.ManageLifecycle;
import org.apache.druid.indexing.common.config.TaskConfig;
import org.apache.druid.indexing.worker.config.WorkerConfig;
import org.apache.druid.java.util.common.DateTimes;
import org.apache.druid.java.util.common.IOE;
import org.apache.druid.java.util.common.ISE;
import org.apache.druid.java.util.common.concurrent.Execs;
import org.apache.druid.java.util.common.io.Closer;
import org.apache.druid.java.util.common.lifecycle.LifecycleStart;
import org.apache.druid.java.util.common.lifecycle.LifecycleStop;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.segment.loading.StorageLocation;
import org.apache.druid.timeline.DataSegment;
import org.apache.druid.utils.CompressionUtils;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.joda.time.DateTime;
import org.joda.time.Interval;
import org.joda.time.Period;

import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * This class manages intermediary segments for data shuffle between native parallel index tasks.
 * In native parallel indexing, phase 1 tasks store segment files in local storage of middleManagers (or indexer)
 * and phase 2 tasks read those files over HTTP.
 *
 * The directory where segment files are placed is structured as
 * {@link StorageLocation#path}/supervisorTaskId/startTimeOfSegment/endTimeOfSegment/bucketIdOfSegment.
 *
 * This class provides interfaces to store, find, and remove segment files.
 * It also has a self-cleanup mechanism to clean up stale segment files. It periodically checks the last access time
 * per supervisorTask and removes its all segment files if the supervisorTask is not running anymore.
 */
@ManageLifecycle
public class IntermediaryDataManager
{
  private static final Logger LOG = new Logger(IntermediaryDataManager.class);

  private final long intermediaryPartitionDiscoveryPeriodSec;
  private final long intermediaryPartitionCleanupPeriodSec;
  private final Period intermediaryPartitionTimeout;
  private final TaskConfig taskConfig;
  private final List<StorageLocation> shuffleDataLocations;
  private final IndexingServiceClient indexingServiceClient;

  // supervisorTaskId -> time to check supervisorTask status
  // This time is initialized when a new supervisorTask is found and updated whenever a partition is accessed for
  // the supervisor.
  private final ConcurrentHashMap<String, DateTime> supervisorTaskCheckTimes = new ConcurrentHashMap<>();

  // supervisorTaskId -> cyclic iterator of storage locations
  private final Map<String, Iterator<StorageLocation>> locationIterators = new HashMap<>();

  // The overlord is supposed to send a cleanup request as soon as the supervisorTask is finished in parallel indexing,
  // but middleManager or indexer could miss the request. This executor is to automatically clean up unused intermediary
  // partitions.
  // This can be null until IntermediaryDataManager is started.
  @MonotonicNonNull
  private ScheduledExecutorService supervisorTaskChecker;

  @Inject
  public IntermediaryDataManager(
      WorkerConfig workerConfig,
      TaskConfig taskConfig,
      IndexingServiceClient indexingServiceClient
  )
  {
    this.intermediaryPartitionDiscoveryPeriodSec = workerConfig.getIntermediaryPartitionDiscoveryPeriodSec();
    this.intermediaryPartitionCleanupPeriodSec = workerConfig.getIntermediaryPartitionCleanupPeriodSec();
    this.intermediaryPartitionTimeout = workerConfig.getIntermediaryPartitionTimeout();
    this.taskConfig = taskConfig;
    this.shuffleDataLocations = taskConfig
        .getShuffleDataLocations()
        .stream()
        .map(config -> new StorageLocation(config.getPath(), config.getMaxSize(), config.getFreeSpacePercent()))
        .collect(Collectors.toList());
    this.indexingServiceClient = indexingServiceClient;
  }

  @LifecycleStart
  public void start()
  {
    discoverSupervisorTaskPartitions();
    supervisorTaskChecker = Execs.scheduledSingleThreaded("intermediary-data-manager-%d");
    // Discover partitions for new supervisorTasks
    supervisorTaskChecker.scheduleAtFixedRate(
        () -> {
          try {
            discoverSupervisorTaskPartitions();
          }
          catch (Exception e) {
            LOG.warn(e, "Error while discovering supervisorTasks");
          }
        },
        intermediaryPartitionDiscoveryPeriodSec,
        intermediaryPartitionDiscoveryPeriodSec,
        TimeUnit.SECONDS
    );

    supervisorTaskChecker.scheduleAtFixedRate(
        () -> {
          try {
            deleteExpiredSuprevisorTaskPartitionsIfNotRunning();
          }
          catch (InterruptedException e) {
            LOG.error(e, "Error while cleaning up partitions for expired supervisors");
          }
          catch (Exception e) {
            LOG.warn(e, "Error while cleaning up partitions for expired supervisors");
          }
        },
        intermediaryPartitionCleanupPeriodSec,
        intermediaryPartitionCleanupPeriodSec,
        TimeUnit.SECONDS
    );
  }

  @LifecycleStop
  public void stop() throws InterruptedException
  {
    if (supervisorTaskChecker != null) {
      supervisorTaskChecker.shutdownNow();
      supervisorTaskChecker.awaitTermination(10, TimeUnit.SECONDS);
    }
    supervisorTaskCheckTimes.clear();
  }

  /**
   * IntermediaryDataManager periodically calls this method after it starts up to search for unknown intermediary data.
   */
  private void discoverSupervisorTaskPartitions()
  {
    for (StorageLocation location : shuffleDataLocations) {
      final Path locationPath = location.getPath().toPath().toAbsolutePath();
      final MutableInt numDiscovered = new MutableInt(0);
      final File[] dirsPerSupervisorTask = location.getPath().listFiles();
      if (dirsPerSupervisorTask != null) {
        for (File supervisorTaskDir : dirsPerSupervisorTask) {
          final String supervisorTaskId = supervisorTaskDir.getName();
          supervisorTaskCheckTimes.computeIfAbsent(
              supervisorTaskId,
              k -> {
                for (File eachFile : FileUtils.listFiles(supervisorTaskDir, null, true)) {
                  final String relativeSegmentPath = locationPath
                      .relativize(eachFile.toPath().toAbsolutePath())
                      .toString();
                  // StorageLocation keeps track of how much storage capacity is being used.
                  // Newly found files should be known to the StorageLocation to keep it up to date.
                  final File reservedFile = location.reserve(
                      relativeSegmentPath,
                      eachFile.getName(),
                      eachFile.length()
                  );
                  if (reservedFile == null) {
                    LOG.warn("Can't add a discovered partition[%s]", eachFile.getAbsolutePath());
                  }
                }
                numDiscovered.increment();
                return getExpiryTimeFromNow();
              }
          );
        }
      }

      if (numDiscovered.getValue() > 0) {
        LOG.info(
            "Discovered partitions for [%s] new supervisor tasks under location[%s]",
            numDiscovered.getValue(),
            location.getPath()
        );
      }
    }
  }

  /**
   * Check supervisorTask status if its partitions have not been accessed in timeout and
   * delete all partitions for the supervisorTask if it is already finished.
   *
   * Note that the overlord sends a cleanup request when a supervisorTask is finished. The below check is to trigger
   * the self-cleanup for when the cleanup request is missing.
   */
  private void deleteExpiredSuprevisorTaskPartitionsIfNotRunning() throws InterruptedException
  {
    final DateTime now = DateTimes.nowUtc();
    final Set<String> expiredSupervisorTasks = new HashSet<>();
    for (Entry<String, DateTime> entry : supervisorTaskCheckTimes.entrySet()) {
      final String supervisorTaskId = entry.getKey();
      final DateTime checkTime = entry.getValue();
      if (checkTime.isAfter(now)) {
        expiredSupervisorTasks.add(supervisorTaskId);
      }
    }

    if (!expiredSupervisorTasks.isEmpty()) {
      LOG.info("Found [%s] expired supervisor tasks", expiredSupervisorTasks.size());
    }

    if (!expiredSupervisorTasks.isEmpty()) {
      final Map<String, TaskStatus> taskStatuses = indexingServiceClient.getTaskStatuses(expiredSupervisorTasks);
      for (Entry<String, TaskStatus> entry : taskStatuses.entrySet()) {
        final String supervisorTaskId = entry.getKey();
        final TaskStatus status = entry.getValue();
        if (status.getStatusCode().isComplete()) {
          // If it's finished, clean up all partitions for the supervisor task.
          try {
            deletePartitions(supervisorTaskId);
          }
          catch (IOException e) {
            LOG.warn(e, "Failed to delete partitions for task[%s]", supervisorTaskId);
          }
        } else {
          // If it's still running, update last access time.
          supervisorTaskCheckTimes.put(supervisorTaskId, getExpiryTimeFromNow());
        }
      }
    }
  }

  /**
   * Write a segment into one of configured locations. The location to write is chosen in a round-robin manner per
   * supervisorTaskId.
   */
  long addSegment(String supervisorTaskId, String subTaskId, DataSegment segment, File segmentDir)
      throws IOException
  {
    // Get or create the location iterator for supervisorTask.
    final Iterator<StorageLocation> iterator = locationIterators.computeIfAbsent(
        supervisorTaskId,
        k -> {
          final Iterator<StorageLocation> cyclicIterator = Iterators.cycle(shuffleDataLocations);
          // Random start of the iterator
          final int random = ThreadLocalRandom.current().nextInt(shuffleDataLocations.size());
          IntStream.range(0, random).forEach(i -> cyclicIterator.next());
          return cyclicIterator;
        }
    );

    // Create a zipped segment in a temp directory.
    final File taskTempDir = taskConfig.getTaskTempDir(subTaskId);

    try (final Closer resourceCloser = Closer.create()) {
      if (taskTempDir.mkdirs()) {
        resourceCloser.register(() -> {
          try {
            FileUtils.forceDelete(taskTempDir);
          }
          catch (IOException e) {
            LOG.warn(e, "Failed to delete directory[%s]", taskTempDir.getAbsolutePath());
          }
        });
      }

      // Tempary compressed file. Will be removed when taskTempDir is deleted.
      final File tempZippedFile = new File(taskTempDir, segment.getId().toString());
      final long unzippedSizeBytes = CompressionUtils.zip(segmentDir, tempZippedFile);
      if (unzippedSizeBytes == 0) {
        throw new IOE(
            "Read 0 bytes from segmentDir[%s]",
            segmentDir.getAbsolutePath()
        );
      }

      // Try copying the zipped segment to one of storage locations
      for (int i = 0; i < shuffleDataLocations.size(); i++) {
        final StorageLocation location = iterator.next();
        final String partitionFilePath = getPartitionFilePath(
            supervisorTaskId,
            subTaskId,
            segment.getInterval(),
            segment.getShardSpec().getPartitionNum()
        );
        final File destFile = location.reserve(partitionFilePath, segment.getId().toString(), tempZippedFile.length());
        if (destFile != null) {
          FileUtils.forceMkdirParent(destFile);
          org.apache.druid.java.util.common.FileUtils.writeAtomically(
              destFile,
              out -> Files.asByteSource(tempZippedFile).copyTo(out)
          );
          LOG.info(
              "Wrote intermediary segment for segment[%s] of subtask[%s] at [%s]",
              segment.getId(),
              subTaskId,
              destFile
          );
          return unzippedSizeBytes;
        }
      }
      throw new ISE("Can't find location to handle segment[%s]", segment);
    }
  }

  @Nullable
  public File findPartitionFile(String supervisorTaskId, String subTaskId, Interval interval, int bucketId)
  {
    IdUtils.validateId("supervisorTaskId", supervisorTaskId);
    for (StorageLocation location : shuffleDataLocations) {
      final File partitionDir = new File(location.getPath(), getPartitionDir(supervisorTaskId, interval, bucketId));
      if (partitionDir.exists()) {
        supervisorTaskCheckTimes.put(supervisorTaskId, getExpiryTimeFromNow());
        final File[] segmentFiles = partitionDir.listFiles();
        if (segmentFiles == null) {
          return null;
        } else {
          for (File segmentFile : segmentFiles) {
            if (segmentFile.getName().equals(subTaskId)) {
              return segmentFile;
            }
          }
          return null;
        }
      }
    }

    return null;
  }

  private DateTime getExpiryTimeFromNow()
  {
    return DateTimes.nowUtc().plus(intermediaryPartitionTimeout);
  }

  public void deletePartitions(String supervisorTaskId) throws IOException
  {
    IdUtils.validateId("supervisorTaskId", supervisorTaskId);
    for (StorageLocation location : shuffleDataLocations) {
      final File supervisorTaskPath = new File(location.getPath(), supervisorTaskId);
      if (supervisorTaskPath.exists()) {
        LOG.info("Cleaning up [%s]", supervisorTaskPath);
        for (File eachFile : FileUtils.listFiles(supervisorTaskPath, null, true)) {
          location.removeFile(eachFile);
        }
        FileUtils.forceDelete(supervisorTaskPath);
      }
    }
    supervisorTaskCheckTimes.remove(supervisorTaskId);
  }

  private static String getPartitionFilePath(
      String supervisorTaskId,
      String subTaskId,
      Interval interval,
      int bucketId
  )
  {
    return Paths.get(getPartitionDir(supervisorTaskId, interval, bucketId), subTaskId).toString();
  }

  private static String getPartitionDir(
      String supervisorTaskId,
      Interval interval,
      int bucketId
  )
  {
    return Paths.get(
        supervisorTaskId,
        interval.getStart().toString(),
        interval.getEnd().toString(),
        String.valueOf(bucketId)
    ).toString();
  }
}


text:
@interface PodsDummy_Pods_RxPickerViewUITests : NSObject
@end
@implementation PodsDummy_Pods_RxPickerViewUITests
@end

redpajama_set_name: RedPajamaGithub


text:
/**
* @file: highslide.css
* @version: 4.1.13
*/
.highslide-container div {
	font-family: Verdana, Helvetica;
	font-size: 10pt;
}
.highslide-container table {
	background: none;
}
.highslide {
	outline: none;
	text-decoration: none;
}
.highslide:hover img {
	border-color: gray;
}
.highslide-active-anchor img {
	visibility: hidden;
}
.highslide-gallery .highslide-active-anchor img {
	border-color: black;
	visibility: visible;
	cursor: default;
}
.highslide-image {
	border-width: 2px;
	border-style: solid;
	border-color: white;
}
.highslide-wrapper, .highslide-outline {
	background: white;
}
.glossy-dark {
	background: #111;
}

.highslide-image-blur {
}
.highslide-number {
	font-weight: bold;
	color: gray;
	font-size: .9em;
}
.highslide-caption {
	display: none;
	font-size: 1em;
	padding: 5px;
	/*background: white;*/
}
.highslide-heading {
	display: none;
	font-weight: bold;
	margin: 0.4em;
}
.highslide-dimming {
	/*position: absolute;*/
	background: black;
}
a.highslide-full-expand {
   background: url(graphics/fullexpand.gif) no-repeat;
   display: block;
   margin: 0 10px 10px 0;
   width: 34px;
   height: 34px;
}
.highslide-loading {
	display: block;
	color: black;
	font-size: 9px;
	font-weight: bold;
	text-transform: uppercase;
	text-decoration: none;
	padding: 3px;
	border: 1px solid white;
	background-color: white;
	padding-left: 22px;
	background-image: url(graphics/loader.white.gif);
	background-repeat: no-repeat;
	background-position: 3px 1px;
}
a.highslide-credits,
a.highslide-credits i {
	padding: 2px;
	color: silver;
	text-decoration: none;
	font-size: 10px;
}
a.highslide-credits:hover,
a.highslide-credits:hover i {
	color: white;
	background-color: gray;
}
.highslide-move, .highslide-move * {
	cursor: move;
}

.highslide-viewport {
	display: none;
	position: fixed;
	width: 100%;
	height: 100%;
	z-index: 1;
	background: none;
	left: 0;
	top: 0;
}
.highslide-overlay {
	display: none;
}
.hidden-container {
	display: none;
}
/* Example of a semitransparent, offset closebutton */
.closebutton {
	position: relative;
	top: -15px;
	left: 15px;
	width: 30px;
	height: 30px;
	cursor: pointer;
	background: url(graphics/close.png);
	/* NOTE! For IE6, you also need to update the highslide-ie6.css file. */
}

/*****************************************************************************/
/* Thumbnail boxes for the galleries.                                        */
/* Remove these if you are not using a gallery.                              */
/*****************************************************************************/
.highslide-gallery ul {
	list-style-type: none;
	margin: 0;
	padding: 0;
}
.highslide-gallery ul li {
	display: block;
	position: relative;
	float: left;
	width: 106px;
	height: 106px;
	border: 1px solid silver;
	background: #ededed;
	margin: 2px;
	padding: 0;
	line-height: 0;
	overflow: hidden;
}
.highslide-gallery ul a {
	position: absolute;
	top: 50%;
	left: 50%;
}
.highslide-gallery ul img {
 	position: relative;
	top: -50%;
	left: -50%;
}
html>/**/body .highslide-gallery ul li {
	display: table;
	text-align: center;
}
html>/**/body .highslide-gallery ul li {
	text-align: center;
}
html>/**/body .highslide-gallery ul a {
	position: static;
	display: table-cell;
	vertical-align: middle;
}
html>/**/body .highslide-gallery ul img {
	position: static;
}

/*****************************************************************************/
/* Controls for the galleries.											     */
/* Remove these if you are not using a gallery							     */
/*****************************************************************************/
.highslide-controls {
	width: 195px;
	height: 40px;
	background: url(graphics/controlbar-white.gif) 0 -90px no-repeat;
	margin: 20px 15px 10px 0;
}
.highslide-controls ul {
	position: relative;
	left: 15px;
	height: 40px;
	list-style: none;
	margin: 0;
	padding: 0;
	background: url(graphics/controlbar-white.gif) right -90px no-repeat;

}
.highslide-controls li {
	float: left;
	padding: 5px 0;
	margin:0;
	list-style: none;
}
.highslide-controls a {
	background-image: url(graphics/controlbar-white.gif);
	display: block;
	float: left;
	height: 30px;
	width: 30px;
	outline: none;
}
.highslide-controls a.disabled {
	cursor: default;
}
.highslide-controls a.disabled span {
	cursor: default;
}
.highslide-controls a span {
	/* hide the text for these graphic buttons */
	display: none;
	cursor: pointer;
}

/* The CSS sprites for the controlbar - see http://www.google.com/search?q=css+sprites */
.highslide-controls .highslide-previous a {
	background-position: 0 0;
}
.highslide-controls .highslide-previous a:hover {
	background-position: 0 -30px;
}
.highslide-controls .highslide-previous a.disabled {
	background-position: 0 -60px !important;
}
.highslide-controls .highslide-play a {
	background-position: -30px 0;
}
.highslide-controls .highslide-play a:hover {
	background-position: -30px -30px;
}
.highslide-controls .highslide-play a.disabled {
	background-position: -30px -60px !important;
}
.highslide-controls .highslide-pause a {
	background-position: -60px 0;
}
.highslide-controls .highslide-pause a:hover {
	background-position: -60px -30px;
}
.highslide-controls .highslide-next a {
	background-position: -90px 0;
}
.highslide-controls .highslide-next a:hover {
	background-position: -90px -30px;
}
.highslide-controls .highslide-next a.disabled {
	background-position: -90px -60px !important;
}
.highslide-controls .highslide-move a {
	background-position: -120px 0;
}
.highslide-controls .highslide-move a:hover {
	background-position: -120px -30px;
}
.highslide-controls .highslide-full-expand a {
	background-position: -150px 0;
}
.highslide-controls .highslide-full-expand a:hover {
	background-position: -150px -30px;
}
.highslide-controls .highslide-full-expand a.disabled {
	background-position: -150px -60px !important;
}
.highslide-controls .highslide-close a {
	background-position: -180px 0;
}
.highslide-controls .highslide-close a:hover {
	background-position: -180px -30px;
}

/*****************************************************************************/
/* Styles for the Individual wrapper class names.							 */
/* See www.highslide.com/ref/hs.wrapperClassName							 */
/* You can safely remove the class name themes you don't use				 */
/*****************************************************************************/

/* hs.wrapperClassName = 'draggable-header' */
.draggable-header .highslide-header {
	height: 18px;
	border-bottom: 1px solid #dddddd;
}
.draggable-header .highslide-heading {
	position: absolute;
	margin: 2px 0.4em;
}

.draggable-header .highslide-header .highslide-move {
	cursor: move;
	display: block;
	height: 16px;
	position: absolute;
	right: 24px;
	top: 0;
	width: 100%;
	z-index: 1;
}
.draggable-header .highslide-header .highslide-move * {
	display: none;
}
.draggable-header .highslide-header .highslide-close {
	position: absolute;
	right: 2px;
	top: 2px;
	z-index: 5;
	padding: 0;
}
.draggable-header .highslide-header .highslide-close a {
	display: block;
	height: 16px;
	width: 16px;
	background-image: url(graphics/closeX.png);
}
.draggable-header .highslide-header .highslide-close a:hover {
	background-position: 0 16px;
}
.draggable-header .highslide-header .highslide-close span {
	display: none;
}
.draggable-header .highslide-maincontent {
	padding-top: 1em;
}

/* hs.wrapperClassName = 'titlebar' */
.titlebar .highslide-header {
	height: 18px;
	border-bottom: 1px solid #dddddd;
}
.titlebar .highslide-heading {
	position: absolute;
	width: 90%;
	margin: 1px 0 1px 5px;
	color: #666666;
}

.titlebar .highslide-header .highslide-move {
	cursor: move;
	display: block;
	height: 16px;
	position: absolute;
	right: 24px;
	top: 0;
	width: 100%;
	z-index: 1;
}
.titlebar .highslide-header .highslide-move * {
	display: none;
}
.titlebar .highslide-header li {
	position: relative;
	top: 3px;
	z-index: 2;
	padding: 0 0 0 1em;
}
.titlebar .highslide-maincontent {
	padding-top: 1em;
}

/* hs.wrapperClassName = 'no-footer' */
.no-footer .highslide-footer {
	display: none;
}

/* hs.wrapperClassName = 'wide-border' */
.wide-border {
	background: white;
}
.wide-border .highslide-image {
	border-width: 10px;
}
.wide-border .highslide-caption {
	padding: 0 10px 10px 10px;
}

/* hs.wrapperClassName = 'borderless' */
.borderless .highslide-image {
	border: none;
}
.borderless .highslide-caption {
	border-bottom: 1px solid white;
	border-top: 1px solid white;
	background: silver;
}

/* hs.wrapperClassName = 'outer-glow' */
.outer-glow {
	background: #444;
}
.outer-glow .highslide-image {
	border: 5px solid #444444;
}
.outer-glow .highslide-caption {
	border: 5px solid #444444;
	border-top: none;
	padding: 5px;
	background-color: gray;
}

/* hs.wrapperClassName = 'colored-border' */
.colored-border {
	background: white;
}
.colored-border .highslide-image {
	border: 2px solid green;
}
.colored-border .highslide-caption {
	border: 2px solid green;
	border-top: none;
}

/* hs.wrapperClassName = 'dark' */
.dark {
	background: #111;
}
.dark .highslide-image {
	border-color: black black #202020 black;
	background: gray;
}
.dark .highslide-caption {
	color: white;
	background: #111;
}
.dark .highslide-controls,
.dark .highslide-controls ul,
.dark .highslide-controls a {
	background-image: url(graphics/controlbar-black-border.gif);
}

/* hs.wrapperClassName = 'floating-caption' */
.floating-caption .highslide-caption {
	position: absolute;
	padding: 1em 0 0 0;
	background: none;
	color: white;
	border: none;
	font-weight: bold;
}

/* hs.wrapperClassName = 'controls-in-heading' */
.controls-in-heading .highslide-heading {
	color: gray;
	font-weight: bold;
	height: 20px;
	overflow: hidden;
	cursor: default;
	padding: 0 0 0 22px;
	margin: 0;
	background: url(graphics/icon.gif) no-repeat 0 1px;
}
.controls-in-heading .highslide-controls {
	width: 105px;
	height: 20px;
	position: relative;
	margin: 0;
	top: -23px;
	left: 7px;
	background: none;
}
.controls-in-heading .highslide-controls ul {
	position: static;
	height: 20px;
	background: none;
}
.controls-in-heading .highslide-controls li {
	padding: 0;
}
.controls-in-heading .highslide-controls a {
	background-image: url(graphics/controlbar-white-small.gif);
	height: 20px;
	width: 20px;
}

.controls-in-heading .highslide-controls .highslide-move {
	display: none;
}

.controls-in-heading .highslide-controls .highslide-previous a {
	background-position: 0 0;
}
.controls-in-heading .highslide-controls .highslide-previous a:hover {
	background-position: 0 -20px;
}
.controls-in-heading .highslide-controls .highslide-previous a.disabled {
	background-position: 0 -40px !important;
}
.controls-in-heading .highslide-controls .highslide-play a {
	background-position: -20px 0;
}
.controls-in-heading .highslide-controls .highslide-play a:hover {
	background-position: -20px -20px;
}
.controls-in-heading .highslide-controls .highslide-play a.disabled {
	background-position: -20px -40px !important;
}
.controls-in-heading .highslide-controls .highslide-pause a {
	background-position: -40px 0;
}
.controls-in-heading .highslide-controls .highslide-pause a:hover {
	background-position: -40px -20px;
}
.controls-in-heading .highslide-controls .highslide-next a {
	background-position: -60px 0;
}
.controls-in-heading .highslide-controls .highslide-next a:hover {
	background-position: -60px -20px;
}
.controls-in-heading .highslide-controls .highslide-next a.disabled {
	background-position: -60px -40px !important;
}
.controls-in-heading .highslide-controls .highslide-full-expand a {
	background-position: -100px 0;
}
.controls-in-heading .highslide-controls .highslide-full-expand a:hover {
	background-position: -100px -20px;
}
.controls-in-heading .highslide-controls .highslide-full-expand a.disabled {
	background-position: -100px -40px !important;
}
.controls-in-heading .highslide-controls .highslide-close a {
	background-position: -120px 0;
}
.controls-in-heading .highslide-controls .highslide-close a:hover {
	background-position: -120px -20px;
}

/*****************************************************************************/
/* Styles for the thumbstrip.							                     */
/* See www.highslide.com/ref/hs.addSlideshow    							 */
/* You can safely remove this if you don't use a thumbstrip 				 */
/*****************************************************************************/

.highslide-thumbstrip {
	height: 100%;
	direction: ltr;
}
.highslide-thumbstrip div {
	overflow: hidden;
}
.highslide-thumbstrip table {
	position: relative;
	padding: 0;
	border-collapse: collapse;
}
.highslide-thumbstrip td {
	padding: 1px;
	/*text-align: center;*/
}
.highslide-thumbstrip a {
	outline: none;
}
.highslide-thumbstrip img {
	display: block;
	border: 1px solid gray;
	margin: 0 auto;
}
.highslide-thumbstrip .highslide-active-anchor img {
	visibility: visible;
}
.highslide-thumbstrip .highslide-marker {
	position: absolute;
	width: 0;
	height: 0;
	border-width: 0;
	border-style: solid;
	border-color: transparent; /* change this to actual background color in highslide-ie6.css */
}
.highslide-thumbstrip-horizontal div {
	width: auto;
	/* width: 100% breaks in small strips in IE */
}
.highslide-thumbstrip-horizontal .highslide-scroll-up {
	display: none;
	position: absolute;
	top: 3px;
	left: 3px;
	width: 25px;
	height: 42px;
}
.highslide-thumbstrip-horizontal .highslide-scroll-up div {
	margin-bottom: 10px;
	cursor: pointer;
	background: url(graphics/scrollarrows.png) left center no-repeat;
	height: 42px;
}
.highslide-thumbstrip-horizontal .highslide-scroll-down {
	display: none;
	position: absolute;
	top: 3px;
	right: 3px;
	width: 25px;
	height: 42px;
}
.highslide-thumbstrip-horizontal .highslide-scroll-down div {
	margin-bottom: 10px;
	cursor: pointer;
	background: url(graphics/scrollarrows.png) center right no-repeat;
	height: 42px;
}
.highslide-thumbstrip-horizontal table {
	margin: 2px 0 10px 0;
}
.highslide-viewport .highslide-thumbstrip-horizontal table {
	margin-left: 10px;
}
.highslide-thumbstrip-horizontal img {
	width: auto;
	height: 40px;
}
.highslide-thumbstrip-horizontal .highslide-marker {
	top: 47px;
	border-left-width: 6px;
	border-right-width: 6px;
	border-bottom: 6px solid gray;
}
.highslide-viewport .highslide-thumbstrip-horizontal .highslide-marker {
	margin-left: 10px;
}
.dark .highslide-thumbstrip-horizontal .highslide-marker, .highslide-viewport .highslide-thumbstrip-horizontal .highslide-marker {
	border-bottom-color: white !important;
}

.highslide-thumbstrip-vertical-overlay {
	overflow: hidden !important;
}
.highslide-thumbstrip-vertical div {
	height: 100%;
}
.highslide-thumbstrip-vertical a {
	display: block;
}
.highslide-thumbstrip-vertical .highslide-scroll-up {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 25px;
}
.highslide-thumbstrip-vertical .highslide-scroll-up div {
	margin-left: 10px;
	cursor: pointer;
	background: url(graphics/scrollarrows.png) top center no-repeat;
	height: 25px;
}
.highslide-thumbstrip-vertical .highslide-scroll-down {
	display: none;
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 25px;
}
.highslide-thumbstrip-vertical .highslide-scroll-down div {
	margin-left: 10px;
	cursor: pointer;
	background: url(graphics/scrollarrows.png) bottom center no-repeat;
	height: 25px;
}
.highslide-thumbstrip-vertical table {
	margin: 10px 0 0 10px;
}
.highslide-thumbstrip-vertical img {
	width: 60px; /* t=5481 */
}
.highslide-thumbstrip-vertical .highslide-marker {
	left: 0;
	margin-top: 8px;
	border-top-width: 6px;
	border-bottom-width: 6px;
	border-left: 6px solid gray;
}
.dark .highslide-thumbstrip-vertical .highslide-marker, .highslide-viewport .highslide-thumbstrip-vertical .highslide-marker {
	border-left-color: white;
}

.highslide-viewport .highslide-thumbstrip-float {
	overflow: auto;
}
.highslide-thumbstrip-float ul {
	margin: 2px 0;
	padding: 0;
}
.highslide-thumbstrip-float li {
	display: block;
	height: 60px;
	margin: 0 2px;
	list-style: none;
	float: left;
}
.highslide-thumbstrip-float img {
	display: inline;
	border-color: silver;
	max-height: 56px;
}
.highslide-thumbstrip-float .highslide-active-anchor img {
	border-color: black;
}
.highslide-thumbstrip-float .highslide-scroll-up div, .highslide-thumbstrip-float .highslide-scroll-down div {
	display: none;
}
.highslide-thumbstrip-float .highslide-marker {
	display: none;
}


text:
namespace base {
class FilePath;
class FileEnumerator;
class Time;
}

class DevToolsFileSystemIndexer
    : public base::RefCountedThreadSafe<DevToolsFileSystemIndexer> {
 public:

  typedef base::OnceCallback<void(int)> TotalWorkCallback;
  typedef base::RepeatingCallback<void(int)> WorkedCallback;
  typedef base::OnceCallback<void()> DoneCallback;
  typedef base::OnceCallback<void(const std::vector<std::string>&)> SearchCallback;

  class FileSystemIndexingJob
      : public base::RefCountedThreadSafe<FileSystemIndexingJob> {
   public:
    void Stop();

   private:
    friend class base::RefCountedThreadSafe<FileSystemIndexingJob>;
    friend class DevToolsFileSystemIndexer;
    FileSystemIndexingJob(const base::FilePath& file_system_path,
                          const std::vector<base::FilePath>& excluded_folders,
                          TotalWorkCallback total_work_callback,
                          const WorkedCallback& worked_callback,
                          DoneCallback done_callback);
    virtual ~FileSystemIndexingJob();

    void Start();
    void StopOnImplSequence();
    void CollectFilesToIndex();
    void IndexFiles();
    void ReadFromFile();
    void OnRead(base::File::Error error,
                const char* data,
                int bytes_read);
    void FinishFileIndexing(bool success);
    void CloseFile();
    void ReportWorked();

    base::FilePath file_system_path_;
    std::vector<base::FilePath> excluded_folders_;

    std::vector<base::FilePath> pending_folders_;
    TotalWorkCallback total_work_callback_;
    WorkedCallback worked_callback_;
    DoneCallback done_callback_;
    std::unique_ptr<base::FileEnumerator> file_enumerator_;
    typedef std::map<base::FilePath, base::Time> FilePathTimesMap;
    FilePathTimesMap file_path_times_;
    FilePathTimesMap::const_iterator indexing_it_;
    base::File current_file_;
    int64_t current_file_offset_;
    typedef int32_t Trigram;
    std::vector<Trigram> current_trigrams_;
    // The index in this vector is the trigram id.
    std::vector<bool> current_trigrams_set_;
    base::TimeTicks last_worked_notification_time_;
    int files_indexed_;
    bool stopped_;
  };

  DevToolsFileSystemIndexer();

  DevToolsFileSystemIndexer(const DevToolsFileSystemIndexer&) = delete;
  DevToolsFileSystemIndexer& operator=(const DevToolsFileSystemIndexer&) =
      delete;

  // Performs file system indexing for given |file_system_path| and sends
  // progress callbacks.
  scoped_refptr<FileSystemIndexingJob> IndexPath(
      const std::string& file_system_path,
      const std::vector<std::string>& excluded_folders,
      TotalWorkCallback total_work_callback,
      const WorkedCallback& worked_callback,
      DoneCallback done_callback);

  // Performs trigram search for given |query| in |file_system_path|.
  void SearchInPath(const std::string& file_system_path,
                    const std::string& query,
                    SearchCallback callback);

 private:
  friend class base::RefCountedThreadSafe<DevToolsFileSystemIndexer>;

  virtual ~DevToolsFileSystemIndexer();

  void SearchInPathOnImplSequence(const std::string& file_system_path,
                                  const std::string& query,
                                  SearchCallback callback);
};

#endif  // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_SYSTEM_INDEXER_H_


text:
package com.dogmalabs.wonderadapter.demo.model;

/**
 * Created by menor on 10/02/14.
 */
public class WonderHeader {

  private String country;

  public String getCountry() {
    return country;
  }

  public void setCountry(String country) {
    this.country = country;
  }
}


text:
package org.apache.camel.processor.aggregator;

import org.apache.camel.CamelExchangeException;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.processor.BodyInAggregatingStrategy;

/**
 * @version $Revision$
 */
public class AggregateIgnoreInvalidCorrelationKeysTest extends ContextTestSupport {

    @Override
    public boolean isUseRouteBuilder() {
        return false;
    }

    public void testAggregateIgnoreInvalidCorrelationKeys() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .aggregate(header("id"), new BodyInAggregatingStrategy())
                        .completionSize(2).ignoreInvalidCorrelationKeys()
                        .to("mock:result");
            }
        });
        context.start();

        getMockEndpoint("mock:result").expectedBodiesReceived("A+C");

        template.sendBodyAndHeader("direct:start", "A", "id", 1);

        // B should be ignored
        template.sendBodyAndHeader("direct:start", "B", "id", null);

        template.sendBodyAndHeader("direct:start", "C", "id", 1);

        assertMockEndpointsSatisfied();
    }

    public void testAggregateNotIgnoreInvalidCorrelationKeys() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .aggregate(header("id"), new BodyInAggregatingStrategy())
                        .completionSize(2)
                        .to("mock:result");
            }
        });
        context.start();

        getMockEndpoint("mock:result").expectedBodiesReceived("A+C");

        template.sendBodyAndHeader("direct:start", "A", "id", 1);

        try {
            template.sendBodyAndHeader("direct:start", "B", "id", null);
            fail("Should throw an exception");
        } catch (CamelExecutionException e) {
            CamelExchangeException cause = assertIsInstanceOf(CamelExchangeException.class, e.getCause());
            assertEquals("Invalid correlation key. Exchange[Message: B]", cause.getMessage());
        }

        template.sendBodyAndHeader("direct:start", "C", "id", 1);

        assertMockEndpointsSatisfied();
    }

}


text:
package org.factcenter.pathORam.test;

import org.factcenter.pathORam.BlockStorage;
import org.factcenter.pathORam.BlockStoragePositionMapFactory;
import org.factcenter.pathORam.ops.BlockStoragePositionMap;

public class DummyPositionMapFactory implements
		BlockStoragePositionMapFactory {
	@Override
	public BlockStoragePositionMap createPositionMap(BlockStorage blockStorage,
			int valuesInBlock) {
		return new DummyBlockStoragePositionMap(blockStorage, valuesInBlock);
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>BigDecimalJavaBean xref</title>
<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />

View Javadoc

1
16  package org.yaml.snakeyaml.constructor;
17
18  import java.math.BigDecimal;
19
20  public class BigDecimalJavaBean {
21      private BigDecimal number;
22      private float amount;
23
24      public BigDecimal getNumber() {
25          return number;
26      }
27
28      public void setNumber(BigDecimal number) {
29          this.number = number;
30      }
31
32      public float getAmount() {
33          return amount;
34      }
35
36      public void setAmount(float amount) {
37          this.amount = amount;
38      }
39  }

This page was automatically generated by Maven


text:
<template>

${title}

						${fullname}

${errorMessage}

${infoMessage}

		<form role="forom">

						Département
						<select id="departements" value.bind="departement">
							<option>Département.</option>
							<option repeat.for="depelem of departements" model.bind="depelem">${depelem.text}</option>
						</select>

						Année
						<select id="annees" value.bind="annee">
							<option>Anneé.</option>
							<option repeat.for="anelem of annees" model.bind="anelem">${anelem.text}</option>
						</select>

						Semestre
						<select id="semestres" value.bind="semestre">
							<option>Semestre.</option>
							<option repeat.for="semelem of semestres" model.bind="semelem">${semelem.text}</option>
						</select>

						Unité
						<select id="unites" value.bind="unite">
							<option>Unité.</option>
							<option repeat.for="unelem of unites" model.bind="unelem">${unelem.text}</option>
						</select>

						Matière
						<select id="matieres" value.bind="matiere">
							<option>Matière.</option>
							<option repeat.for="matelem of matieres" model.bind="matelem">${matelem.text}</option>
						</select>

						Groupe
						<select id="groupes" value.bind="groupe">
							<option>Groupe.</option>
							<option repeat.for="grpelem of groupes" model.bind="grpelem">${grpelem.text}</option>
						</select>

						Genre
						<select id="allGenre" value.bind="allGenre">
							<option>Genre.</option>
							<option value='TP'>Travaux Pratiques</option>
							<option value='CONT'>Contrôle</option>
							<option value='EXAM'>Examen</option>
							<option value='FAC'>Devoir Facultatif</option>
							<option value='TD'>Travaux Dirigés</option>
							<option value='COURS'>Cours Magistral</option>
							<option value='AUTRE'>Autre Genre</option>
						</select>

		</form>

				Edition

				Evènements

				Notes

						Début

						Préc.

						Suivant

						Fin

				<select value.bind="currentItem" size="16">
					<option repeat.for="elem of items" model.bind="elem">${elem.text}</option>
				</select>

				<form role="form">

						Genre
						<select id="genre" value.bind="genre">
							<option>Genre.</option>
							<option value='TP'>Travaux Pratiques</option>
							<option value='CONT'>Contrôle</option>
							<option value='EXAM'>Examen</option>
							<option value='FAC'>Devoir Facultatif</option>
							<option value='TD'>Travaux Dirigés</option>
							<option value='COURS'>Cours Magistral</option>
							<option value='AUTRE'>Autre Genre</option>
						</select>

						Date
						<input class="form-control" type="date" id="eventDate" value.bind="eventDate" min.bind="startDate" max.bind="endDate" required></input>

						Nom
						<input class="form-control" type="text" id="name" value.bind="name" placeholder="Nom" required></input>

						Coefficient
						<input class="form-control" type="text" id="coef" value.bind="coefficient" placeholder="Coefficient"></input>

						Location
						<input class="form-control" type="text" id="location" value.bind="location" placeholder="Location"></input>

						Heure début
						<input class="form-control" type="text" id="startTime" value.bind="startTime"></input>

						Heure fin
						<input class="form-control" type="text" id="endTime" value.bind="endTime"></input>

						Description
						<textarea class="form-control" id="description" value.bind="description"></textarea>

                     	 <button type="button" show.bind="canAdd" click.delegate="addNew()" class="btn btn-primary">Nouveau</button>
                     	 <button type="button" show.bind="canCancel" click.delegate="cancel_add()" class="btn btn-primary">Annuler</button>
                     	 <button type="button" show.bind="canSave" click.delegate="save()" class="btn btn-primary">Enregistrer</button>
                    	  <button type="button" show.bind="canRemove" click.delegate="remove()" class="btn btn-primary">Supprimer</button>

				</form>

					<button type="button" diabled.bind="cannotSaveNotes" click.delegate= "saveNotes">Enregistrer</button>

						Nom de famille
						Prénom(s)
						Note

							<input type="checkbox" checked.bind="note.isSelected" />

							${note.lastname}

							${note.firstname}

							${note.note}

</template>


text:
AdvancedConnection is a rails (~> 4.1) plugin that provides advanced management features for Rails' ActiveRecord connection pool. Features include:
  - Idle Connection Manager
  - Connection-less Code Blocks
  - Statement Pooling (**EXPERIMENTAL**)

### Version

[![Gem Version](https://badge.fury.io/rb/advanced_connection.svg)](https://badge.fury.io/rb/advanced_connection)

### Installation

You need Gulp installed globally:

```sh
$ gem install advanced_connection
```

or in your Gemfile, add:

```ruby
gem 'advanced_connection', '~> 0.5.6'
```

Then generate your `AdvancedConnection` configuration by executing:

```sh
bundle exec rails generate advanced_connection:install
```

### Usage and Configuration

#### Idle Connection Manager

Enabling this will enable idle connection management. This allows you to specify settings
to enable automatic idle connection reaping.

```text
  enable_idle_connection_manager = true | false
```

Pool queue type determines both how free connections will be checkout out of the pool, as well as how idle connections will be culled. The options are:

:fifo

All connections will have an equal opportunity to be used and culled (default)

:lifo, :stack

More frequently used connections will be reused, leaving less frequently used connections to be culled

:prefer_older

Longer lived connections will tend to stick around longer, with younger connections being culled

:prefer_younger

Younger lived connections will tend to stick around longer, with older connections being culled

```text
  connection_pool_queue_type = :fifo | :lifo | :stack | :prefer_older | :prefer_younger
```

Maximum number of connections that can remain idle without being culled. If you have
more idle conections than this, only the difference between the total idle and this
maximum will be culled.
```text
  max_idle_connections = integer | Float::INFINITY
```

How long (in seconds) a connection can remain idle before being culled
```text
  max_idle_time = integer
```

How many seconds between idle checks (defaults to max_idle_time)
```text
  idle_check_interval = integer
```

#### Connection-less Code Blocks

 Enabling this will add a new method to ActiveRecord::Base that allows you to mark a block of code as not requiring a connection. This can be useful in reducing pressure on the pool, especially when you have sections of code that make potentially long-lived external requests. E.g.,

 ```ruby
 require 'open-uri'
 results = ActiveRecord::Base.without_connection do
   open('http://some-slow-site.com/api/')
 end
 ```

During the call to the remote site, the db connection is checked in and subsequently checked back out once the block finishes. To enable this feature, uncomment the following:

```ruby
  enable_without_connection = true | false
```

 WARNING: this feature cannot be enabled with Statement Pooling.

Additionally, you can hook into the checkin / checkout lifecycle by way of callbacks. This can be extremely useful when employing something like [`Apartment`][apt] to manage switching between tenants.

```ruby
without_connection_callbacks = {
  # runs right before the connection is checked back into the pool
  before:  ->() { },
  around:  ->(&block) {
    tenant = Apartment::Tenant.current
    block.call
    Apartment::Tenant.switch(tenant)
  },
  # runs right after the connection is checked back out of the pool
  after:  ->() { }
}
```

#### Statement Pooling

### Todos

 - Finish development of Statement Pooling
 - Write Tests
 - Add Code Comments

License
----

MIT

[//]: # (references)
   [apt]: <https://github.com/influitive/apartment/>


text:
import xml.etree.ElementTree as ET

class Configuration:
    def __init__(self):
        self.tree = ET.parse('config.xml')
        self.root = self.tree.getroot()

    def getUsernamePassword(self,user):
        credentials = self.root.findall('login')
        for entry in credentials:
            if (entry.get('name') == user):
                return entry.find('username').text, entry.find('password').text
    def getCourseByName(self, name):
        courseList = self.root.findall('course')
        for entry in courseList:
            if (entry.get('name') == name):
                return int(entry.find('id').text), (entry.find('startDate').text), entry.find('gotPlace').text == 1
    def getCourseByDate(self, date):
        courseList = self.root.findall('course')
        for entry in courseList:
            if (entry.find('startDate') == date):
                return int(entry.find('id').text), (entry.find('startDate').text), entry.find('gotPlace').text == 1


text:
package com.thoughtworks.go.server;

import com.thoughtworks.go.server.util.GoPlainSocketConnector;
import com.thoughtworks.go.util.SystemEnvironment;
import org.apache.commons.io.FileUtils;
import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebInfConfiguration;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
import org.eclipse.jetty.xml.XmlConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.management.MBeanServer;
import javax.servlet.SessionCookieConfig;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.management.ManagementFactory;

import static java.nio.charset.StandardCharsets.UTF_8;

public class Jetty9Server extends AppServer {
    protected static String JETTY_XML_LOCATION_IN_JAR = "/defaultFiles/config";
    private static final String JETTY_XML = "jetty.xml";
    private static final String JETTY_CONFIG_VERSION = "jetty-v9.4.48.v20220622";
    private Server server;
    private WebAppContext webAppContext;
    private static final Logger LOG = LoggerFactory.getLogger(Jetty9Server.class);
    private final DeploymentManager deploymentManager;

    public Jetty9Server(SystemEnvironment systemEnvironment) {
        this(systemEnvironment, new Server(), new DeploymentManager());
    }

    Jetty9Server(SystemEnvironment systemEnvironment, Server server, DeploymentManager deploymentManager) {
        super(systemEnvironment);
        systemEnvironment.set(SystemEnvironment.JETTY_XML_FILE_NAME, JETTY_XML);
        this.server = server;
        this.deploymentManager = deploymentManager;
    }

    @Override
    public void configure() throws Exception {
        server.addEventListener(mbeans());
        server.addConnector(plainConnector());

        ContextHandlerCollection handlers = new ContextHandlerCollection();
        deploymentManager.setContexts(handlers);

        createWebAppContext();

        JettyCustomErrorPageHandler errorHandler = new JettyCustomErrorPageHandler();
        webAppContext.setErrorHandler(errorHandler);
        webAppContext.setGzipHandler(gzipHandler());
        server.addBean(errorHandler);
        server.addBean(deploymentManager);

        HandlerCollection serverLevelHandlers = new HandlerCollection();
        serverLevelHandlers.setHandlers(new Handler[]{handlers});
        server.setHandler(serverLevelHandlers);

        performCustomConfiguration();
        server.setStopAtShutdown(true);
    }

    static GzipHandler gzipHandler() {
        GzipHandler gzipHandler = new GzipHandler();
        gzipHandler.addIncludedMimeTypes(
                "application/javascript",
                "application/json",
                "application/vnd.go.cd.v1+json",
                "application/vnd.go.cd.v2+json",
                "application/vnd.go.cd.v3+json",
                "application/vnd.go.cd.v4+json",
                "application/vnd.go.cd.v5+json",
                "application/vnd.go.cd.v6+json",
                "application/vnd.go.cd.v7+json",
                "application/vnd.go.cd.v8+json",
                "application/vnd.go.cd.v9+json",
                "application/xhtml+xml",
                "image/svg+xml",
                "text/css",
                "text/html",
                "text/plain",
                "text/xml"
        );
        gzipHandler.addIncludedMethods("HEAD",
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE");
        return gzipHandler;
    }

    @Override
    public void start() throws Exception {
        server.start();

        startHandlers();
    }

    @Override
    public void stop() throws Exception {
        server.stop();
    }

    @Override
    public boolean hasStarted() {
        return !webAppContext.isFailed() && webAppContext.getUnavailableException() == null;
    }

    @Override
    public void setSessionConfig() {
        SessionHandler sessionHandler = webAppContext.getSessionHandler();
        SessionCookieConfig sessionCookieConfig = sessionHandler.getSessionCookieConfig();
        sessionCookieConfig.setHttpOnly(true);
        sessionCookieConfig.setSecure(systemEnvironment.isSessionCookieSecure());
        sessionCookieConfig.setMaxAge(systemEnvironment.sessionCookieMaxAgeInSeconds());
        sessionHandler.setMaxInactiveInterval(systemEnvironment.sessionTimeoutInSeconds());
    }

    @Override
    public void setInitParameter(String name, String value) {
        webAppContext.setInitParameter(name, value);
    }

    @Override
    public Throwable getUnavailableException() {
        return webAppContext.getUnavailableException();
    }

    void startHandlers() {
        WebAppProvider webAppProvider = new WebAppProvider();

        deploymentManager.addApp(new App(deploymentManager, webAppProvider, "welcomeHandler", rootHandler()));

        if (systemEnvironment.useCompressedJs()) {
            AssetsContextHandler assetsContextHandler = new AssetsContextHandler(systemEnvironment);
            deploymentManager.addApp(new App(deploymentManager, webAppProvider, "assetsHandler", assetsContextHandler));
            webAppContext.addLifeCycleListener(new AssetsContextHandlerInitializer(assetsContextHandler, webAppContext));
        }

        deploymentManager.addApp(new App(deploymentManager, webAppProvider, "realApp", webAppContext));
    }

    private MBeanContainer mbeans() {
        MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
        return new MBeanContainer(platformMBeanServer);
    }

    private ContextHandler rootHandler() {
        return new GoServerLoadingIndicationHandler(webAppContext, systemEnvironment);
    }

    private Connector plainConnector() {
        return new GoPlainSocketConnector(this, systemEnvironment).getConnector();
    }

    private void performCustomConfiguration() throws Exception {
        File jettyConfig = systemEnvironment.getJettyConfigFile();
        if (jettyConfig.exists()) {
            replaceJettyXmlIfItBelongsToADifferentVersion(jettyConfig);
            LOG.info("Configuring Jetty using {}", jettyConfig.getAbsolutePath());
            XmlConfiguration configuration = new XmlConfiguration(Resource.newResource(jettyConfig));
            configuration.configure(server);
        } else {
            String message = String.format(
                    "No custom jetty configuration (%s) found, using defaults.",
                    jettyConfig.getAbsolutePath());
            LOG.info(message);
        }
    }

    protected void replaceJettyXmlIfItBelongsToADifferentVersion(File jettyConfig) throws IOException {
        if (FileUtils.readFileToString(jettyConfig, UTF_8).contains(JETTY_CONFIG_VERSION)) return;
        replaceFileWithPackagedOne(jettyConfig);
    }

    private void replaceFileWithPackagedOne(File jettyConfig) {
        try (InputStream inputStream = getClass().getResourceAsStream(JETTY_XML_LOCATION_IN_JAR + "/" + jettyConfig.getName())) {
            FileUtils.copyInputStreamToFile(inputStream, systemEnvironment.getJettyConfigFile());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private String getWarFile() {
        return systemEnvironment.getCruiseWar();
    }

    private WebAppContext createWebAppContext() {
        webAppContext = new WebAppContext();
        webAppContext.setDefaultsDescriptor(GoWebXmlConfiguration.configuration(getWarFile()));

        webAppContext.setConfigurationClasses(new String[]{
                WebInfConfiguration.class.getCanonicalName(),
                WebXmlConfiguration.class.getCanonicalName(),
                JettyWebXmlConfiguration.class.getCanonicalName()
        });
        webAppContext.setContextPath(systemEnvironment.getWebappContextPath());

        // delegate all logging to parent classloader to avoid initialization of loggers in multiple classloaders
        webAppContext.getSystemClasspathPattern().add("org.apache.log4j.");
        webAppContext.getSystemClasspathPattern().add("org.slf4j.");
        webAppContext.getSystemClasspathPattern().add("org.apache.commons.logging.");

        webAppContext.setWar(getWarFile());
        webAppContext.setParentLoaderPriority(systemEnvironment.getParentLoaderPriority());
        return webAppContext;
    }

    public Server getServer() {
        return server;
    }
}


text:
import logging

import flask

from api import helpers
import config

from main import app

@app.errorhandler(400)  # Bad Request
@app.errorhandler(401)  # Unauthorized
@app.errorhandler(403)  # Forbidden
@app.errorhandler(404)  # Not Found
@app.errorhandler(405)  # Method Not Allowed
@app.errorhandler(410)  # Gone
@app.errorhandler(418)  # I'm a Teapot
@app.errorhandler(500)  # Internal Server Error
def error_handler(e):
  logging.exception(e)
  try:
    e.code
  except AttributeError:
    e.code = 500
    e.name = 'Internal Server Error'

  if flask.request.path.startswith('/api/'):
    return helpers.handle_error(e)

  return flask.render_template(
      'error.html',
      title='Error %d (%s)!!1' % (e.code, e.name),
      html_class='error-page',
      error=e,
    ), e.code

if config.PRODUCTION:
  @app.errorhandler(Exception)
  def production_error_handler(e):
    return error_handler(e)


text:
// The MIT License (MIT)

// Copyright (c) 2012-2014 Danny Y., Rapptz

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#ifndef GEARS_META_CONST_HPP
#define GEARS_META_CONST_HPP

#include <gears/meta/const/string.hpp>
#include <gears/meta/const/cstdlib.hpp>

/**
 * @defgroup constexpr Constexpr Utilities
 * @ingroup meta
 * @brief Provides `constexpr` enabled classes and miscellaneous utilities.
 * @details This submodule includes `constexpr` programming utilities such as
 * strings, arrays, heterogeneous lists, and standard library components that
 * can be made `constexpr` but aren't. These are all made with C++11 enabled
 * `constexpr` rather than the C++14 relaxed `constexpr`. However, as a positive
 * consequence it should work in both C++11 and C++14.
 */

#endif // GEARS_META_CONST_HPP


text:
using FluentAssertions;
using OutbreakLabs.LibPacketGremlin.Extensions;
using OutbreakLabs.LibPacketGremlin.PacketFactories;
using OutbreakLabs.LibPacketGremlin.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;

namespace LibPacketGremlinTests.Packets
{
    public class DNSQueryTests
    {

        [Fact]
        public void ParseAndSerializeAreEqual()
        {
            byte[] rawBytes = {
                0x00, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x0c, 0x6f, 0x75, 0x74,
  0x62, 0x72, 0x65, 0x61, 0x6b, 0x6c, 0x61, 0x62,
  0x73, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01,
  0x00, 0x01
            };

            DNSQuery packet;
            var parseResult = DNSQueryFactory.Instance.TryParse(rawBytes, out packet);

            parseResult.Should().BeTrue();

            packet.ToArray().SequenceEqual(rawBytes).Should().BeTrue();

        }
    }
}


text:
import { isCharacterKeyPress } from './is-character-keypress'
import VMasker from 'vanilla-masker'

export const allowedKeys = [
  9, // 'tab'
  37, // 'left'
  38, // 'up'
  39, // 'right'
  40, // 'down'
]

export const inputHandler = (ev) => {
  const mask = ev.target.getAttribute('data-mask')
  if(isAllowedKey(ev.keyCode)) return
  if (isCharacterKeyPress(ev)
        && ev.target.value.length >= mask.length ) {
    ev.preventDefault()
  }
  setTimeout(() => {
    maskInput(mask, ev.target)
    broadcast(ev)
  }, 0)
}

const isAllowedKey = (code) => {
  return allowedKeys.some(key => key == code)
}

const maskInput = (mask, input) => {
  if(mask === 'money'){
    input.value = VMasker.toMoney(input.value, {showSignal: true})
  } else {
    input.value = mask && mask.length > 0
      ? VMasker.toPattern(input.value, mask)
      : input.value
  }
}

const getEventForOldBrowser = (eventType) => {
  const ev = document.createEvent('Event')
  ev.initEvent(eventType, false, false)
  return ev
}

const broadcast = (ev) => {
  let inputEvent = null
  let changeEvent = null

  try {
    inputEvent = new Event('input')
    changeEvent = new Event('change')
  }
  catch (err) {
    inputEvent = getEventForOldBrowser('input')
    changeEvent = getEventForOldBrowser('change')
  }

  ev.target.dispatchEvent(inputEvent)
  ev.target.dispatchEvent(changeEvent)
}


text:
[![Version](https://img.shields.io/cocoapods/v/GitHubAuth.svg?style=flat)](http://cocoapods.org/pods/GitHubAuth)
[![License](https://img.shields.io/cocoapods/l/GitHubAuth.svg?style=flat)](http://cocoapods.org/pods/GitHubAuth)
[![Platform](https://img.shields.io/cocoapods/p/GitHubAuth.svg?style=flat)](http://cocoapods.org/pods/GitHubAuth)

## Usage

```swift
GitHubAuth.shared.configure(
    clientId: "CLINET_ID",
    clientSecret: "CLIENT_SECRET"
)

GitHubAuth.shared.signIn { error in
    print(error) // nil

    print(GitHubAuth.shared.accessToken) // Access Token
    print(GitHubAuth.shared.isSignedIn) // True

    let req = NSMutableURLRequest(URL: NSURL(string: "https://api.github.com/user")!)

    GitHubAuth.shared.authorize(req)
    print(req.allHTTPHeaderFields) // Authorization: token ACCESS_TOKEN

    if let data = try? NSURLConnection.sendSynchronousRequest(req, returningResponse: nil) {
        if let content = String(data: data, encoding: NSUTF8StringEncoding) {
            print(content) // {"login":"tnantoka"...
        }
    }

    GitHubAuth.shared.signOut()
    print(GitHubAuth.shared.isSignedIn) // False
}
```

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements

- GitHub API (Default callback URL: `https://example.com/`)

## Installation

GitHubAuth is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "GitHubAuth"
```

## Author

tnantoka

## License

GitHubAuth is available under the MIT license. See the LICENSE file for more info.


text:
CKEDITOR.plugins.setLang( 'codemirror', 'uk', {
	toolbar: 'Джерело',
	autoFormat: 'Format Selection',
	commentSelectedRange: 'Comment Selection',
	uncommentSelectedRange: 'Uncomment Selection'
});