text:
// -*- C++ -*-

//=============================================================================
/**
 *  @file    ETCL_Constraint.h
 *
 *  $Id$
 *
 *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
 *  @author Jeff Parsons (j.parsons@vanderbilt.edu)
 */
//=============================================================================

#ifndef ACE_ETCL_CONSTRAINT_H
#define ACE_ETCL_CONSTRAINT_H

#include /**/ "ace/pre.h"

#include "ace/SString.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/CDR_Base.h"

#include "ace/ETCL/ace_etcl_export.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

typedef unsigned long Literal_Type;

class ETCL_Constraint_Visitor;

class ACE_ETCL_Export ETCL_Constraint
{
public:
  /// Constructor and destructor
  ETCL_Constraint (void);
  virtual ~ETCL_Constraint (void);

  virtual int accept (ETCL_Constraint_Visitor *visitor);

protected:
  enum
  {
    ACE_ETCL_STRING,
    ACE_ETCL_DOUBLE,
    ACE_ETCL_UNSIGNED,
    ACE_ETCL_SIGNED,
    ACE_ETCL_INTEGER,
    ACE_ETCL_BOOLEAN,
    ACE_ETCL_COMPONENT,
    ACE_ETCL_UNKNOWN
  };
};

// ****************************************************************

class ACE_ETCL_Export ETCL_Literal_Constraint
  : public ETCL_Constraint
{
public:
  ETCL_Literal_Constraint (void);

  // = Constructors for each of the various types of literals.

  explicit ETCL_Literal_Constraint (ACE_CDR::ULong uinteger);
  explicit ETCL_Literal_Constraint (ACE_CDR::Long integer);
  explicit ETCL_Literal_Constraint (ACE_CDR::Boolean boolean);
  explicit ETCL_Literal_Constraint (ACE_CDR::Double doub);
  explicit ETCL_Literal_Constraint (const char* str);

  /// Copy constructor
  ETCL_Literal_Constraint (const ETCL_Literal_Constraint& lit);

  /// Destructor.
  virtual ~ETCL_Literal_Constraint(void);

  /// Visitor accept method.
  virtual int accept (ETCL_Constraint_Visitor* visitor);

  Literal_Type expr_type (void) const;

  /// Assignment operator.
  void operator= (const ETCL_Literal_Constraint& co);

  // Conversion routines.
  operator ACE_CDR::Boolean (void) const;
  operator ACE_CDR::ULong (void) const;
  operator ACE_CDR::Long (void) const;
  operator ACE_CDR::Double (void) const;
  operator const char* (void) const;

  // Return the type represented by this MysteryOperand.

  // = Boolean operators.

  bool
  operator< (const ETCL_Literal_Constraint& rhs);

  bool
  operator<= (const ETCL_Literal_Constraint& rhs);

  bool
  operator> (const ETCL_Literal_Constraint& rhs);

  bool
  operator>= (const ETCL_Literal_Constraint& rhs);

  bool
  operator== (const ETCL_Literal_Constraint& rhs);

  bool
  operator!= (const ETCL_Literal_Constraint& rhs);

  // = Arithmetic operators.

  ETCL_Literal_Constraint
  operator+ (const ETCL_Literal_Constraint& rhs);

  ETCL_Literal_Constraint
  operator- (const ETCL_Literal_Constraint& rhs);

  ETCL_Literal_Constraint
  operator* (const ETCL_Literal_Constraint& rhs);

  ETCL_Literal_Constraint
  operator/ (const ETCL_Literal_Constraint& rhs);

  // Unary minus.
  ETCL_Literal_Constraint
  operator- (void);

  /// Ensure both operands are of the same simple numeric type.
  virtual Literal_Type
  widest_type (const ETCL_Literal_Constraint& rhs);

protected:
  /// Private copy method.
  void copy (const ETCL_Literal_Constraint& co);

  /// Union of the possible literal types.
  union
  {
    char* str_;
    ACE_CDR::ULong uinteger_;
    ACE_CDR::Long integer_;
    ACE_CDR::Boolean bool_;
    ACE_CDR::Double double_;
  } op_;

  /// The actual types of the ETCL_Literal_Constraint.
  Literal_Type type_;
};

// ****************************************************************

class ACE_ETCL_Export ETCL_Identifier : public ETCL_Constraint
{
public:
  ETCL_Identifier (const char *value);

  /// Get the value
  const char *value (void) const;

  // = The Constraint methods.
  int accept (ETCL_Constraint_Visitor *visitor);

private:
  /// The value
  ACE_CString string_;
};

// ****************************************************************

class ACE_ETCL_Export ETCL_Union_Value : public ETCL_Constraint
{
public:
  ETCL_Union_Value (int sign,
                    ETCL_Constraint *integer);
  explicit ETCL_Union_Value (ETCL_Constraint *string = 0);
  virtual ~ETCL_Union_Value (void);

  int sign (void) const;
  ETCL_Literal_Constraint *integer (void) const;
  ETCL_Literal_Constraint *string (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  int sign_;
  ETCL_Literal_Constraint *integer_;
  ETCL_Literal_Constraint *string_;
};

class ACE_ETCL_Export ETCL_Union_Pos : public ETCL_Constraint
{
public:
  ETCL_Union_Pos (ETCL_Constraint *union_value = 0,
                  ETCL_Constraint *component = 0);
  virtual ~ETCL_Union_Pos (void);

  ETCL_Union_Value *union_value (void) const;
  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Union_Value *union_value_;
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Component_Pos : public ETCL_Constraint
{
public:
  ETCL_Component_Pos (ETCL_Constraint *integer = 0,
                      ETCL_Constraint *component = 0);
  virtual ~ETCL_Component_Pos (void);

  ETCL_Literal_Constraint *integer (void) const;
  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Literal_Constraint *integer_;
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Component_Assoc : public ETCL_Constraint
{
public:
  ETCL_Component_Assoc (ETCL_Constraint *identifier = 0,
                        ETCL_Constraint *component = 0);
  virtual ~ETCL_Component_Assoc (void);

  ETCL_Identifier *identifier (void) const;
  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Identifier *identifier_;
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Component_Array : public ETCL_Constraint
{
public:
  ETCL_Component_Array (ETCL_Constraint *integer = 0,
                        ETCL_Constraint *component = 0);
  virtual ~ETCL_Component_Array (void);

  ETCL_Literal_Constraint *integer (void) const;
  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Literal_Constraint *integer_;
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Special : public ETCL_Constraint
{
public:
  ETCL_Special (void);
  ETCL_Special (int type);
  virtual ~ETCL_Special (void);

  int type (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  int type_;
};

class ACE_ETCL_Export ETCL_Component : public ETCL_Constraint
{
public:
  ETCL_Component (ETCL_Constraint *identifier = 0,
                  ETCL_Constraint *component = 0);
  virtual ~ETCL_Component (void);

  ETCL_Identifier *identifier (void) const;
  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Identifier *identifier_;
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Dot : public ETCL_Constraint
{
public:
  explicit ETCL_Dot (ETCL_Constraint *component = 0);
  virtual ~ETCL_Dot (void);

  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Eval : public ETCL_Constraint
{
public:
  explicit ETCL_Eval (ETCL_Constraint *component = 0);
  virtual ~ETCL_Eval (void);

  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Default : public ETCL_Constraint
{
public:
  explicit ETCL_Default (ETCL_Constraint *component = 0);
  virtual ~ETCL_Default (void);

  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Exist : public ETCL_Constraint
{
public:
  explicit ETCL_Exist (ETCL_Constraint *component = 0);
  virtual ~ETCL_Exist (void);

  ETCL_Constraint *component (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  ETCL_Constraint *component_;
};

class ACE_ETCL_Export ETCL_Unary_Expr : public ETCL_Constraint
{
public:
  ETCL_Unary_Expr (int type,
                   ETCL_Constraint *subexpr);
  virtual ~ETCL_Unary_Expr (void);

  int type (void) const;
  ETCL_Constraint *subexpr (void) const;

  int accept (ETCL_Constraint_Visitor *visitor);

private:
  int type_;
  ETCL_Constraint *subexpr_;
};

class ACE_ETCL_Export ETCL_Binary_Expr : public ETCL_Constraint
{
public:
  ETCL_Binary_Expr (int type,
                    ETCL_Constraint *lhs,
                    ETCL_Constraint *rhs);
  virtual ~ETCL_Binary_Expr (void);

  int type (void) const;
  ETCL_Constraint *rhs (void) const;
  ETCL_Constraint *lhs (void) const;

  int accept (ETCL_Constraint_Visitor *visitor);

private:
  int type_;
  ETCL_Constraint *lhs_;
  ETCL_Constraint *rhs_;
};

class ACE_ETCL_Export ETCL_Preference : public ETCL_Constraint
{
public:
  ETCL_Preference (void);
  ETCL_Preference (int type,
                   ETCL_Constraint *subexpr = 0);
  virtual ~ETCL_Preference (void);

  int type (void) const;
  ETCL_Constraint *subexpr (void) const;

  virtual int accept (ETCL_Constraint_Visitor *visitor);

private:
  int type_;
  ETCL_Constraint *subexpr_;
};

ACE_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
#include "ace/ETCL/ETCL_Constraint.inl"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif // ACE_ETCL_CONSTRAINT_H


text:
layout: home
title: Admin hooks - Modules
sidebar: plugin
lang: en
subnav: plugin_hook
---

Modules : Admin Hooks

Using hooks, you can insert blocks of code in many parts of the Back-office.

Doing this is very simple. You just have to create a html file (file name is important and depends on the hook) in your AdminIncludes folder
and it will be parsed and included in the Back-office.

Your file must have the same name as the hook you want your markup to affect. For example, if the hook name is ```product-edit```, my file name must be ```product-edit.html```.

You can discover all available hooks if you put ```SHOW_HOOK=1``` in your query string. This only work in debug mode.

redpajama_set_name: RedPajamaGithub


text:
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Network.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using AutoMapper;
using CNM = Microsoft.Azure.Commands.Network.Models;
using MNM = Microsoft.Azure.Management.Network.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;

namespace Microsoft.Azure.Commands.Network.Automation
{
    [Cmdlet(VerbsCommon.Get, "AzureRMNetworkWatcherReachabilityReport", DefaultParameterSetName = "SetByName"), OutputType(typeof(PSAzureReachabilityReport))]
    public partial class GetAzureRMNetworkWatcherReachabilityReport : NetworkBaseCmdlet
    {
        [Parameter(
            Mandatory = true,
            ValueFromPipeline = true,
            HelpMessage = "The network watcher resource",
            ParameterSetName = "SetByResource")]
        public PSNetworkWatcher NetworkWatcher { get; set; }

        [Alias("ResourceName", "Name")]
        [Parameter(
            Mandatory = true,
            HelpMessage = "The name of network watcher.",
            ParameterSetName = "SetByName")]
        [ValidateNotNullOrEmpty]
        public string NetworkWatcherName { get; set; }

        [Parameter(
            Mandatory = true,
            HelpMessage = "The name of the network watcher resource group.",
            ParameterSetName = "SetByName")]
        [ResourceGroupCompleter]
        [ValidateNotNullOrEmpty]
        public string ResourceGroupName { get; set; }

        [Parameter(
            Mandatory = true,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The Id of network watcher resource.",
            ParameterSetName = "SetByResourceId")]
        public string ResourceId { get; set; }

        [Parameter(
            Mandatory = false,
            HelpMessage = "List of Internet service providers.")]
        public List<string> Provider { get; set; }

        [Parameter(
            Mandatory = false,
            HelpMessage = "Optional Azure regions to scope the query to.")]
        [LocationCompleter("Microsoft.Network/networkWatchers")]
        public List<string> Location { get; set; }

        [Parameter(
            Mandatory = true,
            HelpMessage = "The start time for the Azure reachability report.")]
        public DateTime StartTime { get; set; }

        [Parameter(
            Mandatory = true,
            HelpMessage = "The end time for the Azure reachability report.")]
        public DateTime EndTime { get; set; }

        [Parameter(
            Mandatory = false,
            HelpMessage = "The name of the country.")]
        public string Country { get; set; }

        [Parameter(
            Mandatory = false,
            HelpMessage = "The name of the state.")]
        public string State { get; set; }

        [Parameter(
            Mandatory = false,
            HelpMessage = "The name of the city.")]
        public string City { get; set; }

        [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
        public SwitchParameter AsJob { get; set; }

        public override void Execute()
        {
            base.Execute();

            // ProviderLocation
            PSAzureReachabilityReportLocation vProviderLocation = null;

            if (this.Country != null)
            {
                if (vProviderLocation == null)
                {
                    vProviderLocation = new PSAzureReachabilityReportLocation();
                }
                vProviderLocation.Country = this.Country;
            }

            if (this.State != null)
            {
                if (vProviderLocation == null)
                {
                    vProviderLocation = new PSAzureReachabilityReportLocation();
                }
                vProviderLocation.State = this.State;
            }

            if (this.City != null)
            {
                if (vProviderLocation == null)
                {
                    vProviderLocation = new PSAzureReachabilityReportLocation();
                }
                vProviderLocation.City = this.City;
            }

            var vAzureReachabilityReportParameters = new AzureReachabilityReportParameters
            {
                Providers = this.Provider,
                AzureLocations = this.Location,
                StartTime = this.StartTime,
                EndTime = this.EndTime,
                ProviderLocation = NetworkResourceManagerProfile.Mapper.Map < MNM.AzureReachabilityReportLocation >(vProviderLocation),
            };

            if (string.Equals(this.ParameterSetName, "SetByResource", StringComparison.OrdinalIgnoreCase))
            {
                ResourceGroupName = this.NetworkWatcher.ResourceGroupName;
                NetworkWatcherName = this.NetworkWatcher.Name;
            }

            if (string.Equals(this.ParameterSetName, "SetByResourceId", StringComparison.OrdinalIgnoreCase))
            {
                var resourceInfo = new ResourceIdentifier(this.ResourceId);
                ResourceGroupName = resourceInfo.ResourceGroupName;
                NetworkWatcherName = resourceInfo.ResourceName;
            }

            var vNetworkWatcherResult = this.NetworkClient.NetworkManagementClient.NetworkWatchers.GetAzureReachabilityReport(ResourceGroupName, NetworkWatcherName, vAzureReachabilityReportParameters);
            var vNetworkWatcherModel = NetworkResourceManagerProfile.Mapper.Map<PSAzureReachabilityReport>(vNetworkWatcherResult);
            WriteObject(vNetworkWatcherModel);
        }
    }
}


text:
/*
	Module: rt2x00pci
	Abstract: rt2x00 generic pci device routines.
 */

#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>

#include "rt2x00.h"
#include "rt2x00pci.h"

/*
 * Register access.
 */
int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
			   const unsigned int offset,
			   const struct rt2x00_field32 field,
			   u32 *reg)
{
	unsigned int i;

	for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
		rt2x00pci_register_read(rt2x00dev, offset, reg);
		if (!rt2x00_get_field32(*reg, field))
			return 1;
		udelay(REGISTER_BUSY_DELAY);
	}

	ERROR(rt2x00dev, "Indirect register access failed: "
	      "offset=0x%.08x, value=0x%.08x\n", offset, *reg);
	*reg = ~0;

	return 0;
}
EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read);

/*
 * TX data handlers.
 */
int rt2x00pci_write_tx_data(struct queue_entry *entry)
{
	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
	struct queue_entry_priv_pci *entry_priv = entry->priv_data;
	struct skb_frame_desc *skbdesc;

	/*
	 * This should not happen, we already checked the entry
	 * was ours. When the hardware disagrees there has been
	 * a queue corruption!
	 */
	if (unlikely(rt2x00dev->ops->lib->get_entry_state(entry))) {
		ERROR(rt2x00dev,
		      "Corrupt queue %d, accessing entry which is not ours.\n"
		      "Please file bug report to %s.\n",
		      entry->queue->qid, DRV_PROJECT);
		return -EINVAL;
	}

	/*
	 * Fill in skb descriptor
	 */
	skbdesc = get_skb_frame_desc(entry->skb);
	skbdesc->desc = entry_priv->desc;
	skbdesc->desc_len = entry->queue->desc_size;

	return 0;
}
EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data);

/*
 * TX/RX data handlers.
 */
void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
{
	struct data_queue *queue = rt2x00dev->rx;
	struct queue_entry *entry;
	struct queue_entry_priv_pci *entry_priv;
	struct skb_frame_desc *skbdesc;

	while (1) {
		entry = rt2x00queue_get_entry(queue, Q_INDEX);
		entry_priv = entry->priv_data;

		if (rt2x00dev->ops->lib->get_entry_state(entry))
			break;

		/*
		 * Fill in desc fields of the skb descriptor
		 */
		skbdesc = get_skb_frame_desc(entry->skb);
		skbdesc->desc = entry_priv->desc;
		skbdesc->desc_len = entry->queue->desc_size;

		/*
		 * Send the frame to rt2x00lib for further processing.
		 */
		rt2x00lib_rxdone(rt2x00dev, entry);
	}
}
EXPORT_SYMBOL_GPL(rt2x00pci_rxdone);

/*
 * Device initialization handlers.
 */
static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,
				     struct data_queue *queue)
{
	struct queue_entry_priv_pci *entry_priv;
	void *addr;
	dma_addr_t dma;
	unsigned int i;

	/*
	 * Allocate DMA memory for descriptor and buffer.
	 */
	addr = dma_alloc_coherent(rt2x00dev->dev,
				  queue->limit * queue->desc_size,
				  &dma, GFP_KERNEL | GFP_DMA);
	if (!addr)
		return -ENOMEM;

	memset(addr, 0, queue->limit * queue->desc_size);

	/*
	 * Initialize all queue entries to contain valid addresses.
	 */
	for (i = 0; i < queue->limit; i++) {
		entry_priv = queue->entries[i].priv_data;
		entry_priv->desc = addr + i * queue->desc_size;
		entry_priv->desc_dma = dma + i * queue->desc_size;
	}

	return 0;
}

static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev,
				     struct data_queue *queue)
{
	struct queue_entry_priv_pci *entry_priv =
	    queue->entries[0].priv_data;

	if (entry_priv->desc)
		dma_free_coherent(rt2x00dev->dev,
				  queue->limit * queue->desc_size,
				  entry_priv->desc, entry_priv->desc_dma);
	entry_priv->desc = NULL;
}

int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)
{
	struct data_queue *queue;
	int status;

	/*
	 * Allocate DMA
	 */
	queue_for_each(rt2x00dev, queue) {
		status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue);
		if (status)
			goto exit;
	}

	/*
	 * Register interrupt handler.
	 */
	status = request_irq(rt2x00dev->irq, rt2x00dev->ops->lib->irq_handler,
			     IRQF_SHARED, rt2x00dev->name, rt2x00dev);
	if (status) {
		ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n",
		      rt2x00dev->irq, status);
		goto exit;
	}

	return 0;

exit:
	queue_for_each(rt2x00dev, queue)
		rt2x00pci_free_queue_dma(rt2x00dev, queue);

	return status;
}
EXPORT_SYMBOL_GPL(rt2x00pci_initialize);

void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev)
{
	struct data_queue *queue;

	/*
	 * Free irq line.
	 */
	free_irq(to_pci_dev(rt2x00dev->dev)->irq, rt2x00dev);

	/*
	 * Free DMA
	 */
	queue_for_each(rt2x00dev, queue)
		rt2x00pci_free_queue_dma(rt2x00dev, queue);
}
EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize);

/*
 * PCI driver handlers.
 */
static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev)
{
	kfree(rt2x00dev->rf);
	rt2x00dev->rf = NULL;

	kfree(rt2x00dev->eeprom);
	rt2x00dev->eeprom = NULL;

	if (rt2x00dev->csr.base) {
		iounmap(rt2x00dev->csr.base);
		rt2x00dev->csr.base = NULL;
	}
}

static int rt2x00pci_alloc_reg(struct rt2x00_dev *rt2x00dev)
{
	struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev);

	rt2x00dev->csr.base = pci_ioremap_bar(pci_dev, 0);
	if (!rt2x00dev->csr.base)
		goto exit;

	rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
	if (!rt2x00dev->eeprom)
		goto exit;

	rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
	if (!rt2x00dev->rf)
		goto exit;

	return 0;

exit:
	ERROR_PROBE("Failed to allocate registers.\n");

	rt2x00pci_free_reg(rt2x00dev);

	return -ENOMEM;
}

int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
{
	struct rt2x00_ops *ops = (struct rt2x00_ops *)id->driver_data;
	struct ieee80211_hw *hw;
	struct rt2x00_dev *rt2x00dev;
	int retval;
	u16 chip;

	retval = pci_request_regions(pci_dev, pci_name(pci_dev));
	if (retval) {
		ERROR_PROBE("PCI request regions failed.\n");
		return retval;
	}

	retval = pci_enable_device(pci_dev);
	if (retval) {
		ERROR_PROBE("Enable device failed.\n");
		goto exit_release_regions;
	}

	pci_set_master(pci_dev);

	if (pci_set_mwi(pci_dev))
		ERROR_PROBE("MWI not available.\n");

	if (dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32))) {
		ERROR_PROBE("PCI DMA not supported.\n");
		retval = -EIO;
		goto exit_disable_device;
	}

	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
	if (!hw) {
		ERROR_PROBE("Failed to allocate hardware.\n");
		retval = -ENOMEM;
		goto exit_disable_device;
	}

	pci_set_drvdata(pci_dev, hw);

	rt2x00dev = hw->priv;
	rt2x00dev->dev = &pci_dev->dev;
	rt2x00dev->ops = ops;
	rt2x00dev->hw = hw;
	rt2x00dev->irq = pci_dev->irq;
	rt2x00dev->name = pci_name(pci_dev);

	/*
	 * Determine RT chipset by reading PCI header.
	 */
	pci_read_config_word(pci_dev, PCI_DEVICE_ID, &chip);
	rt2x00_set_chip_rt(rt2x00dev, chip);

	retval = rt2x00pci_alloc_reg(rt2x00dev);
	if (retval)
		goto exit_free_device;

	retval = rt2x00lib_probe_dev(rt2x00dev);
	if (retval)
		goto exit_free_reg;

	return 0;

exit_free_reg:
	rt2x00pci_free_reg(rt2x00dev);

exit_free_device:
	ieee80211_free_hw(hw);

exit_disable_device:
	if (retval != -EBUSY)
		pci_disable_device(pci_dev);

exit_release_regions:
	pci_release_regions(pci_dev);

	pci_set_drvdata(pci_dev, NULL);

	return retval;
}
EXPORT_SYMBOL_GPL(rt2x00pci_probe);

void rt2x00pci_remove(struct pci_dev *pci_dev)
{
	struct ieee80211_hw *hw = pci_get_drvdata(pci_dev);
	struct rt2x00_dev *rt2x00dev = hw->priv;

	/*
	 * Free all allocated data.
	 */
	rt2x00lib_remove_dev(rt2x00dev);
	rt2x00pci_free_reg(rt2x00dev);
	ieee80211_free_hw(hw);

	/*
	 * Free the PCI device data.
	 */
	pci_set_drvdata(pci_dev, NULL);
	pci_disable_device(pci_dev);
	pci_release_regions(pci_dev);
}
EXPORT_SYMBOL_GPL(rt2x00pci_remove);

#ifdef CONFIG_PM
int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state)
{
	struct ieee80211_hw *hw = pci_get_drvdata(pci_dev);
	struct rt2x00_dev *rt2x00dev = hw->priv;
	int retval;

	retval = rt2x00lib_suspend(rt2x00dev, state);
	if (retval)
		return retval;

	pci_save_state(pci_dev);
	pci_disable_device(pci_dev);
	return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
}
EXPORT_SYMBOL_GPL(rt2x00pci_suspend);

int rt2x00pci_resume(struct pci_dev *pci_dev)
{
	struct ieee80211_hw *hw = pci_get_drvdata(pci_dev);
	struct rt2x00_dev *rt2x00dev = hw->priv;

	if (pci_set_power_state(pci_dev, PCI_D0) ||
	    pci_enable_device(pci_dev) ||
	    pci_restore_state(pci_dev)) {
		ERROR(rt2x00dev, "Failed to resume device.\n");
		return -EIO;
	}

	return rt2x00lib_resume(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00pci_resume);
#endif /* CONFIG_PM */

/*
 * rt2x00pci module information.
 */
MODULE_AUTHOR(DRV_PROJECT);
MODULE_VERSION(DRV_VERSION);
MODULE_DESCRIPTION("rt2x00 pci library");
MODULE_LICENSE("GPL");


text:
<?php namespace App\Http\Controllers;

use Input;
use Redirect;
use App\Player;
use App\Match;
use App\Http\Requests;
use App\PlayerEvaluation;
use App\EvaluationScore;
use App\EvaluationCategory;
use App\Http\Controllers\Controller;
//use App\Opponent;
use Illuminate\Http\Request;

class PlayersOpponentController extends Controller {

	/**
	 * Create a new controller instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		$this->middleware('auth');
	}

	/**
	 * Display a listing of the resource.
	 *
	 * @return Response
	 */
	public function index($player, $entry)
	{

		$opplogs = (object) array();
		$opponents = Player::orderBy('full_name');

		return view('pages/players/journal/opponent/index', compact('player', 'entry', 'opponents', 'opplogs'));
	}

	public function listEvaluations($player, $opponent, $entry)
	{

		$evaluations = PlayerEvaluation::where('player_id', '=', $opponent->player_id)
			->where('creator_id', '=', $player->player_id)
			->orderBy('created_at', 'desc')
			->paginate(10);

		return view('pages/players/journal/opponent/evaluation/index', compact('player', 'entry', 'evaluations'));
	}

	/**
	 * Show the form for creating a new resource.
	 *
	 * @return Response
	 */
	public function create($player,$entry)
	{
		$target_id = -1;
		$players = Player::orderby('last_name')->orderby('first_name')->get();
		$players_list = $players->lists('last_first_name', 'player_id');

		return view('pages/players/journal/opponent/create', compact('player', 'target_id', 'categories', 'entry', 'players_list'));
	}

	/**
	 * Show the form for creating a new resource.
	 *
	 * @return Response
	 */
	public function createEvaluation($player,$entry, $opponent_id)
	{

		$categories = EvaluationCategory::all();
		$opponent = Player::find($opponent_id);
		return view('pages/players/journal/opponent/evaluate', compact('player', 'opponent', 'categories', 'entry'));
	}

	/**
	 * Store a newly created resource in storage.
	 *
	 * @return Response
	 */
	public function store($player, $entry)
	{

		$input = Input::all();

		// 1. Create a new Player Evaluation Form
		$opp = Opponent::create(['player_id' => $player->player_id, 'title' => $input["eval_title:"]]);

		// 2. Loop through input and save
		foreach ($categories as $c) {
		 	foreach ($c->subcategories as $s) {
		 		$score = $input["score-$c->category_id-$s->subcategory_id"];
		 		$comment =  $input["comment-$c->category_id-$s->subcategory_id"];

				$eval_score = EvaluationScore::create(['evaluation_id' => $eval->evaluation_id,
					'category_id' => $c->category_id,
					'subcategory_id' => $s->subcategory_id,
					'score' => $score,
					'comment' => $comment,
					]);
			}
		}

		return Redirect::route('opponent.show', [$player->player_id, $entry, $log->id])
		 	->with('flash', 'Opponent Entry Saved');
	}

	/**
	 * Display the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function show($player, $entry, $opponent_id)
	{

		$opponent = Player::find($opponent_id);
		$opplog = []; // OpponentLog::where('opponent_id' , '=', $opponent_id);

		//Match History
		$h2h = new Match();
		$head2head = $h2h->head2head($player->player_id, $opponent->player_id);

		//Evaluation
		$evaluation_id = 28; // get opponent evalution_id by table PlayerID -> entry_ID -> Opponent_id
		$categories = EvaluationCategory::all();
		$evaluation = PlayerEvaluation::find($evaluation_id);
		$scores =EvaluationScore::where('evaluation_id' , '=', $evaluation_id);

		//Notes
		//
		//
		//
		return view('pages/players/journal/opponent/show',
			compact('player', 'entry' ,'opponent', 'opplog', 'head2head', 'evaluation', 'categories', 'scores'));
	}

	/**
	 * Show the form for editing the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function edit($player, $entry, $opponent)
	{
		//
	}

	/**
	 * Update the specified resource in storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function update($player, $entry, $opponent)
	{
		//
	}

	/**
	 * Remove the specified resource from storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function destroy($id)
	{
		//
	}

	/**
	 * Player Tournament History
	 */
	public function getTournaments($player){

		$matches = $player->getMatches();
		$tournaments = $player->getTournaments();

		//return view('pages/players/show', compact('player', 'matches', 'tournaments'));
		return view('pages/players/tournaments', compact('player', 'matches', 'tournaments'));
	}

	/**
	 * Player Tournament History
	 */
	public function getBio($player){

		return view('pages/players/bio', compact('player'));
	}
}


text:
package com.hantsylabs.example.spring.web;

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

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.web.jsf.FacesContextUtils;

import com.hantsylabs.example.spring.jpa.TaskRepository;
import com.hantsylabs.example.spring.model.Status;
import com.hantsylabs.example.spring.model.Task;

/**
 *
 * @author hantsy
 *
 */
@Named("taskHome")
@Scope(value = "view")
public class TaskHome {
	private static final Logger log = LoggerFactory.getLogger(TaskHome.class);

	@Inject
	private TaskRepository taskRepository;

	private List<TaskDetails> todotasks = new ArrayList<>();

	private List<TaskDetails> doingtasks = new ArrayList<>();

	private List<TaskDetails> donetasks = new ArrayList<>();

	public List<TaskDetails> getTodotasks() {
		return todotasks;
	}

	public List<TaskDetails> getDoingtasks() {
		return doingtasks;
	}

	public List<TaskDetails> getDonetasks() {
		return donetasks;
	}

	public void init() {
		log.debug("initalizing...");
		if (!FacesContext.getCurrentInstance().isPostback()) {
			retrieveAllTasks();
		}
	}

	private void retrieveAllTasks() {
		log.debug("retriveing all tasks...");
		this.todotasks = findTasksByStatus(Status.TODO);
		this.doingtasks = findTasksByStatus(Status.DOING);
		this.donetasks = findTasksByStatus(Status.DONE);
	}

	private List<TaskDetails> findTasksByStatus(Status status) {
		List<TaskDetails> taskList = new ArrayList<TaskDetails>();
		List<Task> tasks = taskRepository.findByStatus(status, new Sort(Direction.DESC, "lastModifiedDate"));

		for (Task task : tasks) {
			TaskDetails details = new TaskDetails();
			details.setId(task.getId());
			details.setName(task.getName());
			details.setDescription(task.getDescription());
			details.setCreatedDate(task.getCreatedDate());
			details.setLastModifiedDate(task.getLastModifiedDate());
			taskList.add(details);
		}

		return taskList;
	}

	public void deleteTask(Long id) {

		log.debug("delete task of id@" + id);

		Task task = taskRepository.findOne(id);

		if (task == null) {
			throw new TaskNotFoundException(id);
		}

		taskRepository.delete(id);

		// retrieve all tasks
		retrieveAllTasks();

		FacesMessage deleteInfo= new FacesMessage(FacesMessage.SEVERITY_WARN, "Task is deleted!",  "Task is deleted!");
		FacesContext.getCurrentInstance().addMessage(null, deleteInfo);
	}

	public void markTaskDoing(Long id) {
		log.debug("changing task DONG @" + id);

		Task task = taskRepository.findOne(id);

		if (task == null) {
			throw new TaskNotFoundException(id);
		}

		task.setStatus(Status.DOING);

		taskRepository.save(task);

		// retrieve all tasks
		retrieveAllTasks();
	}

	public void markTaskDone(Long id) {
		log.debug("changing task DONE @" + id);

		Task task = taskRepository.findOne(id);

		if (task == null) {
			throw new TaskNotFoundException(id);
		}

		task.setStatus(Status.DONE);

		taskRepository.save(task);

		// retrieve all tasks
		retrieveAllTasks();

	}

}


text:
static NSString *const customEventErrorDomain = @"com.google.CustomEvent";

@interface SampleCustomEventInterstitial () <SampleInterstitialAdDelegate>

/// The Sample Ad Network interstitial.
@property(nonatomic, strong) SampleInterstitial *interstitial;

@end

@implementation SampleCustomEventInterstitial
@synthesize delegate;

#pragma mark GADCustomEventInterstitial implementation

- (void)requestInterstitialAdWithParameter:(NSString *)serverParameter
                                     label:(NSString *)serverLabel
                                   request:(GADCustomEventRequest *)request {
  self.interstitial = [[SampleInterstitial alloc] init];
  self.interstitial.delegate = self;
  self.interstitial.adUnit = serverParameter;
  SampleAdRequest *adRequest = [[SampleAdRequest alloc] init];
  adRequest.testMode = request.isTesting;
  adRequest.keywords = request.userKeywords;
  [self.interstitial fetchAd:adRequest];
}

/// Present the interstitial ad as a modal view using the provided view controller.
- (void)presentFromRootViewController:(UIViewController *)rootViewController {
  if ([self.interstitial isInterstitialLoaded]) {
    [self.interstitial show];
  }
}

#pragma mark SampleInterstitialAdDelegate implementation

- (void)interstitialDidLoad:(SampleInterstitial *)interstitial {
  [self.delegate customEventInterstitialDidReceiveAd:self];
}

- (void)interstitial:(SampleInterstitial *)interstitial
    didFailToLoadAdWithErrorCode:(SampleErrorCode)errorCode {
  NSError *error = [NSError errorWithDomain:customEventErrorDomain code:errorCode userInfo:nil];
  [self.delegate customEventInterstitial:self didFailAd:error];
}

- (void)interstitialWillPresentScreen:(SampleInterstitial *)interstitial {
  [self.delegate customEventInterstitialWillPresent:self];
}

- (void)interstitialWillDismissScreen:(SampleInterstitial *)interstitial {
  [self.delegate customEventInterstitialWillDismiss:self];
}

- (void)interstitialDidDismissScreen:(SampleInterstitial *)interstitial {
  [self.delegate customEventInterstitialDidDismiss:self];
}

- (void)interstitialWillLeaveApplication:(SampleInterstitial *)interstitial {
  [self.delegate customEventInterstitialWasClicked:self];
  [self.delegate customEventInterstitialWillLeaveApplication:self];
}

@end


text:
title: The Buried Giant
written_by:
isbn: '9780307455796'
binding: Paperback
link_to_buy_page:
image_path: 'https://images.booksense.com/images/796/455/9780307455796.jpg'
---


text:
using filesystem::mojom::FileError;

namespace leveldb {
namespace {

template <typename... Args> void IgnoreAllArgs(Args&&...) {}

template <typename... Args>
void DoCaptures(typename std::decay<Args>::type*... out_args,
                const base::Closure& quit_closure,
                Args... in_args) {
  IgnoreAllArgs((*out_args = std::move(in_args))...);
  quit_closure.Run();
}

template <typename T1>
base::Callback<void(T1)> Capture(T1* t1, const base::Closure& quit_closure) {
  return base::Bind(&DoCaptures<T1>, t1, quit_closure);
}

template <typename T1, typename T2>
base::Callback<void(T1, T2)> Capture(T1* t1,
                                     T2* t2,
                                     const base::Closure& quit_closure) {
  return base::Bind(&DoCaptures<T1, T2>, t1, t2, quit_closure);
}

template <typename T1>
base::Callback<void(const T1&)> CaptureConstRef(
    T1* t1,
    const base::Closure& quit_closure) {
  return base::Bind(&DoCaptures<const T1&>, t1, quit_closure);
}

template <typename T1, typename T2>
base::Callback<void(T1, const T2&)>
CaptureConstRef(T1* t1, T2* t2, const base::Closure& quit_closure) {
  return base::Bind(&DoCaptures<T1, const T2&>, t1, t2, quit_closure);
}

void DatabaseSyncPut(mojom::LevelDBDatabase* database,
                     const std::string& key,
                     const std::string& value,
                     mojom::DatabaseError* out_error) {
  base::RunLoop run_loop;
  database->Put(StdStringToUint8Vector(key), StdStringToUint8Vector(value),
                Capture(out_error, run_loop.QuitClosure()));
  run_loop.Run();
}

void DatabaseSyncGet(mojom::LevelDBDatabase* database,
                     const std::string& key,
                     mojom::DatabaseError* out_error,
                     std::vector<uint8_t>* out_value) {
  base::RunLoop run_loop;
  database->Get(StdStringToUint8Vector(key),
                CaptureConstRef(out_error, out_value, run_loop.QuitClosure()));
  run_loop.Run();
}

void DatabaseSyncGetPrefixed(mojom::LevelDBDatabase* database,
                             const std::string& key_prefix,
                             mojom::DatabaseError* out_error,
                             std::vector<mojom::KeyValuePtr>* out_key_values) {
  base::RunLoop run_loop;
  database->GetPrefixed(
      StdStringToUint8Vector(key_prefix),
      Capture(out_error, out_key_values, run_loop.QuitClosure()));
  run_loop.Run();
}

void DatabaseSyncDeletePrefixed(mojom::LevelDBDatabase* database,
                                const std::string& key_prefix,
                                mojom::DatabaseError* out_error) {
  base::RunLoop run_loop;
  database->DeletePrefixed(StdStringToUint8Vector(key_prefix),
                           Capture(out_error, run_loop.QuitClosure()));
  run_loop.Run();
}

void LevelDBSyncOpenInMemory(mojom::LevelDBService* leveldb,
                             mojom::LevelDBDatabaseAssociatedRequest database,
                             mojom::DatabaseError* out_error) {
  base::RunLoop run_loop;
  leveldb->OpenInMemory(std::move(database),
                        Capture(out_error, run_loop.QuitClosure()));
  run_loop.Run();
}

class LevelDBServiceTest : public service_manager::test::ServiceTest {
 public:
  LevelDBServiceTest() : ServiceTest("leveldb_service_unittests") {}
  ~LevelDBServiceTest() override {}

 protected:
  // Overridden from mojo::test::ApplicationTestBase:
  void SetUp() override {
    ServiceTest::SetUp();
    connector()->BindInterface("filesystem", &files_);
    connector()->BindInterface("leveldb", &leveldb_);
  }

  void TearDown() override {
    leveldb_.reset();
    files_.reset();
    ServiceTest::TearDown();
  }

  // Note: This has an out parameter rather than returning the |DirectoryPtr|,
  // since |ASSERT_...()| doesn't work with return values.
  void GetTempDirectory(filesystem::mojom::DirectoryPtr* directory) {
    FileError error = FileError::FAILED;
    bool handled = files()->OpenTempDirectory(MakeRequest(directory), &error);
    ASSERT_TRUE(handled);
    ASSERT_EQ(FileError::OK, error);
  }

  filesystem::mojom::FileSystemPtr& files() { return files_; }
  mojom::LevelDBServicePtr& leveldb() { return leveldb_; }

 private:
  filesystem::mojom::FileSystemPtr files_;
  mojom::LevelDBServicePtr leveldb_;

  DISALLOW_COPY_AND_ASSIGN(LevelDBServiceTest);
};

TEST_F(LevelDBServiceTest, Basic) {
  mojom::DatabaseError error;
  mojom::LevelDBDatabaseAssociatedPtr database;
  LevelDBSyncOpenInMemory(leveldb().get(),
                          MakeRequest(&database, leveldb().associated_group()),
                          &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Write a key to the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncPut(database.get(), "key", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Read the key back from the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  std::vector<uint8_t> value;
  DatabaseSyncGet(database.get(), "key", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ("value", Uint8VectorToStdString(value));

  // Delete the key from the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  base::RunLoop run_loop;
  database->Delete(StdStringToUint8Vector("key"),
                   Capture(&error, run_loop.QuitClosure()));
  run_loop.Run();
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Read the key back from the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  value.clear();
  DatabaseSyncGet(database.get(), "key", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::NOT_FOUND, error);
  EXPECT_EQ("", Uint8VectorToStdString(value));
}

TEST_F(LevelDBServiceTest, WriteBatch) {
  mojom::DatabaseError error;
  mojom::LevelDBDatabaseAssociatedPtr database;
  LevelDBSyncOpenInMemory(leveldb().get(),
                          MakeRequest(&database, leveldb().associated_group()),
                          &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Write a key to the database.
  DatabaseSyncPut(database.get(), "key", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Create a batched operation which both deletes "key" and adds another write.
  std::vector<mojom::BatchedOperationPtr> operations;
  mojom::BatchedOperationPtr item = mojom::BatchedOperation::New();
  item->type = mojom::BatchOperationType::DELETE_KEY;
  item->key = StdStringToUint8Vector("key");
  operations.push_back(std::move(item));

  item = mojom::BatchedOperation::New();
  item->type = mojom::BatchOperationType::PUT_KEY;
  item->key = StdStringToUint8Vector("other");
  item->value = StdStringToUint8Vector("more");
  operations.push_back(std::move(item));

  base::RunLoop run_loop;
  database->Write(std::move(operations),
                  Capture(&error, run_loop.QuitClosure()));
  run_loop.Run();
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Reading "key" should be invalid now.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  std::vector<uint8_t> value;
  DatabaseSyncGet(database.get(), "key", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::NOT_FOUND, error);
  EXPECT_EQ("", Uint8VectorToStdString(value));

  // Reading "other" should return "more"
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncGet(database.get(), "other", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ("more", Uint8VectorToStdString(value));

  // Write a some prefixed keys to the database.
  DatabaseSyncPut(database.get(), "prefix-key1", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  DatabaseSyncPut(database.get(), "prefix-key2", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Create a batched operation to delete them.
  operations.clear();
  item = mojom::BatchedOperation::New();
  item->type = mojom::BatchOperationType::DELETE_PREFIXED_KEY;
  item->key = StdStringToUint8Vector("prefix");
  operations.push_back(std::move(item));
  base::RunLoop run_loop2;
  database->Write(std::move(operations),
                  Capture(&error, run_loop2.QuitClosure()));
  run_loop2.Run();
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Reading all "prefix" keys should be invalid now.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  value.clear();
  DatabaseSyncGet(database.get(), "prefix-key1", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::NOT_FOUND, error);
  EXPECT_EQ("", Uint8VectorToStdString(value));
  // Reading "key" should be invalid now.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  value.clear();
  DatabaseSyncGet(database.get(), "prefix-key2", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::NOT_FOUND, error);
  EXPECT_EQ("", Uint8VectorToStdString(value));
}

TEST_F(LevelDBServiceTest, Reconnect) {
  mojom::DatabaseError error;

  filesystem::mojom::DirectoryPtr temp_directory;
  GetTempDirectory(&temp_directory);

  {
    filesystem::mojom::DirectoryPtr directory;
    temp_directory->Clone(MakeRequest(&directory));

    mojom::LevelDBDatabaseAssociatedPtr database;
    leveldb::mojom::OpenOptionsPtr options = leveldb::mojom::OpenOptions::New();
    options->error_if_exists = true;
    options->create_if_missing = true;
    base::RunLoop run_loop;
    leveldb()->OpenWithOptions(
        std::move(options), std::move(directory), "test",
        MakeRequest(&database, leveldb().associated_group()),
        Capture(&error, run_loop.QuitClosure()));
    run_loop.Run();
    EXPECT_EQ(mojom::DatabaseError::OK, error);

    // Write a key to the database.
    error = mojom::DatabaseError::INVALID_ARGUMENT;
    DatabaseSyncPut(database.get(), "key", "value", &error);
    EXPECT_EQ(mojom::DatabaseError::OK, error);

    // The database should go out of scope here.
  }

  {
    filesystem::mojom::DirectoryPtr directory;
    temp_directory->Clone(MakeRequest(&directory));

    // Reconnect to the database.
    mojom::LevelDBDatabaseAssociatedPtr database;
    base::RunLoop run_loop;
    leveldb()->Open(std::move(directory), "test",
                    MakeRequest(&database, leveldb().associated_group()),
                    Capture(&error, run_loop.QuitClosure()));
    run_loop.Run();
    EXPECT_EQ(mojom::DatabaseError::OK, error);

    // We should still be able to read the key back from the database.
    error = mojom::DatabaseError::INVALID_ARGUMENT;
    std::vector<uint8_t> value;
    DatabaseSyncGet(database.get(), "key", &error, &value);
    EXPECT_EQ(mojom::DatabaseError::OK, error);
    EXPECT_EQ("value", Uint8VectorToStdString(value));
  }
}

TEST_F(LevelDBServiceTest, Destroy) {
  mojom::DatabaseError error;

  filesystem::mojom::DirectoryPtr temp_directory;
  GetTempDirectory(&temp_directory);

  {
    filesystem::mojom::DirectoryPtr directory;
    temp_directory->Clone(MakeRequest(&directory));

    mojom::LevelDBDatabaseAssociatedPtr database;
    leveldb::mojom::OpenOptionsPtr options = leveldb::mojom::OpenOptions::New();
    options->error_if_exists = true;
    options->create_if_missing = true;
    base::RunLoop run_loop;
    leveldb()->OpenWithOptions(
        std::move(options), std::move(directory), "test",
        MakeRequest(&database, leveldb().associated_group()),
        Capture(&error, run_loop.QuitClosure()));
    run_loop.Run();
    EXPECT_EQ(mojom::DatabaseError::OK, error);

    // Write a key to the database.
    error = mojom::DatabaseError::INVALID_ARGUMENT;
    DatabaseSyncPut(database.get(), "key", "value", &error);
    EXPECT_EQ(mojom::DatabaseError::OK, error);

    // The database should go out of scope here.
  }

  {
    filesystem::mojom::DirectoryPtr directory;
    temp_directory->Clone(MakeRequest(&directory));

    // Destroy the database.
    base::RunLoop run_loop;
    leveldb()->Destroy(std::move(directory), "test",
                       Capture(&error, run_loop.QuitClosure()));
    run_loop.Run();
    EXPECT_EQ(mojom::DatabaseError::OK, error);
  }

  {
    filesystem::mojom::DirectoryPtr directory;
    temp_directory->Clone(MakeRequest(&directory));

    // Reconnect to the database should fail.
    mojom::LevelDBDatabaseAssociatedPtr database;
    base::RunLoop run_loop;
    leveldb()->Open(std::move(directory), "test",
                    MakeRequest(&database, leveldb().associated_group()),
                    Capture(&error, run_loop.QuitClosure()));
    run_loop.Run();
    EXPECT_EQ(mojom::DatabaseError::INVALID_ARGUMENT, error);
  }

  {
    filesystem::mojom::DirectoryPtr directory;
    temp_directory->Clone(MakeRequest(&directory));

    // Destroying a non-existant database should still succeed.
    base::RunLoop run_loop;
    leveldb()->Destroy(std::move(directory), "test",
                       Capture(&error, run_loop.QuitClosure()));
    run_loop.Run();
    EXPECT_EQ(mojom::DatabaseError::OK, error);
  }
}

TEST_F(LevelDBServiceTest, GetSnapshotSimple) {
  mojom::DatabaseError error;
  mojom::LevelDBDatabaseAssociatedPtr database;
  LevelDBSyncOpenInMemory(leveldb().get(),
                          MakeRequest(&database, leveldb().associated_group()),
                          &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  base::UnguessableToken snapshot;
  base::RunLoop run_loop;
  database->GetSnapshot(CaptureConstRef(&snapshot, run_loop.QuitClosure()));
  run_loop.Run();
  EXPECT_FALSE(snapshot.is_empty());
}

TEST_F(LevelDBServiceTest, GetFromSnapshots) {
  mojom::DatabaseError error;
  mojom::LevelDBDatabaseAssociatedPtr database;
  LevelDBSyncOpenInMemory(leveldb().get(),
                          MakeRequest(&database, leveldb().associated_group()),
                          &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Write a key to the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncPut(database.get(), "key", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Take a snapshot where key=value.
  base::UnguessableToken key_value_snapshot;
  base::RunLoop run_loop;
  database->GetSnapshot(
      CaptureConstRef(&key_value_snapshot, run_loop.QuitClosure()));
  run_loop.Run();

  // Change key to "yek".
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncPut(database.get(), "key", "yek", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // (Ensure this change is live on the database.)
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  std::vector<uint8_t> value;
  DatabaseSyncGet(database.get(), "key", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ("yek", Uint8VectorToStdString(value));

  // But if we were to read from the snapshot, we'd still get value.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  value.clear();
  base::RunLoop run_loop2;
  database->GetFromSnapshot(
      key_value_snapshot, StdStringToUint8Vector("key"),
      CaptureConstRef(&error, &value, run_loop2.QuitClosure()));
  run_loop2.Run();
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ("value", Uint8VectorToStdString(value));
}

TEST_F(LevelDBServiceTest, InvalidArgumentOnInvalidSnapshot) {
  mojom::LevelDBDatabaseAssociatedPtr database;
  mojom::DatabaseError error = mojom::DatabaseError::INVALID_ARGUMENT;
  LevelDBSyncOpenInMemory(leveldb().get(),
                          MakeRequest(&database, leveldb().associated_group()),
                          &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  base::UnguessableToken invalid_snapshot = base::UnguessableToken::Create();

  error = mojom::DatabaseError::OK;
  std::vector<uint8_t> value;
  base::RunLoop run_loop;
  database->GetFromSnapshot(
      invalid_snapshot, StdStringToUint8Vector("key"),
      CaptureConstRef(&error, &value, run_loop.QuitClosure()));
  run_loop.Run();
  EXPECT_EQ(mojom::DatabaseError::INVALID_ARGUMENT, error);
}

TEST_F(LevelDBServiceTest, MemoryDBReadWrite) {
  mojom::LevelDBDatabaseAssociatedPtr database;
  mojom::DatabaseError error = mojom::DatabaseError::INVALID_ARGUMENT;
  LevelDBSyncOpenInMemory(leveldb().get(),
                          MakeRequest(&database, leveldb().associated_group()),
                          &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Write a key to the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncPut(database.get(), "key", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Read the key back from the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  std::vector<uint8_t> value;
  DatabaseSyncGet(database.get(), "key", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ("value", Uint8VectorToStdString(value));

  // Delete the key from the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  base::RunLoop run_loop;
  database->Delete(StdStringToUint8Vector("key"),
                   Capture(&error, run_loop.QuitClosure()));
  run_loop.Run();
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  // Read the key back from the database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  value.clear();
  DatabaseSyncGet(database.get(), "key", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::NOT_FOUND, error);
  EXPECT_EQ("", Uint8VectorToStdString(value));
}

TEST_F(LevelDBServiceTest, Prefixed) {
  // Open an in memory database for speed.
  mojom::DatabaseError error = mojom::DatabaseError::INVALID_ARGUMENT;
  mojom::LevelDBDatabaseAssociatedPtr database;
  LevelDBSyncOpenInMemory(leveldb().get(),
                          MakeRequest(&database, leveldb().associated_group()),
                          &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);

  const std::string prefix("prefix");
  std::vector<mojom::KeyValuePtr> key_values;

  // Completely empty database.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncGetPrefixed(database.get(), prefix, &error, &key_values);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_TRUE(key_values.empty());

  // No values with our prefix, but values before and after.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncPut(database.get(), "a-before-prefix", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncPut(database.get(), "z-after-prefix", "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  key_values.clear();
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncGetPrefixed(database.get(), prefix, &error, &key_values);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_TRUE(key_values.empty());

  // One value with the exact prefix.
  DatabaseSyncPut(database.get(), prefix, "value", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  key_values.clear();
  DatabaseSyncGetPrefixed(database.get(), prefix, &error, &key_values);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ(1u, key_values.size());
  EXPECT_EQ("prefix", Uint8VectorToStdString(key_values[0]->key));
  EXPECT_EQ("value", Uint8VectorToStdString(key_values[0]->value));

  // Multiple values with starting with the prefix.
  DatabaseSyncPut(database.get(), (prefix + "2"), "value2", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  key_values.clear();
  DatabaseSyncGetPrefixed(database.get(), prefix, &error, &key_values);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ(2u, key_values.size());
  EXPECT_EQ("prefix", Uint8VectorToStdString(key_values[0]->key));
  EXPECT_EQ("value", Uint8VectorToStdString(key_values[0]->value));
  EXPECT_EQ("prefix2", Uint8VectorToStdString(key_values[1]->key));
  EXPECT_EQ("value2", Uint8VectorToStdString(key_values[1]->value));

  // Delete the prefixed values.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncDeletePrefixed(database.get(), prefix, &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  key_values.clear();
  DatabaseSyncGetPrefixed(database.get(), prefix, &error, &key_values);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_TRUE(key_values.empty());

  // Make sure the others are not deleted.
  std::vector<uint8_t> value;
  DatabaseSyncGet(database.get(), "a-before-prefix", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ("value", Uint8VectorToStdString(value));
  value.clear();
  DatabaseSyncGet(database.get(), "z-after-prefix", &error, &value);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ("value", Uint8VectorToStdString(value));

  // A key having our prefix, but no key matching it exactly.
  // Even thought there is no exact matching key, GetPrefixed
  // and DeletePrefixed still operate on the values.
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncPut(database.get(), (prefix + "2"), "value2", &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  key_values.clear();
  DatabaseSyncGetPrefixed(database.get(), prefix, &error, &key_values);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_EQ(1u, key_values.size());
  EXPECT_EQ("prefix2", Uint8VectorToStdString(key_values[0]->key));
  EXPECT_EQ("value2", Uint8VectorToStdString(key_values[0]->value));
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  DatabaseSyncDeletePrefixed(database.get(), prefix, &error);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  error = mojom::DatabaseError::INVALID_ARGUMENT;
  key_values.clear();
  DatabaseSyncGetPrefixed(database.get(), prefix, &error, &key_values);
  EXPECT_EQ(mojom::DatabaseError::OK, error);
  EXPECT_TRUE(key_values.empty());
}

}  // namespace
}  // namespace leveldb


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Core.Pipeline;

namespace Azure.MixedReality.Authentication
{
    /// <summary>
    /// Represents the Mixed Reality STS client for retrieving STS tokens used to access Mixed Reality services.
    /// </summary>
    public class MixedRealityStsClient
    {
        /// <summary>
        /// The token request scope.
        /// See https://docs.microsoft.com/azure/spatial-anchors/concepts/authentication.
        /// </summary>
        private const string TokenRequestScope = "https://sts.mixedreality.azure.com//.default";

        private readonly ClientDiagnostics _clientDiagnostics;

        private readonly HttpPipeline _pipeline;

        private readonly MixedRealityStsRestClient _restClient;

        /// <summary>
        /// Gets the Mixed Reality service account identifier.
        /// </summary>
        public Guid AccountId { get; }

        /// <summary>
        /// The Mixed Reality STS service endpoint.
        /// </summary>
        public Uri Endpoint { get; }

        /// <summary>
        /// Initializes a new instance of the <see cref="MixedRealityStsClient" /> class.
        /// </summary>
        /// <param name="accountId">The Mixed Reality service account identifier.</param>
        /// <param name="accountDomain">The Mixed Reality service account domain.</param>
        /// <param name="keyCredential">The Mixed Reality service account primary or secondary key credential.</param>
        /// <param name="options">The options.</param>
        public MixedRealityStsClient(Guid accountId, string accountDomain, AzureKeyCredential keyCredential, MixedRealityStsClientOptions options = null)
            : this(accountId, AuthenticationEndpoint.ConstructFromDomain(accountDomain), new MixedRealityAccountKeyCredential(accountId, keyCredential), options) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="MixedRealityStsClient" /> class.
        /// </summary>
        /// <param name="accountId">The Mixed Reality service account identifier.</param>
        /// <param name="endpoint">The Mixed Reality STS service endpoint.</param>
        /// <param name="keyCredential">The Mixed Reality service account primary or secondary key credential.</param>
        /// <param name="options">The options.</param>
        public MixedRealityStsClient(Guid accountId, Uri endpoint, AzureKeyCredential keyCredential, MixedRealityStsClientOptions options = null)
            : this(accountId, endpoint, new MixedRealityAccountKeyCredential(accountId, keyCredential), options) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="MixedRealityStsClient" /> class.
        /// </summary>
        /// <param name="accountId">The Mixed Reality service account identifier.</param>
        /// <param name="accountDomain">The Mixed Reality service account domain.</param>
        /// <param name="credential">The credential used to access the Mixed Reality service.</param>
        /// <param name="options">The options.</param>
        public MixedRealityStsClient(Guid accountId, string accountDomain, TokenCredential credential, MixedRealityStsClientOptions options = null)
            : this(accountId, AuthenticationEndpoint.ConstructFromDomain(accountDomain), credential, options) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="MixedRealityStsClient" /> class.
        /// </summary>
        /// <param name="accountId">The Mixed Reality service account identifier.</param>
        /// <param name="endpoint">The Mixed Reality STS service endpoint.</param>
        /// <param name="credential">The credential used to access the Mixed Reality service.</param>
        /// <param name="options">The options.</param>
        public MixedRealityStsClient(Guid accountId, Uri endpoint, TokenCredential credential, MixedRealityStsClientOptions options = null)
        {
            Argument.AssertNotDefault(ref accountId, nameof(accountId));
            Argument.AssertNotNull(endpoint, nameof(endpoint));
            Argument.AssertNotNull(credential, nameof(credential));

            options ??= new MixedRealityStsClientOptions();

            AccountId = accountId;
            Endpoint = endpoint;
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, TokenRequestScope));
            _restClient = new MixedRealityStsRestClient(_clientDiagnostics, _pipeline, endpoint, options.Version);
        }

#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.

        /// <summary>
        /// Initializes a new instance of the <see cref="MixedRealityStsClient"/> class.
        /// </summary>
        /// <remarks>
        /// Required for mocking.
        /// </remarks>
        protected MixedRealityStsClient()
        {
        }

#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.

        /// <summary>
        /// Retrieve a token from the STS service for the specified account identifier.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns><see cref="Response{AccessToken}"/>.</returns>
        public virtual Response<AccessToken> GetToken(CancellationToken cancellationToken = default)
        {
            MixedRealityTokenRequestOptions headerOptions = MixedRealityTokenRequestOptions.GenerateNew();

            using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MixedRealityStsClient)}.{nameof(GetToken)}");
            scope.AddAttribute(nameof(headerOptions.ClientRequestId), headerOptions.ClientRequestId);
            scope.Start();

            try
            {
                ResponseWithHeaders<StsTokenResponseMessage, MixedRealityStsGetTokenHeaders> response = _restClient.GetToken(AccountId, headerOptions, cancellationToken);

                return ResponseWithHeaders.FromValue(response.Value.ToAccessToken(), response.Headers, response.GetRawResponse());
            }
            catch (Exception ex)
            {
                scope.Failed(ex);
                throw;
            }
        }

        /// <summary>
        /// Retrieve a token from the STS service for the specified account identifier asynchronously.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns><see cref="Response{AccessToken}"/>.</returns>
        public virtual async Task<Response<AccessToken>> GetTokenAsync(CancellationToken cancellationToken = default)
        {
            MixedRealityTokenRequestOptions headerOptions = MixedRealityTokenRequestOptions.GenerateNew();

            using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MixedRealityStsClient)}.{nameof(GetToken)}");
            scope.AddAttribute(nameof(headerOptions.ClientRequestId), headerOptions.ClientRequestId);
            scope.Start();

            try
            {
                ResponseWithHeaders<StsTokenResponseMessage, MixedRealityStsGetTokenHeaders> response = await _restClient.GetTokenAsync(AccountId, headerOptions, cancellationToken).ConfigureAwait(false);

                return ResponseWithHeaders.FromValue(response.Value.ToAccessToken(), response.Headers, response.GetRawResponse());
            }
            catch (Exception ex)
            {
                scope.Failed(ex);
                throw;
            }
        }
    }
}


text:
#!/usr/bin/env node

const fs = require('node:fs');
const path = require('node:path');
const child_process = require('node:child_process');
const https = require('node:https');
const { text } = require('node:stream/consumers');

const browserify = path.resolve(path.join('node_modules', '.bin', 'browserify'));
const webpack = path.resolve(path.join('node_modules', '.bin', 'webpack'));
const coffee = path.resolve(path.join('node_modules', '.bin', 'coffee'));

function run(command, callback) {
  console.log(command);
  child_process.exec(command, { maxBuffer: 25 * 1024 * 1024 }, callback);
}

// Use browserify to package up source-map-support.js
fs.writeFileSync('.temp.js', 'sourceMapSupport = require("./source-map-support");');

run(browserify + ' .temp.js', (error, stdout) => {
  if (error) throw error;

  // Wrap the code so it works both as a normal <script> module and as an AMD module
  const header = [
    '/*',
    ' * Support for source maps in V8 stack traces',
    ' * https://github.com/evanw/node-source-map-support',
    ' */',
  ].join('\n');

  const code = [
    '(this["define"] || function(name, callback) { this["sourceMapSupport"] = callback(); })("browser-source-map-support", function(sourceMapSupport) {',
    stdout.replace(/\bbyte\b/g, 'bite').replace(new RegExp(__dirname + '/', 'g'), '').replace(/@license/g, 'license'),
    'return sourceMapSupport});',
  ].join('\n');

  // Use the online Google Closure Compiler service for minification
  const body = new URLSearchParams({
    compilation_level: 'SIMPLE_OPTIMIZATIONS',
    output_info: 'compiled_code',
    output_format: 'text',
    js_code: code
  });

  const buffer = new TextEncoder().encode(body.toString())

  console.log('making request to google closure compiler');

  const request = https.request({
    method: 'POST',
    host: 'closure-compiler.appspot.com',
    path: '/compile',
    headers: {
      'content-length': buffer.byteLength,
      'content-type': 'application/x-www-form-urlencoded'
    },
  });

  request.once('response', response => {
    text(response).then(stdout => {
      fs.unlinkSync('.temp.js');

      if (response.statusCode !== 200) {
        console.error(stdout);
        throw new Error('failed to post to closure compiler');
      }

      const code = header + '\n' + stdout;
      fs.writeFileSync('browser-source-map-support.js', code);
      fs.writeFileSync('amd-test/browser-source-map-support.js', code);
    });
  });

  request.end(buffer);
});

// Build the AMD test
run(coffee + ' --map --compile amd-test/script.coffee', error => {
  if (error) throw error;
});

// Build the browserify test
run(coffee + ' --map --compile browserify-test/script.coffee', error => {
  if (error) throw error;
  run(browserify + ' --debug browserify-test/script.js > browserify-test/compiled.js', error => {
    if (error) throw error;
  })
});

// Build the browser test
run(coffee + ' --map --compile browser-test/script.coffee', error => {
  if (error) throw error;
});

// Build the header test
run(coffee + ' --map --compile header-test/script.coffee', error => {
  if (error) throw error;
  const contents = fs.readFileSync('header-test/script.js', 'utf8');
  fs.writeFileSync('header-test/script.js', contents.replace(/\/\/# sourceMappingURL=.*/g, ''))
});

// Build the webpack test
child_process.exec(webpack, {cwd: 'webpack-test'}, error => {
  if (error) throw error;
});


text:
'''
MIT License

Copyright (c) 2017 Johan Kinnander

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

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

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

import pygame
import rover_sprite
from settings import *

class View:
	def __init__(self):
		pygame.init()
		pygame.display.set_caption("Hello PyGame")

		self.screen = pygame.display.set_mode(Settings.GAME_DIMENSIONS)

	def draw(self, sprite):
		allsprites = pygame.sprite.RenderPlain(sprite)

		self.screen.fill(Settings.BG_COLOR)

		allsprites.update()
		allsprites.draw(self.screen)

		pygame.display.flip()


text:
<?php

namespace ZaLaravel\LaravelRobokassa\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Models\Payment;
use Illuminate\Http\Request;
use DB;

/**
 * Class PaymentController
 * @package ZaLaravel\LaravelRobokassa\Controllers
 */
class PaymentController extends Controller {

	public function createPayment(Request $request)
    {
        \Auth::user();
        $user = $request->user()->id;
        $sum = $request->get('OutSum');
        $mrh_login = config('roboconfig.login');
        $mrh_pass1 = config('roboconfig.password1');
        $inv_id = mt_rand();
        $inv_desc = 'Пополнение баланса';
        $crc = md5($mrh_login.":".$sum.":".$inv_id.":".$mrh_pass1);

        if($sum != 0) {
            try {
                DB::beginTransaction();
                    $payment = new Payment();
                    $payment->uid = $inv_id;
                    $payment->user_id = $user;
                    $payment->balance = $sum;
                    $payment->description = $inv_desc;
                    $payment->operation = '+';
                    $payment->save();
                DB::commit();
            } catch (\PDOException $e){

                print $e->getMessage();
                DB::connection()->getPdo()->rollBack();
            }
        }
       /* return redirect()->action('ZaLaravel\LaravelRobokassa\Controllers\IpnRobokassaController@getResult',
            array('OutSum' => $sum, 'InvId' => $inv_id, 'SignatureValue' => $crc));*/
       header("Location: https://auth.robokassa.ru/Merchant/Index.aspx?MrchLogin=$mrh_login&OutSum=$sum&InvId=$inv_id&Desc=$inv_desc&SignatureValue=$crc");
    }
}


text:
package gnu.classpath.jdwp.event;

import gnu.classpath.jdwp.JdwpConstants;
import gnu.classpath.jdwp.VMIdManager;
import gnu.classpath.jdwp.id.ThreadId;
import gnu.classpath.jdwp.util.Location;

import java.io.DataOutputStream;
import java.io.IOException;

/**
 * Notification from the VM that that a method has been invoked
 *
 * @author Kyle Galloway (kgallowa@redhat.com)
 */
public class MethodEntryEvent
    extends Event
{
  // The thread where the event occurred
  private Thread _thread;

  // the location where the event occurred
  private Location _location;

  //object instance
  private Object _instance;

  /**
   * Constructs a new MethodEntryEvent
   *
   * @param thread the thread where the exception occurred
   * @param location the location single stepped to
   * @param instance instance from which the method was called
   */
  public MethodEntryEvent(Thread thread, Location location, Object instance)
  {
    super(JdwpConstants.EventKind.METHOD_ENTRY);
    _thread = thread;
    _location = location;
    _instance = instance;
  }

  /**
   * Returns a specific filtering parameter for this event. Valid types are
   * thread and location
   *
   * @param type the type of parameter desired
   * @returns the desired parameter or null
   */
  public Object getParameter(int type)
  {
    if (type == EVENT_THREAD)
      return _thread;
    else if (type == EVENT_LOCATION)
      return _location;
    else if (type == EVENT_INSTANCE)
      return _instance;
    else if (type == EVENT_CLASS)
      return _instance.getClass();

    return null;
  }

  /**
   * Writes the event to the given stream
   *
   * @param outStream the output stream to write the event to
   * @throws IOException
   */
  protected void _writeData(DataOutputStream outStream)
    throws IOException
  {
    VMIdManager idm = VMIdManager.getDefault();
    ThreadId tid = (ThreadId) idm.getObjectId(_thread);

    tid.write(outStream);
    _location.write(outStream);
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="e8ca43ff-d992-4629-bea3-1b818b4119ee" name="Default" comment="" />
    <ignored path="$PROJECT_DIR$/out/" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
      <file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/src/com/jw/stack/Main.java">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="234">
              <caret line="13" column="22" lean-forward="false" selection-start-line="13" selection-start-column="22" selection-end-line="13" selection-end-column="22" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="DynamicArrayStack.java" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="1188">
              <caret line="66" column="38" lean-forward="false" selection-start-line="66" selection-start-column="38" selection-end-line="66" selection-end-column="38" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FileTemplateManagerImpl">
    <option name="RECENT_TEMPLATES">
      <list>
        <option value="Class" />
      </list>
    </option>
  </component>
  <component name="GradleLocalSettings">
    <option name="externalProjectsViewState">
      <projects_view />
    </option>
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java" />
        <option value="$PROJECT_DIR$/src/com/jw/stack/Main.java" />
      </list>
    </option>
  </component>
  <component name="ProjectFrameBounds" extendedState="6">
    <option name="x" value="48" />
    <option name="y" value="-11" />
    <option name="width" value="1319" />
    <option name="height" value="780" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="AndroidView" />
      <pane id="PackagesPane" />
      <pane id="Scratches" />
      <pane id="Scope" />
      <pane id="ProjectPane">
        <subPane>
          <expand>
            <path>
              <item name="040602DynamicAarrayStack" type="b2602c69:ProjectViewProjectNode" />
              <item name="040602DynamicAarrayStack" type="462c0819:PsiDirectoryNode" />
            </path>
            <path>
              <item name="040602DynamicAarrayStack" type="b2602c69:ProjectViewProjectNode" />
              <item name="040602DynamicAarrayStack" type="462c0819:PsiDirectoryNode" />
              <item name="src" type="462c0819:PsiDirectoryNode" />
            </path>
            <path>
              <item name="040602DynamicAarrayStack" type="b2602c69:ProjectViewProjectNode" />
              <item name="040602DynamicAarrayStack" type="462c0819:PsiDirectoryNode" />
              <item name="src" type="462c0819:PsiDirectoryNode" />
              <item name="stack" type="462c0819:PsiDirectoryNode" />
            </path>
          </expand>
          <select />
        </subPane>
      </pane>
    </panes>
  </component>
  <component name="RunDashboard">
    <option name="ruleStates">
      <list>
        <RuleState>
          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
        </RuleState>
        <RuleState>
          <option name="name" value="StatusDashboardGroupingRule" />
        </RuleState>
      </list>
    </option>
  </component>
  <component name="RunManager" selected="Application.Main">
    <configuration name="Main" type="Application" factoryName="Application" temporary="true">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <option name="MAIN_CLASS_NAME" value="com.jw.stack.Main" />
      <option name="VM_PARAMETERS" value="" />
      <option name="PROGRAM_PARAMETERS" value="" />
      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" value="" />
      <option name="ENABLE_SWING_INSPECTOR" value="false" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <module name="040602DynamicAarrayStack" />
      <envs />
      <RunnerSettings RunnerId="Run" />
      <ConfigurationWrapper RunnerId="Run" />
    </configuration>
    <configuration default="true" type="Application" factoryName="Application">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <option name="MAIN_CLASS_NAME" />
      <option name="VM_PARAMETERS" />
      <option name="PROGRAM_PARAMETERS" />
      <option name="WORKING_DIRECTORY" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" />
      <option name="ENABLE_SWING_INSPECTOR" value="false" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <module name="" />
      <envs />
      <method />
    </configuration>
    <recent_temporary>
      <list size="1">
        <item index="0" class="java.lang.String" itemvalue="Application.Main" />
      </list>
    </recent_temporary>
  </component>
  <component name="ShelveChangesManager" show_recycled="false">
    <option name="remove_strategy" value="false" />
  </component>
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="e8ca43ff-d992-4629-bea3-1b818b4119ee" name="Default" comment="" />
      <created>1503449912136</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1503449912136</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="48" y="-11" width="1319" height="780" extended-state="6" />
    <editor active="true" />
    <layout>
      <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Palette	" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32985073" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24981017" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32985073" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/Main.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1188">
          <caret line="66" column="38" lean-forward="false" selection-start-line="66" selection-start-column="38" selection-end-line="66" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/Main.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1188">
          <caret line="66" column="38" lean-forward="false" selection-start-line="66" selection-start-column="38" selection-end-line="66" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/Main.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1188">
          <caret line="66" column="38" lean-forward="false" selection-start-line="66" selection-start-column="38" selection-end-line="66" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/Main.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="14" lean-forward="false" selection-start-line="0" selection-start-column="14" selection-end-line="0" selection-end-column="14" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1188">
          <caret line="66" column="38" lean-forward="false" selection-start-line="66" selection-start-column="38" selection-end-line="66" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/Main.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="14" lean-forward="false" selection-start-line="0" selection-start-column="14" selection-end-line="0" selection-end-column="14" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1062">
          <caret line="59" column="10" lean-forward="false" selection-start-line="59" selection-start-column="10" selection-end-line="59" selection-end-column="10" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/DynamicArrayStack.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1188">
          <caret line="66" column="38" lean-forward="false" selection-start-line="66" selection-start-column="38" selection-end-line="66" selection-end-column="38" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/jw/stack/Main.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="234">
          <caret line="13" column="22" lean-forward="false" selection-start-line="13" selection-start-column="22" selection-end-line="13" selection-end-column="22" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
using System;
using System.Collections.Generic;
using SFA.DAS.CommitmentsV2.Models;
using SFA.DAS.CommitmentsV2.Types;
using SFA.DAS.CommitmentsV2.Types.Dtos;

namespace SFA.DAS.CommitmentsV2.Application.Queries.GetCohortApprenticeships
{
    public class GetSupportCohortSummaryQueryResult
    {
        public long CohortId { get; set; }
        public string CohortReference { get; set; }
        public string AccountLegalEntityPublicHashedId { get; set; }
        public long AccountId { get; set; }
        public long AccountLegalEntityId { get; set; }
        public string LegalEntityName { get; set; }

        public long? ProviderId { get; set; }
        public string ProviderName { get; set; }

        /// <summary>
        ///     Indicates whether the cohort is funding by a transfer. Transfer funded cohorts cannot
        ///     use framework courses.
        /// </summary>
        public bool IsFundedByTransfer => TransferSenderId != null;

        public long? TransferSenderId { get; set; }
        public string TransferSenderName { get; set; }
        public int? PledgeApplicationId { get; set; }
        public Party WithParty { get; set; }
        public string LatestMessageCreatedByEmployer { get; set; }
        public string LatestMessageCreatedByProvider { get; set; }
        public LastAction LastAction { get; set; }
        public string LastUpdatedByEmployerEmail { get; set; }
        public string LastUpdatedByProviderEmail { get; set; }
        public bool IsApprovedByProvider { get; set; }
        public bool IsApprovedByEmployer { get; set; }
        public bool IsCompleteForEmployer { get; set; }
        public bool IsCompleteForProvider { get; set; }
        public Party Approvals { get; set; }
        public ApprenticeshipEmployerType LevyStatus { get; set; }
        public long? ChangeOfPartyRequestId { get; set; }
        public TransferApprovalStatus? TransferApprovalStatus { get; set; }
        public bool ApprenticeEmailIsRequired { get; set; }
        public EditStatus EditStatus { get; set; }
    }
}