text:
// Copyright (c) 2015 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

'use strict';

var assert = require('assert');
var fs = require('fs');
var path = require('path');
var bufrw = require('bufrw');
var Result = require('bufrw/result');
var thriftrw = require('thriftrw');

var errors = require('../errors.js');

var HeaderRW = require('../v2/header.js').header2;

module.exports = TChannelAsThrift;

function TChannelAsThrift(opts) {
    if (!(this instanceof TChannelAsThrift)) {
        return new TChannelAsThrift(opts);
    }

    var self = this;

    assert(opts && typeof opts.source === 'string',
        'must pass source as an argument');

    self.spec = new thriftrw.Thrift({
        source: opts.source,
        strict: opts.strict
    });

    self.logger = opts.logger;

    var bossMode = opts && opts.bossMode;
    self.bossMode = typeof bossMode === 'boolean' ? bossMode : false;

    var logParseFailures = opts && opts.logParseFailures;
    self.logParseFailures = typeof logParseFailures === 'boolean' ?
        logParseFailures : true;

    self.channel = opts.channel;

    self.isHealthy = opts.isHealthy;
    assert(!self.isHealthy || typeof self.isHealthy === 'function',
        'isHealthy must be a function');
    assert(!self.isHealthy || self.channel,
        'channel must be provided with isHealthy');

    if (self.isHealthy) {
        fs.readFile(path.join(__dirname, 'meta.thrift'), 'utf8', registerHealthCheck);
    }

    function registerHealthCheck(err, source) {
        if (err) {
            self.channel.logger.error('failed to read meta.thrift file', {
                error: err
            });
            return;
        }

        self.thriftSource = opts.source;
        var metaSpec = new thriftrw.Thrift({
            source: source
        });
        self.register(self.channel, 'Meta::health', self, health, metaSpec);
        self.register(self.channel, 'Meta::thriftIDL', self, thriftIDL, metaSpec);
    }
}

function TChannelThriftRequest(options) {
    var self = this;

    self.channel = options.channel;
    self.reqOptions = options.reqOptions;
    self.tchannelThrift = options.tchannelThrift;
}

function health(self, req, head, body, callback) {
    var status = self.isHealthy();
    assert(status && typeof status.ok === 'boolean', 'status must have ok field');
    assert(status && (status.ok || typeof status.message === 'string'),
        'status.message must be provided when status.ok === false');

    return callback(null, {
        ok: true,
        body: {
            ok: status.ok,
            message: status.message
        }
    });
}

function thriftIDL(self, req, head, body, callback) {
    return callback(null, {
        ok: true,
        body: self.thriftSource
    });
}

TChannelThriftRequest.prototype.send =
function send(endpoint, head, body, callback) {
    var self = this;

    var outreq = self.channel.request(self.reqOptions);
    self.tchannelThrift.send(outreq, endpoint, head, body, callback);
};

TChannelAsThrift.prototype.request = function request(reqOptions) {
    var self = this;

    assert(self.channel, 'channel is required for thrift.request()');
    assert(reqOptions &&
        reqOptions.type !== 'tchannel.request' &&
        reqOptions.type !== 'tchannel.outgoing-request',
        'invalid reqOptions to TChannelAsThrift.request');

    var req = new TChannelThriftRequest({
        channel: self.channel,
        reqOptions: reqOptions,
        tchannelThrift: self
    });

    return req;
};

TChannelAsThrift.prototype.register =
function register(channel, name, opts, handle, spec) {
    var self = this;

    if (!self.logger) {
        self.logger = channel.logger;
    }

    assert(typeof name === 'string', 'endpoint has to be a string');

    channel.register(name, handleThriftRequest);

    function handleThriftRequest(req, res, inHeadBuffer, inBodyBuffer) {
        if (req.headers.as !== 'thrift') {
            return res.sendError('BadRequest',
                'Expected call request as header to be thrift');
        }

        // Process incoming thrift body
        var parseResult = self._parse({
            head: inHeadBuffer,
            body: inBodyBuffer,
            endpoint: name,
            direction: 'in.request',
            spec: spec
        });

        if (parseResult.err) {
            return res.sendError('BadRequest',
                parseResult.err.type + ': ' + parseResult.err.message);
        }

        var v = parseResult.value;
        handle(opts, req, v.head, v.body, handleThriftResponse);

        function handleThriftResponse(err, thriftRes) {
            if (err) {
                assert(isError(err), 'Error argument must be an error');

                self.logger.error('Got unexpected error in handler', {
                    endpoint: name,
                    error: err
                });

                return res.sendError('UnexpectedError', 'Unexpected Error');
            }

            if (!self.bossMode) {
                assert(typeof thriftRes.ok === 'boolean',
                    'expected response.ok to be a boolean');
                assert(thriftRes.body !== undefined,
                    'expected response.body to exist');

                if (!thriftRes.ok) {
                    assert(isError(thriftRes.body),
                        'not-ok body should be an error');
                    assert(typeof thriftRes.typeName === 'string',
                        'expected not-ok response to have typeName');
                }
            }

            var stringifyResult = self._stringify({
                head: thriftRes.head,
                body: thriftRes.body,
                ok: thriftRes.ok,
                typeName: thriftRes.typeName,
                endpoint: name,
                direction: 'out.response',
                spec: spec
            });

            if (stringifyResult.err) {
                return res.sendError('UnexpectedError',
                    'Could not serialize thrift');
            }

            if (res.setOk(thriftRes.ok)) {
                res.headers.as = 'thrift';
                res.send(
                    stringifyResult.value.head,
                    stringifyResult.value.body
                );
            }
        }
    }
};

/* jshint maxparams:5 */
TChannelAsThrift.prototype.send =
function send(request, endpoint, outHead, outBody, callback) {
    var self = this;

    self.logger = self.logger || request.channel.logger;

    assert(typeof endpoint === 'string', 'send requires endpoint');
    assert(typeof request.serviceName === 'string' &&
        request.serviceName !== '',
        'req.serviceName must be a string');

    var stringifyResult = self._stringify({
        head: outHead,
        body: outBody,
        endpoint: endpoint,
        direction: 'out.request'
    });
    if (stringifyResult.err) {
        return callback(stringifyResult.err);
    }

    // Punch as=thrift into the transport headers
    request.headers.as = 'thrift';

    request.send(
        endpoint,
        stringifyResult.value.head,
        stringifyResult.value.body,
        handleResponse
    );

    function handleResponse(err, res, arg2, arg3) {
        if (err) {
            return callback(err);
        }

        var parseResult = self._parse({
            head: arg2,
            body: arg3,
            ok: res.ok,
            endpoint: endpoint,
            direction: 'in.response'
        });

        if (parseResult.err) {
            return callback(parseResult.err);
        }

        var v = parseResult.value;
        var resp = new TChannelThriftResponse(res, v);

        callback(null, resp);
    }
};

function TChannelThriftResponse(response, parseResult) {
    var self = this;

    self.ok = response.ok;
    self.head = parseResult.head;
    self.body = null;
    self.headers = response.headers;
    self.body = parseResult.body;
    self.typeName = parseResult.typeName;
}

TChannelAsThrift.prototype._parse = function parse(opts) {
    var self = this;
    var spec = opts.spec || self.spec;

    var argsName = opts.endpoint + '_args';
    var argsType = spec.getType(argsName);

    var returnName = opts.endpoint + '_result';
    var resultType = spec.getType(returnName);

    var headRes = bufrw.fromBufferResult(HeaderRW, opts.head);
    if (headRes.err) {
        var headParseErr = errors.ThriftHeadParserError(headRes.err, {
            endpoint: opts.endpoint,
            direction: opts.direction,
            ok: opts.ok,
            headBuf: opts.head.slice(0, 10)
        });

        if (self.logParseFailures) {
            self.logger.warn('Got unexpected invalid thrift arg2', {
                endpoint: opts.endpoint,
                direction: opts.direction,
                ok: opts.ok,
                headErr: headParseErr
            });
        }

        return new Result(headParseErr);
    }

    var bodyRes;
    var typeName;
    if (opts.direction === 'in.request') {
        bodyRes = argsType.fromBufferResult(opts.body);
    } else if (opts.direction === 'in.response') {
        bodyRes = resultType.fromBufferResult(opts.body);

        if (bodyRes.value && opts.ok) {
            bodyRes.value = bodyRes.value.success;
        } else if (bodyRes.value && !opts.ok) {
            typeName = onlyKey(bodyRes.value);
            bodyRes.value = bodyRes.value[typeName];
        }
    }

    if (bodyRes.err) {
        var bodyParseErr = errors.ThriftBodyParserError(bodyRes.err, {
            endpoint: opts.endpoint,
            direction: opts.direction,
            ok: opts.ok,
            bodyBuf: opts.body.slice(0, 10)
        });

        if (self.logParseFailures) {
            self.logger.warn('Got unexpected invalid thrift for arg3', {
                endpoint: opts.endpoint,
                ok: opts.ok,
                direction: opts.direction,
                bodyErr: bodyParseErr
            });
        }

        return new Result(bodyParseErr);
    }

    return new Result(null, {
        head: headRes.value,
        body: bodyRes.value,
        typeName: typeName
    });
};

TChannelAsThrift.prototype._stringify = function stringify(opts) {
    var self = this;
    var spec = opts.spec || self.spec;

    var argsName = opts.endpoint + '_args';
    var argsType = spec.getType(argsName);

    var returnName = opts.endpoint + '_result';
    var resultType = spec.getType(returnName);

    opts.head = opts.head || {};

    var headRes = bufrw.toBufferResult(HeaderRW, opts.head);
    if (headRes.err) {
        var headStringifyErr = errors.ThriftHeadStringifyError(headRes.err, {
            endpoint: opts.endpoint,
            ok: opts.ok,
            direction: opts.direction,
            head: opts.head
        });

        self.logger.error('Got unexpected unserializable thrift for arg2', {
            endpoint: opts.endpoint,
            ok: opts.ok,
            direction: opts.direction,
            headErr: headStringifyErr
        });
        return new Result(headStringifyErr);
    }

    var bodyRes;
    if (opts.direction === 'out.request') {
        bodyRes = argsType.toBufferResult(opts.body);
    } else if (opts.direction === 'out.response') {
        var thriftResult = {};
        if (!opts.ok) {
            thriftResult[opts.typeName] = opts.body;
        } else {
            thriftResult.success = opts.body;
        }

        bodyRes = resultType.toBufferResult(thriftResult);
    }

    if (bodyRes.err) {
        var bodyStringifyErr = errors.ThriftBodyStringifyError(bodyRes.err, {
            endpoint: opts.endpoint,
            ok: opts.ok,
            direction: opts.direction,
            body: opts.body
        });

        self.logger.error('Got unexpected unserializable thrift for arg3', {
            endpoint: opts.endpoint,
            direction: opts.direction,
            ok: opts.ok,
            bodyErr: bodyStringifyErr
        });
        return new Result(bodyStringifyErr);
    }

    return new Result(null, {
        head: headRes.value,
        body: bodyRes.value
    });
};

// TODO proper Thriftify result union that reifies as the selected field.
function onlyKey(object) {
    for (var name in object) {
        if (object[name] !== null) {
            return name;
        }
    }
}

function isError(err) {
    return Object.prototype.toString.call(err) === '[object Error]';
}


text:
---
title: 'Rasa NLU Integration'
excerpt: 'Turn raw text into structured meaning with the Jovo Framework integration for the open source natural language understanding service Rasa NLU.'
---

# Rasa NLU Integration

Turn raw text into structured meaning with the Jovo Framework integration for the open source natural language understanding service Rasa NLU.

## Introduction

[Rasa NLU](https://github.com/RasaHQ/rasa) is an open source [natural language understanding (NLU)](https://www.jovo.tech/marketplace/tag/nlu) service with its own pipeline of processing components.

Since it is an open source service, you can host Rasa NLU on your own servers without any external API calls. [Learn more in the official Rasa docs](https://rasa.com/docs/rasa/nlu-only).

You can use the Jovo Rasa NLU integration for projects where you receive raw text input that needs to be translated into structured meaning to work with the Jovo intent structure. Platforms like the [Jovo Core Platform](https://www.jovo.tech/marketplace/jovo-platform-core) (e.g. in conjunction with the [Jovo Web Client](https://www.jovo.tech/marketplace/jovo-client-web)), [Facebook Messenger](https://www.jovo.tech/marketplace/jovo-platform-facebookmessenger), and [Google Business Messages](https://www.jovo.tech/marketplace/jovo-platform-googlebusiness) are some examples where this would work.

## Installation

You can install the plugin like this:

```sh
$ npm install @jovotech/nlu-rasa
```

NLU plugins can be added to Jovo platform integrations. Here is an example how it can be added to the Jovo Core Platform in `app.ts`:

```typescript
import { CorePlatform } from '@jovotech/platform-core';
import { RasaNlu } from '@jovotech/nlu-rasa';

// ...

const app = new App({
  plugins: [
    new CorePlatform({
      plugins: [new RasaNlu()],
    }),
    // ...
  ],
});
```

## Configuration

The following configurations can be added:

```typescript
new RasaNlu({
  serverUrl: 'http://localhost:5005',
  serverPath: '/model/parse',
  alternativeIntents: {
    maxAlternatives: 15,
    confidenceCutoff: 0.0,
  };
}),
```

- `serverUrl`: Where your Rasa NLU server can be reached. Default: `http://localhost:5005`.
- `serverPath`: The endpoint that gets called by the integration. Default: `/model/parse`.
- `alternativeIntents`: [Learn more below](#alternative-intents).

### Alternative Intents

For each request, Rasa NLU provides a list of intents that potentially match the input, ranked by a confidence score. By default, the Jovo Rasa NLU integration uses the highest ranked intent for routing.

You can, however, access the other ranked intents as an array called `alternativeIntents` by configuring the following:

```typescript
new RasaNlu({
  // ...
  alternativeIntents: {
    maxAlternatives: 15,
    confidenceCutoff: 0.0,
  };
}),
```

`alternativeIntents` includes these properties:

- `maxAlternatives`: The amount of alternative intents that should be added to the array.
- `confidenceCutoff`: Only add intents that are above this confidence level.

You can access the `alternativeIntents` array like this:

```typescript
this.$input.nlu.alternativeIntents;
```

Since the `alternativeIntents` is specific to the `RasaNluData` type, you can do type casting like this:

```typescript
const alternativeIntents = (this.$input.nlu as RasaNluData | undefined)?.alternativeIntents;
```

## Entities

You can access Rasa entities by using the `$entities` property. You can learn more in the [Jovo Model](https://www.jovo.tech/docs/models) and the [`$entities` documentation](https://www.jovo.tech/docs/entities).

The Rasa entity values are translated into the following Jovo entity properties:

```typescript
{
  value: value, // what the user said
  resolved: entity, // the resolved value
  id: entity, // same as resolved, since Rasa doesn't support IDs
  native: { /* raw API response for this entity */ }
}
```

Learn more about Rasa entities in the [official Rasa docs](https://rasa.com/docs/rasa/training-data-format#entities).

## Jovo Model

You can use the [Jovo Model](https://www.jovo.tech/marketplace/jovo-model) to turn the language model files in your `models` folder into Rasa NLU training data. [Learn more about the Rasa Jovo Model integration here](https://www.jovo.tech/marketplace/nlu-rasa/model).

redpajama_set_name: RedPajamaGithub


text:
angular
  .module('app')
  .factory('AuthService', ['Reviewer', '$q', '$rootScope', function(User, $q,
      $rootScope) {
    function login(email, password) {
      return User
        .login({email: email, password: password})
        .$promise
        .then(function(response) {
          $rootScope.currentUser = {
            id: response.user.id,
            tokenId: response.id,
            email: email
          };
        });
    }

    function logout() {
      return User
       .logout()
       .$promise
       .then(function() {
         $rootScope.currentUser = null;
       });
    }

    function register(email, password) {
      return User
        .create({
         email: email,
         password: password
       })
       .$promise;
    }

    return {
      login: login,
      logout: logout,
      register: register
    };
  }]);


text:
from __future__ import print_function
import os
import sys
if __name__ == '__main__':
    me = __file__
    path = os.path.realpath(me)
    sys.path.append(os.path.dirname(os.path.dirname(path)))
os.environ['DJANGO_SETTINGS_MODULE'] = 'astrometry.net.settings'
import settings
from astrometry.net.models import *
from astrometry.util.file import *

if __name__ == '__main__':
    cfs = CachedFile.objects.all()
    print('Total of', cfs.count(), 'files cached')
    nbytes = 0
    for cf in cfs:
        df = cf.disk_file
        path = df.get_path()
        sz = file_size(path)
        print('  %-32s' % cf.key, '=>', path, '  (size: %i bytes)' % sz)
        nbytes += sz
    print('Total of', nbytes, 'bytes')


text:
import * as React from 'react';
import Dropdown from '..';
import { dropdownTestkitFactory } from '../../../testkit';
import { dropdownTestkitFactory as dropdownEnzymeTestkitFactory } from '../../../testkit/enzyme';
import { dropdownTestkitFactory as dropdownPuppeteerTestkitFactory } from '../../../testkit/puppeteer';
import * as enzyme from 'enzyme';
import * as puppeteer from 'puppeteer';

function DropdownWithMandatoryProps() {
  return <Dropdown />;
}

function ShouldHaveControlledProps() {
  return <Dropdown selectedId="1" />;
}

function ShouldHaveUncontrolledProps() {
  return <Dropdown initialSelectedId="1" />;
}

function DropdownWithInputWithOptionsProps() {
  return (
    <Dropdown
      ariaControls="label"
      ariaDescribedby="label"
      ariaLabel="text"
      autoFocus
      autoSelect
      autocomplete="off"
      className="cls"
      clearButton
      customInput={<span />}
      dataHook="hook"
      defaultValue="value"
      disableEditing
      disabled
      forceFocus
      forceHover
      hideStatusSuffix
      id="1"
      max={10}
      maxLength={100}
      menuArrow
      min={5}
      name="name"
      noLeftBorderRadius
      noRightBorderRadius
      onBlur={_ev => {}}
      onChange={_ev => {}}
      onClear={_ev => {}}
      popoverProps={{
        excludeClass: 'cls',
        onMouseEnter: () => {},
        onMouseLeave: () => {},
        flip: true,
        fixed: true,
        moveBy: { x: 1, y: 0 },
        hideDelay: 10,
        showDelay: 1,
        moveArrowTo: 1,
        timeout: 1,
        zIndex: 1,
        dynamicWidth: true,
        minWidth: '10px',
        maxWidth: '11px',
      }}
      onCompositionChange={_isComposing => {}}
      onEnterPressed={_ev => {}}
      onEscapePressed={_ev => {}}
      onFocus={_ev => {}}
      onInputClicked={_ev => {}}
      onKeyDown={_ev => {}}
      onKeyUp={_ev => {}}
      onPaste={_ev => {}}
      placeholder="placeholder"
      prefix={<div />}
      readOnly
      ref={React.createRef()}
      required
      roundInput
      rtl
      size="large"
      status="error"
      statusMessage="msg"
      step={1}
      suffix={<div />}
      tabIndex={0}
      textOverflow="clip"
      tooltipPlacement="bottom"
      type="text"
      value="value"
      withSelection
      closeOnSelect
      dropDirectionUp
      fixedFooter={<div />}
      fixedHeader={<div />}
      focusOnSelectedOption
      hasMore
      inContainer
      infiniteScroll
      itemHeight="big"
      loadMore={_page => {}}
      markedOption="1"
      maxHeightPixels={200}
      minWidthPixels={100}
      onClickOutside={_ev => {}}
      onClose={() => {}}
      onMouseEnter={_ev => {}}
      onMouseLeave={_ev => {}}
      onOptionMarked={_opt => {}}
      onSelect={(_opt, _samePicked) => {}}
      selectedHighlight
      selectedId="1"
      visible
      withArrow
      overflow="scroll"
      options={[
        {
          value: 'a',
          id: 0,
          disabled: true,
          linkTo: 'google.com',
          title: true,
          overrideStyle: true,
        },
        {
          value: <div />,
          id: 1,
          disabled: true,
          linkTo: 'google.com',
          title: true,
          overrideStyle: true,
        },
        { value: '-', id: '2' },
        {
          value: ({ selected, disabled, hovered }) => <div />,
          id: 3,
          disabled: true,
          linkTo: 'google.com',
          title: true,
          overrideStyle: true,
        },
      ]}
    />
  );
}

function ShouldHaveRefMethods() {
  const instance = new Dropdown({});
  instance.focus({ preventScroll: true });
  instance.blur();
  instance.select();
}

async function testkits() {
  const testkit = dropdownTestkitFactory({
    dataHook: 'hook',
    wrapper: document.createElement('div'),
  });

  const enzymeTestkit = dropdownEnzymeTestkitFactory({
    dataHook: 'hook',
    wrapper: enzyme.mount(<div />),
  });

  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  const puppeteerTestkit = await dropdownPuppeteerTestkitFactory({
    dataHook: 'hook',
    page,
  });
}


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

<title>Serialized Form</title>
<meta name="date" content="2015-05-03">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Serialized Form

Package br.com.furb.editorgrafico.frame

Class br.com.furb.editorgrafico.frame.Frame extends javax.swing.JFrame implements Serializable

serialVersionUID:

1L

Serialized Fields

janelaLargura

int janelaLargura

janelaAltura

int janelaAltura

Package br.com.furb.editorgrafico.objetos

Class br.com.furb.editorgrafico.objetos.Mundo extends javax.media.opengl.GLCanvas implements Serializable

serialVersionUID:

1L

Serialized Fields

gl

javax.media.opengl.GL gl

glu

javax.media.opengl.glu.GLU glu

glDrawable

javax.media.opengl.GLAutoDrawable glDrawable

objetos

java.util.List<E> objetos

camera

Camera camera

estado

Estado estado

pontoEmEdicao

Ponto pontoEmEdicao

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
exports = module.exports = function(message) {
    return function(req, res) {
        message.create(req.body, function(err, result) {
            if (err) return res.send(400, err);
            res.send(201, result);
        });
    };
};


text:
swift anagrams.swift rats | diff ../test/rats_heap_expected - && \
swift animals.swift && \
swift array_and_function_chaining.swift && \
swift array_example.swift && \
swift binary_tree.swift && \
swift chaining.swift && \
swift circle.swift && \
swift classes_passed_by_reference.swift && \
swift closure_expressions.swift && \
swift closure_styles.swift && \
swift coalesce.swift && \
swift custom_operator_example.swift && \
swift dictionary_example.swift && \
swift external_names.swift && \
swift generic_pair_example.swift && \
swift int_extensions.swift && \
swift let_contents_immutable.swift && \
swift median.swift && \
swift overflow.swift && \
swift permutations.swift one two three && \
swift raw_values.swift && \
swift rectangles.swift && \
swift ses.swift && \
swift set_example.swift && \
swift shape_extensions.swift && \
swift simple_protocol.swift && \
swift smart_strings.swift && \
swift string_counting.swift && \
swift string_to_int.swift && \
swift string_to_int_with_guard.swift && \
swift structs_are_copied.swift && \
swift sum_of_even_squares.swift && \
swift throw.swift && \
swift throw_turned_to_nil.swift && \
swift token.swift && \
swift top_ten_scorers.swift < ../test/wnba_input | diff ../test/wnba_expected - && \
swift triple.swift | diff ../test/triple_expected - && \
swift trivial_arc_example.swift && \
swift value_vs_reference.swift && \
swift vectors.swift && \
swift wordcount.swift < ../test/wordcount_input | diff ../test/word_and_number_count_expected -

if [ $? -ne 0 ]; then
    echo
    echo "*** SWIFT TESTS FAILED ***"
    exit 1
else
    echo
    echo "SWIFT TESTS PASSED"
fi


text:
void Assert::reportVals( char const* loc, char const* func, char const* vals )
{
    std::cout << loc << " failed in function\n" << func << "\n";

    if ( vals )
        std::cout << "with values " << vals;

    std::cout << std::endl;
}

void Assert::reportValsAndDie( char const* loc, char const* func, char const* vals )
{
    reportVals(loc,func,vals);
    CRD::exit(1);
}


text:
an unsupported attribute

all supported attributes

all supported attrributes in a different order


text:
{% extends "withnav_template.html" %}
{% from "components/ajax-block.html" import ajax_block %}
{% from "components/message-count-label.html" import message_count_label, recipient_count_label %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}

{% block service_page_title %}
  {{ message_count_label(99, message_type, suffix='') | capitalize }}
{% endblock %}

{% block maincolumn_content %}

    {{ message_count_label(99, message_type, suffix='') | capitalize }}

  {% if not message_type == "letter" %}
    {{ ajax_block(
      partials,
      url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status),
      'counts'
    ) }}

    <form
      method="post"
      action="{{ url_for('.view_notifications', service_id=current_service.id, message_type=message_type) }}"
      class="grid-row"
    >

        {{ textbox(
          search_form.to,
          width='1-1',
          label='Search by {}'.format('email address' if message_type == 'email' else 'phone number')
        ) }}

        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <input type="submit" class="button" value="Search">

    </form>

    <form id="search-form" method="post">
      <input type="hidden" name="to" value="{{ search_form.to.data }}">
      <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
    </form>
  {% else %}
    <form id="search-form" method="post">
      <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
    </form>
  {% endif %}
  {{ ajax_block(
    partials,
    url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status, page=page),
    'notifications',
    form='search-form'
  ) }}

{% endblock %}


text:
package org.osgi.service.dal.functions;

import org.osgi.service.dal.DeviceException;
import org.osgi.service.dal.Function;
import org.osgi.service.dal.functions.data.LevelData;

/**
 * {@code MultiLevelSensor} function provides multi-level sensor monitoring. It
 * reports its state when an important event is available. The eventable state
 * is accessible with {@link #getData()} getter. There are no operations.
 *

 * The sensor type can be:
 *

 *
{@link Types#LIGHT}

 *
{@link Types#TEMPERATURE}

 *
{@link Types#FLOW}

 *
{@link Types#PRESSURE}

 *
{@link Types#HUMIDITY}

 *
{@link Types#GAS}

 *
{@link Types#SMOKE}

 *
{@link Types#DOOR}

 *
{@link Types#WINDOW}

 *
{@link Types#LIQUID}

 *
{@link Types#POWER}

 *
{@link Types#NOISINESS}

 *
{@link Types#RAIN}

 *
other type defined in {@link Types}

 *
custom - vendor specific type

 *

 *
 * @see LevelData
 */
public interface MultiLevelSensor extends Function {

	/**
	 * Specifies the state property name. The eventable property can be read
	 * with {@link #getData()} getter.
	 *
	 * @see LevelData
	 */
	public static final String	PROPERTY_DATA	= "data";

	/**
	 * Returns the {@code MultiLevelSensor} current state. It's a getter method
	 * for {@link #PROPERTY_DATA} property.
	 *
	 * @return The {@code MultiLevelSensor} current state.
	 *
	 * @throws IllegalStateException If this function service object has already
	 *         been unregistered.
	 * @throws DeviceException If an operation error is available.
	 *
	 * @see LevelData
	 */
	public LevelData getData() throws DeviceException;
}


text:
<?php
namespace empire\framework\tests\plugin;

use \PHPUnit_Framework_TestCase;
use empire\framework\plugin\PluginManager;
use empire\framework\util\Path;

/**
 * Test suite for the PluginManager class.
 */
class PluginManagerTest extends PHPUnit_Framework_TestCase {

	/**
	 * The test instance
	 *
	 * @var PluginManager
	 */
	protected $instance;

	/*
	 * (non-PHPdoc) @see PHPUnit_Framework_TestCase::setUp()
	 */
	protected function setUp() {
		$this->instance = new PluginManager(__DIR__ . DIRECTORY_SEPARATOR . 'plg', __NAMESPACE__ . '\\plg');
	}

	/**
	 * Tests getting plugins.
	 *
	 * @covers empire\framework\plugin\PluginManager::getPlugins
	 */
	public function testGetPlugins() {
		$expected = array('Echo', 'Print');
		$this->assertEquals($expected, $this->instance->getPlugins());
	}

	/**
	 * Tests whether a plugin exists.
	 *
	 * @covers empire\framework\plugin\PluginManager::pluginExists
	 */
	public function testPluginExists() {
		$this->assertTrue($this->instance->pluginExists('Echo'));
		$this->assertTrue($this->instance->pluginExists('echo'));
		$this->assertFalse($this->instance->pluginExists('nonexistant'));
	}

	/**
	 * Tests registering plugins.
	 *
	 * @covers empire\framework\plugin\PluginManager::registerPlugin
	 */
	public function testRegisterPlugin() {
		$this->instance->registerPlugin('Echo');
		$expected = array('Echo');
		$this->assertSame($expected, $this->instance->getRegisteredPlugins());
	}

	/**
	 * Tests getting registered plugins.
	 *
	 * @covers empire\framework\plugin\PluginManager::getRegisteredPlugins
	 */
	public function testGetRegisteredPlugins() {
		$this->instance->registerPlugin('Echo');
		$expected = array('Echo');
		$this->assertSame($expected, $this->instance->getRegisteredPlugins());
	}

}
?>


text:
import { WindowLocation } from "@reach/router";
import { Link } from "gatsby";
import React from "react";
import { useKnowledgeNetworkQuery } from "../tags";

type RelatedListProps = {
	location: WindowLocation;
	title?: string;
	tags?: string[];
};

const RelatedList: React.FC<RelatedListProps> = ({ location, title, tags }) => {
	const related = useKnowledgeNetworkQuery(location.pathname, tags);
	return (
		<>
			{/* Related - Articles */}
			{!!related.articles?.length && (

Deeper Knowledge on {title}

					{related.articles.map((article) => (

							<Link to={article.fields.slug}>

{article.frontmatter.title}

							</Link>

{article.frontmatter.description || article.excerpt}

					))}

			)}
			{/* Related - Tags */}
			{!!related.tags?.length && (

Broader Topics Related to {title}

					{related.tags.map((article) => (

							<Link to={article.fields.slug}>

{article.frontmatter.title}

							</Link>

{article.frontmatter.description || article.excerpt}

					))}

			)}
		</>
	);
};

export default RelatedList;


text:
import { Fragment, MouseEvent, MutableRefObject, RefObject, useEffect, useRef, useState } from 'react';
import * as React from 'react';

import { c, msgid } from 'ttag';

import {
    AddressesAutocomplete,
    Button,
    Icon,
    Tooltip,
    classnames,
    useContactEmails,
    useContactGroups,
    useNotifications,
} from '@proton/components';
import { Recipient } from '@proton/shared/lib/interfaces/Address';
import { ContactEmail } from '@proton/shared/lib/interfaces/contacts';
import noop from '@proton/utils/noop';

import { getRecipientOrGroupKey, recipientsWithoutGroup } from '../../../helpers/addresses';
import { useContactsMap, useGroupsWithContactsMap } from '../../../hooks/contact/useContacts';
import { useRecipientLabel } from '../../../hooks/contact/useRecipientLabel';
import { useAddressesInputDrag } from '../../../hooks/useAddressesInputDrag';
import { MessageSendInfo } from '../../../hooks/useSendInfo';
import { RecipientGroup } from '../../../models/address';
import AddressesGroupItem from './AddressesGroupItem';
import AddressesRecipientItem from './AddressesRecipientItem';

interface Props {
    id: string;
    recipients?: Recipient[];
    messageSendInfo?: MessageSendInfo;
    onChange: (value: Recipient[]) => void;
    inputFocusRef?: MutableRefObject<() => void>;
    placeholder?: string;
    expanded?: boolean;
    dataTestId?: string;
    addContactButton?: string;
    addContactAction?: () => void;
    classname?: string;
    hasLighterFieldDesign?: boolean;
    anchorRef: RefObject<HTMLElement>;
}

const AddressesInput = ({
    id,
    recipients = [],
    messageSendInfo,
    onChange,
    inputFocusRef,
    placeholder,
    expanded = false,
    dataTestId,
    addContactButton,
    addContactAction,
    classname,
    hasLighterFieldDesign = false,
    anchorRef,
}: Props) => {
    const contactEmailsMap = useContactsMap();
    const groupsWithContactsMap = useGroupsWithContactsMap();

    const { getRecipientsOrGroups } = useRecipientLabel();
    const [contactEmails] = useContactEmails() as [ContactEmail[] | undefined, boolean, any];
    const [contactGroups] = useContactGroups();

    const { createNotification } = useNotifications();

    const inputRef = useRef<HTMLInputElement>(null);

    const [recipientsOrGroups, setRecipientsOrGroups] = useState(() => getRecipientsOrGroups(recipients));

    useEffect(() => setRecipientsOrGroups(getRecipientsOrGroups(recipients)), [recipients]);

    useEffect(() => {
        if (inputFocusRef) {
            inputFocusRef.current = inputRef.current?.focus.bind(inputRef.current) || noop;
        }
    }, []);

    const handleClick = (event: MouseEvent) => {
        if ((event.target as HTMLElement).closest('.stop-propagation')) {
            event.stopPropagation();
            return;
        }

        inputRef.current?.focus();
    };

    const isNonEmptyRecipient = ({ Address }: Recipient) => {
        return Address.trim();
    };

    const showDuplicateNotif = (addresses: string[]) => {
        const recipents = addresses.length > 1 ? addresses.join(', ') : addresses[0];

        const text = c('Error').ngettext(
            msgid`Removed duplicate recipient: ${recipents}`,
            `Removed duplicate recipients: ${recipents}`,
            addresses.length
        );

        createNotification({
            text,
            type: 'warning',
        });
    };

    const handleAddRecipient = (newRecipients: Recipient[]) => {
        const filteredRecipients = newRecipients.filter(isNonEmptyRecipient);

        const duplicates: Recipient[] = [];

        const dedupRecipients = filteredRecipients.reduce<Recipient[]>((acc, recipient) => {
            if (recipients.some(({ Address }) => Address === recipient.Address)) {
                duplicates.push(recipient);
                return acc;
            }

            return [...acc, recipient];
        }, []);

        if (duplicates.length) {
            showDuplicateNotif(duplicates.map(({ Address }) => Address));
        }

        if (!dedupRecipients.length) {
            return;
        }

        onChange([...recipients, ...dedupRecipients]);
    };

    const handleRecipientRemove = (toRemove: Recipient) => () => {
        onChange(recipients.filter((recipient) => recipient !== toRemove));
        inputRef.current?.focus();
    };

    const handleRecipientChange = (toChange: Recipient) => (value: Recipient) => {
        if (!isNonEmptyRecipient(value)) {
            return handleRecipientRemove(toChange)();
        }

        if (recipients.some(({ Address }) => Address === value.Address)) {
            showDuplicateNotif([value.Address]);
            return handleRecipientRemove(toChange)();
        }

        onChange(recipients.map((recipient) => (recipient === toChange ? value : recipient)));
    };

    const handleGroupChange = (toChange?: RecipientGroup) => (value: RecipientGroup) => {
        onChange([...recipientsWithoutGroup(recipients, toChange?.group?.Path), ...value.recipients]);
    };

    const handleGroupRemove = (toRemove?: RecipientGroup) => () => {
        onChange(recipientsWithoutGroup(recipients, toRemove?.group?.Path));
        inputRef.current?.focus();
    };

    const handleInputKey = (event: React.KeyboardEvent<HTMLInputElement>) => {
        if (event.key === 'Backspace' && event.currentTarget.value.length === 0 && recipientsOrGroups.length > 0) {
            const last = recipientsOrGroups[recipientsOrGroups.length - 1];
            if (last.recipient) {
                handleRecipientRemove(last.recipient)();
            } else {
                handleGroupRemove(last.group)();
            }
        }
    };

    const { draggedRecipient, placeholderPosition, placeholderSize, containerDragHandlers, itemDragHandlers } =
        useAddressesInputDrag(recipientsOrGroups, setRecipientsOrGroups, onChange);

    const dragPlaceholder = (
        <div
            className="composer-addresses-item-drag-placeholder mt0-25 mb0-25 mr0-5 max-w100 no-pointer-events h-custom w-custom"
            style={{
                '--width-custom': `${placeholderSize?.width}px`,
                '--height-custom': `${placeholderSize?.height}px`,
            }}
        />
    );

    return (

                    {recipientsOrGroups.map((recipientOrGroup, index) => (
                        <Fragment key={getRecipientOrGroupKey(recipientOrGroup)}>
                            {index === placeholderPosition && dragPlaceholder}
                            {recipientOrGroup.recipient ? (
                                <AddressesRecipientItem
                                    recipient={recipientOrGroup.recipient}
                                    messageSendInfo={messageSendInfo}
                                    onChange={handleRecipientChange(recipientOrGroup.recipient)}
                                    onRemove={handleRecipientRemove(recipientOrGroup.recipient)}
                                    dragged={draggedRecipient === recipientOrGroup}
                                    {...itemDragHandlers(recipientOrGroup)}
                                />
                            ) : (
                                <AddressesGroupItem
                                    recipientGroup={recipientOrGroup.group as RecipientGroup}
                                    messageSendInfo={messageSendInfo}
                                    onChange={handleGroupChange(recipientOrGroup.group)}
                                    onRemove={handleGroupRemove(recipientOrGroup.group)}
                                    dragged={draggedRecipient === recipientOrGroup}
                                    {...itemDragHandlers(recipientOrGroup)}
                                />
                            )}
                        </Fragment>
                    ))}
                    {placeholderPosition === recipientsOrGroups.length && dragPlaceholder}

                        <AddressesAutocomplete
                            id={id}
                            anchorRef={anchorRef}
                            ref={inputRef}
                            contactEmails={contactEmails}
                            contactGroups={contactGroups}
                            contactEmailsMap={contactEmailsMap}
                            groupsWithContactsMap={groupsWithContactsMap}
                            recipients={recipients}
                            onAddRecipients={handleAddRecipient}
                            onKeyDown={handleInputKey}
                            placeholder={recipients.length > 0 ? '' : placeholder}
                            hasEmailPasting
                            hasAddOnBlur
                            data-testid={dataTestId}
                        />

                {addContactButton ? (

                        <Tooltip title={c('Action').t`Insert contacts`}>
                            <Button
                                type="button"
                                tabIndex={-1}
                                onClick={addContactAction}
                                color="weak"
                                shape="ghost"
                                icon
                                data-testid="composer:to-button"
                            >
                                <Icon name="user-plus" size={16} alt={addContactButton} />
                            </Button>
                        </Tooltip>

                ) : null}

    );
};

export default AddressesInput;


text:
import * as React from 'react';
import { expectType } from '@mui/types';
import MenuItemUnstyled from '@mui/base/MenuItemUnstyled';

const polymorphicComponentTest = () => {
  const CustomComponent: React.FC<{ stringProp: string; numberProp: number }> =
    function CustomComponent() {
      return <div />;
    };

  return (
    <div>
      {/* @ts-expect-error */}
      <MenuItemUnstyled invalidProp={0} />

      <MenuItemUnstyled component="a" href="#" />

      <MenuItemUnstyled component={CustomComponent} stringProp="test" numberProp={0} />
      {/* @ts-expect-error */}
      <MenuItemUnstyled component={CustomComponent} />

      <MenuItemUnstyled
        component="button"
        onClick={(e: React.MouseEvent<HTMLButtonElement>) => e.currentTarget.checkValidity()}
      />

      <MenuItemUnstyled<'button'>
        component="button"
        ref={(elem) => {
          expectType<HTMLButtonElement | null, typeof elem>(elem);
        }}
        onMouseDown={(e) => {
          expectType<React.MouseEvent<HTMLButtonElement, MouseEvent>, typeof e>(e);
          e.currentTarget.checkValidity();
        }}
      />
    </div>
  );
};


text:
<!doctype html>

    <meta charset="utf-8">

    <title>Hello, AMPs</title>
    <link rel="canonical" href="http://example.ampproject.org/article-metadata.html">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

Hello, AMP!bolt


text:
Test metadata gets read and written
--FILE--
<?php
use \Riak\BucketPropertyList;
use \Riak\Object;
include_once "connect.inc";
$client = new \Riak\Connection($host, $port);
$bucket = new \Riak\Bucket($client, "test_bucket");
$props = new BucketPropertyList(3, false);
$bucket->setPropertyList($props);

$obj = new Object("get_test");
try {
    $obj->setContent("test-get plap")
        ->addMetadata("ost", 7);
    $bucket->put($obj);

    $output = $bucket->get("get_test");
    $objs = $output->getObjectList();
    $obj0 = $objs[0];
    $meta0 = $obj0->getMetadataMap();
    if (isset($meta0["ost"]) && $meta0["ost"] == 7) {
        echo "success!";
    } else {
        var_dump($meta0);
    }
} catch (Exception $e) {
    var_dump($e);
}
?>
--EXPECT--
success!


text:
using System;
using System.Linq;
using Solution3;
using Xunit;

namespace research2016Tests
{
	public class Solution3Tests
	{
		[Fact]
		public void WareSalesStats_mean_max_variance_correct()
		{
			Random rng = new Random();
			var stats = new WareSalesStats();
			var items = Enumerable.Range(0, 150).Select(i =>
			{
				var dateStart = new DateTime(2015, 1, 1).AddMilliseconds(rng.NextDouble() * 30 * 24 * 60 * 60 * 10);
				var dateEnd = dateStart.AddMilliseconds(rng.NextDouble() * 10 * 30 * 24 * 60 * 60 * 10);
				return (dateEnd - dateStart).TotalMinutes;
			}).ToList();

			foreach (var item in items)
			{
				stats.AddSale(item);
			}

			double mean = items.Sum() / items.Count;
			var variance = items.Sum(x => Math.Pow(x - mean, 2))/(items.Count - 1);
			var deviation = Math.Sqrt(variance);

			Assert.Equal(Math.Round(items.Average(), 3), Math.Round(stats.Mean, 3));
			Assert.Equal(Math.Round(items.Max(), 3), Math.Round(stats.Max, 3));

			Assert.Equal(Math.Round(variance, 3), Math.Round(stats.Variance, 3));
			Assert.Equal(Math.Round(deviation, 3), Math.Round(stats.Deviation, 3));
		}
	}
}


text:
import React from 'react';
import ReactDOM from 'react-dom';
import { shallow } from 'enzyme';
import { fromJS } from 'immutable';
import { OverviewPanelItemView as OverviewPanelItem } from '../OverviewPanelItem';

it('renders without crashing', () => {
	const props = {
		name: 'i',
		title: 'i',
		toggleItem: () => {},
		selectItem: () => {},
		clearForm: () => {},
		showForm: () => {},
		overview: fromJS({
			root: {
				selected: 'i',
			},
			panels: {
				i: {isExpanded: true}
			},
		}),
	};

	shallow(
		<OverviewPanelItem {...props}><i /></OverviewPanelItem>,
		{context: {}}
	);
});


text:
from sqlalchemy import Column, Integer, MetaData, String, Table

from nova import utils

meta = MetaData()

virtual_interfaces = Table("virtual_interfaces", meta,
                           Column("id", Integer(), primary_key=True,
                                  nullable=False))
uuid_column = Column("uuid", String(36))

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    virtual_interfaces.create_column(uuid_column)

    rows = migrate_engine.execute(virtual_interfaces.select())
    for row in rows:
        vif_uuid = str(utils.gen_uuid())
        migrate_engine.execute(virtual_interfaces.update()\
                .where(virtual_interfaces.c.id == row[0])\
                .values(uuid=vif_uuid))

def downgrade(migrate_engine):
    meta.bind = migrate_engine
    virtual_interfaces.drop_column(uuid_column)


text:
layout: page
title: Creating a Custom Theme for ISESteroids
subheadline: PowerShell
teaser: A Detailed look at ISESteroids Themes and their XML format. Each XML value is explained for easy reference.
categories:
  - powershell
tags:
  - powershell
  - ise
  - theme
image:
  thumb: 2015/05/PoshBlogThumb.PNG
  homepage: 2015/05/ISESteroids.PNG
header:
  image_fullwidth: 2015/05/ISESteroids.PNG
date: "2015-05-29 17:39"
---

I am a big fan of the Powershell ISE, but I have always felt it was lacking. I have never used it exclusively, but it has a set place in my toolset. Recently I was watching a talk by [Dave Wyatt][f14190f1] and saw him using [ISESteroids][06461585]. I was immediately interested and had to try it out. After playing with it I noticed it had additional theming support. I have always been unimpressed with the default ISE theming, so this excited me.

I prefer creating custom themes for my text editors. I am inside a text editor for the vast majority of my day, so even small adjustments can vastly improve my user experience. ISESteroids has really changed the way I look at the ISE. I normally have issues using dark themes with editors like Powershell ISE. I feel dark themes are easier on the eyes, but much of this is ruined when using a dark theme with a white editor. ISESteroids gives me enough control over the interface theme that a dark syntax theme is doable.

  [06461585]: http://www.powertheshell.com/isesteroids/ "ISESteroids"
  [f14190f1]: https://twitter.com/msh_dave "Dave Wyatt"

When exploring the ISESteroids Theme Manager I had issues finding the values I was looking for. If you enable UI Customization it allows you to right click an element and customize the color. This is great in theory, but I could figure out where to click to change a large percentage of the values. I quickly realized that going to the actual xml file and manually editing the values was the way to go. I quickly found that trial and error was needed for finding the correct values to change. This process was actually quite time consuming, so I decided to document the process and share my results so others may have an easier time than I did. It also will make it easier to port some of my other themes over. I will be adding any themes I create to my [Github][f5a331ee].

  [f5a331ee]: https://github.com/gerane "Github"

## Github Gist

If you just need a quick reference I have created a Theme Template Gist/Repo with comments documenting the theme xml. I go into greater detail with screenshots in this post if further documentation is needed. Feel free to Fork and/or Share any themes or theme ideas.

[Click here to go directly to the Gist at the end of this post.](#Gist)

## Getting Started

I have good news and bad news. To make things easier, I used a theme that was almost entirely green and made all changes in red. This gave a nice contrast and lets the changes really stand out. However, it may make your eyes bleed. If you aren't sure where to find your Theme xml files, you can find a link to your theme folder in the theme drop down. You can make changes to your theme and reload it to see the changes. If you do not have a color picker handy, you can just use the built in color picker in ISESteroids.

The default color picker has a nice feature that lets you steal colors from other applications or windows. You can move the color picker window over an application with colors you want. When you have the color picker focused you can move your mouse pointer over a color you want to steal and press <kbd>ctrl</kbd>. This will steal the color under the cursor and insert into the color picker. This is an easy way to get colors from other applications.

## Console Settings

The Console Window has several customizable settings that are different from the Script Panes. You can Share the Font Settings between the Console and the Script Pane by setting the *ShareFontForConsole* setting to True. The following settings allow you to set all of the Console Pane and Script Pane Font Settings if you want them to have different values.

{% highlight xml %}
<!-- Shares Console and Script Pane Settings -->
<ShareFontForConsole>false</ShareFontForConsole>

<!-- Script Pane Font Settings -->
<ScriptPaneFontFamily>ubuntumono-r.ttf#Ubuntu Mono</ScriptPaneFontFamily>
<ScriptPaneFontSize>12</ScriptPaneFontSize>

<!-- Console Pane Font Settings -->
<ConsolePaneFontFamily>sourcecodepro-regular.ttf#Source Code Pro</ConsolePaneFontFamily>
<ConsolePaneFontSize>10</ConsolePaneFontSize>

<!-- Console Pane Background and Text Colors -->
<ConsolePaneForegroundColor>#FFEEEEEC</ConsolePaneForegroundColor>
<ConsolePaneBackgroundColor>#FF212121</ConsolePaneBackgroundColor>

<!-- Script Pane Background Color -->
<ScriptPaneBackgroundColor>#FF212121</ScriptPaneBackgroundColor>
{% endhighlight %}

The Text Error Colors can be set with the following Settings:

{% highlight xml %}
<!-- Sets the Console Text and Text Background Colors for Error Messages -->
<ConsolePaneErrorForegroundColor>#FFEF2929</ConsolePaneErrorForegroundColor>
<ConsolePaneErrorBackgroundColor>#00FFFFFF</ConsolePaneErrorBackgroundColor>

<!-- Sets the Console Text and Text Background Colors for Warning Messages -->
<ConsolePaneWarningForegroundColor>#FFC4A000</ConsolePaneWarningForegroundColor>
<ConsolePaneWarningBackgroundColor>#00FFFFFF</ConsolePaneWarningBackgroundColor>

<!-- Sets the Console Text and Text Background Colors for Verbose Messages -->
<ConsolePaneVerboseForegroundColor>#FF06989A</ConsolePaneVerboseForegroundColor>
<ConsolePaneVerboseBackgroundColor>#00FFFFFF</ConsolePaneVerboseBackgroundColor>
{% endhighlight %}

This image shows Verbose text with *ConsolePaneVerboseForegroundColor* set to Blue and *ConsolePaneVerboseBackgroundColor* Set to Transparent.

![Verbose Text]({{ site.urlimg }}/2015/05/Verbose.PNG)

## Menu Bar Settings

The Menu Header can have normal text or can be set to all caps. To set all caps you can set *CapitalizeMainMenuHeaders* to True.

{% highlight xml %}
<!-- This Sets All Caps for Menu Header -->
<CapitalizeMainMenuHeaders>false</CapitalizeMainMenuHeaders>
{% endhighlight %}

The following image shows the Menu Header with *CapitalizeMainMenuHeaders* set to True.

![Cap Headers]({{ site.urlimg }}/2015/05/CapHeaders.PNG)

#### Menu Bar Colors

You will see a Monochrome setting in several places throughout this XML. This setting acts as a switch between a gradient and a solid color. If *MenuBarMonochrome* is set to *true*, only the first color setting will be used. The following are the settings for the Menu Bar:

{% highlight xml %}
<!-- For Solid Color or Gradient Color Background -->
<MenuBarMonochrome>true</MenuBarMonochrome>

<!-- For Solid Color Background with Monochrome = True -->
<MenuBarColor1>#FF2B8007</MenuBarColor1>

<!-- For Gradient Background Colors if Monochrome = False -->
<MenuBarColor2>#FFE6F0FA</MenuBarColor2>
<MenuBarColor3>#FFE6F0FA</MenuBarColor3>
<MenuBarColor4>#FFDCE6F4</MenuBarColor4>
<MenuBarColor5>#FFE1ECF9</MenuBarColor5>
<MenuBarColor6>#FFF8FAFC</MenuBarColor6>
{% endhighlight %}

#### Solid Menu Bar Color

When *MenuBarMonochrome* is set to *true* the *MenuBarColor1* will determine the color. The image below shows the changes once applied.

![Menu Bar Monochrome]({{ site.urlimg }}/2015/05/MenuBarColor1.PNG)

#### Gradient Colored Menu Bar

If *MenuBarMonochrome* is set to *false* the other colors are applied. If *MenuBarMonochrome* was set to *true* and you just changed *MenuBarColor3* you can see the portion of the gradient that it changes. You can then change one at a time until you get the desired gradient.

![Menu Bar Color 3]({{ site.urlimg }}/2015/05/MenuBarColor3.PNG)

After a few colors are changed you can start to see the gradient take shape.

![Menu Bar Gradient]({{ site.urlimg }}/2015/05/MenuBarColorGradient.PNG)

## Tab Settings

Tabs have a few settings that can be tweaked. One of the first I went hunting for was the square tab option. Here are the settings for Tabs.

For Active Tabs:
{% highlight xml %}
<!-- For Square Tabs -->
<ScriptSquareTabs>true</ScriptSquareTabs>

<!-- For Solid Color or Gradient Color Background -->
<ScriptSelectedMonochrome>false</ScriptSelectedMonochrome>

<!-- For Solid Color Background if Monochrome = True -->
<ScriptSelectedColor1>#FF3BF800</ScriptSelectedColor1>

<!-- For Gradient Background Colors if Monochrome = False -->
<ScriptSelectedColor2>#FFFFFFFF</ScriptSelectedColor2>
<ScriptSelectedColor3>#FFDFE9FC</ScriptSelectedColor3>
<ScriptSelectedColor4>#FFE1EEFC</ScriptSelectedColor4>
{% endhighlight %}

For Inactive Tabs:
{% highlight xml %}
<!-- For Solid Background Color or Gradient Color Background -->
<ScriptUnselectedMonochrome>true</ScriptUnselectedMonochrome>

<!-- For Solid Color Background if Monochrome = True -->
<ScriptUnselectedColor1>#FF0F7102</ScriptUnselectedColor1>

<!-- For Gradient Colors if Monochrome = False -->
<ScriptUnselectedColor2>#FFEBEBEB</ScriptUnselectedColor2>
<ScriptUnselectedColor3>#FFDDDDDD</ScriptUnselectedColor3>
<ScriptUnselectedColor4>#FFCDCDCD</ScriptUnselectedColor4>
{% endhighlight %}

#### Tab Borders

Tabs have a *ScriptSquareTabs* setting that if set to *true* makes the tab square. This can be seen in the following image:

![Square Tab]({{ site.urlimg }}/2015/05/SquareTab.PNG)

#### Active Tab Colors

The Tabs also use a similar Monochrome setting for single color or gradient called *ScriptSelectedMonochrome*. This works the same as the other Elements that use Monochrome.

#### Solid Tab Color

You can also see the solid Tab color in the Square Tab image above. Only the *ScriptSelectedColor1* value applies if *ScriptSelectedMonochrome* is set to *true*.

#### Gradient Tab Color

If *ScriptSelectedMonochrome* is set to *false* the tab will be a gradient. In the example in the image below, *ScriptSelectedColor2* is blue, *ScriptSelectedColor3* is yellow and *ScriptSelectedColor4* is pink. You can see how it makes a crazy Tab color combination.

![Gradient Tab]({{ site.urlimg }}/2015/05/ScriptSelectedColorGradient.PNG)

#### Tab Background Color

The colors for the Tab Background function similar to the other color settings. Here you can find the settings that apply:

{% highlight xml %}
<!-- For Solid Color or Gradient Color Background -->
<EditorTabControlMonochrome>false</EditorTabControlMonochrome>

<!-- For Solid Color Background if Monochrome = True -->
<EditorTabControlColor1>#FF122C09</EditorTabControlColor1>

<!-- For Gradient Colors if Monochrome = False -->
<EditorTabControlColor2>#FF000000</EditorTabControlColor2>

<!-- Border Trim Color -->
<EditorTabControlBackground>#FF273800</EditorTabControlBackground>
{% endhighlight %}

You can the Background with a gradient in the following image:

![Gradient Tab Background]({{ site.urlimg }}/2015/05/EditorTabControl.PNG)

The *EditorTabControlBackground* Setting had a somewhat confusing name. It actually seemed to control the border color of the Editor. You can see the border in the following image:

![Tab Background Border Color]({{ site.urlimg }}/2015/05/EditorTabControlBackground.PNG)

## Toolbar Settings

The Toolbars are the sets of buttons in the Menu Bar. They have several options that can be customized. Here is a list of the Toolbar Options:

{% highlight xml %}
<!-- Color of the Button Groups Background -->
<ToolbarGroupBackground>#27EEF5FD</ToolbarGroupBackground>

<!-- This is the Group Background Color for the Run/Debug Group  -->
<ToolbarGroupBackgroundForRunCode>#90B6FD43</ToolbarGroupBackgroundForRunCode>
<ToolbarGroupBackgroundForDebugger>#00FFB98B</ToolbarGroupBackgroundForDebugger>

<!-- Used for the Arrow in the Group Overflow -->
<ToolbarOverflowButtonBackground>#FF007D11</ToolbarOverflowButtonBackground>

<!-- This is the Button Group Background Color for the Run/Debug Area -->
<ToolbarOverflowButtonBackgroundForRunCode>#FFFF0000</ToolbarOverflowButtonBackgroundForRunCode>
<ToolbarOverflowButtonBackgroundForDebugger>#FFEEF5FD</ToolbarOverflowButtonBackgroundForDebugger>

<!-- This is the Border Color -->
<RunspaceBarBackground>#FF275321</RunspaceBarBackground>
{% endhighlight %}

#### Button Groups

The Button Groups by default have a very light transparent color. This will lighten the default background color and make the buttons easier to see. Here is an image of this:

![Group Background Color]({{ site.urlimg }}/2015/05/ToolbarGroupBackground.PNG)

 You can set *ToolbarGroupBackground* to a full color for a bigger impact. You can see Red in the following image:

![Group Background Color Red]({{ site.urlimg }}/2015/05/ToolbarGroupBackgroundSolid.PNG)

You will notice that there are some Group Button Backgrounds that did not change. The Run Code/Debugger section has its own set of Settings. They work the same way as the other group colors.

#### Overflow Buttons

There are also Overflow Buttons that can be colored. These function the same way as the Button Groups above, but target the Overflow Buttons. You can see them set to Red in the image below:

![Group Overflow Background Color]({{ site.urlimg }}/2015/05/ToolBarOverflowBackground.PNG)

There are also settings for the Code/Debugger section that function the same way. Then the last setting is the *RunspaceBarBackground* that controls the Border Color. You can see what it looks like set to Red in the image below:

![Group Border Color]({{ site.urlimg }}/2015/05/RunSpacebarBackground.PNG)

## Function Bar Settings

This section has Settings for the Search and Function Bar Area under the Menu Bar at the top. Here is a list of the Settings:

{% highlight xml %}
<!-- Function/Search Area Background Color -->
<FunctionComboCollapsedFill>#FFFFFFFF</FunctionComboCollapsedFill>

<!-- Function/Search Area Text Color -->
<FunctionComboForegroundStatic>#FFD3D3D3</FunctionComboForegroundStatic>

<!-- Function/Search Area Dropdown Background Color -->
<FunctionComboExpandedFill>#FFFFFFFF</FunctionComboExpandedFill>

<!-- Function/Search Area Dropdown Text Color -->
<FunctionComboForeground>#FF000000</FunctionComboForeground>
{% endhighlight %}

The Function/Search Bar is colored by *FunctionComboCollapsedFill* and the dropdown for your functions is colored by *FunctionComboExpandedFill*. You can also adjust the Text colors in this section as well. Here is an example of the *FunctionComboCollapsedFill* being set to Red:

![Function Background]({{ site.urlimg }}/2015/05/FunctionComboCollapseFill.PNG)

And here is a *FunctionComboExpandedFill* being set to Red:

![Function Background]({{ site.urlimg }}/2015/05/FunctionComboExpandedFill.PNG)

## Script Restore Settings

These settings control a Script Expander Menu that is normally hidden. This menu is only visible when the Script Pane is hidden. The settings for this section work the same as the other menu settings that use Monochrome. Here are the settings:

{% highlight xml %}
<!-- For Solid Color or Gradient Color Background -->
<ScriptExpanderMonochrome>false</ScriptExpanderMonochrome>

<!-- For Solid Color Background if Monochrome = True -->
<ScriptExpanderColor1>#FFE6F0FA</ScriptExpanderColor1>

<!-- For Gradient Colors if Monochrome = False -->
<ScriptExpanderColor2>#FFE6F0FA</ScriptExpanderColor2>
<ScriptExpanderColor3>#FFE6F0FA</ScriptExpanderColor3>
<ScriptExpanderColor4>#FFDCE6F4</ScriptExpanderColor4>
<ScriptExpanderColor5>#FFE1ECF9</ScriptExpanderColor5>
<ScriptExpanderColor6>#FFF8FAFC</ScriptExpanderColor6>
{% endhighlight %}

Here is an image of the Script Expander with a Red Background:

![Function Background]({{ site.urlimg }}/2015/05/ScriptExpander.PNG)

When the Script Pane is hidden, the Script Expander Menu will be in the location of the Tab Bar.

## Panel Divider Settings

These settings control the colors of the dividers between scripting, terminal, and other panels. They have the same coloring scheme as the other monochrome settings. There are two different sets of settings that control Vertical and Horizontal Splitters. Here are the settings:

For Vertical Dividers:

{% highlight xml %}
<!-- For Solid Color or Gradient Color Background -->
<VerticalSplitterMonochrome>true</VerticalSplitterMonochrome>

<!-- Border Color -->
<VerticalSplitterBorder>#FF808080</VerticalSplitterBorder>

<!-- For Solid Color Background if Monochrome = True -->
<VerticalSplitterColor1>#FFFF0000</VerticalSplitterColor1>

<!-- For Gradient Colors if Monochrome = False -->
<VerticalSplitterColor2>#FFA2CBF3</VerticalSplitterColor2>
<VerticalSplitterColor3>#FFB7CEF5</VerticalSplitterColor3>
<VerticalSplitterColor4>#FFC6D2DE</VerticalSplitterColor4>
{% endhighlight %}

For Horizontal Dividers:

{% highlight xml %}
<!-- For Solid Color or Gradient Color Background -->
<HorizontalSplitterMonochrome>true</HorizontalSplitterMonochrome>

<!-- Border Color -->
<HorizontalSplitterBorder>#FF808080</HorizontalSplitterBorder>

<!-- For Solid Color Background if Monochrome = True -->
<HorizontalSplitterColor1>#FFff0000</HorizontalSplitterColor1>

<!-- For Gradient Colors if Monochrome = False -->
<HorizontalSplitterColor2>#FFA2CBF3</HorizontalSplitterColor2>
<HorizontalSplitterColor3>#FFB7CEF5</HorizontalSplitterColor3>
<HorizontalSplitterColor4>#FFC6D2DE</HorizontalSplitterColor4>
{% endhighlight %}

The picture below shows how the dividers look when Monochrome is set to True and *VerticalSplitterColor1* and *HorizontalSplitterColor1* are set to Red.

![Panel dividers](/images/2015/05/Splitter.PNG)

## Status Bar Settings

The Status Bar is the Bar at the very bottom of the ISE. You can customize the coloring of the Bar and its text. There are also options to customize the hyperlink colors. Here are are settings for the Status Bar:

{% highlight xml %}
<!-- Sets the Default Color of the Status Bar -->
<StatusBarBackgroundInactive>#FF003A12</StatusBarBackgroundInactive>
<!-- The Color of the Status Bar when Powershell is Actively Running -->
<StatusBarBackgroundActive>#FFFF0000</StatusBarBackgroundActive>

<!-- Sets the Color of the Status Bar Text when Powershell is Actively Running -->
<StatusBarForegroundColorActive>#FFFFFFFF</StatusBarForegroundColorActive>
<!-- Set the Default Color of the Status Text -->
<StatusBarForegroundColorInactive>#FFFFFFFF</StatusBarForegroundColorInactive>

<!-- Sets the Default hyperlink Color -->
<StatusBarHyperlinkDefaultColor>#FFF5DEB3</StatusBarHyperlinkDefaultColor>
<!-- Sets the Hover hyperlink Color -->
<StatusBarHyperlinkHoverColor>#FFFAFAD2</StatusBarHyperlinkHoverColor>
<!-- Sets the Underline Preference -->
<StatusBarHyperlinkUnderlineAlways>false</StatusBarHyperlinkUnderlineAlways>
<!-- Sets the Hover Underline Preference -->
<StatusBarHyperlinkUnderlineOnHover>false</StatusBarHyperlinkUnderlineOnHover>
{% endhighlight %}

Here is an image of the Status Bar with *StatusBarBackgroundInactive* color set to Red, *StatusBarForegroundColorInactive* set to White, and *StatusBarHyperlinkDefaultColor* set to a tan shade of yellow:

![Status Bar Background](/images/2015/05/StatusBarBackgroundInactive.PNG)

## Snippet Settings

This controls the name color of a snippet. In the image below, the color of the word BlockComment is controlled by this setting.

{% highlight xml %}
<!-- Snippet Color settings when a Snippet has been added -->
<SnippetHeader>#FFADD8E6</SnippetHeader>
<SnippetDescription>#FFADD8E6</SnippetDescription>
<SnippetBorder>#FFFF0000</SnippetBorder>

<!-- Snippet Font Settings -->
<SnippetFontFamily>Segoe UI</SnippetFontFamily>
<SnippetFontSize>8</SnippetFontSize>

<!-- Color of Snippets when Typed -->
<SnippetInsertionBorder>#FF038567</SnippetInsertionBorder>
<SnippetInsertionFill>#C847E7C1</SnippetInsertionFill>
{% endhighlight %}

The *SnippetHeader*, *SnippetDescription*, and *SnippetBorder* control the color settings for the Snippet Box that opens after inserting a Snippet. In the image you can see the Snippet box with a Red Border and Light Blue Header.

![Snippet Border](\images\2015\05\SnippetBorder.PNG)

When a Snippet text has been typed into the ISE they will be colored to let you know a Snippet can be auto-completed. The *SnippetInsertionBorder* and *SnippetInsertionFill* Settings control these colors. In the image below, you can see the text "func1" has been highlighted. A Red background and blue border were used in this example.

![Insert Snippet](\images\2015\05\SnippetInsert.PNG)

## Gutter Settings

The Gutter can be different colors based on different criteria. If a script is saved or unsaved it can have different colors, but it can also have different colors based on debugging. There are also Gutter settings for colors when there are changes made to the current script. We can also customize the color of the current line Arrow.

{% highlight xml %}
<!-- Script Saved State Gutter Colors -->
<DebuggerMarginUnsavedScript>#FFFF0000</DebuggerMarginUnsavedScript>
<DebuggerMarginSavedScript>#FF083101</DebuggerMarginSavedScript>

<!-- Script Debugger State Colors -->
<DebuggerMarginDebuggerActive>#FFFF6464</DebuggerMarginDebuggerActive>
<DebuggerMarginDebuggerActiveBackground>#FF000000</DebuggerMarginDebuggerActiveBackground>

<!-- Gutter Change Colors -->
<TrackChangesBeforeSave>#FFFF0000</TrackChangesBeforeSave>
<TrackChangesAfterSave>#FF2E8B57</TrackChangesAfterSave>
<TrackRevertedChanges>#FF0000FF</TrackRevertedChanges>

<!-- Current Line Arrow Colors -->
<CurrentLineAdornmentBorder>#FFFF0000</CurrentLineAdornmentBorder>
<CurrentLineAdornmentFill>#FF0BA514</CurrentLineAdornmentFill>
{% endhighlight %}

#### Debugger Margin Colors
Here we can see the Gutter color when *DebuggerMarginSavedScript* is Colored Red

![Debugger Margin Color Active](\images\2015\05\DebuggerMarginActive.PNG)

When the Debugger is active, the Gutter gets a striped pattern. In the next image we see the Gutter with *DebuggerMarginDebuggerActive* colored Red with the Debugger Active.

![Debugger Margin Unsaved](\images\2015\05\DebuggerMarginUnsaved.PNG)

#### File Change Colors

When a file is edited the ISE tracks those changes in the gutter using different colors for changes made before a save, after a save, and any changes reverted. The following image shows the Gutter Colors when something has been added, but not yet saved. In the example the *TrackChangesBeforeSave* has been set to the color Red.

![Changes Before Save](\images\2015\05\ChangesBeforeSave.PNG)

#### Current Line Arrow

The Current Line Arrow can be colored with two different settings. The first determines the background color and the second determines the outline color. This can be seen in the following image.

![Current Line Adornment Border](\images\2015\05\CurrentLineAdornmentBorder.PNG)

## Line Number Settings

Line Numbers have several settings that can change their color depending on certain criteria. These are the settings that control the Line Numbers:

{% highlight xml %}
<!-- Line Number Margin Size -->
<LineNumberMarginSize>10</LineNumberMarginSize>

<!-- Line Number Color -->
<LineNumberMarginForegroundColor>#FFFF0000</LineNumberMarginForegroundColor>

<!-- Selected Line Number Color -->
<LineNumberMarginSelectedForegroundColor>#B4FFA500</LineNumberMarginSelectedForegroundColor>

<!-- Bookmark Color -->
<LineNumberMarginBookmarkColor>#B400DC00</LineNumberMarginBookmarkColor>

<!-- Line Number Function Color -->
<LineNumberMarginFunctionForegroundColor>#FF008000</LineNumberMarginFunctionForegroundColor>

<!-- Current Line Number Color -->
<LineNumberMarginCurrentForegroundColor>#AC28DF02</LineNumberMarginCurrentForegroundColor>

<!-- Line Number Font Type -->
<LineNumberMarginFontFamily>OCR A</LineNumberMarginFontFamily>
{% endhighlight %}

In the previous section, we saw the Track Changes image. In this image the *LineNumberMarginSize* was set to 10. In the Below image the *LineNumberMarginSize* is set to 20. You can see that it has made the margin size much smaller.

![Line Number Margin Size](\images\2015\05\LineNumberMarginSize.PNG)

Functions can be set to always have a unique line number color. In the following image the *LineNumberMarginFuncForegroundColor* is set to Red. This sets the line number to Red if the Line is the start of the Function.

![Line Number Function Foreground](\images\2015\05\LineNumberMarginFuncForegroundColor.PNG)

Here you can see where multiple lines have been selected. The *LineNumberMarginCurrentForegroundColor* has been set to Red. All lines in the selection have had their line numbers set to the color Red.

![Line Number Selected Color](\images\2015\05\LineNumberMarginSelectedForegroundColor.PNG)

The below image shows the *LineNumberMarginForegroundColor* set to Red. This sets the Default Line Number Color.

![Line Number Foreground Color](\images\2015\05\MarginForegroundColor.PNG)

## Function Reference Settings

Function References will show up just above Functions in your scripts. Any time those functions are referenced it will give links to the places referencing them. These settings control the Font and Color settings of those References:

{% highlight xml %}
<!-- Function Reference Font Settings-->
<FunctionReferenceSize>10</FunctionReferenceSize>
<FunctionReferenceFontFamily>DIN</FunctionReferenceFontFamily>

<!-- Function Reference Color Settings -->
<FunctionReferenceInactive>#FFD3D3D3</FunctionReferenceInactive>
<FunctionReferenceActive>#FFFF0000</FunctionReferenceActive>
<FunctionReferenceHoverBackground>#64DCE4EB</FunctionReferenceHoverBackground>
{% endhighlight %}

The following image shows an active Reference with 8 References. The *FunctionReferenceActive* settings is set to the color Red.

![Reference Active](\images\2015\05\FunctionReferenceActive.PNG)

## Collapsed Test Settings

There are several elements of Collapsed Text that can be customized. The following settings control these elements:

{% highlight xml %}
<!-- Collapsed Text Color -->
<CollapsedTextColor>#FFFF0000</CollapsedTextColor>

<!-- Bar in Margin when Hovering -->
<CollapseBarColor>#FFF5DEB3</CollapseBarColor>

<!-- Background of highlighted expandable text -->
<CollapseSelectionBackground>#23FFFFFF</CollapseSelectionBackground>

<!-- Margin Square Color -->
<CollapseSquareBackground>#FFADD8E6</CollapseSquareBackground>
{% endhighlight %}

The *CollapsedTextColor* Setting controls the color of a collapsed block of text as seen below.

![Collapsed Text](\images\2015\05\CollapsedText.PNG)

The following image shows the *CollapseBarSelection* and *CollapseSelectionBackground* Settings. The Brown bar in the margin is the *CollapseBarSelection*. The *CollapseSelectionBackground* is set to Red and sets the color of the background when hovering over text that can be collapsed.

![Collapsed Selection](\images\2015\05\CollapseBarSelection.PNG)

The next image shows the the Square in the margin colored Red. This is set by the *CollapseSquareBackground* Setting.

![Collapsed Square](\images\2015\05\CollpaseSquareBackground.PNG)

## Text Warning Settings

These Settings set the colors of the squiggle lines under issues in your code.

{% highlight xml %}
<!-- Squiggle Colors -->
<SquiggleSyntaxError>#FFFF0000</SquiggleSyntaxError>
<SquiggleMinorWarning>#FF008000</SquiggleMinorWarning>
<SquiggleCriticalWarning>#FF0000FF</SquiggleCriticalWarning>
<SquiggleIncompatibility>#FFFEFF00</SquiggleIncompatibility>
{% endhighlight %}

The following image shows Red colored squiggles caused by a Syntax Error.

![Squiggles](\images\2015\05\Squiggle.PNG)

## Brace Settings

These settings set the background and border of Matching Brackets.

{% highlight xml %}
<!-- Bracket Colors -->
<BraceMatchingFill>#FFF7C96C</BraceMatchingFill>
<BraceMatchingBorder>#FFFFA500</BraceMatchingBorder>
{% endhighlight %}

The following image shows the *BraceMatchingFill* Setting set to the color Red.

![Brace Matching](\images\2015\05\BraceMatchingFill.PNG)

## Selection Settings

The selection colors can be a little confusing at first. There are several settings that control different aspects of Selection Colors. The following are the settings that control these.

{% highlight xml %}
<!-- This is the selection color -->
<ActiveSelection>#FFFF0000</ActiveSelection>

<!-- This is the color when above selection is not focused -->
<InactiveSelection>#FFBFCDDB</InactiveSelection>

<!-- Border Color of Selected Lines -->
<ASTDashLineColor>#FFFFE4B5</ASTDashLineColor>

<!-- Sibling Color Settings -->
<ASTSiblingBorder>#FFF7C93C</ASTSiblingBorder>
<ASTSiblingFill>#C8F0F0E6</ASTSiblingFill>

<!-- Scope Border Settings -->
<ASTScopeBorder>#64FFE4B5</ASTScopeBorder>
<ASTScopeFill>#3CFFB533</ASTScopeFill>

<!-- Pipeline Color Settings -->
<ASTPipelineBorder>#50C8C814</ASTPipelineBorder>
<ASTPipelineFill>#00F0F0E6</ASTPipelineFill>
{% endhighlight %}

#### Highlighted Text

The Actively Selected text is the text you have highlighted. In the following image you can see this set to a transparent shade of red.

![Active Selection](\images\2015\05\activeselection.PNG)

#### Text Section Border

The *ASTDashLineColor* sets the border color of the section of lines or text you have selected. The following image shows this set to Red.

![Dash Line](\images\2015\05\DashLineColor.PNG)

#### Sibling Colors

These are the colors of siblings. Siblings are other instances of the currently selected item. In the image below you can see how multiple instances of $ArchivedOutLogFile have been colored.

![Sibling Color](\images\2015\05\SiblingFillColor.PNG)

#### Scope Colors

The following image shows the *ASTScopeFill* setting set to Red. It is the current Scope of where you cursor is located. In this image you can see it colors the entire block of quoted text.

![Scope Border](\images\2015\05\ScopeBorder.PNG)

#### Pipeline Colors

The *ASTPipelineFill* and *ASTPipelineBorder* set the colors of a selected Pipeline. In the image you can see these set to Red.

![Pipeline Colors](\images\2015\05\PipelineBorderFill.PNG)

## Console Admin Warning Settings

If you right click the left margin in the console, you can turn on *Show Admin Warning*. If this is enabled and the ISE is launched with Admin privileges, there will be a Bar in the left margin letting you know the ISE has been ran as Admin. This is an added visual feature to help notify ensure the user has ran ISE as admin. If ISE is ran as Admin you will also notice the ISE icon is red. Here are the settings:

{% highlight xml %}
<!-- Console Admin Warning Settings -->
<ConsoleAdminWarningColor1>#32FF9600</ConsoleAdminWarningColor1>
<ConsoleAdminWarningColor2>#0047E7C1</ConsoleAdminWarningColor2>
<ConsoleAdminWarningStripeOffset>5</ConsoleAdminWarningStripeOffset>
{% endhighlight %}

The below image shows the Admin Console Warning in the left margin.

![Admin Warnings](/images/2015/05/consoleadmin.PNG)

## Color Picker Palette Settings

The Color Picker has a section of easy to select colors called Palettes. The Palettes in the color picker can be set with the following settings:

{% highlight xml %}
<!-- Color Picker Palette Colors -->
<PaletteColor1>#FFFF0000</PaletteColor1>
<PaletteColor2>#FF00FF00</PaletteColor2>
<PaletteColor3>#FF0000FF</PaletteColor3>
<PaletteColor4>#FFFFFF00</PaletteColor4>
<PaletteColor5>#FFFF00FF</PaletteColor5>
<PaletteColor6>#FFFFFF00</PaletteColor6>
<PaletteColor7>#FF00FFFF</PaletteColor7>
<PaletteColor8>#FFFF00FF</PaletteColor8>
<PaletteColor9>#FF00FFFF</PaletteColor9>
<PaletteColor10>#FF000000</PaletteColor10>
<PaletteColor11>#FF3C3C3C</PaletteColor11>
<PaletteColor12>#FF6E6E6E</PaletteColor12>
<PaletteColor13>#FFC8C8C8</PaletteColor13>
<PaletteColor14>#FFFFFFFF</PaletteColor14>
{% endhighlight %}

The following image shows the palettes on the right side.

![Palettes](\images\2015\05\palettes.PNG)

## Syntax Settings

I wont go in depth on these settings. These you can edit via Tools => Options in the ISE. This is the same editor as in the Default ISE.

{% highlight xml %}
<!-- Text Color Settings -->
<DefaultTextColor>#FF00FF00</DefaultTextColor>
<DefaultTokenColor>#FFF5DEB3</DefaultTokenColor>

<!-- Script Pane Syntax Settings -->
<PowerShellScriptToken>
  <Token Name="Attribute" Color="#FF009F00" />
  <Token Name="Command" Color="#FF00BF00" />
  <Token Name="CommandArgument" Color="#FF00DF00" />
  <Token Name="CommandParameter" Color="#FF00FF00" />
  <Token Name="Comment" Color="#FF007F00" />
  <Token Name="GroupEnd" Color="#FF009F00" />
  <Token Name="GroupStart" Color="#FF00BF00" />
  <Token Name="Keyword" Color="#FF00DF00" />
  <Token Name="LineContinuation" Color="#FF00FF00" />
  <Token Name="LoopLabel" Color="#FF00FF00" />
  <Token Name="Member" Color="#FF00DF00" />
  <Token Name="NewLine" Color="#FF00BF00" />
  <Token Name="Number" Color="#FF009F00" />
  <Token Name="Operator" Color="#FF007F00" />
  <Token Name="Position" Color="#FF009F00" />
  <Token Name="StatementSeparator" Color="#FF00BF00" />
  <Token Name="String" Color="#FF00DF00" />
  <Token Name="Type" Color="#FF00FF00" />
  <Token Name="Unknown" Color="#FF00BF00" />
  <Token Name="Variable" Color="#FF00BF00" />
</PowerShellScriptToken>

<!-- Console Pane Syntax Settings -->
<PowerShellConsoleToken>
  <Token Name="Attribute" Color="#FF00FF00" />
  <Token Name="Command" Color="#FF00DF00" />
  <Token Name="CommandArgument" Color="#FF00BF00" />
  <Token Name="CommandParameter" Color="#FF009F00" />
  <Token Name="Comment" Color="#FF007F00" />
  <Token Name="GroupEnd" Color="#FF009F00" />
  <Token Name="GroupStart" Color="#FF00BF00" />
  <Token Name="Keyword" Color="#FF00DF00" />
  <Token Name="LineContinuation" Color="#FF00FF00" />
  <Token Name="LoopLabel" Color="#FF00DF00" />
  <Token Name="Member" Color="#FF00BF00" />
  <Token Name="NewLine" Color="#FF009F00" />
  <Token Name="Number" Color="#FF009F00" />
  <Token Name="Operator" Color="#FF009F00" />
  <Token Name="Position" Color="#FF00BF00" />
  <Token Name="StatementSeparator" Color="#FF00DF00" />
  <Token Name="String" Color="#FF00FF00" />
  <Token Name="Type" Color="#FF009F00" />
  <Token Name="Unknown" Color="#FF00FF00" />
  <Token Name="Variable" Color="#FF00BF00" />
</PowerShellConsoleToken>

<!-- XML Syntax Settings -->
<XMLToken>
  <Token Name="Comment" Color="#FF006400" />
  <Token Name="CommentDelimiter" Color="#FF008000" />
  <Token Name="ElementName" Color="#FF8B0000" />
  <Token Name="MarkupExtension" Color="#FFFF8C00" />
  <Token Name="Attribute" Color="#FFFF0000" />
  <Token Name="Quote" Color="#FF0000FF" />
  <Token Name="QuotedString" Color="#FF00008B" />
  <Token Name="Tag" Color="#FF00008B" />
  <Token Name="Text" Color="#FF000000" />
  <Token Name="CharacterData" Color="#FF808080" />
</XMLToken>
{% endhighlight %}

## Finished Theme

This is still a work in progress, and I am still making minor tweaks as I go. This theme is based on a Monokai theme and customized in a few areas for personal preference.

![finishedtheme](/images/2015/05/finishedtheme.PNG)

## <a name="Gist"></a>Gist

{% gist gerane/6206dd9755fd365c3887 %}

## Related Posts
{: .t60 }

{% include list-posts.html tag='powershell' %}


text:
import java.util.stream.Stream;

public class Map {
  public static void main(String[] args) {
    // Breakpoint!
    Stream.of(1, 2, 3).map(x -> x * x).toArray();
  }
}


text:
package com.github.pfmiles.minvelocity;

import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;

import com.github.pfmiles.org.apache.velocity.runtime.RuntimeConstants;

/**
 * @author pf-miles
 *
 */
public class ImplHelper {

    // 根据相对路径(name)和当前路径(curPath, 绝对路径形式),算出name对应的绝对路径
    public static String resolveAbsName(String name, String curPath) {
        ArrayList<String> relPath = toPathList(name);
        ArrayList<String> base = toPathList(curPath);
        base.remove(base.size() - 1);// to dir path
        for (String p : relPath) {
            if (".".equals(p)) {
                continue;
            } else if ("..".equals(p)) {
                base.remove(base.size() - 1);
            } else {
                base.add(p);
            }
        }
        StringBuilder sb = new StringBuilder();
        for (String b : base) {
            sb.append("/").append(b);
        }
        return sb.toString();
    }

    public static ArrayList<String> toPathList(String path) {
        String[] ss = path.split("/");
        ArrayList<String> ret = new ArrayList<String>();
        for (String s : ss) {
            if (s != null && !"".equals(s))
                ret.add(s);
        }
        return ret;
    }

    /**
     * 取得目前可用的classloader,用于动态加载资源
     */
    public static ClassLoader getCurrentClsLoader() {
        ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
        if (ctxLoader != null) {
            try {
                ctxLoader.loadClass(ImplHelper.class.getName());
                return ctxLoader;
            } catch (ClassNotFoundException e) {
            }
        }
        return ImplHelper.class.getClassLoader();
    }

    /**
     * 将数据从from中,以bufferSize个字符为缓冲,"流"入to中,并关闭from; 可对总的读取字符数做限制
     *
     * @param from
     *            数据源 into array
     * @param to
     *            目的地
     * @param bufferSize
     *            缓冲大小
     * @param totalSize
     *            总读取字符数限制
     * @throws IOException
     */
    public static void flowing(Reader from, Writer to, int bufferSize, int totalSize) throws IOException {
        if (bufferSize < 1)
            bufferSize = RuntimeConstants.DEFAULT_REFERENCE_RENDERING_BUFFER_SIZE;
        if (totalSize < 1)
            totalSize = RuntimeConstants.DEFAULT_REFERENCE_RENDERING_LIMIT;
        char[] buffer = new char[bufferSize];
        int read = 0;
        for (int i = from.read(buffer); i != -1; i = from.read(buffer)) {
            to.write(buffer, 0, i);
            read += i;
            if (read >= totalSize)
                break;
        }
        from.close();
    }
}


text:
  Dannemarie-sur-Crète est
      une ville située dans le département des Doubs en Franche-Comté. Elle comptait 1 271 habitants en 2008.

La commune offre quelques  aménagements, elle dispose, entre autres, de un terrain de sport.

À Dannemarie-sur-Crète, le prix moyen à l'achat d'un appartement se situe à zero € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 2 124 € du m². À la location la valorisation moyenne se situe à 8,33 € du m² par mois.

À proximité de Dannemarie-sur-Crète sont localisées les villes de
Dannemarie à 0 km, 97 habitants,
Velesmes-Essarts située à 1 km, 311 habitants,
Pouilley-Français située à 1 km, 639 habitants,
Mazerolles-le-Salin à 3 km, 180 habitants,
Corcelles-Ferrières à 4 km, 188 habitants,
Villers-Buzon à 2 km, 254 habitants,
 entre autres. De plus, Dannemarie-sur-Crète est située à seulement douze km de Besançon.

Le parc d'habitations, à Dannemarie-sur-Crète, se décomposait en 2011 en 107 appartements et 371 maisons soit
 un marché relativement équilibré.


text:
import { Log } from './Log.js';
import { OidcClientSettings } from './OidcClientSettings.js';
import { ErrorResponse } from './ErrorResponse.js';
import { SigninRequest } from './SigninRequest.js';
import { SigninResponse } from './SigninResponse.js';
import { SignoutRequest } from './SignoutRequest.js';
import { SignoutResponse } from './SignoutResponse.js';
import { SigninState } from './SigninState.js';
import { State } from './State.js';

export class OidcClient {
    constructor(settings = {}) {
        if (settings instanceof OidcClientSettings) {
            this._settings = settings;
        }
        else {
            this._settings = new OidcClientSettings(settings);
        }
    }

    get _stateStore() {
        return this.settings.stateStore;
    }
    get _validator() {
        return this.settings.validator;
    }
    get _metadataService() {
        return this.settings.metadataService;
    }

    get settings() {
        return this._settings;
    }
    get metadataService() {
        return this._metadataService;
    }

    createSigninRequest({
        response_type, scope, redirect_uri,
        // data was meant to be the place a caller could indicate the data to
        // have round tripped, but people were getting confused, so i added state (since that matches the spec)
        // and so now if data is not passed, but state is then state will be used
        data, state, prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values,
        resource, request, request_uri, response_mode, extraQueryParams, extraTokenParams, request_type, skipUserInfo } = {},
        stateStore
    ) {
        Log.debug("OidcClient.createSigninRequest");

        let client_id = this._settings.client_id;
        response_type = response_type || this._settings.response_type;
        scope = scope || this._settings.scope;
        redirect_uri = redirect_uri || this._settings.redirect_uri;

        // id_token_hint, login_hint aren't allowed on _settings
        prompt = prompt || this._settings.prompt;
        display = display || this._settings.display;
        max_age = max_age || this._settings.max_age;
        ui_locales = ui_locales || this._settings.ui_locales;
        acr_values = acr_values || this._settings.acr_values;
        resource = resource || this._settings.resource;
        response_mode = response_mode || this._settings.response_mode;
        extraQueryParams = extraQueryParams || this._settings.extraQueryParams;
        extraTokenParams = extraTokenParams || this._settings.extraTokenParams;

        let authority = this._settings.authority;

        if (SigninRequest.isCode(response_type) && response_type !== "code") {
            return Promise.reject(new Error("OpenID Connect hybrid flow is not supported"));
        }

        return this._metadataService.getAuthorizationEndpoint().then(url => {
            Log.debug("OidcClient.createSigninRequest: Received authorization endpoint", url);

            let signinRequest = new SigninRequest({
                url,
                client_id,
                redirect_uri,
                response_type,
                scope,
                data: data || state,
                authority,
                prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values,
                resource, request, request_uri, extraQueryParams, extraTokenParams, request_type, response_mode,
                client_secret: this._settings.client_secret,
                skipUserInfo
            });

            var signinState = signinRequest.state;
            stateStore = stateStore || this._stateStore;

            return stateStore.set(signinState.id, signinState.toStorageString()).then(() => {
                return signinRequest;
            });
        });
    }

    readSigninResponseState(url, stateStore, removeState = false) {
        Log.debug("OidcClient.readSigninResponseState");

        let useQuery = this._settings.response_mode === "query" ||
            (!this._settings.response_mode && SigninRequest.isCode(this._settings.response_type));
        let delimiter = useQuery ? "?" : "#";

        var response = new SigninResponse(url, delimiter);

        if (!response.state) {
            Log.error("OidcClient.readSigninResponseState: No state in response");
            return Promise.reject(new Error("No state in response"));
        }

        stateStore = stateStore || this._stateStore;

        var stateApi = removeState ? stateStore.remove.bind(stateStore) : stateStore.get.bind(stateStore);

        return stateApi(response.state).then(storedStateString => {
            if (!storedStateString) {
                Log.error("OidcClient.readSigninResponseState: No matching state found in storage");
                throw new Error("No matching state found in storage");
            }

            let state = SigninState.fromStorageString(storedStateString);
            return {state, response};
        });
    }

    processSigninResponse(url, stateStore) {
        Log.debug("OidcClient.processSigninResponse");

        return this.readSigninResponseState(url, stateStore, true).then(({state, response}) => {
            Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response");
            return this._validator.validateSigninResponse(state, response);
        });
    }

    createSignoutRequest({id_token_hint, data, state, post_logout_redirect_uri, extraQueryParams, request_type } = {},
        stateStore
    ) {
        Log.debug("OidcClient.createSignoutRequest");

        post_logout_redirect_uri = post_logout_redirect_uri || this._settings.post_logout_redirect_uri;
        extraQueryParams = extraQueryParams || this._settings.extraQueryParams;

        return this._metadataService.getEndSessionEndpoint().then(url => {
            if (!url) {
                Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned");
                throw new Error("no end session endpoint");
            }

            Log.debug("OidcClient.createSignoutRequest: Received end session endpoint", url);

            let request = new SignoutRequest({
                url,
                id_token_hint,
                post_logout_redirect_uri,
                data: data || state,
                extraQueryParams,
                request_type
            });

            var signoutState = request.state;
            if (signoutState) {
                Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist");

                stateStore = stateStore || this._stateStore;
                stateStore.set(signoutState.id, signoutState.toStorageString());
            }

            return request;
        });
    }

    readSignoutResponseState(url, stateStore, removeState = false) {
        Log.debug("OidcClient.readSignoutResponseState");

        var response = new SignoutResponse(url);
        if (!response.state) {
            Log.debug("OidcClient.readSignoutResponseState: No state in response");

            if (response.error) {
                Log.warn("OidcClient.readSignoutResponseState: Response was error: ", response.error);
                return Promise.reject(new ErrorResponse(response));
            }

            return Promise.resolve({state: undefined, response});
        }

        var stateKey = response.state;

        stateStore = stateStore || this._stateStore;

        var stateApi = removeState ? stateStore.remove.bind(stateStore) : stateStore.get.bind(stateStore);
        return stateApi(stateKey).then(storedStateString => {
            if (!storedStateString) {
                Log.error("OidcClient.readSignoutResponseState: No matching state found in storage");
                throw new Error("No matching state found in storage");
            }

            let state = State.fromStorageString(storedStateString);

            return {state, response};
        });
    }

    processSignoutResponse(url, stateStore) {
        Log.debug("OidcClient.processSignoutResponse");

        return this.readSignoutResponseState(url, stateStore, true).then(({state, response}) => {
            if (state) {
                Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response");
                return this._validator.validateSignoutResponse(state, response);
            }
            else {
                Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response");
                return response;
            }
        });
    }

    clearStaleState(stateStore) {
        Log.debug("OidcClient.clearStaleState");

        stateStore = stateStore || this._stateStore;

        return State.clearStaleState(stateStore, this.settings.staleStateAge);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool name="fitsSystemWindows">true</bool>
    <dimen name="navigation_drawer_header_margin">16dp</dimen>
    <dimen name="status_bar_kitkat_height">0dp</dimen>
    <dimen name="status_bar_lollipop_height">0dp</dimen>
    <dimen name="status_bar_margin_top">0dp</dimen>
</resources>


text:
<?php
/**
 * Created by PhpStorm.
 * User: eduardojunior
 * Date: 15/01/16
 * Time: 10:52
 */
namespace Escola\View\Helper;

use Zend\View\Helper\AbstractHelper;

/**
 * Helper que exibe se concluinte ou nao
 *
 * @author Eduardo Junior <ej@calangodev.com.br>
 * @category Helper
 * @package View\Helper
 * @version 0.1
 * @example Class Concluinte
 * @copyright Copyright (c) 2015 CalangoDev (http://www.calangodev.com.br)
 */
class Concluinte extends AbstractHelper
{
    public function __invoke($value)
    {
        switch ($value){
            case 0:
                $concluinte = 'Não';
                break;
            default:
                $concluinte = 'Sim';
        }

        return $concluinte;
    }
}