text:
id: string-functions
title: String functions
sidebar_label: String Functions
---

## `$string()`
__Signature:__ `$string(arg, prettify)`

Casts the `arg` parameter to a string using the following casting rules

   - Strings are unchanged
   - Functions are converted to an empty string
   - Numeric infinity and NaN throw an error because they cannot be represented as a JSON number
   - All other values are converted to a JSON string using the [JSON.stringify](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) function

If `arg` is not specified (i.e. this function is invoked with no arguments), then the context value is used as the value of `arg`.

If `prettify` is true, then "prettified" JSON is produced. i.e One line per field and lines will be indented based on the field depth.

__Examples__

- `$string(5)` => `"5"`
- `[1..5].$string()` => `["1", "2", "3", "4", "5"]`

## `$length()`
__Signature:__ `$length(str)`

Returns the number of characters in the string `str`.  If `str` is not specified (i.e. this function is invoked with no arguments), then the context value is used as the value of `str`.  An error is thrown if `str` is not a string.

__Examples__

- `$length("Hello World")` => `11`

## `$substring()`
__Signature:__ `$substring(str, start[, length])`

Returns a string containing the characters in the first parameter `str` starting at position `start` (zero-offset).  If `str` is not specified (i.e. this function is invoked with only the numeric argument(s)), then the context value is used as the value of `str`.  An error is thrown if `str` is not a string.

If `length` is specified, then the substring will contain maximum `length` characters.

If `start` is negative then it indicates the number of characters from the end of `str`.  See [substr](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) for full definition.

__Examples__

- `$substring("Hello World", 3)` => `"lo World"`
- `$substring("Hello World", 3, 5)` => `"lo Wo"`
- `$substring("Hello World", -4)` => `"orld"`
- `$substring("Hello World", -4, 2)` => `"or"`

## `$substringBefore()`
__Signature:__ `$substringBefore(str, chars)`

Returns the substring before the first occurrence of the character sequence `chars` in `str`.  If `str` is not specified (i.e. this function is invoked with only one argument), then the context value is used as the value of `str`.  If `str` does not contain `chars`, then it returns `str`.   An error is thrown if `str` and `chars` are not strings.

__Examples__

- `$substringBefore("Hello World", " ")` => `"Hello"`

## `$substringAfter()`
__Signature:__ `$substringAfter(str, chars)`

Returns the substring after the first occurrence of the character sequence `chars` in `str`.  If `str` is not specified (i.e. this function is invoked with only one argument), then the context value is used as the value of `str`.  If `str` does not contain `chars`, then it returns `str`.   An error is thrown if `str` and `chars` are not strings.

__Examples__

- `$substringAfter("Hello World", " ")` => `"World"`

## `$uppercase()`
__Signature:__ `$uppercase(str)`

Returns a string with all the characters of `str` converted to uppercase.  If `str` is not specified (i.e. this function is invoked with no arguments), then the context value is used as the value of `str`.  An error is thrown if `str` is not a string.

__Examples__

- `$uppercase("Hello World")` => `"HELLO WORLD"`

## `$lowercase()`
__Signature:__ `$lowercase(str)`

Returns a string with all the characters of `str` converted to lowercase.  If `str` is not specified (i.e. this function is invoked with no arguments), then the context value is used as the value of `str`.  An error is thrown if `str` is not a string.

__Examples__

- `$lowercase("Hello World")` => `"hello world"`

## `$trim()`
__Signature:__ `$trim(str)`

Normalizes and trims all whitespace characters in `str` by applying the following steps:

- All tabs, carriage returns, and line feeds are replaced with spaces.
- Contiguous sequences of spaces are reduced to a single space.
- Trailing and leading spaces are removed.

If `str` is not specified (i.e. this function is invoked with no arguments), then the context value is used as the value of `str`.  An error is thrown if `str` is not a string.

__Examples__

- `$trim("   Hello    \n World  ")` => `"Hello World"`

## `$pad()`
__Signature:__ `$pad(str, width [, char])`

Returns a copy of the string `str` with extra padding, if necessary, so that its total number of characters is at least the absolute value of the `width` parameter.  If `width` is a positive number, then the string is padded to the right; if negative, it is padded to the left.  The optional `char` argument specifies the padding character(s) to use.  If not specified, it defaults to the space character.

__Examples__

- `$pad("foo", 5)` => `"foo  "`
- `$pad("foo", -5)` => `"  foo"`
- `$pad("foo", -5, "#")` => `"##foo"`
- `$formatBase(35, 2) ~> $pad(-8, '0')` => `"00100011"`

## `$contains()`
__Signature:__ `$contains(str, pattern)`

Returns `true` if `str` is matched by `pattern`, otherwise it returns `false`. If `str` is not specified (i.e. this function is invoked with one argument), then the context value is used as the value of `str`.

The `pattern` parameter can either be a string or a regular expression (regex).  If it is a string, the function returns `true` if the characters within `pattern` are contained contiguously within `str`.  If it is a regex, the function will return `true` if the regex matches the contents of `str`.

__Examples__

- `$contains("abracadabra", "bra")` => `true`
- `$contains("abracadabra", /a.*a/)` => `true`
- `$contains("abracadabra", /ar.*a/)` => `false`
- `$contains("Hello World", /wo/)` => `false`
- `$contains("Hello World", /wo/i)` => `true`
- `Phone[$contains(number, /^077/)]` => `{ "type": "mobile", "number": "077 7700 1234" }`

## `$split()`
__Signature:__ `$split(str, separator [, limit])`

Splits the `str` parameter into an array of substrings.  If `str` is not specified, then the context value is used as the value of `str`.  It is an error if `str` is not a string.

The `separator` parameter can either be a string or a regular expression (regex).  If it is a string, it specifies the characters within `str` about which it should be split.  If it is the empty string, `str` will be split into an array of single characters.  If it is a regex, it splits the string around any sequence of characters that match the regex.

The optional `limit` parameter is a number that specifies the maximum number of substrings to  include in the resultant array.  Any additional substrings are discarded.  If `limit` is not  specified, then `str` is fully split with no limit to the size of the resultant array.  It is an error if `limit` is not a non-negative number.

__Examples__

- `$split("so many words", " ")` => `[ "so", "many", "words" ]`
- `$split("so many words", " ", 2)` => `[ "so", "many" ]`
- `$split("too much, punctuation. hard; to read", /[ ,.;]+/)` => `["too", "much", "punctuation", "hard", "to", "read"]`

## `$join()`
__Signature:__ `$join(array[, separator])`

Joins an array of component strings into a single concatenated string with each component string separated by the optional `separator` parameter.

It is an error if the input array contains an item which isn't a string.

If `separator` is not specified, then it is assumed to be the empty string, i.e. no separator between the component strings.  It is an error if `separator` is not a string.

__Examples__

- `$join(['a','b','c'])` => `"abc"`
- `$split("too much, punctuation. hard; to read", /[ ,.;]+/, 3) ~> $join(', ')` => `"too, much, punctuation"`

## `$match()`
__Signature:__ `$match(str, pattern [, limit])`

Applies the `str` string to the `pattern` regular expression and returns an array of objects, with each object containing information about each occurrence of a match withing `str`.

The object contains the following fields:

- `match` - the substring that was matched by the regex.
- `index` - the offset (starting at zero) within `str` of this match.
- `groups` - if the regex contains capturing groups (parentheses), this contains an array of strings representing each captured group.

If `str` is not specified, then the context value is used as the value of `str`.  It is an error if `str` is not a string.

__Examples__

`$match("ababbabbcc",/a(b+)/)` =>
```
[
  {
    "match": "ab",
    "index": 0,
    "groups": ["b"]
  },
  {
    "match": "abb",
    "index": 2,
    "groups": ["bb"]
  },
  {
    "match": "abb",
    "index": 5,
    "groups": ["bb" ]
  }
]
```

## `$replace()`
__Signature:__ `$replace(str, pattern, replacement [, limit])`

Finds occurrences of `pattern` within `str` and replaces them with `replacement`.

If `str` is not specified, then the context value is used as the value of `str`.  It is an error if `str` is not a string.

The `pattern` parameter can either be a string or a regular expression (regex).  If it is a string, it specifies the substring(s) within `str` which should be replaced.  If it is a regex, its is used to find .

The `replacement` parameter can either be a string or a function.  If it is a string, it specifies the sequence of characters that replace the substring(s) that are matched by `pattern`.  If `pattern` is a regex, then the `replacement` string can refer to the characters that were matched by the regex as well as any of the captured groups using a `$` followed by a number `N`:

- If `N = 0`, then it is replaced by substring matched by the regex as a whole.
- If `N > 0`, then it is replaced by the substring captured by the Nth parenthesised group in the regex.
- If `N` is greater than the number of captured groups, then it is replaced by the empty string.
- A literal `$` character must be written as `$$` in the `replacement` string

If the `replacement` parameter is a function, then it is invoked for each match occurrence of the `pattern` regex.  The `replacement` function must take a single parameter which will be the object structure of a regex match as described in the `$match` function; and must return a string.

The optional `limit` parameter,  is a number that specifies the maximum number of replacements to make before stopping.  The remainder of the input beyond this limit will be copied to the output unchanged.

__Examples__

$replace("John Smith and John Jones", "John", "Mr")

"Mr Smith and Mr Jones"

$replace("John Smith and John Jones", "John", "Mr", 1)

"Mr Smith and John Jones"

$replace("abracadabra", /a.*?a/, "*")

"*c*bra"

$replace("John Smith", /(\w+)\s(\w+)/, "$2, $1")

"Smith, John"

$replace("265USD", /([0-9]+)USD/, "$$$1")

"$265"

(
  $convert := function($m) {
    ($number($m.groups[0]) - 32) * 5/9 & "C"
  };
  $replace("temperature = 68F today", /(\d+)F/, $convert)
)

"temperature = 20C today"

## `$eval()`
__Signature:__ `$eval(expr [, context])`

Parses and evaluates the string `expr` which contains literal JSON or a JSONata expression using the current context as the context for evaluation.

__Examples__

$eval("[1,2,3]")

[1, 2, 3]

$eval('[1,$string(2),3]')

[1,"2",3]

Optionally override the context by specifying the second parameter

## `$base64encode()`
__Signature:__ `$base64encode()`

Converts an ASCII string to a base 64 representation. Each each character in the string is treated as a byte of binary data. This requires that all characters in the string are in the 0x00 to 0xFF range, which includes all characters in URI encoded strings. Unicode characters outside of that range are not supported.

__Examples__

- `$base64encode("myuser:mypass")` => `"bXl1c2VyOm15cGFzcw=="`

## `$base64decode()`
__Signature:__ `$base64decode()`

Converts base 64 encoded bytes to a string, using a UTF-8 Unicode codepage.

__Examples__

- `$base64decode("bXl1c2VyOm15cGFzcw==")` => `"myuser:mypass"`

## `$encodeUrlComponent()`
__Signature:__ `$encodeUrlComponent(str)`

Encodes a Uniform Resource Locator (URL) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.

__Examples__

- `$encodeUrlComponent("?x=test")` => `"%3Fx%3Dtest"`

## `$encodeUrl()`
__Signature:__ `$encodeUrl(str)`

Encodes a Uniform Resource Locator (URL) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.

__Examples__

- `$encodeUrl("https://mozilla.org/?x=шеллы")` => `"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"`

## `$decodeUrlComponent()`
__Signature:__ `$decodeUrlComponent(str)`

Decodes a Uniform Resource Locator (URL) component previously created by encodeUrlComponent.

__Examples__

- `$decodeUrlComponent("%3Fx%3Dtest")` => `"?x=test"`

## `$decodeUrl()`
__Signature:__ `$decodeUrl(str)`

Decodes a Uniform Resource Locator (URL) previously created by encodeUrl.

__Examples__

- `$decodeUrl("https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B")` => `"https://mozilla.org/?x=шеллы"`


text:
from __future__ import unicode_literals

"""
models doctype
"""

from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from djangobmf.currency import Wallet
from djangobmf.conf import settings
from djangobmf.fields import CurrencyField
from djangobmf.fields import MoneyField
from djangobmf.models import BMFModel

from .workflows import TransactionWorkflow

from .serializers import AccountSerializer
from .serializers import TransactionSerializer
from .serializers import TransactionItemSerializer

ACCOUNTING_INCOME = 10
ACCOUNTING_EXPENSE = 20
ACCOUNTING_ASSET = 30
ACCOUNTING_LIABILITY = 40
ACCOUNTING_EQUITY = 50

ACCOUNTING_TYPES = (
    (ACCOUNTING_INCOME, _('Income')),
    (ACCOUNTING_EXPENSE, _('Expense')),
    (ACCOUNTING_ASSET, _('Asset')),
    (ACCOUNTING_LIABILITY, _('Liability')),
    (ACCOUNTING_EQUITY, _('Equity')),
)

# =============================================================================
# TODO: Add Fiscal Year
# TODO: Add Period
# =============================================================================

@python_2_unicode_compatible
class BaseAccount(BMFModel):
    """
    Accounts

    ==============  ========  ========
    Account-Type     Credit     Debit
    ==============  ========  ========
    Asset           Decrease  Increase
    Liability       Increase  Decrease
    Income/Revenue  Increase  Decrease
    Expense         Decrease  Increase
    Equity/Capital  Increase  Decrease
    ==============  ========  ========
    """
    parent = models.ForeignKey(
        'self', null=True, blank=True, related_name='child',
        on_delete=models.CASCADE,
    )
    parents = models.ManyToManyField(
        'self', related_name='children', editable=False, symmetrical=False,
    )

    balance_currency = CurrencyField(editable=False)
    balance = MoneyField(editable=False, default=0)
    number = models.CharField(_('Number'), max_length=30, null=True, blank=True, unique=True, db_index=True)
    name = models.CharField(_('Name'), max_length=100, null=False, blank=False)
    type = models.PositiveSmallIntegerField(
        _('Type'), null=True, blank=True, choices=ACCOUNTING_TYPES,
    )
    read_only = models.BooleanField(_('Read-only'), default=False)

    def credit_increase(self):
        if self.type in [ACCOUNTING_ASSET, ACCOUNTING_EXPENSE]:
            return False
        else:
            return True

    class Meta:
        verbose_name = _('Account')
        verbose_name_plural = _('Accounts')
        ordering = ['number', 'name', 'type']
        abstract = True
        swappable = "BMF_CONTRIB_ACCOUNT"

    class BMFMeta:
        observed_fields = ['name', ]
        serializer = AccountSerializer

    def __init__(self, *args, **kwargs):
        super(BaseAccount, self).__init__(*args, **kwargs)
        self.initial_parent = self.parent_id

    def save(self, update_parents=True, *args, **kwargs):
        super(BaseAccount, self).save(*args, **kwargs)

        if update_parents:
            if self.parent:
                self.parents = list(self.parent.parents.values_list('pk', flat=True)) + [self.parent_id]
            else:
                self.parents = []

        if self.initial_parent != self.parent_id:
            # Update children ...
            for account in Account.objects.filter(parents=self):
                account.save()

    def clean(self):
        if self.parent:
            if not self.type:
                self.type = self.parent.type
            elif self.type != self.parent.type:
                raise ValidationError(_('The type does not match the model parents type'))
        elif not self.type:
            raise ValidationError(_('Root accounts must define a type'))

    def __str__(self):
        return '%s: %s' % (self.number, self.name)

class AbstractAccount(BaseAccount):
    """
    """
    comment = models.TextField(_('Comment'), blank=True, null=True)

    class Meta(BaseAccount.Meta):
        abstract = True

    class BMFMeta(BaseAccount.BMFMeta):
        search_fields = ['name', '^number']

class Account(AbstractAccount):
    """
    """
    pass

# =============================================================================

class BaseTransactionManager(models.Manager):

    def open(self, request):
        return self.get_queryset().filter(
            draft=False,
        ).order_by('-modified')

    def closed(self, request):
        return self.get_queryset().filter(
            draft=True,
        ).order_by('modified')

@python_2_unicode_compatible
class BaseTransaction(BMFModel):
    """
    Transaction
    """
    project = models.ForeignKey(  # TODO optional
        settings.CONTRIB_PROJECT, null=True, blank=True, on_delete=models.SET_NULL,
    )
    text = models.CharField(
        _('Posting text'), max_length=255, null=False, blank=False,
    )
    draft = models.BooleanField(_('Draft'), default=True, editable=False)

#   expensed = models.BooleanField(_('Expensed'), blank=True, null=False, default=False, )

    objects = BaseTransactionManager()

    class Meta:
        verbose_name = _('Transaction')
        verbose_name_plural = _('Transactions')
        abstract = True
        swappable = "BMF_CONTRIB_TRANSACTION"

    class BMFMeta:
        observed_fields = ['expensed', 'text']
        has_files = True
        workflow = TransactionWorkflow
        serializer = TransactionSerializer

    def __str__(self):
        return '%s' % self.text

    def calc_balance(self):
        if hasattr(self, '_calc_balance'):
            return self._calc_balance

        credit = Wallet()
        debit = Wallet()

        for i in self.items.all():
            if i.credit:
                credit += i.amount
            else:
                debit += i.amount

        self._calc_balance = (credit == debit, credit, debit)
        return self._calc_balance

    def is_balanced(self):
        return self.calc_balance()[0]

    def balance_credit(self):
        return self.calc_balance()[1]

    def balance_debit(self):
        return self.calc_balance()[2]

class Transaction(BaseTransaction):
    """
    """
    pass

class TransactionItemManager(models.Manager):
    """
    """
    def get_queryset(self):
        return super(TransactionItemManager, self).get_queryset() \
            .select_related('account', 'transaction').extra(select={"type": "type"})

class BaseTransactionItem(BMFModel):
    """
    """
    account = models.ForeignKey(
        settings.CONTRIB_ACCOUNT, null=True, blank=False,
        related_name="transactions", on_delete=models.PROTECT,
    )
    transaction = models.ForeignKey(
        settings.CONTRIB_TRANSACTION, null=True, blank=False,
        related_name="items", on_delete=models.CASCADE,
    )
    date = models.DateField(
        _('Date'),
        null=True,
        blank=True,
    )

    amount_currency = CurrencyField()
    amount = MoneyField(blank=False)

    credit = models.BooleanField(
        choices=((True, _('Credit')), (False, _('Debit'))),
        default=True,
    )
    draft = models.BooleanField(_('Draft'), default=True, editable=False)

    objects = TransactionItemManager()

    class Meta:
        abstract = True
        swappable = "BMF_CONTRIB_TRANSACTIONITEM"
        ordering = ('-draft', '-date', 'credit', 'account__number', 'transaction__text')

    class BMFMeta:
        serializer = TransactionItemSerializer

    @property
    def get_type(self):
        try:
            return getattr(self, 'type', self.account.type)
        except AttributeError:
            return 0

class TransactionItem(BaseTransactionItem):
    """
    This only inherits from AbstractTransactionItem.
    """
    pass

redpajama_set_name: RedPajamaGithub


text:
import ddt
import mock
import webob

from cinder.api.v1 import snapshots
from cinder import context
from cinder import db
from cinder import exception
from cinder import objects
from cinder.objects import fields
from cinder import test
from cinder.tests.unit.api import fakes
from cinder.tests.unit.api.v1 import stubs
from cinder.tests.unit import fake_constants as fake
from cinder.tests.unit import fake_snapshot
from cinder.tests.unit import fake_volume
from cinder import volume

UUID = fake.SNAPSHOT_ID
INVALID_UUID = fake.WILL_NOT_BE_FOUND_ID

def _get_default_snapshot_param():
    return {'id': UUID,
            'volume_id': fake.VOLUME_ID,
            'status': fields.SnapshotStatus.AVAILABLE,
            'volume_size': 100,
            'created_at': None,
            'display_name': 'Default name',
            'display_description': 'Default description', }

def stub_snapshot_create(self, context,
                         volume_id, name,
                         description, metadata):
    snapshot = _get_default_snapshot_param()
    snapshot['volume_id'] = volume_id
    snapshot['display_name'] = name
    snapshot['display_description'] = description
    snapshot['metadata'] = metadata
    return snapshot

def stub_snapshot_delete(self, context, snapshot):
    if snapshot['id'] != UUID:
        raise exception.NotFound

def stub_snapshot_get(self, context, snapshot_id):
    if snapshot_id != UUID:
        raise exception.NotFound

    param = _get_default_snapshot_param()
    return param

def stub_snapshot_get_all(self, context, search_opts=None):
    param = _get_default_snapshot_param()
    return [param]

@ddt.ddt
class SnapshotApiTest(test.TestCase):
    def setUp(self):
        super(SnapshotApiTest, self).setUp()
        self.controller = snapshots.SnapshotsController()

        self.stubs.Set(db, 'snapshot_get_all_by_project',
                       stubs.stub_snapshot_get_all_by_project)
        self.stubs.Set(db, 'snapshot_get_all',
                       stubs.stub_snapshot_get_all)

    def test_snapshot_create(self):
        self.stubs.Set(volume.api.API, "create_snapshot", stub_snapshot_create)
        self.stubs.Set(volume.api.API, 'get', stubs.stub_volume_get)
        snapshot = {"volume_id": fake.VOLUME_ID,
                    "force": False,
                    "display_name": "Snapshot Test Name",
                    "display_description": "Snapshot Test Desc"}
        body = dict(snapshot=snapshot)
        req = fakes.HTTPRequest.blank('/v1/snapshots')
        resp_dict = self.controller.create(req, body)

        self.assertIn('snapshot', resp_dict)
        self.assertEqual(snapshot['display_name'],
                         resp_dict['snapshot']['display_name'])
        self.assertEqual(snapshot['display_description'],
                         resp_dict['snapshot']['display_description'])

    @ddt.data(True, 'y', 'true', 'trUE', 'yes', '1', 1)
    def test_snapshot_create_force(self, force_param):
        self.stubs.Set(volume.api.API,
                       "create_snapshot_force",
                       stub_snapshot_create)
        self.mock_object(volume.api.API, 'get', stubs.stub_volume_api_get)
        snapshot = {"volume_id": fake.VOLUME_ID,
                    "force": force_param,
                    "display_name": "Snapshot Test Name",
                    "display_description": "Snapshot Test Desc"}
        body = dict(snapshot=snapshot)
        req = fakes.HTTPRequest.blank('/v1/snapshots')
        resp_dict = self.controller.create(req, body)

        self.assertIn('snapshot', resp_dict)
        self.assertEqual(snapshot['display_name'],
                         resp_dict['snapshot']['display_name'])
        self.assertEqual(snapshot['display_description'],
                         resp_dict['snapshot']['display_description'])

    @ddt.data(False, 'n', 'false', 'falSE', 'No', '0', 0)
    def test_snapshot_create_force_failure(self, force_param):
        self.stubs.Set(volume.api.API,
                       "create_snapshot_force",
                       stub_snapshot_create)
        self.mock_object(volume.api.API, 'get', stubs.stub_volume_api_get)
        snapshot = {"volume_id": fake.VOLUME_ID,
                    "force": force_param,
                    "display_name": "Snapshot Test Name",
                    "display_description": "Snapshot Test Desc"}
        body = dict(snapshot=snapshot)
        req = fakes.HTTPRequest.blank('/v1/snapshots')
        self.assertRaises(exception.InvalidVolume,
                          self.controller.create,
                          req,
                          body)

    @ddt.data("**&&^^%%$$##@@", '-1', 2, '01', 'on', 'off', "1         ")
    def test_snapshot_create_invalid_force_param(self, force_param):
        self.stubs.Set(volume.api.API,
                       "create_snapshot_force",
                       stub_snapshot_create)
        self.mock_object(volume.api.API, 'get', stubs.stub_volume_api_get)
        snapshot = {"volume_id": fake.SNAPSHOT_ID,
                    "force": "**&&^^%%$$##@@",
                    "display_name": "Snapshot Test Name",
                    "display_description": "Snapshot Test Desc"}
        body = dict(snapshot=snapshot)
        req = fakes.HTTPRequest.blank('/v1/snapshots')
        self.assertRaises(exception.InvalidParameterValue,
                          self.controller.create,
                          req,
                          body)

    def test_snapshot_create_without_volume_id(self):
        snapshot_name = 'Snapshot Test Name'
        snapshot_description = 'Snapshot Test Desc'
        body = {
            "snapshot": {
                "force": True,
                "name": snapshot_name,
                "description": snapshot_description
            }
        }
        req = fakes.HTTPRequest.blank('/v1/snapshots')
        self.assertRaises(webob.exc.HTTPBadRequest,
                          self.controller.create, req, body)

    @mock.patch.object(volume.api.API, "update_snapshot",
                       side_effect=stubs.stub_snapshot_update)
    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    @mock.patch('cinder.objects.Volume.get_by_id')
    @mock.patch('cinder.objects.Snapshot.get_by_id')
    def test_snapshot_update(self, snapshot_get_by_id, volume_get_by_id,
                             snapshot_metadata_get, update_snapshot):
        snapshot = {
            'id': UUID,
            'volume_id': fake.VOLUME_ID,
            'status': fields.SnapshotStatus.AVAILABLE,
            'volume_size': 100,
            'display_name': 'Default name',
            'display_description': 'Default description',
            'expected_attrs': ['metadata'],
        }
        ctx = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)
        snapshot_obj = fake_snapshot.fake_snapshot_obj(ctx, **snapshot)
        fake_volume_obj = fake_volume.fake_volume_obj(ctx)
        snapshot_get_by_id.return_value = snapshot_obj
        volume_get_by_id.return_value = fake_volume_obj

        updates = {"display_name": "Updated Test Name", }
        body = {"snapshot": updates}
        req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % UUID)
        res_dict = self.controller.update(req, UUID, body)
        expected = {'snapshot': {
            'id': UUID,
            'volume_id': fake.VOLUME_ID,
            'status': fields.SnapshotStatus.AVAILABLE,
            'size': 100,
            'created_at': None,
            'display_name': u'Updated Test Name',
            'display_description': u'Default description',
            'metadata': {},
        }}
        self.assertEqual(expected, res_dict)

    def test_snapshot_update_missing_body(self):
        body = {}
        req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % UUID)
        self.assertRaises(webob.exc.HTTPUnprocessableEntity,
                          self.controller.update, req, UUID, body)

    def test_snapshot_update_invalid_body(self):
        body = {'display_name': 'missing top level snapshot key'}
        req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % UUID)
        self.assertRaises(webob.exc.HTTPUnprocessableEntity,
                          self.controller.update, req, UUID, body)

    def test_snapshot_update_not_found(self):
        self.stubs.Set(volume.api.API, "get_snapshot", stub_snapshot_get)
        updates = {
            "display_name": "Updated Test Name",
        }
        body = {"snapshot": updates}
        req = fakes.HTTPRequest.blank('/v1/snapshots/not-the-uuid')
        self.assertRaises(exception.NotFound, self.controller.update, req,
                          'not-the-uuid', body)

    @mock.patch.object(volume.api.API, "delete_snapshot",
                       side_effect=stubs.stub_snapshot_update)
    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    @mock.patch('cinder.objects.Volume.get_by_id')
    @mock.patch('cinder.objects.Snapshot.get_by_id')
    def test_snapshot_delete(self, snapshot_get_by_id, volume_get_by_id,
                             snapshot_metadata_get, delete_snapshot):
        snapshot = {
            'id': UUID,
            'volume_id': fake.VOLUME_ID,
            'status': fields.SnapshotStatus.AVAILABLE,
            'volume_size': 100,
            'display_name': 'Default name',
            'display_description': 'Default description',
            'expected_attrs': ['metadata'],
        }
        ctx = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)
        snapshot_obj = fake_snapshot.fake_snapshot_obj(ctx, **snapshot)
        fake_volume_obj = fake_volume.fake_volume_obj(ctx)
        snapshot_get_by_id.return_value = snapshot_obj
        volume_get_by_id.return_value = fake_volume_obj

        snapshot_id = UUID
        req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % snapshot_id)
        resp = self.controller.delete(req, snapshot_id)
        self.assertEqual(202, resp.status_int)

    def test_snapshot_delete_invalid_id(self):
        self.stubs.Set(volume.api.API, "delete_snapshot", stub_snapshot_delete)
        snapshot_id = INVALID_UUID
        req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % snapshot_id)
        self.assertRaises(exception.SnapshotNotFound,
                          self.controller.delete,
                          req,
                          snapshot_id)

    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    @mock.patch('cinder.objects.Volume.get_by_id')
    @mock.patch('cinder.objects.Snapshot.get_by_id')
    def test_snapshot_show(self, snapshot_get_by_id, volume_get_by_id,
                           snapshot_metadata_get):
        snapshot = {
            'id': UUID,
            'volume_id': fake.VOLUME_ID,
            'status': fields.SnapshotStatus.AVAILABLE,
            'volume_size': 100,
            'display_name': 'Default name',
            'display_description': 'Default description',
            'expected_attrs': ['metadata'],
        }
        ctx = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)
        snapshot_obj = fake_snapshot.fake_snapshot_obj(ctx, **snapshot)
        fake_volume_obj = fake_volume.fake_volume_obj(ctx)
        snapshot_get_by_id.return_value = snapshot_obj
        volume_get_by_id.return_value = fake_volume_obj

        req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % UUID)
        resp_dict = self.controller.show(req, UUID)

        self.assertIn('snapshot', resp_dict)
        self.assertEqual(UUID, resp_dict['snapshot']['id'])

    def test_snapshot_show_invalid_id(self):
        snapshot_id = INVALID_UUID
        req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % snapshot_id)
        self.assertRaises(exception.SnapshotNotFound,
                          self.controller.show,
                          req,
                          snapshot_id)

    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    @mock.patch('cinder.objects.Volume.get_by_id')
    @mock.patch('cinder.objects.Snapshot.get_by_id')
    @mock.patch('cinder.volume.api.API.get_all_snapshots')
    def test_snapshot_detail(self, get_all_snapshots, snapshot_get_by_id,
                             volume_get_by_id, snapshot_metadata_get):
        snapshot = {
            'id': UUID,
            'volume_id': fake.VOLUME_ID,
            'status': fields.SnapshotStatus.AVAILABLE,
            'volume_size': 100,
            'display_name': 'Default name',
            'display_description': 'Default description',
            'expected_attrs': ['metadata']
        }
        ctx = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)
        snapshot_obj = fake_snapshot.fake_snapshot_obj(ctx, **snapshot)
        fake_volume_obj = fake_volume.fake_volume_obj(ctx)
        snapshot_get_by_id.return_value = snapshot_obj
        volume_get_by_id.return_value = fake_volume_obj
        snapshots = objects.SnapshotList(objects=[snapshot_obj])
        get_all_snapshots.return_value = snapshots

        req = fakes.HTTPRequest.blank('/v1/snapshots/detail')
        resp_dict = self.controller.detail(req)

        self.assertIn('snapshots', resp_dict)
        resp_snapshots = resp_dict['snapshots']
        self.assertEqual(1, len(resp_snapshots))

        resp_snapshot = resp_snapshots.pop()
        self.assertEqual(UUID, resp_snapshot['id'])

    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    def test_admin_list_snapshots_limited_to_project(self,
                                                     snapshot_metadata_get):
        req = fakes.HTTPRequest.blank('/v1/%s/snapshots' % fake.PROJECT_ID,
                                      use_admin_context=True)
        res = self.controller.index(req)

        self.assertIn('snapshots', res)
        self.assertEqual(1, len(res['snapshots']))

    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    def test_list_snapshots_with_limit_and_offset(self,
                                                  snapshot_metadata_get):
        def list_snapshots_with_limit_and_offset(is_admin):
            def stub_snapshot_get_all_by_project(context, project_id,
                                                 filters=None, marker=None,
                                                 limit=None, sort_keys=None,
                                                 sort_dirs=None, offset=None):
                return [
                    stubs.stub_snapshot(fake.SNAPSHOT_ID,
                                        display_name='backup1'),
                    stubs.stub_snapshot(fake.SNAPSHOT2_ID,
                                        display_name='backup2'),
                    stubs.stub_snapshot(fake.SNAPSHOT3_ID,
                                        display_name='backup3'),
                ]

            self.stubs.Set(db, 'snapshot_get_all_by_project',
                           stub_snapshot_get_all_by_project)

            req = fakes.HTTPRequest.blank('/v1/%s/snapshots?limit=1\
                                          &offset=1' % fake.PROJECT_ID,
                                          use_admin_context=is_admin)
            res = self.controller.index(req)

            self.assertIn('snapshots', res)
            self.assertEqual(1, len(res['snapshots']))
            self.assertEqual(fake.SNAPSHOT2_ID, res['snapshots'][0]['id'])

        # admin case
        list_snapshots_with_limit_and_offset(is_admin=True)
        # non_admin case
        list_snapshots_with_limit_and_offset(is_admin=False)

    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    def test_admin_list_snapshots_all_tenants(self, snapshot_metadata_get):
        req = fakes.HTTPRequest.blank(
            '/v1/%s/snapshots?all_tenants=1' % fake.PROJECT_ID,
            use_admin_context=True)
        res = self.controller.index(req)
        self.assertIn('snapshots', res)
        self.assertEqual(3, len(res['snapshots']))

    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    def test_all_tenants_non_admin_gets_all_tenants(self,
                                                    snapshot_metadata_get):
        req = fakes.HTTPRequest.blank(
            '/v1/%s/snapshots?all_tenants=1' % fake.PROJECT_ID)
        res = self.controller.index(req)
        self.assertIn('snapshots', res)
        self.assertEqual(1, len(res['snapshots']))

    @mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
    def test_non_admin_get_by_project(self, snapshot_metadata_get):
        req = fakes.HTTPRequest.blank('/v1/%s/snapshots' % fake.PROJECT_ID)
        res = self.controller.index(req)
        self.assertIn('snapshots', res)
        self.assertEqual(1, len(res['snapshots']))

class SnapshotsUnprocessableEntityTestCase(test.TestCase):

    """Tests of places we throw 422 Unprocessable Entity."""

    def setUp(self):
        super(SnapshotsUnprocessableEntityTestCase, self).setUp()
        self.controller = snapshots.SnapshotsController()

    def _unprocessable_snapshot_create(self, body):
        req = fakes.HTTPRequest.blank('/v1/%s/snapshots' % fake.PROJECT_ID)
        req.method = 'POST'

        self.assertRaises(webob.exc.HTTPUnprocessableEntity,
                          self.controller.create, req, body)

    def test_create_no_body(self):
        self._unprocessable_snapshot_create(body=None)

    def test_create_missing_snapshot(self):
        body = {'foo': {'a': 'b'}}
        self._unprocessable_snapshot_create(body=body)

    def test_create_malformed_entity(self):
        body = {'snapshot': 'string'}
        self._unprocessable_snapshot_create(body=body)


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Services.Exceptions
{
    using System;
    using System.Runtime.Serialization;
    using System.Security.Permissions;

    public class PageLoadException : BasePortalException
    {
        // default constructor
        public PageLoadException()
        {
        }

        // constructor with exception message
        public PageLoadException(string message)
            : base(message)
        {
        }

        // constructor with message and inner exception
        public PageLoadException(string message, Exception inner)
            : base(message, inner)
        {
        }

        protected PageLoadException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }
    }
}


text:
![Storks Logo](https://raw.githubusercontent.com/LiamMorrow/Storks/master/stork.png)

[![Build status](https://ci.appveyor.com/api/projects/status/9vsuhammekxpyl1u?svg=true)](https://ci.appveyor.com/project/LiamMorrow/storks)

#### Nuget
|Storks|Storks Azure Storage|
-------|--------------------|
|[![NuGet](https://img.shields.io/nuget/v/Storks.svg)](https://www.nuget.org/packages/Storks/)|[![NuGet](https://img.shields.io/nuget/v/Storks.AzureStorage.svg)](https://www.nuget.org/packages/Storks.AzureStorage/)|
# Storks
A .Net library for loading of data and separating properties into storage.
Useful for large messages in queues with limited message sizes

Find the reasoning for this project on my blog:
http://blog.liammorrow.xyz/2017/04/overcoming-azure-storage-queue-message.html
## Installation
Get via nuget at:
#### Core
Contains base interfaces and default implementations using file and in memory data stores
Install via the Package Manager Console
```Install-Package Storks```
#### Azure Storage Implementation
Contains an implementation using Azure Blob storage as a data store
Install via the Package Manager Console
```Install-Package Storks.AzureStorage```
## Usage
A common use case of storks is passing large messages or files in an environment which limits message size.
Imagine you have a web service that allows you to convert HTML to PDF using a tool like wkhtmltopdf.  Unfortunately, this tool requires the GDI library which many service providers limit access to on server environments. So you need to create a worker that reads from a queue to run the HTML->PDF conversion then reports back.

You write it up but hit a snag.  Your queue messages are limited to 64kB! That will work for the majority of your html, but all it takes is one file that is too large to queue.  This is where storks comes in.

By using a StoreBackedProperty, you can now effortlessly pass objects as large as you like into your queue!
Your queue message object now becomes this:

```C#
class HtmlToPdfMessage{
  public StoreBackedProperty<string> Html { get; set; }
}
```
And your push to queue method becomes this:
```C#
public async Task PushHtmlToPdfMessage(string html){

   // Create a new data communicator.  Here we use a LocalFileDataCommunicator which stores message data on the local HDD
   // The communicator simply gets and retrieves byte data when given a unique ID.
   // The Storks.AzureStorage package implements a data communicator with Azure Blob storage being the backing store
   IStoreBackedPropertyDataCommunicator dataStore = new LocalFileDataCommunicator("path/to/directorystorage");

   // Create a new StoreBackedPropertyController.  Alternatively, we could use a DI framework to get it
    var controller = new StoreBackedPropertyController(dataStore);
    var storedData = await controller.StoreValueAsync(html);
    var message = new HtmlToPdfMessage{
      Html = storedData
    };

    // Then you'd do your usual message queue operations here with message
}
```
Then to dequeue simply do the reverse:

```C#
public async Task DequeueHtmlToPdf(HtmlToPdfMessage message){

   // Create a new data communicator.  Here we use a LocalFileDataCommunicator which stores message data on the local HDD
   // The communicator simply gets and retrieves byte data when given a unique ID.
   // The Storks.AzureStorage package implements a data communicator with Azure Blob storage being the backing store
   IStoreBackedPropertyDataCommunicator dataStore = new LocalFileDataCommunicator("path/to/directorystorage");

   // Create a new StoreBackedPropertyController.  Alternatively, we could use a DI framework to get it
    var controller = new StoreBackedPropertyController(dataStore);
    var retrievedData = await controller.GetValueAsync(message.Html);

    // Then you'd do your usual message queue operations here with retrievedData
}
```
#### Automatic Data Retrieval
Storks integrates with Json.Net to allow for automatic data retrieval when a message is deserialized with JsonConvert.Deserialize.
This is the method which Azure Webjobs use to deserialize queued messages into POCOs.
Simply call the method `AutoBindLoadedJson` on any `IStoreBackedPropertyController` to use that controller to deserialize messages.
An example can be found in the Storks.Examples.AzureWebJobs project

#### Custom Data Types
By default, Storks can automatically store `string` and `byte[]` `StoreBackedProperty` types.
When using the default `StoreBackedPropertyController` implementation, Storks can also handle most POCOs using BSON serialization provided by Json.Net.

If you need to serialize another type, simply implement the `IStoreBackedPropertyEncoder` interface and register it to your controller with the `RegisterEncoder` method on your controller.  The encoder provides methods to serialize the type into a `byte[]` and back to your type. Have a look at the `StringStoreBackedPropertyEncoder` for reference.

## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request
## License
Licensed under the MIT license, can be found in LICENSE file

## Special thanks:
Icons made by Roundicons from www.flaticon.com is licensed by CC 3.0 BY

Thanks to Appveyor for providing free builds for Open source projects!


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="6b6e5bfc-37d3-41cc-aec3-83ca9c81fd2a" name="Default" comment="">
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/web/main.dart" afterPath="$PROJECT_DIR$/web/main.dart" />
    </list>
    <ignored path="$PROJECT_DIR$/.tmp/" />
    <ignored path="$PROJECT_DIR$/temp/" />
    <ignored path="$PROJECT_DIR$/tmp/" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
      <file leaf-file-name="styles.css" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/web/styles.css">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="135">
              <caret line="9" column="0" lean-forward="false" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="main.dart" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/web/main.dart">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="300">
              <caret line="21" column="40" lean-forward="false" selection-start-line="21" selection-start-column="40" selection-end-line="21" selection-end-column="40" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="index.html" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/web/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="315">
              <caret line="21" column="24" lean-forward="false" selection-start-line="21" selection-start-column="13" selection-end-line="21" selection-end-column="24" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FindInProjectRecents">
    <findStrings>
      <find>left</find>
    </findStrings>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/web/index.html" />
        <option value="$PROJECT_DIR$/web/lib/ghost.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter.dart" />
        <option value="$PROJECT_DIR$/web/lib/bear.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter/random_damage.dart" />
        <option value="$PROJECT_DIR$/web/lib/mud.dart" />
        <option value="$PROJECT_DIR$/test/encounter_test.dart" />
        <option value="$PROJECT_DIR$/test/test_harness.html" />
        <option value="$PROJECT_DIR$/test/test_harness.dart" />
        <option value="$PROJECT_DIR$/lib/server.dart" />
        <option value="$PROJECT_DIR$/pubspec.yaml" />
        <option value="$PROJECT_DIR$/lib/init_data.dart" />
        <option value="$PROJECT_DIR$/Procfile" />
        <option value="$PROJECT_DIR$/web/lib/encounter/encounter.dart" />
        <option value="$PROJECT_DIR$/web/lib/environment.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter/angel.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter/bear.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter/drunken_sailor.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter/ghost.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter/nothing.dart" />
        <option value="$PROJECT_DIR$/web/lib/encounter/vampire.dart" />
        <option value="$PROJECT_DIR$/web/styles.css" />
        <option value="$PROJECT_DIR$/web/main.dart" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
    <sorting>DEFINITION_ORDER</sorting>
  </component>
  <component name="ProjectFrameBounds">
    <option name="y" value="23" />
    <option name="width" value="960" />
    <option name="height" value="1097" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <expand>
            <path>
              <item name="mud" type="b2602c69:ProjectViewProjectNode" />
              <item name="mud" type="462c0819:PsiDirectoryNode" />
            </path>
            <path>
              <item name="mud" type="b2602c69:ProjectViewProjectNode" />
              <item name="mud" type="462c0819:PsiDirectoryNode" />
              <item name="web" type="462c0819:PsiDirectoryNode" />
            </path>
          </expand>
          <select />
        </subPane>
      </pane>
      <pane id="Scratches" />
      <pane id="Scope" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="HbShouldOpenHtmlAsHb" value="" />
    <property name="dart.analysis.tool.window.force.activate" value="false" />
    <property name="settings.editor.selected.configurable" value="preferences.sourceCode" />
    <property name="SearchEverywhereHistoryKey" value="	FILE	file:///Users/winkerxiao/mud/web/lib/encounter/encounter.dart" />
  </component>
  <component name="RecentsManager">
    <key name="MoveFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/web/lib/encounter" />
    </key>
  </component>
  <component name="RunDashboard">
    <option name="ruleStates">
      <list>
        <RuleState>
          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
        </RuleState>
        <RuleState>
          <option name="name" value="StatusDashboardGroupingRule" />
        </RuleState>
      </list>
    </option>
  </component>
  <component name="RunManager" selected="Dart Test.tests in test_harness.dart">
    <configuration name="index.html" type="JavascriptDebugType" factoryName="JavaScript Debug" engineId="bfee1b69-a97d-4338-8ba4-25170adcbaa6" uri="http://localhost:63342/mud/web/index.html" />
    <configuration name="tests in encounter_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" temporary="true" nameIsGenerated="true">
      <option name="filePath" value="$PROJECT_DIR$/test/encounter_test.dart" />
      <option name="testName" value="encounter_test.dart" />
    </configuration>
    <configuration name="tests in test_harness.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" temporary="true" nameIsGenerated="true">
      <option name="filePath" value="$PROJECT_DIR$/test/test_harness.dart" />
      <option name="testName" value="test_harness.dart" />
    </configuration>
    <list size="3">
      <item index="0" class="java.lang.String" itemvalue="JavaScript Debug.index.html" />
      <item index="1" class="java.lang.String" itemvalue="Dart Test.tests in encounter_test.dart" />
      <item index="2" class="java.lang.String" itemvalue="Dart Test.tests in test_harness.dart" />
    </list>
    <recent_temporary>
      <list size="2">
        <item index="0" class="java.lang.String" itemvalue="Dart Test.tests in test_harness.dart" />
        <item index="1" class="java.lang.String" itemvalue="Dart Test.tests in encounter_test.dart" />
      </list>
    </recent_temporary>
  </component>
  <component name="ShelveChangesManager" show_recycled="false">
    <option name="remove_strategy" value="false" />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="6b6e5bfc-37d3-41cc-aec3-83ca9c81fd2a" name="Default" comment="" />
      <created>1500369556167</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1500369556167</updated>
      <workItem from="1500369558517" duration="373000" />
      <workItem from="1500370143035" duration="34000" />
      <workItem from="1500370178467" duration="3968000" />
      <workItem from="1500374402703" duration="5360000" />
      <workItem from="1500389133590" duration="128000" />
    </task>
    <servers />
  </component>
  <component name="TestHistory">
    <history-entry file="tests_in_encounter_test_dart - 2017.07.18 at 11h 21m 22s.xml">
      <configuration name="tests in encounter_test.dart" configurationId="DartTestRunConfigurationType" />
    </history-entry>
    <history-entry file="tests_in_test_harness_dart - 2017.07.18 at 11h 25m 22s.xml">
      <configuration name="tests in test_harness.dart" configurationId="DartTestRunConfigurationType" />
    </history-entry>
  </component>
  <component name="TimeTrackingManager">
    <option name="totallyTimeSpent" value="11861000" />
  </component>
  <component name="ToolWindowManager">
    <frame x="0" y="23" width="960" height="1097" extended-state="0" />
    <editor active="true" />
    <layout>
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25559106" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Dart Analysis" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297561" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32934132" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32934132" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32934132" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
    </layout>
    <layout-to-restore>
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3297561" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Dart Analysis" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297561" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25559106" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
    </layout-to-restore>
  </component>
  <component name="TypeScriptGeneratedFilesManager">
    <option name="version" value="1" />
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager>
      <option name="time" value="1" />
    </breakpoint-manager>
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/web/styles.css">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="420">
          <caret line="28" column="24" lean-forward="false" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/angel.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="165">
          <caret line="11" column="1" lean-forward="false" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/drunken_sailor.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="1" lean-forward="true" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/nothing.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/ghost.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/random_damage.dart" />
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/bear.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="165">
          <caret line="11" column="1" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="11" selection-end-column="1" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/vampire.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="90">
          <caret line="6" column="14" lean-forward="false" selection-start-line="6" selection-start-column="14" selection-end-line="6" selection-end-column="14" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/mud.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="165">
          <caret line="11" column="24" lean-forward="false" selection-start-line="11" selection-start-column="24" selection-end-line="11" selection-end-column="24" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/encounter.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="420">
          <caret line="28" column="7" lean-forward="false" selection-start-line="28" selection-start-column="7" selection-end-line="28" selection-end-column="7" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/init_data.dart" />
    <entry file="file://$PROJECT_DIR$/lib/server.dart" />
    <entry file="file://$PROJECT_DIR$/test/test_harness.html" />
    <entry file="file://$PROJECT_DIR$/README.md">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="75">
          <caret line="5" column="0" lean-forward="false" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/test/test_harness.dart" />
    <entry file="file://$PROJECT_DIR$/test/encounter_test.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="255">
          <caret line="17" column="0" lean-forward="false" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/Procfile">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/environment.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="405">
          <caret line="27" column="0" lean-forward="true" selection-start-line="27" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pubspec.yaml">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="105">
          <caret line="7" column="24" lean-forward="true" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="165">
          <caret line="11" column="33" lean-forward="false" selection-start-line="11" selection-start-column="33" selection-end-line="11" selection-end-column="33" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/main.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="435">
          <caret line="29" column="12" lean-forward="false" selection-start-line="29" selection-start-column="12" selection-end-line="29" selection-end-column="12" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/main.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="15">
          <caret line="2" column="0" lean-forward="true" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/angel.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="165">
          <caret line="11" column="1" lean-forward="true" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/mud.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="45">
          <caret line="3" column="0" lean-forward="true" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/environment.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="150">
          <caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/bear.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="60">
          <caret line="4" column="0" lean-forward="false" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/ghost.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/encounter.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="405">
          <caret line="27" column="1" lean-forward="true" selection-start-line="27" selection-start-column="1" selection-end-line="27" selection-end-column="1" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/nothing.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/styles.css">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="420">
          <caret line="28" column="24" lean-forward="false" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/drunken_sailor.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="105">
          <caret line="7" column="26" lean-forward="true" selection-start-line="7" selection-start-column="26" selection-end-line="7" selection-end-column="26" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/random_damage.dart" />
    <entry file="file://$PROJECT_DIR$/test/encounter_test.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="255">
          <caret line="17" column="0" lean-forward="false" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/test/test_harness.html" />
    <entry file="file://$PROJECT_DIR$/test/test_harness.dart" />
    <entry file="file://$PROJECT_DIR$/lib/init_data.dart" />
    <entry file="file://$PROJECT_DIR$/lib/server.dart" />
    <entry file="file://$PROJECT_DIR$/Procfile">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/pubspec.yaml">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="105">
          <caret line="7" column="24" lean-forward="false" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/mud.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="165">
          <caret line="11" column="24" lean-forward="false" selection-start-line="11" selection-start-column="24" selection-end-line="11" selection-end-column="24" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/bear.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="50" lean-forward="false" selection-start-line="9" selection-start-column="50" selection-end-line="9" selection-end-column="50" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/drunken_sailor.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="105">
          <caret line="7" column="56" lean-forward="false" selection-start-line="7" selection-start-column="56" selection-end-line="7" selection-end-column="56" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/ghost.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="90">
          <caret line="6" column="39" lean-forward="false" selection-start-line="6" selection-start-column="39" selection-end-line="6" selection-end-column="39" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/vampire.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="165">
          <caret line="11" column="1" lean-forward="true" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/nothing.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="90">
          <caret line="6" column="61" lean-forward="false" selection-start-line="6" selection-start-column="61" selection-end-line="6" selection-end-column="61" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/environment.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="210">
          <caret line="14" column="57" lean-forward="false" selection-start-line="14" selection-start-column="57" selection-end-line="14" selection-end-column="57" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/encounter.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="420">
          <caret line="28" column="7" lean-forward="true" selection-start-line="28" selection-start-column="7" selection-end-line="28" selection-end-column="7" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/lib/encounter/angel.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="39" lean-forward="false" selection-start-line="9" selection-start-column="39" selection-end-line="9" selection-end-column="39" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/styles.css">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="135">
          <caret line="9" column="0" lean-forward="false" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="315">
          <caret line="21" column="24" lean-forward="false" selection-start-line="21" selection-start-column="13" selection-end-line="21" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/web/main.dart">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="300">
          <caret line="21" column="40" lean-forward="false" selection-start-line="21" selection-start-column="40" selection-end-line="21" selection-end-column="40" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
<!DOCTYPE html>

	<title id="title">Pattern Lab</title>
	<meta charset="UTF-8">

	<meta http-equiv="cache-control" content="max-age=0" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
	<meta http-equiv="pragma" content="no-cache" />

	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<link rel="stylesheet" href="styleguide/css/styleguide.css?1398976783" media="all" />
	<link rel="stylesheet" href="styleguide/css/styleguide-specific.css?1398976783" media="all" />
	<link rel="stylesheet" href="styleguide/css/vendor/typeahead.css?1398976783" media="all" />
	<link rel="stylesheet" href="styleguide/css/vendor/prism.css?1398976783" media="all" />

		Menu

Global

Headers

Headers_flourish

ParagraphText

ParagraphText_lead

Hr

Hr_dark

A

Atoms

Uncategorized

InlineNav

CarouselBox

Photo_full

Button

Separator

SocialIcon

View All

Molecules

FeaturedBio

SocialIcons

Organisms

Templates

Index

Pages

WhoWeAre

All

									<form id="sg-form">
										Size <input type="text" class="sg-input sg-size-px" value="---">px /
										<input type="text" class="sg-input sg-size-em" value="---">em
									</form>

S

M

L

Full

Random

Disco

								MQ

1200px

1500px

650px

768px

900px

992px

								Search Patterns

<input class="typeahead" id="typeahead" type="text" placeholder="search for a pattern...">

								View

Annotations

Code

Open in new window

								Tools

Page Follow

Auto-reload

Keyboard Shortcuts

Pattern Lab Docs


text:
#ifndef _ADJACENCY_H_
#define _ADJACENCY_H_

/* Translation-invariant adjacency relations */

#include "common.h"

/* Displacements to an adjacent voxel */

typedef struct _adjvoxel
{
    int dx, dy, dz;
} AdjVoxel;

/* Adjacency relation */

typedef struct _adjrel
{
    AdjVoxel *adj; /* list of displacements to the adjacent voxels */
    int        n;  /* number of adjacent voxels */
} AdjRel;

Voxel   GetAdjacentVoxel(AdjRel *A, Voxel u, int adj); /* Access adjacent voxel */

AdjRel *CreateAdjRel(int n);      /* Allocate memory to store
                     adjacency relation */
void    DestroyAdjRel(AdjRel *A); /* Free allocated memory */

/* ------------------ Translation-Invariant Adjacency Relations --------------*/

AdjRel *Spheric(float r); /* Create a ball adjacency with radius r >=
                 1.0 voxel */

AdjRel *ClockCircular(float r);
#endif


text:
plugins are taken from here:
https://gstreamer.freedesktop.org/src/gst-plugins-base/
https://gstreamer.freedesktop.org/src/gst-plugins-good/
https://gstreamer.freedesktop.org/src/gst-plugins-bad/

brew install pkg-config
brew install gstreamer
brew install gtk

Check that this command is working:
```
pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0
```

install tremor:

```
git clone https://github.com/soundcloud/tremor.git
./autogen.sh
./configure
make && make install
```

```
cp /usr/local/lib/pkgconfig/vorbisidec.pc /usr/local/lib/pkgconfig/ivorbisidec.pc
```

Then - reinstall gst-plugins-base-1.6.3 plugins in standard way:
```
./configure && make && make install
```
# Debugging

Add `--gst-debug-level=4` flag to gstreamer application

# Webcam

How to stream video from webcam on mac:
```
gst-launch-1.0 wrappercamerabinsrc mode=2  ! video/x-raw, width=320, height=240 ! autovideosink
gst-launch-1.0 wrappercamerabinsrc mode=2  ! video/x-raw, width=320, height=240 ! udpsink host=127.0.0.1 port=1234
```

input video from test
```
gst-launch-1.0 -v videotestsrc ! videoconvert ! avenc_h263p ! rtph263ppay ! udpsink host=127.0.0.1 port=5001
```

input video from webcam
```
gst-launch-1.0 -v wrappercamerabinsrc mode=2  ! video/x-raw, width=320, height=240 ! videoconvert ! avenc_h263p ! rtph263ppay ! udpsink host=127.0.0.1 port=5001
```

You need to copy `caps` from input and pass on receiver:

```
gst-launch-1.0 -v udpsrc address=127.0.0.1 port=5001 caps="application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H263-1998\,\ payload\=\(int\)96\,\ ssrc\=\(uint\)870888106\,\ timestamp-offset\=\(uint\)3238251667\,\ seqnum-offset\=\(uint\)8585" ! rtph263pdepay ! avdec_h263 ! autovideosink

gst-launch-1.0 -v udpsrc address=127.0.0.1 port=5001 caps="application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H263-1998\,\ payload\=\(int\)96" ! rtph263pdepay ! avdec_h263 ! autovideosink

gst-launch-1.0 -v udpsrc address=127.0.0.1 port=5000 caps="application/x-rtp" ! rtph263pdepay ! avdec_h263 ! autovideosink
```

Watch video from internet:
```
gst-launch-1.0 playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm
```

# Debugging

```
brew install gdb
sudo gdb ./ice_streaming_sample.o
```
Go through this process to codesign gdb:
http://www.patosai.com/blog/post/installing-gdb-on-mac-os-x-yosemite

In gdb session:
```
set scheduler-locking on
b ice_streaming_sample.c:232
b ice_streaming_sample.c:336
b ice_streaming_sample.c:389
b ice_streaming_sample.c:407
run 0 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }') --gst-debug-level=5
```

# Suggestions on integration:

Look here:
https://github.com/since2014/p2p-streaming/blob/142e9d5c7bd6c751223179f25b73e847359bd7ca/Receive_Video_Libnice_From_RPI/jni/Stream/receive_audio.c