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

namespace VineScript.Compiler
{
    /// <summary>
    /// Manage collapsing text when using the Collapse Statement (with '{' and '}').
    /// </summary>
    internal class CollapseManager
    {
        private string textBuffer = "";
        private int pausedDepth;
        private int _depth = 0;
        // Depth is used in case of nested collapse
        public int Depth {
            get {
                return _depth;
            }
            set {
                _depth = value < 0 ? 0 : value;
                if (_depth > 0) {
                    IsCollapsed = true;
                } else {
                    IsCollapsed = false;
                }
            }
        }

        private bool _collapsed = false;
        public bool IsCollapsed {
            get {
                return _collapsed;
            }
            private set {
                if (value != _collapsed)
                {
                    _collapsed = value;
                    if (_collapsed == false) {
                        // flush buffer if it's not collapsed anymore
                        if (flush != null) {
                            flush(textBuffer);
                            textBuffer = "";
                        }
                    }
                }
            }
        }

        private Action<string> flush;

        public CollapseManager(Action<string> flush)
        {
            this.flush = flush;
        }

        public void Pause()
        {
            pausedDepth = Depth;
            Depth = 0;
        }

        public void Resume()
        {
            Depth = pausedDepth;
        }

        public void Stop()
        {
            Depth = 0;
        }

        public void AddText(string text)
        {
            if (Depth <= 0) {
                throw new Exception("CollapseManager: adding text while not in collapse mode");
            }
            textBuffer += text;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
// <copyright file="LocationTests.cs" company="Yojowa, LLC">
// Copyright (c) 2016-2020 All Rights Reserved
// </copyright>
// <author>Alex Bulankou</author>
// <date>10/30/2016</date>

namespace Yojowa.StopByStop.UnitTests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Yojowa.StopByStop.Utils;

    /// <summary>
    /// Location tests
    /// </summary>
    [TestClass]
    public class LocationTests
    {
        /// <summary>
        /// Gets the North West locations for center location test.
        /// </summary>
        [TestMethod]
        public void GetNWLocationsForCenterLocationTest()
        {
            var locations = new Location[]
                {
                    new Location() { Lat = 45.6, Lon = -110.6 },
                    new Location() { Lat = 45.7, Lon = -110.7 },
                    new Location() { Lat = 45.7, Lon = -110.6 },
                    new Location() { Lat = 45.7, Lon = -110.5 },
                    new Location() { Lat = 45.6, Lon = -110.5 },
                    new Location() { Lat = 45.5, Lon = -110.5 },
                    new Location() { Lat = 45.5, Lon = -110.6 },
                    new Location() { Lat = 45.5, Lon = -110.7 },
                    new Location() { Lat = 45.6, Lon = -110.7 },
                    /*
                    new Location(){Lat=45.8, Lon=-110.8},
                    new Location(){Lat=45.8, Lon=-110.7},
                    new Location(){Lat=45.8, Lon=-110.6},
                    new Location(){Lat=45.8, Lon=-110.5},

                    new Location(){Lat=45.8, Lon=-110.4},
                    new Location(){Lat=45.7, Lon=-110.4},
                    new Location(){Lat=45.6, Lon=-110.4},
                    new Location(){Lat=45.5, Lon=-110.4},

                    new Location(){Lat=45.4, Lon=-110.4},
                    new Location(){Lat=45.4, Lon=-110.5},
                    new Location(){Lat=45.4, Lon=-110.6},
                    new Location(){Lat=45.4, Lon=-110.7},

                    new Location(){Lat=45.4, Lon=-110.8},
                    new Location(){Lat=45.7, Lon=-110.8},
                    new Location(){Lat=45.6, Lon=-110.8},
                    new Location(){Lat=45.5, Lon=-110.8},
                    */
                };
            VerifyLocations(
                LocationUtils.GetNWLocationsForCenterLocation(new Location() { Lat = 45.515, Lon = -110.515 }),
                locations);
        }

        /// <summary>
        /// Tests city id normalization
        /// </summary>
        [TestMethod]
        public void NormalizeCityIDTest()
        {
            Assert.AreEqual<string>(
                "k-i-sawyer-s-air-force-base-united-states",
                LocationUtils.NormalizeCityId("K.I.Sawyer's Air Force Base-united-states"));
        }

        /// <summary>
        /// Verifies the locations.
        /// </summary>
        /// <param name="locationsToVerify">The locations to verify.</param>
        /// <param name="expectedLocations">The expected locations.</param>
        private static void VerifyLocations(IEnumerable<Location> locationsToVerify, IEnumerable<Location> expectedLocations)
        {
            Assert.AreEqual<int>(expectedLocations.Count(), locationsToVerify.Count());

            for (int i = 0; i < locationsToVerify.Count(); i++)
            {
                var locationToVerify = locationsToVerify.ToArray()[i];
                var expectedLocation = expectedLocations.ToArray()[i];

                Assert.AreEqual<double>(Math.Round(locationToVerify.Lat, 1), Math.Round(expectedLocation.Lat, 1));
                Assert.AreEqual<double>(Math.Round(locationToVerify.Lon, 1), Math.Round(expectedLocation.Lon, 1));
            }
        }
    }
}


text:
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vfs.impl.local;

import com.intellij.ide.IdeCoreBundle;
import com.intellij.notification.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.local.FileWatcherNotificationSink;
import com.intellij.openapi.vfs.local.PluggableFileWatcher;
import com.intellij.openapi.vfs.newvfs.ManagingFS;
import com.intellij.util.concurrency.AppExecutorUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.SystemDependent;
import org.jetbrains.annotations.TestOnly;

import java.io.File;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.function.Supplier;

/**
 * Unless stated otherwise, all paths are {@link SystemDependent @SystemDependent}.
 */
public final class FileWatcher {
  private static final Logger LOG = Logger.getInstance(FileWatcher.class);

  final static class DirtyPaths {
    final Set<String> dirtyPaths = new HashSet<>();
    final Set<String> dirtyPathsRecursive = new HashSet<>();
    final Set<String> dirtyDirectories = new HashSet<>();

    static final DirtyPaths EMPTY = new DirtyPaths();

    boolean isEmpty() {
      return dirtyPaths.isEmpty() && dirtyPathsRecursive.isEmpty() && dirtyDirectories.isEmpty();
    }

    void addDirtyPath(String path) {
      if (!dirtyPathsRecursive.contains(path)) {
        dirtyPaths.add(path);
      }
    }

    void addDirtyPathRecursive(String path) {
      dirtyPaths.remove(path);
      dirtyPathsRecursive.add(path);
    }
  }

  private final ManagingFS myManagingFS;
  private final MyFileWatcherNotificationSink myNotificationSink;
  private final ExecutorService myFileWatcherExecutor = AppExecutorUtil.createBoundedApplicationPoolExecutor("File Watcher", 1);
  private final AtomicReference<Future<?>> myLastTask = new AtomicReference<>(null);

  private volatile CanonicalPathMap myPathMap = CanonicalPathMap.empty();
  private volatile Map<Object, Set<String>> myManualWatchRoots = Collections.emptyMap();

  FileWatcher(@NotNull ManagingFS managingFS, @NotNull Runnable postInitCallback) {
    myManagingFS = managingFS;
    myNotificationSink = new MyFileWatcherNotificationSink();

    myFileWatcherExecutor.execute(() -> {
      PluggableFileWatcher.EP_NAME.forEachExtensionSafe(watcher -> watcher.initialize(myManagingFS, myNotificationSink));
      if (isOperational()) {
        postInitCallback.run();
      }
    });
  }

  public void dispose() {
    myFileWatcherExecutor.shutdown();

    Future<?> lastTask = myLastTask.get();
    if (lastTask != null) {
      lastTask.cancel(false);
    }

    try {
      myFileWatcherExecutor.awaitTermination(1, TimeUnit.HOURS);
    }
    catch (InterruptedException e) {
      LOG.error(e);
    }

    PluggableFileWatcher.EP_NAME.forEachExtensionSafe(watcher -> watcher.dispose());
  }

  public boolean isOperational() {
    for (PluggableFileWatcher watcher : PluggableFileWatcher.EP_NAME.getIterable()) {
      if (watcher.isOperational()) return true;
    }
    return false;
  }

  public boolean isSettingRoots() {
    Future<?> lastTask = myLastTask.get();  // a new task may come after the read, but this seems to be an acceptable race
    if (lastTask != null && !lastTask.isDone()) {
      return true;
    }
    for (PluggableFileWatcher watcher : PluggableFileWatcher.EP_NAME.getIterable()) {
      if (watcher.isSettingRoots()) return true;
    }
    return false;
  }

  @NotNull DirtyPaths getDirtyPaths() {
    return myNotificationSink.getDirtyPaths();
  }

  public @NotNull Collection<@NotNull String> getManualWatchRoots() {
    Set<String> result = null;
    for (Set<String> rootSet : myManualWatchRoots.values()) {
      //noinspection SynchronizationOnLocalVariableOrMethodParameter
      synchronized (rootSet) {
        if (result == null) {
          result = new HashSet<>(rootSet);
        }
        else {
          result.retainAll(rootSet);
        }
      }
    }
    return result != null ? result : Collections.emptyList();
  }

  void setWatchRoots(@NotNull Supplier<CanonicalPathMap> pathMapSupplier) {
    Future<?> prevTask = myLastTask.getAndSet(myFileWatcherExecutor.submit(() -> {
      try {
        CanonicalPathMap pathMap = pathMapSupplier.get();
        if (pathMap == null) return;
        myPathMap = pathMap;
        myManualWatchRoots = new ConcurrentHashMap<>();

        Pair<List<String>, List<String>> roots = pathMap.getCanonicalWatchRoots();
        PluggableFileWatcher.EP_NAME.forEachExtensionSafe(watcher -> {
          if (watcher.isOperational()) {
            watcher.setWatchRoots(roots.first, roots.second);
          }
        });
      }
      catch (RuntimeException | Error e) {
        LOG.error(e);
      }
    }));
    if (prevTask != null) {
      prevTask.cancel(false);
    }
  }

  public void notifyOnFailure(@NotNull @NlsContexts.NotificationContent String cause, @Nullable NotificationListener listener) {
    LOG.warn(cause);

    String title = IdeCoreBundle.message("watcher.slow.sync");
    Notification notification = new Notification("File Watcher Messages", title, cause, NotificationType.WARNING)
      .setSuggestionType(true);
    if (listener != null) {
      //noinspection deprecation
      notification.setListener(listener);
    }
    notification.notify(null);
  }

  boolean belongsToWatchRoots(@NotNull String reportedPath, boolean isFile) {
    return myPathMap.belongsToWatchRoots(reportedPath, isFile);
  }

  @NotNull Collection<@NotNull String> mapToAllSymlinks(@NotNull String reportedPath) {
    Collection<String> result = myPathMap.mapToOriginalWatchRoots(reportedPath, true);
    if (!result.isEmpty()) {
      result.remove(reportedPath);
    }
    return result;
  }

  private final class MyFileWatcherNotificationSink implements FileWatcherNotificationSink {
    private final Object myLock = new Object();
    private DirtyPaths myDirtyPaths = new DirtyPaths();

    @NotNull DirtyPaths getDirtyPaths() {
      DirtyPaths dirtyPaths = DirtyPaths.EMPTY;

      synchronized (myLock) {
        if (!myDirtyPaths.isEmpty()) {
          dirtyPaths = myDirtyPaths;
          myDirtyPaths = new DirtyPaths();
        }
      }

      PluggableFileWatcher.EP_NAME.forEachExtensionSafe(watcher -> watcher.resetChangedPaths());

      return dirtyPaths;
    }

    @Override
    public void notifyManualWatchRoots(@NotNull PluggableFileWatcher watcher, @NotNull Collection<String> roots) {
      registerManualWatchRoots(watcher, roots);
    }

    private void registerManualWatchRoots(Object key, Collection<String> roots) {
      Set<String> rootSet = myManualWatchRoots.computeIfAbsent(key, k -> new HashSet<>());
      //noinspection SynchronizationOnLocalVariableOrMethodParameter
      synchronized (rootSet) { rootSet.addAll(roots); }
      notifyOnEvent(OTHER);
    }

    @Override
    public void notifyMapping(@NotNull Collection<Pair<String, String>> mapping) {
      if (!mapping.isEmpty()) {
        myPathMap.addMapping(mapping);
      }
      notifyOnEvent(OTHER);
    }

    @Override
    public void notifyDirtyPath(@NotNull String path) {
      Collection<String> paths = myPathMap.mapToOriginalWatchRoots(path, true);
      if (!paths.isEmpty()) {
        synchronized (myLock) {
          for (String eachPath : paths) {
            myDirtyPaths.addDirtyPath(eachPath);
          }
        }
      }
      notifyOnEvent(path);
    }

    @Override
    public void notifyPathCreatedOrDeleted(@NotNull String path) {
      Collection<String> paths = myPathMap.mapToOriginalWatchRoots(path, true);
      if (!paths.isEmpty()) {
        synchronized (myLock) {
          for (String p : paths) {
            myDirtyPaths.addDirtyPathRecursive(p);
            String parentPath = new File(p).getParent();
            if (parentPath != null) {
              myDirtyPaths.addDirtyPath(parentPath);
            }
          }
        }
      }
      notifyOnEvent(path);
    }

    @Override
    public void notifyDirtyDirectory(@NotNull String path) {
      Collection<String> paths = myPathMap.mapToOriginalWatchRoots(path, false);
      if (!paths.isEmpty()) {
        synchronized (myLock) {
          myDirtyPaths.dirtyDirectories.addAll(paths);
        }
      }
      notifyOnEvent(path);
    }

    @Override
    public void notifyDirtyPathRecursive(@NotNull String path) {
      Collection<String> paths = myPathMap.mapToOriginalWatchRoots(path, false);
      if (!paths.isEmpty()) {
        synchronized (myLock) {
          for (String each : paths) {
            myDirtyPaths.addDirtyPathRecursive(each);
          }
        }
      }
      notifyOnEvent(path);
    }

    @Override
    public void notifyReset(@Nullable String path) {
      if (path != null) {
        synchronized (myLock) {
          myDirtyPaths.addDirtyPathRecursive(path);
        }
      }
      else {
        VirtualFile[] roots = myManagingFS.getLocalRoots();
        synchronized (myLock) {
          for (VirtualFile root : roots) {
            myDirtyPaths.addDirtyPathRecursive(root.getPresentableUrl());
          }
        }
      }
      notifyOnEvent(RESET);
    }

    @Override
    public void notifyUserOnFailure(@NotNull @NlsContexts.NotificationContent String cause, @Nullable NotificationListener listener) {
      notifyOnFailure(cause, listener);
    }
  }

  //<editor-fold desc="Test stuff.">
  public static final String RESET = "(reset)";
  public static final String OTHER = "(other)";

  private volatile Consumer<? super String> myTestNotifier;

  private void notifyOnEvent(String path) {
    Consumer<? super String> notifier = myTestNotifier;
    if (notifier != null) notifier.accept(path);
  }

  @TestOnly
  public void startup(@Nullable Consumer<? super String> notifier) throws Exception {
    myTestNotifier = notifier;
    myFileWatcherExecutor.submit(() -> {
      for (PluggableFileWatcher watcher : PluggableFileWatcher.EP_NAME.getIterable()) {
        watcher.startup();
      }
      return null;
    }).get();
  }

  @TestOnly
  public void shutdown() throws Exception {
    myFileWatcherExecutor.submit(() -> {
      for (PluggableFileWatcher watcher : PluggableFileWatcher.EP_NAME.getIterable()) {
        watcher.shutdown();
      }
      myTestNotifier = null;
      return null;
    }).get();
  }
  //</editor-fold>
}


text: Simple mobile phone flashlight application


text:
/**
 * Helper class to read the content of a local file into a variable
 */
Ext.define('TrackAnnot.store.reader.File', {
    /**
     * @event load
     * Fires after a file has been read.
     * @param {String} content Content of file
     * @param {File} file
     * @param {TrackAnnot.store.reader.File} this
     */
    mixins: {
        observable: 'Ext.util.Observable'
    },
    constructor: function (config) {
        this.mixins.observable.constructor.call(this, config);
        this.addEvents('load');
    },

    /**
     * Read the filefield as text. Fires 'load' event when done.
     *
     * Show alert message box on error
     *
     * @param {Ext.form.field.file} component The file field
     */
    readAsText: function(component) {
        var theFile = this.getFirstFileFromFileField(component);
        this.readFileAsText(theFile);
    },
    readFileAsText: function(theFile) {
        var me = this;
        var reader = new FileReader();
        reader.onloadend = function(theFile) {
            if (reader.readyState == FileReader.DONE) {
                me.fireEvent('load', reader.result, theFile, this);
            } else {
                Ext.Msg.show({
                    title: 'Reading file failed',
                    msg: reader.error,
                    buttons: Ext.Msg.OK,
                    icon: Ext.Msg.WARNING
                });
            }
        };
        reader.readAsText(theFile);
    },
    getFirstFileFromFileField: function(component) {
        var fileinput = component.extractFileInput();
        var files = fileinput.files;
        var f = files[0];
        return f;
    }
});


text:
package com.versionone.apiclient.interfaces;

import java.net.URISyntaxException;

import com.versionone.apiclient.V1Configuration;

/**
 * @deprecated This interface has been deprecated. Please use V1Connector instead.
 */
@Deprecated
public interface IModelsAndServices {
        IMetaModel getMetaModel();
        IMetaModel getMetaModelWithProxy() throws URISyntaxException;
        IServices getServices();
        IServices getServicesWithProxy() throws URISyntaxException;
        V1Configuration getV1Configuration();
        V1Configuration getV1ConfigurationWithProxy() throws URISyntaxException;
}


text:
Session data can be encrypted when stored into repository. This allows secure
transport of the data over unsecured lines.

Encryption uses AES CBC algorithm and a key specicfied in configuration. The
key can be provided either as plaintext or as file or resource on specified
URL. The key is provided using system property or servlet initialization
parameter `com.amadeus.session.encryption.key`. If its value is a URL, the
implementation will try to load key from the specified target. Key loading is
supported from `file`, `http` or `https` schemas.

## Cryptography Notes

The AES key is initialized as SHA-256 from the provided encryption key.

Initialization vector for AES is generated for every serialization of the
session data. The initialization vector is stored as 16 bytes binary prefix to
the session data.

If the provided key is specified as plaintext it will be present in the memory
during whole lifetime of the application. Keys loaded from a URL are present
in the memory only during encrpytion initialization. AES key is present in
memory during lifetime of the application.


text:
layout: page
title: Boone Island Holdings Show
date: 2016-05-24
author: Robert Nixon
tags: weekly links, java
status: published
summary: Donec ullamcorper sit amet risus vitae sollicitudin. Etiam tristique.
banner: images/banner/leisure-05.jpg
booking:
  startDate: 07/11/2016
  endDate: 07/14/2016
  ctyhocn: PHLPMHX
  groupCode: BIHS
published: true
---
Suspendisse potenti. Curabitur enim dui, vestibulum in libero at, pharetra tristique lorem. Donec vulputate diam non varius scelerisque. Vestibulum et mollis mauris. Nulla consequat velit libero, quis elementum magna tincidunt at. Sed a mauris dolor. Nullam ultrices quam at erat dapibus semper. Vivamus at vestibulum ex, eu tempor quam. Maecenas bibendum convallis fermentum. Maecenas nec rutrum arcu. Suspendisse erat magna, tristique nec enim vitae, eleifend posuere magna. Donec dolor lacus, ullamcorper non lorem id, congue viverra urna. Ut tempor gravida ex, et suscipit nulla. Fusce eu rutrum felis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin eget erat vestibulum, egestas tellus quis, gravida tortor.

1 Sed tristique arcu convallis orci mollis, sit amet mattis leo dignissim
1 Quisque cursus eros blandit auctor blandit
1 Donec dictum orci sed quam sollicitudin ornare
1 Pellentesque quis eros vehicula, porttitor velit et, ornare lacus.

Phasellus a orci non est luctus convallis eu eu dolor. Duis venenatis odio quis eros posuere, in blandit turpis suscipit. Quisque sodales, erat id porta condimentum, arcu magna convallis est, in mollis sapien turpis non justo. Nulla ullamcorper nulla in molestie volutpat. Fusce eu velit id orci tristique laoreet quis pharetra massa. Sed in tempus magna. Vestibulum id nibh nisi. Vivamus et purus dapibus, vulputate enim porttitor, dignissim arcu. Nullam a mi mi. Nulla accumsan dolor sit amet tortor tristique, in congue nulla fermentum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris tellus libero, lacinia sit amet mattis sit amet, lacinia sed nisl. Nullam quam diam, accumsan at risus a, condimentum interdum dolor. Aenean vitae fringilla tortor. Cras consectetur congue mollis.


text:
SYNONYM

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

#### Published in
Ann. Bot. , Lond. 18: 473 (1904)

#### Original name
Inocybe bucknallii Massee, 1904

### Remarks
null


text:
class bigint
{
private:
	typedef unsigned int digit_type;
	typedef void (bigint::*bool_type)() const;
	void safe_bool_converter() const;

public:
	bigint();
	bigint(  signed int);
	bigint(unsigned int);
	bigint( intmax_t);
	bigint(uintmax_t);
	bigint(double);
	bigint(const char *, int base=0);
	bigint(const std::string&, int base=0);

	friend int compare(const bigint&, const bigint&);
	// divmod(a, b) == (floor(a / b), a - b * floor(a / b))
	// divrem(a, b) == (round(a / b), a - b * round(a / b))
	//                 if round() rounds towards 0
	friend void divmod(const bigint&, const bigint&, bigint *, bigint *);
	friend void divrem(const bigint&, const bigint&, bigint *, bigint *);

	operator bool_type() const;
	void swap(bigint& other) throw();
	int sign() const;
	bool operator!() const;
	const bigint abs() const;

	bigint& operator++();
	bigint& operator--();
	const bigint operator++(int);
	const bigint operator--(int);

	const bigint operator-() const;
	bigint& operator+=(const bigint&);
	bigint& operator-=(const bigint&);
	bigint& operator*=(const bigint&);
	bigint& operator/=(const bigint&);
	bigint& operator%=(const bigint&);

	const bigint operator~() const;
	bigint& operator&=(const bigint&);
	bigint& operator|=(const bigint&);
	bigint& operator^=(const bigint&);
	bigint& operator<<=(const bigint&);
	bigint& operator>>=(const bigint&);

	const bigint pow(const bigint& exp) const;
	const bigint root(const bigint& exp) const;
	const bigint root(const bigint& exp, bigint& remainder) const;
	const bigint sqrt() const;
	const bigint sqrt(bigint& remainder) const;
	const bigint over(const bigint& k) const;

	const std::string str(int base =10) const;
	friend std::ostream& operator<<(std::ostream&, const bigint&);
	//friend std::istream& operator>>(std::istream&, bigint&);

	std::string debug() const;

private:
	int sign_;
	std::vector<digit_type> digits;
};

void swap(bigint&, bigint&) throw();

bool operator==(const bigint& lhs, const bigint& rhs);
bool operator!=(const bigint& lhs, const bigint& rhs);
bool operator< (const bigint& lhs, const bigint& rhs);
bool operator> (const bigint& lhs, const bigint& rhs);
bool operator<=(const bigint& lhs, const bigint& rhs);
bool operator>=(const bigint& lhs, const bigint& rhs);

const bigint& operator+(const bigint&);

const bigint operator+(const bigint& lhs, const bigint& rhs);
const bigint operator-(const bigint& lhs, const bigint& rhs);
const bigint operator*(const bigint& lhs, const bigint& rhs);
const bigint operator/(const bigint& lhs, const bigint& rhs);
const bigint operator%(const bigint& lhs, const bigint& rhs);

const bigint operator& (const bigint& lhs, const bigint& rhs);
const bigint operator| (const bigint& lhs, const bigint& rhs);
const bigint operator^ (const bigint& lhs, const bigint& rhs);
const bigint operator<<(const bigint& lhs, unsigned long rhs);
const bigint operator>>(const bigint& lhs, unsigned long rhs);

const bigint abs(const bigint&);
const bigint pow(const bigint&, const bigint&);
const bigint gcd(const bigint& a, const bigint& b);
const bigint lcm(const bigint& a, const bigint& b);
const bigint fac(const bigint&);
const bigint n_over_k(const bigint& n, const bigint& k);
const bigint root(const bigint& val, const bigint& exp);
const bigint root(const bigint& val, const bigint& exp, bigint& remainder);
const bigint sqrt(const bigint& val);
const bigint sqrt(const bigint& val, bigint& remainder);

template < typename Ty >
bool operator==(const bigint& lhs, const Ty& rhs);
template < typename Ty >
bool operator==(const Ty& lhs, const bigint& rhs);
template < typename Ty >
bool operator!=(const bigint& lhs, const Ty& rhs);
template < typename Ty >
bool operator!=(const Ty& lhs, const bigint& rhs);
template < typename Ty >
bool operator<(const bigint& lhs, const Ty& rhs);
template < typename Ty >
bool operator<(const Ty& lhs, const bigint& rhs);
template < typename Ty >
bool operator<=(const bigint& lhs, const Ty& rhs);
template < typename Ty >
bool operator<=(const Ty& lhs, const bigint& rhs);
template < typename Ty >
bool operator>(const bigint& lhs, const Ty& rhs);
template < typename Ty >
bool operator>(const Ty& lhs, const bigint& rhs);
template < typename Ty >
bool operator>=(const bigint& lhs, const Ty& rhs);
template < typename Ty >
bool operator>=(const Ty& lhs, const bigint& rhs);
template < typename Ty >
const bigint operator+(const bigint& lhs, const Ty& rhs);
template < typename Ty >
const bigint operator+(const Ty& lhs, const bigint& rhs);
template < typename Ty >
const bigint operator-(const bigint& lhs, const Ty& rhs);
template < typename Ty >
const bigint operator-(const Ty& lhs, const bigint& rhs);
template < typename Ty >
const bigint operator*(const bigint& lhs, const Ty& rhs);
template < typename Ty >
const bigint operator*(const Ty& lhs, const bigint& rhs);
template < typename Ty >
const bigint operator/(const bigint& lhs, const Ty& rhs);
template < typename Ty >
const bigint operator/(const Ty& lhs, const bigint& rhs);
template < typename Ty >
const bigint operator%(const bigint& lhs, const Ty& rhs);
template < typename Ty >
const bigint operator%(const Ty& lhs, const bigint& rhs);

std::string to_string(const bigint&);

namespace std
{
// template <> std::numeric_limits<bigint>
}

// ====================================================== implementation

inline
void swap(bigint& a, bigint& b) throw()
{
	a.swap(b);
}
inline
bigint::operator bool_type() const
{
	return (sign())? &bigint::safe_bool_converter : 0;
}
inline
bool bigint::operator!() const
{
	return sign() == 0;
}
inline
const bigint bigint::operator++(int)
{
	bigint result(*this);
	++*this;
	return result;
}
inline
const bigint bigint::operator--(int)
{
	bigint result(*this);
	--*this;
	return result;
}
inline
bigint& bigint::operator/=(const bigint& other)
{
	divmod(*this, other, this, 0);
	return *this;
}
inline
bigint& bigint::operator%=(const bigint& other)
{
	divmod(*this, other, 0, this);
	return *this;
}
inline
bool operator==(const bigint& lhs, const bigint& rhs)
{
	return compare(lhs, rhs) == 0;
}
inline
bool operator!=(const bigint& lhs, const bigint& rhs)
{
	return compare(lhs, rhs) != 0;
}
inline
bool operator<(const bigint& lhs, const bigint& rhs)
{
	return compare(lhs, rhs) < 0;
}
inline
bool operator>(const bigint& lhs, const bigint& rhs)
{
	return compare(lhs, rhs) > 0;
}
inline
bool operator<=(const bigint& lhs, const bigint& rhs)
{
	return compare(lhs, rhs) <= 0;
}
inline
bool operator>=(const bigint& lhs, const bigint& rhs)
{
	return compare(lhs, rhs) >= 0;
}
inline
const bigint& operator+(const bigint& val)
{
	return val;
}
inline
const bigint operator+(const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) += rhs;
}
inline
const bigint operator-(const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) -= rhs;
}
inline
const bigint operator*(const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) *= rhs;
}
inline
const bigint operator/(const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) /= rhs;
}
inline
const bigint operator%(const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) %= rhs;
}
inline
const bigint operator& (const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) &= rhs;
}
inline
const bigint operator| (const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) |= rhs;
}
inline
const bigint operator^ (const bigint& lhs, const bigint& rhs)
{
	return bigint(lhs) ^= rhs;
}
inline
const bigint operator<<(const bigint& lhs, unsigned long rhs)
{
	return bigint(lhs) <<= rhs;
}
inline
const bigint operator>>(const bigint& lhs, unsigned long rhs)
{
	return bigint(lhs) >>= rhs;
}
inline
const bigint abs(const bigint& val)
{
	return val.abs();
}
inline
const bigint pow(const bigint& val, const bigint& exp)
{
	return val.pow(exp);
}
inline
const bigint n_over_k(const bigint& n, const bigint& k)
{
	return n.over(k);
}
inline
const bigint root(const bigint& val, const bigint& exp)
{
	return val.root(exp);
}
inline
const bigint root(const bigint& val, const bigint& exp, bigint& remainder)
{
	return val.root(exp, remainder);
}
inline
const bigint sqrt(const bigint& val)
{
	return val.sqrt();
}
inline
const bigint sqrt(const bigint& val, bigint& remainder)
{
	return val.sqrt(remainder);
}

template < typename Ty >
inline
bool operator==(const bigint& lhs, const Ty& rhs)
{
	return lhs == bigint(rhs);
}

template < typename Ty >
inline
bool operator==(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) == rhs;
}

template < typename Ty >
inline
bool operator!=(const bigint& lhs, const Ty& rhs)
{
	return lhs != bigint(rhs);
}

template < typename Ty >
inline
bool operator!=(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) != rhs;
}

template < typename Ty >
inline
bool operator<(const bigint& lhs, const Ty& rhs)
{
	return lhs < bigint(rhs);
}

template < typename Ty >
inline
bool operator<(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) < rhs;
}

template < typename Ty >
inline
bool operator<=(const bigint& lhs, const Ty& rhs)
{
	return lhs <= bigint(rhs);
}

template < typename Ty >
inline
bool operator<=(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) <= rhs;
}

template < typename Ty >
inline
bool operator>(const bigint& lhs, const Ty& rhs)
{
	return lhs > bigint(rhs);
}

template < typename Ty >
inline
bool operator>(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) > rhs;
}

template < typename Ty >
inline
bool operator>=(const bigint& lhs, const Ty& rhs)
{
	return lhs >= bigint(rhs);
}

template < typename Ty >
inline
bool operator>=(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) >= rhs;
}

template < typename Ty >
inline
const bigint operator+(const bigint& lhs, const Ty& rhs)
{
	return bigint(lhs) += bigint(rhs);
}

template < typename Ty >
inline
const bigint operator+(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) += rhs;
}

template < typename Ty >
inline
const bigint operator-(const bigint& lhs, const Ty& rhs)
{
	return bigint(lhs) -= bigint(rhs);
}

template < typename Ty >
inline
const bigint operator-(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) -= rhs;
}

template < typename Ty >
inline
const bigint operator*(const bigint& lhs, const Ty& rhs)
{
	return bigint(lhs) *= bigint(rhs);
}

template < typename Ty >
inline
const bigint operator*(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) *= rhs;
}

template < typename Ty >
inline
const bigint operator/(const bigint& lhs, const Ty& rhs)
{
	return bigint(lhs) /= bigint(rhs);
}

template < typename Ty >
inline
const bigint operator/(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) /= rhs;
}

template < typename Ty >
inline
const bigint operator%(const bigint& lhs, const Ty& rhs)
{
	return bigint(lhs) %= bigint(rhs);
}

template < typename Ty >
inline
const bigint operator%(const Ty& lhs, const bigint& rhs)
{
	return bigint(lhs) %= rhs;
}

#endif


text:
package main

import (
	"flag"
	"fmt"
	"os"
	"path"

	"github.com/cloudfoundry-incubator/cf-lager"
	"github.com/cloudfoundry-incubator/garden-linux/hook"
	"github.com/cloudfoundry-incubator/garden-linux/linux_backend"
	"github.com/cloudfoundry-incubator/garden-linux/network"
	"github.com/cloudfoundry-incubator/garden-linux/old/logging"
	"github.com/cloudfoundry-incubator/garden-linux/process"
	"github.com/cloudfoundry/gunk/command_runner/linux_command_runner"
)

func main() {
	cf_lager.AddFlags(flag.CommandLine)
	flag.Parse()
	logger, _ := cf_lager.New("hook")

	oldWd, err := os.Getwd()
	if err != nil {
		panic(err)
	}
	cwd := path.Dir(os.Args[0])
	os.Chdir(cwd)
	defer os.Chdir(oldWd)

	config, err := process.EnvFromFile("../etc/config")
	if err != nil {
		panic(fmt.Sprintf("error reading config file in hook: %s", err))
	}
	runner := &logging.Runner{linux_command_runner.New(), logger}
	configurer := network.NewConfigurer(logger.Session("linux_backend: hook.CHILD_AFTER_PIVOT"))
	linux_backend.RegisterHooks(hook.DefaultHookSet, runner, config, linux_backend.NewContainerInitializer(), configurer)

	hook.Main(os.Args[1:])
}


text:
/**
 * PrismTech licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License and with the PrismTech Vortex product. 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 and README for the specific language governing permissions and
 * limitations under the License.
 */
using System;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace vortex.web
{
	[JsonConverter(typeof(ContentFilterConverter))]
	public class ContentFilter : QosPolicy
	{
		private readonly string _filter;

		public ContentFilter (string filter)
		{
			_filter = filter;
		}

		public string Filter {
			get {
				return this._filter;
			}
		}
	}

	public class ContentFilterConverter : JsonConverter
	{
		public override void WriteJson (JsonWriter writer, object value, JsonSerializer serializer)
		{
			var policy = (ContentFilter)value;
			var json = new JObject ();

			json.Add (new JProperty ("id", 3));
			json.Add (new JProperty ("v", policy.Filter));

			json.WriteTo (writer);
		}

		public override object ReadJson (JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			throw new NotImplementedException ();
		}

		public override bool CanConvert (Type objectType)
		{
			return objectType == typeof(ContentFilter);
		}
	}
}


text:
/*
  A few utilities for platform independent interaction with the system
*/

#ifndef _CNC_COMM_PAL_UTIL_H_
#define _CNC_COMM_PAL_UTIL_H_

#include "pal_config.h"
#include <string>

namespace CnC {
namespace Internal
{
    /**
     * return system time in seconds since some unspecified point in the past
     */
    FLOAT64 PAL_TimeOfDayClock();

    /**
     * Returns a good random 32 bit number without affecting the application.
     * Implemented on Linux with /dev/random and rand() as fallback.
     */
    UINT32 PAL_random();

    /**
     * Routines for printing output
     */
    void PAL_Error( const char *format, ... );
    void PAL_Warning( const char *format, ... );
    void PAL_DebugPrintf( const char *filename, int line, const char *format, ... );

    /**
     * Returns a string containing the given path name, and double-quoted
     * if necessary (i.e. if the path name contains blanks).
     */
    std::string PAL_MakeQuotedPath( const char pathName[] );

    /**
     * Starts the given executable as a new process in the background.
     * @param exeName : name of the executable. May contain blanks, need
     *        not be double-quoted in this case.
     * @param argv : command line args. Must be NULL terminated.
     *        0th entry is first command line arg (not name of executable).
     *        The entries of argv must not contain double quotes (due to
     *        problems on Windows). If an entry of argv contains a blank,
     *        it'll be split up into two different arguments, so avaoid
     *        blanks in arguments.
     * @return -1 on error
     */
    int PAL_StartProcessInBackground( const char exeName[], const char* argv[] );

    /**
     * Determines the name of the currently running executable.
     */
    std::string PAL_GetProgname();

    /**
     * Determines the name of the current working directory.
     */
    std::string PAL_getCWD();

    /**
     * Sets environment variable <name> to given value:
     */
    void PAL_SetEnvVar( const char* name, const char* value, int overwrite = 1 );

} // namespace Internal
} // namespace CnC

#endif // _CNC_COMM_PAL_UTIL_H_

/*@} */


text:
/*
  Largely derived just from the code obtained from text2wfreq.c -AC
 */

#include "ac_hash.h"
#include "pc_general.h"
#include "general.h"

/* create a new node, and sets the count to 1 */
struct node *new_node( char *key )
{
  struct node *x;

  x = (struct node *) rr_malloc( sizeof( struct node ) );
  x->word = (char *) rr_malloc( (strlen( key ) + 1) * sizeof( char ) );
  strcpy( x->word, key );
  x->count = 1;
  return x;
}

/* create hash table */
void new_hashtable( struct hash_table *table, int M )
{
  int i;

  table->size = M;
  table->chain = (struct node **) rr_malloc( M * sizeof( struct node *) );
  for( i = 0; i < M; i++ ) {
    table->chain[i] = new_node( "HEAD_NODE" );
    table->chain[i]->next = (struct node *) NULL;
  }
}

/* update linked list */
int update_chain( struct node *t, char *key )
{
  struct node *x;
  int score;

  while( t->next != NULL ) {
    score = strcmp( key, t->next->word );
    /* move to next node */
    if ( score > 0 ) t = t->next;
    /* update node */
    else if ( score == 0 ) {
      t->next->count++;
      return 1;
    }
    /* add new node */
    else {
      x = new_node( key );
      x->next = t->next;
      t->next = x;
      return 0;
    }
  }
  /* add node at end */
  x = new_node( key );
  x->next = (struct node *) NULL;
  t->next = x;
  return 0;
}

/* generate a hash table address from a variable length character */
/* string - from R. Sedgewick, "Algorithms in C++". */
int hash( char *key, int M )
{
  unsigned int h;
  char *t = key;

  for( h = 0; *t; t++ )
    h = ( 64 * h + *t ) % M;
  return h;
}

/* print contents of linked list */
static void print_chain(FILE* outfp, struct node *t )
{
  t = t->next;  /* don't print head node */
  while ( t != NULL ) {
    fprintf(outfp, "%s %d\n", t->word, t->count );
    t = t->next;
  }
}

/* print hash table contents */
void print(FILE* outfp, struct hash_table *table )
{
  int i;
  for( i = 0; i < table->size; i++ )
    print_chain(outfp, table->chain[i] );
}

/* update hash table contents */
void update( struct hash_table *table, char *key, int verbosity )
{
  int chain;

  chain = hash( key, table->size );
  if ( chain < 0 || chain >= table->size ) {
    pc_message(verbosity,1,"WARNING : invalid hash address.\n");
    pc_message(verbosity,1,"%s ignored\n", key );
    return;
  }
  update_chain( table->chain[ chain ], key );
}

/* Hashing functions, by Gary Cook (gdc@eng.cam.ac.uk).  Could use the
   sih functions used in idngrma2lm, but these are much faster. */

/* return the nearest prime not smaller than 'num' */
int nearest_prime(int num)
{
  int div;
  int num_has_divisor = 1;

  if ( num / 2 * 2 == num ) num++;
  for (; num_has_divisor; num += 2 ) {
     num_has_divisor=0;
     for ( div = 3; div <= num / 3; div++ ) {
        if ( ( num / div) * div == num ) {
           num_has_divisor = 1;
           break;
        }
     }
  }
  num -= 2;
  return( num );
}

/**
    ARCHAN 20060122 This is a customized implementation of hash table
    for text2idngram and wngram2idngram.
 */

/* create a new node, and sets the index to ind */
struct idngram_node *idngram_new_node( char *key ,wordid_t ind)
{
  struct idngram_node *x;

  x = (struct idngram_node *) rr_malloc( sizeof( struct idngram_node ) );
  x->word = (char *) rr_malloc( (strlen( key ) + 1) * sizeof( char ) );
  strcpy( x->word, key );
  x->ind = ind;
  return x;
}

/* generate a hash table address from a variable length character */
/* string - from R. Sedgewick, "Algorithms in C++". */
int idngram_hash( char *key, int M )
{
  unsigned int h;
  char *t = key;

  for( h = 0; *t; t++ )
    h = ( 256 * h + *t ) % M;

  return h;
}

/* create hash table */
void new_idngram_hashtable( struct idngram_hash_table *table, int M )
{
  int i;

  table->size = M;
  table->chain = (struct idngram_node **) rr_malloc( M * sizeof( struct idngram_node *) );
  for( i = 0; i < M; i++ ) {
    table->chain[i] = idngram_new_node( "HEAD_NODE" , 0);
    table->chain[i]->next = (struct idngram_node *) NULL;
  }

  /*  for(i = 0; i< M ; i++){
    fprintf(stderr, "%d %s ind %d, %d\n",i,table->chain[i]->word, table->chain[i]->ind, table->chain[i]->next);
    fflush(stderr);
    }*/
}

/* update linked list */
int idngram_update_chain( struct idngram_node *t, char *key ,wordid_t ind)
{
  struct idngram_node *x;

  /* Move to end of list */

  while( t->next != NULL )
    t = t->next;

  /* add node at end */
  x = idngram_new_node( key,ind );
  x->next = (struct idngram_node *) NULL;
  t->next = x;
  return 0;
}

void add_to_idngram_hashtable( struct idngram_hash_table *table,
			       unsigned long position,
			       char *vocab_item,
			       wordid_t ind) {

  idngram_update_chain( table->chain[position], vocab_item,ind );
}

wordid_t index2(struct idngram_hash_table *vocab,
		char *word) {

  unsigned long chain;
  struct idngram_node *chain_pos;

  chain = idngram_hash( word, vocab->size );
  if ( chain >= vocab->size ) {
    fprintf( stderr, "WARNING : invalid hash address\n" );
    fprintf( stderr, "%s ignored\n", word );
    return(0);
  }

  chain_pos = vocab->chain[chain];
  while (chain_pos->next != NULL) {
    if (strcmp(word,chain_pos->next->word) ) {
      fflush(stderr);
      chain_pos = chain_pos->next;
    }else
      return (chain_pos->next->ind);
  }
  return (0);

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Phoma pelliculosa Berk. & Broome

### Remarks
null


text:
import { auth as baidu } from '@/components/dictionaries/baidu/auth'
import { auth as caiyun } from '@/components/dictionaries/caiyun/auth'
import { auth as sogou } from '@/components/dictionaries/sogou/auth'
import { auth as tencent } from '@/components/dictionaries/tencent/auth'
import { auth as youdaotrans } from '@/components/dictionaries/youdaotrans/auth'

export const defaultDictAuths = {
  baidu,
  caiyun,
  sogou,
  tencent,
  youdaotrans
}

export type DictAuths = typeof defaultDictAuths

export const getDefaultDictAuths = (): DictAuths =>
  JSON.parse(JSON.stringify(defaultDictAuths))


text:
namespace OneDream.Models
{
    using System;
    using System.Collections.Generic;

    public partial class OD_City
    {
        public int CityID { get; set; }
        public string CityName { get; set; }
        public Nullable<int> ProvinceID { get; set; }
        public Nullable<int> Sort { get; set; }
    }
}


text:
namespace base {
class SingleThreadTaskRunner;
class Thread;
}

namespace device {

class GamepadDataFetcher;

class DEVICE_GAMEPAD_EXPORT GamepadConnectionChangeClient {
 public:
  virtual void OnGamepadConnectionChange(bool connected,
                                         int index,
                                         const blink::WebGamepad& pad) = 0;
};

class DEVICE_GAMEPAD_EXPORT GamepadProvider
    : public GamepadPadStateProvider,
      public base::SystemMonitor::DevicesChangedObserver {
 public:
  explicit GamepadProvider(
      GamepadConnectionChangeClient* connection_change_client);

  // Manually specifies the data fetcher. Used for testing.
  explicit GamepadProvider(
      GamepadConnectionChangeClient* connection_change_client,
      std::unique_ptr<GamepadDataFetcher> fetcher);

  ~GamepadProvider() override;

  // Returns the shared memory handle of the gamepad data duplicated into the
  // given process.
  base::SharedMemoryHandle GetSharedMemoryHandleForProcess(
      base::ProcessHandle renderer_process);

  // Returns a new mojo::ScopedSharedBufferHandle of the gamepad data.
  mojo::ScopedSharedBufferHandle GetSharedBufferHandle();

  void AddGamepadDataFetcher(GamepadDataFetcher* fetcher);
  void RemoveGamepadDataFetcher(GamepadDataFetcher* fetcher);

  void GetCurrentGamepadData(blink::WebGamepads* data);

  // Pause and resume the background polling thread. Can be called from any
  // thread.
  void Pause();
  void Resume();

  // Registers the given closure for calling when the user has interacted with
  // the device. This callback will only be issued once.
  void RegisterForUserGesture(const base::Closure& closure);

  // base::SystemMonitor::DevicesChangedObserver implementation.
  void OnDevicesChanged(base::SystemMonitor::DeviceType type) override;

  // Add a gamepad data fetcher. Takes ownership of |fetcher|.
  void AddGamepadDataFetcher(std::unique_ptr<GamepadDataFetcher> fetcher);

  // Remove gamepad data fetchers with the given source.
  void RemoveSourceGamepadDataFetcher(GamepadSource source);

  void SetSanitizationEnabled(bool sanitize) { sanitize_ = sanitize; }

 private:
  void Initialize(std::unique_ptr<GamepadDataFetcher> fetcher);

  // Method for setting up the platform-specific data fetcher. Takes ownership
  // of |fetcher|.
  void DoAddGamepadDataFetcher(std::unique_ptr<GamepadDataFetcher> fetcher);
  void DoRemoveSourceGamepadDataFetcher(GamepadSource source);

  // Method for sending pause hints to the low-level data fetcher. Runs on
  // polling_thread_.
  void SendPauseHint(bool paused);

  // Method for polling a GamepadDataFetcher. Runs on the polling_thread_.
  void DoPoll();
  void ScheduleDoPoll();

  void OnGamepadConnectionChange(bool connected,
                                 int index,
                                 const blink::WebGamepad& pad);

  // Checks the gamepad state to see if the user has interacted with it.
  void CheckForUserGesture();

  enum { kDesiredSamplingIntervalMs = 16 };

  // Keeps track of when the background thread is paused. Access to is_paused_
  // must be guarded by is_paused_lock_.
  base::Lock is_paused_lock_;
  bool is_paused_;

  // Keep track of when a polling task is schedlued, so as to prevent us from
  // accidentally scheduling more than one at any time, when rapidly toggling
  // |is_paused_|.
  bool have_scheduled_do_poll_;

  // Lists all observers registered for user gestures, and the thread which
  // to issue the callbacks on. Since we always issue the callback on the
  // thread which the registration happened, and this class lives on the I/O
  // thread, the message loop proxies will normally just be the I/O thread.
  // However, this will be the main thread for unit testing.
  base::Lock user_gesture_lock_;
  struct ClosureAndThread {
    ClosureAndThread(const base::Closure& c,
                     const scoped_refptr<base::SingleThreadTaskRunner>& m);
    ClosureAndThread(const ClosureAndThread& other);
    ~ClosureAndThread();

    base::Closure closure;
    scoped_refptr<base::SingleThreadTaskRunner> task_runner;
  };
  typedef std::vector<ClosureAndThread> UserGestureObserverVector;
  UserGestureObserverVector user_gesture_observers_;

  // Updated based on notification from SystemMonitor when the system devices
  // have been updated, and this notification is passed on to the data fetcher
  // to enable it to avoid redundant (and possibly expensive) is-connected
  // tests. Access to devices_changed_ must be guarded by
  // devices_changed_lock_.
  base::Lock devices_changed_lock_;
  bool devices_changed_;

  bool ever_had_user_gesture_;
  bool sanitize_;

  // Only used on the polling thread.
  typedef std::vector<std::unique_ptr<GamepadDataFetcher>> GamepadFetcherVector;
  GamepadFetcherVector data_fetchers_;

  base::Lock shared_memory_lock_;
  std::unique_ptr<GamepadSharedBuffer> gamepad_shared_buffer_;

  // Polling is done on this background thread.
  std::unique_ptr<base::Thread> polling_thread_;

  GamepadConnectionChangeClient* connection_change_client_;

  DISALLOW_COPY_AND_ASSIGN(GamepadProvider);
};

}  // namespace device

#endif  // DEVICE_GAMEPAD_GAMEPAD_PROVIDER_H_


text:
package no.digipost.api.client.representations;

import java.util.List;

public class MessageDeliverySetter extends MessageDelivery {

    public static MessageDelivery setMessageDeliveryStatus(MessageDelivery messageDelivery, final Document primaryDocument, List<Document> attachments, final Link link){
        messageDelivery.primaryDocument = primaryDocument;
        messageDelivery.attachments = attachments;
        messageDelivery.addLink(link);

        return messageDelivery;
    }
}


text:
<?php

namespace hipanel\modules\domain\tests\acceptance\client\domain;

use hipanel\helpers\Url;
use hipanel\modules\domain\tests\_support\Domain;
use hipanel\modules\domain\tests\_support\Page\DomainIndexPage;
use hipanel\modules\domain\tests\_support\Page\DomainViewPage;
use hipanel\tests\_support\Step\Acceptance\Client;

class DomainNSsCest
{
    /** @var DomainViewPage */
    private $viewPage;

    /** @var Domain */
    private $domain;

    private $successNotification = 'Name servers changed';

    public function _before(Client $I)
    {
        $I->login();
    }

    public function ensureIOpenTestDomainPage(Client $I)
    {
        $indexPage      = new DomainIndexPage($I);
        $this->viewPage = new DomainViewPage($I);
        $this->domain   = new Domain();

        $I->needPage(Url::to('@domain/index'));
        $domainId = $indexPage->getDomainId($this->domain->getName());
        $this->domain->setDomainId($domainId);
        $I->needPage(Url::to('@domain/view?id=' . $domainId));
        $I->see($this->domain->getName(), 'h1');
    }

    public function ensureICanAddNS(Client $I)
    {
        $I->needPage(Url::to('@domain/view?id=' . $this->domain->getDomainId()));

        $nsAmount = $this->viewPage->countNSs();
        $this->addNs();
        $I->pressButton('Save');
        $I->closeNotification($this->successNotification);
        $this->viewPage->checkAmountOfNSs($nsAmount + 1);
    }

    public function ensureICanDeleteNS(Client $I)
    {
        $I->needPage(Url::to('@domain/view?id=' . $this->domain->getDomainId()));

        if (($n = $this->viewPage->countNSs()) <= 1) {
            $this->addNs();
        }

        $this->viewPage->deleteLastNS();
        $I->pressButton('Save');
        $I->closeNotification($this->successNotification);
    }

    private function addNs(): void
    {
        $nss = $this->viewPage->getNSs();
        $nsName = $this->getNewNSName($nss);
        $this->viewPage->addNS($nsName);
    }

    /**
     * @param array $nss
     * @return string
     */
    private function getNewNSName(array $nss): string
    {
        for ($i = 1; $i <= count($nss) + 1; ++$i) {
            $nsName = "ns{$i}.topdns.me";
            if (!in_array($nsName, $nss, true)) {
                break;
            }
        }

        return $nsName ?? 'ns1.topdns.me';
    }
}


text:
import pandas as pd

def create_output_df(fields=[]):
    """
    Function to create a custom pandas dataframe depending on the algorithm
    needs. Fields: event_start,event_stop preset.

    Parameters:
    -----------
    fields(list) - additional fields for the dataframe\n

    Returns:
    --------
    dataframe - pandas dataframe for deteciton insertion\n
    """

    out_df = pd.DataFrame(columns=['event_start', 'event_stop']+fields)

    return out_df

def add_metadata(df,metadata):
    """
    Convenience function to add metadata to the output dataframe.

    Parameters:
    -----------
    df(pandas.DataFrame) - dataframe with original data\n
    metadata(dict) - dictionary with column_name:value\n

    Returns:
    --------
    new_df(pandas.DataFrame) - updated dataframe
    """

    for key in metadata.keys():
        df[key] = metadata[key]

    return df

def correct_boundary_dtype(df):
    """
    Corrects data type of event_start and event_stop columns
    """
    df['event_start'] = df['event_start'].astype('int64')
    df['event_stop'] = df['event_stop'].astype('int64')

    return


text:
__author__ = 'heddevanderheide'

# Django specific
from django import test

# App specific
from takeaway.models import Pizza, Topping

class TestNetworthModel(test.TestCase):
    def setUp(self):
        self.obj_1 = Pizza.objects.create(name='Margherita')
        self.obj_2 = Pizza.objects.create(name='Funghi')
        self.obj_3 = Pizza.objects.create(name='Double Dutch')

        self.topping_1 = Topping.objects.create(name='Mushrooms')
        self.topping_2 = Topping.objects.create(name='Cheese')
        self.topping_3 = Topping.objects.create(name='Onions')

        self.obj_2.toppings.add(self.topping_1)
        self.obj_3.toppings.add(self.topping_2, self.topping_3)

    def test_obj_1(self):
        # no commit
        self.assertEqual(self.obj_1.networth(realtime=True), 1)
        self.assertEqual(self.obj_1._networth, 1)

        # commit
        self.assertEqual(self.obj_1.networth(commit=True), 1)
        self.assertEqual(self.obj_1._networth, 1)

        # relative
        self.assertEqual(self.obj_1.relative_networth(realtime=True, commit=True), 100)
        self.assertEqual(self.obj_1._relative_networth, 100)

    def test_obj_2(self):
        # no commit
        self.assertEqual(self.obj_2.networth(realtime=True), 2)
        self.assertEqual(self.obj_2._networth, 1)

        # commit
        self.assertEqual(self.obj_2.networth(realtime=True, commit=True), 2)
        self.assertEqual(self.obj_2._networth, 2)

        # relative
        self.assertEqual(self.obj_2.relative_networth(realtime=True, commit=True), 100)
        self.assertEqual(self.obj_2._relative_networth, 100)

    def test_obj_3(self):
        # no commit
        self.assertEqual(self.obj_3.networth(realtime=True), 3)
        self.assertEqual(self.obj_3._networth, 1)

        # commit
        self.assertEqual(self.obj_3.networth(realtime=True, commit=True), 3)
        self.assertEqual(self.obj_3._networth, 3)

        # relative
        self.assertEqual(self.obj_3.relative_networth(realtime=True, commit=True), 100)
        self.assertEqual(self.obj_3._relative_networth, 100)

    def test_relative_networth_multiple_objects(self):
        # no commit
        self.assertEqual(self.obj_1.networth(realtime=True), 1)
        self.assertEqual(self.obj_2.networth(realtime=True), 2)
        self.assertEqual(self.obj_3.networth(realtime=True), 3)

        # OBJ 1

        # commit
        self.assertEqual(self.obj_1.networth(commit=True), 1)
        self.assertEqual(self.obj_1._networth, 1)

        # relative
        self.assertEqual(self.obj_1.relative_networth(realtime=True, commit=True), 100)
        self.assertEqual(self.obj_1._relative_networth, 100)

        # OBJ 2

        # commit
        self.assertEqual(self.obj_2.networth(realtime=True, commit=True), 2)
        self.assertEqual(self.obj_2._networth, 2)

        # relative
        self.assertEqual(self.obj_2.relative_networth(realtime=True, commit=True), 100)
        self.assertEqual(self.obj_2._relative_networth, 100)

        # re-test previous object(s)
        self.assertEqual(self.obj_1.relative_networth(realtime=True, commit=True), 50)
        self.assertEqual(self.obj_1._relative_networth, 50)

        # OBJ 3

        # commit
        self.assertEqual(self.obj_3.networth(realtime=True, commit=True), 3)
        self.assertEqual(self.obj_3._networth, 3)

        # relative
        self.assertEqual(self.obj_3.relative_networth(realtime=True, commit=True), 100)
        self.assertEqual(self.obj_3._relative_networth, 100)

        # re-test previous object(s)
        self.assertEqual(self.obj_1.relative_networth(realtime=True, commit=True), 33)
        self.assertEqual(self.obj_1._relative_networth, 33)

        self.assertEqual(self.obj_2.relative_networth(realtime=True, commit=True), 66)
        self.assertEqual(self.obj_2._relative_networth, 66)

        # OBJ 2 UPGRADE
        self.obj_2.toppings.add(self.topping_2, self.topping_3)

        # commit
        self.assertEqual(self.obj_2.networth(realtime=True, commit=True), 4)
        self.assertEqual(self.obj_2._networth, 4)

        # relative
        self.assertEqual(self.obj_2.relative_networth(realtime=True, commit=True), 100)
        self.assertEqual(self.obj_2._relative_networth, 100)

        # re-test previous object(s)
        self.assertEqual(self.obj_1.relative_networth(realtime=True, commit=True), 25)
        self.assertEqual(self.obj_1._relative_networth, 25)

        self.assertEqual(self.obj_3.relative_networth(realtime=True, commit=True), 75)
        self.assertEqual(self.obj_3._relative_networth, 75)

        # OBJ 2 DOWNGRADE
        self.obj_2.toppings.remove(self.topping_2, self.topping_3)

        # commit
        self.assertEqual(self.obj_2.networth(realtime=True, commit=True), 2)
        self.assertEqual(self.obj_2._networth, 2)

        # relative
        self.assertEqual(self.obj_2.relative_networth(realtime=True, commit=True), 66)
        self.assertEqual(self.obj_2._relative_networth, 66)

        # re-test previous object(s)
        # self.assertEqual(self.obj_1.networth(realtime=True, commit=True), 1)
        # self.assertEqual(self.obj_1._networth, 1)
        # self.assertEqual(self.obj_3.networth(realtime=True, commit=True), 3)
        # self.assertEqual(self.obj_3._networth, 3)
        #
        # self.assertEqual(self.obj_1.relative_networth(realtime=True, commit=True), 33)
        # self.assertEqual(self.obj_1._relative_networth, 33)
        # self.assertEqual(self.obj_3.relative_networth(realtime=True, commit=True), 100)
        # self.assertEqual(self.obj_3._relative_networth, 100)


text:
<?php

namespace CendrillonBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use CendrillonBundle\Entity\Conseiller;

class ConseillerController extends Controller
{
    /**
     * @Route ("/conseiller", name="conseiller")
     *
     *
     */
    public function indexAction()
    {

        $conseillers = $this->getDoctrine()->getRepository("CendrillonBundle:Conseiller")->findAll();
        return $this->render('CendrillonBundle:Default:conseiller.html.twig', ['conseillers' => $conseillers]);
    }
}


text:
package com.wangc.fast.p10

/**
  * Created by wangchao on 2017/6/21.
  */
class LoggerMy extends Logger{
  override def log(info: String): Unit = {
    println(info)
  }

  override def toString: String = {
    return "xxx"
  }
}


text:
<?php

	if (!$vars['class']) $vars['class'] = "input-email";
	$vars['type'] = 'email';

	echo \home_api\templates\Template::v('input/input', $vars);


text:
(function( $ ) {
    var ns = 'info';
    if (!$.fn[ns]) {
        $.fn[ns] = function info(command,label,value){

			var type = '', obj = $(this), objFull={};

			if (command && command !== 'undefined' && command !== null){
				if (command !== 'get' && command !== 'set' && command !== 'convert' && command !== 'replace'){
					value = label; label = command; command = 'get';
					if (value && value !== 'undefined'){ command = 'set'; }
				}
			}

			if (command && command !== 'undefined' && (!label || label == 'undefined')){ label = command; command = 'get'; }
			if (!command || command == 'undefined' || command === null){ command = "get";	}
			if (!label || label == 'undefined' || label === null){ label = "";		}
			if (!value || value == 'undefined' || value === null){ value = "";			}

			if (typeof(obj) === 'string'){ 			type = 'string';
			}else if (typeof(obj) === 'object'){ 	type = 'object'; 	if ($.isArray(obj)){ type = "array"; }
			}else if (typeof(obj) === 'numeric'){ 	type = 'integer'; 	if (obj !== parseInt(obj)){ type = 'decimal'; }
			}else if (typeof(obj) === 'function'){ 	type = 'function';
			}

			objFull.value = ''; if (obj.val){ objFull.value = obj.val(); }
			objFull.type = type;
			objFull.innerhtml = ''; if (obj.html){ objFull.innerhtml = obj.html(); }
			objFull.outerhtml = obj.wrap('<div>').parent().html(); obj.unwrap();

			var atts = []; if (obj[0] && obj[0].attributes){ atts = obj[0].attributes; }
			if (atts.length > 0){
				objFull.attributes = {};
				for (var att, i = 0, atts = obj[0].attributes, n = atts.length; i < n; i++){
					objFull.attributes[atts[i].nodeName] = (atts[i].nodeValue);
				}
				if (!objFull.attributes.style || objFull.attributes.style == 'undefined'){ objFull.attributes.style = ''; }
			}

			var ret = objFull;
			if (label && label !== 'undefined'){
				ret = objFull[label];
				if (!ret || ret == 'undefined'){ 	ret = objFull.attributes[label]; }
				if (!ret || ret == 'undefined'){ 	ret = ''; }
			}

			if (command === 'set'){
				ret = '';
				if (objFull[label] && objFull[label] !== 'undefined'){
					objFull[label] = value;
					if (label === 'innerhtml'){ 	obj.html(value);
					}else if (label === 'value'){ 	obj.val(value);
					}
					ret = objFull[label];
				}
				if (ret == '' && objFull.attributes && objFull.attributes[label] && objFull.attributes[label] !== 'undefined'){
					objFull.attributes[label] = value;
					obj.attr(label,value);
					ret = objFull.attributes[label];
				}
				if (ret == ''){
					objFull[label] = value;
					obj.prop(label,value);
					obj.attr(label,value);
					ret = objFull[label];
				}
			}
			return ret;
		};

	}
}( jQuery ));


text:
package org.apereo.cas.util.junit;

import org.apereo.cas.util.SocketUtils;

import lombok.val;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.platform.commons.support.AnnotationSupport;

import java.lang.reflect.AnnotatedElement;

/**
 * This is {@link EnabledIfPortOpenCondition}.
 *
 * @author Timur Duehr
 * @since 6.1.0
 */
public class EnabledIfPortOpenCondition implements ExecutionCondition {
    private static final ConditionEvaluationResult ENABLED_BY_DEFAULT = ConditionEvaluationResult.enabled("@EnabledIfPortOpen is not present");
    @Override
    public ConditionEvaluationResult evaluateExecutionCondition(final ExtensionContext extensionContext) {
        val element = extensionContext
            .getElement()
            .orElseThrow(IllegalStateException::new);
        return AnnotationSupport.findAnnotation(element, EnabledIfPortOpen.class)
            .map(annotation -> enableIfOpen(annotation, element))
            .orElse(ENABLED_BY_DEFAULT);
    }

    private static ConditionEvaluationResult enableIfOpen(final EnabledIfPortOpen annotation, final AnnotatedElement element) {
        val port = annotation.port();
        if (port <= 0) {
            throw new IllegalArgumentException("Port must be positive.");
        }
        if (SocketUtils.isTcpPortAvailable(port)) {
            return ConditionEvaluationResult.disabled(String.format("%s is disabled because %s is not in use", element, port));
        }
        return ConditionEvaluationResult.enabled(String.format("%s is enabled because %s is open.", element, port));
    }
}


text:
=======
Credits
=======

Development Lead
----------------

* A. Mert Kara <amertkara@gmail.com>

Contributors
------------

None yet. Why not be the first?


text:
<resources>

    <color name="moma_color_blue">#6863b1</color>
    <color name="moma_color_darkblue">#262c8d</color>
    <color name="moma_color_red">#931a18</color>
    <color name="moma_color_pink">#c3458d</color>
    <color name="moma_color_white">#dcdcdc</color>
    <color name="black">#000000</color>

    <style name="MOMABlue">
        <item name="android:textColor">@color/moma_color_white</item>
        <item name="android:background">@color/moma_color_blue</item>
    </style>

    <style name="MOMAAlert" parent="android:Theme.Material.Dialog.Alert">
        <item name="android:colorAccent">@color/moma_color_white</item>
        <item name="android:background">@color/moma_color_blue</item>
    </style>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:colorPrimary">@color/moma_color_blue</item>
        <item name="android:colorPrimaryDark">@color/moma_color_darkblue</item>
        <item name="android:colorAccent">@color/moma_color_pink</item>
        <item name="android:textColorPrimary">@color/moma_color_white</item>
        <item name="android:windowBackground">@color/black</item>

        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="actionBarStyle">@style/MyActionBar</item>
    </style>

    <!-- general styles for the action bar -->
    <style name="MyActionBar"
        parent="@style/Widget.AppCompat.ActionBar">
        <item name="android:titleTextStyle">@style/TitleTextStyle</item>
        <item name="android:background">@color/moma_color_blue</item>
        <item name="android:backgroundStacked">@color/moma_color_blue</item>
        <item name="android:backgroundSplit">@color/moma_color_blue</item>

        <!-- Support library compatibility -->
        <item name="titleTextStyle">@style/TitleTextStyle</item>
        <item name="background">@color/moma_color_blue</item>
        <item name="backgroundStacked">@color/moma_color_blue</item>
        <item name="backgroundSplit">@color/moma_color_blue</item>

    </style>

    <!-- action bar title text -->
    <style name="TitleTextStyle"
        parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/moma_color_white</item>
    </style>

</resources>


text:
class TileEnvironment_Tests : public ::testing::Test {
protected:

    virtual void TearDown() {

    }
    TileEnvironment *environment = new TileEnvironment;
};

TEST_F(TileEnvironment_Tests, add_Several_Entities) {
    environment->add(new Agent(), new TileLocation(0,0));//adding to corner
    EXPECT_EQ(environment->getEntities().size(),1);
    environment->add(new Agent(), new TileLocation(4,4));
    EXPECT_EQ(environment->getEntities().size(),2);
    environment->add(new Agent(), new TileLocation(4,4)); //adding to same tile
    EXPECT_EQ(environment->getEntities().size(),3);
}
#endif


text:
{{{
  "title": "CenturyLink Cloud Feature Availability Matrix",
  "date": "1-12-2017",
  "author": "Chris Little",
  "attachments": [],
  "contentIsHTML": false
}}}

### Overview

The CenturyLink Cloud provides a vast array of services for customers to consume on-demand and in a self-service fashion.  This matrix is designed to provide a single resource to review availability of **location specific** CenturyLink Cloud services on a global scale.

### Exceptions

* Only location specific services are provided in this matrix.  For a full list of CenturyLink Cloud services and features [visit our public website](//www.ctl.io)

### Availability Matrix

**Feature**|**Availability**
-----------|----------------
[Hyperscale Computing](//www.ctl.io/hyperscale)|US West (Santa Clara) - UC1
US Central (Chicago) - IL1
US East (New York) - NY1
US East (Sterling) - VA1
Great Britain (Slough) - GB3
Canada (Toronto - Mississauga) - CA3
APAC (Singapore) - SG1
[Bare Metal](//www.ctl.io/bare-metal)|US East (New York) - NY1
US East (Sterling) - VA1
APAC (Australia - Sydney) - AU1
Canada (Vancouver) - CA1
Great Britain (Slough) - GB3
[AppFog](//www.ctl.io/appfog)|US East1
US West1
[Relational DB - MySQL-compatible](//www.ctl.io/relational-database)|US West (Santa Clara) - UC1
US Central (Chicago) - IL1
US East (Sterling) - VA1
US East (New York) - NY1
Canada (Toronto - Mississauga) - CA3
Great Britain (Slough) - GB3
APAC (Singapore) - SG1
[Load Balancer as a Service (LBaaS)](//www.ctl.io/load-balancing/)|US West (Santa Clara) - UC1
US East (Sterling) - VA1
Canada (Toronto - Mississauga) - CA3
Great Britain (Slough) - GB3
APAC (Singapore) - SG1
[Managed Operating System Services](//www.ctl.io/managed-services/operating-system)|US West (Santa Clara) - UC1
US East (Sterling) - VA1
US Central (Chicago) - IL1
Great Britain (Slough) - GB3
Canada (Toronto - Mississauga) - CA3
APAC (Singapore) - SG1
[Managed Applications](//www.ctl.io/managed-services)|US West (Santa Clara) - UC1
US East (Sterling) - VA1
US Central (Chicago) - IL1
Great Britain (Slough) - GB3
Canada (Toronto - Mississauga) - CA3
APAC (Singapore) - SG1
[Managed Backup](//www.ctl.io/managed-services/backup)|US West (Santa Clara) - UC1
US Central (Chicago) - IL1
US East (Sterling) - VA1
Great Britain (Slough) - GB3
APAC (Singapore) - SG1
Canada (Toronto - Mississauga) - CA3
[Cloud Network Services](//www.ctl.io/blog/post/use-cloud-network-service-for-making-hybrid-cloud-a-reality)|US West (Seattle) - WA1
US West (Santa Clara) - UC1
US Central (Chicago) - IL1
US East (New York) - NY1
US East (Sterling) - VA1
Great Britain (Portsmouth) - GB1
Great Britain (Slough) - GB3
Canada (Toronto - Mississauga) - CA3
Germany (Frankfurt) - DE1
APAC (Singapore) - SG1
[Object Storage](//www.ctl.io/object-storage)|Canada Region1
US East1
[Orchestrate](//orchestrate.io)|US West (Santa Clara) - UC1
US East (Sterling) - VA1
US East (New York) - NY1
Great Britain (Slough) - GB3
APAC (Singapore) - SG1

1.  **Service is delivered by Region but is accessible as a public service globally**


text:
@implementation NWWrappedView {
    CGFloat _spacing;
    BOOL _centered;
    CGFloat _width;
    CGFloat _height;
}

- (void)setSpacing:(NSString*)spacing {
    _spacing = [spacing floatValue];
}

- (void)setCentered:(NSString*)centered {
    _centered = [centered boolValue];
}

- (void)positionViews:(NSArray*)views x:(CGFloat)x y:(CGFloat)y {
    CGFloat xOffset = 0;
    if (_centered) {
        CGFloat totalWidth = 0;

        for (UIView *view in views) {
            totalWidth += view.frame.size.width;
        }
        totalWidth += (views.count - 1) * _spacing;
        xOffset = (self.frame.size.width - totalWidth) / 2;
    }
    for (UIView *view in views) {
        CGRect frame = view.frame;
        frame.origin.x = x + xOffset;
        frame.origin.y = y;
        view.frame = frame;
        x += frame.size.width + _spacing;
    }
}

- (CGSize)sizeThatFits:(CGSize)size {
    [self layoutSubviews];
    return CGSizeMake(_width, _height);
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat width = self.frame.size.width;
    _width = width;
    CGFloat x = 0;
    CGFloat y = 0;
    CGFloat maxHeight = 0;
    NSMutableArray *row = [NSMutableArray array];
    for (UIView *subview in self.subviews) {
        CGRect frame = subview.frame;
        if (x + frame.size.width > width && row.count > 0) {
            [self positionViews:row x:0 y:y];
            y += maxHeight + _spacing;
            x = 0;
            maxHeight = 0;
            [row removeAllObjects];
        }
        maxHeight = fmax(frame.size.height, maxHeight);
        [row addObject:subview];
        x += frame.size.width + _spacing;
    }
    if (row.count > 0) {
        [self positionViews:row x:0 y:y];
        y += maxHeight;
    }
    _height = y;
}

@end


text:
<?php

declare(strict_types=1);

namespace Nucleos\LastFm\Crawler;

use Nucleos\LastFm\Exception\CrawlException;
use Nucleos\LastFm\Model\EventInfo;

interface EventInfoCrawlerInterface
{
    /**
     * Get all event information.
     *
     * @throws CrawlException
     */
    public function getEventInfo(int $id): ?EventInfo;
}


text:
package com.theoryinpractice.testng.inspection;

import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionManager;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.util.PsiElementFilter;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import com.theoryinpractice.testng.util.TestNGUtil;

/**
 * @author Hani Suleiman Date: Aug 3, 2005 Time: 3:34:56 AM
 */
public class JUnitConvertTool extends BaseJavaLocalInspectionTool {

  private static final Logger LOG = Logger.getInstance("TestNG QuickFix");
  private static final String DISPLAY_NAME = "Convert JUnit Tests to TestNG";
  public static final String QUICKFIX_NAME = "Convert TestCase to TestNG";

  @NotNull
  @Override
  public String getGroupDisplayName() {
    return "TestNG";
  }

  @NotNull
  @Override
  public String getDisplayName() {
    return DISPLAY_NAME;
  }

  @NotNull
  @Override
  public String getShortName() {
    return "JUnitTestNG";
  }

  @Override
  @Nullable
  public ProblemDescriptor[] checkClass(@NotNull PsiClass psiClass, @NotNull InspectionManager manager, boolean isOnTheFly) {
    if (TestNGUtil.inheritsJUnitTestCase(psiClass) || TestNGUtil.containsJunitAnnotations(psiClass)) {
      final PsiIdentifier nameIdentifier = psiClass.getNameIdentifier();
      ProblemDescriptor descriptor = manager.createProblemDescriptor(nameIdentifier != null ? nameIdentifier : psiClass, "TestCase can be converted to TestNG",
                                                                     new JUnitConverterQuickFix(),
                                                                     ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly);
      return new ProblemDescriptor[]{descriptor};
    }
    return null;
  }

  public static class JUnitConverterQuickFix implements LocalQuickFix {

    @NotNull
    public String getName() {
      return QUICKFIX_NAME;
    }

     @NotNull
    public String getFamilyName() {
      return getName();
    }

    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
      if (!FileModificationService.getInstance().preparePsiElementForWrite(descriptor.getPsiElement())) return;
      final PsiClass psiClass = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiClass.class);
      if (!TestNGUtil.checkTestNGInClasspath(psiClass)) return;
      try {
        final PsiManager manager = PsiManager.getInstance(project);
        final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
        final PsiJavaFile javaFile = (PsiJavaFile)psiClass.getContainingFile();

        for (PsiMethod method : psiClass.getMethods()) {
          if (method.isConstructor()) {
            convertJUnitConstructor(method);
          }
          else {
            if (!javaFile.getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) {
              addMethodJavadoc(factory, method);
            }
            else {
              if (TestNGUtil.containsJunitAnnotations(method)) {
                convertJunitAnnotions(factory, method);
              }
              addMethodAnnotations(factory, method);
            }
          }

          final PsiMethodCallExpression[] methodCalls = getTestCaseCalls(method);
          for (PsiMethodCallExpression methodCall : methodCalls) {
            PsiMethod assertMethod = methodCall.resolveMethod();
            if (assertMethod == null) {
              continue;
            }
            PsiAssertStatement assertStatement = null;
            @NonNls String methodName = assertMethod.getName();
            PsiExpression[] expressions = methodCall.getArgumentList().getExpressions();
            final PsiStatement methodCallStatement = PsiTreeUtil.getParentOfType(methodCall, PsiStatement.class);
            LOG.assertTrue(methodCallStatement != null);
            if ("assertTrue".equals(methodName) || "assertFalse".equals(methodName)) {
              if (expressions.length == 1) {
                assertStatement = createAssert(factory, null, methodCall);
                final PsiExpression assertCondition = assertStatement.getAssertCondition();
                LOG.assertTrue(assertCondition != null);
                assertCondition.replace(expressions[0]);
              }
              else if (expressions.length == 2) {
                assertStatement = createAssert(factory, expressions[0], methodCall);
                final PsiExpression assertCondition = assertStatement.getAssertCondition();
                LOG.assertTrue(assertCondition != null);
                assertCondition.replace(expressions[1]);
              }

              if ("assertFalse".equals(methodName) && assertStatement != null) {
                PsiExpression assertCondition = assertStatement.getAssertCondition();
                LOG.assertTrue(assertCondition != null);
                assertCondition.replace(factory.createExpressionFromText("!(" + assertCondition.getText() + ')',
                                                                         PsiTreeUtil.getParentOfType(assertCondition,
                                                                                PsiMethodCallExpression.class)));
              }
            }
            else if ("assertNull".equals(methodName) || "assertNotNull".equals(methodName)) {
              String operator = "assertNull".equals(methodName) ? "==" : "!=";
              if (expressions.length == 1) {
                assertStatement = createAssert(factory, null, methodCall);
                PsiExpression expression =
                  factory.createExpressionFromText(expressions[0].getText() + ' ' + operator + " null", assertStatement);
                final PsiExpression assertCondition = assertStatement.getAssertCondition();
                LOG.assertTrue(assertCondition != null);
                assertCondition.replace(expression);
              }
              else if (expressions.length == 2) {
                assertStatement = createAssert(factory, expressions[0], methodCall.getParent());
                PsiExpression expression =
                  factory.createExpressionFromText(expressions[1].getText() + ' ' + operator + " null", assertStatement);
                final PsiExpression assertCondition = assertStatement.getAssertCondition();
                LOG.assertTrue(assertCondition != null);
                assertCondition.replace(expression);
              }
            }
            else if ("fail".equals(methodName)) {
              if (expressions.length == 0) {
                assertStatement = createAssert(factory, null, methodCall);
              }
              else if (expressions.length == 1) {
                assertStatement = createAssert(factory, expressions[0], methodCall);
              }
            }
            else {
              //if it's a 3 arg, the error message goes at the end
              PsiElement inserted = null;
              if (expressions.length == 2) {
                inserted = methodCallStatement
                  .replace(factory.createStatementFromText("org.testng.Assert." + methodCall.getText() + ";", methodCall.getParent()));
              }
              else if (expressions.length == 3) {
                @NonNls String call = "org.testng.Assert." + methodName + '(' + expressions[2].getText() + ", " + expressions[1].getText() +
                                      ", " + expressions[0].getText() + ");";
                inserted = methodCallStatement.replace(factory.createStatementFromText(call, methodCall.getParent()));
              }
              if (inserted != null) {
                JavaCodeStyleManager.getInstance(project).shortenClassReferences(inserted);
              }
            }
            if (assertStatement != null) {
              methodCallStatement.replace(assertStatement);
            }
          }
        }
        final PsiClass superClass = psiClass.getSuperClass();
        if (superClass != null && "junit.framework.TestCase".equals(superClass.getQualifiedName())) {
          final PsiReferenceList extendsList = psiClass.getExtendsList();
          LOG.assertTrue(extendsList != null);
          for (PsiJavaCodeReferenceElement element : extendsList.getReferenceElements()) {
            element.delete();
          }
        }
        JavaCodeStyleManager.getInstance(project).optimizeImports(javaFile);//delete unused imports
      }
      catch (IncorrectOperationException e) {
        LOG.error("Error converting testcase", e);
      }
    }

    private static void convertJunitAnnotions(PsiElementFactory factory, PsiMethod method) throws IncorrectOperationException {
      PsiAnnotation[] annotations = method.getModifierList().getAnnotations();
      for (PsiAnnotation annotation : annotations) {
        PsiAnnotation newAnnotation = null;
        if ("org.junit.Test".equals(annotation.getQualifiedName())) {
          newAnnotation = factory.createAnnotationFromText("@org.testng.annotations.Test", method);
        }
        else if ("org.junit.BeforeClass".equals(annotation.getQualifiedName())) {
          newAnnotation = factory.createAnnotationFromText("@org.testng.annotations.BeforeClass", method);
        }
        else if ("org.junit.Before".equals(annotation.getQualifiedName())) {
          newAnnotation = factory.createAnnotationFromText("@org.testng.annotations.BeforeMethod", method);
        }
        else if ("org.junit.AfterClass".equals(annotation.getQualifiedName())) {
          newAnnotation = factory.createAnnotationFromText("@org.testng.annotations.AfterClass", method);
        }
        else if ("org.junit.After".equals(annotation.getQualifiedName())) {
          newAnnotation = factory.createAnnotationFromText("@org.testng.annotations.AfterMethod", method);
        }
        if (newAnnotation != null) {
          JavaCodeStyleManager.getInstance(annotation.getProject()).shortenClassReferences(annotation.replace(newAnnotation));
        }
      }
    }

    private static void convertJUnitConstructor(PsiMethod method) {
      method.accept(new JavaRecursiveElementWalkingVisitor() {

        @Override
        public void visitExpressionStatement(PsiExpressionStatement statement) {
          PsiExpression expression = statement.getExpression();
          if (expression instanceof PsiMethodCallExpression) {
            PsiMethodCallExpression methodCall = (PsiMethodCallExpression)expression;
            if (methodCall.getArgumentList().getExpressions().length == 1) {
              PsiMethod resolved = methodCall.resolveMethod();
              if (resolved != null && "junit.framework.TestCase".equals(resolved.getContainingClass().getQualifiedName()) &&
                  "TestCase".equals(resolved.getName())) {
                try {
                  statement.delete();
                }
                catch (IncorrectOperationException e) {
                  LOG.error(e);
                }
              }
            }
          }
        }
      });
    }

    private static PsiMethodCallExpression[] getTestCaseCalls(PsiMethod method) {
      PsiElement[] methodCalls = PsiTreeUtil.collectElements(method, new PsiElementFilter() {
        public boolean isAccepted(PsiElement element) {
          if (!(element instanceof PsiMethodCallExpression)) return false;
          final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)element;
          final PsiMethod method = methodCall.resolveMethod();
          return method != null && "junit.framework.Assert".equals(method.getContainingClass().getQualifiedName());
        }
      });
      PsiMethodCallExpression[] expressions = new PsiMethodCallExpression[methodCalls.length];
      System.arraycopy(methodCalls, 0, expressions, 0, methodCalls.length);
      return expressions;
    }

    private static void addMethodJavadoc(PsiElementFactory factory, PsiMethod method) throws IncorrectOperationException {
      if (method.getName().startsWith("test")) {
        addMethodJavadocLine(factory, method, " * @testng.test");
      }
      else if ("setUp".equals(method.getName()) && method.getParameterList().getParameters().length == 0) {
        addMethodJavadocLine(factory, method, " * @testng.before-test");
      }
      else if ("tearDown".equals(method.getName()) && method.getParameterList().getParameters().length == 0) {
        addMethodJavadocLine(factory, method, " * @testng.after-test");
      }
    }

    private static void addMethodJavadocLine(PsiElementFactory factory, PsiMethod method, @NonNls String javaDocLine)
      throws IncorrectOperationException {
      PsiComment newComment;
      PsiElement comment = method.getFirstChild();
      if (comment != null && comment instanceof PsiComment) {
        String[] commentLines = comment.getText().split("\n");
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < commentLines.length; i++) {
          String commentLine = commentLines[i];
          // last line, append our new comment entry
          if (i == commentLines.length - 1) {
            buf.append(javaDocLine);
            buf.append(commentLine);
          }
          else {
            buf.append(commentLine);
            buf.append('\n');
          }
        }
        String commentString = buf.toString();

        newComment = factory.createCommentFromText(commentString, null);
        comment.replace(newComment);

      }
      else {
        String commentString;

        StringBuffer commentBuffer = new StringBuffer();
        commentBuffer.append("/**\n");
        commentBuffer.append(javaDocLine);
        commentBuffer.append('\n');
        commentBuffer.append(" */");

        commentString = commentBuffer.toString();
        newComment = factory.createCommentFromText(commentString, null);

        method.addBefore(newComment, comment);
      }
    }

    private static void addMethodAnnotations(PsiElementFactory factory, PsiMethod method) throws IncorrectOperationException {
      PsiAnnotation annotation = null;
      if (method.getName().startsWith("test")) {
        annotation = factory.createAnnotationFromText("@org.testng.annotations.Test", method);
      }
      else if ("setUp".equals(method.getName()) && method.getParameterList().getParameters().length == 0) {
        annotation = factory.createAnnotationFromText("@org.testng.annotations.BeforeMethod", method);
      }
      else if ("tearDown".equals(method.getName()) && method.getParameterList().getParameters().length == 0) {
        annotation = factory.createAnnotationFromText("@org.testng.annotations.AfterMethod", method);
      }
      if (annotation != null) {
        JavaCodeStyleManager.getInstance(annotation.getProject()).shortenClassReferences(method.getModifierList().addAfter(annotation, null));
      }
    }

    private static PsiAssertStatement createAssert(PsiElementFactory factory, PsiExpression description, PsiElement context)
      throws IncorrectOperationException {
      PsiAssertStatement assertStatement;
      if (description == null) {
        assertStatement = (PsiAssertStatement)factory.createStatementFromText("assert false;", context.getParent());
        return assertStatement;
      }
      else {
        assertStatement = (PsiAssertStatement)factory.createStatementFromText("assert false : \"x\";", context.getParent());
        final PsiExpression assertDescription = assertStatement.getAssertDescription();
        assert assertDescription != null;
        assertDescription.replace(description);
      }
      return assertStatement;
    }
  }
}


text:
package com.wwr.locationselect;

import java.util.ArrayList;
import java.util.List;

import com.wwr.clock.A;
import com.wwr.clock.B;
import com.wwr.clock.R;
import android.app.Activity;
import android.app.LocalActivityManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;

public class PagerActivity extends Activity {

	Context context = null;
	LocalActivityManager manager = null;
	ViewPager pager = null;
	TabHost tabHost = null;
	TextView t1, t2, t3;

	private int offset = 0;
	private int currIndex = 0;
	private int bmpW;
	private ImageView cursor, imageview;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.xml);
		context = PagerActivity.this;
		manager = new LocalActivityManager(this, true);
		manager.dispatchCreate(savedInstanceState);
		imageview = (ImageView) findViewById(R.id.imgback);
		imageview.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		InitImageView();
		initTextView();
		initPagerViewer();

	}

	/**
	 * 锟斤拷始锟斤拷锟斤拷锟斤拷
	 */
	private void initTextView() {
		t1 = (TextView) findViewById(R.id.text1);
		t2 = (TextView) findViewById(R.id.text2);

		t1.setOnClickListener(new MyOnClickListener(0));
		t2.setOnClickListener(new MyOnClickListener(1));

	}

	/**
	 * 锟斤拷始锟斤拷PageViewer
	 */
	private void initPagerViewer() {
		pager = (ViewPager) findViewById(R.id.viewpage);
		final ArrayList<View> list = new ArrayList<View>();
		Intent intent = new Intent(context, A.class);
		list.add(getView("A", intent));
		Intent intent2 = new Intent(context, B.class);
		list.add(getView("B", intent2));
		pager.setAdapter(new MyPagerAdapter(list));
		pager.setCurrentItem(0);
		pager.setOnPageChangeListener(new MyOnPageChangeListener());
	}

	/**
	 * 锟斤拷始锟斤拷锟斤拷锟斤拷
	 */
	private void InitImageView() {
		cursor = (ImageView) findViewById(R.id.cursor);
		bmpW = BitmapFactory.decodeResource(getResources(), R.drawable.roller).getWidth();// 锟斤拷取图片锟斤拷锟�
		DisplayMetrics dm = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(dm);
		int screenW = dm.widthPixels;// 锟斤拷取锟街憋拷锟绞匡拷锟�
		offset = (screenW / 3 - bmpW) / 2;// 锟斤拷锟斤拷偏锟斤拷锟斤拷
		Matrix matrix = new Matrix();
		matrix.postTranslate(offset, 0);
		cursor.setImageMatrix(matrix);// 锟斤拷锟矫讹拷锟斤拷锟斤拷始位锟斤拷
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	/**
	 * 通锟斤拷activity锟斤拷取锟斤拷图
	 *
	 * @param id
	 * @param intent
	 * @return
	 */
	private View getView(String id, Intent intent) {
		return manager.startActivity(id, intent).getDecorView();
	}

	/**
	 * Pager锟斤拷锟斤拷锟斤拷
	 */
	public class MyPagerAdapter extends PagerAdapter {
		List<View> list = new ArrayList<View>();
		public MyPagerAdapter(ArrayList<View> list) {
			this.list = list;
		}

		@Override
		public void destroyItem(ViewGroup container, int position, Object object) {
			ViewPager pViewPager = ((ViewPager) container);
			pViewPager.removeView(list.get(position));
		}

		@Override
		public boolean isViewFromObject(View arg0, Object arg1) {
			return arg0 == arg1;
		}

		@Override
		public int getCount() {
			return list.size();
		}

		@Override
		public Object instantiateItem(View arg0, int arg1) {
			ViewPager pViewPager = ((ViewPager) arg0);
			pViewPager.addView(list.get(arg1));
			return list.get(arg1);
		}

		@Override
		public void restoreState(Parcelable arg0, ClassLoader arg1) {

		}

		@Override
		public Parcelable saveState() {
			return null;
		}

		@Override
		public void startUpdate(View arg0) {
		}
	}

	/**
	 * 页锟斤拷锟叫伙拷锟斤拷锟斤拷
	 */
	public class MyOnPageChangeListener implements OnPageChangeListener {

		int one = offset * 2 + bmpW;// 页锟斤拷1 -> 页锟斤拷2 偏锟斤拷锟斤拷
		int two = one * 2;// 页锟斤拷1 -> 页锟斤拷3 偏锟斤拷锟斤拷

		@Override
		public void onPageSelected(int arg0) {
			Animation animation = null;
			switch (arg0) {
			case 0:
				if (currIndex == 1) {
					animation = new TranslateAnimation(one, 0, 0, 0);
				} else if (currIndex == 2) {
					animation = new TranslateAnimation(two, 0, 0, 0);
				}
				break;
			case 1:
				if (currIndex == 0) {
					animation = new TranslateAnimation(offset, one, 0, 0);
				} else if (currIndex == 2) {
					animation = new TranslateAnimation(two, one, 0, 0);
				}
				break;
			case 2:
				if (currIndex == 0) {
					animation = new TranslateAnimation(offset, two, 0, 0);
				} else if (currIndex == 1) {
					animation = new TranslateAnimation(one, two, 0, 0);
				}
				break;
			}
			currIndex = arg0;
			animation.setFillAfter(true);// True:图片停锟节讹拷锟斤拷锟斤拷锟斤拷位锟斤拷
			animation.setDuration(300);
			cursor.startAnimation(animation);
		}

		@Override
		public void onPageScrollStateChanged(int arg0) {

		}

		@Override
		public void onPageScrolled(int arg0, float arg1, int arg2) {

		}
	}

	/**
	 * 头锟斤拷锟斤拷锟斤拷锟斤拷
	 */
	public class MyOnClickListener implements View.OnClickListener {
		private int index = 0;

		public MyOnClickListener(int i) {
			index = i;
		}

		@Override
		public void onClick(View v) {
			pager.setCurrentItem(index);
		}
	};
}