text:
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-underscore-dangle, prefer-arrow-callback, max-len, one-var, one-var-declaration-per-line, no-unused-vars, object-shorthand, comma-dangle, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */
/* global Issuable */
/* global ListMilestone */
import _ from 'underscore';

(function() {
  this.MilestoneSelect = (function() {
    function MilestoneSelect(currentProject, els) {
      var _this, $els;
      if (currentProject != null) {
        _this = this;
        this.currentProject = typeof currentProject === 'string' ? JSON.parse(currentProject) : currentProject;
      }

      $els = $(els);

      if (!els) {
        $els = $('.js-milestone-select');
      }

      $els.each(function(i, dropdown) {
        var $block, $dropdown, $loading, $selectbox, $sidebarCollapsedValue, $value, abilityName, collapsedSidebarLabelTemplate, defaultLabel, defaultNo, issuableId, issueUpdateURL, milestoneLinkNoneTemplate, milestoneLinkTemplate, milestonesUrl, projectId, selectedMilestone, selectedMilestoneDefault, showAny, showNo, showUpcoming, showStarted, useId, showMenuAbove;
        $dropdown = $(dropdown);
        projectId = $dropdown.data('project-id');
        milestonesUrl = $dropdown.data('milestones');
        issueUpdateURL = $dropdown.data('issueUpdate');
        showNo = $dropdown.data('show-no');
        showAny = $dropdown.data('show-any');
        showMenuAbove = $dropdown.data('showMenuAbove');
        showUpcoming = $dropdown.data('show-upcoming');
        showStarted = $dropdown.data('show-started');
        useId = $dropdown.data('use-id');
        defaultLabel = $dropdown.data('default-label');
        defaultNo = $dropdown.data('default-no');
        issuableId = $dropdown.data('issuable-id');
        abilityName = $dropdown.data('ability-name');
        $selectbox = $dropdown.closest('.selectbox');
        $block = $selectbox.closest('.block');
        $sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon');
        $value = $block.find('.value');
        $loading = $block.find('.block-loading').fadeOut();
        selectedMilestoneDefault = (showAny ? '' : null);
        selectedMilestoneDefault = (showNo && defaultNo ? 'No Milestone' : selectedMilestoneDefault);
        selectedMilestone = $dropdown.data('selected') || selectedMilestoneDefault;
        if (issueUpdateURL) {
          milestoneLinkTemplate = _.template('<a href="/<%- full_path %>/milestones/<%- iid %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %>');
          milestoneLinkNoneTemplate = 'None';
          collapsedSidebarLabelTemplate = _.template('<span class="has-tooltip" data-container="body" title="<%- remaining %>" data-placement="left"> <%- title %> ');
        }
        return $dropdown.glDropdown({
          showMenuAbove: showMenuAbove,
          data: function(term, callback) {
            return $.ajax({
              url: milestonesUrl
            }).done(function(data) {
              var extraOptions = [];
              if (showAny) {
                extraOptions.push({
                  id: 0,
                  name: '',
                  title: 'Any Milestone'
                });
              }
              if (showNo) {
                extraOptions.push({
                  id: -1,
                  name: 'No Milestone',
                  title: 'No Milestone'
                });
              }
              if (showUpcoming) {
                extraOptions.push({
                  id: -2,
                  name: '#upcoming',
                  title: 'Upcoming'
                });
              }
              if (showStarted) {
                extraOptions.push({
                  id: -3,
                  name: '#started',
                  title: 'Started'
                });
              }
              if (extraOptions.length) {
                extraOptions.push('divider');
              }

              callback(extraOptions.concat(data));
              if (showMenuAbove) {
                $dropdown.data('glDropdown').positionMenuAbove();
              }
              $(`[data-milestone-id="${selectedMilestone}"] > a`).addClass('is-active');
            });
          },
          renderRow: function(milestone) {
            return `

                  ${_.escape(milestone.title)}

            `;
          },
          filterable: true,
          search: {
            fields: ['title']
          },
          selectable: true,
          toggleLabel: function(selected, el, e) {
            if (selected && 'id' in selected && $(el).hasClass('is-active')) {
              return selected.title;
            } else {
              return defaultLabel;
            }
          },
          defaultLabel: defaultLabel,
          fieldName: $dropdown.data('field-name'),
          text: function(milestone) {
            return _.escape(milestone.title);
          },
          id: function(milestone) {
            if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) {
              return milestone.name;
            } else {
              return milestone.id;
            }
          },
          isSelected: function(milestone) {
            return milestone.name === selectedMilestone;
          },
          hidden: function() {
            $selectbox.hide();
            // display:block overrides the hide-collapse rule
            return $value.css('display', '');
          },
          opened: function(e) {
            const $el = $(e.currentTarget);
            if ($dropdown.hasClass('js-issue-board-sidebar')) {
              selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault;
            }
            $('a.is-active', $el).removeClass('is-active');
            $(`[data-milestone-id="${selectedMilestone}"] > a`, $el).addClass('is-active');
          },
          vue: $dropdown.hasClass('js-issue-board-sidebar'),
          clicked: function(options) {
            const { $el, e } = options;
            let selected = options.selectedObj;
            var data, isIssueIndex, isMRIndex, isSelecting, page, boardsStore;
            page = $('body').data('page');
            isIssueIndex = page === 'projects:issues:index';
            isMRIndex = (page === page && page === 'projects:merge_requests:index');
            isSelecting = (selected.name !== selectedMilestone);
            selectedMilestone = isSelecting ? selected.name : selectedMilestoneDefault;
            if ($dropdown.hasClass('js-filter-bulk-update') || $dropdown.hasClass('js-issuable-form-dropdown')) {
              e.preventDefault();
              return;
            }

            if ($dropdown.closest('.add-issues-modal').length) {
              boardsStore = gl.issueBoards.ModalStore.store.filter;
            }

            if (boardsStore) {
              boardsStore[$dropdown.data('field-name')] = selected.name;
              e.preventDefault();
            } else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) {
              return Issuable.filterResults($dropdown.closest('form'));
            } else if ($dropdown.hasClass('js-filter-submit')) {
              return $dropdown.closest('form').submit();
            } else if ($dropdown.hasClass('js-issue-board-sidebar')) {
              if (selected.id !== -1 && isSelecting) {
                gl.issueBoards.boardStoreIssueSet('milestone', new ListMilestone({
                  id: selected.id,
                  title: selected.name
                }));
              } else {
                gl.issueBoards.boardStoreIssueDelete('milestone');
              }

              $dropdown.trigger('loading.gl.dropdown');
              $loading.removeClass('hidden').fadeIn();

              gl.issueBoards.BoardsStore.detail.issue.update($dropdown.attr('data-issue-update'))
                .then(function () {
                  $dropdown.trigger('loaded.gl.dropdown');
                  $loading.fadeOut();
                })
                .catch(() => {
                  $loading.fadeOut();
                });
            } else {
              selected = $selectbox.find('input[type="hidden"]').val();
              data = {};
              data[abilityName] = {};
              data[abilityName].milestone_id = selected != null ? selected : null;
              $loading.removeClass('hidden').fadeIn();
              $dropdown.trigger('loading.gl.dropdown');
              return $.ajax({
                type: 'PUT',
                url: issueUpdateURL,
                data: data
              }).done(function(data) {
                $dropdown.trigger('loaded.gl.dropdown');
                $loading.fadeOut();
                $selectbox.hide();
                $value.css('display', '');
                if (data.milestone != null) {
                  data.milestone.full_path = _this.currentProject.full_path;
                  data.milestone.remaining = gl.utils.timeFor(data.milestone.due_date);
                  $value.html(milestoneLinkTemplate(data.milestone));
                  return $sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone));
                } else {
                  $value.html(milestoneLinkNoneTemplate);
                  return $sidebarCollapsedValue.find('span').text('No');
                }
              });
            }
          }
        });
      });
    }

    return MilestoneSelect;
  })();
}).call(window);


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="4dp"
    app:cardBackgroundColor="#FFF"
    app:cardCornerRadius="2dp"
    app:cardPreventCornerOverlap="true">

    <RelativeLayout
        android:id="@+id/pictureLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/picture"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/default_img"
            android:scaleType="centerInside"/>
    </RelativeLayout>

</android.support.v7.widget.CardView>

redpajama_set_name: RedPajamaGithub


text:
declare -r MY_INPUT_FILE="${TEST_TMPDIR}/myinput.txt"
declare -r MY_OUTPUT_FILE="${TEST_TMPDIR}/myoutput.txt"
declare -r MY_EXPECT_FILE="${TEST_TMPDIR}/myexpect.txt"

# Get tool from argument
[[ "$#" == 1 ]] || {
  echo "Expecting 1 positional argument, verible-verilog-format path."
  exit 1
}
formatter="$(rlocation ${TEST_WORKSPACE}/${1})"

# Will overwrite this file in-place.
cat >${MY_INPUT_FILE} <<EOF
  module    m   ;endmodule
EOF

cat >${MY_EXPECT_FILE} <<EOF
module m;
endmodule
EOF

# Pipe text through formatter.
cat "${MY_INPUT_FILE}" | ${formatter} - > ${MY_OUTPUT_FILE} || exit 1
diff --strip-trailing-cr "${MY_OUTPUT_FILE}" "${MY_EXPECT_FILE}" || exit 2

echo "PASS"


text:
package io.github.resilience4j.core;

/**
 * configuration not found exception
 */
public class ConfigurationNotFoundException extends RuntimeException {

    /**
     * @param configName The config name.
     */
    public ConfigurationNotFoundException(String configName) {
        super(String.format("Configuration with name '%s' does not exist", configName));
    }
}


text:
using System;

namespace ExportingDataSample
{
    /// <summary>
    /// Define the Person.
    /// </summary>
    public class Person
    {
        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the age.
        /// </summary>
        /// <value>The age.</value>
        public int Age { get; set; }

        /// <summary>
        /// Gets or sets the birthday.
        /// </summary>
        /// <value>The birthday.</value>
        public DateTime Birthday { get; set; }

        /// <summary>
        /// Gets or sets the country.
        /// </summary>
        /// <value>The country.</value>
        public string Country { get; set; }
    }
}


text:
const { CookieJar, Cookie } = require('tough-cookie');

/**
 * Get a list of cookie objects from a request.jar()
 *
 * @param jar
 */
module.exports.cookiesFromJar = function(jar) {
  return new Promise(resolve => {
    jar.store.getAllCookies((err, cookies) => {
      if (err) {
        console.warn('Failed to get cookies form jar', err);
        resolve([]);
      } else {
        // NOTE: Perform toJSON so we have a plain JS object instead of Cookie instance
        resolve(cookies.map(c => c.toJSON()));
      }
    });
  });
};

/**
 * Get a request.jar() from a list of cookie objects
 *
 * @param cookies
 */
module.exports.jarFromCookies = function(cookies) {
  let jar;

  try {
    // For some reason, fromJSON modifies `cookies`. Create a copy first
    // just to be sure
    const copy = JSON.stringify({ cookies });
    jar = CookieJar.fromJSON(copy);
  } catch (e) {
    console.log('[cookies] Failed to initialize cookie jar', e);
    jar = new CookieJar();
  }

  jar.rejectPublicSuffixes = false;
  jar.looseMode = true;

  return jar;
};

module.exports.cookieToString = function(cookie) {
  // Cookie can either be a plain JS object or Cookie instance
  if (!(cookie instanceof Cookie)) {
    cookie = Cookie.fromJSON(cookie);
  }

  let str = cookie.toString();

  // tough-cookie toString() doesn't put domain on all the time.
  // This hack adds when tough-cookie won't
  if (cookie.domain && cookie.hostOnly) {
    str += '; Domain=' + cookie.domain;
  }

  return str;
};


text:
<?php

namespace Magento\Rule\Test\Unit\Model\Condition;

class AbstractConditionTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var AbstractCondition|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $_condition;

    protected function setUp()
    {
        $this->_condition = $this->getMockForAbstractClass(
            '\Magento\Rule\Model\Condition\AbstractCondition',
            [],
            '',
            false,
            false,
            true,
            ['getInputType']
        );
    }

    public function testGetjointTables()
    {
        $this->_condition->setAttribute('category_ids');
        $this->assertEquals([], $this->_condition->getTablesToJoin());
        $this->_condition->setAttribute('gdsjkfghksldjfg');
        $this->assertEmpty($this->_condition->getTablesToJoin());
    }

    public function testGetMappedSqlField()
    {
        $this->_condition->setAttribute('category_ids');
        $this->assertEquals('category_ids', $this->_condition->getMappedSqlField());
    }

    public function validateAttributeDataProvider()
    {
        return [
            // value, operator, valueForValidate, expectedResult
            [1, '==', new \stdClass(), false],
            [new \stdClass(), '==', new \stdClass(), false],

            [1, '==', 1, true],
            [0, '==', 1, false],
            ['0', '==', 1, false],
            ['1', '==', 1, true],
            ['x', '==', 'x', true],
            ['x', '==', 0, false],

            [1, '!=', 1, false],
            [0, '!=', 1, true],
            ['0', '!=', 1, true],
            ['1', '!=', 1, false],
            ['x', '!=', 'x', false],
            ['x', '!=', 0, true],

            [1, '==', [1], true],
            [1, '!=', [1], false],
            [1, '==', [3, 1, 5], false],
            [1, '!=', [1, 5], true],

            [[1,2,3], '==', '1,2,3', false],
            [[1], '==', 1, false],

            // Note: validated value is on the right, so read expression in the array from right to left
            // e.g.: 1, <=, 0 actually is 0 <= 1.
            [1, '>', 1, false],
            [1, '<=', 1, true],
            [1, '<=', '1', true],
            [1, '<=', 0, true],
            [0, '>', [1], false],

            [1, '<', 1, false],
            [1, '>=', 1, true],
            [1, '>=', '1', true],
            [1, '>=', 0, false],
            [0, '<', [1], false],
        ];
    }

    /**
     * @param $existingValue
     * @param $operator
     * @param $valueForValidate
     * @param $expectedResult
     *
     * @dataProvider validateAttributeDataProvider
     */
    public function testValidateAttribute($existingValue, $operator, $valueForValidate, $expectedResult)
    {
        $this->_condition->setOperator($operator);
        $this->_condition->setData('value_parsed', $existingValue);
        $this->assertEquals(
            $expectedResult,
            $this->_condition->validateAttribute($valueForValidate),
            "Failed asserting that "
            . var_export($existingValue, true)
            . $operator
            . var_export($valueForValidate, true)
        );
    }

    /**
     * @param $existingValue
     * @param $operator
     * @param $valueForValidate
     * @param $expectedResult
     *
     * @dataProvider validateAttributeDataProvider
     */
    public function testValidate($existingValue, $operator, $valueForValidate, $expectedResult)
    {
        $objectMock = $this->getMock(
            'Magento\Framework\Model\AbstractModel',
            ['hasData', 'load', 'getId', 'getData'],
            [],
            '',
            false
        );
        $objectMock->expects($this->once())
            ->method('hasData')
            ->willReturn(false);
        $objectMock->expects($this->once())
            ->method('getId')
            ->willReturn(7);
        $objectMock->expects($this->once())
            ->method('load')
            ->with(7);
        $objectMock->expects($this->once())
            ->method('getData')
            ->willReturn($valueForValidate);

        $this->_condition->setOperator($operator);
        $this->_condition->setData('value_parsed', $existingValue);
        $this->assertEquals(
            $expectedResult,
            $this->_condition->validate($objectMock),
            "Failed asserting that "
            . var_export($existingValue, true)
            . $operator
            . var_export($valueForValidate, true)
        );
    }

    public function validateAttributeArrayInputTypeDataProvider()
    {
        return [
            // value, operator, valueForValidate, expectedResult, inputType
            [[1, 2, 3], '==', [2, 1, 3], true, 'multiselect'],
            [[1, 2], '==', [2, 3], true, 'multiselect'],
            [[1, 1, 3], '==', [2, 4], false, 'multiselect'],
            [[1, 2], '!=', [2, 3], false, 'multiselect'],
            [[1, 2], '!=', 1, false, 'multiselect'],

            [[1, 2, 3], '{}', '1', true, 'grid'],
            [[1, 2, 3], '{}', '8', false, 'grid'],
            [[1, 2, 3], '{}', 5, false, 'grid'],
            [[1, 2, 3], '{}', [2, 3, 4], true, 'grid'],
            [[1, 2, 3], '{}', [4], false, 'grid'],
            [[3], '{}', [], false, 'grid'],
            [1, '{}', 1, false, 'grid'],
            [1, '!{}', [1, 2, 3], false, 'grid'],
            [[1], '{}', null, false, 'grid'],
            [null, '{}', null, true, 'input'],
            [null, '!{}', null, false, 'input'],
            [null, '{}', [1], false, 'input'],

            [[1, 2, 3], '()', 1, true, 'select'],
            [[1, 2, 3], '!()', 1, false, 'select'],
            [[1], '()', 3, false, 'select'],
            [[1], '!()', 3, true, 'select'],
            [3, '()', 3, false, 'select'],
            [[3], '()', [3], true, 'select'],
            [3, '()', [3], false, 'select'],

        ];
    }

    /**
     * @param $existingValue
     * @param $operator
     * @param $valueForValidate
     * @param $expectedResult
     * @param $inputType
     *
     * @dataProvider validateAttributeArrayInputTypeDataProvider
     */
    public function testValidateArrayOperatorType(
        $existingValue,
        $operator,
        $valueForValidate,
        $expectedResult,
        $inputType
    ) {
        $this->_condition->setOperator($operator);
        $this->_condition->setData('value_parsed', $existingValue);
        $this->_condition->getDefaultOperatorInputByType();
        $this->_condition
            ->expects($this->any())
            ->method('getInputType')
            ->will($this->returnValue($inputType));

        $this->assertEquals(
            $expectedResult,
            $this->_condition->validateAttribute($valueForValidate),
            "Failed asserting that "
            . var_export($existingValue, true)
            . $operator
            . var_export($valueForValidate, true)
        );
    }

    public function testGetValueParsed()
    {
        $value = [1, 2, 3, 4, 5, 6, 7, 8, 9];
        $this->_condition->setValue(['1,2,3,4,5,6,7,8,9']);
        $this->_condition->setOperator('()');
        $this->assertEquals($value, $this->_condition->getValueParsed());
    }
}


text:
package com.farmerbb.secondscreen.service;

import android.app.IntentService;
import android.content.Intent;
import android.content.SharedPreferences;
import android.provider.Settings;

import com.farmerbb.secondscreen.util.U;

import java.io.File;

// The TempBacklightOnService is responsible for turning the backlight off again if the user happens
// to turn their device off and back on.  It will turn the backlight off once the user has unlocked
// their device.
// This service is only run if the user is mirroring their display to Chromecast.  For all other
// scenarios, the ScreenOnService is run instead.
public final class TempBacklightOnService extends IntentService {

    /**
     * A constructor is required, and must call the super IntentService(String)
     * constructor with a name for the worker thread.
     */
    public TempBacklightOnService() {
        super("TempBacklightOnService");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        SharedPreferences prefCurrent = U.getPrefCurrent(this);
        if(!prefCurrent.getBoolean("not_active", true)
                && prefCurrent.getBoolean("backlight_off", false)
                && prefCurrent.getInt("backlight_value", -1) != -1) {
            // Restore the saved values for backlight and auto-brightness
            Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, prefCurrent.getInt("backlight_value", -1));
            Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, prefCurrent.getInt("auto_brightness", Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL));

            if(prefCurrent.getInt("backlight_value", -1) <= 10) {
                // Manually update the sysfs value to guarantee that the backlight will restore
                for(File backlightOff : U.backlightOff) {
                    if(backlightOff.exists()) {
                        U.runCommand(this, "echo " + Integer.toString(prefCurrent.getInt("backlight_value", -1)) + " > " + backlightOff.getAbsolutePath());
                        break;
                    }
                }
            }
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<module codename="org.netbeans.modules.editor.mimelookup/1">
    <module_version install_time="1298982195088" last="true" origin="installer" specification_version="1.16.1">
        <file crc="244035803" name="config/Modules/org-netbeans-modules-editor-mimelookup.xml"/>
        <file crc="3947402380" name="modules/org-netbeans-modules-editor-mimelookup.jar"/>
    </module_version>
</module>


text:
include(FindPkgConfig)

if (PKG_CONFIG_FOUND)
	pkg_check_modules(AVCODEC libavcodec)
	pkg_check_modules(AVUTIL libavutil)
endif ( PKG_CONFIG_FOUND )

# avcodec
find_path(AVCODEC_INCLUDE_DIR avcodec.h PATHS ${AVCODEC_INCLUDE_DIRS}
          PATH_SUFFIXES libavcodec )
find_library(AVCODEC_LIBRARY avcodec PATHS ${AVCODEC_LIBRARY_DIRS})

# avutil
find_path(AVUTIL_INCLUDE_DIR avutil.h PATHS ${AVUTIL_INCLUDE_DIRS}
          PATH_SUFFIXES libavutil )
find_library(AVUTIL_LIBRARY avutil PATHS ${AVUTIL_LIBRARY_DIRS})

if(AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY)
	set(AVCODEC_FOUND TRUE)
endif()

if(AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY)
	set(AVUTIL_FOUND TRUE)
endif()

FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND)

if(FFMPEG_FOUND)
	set(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR})
	set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY})
endif()

mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARYS)


text:
using System.Collections.Generic;
using System.Linq;
using QuantSA.Shared.Dates;
using QuantSA.Shared.Exceptions;
using QuantSA.Shared.MarketData;

namespace QuantSA.Core.MarketData
{
    public class MarketDataContainer : IMarketDataContainer
    {
        private readonly List<IMarketDataSource> _curves = new List<IMarketDataSource>();

        public void Set(IMarketDataSource curve)
        {
            _curves.Add(curve);
        }

        public void Calibrate(Date calibrationDate)
        {
            foreach (var marketDataSource in _curves)
            {
                marketDataSource.TryCalibrate(calibrationDate, this);
            }
        }

        public bool Contains<T>(MarketDataDescription<T> marketDataDescription) where T : class, IMarketDataSource
        {
            return _curves.Any(c => c.CanBeA(marketDataDescription, this));
        }

        public T Get<T>(MarketDataDescription<T> marketDataDescription) where T : class, IMarketDataSource
        {
            T foundCurve = null;
            foreach (var marketDataSource in _curves)
            {
                if (marketDataSource.CanBeA(marketDataDescription, this))
                {
                    if (foundCurve == null)
                    {
                        foundCurve = marketDataSource.Get(marketDataDescription);
                    }
                    else
                        throw new MissingMarketDataException($"At least two curves provide the same description: {foundCurve.GetName()} and {marketDataSource.GetName()}.");
                }

            }
            if (foundCurve==null)
                throw new MissingMarketDataException($"There is no market data: {marketDataDescription.Name}");
            return foundCurve;
        }
    }
}


text:
require 'pathname'
require 'cgi'

lib = Pathname(__FILE__).dirname.join('jquery-cdn')
require lib.join('version').to_s
require lib.join('helpers').to_s

module JqueryCdn

  version = JqueryCdn::VERSION.split('.')[0..2].join('.')
  URL = {
    google:     "//ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js",
    microsoft:  "//ajax.aspnetcdn.com/ajax/jQuery/jquery-#{version}.min.js",
    jquery:     "http://code.jquery.com/jquery-#{version}.min.js",
    yandex:     "//yandex.st/jquery/#{version}/jquery.min.js",
    cloudflare: "//cdnjs.cloudflare.com/ajax/libs/jquery/#{version}/jquery.min.js"
  }

  # Add assets paths to standalone Sprockets environment.
  def self.install(sprockets)
    root = Pathname(__FILE__).dirname.join('..').expand_path
    sprockets.append_path(root.join('vendor/assets/javascripts'))
  end

  # Return URL to local or CDN jQuery, depend on `env`.
  def self.url(env, cdn)
    if env == :production
      raise ArgumentError, "Unknown CDN #{cdn}" unless URL.has_key? cdn
      URL[cdn]
    else
      @local_url.call
    end
  end

  # Set proc to generate locale jQuery URL
  def self.local_url=(proc)
    @local_url = proc
  end

  # Return <script> tag
  def self.script_tag(attrs, body = '')
    if attrs.is_a? String
      body  = attrs
      attrs = { }
    end

    attrs = attrs.map { |key, value|
      if value == true
        " #{key}"
      else
        " #{key}=\"#{value}\""
      end
    }.join
    "<script#{ attrs }>#{ body }</script>"
  end

  # Return <script> tags with jQuery.
  def self.include_jquery(options = { })
    attrs = options.dup
    env   = attrs.delete(:env) || :production
    cdn   = attrs.delete(:cdn) || :google

    attrs[:src] = url(env, cdn)

    script_tag(attrs) + if not options[:defer] and env == :production
      fallback = include_jquery(options.merge(env: :development))
      escaped  = "unescape('#{ fallback.gsub('<', '%3C') }')"
      script_tag("window.jQuery || document.write(#{ escaped })")
    else
      ''
    end
  end
end

JqueryCdn.local_url = proc { '/assets/jquery.js' }
require lib.join('railties').to_s if defined? ::Rails


text:
package org.jboss.weld.tests.injectionPoint.named;

public class Event {

}


text:
<?php

namespace backend\modules\viewer\controllers;

use Yii;
use common\models\Map;
use common\models\MapBackground;
use common\models\MapLayer;
use common\models\MapToolGroup;
use common\models\search\Map as MapSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * MapController implements the CRUD actions for Map model.
 */
class MapController extends Controller
{
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['post'],
                ],
            ],
        ];
    }

    /**
     * Lists all Map models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new MapSearch;
        $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());

        return $this->render('index', [
            'dataProvider' => $dataProvider,
            'searchModel' => $searchModel,
        ]);
    }

    /**
     * Displays a single Map model.
     * @param integer $id
     * @return mixed
     */
    public function actionView($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('view', ['model' => $model]);
        }
    }

    /**
     * Creates a new Map model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
    public function actionCreate()
    {
        $model = new Map;

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Updates an existing Map model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
    public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Deletes an existing Map model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     * @param integer $id
     * @return mixed
     */
    public function actionDelete($id)
    {
        $this->findModel($id)->delete();

        return $this->redirect(['index']);
    }

    /**
     * Finds the Map model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param integer $id
     * @return Map the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     */
    protected function findModel($id)
    {
        if (($model = Map::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }

	public function actionBackgroundAdd() {
		$model = new MapBackground();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
			Yii::$app->session->setFlash('success', Yii::t('gip', 'Background added.'));
            return $this->redirect(Yii::$app->request->referrer);
        } else {
			Yii::$app->session->setFlash('danger', Yii::t('gip', 'Could not add background.'));
            return $this->redirect(Yii::$app->request->referrer);
        }
	}

	public function actionLayerAdd() {
		$model = new MapLayer();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
			Yii::$app->session->setFlash('success', Yii::t('gip', 'Layer added.'));
            return $this->redirect(Yii::$app->request->referrer);
        } else {
			Yii::$app->session->setFlash('danger', Yii::t('gip', 'Could not add layer.'));
            return $this->redirect(Yii::$app->request->referrer);
        }
	}

	public function actionToolGroupAdd() {
		$model = new MapToolGroup();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
			Yii::$app->session->setFlash('success', Yii::t('gip', 'Tool set added.'));
            return $this->redirect(Yii::$app->request->referrer);
        } else {
			Yii::$app->session->setFlash('danger', Yii::t('gip', 'Could not add tool set.'));
            return $this->redirect(Yii::$app->request->referrer);
        }
	}
}


text:
namespace supermarx
{
namespace message
{

struct add_product
{
	product_base p;
	datetime retrieved_on;
	confidence c;
	std::vector<std::string> problems;
};

}
}

BOOST_FUSION_ADAPT_STRUCT(
		supermarx::message::add_product,
		(supermarx::message::product_base, p)
		(supermarx::datetime, retrieved_on)
		(supermarx::confidence, c)
		(std::vector<std::string>, problems)
)


text:
/* tslint:disable */

import { ReaderFragment } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";
export type ViewingRoomSubsections_viewingRoom = {
    readonly subsections: ReadonlyArray<{
        readonly internalID: string;
        readonly title: string | null;
        readonly body: string | null;
        readonly image: {
            readonly imageURLs: {
                readonly normalized: string | null;
            } | null;
        } | null;
        readonly caption: string | null;
    }>;
    readonly " $refType": "ViewingRoomSubsections_viewingRoom";
};
export type ViewingRoomSubsections_viewingRoom$data = ViewingRoomSubsections_viewingRoom;
export type ViewingRoomSubsections_viewingRoom$key = {
    readonly " $data"?: ViewingRoomSubsections_viewingRoom$data;
    readonly " $fragmentRefs": FragmentRefs<"ViewingRoomSubsections_viewingRoom">;
};

const node: ReaderFragment = {
  "kind": "Fragment",
  "name": "ViewingRoomSubsections_viewingRoom",
  "type": "ViewingRoom",
  "metadata": null,
  "argumentDefinitions": [],
  "selections": [
    {
      "kind": "LinkedField",
      "alias": null,
      "name": "subsections",
      "storageKey": null,
      "args": null,
      "concreteType": "ViewingRoomSubsection",
      "plural": true,
      "selections": [
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "internalID",
          "args": null,
          "storageKey": null
        },
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "title",
          "args": null,
          "storageKey": null
        },
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "body",
          "args": null,
          "storageKey": null
        },
        {
          "kind": "LinkedField",
          "alias": null,
          "name": "image",
          "storageKey": null,
          "args": null,
          "concreteType": "ARImage",
          "plural": false,
          "selections": [
            {
              "kind": "LinkedField",
              "alias": null,
              "name": "imageURLs",
              "storageKey": null,
              "args": null,
              "concreteType": "ImageURLs",
              "plural": false,
              "selections": [
                {
                  "kind": "ScalarField",
                  "alias": null,
                  "name": "normalized",
                  "args": null,
                  "storageKey": null
                }
              ]
            }
          ]
        },
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "caption",
          "args": null,
          "storageKey": null
        }
      ]
    }
  ]
};
(node as any).hash = '3f1d6a976cc3a98198563a8e78f35c4a';
export default node;


text:
/*
 * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved.
 *
 * HISTORY
 *
 */

#ifndef _OS_OSATOMIC_H
#define _OS_OSATOMIC_H

#include <libkern/OSBase.h>

#if defined(__cplusplus)
extern "C" {
#endif

/*!
 * @header
 *
 * @abstract
 * This header declares the OSAtomic group of functions for atomic
 * reading and updating of values.
 */

#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)

/*!
 * @function OSCompareAndSwap64
 *
 * @abstract
 * 64-bit compare and swap operation.
 *
 * @discussion
 * See OSCompareAndSwap.
 */
extern Boolean OSCompareAndSwap64(
    UInt64            oldValue,
    UInt64            newValue,
    volatile UInt64 * address);

#endif /* defined(__i386__) || defined(__x86_64__) */

#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)

/*!
 * @function OSAddAtomic64
 *
 * @abstract
 * 64-bit atomic add operation.
 *
 * @discussion
 * See OSAddAtomic.
 */
extern SInt64 OSAddAtomic64(
    SInt64            theAmount,
    volatile SInt64 * address);

/*!
 * @function OSIncrementAtomic64
 *
 * @abstract
 * 64-bit increment.
 *
 * @discussion
 * See OSIncrementAtomic.
*/
inline static SInt64 OSIncrementAtomic64(volatile SInt64 * address)
{
    return OSAddAtomic64(1LL, address);
}

/*!
 * @function OSDecrementAtomic64
 *
 * @abstract
 * 64-bit decrement.
 *
 * @discussion
 * See OSDecrementAtomic.
*/
inline static SInt64 OSDecrementAtomic64(volatile SInt64 * address)
{
    return OSAddAtomic64(-1LL, address);
}

#endif  /* defined(__i386__) || defined(__x86_64__) || defined(__arm__) */

#if XNU_KERNEL_PRIVATE
/* Not to be included in headerdoc.
 *
 * @function OSAddAtomicLong
 *
 * @abstract
 * 32/64-bit atomic add operation, depending on sizeof(long).
 *
 * @discussion
 * See OSAddAtomic.
 */
extern long OSAddAtomicLong(
    long            theAmount,
    volatile long * address);

/* Not to be included in headerdoc.
 *
 * @function OSIncrementAtomicLong
 *
 * @abstract
 * 32/64-bit increment, depending on sizeof(long)
 *
 * @discussion
 * See OSIncrementAtomic.
*/
inline static long OSIncrementAtomicLong(volatile long * address)
{
    return OSAddAtomicLong(1L, address);
}

/* Not to be included in headerdoc.
 *
 * @function OSDecrementAtomicLong
 *
 * @abstract
 * 32/64-bit decrement, depending on sizeof(long)
 *@discussion See OSDecrementAtomic.
 */
inline static long OSDecrementAtomicLong(volatile long * address)
{
    return OSAddAtomicLong(-1L, address);
}
#endif /* XNU_KERNEL_PRIVATE */

/*
 * The macro SAFE_CAST_PTR() casts one type of pointer to another type, making sure
 * the data the pointer is referencing is the same size. If it is not, it will cause
 * a division by zero compiler warning. This is to work around "SInt32" being defined
 * as "long" on ILP32 and as "int" on LP64, which would require an explicit cast to
 * "SInt32*" when for instance passing an "int*" to OSAddAtomic() - which masks size
 * mismatches.
 * -- var is used twice, but sizeof does not evaluate the
 *    argument, i.e. we're safe against "++" etc. in var --
 */
#ifdef XNU_KERNEL_PRIVATE
#define SAFE_CAST_PTR(type, var) (((type)(var))+(0/(sizeof(*var) == sizeof(*(type)0) ? 1 : 0)))
#else
#define SAFE_CAST_PTR(type, var) ((type)(var))
#endif

/*!
 * @function OSCompareAndSwap
 *
 * @abstract
 * Compare and swap operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSCompareAndSwap function compares the value at the specified address with oldVal. The value of newValue is written to the address only if oldValue and the value at the address are equal. OSCompareAndSwap returns true if newValue is written to the address; otherwise, it returns false.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 *
 * @param oldValue The value to compare at address.
 * @param newValue The value to write to address if oldValue compares true.
 * @param address The 4-byte aligned address of the data to update atomically.
 * @result true if newValue was written to the address.
 */
extern Boolean OSCompareAndSwap(
    UInt32            oldValue,
    UInt32            newValue,
    volatile UInt32 * address);
#define OSCompareAndSwap(a, b, c) \
	(OSCompareAndSwap(a, b, SAFE_CAST_PTR(volatile UInt32*,c)))

/*!
 * @function OSCompareAndSwapPtr
 *
 * @abstract
 * Compare and swap operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSCompareAndSwapPtr function compares the pointer-sized value at the specified address with oldVal. The value of newValue is written to the address only if oldValue and the value at the address are equal. OSCompareAndSwapPtr returns true if newValue is written to the address; otherwise, it returns false.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param oldValue The pointer value to compare at address.
 * @param newValue The pointer value to write to address if oldValue compares true.
 * @param address The pointer-size aligned address of the data to update atomically.
 * @result true if newValue was written to the address.
 */
extern Boolean OSCompareAndSwapPtr(
    void            * oldValue,
    void            * newValue,
    void * volatile * address);
#define OSCompareAndSwapPtr(a, b, c) \
	(OSCompareAndSwapPtr(a, b, SAFE_CAST_PTR(void * volatile *,c)))

/*!
 * @function OSAddAtomic
 *
 * @abstract
 * 32-bit add operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSAddAtomic function adds the specified amount to the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param amount The amount to add.
 * @param address The 4-byte aligned address of the value to update atomically.
 * @result The value before the addition
 */
extern SInt32 OSAddAtomic(
    SInt32            amount,
    volatile SInt32 * address);
#define OSAddAtomic(a, b) \
	(OSAddAtomic(a, SAFE_CAST_PTR(volatile SInt32*,b)))

/*!
 * @function OSAddAtomic16
 *
 * @abstract
 * 16-bit add operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSAddAtomic16 function adds the specified amount to the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param amount The amount to add.
 * @param address The 2-byte aligned address of the value to update atomically.
 * @result The value before the addition
 */
extern SInt16 OSAddAtomic16(
    SInt32            amount,
    volatile SInt16 * address);

/*!
 * @function OSAddAtomic8
 *
 * @abstract
 * 8-bit add operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSAddAtomic8 function adds the specified amount to the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param amount The amount to add.
 * @param address The address of the value to update atomically.
 * @result The value before the addition.
 */
extern SInt8 OSAddAtomic8(
    SInt32           amount,
    volatile SInt8 * address);

/*!
 * @function OSIncrementAtomic
 *
 * @abstract
 * 32-bit increment operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSIncrementAtomic function increments the value at the specified address by one and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device.
 * @param address The 4-byte aligned address of the value to update atomically.
 * @result The value before the increment.
 */
extern SInt32 OSIncrementAtomic(volatile SInt32 * address);
#define OSIncrementAtomic(a) \
	(OSIncrementAtomic(SAFE_CAST_PTR(volatile SInt32*,a)))

/*!
 * @function OSIncrementAtomic16
 *
 * @abstract
 * 16-bit increment operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSIncrementAtomic16 function increments the value at the specified address by one and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param address The 2-byte aligned address of the value to update atomically.
 * @result The value before the increment.
 */
extern SInt16 OSIncrementAtomic16(volatile SInt16 * address);

/*!
 * @function OSIncrementAtomic8
 *
 * @abstract
 * 8-bit increment operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSIncrementAtomic8 function increments the value at the specified address by one and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param address The address of the value to update atomically.
 * @result The value before the increment.
 */
extern SInt8 OSIncrementAtomic8(volatile SInt8 * address);

/*!
 * @function OSDecrementAtomic
 *
 * @abstract
 * 32-bit decrement operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSDecrementAtomic function decrements the value at the specified address by one and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param address The 4-byte aligned address of the value to update atomically.
 * @result The value before the decrement.
 */
extern SInt32 OSDecrementAtomic(volatile SInt32 * address);
#define OSDecrementAtomic(a) \
	(OSDecrementAtomic(SAFE_CAST_PTR(volatile SInt32*,a)))

/*!
 * @function OSDecrementAtomic16
 *
 * @abstract
 * 16-bit decrement operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSDecrementAtomic16 function decrements the value at the specified address by one and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param address The 2-byte aligned address of the value to update atomically.
 * @result The value before the decrement.
 */
extern SInt16 OSDecrementAtomic16(volatile SInt16 * address);

/*!
 * @function OSDecrementAtomic8
 *
 * @abstract
 * 8-bit decrement operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSDecrementAtomic8 function decrements the value at the specified address by one and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param address The address of the value to update atomically.
 * @result The value before the decrement.
 */
extern SInt8 OSDecrementAtomic8(volatile SInt8 * address);

/*!
 * @function OSBitAndAtomic
 *
 * @abstract
 * 32-bit logical and operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSBitAndAtomic function logically ands the bits of the specified mask into the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param mask The mask to logically and with the value.
 * @param address The 4-byte aligned address of the value to update atomically.
 * @result The value before the bitwise operation
 */
extern UInt32 OSBitAndAtomic(
    UInt32            mask,
    volatile UInt32 * address);
#define OSBitAndAtomic(a, b) \
	(OSBitAndAtomic(a, SAFE_CAST_PTR(volatile UInt32*,b)))

/*!
 * @function OSBitAndAtomic16
 *
 * @abstract
 * 16-bit logical and operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSBitAndAtomic16 function logically ands the bits of the specified mask into the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param mask The mask to logically and with the value.
 * @param address The 2-byte aligned address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt16 OSBitAndAtomic16(
    UInt32            mask,
    volatile UInt16 * address);

/*!
 * @function OSBitAndAtomic8
 *
 * @abstract
 * 8-bit logical and operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSBitAndAtomic8 function logically ands the bits of the specified mask into the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param mask The mask to logically and with the value.
 * @param address The address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt8 OSBitAndAtomic8(
    UInt32           mask,
    volatile UInt8 * address);

/*!
 * @function OSBitOrAtomic
 *
 * @abstract
 * 32-bit logical or operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSBitOrAtomic function logically ors the bits of the specified mask into the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param mask The mask to logically or with the value.
 * @param address The 4-byte aligned address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt32 OSBitOrAtomic(
    UInt32            mask,
    volatile UInt32 * address);
#define OSBitOrAtomic(a, b) \
	(OSBitOrAtomic(a, SAFE_CAST_PTR(volatile UInt32*,b)))

/*!
 * @function OSBitOrAtomic16
 *
 * @abstract
 * 16-bit logical or operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSBitOrAtomic16 function logically ors the bits of the specified mask into the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param mask The mask to logically or with the value.
 * @param address The 2-byte aligned address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt16 OSBitOrAtomic16(
    UInt32            mask,
    volatile UInt16 * address);

/*!
 * @function OSBitOrAtomic8
 *
 * @abstract
 * 8-bit logical or operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 *
 * @discussion
 * The OSBitOrAtomic8 function logically ors the bits of the specified mask into the value at the specified address and returns the original value.
 * @param mask The mask to logically or with the value.
 * @param address The address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt8 OSBitOrAtomic8(
    UInt32           mask,
    volatile UInt8 * address);

/*!
 * @function OSBitXorAtomic
 *
 * @abstract
 * 32-bit logical xor operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 *
 * @discussion
 * The OSBitXorAtomic function logically xors the bits of the specified mask into the value at the specified address and returns the original value.
 * @param mask The mask to logically or with the value.
 * @param address The 4-byte aligned address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt32 OSBitXorAtomic(
    UInt32            mask,
    volatile UInt32 * address);
#define OSBitXorAtomic(a, b) \
	(OSBitXorAtomic(a, SAFE_CAST_PTR(volatile UInt32*,b)))

/*!
 * @function OSBitXorAtomic16
 *
 * @abstract
 * 16-bit logical xor operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSBitXorAtomic16 function logically xors the bits of the specified mask into the value at the specified address and returns the original value.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param mask The mask to logically or with the value.
 * @param address The 2-byte aligned address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt16 OSBitXorAtomic16(
    UInt32            mask,
    volatile UInt16 * address);

/*!
 * @function OSBitXorAtomic8
 *
 * @abstract
 * 8-bit logical xor operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 *
 * @discussion
 * The OSBitXorAtomic8 function logically xors the bits of the specified mask into the value at the specified address and returns the original value.
 * @param mask The mask to logically or with the value.
 * @param address The address of the value to update atomically.
 * @result The value before the bitwise operation.
 */
extern UInt8 OSBitXorAtomic8(
    UInt32           mask,
    volatile UInt8 * address);

/*!
 * @function OSTestAndSet
 *
 * @abstract
 * Bit test and set operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 *
 * @discussion
 * The OSTestAndSet function sets a single bit in a byte at a specified address. It returns true if the bit was already set, false otherwise.
 * @param bit The bit number in the range 0 through 7.
 * @param startAddress The address of the byte to update atomically.
 * @result true if the bit was already set, false otherwise.
 */
extern Boolean OSTestAndSet(
    UInt32           bit,
    volatile UInt8 * startAddress);

/*!
 * @function OSTestAndClear
 *
 * @abstract
 * Bit test and clear operation, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSTestAndClear function clears a single bit in a byte at a specified address. It returns true if the bit was already clear, false otherwise.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param bit The bit number in the range 0 through 7.
 * @param startAddress The address of the byte to update atomically.
 * @result true if the bit was already clear, false otherwise.
 */
extern Boolean OSTestAndClear(
    UInt32           bit,
    volatile UInt8 * startAddress);

#ifdef __ppc__
/*!
 * @function OSEnqueueAtomic
 *
 * @abstract
 * Singly linked list head insertion, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSEnqueueAtomic function places an element at the head of a single linked list, which is specified with the address of a head pointer, listHead. The element structure has a next field whose offset is specified.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param listHead The address of a head pointer for the list .
 * @param element The list element to insert at the head of the list.
 * @param elementNextFieldOffset The byte offset into the element where a pointer to the next element in the list is stored.
 */
extern void OSEnqueueAtomic(
    void * volatile * listHead,
    void            * element,
    SInt32            elementNextFieldOffset);

/*!
 * @function OSDequeueAtomic
 *
 * @abstract
 * Singly linked list element head removal, performed atomically with respect to all devices that participate in the coherency architecture of the platform.
 *
 * @discussion
 * The OSDequeueAtomic function removes an element from the head of a single linked list, which is specified with the address of a head pointer, listHead. The element structure has a next field whose offset is specified.
 *
 * This function guarantees atomicity only with main system memory. It is specifically unsuitable for use on noncacheable memory such as that in devices; this function cannot guarantee atomicity, for example, on memory mapped from a PCI device. Additionally, this function incorporates a memory barrier on systems with weakly-ordered memory architectures.
 * @param listHead The address of a head pointer for the list .
 * @param elementNextFieldOffset The byte offset into the element where a pointer to the next element in the list is stored.
 * @result A removed element, or zero if the list is empty.
 */
extern void * OSDequeueAtomic(
    void * volatile * listHead,
    SInt32            elementNextFieldOffset);
#endif /* __ppc__ */

/*!
 * @function OSSynchronizeIO
 *
 * @abstract
 * The OSSynchronizeIO routine ensures orderly load and store operations to noncached memory mapped I/O devices.
 *
 * @discussion
 * The OSSynchronizeIO routine ensures orderly load and store operations to noncached memory mapped I/O devices. It executes the eieio instruction on PowerPC processors.
 */
static __inline__ void OSSynchronizeIO(void)
{
#if defined(__ppc__)
        __asm__ ("eieio");
#endif
}

#if defined(__cplusplus)
}
#endif

#endif /* ! _OS_OSATOMIC_H */


text:
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")

AOTM_SERVER_CAMERA_MANAGER = AOTM_SERVER_CAMERA_MANAGER or {}
AOTM_SERVER_CAMERA_MANAGER.display_list = AOTM_SERVER_CAMERA_MANAGER.display_list or {}

function AOTM_SERVER_CAMERA_MANAGER:AddDisplay( ent )
	table.insert(self.display_list, ent)
end

function AOTM_SERVER_CAMERA_MANAGER:DeleteDisplay( ent )
	table.RemoveByValue(self.display_list, ent)
end

concommand.Add( "camera_test", function(ply, cmd, args, argStr)
	if not ply:IsAdmin() then return end

	local tr = ply:GetEyeTrace()

	local cam_ent = ents.Create("sent_aotm_cctv_camera")
	cam_ent:SetPos(tr.HitPos + tr.HitNormal * 50)
	cam_ent:Spawn()
	cam_ent:Activate()

	display_ent = ents.Create("sent_aotm_cctv_display")
	display_ent:SetPos(tr.HitPos + tr.HitNormal * 50 + Vector(0,50,0))
	display_ent:Spawn()
	display_ent:Activate()

	display_ent:SetCamera(cam_ent)
end )

hook.Add( "SetupPlayerVisibility", "AOTM_SetupPlayerVisibility_CameraManager_Init", function(ply, viewEntity)
	local curtime = CurTime()

	local viewEntity = viewEntity
	if not IsValid(viewEntity) then
		viewEntity = ply
	end

	for i, display_ent in ipairs(AOTM_SERVER_CAMERA_MANAGER.display_list) do
		if display_ent:GetPos():Distance(ply:GetPos()) < 750 then
			local camera = display_ent:GetCamera()

			if IsValid(camera) then
				AddOriginToPVS(camera:GetPos())
			end
		end
	end
end )

print("camera manager init")


text:
title: Impactist
author: alba
layout: post
permalink: /2005/08/24/644/
categories:
  - asides
tags:
  - asides
  - del.icio.us
  - quicklinks
---
[IMPACTIST][1] and [robots on strike][2]

 [1]: http://impactist.com/index.html "IMPACTIST"
 [2]: http://www.robotsonstrike.com/ "robots on strike"


text:
package org.apache.camel.language.simple.ast;

import org.apache.camel.Expression;
import org.apache.camel.language.simple.types.SimpleToken;
import org.apache.camel.support.builder.ExpressionBuilder;

/**
 * Starts a block enclosed by single quotes
 */
public class SingleQuoteStart extends BaseSimpleNode implements BlockStart {

    private final CompositeNodes block;

    public SingleQuoteStart(SimpleToken token) {
        super(token);
        this.block = new CompositeNodes(token);
    }

    @Override
    public String toString() {
        // output a nice toString so it makes debugging easier as we can see the entire block
        return "'" + block + "'";
    }

    @Override
    public Expression createExpression(String expression) {
        Expression answer = null;
        if (block != null) {
            answer = block.createExpression(expression);
        }
        if (answer == null) {
            // there quoted literal is empty
            answer = ExpressionBuilder.constantExpression("");
        }
        return answer;
    }

    @Override
    public boolean acceptAndAddNode(SimpleNode node) {
        block.addChild(node);
        return true;
    }

}


text:
// snippet-start:[mediaconvert.JavaScript.templates.deleteJobTemplateV3]
// Import required AWS-SDK clients and commands for Node.js
import { DeleteJobTemplateCommand } from  "@aws-sdk/client-mediaconvert";
import { emcClient } from  "./libs/emcClient.js";

// Set the parameters
const params = { Name: "test" }; //TEMPLATE_NAME

const run = async () => {
  try {
    const data = await emcClient.send(new DeleteJobTemplateCommand(params));
    console.log(
      "Success, template deleted! Request ID:",
      data.$metadata.requestId
    );
    return data;
  } catch (err) {
    console.log("Error", err);
  }
};
run();
// snippet-end:[mediaconvert.JavaScript.templates.deleteJobTemplateV3]
// For unit tests only.
// module.exports ={run, params};