text:
//
//  OpenForecast - open source, general-purpose forecasting package.
//  Copyright (C) 2002-2011  Steven R. Gould
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//

package net.sourceforge.openforecast;

import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.SortedMap;
import java.util.TreeMap;

/**
 * Represents a collection of data points. Data points are either observations
 * of past data (including both the values of the independent variables and the
 * observed value of the dependent variable), or forecasts or estimates of the
 * dependent variable (for a given set of independent variable values).
 *
 *
Generally when trying to forecast future values you'll use two data sets.
 * The first data set contains all of the observations, or historical data.
 * This data set is used to help initialize the selected forecasting model,
 * the details of which depend on the specific forecasting model. A second
 * data set is then created and initialized with data points describing the
 * values of the independent variables that are to be used to predict or
 * forecast values of the dependent variable.
 *
 *
When defining any data set it is important to provide as much information
 * as possible about the data. While on the surface it may seem trivial, the
 * more information you can provide about a data set (such as whether it is a
 * time-based series, the name of the independent variable representing time,
 * the number of data points/periods in a year), the better the forecasting
 * model will be able to model the data. This is because some models need this
 * type of data to even be applicable.
 * @author Steven R. Gould
 */
public class DataSet extends AbstractCollection<DataPoint>
{
    /**
     * Maintains the list of data points in this data set.
     */
    private Collection<DataPoint> dataPoints = new ArrayList<DataPoint>();

    /**
     * If this data set is a time-based series, then for best results the
     * timeVariable should be initialized to contain the name of the time
     * variable. If set to null, the data set is treated as being non
     * time-based.
     */
    private String timeVariable;

    /**
     * For time-series data, periodsPerYear should be initialized to the
     * number of periods - or data points - in a years worth of data.
     */
    private int periodsPerYear;

    /**
     * Constructs a new empty data set.
     */
    public DataSet()
    {
        timeVariable = null;
        periodsPerYear = 0;
    }

    /**
     * Copy constructor: constructs a new data set object by copying the given
     * data set.
     * @param dataSet the data set to copy from to initialize the new data set.
     */
    public DataSet( DataSet dataSet )
    {
        this( dataSet.getTimeVariable(),
              dataSet.getPeriodsPerYear(),
              dataSet.dataPoints );
    }

    /**
     * Constructs a new time-based data set with the named time variable, the
     * given number of data points in a year, and the given Collection of data
     * points. This is equivalent to using the default constructor, then
     * calling setTimeVariable, setPeriodsPerYear and addAll to initialize it.
     * @param timeVariable the name of the independent variable representing
     *        time.
     * @param periodsPerYear the number of periods - data points - in one years
     *        worth of data.
     * @param c a Collection of data points to initialize this data set with.
     * @see #setTimeVariable
     * @see #setPeriodsPerYear
     * @see #addAll
     */
    public DataSet( String timeVariable, int periodsPerYear, Collection<DataPoint> c )
    {
        this.timeVariable = timeVariable;
        this.periodsPerYear = periodsPerYear;

        addAll( c );
    }

    /**
     * Adds the given data point object to this data set.
     * @param obj the data point object to add to this set.
     * @return true if this collection changed as a result of the call. This is
     * consistent with the add method in the java.util.Collection class.
     * @throws ClassCastException if the specified object does not implement
     * the DataPoint interface.
     * @throws NullPointerException if the specified collection contains
     * one or more null elements.
     */
    public boolean add( DataPoint obj )
    {
        if ( obj == null )
            throw new NullPointerException("DataSet does not support addition of null DataPoints");

        return dataPoints.add( new Observation( (DataPoint)obj ) );
    }

    /**
     * Adds a collection of data points to this data set. All elements of the
     * collection must be DataPoints.
     * @param c a collection of data points to add to this data set.
     * @return true if this collection changed as a result of the call. This is
     * consistent with the add method in the java.util.Collection class.
     */
    public boolean addAll( Collection<? extends DataPoint> c )
    {
        // iterate through all elements in Collection
        //  adding a copy of each DataPoint to this DataSet
        Iterator<?> it = c.iterator();
        while ( it.hasNext() )
            add( (DataPoint)it.next() );

        return true;
    }

    /**
     * Removes all of the data points from this data set. This data set will
     * be empty after this method returns unless it throws an exception.
     */
    public void clear()
    {
        dataPoints.clear();
    }

    /**
     * Returns true if this data set contains no data points. Otherwise returns
     * false.
     * @return true if this data set is empty.
     */
    public boolean isEmpty()
    {
        return dataPoints.isEmpty();
    }

    /**
     * Returns true if this data set contains the given data point object; or
     * false otherwise. This data set is said to contain the given data point
     * iff dataPoint.equals(dp) returns true for some DataPoint
     * object, dp, within the set of data points.
     * @param obj the data point object to search for in this data set.
     * @return true if this data set contains dataPoint.
     * @throws ClassCastException if the specified object does not implement
     * the DataPoint interface.
     * @throws NullPointerException if the specified collection contains
     * one or more null elements.
     */
    public boolean contains( Object obj )
    {
        if ( obj == null )
            throw new NullPointerException("DataSet does not support null DataPoint objects");

        DataPoint dataPoint = (DataPoint)obj;

        Iterator<DataPoint> it = this.iterator();
        while ( it.hasNext() )
            {
                DataPoint dp = it.next();
                if ( dataPoint.equals(dp) )
                    return true;
            }

        return false;
    }

    /**
     * Returns true if this DataSet contains all of the DataPoints in the
     * specified collection.
     * @param c collection to be checked for containment in this collection.
     * @return true if this DataSet contains all of the DataPoints in the
     * specified collection.
     * @throws ClassCastException if the types of one or more elements in
     * the specified collection do not implement the DataPoint interface.
     * @throws NullPointerException if the specified collection contains
     * one or more null elements.
     */
    public boolean containsAll( Collection<?> c )
        throws ClassCastException, NullPointerException
    {
        Iterator<?> it = c.iterator();
        while ( it.hasNext() )
            {
                DataPoint dp = (DataPoint)it.next();
                if ( !this.contains(dp) )
                    return false;
            }

        return true;
    }

    /**
     * Removes a single instance of the specified data point object from this
     * data set, if it is present. Returns true if this collection contained
     * the specified element (or equivalently, if this collection changed as
     * a result of the call).
     * @param obj the data point object to remove from this data set.
     * @return true if this collection changed as a result of the call. This
     * is consistent with the add method in the java.util.Collection class.
     * @throws ClassCastException if the specified object does not implement
     * the DataPoint interface.
     * @throws NullPointerException if the specified collection contains
     * one or more null elements.
     */
    public boolean remove( Object obj )
    {
        if ( obj == null )
            throw new NullPointerException("DataSet does not support null DataPoint objects");

        return dataPoints.remove( (DataPoint)obj );
    }

    /**
     * Returns the number of data points in this data set. If this data
     * contains more than Integer.MAX_VALUE elements, returns
     * Integer.MAX_VALUE.
     * @return the number of data points in this data set.
     */
    public int size()
    {
        return dataPoints.size();
    }

    /**
     * Returns an iterator over the data points in this data set. There are
     * no guarantees concerning the order in which the elements are returned.
     * @return an iterator over the points in this data set.
     */
    public Iterator<DataPoint> iterator()
    {
        return dataPoints.iterator();
    }

    /**
     * Sorts the given data set according to increasing value of the named
     * independent variable. The initial implementation of this sort method
     * appears a little cumbersome - it may be more efficient later to
     * implement a small quicksort routine here instead.
     * @param independentVariable the name of the independent variable to
     *        set by. The resulting data set will be sorted in increasing
     *        value of this variable.
     */
    public void sort( String independentVariable )
    {
        // TODO: check that independentVariable is even defined for this set

        // Create a new sorted map using the given comparator
        SortedMap<Double,DataPoint> sortedMap = new TreeMap<Double,DataPoint>( new Comparator<Double>()
            {
                public int compare( Double o1, Double o2 )
                    {
                        return o1.compareTo(o2);
                    }
            } );

        // Add each element in the array list to the sorted map.
        Iterator<DataPoint> it = dataPoints.iterator();
        while ( it.hasNext() )
            {
                // By putting each DataPoint in the list, it will
                // automatically sort them by key
                DataPoint dp = it.next();
                sortedMap.put(
                              new Double(dp.getIndependentValue(independentVariable)),
                              dp );
            }

        // Clear dataPoints
        dataPoints.clear();

        // Add all values from sorted map back into list in sorted order
        dataPoints.addAll( sortedMap.values() );
    }

    /**
     * Returns an ordered array of all independent variable names used in this
     * data set. The array is guaranteed not to contain duplicate names.
     * @return a sorted array of unique independent variable names for this
     *         data set.
     */
    public String[] getIndependentVariables()
    {
        ArrayList<String> variables = new ArrayList<String>();
        Iterator<DataPoint> it = dataPoints.iterator();
        while ( it.hasNext() )
            {
                DataPoint dp = it.next();
                String[] names = dp.getIndependentVariableNames();

                for ( int i=0; i<names.length; i++ )
                    if ( !variables.contains( names[i] ) )
                        variables.add( names[i] );
            }

        // Sort list
        Collections.sort( variables );

        // Convert the ArrayList to a String[]
        int count = variables.size();
        String names[] = new String[count];
        for ( int i=0; i<count; i++ )
            names[i] = (String)(variables.get(i));

        return names;
    }

    /**
     * Sets the name of the time variable for this data set. If this is not
     * set, then the data set will be treated as being non time-based. In
     * addition to setting the time variable for time series data, it is
     * strongly recommended that you also initialize the number of periods per
     * year with a call to setPeriodsPerYear.
     * @param timeVariable the name of the independent variable that represents
     *        the time data component. For example, this may be something like
     *        "t", "month", "period", "year", and so on.
     * @see #setPeriodsPerYear
     */
    public void setTimeVariable( String timeVariable )
    {
        this.timeVariable = timeVariable;
    }

    /**
     * Returns the time variable associated with this data set, or
     * null if no time variable has been defined.
     * @return the time variable associated with this data set.
     */
    public String getTimeVariable()
    {
        return timeVariable;
    }

    /**
     * Sets the number of periods - or data points - in a years worth of data
     * for time-series data. If this is not set, then no seasonality effects
     * will be considered when forecasting using this data set.
     *
     *
In addition to setting the number of periods per year, you must also
     * set the time variable otherwise any forecasting model will not be able
     * to consider the potential effects of seasonality.
     * @param periodsPerYear the number of periods in a years worth of data.
     * @see #setTimeVariable
     */
    public void setPeriodsPerYear( int periodsPerYear )
    {
        if ( periodsPerYear < 1 )
            throw new IllegalArgumentException( "periodsPerYear parameter must be at least 1" );

        this.periodsPerYear = periodsPerYear;
    }

    /**
     * Returns the number of periods - or data points - in a years worth of
     * data for time-series data. If this has not been set, then a value of 0
     * will be returned.
     * @return the number of periods in a years worth of data.
     */
    public int getPeriodsPerYear()
    {
        return periodsPerYear;
    }

    /**
     * Not currently implemented - always throws UnsupportedOperationException.
     * Removes all this DataSet's elements that are also contained in the
     * specified collection of DataPoint objects. After this call returns,
     * this DataSet will contain no elements in common with the specified
     * collection.
     * @param c DataPoint objects to be removed from this collection.
     * @return true if this DataSet changed as a result of the call.
     * @throws UnsupportedOperationException if the removeAll method is not
     * supported by this collection.
     * @throws ClassCastException if the types of one or more elements in the
     * specified DataSet are not DataPoint objects.
     * @throws NullPointerException if the specified collection contains one
     * or more null elements.
     */
    public boolean removeAll( Collection<?> c )
        throws UnsupportedOperationException
    {
        // TODO: Implement DataSet.removeAll
        throw new UnsupportedOperationException("DataSet.removeAll not yet supported");
    }

    /**
     * Not currently implemented - always throws UnsupportedOperationException.
     * Retains only the elements in this collection that are contained in the
     * specified collection (optional operation). In other words, removes from
     * this collection all of its elements that are not contained in the
     * specified collection.
     * @param c elements to be retained in this collection.
     * @return true if this collection changed as a result of the call.
     * @throws UnsupportedOperationException if the retainAll method is not
     * supported by this collection.
     * @throws ClassCastException if the types of one or more elements in the
     * specified DataSet are not DataPoint objects.
     * @throws NullPointerException if the specified collection contains one
     * or more null elements.
     */
    public boolean retainAll( Collection<?> c )
        throws UnsupportedOperationException
    {
        // TODO: Implement DataSet.retainAll
        throw new UnsupportedOperationException("DataSet.retainAll not yet supported");
    }

    /**
     * Returns the hash code value for this collection, based on the
     * underlying Collection of DataPoints.
     * @return the hash code value for this collection.
     */
    public int hashCode()
    {
        return dataPoints.size()*100
            + getIndependentVariables().length;
    }

    /**
     * Indicates whether some other object, obj, is "equal to" this one.
     * Returns true if the Object, obj, represents another DataSet for which
     * {@link #equals(DataSet)} returns true; otherwise false.
     * @param obj the reference object with which to compare.
     * @return true if this object is the same as the obj argument; false
     * otherwise.
     * @see #equals(DataSet)
     */
    public boolean equals( Object obj )
    {
        if ( obj == null )
            return false;

        if ( !(obj instanceof DataSet) )
            return false;

        return this.equals( (DataSet)obj );
    }

    /**
     * Indicates whether some other DataSet is "equal to" this one. Returns
     * true if the DataSet, dataSet, represents another DataSet containing
     * exactly the same data points as this DataSet. Note that neither the
     * DataPoint objects, or the DataSet objects have to refer to the same
     * instance. They just must refer to a collection of DataPoints with the
     * same values for the independent and dependent variables.
     * @param dataSet the reference object with which to compare.
     * @return true if this object is the same as the dataSet argument; false
     * otherwise.
     */
    public boolean equals( DataSet dataSet )
    {
        if ( dataSet == null )
            return false;

        if ( this.size() != dataSet.size() )
            return false;

        // Iterate through all data points in dataSet,
        //  checking that the same DataPoint exists in this DataSet
        Iterator<DataPoint> it = dataSet.iterator();
        while ( it.hasNext() )
            {
                DataPoint dataPoint = it.next();
                if ( !this.contains( dataPoint ) )
                    return false;
            }

        return true;
    }

    /**
     * Overrides the default toString method. Lists all data points in this
     * data set. Note that if there are a large number of data points in this
     * data set, then the String returned could be very long.
     * @return a string representation of this data set.
     */
    public String toString()
    {
        String lineSeparator = System.getProperty("line.separator");
        String result = "( " + lineSeparator;

        Iterator<DataPoint> it = dataPoints.iterator();
        while ( it.hasNext() )
            {
                result += "  " + it.next().toString()
                    + lineSeparator;
            }

        return result + ")";
    }
}
// Local variables:
// tab-width: 4
// End:


text:
require 'database_cleaner'

ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'file::memory:?cache=shared', pool: 10)
ActiveRecord::Base.logger = Logger.new('/dev/null')
ActiveRecord::Base.raise_in_transactional_callbacks = true if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks)

ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS 'countries'")
ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS 'cities'")
ActiveRecord::Schema.define do
  create_table :countries do |t|
    t.column :name, :string
    t.column :country_code, :string
    t.column :rating, :integer
    t.column :updated_at, :datetime
  end

  create_table :cities do |t|
    t.column :country_id, :integer
    t.column :name, :string
    t.column :rating, :integer
    t.column :updated_at, :datetime
  end
end

module ActiveRecordClassHelpers
  extend ActiveSupport::Concern

  def adapter
    :active_record
  end

  def expects_db_queries(&block)
    have_queries = false
    ActiveSupport::Notifications.subscribed(
      ->(*_) { have_queries = true },
      'sql.active_record',
      &block
    )
    raise 'Expected some db queries, but none were made' unless have_queries
  end

  def expects_no_query(except: nil, &block)
    queries = []
    ActiveSupport::Notifications.subscribed(
      ->(*args) { queries << args[4][:sql] },
      'sql.active_record',
      &block
    )
    ofending_queries = except ? queries.find_all { |query| !query.match(except) } : queries
    raise "Expected no DB queries, but the following ones were made: #{ofending_queries.join(', ')}" if ofending_queries.present?
  end

  def stub_model(name, superclass = nil, &block)
    stub_class(name, superclass || ActiveRecord::Base, &block)
  end
end

RSpec.configure do |config|
  config.include ActiveRecordClassHelpers

  config.filter_run_excluding :mongoid
  config.filter_run_excluding :sequel

  config.before(:suite) do
    DatabaseCleaner.clean_with :truncation
    DatabaseCleaner.strategy = :truncation
  end

  config.before do
    DatabaseCleaner.start
  end

  config.after do
    DatabaseCleaner.clean
  end
end

redpajama_set_name: RedPajamaGithub


text:
:- ['$REGULUS/Prolog/load'].

:- regulus_batch('$REGULUS/Examples/Toy1Specialised/scripts/toy1_specialised_slt.cfg',
		 ["LOAD_TRANSLATE"]).

:- compile('$REGULUS/Examples/Toy1Specialised/Prolog/toy1_slt_app').

:- toy1_slt_app(1975).

:- halt.


text:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('trend-item', 'Integration | Component | trend item', {
  integration: true
});

test('it renders', function(assert) {
  assert.expect(2);

  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs`{{trend-item}}`);

  assert.equal(this.$().text().trim(), '');

  // Template block usage:
  this.render(hbs`
    {{#trend-item}}
      template block text
    {{/trend-item}}
  `);

  assert.equal(this.$().text().trim(), 'template block text');
});


text:
$script:resourceModulePath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$script:modulesFolderPath = Join-Path -Path $script:resourceModulePath -ChildPath 'Modules'

$script:localizationModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'DscResource.LocalizationHelper'
Import-Module -Name (Join-Path -Path $script:localizationModulePath -ChildPath 'DscResource.LocalizationHelper.psm1')

$script:resourceHelperModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'DscResource.Common'
Import-Module -Name (Join-Path -Path $script:resourceHelperModulePath -ChildPath 'DscResource.Common.psm1')

function Get-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $Name,

        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $ServerName
    )

    $returnValue = @{
        Name = [System.String] $Name
        Protocol = [System.String] ''
        ServerName = [System.String] $ServerName
        TcpPort = [System.UInt16] 0
        UseDynamicTcpPort = [System.Boolean] $false
        PipeName = [System.String] ''
        Ensure = [System.String] 'Absent'
    }

    $protocolTcp = 'DBMSSOCN'
    $protocolNamedPipes = 'DBNMPNTW'

    Write-Verbose -Message "Getting the SQL Server Client Alias $Name"
    $itemValue = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' `
                                  -Name $Name `
                                  -ErrorAction SilentlyContinue

    if (((Get-CimInstance -ClassName win32_OperatingSystem).OSArchitecture) -eq '64-bit')
    {
        Write-Verbose -Message "64-bit Operating System. Also get the client alias $Name from Wow6432Node"

        $isWow6432Node = $true
        $itemValueWow6432Node = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' `
                                                 -Name $Name `
                                                 -ErrorAction SilentlyContinue
    }

    if ((-not $isWow6432Node -and $null -ne $itemValue ) -or `
       (($null -ne $itemValue -and $null -ne $itemValueWow6432Node) -and `
       ($isWow6432Node -and $itemValueWow6432Node."$Name" -eq $itemValue."$Name")))
    {
        $itemConfig = $itemValue."$Name" | ConvertFrom-Csv -Header 'Protocol','ServerName','TcpPort'
        if ($itemConfig)
        {
            if ($itemConfig.Protocol -eq $protocolTcp)
            {
                $returnValue.Ensure = 'Present'
                $returnValue.Protocol = 'TCP'
                $returnValue.ServerName = $itemConfig.ServerName
                if ($itemConfig.TcpPort)
                {
                    $returnValue.TcpPort = $itemConfig.TcpPort
                    $returnValue.UseDynamicTcpPort = $false
                }
                else
                {
                    $returnValue.UseDynamicTcpPort = $true
                    $returnValue.TcpPort = 0
                }
            }
            elseif ($itemConfig.Protocol -eq $protocolNamedPipes)
            {
                $returnValue.Ensure = 'Present'
                $returnValue.Protocol = 'NP'
                $returnValue.PipeName = $itemConfig.ServerName
            }
        }
        else
        {
            $returnValue.Ensure = 'Absent'
        }
    }
    else
    {
        $returnValue.Ensure = 'Absent'
    }

    $returnValue
}

function Set-TargetResource
{
    [CmdletBinding(SupportsShouldProcess)]
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $Name,

        [Parameter()]
        [ValidateSet('TCP','NP')]
        [System.String]
        $Protocol = 'TCP',

        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $ServerName,

        [Parameter()]
        [System.UInt16]
        $TcpPort = 1433,

        [Parameter()]
        [System.Boolean]
        $UseDynamicTcpPort = $false,

        [Parameter()]
        [ValidateSet('Present','Absent')]
        [System.String]
        $Ensure = 'Present'
    )

    Write-Verbose -Message "Setting the SQL Server Client Alias $Name"

    if ($Protocol -eq 'NP')
    {
        $itemValue = "DBNMPNTW,\\$ServerName\PIPE\sql\query"
    }

    if ($Protocol -eq 'TCP')
    {
        $itemValue = "DBMSSOCN,$ServerName"
        if (!$UseDynamicTcpPort)
        {
            $itemValue += ",$TcpPort"
        }
    }

    $registryPath = 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo'
    $registryPathWow6432Node = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo'

    if ($Ensure -eq 'Present')
    {
        Write-Verbose -Message "Adding the SQL Server Client Alias $Name"

        if ($PSCmdlet.ShouldProcess($Name, 'Setting the client alias'))
        {
            if (!(Test-Path -Path $registryPath))
            {
                New-Item -Path $registryPath -Force | Out-Null
            }

            Set-ItemProperty -Path $registryPath -Name $Name -Value $itemValue | Out-Null
        }

        # If this is a 64-bit OS then also update Wow6432Node
        if (((Get-CimInstance -ClassName win32_OperatingSystem).OSArchitecture) -eq '64-bit')
        {
            if ($PSCmdlet.ShouldProcess($Name, 'Setting the client alias (32-bit)'))
            {
                if (!(Test-Path -Path $registryPathWow6432Node))
                {
                    New-Item -Path $registryPathWow6432Node -Force | Out-Null
                }

                Set-ItemProperty -Path $registryPathWow6432Node -Name $Name -Value $itemValue | Out-Null
            }
        }
    }

    if ($Ensure -eq 'Absent')
    {
        Write-Verbose -Message "Removing the SQL Server Client Alias $Name"

        if ($PSCmdlet.ShouldProcess($Name, 'Remove the client alias'))
        {
            if (Test-Path -Path $registryPath)
            {
                Remove-ItemProperty -Path $registryPath -Name $Name
            }
        }

        # If this is a 64-bit OS then also remove from Wow6432Node
        if (((Get-CimInstance -ClassName win32_OperatingSystem).OSArchitecture) -eq '64-bit' `
              -and (Test-Path -Path $registryPathWow6432Node))
        {
            if ($PSCmdlet.ShouldProcess($Name, 'Remove the client alias (32-bit)'))
            {
                Remove-ItemProperty -Path $registryPathWow6432Node -Name $Name
            }
        }
    }
}

function Test-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Boolean])]
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $Name,

        [Parameter()]
        [ValidateSet('TCP','NP')]
        [System.String]
        $Protocol = 'TCP',

        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $ServerName,

        [Parameter()]
        [System.UInt16]
        $TcpPort = 1433,

        [Parameter()]
        [System.Boolean]
        $UseDynamicTcpPort = $false,

        [Parameter()]
        [ValidateSet('Present','Absent')]
        [System.String]
        $Ensure = 'Present'
    )

    Write-Verbose -Message "Testing the SQL Server Client Alias $Name"

    $result = $false

    $parameters = @{
        Name = $PSBoundParameters.Name
        ServerName = $PSBoundParameters.ServerName
    }

    $currentValues = Get-TargetResource @parameters

    if ($Ensure -eq $currentValues.Ensure)
    {
        if( $Ensure -eq 'Absent' )
        {
            $result = $true
        }
        else
        {
            Write-Verbose -Message 'Ensure is in the desired state. Verifying values.'

            if ($Protocol -eq $currentValues.Protocol)
            {
                if ($Protocol -eq 'NP' -and
                    $currentValues.PipeName -eq "\\$ServerName\PIPE\sql\query")
                {
                    $result = $true
                }
                elseif ($Protocol -eq 'TCP' -and
                    $UseDynamicTcpPort -and
                    $currentValues.ServerName -eq $ServerName)
                {
                    $result = $true
                }
                elseif ($Protocol -eq 'TCP' -and
                    -not $UseDynamicTcpPort -and
                    $currentValues.ServerName -eq $ServerName -and
                    $currentValues.TcpPort -eq $TcpPort)
                {
                    $result = $true
                }
            }
        }
    }

    if ($result)
    {
        Write-Verbose -Message 'In the desired state'
    }
    else
    {
        Write-Verbose -Message 'Not in the desired state'
    }

    return $result
}

Export-ModuleMember -Function *-TargetResource


text:
package com.markwesterlund.ubo.adapters;

import java.util.Date;
import java.util.List;

import android.content.Context;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.markwesterlund.ubo.R;
import com.markwesterlund.ubo.utils.ParseConstants;
import com.parse.ParseObject;

public class MessageAdapter extends ArrayAdapter<ParseObject> {

	protected Context mContext;
	protected List<ParseObject> mMessages;

	public MessageAdapter(Context context, List<ParseObject> messages){
		super(context, R.layout.message_item, messages);

		mContext = context;
		mMessages = messages;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		ViewHolder holder;

		if(convertView == null) {
			convertView = LayoutInflater.from(mContext).inflate(R.layout.message_item, null);
			holder = new ViewHolder();
			//holder.senderImageView = (ImageView)convertView.findViewById(R.id.messageIcon);
			holder.nameLabel = (TextView)convertView.findViewById(R.id.senderLabel);
			holder.textLabel = (TextView)convertView.findViewById(R.id.messageText);
			holder.timeLabel = (TextView)convertView.findViewById(R.id.timeLabel);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder)convertView.getTag();
		}

		ParseObject message = mMessages.get(position);
		Date createdAt = message.getCreatedAt();
		long now = new Date().getTime();
		String convertedDate = DateUtils.getRelativeTimeSpanString(
				createdAt.getTime(),
				now,
				DateUtils.SECOND_IN_MILLIS).toString();

		holder.timeLabel.setText(convertedDate);

			//holder.senderImageView.setImageResource(R.drawable.ic_picture);

		holder.nameLabel.setText(message.getString(ParseConstants.KEY_SENDER_NAME));
		holder.textLabel.setText(message.getString(ParseConstants.MESSAGE_TO_ALL_TEXT));

		return convertView;
	}

	private static class ViewHolder{
		ImageView senderImageView;
		TextView nameLabel;
		TextView textLabel;
		TextView timeLabel;
	}

	public void refill(List<ParseObject> messages) {
		mMessages.clear();
		mMessages.addAll(messages);
		notifyDataSetChanged();
	}
}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Drake: Subvector< T > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen_extra.css" rel="stylesheet" type="text/css"/>

     Home

     Installation

     Gallery

API Documentation

      C++
      Python

Resources

      Getting Help
      Tutorials
      Python Bindings
      For Developers
      Credits

     GitHub

Drake

  Drake C++ Documentation

  <form id="ddg-search-form" class="wy_form" action="https://duckduckgo.com/" method="get">
   <input type="text" name="q" placeholder="Search C++ API only…">
   <input type="hidden" name="sites" value="drake.mit.edu/doxygen_cxx">
  </form>
  <form id="ddg-search-form" class="wy_form" action="https://duckduckgo.com/" method="get">
   <input type="text" name="q" placeholder="Search all of Drake…">
   <input type="hidden" name="sites" value="drake.mit.edu">
  </form>

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Public Member Functions |
List of all members

Subvector< T > Class Template Referencefinal

Detailed Description

template<typename T>

class drake::systems::Subvector< T >

Subvector is a concrete class template that implements VectorBase by providing a sliced view of a VectorBase.

Template Parameters

T	The scalar type, which must be one of the default scalars.

#include <drake/systems/framework/subvector.h>

Public Member Functions

 	Subvector (VectorBase< T > *vector, int first_element, int num_elements)

 	Constructs a subvector of vector that consists of num_elements starting at first_element.  More...

int 	size () const final

 	Returns the number of elements in the vector.  More...

Does not allow copy, move, or assignment

 	Subvector (const Subvector &)=delete

Subvector & 	operator= (const Subvector &)=delete

 	Subvector (Subvector &&)=delete

Subvector & 	operator= (Subvector &&)=delete

 Public Member Functions inherited from VectorBase< T >

virtual 	~VectorBase ()

T & 	operator[] (int index)

 	Returns the element at the given index in the vector.  More...

const T & 	operator[] (int index) const

 	Returns the element at the given index in the vector.  More...

const T & 	GetAtIndex (int index) const

 	Returns the element at the given index in the vector.  More...

T & 	GetAtIndex (int index)

 	Returns the element at the given index in the vector.  More...

void 	SetAtIndex (int index, const T &value)

 	Replaces the state at the given index with the value.  More...

virtual void 	SetFrom (const VectorBase< T > &value)

 	Replaces the entire vector with the contents of value.  More...

virtual void 	SetFromVector (const Eigen::Ref< const VectorX< T >> &value)

 	Replaces the entire vector with the contents of value.  More...

virtual void 	SetZero ()

 	Sets all elements of this vector to zero.  More...

virtual VectorX< T > 	CopyToVector () const

 	Copies this entire VectorBase into a contiguous Eigen Vector.  More...

virtual void 	CopyToPreSizedVector (EigenPtr< VectorX< T >> vec) const

 	Copies this entire VectorBase into a pre-sized Eigen Vector.  More...

virtual void 	ScaleAndAddToVector (const T &scale, EigenPtr< VectorX< T >> vec) const

 	Adds a scaled version of this vector to Eigen vector vec.  More...

VectorBase & 	PlusEqScaled (const T &scale, const VectorBase< T > &rhs)

 	Add in scaled vector rhs to this vector.  More...

VectorBase & 	PlusEqScaled (const std::initializer_list< std::pair< T, const VectorBase< T > & >> &rhs_scale)

 	Add in multiple scaled vectors to this vector.  More...

VectorBase & 	operator+= (const VectorBase< T > &rhs)

 	Add in vector rhs to this vector.  More...

VectorBase & 	operator-= (const VectorBase< T > &rhs)

 	Subtract in vector rhs to this vector.  More...

virtual void 	GetElementBounds (Eigen::VectorXd *lower, Eigen::VectorXd *upper) const

 	Get the bounds for the elements.  More...

 	VectorBase (const VectorBase &)=delete

VectorBase & 	operator= (const VectorBase &)=delete

 	VectorBase (VectorBase &&)=delete

VectorBase & 	operator= (VectorBase &&)=delete

Additional Inherited Members

 Protected Member Functions inherited from VectorBase< T >

 	VectorBase ()

virtual void 	DoPlusEqScaled (const std::initializer_list< std::pair< T, const VectorBase< T > & >> &rhs_scale)

 	Adds in multiple scaled vectors to this vector.  More...

void 	ThrowOutOfRange (int index) const

void 	ThrowMismatchedSize (int other_size) const

Constructor & Destructor Documentation

◆ Subvector() [1/3]

          Subvector
          (
          const Subvector< T > &
          	)

delete

◆ Subvector() [2/3]

          Subvector
          (
          Subvector< T > &&
          	)

delete

◆ Subvector() [3/3]

          Subvector
          (
          VectorBase< T > *
          vector,

          int
          first_element,

          int
          num_elements

          )

Constructs a subvector of vector that consists of num_elements starting at first_element.

Parameters

vector	The vector to slice. Must not be nullptr. Must remain valid for the lifetime of this object.

Member Function Documentation

◆ operator=() [1/2]

          Subvector& operator=
          (
          const Subvector< T > &
          	)

delete

◆ operator=() [2/2]

          Subvector& operator=
          (
          Subvector< T > &&
          	)

delete

◆ size()

          int size
          (
          	)
           const

finalvirtual

Returns the number of elements in the vector.

Implementations should ensure this operation is O(1) and allocates no memory.

Implements VectorBase< T >.

The documentation for this class was generated from the following file:

drake/systems/framework/subvector.h

drake

systems

Subvector

          C++

          Python

          GitHub


text:
package com.netflix.ribbon.examples.rx;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Scopes;
import com.netflix.client.config.ClientConfigFactory;
import com.netflix.client.config.ClientConfigFactory.DefaultClientConfigFactory;
import com.netflix.client.config.DefaultClientConfigImpl;
import com.netflix.client.config.IClientConfig;
import com.netflix.client.netty.http.NettyHttpClient;
import com.netflix.config.ConfigurationManager;
import com.netflix.ribbon.DefaultResourceFactory;
import com.netflix.ribbon.RibbonResourceFactory;
import com.netflix.ribbon.RibbonTransportFactory;
import com.netflix.ribbon.RibbonTransportFactory.DefaultRibbonTransportFactory;
import com.netflix.ribbon.examples.rx.proxy.MovieService;
import com.netflix.ribbon.examples.rx.proxy.RxMovieProxyExample;
import com.netflix.ribbon.guice.RibbonModule;
import com.netflix.ribbon.guice.RibbonResourceProvider;
import com.netflix.ribbon.proxy.processor.AnnotationProcessorsProvider;
import com.netflix.ribbon.proxy.processor.AnnotationProcessorsProvider.DefaultAnnotationProcessorsProvider;
import io.netty.buffer.ByteBuf;
import io.reactivex.netty.protocol.http.client.HttpClient;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class RxMovieProxyExampleTest extends RxMovieClientTestBase {

    static class MyClientConfigFactory extends DefaultClientConfigFactory {
        @Override
        public IClientConfig newConfig() {
            return new DefaultClientConfigImpl() {
                @Override
                public String getNameSpace() {
                    return "MyConfig";
                }
            };
        }
    }

    @Test
    public void shouldBind() {
        ConfigurationManager.getConfigInstance().setProperty(MovieService.class.getSimpleName() + ".ribbon.listOfServers", "localhost:" + port);

        Injector injector = Guice.createInjector(
            new RibbonModule(),
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(MovieService.class).toProvider(new RibbonResourceProvider<MovieService>(MovieService.class)).asEagerSingleton();
                }
            }
            );

        RxMovieProxyExample example = injector.getInstance(RxMovieProxyExample.class);
        assertTrue(example.runExample());

    }

    @Test
    public void shouldBindCustomClientConfigFactory() {
        ConfigurationManager.getConfigInstance().setProperty(MovieService.class.getSimpleName() + ".MyConfig.listOfServers", "localhost:" + port);

        Injector injector = Guice.createInjector(
                new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(RibbonResourceFactory.class).to(DefaultResourceFactory.class).in(Scopes.SINGLETON);
                        bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
                        bind(AnnotationProcessorsProvider.class).to(DefaultAnnotationProcessorsProvider.class).in(Scopes.SINGLETON);
                        bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
                    }
                },
                new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(MovieService.class).toProvider(new RibbonResourceProvider<MovieService>(MovieService.class)).asEagerSingleton();
                    }
                }
        );

        RxMovieProxyExample example = injector.getInstance(RxMovieProxyExample.class);
        assertTrue(example.runExample());
    }

    @Test
    public void testTransportFactoryWithInjection() {
        Injector injector = Guice.createInjector(
                new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
                        bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
                    }
                }
        );

        RibbonTransportFactory transportFactory = injector.getInstance(RibbonTransportFactory.class);
        HttpClient<ByteBuf, ByteBuf> client = transportFactory.newHttpClient("myClient");
        IClientConfig config = ((NettyHttpClient) client).getClientConfig();
        assertEquals("MyConfig", config.getNameSpace());
    }
}


text:
import {Meteor} from 'meteor/meteor';
import {Mongo} from 'meteor/mongo';
import {check} from 'meteor/check';
import "./webapicaller";

export const Playlists = new Mongo.Collection('playlists');

if (Meteor.isServer) {
    // This code only runs on the server
    // Only publish Playlists that are public or belong to the current user
    Meteor.publish('playlists', function tracksPublication() {
        //console.log(this);
        //console.log(Meteor.users.findOne({_id: this.userId}));
        return Playlists.find({});
    });
}

Meteor.methods({
    'Playlists.insertSong' (plname, song) {
        check(plname, String);
        check(song, Object);
        //console.log(song);
        Playlists.upsert({name: plname}, {$addToSet: {tracks: song}});
        Meteor.call("addSong",plname,song)
    },
    "Playlists.create" (name) {
        check(name,String);
        //console.log(name);
        Meteor.call("createPlaylist",name);
    }
});


text:
use super::rocket;
use rocket::local::Client;
use rocket::http::Status;

fn test(uri: &str, status: Status, body: String) {
    let rocket = rocket::ignite()
        .mount("/", routes![super::hello])
        .catch(catchers![super::not_found]);

    let client = Client::new(rocket).unwrap();
    let mut response = client.get(uri).dispatch();
    assert_eq!(response.status(), status);
    assert_eq!(response.body_string(), Some(body));
}

#[test]
fn test_hello() {
    let (name, age) = ("Arthur", 42);
    let uri = format!("/hello/{}/{}", name, age);
    test(&uri, Status::Ok, format!("Hello, {} year old named {}!", age, name));
}

#[test]
fn test_hello_invalid_age() {
    for &(name, age) in &[("Ford", -129), ("Trillian", 128)] {
        let uri = format!("/hello/{}/{}", name, age);
        let body = format!("
Sorry, but '{}' is not a valid path!

Try visiting /hello/<name>/<age> instead.
",
                           uri);
        test(&uri, Status::NotFound, body);
    }
}


text:
.class final Lcom/payu/android/sdk/internal/sj$2;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/view/animation/Animation$AnimationListener;

# annotations
.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic a:Lcom/payu/android/sdk/internal/sj$b;

.field final synthetic b:Lcom/payu/android/sdk/internal/sj;

# direct methods
.method constructor <init>(Lcom/payu/android/sdk/internal/sj;Lcom/payu/android/sdk/internal/sj$b;)V
    .locals 0

    .line 350
    iput-object p1, p0, Lcom/payu/android/sdk/internal/sj$2;->b:Lcom/payu/android/sdk/internal/sj;

    iput-object p2, p0, Lcom/payu/android/sdk/internal/sj$2;->a:Lcom/payu/android/sdk/internal/sj$b;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public final onAnimationEnd(Landroid/view/animation/Animation;)V
    .locals 0

    .line 360
    return-void
.end method

.method public final onAnimationRepeat(Landroid/view/animation/Animation;)V
    .locals 4

    .line 364
    iget-object v0, p0, Lcom/payu/android/sdk/internal/sj$2;->a:Lcom/payu/android/sdk/internal/sj$b;

    invoke-virtual {v0}, Lcom/payu/android/sdk/internal/sj$b;->a()V

    .line 365
    iget-object v3, p0, Lcom/payu/android/sdk/internal/sj$2;->a:Lcom/payu/android/sdk/internal/sj$b;

    iget v0, v3, Lcom/payu/android/sdk/internal/sj$b;->j:I

    add-int/lit8 v0, v0, 0x1

    iget-object v1, v3, Lcom/payu/android/sdk/internal/sj$b;->i:[I

    array-length v1, v1

    rem-int/2addr v0, v1

    iput v0, v3, Lcom/payu/android/sdk/internal/sj$b;->j:I

    .line 366
    iget-object v0, p0, Lcom/payu/android/sdk/internal/sj$2;->a:Lcom/payu/android/sdk/internal/sj$b;

    iget-object v1, p0, Lcom/payu/android/sdk/internal/sj$2;->a:Lcom/payu/android/sdk/internal/sj$b;

    iget v1, v1, Lcom/payu/android/sdk/internal/sj$b;->e:F

    invoke-virtual {v0, v1}, Lcom/payu/android/sdk/internal/sj$b;->a(F)V

    .line 367
    iget-object v0, p0, Lcom/payu/android/sdk/internal/sj$2;->b:Lcom/payu/android/sdk/internal/sj;

    iget-boolean v0, v0, Lcom/payu/android/sdk/internal/sj;->b:Z

    if-eqz v0, :cond_0

    .line 370
    iget-object v0, p0, Lcom/payu/android/sdk/internal/sj$2;->b:Lcom/payu/android/sdk/internal/sj;

    const/4 v1, 0x0

    iput-boolean v1, v0, Lcom/payu/android/sdk/internal/sj;->b:Z

    .line 371
    const-wide/16 v0, 0x535

    invoke-virtual {p1, v0, v1}, Landroid/view/animation/Animation;->setDuration(J)V

    .line 372
    iget-object v0, p0, Lcom/payu/android/sdk/internal/sj$2;->a:Lcom/payu/android/sdk/internal/sj$b;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/payu/android/sdk/internal/sj$b;->a(Z)V

    return-void

    .line 374
    :cond_0
    iget-object v0, p0, Lcom/payu/android/sdk/internal/sj$2;->b:Lcom/payu/android/sdk/internal/sj;

    iget-object v1, p0, Lcom/payu/android/sdk/internal/sj$2;->b:Lcom/payu/android/sdk/internal/sj;

    invoke-static {v1}, Lcom/payu/android/sdk/internal/sj;->a(Lcom/payu/android/sdk/internal/sj;)F

    move-result v1

    const/high16 v2, 0x3f800000    # 1.0f

    add-float/2addr v1, v2

    const/high16 v2, 0x40a00000    # 5.0f

    rem-float/2addr v1, v2

    invoke-static {v0, v1}, Lcom/payu/android/sdk/internal/sj;->a(Lcom/payu/android/sdk/internal/sj;F)F

    .line 376
    return-void
.end method

.method public final onAnimationStart(Landroid/view/animation/Animation;)V
    .locals 2

    .line 354
    iget-object v0, p0, Lcom/payu/android/sdk/internal/sj$2;->b:Lcom/payu/android/sdk/internal/sj;

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/payu/android/sdk/internal/sj;->a(Lcom/payu/android/sdk/internal/sj;F)F

    .line 355
    return-void
.end method


text:
/*
 * File:   pid_controller.h
 * Author: Bo Liu
 * Comments:
 * Revision history:
 */
#ifndef PID_CONTROLLER_H
#define	PID_CONTROLLER_H

#include <p33Fxxxx.h>
//do not change the order of the following 3 definitions
#define FCY 12800000UL
#include <stdio.h>
#include <libpic30.h>

#include <stdio.h>
#include <libpic30.h>
#include "types.h"

// This is a guard condition so that contents of this file are not included
// more than once.

#include <xc.h> // include processor files - each processor file is guarded.

#ifdef	__cplusplus
extern "C" {
#endif

typedef struct {
    float current_delta;
    float previous_delta;
    float integral;
    float derivative;
    float delta_threshold;

    float trim;

    float delta_time;

    float feedback;

    float kp;
    float ki;
    float kd;
} pid_controller_t;

void pid_controller_init(pid_controller_t * controller, float trim, float delta_threshold, float Delta_time, float Kp, float Ki, float Kd);

uint16_t feed_back(pid_controller_t * controller, float pos, float target);

#ifdef	__cplusplus
}
#endif

#endif	/* PID_CONTROLLER_H */


text:
package com.magnet.samples.android.quickstart.fragments;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public abstract class BaseFragment extends Fragment implements View.OnClickListener {

    protected String getFieldText(int fieldId) {
        hideKeyboard();
        if (getView() != null) {
            EditText editText = (EditText) getView().findViewById(fieldId);
            if (editText != null) {
                return editText.getText().toString().trim();
            }
        }
        return null;
    }

    public void hideKeyboard() {
        InputMethodManager inputMethod = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethod.hideSoftInputFromWindow(getActivity().getWindow().getDecorView().getRootView().getWindowToken(), 0);
    }

    public void showMessage(String message) {
        Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
    }

    public void showMessage(int stringRes) {
        showMessage(getString(stringRes));
    }

    public void setText(int textViewId, String text) {
        if (getView() != null) {
            TextView textView = (TextView) getView().findViewById(textViewId);
            if (textView != null) {
                textView.setText(text);
                textView.setVisibility(View.VISIBLE);
            }
        }
    }

    public void setText(int textViewId, int stringRes) {
        setText(textViewId, getString(stringRes));
    }

}


text:
<?php

class BaseZF_Framework_View_Helper_FormFancySelect extends Zend_View_Helper_FormElement
{
    /**
     * Input type to use
     * @var string
     */
    protected $_inputType = 'radio';

    /**
     * Whether or not this element represents an array collection by default
     * @var bool
     */
    protected $_isArray = false;

    public function formFancySelect($name, $value = null, $attribs = null,
        $options = null, $listsep = "
\n")
    {
        $info = $this->_getInfo($name, $value, $attribs, $options, $listsep);
        extract($info); // name, id, value, attribs, options, listsep, disable

        // get label
        $label = isset($attribs['label']) ? $attribs['label'] : null;
        unset($attribs['label']);

        // get notice
        $notice = isset($attribs['notice']) ? $attribs['notice'] : null;
        unset($attribs['notice']);

        // get notice
        $showChoice = isset($attribs['show_choice']) ? $attribs['show_choice'] : false;
        unset($attribs['show_choice']);

        // get label attribs
        $labelAttribs = $this->getAttribsNamespaceValue($attribs, 'label');

        // is multiple choice
        if (isset($attribs['multiple'])) {
            $this->_inputType = 'checkbox';
            $this->_isArray = true;
            unset($attribs['multiple']);
        }

        // the radio button values and labels
        $options = (array) $options;

        // build the element
        $xhtml = array();

        // should the name affect an array collection?
        $name = $this->view->escape($name);
        if ($this->_isArray && ('[]' != substr($name, -2))) {
            $name .= '[]';
        }

        // ensure value is an array to allow matching multiple times
        $value = (array) $value;

        // XHTML or HTML end tag?
        $endTag = ' />';
        if (($this->view instanceof Zend_View_Abstract) && !$this->view->doctype()->isXhtml()) {
            $endTag= '>';
        }

        // add container open tag
        $xhtml[] = '
view->escape($id) . '" class="formFancySelect">';
        $xhtml[] = '
';
        $xhtml[] = '
';

        // add radio buttons to the list.
        require_once 'Zend/Filter/Alnum.php';
        $filter = new Zend_Filter_Alnum();
        foreach ($options as $optionValue => $optionLabel) {

            // Should the label be escaped?
            $optionLabel = $this->view->escape($optionLabel);

            // is it disabled?
            $disabled = '';
            if (true === $disable) {
                $disabled = ' disabled="disabled"';
            } elseif (is_array($disable) && in_array($optionValue, $disable)) {
                $disabled = ' disabled="disabled"';
            }

            // is it checked?
            $checked = '';
            if (in_array($optionValue, $value)) {
                $checked = ' checked="checked"';
            }

            // generate ID
            $optId = $id . '-' . $filter->filter($optionValue);

            // set class
            $attribs['class'] = 'form' . ucfirst($this->_inputType);

            // Wrap the radios in labels
            $radio = '          _htmlAttribs($labelAttribs) . '>'
                    . '<input type="' . $this->_inputType . '"'
                    . ' name="' . $name . '"'
                    . ' id="' . $optId . '"'
                    . ' value="' . $this->view->escape($optionValue) . '"'
                    . $checked
                    . $disabled
                    . $this->_htmlAttribs($attribs)
                    . $endTag
                    . '' . $optionLabel . ''
                    . '';

            // add to the array of radio buttons
            $xhtml[] = $radio;
        }

        // add container close tag
        $xhtml[] = '
';
        $xhtml[] = '
';
        $xhtml[] = '
';

        $xhtml[] = '
';

        if (!empty($notice)) {
            $xhtml[] = $notice;
        }

        $xhtml[] = '
';

        if ($showChoice) {
            $xhtml[] = '

';
        } else {
            $xhtml[] = '

';
        }

        return implode("\n", $xhtml);
    }

    public function getAttribsNamespaceValue(array &$attribs, $namespace)
    {
         // retrieve attributes for labels (prefixed with '$namespace_' or '$namespace')
        $namespaceLen = mb_strlen($namespace);
        $namespaceAttribs = array();
        foreach ($attribs as $key => $value) {

            $namespaceKey = false;
            $keyLen = strlen($key);

            if ($keyLen <= $namespaceLen) {
                continue;
            }

            if ((substr($key, 0, $namespaceLen + 1) == $namespace . '_')) {

                $namespaceKey = strtolower(substr($key, $namespaceLen + 1));
                $namespaceAttribs[$namespaceKey] = $value;
                unset($attribs[$key]);
            }
        }
    }
}


text:
@interface OLAContainer:OLAWedgit
{

}

- (id) initWithParent:(OLAView *) viewParent  withXMLElement:(XMLElement *) xmlRoot andUIFactory:(OLAUIFactory *)uiFactory;

- (void) parseChildren:(OLAContainer *) rootView withXMLElement:(XMLElement *) root;
- (void) repaint;
- (void) setFrameMinSize;
- (void) removeAllViews;
@end


text:
<?php

namespace Peakium;

class InvalidRequestError extends PeakiumError
{
  public function __construct($message, $param, $http_status=null, $http_body=null, $json_body=null)
  {
    parent::__construct($message, $http_status, $http_body, $json_body);
    $this->param = $param;
  }
}


text:
<?php

namespace Suyabay;

use Suyabay\User;
use Suyabay\Episode;
use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{

    protected $fillable = [
        'user_id',
        'episode_id',
        'comments'
    ];

    /**
     * Comment User relationship
     */
    public function user()
    {
        return $this->belongsTo('Suyabay\User');
    }

    /**
     * Comment Episode relationship
     */
    public function episode()
    {
        return $this->belongsTo('Suyabay\Episode');
    }
}


text:
function [] = plotsAll(struct)
% [] = plots(struct)
% Plot the telemetry data (ALL OF IT)
% Struct array of telemetry data expected
j = 1;
for i = 1:length(struct)
    if j > 2
        j = 1;
        figure
    end %if
    subplot(2,1,j);
%     figure
    plot(struct(i).times, struct(i).values);
    title(sprintf([struct(i).name]));
    xlabel('Time (s)');
    ylabel(struct(i).desc)
    minimum = min(struct(i).values);
    maximum = max(struct(i).values);
    if minimum ~= maximum && minimum < maximum
        ylim([minimum maximum])
    end %if
    j = j + 1;
end % for
end % function


text:
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"os"

	"github.com/calvn/go-tradier/tradier"
	"github.com/joho/godotenv"
	"golang.org/x/oauth2"
)

func main() {
	// Load access token from .env
	err := godotenv.Load(".env")
	if err != nil {
		log.Fatal("Error loading .env file")
	}

	token := os.Getenv("TRADIER_ACCESS_TOKEN")

	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: token},
	)
	tc := oauth2.NewClient(oauth2.NoContext, ts)

	client := tradier.NewClient(tc)

	// Fetch all watchlists
	watchlists, _, err := client.Watchlists.All()
	if err != nil {
		log.Fatalf("Error fetching order: %s", err)
	}

	payload, err := json.Marshal(watchlists)
	if err != nil {
		log.Fatalf("Error marshaling orders to JSON: %s", err)
	}

	fmt.Println(string(payload))

	// Fetch `default` watchlist
	watchlist, _, err := client.Watchlists.Get("default")
	if err != nil {
		log.Fatalf("Error fetching order: %s", err)
	}

	payload, err = json.Marshal(watchlist)
	if err != nil {
		log.Fatalf("Error marshaling orders to JSON: %s", err)
	}

	fmt.Println(string(payload))
}


text:
<title>Create User</title>

 Create User

  Registeration

        <?php
            $arr = array('role'=>'form', 'id'=>'registration-form');
            echo form_open('security/create_user_validation',$arr);

            echo validation_errors();
            $error = $this->session->flashdata('error');
            if (! empty($error) ) {
              echo $error;
            }
            if (isset($success) ) {
                 echo $success;
            }
        ?>

    						Full Name:

                  <input type='text' name='fullname' value= "<?php echo set_value('fullname');?>" class='form-control' data-validation='required'>

	                        Email:

	                            <input type="text" class="form-control" value ="<?php echo set_value('email');?>"id="email" name="email"  data-validation='email' >

	                        Username:

	                            <input type="text" class="form-control" value="<?php echo set_value('username');?>" name="username"  data-validation='length' data-validation-length='min5'>

								Click more position, if you want to and another type of users.

	                        Type Users:

                              <?php
                                $result = $this->db->get('tbl_position');
                                echo  "<select class='form-control' name='type_user' data-validation='required' >";
                                echo  "<option value=' '>Please choose user type</option>";
                                  foreach ($result->result() as $value) {
                                    echo "<option value='$value->name'>$value->name</option>";
                                  }
                                     echo   "</select>";

                               ?>

                               <input type='button' class='form-control btn btn-primary'  onclick='showModal()' value='Add More Type User'>

	                        New Password:

	                            <input type="password" class="form-control"  id="password" name="password" data-validation='length' data-validation-length='min10'>

	                        Re-Type New Password:

	                            <input type="password" class="form-control"  data-validation='length' data-validation-length='min10' id="password-confirm" name="password_confirm">

		                    	<input type='submit' value='Save changes' class='btn btn-primary'>
		                  		<input type='button' value='Cancel'  class='btn btn-default' id="cancel">

    		</form>

              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Add More Type User

              <input type='text' class='form-control' id='position_name' placeholder='Add More Type User'>

              <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
              <button type="submit" id="deleteButton" onclick="ajaxInsert()"; class="btn btn-primary">Ok</button>


text:
using namespace boost::python;

namespace  {

struct Magick_DrawableStrokeColor_Wrapper: Magick::DrawableStrokeColor
{
    Magick_DrawableStrokeColor_Wrapper(PyObject* py_self_, const Magick::Color& p0):
        Magick::DrawableStrokeColor(p0), py_self(py_self_) {}

    Magick_DrawableStrokeColor_Wrapper(PyObject* py_self_, const Magick::DrawableStrokeColor& p0):
        Magick::DrawableStrokeColor(p0), py_self(py_self_) {}

    PyObject* py_self;
};

}

void __DrawableStrokeColor()
{
    class_< Magick::DrawableStrokeColor, bases<Magick::DrawableBase>, Magick_DrawableStrokeColor_Wrapper >("DrawableStrokeColor", init< const Magick::Color& >())
        .def(init< const Magick::DrawableStrokeColor& >())
        .def("color", (void (Magick::DrawableStrokeColor::*)(const Magick::Color&) )&Magick::DrawableStrokeColor::color)
        .def("color", (Magick::Color (Magick::DrawableStrokeColor::*)() const)&Magick::DrawableStrokeColor::color)
    ;
}


text:
import {IToken} from './token';

/**
 * Error thrown a dependency cycle is detected at runtime.
 */
export class CyclicDependencyError extends Error {
  public name = 'CyclicDependencyError';
  public message: string;

  constructor(tokenChain: IToken<any>[]) {
    super();
    this.message = tokenChain.map(t => t.getDebugName()).join(' -> ');
  }
}

/**
 * Error thrown when attempting to call Injector#get(token) where token is not bound on the injector.
 */
export class NoBoundTokenError extends Error {
  public name = 'NoBoundTokenError';

  constructor(token: IToken<any>) {
    super();
    this.message = `Tried to get ${token.getDebugName() } from an injector, but it's not bound.`;
  }
}


text:
import './index-2db3a464.js';
export { C as ControlButton, i as default } from './index-f60daeab.js';
import 'react';
import 'classcat';
import './useReactFlow-a04052e8.js';
import 'zustand';
import 'zustand/context';
import 'd3-zoom';
import 'zustand/shallow';
//# sourceMappingURL=index4.js.map


text:
title: "Drupal, qu'on lui coupe la tête !"
description: |
   Retour d'expérience sur la refonte du site internet et de la plateforme de contribution d'un leader dans la location de vacances en mobile-home : passage du CMS Drupal 7 à une architecture micro-services en NodeJS et React, avec migration vers Drupal 8 headless.
speaker:
  - sylvain_etienne # reference correspondant à celle du fichier spearkers dans _data
type: lt
symbol: expe # icone
date: 2017-05-19 11:50:00 +0200 # heure de début du talk
lang: fr # langue du talk
display-order: 6 # ordre d'affichage sur le site
video: https://vimeo.com/224596352
slides: # url du support de présentation
---


text:
export { Enumerable, Enumerable as IEnumerable, From } from "linq-es2015";
export declare function ToArray<T>(iterable: AsyncIterable<T>): Promise<Array<T>>;
export declare function Push<T>(destination: Array<T>, source: any): void;
export declare function IsIterable(target: any): boolean;


text:
package org.opengroup.osdu.core.common.model.indexer;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RecordQueryResponse {
    private String cursor;
    private List<String> results;
}


text:
class VideosController < ApplicationController
  before_action :set_video, only: [:show, :edit, :update, :destroy, :zip]

  # GET /videos
  # GET /videos.json
  def index
    @videos = Video.where(user_id: get_user_id, is_show: true).order(id: :desc).page(params[:page])

    # 子データの集計を行う
    @videos.each do | video |
      Video.set_total video
    end
  end

  # GET /videos/1
  # GET /videos/1.json
  def show
  end

  # GET /videos/new
  def new
    @video = Video.new
  end

  # GET /videos/1/edit
  def edit
  end

  # POST /videos
  # POST /videos.json
  def create

    #動画基本情報
    @video = Video.new(video_params)
    @video.user_id = get_user_id

    upload_file = params[:file]

    # ファイル必須
    if upload_file.nil?
       @video.errors.add(:file, "は最低1つアップしてください。")
    end

    respond_to do |format|
      if !upload_file.nil? && @video.save
        UpfileManageService.save(upload_file, @video)
        format.html { redirect_to videos_url, notice: '動画情報を登録しました。' }
        format.json { render :show, status: :created, location: @video }
      else
        format.html { render :new }
        format.json { render json: @video.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /videos/1
  # PATCH/PUT /videos/1.json
  def update
    respond_to do |format|
      if @video.update(video_params)
        format.html { redirect_to @video, notice: 'Video was successfully updated.' }
        format.json { render :show, status: :ok, location: @video }
      else
        format.html { render :edit }
        format.json { render json: @video.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /videos/1
  # DELETE /videos/1.json
  def destroy

    #論理削除
    @video.is_show = false
    @video.save
    respond_to do |format|
      format.html { redirect_to videos_url, notice: '動画情報を削除しました' }
      format.json { head :no_content }
    end
  end

  # 一括削除
  def destroy_all
    Video.delete_by_ids(params["ids"])
    redirect_to(videos_url, notice: '動画情報を削除しました')
  end

  # zipファイルDL
  def zip
    dl_file = Video.create_dl_zip(@video.id)
    send_file(dl_file, type: 'application/zip', :filename => ERB::Util.url_encode(@video.name)+ '_' + Time.now.strftime('%Y%m%d%H%M%S') + '.zip')
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_video
      @video = Video.find_by(id: params[:id], user_id: get_user_id)
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def video_params
      params.require(:video).permit(:name)
    end
end


text:
<html>
<head>
<script src="../testconfig.js"></script>
<script src="../regression-lib/testbase.js"></script>
<title>DOM 2 HTML FormElement </title>
</head>

<body>
<form id="myForm">
  <input id="h0" type="reset" value="initial">
  <input id="h1" type="hidden" value="initial">
  <input id="h2" type="radio" value="radio">
  <input type="radio" value="initial"  checked>
  <input id="h3" type="text" value="initial">
  <textarea id="h4">initial</textarea>
  <select id="h5" size=2>
    <option value="pompel">p1</option>
    <option value="pilt" selected>p2</option>
  </select>
</form>
<form id="myForm2" action="gogo" method="post" enctype="multipart/form-data" accept-charset="utf-8" accept="text/xml" name="f2">
  <input type="hidden">
</form>
<script src="scripts/htmlformelement.js"></script>
</body>
</html>


text:
using System;
using System.Windows;
using System.Windows.Controls;
using Codeer.TestAssistant.GeneratorToolKit;

namespace RM.Friendly.WPFStandardControls.Generator
{
    [CaptureCodeGenerator("RM.Friendly.WPFStandardControls.WPFDataGrid")]
    public class WPFDataGridGenerator : CaptureCodeGeneratorBase
    {
        DataGrid _control;

        protected override void Attach()
        {
            _control = (DataGrid)ControlObject;
            _control.BeginningEdit += BeginningEdit;
            _control.CellEditEnding += CellEditEnding;
            _control.CurrentCellChanged += CurrentCellChanged;
        }

        protected override void Detach()
        {
            _control.BeginningEdit -= BeginningEdit;
            _control.CellEditEnding -= CellEditEnding;
            _control.CurrentCellChanged -= CurrentCellChanged;
        }

        public override bool ConvertChildClientPoint(ref System.Drawing.Point clientPointWinForms, out string childUIObject)
        {
            childUIObject = string.Empty;
            var clientPoint = new Point(clientPointWinForms.X, clientPointWinForms.Y);

            //指定座標の要素取得
            var hitElement = PointUtility.GetPosElement(clientPoint, _control);
            if (hitElement == null) return false;

            //DataGridCell取得
            DataGridCell cell = null;
            foreach (var x in TreeUtilityInTarget.VisualTree(hitElement, TreeRunDirection.Ancestors))
            {
                if (Equals(x, _control)) break;
                cell = x as DataGridCell;
                if (cell != null) break;
            }

            if (cell == null) return false;
            var row = DataGridRow.GetRowContainingElement(cell);
            if (row == null) return false;

            int rowindex = row.GetIndex();
            var colIndex = cell.Column.DisplayIndex;

            //座標変換
            var screenPos = _control.PointToScreen(clientPoint);
            var childPoint = cell.PointFromScreen(screenPos);
            clientPointWinForms.X = (int)childPoint.X;
            clientPointWinForms.Y = (int)childPoint.Y;

            childUIObject = $".GetCell({rowindex}, {colIndex})";
            return true;
        }

        void CurrentCellChanged(object sender, EventArgs e)
        {
            var current = _control.CurrentCell;
            if (current != null)
            {
                int row = -1;
                for (int i = 0; i < _control.Items.Count; i++)
                {
                    if (ReferenceEquals(_control.Items[i], current.Item))
                    {
                        row = i;
                        break;
                    }
                }
                if (row != -1)
                {
                    AddSentence(new TokenName(),
                        ".EmulateChangeCurrentCell(", row, ", ", current.Column.DisplayIndex,
                        new TokenAsync(CommaType.Before), ");");
                }
            }
        }

        void BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
            => AddSentence(new TokenName(),
                ".EmulateBeginEdit();");

        void CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
            => AddSentence(new TokenName(),
                ".EmulateCommitEdit(", new TokenAsync(CommaType.Non), ");");
    }
}


text:
module.exports = function (bt) {

    bt.match('footer', function (ctx) {
        ctx.setTag('footer');
        ctx.setAttr('role', 'contentinfo');

        ctx.setContent('
 Copyright © 2014 - Вадим Макишвили - Powered by Octopress
');
    });

};


text:
package com.travelport.schema.air_v29_0;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.travelport.schema.common_v29_0.BaseRsp;
import com.travelport.schema.common_v29_0.BookingTraveler;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <extension base="{http://www.travelport.com/schema/common_v29_0}BaseRsp">
 *       <sequence>
 *         <element ref="{http://www.travelport.com/schema/common_v29_0}BookingTraveler" maxOccurs="unbounded" minOccurs="0"/>
 *         <element ref="{http://www.travelport.com/schema/air_v29_0}AirReservation" minOccurs="0"/>
 *         <element name="ExchangeFailureInfo" type="{http://www.travelport.com/schema/air_v29_0}typeTicketFailureInfo" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "bookingTraveler",
    "airReservation",
    "exchangeFailureInfo"
})
@XmlRootElement(name = "AirExchangeRsp")
public class AirExchangeRsp
    extends BaseRsp
{

    @XmlElement(name = "BookingTraveler", namespace = "http://www.travelport.com/schema/common_v29_0")
    protected List<BookingTraveler> bookingTraveler;
    @XmlElement(name = "AirReservation")
    protected AirReservation airReservation;
    @XmlElement(name = "ExchangeFailureInfo")
    protected List<TypeTicketFailureInfo> exchangeFailureInfo;

    /**
     * Provider: ACH.Gets the value of the bookingTraveler property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the bookingTraveler property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getBookingTraveler().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link BookingTraveler }
     *
     *
     */
    public List<BookingTraveler> getBookingTraveler() {
        if (bookingTraveler == null) {
            bookingTraveler = new ArrayList<BookingTraveler>();
        }
        return this.bookingTraveler;
    }

    /**
     * Provider: ACH.
     *
     * @return
     *     possible object is
     *     {@link AirReservation }
     *
     */
    public AirReservation getAirReservation() {
        return airReservation;
    }

    /**
     * Sets the value of the airReservation property.
     *
     * @param value
     *     allowed object is
     *     {@link AirReservation }
     *
     */
    public void setAirReservation(AirReservation value) {
        this.airReservation = value;
    }

    /**
     * Gets the value of the exchangeFailureInfo property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the exchangeFailureInfo property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getExchangeFailureInfo().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link TypeTicketFailureInfo }
     *
     *
     */
    public List<TypeTicketFailureInfo> getExchangeFailureInfo() {
        if (exchangeFailureInfo == null) {
            exchangeFailureInfo = new ArrayList<TypeTicketFailureInfo>();
        }
        return this.exchangeFailureInfo;
    }

}


text:
import {MouseEventHandler, MouseEvent} from "react";
import katex from "katex";

// expose katex on window, for use by $node.ts (in dm-server shared-code, when running on client)
G({katex});

// todo: probably remove, since outdated
export function StandardCompProps() {
	return ["dispatch", "_user", "_permissions", "_extraInfo"] as const;
}

export function MarkHandled(event: React.SyntheticEvent) {
	event.preventDefault();
	event.nativeEvent["handled"] = true;
}
export function IsHandled(event: React.SyntheticEvent | Event) {
	if (event["nativeEvent"]) {
		return !!event["nativeEvent"].handled;
	}
	return !!event["handled"];
}

export function IsMouseEnterReal(event: React.MouseEvent<MouseEvent>, dom: HTMLElement) {
	const {fromElement, toElement} = event.nativeEvent as any;
	if (fromElement == null || toElement == null) return true; // just assume true
	return !dom.contains(fromElement) && dom.contains(toElement);
}
export function IsMouseLeaveReal(event: React.MouseEvent<MouseEvent>, dom: HTMLElement) {
	const {fromElement, toElement} = event.nativeEvent as any;
	if (fromElement == null || toElement == null) return true; // just assume true
	return dom.contains(fromElement) && !dom.contains(toElement);
}