text:
package org.apache.qpid.protonj2.codec.encoders;

import org.apache.qpid.protonj2.buffer.ProtonBuffer;
import org.apache.qpid.protonj2.codec.EncodeException;
import org.apache.qpid.protonj2.codec.EncoderState;
import org.apache.qpid.protonj2.codec.EncodingCodes;

/**
 * Base class used for all Described Type objects that are represented as a List
 *
 * @param <V> the type that is being encoded
 */
public abstract class AbstractDescribedListTypeEncoder<V> extends AbstractDescribedTypeEncoder<V> {

    /**
     * Determine the list type the given value can be encoded to based on the number
     * of bytes that would be needed to hold the encoded form of the resulting list
     * entries.
     * <p>
     * Most encoders will return LIST32 but for cases where the type is known to
     * be encoded to LIST8 or always encodes an empty list (LIST0) the encoder can
     * optimize the encode step and not compute sizes.
     *
     * @param value
     *      The value that is to be encoded.
     *
     * @return the encoding code of the list type encoding needed for this object.
     */
    public byte getListEncoding(V value) {
        return EncodingCodes.LIST32;
    }

    /**
     * Instructs the encoder to write the element identified with the given index
     *
     * @param source
     *      the source of the list elements to write
     * @param index
     *      the element index that needs to be written
     * @param buffer
     *      the buffer to write the element to
     * @param state
     *      the current EncoderState value to use.
     */
    public abstract void writeElement(V source, int index, ProtonBuffer buffer, EncoderState state);

    /**
     * Gets the number of elements that will result when this type is encoded
     * into an AMQP List type.
     *
     * @param value
     *      the value which will be encoded as a list type.
     *
     * @return the number of elements that should comprise the encoded list.
     */
    public abstract int getElementCount(V value);

    /**
     * Return the minimum number of elements that this AMQP type must provide
     * in order to be considered a valid type.
     *
     * @return the minimum number of elements this type must provide.
     */
    public int getMinElementCount() {
        return 0;
    }

    @Override
    public void writeType(ProtonBuffer buffer, EncoderState state, V value) {
        buffer.writeByte(EncodingCodes.DESCRIBED_TYPE_INDICATOR);
        state.getEncoder().writeUnsignedLong(buffer, state, getDescriptorCode().byteValue());

        final int count = getElementCount(value);
        final byte encodingCode = getListEncoding(value);

        if (count < getMinElementCount()) {
            throw new EncodeException("Incomplete Type cannot be encoded");
        }

        buffer.writeByte(encodingCode);

        switch (encodingCode) {
            case EncodingCodes.LIST8:
                writeSmallType(buffer, state, value, count);
                break;
            case EncodingCodes.LIST32:
                writeLargeType(buffer, state, value, count);
                break;
        }
    }

    private void writeSmallType(ProtonBuffer buffer, EncoderState state, V value, int elementCount) {
        final int startIndex = buffer.getWriteIndex();

        // Reserve space for the size and write the count of list elements.
        buffer.writeByte((byte) 0);
        buffer.writeByte((byte) elementCount);

        // Write the list elements and then compute total size written.
        for (int i = 0; i < elementCount; ++i) {
            writeElement(value, i, buffer, state);
        }

        // Move back and write the size
        final int writeSize = buffer.getWriteIndex() - startIndex - Byte.BYTES;

        buffer.setByte(startIndex, writeSize);
    }

    private void writeLargeType(ProtonBuffer buffer, EncoderState state, V value, int elementCount) {
        final int startIndex = buffer.getWriteIndex();

        // Reserve space for the size and write the count of list elements.
        buffer.writeInt(0);
        buffer.writeInt(elementCount);

        // Write the list elements and then compute total size written.
        for (int i = 0; i < elementCount; ++i) {
            writeElement(value, i, buffer, state);
        }

        // Move back and write the size
        final int writeSize = buffer.getWriteIndex() - startIndex - Integer.BYTES;

        buffer.setInt(startIndex, writeSize);
    }

    @Override
    public void writeArray(ProtonBuffer buffer, EncoderState state, Object[] values) {
        // Write the Array Type encoding code, we don't optimize here.
        buffer.writeByte(EncodingCodes.ARRAY32);

        final int startIndex = buffer.getWriteIndex();

        // Reserve space for the size and write the count of list elements.
        buffer.writeInt(0);
        buffer.writeInt(values.length);

        buffer.writeByte(EncodingCodes.DESCRIBED_TYPE_INDICATOR);
        state.getEncoder().writeUnsignedLong(buffer, state, getDescriptorCode());

        writeRawArray(buffer, state, values);

        // Move back and write the size
        final int writeSize = buffer.getWriteIndex() - startIndex - Integer.BYTES;

        if (writeSize > Integer.MAX_VALUE) {
            throw new IllegalArgumentException("Cannot encode given array, encoded size to large: " + writeSize);
        }

        buffer.setInt(startIndex, writeSize);
    }

    @SuppressWarnings("unchecked")
    @Override
    public void writeRawArray(ProtonBuffer buffer, EncoderState state, Object[] values) {
        buffer.writeByte(EncodingCodes.LIST32);

        for (int i = 0; i < values.length; ++i) {
            final V listType = (V) values[i];
            final int count = getElementCount(listType);
            final int elementStartIndex = buffer.getWriteIndex();

            // Reserve space for the size and write the count of list elements.
            buffer.writeInt(0);
            buffer.writeInt(count);

            // Write the list elements and then compute total size written.
            for (int j = 0; j < count; ++j) {
                writeElement(listType, j, buffer, state);
            }

            // Move back and write the size
            final int listWriteSize = buffer.getWriteIndex() - elementStartIndex - Integer.BYTES;

            buffer.setInt(elementStartIndex, listWriteSize);
        }
    }
}


text:
namespace perfetto::protos::pbzero {
class SiteInstance;
}  // namespace perfetto::protos::pbzero

namespace content {
class BrowserContext;
class RenderProcessHost;
class StoragePartitionConfig;

using SiteInstanceId = base::IdType32<class SiteInstanceIdTag>;

///////////////////////////////////////////////////////////////////////////////
// SiteInstance interface.
//
// In an ideal sense, a SiteInstance represents a group of documents and workers
// that can share memory with each other, and thus must live in the same
// renderer process. In the spec, this roughly corresponds to an agent cluster.
// Documents that are able to synchronously script each other will always be
// placed in the same SiteInstance.
//
// A document's SiteInstance is determined by a combination of where the
// document comes from (i.e., a principal based on its "site") and which frames
// have references to it (i.e., the browsing context group, or "instance"). The
// site part groups together documents that can script each other, while the
// instance part allows independent copies of such documents to safely live in
// different processes.
//
// The principal is usually based on the site of the document's URL: the scheme
// and "registrable domain" (i.e., eTLD+1), not the full origin. For example,
// https://dev.chromium.org would have a site of https://chromium.org. This
// preserves compatibility with document.domain modifications, which allow
// similar origin pages to script each other. (Note that there are many
// exceptions, and the policy for determining site URLs is complex.) Meanwhile,
// an "instance" is represented by the BrowsingInstance class, which includes
// all frames that can find each other based on how they were created (e.g.,
// window.open or targeted links).
//
// In practice, a SiteInstance may contain documents from more than a single
// site, usually for compatibility or performance reasons. For example, on
// platforms that do not support out-of-process iframes, cross-site iframes must
// necessarily be loaded in the same process as their parent document. Chrome's
// process model uses SiteInstance as the basic primitive for assigning
// documents to processes, and the process model's behavior is tuned primarily
// by changing how SiteInstance principals (e.g., site URLs) are defined.
//
// Various process models are currently supported:
//
// FULL SITE ISOLATION (the current default for desktop platforms): Every
// document from the web uses a SiteInstance whose process is strictly locked to
// a single site (scheme + eTLD+1), such that the renderer process can be
// prevented from loading documents outside that site. Cross-site navigations
// always change SiteInstances (usually within the same BrowsingInstance,
// although sometimes the BrowsingInstance changes as well). Subframes from
// other sites will use different SiteInstances (always within the same
// BrowsingInstance), and thus out-of-process iframes.
//
// PARTIAL SITE ISOLATION (the current Google Chrome default on most Android
// devices): Documents from sites that are most likely to involve login use
// SiteInstances that are strictly locked to such sites, while one shared
// SiteInstance within each BrowsingInstance is used for the remaining documents
// from other less sensitive sites. This avoids out-of-process iframes in the
// common case for performance reasons, while protecting the sites that are most
// likely to be targeted in attacks.
//
// NO SITE ISOLATION (the current Google Chrome default on low-end Android
// devices and Android WebView): No documents from the web use locked processes,
// and no out-of-process iframes are created. The shared SiteInstance for each
// BrowsingInstance is always used for documents from the web.
//
// In each model, there are many exceptions, such as always requiring locked
// processes for chrome:// URLs, or allowing some special cases to share
// processes with each other (e.g., file:// URLs).
//
// In terms of lifetime, each RenderFrameHost tracks the SiteInstance it is
// associated with, to identify its principal and determine its process. Each
// FrameNavigationEntry also tracks the SiteInstance that rendered it, to
// prevent loading attacker-controlled data into the wrong process on a session
// history navigation. A SiteInstance is jointly owned by these references and
// is only alive as long as it is accessible, either from current documents or
// from session history.
//
///////////////////////////////////////////////////////////////////////////////
class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance> {
 public:
  // Returns a unique ID for this SiteInstance.
  virtual SiteInstanceId GetId() = 0;

  // Returns a unique ID for the BrowsingInstance (i.e., group of related
  // browsing contexts) to which this SiteInstance belongs. This allows callers
  // to identify which SiteInstances can asynchronously script each other.
  virtual BrowsingInstanceId GetBrowsingInstanceId() = 0;

  // Whether this SiteInstance has a running process associated with it.
  // This may return true before the first call to GetProcess(), in cases where
  // we use process-per-site and there is an existing process available.
  virtual bool HasProcess() = 0;

  // Returns the current RenderProcessHost being used to render pages for this
  // SiteInstance.  If there is no RenderProcessHost (because either none has
  // yet been created or there was one but it was cleanly destroyed (e.g. when
  // it is not actively being used), then this method will create a new
  // RenderProcessHost (and a new ID).  Note that renderer process crashes leave
  // the current RenderProcessHost (and ID) in place.
  //
  // For sites that require process-per-site mode (e.g., NTP), this will
  // ensure only one RenderProcessHost for the site exists within the
  // BrowserContext.
  virtual RenderProcessHost* GetProcess() = 0;

  // Browser context to which this SiteInstance (and all related
  // SiteInstances) belongs.
  virtual BrowserContext* GetBrowserContext() = 0;

  // Get the web site that this SiteInstance is rendering pages for. This
  // includes the scheme and registered domain, but not the port.
  //
  // NOTE: In most cases, code should be performing checks against the origin
  // returned by |RenderFrameHost::GetLastCommittedOrigin()|. In contrast, the
  // GURL returned by |GetSiteURL()| should not be considered authoritative
  // because:
  // - a SiteInstance can host pages from multiple sites if "site per process"
  //   is not enabled and the SiteInstance isn't hosting pages that require
  //   process isolation (e.g. WebUI or extensions)
  // - even with site per process, the site URL is not an origin: while often
  //   derived from the origin, it only contains the scheme and the eTLD + 1,
  //   i.e. an origin with the host "deeply.nested.subdomain.example.com"
  //   corresponds to a site URL with the host "example.com".
  virtual const GURL& GetSiteURL() = 0;

  // Get the StoragePartitionConfig used by this SiteInstance.
  virtual const StoragePartitionConfig& GetStoragePartitionConfig() = 0;

  // Gets a SiteInstance for the given URL that shares the current
  // BrowsingInstance, creating a new SiteInstance if necessary.  This ensures
  // that a BrowsingInstance only has one SiteInstance per site, so that pages
  // in a BrowsingInstance have the ability to script each other.
  virtual scoped_refptr<SiteInstance> GetRelatedSiteInstance(
      const GURL& url) = 0;

  // Returns whether the given SiteInstance is in the same BrowsingInstance as
  // this one.  If so, JavaScript interactions that are permitted across
  // origins (e.g., postMessage) should be supported.
  virtual bool IsRelatedSiteInstance(const SiteInstance* instance) = 0;

  // Returns the total active WebContents count for this SiteInstance and all
  // related SiteInstances in the same BrowsingInstance.
  virtual size_t GetRelatedActiveContentsCount() = 0;

  // Returns true if this SiteInstance is for a site that requires a dedicated
  // process. This only returns true under the "site per process" process model.
  virtual bool RequiresDedicatedProcess() = 0;

  // Returns true if this SiteInstance is for a process-isolated origin with its
  // own OriginAgentCluster.
  virtual bool RequiresOriginKeyedProcess() = 0;

  // Return whether this SiteInstance and the provided |url| are part of the
  // same web site, for the purpose of assigning them to processes accordingly.
  // The decision is currently based on the registered domain of the URLs
  // (google.com, bbc.co.uk), as well as the scheme (https, http). This ensures
  // that two pages will be in the same process if they can communicate with
  // other via JavaScript. (e.g., docs.google.com and mail.google.com have DOM
  // access to each other if they both set their document.domain properties to
  // google.com.) Note that if the destination is a blank page, we consider
  // that to be part of the same web site for the purposes for process
  // assignment.
  virtual bool IsSameSiteWithURL(const GURL& url) = 0;

  // Returns true if this object is used for a <webview> guest.
  virtual bool IsGuest() = 0;

  // Returns how this SiteInstance was assigned to a renderer process the most
  // recent time that such an assignment was done. This allows the content
  // embedder to collect metrics on how renderer process starting or reuse
  // affects performance.
  virtual SiteInstanceProcessAssignment GetLastProcessAssignmentOutcome() = 0;

  using TraceProto = perfetto::protos::pbzero::SiteInstance;
  // Write a representation of this object into a trace.
  virtual void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) = 0;

  // Estimates the overhead in terms of process count due to OriginAgentCluster
  // (OAC) SiteInstances in the BrowsingInstance related to this SiteInstance.
  // The estimate is based on counting SiteInstances where OAC is on, and
  // subtracting from it the count of SiteInstances that would exist without
  // OAC. If we assume that we don't coalesce SiteInstances from different
  // BrowsingInstances into a single RenderProcess, this roughly corresponds to
  // the number of renderer processes engendered by OAC.
  virtual int EstimateOriginAgentClusterOverheadForMetrics() = 0;

  // Factory method to create a new SiteInstance.  This will create a new
  // BrowsingInstance, so it should only be used when creating a new tab from
  // scratch (or similar circumstances).
  //
  // The render process host factory may be nullptr.  See SiteInstance
  // constructor.
  static scoped_refptr<SiteInstance> Create(BrowserContext* browser_context);

  // Factory method to get the appropriate SiteInstance for the given URL, in
  // a new BrowsingInstance.  Use this instead of Create when you know the URL,
  // since it allows special site grouping rules to be applied (for example, to
  // obey process-per-site for sites that require it, such as NTP, or to use a
  // default SiteInstance for sites that don't require a dedicated process on
  // Android).
  static scoped_refptr<SiteInstance> CreateForURL(
      BrowserContext* browser_context,
      const GURL& url);

  // Factory method to create a SiteInstance for a <webview> guest in a new
  // BrowsingInstance. A guest requires a non-default StoragePartitionConfig
  // which should be passed in via `partition_config`.
  static scoped_refptr<SiteInstance> CreateForGuest(
      BrowserContext* browser_context,
      const StoragePartitionConfig& partition_config);

  // Determine if a URL should "use up" a site.  URLs such as about:blank or
  // chrome-native:// leave the site unassigned.
  static bool ShouldAssignSiteForURL(const GURL& url);

  // Starts requiring a dedicated process for |url|'s site.  On platforms where
  // strict site isolation is disabled, this may be used as a runtime signal
  // that a certain site should become process-isolated, because its security
  // is important to the user (e.g., if the user has typed a password or logged
  // in via OAuth on that site).  The site will be determined from |url|'s
  // scheme and eTLD+1. If |context| is non-null, the site will be isolated
  // only within that BrowserContext; if |context| is null, the site will be
  // isolated globally for all BrowserContexts. |source| specifies why the new
  // site is being isolated.
  //
  // Note that this has no effect if site isolation is turned off, such as via
  // the kDisableSiteIsolation cmdline flag or enterprise policy -- see also
  // SiteIsolationPolicy::AreDynamicIsolatedOriginsEnabled().
  //
  // The |should_persist| parameter controls whether the site is added
  // *persistently*.  When true (this is the default), this function will ask
  // the embedder to save the site as part of profile data for |context|, so
  // that it survives restarts. The site will be cleared from profile data if
  // the user clears browsing data.  When false, the isolation will last only
  // until the end of the current browsing session.  This is appropriate if the
  // site's persistence is not desired or is managed separately (e.g., sites
  // isolated due to OAuth logins are saved and in another component).
  static void StartIsolatingSite(
      BrowserContext* context,
      const GURL& url,
      ChildProcessSecurityPolicy::IsolatedOriginSource source,
      bool should_persist = true);

 protected:
  friend class base::RefCounted<SiteInstance>;

  SiteInstance() {}
  virtual ~SiteInstance() {}
};

}  // namespace content.

#endif  // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_

redpajama_set_name: RedPajamaGithub


text:
<html>
<body>
<script src="instinct.js"></script>
<script>

i = instinct();

// Define dummy logic.  Dependancies are evaluated based on the parameter arguments of each function.
// No dependancies => parallel execution.  Dependancies are run sequentially.
i.logic.test = function(number,cb) { return cb(number-2) }
i.logic.test2 =function(test,cb) { return setTimeout(function() { cb(test+70) },1000)}
i.logic.test3 = function(test,cb) { return setTimeout(function() { cb(test+90) },2000)}
i.logic.test4 = function(test2,test3,cb) { return setTimeout(function() { cb(test3+test2+100)})}
i.logic.goodtohave = function(test3,cb) { return setTimeout(function() { cb(test3*2)},5000)}

// And add one fact into the mig
i.facts.number = 23

// Let's allow instinct.js to determine optimal evaluation of the following function
i.exec(function(test4,test) {
  alert("RESULTS ARE "+test4+" and "+test)
  i.exec(function(goodtohave) {}) // This prepares goodtohave in case we need it later on
})

// See console logs for a dynamic view of outstanding processes
setInterval(function() { console.log("Processes running: "+JSON.stringify(Object.keys(i.process)))},200)

</script>
</body>
</html>


text:
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.

/* Moved to PlayMake.dll

using System;
using HutongGames.PlayMaker;
using UnityEngine;

/// <summary>
/// Simple container for an Fsm so it can be saved as an asset in the project.
/// This asset can then be pasted into FSMs.
/// TODO: Create a new PlayMakerFSM from FsmTemplate and add to Game Object.
/// </summary>

[Serializable]
public class FsmTemplate : ScriptableObject
{
    [SerializeField]
    private string category;
    public Fsm fsm;

    public string Category
    {
        get { return category; }
        set { category = value; }
    }
}

*/


text:
@implementation Columns (Additon)

@end


text:
package org.jwaf.test.tasks;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Inject;

import org.jwaf.agent.management.AgentManager;
import org.jwaf.agent.persistence.entity.AgentIdentifier;
import org.jwaf.agent.persistence.entity.CreateAgentRequest;
import org.jwaf.message.management.MessageSender;
import org.jwaf.message.persistence.entity.ACLMessage;
import org.jwaf.platform.annotations.resource.LocalPlatformName;
import org.jwaf.task.deployer.TaskDeployer;
import org.jwaf.task.persistence.entity.TaskRequest;

@Stateless
@LocalBean
public class IntegrationTestTask implements TaskDeployer
{
	@Inject
	private AgentManager agentManager;

	@Inject
	MessageSender messageSender;

	@Inject @LocalPlatformName
	private String localPlatformName;

	@Override
	public void deploy(TaskRequest request)
	{
		CreateAgentRequest testCreateReq = new CreateAgentRequest("IntegrationTestAgent");
		AgentIdentifier testAid = agentManager.initialize(testCreateReq);

		ACLMessage testMessage = new ACLMessage("test", new AgentIdentifier(localPlatformName))
			.addReceivers(testAid)
			.setContentAsObject(request);

		messageSender.send(testMessage);
	}
}


text:
package com.google.cloud.bigtable.beam.sequencefiles;

import com.google.cloud.bigtable.hbase.BigtableConfiguration;
import com.google.common.base.Throwables;
import java.util.List;
import java.util.Objects;
import org.apache.beam.sdk.io.BoundedSource.BoundedReader;
import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
import org.apache.beam.sdk.io.FileBasedSource;
import org.apache.beam.sdk.io.FileSystems;
import org.apache.beam.sdk.options.Default;
import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.options.ValueProvider.StaticValueProvider;
import org.apache.beam.sdk.values.KV;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;

/**
 * Command to create a new table.
 *
 *

 * mvn compile exec:java \
 *   -Dexec.args="create-table --runner=DataflowRunner \
 *                --project=$PROJECT  \
 *                --bigtableInstanceId=$INSTANCE \
 *                --bigtableTableId=$TABLE \
 *                --sourcePattern=gs://$SOURCE_PATTERN \
 *                --families=$FAMILIES"
 *

 *
 *
The table will be presplit based on row keys collected from a set of sequence files. This is
 * intended to be a preparation step before running an {@link ImportJob}.
 */
class CreateTableHelper {
  private static final Log LOG = LogFactory.getLog(CreateTableHelper.class);

  interface CreateTableOpts extends GcpOptions {
    @Description("The project that contains the table to export. Defaults to --project.")
    @Default.InstanceFactory(Utils.DefaultBigtableProjectFactory.class)
    String getBigtableProject();
    @SuppressWarnings("unused")
    void setBigtableProject(String projectId);

    @Description("The Bigtable instance id that contains the table to export.")
    String getBigtableInstanceId();
    @SuppressWarnings("unused")
    void setBigtableInstanceId(String instanceId);

    @Description("The Bigtable table id to export.")
    String getBigtableTableId();
    @SuppressWarnings("unused")
    void setBigtableTableId(String tableId);

    @Description(
        "The fully qualified file pattern to import. Should of the form '[destinationPath]/part-*'")
    String getSourcePattern();
    @SuppressWarnings("unused")
    void setSourcePattern(String sourcePath);

    @Description("The families to add to the new table")
    List<String> getFamilies();
    void setFamilies(List<String> families);
  }

  public static void main(String[] args) throws Exception {
    PipelineOptionsFactory.register(CreateTableOpts.class);

    CreateTableOpts opts = PipelineOptionsFactory
        .fromArgs(args).withValidation()
        .as(CreateTableOpts.class);

    FileSystems.setDefaultPipelineOptions(opts);

    createTable(opts);

  }

  static void createTable(CreateTableOpts opts) throws Exception {
    LOG.info("Extracting splits from the source files");

    // Create the same source as the import job would use
    SequenceFileSource<ImmutableBytesWritable, Result> source =
        ImportJob.createSource(StaticValueProvider.of(opts.getSourcePattern()));

    // Extract the splits from the sequence files
    List<? extends FileBasedSource<KV<ImmutableBytesWritable, Result>>> splitSources = source
        .split(ImportJob.BUNDLE_SIZE, opts);

    // Read the start key of each split
    byte[][] splits = splitSources.stream()
        .parallel()
        .map(splitSource -> {
          try (BoundedReader<KV<ImmutableBytesWritable, Result>> reader = splitSource
              .createReader(opts)) {
            if (reader.start()) {
              return reader.getCurrent().getKey();
            }
          } catch (Exception e) {
            Throwables.propagate(e);
          }
          return null;
        })
        .filter(Objects::nonNull)
        .sorted()
        .map(ImmutableBytesWritable::copyBytes)
        .toArray(byte[][]::new);

    LOG.info(String.format("Creating a new table with %d splits and the families: %s",
        splits.length, opts.getFamilies()));

    try (Connection connection =
        BigtableConfiguration.connect(opts.getBigtableProject(), opts.getBigtableInstanceId())) {

      TableName tableName = TableName.valueOf(opts.getBigtableTableId());
      HTableDescriptor descriptor = new HTableDescriptor(tableName);

      for (String family : opts.getFamilies()) {
        descriptor.addFamily(
            new HColumnDescriptor(family)
        );
      }

      connection.getAdmin().createTable(descriptor, splits);
    }
  }
}


text:
<?php
/**
 *	Type table class.
 *
 *	@author      Raymond van Velzen <raymond@latunyi.com>
 *	@package     LatunyiFramework
 **/

namespace Application\Database;

use System\Core\Database\TableField;
use System\Core\Database\CustomField;
use System\Core\Database\ForeignField;

use \System\Core\Database\Table;

/**
 * Child class for the Type table.
 */
class TypeTable extends Table
{
	/**
	 * Constructor, receives the Database object, sets properties and fields.
	 *
	 * @param \System\Core\Database\Database $db
	 */
	public function __construct(\System\Core\Database\Database $db)
	{
		parent::__construct($db, 'Type');

		$this->setName('type');
		$this->setOrderBy('name');
		$this->setPrimaryKeyIsAutoIncrement(true);

		$this->addField(new TableField('id', true));
		$this->addField(new TableField('name'));

		/*
		// Example of a custom field
		$field = new CustomField('custom');
		$field->query = "SELECT 'bla'";		// Can be any kind of subselect
		$this->addField($field);
		*/
	}
}


text:
package org.apache.camel.spring.spi;

import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spring.SpringTestSupport;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BridgePropertyPlaceholderConfigurerTest extends SpringTestSupport {
    public static final String CONSTANT = "This is the test property.";

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/spring/spi/bridgePropertyPlaceholderConfigurer.xml");
    }

    public void testIgnore() throws Exception {
        MockEndpoint result = context.getEndpoint("mock:result", MockEndpoint.class);
        result.expectedBodiesReceived(CONSTANT);
        template.sendBody("direct:start", "Test");
        result.assertIsSatisfied();
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.aheadinabox.alllightsoff.LevelsActivity"
    tools:ignore="ContentDescription">

    <TextView
        android:id="@+id/header"
        style="@style/TextHeader"
        android:text="@string/header_help"/>

    <ScrollView
        android:scrollbarStyle="outsideOverlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/header"
        android:fadingEdgeLength="16dp"
        android:gravity="center"
        android:paddingLeft="@dimen/large_margin"
        android:paddingRight="@dimen/large_margin"
        android:requiresFadingEdge="vertical">

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

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph1"/>

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/example_pattern"/>

            <View style="@style/Separator"/>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph2"/>

            <LinearLayout
                style="@style/HelpGridLayout"
                android:layout_marginBottom="@dimen/medium_margin">

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_menu_default"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_levels_default"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_prev_default"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_reset_default"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_next_default"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_undo_default"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_help_default"/>

            </LinearLayout>

            <GridLayout
                style="@style/HelpGridLayout"
                android:columnCount="2">

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_menu_default"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph3"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_levels_default"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph4"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_prev_default"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph5"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_reset_default"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph6"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_next_default"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph7"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_undo_default"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph8"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/ic_help_default"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph9"/>

            </GridLayout>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph10"/>

            <View style="@style/Separator"/>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph11"/>

            <LinearLayout
                style="@style/HelpGridLayout"
                android:layout_marginBottom="@dimen/medium_margin"
                android:weightSum="12">

                <TextView
                    style="@style/TileMediumHelp"
                    android:layout_weight="1"
                    android:background="@drawable/bkg_text"
                    android:text="@string/help_level_number"
                    android:textColor="@color/colorTextPanel"
                    android:textSize="@dimen/small_text"/>

                <TextView
                    style="@style/TileMediumHelp"
                    android:layout_weight="6"
                    android:background="@drawable/bkg_text"
                    android:text="@string/help_level_name"
                    android:textColor="@color/colorTextPanel"
                    android:textSize="@dimen/small_text"/>

                <View
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/star_lit"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/star_lit"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/star_lit"/>

            </LinearLayout>

            <GridLayout
                style="@style/HelpGridLayout"
                android:columnCount="2">

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/star_lit"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph12"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/star_unlit"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph13"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/star_question"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph14"/>

                <ImageView
                    style="@style/TileMediumHelp"
                    android:src="@drawable/star_disabled"/>

                <TextView
                    style="@style/ListParagraph"
                    android:text="@string/help_paragraph15"/>

            </GridLayout>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph16"/>

            <View style="@style/Separator"/>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph17"/>

            <LinearLayout
                style="@style/HelpGridLayout"
                android:layout_marginBottom="@dimen/medium_margin">

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_bronze"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_bronze"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_bronze"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_silver"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_silver"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_silver"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_gold"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_gold"/>

                <ImageView
                    style="@style/TileSmallHelp"
                    android:src="@drawable/move_gold"/>

            </LinearLayout>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph18"/>

            <View style="@style/Separator"/>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph19"/>

            <RelativeLayout
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:layout_gravity="center_horizontal"
                android:background="@drawable/bkg_popup">

                <TextView
                    android:id="@+id/pop_up_message"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_margin="@dimen/medium_margin"
                    android:gravity="center"
                    android:text="@string/message_gold"
                    android:textSize="@dimen/medium_text"/>

                <ImageView
                    android:layout_below="@id/pop_up_message"
                    android:layout_above="@id/pop_up_moves"
                    android:id="@+id/cup"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_centerInParent="true"
                    android:src="@drawable/cup_gold"/>

            </RelativeLayout>

            <TextView
                style="@style/TextParagraph"
                android:text="@string/help_paragraph20"/>

            <View style="@style/Separator"/>

            <Button
                android:id="@+id/back"
                style="@style/MenuButton"
                android:drawableEnd="@drawable/ic_menu_button_menu"
                android:drawableRight="@drawable/ic_menu_button_menu"
                android:onClick="backToMenu"
                android:text="@string/button_back_to_main"/>

        </LinearLayout>

    </ScrollView>

</RelativeLayout>


text:
using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using MS.Core;

namespace System.Diagnostics
{
    public static class __DebuggerTypeProxyAttribute
    {
        public static IObservable<System.String> get_ProxyTypeName(
            this IObservable<System.Diagnostics.DebuggerTypeProxyAttribute> DebuggerTypeProxyAttributeValue)
        {
            return Observable.Select(DebuggerTypeProxyAttributeValue,
                (DebuggerTypeProxyAttributeValueLambda) => DebuggerTypeProxyAttributeValueLambda.ProxyTypeName);
        }

        public static IObservable<System.Type> get_Target(
            this IObservable<System.Diagnostics.DebuggerTypeProxyAttribute> DebuggerTypeProxyAttributeValue)
        {
            return Observable.Select(DebuggerTypeProxyAttributeValue,
                (DebuggerTypeProxyAttributeValueLambda) => DebuggerTypeProxyAttributeValueLambda.Target);
        }

        public static IObservable<System.String> get_TargetTypeName(
            this IObservable<System.Diagnostics.DebuggerTypeProxyAttribute> DebuggerTypeProxyAttributeValue)
        {
            return Observable.Select(DebuggerTypeProxyAttributeValue,
                (DebuggerTypeProxyAttributeValueLambda) => DebuggerTypeProxyAttributeValueLambda.TargetTypeName);
        }

        public static IObservable<System.Reactive.Unit> set_Target(
            this IObservable<System.Diagnostics.DebuggerTypeProxyAttribute> DebuggerTypeProxyAttributeValue,
            IObservable<System.Type> value)
        {
            return ObservableExt.ZipExecute(DebuggerTypeProxyAttributeValue, value,
                (DebuggerTypeProxyAttributeValueLambda, valueLambda) =>
                    DebuggerTypeProxyAttributeValueLambda.Target = valueLambda);
        }

        public static IObservable<System.Reactive.Unit> set_TargetTypeName(
            this IObservable<System.Diagnostics.DebuggerTypeProxyAttribute> DebuggerTypeProxyAttributeValue,
            IObservable<System.String> value)
        {
            return ObservableExt.ZipExecute(DebuggerTypeProxyAttributeValue, value,
                (DebuggerTypeProxyAttributeValueLambda, valueLambda) =>
                    DebuggerTypeProxyAttributeValueLambda.TargetTypeName = valueLambda);
        }
    }
}


text:
using namespace fast;

TEST_CASE("Image weighted moving average 2D", "[fast][ImageWeightedMovingAverage][visual]") {
   auto streamer = ImageFileStreamer::New();
   streamer->setFilenameFormat(Config::getTestDataPath() + "US/Axillary/US-2D_#.mhd");
   streamer->setSleepTime(200);

   auto thresholding = BinaryThresholding::New();
   thresholding->setLowerThreshold(100);
   thresholding->setInputConnection(streamer->getOutputPort());

   auto average = ImageWeightedMovingAverage::New();
   average->setInputConnection(thresholding->getOutputPort());
   average->setFrameCount(15);

   auto renderer = ImageRenderer::New();
   renderer->addInputConnection(average->getOutputPort());
   renderer->setIntensityLevel(0.5);
   renderer->setIntensityWindow(1);

   auto window = SimpleWindow::New();
   window->addRenderer(renderer);
   window->set2DMode();
   window->setTimeout(3000);
   window->start();
}


text:
package it.unisa.dia.gas.crypto.jpbc.fe.ip.lostw10.params;

import it.unisa.dia.gas.jpbc.Element;
import it.unisa.dia.gas.jpbc.PairingParameters;
import org.bouncycastle.crypto.CipherParameters;

/**
 * @author Angelo De Caro (jpbclib@gmail.com)
 */
public class IPLOSTW10Parameters implements CipherParameters {
    private PairingParameters parameters;
    private Element g;
    private int n;

    public IPLOSTW10Parameters(PairingParameters parameters, Element g, int n) {
        this.parameters = parameters;
        this.g = g.getImmutable();
        this.n = n;
    }

    public PairingParameters getParameters() {
        return parameters;
    }

    public Element getG() {
        return g;
    }

    public int getN() {
        return n;
    }

}


text:
;(function() {
  var global = this;
  function ScratchCard(element, options, ownerDocument) {

    // apply default arguments.
    var defaultOptions = {
      'color': 'gray',
      'radius': 5
    };
    if (options) {
      for (var key in defaultOptions) {
        if (!(key in options)) {
          options[key] = defaultOptions[key];
        }
      }
    } else {
      options = defaultOptions;
    }
    ownerDocument = ownerDocument || global.document;

    // canvas validate.
    var canvas = document.createElement('canvas');
    if (typeof canvas.getContext != 'function')
      return console.log('Canvas not supported.');

    // apply canvas offset & size of element
    var rect = element.getBoundingClientRect();
    canvas.width = rect.width || rect.right - rect.left
    canvas.height = rect.height || rect.bottom - rect.top;
    canvas.style.top = rect.top + 'px';
    canvas.style.left = rect.left + 'px';
    canvas.style.position = 'absolute';
    canvas.style.zIndex = +element.style.zIndex + 1;

    // fill the canvas
    var context = canvas.getContext('2d');
    context.fillStyle = options.color;
    context.fillRect(0, 0, canvas.width, canvas.height);
    context.globalCompositeOperation = "destination-out";
    context.strokeStyle = "rgba(0,0,0,1)";

    // add mouse events to canvas
    // TODO: supply touch events
    // TODO: scratch from the outside
    function scratchStart(event) {
      if (event.button != 0) // not left button
        return;

      var x = event.offsetX || event.layerX;
      var y = event.offsetY || event.layerY;

      context.beginPath();
      context.arc(x, y, options.radius, 0, Math.PI * 2);
      context.fill();

      canvas.addEventListener('mousemove', scratchMove);
      document.addEventListener('mouseup', scratchEnd);
    }

    function scratchMove(event) {
      var x = event.offsetX || event.layerX;
      var y = event.offsetY || event.layerY;

      context.beginPath();
      context.arc(x, y, options.radius, 0, Math.PI * 2);
      context.fill();
    }

    function scratchEnd(event) {
      canvas.removeEventListener('mousemove', scratchMove);
      document.removeEventListener('mouseup', scratchEnd);
    }

    canvas.addEventListener('mousedown', scratchStart);

    // disable element interaction
    ['MozUserSelect',
     'msUserSelect',
     'oUserSelect',
     'webkitUserSelect',
     'pointerEvents']
      .filter(function (cssProp) {
        return cssProp in element.style;
      }).forEach(function (cssProp) {
        element.style[cssProp] = 'none';
      });

    // append canvas to body.
    document.body.appendChild(canvas);
  }

  if (typeof module == 'object' && module.exports) {
    // Node.js module
    module.exports = ScratchCard;
  } else if (typeof define == 'function' && (define.amd || define.cmd)) {
    // AMD or CMD module
    define(ScratchCard);
  } else if (typeof jQuery == 'function' && typeof jQuery.extend == 'function') {
    // jQuery plugin
    jQuery.fn.extend({
      'ScratchCard': function (options) {
        return this.each(function (element) {
          ScratchCard(element, options);
        });
      }
    });
  } else if (typeof angular == 'object' && typeof angular.module == 'function') {
    // AngularJS module
    // TODO: modify it to a directive.
    angular.module('ScratchCard', [])
      .value('ScratchCard', ScratchCard);
  } else {
    // Apply to a global variable.
    if (global.ScratchCard) {
      (function (oldScratchCard) {
        ScratchCard.noConflict = function () {
          global.ScratchCard = oldScratchCard;
          return ScratchCard;
        };
      }) (global.ScratchCard);
    }
    global.ScratchCard = ScratchCard;
  }
}).call(this);


text:
package play.libs.testmodel;

public @AC1 class C1 {
}


text:
importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

var t = async_test("");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
    throw reason;
});
t.step(function() {

var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

var offscreenCanvas2 = new OffscreenCanvas(100, 50);
var ctx2 = offscreenCanvas2.getContext('2d');
ctx2.fillStyle = '#f00';
ctx2.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations
ctx.drawImage(offscreenCanvas2, 0, 0);
_assertPixelApprox(offscreenCanvas, 50,25, 2,253,0,255, "50,25", "2,253,0,255", 2);
t.done();

});
done();


text:
package openblocks.client.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import openblocks.client.renderer.HeightMapRenderer;
import openblocks.common.HeightMapData;
import openblocks.common.MapDataManager;
import openblocks.common.container.ContainerProjector;
import openblocks.rpc.IRotatable;
import openmods.gui.BaseGuiContainer;
import openmods.gui.component.*;
import openmods.gui.listener.IMouseDownListener;
import openmods.gui.misc.Trackball.TrackballWrapper;
import openmods.utils.MathUtils;
import openmods.utils.render.FakeIcon;

import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;

public class GuiProjector extends BaseGuiContainer<ContainerProjector> {

	private static final ResourceLocation texture = new ResourceLocation("openblocks:textures/gui/projector.png");

	private static final int VIEW_HEIGHT = 138;
	private static final int VIEW_WIDTH = 160;
	private TrackballWrapper trackball = new TrackballWrapper(1, 150);

	private static IMouseDownListener createRotationListener(final IRotatable proxy, final int direction) {
		return new IMouseDownListener() {
			@Override
			public void componentMouseDown(BaseComponent component, int x, int y, int button) {
				proxy.rotate(direction);
			}
		};
	}

	public GuiProjector(ContainerProjector container) {
		super(container, 176, 234, "");
		IRotatable proxy = getContainer().getOwner().createClientRpcProxy(IRotatable.class);

		GuiComponentIconButton buttonLeft = new GuiComponentIconButton(7, 130, 0xFFFFFF, FakeIcon.createSheetIcon(176, 0, 13, 13), texture);
		buttonLeft.setListener(createRotationListener(proxy, -1));
		root.addComponent(buttonLeft);

		GuiComponentIconButton buttonRight = new GuiComponentIconButton(152, 130, 0xFFFFFF, FakeIcon.createSheetIcon(176 + 13, 0, -13, 13), texture);
		buttonRight.setListener(createRotationListener(proxy, +1));
		root.addComponent(buttonRight);
	}

	@Override
	protected BaseComposite createRoot() {
		return new EmptyComposite(0, 0, xSize, ySize);
	}

	private boolean isInitialized;
	private int scale = 90;
	private double mapHeight = 2;

	@Override
	protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) {
		if (isInitialized == false || Mouse.isButtonDown(2)) {
			trackball.setTransform(MathUtils.createEntityRotateMatrix(Minecraft.getMinecraft().renderViewEntity));
			isInitialized = true;
		}

		mapHeight += Mouse.getDWheel() / 1000.0;
		if (mapHeight > 10) mapHeight = 10;
		if (mapHeight < -5) mapHeight = -5;

		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		int left = (width - xSize) / 2;
		int top = (height - ySize) / 2;

		GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
		GL11.glPushMatrix();
		GL11.glColorMask(false, false, false, false);
		GL11.glTranslatef(0, 0, +999);
		// raise whole screen ...
		drawRect(0, 0, width, height, 0xFF000000);
		GL11.glColorMask(true, true, true, true);
		GL11.glTranslatef(0, 0, -999 * 2);

		GL11.glDepthFunc(GL11.GL_GREATER);
		// ... and dig hole for map
		drawRect(left + 8, top + 8, left + 8 + VIEW_WIDTH, top + 8 + VIEW_HEIGHT, 0xFF000000);
		GL11.glDepthFunc(GL11.GL_LEQUAL);
		GL11.glPopMatrix();
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

		ContainerProjector container = getContainer();
		Integer mapId = container.getMapId();

		if (mapId != null) {
			World world = container.getOwner().getWorldObj();
			HeightMapData data = MapDataManager.getMapData(world, mapId);
			if (data.isValid()) {
				GL11.glPushMatrix();
				GL11.glColor4f(1, 1, 1, 1);
				int viewMiddleX = left + 8 + VIEW_WIDTH / 2;
				int viewMiddleY = top + 8 + VIEW_HEIGHT / 2;
				GL11.glTranslatef(viewMiddleX, viewMiddleY, 50);

				GL11.glScalef(scale, -scale, scale);
				trackball.update(mouseX - viewMiddleX, -(mouseY - viewMiddleY));

				GL11.glRotated(90 * container.rotation(), 0, 1, 0);
				GL11.glTranslated(-0.5, -mapHeight, -0.5);
				HeightMapRenderer.instance.render(mapId, data);
				GL11.glDisable(GL11.GL_LIGHTING);
				GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
				drawLevels();
				GL11.glPopMatrix();
			}
		}

		GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);

		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		mc.renderEngine.bindTexture(texture);

		GL11.glPushMatrix();
		GL11.glTranslated(guiLeft, guiTop, 0);
		drawTexturedModalRect(0, 0, 0, 0, xSize, ySize);

		root.render(mc, 0, 0, mouseX - guiLeft, mouseY - guiTop);
		GL11.glPopMatrix();
	}

	private void drawLevels() {
		GL11.glDisable(GL11.GL_CULL_FACE);
		GL11.glDisable(GL11.GL_TEXTURE_2D);
		GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
		GL11.glBegin(GL11.GL_QUADS);

		GL11.glColor3d(0, 1, 0);

		for (int i = 0; i <= 4; i++) {
			GL11.glVertex3d(0, i, 0);
			GL11.glVertex3d(0, i, 1);
			GL11.glVertex3d(1, i, 1);
			GL11.glVertex3d(1, i, 0);
		}

		GL11.glColor3d(1, 0, 0);
		GL11.glVertex3d(0, mapHeight, 0);
		GL11.glVertex3d(0, mapHeight, 1);
		GL11.glVertex3d(1, mapHeight, 1);
		GL11.glVertex3d(1, mapHeight, 0);

		GL11.glEnd();

		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
		GL11.glEnable(GL11.GL_CULL_FACE);
	}

	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {}
}


text:
/**
 * A simple Timer class
 * @author Daniel Mason <daniel@danielmason.com>
 */

var Timer = function(config) {

    /**
     * @param int
     */
    var seconds = config.hasOwnProperty('seconds') ? config.seconds : 0;

    /**
     * @param int
     */
    var timeStarted = config.hasOwnProperty('timeStarted') ? config.timeStarted : 0;

    var timeSinceStarted = function() {
        if(timeStarted > 0) {
            return new Date().getTime() - timeStarted;
        }
        return 0;
    }

    return {

        start : function() {
            timeStarted = new Date().getTime();
            return this;
        },

        stop : function() {
            seconds += timeSinceStarted();
            timeStarted = 0;
            return this;
        },

        reset : function() {
            seconds = 0;
            timeStarted = 0;
            return this;
        },

        getTime : function() {
            return seconds + timeSinceStarted();
        }

    };

};


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Graphics;
using Android.Graphics.Drawables;
using Android.Locations;
using Android.Widget;
using Android.OS;
using Android.Support.V7.App;
using Android.Views;
using GeoJSON.Net.Geometry;
using Org.Osmdroid.Views.Overlay.Mylocation;
using OsmDroid;
using OsmTest.Android.Model;
using OsmTest.Android.Services;
using Environment = Android.OS.Environment;

using OsmDroid.Api;
using OsmDroid.TileProvider;
using OsmDroid.TileProvider.TileSource;
using OsmDroid.Util;
using OsmDroid.Views;
using OsmDroid.Views.Overlay;
using OsmSharp.Geo.Geometries;
using OsmSharp.UI.Map.Styles;
using OsmTest.Android.Adapter;
using OsmTest.Android.Views;
using OsmTest.Core.Services;
using AlertDialog = Android.Support.V7.App.AlertDialog;

namespace OsmTest.Android
{
    [Activity(Label = "Space Herders", MainLauncher = true, Icon = "@mipmap/icon", Theme = "@style/Theme.AppCompat.Light", ScreenOrientation = ScreenOrientation.Landscape)]
    public class MainActivity : ActionBarActivity, IDialogInterfaceOnClickListener
    {
        /// <summary>
        /// Holds the mapview.
        /// </summary>
        private MapView _mapView;

        private CancellationTokenSource _cancellationTokenSource;
        CustomLocationProvider _provider = null;
        private string css = @"
node
{
    color:#f00;
    width:2;
    opacity:0.7;
    fill-color:#fc0;
    fill-opacity:0.3;
}
way
{
    color:#03f;
    width:5;
    opacity:0.6;
}
area
{
    color:#03f;
    width:2;
    opacity:0.7;
    fill-color:#fc0;
    fill-opacity:0.3;
}
relation node, relation way, relation relation
{
    color:#d0f;
}";
        private IMapController _mapController;
        IGeoObjectsService _geoService = null;
        private GeoPositionOverlay _geoPositionOverlay;
        //private MapView _mapView;

        private RelativeLayout _sos = null;
        protected RelativeLayout _layers = null;
        protected RelativeLayout _myLocation = null;

        GeoPoint _centreOfMap = new GeoPoint(-6.3423888, 35.392372);
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            SupportActionBar.DisplayOptions = (int)ActionBarDisplayOptions.ShowCustom;
            SupportActionBar.SetCustomView(Resource.Layout.ActionBar_Moses);
            _sos = SupportActionBar.CustomView.FindViewById<RelativeLayout>(Resource.Id.sos);
            _myLocation = SupportActionBar.CustomView.FindViewById<RelativeLayout>(Resource.Id.where_i);
            _layers = SupportActionBar.CustomView.FindViewById<RelativeLayout>(Resource.Id.layers);

            _sos.Click += delegate (object sender, EventArgs args)
            {
                Toast.MakeText(this, "Help me!!!!", ToastLength.Long).Show();
            };
            _layers.Click += delegate (object sender, EventArgs args)
            {
                AlertDialog.Builder builderSingle = new AlertDialog.Builder(this);
                builderSingle.SetTitle("Type");

                ArrayAdapterWithIcon arrayAdapter = new ArrayAdapterWithIcon(
                     this,
                     Android.Resource.Layout.select_dialog_singlechoice_material);
                arrayAdapter.Add(new ListItem() { ImageResourceId = Resource.Drawable.tse_tse });
                arrayAdapter.Add(new ListItem() { ImageResourceId = Resource.Drawable.grass });
                arrayAdapter.Add(new ListItem() { ImageResourceId = Resource.Drawable.water });
                arrayAdapter.Add(new ListItem() { ImageResourceId = Resource.Drawable.fire });
                builderSingle.SetNegativeButton("Cancel", NegativeHandler);
                builderSingle.SetAdapter(arrayAdapter, this);
                builderSingle.Show();
            };
            _myLocation.Click += delegate (object sender, EventArgs args)
            {
                _mapController.SetCenter(_centreOfMap);
            };
            //StyleInterpreter interpreter = null;
            try
            {
                bool isTile = true;
                //List<OsmGeo> osm = null;
                if (isTile)
                {
                    _mapView = FindViewById<MapView>(Resource.Id.mapview);
                    _mapView.SetTileSource(TileSourceFactory.DefaultTileSource);
                    _mapView.SetBuiltInZoomControls(true);
                    //_mapView.SetUseDataConnection(false);

                    _provider = new CustomLocationProvider(this);
                    _provider.StartLocationProvider(new MyLocationNewOverlay(this, _mapView));

                    //List<OverlayItem> overlayItemArray = new List<OverlayItem>();
                    //OverlayItem olItem = new OverlayItem("Here", "SampleDescription", new GeoPoint(34.878039, -10.650));
                    //overlayItemArray.Add(olItem);
                    //olItem.SetMarker(Resources.GetDrawable(Resource.Drawable.cloud));
                    //overlayItemArray.Add(new OverlayItem("Hi", "You're here", new GeoPoint(34.888039, -10.660)));

                    //DefaultResourceProxyImpl defaultResourceProxyImpl = new DefaultResourceProxyImpl(this);
                    //ItemizedIconOverlay myItemizedIconOverlay = new ItemizedIconOverlay(overlayItemArray, null, defaultResourceProxyImpl);
                    //_mapView.Overlays.Add(myItemizedIconOverlay);

                    //PathOverlay myPath = new PathOverlay(Color.Red, this);
                    //myPath.AddPoint(new GeoPoint(34.878039, -10.650));
                    //myPath.AddPoint(new GeoPoint(34.888039, -10.660));
                    //_mapView.Overlays.Add(myPath);

                    _mapController = _mapView.Controller;
                    _mapController.SetZoom(6);

                    _mapController.SetCenter(_centreOfMap);
                    _geoPositionOverlay = new GeoPositionOverlay(this);
                    _geoPositionOverlay.GeoPointTapped += async delegate (object sender, IGeoPoint point)
                    {
                        List<OverlayItem> overlayItemArray = new List<OverlayItem>();
                        OverlayItem olItem = new OverlayItem("Here", "SampleDescription", new GeoPoint(point.Latitude, point.Longitude));
                        overlayItemArray.Add(olItem);
                        olItem.SetMarker(Resources.GetDrawable(Resource.Drawable.cloud));

                        DefaultResourceProxyImpl defaultResourceProxyImpl = new DefaultResourceProxyImpl(this);
                        ItemizedIconOverlay myItemizedIconOverlay = new ItemizedIconOverlay(overlayItemArray, null, defaultResourceProxyImpl);
                        _mapView.Overlays.Add(myItemizedIconOverlay);
                        _mapView.Invalidate();

                        try
                        {
                            var service = new OsmTest.Android.Services.ApiService();
                            await service.UploadPoint(point.Latitude, point.Longitude);
                        }
                        catch (Exception exception)
                        {
                            Toast.MakeText(this, exception.Message, ToastLength.Long).Show();
                        }
                    };
                    _mapView.Overlays.Add(_geoPositionOverlay);

                    _geoService = new CouchDbGeoObjectsService();

                    //var firstPoint = ((GeoJSON.Net.Geometry.Point) points.Features[0].Geometry);
                    //var firstPoint = new OsmSharp.Geo.Geometries.Point(new OsmSharp.Math.Geo.GeoCoordinate(33, -10));
                    //double x = ((GeographicPosition) firstPoint.Coordinates).Latitude;
                    //double y = ((GeographicPosition)firstPoint.Coordinates).Longitude;
                    //List<OverlayItem> overlayItemArray = new List<OverlayItem>();
                    //OverlayItem olItem = new OverlayItem("Here", "SampleDescription", new GeoPoint(x, y));
                    //overlayItemArray.Add(olItem);
                    //olItem.SetMarker(Resources.GetDrawable(Resource.Drawable.cloud));

                    //ItemizedIconOverlay newPoints = new ItemizedIconOverlay(overlayItemArray, null, defaultResourceProxyImpl);
                    //_mapView.Overlays.Add(newPoints);

                }
                else
                {
                    /*List<OsmGeo> osm = await _service.DownloadArea(34.878039, -10.465, 36, -9.077);
                    if (osm != null)
                    {
                       Native.Initialize();

                       // initialize map.
                       var map = new Map();
                       interpreter = new MapCSSInterpreter(css);

                       IDataSourceReadOnly source = new MemoryDataSource(osm.ToArray());
                       var layer = map.AddLayerOsm(source, interpreter);

                       _mapView = new MapView(this, new MapViewSurface(this));
                       _mapView.Map = map;
                       _mapView.MapMaxZoomLevel = 17; // limit min/max zoom because MBTiles sample only contains a small portion of a map.
                       _mapView.MapMinZoomLevel = 1;
                       _mapView.MapTilt = 0;
                       _mapView.MapCenter = new GeoCoordinate(-9.2, 36);
                       _mapView.MapZoom = 2;
                       _mapView.MapAllowTilt = false;

                       //OsmSharp.Data.SQLite.SQLiteConnectionBase sqLiteConnection = new SQLiteConnection("osmMap");

                       frame.AddView(_mapView);
                       var textLabel = FindViewById<TextView>(Resource.Id.text_label);
                       textLabel.Text = "Изображение подгрузилось";
                       Toast.MakeText(this, "Read success", ToastLength.Long).Show();
                    }
                    else
                    {
                       Toast.MakeText(this, "OSM is null", ToastLength.Long).Show();
                    }*/
                }

            }
            catch (Exception exception)
            {
                //Toast.MakeText(this, exception.Message, ToastLength.Long).Show();
            }
        }

        public void ChangeCenterPoint(Location location)
        {
            _centreOfMap = new GeoPoint(location);
            _provider.StopLocationProvider();
        }

        protected override void OnStart()
        {
            base.OnStart();

        }

        protected async override void OnResume()
        {
            base.OnResume();
        }

        protected override void OnPause()
        {
            base.OnPause();
        }

        private void NegativeHandler(object sender, DialogClickEventArgs dialogClickEventArgs)
        {
            ((AlertDialog)sender).Dismiss();
        }

        //private async Task<MvxGeoLocation> UpdateLocation()
        //{
        //   _cancellationTokenSource?.Cancel();
        //   _cancellationTokenSource = new CancellationTokenSource();
        //     var locationService = Mvx.Resolve<LocationService>();
        //   return await locationService.GetLocation(_cancellationTokenSource);
        //}
        public void OnClick(IDialogInterface dialog, int which)
        {
            try
            {
                for (int i = _mapView.Overlays.Count - 1; i >= 0; i--)
                {
                    _mapView.Overlays.RemoveAt(i);
                }
                _mapView.Invalidate();
                switch (which)
                {
                    case 0:
                        {
                            GeoPoint leftTopGeo = new GeoPoint(-1.686000, 33.558542);
                            GeoPoint rightBottomGeo = new GeoPoint(-11.409878, 42.633248);
                            Bitmap tanzania = BitmapFactory.DecodeResource(Resources, Resource.Drawable.tsetse_tanzania);
                            Overlay newOverlay = new BitmapOverlay(this, leftTopGeo, rightBottomGeo, tanzania);
                            _mapView.Overlays.Add(newOverlay);
                        }
                        break;
                    case 1:
                        {
                            GeoPoint leftTopGeo = new GeoPoint(39.301256, -20.008362);
                            GeoPoint rightBottomGeo = new GeoPoint(-37.787103, 51.759213);
                            Bitmap tanzania = BitmapFactory.DecodeResource(Resources, Resource.Drawable.green_africa);
                            Overlay newOverlay = new BitmapOverlay(this, leftTopGeo, rightBottomGeo, tanzania);
                            _mapView.Overlays.Add(newOverlay);
                        }
                        break;
                    case 2:
                        {
                            var points = _geoService.GetRivers(null, 0);
                            GeoPoint lastPoint = null;
                            foreach (GeoJsonObject geoJsonObject in points)
                            {
                                PathOverlay newOverlay = new PathOverlay(Color.Blue, this);
                                foreach (List<double> coordinate in geoJsonObject.geometry.coordinates)
                                {
                                    var point = new GeoPoint(coordinate[0], coordinate[1]);
                                    newOverlay.AddPoint(point);
                                    lastPoint = point;
                                }
                                _mapView.Overlays.Add(newOverlay);
                            }
                            _mapController.SetCenter(lastPoint);

                        }
                        break;
                    case 3:
                        {
                            GeoPoint leftTopGeo = new GeoPoint(39.301256, -20.008362);
                            GeoPoint rightBottomGeo = new GeoPoint(-37.787103, 51.759213);
                            Bitmap tanzania = BitmapFactory.DecodeResource(Resources, Resource.Drawable.fire_africa);
                            Overlay newOverlay = new BitmapOverlay(this, leftTopGeo, rightBottomGeo, tanzania);
                            _mapView.Overlays.Add(newOverlay);
                        }
                        break;
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, "Service not available", ToastLength.Long).Show();
            }
        }
    }
}


text:
jQuery( document ).ready( function( ) {
	jQuery( '.lf-links' ).on( 'click', 'li, tr', function( event ) {
		var action = jQuery( this ).closest( "[data-action]" ).attr( 'data-action' );
		var key = jQuery( this ).attr( 'data-key' );
		var parm = jQuery( this ).closest( "[data-parm]" ).attr( 'data-parm' );
		if ( action && key )
			window.location.href = action + '/' + key + ( parm ? '?parm=' + parm : '' );
	} );
} );


text:
package proxiedsites

import (
	"sort"
	"sync"

	"github.com/getlantern/golog"

	"github.com/fatih/set"
)

var (
	log = golog.LoggerFor("proxiedsites")

	cs       *configsets
	cfgMutex sync.RWMutex
)

// Delta represents modifications to the proxied sites list.
type Delta struct {
	Additions []string `json:"Additions, omitempty"`
	Deletions []string `json:"Deletions, omitempty"`
}

// Merge merges the given delta into the existing one.
func (d *Delta) Merge(n *Delta) {
	oadd := toSet(d.Additions)
	odel := toSet(d.Deletions)
	nadd := toSet(n.Additions)
	ndel := toSet(n.Deletions)

	// First remove new deletions from old adds and vice versa
	fadd := set.Difference(oadd, ndel)
	fdel := set.Difference(odel, nadd)

	// Now add new adds and deletions
	fadd = set.Union(fadd, nadd)
	fdel = set.Union(fdel, ndel)

	d.Additions = toStrings(fadd)
	d.Deletions = toStrings(fdel)
}

// Config is the whole configuration for proxiedsites.
type Config struct {
	// User customizations
	*Delta

	// Global list of white-listed sites
	Cloud []string
}

// toCS converts this Config into a configsets
func (cfg *Config) toCS() *configsets {
	cs := &configsets{
		cloud: toSet(cfg.Cloud),
		add:   toSet(cfg.Delta.Additions),
		del:   toSet(cfg.Delta.Deletions),
	}
	cs.calculateActive()
	return cs
}

// toSet converts a slice of strings into a set
func toSet(s []string) set.Interface {
	if s == nil {
		return set.New(set.NonThreadSafe)
	}
	is := make([]interface{}, len(s))
	for i, s := range s {
		is[i] = s
	}
	set := set.New(set.NonThreadSafe)
	set.Add(is...)
	return set
}

// toStrings converts a set into a slice of strings
func toStrings(s set.Interface) []string {
	l := set.StringSlice(s)
	sort.Strings(l)
	return l
}

// configsets is a version of a Config that uses sets instead of slices
type configsets struct {
	cloud      set.Interface
	add        set.Interface
	del        set.Interface
	active     set.Interface
	activeList []string
}

// calculateActive calculates the active sites for the given configsets and
// stores them in the active property.
func (cs *configsets) calculateActive() {
	cs.active = set.Difference(set.Union(cs.cloud, cs.add), cs.del)
	cs.activeList = toStrings(cs.active)
}

// equals checks whether this configsets is identical to some other configsets
func (cs *configsets) equals(other *configsets) bool {
	return cs.cloud.IsEqual(other.cloud) &&
		cs.add.IsEqual(other.add) &&
		cs.del.IsEqual(other.del)
}

// Configure applies the given configuration. If there were changes, a Delta is
// returned that includes the additions and deletions from the active list. If
// there were no changes, or the changes couldn't be applied, this method
// returns a nil Delta.
func Configure(cfg *Config) *Delta {
	newCS := cfg.toCS()
	if cs != nil && cs.equals(newCS) {
		log.Debug("Configuration unchanged")
		return nil
	}

	var delta *Delta
	if cs == nil {
		delta = &Delta{
			Additions: newCS.activeList,
		}
	} else {
		delta = &Delta{
			Additions: toStrings(set.Difference(newCS.active, cs.active)),
			Deletions: toStrings(set.Difference(cs.active, newCS.active)),
		}
	}
	cs = newCS
	log.Debug("Applied updated configuration")
	return delta
}

// ActiveDelta returns the active sites as a Delta of additions.
func ActiveDelta() *Delta {
	cfgMutex.RLock()
	d := &Delta{
		Additions: cs.activeList,
	}
	cfgMutex.RUnlock()
	return d
}


text:
package com.ea.core.web.bridge;

import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import com.ea.core.base.CoreDefinition;
import com.ea.core.bridge.IConnector;
import com.ea.core.storm.TopologyDefinition;
import com.ea.core.storm.topology.ITopology;

@Component
public class BridgeContext implements ApplicationContextAware{
	private Logger logger = LoggerFactory.getLogger(BridgeContext.class);
	private ApplicationContext context;
	private Map<String, IConnector> connectorMapping;

	public BridgeContext(){
		connectorMapping = new HashMap<String, IConnector>();
	}

	public Object connect(String connectMode, String facadeId, Object... models) throws Exception {
		// TODO Auto-generated method stub
		long startTime = Calendar.getInstance().getTimeInMillis();
		IConnector connector = (IConnector) connectorMapping.get(connectMode);
		Object result = connectorMapping.get(connectMode).connect(connector.findByFacade(facadeId), facadeId, models);
		long endTime = Calendar.getInstance().getTimeInMillis();
		logger.info("本次执行共耗时" + (endTime - startTime) + "毫秒,连接方式:" + connectMode + ",调用Facade:" + facadeId);
		return result;
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		// TODO Auto-generated method stub
		context = applicationContext;
		connectorMapping.put(BridgeConstant.CONNECTOR_MODE.MQ.getCode(), (IConnector) context.getBean("mqConnector"));
		connectorMapping.put(BridgeConstant.CONNECTOR_MODE.SPRING.getCode(), (IConnector) context.getBean("springConnector"));
		connectorMapping.put(BridgeConstant.CONNECTOR_MODE.STORM_LOCAL.getCode(), (IConnector) context.getBean("localConnector"));
		connectorMapping.put(BridgeConstant.CONNECTOR_MODE.STORM_REMOTE.getCode(), (IConnector) context.getBean("remoteConnector"));
		initConnection();
	}

	/**
	 * 启动WEB服务器后,将先往每一个Topology发送一个请求,以预先初始化storm各工作线程Hibernate,以加快后续加载问题
	 * @throws BeansException
	 */
	private void initConnection() {
		if(BridgeConstant.CONNECTOR_MODE.STORM_LOCAL.getCode().equals(CoreDefinition.getPropertyValue("sync.mode"))){
			ActivateStorm astorm = new ActivateStorm(connectorMapping.get(BridgeConstant.CONNECTOR_MODE.STORM_LOCAL.getCode()));
			new Thread(astorm).start();
		}
		if(BridgeConstant.CONNECTOR_MODE.STORM_REMOTE.getCode().equals(CoreDefinition.getPropertyValue("sync.mode"))){
			ActivateStorm astorm = new ActivateStorm(connectorMapping.get(BridgeConstant.CONNECTOR_MODE.STORM_REMOTE.getCode()));
			new Thread(astorm).start();
		}
	}

}

/**
 * 首次连接Storm时,需要对Hibernate做些初始化工作,需时大约2-3秒。
 * 增加一个线程,定时触发Storm,以保证Storm的处理时效。
 * @author yiyongfei
 *
 */
class ActivateStorm implements Runnable {
	private Logger logger = LoggerFactory.getLogger(ActivateStorm.class);
	private IConnector connector;
	private long sleeptime = 10*60*1000;

	public ActivateStorm(IConnector connector){
		this.connector = connector;
	}

	@Override
	public void run() {
		boolean isAtonce = true;
		while(true){
			try {
				if(isAtonce){
					Thread.sleep(10*1000);
				} else {
					Thread.sleep(sleeptime);
				}
				Collection<ITopology> topologys = TopologyDefinition.findFacadeTopology();
				for(ITopology topology : topologys){
					logger.info("发送到:" + topology.getTopologyName());
					connector.connect(topology.getTopologyName(), "f247969860897966875L", new Object[]{});
				}
				isAtonce = false;
			} catch (Exception e) {
				//异常处理(策略是记录原始取到的队列信息和异常信息,并写到队列里,队列名为errorQueue
				logger.error("异常:" , e);
				isAtonce = true;
			}
		}
	}
}


text:
#include <boost/fusion/functional/invocation/invoke.hpp>
#include <boost/fusion/functional/adapter/unfused.hpp>
#include <boost/fusion/support/deduce_sequence.hpp>

#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/intrinsic/front.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/algorithm/transformation/pop_front.hpp>
#include <boost/fusion/algorithm/iteration/fold.hpp>
#include <boost/fusion/view/filter_view.hpp>

#include <boost/functional/forward_adapter.hpp>
#include <boost/functional/lightweight_forward_adapter.hpp>

#include <boost/type_traits/remove_reference.hpp>

#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/max.hpp>
#include <boost/mpl/next.hpp>

#include <boost/ref.hpp>
#include <iostream>
#include <typeinfo>

namespace impl
{
    namespace fusion = boost::fusion;
    namespace traits = boost::fusion::traits;
    namespace result_of = boost::fusion::result_of;
    namespace mpl = boost::mpl;
    using mpl::placeholders::_;

    // Placeholders (we inherit from mpl::int_, so we can use placeholders
    // as indices for fusion::at, later)
    template <int I> struct placeholder : mpl::int_<I> { };

    // A traits class to find out whether T is a placeholeder
    template <typename T> struct is_placeholder              : mpl::false_  { };
    template <int I> struct is_placeholder< placeholder<I> > : mpl::true_   { };
    template <int I> struct is_placeholder< placeholder<I> & > : mpl::true_   { };
    template <int I> struct is_placeholder< placeholder<I> const   > : mpl::true_   { };
    template <int I> struct is_placeholder< placeholder<I> const & > : mpl::true_   { };

    // This class template provides a Polymorphic Function Object to be used
    // with fusion::transform. It is applied to the sequence of arguments that
    // describes the binding and holds a reference to the sequence of arguments
    // from the final call.
    template<class FinalArgs> struct argument_transform
    {
        FinalArgs const & ref_final_args;
    public:

        explicit argument_transform(FinalArgs const & final_args)
            : ref_final_args(final_args)
        { }

        // A placeholder? Replace it with an argument from the final call...
        template <int Index>
        inline typename result_of::at_c<FinalArgs const, Index>::type
        operator()(placeholder<Index> const &) const
        {
            return fusion::at_c<Index>(this->ref_final_args);
        }
        // ...just return the bound argument, otherwise.
        template <typename T> inline T & operator()(T & bound) const
        {
            return bound;
        }

        template <typename Signature>
        struct result;

        template <class Self, typename T>
        struct result< Self (T) >
            : mpl::eval_if< is_placeholder<T>,
                result_of::at<FinalArgs,typename boost::remove_reference<T>::type>,
                mpl::identity<T>
            >
        { };
    };

    // Fused implementation of the bound function, the function object
    // returned by bind
    template <class BindArgs> class fused_bound_function
    {
        // Transform arguments to be held by value
        typedef typename traits::deduce_sequence<BindArgs>::type bound_args;

        bound_args fsq_bind_args;
    public:

        fused_bound_function(BindArgs const & bind_args)
          : fsq_bind_args(bind_args)
        { }

        template <typename Signature>
        struct result;

        template <class FinalArgs>
        struct result_impl
            : result_of::invoke< typename result_of::front<bound_args>::type,
                typename result_of::transform<
                    typename result_of::pop_front<bound_args>::type,
                    argument_transform<FinalArgs> const
                >::type
            >
        { };

        template <class Self, class FinalArgs>
        struct result< Self (FinalArgs) >
            : result_impl< typename boost::remove_reference<FinalArgs>::type >
        { };

        template <class FinalArgs>
        inline typename result_impl<FinalArgs>::type
        operator()(FinalArgs const & final_args) const
        {
            return fusion::invoke( fusion::front(this->fsq_bind_args),
                fusion::transform( fusion::pop_front(this->fsq_bind_args),
                    argument_transform<FinalArgs>(final_args) ) );
        }
        // Could add a non-const variant - omitted for readability

    };

    // Find the number of placeholders in use
    struct n_placeholders
    {
        struct fold_op
        {
            template <typename Sig> struct result;
            template <class S, class A, class B> struct result< S(A &,B &) >
                : mpl::max<A,B> { };
        };
        struct filter_pred
        {
            template <class X> struct apply : is_placeholder<X> { };
        };

        template <typename Seq>
        struct apply
            : mpl::next< typename result_of::fold<
                fusion::filter_view<Seq,filter_pred>, mpl::int_<-1>, fold_op
            >::type>::type
        { };
    };

    // Fused implementation of the 'bind' function
    struct fused_binder
    {
        template <class Signature>
        struct result;

        template <class BindArgs,
            int Placeholders = n_placeholders::apply<BindArgs>::value>
        struct result_impl
        {
            typedef boost::forward_adapter<fusion::unfused<
                fused_bound_function<BindArgs>,!Placeholders>,Placeholders> type;
        };

        template <class Self, class BindArgs>
        struct result< Self (BindArgs) >
            : result_impl< typename boost::remove_reference<BindArgs>::type >
        { };

        template <class BindArgs>
        inline typename result_impl< BindArgs >::type
        operator()(BindArgs & bind_args) const
        {
            return typename result< void(BindArgs) >::type(
                fusion::unfused< fused_bound_function<BindArgs>,
                    ! n_placeholders::apply<BindArgs>::value >(bind_args) );
        }
    };

    // The binder's unfused type. We use lightweght_forward_adapter to make
    // that thing more similar to Boost.Bind. Because of that we have to use
    // Boost.Ref (below in the sample code)
    typedef boost::lightweight_forward_adapter< fusion::unfused<fused_binder> > binder;
}

// Placeholder globals
impl::placeholder<0> const _1_ = impl::placeholder<0>();
impl::placeholder<1> const _2_ = impl::placeholder<1>();
impl::placeholder<2> const _3_ = impl::placeholder<2>();
impl::placeholder<3> const _4_ = impl::placeholder<3>();

// The bind function is a global, too
impl::binder const bind = impl::binder();

// OK, let's try it out:

struct func
{
    typedef int result_type;

    inline int operator()() const
    {
        std::cout << "operator()" << std::endl;
        return 0;
    }

    template <typename A>
    inline int operator()(A const & a) const
    {
        std::cout << "operator()(A const & a)" << std::endl;
        std::cout << "  a = " << a << "  A = " << typeid(A).name() << std::endl;
        return 1;
    }

    template <typename A, typename B>
    inline int operator()(A const & a, B & b) const
    {
        std::cout << "operator()(A const & a, B & b)" << std::endl;
        std::cout << "  a = " << a << "  A = " << typeid(A).name() << std::endl;
        std::cout << "  b = " << b << "  B = " << typeid(B).name() << std::endl;
        return 2;
    }
};

int main()
{
    func f;
    int value = 42;
    using boost::ref;

    int errors = 0;

    errors += !( bind(f)() == 0);
    errors += !( bind(f,"Hi")() == 1);
    errors += !( bind(f,_1_)("there.") == 1);
    errors += !( bind(f,"The answer is",_1_)(12) == 2);
    errors += !( bind(f,_1_,ref(value))("Really?") == 2);
    errors += !( bind(f,_1_,_2_)("Dunno. If there is an answer, it's",value) == 2);

    return !! errors;
}


text:
<?php
if (!defined('MEDIAWIKI')) die('omghax');

class Limn {

    public static function registerParserHooks( &$parser ) {
        $parser->setHook(           'graph', 'Limn::graphParserHook' );
        $parser->setFunctionHook(   'graph', 'Limn::graphParserFunction' );
        return true;
    }

    public static function addModule() {
        global $wgOut;
        $wgOut->addModules( 'ext.limn' );
    }

    public static function resourceLoaderGetConfigVars( &$vars ) {
        global $wgLimnServerBase, $wgLimnServerRemoteMode;

        $vars['wgLimnOptions'] = array(
            'server' => array(
                'base'          => $wgLimnServerBase,
            ),
            'data' => array(
                'remoteMode'    => $wgLimnDataRemoteMode,
            ),
        );

        return true;
    }

    public static function graph( $graph_id='', $template='graph-chart-only' ) {
        if ( !$graph_id ) return '';
        $output = "

\n";
        return $output;
    }

    public static function graphParserHook( $content, $argv, $parser ) {
        $graph_id = $argv['graph-id'];
        if ( !$graph_id ) return '';

        $parser->disableCache();

        // self::addModule();
        global $wgOut;
        $wgOut->addModules( 'ext.limn' );

        $output = self::graph( $graph_id );
        return $output;
    }

    public static function graphParserFunction( $parser, $graph_id='' ) {
        if ( !$graph_id ) return '';

        $parser->disableCache();

        // self::addModule();
        global $wgOut;
        $wgOut->addModules( 'ext.limn' );

        $output = self::graph( $graph_id );
        return array( $output, 'noparse' => true, 'isHTML' => true );
    }

}


text:
cask "eclipse-rcp" do
  version "4.18.0,2020-12:R"
  sha256 "cb2fa051770bc69a223fb987595496c849dff663c66b3ef93fe7f4ee850de197"

  url "https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/#{version.after_comma.before_colon}/#{version.after_colon}/eclipse-rcp-#{version.after_comma.before_colon}-#{version.after_colon}-macosx-cocoa-x86_64.dmg&r=1"
  name "Eclipse for RCP and RAP Developers"
  homepage "https://eclipse.org/"

  # Renamed to avoid conflict with other Eclipse.
  app "Eclipse.app", target: "Eclipse RCP.app"
end


text:
#ifndef PACKET_HPP
#define PACKET_HPP

#include <type_traits>
#include "stringhash.hpp"
#include "messagetypes.hpp"
#include "packethandler.hpp"

/** MESSAGE TO SELF: If I ever get the idea that this packet-class should contain ip address,
    DONT make it a member! Make it a feature of the Data instead. Otherwise I am at risk making
    the ip address class making its way everywhere in the program **/

/** Sole purpose of IPacket is to provide a function givetype in which
    the realizing child of IPacket may pass *this to the PacketHandler,
    such that the PacketHandler will know the underlying type of IPacket
    (the IPacket is telling its type!) **/
struct IPacket {
    virtual void greet(PacketHandler* ph) = 0;
};

//Representing objects as unsigned int is probably the easiest way
//but template is here to allow user to pass any type in the packet
//caution: objects with pointers wont work as data, obviously,
//since memory pointed to by pointers aren't the same across
//machines...
template<class Data, MESSAGE_TYPE Message>
class Packet : public IPacket {
private:
    uint16_t protocol;
    uint16_t sequence;
    unsigned int datasize;
    MESSAGE_TYPE type;

    //Dont move data any further up - it will cause invalid read of
    //protocol, sequence, type and datasize before the packet was
    //typecasted to the correct type
    Data data;
public:
    constexpr Packet() {}
    constexpr Packet(const unsigned int protocol, uint16_t sequence, const Data& data, unsigned int datasize) :
        protocol(protocol), sequence(sequence), type(Message), data(data), datasize(datasize) {
            static_assert(
                !std::is_pointer<Data>::value,
                "Sending pointers over network can't work. Try to copy the data pointed to by the pointer instead"
            );
        }

    template<class Archive>
    void serialize(Archive& ar) {
        ar(protocol, sequence, datasize, type, data);
    }

    constexpr uint16_t getProtocol() const { return protocol; }
    constexpr uint16_t getSequence() const { return sequence; }
    constexpr MESSAGE_TYPE getType() const { return type; }
    constexpr const Data& getData() const { return data; }
    constexpr Data& getData() { return data; }
    constexpr unsigned int getDataSize() { return datasize; }

    /** FIXME: This cant ever work because PacketHandlers expect "ConnectToServerData" or such,
        which is never available from here (only the enum "MESSAGE_TYPE" or actual raw-data is available here **/
    void greet(PacketHandler* ph) override {
        static_assert(!std::is_same<decltype(data), bool>::value, "Packet: data is wrongly of type bool, you want data to be of type found in messagetypes.hpp");
        ph->handle(&data);
    }

};

#endif //PACKET_HPP


text:
var args = arguments[0] || {};
var homeworkModel = Alloy.createCollection('homework');
var homeworkAttachmentModel = Alloy.createCollection('homeworkAttachment');
COMMON.construct($);
var homework_id = args.homework_id || "";
loadHomeworktDetails();
function loadHomeworktDetails(){
	var details = homeworkModel.getHomeworkById(homework_id);
	var attList = homeworkAttachmentModel.getRecordByHomework(homework_id);

	var titleLabel = $.UI.create('Label',{
		text: details.subject,
		classes : ["h4", "themeColor","padding",'bold']
	});

 	var view1 = $.UI.create('View',{
		classes :['hsize', 'vert','box','padding','wfill'],
		backgroundColor : "#ffffff",
		top:0
	});

	var viewBg = $.UI.create('View',{
		classes :['wfill', "hsize"],
		backgroundColor : "#f5f5f5",
	});
	var remarkLabel = $.UI.create('Label',{
		text: "Homework Remark",
		classes : ["h5", "hsize",'wfill',"padding","bold"]
	});
	viewBg.add(remarkLabel);
 	var contentLabel = $.UI.create('Label',{
		text: details.remark,
		classes : ["h5", "padding","hsize","font_light_grey"]
	});

 	view1.add(viewBg);
 	view1.add(contentLabel);

 	/**Updated**/
 	var view2 = $.UI.create('View',{
		classes :['hsize', 'vert','box','padding','wfill'],
		backgroundColor : "#ffffff",
		top:0
	});

	var viewBg2 = $.UI.create('View',{
		classes :['wfill', "hsize"],
		backgroundColor : "#f5f5f5",
	});
	var updatedLabel = $.UI.create('Label',{
		text: "Last Updated",
		classes : ["h5", "hsize",'wfill',"padding","bold"]
	});
	viewBg2.add(updatedLabel);

	var updated = details.updated;
	updated =   updated.substr(0, 10);

	var dateLabel = $.UI.create('Label',{
		text: monthFormat(updated) ,
		classes : ["h5", "padding","hsize",,"font_light_grey"]
	});
 	view2.add(viewBg2);
 	view2.add(dateLabel);

	/**Published**/
 	var view3 = $.UI.create('View',{
		classes :['hsize', 'vert','box','padding','wfill'],
		backgroundColor : "#ffffff",
		top:0
	});

	var viewBg3 = $.UI.create('View',{
		classes :['wfill', "hsize"],
		backgroundColor : "#f5f5f5",
	});
	var publishedLabel = $.UI.create('Label',{
		text: "Homework Publisher",
		classes : ["h5", "hsize",'wfill',"padding","bold"]
	});

 	var pubLabel = $.UI.create('Label',{
		text: details.published_by,
		classes : ["h5", "padding","hsize","font_light_grey"]
	});

	viewBg3.add(publishedLabel);
 	view3.add(viewBg3);
 	view3.add(pubLabel);
 	$.myContentView.add(titleLabel);
 	$.myContentView.add(view1);
 	$.myContentView.add(view2);
 	$.myContentView.add(view3);
 //	$.myContentView.add(separateHorzLine());

 	if(attList.length > 0){
 		var galleryLabel = $.UI.create('Label',{
				text:"Homework Attachment",
				classes : ["h5","hsize", "padding", 'themeColor']
		});
		/**Homework Attachment**/
	 	var view4 = $.UI.create('View',{
			classes :['hsize', 'vert','box','padding','wfill'],
			backgroundColor : "#ffffff",
			top:0
		});

		var viewBg4 = $.UI.create('View',{
			classes :['wfill', "hsize"],
			backgroundColor : "#f5f5f5",
		});
		var attachmentLabel = $.UI.create('Label',{
			text: "Homework Attachment",
			classes : ["h5", "hsize",'wfill',"padding",'bold']
		});

		viewBg4.add(attachmentLabel);
		var galleryListingView = Ti.UI.createView({
			left:2,
			layout: "horizontal",
			height:Ti.UI.SIZE,
			width :"auto"
		});
	 	var gal_counter = 0;
		attList.forEach(function(entry) {

					var cell = $.UI.create('View', {
						classes: ["cell","tiny_padding","hsize",'vert'],
						borderColor:"#10844D" ,
						width: "48.5%",
						source_id:  entry.id,
						position: gal_counter});

					var imageContainer = $.UI.create('View', {
						backgroundColor:"#000000" ,
						width: Ti.UI.FILL,
						height:150,
						position: gal_counter,
						source_id:  entry.id
					});
					var pad_cell = $.UI.create('View', {
						width: Ti.UI.FILL,
						height:Ti.UI.SIZE,
						position: gal_counter,
						source_id:  entry.id
					});
					var leftImg = entry.img_path;//entry.img_thumb;
					if(leftImg == ""){
						leftImg = "/images/default.png";
					}
					var newsImage = Ti.UI.createImageView({
				   		//defaultImage: "/images/loading_image.png",
						image: "",
						width: Ti.UI.FILL,
						height: Ti.UI.SIZE,
						position: gal_counter,
						source_id:  entry.id
					});
					API.loadRemoteImage(newsImage,leftImg);
					imageContainer.add(pad_cell);

					pad_cell.add(newsImage);
					cell.add(imageContainer);

					//addClickEvent(cell);
					galleryListingView.add(cell);
					//image event
					createGalleryEvent(newsImage,entry.id,gal_counter );

					gal_counter++;

		});

		view4.add(viewBg4);
	 	view4.add(galleryListingView);
		$.myContentView.add(view4);
 	}
	/***
	var titleLabel = $.UI.create('Label',{
		text: postDetails.title,
		classes : ["news_title"]
	});
	***/

}

function createGalleryEvent(adImage,e_id,position){
	adImage.addEventListener('click', function(e) {
    	var elbl = JSON.stringify(e.source);
		var res = JSON.parse(elbl);
		var win = Alloy.createController("school/attachmentDetails",{  id:homework_id,position: position, type: "homework" }).getView();

		Alloy.Globals.schooltabgroup.activeTab.open(win);
    });

}

function separateHorzLine(){
	return seperatorLine = Titanium.UI.createView({
		backgroundColor: "#D5D5D5",
		height:1,
		width:Ti.UI.FILL
	});
}

function closeWindow(){
	COMMON.closeWindow($.win);
}


text:
static NSString *const kwords              =        @"keywords";
static NSString *const kIconFileName       =        @"iconFileName";
//
static NSString *const kOfficeInstructions =        @"instructions";
static NSString *const kUrl                =        @"url";
static NSString *const kIsMedia            =        @"isMedia";
static NSString *const kAnswearingHours    =        @"answearing";
static NSString *const kVisit              =        @"visit";
//
static NSString *const kNurse              =        @"nurse";
static NSString *const kStation            =        @"station";
static NSString *const kEmail              =        @"email";
//
static NSString *const kShowInCategory     =        @"showInCategory";
static NSString *const kShowOnMap          =        @"showOnMap";
static NSString *const kIsShowInSearch     =        @"showInSearch";
static NSString *const kIsShowBubble       =        @"showBubble";
static NSString *const kIsAtZoomLevel      =        @"zoomLevel";
static NSString *const kMultiMedia         =        @"multiMedia";
//

static NSString *const kHead               =        @"head";
static NSString *const kGalleries          =        @"gallery";

#define kHeightForRowAtIndexPath    44.

////////////////////////////////////////////////////////////////////////////////////////
// Notification Keys
////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark Notification Keys

static NSString *const kLocalizationLanguageDidChangeNotification   = @"kLocalizationLanguageDidChangeNotification";

////////////////////////////////////////////////////////////////////////////////////////
// Macros
////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark Macros

#define LOCALIZATION(text) [HWSLocalization stringForKey:text]