text:
declare namespace java {
  namespace lang {
    namespace invoke {

      class MethodType implements java.io.Serializable {
        static readonly MAX_JVM_ARITY: int
        static readonly MAX_MH_ARITY: int
        static readonly MAX_MH_INVOKER_ARITY: int
        static readonly internTable: java.lang.invoke.MethodType$ConcurrentWeakInternSet<java.lang.invoke.MethodType>
        static readonly NO_PTYPES: java.lang.Class<unknown>[]
        static readonly $assertionsDisabled: boolean
        form(): java.lang.invoke.MethodTypeForm
        rtype(): java.lang.Class<unknown>
        ptypes(): java.lang.Class<unknown>[]
        setForm(arg0: java.lang.invoke.MethodTypeForm): void
        static checkSlotCount(arg0: number | java.lang.Integer): void
        public static methodType(arg0: java.lang.Class<unknown>, arg1: java.lang.Class<unknown>[]): java.lang.invoke.MethodType
        public static methodType(arg0: java.lang.Class<unknown>, arg1: java.util.List<java.lang.Class<unknown>>): java.lang.invoke.MethodType
        public static methodType(arg0: java.lang.Class<unknown>, arg1: java.lang.Class<unknown>, ...vargs: (java.lang.Class<unknown>)[]): java.lang.invoke.MethodType
        public static methodType(arg0: java.lang.Class<unknown>): java.lang.invoke.MethodType
        public static methodType(arg0: java.lang.Class<unknown>, arg1: java.lang.Class<unknown>): java.lang.invoke.MethodType
        public static methodType(arg0: java.lang.Class<unknown>, arg1: java.lang.invoke.MethodType): java.lang.invoke.MethodType
        static makeImpl(arg0: java.lang.Class<unknown>, arg1: java.lang.Class<unknown>[], arg2: boolean | java.lang.Boolean): java.lang.invoke.MethodType
        public static genericMethodType(arg0: number | java.lang.Integer, arg1: boolean | java.lang.Boolean): java.lang.invoke.MethodType
        public static genericMethodType(arg0: number | java.lang.Integer): java.lang.invoke.MethodType
        public changeParameterType(arg0: number | java.lang.Integer, arg1: java.lang.Class<unknown>): java.lang.invoke.MethodType
        public insertParameterTypes(arg0: number | java.lang.Integer, ...vargs: (java.lang.Class<unknown>)[]): java.lang.invoke.MethodType
        public appendParameterTypes(...vargs: (java.lang.Class<unknown>)[]): java.lang.invoke.MethodType
        public insertParameterTypes(arg0: number | java.lang.Integer, arg1: java.util.List<java.lang.Class<unknown>>): java.lang.invoke.MethodType
        public appendParameterTypes(arg0: java.util.List<java.lang.Class<unknown>>): java.lang.invoke.MethodType
        replaceParameterTypes(arg0: number | java.lang.Integer, arg1: number | java.lang.Integer, ...vargs: (java.lang.Class<unknown>)[]): java.lang.invoke.MethodType
        asSpreaderType(arg0: java.lang.Class<unknown>, arg1: number | java.lang.Integer, arg2: number | java.lang.Integer): java.lang.invoke.MethodType
        leadingReferenceParameter(): java.lang.Class<unknown>
        asCollectorType(arg0: java.lang.Class<unknown>, arg1: number | java.lang.Integer, arg2: number | java.lang.Integer): java.lang.invoke.MethodType
        public dropParameterTypes(arg0: number | java.lang.Integer, arg1: number | java.lang.Integer): java.lang.invoke.MethodType
        public changeReturnType(arg0: java.lang.Class<unknown>): java.lang.invoke.MethodType
        public hasPrimitives(): boolean
        public hasWrappers(): boolean
        public erase(): java.lang.invoke.MethodType
        basicType(): java.lang.invoke.MethodType
        invokerType(): java.lang.invoke.MethodType
        public generic(): java.lang.invoke.MethodType
        isGeneric(): boolean
        public wrap(): java.lang.invoke.MethodType
        public unwrap(): java.lang.invoke.MethodType
        public parameterType(arg0: number | java.lang.Integer): java.lang.Class<unknown>
        public parameterCount(): number
        public returnType(): java.lang.Class<unknown>
        public parameterList(): java.util.List<java.lang.Class<unknown>>
        public lastParameterType(): java.lang.Class<unknown>
        public parameterArray(): java.lang.Class<unknown>[]
        public equals(arg0: java.lang.Object | any): boolean
        public hashCode(): number
        public toString(): java.lang.String
        effectivelyIdenticalParameters(arg0: number | java.lang.Integer, arg1: java.util.List<java.lang.Class<unknown>>): boolean
        isViewableAs(arg0: java.lang.invoke.MethodType, arg1: boolean | java.lang.Boolean): boolean
        isConvertibleTo(arg0: java.lang.invoke.MethodType): boolean
        explicitCastEquivalentToAsType(arg0: java.lang.invoke.MethodType): boolean
        static canConvert(arg0: java.lang.Class<unknown>, arg1: java.lang.Class<unknown>): boolean
        parameterSlotCount(): number
        invokers(): java.lang.invoke.Invokers
        parameterSlotDepth(arg0: number | java.lang.Integer): number
        returnSlotCount(): number
        public static fromMethodDescriptorString(arg0: java.lang.String | string, arg1: java.lang.ClassLoader): java.lang.invoke.MethodType
        static fromDescriptor(arg0: java.lang.String | string, arg1: java.lang.ClassLoader): java.lang.invoke.MethodType
        public toMethodDescriptorString(): java.lang.String
        static toFieldDescriptorString(arg0: java.lang.Class<unknown>): java.lang.String
      }

    }
  }
}


text:
using System;
using System.IO;
using Gallio.Common.Validation;

namespace Gallio.Runner.Projects
{
    /// <summary>
    /// Provides services for loading and saving test projects.
    /// </summary>
    public interface ITestProjectManager
    {
        /// <summary>
        /// Creates a new project.
        /// </summary>
        /// <param name="projectName">The location of the project to be created.</param>
        /// <returns>The loaded test project.</returns>
        /// <exception cref="ArgumentException">Thrown if the project name is null or empty.</exception>
        TestProject NewProject(string projectName);

        /// <summary>
        /// Loads a saved test project.
        /// </summary>
        /// <param name="testProjectFile">The test project file to load.</param>
        /// <returns>The loaded test project.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="testProjectFile"/> is null.</exception>
        /// <exception cref="IOException">Thrown if the test project cannot be loaded.</exception>
        /// <exception cref="ValidationException">Thrown if the test project is malformed.</exception>
        TestProject LoadProject(FileInfo testProjectFile);

        /// <summary>
        /// Saves a test project.
        /// </summary>
        /// <param name="testProject">The test project.</param>
        /// <param name="testProjectFile">The test project file to save.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="testProject"/> or
        /// <paramref name="testProjectFile"/> is null.</exception>
        /// <exception cref="IOException">Thrown if the test project cannot be saved.</exception>
        /// <exception cref="ValidationException">Thrown if the test project is malformed.</exception>
        void SaveProject(TestProject testProject, FileInfo testProjectFile);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Ekyna\Bundle\ProductBundle\Behat\Context;

use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use Behat\Symfony2Extension\Context\KernelAwareContext;
use Behat\Symfony2Extension\Context\KernelDictionary;

/**
 * Class CategoryContext
 * @package Ekyna\Bundle\ProductBundle\Behat\Context
 * @author  Etienne Dauvergne <contact@ekyna.com>
 */
class CategoryContext implements Context, KernelAwareContext
{
    use KernelDictionary;

    /**
     * @Given The following categories:
     *
     * @param TableNode $table
     */
    public function createCategories(TableNode $table)
    {
        $categories = $this->castCategoriesTable($table);

        $manager = $this->getContainer()->get('ekyna_product.category.manager');

        foreach ($categories as $category) {
            $manager->persist($category);
        }

        $manager->flush();
        $manager->clear();
    }

    /**
     * @param TableNode $table
     *
     * @return array
     */
    private function castCategoriesTable(TableNode $table)
    {
        $repository = $this->getContainer()->get('ekyna_product.category.repository');

        $categories = [];
        foreach ($table->getHash() as $hash) {
            /** @var \Ekyna\Bundle\ProductBundle\Model\CategoryInterface $category */
            $category = $repository->createNew();
            $category
                ->setName($hash['name'])
                ->setVisible(true)
                ->translate()
                    ->setTitle($hash['name']);

            $categories[] = $category;
        }

        return $categories;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using VsTeXCommentsExtension.View;

namespace VsTeXCommentsExtension.Integration.View
{
    /// <summary>
    /// Helper class for interspersing adornments into text.
    /// </summary>
    /// <remarks>
    /// To avoid an issue around intra-text adornment support and its interaction with text buffer changes,
    /// this tagger reacts to text and tag changes with a delay. It waits to send out its own TagsChanged
    /// event until the WPF Dispatcher is running again and it takes care to report adornments
    /// that are consistent with the latest sent TagsChanged event by storing that particular snapshot
    /// and using it to query for the data tags.
    /// </remarks>
    internal abstract class IntraTextAdornmentTagger<TDataTag, TAdornment> : ITagger<IntraTextAdornmentTag>, IDisposable
        where TDataTag : ITag, ITagSpan
        where TAdornment : UIElement, ITagAdornment
    {
        private const int MaxAdornmentPoolSize = 128;

        private readonly List<SnapshotSpan> invalidatedSpans = new List<SnapshotSpan>();
        private readonly List<TAdornment> adornmentsPool = new List<TAdornment>(MaxAdornmentPoolSize);
        private readonly List<SnapshotSpan> editedBlockSpans = new List<SnapshotSpan>();
        private readonly TextSnapshotValuesPerVersionCache<PooledStructEnumerable<ITagSpan<IntraTextAdornmentTag>>> perSnapshotResults;
        private readonly ObjectPool<HashSet<AdornmentCacheKey>> adornmentCacheKeyHashsetsPool = new ObjectPool<HashSet<AdornmentCacheKey>>(() => new HashSet<AdornmentCacheKey>());
        private readonly ObjectPool<List<ITagSpan<IntraTextAdornmentTag>>> tagSpanListsPool = new ObjectPool<List<ITagSpan<IntraTextAdornmentTag>>>(() => new List<ITagSpan<IntraTextAdornmentTag>>());
        private readonly ObjectPool<Dictionary<AdornmentCacheKey, TAdornment>> adormentDictionariesPool = new ObjectPool<Dictionary<AdornmentCacheKey, TAdornment>>(() => new Dictionary<AdornmentCacheKey, TAdornment>());

        private Dictionary<AdornmentCacheKey, TAdornment> adornmentsCache = new Dictionary<AdornmentCacheKey, TAdornment>();
        private bool isEnabled;

        protected readonly TextSnapshotTeXCommentBlocks TexCommentBlocks;
        protected readonly IWpfTextView TextView;
        protected ITextSnapshot Snapshot { get; private set; }

        public IntraTextAdornmentTaggerDisplayMode Mode { get; set; }

        protected IntraTextAdornmentTagger(IWpfTextView textView)
        {
            this.TextView = textView;
            Snapshot = textView.TextBuffer.CurrentSnapshot;
            TexCommentBlocks = TextSnapshotTeXCommentBlocksProvider.Get(textView.TextBuffer);
            //this.view.LayoutChanged += HandleLayoutChanged;
            this.TextView.TextBuffer.Changed += HandleBufferChanged;
            ((FrameworkElement)textView).Loaded += TextView_Loaded;
            perSnapshotResults = new TextSnapshotValuesPerVersionCache<PooledStructEnumerable<ITagSpan<IntraTextAdornmentTag>>>(GetAdornmentTagsOnSnapshot);
        }

        /// <param name="span">The span of text that this adornment will elide.</param>
        /// <returns>Adornment corresponding to given data. May be null.</returns>
        protected abstract TAdornment CreateAdornment(TDataTag data, ITextSnapshot snapshot);

        protected abstract void UpdateAdornment(TAdornment adornment, TDataTag data, ITextSnapshot snapshot);

        /// <param name="spans">Spans to provide adornment data for. These spans do not necessarily correspond to text lines.</param>
        /// <remarks>
        /// If adornments need to be updated, call <see cref="RaiseTagsChanged"/> or <see cref="InvalidateSpans"/>.
        /// This will, indirectly, cause <see cref="GetAdornmentData"/> to be called.
        /// </remarks>
        /// <returns>
        /// A sequence of:
        ///  * adornment data for each adornment to be displayed
        ///  * the span of text that should be elided for that adornment (zero length spans are acceptable)
        ///  * and affinity of the adornment (this should be null if and only if the elided span has a length greater than zero)
        /// </returns>
        protected abstract IEnumerable<TagData> GetAdornmentData(NormalizedSnapshotSpanCollection spans);

        private void HandleBufferChanged(object sender, TextContentChangedEventArgs args)
        {
            if (args.Changes.Count == 0) return;
            Debug.Assert(sender == TextView.TextBuffer);
            Debug.Assert(editedBlockSpans.Count == 0);

            foreach (var change in args.Changes)
            {
                using (var blockSpansBefore = TexCommentBlocks.GetBlockSpansIntersectedBy(args.Before, change.OldSpan))
                using (var blockSpansAfter = TexCommentBlocks.GetBlockSpansIntersectedBy(args.After, change.NewSpan))
                {
                    bool changed = false;
                    if (blockSpansBefore.Count == blockSpansAfter.Count)
                    {
                        for (int i = 0; i < blockSpansBefore.Count; i++)
                        {
                            if (blockSpansBefore[i].Span != blockSpansAfter[i].Span || blockSpansBefore[i].GetText() != blockSpansAfter[i].GetText())
                            {
                                changed = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        changed = true;
                    }

                    if (changed)
                    {
                        if (change.OldText.Contains(Environment.NewLine)) editedBlockSpans.AddRange(blockSpansBefore); //special case which causes an error in VS if not handled
                        editedBlockSpans.AddRange(blockSpansAfter);
                    }
                }
            }

            if (editedBlockSpans.Count == 0)
            {
                var changesStart = args.Changes[0].NewPosition;
                var changesEnd = args.Changes[args.Changes.Count - 1].NewEnd;
                editedBlockSpans.Add(new SnapshotSpan(args.After, new Span(changesStart, changesEnd - changesStart)));
            }

            InvalidateSpans(editedBlockSpans);
            editedBlockSpans.Clear();
        }

        protected void ForAllCurrentlyUsedAdornments(Action<TAdornment> action, bool invalidateAdornmentsAfterAction)
        {
            lock (adornmentsCache)
            {
                foreach (var adornment in adornmentsCache.Values)
                {
                    action(adornment);
                }

                if (invalidateAdornmentsAfterAction)
                {
                    InvalidateSpans(new List<SnapshotSpan>() { new SnapshotSpan(Snapshot, new Span(0, Snapshot.Length)) });
                }
            }
        }

        /// <summary>
        /// Causes intra-text adornments to be updated asynchronously.
        /// </summary>
        protected void InvalidateSpans(IList<SnapshotSpan> spans)
        {
            if (spans.Count == 0) return;

            bool wasEmpty = false;
            lock (invalidatedSpans)
            {
                wasEmpty = invalidatedSpans.Count == 0;
                invalidatedSpans.AddRangeByFor(spans);
            }

            if (wasEmpty)
                TextView.VisualElement.Dispatcher.BeginInvoke(new Action(AsyncUpdate));
        }

        private void AsyncUpdate()
        {
            // Store the snapshot that we're now current with and send an event
            // for the text that has changed.
            if (Snapshot != TextView.TextBuffer.CurrentSnapshot)
            {
                Snapshot = TextView.TextBuffer.CurrentSnapshot;

                var translatedAdornmentCache = adormentDictionariesPool.Get();
                Debug.Assert(translatedAdornmentCache.Count == 0);
                lock (adornmentsCache)
                {
                    foreach (var keyValuePair in adornmentsCache)
                    {
                        var newKey = new AdornmentCacheKey(keyValuePair.Key.Span.TranslateTo(Snapshot, SpanTrackingMode.EdgeExclusive));
                        if (!translatedAdornmentCache.ContainsKey(newKey))
                            translatedAdornmentCache.Add(newKey, keyValuePair.Value);
                    }

                    adornmentsCache.Clear();
                    adormentDictionariesPool.Put(adornmentsCache);
                    adornmentsCache = translatedAdornmentCache;
                }
            }

            int minSpan = int.MaxValue, maxSpan = int.MinValue;
            lock (invalidatedSpans)
            {
                if (invalidatedSpans.Count == 0) return;

                for (int i = 0; i < invalidatedSpans.Count; i++)
                {
                    var translatedSpan = invalidatedSpans[i].TranslateTo(Snapshot, SpanTrackingMode.EdgeInclusive);
                    if (translatedSpan.Start < minSpan) minSpan = translatedSpan.Start;
                    if (translatedSpan.End > maxSpan) maxSpan = translatedSpan.End;
                }

                invalidatedSpans.Clear();
            }

            RaiseTagsChanged(new SnapshotSpan(Snapshot, minSpan, maxSpan - minSpan));
        }

        /// <summary>
        /// Causes intra-text adornments to be updated synchronously.
        /// </summary>
        protected void RaiseTagsChanged(SnapshotSpan span)
        {
            Debug.WriteLine($"RaiseTagsChanged: {span}");
            TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span));
        }

        //private void HandleLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
        //{
        //    var visibleSpan = view.TextViewLines.FormattedSpan;

        //    // Filter out the adornments that are no longer visible.
        //    var toRemove =
        //        (from kv
        //         in adornmentCache
        //         where !kv.Key.Span.TranslateTo(visibleSpan.Snapshot, SpanTrackingMode.EdgeExclusive).IntersectsWith(visibleSpan)
        //         select kv.Key).ToList();

        //    foreach (var span in toRemove)
        //        adornmentCache.Remove(span);
        //}

        // Produces tags on the snapshot that the tag consumer asked for.
        public IEnumerable<ITagSpan<IntraTextAdornmentTag>> GetTags(NormalizedSnapshotSpanCollection spans)
        {
            if (!isEnabled || spans == null || spans.Count == 0) yield break;

            var requestedSnapshot = spans[0].Snapshot;
            var allTagSpans = perSnapshotResults.GetValue(Snapshot);
            foreach (var tagSpan in allTagSpans)
            {
                foreach (var span in spans)
                {
                    var adornment = (TeXCommentAdornment)tagSpan.Tag.Adornment;
                    var dataTagSpan = adornment.DataTag.SpanWithLastLineBreak;

                    var translatedDataTagSpan = new SnapshotSpan(Snapshot, dataTagSpan).TranslateTo(requestedSnapshot, SpanTrackingMode.EdgeExclusive);
                    if (translatedDataTagSpan.IntersectsWith(span))
                    {
                        var translatedTagSpan = new SnapshotSpan(Snapshot, tagSpan.Span).TranslateTo(requestedSnapshot, SpanTrackingMode.EdgeExclusive);
                        yield return new TagSpan<IntraTextAdornmentTag>(translatedTagSpan, tagSpan.Tag);
                        break;
                    }
                }
            }
        }

        private PooledStructEnumerable<ITagSpan<IntraTextAdornmentTag>> GetAdornmentTagsOnSnapshot(ITextSnapshot snapshot)
        {
            // Since WPF UI objects have state (like mouse hover or animation) and are relatively expensive to create and lay out,
            // this code tries to reuse controls as much as possible.
            // The controls are stored in this.adornmentCache between the calls.

            var results = tagSpanListsPool.Get();
            Debug.Assert(results.Count == 0);

            var toRemove = adornmentCacheKeyHashsetsPool.Get();
            Debug.Assert(toRemove.Count == 0);

            lock (adornmentsCache)
            {
                // Mark which adornments fall inside the requested spans with Keep=false
                // so that they can be removed from the cache if they no longer correspond to data tags.
                foreach (var kv in adornmentsCache)
                {
                    toRemove.Add(kv.Key);
                }

                foreach (var tagData in GetAdornmentData(new NormalizedSnapshotSpanCollection(snapshot, new Span(0, snapshot.Length))))
                {
                    // Look up the corresponding adornment or create one if it's new.
                    AdornmentInfo adornmentInfo;
                    var key = new AdornmentCacheKey(tagData.Span);
                    if (adornmentsCache.TryGetValue(key, out TAdornment adornment))
                    {
                        adornmentInfo = tagData.GetAdornmentInfo(adornment.DisplayMode);
                        UpdateAdornment(adornment, tagData.Tag, snapshot);
                        toRemove.Remove(key);

                        Debug.WriteLine($"Updating adornment {adornment.Index}");
                    }
                    else
                    {
                        adornmentInfo = tagData.GetAdornmentInfo(Mode);

                        if (adornmentsPool.Count > 0)
                        {
                            adornment = adornmentsPool[adornmentsPool.Count - 1];
                            adornmentsPool.RemoveAt(adornmentsPool.Count - 1);
                            UpdateAdornment(adornment, tagData.Tag, snapshot);
                            adornment.CurrentState = TeXCommentAdornmentState.EditingAndRenderingPreview;
                            Debug.WriteLine($"Reusing adornment {adornment.Index} from pool");
                        }
                        else
                        {
                            adornment = CreateAdornment(tagData.Tag, snapshot);
                            adornment.DisplayModeChanged += (s, e) => perSnapshotResults.UpdateValue(Snapshot); //will be deattached on  dispose
                            Debug.WriteLine($"Creating adornment {adornment.Index}");
                        }

                        if (adornment == null) continue;

                        // Get the adornment to measure itself. Its DesiredSize property is used to determine
                        // how much space to leave between text for this adornment.
                        // Note: If the size of the adornment changes, the line will be reformatted to accommodate it.
                        // Note: Some adornments may change size when added to the view's visual tree due to inherited
                        // dependency properties that affect layout. Such options can include SnapsToDevicePixels,
                        // UseLayoutRounding, TextRenderingMode, TextHintingMode, and TextFormattingMode. Making sure
                        // that these properties on the adornment match the view's values before calling Measure here
                        // can help avoid the size change and the resulting unnecessary re-format.
                        adornment.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                        adornmentsCache.Add(key, adornment);
                    }

                    Debug.WriteLine($"Yielding adornment {adornment.Index} with span {adornmentInfo.Span}");
                    results.Add(new TagSpan<IntraTextAdornmentTag>(adornmentInfo.Span, new IntraTextAdornmentTag(adornment, null, adornmentInfo.Affinity)));
                }

                foreach (var adornmentKey in toRemove)
                {
                    if (adornmentsPool.Count < MaxAdornmentPoolSize)
                    {
                        adornmentsPool.Add(adornmentsCache[adornmentKey]);
                    }
                    adornmentsCache.Remove(adornmentKey);
                }

                toRemove.Clear();
                adornmentCacheKeyHashsetsPool.Put(toRemove);
            }

            return new PooledStructEnumerable<ITagSpan<IntraTextAdornmentTag>>(results, tagSpanListsPool);
        }

        private void TextView_Loaded(object sender, RoutedEventArgs e)
        {
            isEnabled = true;
        }

        public virtual void Dispose()
        {
            ((FrameworkElement)TextView).Loaded -= TextView_Loaded;

            TextSnapshotTeXCommentBlocksProvider.Release(TextView.TextBuffer, TexCommentBlocks);
            perSnapshotResults.Dispose();

            foreach (var item in adornmentsCache.Values) item.Dispose();
            adornmentsCache.Clear();
        }

        public event EventHandler<SnapshotSpanEventArgs> TagsChanged;

        private struct AdornmentCacheKey : IEquatable<AdornmentCacheKey>
        {
            private readonly int SnapshotVersion;
            private readonly int SpanStart;

            public readonly SnapshotSpan Span;

            public AdornmentCacheKey(SnapshotSpan span)
            {
                Span = span;
                SnapshotVersion = span.Snapshot.Version.VersionNumber;
                SpanStart = span.Start.Position;
            }

            public bool Equals(AdornmentCacheKey other)
            {
                return SnapshotVersion == other.SnapshotVersion && SpanStart == other.SpanStart;
            }

            public override int GetHashCode() => SnapshotVersion ^ SpanStart;
        }

        public struct TagData : IEquatable<TagData>
        {
            private readonly PositionAffinity? Affinity;
            public readonly SnapshotSpan Span;
            public readonly TDataTag Tag;

            public TagData(SnapshotSpan tagSpan, PositionAffinity? adornmentAffinity, TDataTag tag)
            {
                this.Span = tagSpan;
                Affinity = adornmentAffinity;
                Tag = tag;
            }

            public AdornmentInfo GetAdornmentInfo(IntraTextAdornmentTaggerDisplayMode mode)
            {
                switch (mode)
                {
                    case IntraTextAdornmentTaggerDisplayMode.HideOriginalText_WithoutLastLineBreak:
                        {
                            var affinity = Span.Length > 0 ? null : Affinity;
                            return new AdornmentInfo(Span, affinity);
                        }
                    case IntraTextAdornmentTaggerDisplayMode.DoNotHideOriginalText_BeforeLastLineBreak:
                        {
                            SnapshotPoint start;
                            if (!Affinity.HasValue || Affinity.Value == PositionAffinity.Predecessor)
                            {
                                start = Span.Start;
                            }
                            else
                            {
                                start = Span.End;
                            }
                            var adornmentSpan = new SnapshotSpan(start, 0);
                            return new AdornmentInfo(adornmentSpan, Affinity);
                        }
                    default:
                        throw new InvalidOperationException($"Unknown {nameof(IntraTextAdornmentTaggerDisplayMode)}: '{mode}'.");
                }
            }

            public bool Equals(TagData other)
            {
                return Span.Snapshot.Version.VersionNumber == other.Span.Snapshot.Version.VersionNumber &&
                    Span.Start.Position == other.Span.Start.Position;
            }
        }

        public struct AdornmentInfo
        {
            public readonly SnapshotSpan Span;
            public readonly PositionAffinity? Affinity;

            public AdornmentInfo(SnapshotSpan adornmentSpan, PositionAffinity? affinity)
            {
                Span = adornmentSpan;
                Affinity = affinity;
            }
        }
    }

    public enum IntraTextAdornmentTaggerDisplayMode
    {
        HideOriginalText_WithoutLastLineBreak,
        DoNotHideOriginalText_BeforeLastLineBreak,
    }
}


text:
This is an example of using a configuration file for URLs. Seet the configuration.xml file.

The important settings here are these settings in the jnlp file:

```
    <property name="javaws.configuration" value="https://raw.githubusercontent.com/AutoGeneral/IridiumApplicationTesting/master/examples/4.urlmappings/configuration.xml"/>
```


text:
require File.expand_path('../helper', __FILE__)

class PagerdutyTest < Librato::Services::TestCase
  def setup
    @stubs = Faraday::Adapter::Test::Stubs.new
  end

  def test_validations
    params = {:service_key => 'k', :event_type => 't', :description => 'd'}

    0.upto(params.keys.length - 1) do |i|
      opts = {}
      0.upto(i) do |j|
        opts[params.keys[j]] = params[params.keys[j]]
      end
      svc = service(:alert, opts, alert_payload)
      errors = {}
      ret = svc.receive_validate(errors)
      success = i == params.keys.length - 1
      assert_equal(success, ret, "opts not complete: #{opts}")
      assert_equal(0, errors.length) if success
    end
  end

  def test_alerts_multiple_measurements
    svc = service(:alert, {
                    :service_key => 'k',
                    :event_type => 't',
                    :description => 'd'
                  }, alert_payload_multiple_measurements)

    @stubs.post '/generic/2010-04-15/create_event.json' do |env|
      [200, {}, '']
    end

    svc.receive_alert
  end

  def test_alerts
    svc = service(:alert, {
                    :service_key => 'k',
                    :event_type => 't',
                    :description => 'settings description'
                  }, alert_payload)

    @stubs.post '/generic/2010-04-15/create_event.json' do |env|
      [200, {}, '']
      # if the alert does not have a name, then verify it uses the description
      assert_equal 'settings description', env[:body][:description]
    end

    svc.receive_alert
  end

  def test_new_alerts
    svc = service(:alert, {
                    :service_key => 'k',
                    :event_type => 't',
                    :description => 'd'
                  }, new_alert_payload)

    @stubs.post '/generic/2010-04-15/create_event.json' do |env|
      assert_nil env[:body][:details]["auth"]
      assert_nil env[:body][:details]["settings"]
      assert_nil env[:body][:details]["service_type"]
      assert_nil env[:body][:details]["event_type"]
      assert_not_nil env[:body][:details]["violations"]
      assert_not_nil env[:body][:details]["conditions"]
      assert_not_nil env[:body][:details]["trigger_time"]
      assert_not_nil env[:body][:details]["alert"]
      assert_not_nil env[:body][:details]["user_id"]
      assert_not_nil env[:body][:details][:alert_link]
      assert_nil env[:body][:details][:metric_link] # no metric_link for v2 alerts
      assert_equal "trigger", env[:body][:event_type]
      assert_equal "foo", env[:body][:incident_key]
      assert_equal 'Some alert name', env[:body][:description]
      [200, {}, '']
    end

    svc.receive_alert
  end

  def test_new_alerts_clearing
    payload = new_alert_payload.dup
    payload[:clear] = "manual"
    svc = service(:alert, {
                    :service_key => 'k',
                    :event_type => 't',
                    :description => 'd'
                  }, payload)

    @stubs.post '/generic/2010-04-15/create_event.json' do |env|
      assert_nil env[:body][:details]["auth"]
      assert_nil env[:body][:details]["settings"]
      assert_nil env[:body][:details]["service_type"]
      assert_nil env[:body][:details]["event_type"]
      assert_not_nil env[:body][:details]["violations"]
      assert_not_nil env[:body][:details]["conditions"]
      assert_not_nil env[:body][:details]["trigger_time"]
      assert_not_nil env[:body][:details]["alert"]
      assert_not_nil env[:body][:details]["user_id"]
      assert_equal "resolve", env[:body][:event_type]
      assert_equal "foo", env[:body][:incident_key]
      assert_equal 'Some alert name', env[:body][:description]
      [200, {}, '']
    end

    svc.receive_alert
  end

  def service(*args)
    super Service::Pagerduty, *args
  end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Powerfront.Backend.Repository
{
    public interface IUnitOfWork : IDisposable
    {
        IRepository<TEntity> GetRepository<TEntity>() where TEntity : class;
        void Save();
    }
}


text:
package com.amazonaws.resources.ec2.internal;

import java.util.Iterator;

import com.amazonaws.resources.ResourcePage;
import com.amazonaws.resources.ResultCapture;
import com.amazonaws.resources.ec2.Vpc;
import com.amazonaws.resources.ec2.VpcCollection;
import com.amazonaws.resources.internal.ResourceCollectionImpl;
import com.amazonaws.resources.internal.StandardPageIterable;
import com.amazonaws.resources.internal.StandardResourceIterator;
import com.amazonaws.resources.internal.StandardResourcePage;

class VpcCollectionImpl implements VpcCollection {

    private final ResourceCollectionImpl impl;

    public VpcCollectionImpl(ResourceCollectionImpl impl) {
        this.impl = impl;
    }

    @Override
    public Iterator<Vpc> iterator() {
        return new StandardResourceIterator<Vpc>(impl.iterator(),
                VpcImpl.CODEC);
    }

    @Override
    public Iterable<ResourcePage<Vpc>> pages() {
        return new StandardPageIterable<Vpc>(impl.pages(), VpcImpl.CODEC);
    }

    @Override
    public ResourcePage<Vpc> firstPage() {
        return firstPage(null);
    }

    @Override
    public ResourcePage<Vpc> firstPage(ResultCapture<Object> extractor) {
        return new StandardResourcePage<Vpc>(impl.firstPage(extractor),
                VpcImpl.CODEC);
    }
}


text:
package androidx.car.app.model;

import static androidx.car.app.model.CarLocation.create;

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.internal.DoNotInstrument;

/** Tests for {@link CarLocation}. */
@RunWith(RobolectricTestRunner.class)
@DoNotInstrument
public class CarLocationTest {
    @Test
    public void createInstance() {
        CarLocation location = create(123.f, 456.f);
        assertThat(location.getLatitude()).isWithin(0.001).of(123.f);
        assertThat(location.getLongitude()).isWithin(0.001).of(456.f);
    }

    @Test
    public void equals() {
        CarLocation carLocation = create(123.45, 987.65);

        assertThat(create(123.45, 987.65)).isEqualTo(carLocation);
    }

    @Test
    public void notEquals_differentLat() {
        CarLocation carLocation = create(123.45, 987.65);

        assertThat(create(123.449999999, 987.65)).isNotEqualTo(carLocation);
        assertThat(create(123.450000001, 987.65)).isNotEqualTo(carLocation);
    }

    @Test
    public void notEquals_differentLng() {
        CarLocation carLocation = create(123.45, 987.65);

        assertThat(create(123.45, 987.64999999999)).isNotEqualTo(carLocation);
        assertThat(create(123.45, 987.65000000001)).isNotEqualTo(carLocation);
    }
}


text:
package net.minidev.ovh.api.connectivity.eligibility;

/**
 * Line status
 */
public enum OvhLineStatusEnum {
	active("active"),
	inactive("inactive");

	final String value;

	OvhLineStatusEnum(String s) {
		this.value = s;
	}

	public String toString() {
		return this.value;
	}
}


text:
[Install Docker](https://docs.docker.com/engine/installation/).

If you are using Mac, find the "Docker Quickstart Terminal" and double-click to launch it and work within it.

build container:

```
git clone https://github.com/masayoshi-nakamura/CognitiveArchitectureLecture.git
cd CognitiveArchitectureLecture/docker/brica_gazebo
docker build --tag=brica-gazebo .
```

run docker container:

```
docker run -it -p 8888:8888 -p 8080:8080 -p 7681:7681 brica-gazebo
```

After that, you are in docker container. Start gazebo server and gazebo web server:

```
# in docker container
/root/gzweb/start_gzweb.sh && gzserver /root/CognitiveArchitectureLecture/worlds/maze_turtlbot.xml &
```

You'll now be able to access http://[your docker IP]:8080.
 - Ubuntu: [http://localhost:8080/](http://localhost:8080/)
 - Mac and using "Docker Quickstart Terminal": access to IP displayed when "Docker Quickstart Terminal" started.

Run a BriCA sample agent in the container:

```
# in docker container
cd ~/CognitiveArchitectureLecture/examples/brica_agent
python brica_agent.py
```

If you want to create your code, use [IPython Jupyter](http://ipython.org/):

```
# in docker container
cd ~/CognitiveArchitectureLecture/examples/brica_agent
jupyter notebook --no-browser --port 8888 --ip=*
```

You'll now be able to access http://[your docker IP]:8888/


text:
"""Code for pie charts."""

import warnings

from mapreduce.third_party.graphy import common
from mapreduce.third_party.graphy import util

class Segment(common.DataSeries):
  """A single segment of the pie chart.

  Object attributes:
    size: relative size of the segment
    label: label of the segment (if any)
    color: color of the segment (if any)
  """
  def __init__(self, size, label=None, color=None):
    if label is not None and util._IsColor(label):
      warnings.warn('Your code may be broken! '
                    'Label looks like a hex triplet; it might be a color.  '
                    'The old argument order (color before label) is '
                    'deprecated.',
                    DeprecationWarning, stacklevel=2)
    style = common._BasicStyle(color)
    super(Segment, self).__init__([size], label=label, style=style)
    assert size >= 0

  def _GetSize(self):
    return self.data[0]

  def _SetSize(self, value):
    assert value >= 0
    self.data[0] = value

  size = property(_GetSize, _SetSize,
                  doc = """The relative size of this pie segment.""")

  # Since Segments are so simple, provide color for convenience.
  def _GetColor(self):
    return self.style.color

  def _SetColor(self, color):
    self.style.color = color

  color = property(_GetColor, _SetColor,
                   doc = """The color of this pie segment.""")

class PieChart(common.BaseChart):
  """Represents a pie chart.

  The pie chart consists of a single "pie" by default, but additional pies
  may be added using the AddPie method. The Google Chart API will display
  the pies as concentric circles, with pie #0 on the inside; other backends
  may display the pies differently.
  """

  def __init__(self, points=None, labels=None, colors=None):
    """Constructor for PieChart objects.

    Creates a pie chart with a single pie.

    Args:
      points: A list of data points for the pie chart;
              i.e., relative sizes of the pie segments
      labels: A list of labels for the pie segments.
              TODO: Allow the user to pass in None as one of
              the labels in order to skip that label.
      colors: A list of colors for the pie segments, as hex strings
              (f.ex. '0000ff' for blue). If there are less colors than pie
              segments, the Google Chart API will attempt to produce a smooth
              color transition between segments by spreading the colors across
              them.
    """
    super(PieChart, self).__init__()
    self.formatters = []
    self._colors = None
    if points:
      self.AddPie(points, labels, colors)

  def AddPie(self, points, labels=None, colors=None):
    """Add a whole pie to the chart.

    Args:
      points: A list of pie segment sizes
      labels: A list of labels for the pie segments
      colors: A list of colors for the segments. Missing colors will be chosen
          automatically.
    Return:
      The index of the newly added pie.
    """
    num_colors = len(colors or [])
    num_labels = len(labels or [])
    pie_index = len(self.data)
    self.data.append([])
    for i, pt in enumerate(points):
      label = None
      if i < num_labels:
        label = labels[i]
      color = None
      if i < num_colors:
        color = colors[i]
      self.AddSegment(pt, label=label, color=color, pie_index=pie_index)
    return pie_index

  def AddSegments(self, points, labels, colors):
    """DEPRECATED."""
    warnings.warn('PieChart.AddSegments is deprecated. Call AddPie instead. ',
                  DeprecationWarning, stacklevel=2)
    num_colors = len(colors or [])
    for i, pt in enumerate(points):
      assert pt >= 0
      label = labels[i]
      color = None
      if i < num_colors:
        color = colors[i]
      self.AddSegment(pt, label=label, color=color)

  def AddSegment(self, size, label=None, color=None, pie_index=0):
    """Add a pie segment to this chart, and return the segment.

    size: The size of the segment.
    label: The label for the segment.
    color: The color of the segment, or None to automatically choose the color.
    pie_index: The index of the pie that will receive the new segment.
      By default, the chart has one pie (pie #0); use the AddPie method to
      add more pies.
    """
    if isinstance(size, Segment):
      warnings.warn("AddSegment(segment) is deprecated.  Use AddSegment(size, "
                    "label, color) instead",  DeprecationWarning, stacklevel=2)
      segment = size
    else:
      segment = Segment(size, label=label, color=color)
    assert segment.size >= 0
    if pie_index == 0 and not self.data:
      # Create the default pie
      self.data.append([])
    assert (pie_index >= 0 and pie_index < len(self.data))
    self.data[pie_index].append(segment)
    return segment

  def AddSeries(self, points, color=None, style=None, markers=None, label=None):
    """DEPRECATED

    Add a new segment to the chart and return it.

    The segment must contain exactly one data point; all parameters
    other than color and label are ignored.
    """
    warnings.warn('PieChart.AddSeries is deprecated.  Call AddSegment or '
                  'AddSegments instead.', DeprecationWarning)
    return self.AddSegment(Segment(points[0], color=color, label=label))

  def SetColors(self, *colors):
    """Change the colors of this chart to the specified list of colors.

    Note that this will completely override the individual colors specified
    in the pie segments. Missing colors will be interpolated, so that the
    list of colors covers all segments in all the pies.
    """
    self._colors = colors


text:
{
    'name': 'Google Drive™ integration',
    'version': '0.2',
    'category': 'Extra Tools',
    'installable': True,
    'auto_install': False,
    'data': [
        'security/ir.model.access.csv',
        'res_config_user_view.xml',
        'google_drive_data.xml',
        'views/google_drive.xml',
    ],
    'demo': [
        'google_drive_demo.xml'
    ],
    'depends': ['base_setup', 'google_account'],
    'description': """
Integrate google document to OpenERP record.
============================================

This module allows you to integrate google documents to any of your OpenERP record quickly and easily using OAuth 2.0 for Installed Applications,
You can configure your google Authorization Code from Settings > Configuration > General Settings by clicking on "Generate Google Authorization Code"
"""
}


text:
struct ExtensionMsg_ExternalConnectionInfo;
struct ExtensionMsg_TabConnectionInfo;

namespace extensions {

class Dispatcher;
struct Message;
struct PortId;
class ScriptContext;

// RenderFrame-level plumbing for extension features.
class ExtensionFrameHelper
    : public content::RenderFrameObserver,
      public content::RenderFrameObserverTracker<ExtensionFrameHelper>,
      public mojom::LocalFrame {
 public:
  ExtensionFrameHelper(content::RenderFrame* render_frame,
                       Dispatcher* extension_dispatcher);

  ExtensionFrameHelper(const ExtensionFrameHelper&) = delete;
  ExtensionFrameHelper& operator=(const ExtensionFrameHelper&) = delete;

  ~ExtensionFrameHelper() override;

  // Returns a list of extension RenderFrames that match the given filter
  // criteria. A |browser_window_id| of extension_misc::kUnknownWindowId
  // specifies "all", as does a |view_type| of mojom::ViewType::kInvalid.
  static std::vector<content::RenderFrame*> GetExtensionFrames(
      const std::string& extension_id,
      int browser_window_id,
      int tab_id,
      mojom::ViewType view_type);
  // Same as above, but returns a v8::Array of the v8 global objects for those
  // frames, and only includes main frames. Note: This only returns contexts
  // that are accessible by |context|, and |context| must be the current
  // context.
  // Returns an empty v8::Array if no frames are found.
  static v8::Local<v8::Array> GetV8MainFrames(v8::Local<v8::Context> context,
                                              const std::string& extension_id,
                                              int browser_window_id,
                                              int tab_id,
                                              mojom::ViewType view_type);

  // Returns the main frame of the extension's background page, or null if there
  // isn't one in this process.
  static content::RenderFrame* GetBackgroundPageFrame(
      const std::string& extension_id);
  // Same as above, but returns the background page's main frame, or
  // v8::Undefined if there is none. Note: This will assert that the
  // isolate's current context can access the returned object; callers should
  // ensure that the current context is correct.
  static v8::Local<v8::Value> GetV8BackgroundPageMainFrame(
      v8::Isolate* isolate,
      const std::string& extension_id);

  // Finds a neighboring extension frame with the same extension as the one
  // owning |relative_to_frame| (if |relative_to_frame| is not an extension
  // frame, returns nullptr). Pierces the browsing instance boundary because
  // certain extensions rely on this behavior.
  // TODO(devlin, lukasza): https://crbug.com/786411: Remove this behavior, and
  // make extensions follow the web standard for finding frames or use an
  // explicit API.
  static content::RenderFrame* FindFrame(
      content::RenderFrame* relative_to_frame,
      const std::string& name);

  // Returns true if the given |context| is for any frame in the extension's
  // event page.
  // TODO(devlin): This isn't really used properly, and should probably be
  // deleted.
  static bool IsContextForEventPage(const ScriptContext* context);

  mojom::ViewType view_type() const { return view_type_; }
  int tab_id() const { return tab_id_; }
  int browser_window_id() const { return browser_window_id_; }
  bool did_create_current_document_element() const {
    return did_create_current_document_element_;
  }

  // mojom::LocalFrame:
  void SetFrameName(const std::string& name) override;
  void SetSpatialNavigationEnabled(bool enabled) override;
  void SetTabId(int32_t id) override;
  void AppWindowClosed(bool send_onclosed) override;
  void NotifyRenderViewType(mojom::ViewType view_type) override;
  void MessageInvoke(const std::string& extension_id,
                     const std::string& module_name,
                     const std::string& function_name,
                     const base::Value args) override;

  void ExecuteCode(mojom::ExecuteCodeParamsPtr param,
                   ExecuteCodeCallback callback) override;

  void ExecuteDeclarativeScript(int32_t tab_id,
                                const std::string& extension_id,
                                const std::string& script_id,
                                const GURL& url) override;

  void UpdateBrowserWindowId(int32_t window_id) override;

  void set_did_create_script_context() { did_create_script_context_ = true; }
  bool did_create_script_context() const { return did_create_script_context_; }

  // Called when the document element has been inserted in this frame. This
  // method may invoke untrusted JavaScript code that invalidate the frame and
  // this ExtensionFrameHelper.
  void RunScriptsAtDocumentStart();

  // Called after the DOMContentLoaded event has fired.
  void RunScriptsAtDocumentEnd();

  // Called before the window.onload event is fired.
  void RunScriptsAtDocumentIdle();

  // Schedule a callback, to be run at the next RunScriptsAtDocumentStart
  // notification. Only call this when you are certain that there will be such a
  // notification, e.g. from RenderFrameObserver::DidCreateDocumentElement.
  // Otherwise the callback is never invoked, or invoked for a document that you
  // were not expecting.
  void ScheduleAtDocumentStart(base::OnceClosure callback);

  // Schedule a callback, to be run at the next RunScriptsAtDocumentEnd call.
  void ScheduleAtDocumentEnd(base::OnceClosure callback);

  // Schedule a callback, to be run at the next RunScriptsAtDocumentIdle call.
  void ScheduleAtDocumentIdle(base::OnceClosure callback);

  mojom::LocalFrameHost* GetLocalFrameHost();

 private:
  void BindLocalFrame(
      mojo::PendingAssociatedReceiver<mojom::LocalFrame> receiver);

  // RenderFrameObserver implementation.
  void DidCreateDocumentElement() override;
  void DidCreateNewDocument() override;
  void ReadyToCommitNavigation(
      blink::WebDocumentLoader* document_loader) override;
  void DidCommitProvisionalLoad(ui::PageTransition transition) override;
  void DidCreateScriptContext(v8::Local<v8::Context>,
                              int32_t world_id) override;
  void WillReleaseScriptContext(v8::Local<v8::Context>,
                                int32_t world_id) override;
  bool OnMessageReceived(const IPC::Message& message) override;
  void OnDestruct() override;
  void DraggableRegionsChanged() override;

  // IPC handlers.
  void OnExtensionValidateMessagePort(int worker_thread_id, const PortId& id);
  void OnExtensionDispatchOnConnect(
      int worker_thread_id,
      const PortId& target_port_id,
      const std::string& channel_name,
      const ExtensionMsg_TabConnectionInfo& source,
      const ExtensionMsg_ExternalConnectionInfo& info);
  void OnExtensionDeliverMessage(int worker_thread_id,
                                 const PortId& target_port_id,
                                 const Message& message);
  void OnExtensionDispatchOnDisconnect(int worker_thread_id,
                                       const PortId& id,
                                       const std::string& error_message);

  // Type of view associated with the RenderFrame.
  mojom::ViewType view_type_ = mojom::ViewType::kInvalid;

  // The id of the tab the render frame is attached to.
  int tab_id_ = -1;

  // The id of the browser window the render frame is attached to.
  int browser_window_id_ = -1;

  Dispatcher* extension_dispatcher_;

  // Whether or not the current document element has been created. This starts
  // true as the initial empty document is already created when this class is
  // instantiated.
  // TODO(danakj): Does this still need to be tracked? We now have consisitent
  // notifications for initial empty documents on all frames.
  bool did_create_current_document_element_ = true;

  // Callbacks to be run at the next RunScriptsAtDocumentStart notification.
  std::vector<base::OnceClosure> document_element_created_callbacks_;

  // Callbacks to be run at the next RunScriptsAtDocumentEnd notification.
  std::vector<base::OnceClosure> document_load_finished_callbacks_;

  // Callbacks to be run at the next RunScriptsAtDocumentIdle notification.
  std::vector<base::OnceClosure> document_idle_callbacks_;

  bool delayed_main_world_script_initialization_ = false;

  // Whether or not a DocumentLoader has been created at least once for this
  // RenderFrame.
  // Note: Chrome Apps intentionally do not support new navigations. When a
  // navigation happens, it is either the initial one or a reload.
  bool has_started_first_navigation_ = false;

  bool did_create_script_context_ = false;
  // Whether we are currently initializing the main world script context.
  bool is_initializing_main_world_script_context_ = false;

  mojo::AssociatedRemote<mojom::LocalFrameHost> local_frame_host_remote_;

  mojo::AssociatedReceiver<mojom::LocalFrame> local_frame_receiver_{this};

  base::WeakPtrFactory<ExtensionFrameHelper> weak_ptr_factory_{this};
};

}  // namespace extensions

#endif  // EXTENSIONS_RENDERER_EXTENSION_FRAME_HELPER_H_


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Diatom Research 16: -. [307¿316]

#### Original name
null

### Remarks
null


text:
<!doctype html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">

  <link rel="icon" type="image/ico" href="http://www.alsace.com/wp-content/themes/default/fav_icon.ico">

  <title>Alsace.nyc</title>

  <base href="/">

  <link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="all">

    <app-root>

    </app-root>


text:
<?php

namespace Proyecto\UsuarioBundle\Tests;

use Proyecto\UsuarioBundle\UsuarioBundle;
use Symfony\Component\Validator\Validation;
use Proyecto\UsuarioBundle\Entity\Usuario;

/**
 * Test unitario para la entidad Usuario
 */
class UsuarioTest extends \PHPUnit_Framework_TestCase
{
    private $validator;

    protected function setUp()
    {
        $this->validator = Validation::createValidatorBuilder()
            ->enableAnnotationMapping()
            ->getValidator();
    }

    public function testValidarRole()
    {
        $usuario = new Usuario();
        $role = $usuario->getRole();
        $this->assertEquals('user', $role);
    }

}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.sql.gen;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import io.airlift.bytecode.BytecodeBlock;
import io.airlift.bytecode.BytecodeNode;
import io.airlift.bytecode.Scope;
import io.airlift.bytecode.Variable;
import io.airlift.bytecode.control.IfStatement;
import io.airlift.bytecode.instruction.LabelNode;
import io.airlift.bytecode.instruction.VariableInstruction;
import io.prestosql.metadata.Signature;
import io.prestosql.spi.function.OperatorType;
import io.prestosql.spi.type.Type;
import io.prestosql.sql.relational.RowExpression;
import io.prestosql.sql.relational.SpecialForm;

import java.util.List;

import static io.airlift.bytecode.expression.BytecodeExpressions.constantFalse;
import static io.airlift.bytecode.expression.BytecodeExpressions.constantTrue;
import static io.prestosql.sql.relational.SpecialForm.Form.WHEN;

public class SwitchCodeGenerator
        implements BytecodeGenerator
{
    @Override
    public BytecodeNode generateExpression(Signature signature, BytecodeGeneratorContext generatorContext, Type returnType, List<RowExpression> arguments)
    {
        // TODO: compile as
        /*
            hashCode = hashCode(<value>)

            // all constant expressions before a non-constant
            switch (hashCode) {
                case ...:
                    if (<value> == <constant1>) {
                       ...
                    }
                    else if (<value> == <constant2>) {
                       ...
                    }
                    else if (...) {
                    }
                case ...:
                    ...
            }

            if (<value> == <non-constant1>) {
                ...
            }
            else if (<value> == <non-constant2>) {
                ...
            }
            ...

            // repeat with next sequence of constant expressions
         */

        Scope scope = generatorContext.getScope();

        // process value, else, and all when clauses
        RowExpression value = arguments.get(0);
        BytecodeNode valueBytecode = generatorContext.generate(value);
        BytecodeNode elseValue;

        List<RowExpression> whenClauses;
        RowExpression last = arguments.get(arguments.size() - 1);
        if (last instanceof SpecialForm && ((SpecialForm) last).getForm() == WHEN) {
            whenClauses = arguments.subList(1, arguments.size());
            elseValue = new BytecodeBlock()
                    .append(generatorContext.wasNull().set(constantTrue()))
                    .pushJavaDefault(returnType.getJavaType());
        }
        else {
            whenClauses = arguments.subList(1, arguments.size() - 1);
            elseValue = generatorContext.generate(last);
        }

        // determine the type of the value and result
        Class<?> valueType = value.getType().getJavaType();

        // evaluate the value and store it in a variable
        LabelNode nullValue = new LabelNode("nullCondition");
        Variable tempVariable = scope.createTempVariable(valueType);
        BytecodeBlock block = new BytecodeBlock()
                .append(valueBytecode)
                .append(BytecodeUtils.ifWasNullClearPopAndGoto(scope, nullValue, void.class, valueType))
                .putVariable(tempVariable);

        BytecodeNode getTempVariableNode = VariableInstruction.loadVariable(tempVariable);

        // build the statements
        elseValue = new BytecodeBlock().visitLabel(nullValue).append(elseValue);
        // reverse list because current if statement builder doesn't support if/else so we need to build the if statements bottom up
        for (RowExpression clause : Lists.reverse(whenClauses)) {
            Preconditions.checkArgument(clause instanceof SpecialForm && ((SpecialForm) clause).getForm() == WHEN);

            RowExpression operand = ((SpecialForm) clause).getArguments().get(0);
            RowExpression result = ((SpecialForm) clause).getArguments().get(1);

            // call equals(value, operand)
            Signature equalsFunction = generatorContext.getMetadata().resolveOperator(OperatorType.EQUAL, ImmutableList.of(value.getType(), operand.getType()));

            // TODO: what if operand is null? It seems that the call will return "null" (which is cleared below)
            // and the code only does the right thing because the value in the stack for that scenario is
            // Java's default for boolean == false
            // This code should probably be checking for wasNull after the call and "failing" the equality
            // check if wasNull is true
            BytecodeNode equalsCall = generatorContext.generateCall(
                    equalsFunction.getName(),
                    generatorContext.getMetadata().getScalarFunctionImplementation(equalsFunction),
                    ImmutableList.of(generatorContext.generate(operand), getTempVariableNode));

            BytecodeBlock condition = new BytecodeBlock()
                    .append(equalsCall)
                    .append(generatorContext.wasNull().set(constantFalse()));

            elseValue = new IfStatement("when")
                    .condition(condition)
                    .ifTrue(generatorContext.generate(result))
                    .ifFalse(elseValue);
        }

        return block.append(elseValue);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<query name="current user's roles" ds="ralasafe" isRawSQL="false" type="sql">
    <select isDistinct="false" mappingClass="org.ralasafe.privilege.UserRole">
        <column name="roleid" tableAlias="t1" order="ASC" javaType="int" property="roleId"/>
    </select>
    <from>
        <table name="ralasafe_ralasafe_userrole" alias="t1"/>
    </from>
    <where>
        <expressionGroup linker="AND">
            <binaryExpression>
                <operand1>
                    <column name="userid" tableAlias="t1" order="ASC"/>
                </operand1>
                <simpleOperator>=</simpleOperator>
                <operand2>
                    <userValue key="id"/>
                </operand2>
            </binaryExpression>
        </expressionGroup>
    </where>
    <rawSQL>
        <content></content>
    </rawSQL>
    <storedProcedure>
        <content></content>
        <select isDistinct="false"/>
    </storedProcedure>
</query>


text:
%--------------------------------------------------------------------------
% Author: Yash Vyas - yjvyas@gmail.com - 29/06/2017
% Contributors:
%--------------------------------------------------------------------------

function self = setVisibility(self,config,environment)
%SETVISIBILITY Sets visibility for the sensor viewing points and primitives
%in the environments as they are turned into sensor objects and Points. The
%occlusion sensor requires environment as input as well.
t      = config.t;
nSteps = numel(t);
self.pointVisibility     = zeros(self.nPoints,nSteps);
self.objectVisibility    = zeros(self.nObjects,nSteps);
self.pointObservationRelative = GP_Point.empty();

for i = 1:nSteps
    meshes = self.generateMeshes(environment,t(i));
    for j = 1:self.nPoints
        jPoint = self.get('points',j);
        [jPointVisible,jPointRelative] = self.pointVisibleOcclusion(jPoint,meshes,t(i));
        self.pointVisibility(j,i) = jPointVisible;
        self.pointObservationRelative(j,i) = jPointRelative;
    end
    for k = 1:self.nObjects
       pointIndexes = self.get('objects',k).get('pointIndexes');
       visibilities = self.pointVisibility(pointIndexes,i);
       if any(visibilities)
           self.objectVisibility(k,i) = 1;
       end
    end
end

end


text:
class CreateUndoableUndoContexts < ActiveRecord::Migration
  def change
    create_table :undoable_undo_contexts do |t|
      t.string :handle
      t.text :context

      t.timestamps
    end
  end
end


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.frontdoor.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Defines values for FrontDoorEnabledState. */
public final class FrontDoorEnabledState extends ExpandableStringEnum<FrontDoorEnabledState> {
    /** Static value Enabled for FrontDoorEnabledState. */
    public static final FrontDoorEnabledState ENABLED = fromString("Enabled");

    /** Static value Disabled for FrontDoorEnabledState. */
    public static final FrontDoorEnabledState DISABLED = fromString("Disabled");

    /**
     * Creates or finds a FrontDoorEnabledState from its string representation.
     *
     * @param name a name to look for.
     * @return the corresponding FrontDoorEnabledState.
     */
    @JsonCreator
    public static FrontDoorEnabledState fromString(String name) {
        return fromString(name, FrontDoorEnabledState.class);
    }

    /** @return known FrontDoorEnabledState values. */
    public static Collection<FrontDoorEnabledState> values() {
        return values(FrontDoorEnabledState.class);
    }
}


text:
"""
Display detailed information about currently active connections.
"""
import NetworkManager

c = NetworkManager.const

for conn in NetworkManager.NetworkManager.ActiveConnections:
    settings = conn.Connection.GetSettings()

    for s in list(settings.keys()):
        if 'data' in settings[s]:
            settings[s + '-data'] = settings[s].pop('data')

    secrets = conn.Connection.GetSecrets()
    for key in secrets:
        settings[key].update(secrets[key])

    devices = ""
    if conn.Devices:
        devices = " (on %s)" % ", ".join([x.Interface for x in conn.Devices])
    print("Active connection: %s%s" % (settings['connection']['id'], devices))
    size = max([max([len(y) for y in x.keys()]) for x in settings.values()])
    format = "      %%-%ds %%s" % (size + 5)
    for key, val in sorted(settings.items()):
        print("   %s" % key)
        for name, value in val.items():
            print(format % (name, value))
    for dev in conn.Devices:
        print("Device: %s" % dev.Interface)
        print("   Type             %s" % c('device_type', dev.DeviceType))
        # print("   IPv4 address     %s" % socket.inet_ntoa(struct.pack('L', dev.Ip4Address)))
        devicedetail = dev.SpecificDevice()
        if not callable(devicedetail.HwAddress):
            print("   MAC address      %s" % devicedetail.HwAddress)
        print("   IPv4 config")
        print("      Addresses")
        for addr in dev.Ip4Config.Addresses:
            print("         %s/%d -> %s" % tuple(addr))
        print("      Routes")
        for route in dev.Ip4Config.Routes:
            print("         %s/%d -> %s (%d)" % tuple(route))
        print("      Nameservers")
        for ns in dev.Ip4Config.Nameservers:
            print("         %s" % ns)


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

<title>D-Index</title>
<meta name="date" content="2015-04-06">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G H I L M N P Q R S T V

D

depth(Position<E>) - Method in class net.datastructures.AbstractTree

Returns the number of levels separating Position p from the root.

dequeue() - Method in class net.datastructures.LinkedQueue

Removes and returns the first element of the queue.

dequeue() - Method in interface net.datastructures.Queue

Removes and returns the first element of the queue.

A B C D E F G H I L M N P Q R S T V

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
class HealthForm < ActiveRecord::Base
  belongs_to :user, touch: true
  belongs_to :unit

  # validates :user_id, presence: true
  validates :unit_id, presence: true

  def valid_forms_for_event(event)
    return true if event.health_forms_required.empty?
    event.health_forms_required.all? do |form|
      form_date = self.send(form)
      return false if form_date.nil?
      form_date.end_of_day >= event.end_at
    end
  end

  def all_blank?
    part_a_date.blank? &&
      part_b_date.blank? &&
      part_c_date.blank? &&
      philmont_date.blank? &&
      northern_tier_date.blank? &&
      florida_sea_base_date.blank? &&
      summit_tier_date.blank?
  end

  def part_a_expires
    expires_at part_a_date
  end

  def part_b_expires
    expires_at part_b_date
  end

  def part_c_expires
    expires_at part_c_date
  end

  def florida_sea_base_expires
    expires_at florida_sea_base_date
  end

  def northern_tier_expires
    expires_at northern_tier_date
  end

  def summit_tier_expires
    expires_at summit_tier_date
  end

  def philmont_expires
    expires_at philmont_date
  end

  private

    def expires_at(date)
      return nil if date.nil?
      date + 1.year - 1.day
    end
end


text:
'use strict';

module.exports = {
	app: {
		title: 'MEAN.JS',
		description: 'Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js',
		keywords: 'mongodb, express, angularjs, node.js, mongoose, passport'
	},
	port: process.env.PORT || 3000,
	templateEngine: 'swig',
	sessionSecret: 'MEAN',
	sessionCollection: 'sessions',
	assets: {
		lib: {
			css: [
				'public/lib/bootstrap/dist/css/bootstrap.css',
				'public/lib/bootstrap/dist/css/bootstrap-theme.css',
				'public/lib/angular-ui-select/dist/select.min.css',
				'public/lib/select2/select2.css',
				'public/lib/ngReactGrid/build/css/ngReactGrid.css',
				'public/lib/ngDialog/css/ngDialog-theme-default.min.css'
			],
			js: [
				'public/lib/ng-file-upload/angular-file-upload-shim.js',
				'public/lib/angular/angular.js',
				'public/lib/angular-resource/angular-resource.js',
				'public/lib/angular-animate/angular-animate.js',
				'public/lib/angular-ui-select/dist/select.min.js',
				'public/lib/angular-ui-router/release/angular-ui-router.js',
				'public/lib/angular-ui-utils/ui-utils.js',
				'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
        		'public/lib/angular-sanitize/angular-sanitize.js',
				'public/lib/react/react.min.js',
				'public/lib/ngReactGrid/build/js/ngReactGrid.min.js',
				'public/lib/ngDialog/js/ngDialog.min.js',
				'public/lib/ng-file-upload/angular-file-upload.js',
				'public/lib/async/lib/async.js',
				'public/lib/jquery/dist/jquery.min.js'
			]
		},
		css: [
			'public/modules/**/css/*.css'
		],
		js: [
			'public/config.js',
			'public/application.js',
			'public/modules/*/*.js',
			'public/modules/*/*[!tests]*/*.js'
		],
		tests: [
			'public/lib/angular-mocks/angular-mocks.js',
			'public/modules/*/tests/*.js'
		]
	}
};


text:
CLThreadInitialFinishedNotifier::CLThreadInitialFinishedNotifier(CLEvent *pEvent)
{
	m_pEvent = pEvent;
	m_bSuccess = false;
}

CLThreadInitialFinishedNotifier::~CLThreadInitialFinishedNotifier()
{
}

CLStatus CLThreadInitialFinishedNotifier::NotifyInitialFinished(bool bInitialSuccess)
{
	m_bSuccess = bInitialSuccess;

	if(m_pEvent == 0)
		return CLStatus(-1, 0);

	CLStatus s = m_pEvent->Set();
	if(!s.IsSuccess())
	{
		CLLogger::WriteLogMsg("In CLThreadInitialFinishedNotifier::NotifyInitialFinished(), m_pEvent->Set error", 0);
		return CLStatus(-1, 0);
	}

	return CLStatus(0, 0);
}

bool CLThreadInitialFinishedNotifier::IsInitialSuccess()
{
	return m_bSuccess;
}


text:
import 'react-native';
import React from 'react';
import renderer from 'react-test-renderer';

import ProductListRow from '../ProductListRow';

it('renders correctly', () => {
  const tree = renderer.create(
    <ProductListRow
      name="Item"
      image="http://i.ebayimg.com/images/g/64EAAOSwCQZZDJPO/s-l1600.jpg"
      price={10}
    />,
  ).toJSON();

  expect(tree).toMatchSnapshot();
});


text:
/*import { Injectable }    from '@angular/core'
import { Headers, Http, RequestOptions,Response } from '@angular/http';
import { UserObject } from './userobject';
import './rxjs-operators'
import { Observable }     from 'rxjs/Observable';

@Injectable()

export class LoginService{

    constructor (private http: Http) {}
    private postURL = '/post'
    registerUser( info: UserObject ){
        console.log(info);
        let body = JSON.stringify(info);
        let headers = new Headers({ 'Content-Type': 'application/json' });
        let options = new RequestOptions({ headers: headers });
        return this.http.post(this.postURL, body, options)
            .map(this.extractData)
            .catch(this.handleError);
    }
    loginUser( info: UserObject ){

    }
    extractData(res: Response){
        console.log('did this run')
        let body = res.json();
        return body.data || { };
    }

    private handleError (error: any) {
        console.log(error);
        let errMsg = (error.message) ? error.message :
            -   error.status ? `${error.status} - ${error.statusText}` : 'Server error';
        console.error(errMsg); // log to console instead
        return Observable.throw(errMsg);
    }

} */
//# sourceMappingURL=login.service.js.map