text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Text;
using XHD.Common;
using System.Web.Security;

namespace XHD.CRM.Data
{
    /// <summary>
    /// Personal_Calendar 的摘要说明
    /// </summary>
    public class Personal_Calendar : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpRequest request = context.Request;

            BLL.Personal_Calendar calendar = new BLL.Personal_Calendar();
            Model.Personal_Calendar model = new Model.Personal_Calendar();

            var cookie = context.Request.Cookies[FormsAuthentication.FormsCookieName];
            var ticket = FormsAuthentication.Decrypt(cookie.Value);
            string CoockiesID = ticket.UserData;

            BLL.hr_employee emp = new BLL.hr_employee();
            int emp_id = int.Parse(CoockiesID);
            DataSet dsemp = emp.GetList("id=" + emp_id);
            string empname = dsemp.Tables[0].Rows[0]["name"].ToString();
            string uid = dsemp.Tables[0].Rows[0]["uid"].ToString();

            if (request["Action"] == "get")
            {
                CalendarViewType viewType = (CalendarViewType)Enum.Parse(typeof(CalendarViewType), request["viewtype"]);
                string strshowday = request["showdate"];
                int clientzone = Convert.ToInt32(request["timezone"]);
                int serverzone = GetTimeZone();

                var zonediff = serverzone - clientzone;

                var format = new CalendarViewFormat(viewType, DateTime.Parse(strshowday), DayOfWeek.Monday);

                DataSet ds = calendar.GetList("emp_id=" + emp_id + " and StartTime>='" + format.StartDate.ToString("yyyy-MM-dd HH:mm:ss") + "' and EndTime<='" + format.EndDate.ToString("yyyy-MM-dd HH:mm:ss") + "'");
                string dt = DataToJSON(ds);

                var data = new JsonCalendarViewData(calendar.DataTableToList(ds.Tables[0]), format.StartDate, format.EndDate);
                context.Response.Write("{\"start\":\"\\/Date(" + MilliTimeStamp(format.StartDate) + ")\\/\",\"end\":\"\\/Date(" + MilliTimeStamp(format.EndDate) + ")\\/\",\"error\":null,\"issort\":true,\"events\":[" + dt + "]}");
                //context.Response.Write(dt);
            }

            if (request["Action"] == "quickadd")
            {
                int clientzone = Convert.ToInt32(request["timezone"]);
                int serverzone = GetTimeZone();
                var zonediff = serverzone - clientzone;

                model.Subject = PageValidate.InputText(request["CalendarTitle"], 4000);
                model.StartTime = DateTime.Parse(request["CalendarStartTime"]).AddHours(zonediff);
                model.EndTime = DateTime.Parse(request["CalendarEndTime"]).AddHours(zonediff);
                model.IsAllDayEvent = PageValidate.InputText(request["IsAllDayEvent"], 255) == "1" ? true : false;

                model.CalendarType = 1;
                model.InstanceType = 0;

                model.UPAccount = emp_id.ToString();
                model.UPTime = DateTime.Now;
                model.MasterId = clientzone;

                model.emp_id = emp_id;
                model.Category = emp_id.ToString();

                int n = calendar.Add(model);

                context.Response.Write("{\"IsSuccess\":true,\"Msg\":\"\u64cd\u4f5c\u6210\u529f!\",\"Data\":\"" + n + "\"}");
            }
            if (request["Action"] == "quickupdate")
            {
                string Id = request["calendarId"];

                int clientzone = Convert.ToInt32(request["timezone"]);
                int serverzone = GetTimeZone();
                var zonediff = serverzone - clientzone;

                model.StartTime = DateTime.Parse(request["CalendarStartTime"]).AddHours(zonediff);
                model.EndTime = DateTime.Parse(request["CalendarEndTime"]).AddHours(zonediff);

                model.UPAccount = emp_id.ToString();
                model.UPTime = DateTime.Now;
                model.MasterId = clientzone;

                model.Id = int.Parse(Id);

                calendar.quickUpdate(model);

                context.Response.Write("{IsSuccess:true}");
            }
            if (request["Action"] == "quickdel")
            {
                int id = Convert.ToInt32(request["calendarId"]);
                calendar.Delete(id);

                context.Response.Write("{IsSuccess:true}");
            }
            if (request["Action"] == "form")
            {
                int id = Convert.ToInt32(request["calendarid"]);
                DataSet ds = calendar.GetList("Id=" + id);
                string dt = Common.DataToJson.DataToJSON(ds);
                context.Response.Write(dt);
            }
            if (request["Action"] == "save")
            {
                string Id = request["calendarid"];

                int clientzone = 8;
                int serverzone = GetTimeZone();
                var zonediff = serverzone - clientzone;

                model.StartTime = DateTime.Parse(request["T_starttime"]).AddHours(zonediff);
                model.EndTime = DateTime.Parse(request["T_endtime"]).AddHours(zonediff);

                model.Subject = Common.PageValidate.InputText(request["T_content"], 4000);

                model.emp_id = emp_id;
                model.UPAccount = emp_id.ToString();
                model.UPTime = DateTime.Now;
                model.MasterId = clientzone;
                model.CalendarType = 1;
                model.InstanceType = 0;
                model.IsAllDayEvent = PageValidate.InputText(request["allday"], 255) == "True" ? true : false;

                model.Id = int.Parse(Id);

                calendar.Update(model);

                context.Response.Write("{IsSuccess:true}");
            }
            if (request["Action"] == "Today")
            {
                string starttime = (DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
                DateTime endtime = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " 00:00:00");

                //DataSet ds = calendar.GetList(0, "datediff(day,[StartTime],getdate())=0 and datediff(day,[EndTime],getdate())=0 and emp_id=" + int.Parse(emp_id), "[StartTime] desc");
                //'" + DateTime.Now.ToShortDateString() + " 23:59:50' >= [StartTime] and
                DataSet ds = calendar.GetList(7, "'" + starttime + "' <= [EndTime] and emp_id=" + emp_id, "[StartTime] ");
                context.Response.Write(GetGridJSON.DataTableToJSON(ds.Tables[0]));
            }
        }

        private static string DataToJSON(DataSet ds)
        {
            StringBuilder JsonString = new StringBuilder();
            DataTable dt = ds.Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    JsonString.Append("[");
                    JsonString.Append("\"" + (dt.Rows[i]["Id"].ToString()) + "\",");
                    JsonString.Append("\"" + System.Web.HttpUtility.UrlEncode((dt.Rows[i]["Subject"].ToString())) + "\",");
                    JsonString.Append("\"\\/Date(" + MilliTimeStamp(DateTime.Parse(dt.Rows[i]["StartTime"].ToString())) + ")\\/\",");
                    JsonString.Append("\"\\/Date(" + MilliTimeStamp(DateTime.Parse(dt.Rows[i]["EndTime"].ToString())) + ")\\/\",");
                    JsonString.Append("" + (dt.Rows[i]["IsAllDayEvent"].ToString() == "True" ? 1 : 0) + ",");
                    JsonString.Append("" + (dt.Rows[i]["StartTime"].ToString() == dt.Rows[i]["StartTime"].ToString() ? 0 : 1) + ",");
                    JsonString.Append("" + (dt.Rows[i]["InstanceType"].ToString() == "2" ? 1 : 0) + ",");
                    JsonString.Append("" + (dt.Rows[i]["Category"].ToString() == "4" ? "4" : "3") + ",");
                    //JsonString.Append("3,");
                    JsonString.Append("1,\"" + dt.Rows[i]["companyid"] + "\",\"\"");

                    if (i == dt.Rows.Count - 1)
                    {
                        JsonString.Append("]");
                    }
                    else
                    {
                        JsonString.Append("],");
                    }
                }
                return JsonString.ToString();
            }
            else
            {
                return null;
            }
        }
        private static int GetTimeZone()
        {
            DateTime now = DateTime.Now;
            var utcnow = now.ToUniversalTime();

            var sp = now - utcnow;

            return sp.Hours;
        }
        private static long MilliTimeStamp(DateTime theDate)
        {
            DateTime d1 = new DateTime(1970, 1, 1);
            DateTime d2 = theDate.ToUniversalTime();
            TimeSpan ts = new TimeSpan(d2.Ticks - d1.Ticks);
            return (long)ts.TotalMilliseconds;
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}


text:
// Copyright (c) 2010-2011 Turbulenz Limited
//
//  SceneLoader
//  ===========
//
//  Helper class to load() a scene and wait for its dependencies before complete() is true
//
/*global TurbulenzEngine: false*/
/*global ResourceLoader: false*/
var SceneLoader = (function () {
    function SceneLoader() {
    }
    SceneLoader.prototype.complete = function () {
        if (!this.dependenciesLoaded) {
            if (this.sceneAssetsRequested && 0 === this.textureManager.getNumPendingTextures() && (!this.shaderManager || 0 === this.shaderManager.getNumPendingShaders())) {
                this.dependenciesLoaded = true;
            }
        }
        return this.dependenciesLoaded;
    };

    SceneLoader.prototype.load = function (parameters) {
        var sceneLoader = this;

        this.sceneAssetsRequested = false;

        this.scene = parameters.scene;
        this.assetPath = parameters.assetPath;
        this.textureManager = parameters.textureManager;
        this.shaderManager = parameters.shaderManager;
        this.effectManager = parameters.effectManager;
        this.animationManager = parameters.animationManager;
        this.requestHandler = parameters.requestHandler;

        if (parameters.keepLights !== undefined) {
            this.keepLights = parameters.keepLights;
        }
        if (parameters.keepCameras !== undefined) {
            this.keepCameras = parameters.keepCameras;
        }
        this.preSceneLoadFn = parameters.preSceneLoadFn;
        this.postSceneLoadFn = parameters.postSceneLoadFn;
        this.dependenciesLoaded = false;
        this.sceneLoaded = false;

        if (!parameters.append) {
            this.scene.clear();
        }

        var pathRemapping = this.pathRemapping;
        var requestHandler = this.requestHandler;
        function requestFn(url, onload) {
            requestHandler.request({
                src: (pathRemapping && pathRemapping[url]) || (this.pathPrefix + url),
                onload: onload
            });
        }

        if (parameters.request) {
            this.request = parameters.request;
        } else {
            this.request = requestFn;
        }

        // Create a callback for post scene load
        function loadSceneFinishedFn() {
            if (sceneLoader.postSceneLoadFn) {
                //Add custom logic
                sceneLoader.postSceneLoadFn(sceneLoader.scene);
            }
            sceneLoader.sceneAssetsRequested = true;
        }

        // Callback function to pass to the below request()
        function sceneReceivedFn(text/*, status */ ) {
            var sceneData = JSON.parse(text);

            if (!sceneData) {
                // Doesn't exist, create an empty data object to preload into the scene
                sceneData = {};
            }

            if (parameters.preSceneLoadFn) {
                //Add custom nodes
                parameters.preSceneLoadFn(sceneData);
            }

            // Set a yield callback for loading, for the sample don't do anything special
            function sceneLoadYieldFn(callback) {
                TurbulenzEngine.setTimeout(callback, 0);
            }

            function begetFn(o) {
                /* tslint:disable:no-empty */
                var F = function () {
                };

                /* tslint:enable:no-empty */
                F.prototype = o;
                return new F();
            }

            var loadParameters = begetFn(parameters);

            // Set a sceneLoad callback to load the resource into the scene
            function sceneLoadFn(resolvedData) {
                if (sceneLoader.animationManager) {
                    sceneLoader.animationManager.loadData(resolvedData);
                }

                loadParameters.data = resolvedData;
                loadParameters.yieldFn = sceneLoadYieldFn;
                loadParameters.onload = loadSceneFinishedFn;

                sceneLoader.scene.load(loadParameters);
            }

            // Create a resource loader to resolve any references in the scene data
            var resourceLoader = ResourceLoader.create();
            resourceLoader.resolve({
                data: sceneData,
                request: this.request,
                onload: sceneLoadFn,
                requestHandler: requestHandler
            });
        }

        this.request(parameters.assetPath, sceneReceivedFn);
    };

    SceneLoader.prototype.setPathRemapping = function (prm, assetUrl) {
        this.pathRemapping = prm;
        this.pathPrefix = assetUrl;
    };

    SceneLoader.create = function () {
        var sceneLoader = new SceneLoader();

        sceneLoader.scene = null;
        sceneLoader.assetPath = null;
        sceneLoader.textureManager = null;
        sceneLoader.shaderManager = null;
        sceneLoader.effectManager = null;
        sceneLoader.animationManager = null;
        sceneLoader.preSceneLoadFn = null;
        sceneLoader.postSceneLoadFn = null;
        sceneLoader.dependenciesLoaded = false;
        sceneLoader.sceneAssetsRequested = false;

        sceneLoader.pathPrefix = "";

        return sceneLoader;
    };
    return SceneLoader;
})();

redpajama_set_name: RedPajamaGithub


text:
import sys, codecs, cgi, cgitb, sqlite3, datetime
web_cgi = codecs.getwriter('utf-8')(sys.stdout.buffer)

HEADER = 'Content-Type:text/html;charset=utf-8\n\nCleared'

def main():
    conn = sqlite3.connect('activity.sqlite3')
    c = conn.cursor()
    c.execute('DELETE FROM log;')
    conn.commit()
    c.close()
    conn.close()
    print(HEADER, file=web_cgi)

if __name__ == '__main__':
    main()


text:
const helpers = require('../test/test-helper');
const forwardMessage = require('./forward-message').handler;
const Twilio = require('twilio');

const context = {
  MY_PHONE_NUMBER: 'TwilioNumber'
};
const event = {
  Body: 'Hello',
  From: 'ExternalNumber'
};

beforeAll(() => {
  helpers.setup(context);
});

afterAll(() => {
  helpers.teardown();
});

test('returns a MessagingResponse', done => {
  const callback = (err, result) => {
    expect(result).toBeInstanceOf(Twilio.twiml.MessagingResponse);
    done();
  };

  forwardMessage(context, event, callback);
});

test('forwards the message to the number from the context', done => {
  const callback = (err, result) => {
    expect(result.toString()).toMatch('to="' + context.MY_PHONE_NUMBER + '"');
    done();
  };

  forwardMessage(context, event, callback);
});

test('includes the original From number and Body', done => {
  const callback = (err, result) => {
    expect(result.toString()).toMatch(
      '>From: ' + event.From + '. Body: ' + event.Body + '<'
    );
    done();
  };

  forwardMessage(context, event, callback);
});


text:
Delmo is a tool to test systems running within multiple docker containers.

In particular it is possible to start and stop individual services to test how the system behaves when facing outages. It was written and is still being used to test automatic failover capabilities of a clustered postgresql deployment. It is well suited to run integration tests of any system that runs as collaborating docker containers.

After [installation](#installation) you can run the [example](#examples) to quickly see delmo in action.

## Installation
Find the [latest release](https://github.com/bodymindarts/delmo/releases) and download the binary for your environment.
Alternatively you can follow the [instructions below](#building-delmo) to build it yourself.

## Usage
```
$ delmo -h
USAGE: delmo [--version] [--help] [options] [test...]

OPTIONS:
  -f                    path to the spec file (default: "delmo.yml").
  -m <machine-name>     docker-machine to run the tests on. DOCKER_HOST_IP will
                        be set to the ip returned by 'docker-machine ip <machine>'.
  --localhost <ip>      an IP that DOCKER_HOST_IP will be set to when not using -m.
  --parallel            execute tests in parallel.
  --only-build-task     only build the task_image. All other images must be
                        available via 'docker pull'.
  --skip-pull           don't pull the images before building.
```

Omitting `[test...]` will result in all tests being run.

## Files

For delmo to work 2 files must be provided.

A docker-compose.yml (complete file reference can be found [here](https://docs.docker.com/compose/compose-file/)) that defines the way your containers will start.
```yaml
version: '2'

services:
  tests:
    image: busybox
```
A delmo.yml that defines the tests that will run and the tasks that will be executed during the tests.
```yaml
---
suite:
  name: Webapp                   # Name of the test suite
  system: docker-compose.yml     # Path to a file that docker-compose can read
  task_service: tests            # The name of a service in the docker-compose.yml
                                 # that will be used to execute tasks

tasks:                           # Definition of tasks that can be run during a test.
                                 # These tasks get run by calling
                                 # 'docker-compose run <task_service> <command>'

- name: hello_world              # The name of a task to refer to it in a test.
  command: echo hello world      # The command to run within the <task_service> image.
- name: list_root
  command: ls /
- name: failing_task
  command: exit 1

tests:                           # Definition of tests to run.

- name: example_test             # Name of the test
  before_startup: [hello_world]  # Tasks to run before running 'docker-compose up'
  spec:                          # The steps to be performed during the test
                                 # Before running any steps 'docker-compose up' is run                                 # to start all the defined containers
  - exec:
    - hello_world
    - list_root
  - failing: [failing_task]

```

### Available steps
The `spec` key is an array of hashes that define the steps which should be executed during a test.
The type of step is determined by which keys are present.

| step | meaning |
| ---- | ---- |
| `- assert: [<task>...]` | Array of tasks to run. The test will fail if a task returns a non-0 exit status |
| `- exec: [<task>...]` |  Same as `assert`. Provided for differentiating steps that are preparatory in nature. |
| `- {wait: <task>, timeout: 120}` | A Task to repeat as long as the exit status is non-0. The test fails if the `<task>` doesn't return '0' within `<timeout>` seconds. `timeout:` key is optional, default is 60. |
| `- fail: [<task>...]` | Opposite of assert. These tasks are expected to return non-0. The test fails if a '0' exit status is returned. |
| `- stop: [<service>...]` | An array of service names. The services must be defined in the docker-compose.yml and will be stopped via `docker-compose stop [<service>...]` |
| `- start: [<service>...]` | An array of service names. The services must be defined in the docker-compose.yml and will be started via `docker-compose up [<service>...]` |
| `- destroy: [<service>...]` | An array of service names. The services must be defined in the docker-compose.yml. The containers will be killed and then removed via `docker-compose kill [<service>...] && docker-compose rm -f -v [<service>...]` |

### Examples

An [example](./example/webapp) test suite is configured in `example/webapp/delmo.yml` and can be executed from the repo root via:
```
delmo -f example/webapp/delmo.yml
```

Delmo was originally written to test clustering and automatic failover of postgresql nodes. It is still being used and you can [look here](https://github.com/dingotiles/dingo-postgresql-release/tree/master/images) to see real-world usage of delmo.

## Building delmo

 For local dev first make sure Go is properly installed, including setting up a GOPATH. After setting up Go, clone this repository into $GOPATH/src/github.com/bodymindarts/delmo.

To install dev dependencies:
```
$ make bootstrap
...
```

To see if the tests are working:
```
$ make test
...
```

To build delmo for your environment
```
$ make dev
...
$ bin/delmo help
...
```

For cross compilation run `make build` this will compile delmo for multiple platforms and place the resulting binaries into the ./pkg directory:
```
$ make build
...
```

## Contributing

Any feedback is welcome. Feel free to open issues or PRs.


text:
"""
Tests for ACL. Checks whether certain kinds of requests
are blocked or allowed to be processed.
"""

import mock
from oslo_config import cfg
from six.moves import http_client

from ironic.tests.api import base
from ironic.tests.api import utils
from ironic.tests.db import utils as db_utils

cfg.CONF.import_opt('cache', 'keystonemiddleware.auth_token',
                    group='keystone_authtoken')

class TestACL(base.FunctionalTest):

    def setUp(self):
        super(TestACL, self).setUp()

        self.environ = {'fake.cache': utils.FakeMemcache()}
        self.fake_db_node = db_utils.get_test_node(chassis_id=None)
        self.node_path = '/nodes/%s' % self.fake_db_node['uuid']

    def get_json(self, path, expect_errors=False, headers=None, q=[], **param):
        return super(TestACL, self).get_json(path,
                                             expect_errors=expect_errors,
                                             headers=headers,
                                             q=q,
                                             extra_environ=self.environ,
                                             **param)

    def _make_app(self):
        cfg.CONF.set_override('cache', 'fake.cache',
                              group='keystone_authtoken')
        return super(TestACL, self)._make_app(enable_acl=True)

    def test_non_authenticated(self):
        response = self.get_json(self.node_path, expect_errors=True)
        self.assertEqual(http_client.UNAUTHORIZED, response.status_int)

    def test_authenticated(self):
        with mock.patch.object(self.dbapi, 'get_node_by_uuid',
                               autospec=True) as mock_get_node:
            mock_get_node.return_value = self.fake_db_node

            response = self.get_json(
                self.node_path, headers={'X-Auth-Token': utils.ADMIN_TOKEN})

            self.assertEqual(self.fake_db_node['uuid'], response['uuid'])
            mock_get_node.assert_called_once_with(self.fake_db_node['uuid'])

    def test_non_admin(self):
        response = self.get_json(self.node_path,
                                 headers={'X-Auth-Token': utils.MEMBER_TOKEN},
                                 expect_errors=True)

        self.assertEqual(http_client.FORBIDDEN, response.status_int)

    def test_non_admin_with_admin_header(self):
        response = self.get_json(self.node_path,
                                 headers={'X-Auth-Token': utils.MEMBER_TOKEN,
                                          'X-Roles': 'admin'},
                                 expect_errors=True)

        self.assertEqual(http_client.FORBIDDEN, response.status_int)

    def test_public_api(self):
        # expect_errors should be set to True: If expect_errors is set to False
        # the response gets converted to JSON and we cannot read the response
        # code so easy.
        for route in ('/', '/v1'):
            response = self.get_json(route,
                                     path_prefix='', expect_errors=True)
            self.assertEqual(http_client.OK, response.status_int)

    def test_public_api_with_path_extensions(self):
        routes = {'/v1/': http_client.OK,
                  '/v1.json': http_client.OK,
                  '/v1.xml': http_client.NOT_FOUND}
        for url in routes:
            response = self.get_json(url,
                                     path_prefix='', expect_errors=True)
            self.assertEqual(routes[url], response.status_int)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL.Interfaces;
using Domain.Identity;

namespace DAL.Repositories
{
    public class UserIntRepository : UserRepository<int, RoleInt, UserInt, UserClaimInt, UserLoginInt, UserRoleInt>,
        IUserIntRepository
    {
        public UserIntRepository(IDbContext dbContext) : base(dbContext)
        {
        }
    }

    public class UserRepository : UserRepository<string, Role, User, UserClaim, UserLogin, UserRole>, IUserRepository
    {
        public UserRepository(IDbContext dbContext) : base(dbContext)
        {
        }
    }

    public class UserRepository<TKey, TRole, TUser, TUserClaim, TUserLogin, TUserRole> : EFRepository<TUser>
        where TKey : IEquatable<TKey>
        where TRole : Role<TKey, TRole, TUser, TUserClaim, TUserLogin, TUserRole>
        where TUser : User<TKey, TRole, TUser, TUserClaim, TUserLogin, TUserRole>
        where TUserClaim : UserClaim<TKey, TRole, TUser, TUserClaim, TUserLogin, TUserRole>
        where TUserLogin : UserLogin<TKey, TRole, TUser, TUserClaim, TUserLogin, TUserRole>
        where TUserRole : UserRole<TKey, TRole, TUser, TUserClaim, TUserLogin, TUserRole>
    {
        public UserRepository(IDbContext dbContext)
            : base(dbContext)
        {
        }

        public TUser GetUserByUserName(string userName)
        {
            return DbSet.FirstOrDefault(a => a.UserName.ToUpper() == userName.ToUpper());
        }

        public TUser GetUserByEmail(string email)
        {
            return DbSet.FirstOrDefault(a => a.Email.ToUpper() == email.ToUpper());
        }

        public bool IsInRole(TKey userId, string roleName)
        {
            return DbSet.Find(userId).Roles.Any(a => a.Role.Name == roleName);
        }

        public void AddUserToRole(TKey userId, string roleName)
        {
        }
    }
}


text:
<test>
  <sql>SELECT	e1.FirstName,
		e2.LastName
FROM	Employees e1, Employees e2

UNION	ALL

SELECT	e.FirstName,
		e.LastName
FROM	Employees e
WHERE	LEN(e.FirstName) < 6

ORDER	BY 1, 2</sql>
  <expectedResults>
    <NewDataSet>
  <xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table1" msdata:Locale="en-US">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="FirstName" type="xs:string" minOccurs="0" />
                <xs:element name="LastName" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Andrew</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Anne</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Janet</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Laura</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Margaret</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Michael</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Nancy</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Robert</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Buchanan</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Callahan</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Davolio</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Dodsworth</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Fuller</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>King</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Leverling</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Peacock</LastName>
  </Table1>
  <Table1>
    <FirstName>Steven</FirstName>
    <LastName>Suyama</LastName>
  </Table1>
</NewDataSet>
  </expectedResults>
  <expectedPlan>
    <executionPlan>
      <element operator="Select">
        <properties>
          <property name="Output List.[0]" value="Union1004 AS FirstName" />
          <property name="Output List.[0].Column" value="Union1004" />
          <property name="Output List.[0].DataType" value="String" />
          <property name="Output List.[0].Output Name" value="FirstName" />
          <property name="Output List.[1]" value="Union1005 AS LastName" />
          <property name="Output List.[1].Column" value="Union1005" />
          <property name="Output List.[1].DataType" value="String" />
          <property name="Output List.[1].Output Name" value="LastName" />
        </properties>
        <input>
          <element operator="Sort">
            <properties>
              <property name="Output List.[0]" value="Union1004" />
              <property name="Output List.[0].Column" value="Union1004" />
              <property name="Output List.[0].DataType" value="String" />
              <property name="Output List.[1]" value="Union1005" />
              <property name="Output List.[1].Column" value="Union1005" />
              <property name="Output List.[1].DataType" value="String" />
              <property name="Statistics.Open Count" value="1" />
              <property name="Statistics.Row Count" value="85" />
              <property name="Statistics.Average Row Count" value="85" />
              <property name="Logical Operator" value="Sort" />
              <property name="Order By.[0]" value="Union1004 ASC" />
              <property name="Order By.[0].Column" value="Union1004" />
              <property name="Order By.[0].DataType" value="String" />
              <property name="Order By.[0].Order" value="ASC" />
              <property name="Order By.[1]" value="Union1005 ASC" />
              <property name="Order By.[1].Column" value="Union1005" />
              <property name="Order By.[1].DataType" value="String" />
              <property name="Order By.[1].Order" value="ASC" />
            </properties>
            <input>
              <element operator="Concatenation">
                <properties>
                  <property name="Output List.[0]" value="Union1004" />
                  <property name="Output List.[0].Column" value="Union1004" />
                  <property name="Output List.[0].DataType" value="String" />
                  <property name="Output List.[1]" value="Union1005" />
                  <property name="Output List.[1].Column" value="Union1005" />
                  <property name="Output List.[1].DataType" value="String" />
                  <property name="Statistics.Open Count" value="1" />
                  <property name="Statistics.Row Count" value="85" />
                  <property name="Statistics.Average Row Count" value="85" />
                  <property name="Defined Values.Union1004" value="e1.FirstName; e.FirstName" />
                  <property name="Defined Values.Union1004.[0]" value="e1.FirstName" />
                  <property name="Defined Values.Union1004.[0].Table" value="e1" />
                  <property name="Defined Values.Union1004.[0].Column" value="FirstName" />
                  <property name="Defined Values.Union1004.[0].DataType" value="String" />
                  <property name="Defined Values.Union1004.[1]" value="e.FirstName" />
                  <property name="Defined Values.Union1004.[1].Table" value="e" />
                  <property name="Defined Values.Union1004.[1].Column" value="FirstName" />
                  <property name="Defined Values.Union1004.[1].DataType" value="String" />
                  <property name="Defined Values.Union1005" value="e2.LastName; e.LastName" />
                  <property name="Defined Values.Union1005.[0]" value="e2.LastName" />
                  <property name="Defined Values.Union1005.[0].Table" value="e2" />
                  <property name="Defined Values.Union1005.[0].Column" value="LastName" />
                  <property name="Defined Values.Union1005.[0].DataType" value="String" />
                  <property name="Defined Values.Union1005.[1]" value="e.LastName" />
                  <property name="Defined Values.Union1005.[1].Table" value="e" />
                  <property name="Defined Values.Union1005.[1].Column" value="LastName" />
                  <property name="Defined Values.Union1005.[1].DataType" value="String" />
                </properties>
                <input>
                  <element operator="NestedLoops">
                    <properties>
                      <property name="Output List.[0]" value="e2.LastName" />
                      <property name="Output List.[0].Table" value="e2" />
                      <property name="Output List.[0].Column" value="LastName" />
                      <property name="Output List.[0].DataType" value="String" />
                      <property name="Output List.[1]" value="e1.FirstName" />
                      <property name="Output List.[1].Table" value="e1" />
                      <property name="Output List.[1].Column" value="FirstName" />
                      <property name="Output List.[1].DataType" value="String" />
                      <property name="Logical Operator" value="Inner Join" />
                      <property name="Statistics.Open Count" value="1" />
                      <property name="Statistics.Row Count" value="81" />
                      <property name="Statistics.Average Row Count" value="81" />
                      <property name="Warning" value="No join predicate" />
                    </properties>
                    <input>
                      <element operator="TableScan">
                        <properties>
                          <property name="Table" value="Employees AS e2" />
                          <property name="Output List.[0]" value="e2.LastName" />
                          <property name="Output List.[0].Table" value="e2" />
                          <property name="Output List.[0].Column" value="LastName" />
                          <property name="Output List.[0].DataType" value="String" />
                          <property name="Statistics.Open Count" value="1" />
                          <property name="Statistics.Row Count" value="9" />
                          <property name="Statistics.Average Row Count" value="9" />
                        </properties>
                        <input />
                      </element>
                      <element operator="TableScan">
                        <properties>
                          <property name="Table" value="Employees AS e1" />
                          <property name="Output List.[0]" value="e1.FirstName" />
                          <property name="Output List.[0].Table" value="e1" />
                          <property name="Output List.[0].Column" value="FirstName" />
                          <property name="Output List.[0].DataType" value="String" />
                          <property name="Statistics.Open Count" value="9" />
                          <property name="Statistics.Row Count" value="81" />
                          <property name="Statistics.Average Row Count" value="9" />
                        </properties>
                        <input />
                      </element>
                    </input>
                  </element>
                  <element operator="Filter">
                    <properties>
                      <property name="Output List.[0]" value="e.LastName" />
                      <property name="Output List.[0].Table" value="e" />
                      <property name="Output List.[0].Column" value="LastName" />
                      <property name="Output List.[0].DataType" value="String" />
                      <property name="Output List.[1]" value="e.FirstName" />
                      <property name="Output List.[1].Table" value="e" />
                      <property name="Output List.[1].Column" value="FirstName" />
                      <property name="Output List.[1].DataType" value="String" />
                      <property name="Statistics.Open Count" value="1" />
                      <property name="Statistics.Row Count" value="4" />
                      <property name="Statistics.Average Row Count" value="4" />
                      <property name="Predicate" value="LEN(e.FirstName) < 6" />
                    </properties>
                    <input>
                      <element operator="TableScan">
                        <properties>
                          <property name="Table" value="Employees AS e" />
                          <property name="Output List.[0]" value="e.LastName" />
                          <property name="Output List.[0].Table" value="e" />
                          <property name="Output List.[0].Column" value="LastName" />
                          <property name="Output List.[0].DataType" value="String" />
                          <property name="Output List.[1]" value="e.FirstName" />
                          <property name="Output List.[1].Table" value="e" />
                          <property name="Output List.[1].Column" value="FirstName" />
                          <property name="Output List.[1].DataType" value="String" />
                          <property name="Statistics.Open Count" value="1" />
                          <property name="Statistics.Row Count" value="9" />
                          <property name="Statistics.Average Row Count" value="9" />
                        </properties>
                        <input />
                      </element>
                    </input>
                  </element>
                </input>
              </element>
            </input>
          </element>
        </input>
      </element>
    </executionPlan>
  </expectedPlan>
</test>


text:
<!DOCTYPE html>
<meta charset=utf-8>
<title>invalid src: scheme-http-no-slash-colon</title>
<video src="http::@c:29"></video>


text:
import numpy as np
from numpy.lib.function_base import quantile
import pytest

import elfi
import elfi.examples.ma2 as exma2
from elfi.methods.inference.parameter_inference import ParameterInference

def test_testbenchmethod_init():

    method = elfi.TestbenchMethod(method=elfi.SMC, name="SMC_1")
    method.set_method_kwargs(discrepancy_name='d', batch_size=50)
    method.set_sample_kwargs(n_samples=100, thresholds=[2.0, 1.0], bar=False)
    attr = method.get_method()

    assert attr['name'] == "SMC_1"
    assert attr['method_kwargs']['batch_size'] == 50
    assert attr['sample_kwargs']['n_samples'] == 100

def test_testbench_init_param_reps(ma2):

    testbench = elfi.Testbench(model=ma2,
                               repetitions=5,
                               seed=99,
                               progress_bar=False)

    for _, values in testbench.reference_parameter.items():
        assert values.size == 5

def test_testbench_init_given_params(ma2):

    ref_params = ma2.generate(batch_size=1, outputs=['t1', 't2'])
    testbench = elfi.Testbench(model=ma2,
                               reference_parameter=ref_params,
                               repetitions=5,
                               seed=99,
                               progress_bar=False)

    for _, values in testbench.reference_parameter.items():
        assert np.all(values == values[0])
        assert values.size == 5

def test_testbench_init_obs_reps(ma2):

    testbench = elfi.Testbench(model=ma2,
                               repetitions=5,
                               seed=99,
                               progress_bar=False)

    assert len(testbench.observations) == 5

def test_testbench_init_given_obs(ma2):

    obs = ma2.generate(batch_size=1, outputs=['MA2'])
    testbench = elfi.Testbench(model=ma2,
                               observations=obs,
                               repetitions=5,
                               seed=99,
                               progress_bar=False)

    assert len(testbench.observations) == 5
    assert np.all(
        [a == b for a, b in zip([obs], testbench.observations)]
        )

def test_testbench_execution(ma2):

    method1 = elfi.TestbenchMethod(method=elfi.Rejection, name='Rejection_1')
    method1.set_method_kwargs(discrepancy_name='d', batch_size=500)
    method1.set_sample_kwargs(n_samples=500, bar=False)

    method2 = elfi.TestbenchMethod(method=elfi.Rejection, name='Rejection_2')
    method2.set_method_kwargs(discrepancy_name='d', batch_size=500)
    method2.set_sample_kwargs(n_samples=500, quantile=0.5, bar=False)

    testbench = elfi.Testbench(model=ma2,
                               repetitions=3,
                               seed=156,
                               progress_bar=False)
    testbench.add_method(method1)
    testbench.add_method(method2)

    testbench.run()

    sample_mean_differences = testbench.parameterwise_sample_mean_differences()
    assert len(sample_mean_differences) == 2
    assert len(sample_mean_differences['Rejection_1']) == 2
    assert len(sample_mean_differences['Rejection_1']['t1']) == 3

def test_testbench_seeding(ma2):

    testbench1 = elfi.Testbench(model=ma2,
                                repetitions=2,
                                seed=100,
                                progress_bar=False)

    testbench2 = elfi.Testbench(model=ma2,
                                repetitions=2,
                                seed=100,
                                progress_bar=False)

    assert len(testbench1.observations) == len(testbench2.observations)
    assert np.all(
        [a == b for a, b in zip(testbench1.observations, testbench2.observations)]
        )


text:
import React from 'react'
import Menu from 'react-burger-menu/lib/menus/slide'
// import styles from './Megamenu.css'

// import BurgerMenu from 'react-burger-menu'

const Megamenu = () => (
  <Menu width={'225px'}>

HOME

BIRTHDAY

ANNIVERSARY

MOTHER'S DAY

FLOWERS

PLANTS

GIFTS

BESTSELLERS

OCCASION

SIGN IN

MY CART

MY ACCOUNT

CALL US
  </Menu>
)

export default Megamenu


text:
'use strict';

/* Setup ==================================================================== */
import React, { Component } from 'react'
import {
  StyleSheet,
  View,
  Text,
	Image,
	ActivityIndicator
} from 'react-native'

import { connect } from 'react-redux';
import { Actions } from 'react-native-router-flux';
import { addExercises, fetchExercises } from '../actions/exercises';
import { fetchSets } from '../actions/sets';
import { fetchTrainings } from '../actions/trainings';
import { fetchWorkouts } from '../actions/workouts';
import { getAsyncUser } from '../actions/auth';
import { fetchRecords } from '../actions/records';
import { setLoading } from '../actions/current';
// App Globals
import AppStyles from '../styles'
import AppConfig from '../config'

// Components
import Button from '../components/button'

// Screens
import MainScreen from './mainScreen'

import Spinner from 'react-native-loading-spinner-overlay';

/* Component ==================================================================== */
class Home extends Component {
  constructor(props) {
		super(props);

		this.props.getAsyncUser(this.props.date);

		this.goToNextScreen = this.goToNextScreen.bind(this);
		this.props.fetchExercises();
	}

	goToNextScreen() {
		(!this.props.user) ?
			Actions.logIn() :	Actions.training();
	}

	componentWillReceiveProps(nextProps) {
		nextProps.fetchRecords(nextProps.uid);
	}

	/* Render ==================================================================== */
  render() {
    return (
      <View style={[
				AppStyles.container,
				AppStyles.containerCentered,
				styles.homeContainer]}>
      	<View style={[AppStyles.containerStrecht]}>
					<View>
						<Text
							style={[
								AppStyles.baseText,
								styles.mainTitle,
								AppStyles.centered,
								styles.headerHeight]}>
							Pamiętnik Treningowy
						</Text>
					</View>
					<View style={[AppStyles.paddingVertical]}>
						<Image
							style={[styles.imageRotate]}
							source={require('../images/2.png')}
						/>
					</View>
					<View style={[AppStyles.row]}>
						<View style={[
							AppStyles.flex1,
							AppStyles.paddingHorizontal]}>
							<Button
								text={'Start'}
								onPress={this.goToNextScreen} />
						</View>
					</View>
      	</View>
      </View>
    );
  }
}

Home.propTypes = {
	//TODO
}

/* Styles ==================================================================== */
const styles = StyleSheet.create({
	homeContainer: {
		backgroundColor: AppConfig.forthColor,
	},
	back: {
		zIndex: 0,
		position: 'relative',
	},
	mainTitle: {
		fontSize: AppConfig.baseFontSize * 3,
		color: AppConfig.thirdColor,
		lineHeight: 50,
		fontFamily: 'Roboto',
		fontWeight: '300',
	},
	headerHeight: {
		height: 100,
	},
	imageRotate: {
		transform: [{rotate: '-30deg'}],
	},
});

function mapStateToProps(state) {
  return {
		user: state.auth.userLogin,
	  uid: state.auth.userId,
		date: state.date,
		workouts: state.workouts,
		 };
}

/* Export Component ==================================================================== */
export default connect(mapStateToProps,{ addExercises, fetchExercises, fetchSets, fetchWorkouts, fetchTrainings, getAsyncUser, fetchRecords, setLoading })(Home);


text:
[![Build Status](https://travis-ci.org/uias/Tabman.svg?branch=master)](https://travis-ci.org/uias/Tabman)
[![Swift 4](https://img.shields.io/badge/Swift-4-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![CocoaPods](https://img.shields.io/cocoapods/v/Tabman.svg)](https://cocoapods.org/pods/Tabman)
[![Platforms](https://img.shields.io/cocoapods/p/Tabman.svg)](https://cocoapods.org/pods/Tabman)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![codecov](https://codecov.io/gh/uias/Tabman/branch/master/graph/badge.svg)](https://codecov.io/gh/uias/Tabman)
[![GitHub release](https://img.shields.io/github/release/uias/Tabman.svg)](https://github.com/uias/Tabman/releases)

**Tabman** is a powerful paging view controller with indicator bar, for iOS.

## Features
- [x] Super easy to implement page view controller with indicator bar.
- [x] Multiple indicator bar styles.
- [x] Simplistic, yet highly extensive customisation.
- [x] Full support for custom components.
- [x] Built on a powerful and informative page view controller, [Pageboy](https://github.com/uias/pageboy).

## Requirements
Tabman requires iOS 8 or above, Swift 4 and uses [Pageboy 2](https://github.com/uias/Pageboy/releases/tag/2.0.0).

For details on using older versions of Tabman or Swift please see [Compatibility](Docs/COMPATIBILITY.md).

## Installation
### CocoaPods
Tabman is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:

```ruby
pod 'Tabman', '~> 1.0'
```

And run `pod install`.

### Carthage
Tabman is also available through [Carthage](https://github.com/Carthage/Carthage). Simply install carthage with [Homebrew](http://brew.sh/) using the following command:

```bash
$ brew update
$ brew install carthage
```

Add Tabman to your `Cartfile`:

```ogdl
github "uias/Tabman" ~> 1.0
```

**Dependencies**

- [Pageboy](https://www.github.com/msaps/Pageboy) by Merrick Sapsford
- [PureLayout](https://www.github.com/PureLayout/PureLayout) by PureLayout

### Example
An example project is available to take a look at some of the features that **Tabman** offers. To run the example, simply clone the repo, run

```ogdl
carthage bootstrap --platform ios
```

and build the workspace.

## Usage

### The Basics

1) Create an instance of `TabmanViewController` and provide it with a `PageboyViewControllerDataSource`, also configuring the items you want to display in the `TabmanBar`. Note: `TabmanViewController` conforms to and is set as the `PageboyViewControllerDelegate`.

```swift
class YourTabViewController: TabmanViewController, PageboyViewControllerDataSource {

	override func viewDidLoad() {
		super.viewDidLoad()

		self.dataSource = self

        	// configure the bar
        	self.bar.items = [Item(title: "Page 1"),
                          	  Item(title: "Page 2")]
	}
}
```

2) Implement `PageboyViewControllerDataSource`.

```swift
func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
    return viewControllers.count
}

func viewController(for pageboyViewController: PageboyViewController,
                    at index: PageboyViewController.PageIndex) -> UIViewController? {
    return viewControllers[index]
}

func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
    return nil
}
```

3) All done! 🎉

### Page View Controller
As Tabman is based on **[Pageboy](https://github.com/uias/Pageboy)**, all the extras and niceities in a `PageboyViewController` are available in a`TabmanViewController`. Including:

- Simplified data source management.
- Enhanced delegation; featuring exact relative positional data and reliable updates.
- Infinite scrolling support.
- Automatic timer-based page transitioning.
- Support for custom page transitions.

Read up on the **Pageboy** documentation [here](https://github.com/uias/Pageboy#usage).

### Child Content Insetting
Tabman will automatically attempt to inset any `UIScrollView` that if finds within it's child view controllers. This is enabled by default:

```swift
.automaticallyAdjustsChildScrollViewInsets = true
```

*The values used for insetting the child content are also available for manual use at `bar.requiredInsets`. Additionally, `additionalSafeAreaInsets` are also configured to allow for content to be pinned to the safe areas when running iOS 11.*

Automatic insetting support is available for any `UIScrollView` derived class such as `UITableView` and also view controllers such as `UITableViewController` and `UICollectionViewController`.

**Troubleshooting** - If you are having issues with the automatic insetting behaviour of Tabman, please check out the [Automatic Insetting Troubleshooting Guide](Docs/TROUBLESHOOTING.md#automatic-insetting). If you still are having issues, please raise an [issue](https://github.com/uias/Tabman/issues/new).

## Customization
The `TabmanBar` in Tabman can be completely customized to your liking, by simply modifying the available properties in the `.bar` `TabmanBar.Config` object.

#### Style
The style of bar to display, by default this is set to `.scrollingButtonBar`.

```swift
tabViewController.bar.style = .buttonBar
```

##### Available Styles:

*For examples on implementing real-world bar styles with `Tabman`, check out [Tabman-Styles](https://github.com/uias/Tabman-Styles).*

#### Location
Choose where you want the bar to appear, by default this is set to `.preferred` which will use the predefined preferred location for the active style.

```swift
tabViewController.bar.location = .top
```

*Note: The bar will automatically take `UIKit` components such as `UINavigationBar` and `UITabBar` into account.*

#### Appearance
Customization of the appearance and styling of a bar is available via `.appearance`. Providing a `TabmanBar.Appearance` object with your desired configuration will instantly update the appearance of the active bar:

```swift
tabViewController.bar.appearance = TabmanBar.Appearance({ (appearance) in

	// customise appearance here
	appearance.text.color = UIColor.red
	appearance.indicator.isProgressive = true
})
```

*The full list of appearance properties can be found [here](Docs/APPEARANCE.md).*

*For more advanced customisation, including defining your own indicator and bar styles please read [here](Docs/ADVANCED_CUSTOMISATION.md).*

#### Behaviors
You can also enable different behaviors via `.behaviors`. Simply provide an array of your desired `TabmanBar.Behavior` values and the bar will start using them:

```swift
tabViewController.bar.behaviors = [.autoHide(.always)]
```

*The full list of available behaviors can be found [here](Docs/BEHAVIORS.md).*

## Troubleshooting
If you are encountering issues with Tabman, please check out the [Troubleshooting Guide](Docs/TROUBLESHOOTING.md).

If you're still having problems, feel free to raise an [issue](https://github.com/uias/Tabman/issues/new).

## About
- Created by [Merrick Sapsford](https://github.com/msaps) ([@MerrickSapsford](https://twitter.com/MerrickSapsford))
- Contributed to by a growing [list of others](https://github.com/uias/Tabman/graphs/contributors).

## Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/uias/Tabman](https://github.com/uias/Tabman).

## License
The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
/**
 * A lightweight youtube embed. Still should feel the same to the user, just MUCH faster to initialize and paint.
 *
 * Thx to these as the inspiration
 *   https://storage.googleapis.com/amp-vs-non-amp/youtube-lazy.html
 *   https://autoplay-youtube-player.glitch.me/
 *
 * Once built it, I also found these:
 *   https://github.com/ampproject/amphtml/blob/master/extensions/amp-youtube (👍👍)
 *   https://github.com/Daugilas/lazyYT
 *   https://github.com/vb/lazyframe
 */
class LiteYTEmbed extends HTMLElement {
    constructor() {
        super();

        // Gotta encode the untrusted value
        // https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#rule-2---attribute-escape-before-inserting-untrusted-data-into-html-common-attributes
        this.videoId = encodeURIComponent(this.getAttribute('videoid'));

        /**
         * Lo, the youtube placeholder image!  (aka the thumbnail, poster image, etc)
         * There is much internet debate on the reliability of thumbnail URLs. Weak consensus is that you
         * cannot rely on anything and have to use the YouTube Data API.
         *
         * amp-youtube also eschews using the API, so they just try sddefault with a hqdefault fallback:
         *   https://github.com/ampproject/amphtml/blob/6039a6317325a8589586e72e4f98c047dbcbf7ba/extensions/amp-youtube/0.1/amp-youtube.js#L498-L537
         * For now I'm gonna go with this confident (lol) assertion: https://stackoverflow.com/a/20542029, though I'll use `i.ytimg` to optimize for origin reuse.
         *
         * Worth noting that sddefault is _higher_ resolution than hqdefault. Naming is hard. ;)
         * From my own testing, it appears that hqdefault is ALWAYS there sddefault is missing for ~10% of videos
         *
         * TODO: Do the sddefault->hqdefault fallback
         *       - When doing this, apply referrerpolicy (https://github.com/ampproject/amphtml/pull/3940)
         * TODO: Consider using webp if supported, falling back to jpg
         */
        this.posterUrl = `https://i.ytimg.com/vi/${this.videoId}/hqdefault.jpg`;
        // Warm the connection for the poster image
        LiteYTEmbed.addPrefetch('preload', this.posterUrl, 'image');
        // TODO: support dynamically setting the attribute via attributeChangedCallback
    }

    connectedCallback() {
        this.style.backgroundImage = `url("${this.posterUrl}")`;

        const playBtn = document.createElement('div');
        playBtn.classList.add('lty-playbtn');
        this.append(playBtn);

        // On hover (or tap), warm up the TCP connections we're (likely) about to use.
        this.addEventListener('pointerover', LiteYTEmbed.warmConnections, {once: true});

        // Once the user clicks, add the real iframe and drop our play button
        // TODO: In the future we could be like amp-youtube and silently swap in the iframe during idle time
        //   We'd want to only do this for in-viewport or near-viewport ones: https://github.com/ampproject/amphtml/pull/5003
        this.addEventListener('click', e => this.addIframe());
    }

    // // TODO: Support the the user changing the [videoid] attribute
    // attributeChangedCallback() {
    // }

    /**
     * Add a <link rel={preload | preconnect} ...> to the head
     */
    static addPrefetch(kind, url, as) {
        const linkElem = document.createElement('link');
        linkElem.rel = kind;
        linkElem.href = url;
        if (as) {
            linkElem.as = as;
        }
        linkElem.crossOrigin = 'anonymous';
        document.head.append(linkElem);
    }

    /**
     * Begin pre-connecting to warm up the iframe load
     * Since the embed's network requests load within its iframe,
     *   preload/prefetch'ing them outside the iframe will only cause double-downloads.
     * So, the best we can do is warm up a few connections to origins that are in the critical path.
     *
     * Maybe `<link rel=preload as=document>` would work, but it's unsupported: http://crbug.com/593267
     * But TBH, I don't think it'll happen soon with Site Isolation and split caches adding serious complexity.
     */
    static warmConnections() {
        if (LiteYTEmbed.preconnected) return;

        // The iframe document and most of its subresources come right off youtube.com
        LiteYTEmbed.addPrefetch('preconnect', 'https://www.youtube-nocookie.com');
        // The botguard script is fetched off from google.com
        LiteYTEmbed.addPrefetch('preconnect', 'https://www.google.com');

        // Not certain if these ad related domains are in the critical path. Could verify with domain-specific throttling.
        LiteYTEmbed.addPrefetch('preconnect', 'https://googleads.g.doubleclick.net');
        LiteYTEmbed.addPrefetch('preconnect', 'https://static.doubleclick.net');

        LiteYTEmbed.preconnected = true;
    }

    addIframe(){
        const iframeHTML = `
<iframe width="560" height="315" frameborder="0"
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen
  src="https://www.youtube-nocookie.com/embed/${this.videoId}?autoplay=1"
></iframe>`;
        this.insertAdjacentHTML('beforeend', iframeHTML);
        this.classList.add('lyt-activated');
    }
}
// Register custome element
customElements.define('lite-youtube', LiteYTEmbed);


text:
<?php

require_once __DIR__ . '/../app/app.php';
require_once __DIR__ . '/inc/auth.inc.php';

$opml         = OpmlManager::load(__DIR__ . '/../custom/people.opml');
$opml_people  = $opml->getPeople();
$page_id      = 'admin-admin';
$header_extra = <<<"HTML"

HTML;

$page_content = <<<"FRAGMENT"

{$l10n->getString('Clear cache')}

                <form action="purgecache.php" method="post" id="frmPurge">
                    <input type="hidden" value="{$csrf->generate('frmPurge')}" name="_csrf">

{$l10n->getString('Clear cache:')}<input type="submit" class="submit delete" name="purge" id="purge" value="{$l10n->getString('Clear')}" />

{$l10n->getString('Clearing the cache will make moonmoon reload all feeds.')}

                </form>

{$l10n->getString('Change administrator password')}

                <form action="changepassword.php" method="post" id="frmPassword">
                    <input type="hidden" value="{$csrf->generate('frmPassword')}" name="_csrf">

{$l10n->getString('New password:')} <input type="password" class="text" value="" name="password" id="password" size="20" /> <input type="submit" class="submit delete" name="changepwd" id="changepwd" value="{$l10n->getString('Change password')}" />

                </form>

FRAGMENT;

$footer_extra = '';
$admin_access = 1;
require_once __DIR__ . '/template.php';


text:
{{orgs}}

					jobs 1
					jobs 2
					jobs 3
					jobs 4
					jobs 5

					FIRST INFORMATION
					Brand one info
					Brand two info
					Brand three info
					Brand four info
					Brand five info

					SECOND INFORMATION
					Brand one info
					Brand two info
					Brand three info
					Brand four info
					Brand five info

					THIRD INFORMATION
					Brand one info
					Brand two info
					Brand three info
					Brand four info
					Brand five info

					FOURTH INFORMATION
					Brand one info
					Brand two info
					Brand three info
					Brand four info
					Brand five info


text:
import copy
import unittest

old_db_id = None
new_db_id = None
USE_TEST_DB = False
test_db_name = "testing.sqlite"

def make_test_db(DAL, db, clean):
    global new_db_id
    test_db = DAL("sqlite://%s" % test_db_name)
    new_db_id = id(test_db)
    # preserver hooks
    test_db.auth = db.auth
    test_db.manager = db.manager

    # Copy current db tables!
    for tablename in db.tables:
        table_copy = [copy.copy(f) for f in db[tablename]]
        test_db.define_table(tablename, *table_copy)

    if clean:
        # cleanup test_db
        for table_name in test_db.tables():
            test_db[table_name].truncate()

    return test_db

def get_db(DAL, current_db, clean=False):
    global old_db_id
    old_db_id = id(current_db)

    if USE_TEST_DB:
        print "preparing test db (%s)" % test_db_name
        return make_test_db(DAL, current_db, clean)
    return current_db

class DBReplicationTest(unittest.TestCase):
    def setUp(self):
        pass

    def test_db_replication(self):
        if USE_TEST_DB:
            self.assertTrue(old_db_id != new_db_id)
        else:
            self.assertEqual(new_db_id, None)


text:
class Bezel {
    constructor(container) {
        this.container = container;

        this.container.addEventListener('animationend', () => {
            this.container.classList.remove('dplayer-bezel-transition');
        });
    }

    switch(icon) {
        this.container.innerHTML = icon;
        this.container.classList.add('dplayer-bezel-transition');
    }
}

export default Bezel;


text:
import gravity from "lib/loaders/legacy/gravity"
import { GraphQLString, GraphQLBoolean } from "graphql"
import { mutationWithClientMutationId } from "graphql-relay"
import { ArtworkType } from "schema/artwork/index"

export default mutationWithClientMutationId({
  name: "SaveArtwork",
  decription: "Save (or remove) an artwork to (from) a users default collection.",
  inputFields: {
    artwork_id: {
      type: GraphQLString,
    },
    remove: {
      type: GraphQLBoolean,
    },
  },
  outputFields: {
    artwork: {
      type: ArtworkType,
      resolve: ({ artwork_id }) => gravity(`artwork/${artwork_id}`),
    },
  },
  mutateAndGetPayload: ({ artwork_id, remove }, request, { rootValue: { accessToken, userID } }) => {
    if (!accessToken) return new Error("You need to be signed in to perform this action")
    const saveMethod = remove ? "DELETE" : "POST"
    return gravity.with(accessToken, {
      method: saveMethod,
    })(`/collection/saved-artwork/artwork/${artwork_id}`, {
      user_id: userID,
    }).then(() => ({ artwork_id }))
  },
})


text:
Cinephile is a sample Javascript application that allows users to keep track of their favourite movies as well as suggesting other films that they might be interested in. The primary goal of Cinephile is to demonstrate Javascript application development using backbone.js

You can see the app in action [here](http://adampetrie.com/cinephile).

## Features ##

Cinephile alllows users to perform the following:

* Search for movies by title
* Add movies to a list of favourites
* Mark favourite movies as 'watched' or 'unwatched'
* View a list movies that TMDb deems to be similar to any given movie*
* Browser movie details for movies that are not in your favourites list

*Please note that the TMDb API matches films for similarity based on plot keywords only. Expect some strange results. More info available [here](https://www.themoviedb.org/talk/50855d9519c2954140000535).

## Technology ##

Cinephile uses the following technologies:

* Yeoman for application scaffolding
* Grunt for build tasks/complation
* Bower for dependency handling
* Twitter Bootstrap for UI look and feel
* PHP REST API for retrieving movie data
* Jasmine-based test suite

## Roadmap ##

In the future I plan to implement the following additional pieces to round out the application's robustness:

* Complete test suite for better code coverage
* Migrate favourite's list from localStorage to database
* Enhance error reporting (AJAX errors currently fail silently)
* Upgrade to Twitter Bootstrap 3
* Integrate Sinon.js for more sophisticated test cases


text:
/**
 * The main application class. An instance of this class is created by app.js when it calls
 * Ext.application(). This is the ideal place to handle application launch and initialization
 * details.
 */
Ext.define('ContentEditor.Application', {
    extend: 'Ext.app.Application',
    requires: [
        'Emergence.cms.view.DualView',
        'Ext.plugin.Viewport'
    ],

    name: 'ContentEditor',

    init: function() {
        Emergence.util.API.setHostname('v1-demo.node0.slate.is');
    },

    launch: function () {
        var me = this,
            dualView = Ext.create('Emergence.cms.view.DualView', {
                plugins: 'viewport'
            });

        // TODO - Launch the application
        Emergence.util.API.request({
            url: '/blog/about',
            success: function(response) {
                dualView.lookupReference('editor').setContentRecord(response.data.data);
            }
        });
    }
});


text:
import { URI } from 'vs/base/common/uri';
import { EditorWorkerClient } from 'vs/editor/common/services/editorWorkerServiceImpl';
import { IModelService } from 'vs/editor/common/services/modelService';
import * as types from 'vs/base/common/types';

/**
 * Create a new web worker that has model syncing capabilities built in.
 * Specify an AMD module to load that will `create` an object that will be proxied.
 */
export function createWebWorker<T>(modelService: IModelService, opts: IWebWorkerOptions): MonacoWebWorker<T> {
	return new MonacoWebWorkerImpl<T>(modelService, opts);
}

/**
 * A web worker that can provide a proxy to an arbitrary file.
 */
export interface MonacoWebWorker<T> {
	/**
	 * Terminate the web worker, thus invalidating the returned proxy.
	 */
	dispose(): void;
	/**
	 * Get a proxy to the arbitrary loaded code.
	 */
	getProxy(): Promise<T>;
	/**
	 * Synchronize (send) the models at `resources` to the web worker,
	 * making them available in the monaco.worker.getMirrorModels().
	 */
	withSyncedResources(resources: URI[]): Promise<T>;
}

export interface IWebWorkerOptions {
	/**
	 * The AMD moduleId to load.
	 * It should export a function `create` that should return the exported proxy.
	 */
	moduleId: string;
	/**
	 * The data to send over when calling create on the module.
	 */
	createData?: any;
	/**
	 * A label to be used to identify the web worker for debugging purposes.
	 */
	label?: string;
	/**
	 * An object that can be used by the web worker to make calls back to the main thread.
	 */
	host?: any;
	/**
	 * Keep idle models.
	 * Defaults to false, which means that idle models will stop syncing after a while.
	 */
	keepIdleModels?: boolean;
}

class MonacoWebWorkerImpl<T> extends EditorWorkerClient implements MonacoWebWorker<T> {

	private readonly _foreignModuleId: string;
	private readonly _foreignModuleHost: { [method: string]: Function } | null;
	private _foreignModuleCreateData: any | null;
	private _foreignProxy: Promise<T> | null;

	constructor(modelService: IModelService, opts: IWebWorkerOptions) {
		super(modelService, opts.keepIdleModels || false, opts.label);
		this._foreignModuleId = opts.moduleId;
		this._foreignModuleCreateData = opts.createData || null;
		this._foreignModuleHost = opts.host || null;
		this._foreignProxy = null;
	}

	// foreign host request
	public override fhr(method: string, args: any[]): Promise<any> {
		if (!this._foreignModuleHost || typeof this._foreignModuleHost[method] !== 'function') {
			return Promise.reject(new Error('Missing method ' + method + ' or missing main thread foreign host.'));
		}

		try {
			return Promise.resolve(this._foreignModuleHost[method].apply(this._foreignModuleHost, args));
		} catch (e) {
			return Promise.reject(e);
		}
	}

	private _getForeignProxy(): Promise<T> {
		if (!this._foreignProxy) {
			this._foreignProxy = this._getProxy().then((proxy) => {
				const foreignHostMethods = this._foreignModuleHost ? types.getAllMethodNames(this._foreignModuleHost) : [];
				return proxy.loadForeignModule(this._foreignModuleId, this._foreignModuleCreateData, foreignHostMethods).then((foreignMethods) => {
					this._foreignModuleCreateData = null;

					const proxyMethodRequest = (method: string, args: any[]): Promise<any> => {
						return proxy.fmr(method, args);
					};

					const createProxyMethod = (method: string, proxyMethodRequest: (method: string, args: any[]) => Promise<any>): () => Promise<any> => {
						return function () {
							const args = Array.prototype.slice.call(arguments, 0);
							return proxyMethodRequest(method, args);
						};
					};

					let foreignProxy = {} as T;
					for (const foreignMethod of foreignMethods) {
						(<any>foreignProxy)[foreignMethod] = createProxyMethod(foreignMethod, proxyMethodRequest);
					}

					return foreignProxy;
				});
			});
		}
		return this._foreignProxy;
	}

	public getProxy(): Promise<T> {
		return this._getForeignProxy();
	}

	public withSyncedResources(resources: URI[]): Promise<T> {
		return this._withSyncedResources(resources).then(_ => this.getProxy());
	}
}


text:
<?php

namespace Skinny\Data;

/**
 * Data Exception
 */
class Exception extends \Skinny\Exception {

}


text:
//=================================================================================================

//=================================================================================================

//*************************************************************************************************
// Includes
//*************************************************************************************************

#include <cstdlib>
#include <iostream>
#include <blaze/math/DynamicMatrix.h>
#include <blaze/math/HermitianMatrix.h>
#include <blaze/math/SymmetricMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/dmatdmatsub/OperationTest.h>
#include <blazetest/system/MathTest.h>

//=================================================================================================
//
//  MAIN FUNCTION
//
//=================================================================================================

//*************************************************************************************************
int main()
{
   std::cout << "   Running 'HDbSDa'..." << std::endl;

   using blazetest::mathtest::NumericA;
   using blazetest::mathtest::NumericB;

   try
   {
      // Matrix type definitions
      typedef blaze::HermitianMatrix< blaze::DynamicMatrix<NumericB> >  HDb;
      typedef blaze::SymmetricMatrix< blaze::DynamicMatrix<NumericA> >  SDa;

      // Creator type definitions
      typedef blazetest::Creator<HDb>  CHDb;
      typedef blazetest::Creator<SDa>  CSDa;

      // Running tests with small matrices
      for( size_t i=0UL; i<=9UL; ++i ) {
         RUN_DMATDMATSUB_OPERATION_TEST( CHDb( i ), CSDa( i ) );
      }

      // Running tests with large matrices
      RUN_DMATDMATSUB_OPERATION_TEST( CHDb(  67UL ), CSDa(  67UL ) );
      RUN_DMATDMATSUB_OPERATION_TEST( CHDb( 128UL ), CSDa( 128UL ) );
   }
   catch( std::exception& ex ) {
      std::cerr << "\n\n ERROR DETECTED during dense matrix/dense matrix subtraction:\n"
                << ex.what() << "\n";
      return EXIT_FAILURE;
   }

   return EXIT_SUCCESS;
}
//*************************************************************************************************


text:
// -*- C++ -*-

//=============================================================================
/**
 *  @file    IOStream.h
 *
 *  $Id: IOStream.h 1861 2011-08-31 16:18:08Z mesnierp $
 *
 *  @author James CE Johnson <jcej@lads.com>
 *  @author Jim Crossley <jim@lads.com>
 */
//=============================================================================

#ifndef ACE_IOSTREAM_H
#define ACE_IOSTREAM_H
#include /**/ "ace/pre.h"

#include /**/ "ace/ACE_export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

// Needed on Windows for streambuf
// FUZZ: disable check_for_streams_include
#include "ace/streams.h"

// This is a temporary restriction - ACE_IOStream is only enabled if the
// compiler does not supply the standard C++ library (and standard iostreams)
// or, if it does, the platform is explicitly set to use old iostreams
// by its config.h file.
// This restriction is recorded in Bugzilla entry 857.
#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY == 1)
#  if !defined (ACE_USES_OLD_IOSTREAMS) && !defined (ACE_LACKS_ACE_IOSTREAM)
#    define ACE_LACKS_ACE_IOSTREAM
#  endif /* !ACE_USES_OLD_IOSTREAMS && !ACE_LACKS_ACE_IOSTREAM */
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */

#if !defined (ACE_LACKS_ACE_IOSTREAM)

#  if defined (ACE_HAS_STRING_CLASS)
#    if defined (ACE_WIN32) && defined (_MSC_VER)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef CString ACE_IOStream_String;
ACE_END_VERSIONED_NAMESPACE_DECL
#    else
#      if !defined (ACE_HAS_STDCPP_STL_INCLUDES)
#include /**/ <String.h>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef String ACE_IOStream_String;
ACE_END_VERSIONED_NAMESPACE_DECL
#      else
#        include /**/ <string>

#        if defined(ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef std::string ACE_IOStream_String;
ACE_END_VERSIONED_NAMESPACE_DECL
#        else
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef string ACE_IOStream_String;
ACE_END_VERSIONED_NAMESPACE_DECL
#        endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
#      endif /* ! ACE_HAS_STDCPP_STL_INCLUDES */
#    endif /* ACE_WIN32 && defined (_MSC_VER) */

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

class ACE_Export ACE_Quoted_String : public ACE_IOStream_String
{
public:
  inline ACE_Quoted_String (void) { *this = ""; }
  inline ACE_Quoted_String (const char *c) { *this = ACE_IOStream_String (c); }
  inline ACE_Quoted_String (const ACE_IOStream_String &s) { *this = s; }
  inline ACE_Quoted_String &operator= (const ACE_IOStream_String& s)
  {
    return (ACE_Quoted_String &) ACE_IOStream_String::operator= (s);
  }
  inline ACE_Quoted_String &operator = (const char c) {
    return (ACE_Quoted_String &) ACE_IOStream_String::operator= (c);
  }
  inline ACE_Quoted_String &operator = (const char *c) {
    return (ACE_Quoted_String &) ACE_IOStream_String::operator= (c);
  }
  inline bool operator < (const ACE_Quoted_String &s) const {
    return *(ACE_IOStream_String *) this < (ACE_IOStream_String) s;
  }
#    if defined (ACE_WIN32) && defined (_MSC_VER)
  inline int length (void) { return this->GetLength (); }
#    endif /* ACE_WIN32 && defined (_MSC_VER) */
};

ACE_END_VERSIONED_NAMESPACE_DECL

#  endif /* ACE_HAS_STRING_CLASS */

#  include "ace/Time_Value.h"
#  include "ace/os_include/sys/os_types.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class ACE_Streambuf
 *
 * @brief Create your custom streambuf by providing and ACE_*_Stream
 * object to this template.  I have tested it with
 * ACE_SOCK_Stream and it should work fine for others as well.
 *
 * For any iostream object, the real work is done by the
 * underlying streambuf class.  That is what we create here.
 * A streambuf has an internal buffer area into which data is
 * read and written as the iostream requests and provides data.
 * At some point during the read process, the iostream will
 * realize that the streambuf has no more data.  The underflow
 * function of the streambuf is then called.
 * Likewise, during the write process, the iostream will
 * eventually notice that the streabuf's buffer has become full
 * and will invoke the overflow function.
 * The empty/full state of the read/write "buffers" are
 * controled by two sets pointers.  One set is dedicated to
 * read, the other to write.  These pointers, in turn, reference
 * a common buffer that is to be shared by both read and write
 * operations.  It is this common buffer to which data is
 * written and from which it is read.
 * The common buffer is used by functions of the streambuf as
 * well as the iostream.  Because of this and the fact that it
 * is "shared" by both read and write operators, there is a
 * danger of data corruption if read and write operations are
 * allowed to take place "at the same time".
 * To prevent data corruption, we manipulate the read and write
 * pointer sets so that the streambuf is in either a read-mode
 * or write-mode at all times and can never be in both modes at
 * the same time.
 * In the constructor: set the read and write sets to NULL This
 * causes the underflow or overflow operators to be invoked at
 * the first IO activity of the iostream.
 * In the underflow function we arrange for the common buffer to
 * reference our read buffer and for the write pointer set to be
 * disabled.  If a write operation is performed by the iostream
 * this will cause the overflow function to be invoked.
 * In the overflow function we arrange for the common buffer to
 * reference our write buffer and for the read pointer set to be
 * disabled.  This causes the underflow function to be invoked
 * when the iostream "changes our mode".
 * The overflow function will also invoke the send_n function to
 * flush the buffered data to our peer.  Similarly, the sync and
 * syncout functions will cause send_n to be invoked to send the
 * data.
 * Since socket's and the like do not support seeking, there can
 * be no method for "syncing" the input.  However, since we
 * maintain separate read/write buffers, no data is lost by
 * "syncing" the input.  It simply remains buffered.
 */
class ACE_Export ACE_Streambuf : public streambuf
{
public:

  /**
   * If the default allocation strategy were used the common buffer
   * would be deleted when the object destructs.  Since we are
   * providing separate read/write buffers, it is up to us to manage
   * their memory.
   */
  virtual ~ACE_Streambuf (void);

  /// Get the current Time_Value pointer and provide a new one.
  ACE_Time_Value *recv_timeout (ACE_Time_Value *tv = 0);

  /**
   * Use this to allocate a new/different buffer for put operations.
   * If you do not provide a buffer pointer, one will be allocated.
   * That is the preferred method.  If you do provide a buffer, the
   * size must match that being used by the get buffer.  If
   * successful, you will receive a pointer to the current put buffer.
   * It is your responsibility to delete this memory when you are done
   * with it.
   */
  char *reset_put_buffer (char *newBuffer = 0,
                          u_int _streambuf_size = 0,
                          u_int _pptr = 0 );

  /// Return the number of bytes to be 'put' onto the stream media.
  ///    pbase + put_avail = pptr
  u_int put_avail (void);

  /**
   * Use this to allocate a new/different buffer for get operations.
   * If you do not provide a buffer pointer, one will be allocated.
   * That is the preferred method.  If you do provide a buffer, the
   * size must match that being used by the put buffer.  If
   * successful, you will receive a pointer to the current get buffer.
   * It is your responsibility to delete this memory when you are done
   * with it.
   */
  char *reset_get_buffer (char *newBuffer = 0,
                          u_int _streambuf_size = 0,
                          u_int _gptr = 0,
                          u_int _egptr = 0);

  /// Return the number of bytes not yet gotten.  eback + get_waiting =
  /// gptr
  u_int get_waiting (void);

  /// Return the number of bytes in the get area (includes some already
  /// gotten); eback + get_avail = egptr
  u_int get_avail (void);

  /// Query the streambuf for the size of its buffers.
  u_int streambuf_size (void);

  /// Did we take an error because of an IO operation timeout?
  /// @note Invoking this resets the flag.
  u_char timeout (void);

protected:
  ACE_Streambuf (u_int streambuf_size,
                 int io_mode);

  /// Sync both input and output. See syncin/syncout below for
  /// descriptions.
  virtual int sync (void);

  // = Signatures for the underflow/overflow discussed above.
  virtual int underflow (void);

  /// The overflow function receives the character which caused the
  /// overflow.
  virtual int overflow (int c = EOF);

  /// Resets the <base> pointer and streambuf mode.  This is used
  /// internally when get/put buffers are allocatd.
  void reset_base (void);

protected:
  // = Two pointer sets for manipulating the read/write areas.
  char *eback_saved_;
  char *gptr_saved_;
  char *egptr_saved_;
  char *pbase_saved_;
  char *pptr_saved_;
  char *epptr_saved_;

  // = With cur_mode_ we keep track of our current IO mode.

  // This helps us to optimize the underflow/overflow functions.
  u_char cur_mode_;
  const u_char get_mode_;
  const u_char put_mode_;

  /// mode tells us if we're working for an istream, ostream, or
  /// iostream.
  int mode_;

  /// This defines the size of the input and output buffers.  It can be
  /// set by the object constructor.
  const u_int streambuf_size_;

  /// Did we take an error because of an IO operation timeout?
  u_char timeout_;

  /// We want to allow the user to provide Time_Value pointers to
  /// prevent infinite blocking while waiting to receive data.
  ACE_Time_Value recv_timeout_value_;
  ACE_Time_Value *recv_timeout_;

  /**
   * syncin is called when the input needs to be synced with the
   * source file.  In a filebuf, this results in the <seek> system
   * call being used.  We can't do that on socket-like connections, so
   * this does basically nothing.  That's safe because we have a
   * separate read buffer to maintain the already-read data.  In a
   * filebuf, the single common buffer is used forcing the <seek>
   * call.
   */
  int syncin (void);

  /// syncout() is called when the output needs to be flushed.  This is
  /// easily done by calling the peer's send_n function.
  int syncout (void);

  /// flushbuf() is the worker of syncout.  It is a separate function
  /// because it gets used sometimes in different context.
  int flushbuf (void);

  /**
   * fillbuf is called in a couple of places.  This is the worker of
   * underflow.  It will attempt to fill the read buffer from the
   * peer.
   */
  int fillbuf (void);

  /**
   * Used by fillbuf and others to get exactly one byte from the peer.
   * recv_n is used to be sure we block until something is available.
   * It is virtual because we really need to override it for
   * datagram-derived objects.
   */
  virtual int get_one_byte (void);

  /**
   * Stream connections and "unconnected connections" (ie --
   * datagrams) need to work just a little differently.  We derive
   * custom Streambuf objects for them and provide these functions at
   * that time.
   */
  virtual ssize_t send (char *buf,
                        ssize_t len) = 0;
  virtual ssize_t recv (char *buf,
                        ssize_t len,
                        ACE_Time_Value *tv = 0) = 0;
  virtual ssize_t recv (char *buf,
                        ssize_t len,
                        int flags,
                        ACE_Time_Value *tv = 0) = 0;
  virtual ssize_t recv_n (char *buf,
                          ssize_t len,
                          int flags = 0,
                          ACE_Time_Value *tv = 0) = 0;

  virtual ACE_HANDLE get_handle (void);

#  if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) && !defined (ACE_USES_OLD_IOSTREAMS)
  char *base (void) const
    {
      return cur_mode_ == get_mode_ ? eback_saved_
        : cur_mode_ == put_mode_ ? pbase_saved_
        : 0;
    }
  char *ebuf (void) const
    {
      return cur_mode_ == 0 ? 0 : base () + streambuf_size_;
    }

  int blen (void) const
    {
      return streambuf_size_;
    }

  void setb (char* b, char* eb, int /* a */=0)
    {
      setbuf (b, (eb - b));
    }

  int out_waiting (void)
    {
      return pptr () - pbase ();
    }
#  endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
};

ACE_END_VERSIONED_NAMESPACE_DECL

///////////////////////////////////////////////////////////////////////////

// These typedefs are provided by G++ (on some systems?) without the
// trailing '_'.  Since we can't count on 'em, I've defined them to
// what GNU wants here.
//
typedef ios& (*__manip_)(ios&);
typedef istream& (*__imanip_)(istream&);
typedef ostream& (*__omanip_)(ostream&);

// Trying to do something like is shown below instead of using the
// __*manip typedefs causes Linux do segfault when "<<endl" is done.
//
//        virtual MT& operator<<(ios& (*func)(ios&))  { (*func)(*this); return *this; }

// This macro defines the get operator for class MT into datatype DT.
// We will use it below to quickly override most (all?)  iostream get
// operators.  Notice how the <ipfx> and <isfx> functions are used.

#define GET_SIG(MT,DT)          inline virtual MT& operator>> (DT v)
#  if (defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510)
#define GET_CODE {                      \
        if (ipfx (0))                                   \
        {                                               \
                (*((istream*)this)) >> (v);             \
        }                                               \
        isfx ();                                        \
        return *this;                                   \
        }
#  else
#define GET_CODE {                      \
        if (ipfx (0))                                   \
        {                                               \
                iostream::operator>> (v);               \
        }                                               \
        isfx ();                                        \
        return *this;                                   \
        }
#  endif
#define GET_PROT(MT,DT,CODE)    GET_SIG(MT,DT)  CODE
#define GET_FUNC(MT,DT)         GET_PROT(MT,DT,GET_CODE)

// This macro defines the put operator for class MT into datatype DT.
// We will use it below to quickly override most (all?)  iostream put
// operators.  Notice how the <opfx> and <osfx> functions are used.

#define PUT_SIG(MT,DT)          inline virtual MT& operator<< (DT v)
#  if (defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510)
#define PUT_CODE {                      \
        if (opfx ())                                    \
        {                                               \
                (*((ostream *) this)) << (v);            \
        }                                               \
        osfx ();                                        \
        return *this;                                   \
        }
#  else
#define PUT_CODE {                      \
        if (opfx ())                                    \
        {                                               \
                iostream::operator<< (v);               \
        }                                               \
        osfx ();                                        \
        return *this;                                   \
        }
#  endif
#define PUT_PROT(MT,DT,CODE)    PUT_SIG(MT,DT)  CODE
#define PUT_FUNC(MT,DT)         PUT_PROT(MT,DT,PUT_CODE)

// These are necessary in case somebody wants to derive from us and
// override one of these with a custom approach.

#  if defined (ACE_LACKS_CHAR_RIGHT_SHIFTS)
#define GET_FUNC_SET0(MT,CODE,CODE2) \
        GET_PROT(MT,short &,CODE) \
        GET_PROT(MT,u_short &,CODE) \
        GET_PROT(MT,int &,CODE) \
        GET_PROT(MT,u_int &,CODE) \
        GET_PROT(MT,long &,CODE) \
        GET_PROT(MT,u_long &,CODE) \
        GET_PROT(MT,float &,CODE) \
        GET_PROT(MT,double &,CODE) \
        inline virtual MT& operator>>(__omanip_ func) CODE2 \
        inline virtual MT& operator>>(__manip_ func)  CODE2
#  else
#define GET_FUNC_SET0(MT,CODE,CODE2) \
        GET_PROT(MT,short &,CODE) \
        GET_PROT(MT,u_short &,CODE) \
        GET_PROT(MT,int &,CODE) \
        GET_PROT(MT,u_int &,CODE) \
        GET_PROT(MT,long &,CODE) \
        GET_PROT(MT,u_long &,CODE) \
        GET_PROT(MT,float &,CODE) \
        GET_PROT(MT,double &,CODE) \
        GET_PROT(MT,char &,CODE) \
        GET_PROT(MT,u_char &,CODE) \
        GET_PROT(MT,char *,CODE) \
        GET_PROT(MT,u_char *,CODE) \
        inline virtual MT& operator>>(__omanip_ func) CODE2 \
        inline virtual MT& operator>>(__manip_ func)  CODE2
#  endif

#define PUT_FUNC_SET0(MT,CODE,CODE2) \
        PUT_PROT(MT,short,CODE) \
        PUT_PROT(MT,u_short,CODE) \
        PUT_PROT(MT,int,CODE) \
        PUT_PROT(MT,u_int,CODE) \
        PUT_PROT(MT,long,CODE) \
        PUT_PROT(MT,u_long,CODE) \
        PUT_PROT(MT,float,CODE) \
        PUT_PROT(MT,double,CODE) \
        PUT_PROT(MT,char,CODE) \
        PUT_PROT(MT,u_char,CODE) \
        PUT_PROT(MT,const char *,CODE) \
        PUT_PROT(MT,u_char *,CODE) \
        PUT_PROT(MT,void *,CODE) \
        inline virtual MT& operator<<(__omanip_ func) CODE2 \
        inline virtual MT& operator<<(__manip_ func)  CODE2

#  if defined (ACE_LACKS_SIGNED_CHAR)
  #define GET_FUNC_SET1(MT,CODE,CODE2) GET_FUNC_SET0(MT,CODE,CODE2)
  #define PUT_FUNC_SET1(MT,CODE,CODE2) PUT_FUNC_SET0(MT,CODE,CODE2)
#  else
  #define GET_FUNC_SET1(MT,CODE,CODE2) \
          GET_PROT(MT,signed char &,CODE) \
          GET_PROT(MT,signed char *,CODE) \
          GET_FUNC_SET0(MT,CODE,CODE2)

  #define PUT_FUNC_SET1(MT,CODE,CODE2) \
          PUT_FUNC(MT,signed char) \
          PUT_FUNC(MT,const signed char *) \
          PUT_FUNC_SET0(MT,CODE,CODE2)
#  endif /* ACE_LACKS_SIGNED_CHAR */

#define GET_MANIP_CODE  { if (ipfx ()) { (*func) (*this); } isfx (); return *this; }
#define PUT_MANIP_CODE  { if (opfx ()) { (*func) (*this); } osfx (); return *this; }

#define GET_FUNC_SET(MT)        GET_FUNC_SET1(MT,GET_CODE,GET_MANIP_CODE)
#define PUT_FUNC_SET(MT)        PUT_FUNC_SET1(MT,PUT_CODE,PUT_MANIP_CODE)
#define GETPUT_FUNC_SET(MT)     GET_FUNC_SET(MT) PUT_FUNC_SET(MT)

#define GET_SIG_SET(MT)         GET_FUNC_SET1(MT,= 0;,= 0;)
#define PUT_SIG_SET(MT)         PUT_FUNC_SET1(MT,= 0;,= 0;)
#define GETPUT_SIG_SET(MT)      GET_SIG_SET(MT) PUT_SIG_SET(MT)

// Include the templates here.
#  include "ace/IOStream_T.h"
#endif /* !ACE_LACKS_ACE_IOSTREAM && ACE_USES_OLD_IOSTREAMS */

#include /**/ "ace/post.h"
#endif /* ACE_IOSTREAM_H */