text:
[![](https://img.shields.io/pypi/pyversions/supriya)]()
[![](https://img.shields.io/pypi/l/supriya)]()
[![](https://img.shields.io/github/workflow/status/josiah-wolf-oberholtzer/supriya/Testing/main)]()

[Supriya](https://github.com/josiah-wolf-oberholtzer/supriya) is a
[Python](https://www.python.org/) API for
[SuperCollider](http://supercollider.github.io/).

Supriya lets you:

- Boot and communicate with SuperCollider's ``scsynth`` synthesis engine:
  [servers](http://josiahwolfoberholtzer.com/supriya/api/supriya/realtime/servers.html)
  in
  [realtime](http://josiahwolfoberholtzer.com/supriya/api/supriya/realtime/index.html)

- Compile SuperCollider
  [SynthDefs](http://josiahwolfoberholtzer.com/supriya/api/supriya/synthdefs/index.html)
  natively in Python code

- Explore
  [nonrealtime](http://josiahwolfoberholtzer.com/supriya/api/supriya/nonrealtime/index.html)
  composition with object-oriented
  [sessions](http://josiahwolfoberholtzer.com/supriya/api/supriya/nonrealtime/index.html)

- Build time-agnostic
  [asyncio](https://docs.python.org/3/library/asyncio.html)-aware applications
  with
  [providers](http://josiahwolfoberholtzer.com/supriya/api/supriya/providers.html)

- Schedule
  [patterns](http://josiahwolfoberholtzer.com/supriya/api/supriya/patterns/index.html)
  and callbacks with tempo- and meter-aware
  [clocks](http://josiahwolfoberholtzer.com/supriya/api/supriya/clocks/index.html)

- Integrate with [IPython](http://ipython.org/),
  [Sphinx](https://www.sphinx-doc.org/en/master/) and
  [Graphviz](http://graphviz.org/)

## Installation

Get [SuperCollider]() from
[http://supercollider.github.io/](http://supercollider.github.io/).

Get Supriya from PyPI:

```bash
pip install supriya
```

... or from source:

```bash
git clone https://github.com/josiah-wolf-oberholtzer/supriya.git
cd supriya/
pip install -e .
```

## Example: Hello World!

Let's make some noise. One synthesis context, one synth, one parameter change.

```
>>> import supriya
```

### Realtime

Grab a reference to a realtime server and boot it:

```python
>>> server = supriya.Server().boot()
```

Add a synth, using the default `SynthDef`:

```python
>>> synth = server.add_synth()
```

Set the synth's frequency parameter like a dictionary:

```python
>>> synth["frequency"] = 123.45
```

Release the synth:

```python
>>> synth.release()
```

Quit the server:

```python
>>> server.quit()
```

### Non-realtime

Non-realtime work looks similar to realtime, with a couple key differences.

Create a `Session` instead of a `Server`:

```python
>>> session = supriya.Session()
```

Use `Session.at(...)` to select the desired point in time to make a mutation,
and add a synth using the default `SynthDef`, and an explicit duration for the
synth which the Session will use to terminate the synth automatically at the
appropriate timestep:

```python
>>> with session.at(0):
...     synth = session.add_synth(duration=2)
...
```

Select another point in time and modify the synth's frequency, just like in
realtime work:

```python
>>> with session.at(1):
...     synth["frequency"] = 123.45
...
```

Finally, render the session to disk:

```python
>>> session.render(duration=3)
(0, PosixPath('/Users/josiah/Library/Caches/supriya/session-981245bde945c7550fa5548c04fb47f7.aiff'))
```

## Example: Defining SynthDefs

Let's build a simple `SynthDef` for playing a sine tone with an ADSR envelope.

First, some imports:

```python
>>> from supriya.ugens import EnvGen, Out, SinOsc
>>> from supriya.synthdefs import Envelope, synthdef
```

We'll define a function and *decorate* it with the `synthdef` decorator:

```python
>>> @synthdef()
... def simple_sine(frequency=440, amplitude=0.1, gate=1):
...     sine = SinOsc.ar(frequency=frequency) * amplitude
...     envelope = EnvGen.kr(envelope=Envelope.adsr(), gate=gate, done_action=2)
...     Out.ar(bus=0, source=[sine * envelope] * 2)
...
```

This results *not* in a function definition, but in the creation of a `SynthDef` object:

```python
>>> simple_sine
<SynthDef: simple_sine>
```

... which we can print to dump out its structure:

```python
>>> print(simple_sine)
synthdef:
    name: simple_sine
    ugens:
    -   Control.kr: null
    -   SinOsc.ar:
            frequency: Control.kr[1:frequency]
            phase: 0.0
    -   BinaryOpUGen(MULTIPLICATION).ar/0:
            left: SinOsc.ar[0]
            right: Control.kr[0:amplitude]
    -   EnvGen.kr:
            gate: Control.kr[2:gate]
            level_scale: 1.0
            level_bias: 0.0
            time_scale: 1.0
            done_action: 2.0
            envelope[0]: 0.0
            envelope[1]: 3.0
            envelope[2]: 2.0
            envelope[3]: -99.0
            envelope[4]: 1.0
            envelope[5]: 0.01
            envelope[6]: 5.0
            envelope[7]: -4.0
            envelope[8]: 0.5
            envelope[9]: 0.3
            envelope[10]: 5.0
            envelope[11]: -4.0
            envelope[12]: 0.0
            envelope[13]: 1.0
            envelope[14]: 5.0
            envelope[15]: -4.0
    -   BinaryOpUGen(MULTIPLICATION).ar/1:
            left: BinaryOpUGen(MULTIPLICATION).ar/0[0]
            right: EnvGen.kr[0]
    -   Out.ar:
            bus: 0.0
            source[0]: BinaryOpUGen(MULTIPLICATION).ar/1[0]
            source[1]: BinaryOpUGen(MULTIPLICATION).ar/1[0]
```

Now let's boot the server:

```python
>>> server = supriya.Server().boot()
```

... add our `SynthDef` to it explicitly:

```python
>>> server.add_synthdef(simple_sine)
```

... make a synth using our new SynthDef:

```python
>>> synth = server.add_synth(simple_sine)
```

...release it:

```python
>>> synth.release()
```

...and quit:

```python
>>> server.quit()
```

## Example: SynthDef Builders

Let's build a simple `SynthDef` for playing an audio buffer as a one-shot, with
panning and speed controls.

This time we'll use Supriya's `SynthDefBuilder` context manager. It's more
verbose than decorating a function, but it also gives more flexibility. For
example, the context manager can be passed around from function to function to
add progressively more complexity. The `synthdef` decorator uses
`SynthDefBuilder` under the hood.

First, some imports, just to save horizontal space:

```python
>>> from supriya.ugens import Out, Pan2, PlayBuf
```

Second, define a builder with the control parameters we want for our
`SynthDef`:

```python
>>> builder = supriya.SynthDefBuilder(
...     amplitude=1, buffer_id=0, out=0, panning=0.0, rate=1.0
... )
```

Third, use the builder as a context manager. Unit generators defined inside the
context will be added automatically to the builder:

```python
>>> with builder:
...     player = PlayBuf.ar(
...         buffer_id=builder["buffer_id"],
...         done_action=supriya.DoneAction.FREE_SYNTH,
...         rate=builder["rate"],
...     )
...     panner = Pan2.ar(
...         source=player,
...         position=builder["panning"],
...         level=builder["amplitude"],
...     )
...     _ = Out.ar(bus=builder["out"], source=panner)
...
```

Finally, build the `SynthDef`:

```python
>>> buffer_player = builder.build()
```

Let's print its structure. Note that Supriya has given the `SynthDef` a name
automatically by hashing its structure:

```python
>>> print(buffer_player)
synthdef:
    name: a056603c05d80c575333c2544abf0a05
    ugens:
    -   Control.kr: null
    -   PlayBuf.ar:
            buffer_id: Control.kr[1:buffer_id]
            done_action: 2.0
            loop: 0.0
            rate: Control.kr[4:rate]
            start_position: 0.0
            trigger: 1.0
    -   Pan2.ar:
            level: Control.kr[0:amplitude]
            position: Control.kr[3:panning]
            source: PlayBuf.ar[0]
    -   Out.ar:
            bus: Control.kr[2:out]
            source[0]: Pan2.ar[0]
            source[1]: Pan2.ar[1]
```

"Anonymous" `SynthDef`s are great! Supriya keeps track of what `SynthDef`s have
been allocated by name, so naming them after the hash of their structure
guarantees no accidental overwrites and no accidental re-allocations.

## Example: Playing Samples

Boot the server and allocate a sample:

```python
>>> server = supriya.Server().boot()
>>> buffer_ = server.add_buffer(file_path="supriya/assets/audio/birds/birds-01.wav")
```

Allocate a synth using the `SynthDef` we defined before:

```
>>> server.add_synth(synthdef=buffer_player, buffer_id=buffer_)
<+ Synth: 1000 a056603c05d80c575333c2544abf0a05>
```

The synth will play to completion and terminate itself.

## Example: Performing Patterns

Supriya implements a pattern library inspired by SuperCollider's, using nested
generators.

Let's import some pattern classes:

```python
>>> from supriya.patterns import EventPattern, ParallelPattern, SequencePattern
```

... then define a pattern comprised of two *event* patterns played in parallel:

```
>>> pattern = ParallelPattern([
...     EventPattern(
...         frequency=SequencePattern([440, 550]),
...     ),
...     EventPattern(
...         frequency=SequencePattern([1500, 1600, 1700]),
...         delta=0.75,
...     ),
... ])
```

Patterns can be manually iterated over:

```python
>>> for event in pattern:
...     event
...
CompositeEvent([
    NoteEvent(UUID('ec648473-4e7b-4a9a-9708-6893c054ac0b'), delta=0.0, frequency=440),
    NoteEvent(UUID('32b84a7d-ba7b-4508-81f3-b9f560bc34a7'), delta=0.0, frequency=1500),
], delta=0.75)
NoteEvent(UUID('412f3bf3-df75-4eb5-bc9d-3e074bfd2f46'), delta=0.25, frequency=1600)
NoteEvent(UUID('69a01ba8-4c00-4b55-905a-99f3933a6963'), delta=0.5, frequency=550)
NoteEvent(UUID('2c6a6d95-f418-4613-b213-811a442ea4c8'), delta=0.5, frequency=1700)
```

Patterns can be played (and stopped) in real-time contexts:

```python
>>> server = supriya.Server().boot()
>>> player = pattern.play(provider=server)
>>> player.stop()
```

... or in non-realtime contexts:

```python
>>> session = supriya.Session()
>>> _ = pattern.play(provider=session, at=0.5)
>>> print(session.to_strings(include_controls=True))
0.0:
    NODE TREE 0 group
0.5:
    NODE TREE 0 group
        1001 default
            amplitude: 0.1, frequency: 1500.0, gate: 1.0, out: 0.0, pan: 0.5
        1000 default
            amplitude: 0.1, frequency: 440.0, gate: 1.0, out: 0.0, pan: 0.5
2.0:
    NODE TREE 0 group
        1002 default
            amplitude: 0.1, frequency: 1600.0, gate: 1.0, out: 0.0, pan: 0.5
        1001 default
            amplitude: 0.1, frequency: 1500.0, gate: 1.0, out: 0.0, pan: 0.5
        1000 default
            amplitude: 0.1, frequency: 440.0, gate: 1.0, out: 0.0, pan: 0.5
2.5:
    NODE TREE 0 group
        1003 default
            amplitude: 0.1, frequency: 550.0, gate: 1.0, out: 0.0, pan: 0.5
        1002 default
            amplitude: 0.1, frequency: 1600.0, gate: 1.0, out: 0.0, pan: 0.5
3.5:
    NODE TREE 0 group
        1006 default
            amplitude: 0.1, frequency: 1700.0, gate: 1.0, out: 0.0, pan: 0.5
        1003 default
            amplitude: 0.1, frequency: 550.0, gate: 1.0, out: 0.0, pan: 0.5
        1002 default
            amplitude: 0.1, frequency: 1600.0, gate: 1.0, out: 0.0, pan: 0.5
4.0:
    NODE TREE 0 group
        1006 default
            amplitude: 0.1, frequency: 1700.0, gate: 1.0, out: 0.0, pan: 0.5
        1003 default
            amplitude: 0.1, frequency: 550.0, gate: 1.0, out: 0.0, pan: 0.5
4.5:
    NODE TREE 0 group
        1006 default
            amplitude: 0.1, frequency: 1700.0, gate: 1.0, out: 0.0, pan: 0.5
5.5:
    NODE TREE 0 group
```

## Example: Asyncio

Supriya also supports asyncio, with async servers, providers and clocks.

Async servers expose a minimal interface (effectively just `.boot()`, `.send()`
and `.quit()`), and don't support the rich stateful entities their non-async
siblings do (e.g. `Group`, `Synth`, `Bus`, `Buffer`). To split the difference,
we'll wrap the async server with a `Provider` that exposes an API of common
actions and returns lightweight stateless *proxies* we can use as references.
The proxies know their IDs and provide convenience functions, but otherwise
don't keep track of changes reported by the server.

Let's grab a couple imports:

```python
import asyncio, random
```

... and get a little silly.

First we'll define an async clock callback. It takes a `Provider` and a list of
buffer proxies created elsewhere by that provider, picks a random buffer and
uses the `buffer_player` `SynthDef` we defined earlier to play it (with a lot
of randomized parameters). Finally, it returns a random *delta* between 0 beats
and 2/4:

```python
async def callback(clock_context, provider, buffer_proxies):
    print("playing a bird...")
    buffer_proxy = random.choice(buffer_proxies)
    async with provider.at():
        provider.add_synth(
            synthdef=buffer_player,
            buffer_id=buffer_proxy,
            amplitude=random.random(),
            rate=random.random() * 2,
            panning=(random.random() * 2) - 1,
        )
    return random.random() * 0.5
```

Next we'll define our top-level async function. This one boots the server,
creates the `Provider` we'll use to interact with it, loads in all of Supriya's
built-in bird samples, schedules our clock callback with an async clock, waits
10 seconds and shuts down:

```python
async def serve():
    print("preparing the birds...")
    # Boot an async server
    server = await supriya.AsyncServer().boot(
        port=supriya.osc.utils.find_free_port(),
    )
    # Create a provider for higher-level interaction
    provider = supriya.Provider.from_context(server)
    # Use the provider as a context manager and load some buffers
    async with provider.at():
        buffer_proxies = [
            provider.add_buffer(file_path=bird_sample)
            for bird_sample in supriya.Assets["audio/birds/*"]
        ]
    # Create an async clock
    clock = supriya.AsyncClock()
    # Schedule our bird-playing clock callback to run immediately
    clock.schedule(callback, args=[provider, buffer_proxies])
    # Start the clock
    await clock.start()
    # Wait 10 seconds
    await asyncio.sleep(10)
    # Stop the clock
    await clock.stop()
    # And quit the server
    await server.quit()
    print("... done!")
```

Let's make some noise:

```python
>>> asyncio.run(serve())
preparing the birds...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
playing a bird...
... done!
```

Working async means we can hook into other interesting projects like
[python-prompt-toolkit](https://python-prompt-toolkit.readthedocs.io/),
[aiohttp](https://docs.aiohttp.org/) and
[pymonome](https://github.com/artfwo/pymonome).

## License

This library is made available under the terms of the MIT license.


text:
import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';

import { HeaderComponent } from './header/index';
import { NavbarComponent } from './navbar/index';
import { AuthenticationService } from './authentication/index';
import { AuthCheckerService } from './auth-checker/index';

/**
 * Do not specify providers for modules that might be imported by a lazy loaded module.
 */

@NgModule({
  imports: [CommonModule, RouterModule],
  declarations: [HeaderComponent, NavbarComponent],
  exports: [HeaderComponent, NavbarComponent,
    CommonModule, FormsModule, RouterModule]
})
export class SharedModule {
  static forRoot(): ModuleWithProviders {
    return {
      ngModule: SharedModule,
      providers: [AuthenticationService, AuthCheckerService]
    };
  }
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

var Analytics = require('@segment/analytics.js-core').constructor;
var integration = require('@segment/analytics.js-integration');
var sandbox = require('@segment/clear-env');
var tester = require('@segment/analytics.js-integration-tester');
var HitTail = require('../lib/');

describe('HitTail', function() {
  var analytics;
  var hitTail;
  var options = {
    siteId: 'x'
  };

  beforeEach(function() {
    analytics = new Analytics();
    hitTail = new HitTail(options);
    analytics.use(HitTail);
    analytics.use(tester);
    analytics.add(hitTail);
  });

  afterEach(function() {
    analytics.restore();
    analytics.reset();
    hitTail.reset();
    sandbox();
  });

  it('should have the right settings', function() {
    analytics.compare(HitTail, integration('HitTail')
      .assumesPageview()
      .global('htk')
      .option('siteId', ''));
  });

  describe('loading', function() {
    it('should load', function(done) {
      analytics.load(hitTail, done);
    });
  });
});


text:
package ui.main_panels;

/**
 * Created by aakintol on 29/06/16.
 */
public interface HostPanel {

    void updateInParent();

}


text:
import org.w3c.dom.Node;

import com.neulevel.biz.BizLock;
import com.neulevel.epp.core.EppAddress;
import com.neulevel.epp.core.EppAuthInfo;
import com.neulevel.epp.core.EppContact;
import com.neulevel.epp.core.EppContactData;
import com.neulevel.epp.core.EppContactType;
import com.neulevel.epp.core.EppDomain;
import com.neulevel.epp.core.EppHost;
import com.neulevel.epp.core.EppIpAddress;
import com.neulevel.epp.core.EppParser;
import com.neulevel.epp.core.EppPeriod;
import com.neulevel.epp.core.EppSvcsub;
import com.neulevel.epp.core.command.EppCommand;
import com.neulevel.epp.core.command.EppCommandCreate;
import com.neulevel.epp.ext.EppIDNData;

/**
 * The EppCreateTest class tests functions of
 * EppCommandCreate commands.
 *
 * @author Ning Zhang ning.zhang@neustar.com
 * @version $Revision: 1.3 $ $Date: 2013/06/14 16:40:26 $
 */
public class EppCreateTest
{
	public static void main( String argv[] )
	{
		testContact();
		testDomain();
		testHost();
		testSvcsub();
	}

	private static void testContact()
	{
		EppAddress addr = new EppAddress();
		addr.setStreet(0, "101 Park Street");
		addr.setStreet(1, "Suite 101");
		addr.setCity("Sterling");
		addr.setState("VA");
		addr.setPostalCode("20166");
		addr.setCountryCode("US");

		EppContactData ascii = new EppContactData("FooBar, Inc,", null, addr);
		EppContactData i15d  = new EppContactData("Foo Bar", "FooBar, Inc.", addr);

		EppContact contact = new EppContact("CONTACT-ID");
		contact.setContactDataAscii(ascii);
		contact.setContactDataI15d(i15d);
		contact.setVoice("+1.7035551234", "9999");
		contact.setEmail("mail@foobar.com");
		contact.setAuthInfo(new EppAuthInfo("pw", "NEULEVEL-123"));

		EppCommandCreate cmd = new EppCommandCreate(contact);
		cmd.setClientTransactionId("ABC-DEF-12345");

		System.out.println(cmd);

		EppParser parser = new EppParser(cmd.toString());
		if( parser.hasError() )
		{
			System.out.println(parser.getResult());
			System.exit(1);
		}

		Node epp = parser.getRootNode();
		EppCommand newcmd = (EppCommand) EppCommand.fromXML(epp);
		if( newcmd == null )
		{
			System.out.println("Error in fromXML");
			System.exit(1);
		}
		System.out.println(newcmd);
	}

	public static void testDomain()
	{
		EppDomain domain = new EppDomain("example.com");
		domain.setPeriod(new EppPeriod(2, 'y'));

		domain.addNameServer("ns1.example.com");
		domain.addNameServer("ns2.example.com");
		domain.setRegistrant("JD1234-EXAMPLE");
		domain.addContact(new EppContactType("JD1234-NEULEVEL", "admin"));
		domain.setAuthInfo(new EppAuthInfo("pw", "2fooBAR", "JD1234-EXAMPLE"));

		EppCommandCreate cmd = new EppCommandCreate(domain);
		cmd.setClientTransactionId("ABC-DEF-12345");
		EppIDNData idn = new EppIDNData();
		idn.table("es");
		idn.uname("español.example.com");
		cmd.addExtension(idn);
		System.out.println(cmd);

		EppParser parser = new EppParser(cmd.toString());
		if( parser.hasError() )
		{
			System.out.println(parser.getResult());
			System.exit(1);
		}

		Node epp = parser.getRootNode();
		if(null == epp){
			System.out.println("Error in parsing");
			System.exit(1);
		}
		EppCommand newcmd  = (EppCommand) EppCommand.fromXML(epp);

		System.out.println(newcmd);
	}

	public static void testHost()
	{
		EppHost host = new EppHost("example.com");
		host.addAddress(new EppIpAddress("192.168.1.1"));
		host.addAddress(new EppIpAddress("192.168.1.2", "v4"));
		host.addAddress(new EppIpAddress("::FFFF:192.168.1.3", "v6"));

		EppCommandCreate cmd = new EppCommandCreate(host);
		cmd.setClientTransactionId("ABC-DEF-12345");
		System.out.println(cmd);

		EppParser parser = new EppParser(cmd.toString());
		if( parser.hasError() )
		{
			System.out.println(parser.getResult());
			System.exit(1);
		}

		Node epp = parser.getRootNode();
		EppCommand newcmd = (EppCommand) EppCommand.fromXML(epp);
		if( newcmd == null )
		{
			System.out.println("Error in fromXML");
			System.exit(1);
		}
		System.out.println(newcmd);
	}

	public static void testSvcsub()
	{
		EppSvcsub svcsub = new EppSvcsub("BIZLOCK-123");
		svcsub.setService(BizLock.ID);
		svcsub.setPeriod(new EppPeriod(2, 'y'));

		svcsub.addParam(BizLock.PARAM_DOMAIN  , "example.biz");
		svcsub.addParam(BizLock.PARAM_DOMAIN_AUTHINFO, "2fooBAR");
		svcsub.addParam(BizLock.PARAM_BIZACCOUNT , "myBizAccount");
		svcsub.addParam(BizLock.PARAM_USERID, "myUserID");
		svcsub.addParam(BizLock.PARAM_PASSWORD, "myPassword");
		svcsub.addParam(BizLock.PARAM_LOCKTYPE , "hardLock");
		svcsub.addParam(BizLock.PARAM_LOCKSTATE , "on");
		svcsub.setRegistrant("JD1234-EXAMPLE");
		svcsub.addContact(new EppContactType("JD1234-NEULEVEL",
				svcsub.CONTACT_TYPE_PRIMARY));
		svcsub.addContact(new EppContactType("JD1235-NEULEVEL",
				svcsub.CONTACT_TYPE_SECONDARY));
		svcsub.addContact(new EppContactType("JD1235-NEULEVEL",
				svcsub.CONTACT_TYPE_BILLING));
		svcsub.setAuthInfo(new EppAuthInfo("pw", "2fooBAR", "JD1234-EXAMPLE"));

		EppCommandCreate cmd = new EppCommandCreate(svcsub);
		cmd.setClientTransactionId("ABC-DEF-12345");
		System.out.println(cmd);

		EppParser parser = new EppParser(cmd.toString());
		if( parser.hasError() )
		{
			System.out.println(parser.getResult());
			System.exit(1);
		}

		Node epp = parser.getRootNode();
		EppCommand newcmd = (EppCommand) EppCommand.fromXML(epp);
		if( newcmd == null )
		{
			System.out.println("Error in fromXML");
			System.exit(1);
		}
		System.out.println(newcmd);
	}
}


text:
How to measure special KPIs
=========================

This cockpit plugin shows how you could count and evaluate special Key Performance Indicators from your processes.

The plugin relies on intermediate none events with a name started by 'KPI:'. The complete logic is in the [database query](src/main/resources/org/camunda/bpm/demo/cockpit/plugin/kpi/queries/kpi-queries.xml) and you can adjust it for your needs.

In this example, the query calculates the time elapsed between KPI-Events while the process instance is executed.

Then it builds a stage for each occurred combinations of KPI-Events and calculates average and maximum duration of all process instances in these stages.

Example Process Application
---------------------------

An example process application called ['cockpit-plugin-kpi-view-pa-sample'](../cockpit-plugin-kpi-view-pa-sample) is available in this repository.

Tested Environment
------------------

The plugin is tested on camunda BPM 7.3.0 with H2 database.

![Screenshot](screenshot.png)


text:
//  ray_tracer

#ifndef __ray_tracer__LightSource__
#define __ray_tracer__LightSource__

#include <stdio.h>
#include "vector3d.h"

// abstract Light Source
class LightSource{
public:
	virtual vector3d getRadianceAt ( vector3d x )=0;
	virtual vector3d getLightDirAt ( vector3d x )=0;
	virtual float getDistanceFrom( vector3d x )=0;
};

// directional light
class DirectionalLight : public LightSource{
public:
	vector3d direction, radiance;

	DirectionalLight(vector3d d, vector3d r){
		direction = d;
		radiance = r;
	}
	vector3d getRadianceAt(vector3d p){return radiance;}
	vector3d getLightDirAt(vector3d p){return direction;}
	float getDistanceFrom(vector3d p){return 10000000;}
};

// point light
class PointLight : public LightSource{
public:
	vector3d position, power;

	PointLight(vector3d pos, vector3d pow){
		position = pos;
		power = pow;
	}
	vector3d getRadianceAt(vector3d p){return power * (1 / (position-p).dot(position-p));}
	vector3d getLightDirAt(vector3d p){return (position-p).normalize();}
	float getDistanceFrom(vector3d p){return (position-p).norm();}
};

#endif /* defined(__ray_tracer__LightSource__) */


text:
namespace v8 {
namespace internal {
namespace compiler {

class Verifier {
 public:
  static void Run(Graph* graph);

 private:
  class Visitor;
  DISALLOW_COPY_AND_ASSIGN(Verifier);
};
}
}
}  // namespace v8::internal::compiler

#endif  // V8_COMPILER_VERIFIER_H_


text:
class FulltextRowsGenerator < Rails::Generator::Base
  attr_accessor :models
  def initialize(*runtime_args)
    super(*runtime_args)
    @models = args.map {|m| Object.const_get(m.camelize) rescue nil}.compact.uniq
  end

  def manifest
    record do |m|
      m.migration_template("migration.rb", 'db/migrate',
                           :assigns => { :models => @models },
                           :migration_file_name => "create_fulltext_rows")
    end
  end

protected
  def banner
    "Usage: #{$0} #{spec.name} [model1 model2 model3 ...]"
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

   <TITLE>EXPORT_SPEC IXML_Document* ixmlNode_getOwnerDocument</TITLE>
   <META NAME="GENERATOR" CONTENT="DOC++ 3.4.10">

EXPORT_SPEC IXML_Document* ixmlNode_getOwnerDocument

(IXML_Node* nodeptr )

Retrieves the document object associated with this Node.

Documentation

Retrieves the document object associated with this Node.  This
owner document Node allows other Nodes to be created in the
context of this document.  Note that Document nodes do not have
an owner document.

Parameters:
nodeptr -   The Node from which to retrieve the
owner document.

Returns:
  [Document*] A pointer to the owning Document or
<TT>NULL</TT>, if the Node does not have an owner.

Alphabetic index

This page was generated with the help of DOC++.


text:
% #######################################################################
%   Robust Control Design for Active Flutter Suppression
% #######################################################################
%   Julian Theis, Peter Seiler
% ########################################################################
%
% ### ANALYSIS PART ###
% last modified 20/07/2018 Julian Theis
%
% RUN PART1_DESIGN_ROBUSTFLUTTERSUPPRESSION FIRST
% uses variables in workspace, requires
% GeriFDsysPID2_IO : model with physical inputs/outputs
% Kphys : controller with physical inputs/outputs
% VV : vector of airspeed

%% Define System / Controller

%P = GeriFDsysPID2_IO(Kphys.InputName,Kphys.OutputName);
% XXX remove low frequency dynamics. Otherwise stability check fails due to
% open integrators ... this needs some discussion in the group!
RemoveStates = getStatesIndex(GeriFDsysPID2_IO.StateName,{'h','u','theta','phi'});
P = ss([]);
for ii = 1:size(GeriFDsysPID2_IO,3)
P(:,:,ii) = modred(GeriFDsysPID2_IO(Kphys.InputName,Kphys.OutputName,ii),RemoveStates,'truncate');
end

C = Kphys;   % renaming so that following could remains the same
Vinf = VV;

w = {0.01, 1000}; %relevant frequency range for plotting

%% Robustness Margins
% Robustness margins are calculated using the LOOPMARGIN command (called
% inside the function DisplayLoopmargin which also prints the data to the workspace)
%
% The considered metrics here are
% - the classical single loop margins at both input and output
% - the multi loop input disk margin
%   (simultaneous gain and phase perturbation in all inputs)
% - the multi loop output disk margin
%   (simultaneous gain and phase perturbation in all outputs)
% - the multi loop output disk margin
%   (simultaneous gain and phase perturbation in all outputs)
% - the multi loop IO disk margin
%   (simultaneous gain and phase perturbation in all inputs AND outputs)
%
% Covers the following points from our discussion:
%  * single loop margins for all individual feedback loops that are closed by the respective controllers
%  ** classical gain and phase margins
%  ** (symmetric) disk margins
%  ** delay margins
%  * multi loop margins for all simultaneously closed feedback loops by the respective controller
%  ** (symmetric) disk margins

for ii=1:numel(Vinf)
    fprintf('\nModel at airspeed %2.0f m/s:\n', Vinf(ii))
[ICM_G(:,ii), ICM_P(:,ii), ICM_D(:,ii), IDM_G(:,ii), IDM_P(:,ii), ...
 OCM_G(:,ii), OCM_P(:,ii), OCM_D(:,ii), ODM_G(:,ii), ODM_P(:,ii), ...
 MMI_G(:,ii), MMI_P(:,ii), MMO_G(:,ii), MMO_P(:,ii), MMIO_G(:,ii), MMIO_P(:,ii)] = ...
 DisplayLoopmargin(P(:,:,ii),C);
end

%calculate Robust and Absolute Flutter Speed

[RFS, AFS, vis] = CalculateRobustFlutterSpeed(ICM_P,OCM_P,ICM_G,OCM_G,Vinf);
fprintf('Robust Flutter Speed: %d \nAbsolute Flutter Speed: %d \n',RFS,AFS)

% plot of minimum classical phase margin at input over airspeed
InputPhase = ICM_P; InputPhase(InputPhase>=90)=90; InputPhase(InputPhase==0)=-Inf;
figure; plot(Vinf,InputPhase,'LineWidth',3); title('Minimum Input Phase Margin'); xlabel('airspeed'); ylabel('degrees');legend(P.InputName(:),'Location','southwest')
xlim([Vinf(1) Vinf(end)]); ylim([0 90]);
hold on; plot([AFS AFS],[0 90],'k--','LineWidth',3);
area(vis.RFS_P_x, vis.RFS_P_y); hold off;

% plot of minimum classical gain margin at input over airspeed
InputGain = abs(db(ICM_G));
figure; semilogy(Vinf,InputGain,'LineWidth',3); title('Minimum Input Gain Margin'); xlabel('airspeed'); ylabel('dB');legend(P.InputName(:),'Location','southwest')
xlim([Vinf(1) Vinf(end)]); ylim([0 40]);
hold on; plot([AFS AFS],[1 100],'k--','LineWidth',3);
area(vis.RFS_G_x, vis.RFS_G_y); hold off;

% plot of minimum classical phase margin at output over airspeed
OutputPhase = OCM_P; OutputPhase(OutputPhase>=90)=90; OutputPhase(OutputPhase==0)=-Inf;
figure; plot(Vinf,OutputPhase,'LineWidth',3); title('Minimum Output Phase Margin'); xlabel('airspeed'); ylabel('degrees');legend(P.OutputName(:),'Location','southwest')
xlim([Vinf(1) Vinf(end)]); ylim([0 90]);
hold on; plot([AFS AFS],[0 90],'k--','LineWidth',3);
area(vis.RFS_P_x, vis.RFS_P_y); hold off;

% plot of minimum classical gain margin at output over airspeed
OutputGain = abs(db(OCM_G));
figure; semilogy(Vinf,OutputGain,'LineWidth',3); title('Minimum Output Gain Margin'); xlabel('airspeed'); ylabel('dB');legend(P.OutputName(:),'Location','southwest')
xlim([Vinf(1) Vinf(end)]);
hold on; plot([AFS AFS],[0 90],'k--','LineWidth',3);
area(vis.RFS_G_x, vis.RFS_G_y); hold off;

%%

%% Closed-Loop Transfer Function Analysis
% All relevant closed-loop (or broken loop) transfer functions are
% calculated by LOOPSENS:
% So  : output sensitivity (I+P*C)^-1     with plant P and compensator C
% Si  : input sensitivity (I+C*P)^-1
% To  : complementary output sensitivity P*C(I+P*C)^-1
% Ti  : complementary input sensitivity C*P(I+C*P)^-1
% CSo : controller sensitivity
% PSi : sensitivity to input disturbances

% Covers the following points from our discussion:
% * multi loop margins for all simultaneously closed feedback loops by the respective controller
%   ** (non-symmetric) disk margins, i.e. peaks of S and T
% * structured uncertainty descriptions
% ** combinations of dynamic actuator, plant, and sensor uncertainty

% check at robust flutter speed
DisplayLoopsens(P(:,:,Vinf==RFS),C,w,'g'); %plot gang of six Singular Values

DisplayLoopsens(P(:,:,Vinf==RFS),C,w,'ui'); %plot allowable dynamic multiplicative uncertainty in each input
DisplayLoopsens(P(:,:,Vinf==RFS),C,w,'uo'); %plot allowable dynamic multiplicative uncertainty in each output
DisplayLoopsens(P(:,:,Vinf==RFS),C,w,'ua'); %plot allowable dynamic additive uncertainty
DisplayLoopsens(P(:,:,Vinf==RFS),C,w,'si'); %plot allowable dynamic multiplicative uncertainty in each output
[~, Peaks] = DisplayLoopsens(P(:,:,Vinf==RFS),C,w,'so') %plot allowable dynamic multiplicative uncertainty in each input

%% QUALITATIVE (Root Loci)
% * root loci over airspeed and how they are affected by feedback
% * root loci over airspeed for samples of parametrically perturbed model (structural mode frequency/damping)
% * flutter speed predicted by root-loci (also under uncertainty)

varypzmap(P)
hold on; pzmap(P(:,:,VV==designspeed),'r'); hold off;
xlim([-60,10])
ylim([-5,60])
sgrid

varypzmap(feedback(P,C))
hold on; pzmap(feedback(P(:,:,VV==designspeed),C),'r'); hold off;
xlim([-60,10])
ylim([-5,60])
sgrid
%% FURTHER ANALYSIS
% Mu Analysis with real parameters (I can set up an uncertain model,
% but we should first agree on the parameters. Plus I think, I require some more time)
% * structured uncertainty descriptions
%   ** real parametric uncertainty in structural mode frequencies and damping ratios
%   ** real parametric uncertainty in air data, i.e. derivatives/coefficients

% TIME SIMULATION WITH RATE LIMITS AND SATURATION
% This is pretty easy to set up but we need to look at the avalaible
% inputs/outputs first.

% TIME SIMULATION (linear/quasi-linear) for multiple fixed airspeeds and/or time-varying airspeed
% This should also be pretty straight forward
% * step responses from elevator (control surfaces not in the loop)
% * step disturbance responses at control surfaces in the loop


text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCompaniesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('company', function(Blueprint $table)
		{
			$table->increments('id');
            $table->string('name');
            $table->string('address');
            $table->string('zipcode', 10);
            $table->string('city', 50);
            $table->string('registration', 50)->nullable();
            $table->string('tax', 50)->nullable();
            $table->integer('user_id', false, true)->length(10);
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('company');
	}

}


text:
require 'abstract_unit'

class RespondToController < ActionController::Base
  layout :set_layout

  def html_xml_or_rss
    respond_to do |type|
      type.html { render :text => "HTML"    }
      type.xml  { render :text => "XML"     }
      type.rss  { render :text => "RSS"     }
      type.all  { render :text => "Nothing" }
    end
  end

  def js_or_html
    respond_to do |type|
      type.html { render :text => "HTML"    }
      type.js   { render :text => "JS"      }
      type.all  { render :text => "Nothing" }
    end
  end

  def json_or_yaml
    respond_to do |type|
      type.json { render :text => "JSON" }
      type.yaml { render :text => "YAML" }
    end
  end

  def html_or_xml
    respond_to do |type|
      type.html { render :text => "HTML"    }
      type.xml  { render :text => "XML"     }
      type.all  { render :text => "Nothing" }
    end
  end

  def forced_xml
    request.format = :xml

    respond_to do |type|
      type.html { render :text => "HTML"    }
      type.xml  { render :text => "XML"     }
    end
  end

  def just_xml
    respond_to do |type|
      type.xml  { render :text => "XML" }
    end
  end

  def using_defaults
    respond_to do |type|
      type.html
      type.js
      type.xml
    end
  end

  def using_defaults_with_type_list
    respond_to(:html, :js, :xml)
  end

  def made_for_content_type
    respond_to do |type|
      type.rss  { render :text => "RSS"  }
      type.atom { render :text => "ATOM" }
      type.all  { render :text => "Nothing" }
    end
  end

  def custom_type_handling
    respond_to do |type|
      type.html { render :text => "HTML"    }
      type.custom("application/crazy-xml")  { render :text => "Crazy XML"  }
      type.all  { render :text => "Nothing" }
    end
  end

  def custom_constant_handling
    Mime::Type.register("text/x-mobile", :mobile)

    respond_to do |type|
      type.html   { render :text => "HTML"   }
      type.mobile { render :text => "Mobile" }
    end
  ensure
    Mime.module_eval { remove_const :MOBILE if const_defined?(:MOBILE) }
  end

  def custom_constant_handling_without_block
    Mime::Type.register("text/x-mobile", :mobile)

    respond_to do |type|
      type.html   { render :text => "HTML"   }
      type.mobile
    end

  ensure
    Mime.module_eval { remove_const :MOBILE if const_defined?(:MOBILE) }
  end

  def handle_any
    respond_to do |type|
      type.html { render :text => "HTML" }
      type.any(:js, :xml) { render :text => "Either JS or XML" }
    end
  end

  def handle_any_any
    respond_to do |type|
      type.html { render :text => 'HTML' }
      type.any { render :text => 'Whatever you ask for, I got it' }
    end
  end

  def all_types_with_layout
    respond_to do |type|
      type.html
      type.js
    end
  end

  def iphone_with_html_response_type
    Mime::Type.register_alias("text/html", :iphone)
    request.format = :iphone if request.env["HTTP_ACCEPT"] == "text/iphone"

    respond_to do |type|
      type.html   { @type = "Firefox" }
      type.iphone { @type = "iPhone"  }
    end

  ensure
    Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
  end

  def iphone_with_html_response_type_without_layout
    Mime::Type.register_alias("text/html", :iphone)
    request.format = "iphone" if request.env["HTTP_ACCEPT"] == "text/iphone"

    respond_to do |type|
      type.html   { @type = "Firefox"; render :action => "iphone_with_html_response_type" }
      type.iphone { @type = "iPhone" ; render :action => "iphone_with_html_response_type" }
    end

  ensure
    Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
  end

  def rescue_action(e)
    raise
  end

  protected
    def set_layout
      if ["all_types_with_layout", "iphone_with_html_response_type"].include?(action_name)
        "respond_to/layouts/standard"
      elsif action_name == "iphone_with_html_response_type_without_layout"
        "respond_to/layouts/missing"
      end
    end
end

class MimeControllerTest < ActionController::TestCase
  tests RespondToController

  def setup
    ActionController::Base.use_accept_header = true
    @request.host = "www.example.com"
  end

  def teardown
    ActionController::Base.use_accept_header = false
  end

  def test_html
    @request.accept = "text/html"
    get :js_or_html
    assert_equal 'HTML', @response.body

    get :html_or_xml
    assert_equal 'HTML', @response.body

    get :just_xml
    assert_response 406
  end

  def test_all
    @request.accept = "*/*"
    get :js_or_html
    assert_equal 'HTML', @response.body # js is not part of all

    get :html_or_xml
    assert_equal 'HTML', @response.body

    get :just_xml
    assert_equal 'XML', @response.body
  end

  def test_xml
    @request.accept = "application/xml"
    get :html_xml_or_rss
    assert_equal 'XML', @response.body
  end

  def test_js_or_html
    @request.accept = "text/javascript, text/html"
    get :js_or_html
    assert_equal 'JS', @response.body

    get :html_or_xml
    assert_equal 'HTML', @response.body

    get :just_xml
    assert_response 406
  end

  def test_json_or_yaml
    get :json_or_yaml
    assert_equal 'JSON', @response.body

    get :json_or_yaml, :format => 'json'
    assert_equal 'JSON', @response.body

    get :json_or_yaml, :format => 'yaml'
    assert_equal 'YAML', @response.body

    { 'YAML' => %w(text/yaml),
      'JSON' => %w(application/json text/x-json)
    }.each do |body, content_types|
      content_types.each do |content_type|
        @request.accept = content_type
        get :json_or_yaml
        assert_equal body, @response.body
      end
    end
  end

  def test_js_or_anything
    @request.accept = "text/javascript, */*"
    get :js_or_html
    assert_equal 'JS', @response.body

    get :html_or_xml
    assert_equal 'HTML', @response.body

    get :just_xml
    assert_equal 'XML', @response.body
  end

  def test_using_defaults
    @request.accept = "*/*"
    get :using_defaults
    assert_equal "text/html", @response.content_type
    assert_equal 'Hello world!', @response.body

    @request.accept = "text/javascript"
    get :using_defaults
    assert_equal "text/javascript", @response.content_type
    assert_equal '$("body").visualEffect("highlight");', @response.body

    @request.accept = "application/xml"
    get :using_defaults
    assert_equal "application/xml", @response.content_type
    assert_equal "
Hello world!
\n", @response.body
  end

  def test_using_defaults_with_type_list
    @request.accept = "*/*"
    get :using_defaults_with_type_list
    assert_equal "text/html", @response.content_type
    assert_equal 'Hello world!', @response.body

    @request.accept = "text/javascript"
    get :using_defaults_with_type_list
    assert_equal "text/javascript", @response.content_type
    assert_equal '$("body").visualEffect("highlight");', @response.body

    @request.accept = "application/xml"
    get :using_defaults_with_type_list
    assert_equal "application/xml", @response.content_type
    assert_equal "
Hello world!
\n", @response.body
  end

  def test_with_atom_content_type
    @request.env["CONTENT_TYPE"] = "application/atom+xml"
    get :made_for_content_type
    assert_equal "ATOM", @response.body
  end

  def test_with_rss_content_type
    @request.env["CONTENT_TYPE"] = "application/rss+xml"
    get :made_for_content_type
    assert_equal "RSS", @response.body
  end

  def test_synonyms
    @request.accept = "application/javascript"
    get :js_or_html
    assert_equal 'JS', @response.body

    @request.accept = "application/x-xml"
    get :html_xml_or_rss
    assert_equal "XML", @response.body
  end

  def test_custom_types
    @request.accept = "application/crazy-xml"
    get :custom_type_handling
    assert_equal "application/crazy-xml", @response.content_type
    assert_equal 'Crazy XML', @response.body

    @request.accept = "text/html"
    get :custom_type_handling
    assert_equal "text/html", @response.content_type
    assert_equal 'HTML', @response.body
  end

  def test_xhtml_alias
    @request.accept = "application/xhtml+xml,application/xml"
    get :html_or_xml
    assert_equal 'HTML', @response.body
  end

  def test_firefox_simulation
    @request.accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
    get :html_or_xml
    assert_equal 'HTML', @response.body
  end

  def test_handle_any
    @request.accept = "*/*"
    get :handle_any
    assert_equal 'HTML', @response.body

    @request.accept = "text/javascript"
    get :handle_any
    assert_equal 'Either JS or XML', @response.body

    @request.accept = "text/xml"
    get :handle_any
    assert_equal 'Either JS or XML', @response.body
  end

  def test_handle_any_any
    @request.accept = "*/*"
    get :handle_any_any
    assert_equal 'HTML', @response.body
  end

  def test_handle_any_any_parameter_format
    get :handle_any_any, {:format=>'html'}
    assert_equal 'HTML', @response.body
  end

  def test_handle_any_any_explicit_html
    @request.accept = "text/html"
    get :handle_any_any
    assert_equal 'HTML', @response.body
  end

  def test_handle_any_any_javascript
    @request.accept = "text/javascript"
    get :handle_any_any
    assert_equal 'Whatever you ask for, I got it', @response.body
  end

  def test_handle_any_any_xml
    @request.accept = "text/xml"
    get :handle_any_any
    assert_equal 'Whatever you ask for, I got it', @response.body
  end

  def test_rjs_type_skips_layout
    @request.accept = "text/javascript"
    get :all_types_with_layout
    assert_equal 'RJS for all_types_with_layout', @response.body
  end

  def test_html_type_with_layout
    @request.accept = "text/html"
    get :all_types_with_layout
    assert_equal '
HTML for all_types_with_layout
', @response.body
  end

  def test_xhr
    xhr :get, :js_or_html
    assert_equal 'JS', @response.body

    xhr :get, :using_defaults
    assert_equal '$("body").visualEffect("highlight");', @response.body
  end

  def test_custom_constant
    get :custom_constant_handling, :format => "mobile"
    assert_equal "text/x-mobile", @response.content_type
    assert_equal "Mobile", @response.body
  end

  def test_custom_constant_handling_without_block
    get :custom_constant_handling_without_block, :format => "mobile"
    assert_equal "text/x-mobile", @response.content_type
    assert_equal "Mobile", @response.body
  end

  def test_forced_format
    get :html_xml_or_rss
    assert_equal "HTML", @response.body

    get :html_xml_or_rss, :format => "html"
    assert_equal "HTML", @response.body

    get :html_xml_or_rss, :format => "xml"
    assert_equal "XML", @response.body

    get :html_xml_or_rss, :format => "rss"
    assert_equal "RSS", @response.body
  end

  def test_internally_forced_format
    get :forced_xml
    assert_equal "XML", @response.body

    get :forced_xml, :format => "html"
    assert_equal "XML", @response.body
  end

  def test_extension_synonyms
    get :html_xml_or_rss, :format => "xhtml"
    assert_equal "HTML", @response.body
  end

  def test_render_action_for_html
    @controller.instance_eval do
      def render(*args)
        unless args.empty?
          @action = args.first[:action]
        end
        response.body = "#{@action} - #{@template.template_format}"
      end
    end

    get :using_defaults
    assert_equal "using_defaults - html", @response.body

    get :using_defaults, :format => "xml"
    assert_equal "using_defaults - xml", @response.body
  end

  def test_format_with_custom_response_type
    get :iphone_with_html_response_type
    assert_equal '
Hello future from Firefox!
', @response.body

    get :iphone_with_html_response_type, :format => "iphone"
    assert_equal "text/html", @response.content_type
    assert_equal '
Hello iPhone future from iPhone!
', @response.body
  end

  def test_format_with_custom_response_type_and_request_headers
    @request.accept = "text/iphone"
    get :iphone_with_html_response_type
    assert_equal '
Hello iPhone future from iPhone!
', @response.body
    assert_equal "text/html", @response.content_type
  end

  def test_format_with_custom_response_type_and_request_headers_with_only_one_layout_present
    get :iphone_with_html_response_type_without_layout
    assert_equal '
Hello future from Firefox!
', @response.body

    @request.accept = "text/iphone"
    assert_raises(ActionView::MissingTemplate) { get :iphone_with_html_response_type_without_layout }
  end
end

class AbstractPostController < ActionController::Base
  self.view_paths = File.dirname(__FILE__) + "/../fixtures/post_test/"
end

# For testing layouts which are set automatically
class PostController < AbstractPostController
  around_filter :with_iphone

  def index
    respond_to do |type|
      type.html
      type.iphone
    end
  end

  protected
    def with_iphone
      Mime::Type.register_alias("text/html", :iphone)
      request.format = "iphone" if request.env["HTTP_ACCEPT"] == "text/iphone"
      yield
    ensure
      Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
    end
end

class SuperPostController < PostController
  def index
    respond_to do |type|
      type.html
      type.iphone
    end
  end
end

class MimeControllerLayoutsTest < ActionController::TestCase
  tests PostController

  def setup
    @request.host = "www.example.com"
  end

  def test_missing_layout_renders_properly
    get :index
    assert_equal '
Hello Firefox
', @response.body

    @request.accept = "text/iphone"
    get :index
    assert_equal 'Hello iPhone', @response.body
  end

  def test_format_with_inherited_layouts
    @controller = SuperPostController.new

    get :index
    assert_equal 'Super Firefox', @response.body

    @request.accept = "text/iphone"
    get :index
    assert_equal '
Super iPhone
', @response.body
  end
end


text:
<?php

namespace SmallUser\Controller;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;

class AuthFactory implements FactoryInterface
{
    /**
     * @param ContainerInterface $container
     * @param string $requestedName
     * @param array|null $options
     * @return AuthController
     */
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {/** @noinspection PhpParamsInspection */
        return new AuthController(
            $container->get('small_user_service')
        );
    }

}


text:
using System;
using Microsoft.Web.Administration;

namespace FluentInstallation.Web.Administration
{
    public interface IWebsiteConfigurer : IFluentSyntax
    {
        IWebsiteConfigurer WithId(int id);

        IWebsiteConfigurer Named(string name);

        IWebsiteConfigurer UseApplicationPool(string applicationPoolName);

        IWebsiteConfigurer OnPhysicalPath(string path);

        IWebsiteConfigurer UseWebProjectDirectoryAsPhysicalPath();

        IWebsiteConfigurer AddBinding(Action<IBindingConfigurer> action);

        IWebsiteConfigurer RemoveApplication(string alias);

        IWebsiteConfigurer RemoveVirtualDirectory(string alias);

        IWebsiteConfigurer AddApplication(Action<IApplicationConfigurer> application);

        IWebsiteConfigurer AddVirtualDirectory(Action<IVirtualDirectoryConfigurer> virtualDirectory);

        IWebsiteConfigurer AssertApplicationExists(string alias);

        IWebsiteConfigurer AssertVirtualDirectoryExists(string alias);

        IWebsiteConfigurer Configure(Action<Site> action);

    }
}


text:
from __future__ import division, print_function
'''
PySeries
========

Time series data mining and prediction in python. This module was created for
my PhD research in the need to implement multiple baseline methods for
popularity prediction.
'''
__version__ = '0.01-git'

from pyseries.data.base import TimeSeries
from pyseries.data.base import TimeSeriesDataset


text: Rails.application.config.session_store :cookie_store, key: '_daily-awesome_session'


text:
package org.elasticsearch.cluster.routing.allocation;

import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.routing.AllocationId;
import org.elasticsearch.cluster.routing.IndexRoutingTable;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.cluster.routing.TestShardRouting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.cluster.ESAllocationTestCase;

import java.util.Arrays;
import java.util.Collections;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;

public class StartedShardsRoutingTests extends ESAllocationTestCase {
    public void testStartedShardsMatching() {
        AllocationService allocation = createAllocationService();

        logger.info("--> building initial cluster state");
        AllocationId allocationId = AllocationId.newRelocation(AllocationId.newInitializing());
        final IndexMetaData indexMetaData = IndexMetaData.builder("test")
                .settings(settings(Version.CURRENT))
                .numberOfShards(2).numberOfReplicas(0)
                .putActiveAllocationIds(1, Collections.singleton(allocationId.getId()))
                .build();
        final Index index = indexMetaData.getIndex();
        ClusterState.Builder stateBuilder = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY))
                .nodes(DiscoveryNodes.builder().add(newNode("node1")).add(newNode("node2")))
                .metaData(MetaData.builder().put(indexMetaData, false));

        final ShardRouting initShard = TestShardRouting.newShardRouting(new ShardId(index, 0), "node1", true, ShardRoutingState.INITIALIZING);
        final ShardRouting relocatingShard = TestShardRouting.newShardRouting(new ShardId(index, 1), "node1", "node2", true, ShardRoutingState.RELOCATING, allocationId);
        stateBuilder.routingTable(RoutingTable.builder().add(IndexRoutingTable.builder(index)
                .addIndexShard(new IndexShardRoutingTable.Builder(initShard.shardId()).addShard(initShard).build())
                .addIndexShard(new IndexShardRoutingTable.Builder(relocatingShard.shardId()).addShard(relocatingShard).build())).build());

        ClusterState state = stateBuilder.build();

        logger.info("--> test starting of shard");

        RoutingAllocation.Result result = allocation.applyStartedShards(state, Arrays.asList(initShard), false);
        assertTrue("failed to start " + initShard + "\ncurrent routing table:" + result.routingTable().prettyPrint(), result.changed());
        assertTrue(initShard + "isn't started \ncurrent routing table:" + result.routingTable().prettyPrint(),
                result.routingTable().index("test").shard(initShard.id()).allShardsStarted());

        logger.info("--> testing starting of relocating shards");
        result = allocation.applyStartedShards(state, Arrays.asList(relocatingShard.getTargetRelocatingShard()), false);
        assertTrue("failed to start " + relocatingShard + "\ncurrent routing table:" + result.routingTable().prettyPrint(), result.changed());
        ShardRouting shardRouting = result.routingTable().index("test").shard(relocatingShard.id()).getShards().get(0);
        assertThat(shardRouting.state(), equalTo(ShardRoutingState.STARTED));
        assertThat(shardRouting.currentNodeId(), equalTo("node2"));
        assertThat(shardRouting.relocatingNodeId(), nullValue());
    }
}


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

    <title>nice-layout</title>
    <link href="stylesheets/form.css" media="all" rel="stylesheet" type="text/css"/><link href="stylesheets/global.css" media="all" rel="stylesheet" type="text/css"/><link href="stylesheets/header.css" media="all" rel="stylesheet" type="text/css"/><link href="stylesheets/table.css" media="all" rel="stylesheet" type="text/css"/><link href="stylesheets/wrapper.css" media="all" rel="stylesheet" type="text/css"/>

        link1
        |
        link2
        |
        link3

Nice Layout Staticmatic

            Form
            Simple
            Table
            tab 4
            tab 7
            tab 6
            tab 5

              Simple bloc with some paragraphs

                action

Informations

            <fieldset>

                  Title

                  <input id='title' name='title' type='text' />

ie: example of title

                  Description

                  <textarea id='description' name='description' rows='5'></textarea>

ie: example of description

                  Price ($)

                  <input id='price' name='price' type='text' />

ie: example of price

            </fieldset>

Nice form

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


text:
<?php
require_once APPPATH.'vendor/twilio/Twilio.php';

class Twilio {
    public static function send_download_link($to) {
        // Instantiate a new Twilio Rest Client
        $twilio = new Services_Twilio(Kohana::config("twilio.AccountSid"), Kohana::config("twilio.AuthToken"));

        $twilio->account->sms_messages->create(Kohana::config("twilio.number"), $to, Kohana::config("twilio.message"));
    }
}


text:
package org.apache.camel.component.jetty;

import java.io.InputStream;

import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;

public class MultiPartFormOkHttpTest extends BaseJettyTest {

    private Request createMultipartRequest() throws Exception {
        MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
        RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"test\"\r\n\r\nsome data here\r\n-----011000010111000001101001--");
        Request request = new Request.Builder()
            .url("http://localhost:" + getPort() + "/test")
            .post(body)
            .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
            .addHeader("cache-control", "no-cache")
            .addHeader("postman-token", "a9fd95b6-04b9-ea7a-687e-ff828ea00774")
            .build();
        return request;
    }

    @Test
    public void testSendMultiPartFormFromOkHttpClient() throws Exception {
        OkHttpClient client = new OkHttpClient();
        Request request = createMultipartRequest();
        Response response = client.newCall(request).execute();

        assertEquals(200, response.code());
        assertEquals("Thanks", response.body().string());
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("jetty://http://localhost:{{port}}/test").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        assertTrue("Should have attachment", exchange.getIn().hasAttachments());

                        InputStream is = exchange.getIn().getAttachment("test").getInputStream();
                        assertNotNull(is);
                        assertEquals("form-data; name=\"test\"", exchange.getIn().getAttachmentObject("test").getHeader("content-disposition"));
                        String data = exchange.getContext().getTypeConverter().convertTo(String.class, exchange, is);
                        assertNotNull("Should have data", data);
                        assertEquals("some data here", data);

                        exchange.getOut().setBody("Thanks");
                    }
                });
            }
        };
    }

}


text:
package top.cardone.configuration.dao.impl;

import top.cardone.data.jdbc.dao.impl.PageDaoImpl;

/**
 * 变量
 *
 * @author yao hai tao
 */
public class VariableDaoImpl extends PageDaoImpl implements top.cardone.configuration.dao.VariableDao {
}


text:
/// @author Владимир Керимов

#pragma once

#include <data/object>
#include <data/lazy>

namespace data
{
    class DOZEN_API hash : public object
    {
    public:
        hash();

        virtual ~hash() override;

        virtual std::unique_ptr<object> clone() const override;

    private:
        class impl;

        lazy<impl> m_impl;
    };
}


text:
using System.Security.Cryptography;
using System.Text;

namespace Coelacanth.Lib
{
    public class PasswordGenerator
    {
        #region private fields

        private readonly string availableCharacters;
        private readonly int passwordLength;

        #endregion

        private PasswordGenerator()
        {
        }

        internal PasswordGenerator(string availableCharacters, int passwordLength)
        {
            this.availableCharacters = availableCharacters;
            this.passwordLength = passwordLength;
        }

        #region Public Methods

        public string NewPassword()
        {
            var newPassword = new StringBuilder();

            if (availableCharacters.Length > 0)
            {
                using (var randomNumberGenerator = new RNGCryptoServiceProvider())
                {
                    var randomNumbers = new byte[passwordLength];
                    randomNumberGenerator.GetBytes(randomNumbers);

                    foreach (var randomNumber in randomNumbers)
                    {
                        newPassword.Append(availableCharacters[randomNumber % availableCharacters.Length]);
                    }
                }
            }

            return newPassword.ToString();
        }

        #endregion
    }
}


text:
    Global configuration menu ...

	<?php
	if( isset($_POST['change']) )
	{
	$fp=fopen("globals.php","w");

				$out=sprintf("<?php \r\n");
				fwrite($fp,$out,strlen($out));
                $out=sprintf("\$base_dir=\"%s\";\r\n",$_POST['nbase_dir']);
				fwrite($fp,$out,strlen($out));
                $out=sprintf("\$max_uploads=\"%s\";\r\n",$_POST['nmax_uploads']);
				fwrite($fp,$out,strlen($out));
                $out=sprintf("\$upload_size=\"%s\";\r\n",$_POST['nupload_size']);
				fwrite($fp,$out,strlen($out));
                $out=sprintf("\$user=\"%s\";\r\n",$_POST['nusername']);
				fwrite($fp,$out,strlen($out));
                $out=sprintf("\$pass=\"%s\";\r\n",$_POST['npassword']);
				fwrite($fp,$out,strlen($out));
                $out=sprintf("?>\r\n");
				fwrite($fp,$out,strlen($out));
				fclose($fp);
				require("globals.php");
	echo '

 The main configuration file was updated
';
	}
	?>

      <form name="form1" method="post" action="admin.php">
        <input name="action" type="hidden" id="action" value="main">
        <input name="change" type="hidden" id="change" value="true">

Admin settings

                  Usrname :

                    This usename is for the admin purposes .
                   <input name="nusername" type="text" class="arbo" id="nusername" value="<?php echo $user; ?>" size="40" maxlength="200">

                  Password :

                    This password is for the admin account .
                  <input name="npassword" type="text" class="arbo" id="npassword" value="<?php echo $pass; ?>" size="40" maxlength="200">

Script Settings

                  Base Directory :

                    From where the script will start looking
                   <input name="nbase_dir" type="text" class="arbo" id="nbase_dir" value="<?php echo $base_dir; ?>" size="40" maxlength="200">

                  Max Uploads :

                    The maximum files which can be uploaded at a time ..
                   <input name="nmax_uploads" type="text" class="arbo" id="nmax_uploads" value="<?php echo $max_uploads; ?>" size="40" maxlength="200">

                  Upload File size :

                    The maximum size of file which can be uploaded ( Size
                    in Bytes ) .
                  <input name="nupload_size" type="text" class="arbo" id="nupload_size" value="<?php echo $upload_size; ?>" size="40" maxlength="200">

          <input name="Submit" type="submit" class="arbo" value="Make Changes">

      </form>

All these configuration
        settings will be saved in globals.php


text:
window.addEventListener("load", function() {
  // Fall back to pngs when svg images are not supported
  if (document.getElementsByTagName && !document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1")) {
    var imgs = document.getElementsByTagName("img");
    for (var i = 0, svg; i < imgs.length; i++)
      if (svg = /^(.*?img\/)([^.]+)\.svg$/.exec(imgs[i].src))
        imgs[i].src = svg[1] + "generated/" + svg[2] + ".png";
  }

  // If there's no ecmascript 5 support, don't try to initialize
  if (!Object.create || !window.JSON) return;

  var sandboxHint = null;
  if (window.chapNum && window.chapNum < 20 && window.localStorage && !localStorage.getItem("usedSandbox")) {
    var pres = document.getElementsByTagName("pre");
    for (var i = 0; i < pres.length; i++) {
      var pre = pres[i];
      if (!/^(text\/)?(javascript|html)$/.test(pre.getAttribute("data-language")) ||
          chapNum == 1 && !/console\.log/.test(pre.textContent)) continue;
      sandboxHint = elt("div", {"class": "sandboxhint"},
                        "edit & run code by clicking it");
      pre.insertBefore(sandboxHint, pre.firstChild);
      break;
    }
  }

  document.body.addEventListener("click", function(e) {
    for (var n = e.target; n; n = n.parentNode) {
      if (n.className == "c_ident") return;
      var lang = n.nodeName == "PRE" && n.getAttribute("data-language");
      if (/^(text\/)?(javascript|html)$/.test(lang))
        return activateCode(n, e, lang);
      if (n.nodeName == "DIV" && n.className == "solution")
        n.className = "solution open";
    }
  });

  function elt(type, attrs) {
    var firstChild = 1;
    var node = document.createElement(type);
    if (attrs && typeof attrs == "object" && attrs.nodeType == null) {
      for (var attr in attrs) if (attrs.hasOwnProperty(attr)) {
        if (attr == "css") node.style.cssText = attrs[attr];
        else node.setAttribute(attr, attrs[attr]);
      }
      firstChild = 2;
    }
    for (var i = firstChild; i < arguments.length; ++i) {
      var child = arguments[i];
      if (typeof child == "string") child = document.createTextNode(child);
      node.appendChild(child);
    }
    return node;
  }

  CodeMirror.commands[CodeMirror.keyMap.default.Down = "lineDownEscape"] = function(cm) {
    var cur = cm.getCursor();
    if (cur.line == cm.lastLine()) {
      document.activeElement.blur();
      return CodeMirror.Pass;
    } else {
      cm.moveV(1, "line");
    }
  };
  CodeMirror.commands[CodeMirror.keyMap.default.Up = "lineUpEscape"] = function(cm) {
    var cur = cm.getCursor();
    if (cur.line == cm.firstLine()) {
      document.activeElement.blur();
      return CodeMirror.Pass;
    } else {
      cm.moveV(-1, "line");
    }
  };

  var keyMap = {
    Esc: function(cm) { cm.display.input.blur(); },
    "Ctrl-Enter": function(cm) { runCode(cm.state.context); },
    "Ctrl-,": function(cm) { closeCode(cm.state.context); },
    "Ctrl-Q": resetSandbox
  };

  var nextID = 0;
  var article = document.getElementsByTagName("article")[0];

  function activateCode(node, e, lang) {
    if (sandboxHint) {
      sandboxHint.parentNode.removeChild(sandboxHint);
      sandboxHint = null;
      localStorage.setItem("usedSandbox", "true");
    }

    var code = node.textContent;
    var wrap = node.parentNode.insertBefore(elt("div", {"class": "editor-wrap"}), node);
    var editor = CodeMirror(function(div) {wrap.insertBefore(div, wrap.firstChild)}, {
      value: code,
      mode: lang,
      extraKeys: keyMap,
      matchBrackets: true,
      lineNumbers: true
    });
    wrap.style.marginLeft = wrap.style.marginRight = -Math.min(article.offsetLeft, 100) + "px";
    setTimeout(function() { editor.refresh(); }, 600);
    if (e) {
      editor.setCursor(editor.coordsChar({left: e.clientX, top: e.clientY}, "client"));
      editor.focus();
    }
    var out = wrap.appendChild(elt("div", {"class": "sandbox-output"}));
    var menu = wrap.appendChild(elt("div", {"class": "sandbox-menu", title: "Sandbox menu..."}));
    var sandbox = node.getAttribute("data-sandbox");
    if (lang == "text/html" && !sandbox) {
      sandbox = "html" + nextID++;
      node.setAttribute("data-sandbox", sandbox);
      sandboxSnippets[sandbox] = node;
    }
    node.style.display = "none";

    var data = editor.state.context = {editor: editor,
                                       wrap: wrap,
                                       orig: node,
                                       isHTML: lang == "text/html",
                                       sandbox: sandbox};
    data.output = new SandBox.Output(out);
    menu.addEventListener("click", function() { openMenu(data, menu); });
  }

  function openMenu(data, node) {
    var menu = elt("div", {"class": "sandbox-open-menu"});
    var items = [["Run code (ctrl-enter)", function() { runCode(data); }],
                 ["Revert to original code", function() { revertCode(data); }],
                 ["Reset sandbox (ctrl-q)", function() { resetSandbox(data.sandbox); }]];
    if (!data.isHTML || !data.sandbox)
      items.push(["Deactivate editor (ctrl-,)", function() { closeCode(data); }]);
    items.forEach(function(choice) {
      menu.appendChild(elt("div", choice[0]));
    });
    function click(e) {
      var target = e.target;
      if (e.target.parentNode == menu) {
        for (var i = 0; i < menu.childNodes.length; ++i)
          if (target == menu.childNodes[i])
            items[i][1]();
      }
      menu.parentNode.removeChild(menu);
      window.removeEventListener("click", click);
    }
    setTimeout(function() {
      window.addEventListener("click", click);
    }, 20);
    node.offsetParent.appendChild(menu);
  }

  function runCode(data) {
    data.output.clear();
    var val = data.editor.getValue();
    var sb = data.sandbox;
    getSandbox(data.sandbox, data.isHTML, function(box) {
      if (data.isHTML)
        box.setHTML(val, data.output, function() {
          if (data.orig.getAttribute("data-focus"))
            box.win.focus();
        });
      else
        box.run(val, data.output);
    });
  }

  function closeCode(data) {
    if (data.isHTML && data.sandbox) return;
    data.wrap.parentNode.removeChild(data.wrap);
    data.orig.style.display = "";
  }

  function revertCode(data) {
    data.editor.setValue(data.orig.textContent);
  }

  var sandboxSnippets = function() {
    var result = {};
    var snippets = document.getElementsByClassName("snippet");
    for (var i = 0; i < snippets.length; i++) {
      var snippet = snippets[i];
      if (snippet.getAttribute("data-language") == "text/html" &&
          snippet.getAttribute("data-sandbox"))
        result[snippet.getAttribute("data-sandbox")] = snippet;
    }
    return result;
  }();

  var sandboxes = {};
  function getSandbox(name, forHTML, callback) {
    name = name || "null";
    if (sandboxes.hasOwnProperty(name)) return callback(sandboxes[name]);
    var options = {loadFiles: window.sandboxLoadFiles}, html;
    if (sandboxSnippets.hasOwnProperty(name)) {
      var snippet = sandboxSnippets[name];
      options.place = function(node) { placeFrame(node, snippet); };
      if (!forHTML) html = snippet.textContent;
    }
    new SandBox(options, function(box) {
      if (html != null)
        box.win.document.documentElement.innerHTML = html;
      sandboxes[name] = box;
      callback(box);
    });
  }

  function resetSandbox(name) {
    name = name || "null";
    if (!sandboxes.hasOwnProperty(name)) return;
    var frame = sandboxes[name].frame;
    frame.parentNode.removeChild(frame);
    delete sandboxes[name];
  }

  function placeFrame(frame, snippet) {
    var wrap = snippet.previousSibling;
    if (!wrap || wrap.className != "editor-wrap") {
      var bot = snippet.getBoundingClientRect().bottom;
      activateCode(snippet, null, "text/html");
      wrap = snippet.previousSibling;
    } else {
      bot = wrap.getBoundingClientRect().bottom;
    }
    wrap.insertBefore(frame, wrap.childNodes[1]);
    if (bot < 50) {
      var newBot = wrap.getBoundingClientRect().bottom;
      window.scrollBy(0, newBot - bot);
    }
  }
});


text:
/*
 * generated by Xtext 2.9.1
 */
package org.xtext.example.mydsl.scoping;

import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider;

public abstract class AbstractMyDslScopeProvider extends DelegatingScopeProvider {
}


text:
package com.xinyu.mwp.fragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.LinearLayout;

import com.xinyu.mwp.R;
import com.xinyu.mwp.fragment.base.BaseFragment;

import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

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

/**
 * Created by Benjamin on 17/1/10.
 */

public class ShareOrderFragment extends BaseFragment {

    @ViewInject(R.id.tabLayout)
    private LinearLayout tabLayout;
    @ViewInject(R.id.viewPager)
    private ViewPager viewPager;
    private List<Fragment> fragmentList = new ArrayList<>();

    @Override
    protected int getLayoutID() {
        return R.layout.fragment_shareorder;
    }

    @Override
    protected void initView() {
        super.initView();
        viewPager.setOffscreenPageLimit(tabLayout.getChildCount());
        fragmentList.add(new ShareOrderPageFragment());
        fragmentList.add(new ShareOrderPageFragment());
        fragmentList.add(new ShareOrderPageFragment());
        tabLayout.getChildAt(0).setSelected(true);
    }

    @Override
    protected void initListener() {
        super.initListener();
        viewPager.setAdapter(new FragmentPagerAdapter(getChildFragmentManager()) {

            @Override
            public int getCount() {
                return fragmentList != null ? fragmentList.size() : 0;
            }

            @Override
            public Fragment getItem(int i) {
                return fragmentList.get(i);
            }
        });
        viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                for (int i = 0; i < tabLayout.getChildCount(); i++){
                    tabLayout.getChildAt(i).setSelected(position == i);
                }
            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }

    @Event({R.id.itemLayout1, R.id.itemLayout2, R.id.itemLayout3})
    private void onClick(View view){
        viewPager.setCurrentItem(tabLayout.indexOfChild(view));
    }
}


text:
package com.adaptris.core.interceptor;

import com.adaptris.core.PoolingWorkflow;
import com.adaptris.core.http.jetty.JettyNoBacklogInterceptor;
import com.adaptris.core.runtime.ChildRuntimeInfoComponentMBean;

/**
 * Management bean interface for messages in flight.
 *
 */
public interface MessageInFlightMBean extends ChildRuntimeInfoComponentMBean {

  /**
   * Whether or not there are any messages in flight for the workflow.
   *
   * @return true if there are messages in flight
   */
  boolean messagesInFlight();

  /**
   * Return the count of messages that are currently in flight.
   *

   * Other than {@link PoolingWorkflow}, this will generally return 1 or 0. {@link PoolingWorkflow} will at most return
   * {@link PoolingWorkflow#getPoolSize()}. It is included for completeness.
   *

   *
   * @return the number of messages in flight.
   */
  int messagesInFlightCount();

  /**
   * Return the count of messages that are currently queued.
   *

   * This only makes sense for {@link PoolingWorkflow} as other workflows are single threaded; so will most likely return 0. In the
   * context of PoolingWorkflow, this is the number of messages that have been submitted to the workflow, but have not yet been
   * processed.
   *

   *
   * @see JettyNoBacklogInterceptor
   * @return the number of messages that have been submitted for processing, but have not entered the workflow proper.
   */
  int messagesPendingCount();

}


text:
"""
Takes an URL that works and an URL that doesn't work and finds out the difference.
The URLs must have the same host/path, only the queries can differ.
An URL is seen as working, if SEARCHSTR is contained in the response.
"""
URL_BAD = 'http://primo.ub.uni-due.de/primo_library/libweb/action/search.do?mode=Advanced&tab=localude&indx=1&dum=true&srt=rank&vid=UDE&frbg=&tb=t&title2=2&=Selected_Databases&=dummyLocations&=EXLSelectOption+EXLSearchInputScopesOptionSelected_Databases&=Ausgew%C3%A4hlte+Datenbanken&vl%28D2327293UI3%29=all_items&scp.scps=scope%3A%28UDEALEPH%29%2Cscope%3A%28UDESEMAPP%29%2Cscope%3A%28UDEDUEPUBLICO%29&vl%28100316065UI0%29=any&vl%28freeText0%29=harry+potter&vl%281UI0%29=contains&=AND&vl%282482768UI5%29=all_items&vl%282482478UI4%29=all_items'
URL_GOOD = 'http://primo.ub.uni-due.de/primo_library/libweb/action/search.do?dscnt=0&vl(1UI0)=contains&tab=localude&vl(1UI2)=contains&dstmp=1429601477151&srt=rank&mode=Advanced&indx=1&tb=t&vl(freeText0)=harry+potter&fn=search&vid=UDE&vl(2482481UI1)=title&vl(2482768UI5)=all_items&vl(freeText2)=&vl(2482478UI4)=all_items&title2=2&vl(1UI1)=contains&frbg=&vl(2482769UI2)=creator&ct=search&dum=true&vl(100316065UI0)=any&vl(D2327293UI3)=all_items&Submit=Suche&vl(freeText1)='
SEARCHSTR = 'auf den Spuren eines zauberhaften Bestsellers'

import requests
import sys
import re
import copy
from urllib.parse import urlparse, parse_qs

good_parsed = urlparse(URL_GOOD)
bad_parsed = urlparse(URL_BAD)
good_query = parse_qs(good_parsed.query)
bad_query = parse_qs(bad_parsed.query)

def test(qsd):
    r = requests.get('%s://%s%s' % (good_parsed.scheme, good_parsed.netloc, good_parsed.path),
                     params=qsd)
    if 'id="connect"' in r.text:
        pattern = re.compile("\"/goto/([^\"]+)\"")
        m = pattern.search(r.text)
        if m:
            r = requests.get(m.group(1))
    return (SEARCHSTR in r.text)

if not test(good_query):
    print("Good query is not good.")
    sys.exit(0)

if test(bad_query):
    print("Bad query is not bad.")
    sys.exit(0)

bad_query_clone = copy.copy(bad_query)
for k, v in bad_query.items():
    if k not in good_query:
        del bad_query_clone[k]
        print("Remote %s from bad query" % k)
        if test(bad_query_clone):
            print ("MATCH")
            sys.exit(0)

for k, v in good_query.items():
    if k not in bad_query:
        bad_query_clone[k] = v
        print("Add %s to bad query" % k)
        if test(bad_query_clone):
            print ("MATCH")
            sys.exit(0)


text:
package iso20022

// Identifies other amounts pertaining to the transaction.
type OtherAmounts28 struct {

	// Interest amount that has accrued in between coupon payment periods.
	AccruedInterestAmount *AmountAndDirection44 `xml:"AcrdIntrstAmt,omitempty"`

	// Amount of money paid for the provision of financial services that cannot be categorised by another qualifier.
	ChargesFees *AmountAndDirection44 `xml:"ChrgsFees,omitempty"`

	// Amount of country, national or federal tax charged by the jurisdiction in which the account servicer is located.
	CountryNationalFederalTax *AmountAndDirection44 `xml:"CtryNtlFdrlTax,omitempty"`

	// Principal amount of a trade (price multiplied by quantity).
	TradeAmount *AmountAndDirection44 `xml:"TradAmt,omitempty"`

	// Amount of money paid to an executing broker as a commission.
	ExecutingBrokerAmount *AmountAndDirection44 `xml:"ExctgBrkrAmt,omitempty"`

	// Amount of money defined as a discount on a new issue or on a tranche of an existing issue.
	IssueDiscountAllowance *AmountAndDirection44 `xml:"IsseDscntAllwnc,omitempty"`

	// Amount of payment levy tax.
	PaymentLevyTax *AmountAndDirection44 `xml:"PmtLevyTax,omitempty"`

	// Tax charged by the jurisdiction in which the financial instrument settles.
	LocalTax *AmountAndDirection44 `xml:"LclTax,omitempty"`

	// Local tax country specific.
	LocalTaxCountrySpecific *AmountAndDirection44 `xml:"LclTaxCtrySpcfc,omitempty"`

	// Amount of commission paid to a local broker.
	LocalBrokerCommission *AmountAndDirection44 `xml:"LclBrkrComssn,omitempty"`

	// Amount of money deposited by the trading party in a margin account.
	Margin *AmountAndDirection44 `xml:"Mrgn,omitempty"`

	// An amount that is not indicated by a known business denomination.
	Other *AmountAndDirection44 `xml:"Othr,omitempty"`

	// Amount of money charged by a regulatory authority, for example, Securities and Exchange fees.
	RegulatoryAmount *AmountAndDirection44 `xml:"RgltryAmt,omitempty"`

	// All costs related to the physical delivery of documents such as stamps, postage, carrier fees, insurances or messenger services.
	ShippingAmount *AmountAndDirection44 `xml:"ShppgAmt,omitempty"`

	// Amount of drawdown or other reduction from or in addition to the deal price.
	SpecialConcession *AmountAndDirection44 `xml:"SpclCncssn,omitempty"`

	// Amount of stamp duty.
	StampDuty *AmountAndDirection44 `xml:"StmpDty,omitempty"`

	// Amount of stock exchange tax.
	StockExchangeTax *AmountAndDirection44 `xml:"StockXchgTax,omitempty"`

	// Amount of tax levied on a transfer of ownership of financial instrument.
	TransferTax *AmountAndDirection44 `xml:"TrfTax,omitempty"`

	// Amount of transaction tax.
	TransactionTax *AmountAndDirection44 `xml:"TxTax,omitempty"`

	// Amount of value-added tax.
	ValueAddedTax *AmountAndDirection44 `xml:"ValAddedTax,omitempty"`

	// Amount of money that will be withheld by a tax authority.
	WithholdingTax *AmountAndDirection44 `xml:"WhldgTax,omitempty"`

	// Amount representing the difference between the cost and the current price of a security. In the context of securities settlement, it is the amount paid or received when the instructions are netted or paired off.
	NetGainLoss *AmountAndDirection44 `xml:"NetGnLoss,omitempty"`

	// Amount of consumption tax.
	ConsumptionTax *AmountAndDirection44 `xml:"CsmptnTax,omitempty"`

	// Amount of unpaid interest (on bonds which have defaulted and have subsequently
	// restructured), which is capitalized and added to the original principal amount of the bond.
	AccruedCapitalisationAmount *AmountAndDirection44 `xml:"AcrdCptlstnAmt,omitempty"`
}

func (o *OtherAmounts28) AddAccruedInterestAmount() *AmountAndDirection44 {
	o.AccruedInterestAmount = new(AmountAndDirection44)
	return o.AccruedInterestAmount
}

func (o *OtherAmounts28) AddChargesFees() *AmountAndDirection44 {
	o.ChargesFees = new(AmountAndDirection44)
	return o.ChargesFees
}

func (o *OtherAmounts28) AddCountryNationalFederalTax() *AmountAndDirection44 {
	o.CountryNationalFederalTax = new(AmountAndDirection44)
	return o.CountryNationalFederalTax
}

func (o *OtherAmounts28) AddTradeAmount() *AmountAndDirection44 {
	o.TradeAmount = new(AmountAndDirection44)
	return o.TradeAmount
}

func (o *OtherAmounts28) AddExecutingBrokerAmount() *AmountAndDirection44 {
	o.ExecutingBrokerAmount = new(AmountAndDirection44)
	return o.ExecutingBrokerAmount
}

func (o *OtherAmounts28) AddIssueDiscountAllowance() *AmountAndDirection44 {
	o.IssueDiscountAllowance = new(AmountAndDirection44)
	return o.IssueDiscountAllowance
}

func (o *OtherAmounts28) AddPaymentLevyTax() *AmountAndDirection44 {
	o.PaymentLevyTax = new(AmountAndDirection44)
	return o.PaymentLevyTax
}

func (o *OtherAmounts28) AddLocalTax() *AmountAndDirection44 {
	o.LocalTax = new(AmountAndDirection44)
	return o.LocalTax
}

func (o *OtherAmounts28) AddLocalTaxCountrySpecific() *AmountAndDirection44 {
	o.LocalTaxCountrySpecific = new(AmountAndDirection44)
	return o.LocalTaxCountrySpecific
}

func (o *OtherAmounts28) AddLocalBrokerCommission() *AmountAndDirection44 {
	o.LocalBrokerCommission = new(AmountAndDirection44)
	return o.LocalBrokerCommission
}

func (o *OtherAmounts28) AddMargin() *AmountAndDirection44 {
	o.Margin = new(AmountAndDirection44)
	return o.Margin
}

func (o *OtherAmounts28) AddOther() *AmountAndDirection44 {
	o.Other = new(AmountAndDirection44)
	return o.Other
}

func (o *OtherAmounts28) AddRegulatoryAmount() *AmountAndDirection44 {
	o.RegulatoryAmount = new(AmountAndDirection44)
	return o.RegulatoryAmount
}

func (o *OtherAmounts28) AddShippingAmount() *AmountAndDirection44 {
	o.ShippingAmount = new(AmountAndDirection44)
	return o.ShippingAmount
}

func (o *OtherAmounts28) AddSpecialConcession() *AmountAndDirection44 {
	o.SpecialConcession = new(AmountAndDirection44)
	return o.SpecialConcession
}

func (o *OtherAmounts28) AddStampDuty() *AmountAndDirection44 {
	o.StampDuty = new(AmountAndDirection44)
	return o.StampDuty
}

func (o *OtherAmounts28) AddStockExchangeTax() *AmountAndDirection44 {
	o.StockExchangeTax = new(AmountAndDirection44)
	return o.StockExchangeTax
}

func (o *OtherAmounts28) AddTransferTax() *AmountAndDirection44 {
	o.TransferTax = new(AmountAndDirection44)
	return o.TransferTax
}

func (o *OtherAmounts28) AddTransactionTax() *AmountAndDirection44 {
	o.TransactionTax = new(AmountAndDirection44)
	return o.TransactionTax
}

func (o *OtherAmounts28) AddValueAddedTax() *AmountAndDirection44 {
	o.ValueAddedTax = new(AmountAndDirection44)
	return o.ValueAddedTax
}

func (o *OtherAmounts28) AddWithholdingTax() *AmountAndDirection44 {
	o.WithholdingTax = new(AmountAndDirection44)
	return o.WithholdingTax
}

func (o *OtherAmounts28) AddNetGainLoss() *AmountAndDirection44 {
	o.NetGainLoss = new(AmountAndDirection44)
	return o.NetGainLoss
}

func (o *OtherAmounts28) AddConsumptionTax() *AmountAndDirection44 {
	o.ConsumptionTax = new(AmountAndDirection44)
	return o.ConsumptionTax
}

func (o *OtherAmounts28) AddAccruedCapitalisationAmount() *AmountAndDirection44 {
	o.AccruedCapitalisationAmount = new(AmountAndDirection44)
	return o.AccruedCapitalisationAmount
}


text:
@implementation CollectionViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSString *cellId = @"collectionViewCell";

    [self.collectionView registerNib:[UINib nibWithNibName:NSStringFromClass([CollectionViewCell class]) bundle:nil]
          forCellWithReuseIdentifier:cellId];

    ViewModelFactory *factory = [ViewModelFactory new];
    NSArray *viewModels = [factory viewModels];

    RSTCollectionViewCellFactory *cellFactory = [[RSTCollectionViewCellFactory alloc] initWithCellDequeuingBlock:^UICollectionViewCell *(UICollectionView *collectionView, id item, NSIndexPath *indexPath) {
        return [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
    }];

    self.dataSource = [[RSTCollectionViewArrayDataSource alloc] initWithItems:viewModels
                                                                  cellFactory:cellFactory
                                                       cellConfigurationBlock:^(UICollectionView *collectionView, UICollectionViewCell *cell, id item, NSIndexPath *indexPath) {

                                                           ViewModel *viewModel = (ViewModel *)item;
                                                           CollectionViewCell *customCell = (CollectionViewCell *)cell;

                                                           customCell.textLabel.text = viewModel.title;
                                                           customCell.detailTextLabel.text = viewModel.subtitle;

                                                       }];

    self.collectionView.dataSource = self.dataSource;
}

@end


text:
namespace Gu.Units.Generator
{
    using System;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Runtime.CompilerServices;
    using System.Threading.Tasks;

    [Serializable]
    public class FactorConversion : IFactorConversion, INotifyPropertyChanged
    {
        private string name;
        private string symbol;
        private double factor;
        private Unit unit;

        public FactorConversion(string name, string symbol, double factor)
        {
            this.name = name;
            this.symbol = symbol;
            this.factor = factor;
        }

        [field: NonSerialized]
        public event PropertyChangedEventHandler PropertyChanged;

        public string Name
        {
            get => this.name;
            set
            {
                if (value == this.name)
                {
                    return;
                }

                this.name = value;
                this.OnPropertyChanged();
                this.OnPropertyChanged(nameof(this.ToSi));
                this.OnPropertyChanged(nameof(this.FromSi));
                this.OnPropertyChanged(nameof(this.ParameterName));
                this.OnPropertyChanged(nameof(this.XDocParameterName));
            }
        }

        public string ParameterName => this.Name.ToParameterName();

        public string XDocParameterName => this.Name.FirstCharLower();

        public string Symbol
        {
            get => this.symbol;
            set
            {
                if (value == this.symbol)
                {
                    return;
                }

                this.symbol = value;
                this.OnPropertyChanged();
            }
        }

        public double Factor
        {
            get => this.factor;
            set
            {
                if (value.Equals(this.factor))
                {
                    return;
                }

                this.factor = value;
                this.OnPropertyChanged();
                this.OnPropertyChanged(nameof(this.ToSi));
                this.OnPropertyChanged(nameof(this.FromSi));
            }
        }

        public string ToSi => this.GetToSi();

        public string FromSi => this.GetFromSi();

        public Unit Unit => this.unit ?? (this.unit = this.GetUnit());

        public ObservableCollection<PrefixConversion> PrefixConversions { get; } = new ObservableCollection<PrefixConversion>();

        public Task<bool> CanRoundtripAsync() => this.CanRoundtripCoreAsync();

        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}


text:
var test = require("tape");
var cliArgs = require("../lib/command-line-args");

test("parse works with default argv", function(t){
    var argv = [ "--verbose", "-d", "--colour", "red", "--number", 3 ];

    var result = cliArgs([]).parse();
    t.end();
});


text:
layout: page
title: Gold Media Executive Retreat
date: 2016-05-24
author: Andrea Hardy
tags: weekly links, java
status: published
summary: Sed vel scelerisque nunc, dignissim interdum ex.
banner: images/banner/wedding.jpg
booking:
  startDate: 05/05/2017
  endDate: 05/08/2017
  ctyhocn: SGUHHHX
  groupCode: GMER
published: true
---
Nam pellentesque dui ipsum, at feugiat tortor malesuada sed. Aliquam lobortis, urna quis consequat faucibus, urna ex pharetra lectus, eu consequat lectus tortor eget justo. Etiam pulvinar at eros quis placerat. Donec dictum est sit amet quam facilisis accumsan. Pellentesque finibus odio in condimentum commodo. Suspendisse fermentum quam elit, interdum pharetra arcu volutpat id. Nunc et ipsum blandit turpis facilisis eleifend. Cras maximus sem sit amet orci vestibulum semper. Morbi turpis orci, egestas vitae dignissim sit amet, dapibus vel ligula.
Suspendisse nec enim fermentum, scelerisque massa ut, pulvinar lectus. Sed convallis nisi vel velit dapibus pretium. Sed varius pharetra sem sed bibendum. Duis leo ligula, bibendum quis commodo et, sagittis eu ante. Suspendisse potenti. Curabitur at mi magna. Aenean sodales mauris auctor neque venenatis, sit amet tristique libero dapibus. Sed nisi diam, posuere in nisi ut, consequat fringilla ante. Nam sed vehicula nunc. Pellentesque consequat sodales elit, id rhoncus sapien hendrerit ut.

1 Etiam consequat ex id dolor commodo convallis.

Pellentesque rhoncus consectetur purus vitae dictum. Duis sodales risus vitae semper auctor. Vestibulum rutrum sem vestibulum sapien hendrerit gravida at sed sem. Cras non blandit eros. Nullam convallis scelerisque cursus. Morbi in dapibus quam. Fusce et mollis diam. Nunc posuere dapibus fringilla.
Nunc dapibus nibh eget tellus sodales, ac accumsan dui blandit. Fusce sit amet suscipit arcu. Praesent ornare nec elit a imperdiet. Fusce ac leo dapibus, tincidunt justo vel, dictum libero. Nam sit amet nulla sit amet nunc viverra ultricies eget in urna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed imperdiet luctus facilisis. Praesent et ultricies mauris, quis varius velit.


text:
/******************************************************************************/
/**
@file		CppWrapperExample.cpp
@author		Dana Klamut
@brief		Example class exemplifying uses for Dictionary.h and MasterTable.h.
@copyright	Copyright 2017
			The University of British Columbia,
			IonDB Project Contributors (see AUTHORS.md)
@par Redistribution and use in source and binary forms, with or without
	modification, are permitted provided that the following conditions are met:

@par 1.Redistributions of source code must retain the above copyright notice,
	this list of conditions and the following disclaimer.

@par 2.Redistributions in binary form must reproduce the above copyright notice,
	this list of conditions and the following disclaimer in the documentation
	and/or other materials provided with the distribution.

@par 3.Neither the name of the copyright holder nor the names of its contributors
	may be used to endorse or promote products derived from this software without
	specific prior written permission.

@par THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
	ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
	LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/

#include <iostream>
using namespace std;
#include "../../src/cpp_wrapper/Dictionary.h"
#include "../../src/cpp_wrapper/MasterTable.h"

int
main(
	void
) {
	int key									= 0;
	int count								= 0;

	/* Create dictionary */
	ion_dictionary_id_t				id		= 1;
	ion_dictionary_config_info_t	config	= {
		.id = id, .type = key_type_numeric_signed, .key_size = sizeof(int), .value_size = 40, .dictionary_size = 20, .dictionary_type = dictionary_type_skip_list_t
	};
	int								type	= 0;
	string							val		= "";

	/* Traditional method of creating a dictionary */
/*	Dictionary<int, string> *dictionary = new SkipList<int, string>(id, key_type_numeric_signed, sizeof(int), sizeof("abracadabra"), 7); */

/*	Dictionary<int, string> *dictionary = SkipList<int, string>::open(config, type, val); */
	SkipList<int, string> *dictionary = SkipList<int, string>::openDictionary(config, type, val);

	if (err_ok != dictionary->last_status.error) {
		printf("Oh no! Something went wrong opening my dictionary\n");
	}

	string input;

	while (7 > count) {
		printf("READY FOR INPUT\n");
		getline(cin, input);

		printf("key: %i\n", key);
		cout << input << "\n";
		dictionary->insert(key, input);

		if (key > 0) {
			printf("last key: %i", key - 1);
			cout << "value: " << dictionary->get(key - 1) << "\n";
		}

		if (err_ok != dictionary->last_status.error) {
			printf("Oh no! Something went wrong opening my dictionary\n");
		}

		key = key + 1;

		Cursor<int, string> *cur = dictionary->allRecords();
		printf("\n<CURRENT DICTIONARY VALUES>\n");

		while (cur->next()) {
			printf("%i ", cur->getKey());
			cout << cur->getValue() << "\n";
		}

		printf("</CURRENT DICTIONARY VALUES>\n\n");
		delete cur;

		count++;
	}

	return 0;
}


text:
find_path(libcaca_INCLUDE_DIR caca.h)
find_library(libcaca_LIBRARY caca)
check_symbol_exists(CACA_API_VERSION_1 caca.h CACA_API_VERSION_1)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(libcaca FOUND_VAR libcaca_FOUND
	REQUIRED_VARS libcaca_LIBRARY libcaca_INCLUDE_DIR
	VERSION_VAR CACA_API_VERSION_1)

mark_as_advanced(libcaca_INCLUDE_DIR libcaca_LIBRARY)


text:
'use strict';
var server = require('./server/express');

var options = {
  port: process.env.VCAP_APP_PORT || 3000,
  hostname: process.env.VCAP_APP_HOST,
};

server.use(server.express.static(__dirname + '/dist'));

server.listen(options.port, options.hostname, function() {
  console.log('Web server started on ' + options.hostname + ':' + options.port + ' using the built app in "dist"');
});


text:
require "rack/tld_length.rb"
require "tld_length/version.rb"