text:
<bill session="115" type="s" number="571" updated="2017-07-20T16:56:14Z">
  <state datetime="2017-03-08">REFERRED</state>
  <status>
    <introduced datetime="2017-03-08"/>
  </status>
  <introduced datetime="2017-03-08"/>
  <titles>
    <title type="short" as="introduced">Chattahoochee-Oconee National Forest Land Adjustment Act</title>
    <title type="short" as="introduced">Chattahoochee-Oconee National Forest Land Adjustment Act</title>
    <title type="official" as="introduced">A bill to authorize the sale of certain National Forest System land in the State of Georgia.</title>
    <title type="display">Chattahoochee-Oconee National Forest Land Adjustment Act</title>
  </titles>
  <sponsor bioguide_id="P000612"/>
  <cosponsors>
    <cosponsor bioguide_id="I000055" joined="2017-03-08"/>
  </cosponsors>
  <actions>
    <action datetime="2017-03-08">
      <text>Introduced in Senate</text>
    </action>
    <action datetime="2017-03-08" state="REFERRED">
      <text>Read twice and referred to the Committee on Agriculture, Nutrition, and Forestry.</text>
    </action>
  </actions>
  <committees>
    <committee subcommittee="" code="SSAF" name="Senate Agriculture, Nutrition, and Forestry" activity="Referral"/>
  </committees>
  <relatedbills>
    <bill type="h" session="115" relation="identical" number="1434"/>
  </relatedbills>
  <subjects>
    <term name="Public lands and natural resources"/>
    <term name="Forests, forestry, trees"/>
    <term name="Georgia"/>
    <term name="Land transfers"/>
  </subjects>
  <amendments/>
  <summary date="2017-03-08T05:00:00Z" status="Introduced in Senate">Chattahoochee-Oconee National Forest Land Adjustment Act

This bill authorizes the Department of Agriculture (USDA) to sell or exchange any or all interest of the United States in 30 tracts of National Forest System land in Georgia totaling approximately 3,841 acres.

 USDA may reserve any rights-of-way or other rights or interests in land sold or exchanged under this bill that is considered necessary for management purposes or to protect the public interest.

 USDA may not sell or exchange land under this bill for less than market value, as determined by an appraisal or through a competitive bid.

 The bill requires proceeds to be used for the acquisition of land for national forest purposes in Georgia.</summary>
  <committee-reports/>
</bill>


text:
<?php
namespace Chamilo\Core\Repository\Implementation\Box\Package;

class Activator extends \Chamilo\Configuration\Package\Action\Activator
{
}

redpajama_set_name: RedPajamaGithub


text:
import React, {PropTypes, Component} from 'react'
import {Button, OverlayTrigger, Tooltip} from 'react-bootstrap'
import styles from "../../styles/Calculator.styl"
import _ from 'lodash'

export class Keyboard extends Component {
  static propTypes = {
    updateActiveNumber: PropTypes.func,
    doOperation:        PropTypes.func,
    doReset:            PropTypes.func,
    displayResult:      PropTypes.func,
    convertToFloat:     PropTypes.func
  }

  static buttons = { // TIP: move down items with specific codes
    zero: {
      label: '0',
      code: 48,
      type: 'number'
    },
    one: {
      label: '1',
      code: 49,
      type: 'number'
    },
    two: {
      label: '2',
      code: 50,
      type: 'number'
    },
    three: {
      label: '3',
      code: 51,
      type: 'number'
    },
    four: {
      label: '4',
      code: 52,
      type: 'number'
    },
    five: {
      label: '5',
      code: 53,
      type: 'number'
    },
    six: {
      label: '6',
      code: 54,
      type: 'number'
    },
    seven: {
      label: '7',
      code: 55,
      type: 'number'
    },
    eight: {
      label: '8',
      code: 56,
      type: 'number'
    },
    nine: {
      label: '9',
      code: 57,
      type: 'number'
    },
    result: {
      label: '=',
      code: [187, 13],
      type: 'result',
      tip: "Press = or Enter"
    },
    reset: {
      label: 'C',
      code: [67, 32],
      type: 'reset',
      tip: 'Press C or Space'
    },
    sum: {
      label: '+',
      code: [107, {code: 187, metakeys: {
        shiftKey: true
      }}],
      type: 'operation',
      tip: 'Press shift-+'
    },
    substract: {
      label: '-',
      code: [109, 189],
      type: 'operation'
    },
    multiple: {
      label: '*',
      code: [106, {code: 56, metakeys: {
        shiftKey: true
      }}],
      type: 'operation',
      tip: 'Press shift-8'
    },
    divide: {
      label: '/',
      code: [111, {code: 191}],
      type: 'operation'
    }
  }

  integrateActionToButton = (btn, name) => {
    const {updateActiveNumber, doOperation, doReset, displayResult} = this.props
    const {label, type} = btn
    let action = null
    switch (type) {
      case 'number'    : action = _.partial(updateActiveNumber, label)
      break
      case 'operation' : action = _.partial(doOperation, name)
      break
      case 'reset'     : action = doReset
      break
      case 'result'    : action = displayResult
      break
    }
    return _.assign({}, btn, {action})
  }

  state = {
    buttonsWithActions: _.mapValues(Keyboard.buttons, this.integrateActionToButton),
    layout: [
      ['one', 'two', 'three', 'divide'],
      ['four', 'five', 'six', 'multiple'],
      ['seven', 'eight', 'nine', 'substract'],
      ['reset', 'zero', 'result', 'sum']
    ]
  }

  addKeyboardSupport (ev) {
    const isEventKeyCode = (val) => val === ev.keyCode
    const getPressedBtn = ({code}) => {
      if (!code.length) return isEventKeyCode(code)
      return _.find(code, (item) => {
        return _.isObject(item)
          ? _.every(item.metakeys, (v, k) => ev[k]) && isEventKeyCode(item.code)
          : isEventKeyCode(item)
      })
    }
    const pressedBtn = _.findLast(this.state.buttonsWithActions, getPressedBtn)
    if (pressedBtn) pressedBtn.action(pressedBtn.label)
  }

  componentDidMount () {
    document.addEventListener('keyup', this.addKeyboardSupport.bind(this))
  }

  componentWillUnmount () {
    document.removeEventListener('keyup', this.addKeyboardSupport)
  }

  getButtonStyle =  (type) => {
    switch (type) {
      case 'number'    : return 'primary'
      case 'operation' : return 'info'
      case 'reset'     : return 'danger'
      case 'result'    : return 'success'
    }
  }

  r_buttonTip = (text) => <Tooltip id={_.uniqueId('tip-')}>{text}</Tooltip>

  r_button = ({label, action, type, tip}) => <li
    key={_.uniqueId('btn-')}>
      <OverlayTrigger placement="top" overlay={this.r_buttonTip(tip || label)} delayShow={1000}>
        <Button onClick={action}
                bsSize="large"
                bsStyle={this.getButtonStyle(type)}
                className={styles.keyboardBtn}>{label}</Button>
      </OverlayTrigger>
    </li>

  r_buttonsRow = (row) => <ul
    className="util-list_reset f-box"
    key={_.uniqueId('row-')}>
      {_.map(row, (name) => this.r_button(this.state.buttonsWithActions[name]))}
    </ul>

  render () {
    return (
      <div>
        {_.map(this.state.layout, this.r_buttonsRow)}
      </div>
    )
  }
}

export default Keyboard


text:
require_relative 'base_shared'

module Concurrent::Channel::Buffer

  describe Unbuffered do

    subject { described_class.new }

    it_behaves_like :channel_buffer

    specify do
      expect(subject).to be_blocking
    end

    specify do
      expect(subject.capacity).to eq 1
    end

    context '#size' do

      it 'is 0 when first created' do
        expect(subject.size).to eq 0
      end

      it 'is 1 when a putting thread is waiting' do
        t = Thread.new { subject.put(:foo) }
        t.join(0.1)
        expect(subject.size).to eq 1
        t.kill # cleanup
      end

      it 'is 0 when there are taking threads but no putting threads' do
        t = Thread.new { subject.take }
        t.join(0.1)
        expect(subject.size).to eq 0
        t.kill # cleanup
      end
    end

    context '#empty?' do

      it 'is true when there are no putting threads' do
        expect(subject).to be_empty
      end

      it 'is false when there are waiting putting threads' do
        t = Thread.new { subject.put(:foo) }
        t.join(0.1)
        expect(subject).to_not be_empty
        t.kill # cleanup
      end
    end

    context '#full?' do

      it 'is false when there are no putting threads' do
        expect(subject).to_not be_full
      end

      it 'is false when there are waiting putting threads' do
        t = Thread.new { subject.put(:foo) }
        t.join(0.1)
        expect(subject).to be_full
        t.kill # cleanup
      end
    end

    context '#put' do

      it 'does not enqueue the item when closed' do
        subject.close
        subject.put(:foo)
        expect(subject).to be_empty
      end

      it 'returns false when closed' do
        subject.close
        expect(subject.put(:foo)).to be false
      end

      it 'blocks until a thread is ready to take' do
        subject # initialize on this thread
        bucket = Concurrent::AtomicReference.new(nil)
        t = Thread.new do
          subject.put(42)
          bucket.value = 42
        end

        t.join(0.1)

        before = bucket.value
        subject.take
        t.join(0.1)
        after = bucket.value

        expect(before).to be nil
        expect(after).to eq 42
        expect(t.status).to be false
      end

      it 'delivers when closed after put starts' do
        t = Thread.new do
          subject.put(:foo)
        end
        t.join(0.1)
        subject.close

        item = subject.take
        t.kill #clean up

        expect(item).to eq :foo
      end
    end

    context '#offer' do

      it 'returns false immediately when a put in in progress' do
        subject # initialize on this thread
        t = Thread.new do
          subject.put(:foo) # block the thread
        end
        t.join(0.1)

        ok = subject.offer(:bar)
        subject.poll # release the blocked thread

        expect(ok).to be false
      end

      it 'gives the item to a waiting taker and returns true' do
        subject # initialize on this thread
        bucket = Concurrent::AtomicReference.new(nil)
        t = Thread.new do
          bucket.value = subject.take
        end
        t.join(0.1)

        before = bucket.value
        ok = subject.offer(42)
        t.join(0.1)
        after = bucket.value

        expect(ok).to be true
        expect(before).to be nil
        expect(after).to eq 42
      end
    end

    context '#take' do

      it 'returns false immediately when a put in in progress' do
        subject # initialize on this thread
        t = Thread.new do
          subject.put(:foo) # block the thread
        end
        t.join(0.1)

        ok = subject.offer(:bar)
        subject.poll # release the blocked thread

        expect(ok).to be false
      end

      it 'gives the item to a waiting taker and returns true' do
        subject # initialize on this thread
        bucket = Concurrent::AtomicReference.new(nil)
        t = Thread.new do
          bucket.value = subject.take
        end
        t.join(0.1)

        before = bucket.value
        ok = subject.offer(42)
        t.join(0.1)
        after = bucket.value

        expect(ok).to be true
        expect(before).to be nil
        expect(after).to eq 42
      end
    end

    context '#next' do

      it 'blocks when no putting and returns <item>, true when one arrives' do
        subject # initialize on this thread
        bucket = Concurrent::AtomicReference.new([])
        t = Thread.new do
          bucket.value = subject.next
        end
        t.join(0.1)

        before = bucket.value
        subject.put(42)
        t.join(0.1)
        after = bucket.value

        expect(before).to eq []
        expect(after.first).to eq 42
        expect(after.last).to be true
        expect(t.status).to be false
      end

      it 'returns <item>, true when there are multiple putting' do
        subject # initialize on this thread
        threads = 2.times.collect do
          Thread.new do
            subject.put(42)
          end
        end
        threads.each {|t| t.join(0.1)}

        item, more = subject.next
        subject.poll # clear the channel

        expect(item).to eq 42
        expect(more).to be true
      end

      it 'returns <item>, true when closed and last item' do
        t = Thread.new do
          subject.put(:foo)
        end
        t.join(0.1)
        subject.close

        item, more = subject.next
        t.kill #clean up

        expect(item).to eq :foo
        expect(more).to be true
      end

      it 'returns Concurrent::NULL, false when closed and no items remain' do
        t = Thread.new do
          subject.put(:foo)
        end
        subject.close

        subject.next
        item, more = subject.next
        t.kill #clean up

        expect(item).to eq Concurrent::NULL
        expect(more).to be false
      end
    end
  end
end


text:
{% capture baseurl %}{{ item.url | remove:'index.html' }}{% endcapture %}
{% if item.redirect %}
  {% assign url = item.redirect %}
{% else %}
  {% assign url = baseurl %}
{% endif %}
{% if item.nav %}
  {% assign title = item.nav %}
{% else %}
  {% assign title = item.title %}
{% endif %}

{{ title }}


text:
import '@angular/compiler';
import * as fs from 'fs';
import * as path from 'path';

const UTF8 = {
  encoding: 'utf-8'
};
const PACKAGE = 'angular/packages/core/test/bundling/forms_reactive';

describe('treeshaking with uglify', () => {
  let content: string;
  // We use the debug version as otherwise symbols/identifiers would be mangled (and the test would
  // always pass)
  const contentPath = require.resolve(path.join(PACKAGE, 'bundle.min_debug.js'));
  beforeAll(() => {
    content = fs.readFileSync(contentPath, UTF8);
  });

  it('should drop unused TypeScript helpers', () => {
    expect(content).not.toContain('__asyncGenerator');
  });

  it('should not contain rxjs from commonjs distro', () => {
    expect(content).not.toContain('commonjsGlobal');
    expect(content).not.toContain('createCommonjsModule');
  });
});


text: JsInterop wrapper for MomentJs


text:
package com.gravity.levels;

import org.newdawn.slick.state.GameState;
import org.newdawn.slick.state.StateBasedGame;

import com.gravity.geom.Rect;

public class MenuCage {
    private final StateBasedGame game;
    private Rect rect;
    protected int stateID;

    public MenuCage(StateBasedGame game, float x, float y, int stateID) {
        this.game = game;
        float width = CageRenderer.image.getWidth();
        float height = CageRenderer.image.getHeight();
        this.rect = new Rect(x - width / 2f, y - height, CageRenderer.image.getWidth(), CageRenderer.image.getHeight());
        this.stateID = stateID;
    }

    public Rect getRect() {
        return rect;
    }

    public int getToState() {
        return stateID;
    }

    public boolean intersects(Rect... rects) {
        for (Rect rect : rects) {
            if (!rect.intersects(this.rect)) {
                return false;
            }
        }
        return true;
    }

    public boolean isDisabled() {
        GameState state = game.getState(stateID);
        if (state instanceof GameplayState) {
            return ((GameplayState)state).isFinished();
        }
        return false;
    }
}


text:
input_name = '../examples/homogenization/linear_elastic_mM.py'
output_name = 'test_linear_elastic_mM.vtk'

from testsBasic import TestInput
class Test( TestInput ):
    pass


text:
Drive-ThruJS
============

Carousel Image Lazy-loader

Docs & example at http://codepen.io/clearwavedesigns/pen/ADLJE.


text:
<?php

namespace Afsy\UI\SymfonyBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class AfsyBlackjackExtension extends Extension
{
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('commands.yml');
        $loader->load('controllers.yml');
        $loader->load('cqrs.yml');
        $loader->load('listeners.yml');
        $loader->load('query.yml');
        $loader->load('repository.yml');
        $loader->load('services.yml');
    }
}


text:
using FluentAssertions;
using Nest;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tests.Framework;
using Tests.Framework.Integration;
using Xunit;

namespace Tests.Modules.SnapshotAndRestore.Repositories
{
	[Collection(IntegrationContext.Indexing)]
	public class RepositoryCrudTests
		: CrudTestBase<IAcknowledgedResponse, IGetRepositoryResponse, IAcknowledgedResponse, IAcknowledgedResponse>
	{
		public RepositoryCrudTests(IndexingCluster cluster, EndpointUsage usage) : base(cluster, usage)
		{
			_rootRepositoryPath = cluster.Node.RepositoryPath;
		}

		protected override LazyResponses Create() => Calls<CreateRepositoryDescriptor, CreateRepositoryRequest, ICreateRepositoryRequest, IAcknowledgedResponse>(
			CreateInitializer,
			CreateFluent,
			fluent: (s, c, f) => c.CreateRepository(s, f),
			fluentAsync: (s, c, f) => c.CreateRepositoryAsync(s, f),
			request: (s, c, r) => c.CreateRepository(r),
			requestAsync: (s, c, r) => c.CreateRepositoryAsync(r)
        );

		private string _rootRepositoryPath;
		private string GetRepositoryPath(string name) => Path.Combine(_rootRepositoryPath, name);

		protected CreateRepositoryRequest CreateInitializer(string name) =>
			new CreateRepositoryRequest(name)
			{
				Repository = new FileSystemRepository(
					new FileSystemRepositorySettings(GetRepositoryPath(name))
						{
							ChunkSize = "64mb",
							Compress = true
                        }
					)
            };

		protected ICreateRepositoryRequest CreateFluent(string name, CreateRepositoryDescriptor d) => d
			.FileSystem(fs => fs
				.Settings(GetRepositoryPath(name), s => s
					.ChunkSize("64mb")
					.Compress()
				)
			);

		protected override LazyResponses Read() => Calls<GetRepositoryDescriptor, GetRepositoryRequest, IGetRepositoryRequest, IGetRepositoryResponse>(
			ReadInitializer,
			ReadFluent,
			fluent: (s, c, f) => c.GetRepository(f),
			fluentAsync: (s, c, f) => c.GetRepositoryAsync(f),
			request: (s, c, r) => c.GetRepository(r),
			requestAsync: (s, c, r) => c.GetRepositoryAsync(r)
		);

		protected GetRepositoryRequest ReadInitializer(string name) => new GetRepositoryRequest(name);

		protected IGetRepositoryRequest ReadFluent(string name, GetRepositoryDescriptor d) => d
			.RepositoryName(name);

		protected override LazyResponses Update() => Calls<CreateRepositoryDescriptor, CreateRepositoryRequest, ICreateRepositoryRequest, IAcknowledgedResponse>(
			UpdateInitializer,
			UpdateFluent,
			fluent: (s, c, f) => c.CreateRepository(s, f),
			fluentAsync: (s, c, f) => c.CreateRepositoryAsync(s, f),
			request: (s, c, r) => c.CreateRepository(r),
			requestAsync: (s, c, r) => c.CreateRepositoryAsync(r)
        );

		protected CreateRepositoryRequest UpdateInitializer(string name) => new CreateRepositoryRequest(name)
		{
			Repository = new FileSystemRepository(new FileSystemRepositorySettings(GetRepositoryPath(name))
				{
					ChunkSize = "64mb",
					Compress = true,
					ConcurrentStreams = 5
				}
			)
		};

		protected ICreateRepositoryRequest UpdateFluent(string name, CreateRepositoryDescriptor d) => d
			.FileSystem(fs => fs
				.Settings(GetRepositoryPath(name), s => s
					.ChunkSize("64mb")
					.Compress()
					.ConcurrentStreams(5)
				)
			);

		protected override LazyResponses Delete() => Calls<DeleteRepositoryDescriptor, DeleteRepositoryRequest, IDeleteRepositoryRequest, IAcknowledgedResponse>(
			DeleteInitializer,
			DeleteFluent,
			fluent: (s, c, f) => c.DeleteRepository(s),
			fluentAsync: (s, c, f) => c.DeleteRepositoryAsync(s),
			request: (s, c, r) => c.DeleteRepository(r),
			requestAsync: (s, c, r) => c.DeleteRepositoryAsync(r)
        );

		protected DeleteRepositoryRequest DeleteInitializer(string name) => new DeleteRepositoryRequest(name);

		protected IDeleteRepositoryRequest DeleteFluent(string name, DeleteRepositoryDescriptor d) => null;

		protected override void ExpectAfterCreate(IGetRepositoryResponse response)
		{
			response.Repositories.Should().NotBeNull().And.HaveCount(1);
			var name = response.Repositories.Keys.First();
			var repository = response.FileSystem(name);
			repository.Should().NotBeNull();
			repository.Type.Should().Be("fs");
			repository.Settings.Should().NotBeNull();
			repository.Settings.ChunkSize.Should().Be("64mb");
			repository.Settings.Compress.Should().BeTrue();
        }

		protected override void ExpectAfterUpdate(IGetRepositoryResponse response)
		{
			response.Repositories.Should().NotBeNull().And.HaveCount(1);
			var name = response.Repositories.Keys.First();
			var repository = response.FileSystem(name);
			repository.Should().NotBeNull();
			repository.Type.Should().Be("fs");
			repository.Settings.Should().NotBeNull();
			repository.Settings.ChunkSize.Should().Be("64mb");
			repository.Settings.Compress.Should().BeTrue();
			repository.Settings.ConcurrentStreams.Should().Be(5);
		}
	}
}


text:
(function (app) {
  'use strict';

  app.factory('matchImage', matchImageFactory);

  matchImageFactory.$inject = [ '$window', 'RSrcPixelDensity' ];
  function matchImageFactory ($window, RSrcPixelDensity) {
    // RSrcPixelDensity should be an integer between 1 and 4 representing the screen's pixel density.

    return function matchImage (imgObj, width, height, ratio) {

      if (!imgObj || !width || !height || !ratio) {
        console.error(new Error('r-src must be provided an src object, a width and a ratio.'));
        return;
      }

      // Iterate over src to find the best possible match
      var match = Object.keys(imgObj)

      // Format the incoming data into an easily iterable format
      // Assume data in a format like { url_100x100: 'https://example.com', ... }
      .map(function formatImageObject (item, index, array) {
        var m      = item.match(/^url_(\d+)x(\d+)$/);

        if (!m) {
          // This will allow properties that do not contain image urls into those objects : things
          // like IDs, content object references, etc.
          return null;
        }

        var width  = m[1],
            height = m[2],
            ratio  = width / height;
        if (!width || !height || !ratio) {
          console.error(new Error('Unexpected image object. rSrc needs keys of the form url_0x0 with urls as values'));
          return;
        }
        return [ ratio, width, height, imgObj[item] ];
      })

      // Remove falsy values such as null
      .filter(function removeFalsyValues (item, index, array) {
        return !!item;
      })

      // Find images tall enough to fit
      .filter(function filterImagesByHeight (item, index, array) {
        return +item[2] >= height * RSrcPixelDensity;
      })

      // Find images large enough to fit, or larger
      .filter(function filterImagesByWidth (item, index, array) {
        return +item[1] >= width * RSrcPixelDensity;
      })

      // Sort images by ratio for simpler selection
      .sort(function sortImagesByRatio (a, b) {
        return a[0] - b[0];
      })

      .filter(function pickExactRatio (item, index, array) {
        // If there are exact match ratio images in the imgObj, pick those
        if (array.filter(function (item) { return item[0] === ratio; })[0]) {
          return item[0] === ratio;
        }

        // Otherwise do nothing, we will select the proper images below
        else {
          return true;
        }
      })

      // Keep only the highest ratio images. If we have an exact match, it's all that will be left anyway.
      // Otherwise this will leave us with the least all images still tall enough to fit
      .reduceRight(function keepHighestRatioImages (acc, item, index, array) {
        return (acc.length > 0) && (+item[0] < acc[0][0]) ? acc : acc.concat([ item ]);
      }, [])

      // Keep the smallest image that did fit. If there's only one image, this will be it.
      .reduce(function keepSmallestWidthImages (acc, item, index, array) {
        return !acc ? item :                        // If there's nothing yet, take the first item that comes
          (+item[1] < +acc[1]) ? item : acc;        // If the item is smaller than what we had, take it instead
      }, false); // Avoid a TypeError to allow our smarter reporting right below.

      // There's no matching image. Just return the largest image we have and hopefully the user will not notice
      if (!match) {
        var largestImageKeyMatch = Object.keys(imgObj)
        .map(function (key) { return key.match(/^url_(\d+)x(\d+)$/); })
        .reduce(function (acc, matchedKey) {
          if (!matchedKey || !matchedKey[1] || acc && acc[1] > matchedKey[1]) {
            return acc;
          }
          else {
            return matchedKey;
          }
        });

        if (!largestImageKeyMatch) {
          console.error(new Error('The image object does not contain any proper image properties.'));
          return;
        }

        console.warn('No image for ' + width + 'px/' + RSrcPixelDensity + '/' + ratio + '. Falling back to largest.');
        return imgObj[largestImageKeyMatch[0]];
      }

      return match[3];
    };
  }

})(angular.module('ng-responsive-image.matcher', [
  'ng-responsive-image.pixel-density'
]));


text:
function performAjaxOperation(target) {

  triggerEvent(target,'ajax-start');

  window.setTimeout(function(){
    triggerEvent(target,'ajax-complete')
  },5000);

}


text:
<?php
namespace CodeIgniter\HTTP;

use CodeIgniter\HTTP\Files\UploadedFile;
use Config\App;

/**
 * @backupGlobals enabled
 */
class IncomingRequestTest extends \CodeIgniter\Test\CIUnitTestCase
{

	/**
	 * @var \CodeIgniter\HTTP\IncomingRequest
	 */
	protected $request;

	protected function setUp(): void
	{
		parent::setUp();

		$this->request = new IncomingRequest(new App(), new URI(), null, new UserAgent());

		$_POST = $_GET = $_SERVER = $_REQUEST = $_ENV = $_COOKIE = $_SESSION = [];
	}

	//--------------------------------------------------------------------

	public function testCanGrabRequestVars()
	{
		$_REQUEST['TEST'] = 5;

		$this->assertEquals(5, $this->request->getVar('TEST'));
		$this->assertNull($this->request->getVar('TESTY'));
	}

	public function testCanGrabGetVars()
	{
		$_GET['TEST'] = 5;

		$this->assertEquals(5, $this->request->getGet('TEST'));
		$this->assertNull($this->request->getGet('TESTY'));
	}

	public function testCanGrabPostVars()
	{
		$_POST['TEST'] = 5;

		$this->assertEquals(5, $this->request->getPost('TEST'));
		$this->assertNull($this->request->getPost('TESTY'));
	}

	public function testCanGrabPostBeforeGet()
	{
		$_POST['TEST'] = 5;
		$_GET['TEST']  = 3;

		$this->assertEquals(5, $this->request->getPostGet('TEST'));
		$this->assertEquals(3, $this->request->getGetPost('TEST'));
	}

	//--------------------------------------------------------------------

	public function testNoOldInput()
	{
		$this->assertNull($this->request->getOldInput('name'));
	}

	public function testCanGetOldInput()
	{
		$_SESSION['_ci_old_input'] = [
			'get'  => ['one' => 'two'],
			'post' => ['name' => 'foo'],
		];

		$this->assertEquals('foo', $this->request->getOldInput('name'));
		$this->assertEquals('two', $this->request->getOldInput('one'));
	}

	public function testCanGetOldInputDotted()
	{
		$_SESSION['_ci_old_input'] = [
			'get'  => ['apple' => ['name' => 'two']],
			'post' => ['banana' => ['name' => 'foo']],
		];

		$this->assertEquals('foo', $this->request->getOldInput('banana.name'));
		$this->assertEquals('two', $this->request->getOldInput('apple.name'));
	}

	public function testMissingOldInput()
	{
		$_SESSION['_ci_old_input'] = [
			'get'  => ['apple' => ['name' => 'two']],
			'post' => ['banana' => ['name' => 'foo']],
		];

		$this->assertNull($this->request->getOldInput('pineapple.name'));
	}

	// Reference: https://github.com/codeigniter4/CodeIgniter4/issues/1492
	public function testCanGetOldInputArray()
	{
		$_SESSION['_ci_old_input'] = [
			'get'  => ['apple' => ['name' => 'two']],
			'post' => ['banana' => ['name' => 'foo']],
		];

		$this->assertEquals(['name' => 'two'], $this->request->getOldInput('apple'));
		$this->assertEquals(['name' => 'foo'], $this->request->getOldInput('banana'));
	}

	// Reference: https://github.com/codeigniter4/CodeIgniter4/issues/1492
	/**
	 * @runInSeparateProcess
	 * @preserveGlobalState  disabled
	 */
	public function testCanSerializeOldArray()
	{
		$locations = [
			'AB' => 'Alberta',
			'BC' => 'British Columbia',
			'SK' => 'Saskatchewan',
		];
		$session   = service('session');
		$session->set(['_ci_old_input' => ['post' => ['location' => $locations]]]);

		$this->assertEquals($locations, $this->request->getOldInput('location'));
	}

	//--------------------------------------------------------------------

	public function testCanGrabServerVars()
	{
		$server                   = $this->getPrivateProperty($this->request, 'globals');
		$server['server']['TEST'] = 5;
		$this->setPrivateProperty($this->request, 'globals', $server);

		$this->assertEquals(5, $this->request->getServer('TEST'));
		$this->assertNull($this->request->getServer('TESTY'));
	}

	public function testCanGrabEnvVars()
	{
		$server                = $this->getPrivateProperty($this->request, 'globals');
		$server['env']['TEST'] = 5;
		$this->setPrivateProperty($this->request, 'globals', $server);

		$this->assertEquals(5, $this->request->getEnv('TEST'));
		$this->assertNull($this->request->getEnv('TESTY'));
	}

	public function testCanGrabCookieVars()
	{
		$_COOKIE['TEST'] = 5;

		$this->assertEquals(5, $this->request->getCookie('TEST'));
		$this->assertNull($this->request->getCookie('TESTY'));
	}

	//--------------------------------------------------------------------

	public function testStoresDefaultLocale()
	{
		$config = new App();

		$this->assertEquals($config->defaultLocale, $this->request->getDefaultLocale());
		$this->assertEquals($config->defaultLocale, $this->request->getLocale());
	}

	public function testSetLocaleSaves()
	{
		$config                   = new App();
		$config->supportedLocales = [
			'en',
			'es',
		];
		$config->defaultLocale    = 'es';
		$config->baseURL          = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), null, new UserAgent());

		$request->setLocale('en');
		$this->assertEquals('en', $request->getLocale());
	}

	public function testSetBadLocale()
	{
		$config                   = new App();
		$config->supportedLocales = [
			'en',
			'es',
		];
		$config->defaultLocale    = 'es';
		$config->baseURL          = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), null, new UserAgent());

		$request->setLocale('xx');
		$this->assertEquals('es', $request->getLocale());
	}

	//--------------------------------------------------------------------

	/**
	 * @see https://github.com/codeigniter4/CodeIgniter4/issues/2774
	 */
	public function testNegotiatesLocale()
	{
		$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-FR; q=1.0, en; q=0.5';

		$config                   = new App();
		$config->negotiateLocale  = true;
		$config->supportedLocales = [
			'fr',
			'en',
		];
		$config->baseURL          = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), null, new UserAgent());

		$this->assertEquals($config->defaultLocale, $request->getDefaultLocale());
		$this->assertEquals('fr', $request->getLocale());
	}

	public function testNegotiatesLocaleOnlyBroad()
	{
		$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr; q=1.0, en; q=0.5';

		$config                   = new App();
		$config->negotiateLocale  = true;
		$config->supportedLocales = [
			'fr',
			'en',
		];
		$config->baseURL          = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), null, new UserAgent());

		$this->assertEquals($config->defaultLocale, $request->getDefaultLocale());
		$this->assertEquals('fr', $request->getLocale());
	}

	// The negotiation tests below are not intended to exercise the HTTP\Negotiate class -
	// that is up to the NegotiateTest. These are only to make sure that the requests
	// flow through to the negotiator

	public function testNegotiatesNot()
	{
		$this->request->setHeader('Accept-Charset', 'iso-8859-5, unicode-1-1;q=0.8');

		$this->expectException(Exceptions\HTTPException::class);
		$this->request->negotiate('something bogus', ['iso-8859-5', 'unicode-1-1']);
	}

	public function testNegotiatesCharset()
	{
		//      $_SERVER['HTTP_ACCEPT_CHARSET'] = 'iso-8859-5, unicode-1-1;q=0.8';
		$this->request->setHeader('Accept-Charset', 'iso-8859-5, unicode-1-1;q=0.8');

		$this->assertEquals(strtolower($this->request->config->charset), $this->request->negotiate('charset', ['iso-8859', 'unicode-1-2']));
	}

	public function testNegotiatesMedia()
	{
		$this->request->setHeader('Accept', 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c');
		$this->assertEquals('text/html', $this->request->negotiate('media', ['text/html', 'text/x-c', 'text/x-dvi', 'text/plain']));
	}

	public function testNegotiatesEncoding()
	{
		$this->request->setHeader('Accept-Encoding', 'gzip;q=1.0, identity; q=0.4, compress;q=0.5');
		$this->assertEquals('gzip', $this->request->negotiate('encoding', ['gzip', 'compress']));
	}

	public function testNegotiatesLanguage()
	{
		$this->request->setHeader('Accept-Language', 'da, en-gb;q=0.8, en;q=0.7');
		$this->assertEquals('en', $this->request->negotiate('language', ['en', 'da']));
	}

	//--------------------------------------------------------------------

	public function testCanGrabGetRawJSON()
	{
		$json = '{"code":1, "message":"ok"}';

		$expected = [
			'code'    => 1,
			'message' => 'ok',
		];

		$config          = new App();
		$config->baseURL = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), $json, new UserAgent());

		$this->assertEquals($expected, $request->getJSON(true));
	}

	public function testCanGetAVariableFromJson()
	{
		$jsonObj = [
			'foo' => 'bar',
			'baz' => [
				'fizz' => 'buzz',
			],
		];
		$json    = json_encode($jsonObj);

		$config          = new App();
		$config->baseURL = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), $json, new UserAgent());

		$this->assertEquals('bar', $request->getJsonVar('foo'));
		$jsonVar = $request->getJsonVar('baz');
		$this->assertIsObject($jsonVar);
		$this->assertEquals('buzz', $jsonVar->fizz);
		$this->assertEquals('buzz', $request->getJsonVar('baz.fizz'));
	}

	public function testGetJsonVarAsArray()
	{
		$jsonObj = [
			'baz' => [
				'fizz' => 'buzz',
				'foo'  => 'bar',
			],
		];
		$json    = json_encode($jsonObj);

		$config          = new App();
		$config->baseURL = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), $json, new UserAgent());

		$jsonVar = $request->getJsonVar('baz', true);
		$this->assertIsArray($jsonVar);
		$this->assertEquals('buzz', $jsonVar['fizz']);
		$this->assertEquals('bar', $jsonVar['foo']);
	}

	public function testGetVarWorksWithJson()
	{
		$jsonObj = [
			'foo'  => 'bar',
			'fizz' => 'buzz',
		];
		$json    = json_encode($jsonObj);

		$config          = new App();
		$config->baseURL = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), $json, new UserAgent());
		$request->setHeader('Content-Type', 'application/json');

		$this->assertEquals('bar', $request->getVar('foo'));
		$this->assertEquals('buzz', $request->getVar('fizz'));

		$multiple = $request->getVar(['foo', 'fizz']);
		$this->assertIsArray($multiple);
		$this->assertEquals('bar', $multiple['foo']);
		$this->assertEquals('buzz', $multiple['fizz']);

		$all = $request->getVar();
		$this->assertIsObject($all);
		$this->assertEquals('bar', $all->foo);
		$this->assertEquals('buzz', $all->fizz);
	}

	public function testCanGrabGetRawInput()
	{
		$rawstring = 'username=admin001&role=administrator&usepass=0';

		$expected = [
			'username' => 'admin001',
			'role'     => 'administrator',
			'usepass'  => 0,
		];

		$config          = new App();
		$config->baseURL = 'http://example.com/';

		$request = new IncomingRequest($config, new URI(), $rawstring, new UserAgent());

		$this->assertEquals($expected, $request->getRawInput());
	}

	//--------------------------------------------------------------------

	public function testIsCLI()
	{
		// this should be the case in unit testing
		$this->assertTrue($this->request->isCLI());
	}

	public function testIsAJAX()
	{
		$this->request->appendHeader('X-Requested-With', 'XMLHttpRequest');
		$this->assertTrue($this->request->isAJAX());
	}

	//--------------------------------------------------------------------

	public function testIsSecure()
	{
		$_SERVER['HTTPS'] = 'on';
		$this->assertTrue($this->request->isSecure());
	}

	public function testIsSecureFrontEnd()
	{
		$this->request->appendHeader('Front-End-Https', 'on');
		$this->assertTrue($this->request->isSecure());
	}

	public function testIsSecureForwarded()
	{
		$this->request->appendHeader('X-Forwarded-Proto', 'https');
		$this->assertTrue($this->request->isSecure());
	}

	//--------------------------------------------------------------------

	public function testUserAgent()
	{
		$_SERVER['HTTP_USER_AGENT'] = 'Mozilla';
		$config                     = new App();
		$request                    = new IncomingRequest($config, new URI(), null, new UserAgent());
		$this->assertEquals('Mozilla', $request->getUserAgent());
	}

	//--------------------------------------------------------------------

	public function testFileCollectionFactory()
	{
		$_FILES = [
			'userfile' => [
				'name'     => 'someFile.txt',
				'type'     => 'text/plain',
				'size'     => '124',
				'tmp_name' => '/tmp/myTempFile.txt',
				'error'    => 0,
			],
		];

		$files = $this->request->getFiles();
		$this->assertCount(1, $files);

		$file = array_shift($files);
		$this->assertInstanceOf(UploadedFile::class, $file);

		$this->assertEquals('someFile.txt', $file->getName());
		$this->assertEquals(124, $file->getSize());
	}

	//--------------------------------------------------------------------

	public function testGetFileMultiple()
	{
		$_FILES = [
			'userfile' => [
				'name'     => [
					'someFile.txt',
					'someFile2.txt',
				],
				'type'     => [
					'text/plain',
					'text/plain',
				],
				'size'     => [
					'124',
					'125',
				],
				'tmp_name' => [
					'/tmp/myTempFile.txt',
					'/tmp/myTempFile2.txt',
				],
				'error'    => [
					0,
					0,
				],
			],
		];

		$gotit = $this->request->getFileMultiple('userfile');
		$this->assertEquals(124, $gotit[0]->getSize());
		$this->assertEquals(125, $gotit[1]->getSize());
	}

	//--------------------------------------------------------------------

	public function testGetFile()
	{
		$_FILES = [
			'userfile' => [
				'name'     => 'someFile.txt',
				'type'     => 'text/plain',
				'size'     => '124',
				'tmp_name' => '/tmp/myTempFile.txt',
				'error'    => 0,
			],
		];

		$gotit = $this->request->getFile('userfile');
		$this->assertEquals(124, $gotit->getSize());
	}

	//--------------------------------------------------------------------

	public function testSpoofing()
	{
		$this->request->setMethod('WINK');
		$this->assertEquals('wink', $this->request->getMethod());
	}

	/**
	 * @see https://github.com/codeigniter4/CodeIgniter4/issues/2839
	 */
	public function testGetPostEmpty()
	{
		$_POST['TEST'] = 5;
		$_GET['TEST']  = 3;
		$this->assertEquals($_POST, $this->request->getPostGet());
		$this->assertEquals($_GET, $this->request->getGetPost());
	}

	public function testWithFalseBody()
	{
		// Use `false` here to simulate file_get_contents returning a false value
		$request = new IncomingRequest(new App(), new URI(), false, new UserAgent());

		$this->assertTrue($request->getBody() !== false);
		$this->assertTrue($request->getBody() === null);
	}

	/**
	 * @see https://github.com/codeigniter4/CodeIgniter4/issues/3020
	 */
	public function testGetPostIndexNotExists()
	{
		$_POST['TEST'] = 5;
		$_GET['TEST']  = 3;
		$this->assertNull($this->request->getPostGet('gc'));
		$this->assertNull($this->request->getGetPost('gc'));
	}

	public function providePathChecks()
	{
		return [
			'not /index.php' => [
				'/test.php',
				'test.php',
			],
			'/index.php'     => [
				'/index.php',
				'/',
			],
		];
	}

	/**
	 * @dataProvider providePathChecks
	 */
	public function testExtensionPHP($path, $detectPath)
	{
		$config          = new App();
		$config->baseURL = 'http://example.com/';

		$_SERVER['REQUEST_URI'] = $path;
		$_SERVER['SCRIPT_NAME'] = $path;
		$request                = new IncomingRequest($config, new URI($path), null, new UserAgent());
		$this->assertEquals($detectPath, $request->detectPath());
	}
}


text:
package org.gradle.workers.internal;

import org.gradle.api.Transformer;
import org.gradle.api.logging.LogLevel;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.specs.Spec;
import org.gradle.initialization.SessionLifecycleListener;
import org.gradle.internal.concurrent.CompositeStoppable;
import org.gradle.internal.concurrent.Stoppable;
import org.gradle.internal.event.ListenerManager;
import org.gradle.internal.logging.LoggingManagerInternal;
import org.gradle.internal.logging.events.LogLevelChangeEvent;
import org.gradle.internal.logging.events.OutputEvent;
import org.gradle.internal.logging.events.OutputEventListener;
import org.gradle.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

public class WorkerDaemonClientsManager implements Stoppable {

    private static final Logger LOGGER = Logging.getLogger(WorkerDaemonClientsManager.class);

    private final Object lock = new Object();
    private final List<WorkerDaemonClient> allClients = new ArrayList<WorkerDaemonClient>();
    private final List<WorkerDaemonClient> idleClients = new ArrayList<WorkerDaemonClient>();

    private final WorkerDaemonStarter workerDaemonStarter;
    private final ListenerManager listenerManager;
    private final LoggingManagerInternal loggingManager;
    private final SessionLifecycleListener stopSessionScopeWorkers;
    private final OutputEventListener logLevelChangeEventListener;
    private LogLevel currentLogLevel;

    public WorkerDaemonClientsManager(WorkerDaemonStarter workerDaemonStarter, ListenerManager listenerManager, LoggingManagerInternal loggingManager) {
        this.workerDaemonStarter = workerDaemonStarter;
        this.listenerManager = listenerManager;
        this.loggingManager = loggingManager;
        this.stopSessionScopeWorkers = new StopSessionScopedWorkers();
        listenerManager.addListener(stopSessionScopeWorkers);
        this.logLevelChangeEventListener = new LogLevelChangeEventListener();
        loggingManager.addOutputEventListener(logLevelChangeEventListener);
        this.currentLogLevel = loggingManager.getLevel();
    }

    // TODO - should supply and check for the same parameters as passed to reserveNewClient()
    public WorkerDaemonClient reserveIdleClient(DaemonForkOptions forkOptions) {
        return reserveIdleClient(forkOptions, idleClients);
    }

    WorkerDaemonClient reserveIdleClient(DaemonForkOptions forkOptions, List<WorkerDaemonClient> clients) {
        synchronized (lock) {
            Iterator<WorkerDaemonClient> it = clients.iterator();
            while (it.hasNext()) {
                WorkerDaemonClient candidate = it.next();
                if (candidate.isCompatibleWith(forkOptions)) {
                    it.remove();
                    if (candidate.getLogLevel() != currentLogLevel) {
                        // TODO: Send a message to workers to change their log level rather than stopping
                        LOGGER.info("Log level has changed, stopping idle worker daemon with out-of-date log level.");
                        candidate.stop();
                    } else {
                        return candidate;
                    }
                }
            }
            return null;
        }
    }

    public WorkerDaemonClient reserveNewClient(Class<? extends WorkerProtocol<ActionExecutionSpec>> workerProtocolImplementationClass, DaemonForkOptions forkOptions) {
        //allow the daemon to be started concurrently
        WorkerDaemonClient client = workerDaemonStarter.startDaemon(workerProtocolImplementationClass, forkOptions);
        synchronized (lock) {
            allClients.add(client);
        }
        return client;
    }

    public void release(WorkerDaemonClient client) {
        synchronized (lock) {
            idleClients.add(client);
        }
    }

    @Override
    public void stop() {
        synchronized (lock) {
            stopWorkers(allClients);
            allClients.clear();
            idleClients.clear();
            listenerManager.removeListener(stopSessionScopeWorkers);
            loggingManager.removeOutputEventListener(logLevelChangeEventListener);
        }
    }

    /**
     * Select idle daemon clients to stop.
     *
     * @param selectionFunction Gets all idle daemon clients, daemons of returned clients are stopped
     */
    public void selectIdleClientsToStop(Transformer<List<WorkerDaemonClient>, List<WorkerDaemonClient>> selectionFunction) {
        synchronized (lock) {
            List<WorkerDaemonClient> sortedClients = CollectionUtils.sort(idleClients, new Comparator<WorkerDaemonClient>() {
                @Override
                public int compare(WorkerDaemonClient o1, WorkerDaemonClient o2) {
                    return new Integer(o1.getUses()).compareTo(o2.getUses());
                }
            });
            List<WorkerDaemonClient> clientsToStop = selectionFunction.transform(new ArrayList<WorkerDaemonClient>(sortedClients));
            if (!clientsToStop.isEmpty()) {
                stopWorkers(clientsToStop);
            }
        }
    }

    private void stopWorkers(List<WorkerDaemonClient> clientsToStop) {
        if (clientsToStop.size() > 0) {
            LOGGER.debug("Stopping {} worker daemon(s).", clientsToStop.size());
            CompositeStoppable.stoppable(clientsToStop).stop();
            LOGGER.info("Stopped {} worker daemon(s).", clientsToStop.size());
            idleClients.removeAll(clientsToStop);
            allClients.removeAll(clientsToStop);
        }
    }

    private class StopSessionScopedWorkers implements SessionLifecycleListener {
        @Override
        public void afterStart() { }

        @Override
        public void beforeComplete() {
            synchronized (lock) {
                List<WorkerDaemonClient> sessionScopedClients = CollectionUtils.filter(allClients, new Spec<WorkerDaemonClient>() {
                    @Override
                    public boolean isSatisfiedBy(WorkerDaemonClient client) {
                        return client.getKeepAliveMode() == KeepAliveMode.SESSION;
                    }
                });
                stopWorkers(sessionScopedClients);
            }
        }
    }

    private class LogLevelChangeEventListener implements OutputEventListener {
        @Override
        public void onOutput(OutputEvent event) {
            if (event instanceof LogLevelChangeEvent) {
                LogLevelChangeEvent logLevelChangeEvent = (LogLevelChangeEvent) event;
                if (currentLogLevel != logLevelChangeEvent.getNewLogLevel()) {
                    synchronized (lock) {
                        currentLogLevel = logLevelChangeEvent.getNewLogLevel();
                    }
                }
            }
        }
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>Rulette Server</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">

                    <form action="#" th:object="${ruleId}"
                          th:action="@{/ui/provider/{providerName}/rulesystem/{ruleSystemName}/rule
                              (providerName = ${ruleSystem.providerName}, ruleSystemName = ${ruleSystem.ruleSystemName})}">

                                Rule Id
                                <input type="text" id="ruleId" name="ruleId"/>
                                <input type="submit" class="btn btn-success" value="Search">

                    </form>

                        |
                        Evaluate Inputs
                        |
                        Add new rule

                        No records found!

                        |
                        Evaluate Inputs
                        |
                        Add new rule

                                << Prev

                        |

                        |

                                Next >>

                            Edit Rule
                            Delete Rule

                                << Prev

                    |

                    |

                            Next >>


text:
/*************************************************************************
**                                                                      **
**  Description                                                         **
**                                                                      **
** Class SingleTest embodies a single test in the GAMMA platform        **
** testing hierarchy. Such tests are direct, examining specific aspects **
** of the platform. Thus a single test will always deal with one        **
** section within one class within one Module.                          **
**                                                                      **
*************************************************************************/

#ifndef   SingleTest_h_			// Is this file already included?
#  define SingleTest_h_ 1		// If no, then remember it
#  if defined(GAMPRAGMA)		// Using the GNU compiler?
#    pragma interface			// Then this is the interface
#  endif

#include <GamGen.h>			// Know MSVCDLL (__declspec)
#include <iostream>			// Include file streams
#include <fstream>			// Include {if,of}streams
#include <string>			// Include string class
#include <iostream>

class SingleTest
  {
       int      TestStatus;			// Test status (True/False)
  std::string   TestName;			// Test name
  std::string   TestDescription;		// Test description
       int      TestRunLevel;			// Test run level
       int    (*TestTest)(std::ostream&, int);	// Test function

/* Note that above TestTest should will serve as a pointer to a test function
   that takes, as arguments, an output stream and an integer and returns an
   integer. The above function pointer declaration is NOT the same a
   int *TestTest(std::ostream&,int); which is a function which returns a
   pointer to an integer. It is possible to simplify the code with a typedef

  typedef int GTestFct(std::ostream&, int);	// Simplify code (hopefully)
  GTestFct *TestTest;				// Test function (pointer to)

   but it isn't used enough to bother, unless there are some compiler
   problems figuring out what is going on. Actually I do use this in a
   function return type later in this file (see below).                      */

// ----------------------------------------------------------------------------
// --------------------------- PRIVATE FUNCTIONS ------------------------------
// ----------------------------------------------------------------------------

// ____________________________________________________________________________
// i                      SINGLE TEST ERROR HANDLING
// ____________________________________________________________________________

/*      Input                   ST      : A single test (this)
                                eidx    : Error index
                                noret   : Flag for linefeed (0=linefeed)
        Output                  none    : Error message output
                                          Program execution stopped if fatal */

         void STerror(int eidx, int noret=0) const;
volatile void STfatality(int eidx)           const;

// ____________________________________________________________________________
// ii                       SINGLE TEST DEFAULTS
// ____________________________________________________________________________

/* Each test points to a function that takes as arguments an output stream and
   an integer and returns an integer. When there is no particular test function
   (such as during default contruction), then the test should just point to a
   default function which return true (the integer 1). This is that function.
   The function is a friend function because for a member function one will
   need to pass the argument "this" in addition. This is normally implicltly
   done, but not when we are using function pointers, which is what is used in
   this class when it calls TrueFct. A possible alternative is to use a
   static member function, but I have not learned how to do that yet.        */

//static int TrueFct(std::ostream& ostr, int RL);
friend int TrueFct(std::ostream& ostr, int RL);

public:

// ----------------------------------------------------------------------------
// ---------------------------- PUBLIC FUNCTIONS ------------------------------
// ----------------------------------------------------------------------------

// ____________________________________________________________________________
// A            SINGLE TEST CONSTRUCTION, DESTRUCTION, ASSIGNMENT
// ____________________________________________________________________________

/* These constructors set up a new single test.

        Input Arguments                     Result
        ---------------       -------------------------------------------------
               -              An empty test, just good to have, returns true

*/

MSVCDLC      SingleTest();
MSVCDLC      SingleTest(const SingleTest& ST);
MSVCDLC      ~SingleTest();
MSVCDLL void operator= (const SingleTest& ST);

// ____________________________________________________________________________
// B                        SINGLE TEST ACCESS FUNCTIONS
// ____________________________________________________________________________

/*         Input                ST : A single test (this)
                  (name)      name : The name of the test     (setting name)
                  (status)  status : Current test status      (setting status)
                  (descr)    descr : Current test description (setting describ)
                  (runlev)  runlev : Current test run level   (setting runlev)
                  (test)      test : Current test             (setting test)
           Output (name)      name : The name of the test     (getting name)
                  (status)  status : Current test status      (getting status)
                  (descr)    descr : Current test description (getting describ)
                  (runlev)  runlev : Current test run level   (getting runlev)
                  (test)      test : Result of test test      (getting test)
                              void : If setting interal value

   Note that none of these function will run the test. They only allow users
   to access the current test parameters.                                    */

MSVCDLL const std::string& name()      const;		// Get name
MSVCDLL       int          status()    const;		// Get status
MSVCDLL const std::string& describe()  const;		// Get descript
MSVCDLL       int          runlevel()  const;		// Get runlev
  typedef int GTestFct(std::ostream&, int);	// Simplify code (hopefully)
MSVCDLL       GTestFct*    test()     const;		// Test function (pointer to)

MSVCDLL void name(const std::string& Name);			// Set name
MSVCDLL void status(    int          Status);		// Set status
MSVCDLL void describe(const std::string& D);		// Set decript
MSVCDLL void runlevel(  int          RunLev);		// Set runlevel
MSVCDLL void test(int (*T)(std::ostream& O, int RF));	// Set test

// ____________________________________________________________________________
// C                       SINGLE TEST TESTING FUNCTIONS
// ____________________________________________________________________________

/* Each test has a pointer to a function that is used for actual testing.  This
   test is not invoked unless the user requests that it be run.  The functions
   in this section allow for that. Note that once a test has been run test
   status flag is set (default = -1 ==> untested) so that subsequent testing
   within a loop can readily be avoided.                                     */

MSVCDLL int runtest(std::ostream&   ostr, int force=1);
MSVCDLL int RunLevel0(std::ostream& ostr, int force=1);
MSVCDLL int RunLevel1(std::ostream& ostr, int force=1);
MSVCDLL int RunLevel2(std::ostream& ostr, int force=1);
MSVCDLL int RunLevel3(std::ostream& ostr, int force=1);
MSVCDLL int RunLevel4(std::ostream& ostr, int force=1);

// ____________________________________________________________________________
// D                       SINGLE TEST OUTPUT FUNCTIONS
// ____________________________________________________________________________

/*              Input           ST   : A single test (this)
                                ostr : Output ASCII file stream
                                full : Flag for amount of output
                Return          void : Test is sent to the output stream    */

MSVCDLL        std::ostream& print(std::ostream& ostr) const;
MSVCDLL friend std::ostream& operator<< (std::ostream& ostr, const SingleTest& ST);

// ____________________________________________________________________________
// E                 SINGLE TEST STL LIST SUPPORT FUNCTIONS
// ____________________________________________________________________________

/* These functions are MUST be defined if one desired to build C++ STL lists
   and vectors of single test, i.e. list<SingleTest> and vector<SingleTest>.
   They don't make a lot of sense and aren't really used, it is just that
   some compilers complain if they are not present (MSVC++ for one)          */

MSVCDLL bool operator==(const SingleTest& ST) const;
MSVCDLL bool operator!=(const SingleTest& ST) const;
MSVCDLL bool operator< (const SingleTest& ST) const;
MSVCDLL bool operator> (const SingleTest& ST) const;

// ____________________________________________________________________________
// F                       SINGLE TEST OUTPUT FUNCTIONS
// ____________________________________________________________________________

/* These functions facilitate output of single testing in a nicely formatted
   fashion. Note that when test results are listed only the status flags are
   utilized. That is, NO TESTS ARE RUN.  So, any testing should be performed
   prior to calling test output functions.                                   */

MSVCDLL std::ostream& Header(std::ostream& ostr, const std::string& S) const;
MSVCDLL std::ostream& Header(std::ostream& ostr) const;
MSVCDLL std::ostream& Result(std::ostream& ostr) const;
};

#endif							// SingleTest.h


text:
@class SBFolder, SBIconView, UITouch;

@protocol SBIconViewDelegate <NSObject>

@optional
- (double)iconLabelWidth;
- (_Bool)iconViewDisplaysCloseBox:(SBIconView *)arg1;
- (_Bool)iconViewDisplaysBadges:(SBIconView *)arg1;
- (void)iconCloseBoxTapped:(SBIconView *)arg1;
- (void)icon:(SBIconView *)arg1 openFolder:(SBFolder *)arg2 animated:(_Bool)arg3;
- (_Bool)icon:(SBIconView *)arg1 canReceiveGrabbedIcon:(SBIconView *)arg2;
- (void)iconTapped:(SBIconView *)arg1;
- (_Bool)iconShouldAllowTap:(SBIconView *)arg1;
- (void)icon:(SBIconView *)arg1 touchEnded:(_Bool)arg2;
- (void)icon:(SBIconView *)arg1 touchMoved:(UITouch *)arg2;
- (void)iconTouchBegan:(SBIconView *)arg1;
- (void)iconHandleLongPress:(SBIconView *)arg1;
@end


text:
#pragma once
#include <aws/route53-recovery-control-config/Route53RecoveryControlConfig_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/route53-recovery-control-config/model/RuleConfig.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Route53RecoveryControlConfig
{
namespace Model
{

  /**
   *
A new gating rule for a control panel.

See Also:
   AWS
   * API Reference

   */
  class AWS_ROUTE53RECOVERYCONTROLCONFIG_API NewGatingRule
  {
  public:
    NewGatingRule();
    NewGatingRule(Aws::Utils::Json::JsonView jsonValue);
    NewGatingRule& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline const Aws::String& GetControlPanelArn() const{ return m_controlPanelArn; }

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline bool ControlPanelArnHasBeenSet() const { return m_controlPanelArnHasBeenSet; }

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline void SetControlPanelArn(const Aws::String& value) { m_controlPanelArnHasBeenSet = true; m_controlPanelArn = value; }

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline void SetControlPanelArn(Aws::String&& value) { m_controlPanelArnHasBeenSet = true; m_controlPanelArn = std::move(value); }

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline void SetControlPanelArn(const char* value) { m_controlPanelArnHasBeenSet = true; m_controlPanelArn.assign(value); }

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline NewGatingRule& WithControlPanelArn(const Aws::String& value) { SetControlPanelArn(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline NewGatingRule& WithControlPanelArn(Aws::String&& value) { SetControlPanelArn(std::move(value)); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the control panel.

     */
    inline NewGatingRule& WithControlPanelArn(const char* value) { SetControlPanelArn(value); return *this;}

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline const Aws::Vector<Aws::String>& GetGatingControls() const{ return m_gatingControls; }

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline bool GatingControlsHasBeenSet() const { return m_gatingControlsHasBeenSet; }

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline void SetGatingControls(const Aws::Vector<Aws::String>& value) { m_gatingControlsHasBeenSet = true; m_gatingControls = value; }

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline void SetGatingControls(Aws::Vector<Aws::String>&& value) { m_gatingControlsHasBeenSet = true; m_gatingControls = std::move(value); }

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline NewGatingRule& WithGatingControls(const Aws::Vector<Aws::String>& value) { SetGatingControls(value); return *this;}

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline NewGatingRule& WithGatingControls(Aws::Vector<Aws::String>&& value) { SetGatingControls(std::move(value)); return *this;}

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline NewGatingRule& AddGatingControls(const Aws::String& value) { m_gatingControlsHasBeenSet = true; m_gatingControls.push_back(value); return *this; }

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline NewGatingRule& AddGatingControls(Aws::String&& value) { m_gatingControlsHasBeenSet = true; m_gatingControls.push_back(std::move(value)); return *this; }

    /**
     *
The gating controls for the new gating rule. That is, routing controls that
     * are evaluated by the rule configuration that you specify.

     */
    inline NewGatingRule& AddGatingControls(const char* value) { m_gatingControlsHasBeenSet = true; m_gatingControls.push_back(value); return *this; }

    /**
     *
The name for the new gating rule.

     */
    inline const Aws::String& GetName() const{ return m_name; }

    /**
     *
The name for the new gating rule.

     */
    inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }

    /**
     *
The name for the new gating rule.

     */
    inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }

    /**
     *
The name for the new gating rule.

     */
    inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }

    /**
     *
The name for the new gating rule.

     */
    inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }

    /**
     *
The name for the new gating rule.

     */
    inline NewGatingRule& WithName(const Aws::String& value) { SetName(value); return *this;}

    /**
     *
The name for the new gating rule.

     */
    inline NewGatingRule& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}

    /**
     *
The name for the new gating rule.

     */
    inline NewGatingRule& WithName(const char* value) { SetName(value); return *this;}

    /**
     *
The criteria that you set for specific gating controls (routing controls)
     * that designates how many control states must be ON to allow you to change (set
     * or unset) the target control states.

     */
    inline const RuleConfig& GetRuleConfig() const{ return m_ruleConfig; }

    /**
     *
The criteria that you set for specific gating controls (routing controls)
     * that designates how many control states must be ON to allow you to change (set
     * or unset) the target control states.

     */
    inline bool RuleConfigHasBeenSet() const { return m_ruleConfigHasBeenSet; }

    /**
     *
The criteria that you set for specific gating controls (routing controls)
     * that designates how many control states must be ON to allow you to change (set
     * or unset) the target control states.

     */
    inline void SetRuleConfig(const RuleConfig& value) { m_ruleConfigHasBeenSet = true; m_ruleConfig = value; }

    /**
     *
The criteria that you set for specific gating controls (routing controls)
     * that designates how many control states must be ON to allow you to change (set
     * or unset) the target control states.

     */
    inline void SetRuleConfig(RuleConfig&& value) { m_ruleConfigHasBeenSet = true; m_ruleConfig = std::move(value); }

    /**
     *
The criteria that you set for specific gating controls (routing controls)
     * that designates how many control states must be ON to allow you to change (set
     * or unset) the target control states.

     */
    inline NewGatingRule& WithRuleConfig(const RuleConfig& value) { SetRuleConfig(value); return *this;}

    /**
     *
The criteria that you set for specific gating controls (routing controls)
     * that designates how many control states must be ON to allow you to change (set
     * or unset) the target control states.

     */
    inline NewGatingRule& WithRuleConfig(RuleConfig&& value) { SetRuleConfig(std::move(value)); return *this;}

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline const Aws::Vector<Aws::String>& GetTargetControls() const{ return m_targetControls; }

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline bool TargetControlsHasBeenSet() const { return m_targetControlsHasBeenSet; }

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline void SetTargetControls(const Aws::Vector<Aws::String>& value) { m_targetControlsHasBeenSet = true; m_targetControls = value; }

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline void SetTargetControls(Aws::Vector<Aws::String>&& value) { m_targetControlsHasBeenSet = true; m_targetControls = std::move(value); }

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline NewGatingRule& WithTargetControls(const Aws::Vector<Aws::String>& value) { SetTargetControls(value); return *this;}

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline NewGatingRule& WithTargetControls(Aws::Vector<Aws::String>&& value) { SetTargetControls(std::move(value)); return *this;}

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline NewGatingRule& AddTargetControls(const Aws::String& value) { m_targetControlsHasBeenSet = true; m_targetControls.push_back(value); return *this; }

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline NewGatingRule& AddTargetControls(Aws::String&& value) { m_targetControlsHasBeenSet = true; m_targetControls.push_back(std::move(value)); return *this; }

    /**
     *
Routing controls that can only be set or unset if the specified RuleConfig
     * evaluates to true for the specified GatingControls. For example, say you have
     * three gating controls, one for each of three Amazon Web Services Regions. Now
     * you specify AtLeast 2 as your RuleConfig. With these settings, you can only
     * change (set or unset) the routing controls that you have specified as
     * TargetControls if that rule evaluates to true.

In other words, your
     * ability to change the routing controls that you have specified as TargetControls
     * is gated by the rule that you set for the routing controls in
     * GatingControls.

     */
    inline NewGatingRule& AddTargetControls(const char* value) { m_targetControlsHasBeenSet = true; m_targetControls.push_back(value); return *this; }

    /**
     *
An evaluation period, in milliseconds (ms), during which any request against
     * the target routing controls will fail. This helps prevent "flapping" of state.
     * The wait period is 5000 ms by default, but you can choose a custom value.

     */
    inline int GetWaitPeriodMs() const{ return m_waitPeriodMs; }

    /**
     *
An evaluation period, in milliseconds (ms), during which any request against
     * the target routing controls will fail. This helps prevent "flapping" of state.
     * The wait period is 5000 ms by default, but you can choose a custom value.

     */
    inline bool WaitPeriodMsHasBeenSet() const { return m_waitPeriodMsHasBeenSet; }

    /**
     *
An evaluation period, in milliseconds (ms), during which any request against
     * the target routing controls will fail. This helps prevent "flapping" of state.
     * The wait period is 5000 ms by default, but you can choose a custom value.

     */
    inline void SetWaitPeriodMs(int value) { m_waitPeriodMsHasBeenSet = true; m_waitPeriodMs = value; }

    /**
     *
An evaluation period, in milliseconds (ms), during which any request against
     * the target routing controls will fail. This helps prevent "flapping" of state.
     * The wait period is 5000 ms by default, but you can choose a custom value.

     */
    inline NewGatingRule& WithWaitPeriodMs(int value) { SetWaitPeriodMs(value); return *this;}

  private:

    Aws::String m_controlPanelArn;
    bool m_controlPanelArnHasBeenSet;

    Aws::Vector<Aws::String> m_gatingControls;
    bool m_gatingControlsHasBeenSet;

    Aws::String m_name;
    bool m_nameHasBeenSet;

    RuleConfig m_ruleConfig;
    bool m_ruleConfigHasBeenSet;

    Aws::Vector<Aws::String> m_targetControls;
    bool m_targetControlsHasBeenSet;

    int m_waitPeriodMs;
    bool m_waitPeriodMsHasBeenSet;
  };

} // namespace Model
} // namespace Route53RecoveryControlConfig
} // namespace Aws


text:
FROM multiarch/ubuntu-debootstrap:amd64-wily       # arch=amd64
#FROM multiarch/ubuntu-debootstrap:armhf-wily      # arch=armhf
#FROM multiarch/ubuntu-debootstrap:powerpc-wily    # arch=powerpc

ARG ARCH

RUN apt-get update && apt-get install --no-install-recommends -y -q wget

RUN [ "${ARCH}" = "amd64" ] || echo "Special build instruction for amd64"

ADD overlay-common  /overlay
ADD overlay-amd64   /overlay                      # arch=amd64
#ADD overlay-armhf   /overlay                      # arch=armhf
#ADD overlay-powerpc /overlay                      # arch=powerpc

CMD ["uname -a; cowsay hello world"]


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IndusValley.Banking {
    public class Stock {
        public string Symbol { get; set; }
        public decimal Shares { get; set; }

        public void Purchase(decimal shares) {
            this.Shares += shares;
        }

        public void Sell(decimal shares) {
            this.Shares -= shares;
        }
    }
}


text:
package org.lodder.subtools.multisubdownloader.framework.event;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class EventBag {
    protected Map<String, Object> attributes = new HashMap<>();

    public Object getAttribute(String name) {
        if (this.attributes.containsKey(name)) {
            return this.attributes.get(name);
        }
        return null;
    }

    public Collection<String> getAttributeNames() {
        return this.attributes.keySet();
    }

    public void setAttribute(String name, Object object) {
        this.attributes.put(name, object);
    }
}


text:
var Room = require('../models/room');

module.exports = function (router) {

  router.route('/rooms')

    // get rooms (GET http://localhost:4020/api/rooms)
    .get(function (req, res) {
      console.log('get rooms');

      Room.find(function (err, rooms) {
        if (err) {
          console.error(err);
          res.status(500).send(err);
          return;
        }

        res.json(rooms);
      });
    })

    // create a room (POST http://localhost:4050/api/rooms)
    .post(function(req, res) {
      console.log('create room');

      var room = new Room(req.body);

      room.save(function(err) {
        if (err) {
          console.error(err);
          res.status(500).send(err);
          return;
        }

        res.json({ message: 'Room created!' });
      });
    });

  router.route('/rooms/:room_id')

    // get the room with that id (GET http://localhost:4050/api/rooms/:room_id)
    .get(function(req, res) {
      console.log('get room ' + req.params.room_id);

      Room.findById(req.params.room_id, function(err, room) {
        if (err) {
          console.error(err);
          res.status(500).send(err);
          return;
        }

        if (room) {
          res.json(room);
        } else {
          console.log("< no room with that ID yet.");
          res.status(404).send('Not found');
        }
      });
    })

    // update the room with this id (PUT http://localhost:4050/api/rooms/:room_id)
    .put(function(req, res) {
      console.log('update room ' + req.params.room_id);

      Room.update({ _id: req.params.room_id }, req.body, function(err) {
        if (err) {
          console.error(err);
          res.status(500).send(err);
          return;
        }

        res.json({ message: 'Room updated!' });
      });
    })

    // delete the room with this id (DELETE http://localhost:4050/api/rooms/:room_id)
    .delete(function(req, res) {
      console.log('delete room ' + req.params.room_id);

      Room.remove({
        _id: req.params.room_id
      }, function(err) {
        if (err) {
          console.error(err);
          res.status(500).send(err);
          return;
        }

        res.json({ message: 'Successfully deleted' });
      });
    });

};


text:
using System;
using Xunit;

namespace Humanizer.Tests.Localisation.uzLatn
{
    [UseCulture("uz-Latn-UZ")]
    public class TimeSpanHumanizeTests
    {

        [Theory]
        [InlineData(14, "2 hafta")]
        [InlineData(7, "1 hafta")]
        public void Weeks(int days, string expected)
        {
            var actual = TimeSpan.FromDays(days).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(6, "6 kun")]
        [InlineData(2, "2 kun")]
        public void Days(int days, string expected)
        {
            var actual = TimeSpan.FromDays(days).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 soat")]
        [InlineData(1, "1 soat")]
        public void Hours(int hours, string expected)
        {
            var actual = TimeSpan.FromHours(hours).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 minut")]
        [InlineData(1, "1 minut")]
        public void Minutes(int minutes, string expected)
        {
            var actual = TimeSpan.FromMinutes(minutes).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 sekund")]
        [InlineData(1, "1 sekund")]
        public void Seconds(int seconds, string expected)
        {
            var actual = TimeSpan.FromSeconds(seconds).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 millisekund")]
        [InlineData(1, "1 millisekund")]
        public void Milliseconds(int ms, string expected)
        {
            var actual = TimeSpan.FromMilliseconds(ms).Humanize();
            Assert.Equal(expected, actual);
        }

        [Fact]
        public void NoTime()
        {
            var noTime = TimeSpan.Zero;
            var actual = noTime.Humanize();
            Assert.Equal("vaqt yo`q", actual);
        }
    }
}


text:
using System;

namespace SWAPISDK.Entities
{
    // https://swapi.co/api/people/schema
    public class Person : Entity
    {
        public string Name { get; set; }
        public string Height { get; set; }
        public string Mass { get; set; }
        public string Hair_color { get; set; }
        public string Skin_color { get; set; }
        public string Eye_color { get; set; }
        public string Birth_year { get; set; }
        public string Gender { get; set; }
        public string Homeworld { get; set; }
        public string[] Films { get; set; }
        public string[] Species { get; set; }
        public string[] Vehicles { get; set; }
        public string[] Starships { get; set; }
    }

}


text:
module LoyalSpider
  module FetchAble
    # 有返回信息的
    def self.included base
      base.class_eval do
        attr_accessor :fetch_options

        include InstanceMethods
        extend  ClassMethods
      end
    end

    module ClassMethods
      # 配置蜘蛛的抓取配置
      def config_loyal_spider_default_fetch_options options={}
        @default_fetch_options ||= options
      end

      def default_fetch_options
        @default_fetch_options ||= {}
      end

      def fetch options={}, &block
        self.new.fetch options, &block
      end
    end

    module InstanceMethods
      def base_url
        self.fetch_options.base_url
      end

      def fetch options={}, &block
        self._before_fetch options if self.respond_to?(:_before_fetch, true)
        self.before_fetch options if self.respond_to?(:before_fetch, true)

        result = _perform_fetch options, &block

        if result.success?
          self.after_fetch_success(result) if self.respond_to?(:after_fetch_success, true)
          self._after_fetch_success(result) if self.respond_to?(:_after_fetch_success, true)
        else
          self.after_fetch_fail(result) if self.respond_to?(:after_fetch_fail, true)
          self._after_fetch_fail(result) if self.respond_to?(:_after_fetch_fail, true)
        end

        result
      end

      private

      def _perform_fetch options={}, &block
        _fetch_url = self.respond_to?(:fetch_url, true) ? self.fetch_url : self.url

        @fetch_options = ::LoyalSpider::FetchOptions.new(
          ::LoyalSpider::HashUtil.deep_merge(self.class.default_fetch_options, options).merge(
            :url => _fetch_url
          )
        )

        begin
          ::RestClient::Request.execute @fetch_options.net_options do |response, request, response_result, &_block|
            response_code = response.code

            response_status = if (200..207).include?(response_code)
                                :success
                              elsif (300..307).include?(response_code)
                                :redirect
                              elsif (400..450).include?(response_code)
                                :request_error
                              else
                                :server_error
                              end

            _result = ::LoyalSpider::FetchResult.new(
              :response_status  => response_status,
              :response_code    => response_code,
              :response         => response.force_encoding(self.fetch_options.encoding_type).encode!('UTF-8'),
              :request          => request,
              :response_result  => response_result,
              :fetch_options    => self.fetch_options,
              :url              => _fetch_url
            )

            if block_given?
              block.call _result, &_block
            end

            _result
          end
        rescue Exception => exception
          _error_result = {
            :response         => nil,
            :request          => nil,
            :response_result  => nil,
            :fetch_options    => self.fetch_options,
            :url              => _fetch_url,
            :exception        => exception
          }

          case exception
          when ::SocketError
            _error_result.merge!(
              :response_status  => :socket_error,
              :response_code    => 502
            )
          else
            _error_result.merge!(
              :response_status  => :request_error,
              :response_code    => 400
            )
          end

          _result = ::LoyalSpider::FetchResult.new(
            _error_result
          )

          if block_given?
            block.call _result, &_block
          end

          _result

        end

      end
    end
  end
end


text:
All notable changes to this project will be documented in this file. Created by Gerard Ng and Ninew Mai

## [1.0.0] - 2016-10-21
### Added
- lab 5 release version 1.0 @New3 @gerardng

### Changed - 2016-10-21
- Created the template-shopping.php to show the shopping view page @New3
- Created the Shopping.php controller @New3
- Created the receipt.md to add the contents to show on shopping page @New3

### Changed - 2016-10-21
- Created the template-secondary.php to show the first page in different way from the first task @New3
- Created the hiring.php controller @New3
- Added Parsedown.php @New3
- Created the jobs.md to add the contents to show on hiring page @New3

### Changed - 2016-10-21
 - Made render more flexible @gerardng
 - Edited template to fit Bootstrap @gerardng
 - Changed navbar view @gerardng
 - Changed controller to use SQl database @gerardng
 - Changed homepage body controller @gerarnd

## [Unreleased] - 2016-10-14
### Added
- forked CodeIgniter3.1-starter3 @gerardng, @New3


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memmove_84_goodG2B.cpp
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml
Template File: sources-sink-84_goodG2B.tmpl.cpp
*/
/*
 * @description
 * CWE: 122 Heap Based Buffer Overflow
 * BadSource:  Allocate memory for a string, but do not allocate space for NULL terminator
 * GoodSource: Allocate enough memory for a string and the NULL terminator
 * Sinks: memmove
 *    BadSink : Copy string to data using memmove()
 * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use
 *
 * */
#ifndef OMITGOOD

#include "std_testcase.h"
#include "CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memmove_84.h"

namespace CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memmove_84
{
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memmove_84_goodG2B::CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memmove_84_goodG2B(char * dataCopy)
{
    data = dataCopy;
    /* FIX: Allocate space for a null terminator */
    data = (char *)malloc((10+1)*sizeof(char));
}

CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memmove_84_goodG2B::~CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memmove_84_goodG2B()
{
    {
        char source[10+1] = SRC_STRING;
        /* Copy length + 1 to include NUL terminator from source */
        /* POTENTIAL FLAW: data may not have enough space to hold source */
        memmove(data, source, (strlen(source) + 1) * sizeof(char));
        printLine(data);
        free(data);
    }
}
}
#endif /* OMITGOOD */


text:
import numpy as np
import warnings
import unittest
import paddle
import paddle.fluid as fluid
from paddle.fluid.layers.device import get_places
from paddle.fluid.executor import as_numpy

class TestSaveModelWithoutVar(unittest.TestCase):
    def test_no_var_save(self):
        data = fluid.layers.data(
            name='data',
            shape=[-1, 1],
            dtype='float32',
            append_batch_size=False)
        data_plus = data + 1

        if fluid.core.is_compiled_with_cuda():
            place = fluid.core.CUDAPlace(0)
        else:
            place = fluid.core.CPUPlace()

        exe = fluid.Executor(place)
        exe.run(fluid.default_startup_program())

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")

            fluid.io.save_inference_model(
                dirname='test',
                feeded_var_names=['data'],
                target_vars=[data_plus],
                executor=exe,
                model_filename='model',
                params_filename='params')
            expected_warn = "no variable in your model, please ensure there are any variables in your model to save"
            self.assertTrue(len(w) > 0)
            self.assertTrue(expected_warn == str(w[0].message))

if __name__ == '__main__':
    unittest.main()


text:
The API server custom features were migrated to the admission webhook approach.

The table converter API server feature was migrated to the [Additional Printer Columns](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#additional-printer-columns) feature.

## Project changes

The architecture after the migration looks as follows:

<img src="/docs/images/current.png" width="75%" height="75%">

The Service Catalog resources are grouped under the `svcat` name. With that feature, you can list them with the `kubectl get svcat` command.

### Chart changes

The following files were added to the Service Catalog helm chart:

- **crds.yaml** - CustomResourceDefinitions for the Service Catalog resources
- **webhook-deployment.yaml** - webhook server deployment
- **webhook-register.yaml** - registration of the webhook server operations
- **webhook-service.yaml** - service for the webhook server
- **cleaner-job.yaml** - creates the `pre-delete` job which ensures that all CRDs and CRs are removed after helm release deletion

These files were deleted from the Service Catalog helm chart because they are not necessary anymore due to the API server removal:

- **apiregistration.yaml**
- **apiserver-deployment.yaml**
- **apiserver-service.yaml**
- **etcd-pvc.yaml**

All the webhook server configuration can be found under the `webhook` field in the chart's `values.yaml` file.

### Code changes

The following code changes were introduced to the Service Catalog:

- **pkg/webhookutil** - under this directory you can find the common logic used in the webhook server implementation
- **pkg/webhook/servicecatalog** - here you can find the webhook server logic for all of the Service Catalog resources
- **cmd/webhook/server** - the implementation of the webhook server where you can find the validation and mutation webhook registration
- **pkg/cleaner** - responsible for removing CRD and CR when removing a helm release
- **pkg/probe** - responsible for checking if webhook/controller is ready to use (readiness probe), especially if all required CRDs exist and have specific state

All of the webhook logic is covered by the unit tests. The API server tests were deleted.

## Implementation

Mutating and validating admission webhooks are registered in the chart's file **webhook-register.yaml**. For example, the registration of the Service Instances looks as follows:

```yaml
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
  name: {{ template "fullname" . }}-webhook
  namespace: "{{ .Release.Namespace }}"
webhooks:
- name: mutating.serviceinstances.servicecatalog.k8s.io
  clientConfig:
    caBundle: {{ b64enc $ca.Cert }}
    service:
      name: {{ template "fullname" . }}-webhook
      namespace: "{{ .Release.Namespace }}"
      path: "/mutating-serviceinstances"
  failurePolicy: Fail
  rules:
  - operations: [ "CREATE", "UPDATE" ]
    apiGroups: ["servicecatalog.k8s.io"]
    apiVersions: ["v1beta1"]
    resources: ["serviceinstances"]

---

apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
  name: {{ template "fullname" . }}-validating-webhook
  namespace: "{{ .Release.Namespace }}"
webhooks:
- name: validating.serviceinstances.servicecatalog.k8s.io
  clientConfig:
    caBundle: {{ b64enc $ca.Cert }}
    service:
      name: {{ template "fullname" . }}-webhook
      namespace: "{{ .Release.Namespace }}"
      path: "/validating-serviceinstances"
  failurePolicy: Fail
  rules:
  - operations: [ "CREATE", "UPDATE" ]
    apiGroups: ["servicecatalog.k8s.io"]
    apiVersions: ["v1beta1"]
    resources: ["serviceinstances"]
```

> **NOTE:** Each kind is registered separately in the **webhooks** array.

If the resource is registered, the webhook logic will be triggered when the registered operation on this resource occurs. The example of the webhook logic implementation looks as follows:

```go
// Handle admission requests.
func (h *CreateUpdateHandler) Handle(ctx context.Context, req admission.Request) admission.Response {
	si := &sc.ServiceInstance{}
	webhookutil.MatchKinds(si, req.Kind)
	h.decoder.Decode(req, si)

	switch req.Operation {
	case admissionTypes.Create:
		h.mutateOnCreate(ctx, req, mutated)
	case admissionTypes.Update:
		oldObj := &sc.ServiceInstance{}
		h.decoder.DecodeRaw(req.OldObject, oldObj)
		h.mutateOnUpdate(ctx, req, oldObj, mutated)
	default:
		return admission.Allowed("action not taken")
	}

	rawMutated, err := json.Marshal(mutated)
	return admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, rawMutated)
}
```

> **NOTE:** The webhook implementation logic is common for all of the resources.

For the webhook server implementation, the [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) dependency is used in the latest version - `v0.2.0-beta.0`.