text:
import { DeviceType } from './device-type';

let instance;

const type = 'action.devices.types.SHUTTER'

class Shutter extends DeviceType {
  constructor() {
    super()
    this.valuesArray = [{
      nicknames: ['back window shutter'],
      roomHint: 'Kitchen',
    }];
  }

  static createDevice() {
    if (!instance) {
      instance = new Shutter()
    }
    const element = instance.valuesArray.shift();

    return {
      id: instance.genUuid(),
      type,
      traits: [
        'action.devices.traits.OpenClose',
      ],
      defaultNames: [`Smart Shutter`],
      name: `Smart Shutter`,
      nicknames: instance.getNicknames(element),
      roomHint: instance.getRoomHint(element),
      attributes: {
        openDirection: ['LEFT', 'RIGHT'],
      },
      willReportState: true,
      states: {
        online: true,
        openState: [{
          openPercent: 0,
          openDirection: 'LEFT',
        }, {
          openPercent: 0,
          openDirection: 'RIGHT',
        }],
      },
      hwVersion: '3.2',
      swVersion: '11.4',
      model: '442',
      manufacturer: 'sirius',
    };
  }
}

window.deviceTypes.push({
  type,
  identifier: '_addShutter',
  icon: 'maps:map',
  label: 'Shutters',
  function: (app) => {
    app._createDevice(Shutter.createDevice());
  },
})


text:
Starboard is Cobalt's porting layer and OS abstraction. It attempts to encompass
all the platform-specific functionality that Cobalt actually uses, and nothing
that it does not.

## GN Migration Notice

Cobalt and Starboard have been migrated from the GYP build system to the GN
build system. This readme only contains instructions for GN, as GYP is no
longer supported.

## Documentation

See [`starboard/doc`](doc) for more detailed documentation.

## Interesting Source Locations

All source locations are specified relative to `starboard/` (this directory).

  * [`.`](.) - This is the root directory for the Starboard project, and
    contains all the public headers that Starboard defines.
  * [`examples/`](examples) - Example code demonstrating various aspects of
    Starboard API usage.
  * [`stub/`](stub) - The home of the Stub Starboard implementation. This
    contains a `BUILD.gn` file that defines a library with all the
    source files needed to provide a complete linkable Starboard implementation.
  * [`nplb/`](nplb) - "No Platform Left Behind," Starboard's platform
    verification test suite.
  * [`shared/`](shared) - The home of all code that can be shared between
    Starboard implementations. Subdirectories delimit code that can be shared
    between platforms that share some facet of their OS API.

## Quick Guide to Starting a Port

### I. Enumerate and Name Your Platform Configurations

Before starting a Cobalt/Starboard port, first you will need to define the
canonical names for your set of platform configurations. These will be used when
organizing the code for your platforms.

What determines what goes into one platform configuration versus another? A
platform configuration has a one-to-one mapping to a production binary. So, if
you will need to produce a new binary, you are going to need a new platform
configuration for that.

The recommended naming convention for a `<platform-configuration>` is:

    <family-name>-<binary-variant>

Where `<family-name>` is a name specific to the family of products you are
porting to Starboard and `<binary-variant>` is one or more tokens that uniquely
describe the specifics of the binary you want that configuration to produce.

For example, let's say your company is named BobCo. BobCo employs multiple
different device architectures so it will need to define multiple platform
configurations.

All the BobCo devices are called BobBox, so it's a reasonable choice as a
product `<family-name>`. But they have both big- and little-endian ARM
chips. So they might define two platform configurations:

  1. `bobbox-armeb` - For big-endian ARM devices.
  1. `bobbox-armel` - For little-endian ARM devices.

### II. Choose a Location in the Source Tree for Your Starboard Port

To be perfectly compatible with the Cobalt source tree layout, any code that is
written by a party that isn't the Cobalt team should be in the
`third_party/` directory. The choice is up to you, but we recommend that you
follow this practice, even if, as we expect to be common, you do not plan on
sharing your Starboard implementation with anyone.

Primarily, following this convention ensures that no future changes to Cobalt or
Starboard will conflict with your source code additions. Starboard is intended
to be a junction where new Cobalt versions or Starboard implementations can be
replaced without significant (and hopefully, any) code changes.

We recommend that you place your code here in the source tree:

    third_party/starboard/<family-name>/

With subdirectories:

  * `shared/` - For code shared between architectures within a product family.
  * `<binary-variant>/` - For any code that is specific to a specific binary
    variant. Each one of these must at least have `BUILD.gn`,
    `configuration_public.h`, `atomic_public.h`,
    `platform_configuration/BUILD.gn`,
    `platform_configuration/configuration.gni`, and `toolchain/BUILD.gn` files.

In the BobCo's BobBox example, we would see something like:

  * `third_party/starboard/bobbox/`
      * `shared/`
      * `armeb/`
          * `platform_configuration/`
            * `BUILD.gn`
            * `configuration.gni`
          * `toolchain/`
            * `BUILD.gn`
          * `atomic_public.h`
          * `BUILD.gn`
          * `configuration_public.h`
      * `armel/`
          * `platform_configuration/`
            * `BUILD.gn`
            * `configuration.gni`
          * `toolchain/`
            * `BUILD.gn`
          * `atomic_public.h`
          * `BUILD.gn`
          * `configuration_public.h`

And so on.

### III. Base Your Port on a Reference Port

You can start off by copying files from a reference port to your port's
location. Currently these reference ports include:

  * `starboard/stub`
  * `starboard/linux`
  * `starboard/raspi`

The platform's `BUILD.gn` contains absolute paths, so the paths will still be
valid if you copy it to a new directory. You can then incrementally replace
files with new implementations as necessary.

The cleanest, simplest starting point is from the Stub reference
implementation. Nothing will work, but you should be able to compile and link it
with your toolchain. You can then replace stub implementations with
implementations from `starboard/shared` or your own custom implementations
module-by-module, until you have gone through all modules.

You may also choose to copy either the Desktop Linux or Raspberry Pi ports and
work backwards fixing things that don't compile or work on your platform.

For example, for `bobbox-armel`, you might do:

    mkdir -p third_party/starboard/bobbox
    cp -R starboard/stub third_party/starboard/bobbox/armel

Modify the files in `<binary-variant>/` as appropriate (you will probably be
coming back to these files a lot).

Update `<binary-variant>/BUILD.gn` to point at all the source files that you
want to build as your new Starboard implementation. The `//` expression in GN
refers to the top-level directory of your source tree. Otherwise, files are
assumed to be relative to the directory the `BUILD.gn` or `.gni` file is in.
The `BUILD.gn` file contains absolute paths, so the paths will still be valid
if you copy it to a new directory. You can then incrementally replace files
with new implementations as necessary.

In order to use a new platform configuration in a build, you need to ensure that
you have a `BUILD.gn`, `toolchain/BUILD.gn`,
`platform_configuration/configuration.gni`, and
`platform_configuration/BUILD.gn` in their own directory for each binary
variant, plus the header files `configuration_public.h` and `atomic_public.h`.
You must add your platform name to `starboard/build/platforms.py` along with
the path to the port to be able to build it.

### IV. A New Port, Step-by-Step

  1. Recursively copy `starboard/stub` to
     `third_party/starboard/<family-name>/<binary-variant>`.  You may also
     consider copying from another reference platform, like `raspi-2` or
     `linux-x64x11`.
  1. Add your platform and path to `starboard/build/platforms.py`.
  1. In `platform_configuration/configuration.gni`
      1. Delete variables in the file that are not needed for your platform.
      1. Set `gl_type` to the appropriate value if it is not the default
         `system_gles2`.
      1. Set `enable_in_app_dial` to `true` or `false`. This enables or
         disables the DIAL server that runs inside Cobalt, only when Cobalt is
         running. You do not want in-app DIAL if you already have system-wide
         DIAL support.
  1. In `platform_configuration/BUILD.gn`
      1. Update your toolchain command-line flags and libraries. Make sure you
         don't assume a particular workstation layout, as it is likely to be
         different for someone else.
  1. In `toolchain/BUILD.gn`
      1. Either use the `clang_toolchain` template and pass the base path to
         your toolchain, or use the `gcc_toolchain` and pass the full path to
         each tool you use.
      1. Set `is_clang = true` in `toolchain_args` in `gcc_toolchain` if the
         toolchain uses clang.
  1. Go through `configuration_public.h` and adjust all the configuration values
     as appropriate for your platform.
  1. Update `BUILD.gn` to point at all the source files you want to build as
     part of your new Starboard implementation (as mentioned above).
  1. Update `atomic_public.h` as necessary to point
     at the appropriate shared or custom implementations.

If you want to use `cobalt/build/gn.py`, you'll also need a
`third_party/starboard/<family-name>/<binary-variant>/args.gn` file. This
should contain the gn arguments necessary to build your platform. Pay
particular attention to `target_platform`, `target_os`, `target_cpu`, and
`is_clang`. The defaults for each can be found in
`starboard/build/config/BUILDCONFIG.gn`. If you don't care about using `gn.py`,
all of these arguments can be passed using `gn args` or `gn gen` with `--args`.
For example, the first command below might instead look like
`gn gen out/bobbox-armeb_debug --args='target_platform="bobbox-armeb" build_type="debug"'`.

You should now be able to run GN with your new port. From your the top level
directory:

    $ python cobalt/build/gn.py -c debug -p bobbox-armeb
    $ ninja -C out/bobbox-armeb_debug nplb

This will attempt to build the "No Platform Left Behind" test suite with your
new Starboard implementation, and you are ready to start porting!

## Suggested Implementation Order

When bringing up a new Starboard platform, it is suggested that you try to get
the NPLB tests passing module-by-module. Because of dependencies between
modules, you will find it easier to get some modules passing sooner than other
modules.

Here's a recommended module implementation order in which to get things going
(still significantly subject to change based on feedback):

  1. Configuration
  1. main(), Application, & Event Pump (i.e. the call into SbEventHandle)
  1. Memory
  1. Byte Swap
  1. Time
  1. String/Character/Double
  1. Log
  1. File
  1. Directory
  1. System
  1. Atomic
  1. Thread & Thread Types
  1. Mutex
  1. Condition Variable
  1. Once
  1. Socket
  1. SocketWaiter
  1. Window
  1. Input
  1. Blitter (if applicable)
  1. Audio Sink
  1. Media & Player
  1. DRM
  1. TimeZone
  1. User
  1. Storage

redpajama_set_name: RedPajamaGithub


text:
import documentRoute from './documents.routes';
import userRoute from './users.routes';
import searchRoute from './search.routes';
import rolesRoute from './roles.routes';

const routes = (router) => {
  userRoute(router);
  documentRoute(router);
  searchRoute(router);
  rolesRoute(router);
};

export default routes;


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>Lot: src/num.h Source File</title>
<link href="tabs.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" />

Lot

Main Page

Data Structures

Files

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

File List

Globals

 All Data Structures Files Functions Macros

src

num.h

Go to the documentation of this file.

    1

    6 #ifndef NUM_H

    7 #define NUM_H

    8 #define MAX_NUMBER 3268720

    9

   15 struct Num {

   16     long id;

   17     int balls[25];

   18     int cols[5];

   19     int lines[5];

   20     void (*toString)(struct Num*, char*);

   21     void (*print)(struct Num*);

   22     void (*inc)  (struct Num*);

   23     void (*switchNumbers)(struct Num*, int, int);

   24     void (*destroy)(struct Num*);

   25     int  (*compare)(struct Num*, struct Num*);

   26     void (*write_to_file)(struct Num*, char*);

   27     void (*load_string)(struct Num*, char*);

   28     void (*reset)(struct Num*);

   29     void (*clear)(struct Num*);

   30     int  (*density)(struct Num*);

   31     struct Num* (*clone)(struct Num*);

   32 };

   33

   34 extern struct Num *

   35 newNum();

   36

   37 extern struct Num *

   38 num_clone(struct Num *);

   39 extern int num_line(struct Num *, int line);

   40 extern void num_destroy(struct Num *);

   41

   42 static int

   43 bols_in_the_end(struct Num *);

   44

   45 static int num_compare(struct Num *, struct Num *other);

   46 static struct Node * num_load_file(struct Num*, char*);

   47 static void num_inc(struct Num *);

   48 static void num_load_string(struct Num *, char *text);

   49 static void num_print(struct Num *);

   50 static void num_reset(struct Num *);

   51 static void num_clear(struct Num *);

   52 static void num_switch(struct Num *, int a, int b);

   53 static void num_toString(struct Num *, char* text);

   54 static void num_write_file(struct Num*, char*);

   55 static int  num_density(struct Num*);

   56 extern int num_line(struct Num *, int);

   57 extern int num_cols(struct Num *, int);

   58 static void setup_cols_and_lines(struct Num *num, int ball);

   59

   60 #endif

Node

Definition: list.h:30

Num

A combination of numbers.

Definition: num.h:15

<address class="footer">
Generated on Mon Jan 8 2018 20:09:03 for Lot by

 1.8.8
</address>


text:
package network

import (
	log "github.com/Sirupsen/logrus"
	"github.com/ffloyd/evergrid-go/simulator/simdata/networkcfg"
)

// Network represents all network stats for all machines in simulation.
type Network struct {
	name     string
	segments map[string]*Segment

	nodes map[string]*Node
}

// New creates a new network basing on config
func New(config *networkcfg.NetworkCfg) *Network {
	network := &Network{
		name:     config.Name,
		segments: make(map[string]*Segment),
		nodes:    make(map[string]*Node),
	}

	for _, segmentConfig := range config.Segments {
		segment := newSegment(segmentConfig, network)
		network.segments[segmentConfig.Name] = segment
		for name, node := range segment.nodes {
			network.nodes[name] = node
		}
	}

	log.WithField("name", network.name).Info("Network initialized")
	return network
}

// Node returns node by its name
func (network Network) Node(name string) *Node {
	return network.nodes[name]
}


text:
import {provideStore, Store} from '@ngrx/store';

import {t, TEST_COMMON_PROVIDERS, TEST_ROUTER_PROVIDERS, TEST_MULTILINGUAL_PROVIDERS, TEST_MULTILINGUAL_RESET, WindowMockFrench} from '../../test.framework/index';
import {ILang} from '../../core.framework/index';
import {MultilingualService, MultilingualStateI, multilingualReducer} from '../index';

export function main() {
  t.describe('i18n.framework: MultilingualService', () => {
    t.bep(() => [
      TEST_COMMON_PROVIDERS(),
      TEST_ROUTER_PROVIDERS(),
      TEST_MULTILINGUAL_PROVIDERS(),
      provideStore({i18n: multilingualReducer})
    ]);
    t.it('should at a minimum support english', () => {
      t.e(MultilingualService.SUPPORTED_LANGUAGES.length).toBe(1);
      t.e(MultilingualService.SUPPORTED_LANGUAGES[0].code).toBe('en');
    });
    t.it('changeLang - should not switch unless supported', t.inject([MultilingualService, Store], (multilang: MultilingualService, store: Store<any>) => {
      multilang.changeLang('fr');
      // only 'en' supported by default so changing to 'fr' should not change state
      store.select('i18n').subscribe((i18n: MultilingualStateI) => {
        t.e(i18n.lang).toBe('en');
      });
    }));

  });

  t.describe('i18n.framework: MultilingualService for French browser/platform', () => {
    const SUPPORTED_LANGUAGES: Array<ILang> = [
      { code: 'en', title: 'English' },
      { code: 'fr', title: 'French' }
    ];
    t.be(() => MultilingualService.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES);
    t.bep(() => [
      TEST_COMMON_PROVIDERS({ Window: WindowMockFrench }),
      TEST_ROUTER_PROVIDERS(),
      TEST_MULTILINGUAL_PROVIDERS(),
      provideStore({i18n: multilingualReducer})
    ]);
    t.it('should now support french by default', t.inject([MultilingualService, Store], (multilang: MultilingualService, store: Store<any>) => {
      store.select('i18n').subscribe((i18n: MultilingualStateI) => {
        t.e(i18n.lang).toBe('fr');
      });
      t.e(MultilingualService.SUPPORTED_LANGUAGES.length).toBe(2);
      t.e(MultilingualService.SUPPORTED_LANGUAGES[0].code).toBe('en');
      t.e(MultilingualService.SUPPORTED_LANGUAGES[1].code).toBe('fr');
    }));

    // ensure statics are reset when the test had modified statics in a beforeEach (be) or beforeEachProvider (bep)
    t.ae(() => TEST_MULTILINGUAL_RESET());

  });

}


text:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;

namespace DBAdapter.Helper
{
	public interface IRepository<T> : IDisposable where T : class
    {
        /// <summary>
        /// Gets all objects from database
        /// </summary>
        /// <returns></returns>
        IQueryable<T> All(string[] includes = null);

		/// <summary>
		///
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="id"></param>
		/// <returns></returns>
        T GetById(Guid id);

        /// <summary>
        /// Find object by specified expression.
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        T FindOne(Expression<Func<T, bool>> predicate, string[] includes = null);

        /// <summary>
        /// Gets objects from database by filter.
        /// </summary>
        /// <param name="predicate">Specified a filter</param>
        /// <returns></returns>
        IQueryable<T> Filter(Expression<Func<T, bool>> predicate, string[] includes = null);

        /// <summary>
        /// Gets objects from database with filting and paging.
        /// </summary>
        /// <typeparam name="Key"></typeparam>
        /// <param name="filter">Specified a filter</param>
        /// <param name="total">Returns the total records count of the filter.</param>
        /// <param name="index">Specified the page index.</param>
        /// <param name="size">Specified the page size</param>
        /// <returns></returns>
        IQueryable<T> Filter(Expression<Func<T, bool>> filter, out int total, int index = 0, int size = 50, string[] includes = null);

        /// <summary>
        /// Gets the object(s) is exists in database by specified filter.
        /// </summary>
        /// <param name="predicate">Specified the filter expression</param>
        /// <returns></returns>
        bool Contains(Expression<Func<T, bool>> predicate);

        /// <summary>
        /// Create a new object to database.
        /// </summary>
        /// <param name="t">Specified a new object to create.</param>
        /// <returns></returns>
        T Create(T t);

        /// <summary>
        /// Delete the object from database.
        /// </summary>
        /// <param name="t">Specified a existing object to delete.</param>
        int Delete(T t);

        /// <summary>
        /// Delete objects from database by specified filter expression.
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        int Delete(Expression<Func<T, bool>> predicate);

        /// <summary>
        /// Update object changes and save to database.
        /// </summary>
        /// <param name="t">Specified the object to save.</param>
        /// <returns></returns>
        int Update(T t);

        /// <summary>
        /// Saves the changes.
        /// </summary>
        void SaveChanges();

        /// <summary>
        /// Executes the procedure.
        /// </summary>
        /// <param name="procedureCommand">The procedure command.</param>
        /// <param name="sqlParams">The SQL params.</param>
        void ExecuteProcedure(String procedureCommand, params SqlParameter[] sqlParams);
    }
}


text:
namespace ConoHaNet
{
    using Objects.Billing;
    using Providers;
    using System.Collections.Generic;
    using System.Diagnostics;

    public partial class OpenStackMember : IOpenStackMember
    {

        private CloudAccountServiceProvider _AccountServiceProvider = null;

        /// <inheritdoc/>
        public CloudAccountServiceProvider AccountServiceProvider
        {
            get
            {
                if (_AccountServiceProvider == null)
                {
                    _AccountServiceProvider = new CloudAccountServiceProvider(this.Identity, this.DefaultRegion, this.IdentityProvider, null);
                    Trace.WriteLine("CloudAccountServiceProvider created.");
                }

                return _AccountServiceProvider;
            }
        }

        /// <inheritdoc/>
        public IEnumerable<SimpleOrderItem> ListOrderItems()
        {
            return AccountServiceProvider.ListOrderItems(Identity);
        }

        /// <inheritdoc/>
        public OrderItem GetOrderItem(string itemid)
        {
            return AccountServiceProvider.GetOrderItem(itemid, Identity);
        }

        /// <inheritdoc/>
        public IEnumerable<ProdctBase> ListProducts()
        {
            return AccountServiceProvider.ListProducts(Identity);
        }

        /// <inheritdoc/>
        public IEnumerable<SimplePayment> ListPaymentHistory()
        {
            return AccountServiceProvider.ListPaymentHistory(Identity);
        }

        /// <inheritdoc/>
        public PaymentSummary GetPaymentSummary()
        {
            return AccountServiceProvider.GetPaymentSummary(Identity);
        }

        /// <inheritdoc/>
        public IEnumerable<BillingInvoice> ListBillingInvoices(int offset = 0, int limit = 1000)
        {
            return AccountServiceProvider.ListBillingInvoices(offset, limit, Identity);
        }

        /// <inheritdoc/>
        public BillingInvoice GetBillingInvoice(int invoiceId)
        {
            return AccountServiceProvider.GetBillingInvoice(invoiceId, Identity);
        }

        /// <inheritdoc/>
        public IEnumerable<Notification> ListNotifications(string lang = "en", int offset = 0, int limit = 1000)
        {
            return AccountServiceProvider.ListNotifications(lang, offset, limit, Identity);
        }

        /// <inheritdoc/>
        public Notification GetNotification(int notificationCode, string lang = "en")
        {
            return AccountServiceProvider.GetNotification(notificationCode, lang, Identity);
        }

        /// <inheritdoc/>
        public Notification SetNotification(int notificationCode, string status)
        {
            return AccountServiceProvider.SetNotification(notificationCode, status, Identity);
        }

    }
}


text:
import { DateRangeInputDirective } from './date-range-input.directive';

describe('DateRangeInputDirective', () => {
  it('should create an instance', () => {
    const directive = new DateRangeInputDirective(null as any);
    expect(directive).toBeTruthy();
  });
});


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Searching Algorithms</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../algorithm.html" title="Chapter 3. The Boost Algorithm Library">
<link rel="prev" href="../algorithm.html" title="Chapter 3. The Boost Algorithm Library">
<link rel="next" href="CXX11.html" title="C++11 Algorithms">

Home
Libraries
People
FAQ
More

Searching Algorithms

Boyer-Moore
      Search

Boyer-Moore-Horspool
      Search

Knuth-Morris-Pratt
      Search

Boyer-Moore
      Search

        Overview

        The header file 'boyer_moore.hpp' contains an implementation of the Boyer-Moore
        algorithm for searching sequences of values.

        The Boyer–Moore string search algorithm is a particularly efficient string
        searching algorithm, and it has been the standard benchmark for the practical
        string search literature. The Boyer-Moore algorithm was invented by Bob Boyer
        and J. Strother Moore, and published in the October 1977 issue of the Communications
        of the ACM , and a copy of that article is available at http://www.cs.utexas.edu/~moore/publications/fstrpos.pdf.

        The Boyer-Moore algorithm uses two precomputed tables to give better performance
        than a naive search. These tables depend on the pattern being searched for,
        and give the Boyer-Moore algorithm larger a memory footprint and startup
        costs than a simpler algorithm, but these costs are recovered quickly during
        the searching process, especially if the pattern is longer than a few elements.

        However, the Boyer-Moore algorithm cannot be used with comparison predicates
        like std::search.

        Nomenclature: I refer to the sequence being searched for as the "pattern",
        and the sequence being searched in as the "corpus".

        Interface

        For flexibility, the Boyer-Moore algorithm has two interfaces; an object-based
        interface and a procedural one. The object-based interface builds the tables
        in the constructor, and uses operator () to perform the search. The procedural
        interface builds the table and does the search all in one step. If you are
        going to be searching for the same pattern in multiple corpora, then you
        should use the object interface, and only build the tables once.

        Here is the object interface:

template <typename patIter>
class boyer_moore {
public:
    boyer_moore ( patIter first, patIter last );
    ~boyer_moore ();

    template <typename corpusIter>
    corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last );
    };

        and here is the corresponding procedural interface:

template <typename patIter, typename corpusIter>
corpusIter boyer_moore_search (
        corpusIter corpus_first, corpusIter corpus_last,
        patIter pat_first, patIter pat_last );

        Each of the functions is passed two pairs of iterators. The first two define
        the corpus and the second two define the pattern. Note that the two pairs
        need not be of the same type, but they do need to "point" at the
        same type. In other words, patIter::value_type
        and curpusIter::value_type need to be the same type.

        The return value of the function is an iterator pointing to the start of
        the pattern in the corpus. If the pattern is not found, it returns the end
        of the corpus (corpus_last).

        Performance

        The execution time of the Boyer-Moore algorithm, while still linear in the
        size of the string being searched, can have a significantly lower constant
        factor than many other search algorithms: it doesn't need to check every
        character of the string to be searched, but rather skips over some of them.
        Generally the algorithm gets faster as the pattern being searched for becomes
        longer. Its efficiency derives from the fact that with each unsuccessful
        attempt to find a match between the search string and the text it is searching,
        it uses the information gained from that attempt to rule out as many positions
        of the text as possible where the string cannot match.

        Memory
        Use

        The algorithm allocates two internal tables. The first one is proportional
        to the length of the pattern; the second one has one entry for each member
        of the "alphabet" in the pattern. For (8-bit) character types,
        this table contains 256 entries.

        Complexity

        The worst-case performance to find a pattern in the corpus is O(N)
        (linear) time; that is, proportional to the length of the corpus being searched.
        In general, the search is sub-linear; not every entry in the corpus need
        be checked.

        Exception
        Safety

        Both the object-oriented and procedural versions of the Boyer-Moore algorithm
        take their parameters by value and do not use any information other than
        what is passed in. Therefore, both interfaces provide the strong exception
        guarantee.

        Notes

            When using the object-based interface, the pattern must remain unchanged
            for during the searches; i.e, from the time the object is constructed
            until the final call to operator () returns.

            The Boyer-Moore algorithm requires random-access iterators for both the
            pattern and the corpus.

        Customization
        points

        The Boyer-Moore object takes a traits template parameter which enables the
        caller to customize how one of the precomputed tables is stored. This table,
        called the skip table, contains (logically) one entry for every possible
        value that the pattern can contain. When searching 8-bit character data,
        this table contains 256 elements. The traits class defines the table to be
        used.

        The default traits class uses a boost::array
        for small 'alphabets' and a tr1::unordered_map
        for larger ones. The array-based skip table gives excellent performance,
        but could be prohibitively large when the 'alphabet' of elements to be searched
        grows. The unordered_map based version only grows as the number of unique
        elements in the pattern, but makes many more heap allocations, and gives
        slower lookup performance.

        To use a different skip table, you should define your own skip table object
        and your own traits class, and use them to instantiate the Boyer-Moore object.
        The interface to these objects is described TBD.

Boyer-Moore-Horspool
      Search

        Overview

        The header file 'boyer_moore_horspool.hpp' contains an implementation of
        the Boyer-Moore-Horspool algorithm for searching sequences of values.

        The Boyer-Moore-Horspool search algorithm was published by Nigel Horspool
        in 1980. It is a refinement of the Boyer-Moore algorithm that trades space
        for time. It uses less space for internal tables than Boyer-Moore, and has
        poorer worst-case performance.

        The Boyer-Moore-Horspool algorithm cannot be used with comparison predicates
        like std::search.

        Interface

        Nomenclature: I refer to the sequence being searched for as the "pattern",
        and the sequence being searched in as the "corpus".

        For flexibility, the Boyer-Moore-Horspool algorithm has two interfaces; an
        object-based interface and a procedural one. The object-based interface builds
        the tables in the constructor, and uses operator () to perform the search.
        The procedural interface builds the table and does the search all in one
        step. If you are going to be searching for the same pattern in multiple corpora,
        then you should use the object interface, and only build the tables once.

        Here is the object interface:

template <typename patIter>
class boyer_moore_horspool {
public:
    boyer_moore_horspool ( patIter first, patIter last );
    ~boyer_moore_horspool ();

    template <typename corpusIter>
    corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last );
    };

        and here is the corresponding procedural interface:

template <typename patIter, typename corpusIter>
corpusIter boyer_moore_horspool_search (
        corpusIter corpus_first, corpusIter corpus_last,
        patIter pat_first, patIter pat_last );

        Each of the functions is passed two pairs of iterators. The first two define
        the corpus and the second two define the pattern. Note that the two pairs
        need not be of the same type, but they do need to "point" at the
        same type. In other words, patIter::value_type
        and curpusIter::value_type need to be the same type.

        The return value of the function is an iterator pointing to the start of
        the pattern in the corpus. If the pattern is not found, it returns the end
        of the corpus (corpus_last).

        Performance

        The execution time of the Boyer-Moore-Horspool algorithm is linear in the
        size of the string being searched; it can have a significantly lower constant
        factor than many other search algorithms: it doesn't need to check every
        character of the string to be searched, but rather skips over some of them.
        Generally the algorithm gets faster as the pattern being searched for becomes
        longer. Its efficiency derives from the fact that with each unsuccessful
        attempt to find a match between the search string and the text it is searching,
        it uses the information gained from that attempt to rule out as many positions
        of the text as possible where the string cannot match.

        Memory
        Use

        The algorithm an internal table that has one entry for each member of the
        "alphabet" in the pattern. For (8-bit) character types, this table
        contains 256 entries.

        Complexity

        The worst-case performance is O(m x n), where m
        is the length of the pattern and n is the length of
        the corpus. The average time is O(n). The best case
        performance is sub-linear, and is, in fact, identical to Boyer-Moore, but
        the initialization is quicker and the internal loop is simpler than Boyer-Moore.

        Exception
        Safety

        Both the object-oriented and procedural versions of the Boyer-Moore-Horspool
        algorithm take their parameters by value and do not use any information other
        than what is passed in. Therefore, both interfaces provide the strong exception
        guarantee.

        Notes

            When using the object-based interface, the pattern must remain unchanged
            for during the searches; i.e, from the time the object is constructed
            until the final call to operator () returns.

            The Boyer-Moore-Horspool algorithm requires random-access iterators for
            both the pattern and the corpus.

        Customization
        points

        The Boyer-Moore-Horspool object takes a traits template parameter which enables
        the caller to customize how the precomputed table is stored. This table,
        called the skip table, contains (logically) one entry for every possible
        value that the pattern can contain. When searching 8-bit character data,
        this table contains 256 elements. The traits class defines the table to be
        used.

        The default traits class uses a boost::array
        for small 'alphabets' and a tr1::unordered_map
        for larger ones. The array-based skip table gives excellent performance,
        but could be prohibitively large when the 'alphabet' of elements to be searched
        grows. The unordered_map based version only grows as the number of unique
        elements in the pattern, but makes many more heap allocations, and gives
        slower lookup performance.

        To use a different skip table, you should define your own skip table object
        and your own traits class, and use them to instantiate the Boyer-Moore-Horspool
        object. The interface to these objects is described TBD.

Knuth-Morris-Pratt
      Search

        Overview

        The header file 'knuth_morris_pratt.hpp' contains an implementation of the
        Knuth-Morris-Pratt algorithm for searching sequences of values.

        The basic premise of the Knuth-Morris-Pratt algorithm is that when a mismatch
        occurs, there is information in the pattern being searched for that can be
        used to determine where the next match could begin, enabling the skipping
        of some elements of the corpus that have already been examined.

        It does this by building a table from the pattern being searched for, with
        one entry for each element in the pattern.

        The algorithm was conceived in 1974 by Donald Knuth and Vaughan Pratt, and
        independently by James H. Morris. The three published it jointly in 1977
        in the SIAM Journal on Computing http://citeseer.ist.psu.edu/context/23820/0

        However, the Knuth-Morris-Pratt algorithm cannot be used with comparison
        predicates like std::search.

        Interface

        Nomenclature: I refer to the sequence being searched for as the "pattern",
        and the sequence being searched in as the "corpus".

        For flexibility, the Knuth-Morris-Pratt algorithm has two interfaces; an
        object-based interface and a procedural one. The object-based interface builds
        the table in the constructor, and uses operator () to perform the search.
        The procedural interface builds the table and does the search all in one
        step. If you are going to be searching for the same pattern in multiple corpora,
        then you should use the object interface, and only build the tables once.

        Here is the object interface:

template <typename patIter>
class knuth_morris_pratt {
public:
    knuth_morris_pratt ( patIter first, patIter last );
    ~knuth_morris_pratt ();

    template <typename corpusIter>
    corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last );
    };

        and here is the corresponding procedural interface:

template <typename patIter, typename corpusIter>
corpusIter knuth_morris_pratt_search (
        corpusIter corpus_first, corpusIter corpus_last,
        patIter pat_first, patIter pat_last );

        Each of the functions is passed two pairs of iterators. The first two define
        the corpus and the second two define the pattern. Note that the two pairs
        need not be of the same type, but they do need to "point" at the
        same type. In other words, patIter::value_type
        and curpusIter::value_type need to be the same type.

        The return value of the function is an iterator pointing to the start of
        the pattern in the corpus. If the pattern is not found, it returns the end
        of the corpus (corpus_last).

        Performance

        The execution time of the Knuth-Morris-Pratt algorithm is linear in the size
        of the string being searched. Generally the algorithm gets faster as the
        pattern being searched for becomes longer. Its efficiency derives from the
        fact that with each unsuccessful attempt to find a match between the search
        string and the text it is searching, it uses the information gained from
        that attempt to rule out as many positions of the text as possible where
        the string cannot match.

        Memory
        Use

        The algorithm an that contains one entry for each element the pattern, plus
        one extra. So, when searching for a 1026 byte string, the table will have
        1027 entries.

        Complexity

        The worst-case performance is O(2n), where n
        is the length of the corpus. The average time is O(n).
        The best case performance is sub-linear.

        Exception
        Safety

        Both the object-oriented and procedural versions of the Knuth-Morris-Pratt
        algorithm take their parameters by value and do not use any information other
        than what is passed in. Therefore, both interfaces provide the strong exception
        guarantee.

        Notes

            When using the object-based interface, the pattern must remain unchanged
            for during the searches; i.e, from the time the object is constructed
            until the final call to operator () returns.

            The Knuth-Morris-Pratt algorithm requires random-access iterators for
            both the pattern and the corpus. It should be possible to write this
            to use bidirectional iterators (or possibly even forward ones), but this
            implementation does not do that.

Copyright © 2010-2012 Marshall Clow

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
package net.dvt32.restfulwebservices.jwt;

import java.io.IOException;
import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;

@Component
public class JwtUnAuthorizedResponseAuthenticationEntryPoint implements AuthenticationEntryPoint, Serializable {

  private static final long serialVersionUID = -8970718410437077606L;

  @Override
  public void commence(HttpServletRequest request, HttpServletResponse response,
      AuthenticationException authException) throws IOException {
    response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
        "You would need to provide the Jwt Token to Access This resource");
  }
}


text:
import {injectElementRef as render3InjectElementRef} from '../render3/view_engine_compatibility';
import {noop} from '../util/noop';

/**
 * A wrapper around a native element inside of a View.
 *
 * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
 * element.
 *
 * @security Permitting direct access to the DOM can make your application more vulnerable to
 * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
 * [Security Guide](http://g.co/ng/security).
 *
 * @publicApi
 */
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
// i.e. users have to ask for what they need. With that, we can build better analysis tools
// and could do better codegen in the future.
export class ElementRef<T = any> {
  /**
   * The underlying native element or `null` if direct access to native elements is not supported
   * (e.g. when the application runs in a web worker).
   *
   *

   *   Use with caution
   *

   *    Use this API as the last resort when direct access to DOM is needed. Use templating and
   *    data-binding provided by Angular instead. Alternatively you can take a look at {@link
   * Renderer2}
   *    which provides API that can safely be used even when direct access to native elements is not
   *    supported.
   *

   *

   *    Relying on direct DOM access creates tight coupling between your application and rendering
   *    layers which will make it impossible to separate the two and deploy your application into a
   *    web worker.
   *

   *

   *
   */
  public nativeElement: T;

  constructor(nativeElement: T) {
    this.nativeElement = nativeElement;
  }

  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__: () => ElementRef = () => SWITCH_ELEMENT_REF_FACTORY(ElementRef);
}

export const SWITCH_ELEMENT_REF_FACTORY__POST_R3__ = render3InjectElementRef;
const SWITCH_ELEMENT_REF_FACTORY__PRE_R3__ = noop;
const SWITCH_ELEMENT_REF_FACTORY: typeof render3InjectElementRef =
    SWITCH_ELEMENT_REF_FACTORY__PRE_R3__;


text:
type: politics
kategorien:
  - Offenes Regierungshandeln
  - Community
  - Informationsfreiheit
tile: double
type: featured
title: FragDenStaat
subtitle: Das Informationsfreiheitsportal
layout: project
weight: 4
img: projects/FragDenStaat_Projektuebersicht_bigTile.jpg
img_header: projects/FragDenStaat_Header.jpg
website: https://fragdenstaat.de
people:
  - name: Arne Semsrott
    role: Projektleiter
  - name: Stefan Wehrmeyer
    role: Tech Lead
  - name: Judith Doleschal
    role: Kommunikation und Community-Entwicklung
  - name: Phillip Hofmann
    role: Head of Legal
  - name: Lea Pfau
    role: Campaignerin
  - name: Layla Ansari
  - name: Max Kronmüller
  - name: Hannah Vos
contact_person: arnesemsrott
years: 2011 - heute
financing:
  - Schöpflin-Stiftung
  - Spenden
contact:
  website: https://fragdenstaat.de
  twitter: fragdenstaat
  github: https://github.com/okfde/fragdenstaat_de
  facebook: https://www.facebook.com/fragdenstaat.de
  mastodon:
    handle: fragdenstaat
    server: chaos.social
  instagram: fragdenstaat
video: "https://player.vimeo.com/video/102604678"
cta: Mitmachen
cta_text: |-
  Du hast auch eine Frage an eine Behörde? Stell jetzt eine Anfrage!
more_text: |-
    Weitere Infos gibt es auf FragDenStaat.de.
---

In einer Demokratie ist es notwendig, dass sich Bürgerinnen frei über Regierungshandeln informieren können. Mit dem Informationsfreiheitsgesetz hat jede Person unabhängig von Alter oder Herkunft das Recht, Dokumente bei Behörden anzufragen. Mit der Online-Plattform FragDenStaat unterstützen wir Bürgerinnen dabei, ihr Recht auf Zugang zu Informationen von deutschen Behörden wahrzunehmen. Bürgerinnen müssen sich nicht mehr durch den Gesetzesdschungel der Bundesländer und dem Bund arbeiten, um eine Anfrage zu stellen. Anfragen und Antworten erscheinen transparent online. Schon im Jahr der Gründung des Projektes hat sich die Anzahl der Informationsanfragen in Deutschland verdoppelt.

FragDenStaat ist aber nicht nur eine Software. Wir wollen die Informationsfreiheit in Deutschland nach vorne bringen. Hierzu entwickeln wir eigene Kampagnen, unternehmen eigene Recherchen, entwickeln ein [Transparenzranking]( /projekte/transparenzranking/), das die Informationsfreiheits- und Transparenzgesetze in Bund und Ländern miteinander vergleicht, und arbeiten an einem [Volksentscheid für ein Transparenzgesetz]( /projekte/volksentscheid/) in Berlin gemeinsam mit weiteren zivilgesellschaftlichen Partnern.

Unsere Kampagnen haben unter anderem dazu geführt, dass der Bundestag tausende Gutachten des wissenschaftlichen Dienstes veröffentlicht hat und Gesetzentwürfe von Ministerien mit Lobby-Stellungnahmen frei verfügbar sind.


text:
<?php

namespace Symfony\Component\PropertyAccess\Tests;

use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClass;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet;
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object;

class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var PropertyAccessor
     */
    private $propertyAccessor;

    protected function setUp()
    {
        $this->propertyAccessor = new PropertyAccessor();
    }

    public function getPathsWithMissingProperty()
    {
        return array(
            array((object) array('firstName' => 'Bernhard'), 'lastName'),
            array((object) array('property' => (object) array('firstName' => 'Bernhard')), 'property.lastName'),
            array(array('index' => (object) array('firstName' => 'Bernhard')), '[index].lastName'),
            array(new TestClass('Bernhard'), 'protectedProperty'),
            array(new TestClass('Bernhard'), 'privateProperty'),
            array(new TestClass('Bernhard'), 'protectedAccessor'),
            array(new TestClass('Bernhard'), 'protectedIsAccessor'),
            array(new TestClass('Bernhard'), 'protectedHasAccessor'),
            array(new TestClass('Bernhard'), 'privateAccessor'),
            array(new TestClass('Bernhard'), 'privateIsAccessor'),
            array(new TestClass('Bernhard'), 'privateHasAccessor'),

            // Properties are not camelized
            array(new TestClass('Bernhard'), 'public_property'),
        );
    }

    public function getPathsWithMissingIndex()
    {
        return array(
            array(array('firstName' => 'Bernhard'), '[lastName]'),
            array(array(), '[index][lastName]'),
            array(array('index' => array()), '[index][lastName]'),
            array(array('index' => array('firstName' => 'Bernhard')), '[index][lastName]'),
            array((object) array('property' => array('firstName' => 'Bernhard')), 'property[lastName]'),
        );
    }

    /**
     * @dataProvider getValidPropertyPaths
     */
    public function testGetValue($objectOrArray, $path, $value)
    {
        $this->assertSame($value, $this->propertyAccessor->getValue($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingProperty
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
     */
    public function testGetValueThrowsExceptionIfPropertyNotFound($objectOrArray, $path)
    {
        $this->propertyAccessor->getValue($objectOrArray, $path);
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     */
    public function testGetValueThrowsNoExceptionIfIndexNotFound($objectOrArray, $path)
    {
        $this->assertNull($this->propertyAccessor->getValue($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
     */
    public function testGetValueThrowsExceptionIfIndexNotFoundAndIndexExceptionsEnabled($objectOrArray, $path)
    {
        $this->propertyAccessor = new PropertyAccessor(false, true);
        $this->propertyAccessor->getValue($objectOrArray, $path);
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
     */
    public function testGetValueThrowsExceptionIfNotArrayAccess()
    {
        $this->propertyAccessor->getValue(new \stdClass(), '[index]');
    }

    public function testGetValueReadsMagicGet()
    {
        $this->assertSame('Bernhard', $this->propertyAccessor->getValue(new TestClassMagicGet('Bernhard'), 'magicProperty'));
    }

    // https://github.com/symfony/symfony/pull/4450
    public function testGetValueReadsMagicGetThatReturnsConstant()
    {
        $this->assertSame('constant value', $this->propertyAccessor->getValue(new TestClassMagicGet('Bernhard'), 'constantMagicProperty'));
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
     */
    public function testGetValueDoesNotReadMagicCallByDefault()
    {
        $this->propertyAccessor->getValue(new TestClassMagicCall('Bernhard'), 'magicCallProperty');
    }

    public function testGetValueReadsMagicCallIfEnabled()
    {
        $this->propertyAccessor = new PropertyAccessor(true);

        $this->assertSame('Bernhard', $this->propertyAccessor->getValue(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
    }

    // https://github.com/symfony/symfony/pull/4450
    public function testGetValueReadsMagicCallThatReturnsConstant()
    {
        $this->propertyAccessor = new PropertyAccessor(true);

        $this->assertSame('constant value', $this->propertyAccessor->getValue(new TestClassMagicCall('Bernhard'), 'constantMagicCallProperty'));
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
     */
    public function testGetValueThrowsExceptionIfNotObjectOrArray()
    {
        $this->propertyAccessor->getValue('baz', 'foobar');
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
     */
    public function testGetValueThrowsExceptionIfNull()
    {
        $this->propertyAccessor->getValue(null, 'foobar');
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
     */
    public function testGetValueThrowsExceptionIfEmpty()
    {
        $this->propertyAccessor->getValue('', 'foobar');
    }

    /**
     * @dataProvider getValidPropertyPaths
     */
    public function testSetValue($objectOrArray, $path)
    {
        $this->propertyAccessor->setValue($objectOrArray, $path, 'Updated');

        $this->assertSame('Updated', $this->propertyAccessor->getValue($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingProperty
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
     */
    public function testSetValueThrowsExceptionIfPropertyNotFound($objectOrArray, $path)
    {
        $this->propertyAccessor->setValue($objectOrArray, $path, 'Updated');
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     */
    public function testSetValueThrowsNoExceptionIfIndexNotFound($objectOrArray, $path)
    {
        $this->propertyAccessor->setValue($objectOrArray, $path, 'Updated');

        $this->assertSame('Updated', $this->propertyAccessor->getValue($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     */
    public function testSetValueThrowsNoExceptionIfIndexNotFoundAndIndexExceptionsEnabled($objectOrArray, $path)
    {
        $this->propertyAccessor = new PropertyAccessor(false, true);
        $this->propertyAccessor->setValue($objectOrArray, $path, 'Updated');

        $this->assertSame('Updated', $this->propertyAccessor->getValue($objectOrArray, $path));
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException
     */
    public function testSetValueThrowsExceptionIfNotArrayAccess()
    {
        $this->propertyAccessor->setValue(new \stdClass(), '[index]', 'Updated');
    }

    public function testSetValueUpdatesMagicSet()
    {
        $author = new TestClassMagicGet('Bernhard');

        $this->propertyAccessor->setValue($author, 'magicProperty', 'Updated');

        $this->assertEquals('Updated', $author->__get('magicProperty'));
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
     */
    public function testSetValueThrowsExceptionIfThereAreMissingParameters()
    {
        $this->propertyAccessor->setValue(new TestClass('Bernhard'), 'publicAccessorWithMoreRequiredParameters', 'Updated');
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
     */
    public function testSetValueDoesNotUpdateMagicCallByDefault()
    {
        $author = new TestClassMagicCall('Bernhard');

        $this->propertyAccessor->setValue($author, 'magicCallProperty', 'Updated');
    }

    public function testSetValueUpdatesMagicCallIfEnabled()
    {
        $this->propertyAccessor = new PropertyAccessor(true);

        $author = new TestClassMagicCall('Bernhard');

        $this->propertyAccessor->setValue($author, 'magicCallProperty', 'Updated');

        $this->assertEquals('Updated', $author->__call('getMagicCallProperty', array()));
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
     */
    public function testSetValueThrowsExceptionIfNotObjectOrArray()
    {
        $value = 'baz';

        $this->propertyAccessor->setValue($value, 'foobar', 'bam');
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
     */
    public function testSetValueThrowsExceptionIfNull()
    {
        $value = null;

        $this->propertyAccessor->setValue($value, 'foobar', 'bam');
    }

    /**
     * @expectedException \Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException
     */
    public function testSetValueThrowsExceptionIfEmpty()
    {
        $value = '';

        $this->propertyAccessor->setValue($value, 'foobar', 'bam');
    }

    /**
     * @dataProvider getValidPropertyPaths
     */
    public function testIsReadable($objectOrArray, $path)
    {
        $this->assertTrue($this->propertyAccessor->isReadable($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingProperty
     */
    public function testIsReadableReturnsFalseIfPropertyNotFound($objectOrArray, $path)
    {
        $this->assertFalse($this->propertyAccessor->isReadable($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     */
    public function testIsReadableReturnsTrueIfIndexNotFound($objectOrArray, $path)
    {
        // Non-existing indices can be read. In this case, null is returned
        $this->assertTrue($this->propertyAccessor->isReadable($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     */
    public function testIsReadableReturnsFalseIfIndexNotFoundAndIndexExceptionsEnabled($objectOrArray, $path)
    {
        $this->propertyAccessor = new PropertyAccessor(false, true);

        // When exceptions are enabled, non-existing indices cannot be read
        $this->assertFalse($this->propertyAccessor->isReadable($objectOrArray, $path));
    }

    public function testIsReadableRecognizesMagicGet()
    {
        $this->assertTrue($this->propertyAccessor->isReadable(new TestClassMagicGet('Bernhard'), 'magicProperty'));
    }

    public function testIsReadableDoesNotRecognizeMagicCallByDefault()
    {
        $this->assertFalse($this->propertyAccessor->isReadable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
    }

    public function testIsReadableRecognizesMagicCallIfEnabled()
    {
        $this->propertyAccessor = new PropertyAccessor(true);

        $this->assertTrue($this->propertyAccessor->isReadable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
    }

    public function testIsReadableThrowsExceptionIfNotObjectOrArray()
    {
        $this->assertFalse($this->propertyAccessor->isReadable('baz', 'foobar'));
    }

    public function testIsReadableThrowsExceptionIfNull()
    {
        $this->assertFalse($this->propertyAccessor->isReadable(null, 'foobar'));
    }

    public function testIsReadableThrowsExceptionIfEmpty()
    {
        $this->assertFalse($this->propertyAccessor->isReadable('', 'foobar'));
    }

    /**
     * @dataProvider getValidPropertyPaths
     */
    public function testIsWritable($objectOrArray, $path)
    {
        $this->assertTrue($this->propertyAccessor->isWritable($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingProperty
     */
    public function testIsWritableReturnsFalseIfPropertyNotFound($objectOrArray, $path)
    {
        $this->assertFalse($this->propertyAccessor->isWritable($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     */
    public function testIsWritableReturnsTrueIfIndexNotFound($objectOrArray, $path)
    {
        // Non-existing indices can be written. Arrays are created on-demand.
        $this->assertTrue($this->propertyAccessor->isWritable($objectOrArray, $path));
    }

    /**
     * @dataProvider getPathsWithMissingIndex
     */
    public function testIsWritableReturnsTrueIfIndexNotFoundAndIndexExceptionsEnabled($objectOrArray, $path)
    {
        $this->propertyAccessor = new PropertyAccessor(false, true);

        // Non-existing indices can be written even if exceptions are enabled
        $this->assertTrue($this->propertyAccessor->isWritable($objectOrArray, $path));
    }

    public function testIsWritableRecognizesMagicSet()
    {
        $this->assertTrue($this->propertyAccessor->isWritable(new TestClassMagicGet('Bernhard'), 'magicProperty'));
    }

    public function testIsWritableDoesNotRecognizeMagicCallByDefault()
    {
        $this->assertFalse($this->propertyAccessor->isWritable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
    }

    public function testIsWritableRecognizesMagicCallIfEnabled()
    {
        $this->propertyAccessor = new PropertyAccessor(true);

        $this->assertTrue($this->propertyAccessor->isWritable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
    }

    public function testNotObjectOrArrayIsNotWritable()
    {
        $this->assertFalse($this->propertyAccessor->isWritable('baz', 'foobar'));
    }

    public function testNullIsNotWritable()
    {
        $this->assertFalse($this->propertyAccessor->isWritable(null, 'foobar'));
    }

    public function testEmptyIsNotWritable()
    {
        $this->assertFalse($this->propertyAccessor->isWritable('', 'foobar'));
    }

    public function getValidPropertyPaths()
    {
        return array(
            array(array('Bernhard', 'Schussek'), '[0]', 'Bernhard'),
            array(array('Bernhard', 'Schussek'), '[1]', 'Schussek'),
            array(array('firstName' => 'Bernhard'), '[firstName]', 'Bernhard'),
            array(array('index' => array('firstName' => 'Bernhard')), '[index][firstName]', 'Bernhard'),
            array((object) array('firstName' => 'Bernhard'), 'firstName', 'Bernhard'),
            array((object) array('property' => array('firstName' => 'Bernhard')), 'property[firstName]', 'Bernhard'),
            array(array('index' => (object) array('firstName' => 'Bernhard')), '[index].firstName', 'Bernhard'),
            array((object) array('property' => (object) array('firstName' => 'Bernhard')), 'property.firstName', 'Bernhard'),

            // Accessor methods
            array(new TestClass('Bernhard'), 'publicProperty', 'Bernhard'),
            array(new TestClass('Bernhard'), 'publicAccessor', 'Bernhard'),
            array(new TestClass('Bernhard'), 'publicAccessorWithDefaultValue', 'Bernhard'),
            array(new TestClass('Bernhard'), 'publicAccessorWithRequiredAndDefaultValue', 'Bernhard'),
            array(new TestClass('Bernhard'), 'publicIsAccessor', 'Bernhard'),
            array(new TestClass('Bernhard'), 'publicHasAccessor', 'Bernhard'),
            array(new TestClass('Bernhard'), 'publicGetSetter', 'Bernhard'),

            // Methods are camelized
            array(new TestClass('Bernhard'), 'public_accessor', 'Bernhard'),
            array(new TestClass('Bernhard'), '_public_accessor', 'Bernhard'),

            // Missing indices
            array(array('index' => array()), '[index][firstName]', null),
            array(array('root' => array('index' => array())), '[root][index][firstName]', null),

            // Special chars
            array(array('%!@$§.' => 'Bernhard'), '[%!@$§.]', 'Bernhard'),
            array(array('index' => array('%!@$§.' => 'Bernhard')), '[index][%!@$§.]', 'Bernhard'),
            array((object) array('%!@$§' => 'Bernhard'), '%!@$§', 'Bernhard'),
            array((object) array('property' => (object) array('%!@$§' => 'Bernhard')), 'property.%!@$§', 'Bernhard'),
        );
    }

    public function testTicket5755()
    {
        $object = new Ticket5775Object();

        $this->propertyAccessor->setValue($object, 'property', 'foobar');

        $this->assertEquals('foobar', $object->getProperty());
    }
}


text:
<?php

namespace ApplicationTest\Model;

use Application\Controller\Api\ItemController;
use Application\Controller\Api\ItemParentController;
use Application\Model\Twins;
use Application\Test\AbstractHttpControllerTestCase;
use ApplicationTest\Data;
use Exception;
use Laminas\Http\Header\Location;
use Laminas\Http\Request;
use Laminas\Http\Response;

use function array_replace;
use function count;
use function explode;

class TwinsTest extends AbstractHttpControllerTestCase
{
    protected string $applicationConfigPath = __DIR__ . '/../../../../config/application.config.php';

    /**
     * @throws Exception
     */
    private function createItem(array $params): int
    {
        $this->reset();

        /** @var Request $request */
        $request = $this->getRequest();
        $request->getHeaders()->addHeader(Data::getAdminAuthHeader(
            $this->getApplicationServiceLocator()->get('Config')['keycloak']
        ));
        $this->dispatch('https://www.autowp.ru/api/item', Request::METHOD_POST, $params);

        $this->assertResponseStatusCode(201);
        $this->assertModuleName('application');
        $this->assertControllerName(ItemController::class);
        $this->assertMatchedRouteName('api/item/post');
        $this->assertActionName('post');

        /** @var Response $response */
        $response = $this->getResponse();
        /** @var Location $location */
        $location = $response->getHeaders()->get('Location');
        $uri      = $location->uri();
        $parts    = explode('/', $uri->getPath());
        return (int) $parts[count($parts) - 1];
    }

    /**
     * @throws Exception
     */
    private function addItemParent(int $itemId, int $parentId, array $params = []): void
    {
        $this->reset();

        /** @var Request $request */
        $request = $this->getRequest();
        $request->getHeaders()->addHeader(Data::getAdminAuthHeader(
            $this->getApplicationServiceLocator()->get('Config')['keycloak']
        ));
        $this->dispatch(
            'https://www.autowp.ru/api/item-parent',
            Request::METHOD_POST,
            array_replace([
                'item_id'   => $itemId,
                'parent_id' => $parentId,
            ], $params)
        );

        $this->assertResponseStatusCode(201);
        $this->assertModuleName('application');
        $this->assertControllerName(ItemParentController::class);
        $this->assertMatchedRouteName('api/item-parent/post');
        $this->assertActionName('post');
    }

    public function testGetCarsGroups(): void
    {
        $vehicle1Id = $this->createItem([
            'item_type_id' => 1,
            'name'         => 'First vehicle',
        ]);

        $vehicle2Id = $this->createItem([
            'item_type_id' => 1,
            'name'         => 'Second vehicle',
        ]);

        $groupId = $this->createItem([
            'item_type_id' => 4,
            'name'         => 'Twins group',
        ]);

        $this->addItemParent($vehicle1Id, $groupId);
        $this->addItemParent($vehicle2Id, $groupId);

        $serviceManager = $this->getApplicationServiceLocator();

        /** @var Twins $model */
        $model = $serviceManager->get(Twins::class);

        $groups = $model->getCarsGroups([$vehicle1Id, $vehicle2Id], 'en');

        $this->assertArrayHasKey($vehicle1Id, $groups);
        $this->assertArrayHasKey($vehicle2Id, $groups);

        $this->assertNotEmpty($groups[$vehicle1Id]);
        $this->assertNotEmpty($groups[$vehicle2Id]);
    }
}


text:
<?php

namespace Polylang_CLI\Traits;

if ( ! trait_exists( 'Polylang_CLI\Traits\Cpt' ) ) {

trait Cpt {

    private function manage( $action, $type, $data )
    {
        if ( empty( $data ) ) {
            $this->cli->error( 'Specify one or more post types and/or taxonomies you want to enable translation for.' );
        }

        $input = explode( ',', $data );

        # invoke Polylang settings module
        $this->options_cpt = $settings = new \PLL_Settings_CPT( $this->pll );

        # set current module
        $settings->module = 'cpt';

        # populate the $_POST array
        $_POST = array();

        # sanitize post types input
        $post_types = array_map( 'sanitize_key', explode( ',', $data ) );
        $post_types = array_combine( $post_types, array_fill( 1, count( $post_types ), 1 ) );
        $post_types = array_intersect_key( $post_types, $settings->post_types );
        $post_types = array_merge( array_combine( $settings->options['post_types'], array_fill( 1, count( $settings->options['post_types'] ), 1 ) ), $post_types );

        # sanitize taxonomies input
        $taxonomies = array_map( 'sanitize_title', explode( ',', $data ) );
        $taxonomies = array_combine( $taxonomies, array_fill( 1, count( $taxonomies ), 1 ) );
        $taxonomies = array_intersect_key( $taxonomies, $settings->taxonomies );
        $taxonomies = array_merge( array_combine( $settings->options['taxonomies'], array_fill( 1, count( $settings->options['taxonomies'] ), 1 ) ), $taxonomies );

        # disable post types or taxonomies
        if ( $action === 'disable' ) {
            foreach ( array( 'post_types', 'taxonomies' ) as $key ) {
                foreach ( $input as $i ) {
                    if ( isset( ${$key}[$i] ) ) {
                        unset( ${$key}[$i] );
                    }
                }
            }
        }

        $_POST = compact( 'post_types', 'taxonomies' );
        $_POST['action'] = 'pll_save_options';

        # make protected method accessible
        $update = new \ReflectionMethod( 'PLL_Settings_CPT', 'update' );
        $update->setAccessible( true );
        $options = $update->invoke( $settings, $_POST );

        # update Polylang settings
        $settings->options = array_merge( $settings->options, $options );

        # see below, @todo review
        # update_option( 'polylang', $settings->options );

        # set the options
        $this->pll->model->options = $settings->options;

        # update options, default category and nav menu locations
        $this->pll->model->update_default_lang( $this->api->default_language() );

        # refresh language cache in case home urls have been modified
        $settings->model->clean_languages_cache();

        # refresh rewrite rules in case rewrite,  hide_default, post types or taxonomies options have been modified
        # don't use flush_rewrite_rules as we don't have the right links model and permastruct
        delete_option( 'rewrite_rules' );

        $this->cli->success( sprintf( 'Polylang `%s` option updated', $type ) );

/*
        ob_start();

        if ( ! get_settings_errors() ) {
            # send update message
            add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
            settings_errors();
            $response = new \WP_Ajax_Response( array( 'what' => 'success', 'data' => ob_get_clean() ) );
        } else {
            # send error messages
            settings_errors();
            $response = new \WP_Ajax_Response( array( 'what' => 'error', 'data' => ob_get_clean() ) );
        }

        foreach ( $response->responses as $xml ) {
            $object = simplexml_load_string( $xml, null, LIBXML_NOCDATA );
            if ( property_exists( $object, 'success' ) ) {
                \WP_CLI::success( wp_strip_all_tags( $object->success->response_data ) );
            } elseif ( property_exists( $object, 'error' ) ) {
                \WP_CLI::error( wp_strip_all_tags( $object->error->response_data ) );
            } else {
                \WP_CLI::error( 'An unknown error occurred saving the settings.' );
            }
        }
*/

    }

}

}


text:
import Post from '../model/post';

export default {
    async find(ctx){
        let posts = await Post.find();

        return ctx.render('posts/index', { posts: posts });
    },

    async save(ctx){
        let post = await Post.create({ title: ctx.query.title, content: ctx.query.content });

        return ctx.body = post;
    },

    async findOne(ctx){
        let post = await Post.findOne({ title: ctx.params.title }).exec();

        console.info(post.createdAt);
        // post.createdAt = moment(post.createdAt).format('LLL');
        // console.info(moment(post.createdAt).format('LLL'));
        // console.info(moment(post.createdAt).format('LLL'));
        // console.info(moment("2010-10-20 4:30 +0000", "YYYY-MM-DD HH:mm Z"));
        // console.info(moment().get('year'));
        return ctx.render('posts/index', { post: post })
    }
};


text:
@echo off
rem Make sure we have a schema
echo Locating schema file...
if not exist %ROOT%RPS\REPLICATION.SCH goto no_schema
rem Test to see if the schema will load
echo Testing schema load...
dbs RPS:rpsutl -i %ROOT%RPS\REPLICATION.SCH -ia -ir -s -n %ROOT%RPS\rpsmain.new %ROOT%RPS\rpstext.new
if "%ERRORLEVEL%"=="1" goto parse_fail
if exist %ROOT%RPS\rpsmain.new del /q %ROOT%RPS\rpsmain.new
if exist %ROOT%RPS\rpsmain.ne1 del /q %ROOT%RPS\rpsmain.ne1
if exist %ROOT%RPS\rpstext.new del /q %ROOT%RPS\rpstext.new
if exist %ROOT%RPS\rpstext.ne1 del /q %ROOT%RPS\rpstext.ne1
echo Test OK
rem Load the schema
echo Performing schema load...
dbs RPS:rpsutl -i %ROOT%RPS\REPLICATION.SCH -ia -ir
if "%ERRORLEVEL%"=="1" goto load_fail
echo Schema loaded OK
goto done
:no_schema
echo *ERROR* Schema file not found!
goto done
:parse_fail
echo *ERROR* Schema parse failed - repository not changed
goto done
:load_fail
echo *ERROR* Schema load failed - repository not changed
:done


text:
package org.apache.ignite.internal.processors.cache.persistence.snapshot;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;

/**
 * Input parameters for checking snapshot partitions consistency task.
 */
public class SnapshotMetadataCollectorTaskArg extends VisorDataTransferObject {
    /** Serial version UID. */
    private static final long serialVersionUID = 0L;

    /** Snapshot name. */
    private String snpName;

    /** Snapshot directory path. */
    private String snpPath;

    /** Default constructor. */
    public SnapshotMetadataCollectorTaskArg() {
        // No-op.
    }

    /**
     * @param snpName Snapshot name.
     * @param snpPath Snapshot directory path.
     */
    public SnapshotMetadataCollectorTaskArg(String snpName, @Nullable String snpPath) {
        this.snpName = snpName;
        this.snpPath = snpPath;
    }

    /**
     * @return Snapshot name.
     */
    public String snapshotName() {
        return snpName;
    }

    /**
     * @return Snapshot directory path.
     */
    public String snapshotPath() {
        return snpPath;
    }

    /** {@inheritDoc} */
    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
        U.writeString(out, snpName);
        U.writeString(out, snpPath);
    }

    /** {@inheritDoc} */
    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
        snpName = U.readString(in);
        snpPath = U.readString(in);
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(SnapshotMetadataCollectorTaskArg.class, this);
    }
}


text:
package com.zeynalov.rw.core.dbl.model;

/**
 * User Genders
 *
 * @author vagif.zeynalov
 *
 */
public enum UserGender {
    UNKNOWN, FEMALE, MALE;
}


text:
title: "TOLOWER"
layout: function
desc: "Converts the string on top of the stack to lower case."
category: reference
---

Converts the string on top of the stack to lower case.

## Example ##

{% raw %}
<warp10-warpscript-widget backend="{{backend}}"  exec-endpoint="{{execEndpoint}}">'STOP SHOUTING' TOLOWER
</warp10-warpscript-widget>
{% endraw %}

## Unit Test ##

{% raw %}
<warp10-warpscript-widget backend="{{backend}}"  exec-endpoint="{{execEndpoint}}">'H4cKme' TOLOWER
'h4ckme' == ASSERT
</warp10-warpscript-widget>
{% endraw %}


text:
#     $ ruby -Ilib -Itest -rrubygems test/test_all.rb
#     $ ruby -Ilib -Itest -rrubygems test/channel_test.rb
Dir["#{File.dirname(__FILE__)}/**/*_test.rb"].each do |file|
  load(file)
end


text:
[![NPM version](https://badge.fury.io/js/eventuate-once.png)](http://badge.fury.io/js/eventuate-once)
[![Build Status](https://travis-ci.org/jasonpincin/eventuate-once.svg?branch=master)](https://travis-ci.org/jasonpincin/eventuate-once)
[![Coverage Status](https://coveralls.io/repos/jasonpincin/eventuate-once/badge.png?branch=master)](https://coveralls.io/r/jasonpincin/eventuate-once?branch=master)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/jp-project6.svg)](https://saucelabs.com/u/jp-project6)

Act once upon the next occurrence of an eventuate. Optionally act upon only the next matching occurrence.

## example

```javascript
var eventuate = require('eventuate'),
    once      = require('eventuate-once')

var request = eventuate()

// once cb
once(request, function (req) {
    console.log(req)
})
request.produce({ url: '/index.html' })

// once promise
once(request).then(console.log)
request.produce({ url: '/README.md' })

// will result in no actions because consumers are gone
// (use "requireConsumers" to make this an error condition)
request.produce({ url: '/LICENSE' })
```

## api

```javascript
var once = require('eventuate-once')
```

### once(eventuate [, cb])

Execute the optional `cb` (if provided) one time on the next data payload from the `eventuate`. This is like `eventuate(cb)` except that it only happens once. In addition, returns a `Promise` that resolves to the `eventuate` data payload.

### once.match(eventuate, filter [, cb])

Execute the optional `cb` (if provided) one time on the next data payload from the `eventuate`, for which a truthy value is returned from the `filter` function. In addition, returns a `Promise` that resolves to the matched `eventuate` data payload.

The `filter` argument should be a function with signature `function (data)`. It will be passed all events produced by the `eventuate`, and it should return a falsey value or truthy value. Upon returning a truthy value, no more events will be provided, and the callbacks/promise will be resolved.

## testing

`npm test [--dot | --spec] [--phantom] [--grep=pattern]`

Specifying `--dot` or `--spec` will change the output from the default TAP style.
Specifying `--phantom` will cause the tests to run in the headless phantom browser instead of node.
Specifying `--grep` will only run the test files that match the given pattern.

### browser test

`npm run browser-test`

This will run the tests in all browsers (specified in .zuul.yml). Be sure to [educate zuul](https://github.com/defunctzombie/zuul/wiki/cloud-testing#2-educate-zuul) first.

### coverage

`npm run coverage [--html]`

This will output a textual coverage report. Including `--html` will also open
an HTML coverage report in the default browser.


text:
package org.hibernate.validator.internal.engine.messageinterpolation.parser;

import javax.xml.bind.ValidationException;

/**
 * Exception thrown in case the message descriptor is invalid, for example unbalanced braces or escape characters
 *
 * @author Hardy Ferentschik
 */
public class MessageDescriptorFormatException extends ValidationException {
	public MessageDescriptorFormatException(String s) {
		super( s );
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>com.cmput301.cs.project.listeners</title>
<meta name="date" content="2015-04-07">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV PACKAGE

NEXT PACKAGE

FRAMES

NO FRAMES

All Classes

Package com.cmput301.cs.project.listeners

Custom listeners for android

See: Description

Interface Summary

Interface
Description

TagsChangedListener

Interface for listeners that TagsManager uses.

TagSelectorListener

Package com.cmput301.cs.project.listeners Description

Custom listeners for android

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV PACKAGE

NEXT PACKAGE

FRAMES

NO FRAMES

All Classes


text:
<?php

namespace MGDigital\BusQue\QueueResolver;

use MGDigital\BusQue\Exception\QueueResolverException;
use MGDigital\BusQue\QueueResolverInterface;

class QueueVoterResolver implements QueueResolverInterface
{

    /**
     * @var QueueVoterInterface[]
     */
    private $voters = [ ];

    public function __construct(array $voters)
    {
        array_walk($voters, function (QueueVoterInterface $voter) {
            $this->voters[ ] = $voter;
        });
    }

    public function resolveQueueName($command): string
    {
        $votes = $this->getVotes($command);
        if (!isset($votes[ 0 ])) {
            throw new QueueResolverException;
        }
        return $votes[ 0 ]->getQueueName();
    }

    /**
     * @param mixed $command
     * @return QueueVote[]
     */
    public function getVotes($command): array
    {
        $votes = [ ];
        foreach ($this->voters as $voter) {
            $vote = $voter->getVote($command);
            if ($vote instanceof QueueVote) {
                $votes[ ] = $vote;
            }
        }
        usort($votes, function (QueueVote $voteA, QueueVote $voteB) {
            return $voteB->getConfidence() <=> $voteA->getConfidence();
        });
        return $votes;
    }
}


text:
<?php

namespace ReceiptValidator\iTunes;

use ArrayAccess;
use Carbon\Carbon;
use ReceiptValidator\RunTimeException;

class PurchaseItem implements ArrayAccess
{
    /**
     * quantity.
     *
     * @var int
     */
    protected $quantity = 0;

    /**
     * product_id.
     *
     * @var string
     */
    protected $product_id;

    /**
     * web_order_line_item_id.
     *
     * @var string
     */
    protected $web_order_line_item_id;

    /**
     * transaction_id.
     *
     * @var string
     */
    protected $transaction_id;

    /**
     * original_transaction_id.
     *
     * @var string
     */
    protected $original_transaction_id;

    /**
     * purchase_date.
     *
     * @var Carbon
     */
    protected $purchase_date;

    /**
     * original_purchase_date.
     *
     * @var Carbon
     */
    protected $original_purchase_date;

    /**
     * expires_date.
     *
     * @var Carbon
     */
    protected $expires_date;

    /**
     * cancellation_date.
     *
     * @var Carbon|null
     */
    protected $cancellation_date;

    /**
     * For a subscription, whether or not it is in the free trial period.
     *
     * @var bool|null
     */
    protected $is_trial_period;

    /**
     * For an auto-renewable subscription, whether or not it is in the introductory price period.
     *
     * @var bool|null
     */
    protected $is_in_intro_offer_period;

    /**
     * When a subscriber redeems an offer, there is a promotional offer ID.
     *
     * @var string|null
     */
    protected $promotional_offer_id;

    /**
     * purchase item info.
     *
     * @var array|null
     */
    protected $raw_data;

    /**
     * PurchaseItem constructor.
     *
     * @param array|null $data
     *
     * @throws RunTimeException
     */
    public function __construct(?array $data = null)
    {
        $this->raw_data = $data;
        $this->parseData();
    }

    /**
     * Parse Data from JSON Response.
     *
     * @throws RunTimeException
     *
     * @return $this
     */
    public function parseData(): self
    {
        if (!is_array($this->raw_data)) {
            throw new RuntimeException('Response must be an array');
        }

        if (array_key_exists('quantity', $this->raw_data)) {
            $this->quantity = (int) $this->raw_data['quantity'];
        }

        if (array_key_exists('transaction_id', $this->raw_data)) {
            $this->transaction_id = $this->raw_data['transaction_id'];
        }

        if (array_key_exists('original_transaction_id', $this->raw_data)) {
            $this->original_transaction_id = $this->raw_data['original_transaction_id'];
        }

        if (array_key_exists('product_id', $this->raw_data)) {
            $this->product_id = $this->raw_data['product_id'];
        }

        if (array_key_exists('web_order_line_item_id', $this->raw_data)) {
            $this->web_order_line_item_id = $this->raw_data['web_order_line_item_id'];
        }

        if (array_key_exists('promotional_offer_id', $this->raw_data)) {
            $this->promotional_offer_id = $this->raw_data['promotional_offer_id'];
        }

        if (array_key_exists('is_trial_period', $this->raw_data)) {
            $this->is_trial_period = filter_var($this->raw_data['is_trial_period'], FILTER_VALIDATE_BOOLEAN);
        }

        if (array_key_exists('is_in_intro_offer_period', $this->raw_data)) {
            $this->is_in_intro_offer_period = filter_var(
                $this->raw_data['is_in_intro_offer_period'],
                FILTER_VALIDATE_BOOLEAN
            );
        }

        if (array_key_exists('purchase_date_ms', $this->raw_data)) {
            $this->purchase_date = Carbon::createFromTimestampUTC(
                (int) round($this->raw_data['purchase_date_ms'] / 1000)
            );
        }

        if (array_key_exists('original_purchase_date_ms', $this->raw_data)) {
            $this->original_purchase_date = Carbon::createFromTimestampUTC(
                (int) round($this->raw_data['original_purchase_date_ms'] / 1000)
            );
        }

        if (array_key_exists('expires_date_ms', $this->raw_data)) {
            $this->expires_date = Carbon::createFromTimestampUTC((int) round($this->raw_data['expires_date_ms'] / 1000));
        } elseif (array_key_exists('expires_date', $this->raw_data) && is_numeric($this->raw_data['expires_date'])) {
            $this->expires_date = Carbon::createFromTimestampUTC(
                (int) round((int) $this->raw_data['expires_date'] / 1000)
            );
        }

        if (array_key_exists('cancellation_date_ms', $this->raw_data)) {
            $this->cancellation_date = Carbon::createFromTimestampUTC(
                (int) round($this->raw_data['cancellation_date_ms'] / 1000)
            );
        }

        return $this;
    }

    /**
     * @return array|null
     */
    public function getRawResponse(): ?array
    {
        return $this->raw_data;
    }

    /**
     * @return int
     */
    public function getQuantity(): int
    {
        return $this->quantity;
    }

    /**
     * @return bool|null
     */
    public function isTrialPeriod(): ?bool
    {
        return $this->is_trial_period;
    }

    /**
     * @return bool|null
     */
    public function isInIntroOfferPeriod(): ?bool
    {
        return $this->is_in_intro_offer_period;
    }

    /**
     * @return string|null
     */
    public function getPromotionalOfferId(): ?string
    {
        return $this->promotional_offer_id;
    }

    /**
     * @return string
     */
    public function getProductId(): string
    {
        return $this->product_id;
    }

    /**
     * @return null|string
     */
    public function getWebOrderLineItemId(): ?string
    {
        return $this->web_order_line_item_id;
    }

    /**
     * @return string
     */
    public function getTransactionId(): string
    {
        return $this->transaction_id;
    }

    /**
     * @return string
     */
    public function getOriginalTransactionId(): string
    {
        return $this->original_transaction_id;
    }

    /**
     * @return Carbon|null
     */
    public function getPurchaseDate(): ?Carbon
    {
        return $this->purchase_date;
    }

    /**
     * @return Carbon|null
     */
    public function getOriginalPurchaseDate(): ?Carbon
    {
        return $this->original_purchase_date;
    }

    /**
     * @return Carbon|null
     */
    public function getExpiresDate(): ?Carbon
    {
        return $this->expires_date;
    }

    /**
     * @return Carbon|null
     */
    public function getCancellationDate(): ?Carbon
    {
        return $this->cancellation_date;
    }

    /**
     * Update a response key and reprocess object properties.
     *
     * @param $key
     * @param $value
     *
     * @throws RunTimeException
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($key, $value)
    {
        $this->raw_data[$key] = $value;
        $this->parseData();
    }

    /**
     * Get a response key.
     *
     * @param $key
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($key)
    {
        return $this->raw_data[$key];
    }

    /**
     * Unset a response key.
     *
     * @param $key
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($key)
    {
        unset($this->raw_data[$key]);
    }

    /**
     * Check if response key exists.
     *
     * @param $key
     *
     * @return bool
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($key)
    {
        return isset($this->raw_data[$key]);
    }
}


text:
<?php

namespace Rancherize\Blueprint\Infrastructure\Service\Maker\PhpFpm\Traits;

use Rancherize\Blueprint\Infrastructure\Service\Maker\PhpFpm\UploadFileLimit;

trait UploadFileLimitTrait {

	/**
	 * @var string
	 */
	private $uploadFileLimit = UploadFileLimit::DEFAULT_UPLOAD_FILE_LIMIT;

	/**
	 * @return $this
	 */
	public function setUploadFileLimit( $limit ) {
		$this->uploadFileLimit = $limit;
		return $this;
	}
}


text:
#include "Divide.h"
#include "System.h"
#include "DumpLogManager.h"

/** Divide **/

Divide::Divide(unsigned int rs, unsigned int rt, unsigned int rd)
    : RFormatInstruction(rs, rt, rd), _executionHiResult(0), _executionLoResult(0)
{
	GlobalDumpManagerAddLogClassName(Divide);
}

Divide::~Divide(void)
{

}

unsigned int Divide::Instruct(unsigned int rsData, unsigned int rtData)
{
	return 0;
}

void Divide::Execution(const Instruction* prev2stepInst, const Instruction* prev1stepInst)
{
	Forwarding(prev2stepInst, prev1stepInst, _rsData, _rs);
	Forwarding(prev2stepInst, prev1stepInst, _rtData, _rt);

	int rsData = _rsData;
	int rtData = _rtData;

	_executionLoResult = (rsData / rtData);
	_executionHiResult = (rsData % rtData);
	{
		char buff[256] = {0, };
		sprintf(buff, "ExecutionHiData = 0x%x / ExecutionLoData = 0x%x", _executionHiResult, _executionLoResult);
		GlobalDumpLogManager->AddLog(buff, true);
	}
}

void Divide::WriteBack()
{
	System* system = System::GetInstance();

	system->SetHiRegister( _executionHiResult );
	system->SetLoRegister( _executionLoResult );
	{
		char buff[256] = {0, };
		sprintf(buff, "Hi = 0x%x / Lo = 0x%x", _executionHiResult, _executionLoResult);
		GlobalDumpLogManager->AddLog(buff, true);
	}
}

/** Divide Unsigned **/

DivideUnsigned::DivideUnsigned(unsigned int rs, unsigned int rt, unsigned int rd)
    : RFormatInstruction(rs, rt, rd), _executionHiResult(0), _executionLoResult(0)
{
	GlobalDumpManagerAddLogClassName(DivideUnsigned);
}

DivideUnsigned::~DivideUnsigned(void)
{

}

unsigned int DivideUnsigned::Instruct(unsigned int rsData, unsigned int rtData)
{
    return 0;
}

void DivideUnsigned::Execution(const Instruction* prev2stepInst, const Instruction* prev1stepInst)
{
	Forwarding(prev2stepInst, prev1stepInst, _rsData, _rs);
	Forwarding(prev2stepInst, prev1stepInst, _rtData, _rt);

	_executionLoResult = (_rsData / _rtData);
	_executionHiResult = (_rsData % _rtData);
	{
		char buff[256] = {0, };
		sprintf(buff, "ExecutionHiData = 0x%x / ExecutionLoData = 0x%x", _executionHiResult, _executionLoResult);
		GlobalDumpLogManager->AddLog(buff, true);
	}
}

void DivideUnsigned::WriteBack()
{
	System* system = System::GetInstance();

	system->SetHiRegister( _executionHiResult );
	system->SetLoRegister( _executionLoResult );
	{
		char buff[256] = {0, };
		sprintf(buff, "Hi = 0x%x / Lo = 0x%x", _executionHiResult, _executionLoResult);
		GlobalDumpLogManager->AddLog(buff, true);
	}
}


text:
layout: index
title: Custom attributes
---

We'll now start creating things in the kitchen, where we'll look at some more of Quest's features.

Enter a description like "The kitchen is cold and the stench of the overflowing bin makes you feel somewhat faint." As an exercise, add a scenery object called "bin" and give it a sensible description.

We're now going to look at **attributes**. Every time we've edited any aspect of an object or room so far, we've actually been editing an attribute. The prefix, description, "take" behaviour and so on are all attributes of an object. Whenever something changes in ther game, it is a change in an objects attribute. When the TV is turned on or off, the "switchedon" attribute is changing. Even when the player moves, this is actually just changing an attribute of the player object called "parent".

In this example, we'll store the weights of various objects by creating a new "weight" attribute. Later we will create a "weigh" command which will tell us the weight of **any** object.

First, let us create a few objects we can weigh. Create three objects – flour, eggs and sugar. Make sure the object types are set correctly (either "inanimate object" or "inanimate object (plural)"). We'll use units of grams, so we'll say the flour has a weight of 500, the eggs have a weight of 250, and the sugar has a weight of 1000.

The Attributes Tab (Desktop Version Only)
------------------

If you are using the desktop version, you can click an object and select the Attributes tab - you'll see all the underlying data for the object. We can also use the Attributes tab to add our own custom data to any object.

So let's give the new objects weights. First we'll set the flour's "weight" attribute to 500. To do this, select the flour object and go to the Attributes tab. We'll look at "Inherited Types" later - for now, go to the Attributes table and click the Add button. Enter the name "weight". We want to to use whole numbers for weight values, so select "Integer" from the list and enter the value "500".

![](../images/Weightflour.png "Weightflour.png")

Alternatively...
-------------

The Web version currently has no attributes tab, so we will have to use an alternative approach. Go to the Script tab of the game object. The bit at the top is a script that will run when the game starts, so we can set attributes there (the disadvantage is that this will get pretty messy if you have dozens of objects with a few attributes each, but for a handful, it is okay).

Click "Add new script", and select "Set a objects attribute (named by an expression)" from the "Variables" category. In the first line, keep "Name", and in the other box, select the flour. For the next line, set the attribute name to "weight" (note that for once you need quotes here, but there are already provided). In the third line, for the value type "500".

![](../images/attributes_web.png "attributes_web.png")

Now follow the same process to set the weights of the eggs and the sugar.

Reading Attributes
------------------

You can read an attribute from any script command by using an **expression**. Expressions let you perform calculations, run functions, and read the values of variables and attributes. To read an attribute, you use this form:

     object.attribute

For example, to read the weight of the eggs, you would type:

     eggs.weight

Let's update the "look at" description of the eggs, as an example. Select the eggs object, and then under the "Setup" tab, change the "Look at" description to "Run script". Add the "print a message" command. Now, instead of printing a normal message (which would never change, and can't read attributes), we want to print the result of an expression. So, click the "message" drop-down and select "expression" instead.

![](../images/Printexpression.png "Printexpression.png")

Enter this expression exactly, including the quotation marks in the correct place:

     "A box of eggs, weighing " + eggs.weight + " grams."

This will insert the value of the "weight" attribute in our text.

Always make sure that your object and attribute names match the expression exactly - it is recommended that you always use lower-case object and attribute names, as these names are case-sensitive.

Launch the game and verify that the correct response is displayed – it should read "A box of eggs, weighing 250 grams."

Of course, we could have just manually entered this into the description of the eggs anyway – we didn't really need to use an attribute. The real power of this, though, is that you can easily change attributes while the game is running. We could change the "weight" attribute of the eggs for example, if the player used some of them to bake a cake (but, er, hopefully you'll have some slightly more exciting ideas for things that players can do in *your* game). After the attribute is updated, our "look" description would automatically reflect the current weight of the eggs.

[Next: Custom commands](custom_commands.html)


text:
A really stupid, lightweight `setImmediate` polyfill for browsers and node 0.8.
Supports the browser as well as node.

For a most robust polyfill,
you should probably use [setImmediate](https://github.com/YuzuJS/setImmediate).
For most cases,
the underlying "next tick" mechanism is irrelevant.

## Usage

```js
require('setimmediate.js');

setImmediate(function () {
  console.log('something');
});
```

Nothing is exported! A global `setImmediate` function is added!