text:
var expect = chai.expect;

describe('Router', function() {
    var templete;
    var container;
    var stubbedNavigationView;
    var stubbedPageView;
    var stubbedNotFoundView;
    var router;

    before(function() {
        templete = $('<div/>', {
            id: 'page-template'
        }).appendTo('body').append('<p/>');

        container = $('<div/>', {
            id: 'container'
        }).appendTo('body');

        var navigationView = {
            select: function(menu) {
            },
            deselectAll: function() {
            }
        };

        var contentView = function() {
            this.$el = $('<div/>');
        };

        contentView.prototype = {
            render: function() { return this; },
            activate: function() {
            },
            deactivate: function() {
            }
        };

        stubbedNavigationView = sinon.stub(Application.Views, 'Navigation').returns(navigationView);
        stubbedPageView = sinon.stub(Application.Views, 'Page', function() {
            return new contentView();
        });

        stubbedNotFoundView = sinon.stub(Application.Views, 'NotFound', function() {
            return new contentView();
        });

        router = new Application.Router();
    });

    describe('new', function() {
        it('creates navigation view', function() {
            expect(router.navigationView).to.exist;
        });

        it('creates home view', function() {
            expect(router.homeView).to.exist;
        });

        it('creates about view', function() {
            expect(router.homeView).to.exist;
        });

        it('creates not found view', function() {
            expect(router.notFoundView).to.exist;
        });
    });

    describe('navigation', function() {
        var stubbedActivate;

        before(function() {
            stubbedActivate = sinon.stub(router, 'activate', function() {
            });
            router.currentView = undefined;
        });

        describe('#about', function() {
            before(function() {
                return router.about();
            });

            it('activates home view', function() {
                expect(stubbedActivate).to.have.been.calledWith(router.aboutView, 'about');
            });

            after(function() {
                router.currentView = undefined;
                stubbedActivate.reset();
            });
        });

        describe('#home', function() {
            before(function() {
                return router.home();
            });

            it('activates home view', function() {
                expect(stubbedActivate).to.have.been.calledWith(router.homeView, 'home');
            });

            after(function() {
                router.currentView = undefined;
                stubbedActivate.reset();
            });
        });

        describe('#notFound', function() {
            before(function() {
                return router.notFound();
            });

            it('activates not found view', function() {
                expect(stubbedActivate).to.have.been.calledWith(router.notFoundView);
            });

            after(function() {
                router.currentView = undefined;
                stubbedActivate.reset();
            });
        });

        after(function() {
            return stubbedActivate.restore();
        });
    });

    describe('#activate', function() {
        describe('other view', function() {
            var spiedHomeViewDeactivate;
            var spiedAboutViewActivate;
            var spiedSelectMenu;

            before(function() {
                spiedSelectMenu = sinon.spy(router.navigationView, 'select');
                spiedHomeViewDeactivate = sinon.spy(router.homeView, 'deactivate');
                spiedAboutViewActivate = sinon.spy(router.aboutView, 'activate');
                router.currentView = router.homeView;
                router.activate(router.aboutView, 'about');
            });

            it('deactivates current view', function() {
                expect(spiedHomeViewDeactivate).to.have.been.calledOnce;
            });

            it('activates other view', function() {
                expect(spiedAboutViewActivate).to.have.been.calledOnce;
            });

            it('selects other view menu', function() {
                expect(spiedSelectMenu).to.have.been.calledWith('about');
            });

            it('sets other view as current view', function() {
                expect(router.currentView).to.equal(router.aboutView);
            });

            after(function() {
                spiedSelectMenu.restore();
                spiedHomeViewDeactivate.restore();
                spiedAboutViewActivate.restore();
            });
        });

        describe('same view', function() {
            var spiedHomeViewDeactivate;
            var spiedSelectMenu;

            before(function() {
                spiedSelectMenu = sinon.spy(router.navigationView, 'select');
                spiedHomeViewDeactivate = sinon.spy(router.homeView, 'deactivate');
                router.currentView = router.homeView;
                router.activate(router.homeView, 'home');
            });

            it('does nothing', function() {
                expect(spiedHomeViewDeactivate).to.not.have.been.called;
                expect(spiedSelectMenu).to.not.have.been.called;
                expect(router.currentView).to.equal(router.homeView);
            });

            after(function() {
                spiedSelectMenu.restore();
                spiedHomeViewDeactivate.restore();
            });
        });

        describe('not found view', function() {
            var spiedDeselectMenu;

            before(function() {
                spiedDeselectMenu = sinon.spy(router.navigationView, 'deselectAll');
                router.currentView = router.homeView;
                router.activate(router.notFoundView);
            });

            it('deselects menu', function() {
                expect(spiedDeselectMenu).to.have.been.calledOnce;
            });

            after(function() {
                spiedDeselectMenu.restore();
            });
        });
    });

    after(function() {
        stubbedNavigationView.restore();
        stubbedPageView.restore();
        stubbedNotFoundView.restore();
        container.remove();
        templete.remove();
    });
});


text:
namespace DNS.Task.Core.Models
{
	public class EntityBase : IIdentityObject<int>
	{
		public int Id { get; set; }

	}
}

redpajama_set_name: RedPajamaGithub


text:
package elastic

import (
    "encoding/json"
    "net/http"
    "net/url"
)

// PingService checks if an Elasticsearch server on a given URL is alive.
// When asked for, it can also return various information about the
// Elasticsearch server, e.g. the Elasticsearch version number.
//
// Ping simply starts a HTTP GET request to the URL of the server.
// If the server responds with HTTP Status code 200 OK, the server is alive.
type PingService struct {
    client       *Client
    url          string
    timeout      string
    httpHeadOnly bool
    pretty       bool
}

// PingResult is the result returned from querying the Elasticsearch server.
type PingResult struct {
    Status      int    `json:"status"`
    Name        string `json:"name"`
    ClusterName string `json:"cluster_name"`
    Version     struct {
                    Number         string `json:"number"`
                    BuildHash      string `json:"build_hash"`
                    BuildTimestamp string `json:"build_timestamp"`
                    BuildSnapshot  bool   `json:"build_snapshot"`
                    LuceneVersion  string `json:"lucene_version"`
                } `json:"version"`
    TagLine     string `json:"tagline"`
}

func NewPingService(client *Client) *PingService {
    return &PingService{
        client:       client,
        url:          DefaultURL,
        httpHeadOnly: false,
        pretty:       false,
    }
}

func (s *PingService) URL(url string) *PingService {
    s.url = url
    return s
}

func (s *PingService) Timeout(timeout string) *PingService {
    s.timeout = timeout
    return s
}

// HeadOnly makes the service to only return the status code in Do;
// the PingResult will be nil.
func (s *PingService) HttpHeadOnly(httpHeadOnly bool) *PingService {
    s.httpHeadOnly = httpHeadOnly
    return s
}

func (s *PingService) Pretty(pretty bool) *PingService {
    s.pretty = pretty
    return s
}

// Do returns the PingResult, the HTTP status code of the Elasticsearch
// server, and an error.
func (s *PingService) Do() (*PingResult, int, error) {
    url_ := s.url + "/"

    params := make(url.Values)
    if s.timeout != "" {
        params.Set("timeout", s.timeout)
    }
    if s.pretty {
        params.Set("pretty", "1")
    }
    if len(params) > 0 {
        url_ += "?" + params.Encode()
    }

    var method string
    if s.httpHeadOnly {
        method = "HEAD"
    } else {
        method = "GET"
    }

    // Notice: This service must NOT use PerformRequest!
    req, err := NewRequest(method, url_)
    if err != nil {
        return nil, 0, err
    }

    res, err := s.client.c.Do((*http.Request)(req))
    if err != nil {
        return nil, 0, err
    }
    defer res.Body.Close()

    var ret *PingResult
    if !s.httpHeadOnly {
        ret = new(PingResult)
        if err := json.NewDecoder(res.Body).Decode(ret); err != nil {
            return nil, res.StatusCode, err
        }
    }

    return ret, res.StatusCode, nil
}


text:
My interests

                    I am currently doing a PhD in Computer Science in France at the Laboratoire d'analyse et d'architecture des systèmes (LAAS).
                    My main work is on Network Function Virtualization (NFV). More specifically in the multi-domain orchestration of network services.
                    I am interested in the coordination of multiple orchestrators that have partial knowledge to support the correct execution of network services.

                    I have work experience as a Software engineer in research projects at Samsung Research Tijuana (SRT). I supervised a team of four in a research project. Most of my
                    work dealt with machine learning and distributed systems. Also, I was involved in many internal projects to continue education within the team such as training, seminars.

                    I also hold a Master's Degree in Computer Science from the Instituto Nacional de Astrofísica, Óptica y Electrónica (INAOE).
                    My thesis on bio-inspired data foraging relates the abstract notion of indirect communication with the spatial and
                    temporal causality of events in order to identify regions of interest in an unknown and dynamic environment.

                    My interest are: Distributed systems, formal systems, software architecture and competitive programming.

                INAOE

Publications

Data-Foraging-Oriented Reconnaissance Based on Bio-Inspired Indirect Communication for Aerial Vehicles


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Security.Cryptography;
using System.Text;
using Mono.Cecil;
using Mono.Options;

namespace StrongNameResigner
{
    class Program
    {
        static int verbosity;

        public static string ExecutableFileName
        {
            get
            {
                return System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe";
            }
        }

        static BaseAssemblyResolver assemblyResolver = new DefaultAssemblyResolver();

        public static void Main(string[] args)
        {
            bool showHelp = false;
            bool listDependenciesOnly = false;

            foreach (var s in assemblyResolver.GetSearchDirectories())
            {
                assemblyResolver.RemoveSearchDirectory(s);
            }

            var p = new OptionSet()
            {
                { "a|assembly-search-directory=", "add a search directory into the assembly resolver", v => assemblyResolver.AddSearchDirectory(v) },
                { "d|list-dependencies-only", "output a list of detected dependencies and exit", v => listDependenciesOnly = v != null },
                { "k|key-pair-file=", "resign assembly with the key pair in file (.snk)", v => LoadKeyPairFile(v) },
                { "v", "increase verbosity", v => { if (v != null) ++verbosity; } },
                { "h|help",  "show this message and exit", v => showHelp = v != null },
            };

            if (0 == args.Length)
            {
                TryHelp();
                return;
            }

            List<string> assemblies;
            try
            {
                assemblies = p.Parse(args);
            }
            catch (OptionException e)
            {
                Error(e.Message);
                TryHelp();
                return;
            }

            if (showHelp)
            {
                ShowHelp(p);
                return;
            }

            if (0 == assemblies.Count)
            {
                Error("No assembly names were given.");
                TryHelp();
                return;
            }

            if (0 == assemblyResolver.GetSearchDirectories().Length)
            {
                assemblyResolver.AddSearchDirectory(".");
            }

            IEnumerable<AssemblyDefinition> dependendAssemblies;
            try
            {
                dependendAssemblies = FindDependendAssemblies(assemblies).ToList();
            }
            catch (Exception exception)
            {
                Error("Unable find dependend assemblies: {0}", exception.ToString());
                return;
            }

            if (listDependenciesOnly)
            {
                foreach (var a in dependendAssemblies)
                {
                    Console.WriteLine(a.MainModule.FullyQualifiedName);
                }
                return;
            }

            foreach (var d in ProcessAssemblies(dependendAssemblies).ToList())
            {
                try
                {
                    WriteAssembly(d);
                }
                catch (Exception exception)
                {
                    Error("Unable to write assembly: {0}", exception.ToString());
                    continue;
                }
            }
        }

        static void TryHelp()
        {
            Console.WriteLine(string.Format("Try »{0} --help« for more information.", ExecutableFileName));
        }

        static StrongNameKeyPair strongNameKeyPair = null;
        static byte[] publicKeyToken = new byte[0];

        static void LoadKeyPairFile(string fileName)
        {
            strongNameKeyPair =
                new StrongNameKeyPair(File.ReadAllBytes(fileName));
            publicKeyToken = new SHA1Managed().ComputeHash(strongNameKeyPair.PublicKey)
                .Reverse().Take(8).ToArray();
        }

        static void ShowHelp(OptionSet p)
        {
            Console.WriteLine("Usage: {0} [Option]... AssemblyName...", ExecutableFileName);
            Console.WriteLine("Resign a list of assemblies and its dependencies.");
            Console.WriteLine("If no key pair is specified, the strong name signature will be removed.");
            Console.WriteLine();
            Console.WriteLine("Options:");
            p.WriteOptionDescriptions(Console.Out);
        }

        static void Error(string format, params object[] args)
        {
            Console.Error.WriteLine(format, args);
        }

        static void Debug(string format, params object[] args)
        {
            if (verbosity > 1)
            {
                Console.WriteLine(format, args);
            }
        }

        static void Info(string format, params object[] args)
        {
            if (verbosity > 0)
            {
                Console.WriteLine(format, args);
            }
        }

        static IEnumerable<AssemblyDefinition> ProcessAssemblies(IEnumerable<AssemblyDefinition> assemblies)
        {
            foreach (var d in assemblies)
            {
                try
                {
                    Info("Processing assembly {0}", d.FullName);
                    FixAssemblyReferences(d, assemblies);
                    FixInternalsVisibleToAttribute(d, assemblies);
                    FixCustomAttributesReferences(d, assemblies);
                    FixResourceReferences(d, assemblies);
                }
                catch (Exception exception)
                {
                    Error("Assembly will be skipped: {0}", exception.ToString());
                    continue;
                }
                yield return d;
            }
        }

        static AssemblyDefinition LoadAssemblyDefinition(string fileName)
        {
            Debug("Loading {0}", fileName);
            return AssemblyDefinition.ReadAssembly(fileName,
                new ReaderParameters { AssemblyResolver = assemblyResolver });
        }

        static IEnumerable<AssemblyDefinition> FindDependendAssemblies(List<string> assemblyFullNames)
        {
            List<string> dependencies = new List<string>();

            foreach (var fullName in assemblyFullNames)
            {
                Debug("Loading {0} for dependency searching.", fullName);
                var assemblyDefinition = assemblyResolver.Resolve(fullName);
                var fileName = assemblyDefinition.MainModule.FullyQualifiedName;
                dependencies.Add(assemblyDefinition.FullName);
                yield return assemblyDefinition;
            }

            bool retry = false;
            do
            {
                retry = false;
                foreach (var searchDirectory in assemblyResolver.GetSearchDirectories())
                {
                    if (!Directory.Exists(searchDirectory)) { continue; }
                    foreach (var fileName in Directory.GetFiles(searchDirectory))
                    {
                        if ((!fileName.ToLower().EndsWith(".dll") &&
                            !fileName.ToLower().EndsWith(".exe"))) { continue; }
                        AssemblyDefinition assemblyDefinition = null;
                        try
                        {
                            assemblyDefinition = LoadAssemblyDefinition(fileName);
                        }
                        catch (BadImageFormatException exception)
                        {
                            Debug("Unable to load {0}: {1}", fileName, exception.Message);
                            continue;
                        }
                        catch (Exception exception)
                        {
                            Error("Unknown error while loading {0}: {1}", fileName, exception.ToString());
                            continue;
                        }
                        if (dependencies.Contains(assemblyDefinition.FullName)) { continue; }
                        foreach (var r in assemblyDefinition.MainModule.AssemblyReferences)
                        {
                            if (!dependencies.Contains(r.FullName)) { continue; }
                            retry = true;
                            dependencies.Add(assemblyDefinition.FullName);
                            yield return assemblyDefinition;
                            break;
                        }
                    }
                }
            } while (retry);
        }

        static void FixResourceReferences(AssemblyDefinition assemblyDefinition, IEnumerable<AssemblyDefinition> dependencies)
        {
            Info("Fixing resource references.");
            var searchAndReplace = new List<Tuple<byte[], byte[]>>();
            foreach (var d in dependencies)
            {
                string newName =
                    new AssemblyNameDefinition(d.Name.Name, d.Name.Version)
                    {
                        PublicKeyToken = publicKeyToken
                    }.FullName;
                if (0 == publicKeyToken.Length) { newName += new string(' ', (8 * 2) - "null".Length); }
                string oldName = d.FullName;
                if (0 == d.Name.PublicKeyToken.Length) { oldName += new string(' ', (8 * 2) - "null".Length); }
                if (newName.Length != oldName.Length || newName == oldName) { continue; }
                searchAndReplace.Add(
                    Tuple.Create(Encoding.UTF8.GetBytes(oldName), Encoding.UTF8.GetBytes(newName)));
            }
            if (0 == searchAndReplace.Count)
            {
                return;
            }

            foreach (var resource in assemblyDefinition.MainModule.Resources.ToList())
            {
                var embeddedResource = resource as EmbeddedResource;
                if (embeddedResource == null ||
                    !embeddedResource.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                using (var resourceOutput = new MemoryStream())
                {
                    using (var resourceInput = embeddedResource.GetResourceStream())
                    {
                        BinaryUtility.Replace(new BinaryReader(resourceInput), new BinaryWriter(resourceOutput), searchAndReplace);
                        assemblyDefinition.MainModule.Resources.Remove(resource);
                        assemblyDefinition.MainModule.Resources.Add(new EmbeddedResource(embeddedResource.Name, resource.Attributes, resourceOutput.ToArray()));
                    }
                }
            }
        }

        static void FixCustomAttributesReferences(AssemblyDefinition assemblyDefinition, IEnumerable<AssemblyDefinition> dependencies)
        {
            Info("Fixing type references in custom attributes.");
            foreach (var t in assemblyDefinition.MainModule.Types)
            {
                FixCustomAttributesReferences(t, dependencies);
            }
        }

        static void FixCustomAttributesReferences(TypeDefinition typeDefinition, IEnumerable<AssemblyDefinition> dependencies)
        {
            foreach(var n in typeDefinition.NestedTypes)
            {
                FixCustomAttributesReferences(n, dependencies);
            }
            foreach (var attribute in typeDefinition.CustomAttributes)
            {
                foreach (var argument in attribute.ConstructorArguments)
                {
                    FixCustomAttributesReferences(argument, dependencies);
                }
                foreach (var property in attribute.Properties)
                {
                    FixCustomAttributesReferences(property.Argument, dependencies);
                }
            }
        }

        static void FixCustomAttributesReferences(CustomAttributeArgument argument, IEnumerable<AssemblyDefinition> dependencies)
        {
            {
                AssemblyDefinition existingDependency;
                AssemblyNameReference assemblyNameReference;
                if (null != (assemblyNameReference = argument.Type.Scope as AssemblyNameReference) &&
                    null != (existingDependency = dependencies.SingleOrDefault(x => x.FullName == assemblyNameReference.FullName)))
                {
                    assemblyNameReference.PublicKeyToken = publicKeyToken;
                    return;
                }
            }
            {
                if (argument.Type.FullName != "System.Type") { return; }
                if (!(argument.Value is MemberReference)) { return; }
                object scope = ((dynamic)argument.Value).Scope;
                if (!(scope is AssemblyNameReference)) { return; }
                AssemblyNameReference assemblyNameReference = (AssemblyNameReference)scope;
                if (!dependencies.Any(x => x.FullName == assemblyNameReference.FullName)) { return; }
                assemblyNameReference.PublicKeyToken = publicKeyToken;
            }
        }

        static void FixInternalsVisibleToAttribute(AssemblyDefinition assemblyDefinition, IEnumerable<AssemblyDefinition> dependencies)
        {
            Info("Fixing InternalsVisibleToAttribute references.");
            foreach (var attribute in assemblyDefinition.CustomAttributes)
            {
                if (attribute.AttributeType.Name != "InternalsVisibleToAttribute") { continue; }
                var argument = attribute.ConstructorArguments.First();
                var v = argument.Value.ToString().Split(new string[] { "," }, StringSplitOptions.None);
                if (2 != v.Length) { continue; }
                var name = v[0].Trim();
                if (!dependencies.Any(x => x.Name.Name == name)) { continue; }
                attribute.ConstructorArguments.Remove(argument);
                attribute.ConstructorArguments.Insert(0,
                    new CustomAttributeArgument(argument.Type, string.Format("{0}, PublicKey={1}", name,
                        BitConverter.ToString(strongNameKeyPair.PublicKey).Replace("-", ""))));
            }
        }

        static void FixAssemblyReferences(AssemblyDefinition assemblyDefinition, IEnumerable<AssemblyDefinition> dependencies)
        {
            Info("Fixing assembly references.");
            foreach (var r in assemblyDefinition.MainModule.AssemblyReferences)
            {
                if (!dependencies.Any(x => x.FullName == r.FullName)) { continue; }
                Debug("Fixing assembly reference to {0}.", r.FullName);
                r.PublicKeyToken = publicKeyToken;
            }
        }

        static void WriteAssembly(AssemblyDefinition assemblyDefinition)
        {
            Info("Writing assembly to {0}.", assemblyDefinition.MainModule.FullyQualifiedName);
            if (0 == publicKeyToken.Length)
            {
                assemblyDefinition.Name.HasPublicKey = false;
                assemblyDefinition.Name.PublicKey = new byte[0];
                assemblyDefinition.MainModule.Attributes &= ~ModuleAttributes.StrongNameSigned;
            }
            assemblyDefinition.Write(assemblyDefinition.MainModule.FullyQualifiedName,
                new WriterParameters() { StrongNameKeyPair = strongNameKeyPair });
        }
    }
}


text:
using System;
using Mono.Cecil;

namespace IL.View.Model
{
  public sealed class AssemblyDefinitionEventArgs : EventArgs
  {
    public AssemblyDefinition Definition { get; private set; }
    public AssemblyStream Source { get; private set; }

    public AssemblyDefinitionEventArgs(AssemblyDefinition definition, AssemblyStream source)
    {
      Definition = definition;
      Source = source;
    }
  }
}


text:
ACCEPTED

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

#### Published in
Wiss. Meeresunters. , 3, Abt. Kiel, 15.

#### Original name
null

### Remarks
null


text:
<?php
namespace Elastica\Test\Query;

use Elastica\Document;
use Elastica\Query;
use Elastica\Query\GeoDistance;
use Elastica\Test\Base as BaseTest;

class GeoDistanceTest extends BaseTest
{
    /**
     * @group functional
     */
    public function testGeoPoint()
    {
        $index = $this->_createIndex();

        $type = $index->getType('test');

        // Set mapping
        $type->setMapping(['point' => ['type' => 'geo_point']]);

        // Add doc 1
        $doc1 = new Document(1);
        $doc1->addGeoPoint('point', 17, 19);
        $type->addDocument($doc1);

        // Add doc 2
        $doc2 = new Document(2);
        $doc2->addGeoPoint('point', 30, 40);
        $type->addDocument($doc2);

        $index->forcemerge();
        $index->refresh();

        // Only one point should be in radius
        $geoQuery = new GeoDistance('point', ['lat' => 30, 'lon' => 40], '1km');
        $query = new Query();
        $query->setPostFilter($geoQuery);

        $this->assertEquals(1, $type->count($query));

        // Both points should be inside
        $geoQuery = new GeoDistance('point', ['lat' => 30, 'lon' => 40], '40000km');
        $query = new Query();
        $query->setPostFilter($geoQuery);

        $this->assertEquals(2, $type->count($query));
    }

    /**
     * @group unit
     */
    public function testConstructLatlon()
    {
        $key = 'location';
        $location = [
            'lat' => 48.86,
            'lon' => 2.35,
        ];
        $distance = '10km';

        $query = new GeoDistance($key, $location, $distance);

        $expected = [
            'geo_distance' => [
                $key => $location,
                'distance' => $distance,
            ],
        ];

        $data = $query->toArray();

        $this->assertEquals($expected, $data);
    }

    /**
     * @group unit
     */
    public function testConstructGeohash()
    {
        $key = 'location';
        $location = 'u09tvqx';
        $distance = '10km';

        $query = new GeoDistance($key, $location, $distance);

        $expected = [
            'geo_distance' => [
                $key => $location,
                'distance' => $distance,
            ],
        ];

        $data = $query->toArray();

        $this->assertEquals($expected, $data);
    }

    /**
     * @group unit
     */
    public function testSetDistanceType()
    {
        $query = new GeoDistance('location', ['lat' => 48.86, 'lon' => 2.35], '10km');
        $distanceType = GeoDistance::DISTANCE_TYPE_ARC;
        $query->setDistanceType($distanceType);

        $data = $query->toArray();

        $this->assertEquals($distanceType, $data['geo_distance']['distance_type']);
    }

    /**
     * @group unit
     */
    public function testSetOptimizeBbox()
    {
        $query = new GeoDistance('location', ['lat' => 48.86, 'lon' => 2.35], '10km');
        $optimizeBbox = GeoDistance::OPTIMIZE_BBOX_MEMORY;
        $query->setOptimizeBbox($optimizeBbox);

        $data = $query->toArray();

        $this->assertEquals($optimizeBbox, $data['geo_distance']['optimize_bbox']);
    }
}


text:
/**
 * Replaceable Attribute
 */

@interface SimpleDBReplaceableAttribute:NSObject

{
    NSString *name;
    NSString *value;
    BOOL     replace;
    BOOL     replaceIsSet;
}

/**
 * The name of the replaceable attribute.
 */
@property (nonatomic, retain) NSString *name;

/**
 * The value of the replaceable attribute.
 */
@property (nonatomic, retain) NSString *value;

/**
 * A flag specifying whether or not to replace the attribute/value pair
 * or to add a new attribute/value pair. The default setting is
 * false.
 */
@property (nonatomic) BOOL           replace;

@property (nonatomic, readonly) BOOL replaceIsSet;

/**
 * Default constructor for a new ReplaceableAttribute object.  Callers should use the
 * property methods to initialize this object after creating it.
 */
-(id)init;

/**
 * Constructs a new ReplaceableAttribute object.
 * Callers should use properties to initialize any additional object members.
 *
 * @param theName The name of the replaceable attribute.
 * @param theValue The value of the replaceable attribute.
 * @param theReplace A flag specifying whether or not to replace the
 * attribute/value pair or to add a new attribute/value pair. The default
 * setting is false.
 */
-(id)initWithName:(NSString *)theName andValue:(NSString *)theValue andReplace:(BOOL)theReplace;

/**
 * Returns a string representation of this object; useful for testing and
 * debugging.
 *
 * @return A string representation of this object.
 */
-(NSString *)description;

@end


text:
package com.puresoltechnologies.ductiledb.engine.cf;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.IOException;

import org.junit.Test;

import com.puresoltechnologies.ductiledb.columnfamily.ColumnFamilyImpl;
import com.puresoltechnologies.ductiledb.columnfamily.ColumnFamilyRow;
import com.puresoltechnologies.ductiledb.columnfamily.ColumnFamilyScanner;
import com.puresoltechnologies.ductiledb.columnfamily.ColumnMap;
import com.puresoltechnologies.ductiledb.columnfamily.ColumnValue;
import com.puresoltechnologies.ductiledb.commons.Bytes;
import com.puresoltechnologies.ductiledb.engine.AbstractColumnFamiliyEngineTest;
import com.puresoltechnologies.ductiledb.logstore.Key;

public class ColumnFamilyScannerIT extends AbstractColumnFamiliyEngineTest {

    private static String NAMESPACE = ColumnFamilyScannerIT.class.getSimpleName();

    @Test
    public void testEmptyScanner() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE, "testEmptyScanner", "testcf")) {
	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	    assertNull(scanner.next());
	    scanner.skip();
	}
    }

    @Test
    public void testSingleEntryScannerWithoutBounds() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE,
		"testSingleEntryScannerWithoutBounds", "testcf")) {
	    ColumnMap values = new ColumnMap();
	    values.put(Key.of(12l), ColumnValue.of(123l));
	    Key rowKey = Key.of(1l);
	    columnFamilyEngine.put(rowKey, values);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertNotNull(scanner.peek());
	    ColumnFamilyRow result = scanner.next();
	    assertEquals(rowKey, result.getRowKey());
	    ColumnMap columnMap = result.getColumnMap();
	    assertEquals(1, columnMap.size());
	    assertEquals(123l, Bytes.toLong(columnMap.get(Key.of(12l)).getBytes()));

	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	}
    }

    @Test
    public void testSingleEntryScannerWithLowerBoundOnly() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE,
		"testSingleEntryScannerWithLowerBoundOnly", "testcf")) {
	    ColumnMap values = new ColumnMap();
	    values.put(Key.of(12l), ColumnValue.of(123l));
	    Key rowKey = Key.of(1l);
	    columnFamilyEngine.put(rowKey, values);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(rowKey, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertNotNull(scanner.peek());
	    ColumnFamilyRow result = scanner.next();
	    assertEquals(rowKey, result.getRowKey());
	    ColumnMap columnMap = result.getColumnMap();
	    assertEquals(1, columnMap.size());
	    assertEquals(123l, Bytes.toLong(columnMap.get(Key.of(12l)).getBytes()));

	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	}
    }

    @Test
    public void testSingleEntryScannerWithUpperBoundOnly() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE,
		"testSingleEntryScannerWithUpperBoundOnly", "testcf")) {
	    ColumnMap values = new ColumnMap();
	    values.put(Key.of(12l), ColumnValue.of(123l));
	    Key rowKey = Key.of(1l);
	    columnFamilyEngine.put(rowKey, values);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, rowKey);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertNotNull(scanner.peek());
	    ColumnFamilyRow result = scanner.next();
	    assertEquals(rowKey, result.getRowKey());
	    ColumnMap columnMap = result.getColumnMap();
	    assertEquals(1, columnMap.size());
	    assertEquals(123l, Bytes.toLong(columnMap.get(Key.of(12l)).getBytes()));

	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	}
    }

    @Test
    public void testSingleEntryScannerWithCloseBounds() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE,
		"testSingleEntryScannerWithCloseBounds", "testcf")) {
	    ColumnMap values = new ColumnMap();
	    values.put(Key.of(12l), ColumnValue.of(123l));
	    Key rowKey = Key.of(1l);
	    columnFamilyEngine.put(rowKey, values);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(rowKey, rowKey);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertNotNull(scanner.peek());
	    ColumnFamilyRow result = scanner.next();
	    assertEquals(rowKey, result.getRowKey());
	    ColumnMap columnMap = result.getColumnMap();
	    assertEquals(1, columnMap.size());
	    assertEquals(123l, Bytes.toLong(columnMap.get(Key.of(12l)).getBytes()));

	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	}
    }

    @Test
    public void testSingleEntryScannerWithWideBounds() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE,
		"testSingleEntryScannerWithWideBounds", "testcf")) {
	    ColumnMap values = new ColumnMap();
	    values.put(Key.of(12l), ColumnValue.of(123l));
	    Key rowKey = Key.of(1l);
	    columnFamilyEngine.put(rowKey, values);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(Key.of(0l), Key.of(123l));
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertNotNull(scanner.peek());
	    ColumnFamilyRow result = scanner.next();
	    assertEquals(rowKey, result.getRowKey());
	    ColumnMap columnMap = result.getColumnMap();
	    assertEquals(1, columnMap.size());
	    assertEquals(123l, Bytes.toLong(columnMap.get(Key.of(12l)).getBytes()));

	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	}
    }

    @Test
    public void testEmptyScannerAfterDeletion() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE, "testEmptyScannerAfterDeletion",
		"testcf")) {
	    ColumnMap values = new ColumnMap();
	    values.put(Key.of(123l), ColumnValue.of(1234l));
	    Key rowKey = Key.of(12345l);
	    columnFamilyEngine.put(rowKey, values);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());

	    columnFamilyEngine.delete(rowKey);

	    scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	    assertNull(scanner.next());
	    scanner.skip();
	}
    }

    @Test
    public void testEmptyScannerAfterDeletionWithCompaction() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE,
		"testEmptyScannerAfterDeletionWithCompaction", "testcf")) {
	    columnFamilyEngine.setMaxCommitLogSize(5 * 1024);
	    columnFamilyEngine.setMaxDataFileSize(25 * 1024);
	    for (long i = 1; i <= 200; ++i) {
		ColumnMap values = new ColumnMap();
		values.put(Key.of(i * 10), ColumnValue.of(i * 100));
		Key rowKey = Key.of(i);
		columnFamilyEngine.put(rowKey, values);
	    }

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());

	    for (long i = 1; i <= 200; ++i) {
		Key rowKey = Key.of(i);
		columnFamilyEngine.delete(rowKey);
	    }

	    scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	    assertNull(scanner.next());
	    scanner.skip();
	}
    }

    @Test
    public void testEmptyScannerAfterDeletionWithoutCompactionAfterRollover() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE,
		"testEmptyScannerAfterDeletionWithoutCompactionAfterRollover", "testcf")) {
	    columnFamilyEngine.setMaxCommitLogSize(5 * 1024);
	    columnFamilyEngine.setMaxDataFileSize(25 * 1024);
	    columnFamilyEngine.setRunCompactions(false);
	    for (long i = 1; i <= 100; ++i) {
		ColumnMap values = new ColumnMap();
		values.put(Key.of(i * 10), ColumnValue.of(i * 100));
		Key rowKey = Key.of(i);
		columnFamilyEngine.put(rowKey, values);
	    }

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());

	    for (long i = 1; i <= 100; ++i) {
		Key rowKey = Key.of(i);
		columnFamilyEngine.delete(rowKey);
	    }

	    scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	    assertNull(scanner.next());
	    scanner.skip();
	}
    }

    @Test
    public void testRowUpdateWithScanner() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE, "testRowUpdateWithScanner",
		"testcf")) {
	    columnFamilyEngine.setMaxCommitLogSize(5 * 1024);
	    columnFamilyEngine.setMaxDataFileSize(25 * 1024);
	    // Check behavior of empty Memtable
	    Key rowKey = Key.of(1l);
	    ColumnMap entry = columnFamilyEngine.get(rowKey);
	    assertTrue(entry.isEmpty());

	    // Check put
	    ColumnMap columns = new ColumnMap();
	    columns.put(Key.of(10l), ColumnValue.of(100l));
	    columnFamilyEngine.put(rowKey, columns);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertEquals(rowKey, scanner.next().getRowKey());
	    assertFalse(scanner.hasNext());

	    // Check put with column extension
	    columns = new ColumnMap();
	    columns.put(Key.of(20l), ColumnValue.of(200l));
	    columnFamilyEngine.put(rowKey, columns);

	    scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertEquals(rowKey, scanner.next().getRowKey());
	    assertFalse(scanner.hasNext());

	    // Check put with column extensions with compaction
	    for (long i = 3; i <= 100; ++i) {
		columns = new ColumnMap();
		columns.put(Key.of((i + 1) * 10), ColumnValue.of((i + 1) * 100));
		columnFamilyEngine.put(rowKey, columns);
	    }

	    scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertEquals(rowKey, scanner.next().getRowKey());
	    assertFalse(scanner.hasNext());
	}
    }

    @Test
    public void testRowDeleteWithScanner() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE, "testRowDeleteWithScanner",
		"testcf")) {
	    columnFamilyEngine.setMaxCommitLogSize(5 * 1024);
	    columnFamilyEngine.setMaxDataFileSize(25 * 1024);
	    // Check behavior of empty Memtable
	    Key rowKey1 = Key.of(1l);
	    ColumnMap entry1 = columnFamilyEngine.get(rowKey1);
	    assertTrue(entry1.isEmpty());

	    Key rowKey2 = Key.of(2l);
	    ColumnMap entry2 = columnFamilyEngine.get(rowKey2);
	    assertTrue(entry2.isEmpty());

	    Key rowKey3 = Key.of(3l);
	    ColumnMap entry3 = columnFamilyEngine.get(rowKey3);
	    assertTrue(entry3.isEmpty());

	    // Check put
	    ColumnMap columns = new ColumnMap();
	    columns.put(Key.of(10l), ColumnValue.of(100l));
	    columnFamilyEngine.put(rowKey1, columns);

	    ColumnMap columns2 = new ColumnMap();
	    columns2.put(Key.of(20l), ColumnValue.of(200l));
	    columnFamilyEngine.put(rowKey2, columns2);

	    ColumnMap columns3 = new ColumnMap();
	    columns3.put(Key.of(30l), ColumnValue.of(300l));
	    columnFamilyEngine.put(rowKey3, columns3);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertEquals(rowKey1, scanner.next().getRowKey());
	    assertEquals(rowKey2, scanner.next().getRowKey());
	    assertEquals(rowKey3, scanner.next().getRowKey());
	    assertFalse(scanner.hasNext());

	    // Check put with column extension
	    columnFamilyEngine.delete(rowKey2);

	    scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertEquals(rowKey1, scanner.next().getRowKey());
	    assertEquals(rowKey3, scanner.next().getRowKey());
	    assertFalse(scanner.hasNext());

	    // Check after compaction
	    columnFamilyEngine.runCompaction();

	    scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertTrue(scanner.hasNext());
	    assertEquals(rowKey1, scanner.next().getRowKey());
	    assertEquals(rowKey3, scanner.next().getRowKey());
	    assertFalse(scanner.hasNext());
	}
    }

    @Test
    public void testRange() throws IOException {
	try (ColumnFamilyImpl columnFamilyEngine = createTestColumnFamily(NAMESPACE, "testScanner", "testcf")) {
	    columnFamilyEngine.setMaxCommitLogSize(5 * 1024);
	    columnFamilyEngine.setMaxDataFileSize(25 * 1024);

	    ColumnFamilyScanner scanner = columnFamilyEngine.getScanner(null, null);
	    assertNotNull(scanner);
	    assertFalse(scanner.hasNext());
	    assertNull(scanner.peek());
	    assertNull(scanner.next());

	    for (long i = 1; i <= 1000; ++i) {
		ColumnMap columnMap = new ColumnMap();
		columnMap.put(Key.of(i * 10), ColumnValue.of(i * 100));
		columnFamilyEngine.put(Key.of(i), columnMap);
	    }

	    scanner = columnFamilyEngine.getScanner(Key.of(100l), Key.of(900l));
	    assertNotNull(scanner);

	    long current = 100l;
	    while (scanner.hasNext()) {
		ColumnFamilyRow startResult = scanner.next();
		long l = Bytes.toLong(startResult.getRowKey().getBytes());
		assertEquals(current, l);
		ColumnValue value = startResult.getColumnMap().get(Key.of(l * 10l));
		assertNotNull(value);
		assertEquals(l * 100l, Bytes.toLong(value.getBytes()));
		++current;
	    }
	    assertEquals(901, current);

	}
    }
}


text:
#include <openspace/util/transformationmanager.h>

#include <openspace/util/spicemanager.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/assert.h>

#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
#ifdef WIN32
#pragma warning (push)
#pragma warning (disable : 4619) // #pragma warning: there is no warning number '4675'
#endif // WIN32

#include <ccmc/Kameleon.h>

#ifdef WIN32
#pragma warning (pop)
#endif // WIN32
#endif

namespace openspace {

TransformationManager* TransformationManager::_instance = nullptr;

TransformationManager::TransformationManager() {
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
    _kameleon = std::make_shared<ccmc::Kameleon>();
#else
    LWARNINGC(
        "TransformationManager",
        "Kameleon module needed for transformations with dynamic frames"
    );
#endif
    _kameleonFrames = {
        "J2000", "GEI", "GEO", "MAG", "GSE", "GSM", "SM", "RTN", "GSEQ",   //geocentric
        "HEE", "HAE", "HEEQ"                                              //heliocentric
    };
}

TransformationManager::~TransformationManager() {
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
    _kameleon = nullptr;
#endif
}

void TransformationManager::initialize() {
    ghoul_assert(!isInitialized(), "TransformationManager is already initialized");
    _instance = new TransformationManager;
}

void TransformationManager::deinitialize() {
    ghoul_assert(isInitialized(), "TransformationManager is not initialized");
    delete _instance;
    _instance = nullptr;
}

bool TransformationManager::isInitialized() {
    return _instance != nullptr;
}

TransformationManager& TransformationManager::ref() {
    ghoul_assert(isInitialized(), "TransformationManager is not initialized");
    return *_instance;
}

glm::dmat3 TransformationManager::kameleonTransformationMatrix(
                                                 [[maybe_unused]] const std::string& from,
                                                   [[maybe_unused]] const std::string& to,
                                              [[maybe_unused]] double ephemerisTime) const
{
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
    ccmc::Position in0 = {1.f, 0.f, 0.f};
    ccmc::Position in1 = {0.f, 1.f, 0.f};
    ccmc::Position in2 = {0.f, 0.f, 1.f};

    ccmc::Position out0;
    ccmc::Position out1;
    ccmc::Position out2;

    ccmc::Kameleon::_cxform(from.c_str(), to.c_str(), ephemerisTime, &in0, &out0);
    ccmc::Kameleon::_cxform(from.c_str(), to.c_str(), ephemerisTime, &in1, &out1);
    ccmc::Kameleon::_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2);

    return glm::dmat3(
        out0.c0, out0.c1, out0.c2,
        out1.c0, out1.c1, out1.c2,
        out2.c0, out2.c1, out2.c2
    );
#else
    return glm::dmat3(0.0);
#endif
}

glm::dmat3 TransformationManager::frameTransformationMatrix(
                                                 [[maybe_unused]] const std::string& from,
                                                   [[maybe_unused]] const std::string& to,
                                              [[maybe_unused]] double ephemerisTime) const
{
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
    auto fromit = _kameleonFrames.find(from);
    auto toit   = _kameleonFrames.find(to);

    bool fromKameleon   = (fromit != _kameleonFrames.end());
    bool toKameleon     = (toit   != _kameleonFrames.end());

    if (!fromKameleon && !toKameleon) {
        return  SpiceManager::ref().frameTransformationMatrix(from, to, ephemerisTime);
    }

    if (fromKameleon && toKameleon) {
        return kameleonTransformationMatrix(from, to, ephemerisTime);

    }
    else if (fromKameleon && !toKameleon) {
        glm::dmat3 kameleonTransformation = kameleonTransformationMatrix(
            from,
            "J2000",
            ephemerisTime
        );
        glm::dmat3 spiceTransformation = SpiceManager::ref().frameTransformationMatrix(
            "J2000",
            to,
            ephemerisTime
        );
        return spiceTransformation*kameleonTransformation;
    }
    else if (!fromKameleon && toKameleon) {
        glm::dmat3 spiceTransformation = SpiceManager::ref().frameTransformationMatrix(
            from,
            "J2000",
            ephemerisTime
        );
        glm::dmat3 kameleonTransformation = kameleonTransformationMatrix(
            "J2000",
            to,
            ephemerisTime
        );

        return kameleonTransformation*spiceTransformation;
    }
#else
    LERRORC(
        "TransformationManager",
        "Can not transform dynamic frames without kameleon module enabled"
    );
#endif
    return glm::dmat3(1.0);
}

} // namespace openspace


text:
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you 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 org.openqa.selenium.interactions.internal;

import com.google.common.collect.ImmutableList;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Interaction;
import org.openqa.selenium.interactions.IsInteraction;
import org.openqa.selenium.interactions.Mouse;
import org.openqa.selenium.interactions.PointerInput;
import org.openqa.selenium.interactions.PointerInput.Origin;
import org.openqa.selenium.internal.Locatable;

import java.time.Duration;
import java.util.Optional;

/**
 * Base class for all mouse-related actions.
 */
public abstract class MouseAction extends BaseAction implements IsInteraction {

  public enum Button {
    LEFT(0),
    MIDDLE(1),
    RIGHT(2);

    private final int button;

    Button(int button) {
      this.button = button;
    }

    public int asArg() {
      return button;
    }
  }

  protected final Mouse mouse;

  protected MouseAction(Mouse mouse, Locatable locationProvider) {
    super(locationProvider);
    this.mouse = mouse;
  }

  protected Coordinates getActionLocation() {
    if (where == null) {
      return null;
    }

    return where.getCoordinates();
  }

  protected void moveToLocation() {
    // Only call mouseMove if an actual location was provided. If not,
    // the action will happen in the last known location of the mouse
    // cursor.
    if (getActionLocation() != null) {
      mouse.mouseMove(getActionLocation());
    }
  }

  protected void moveToLocation(
      PointerInput mouse,
      ImmutableList.Builder<Interaction> interactions) {
    Optional<WebElement> target = getTargetElement();
    interactions.add(mouse.createPointerMove(
        Duration.ofMillis(500),
        target.map(Origin::fromElement).orElse(Origin.pointer()),
        0,
        0));
  }
}


text:
author: dema
comments: true
date: 2007-08-02 07:55:05+00:00
layout: post
slug: grazie-di-cuore-e-buone-ferie
title: Grazie di cuore e buone ferie
wordpress_id: 87
categories:
- dema
- fon
- omaggio
- riconoscimento
- tributo
- video
---

E' un tributo , omaggio , riconoscimento , questo è un ricco tributo , ricco omaggio , ricco noscimento.

[youtube=http://youtube.com/watch?v=kPLCsBpaxFE]


text:
package org.kannel.conf;

import java.net.URL;

/**
 * core configuration
 *
 * @author garth
 */
public class CoreConfiguration extends Configuration {

  public CoreConfiguration() {
    super("core");
  }

  private static final String[] PROP_ORDER = {
    "admin-port",
    "admin-port-ssl",
    "admin-password",
    "status-password",
    "admin-deny-ip",
    "admin-allow-ip",
    "smsbox-port",
    "smsbox-port-ssl",
    "wapbox-port",
    "wapbox-port-ssl",
    "box-deny-ip",
    "box-allow-ip",
    "udp-deny-ip",
    "udp-allow-ip",
    "wdp-interface-name",
    "log-file",
    "log-level",
    "access-log",
    "access-log-clean",
    "access-log-format",
    "unified-prefix",
    "white-list",
    "black-list",
    "store-type",
    "store-location",
    "store-dump-freq",
    "http-proxy-host",
    "http-proxy-port",
    "http-proxy-exceptions",
    "http-proxy-exceptions-regex",
    "http-proxy-username",
    "http-proxy-password",
    "ssl-client-certkey-file",
    "ssl-server-cert-file",
    "ssl-server-key-file",
    "ssl-trusted-ca-file",
    "dlr-storage",
    "sms-incoming-queue-limit",
    "sms-outgoing-queue-limit",
    "white-list-regex",
    "black-list-regex",
    "smsbox-max-pending",
    "sms-resend-freq",
    "sms-resend-retry",
    "sms-combine-concatenated-mo",
    "sms-combine-concatenated-mo-timeout",
    "http-timeout"
  };

  public String[] getPropertyOrder() {
    return PROP_ORDER;
  }

  private static final String[] MANDATORY_PROPS = {"admin-port", "admin-password"};

  public String[] getMandatoryProps() {
    return MANDATORY_PROPS;
  }

  /**
   * admin-port The port number in which the bearerbox listens to HTTP administration commands. It
   * is NOT the same as the HTTP port of the local HTTP server, just invent any port, but it must be
   * over 1023 unless you are running Kannel as a root process (not recommended)
   */
  private Integer adminPort;

  public Integer getAdminPort() {
    return this.adminPort;
  }

  public void setAdminPort(Integer adminPort) {
    this.adminPort = adminPort;
  }

  /**
   * admin-port-ssl If set to true a SSL-enabled administration HTTP server will be used instead of
   * the default insecure plain HTTP server. To access the administration pages you will have to use
   * a HTTP client that is capable of talking to such a server. Use the "https://" scheme to access
   * the secured HTTP server. Defaults to "no".
   */
  private Boolean adminPortSsl;

  public Boolean getAdminPortSsl() {
    return this.adminPortSsl;
  }

  public void setAdminPortSsl(Boolean adminPortSsl) {
    this.adminPortSsl = adminPortSsl;
  }

  /** admin-password Password for HTTP administration commands (see below) */
  private String adminPassword;

  public String getAdminPassword() {
    return this.adminPassword;
  }

  public void setAdminPassword(String adminPassword) {
    this.adminPassword = adminPassword;
  }

  /**
   * status-password Password to request Kannel status. If not set, no password is required, and if
   * set, either this or admin-password can be used
   */
  private String statusPassword;

  public String getStatusPassword() {
    return this.statusPassword;
  }

  public void setStatusPassword(String statusPassword) {
    this.statusPassword = statusPassword;
  }

  /**
   * admin-deny-ip These lists can be used to prevent connection from given IP addresses. Each list
   * can have several addresses, separated with semicolons (';'). An asterisk ('*') can be used as a
   * wild-card in a place of any ONE number, so *.*.*.* matches any IP.
   */
  private String[] adminDenyIp;

  public String[] getAdminDenyIp() {
    return this.adminDenyIp;
  }

  public void setAdminDenyIp(String[] adminDenyIp) {
    this.adminDenyIp = adminDenyIp;
  }

  /**
   * admin-allow-ip These lists can be used to prevent connection from given IP addresses. Each list
   * can have several addresses, separated with semicolons (';'). An asterisk ('*') can be used as a
   * wild-card in a place of any ONE number, so *.*.*.* matches any IP.
   */
  private String[] adminAllowIp;

  public String[] getAdminAllowIp() {
    return this.adminAllowIp;
  }

  public void setAdminAllowIp(String[] adminAllowIp) {
    this.adminAllowIp = adminAllowIp;
  }

  /**
   * smsbox-port This is the port number to which the smsboxes, if any, connect. As with admin-port,
   * this can be anything you want. Must be set if you want to handle any SMS traffic.
   */
  private Integer smsboxPort;

  public Integer getSmsboxPort() {
    return this.smsboxPort;
  }

  public void setSmsboxPort(Integer smsboxPort) {
    this.smsboxPort = smsboxPort;
  }

  /**
   * smsbox-port-ssl If set to true, the smsbox connection module will be SSL-enabled. Your smsboxes
   * will have to connect using SSL to the bearerbox then. This is used to secure communication
   * between bearerbox and smsboxes in case they are in separate networks operated and the TCP
   * communication is not secured on a lower network layer. Defaults to "no".
   */
  private Boolean smsboxPortSsl;

  public Boolean getSmsboxPortSsl() {
    return this.smsboxPortSsl;
  }

  public void setSmsboxPortSsl(Boolean smsboxPortSsl) {
    this.smsboxPortSsl = smsboxPortSsl;
  }

  /**
   * wapbox-port Like smsbox-port, but for wapbox-connections. If not set, Kannel cannot handle WAP
   * traffic
   */
  private Integer wapboxPort;

  public Integer getWapboxPort() {
    return this.wapboxPort;
  }

  public void setWapboxPort(Integer wapboxPort) {
    this.wapboxPort = wapboxPort;
  }

  /**
   * wapbox-port-ssl If set to true, the wapbox connection module will be SSL-enabled. Your wapboxes
   * will have to connect using SSL to the bearerbox then. This is used to secure communication
   * between bearerbox and wapboxes in case they are in separate networks operated and the TCP
   * communication is not secured on a lower network layer. Defaults to "no".
   */
  private Boolean wapboxPortSsl;

  public Boolean getWapboxPortSsl() {
    return this.wapboxPortSsl;
  }

  public void setWapboxPortSsl(Boolean wapboxPortSsl) {
    this.wapboxPortSsl = wapboxPortSsl;
  }

  /**
   * box-deny-ip These lists can be used to prevent box connections from given IP addresses. Each
   * list can have several addresses, separated with semicolons (';'). An asterisk ('*') can be used
   * as a wild-card in place of any ONE number, so *.*.*.* matches any IP.
   */
  private String[] boxDenyIp;

  public String[] getBoxDenyIp() {
    return this.boxDenyIp;
  }

  public void setBoxDenyIp(String[] boxDenyIp) {
    this.boxDenyIp = boxDenyIp;
  }

  /**
   * box-allow-ip These lists can be used to prevent box connections from given IP addresses. Each
   * list can have several addresses, separated with semicolons (';'). An asterisk ('*') can be used
   * as a wild-card in place of any ONE number, so *.*.*.* matches any IP.
   */
  private String[] boxAllowIp;

  public String[] getBoxAllowIp() {
    return this.boxAllowIp;
  }

  public void setBoxAllowIp(String[] boxAllowIp) {
    this.boxAllowIp = boxAllowIp;
  }

  /**
   * udp-deny-ip These lists can be used to prevent UDP packets from given IP addresses, thus
   * preventing unwanted use of the WAP gateway. Used the same way as box-deny-ip and box-allow-ip.
   */
  private String[] udpDenyIp;

  public String[] getUdpDenyIp() {
    return this.udpDenyIp;
  }

  public void setUdpDenyIp(String[] udpDenyIp) {
    this.udpDenyIp = udpDenyIp;
  }

  /**
   * udp-allow-ip These lists can be used to prevent UDP packets from given IP addresses, thus
   * preventing unwanted use of the WAP gateway. Used the same way as box-deny-ip and box-allow-ip.
   */
  private String[] udpAllowIp;

  public String[] getUdpAllowIp() {
    return this.udpAllowIp;
  }

  public void setUdpAllowIp(String[] udpAllowIp) {
    this.udpAllowIp = udpAllowIp;
  }

  /**
   * wdp-interface-name If this is set, Kannel listens to WAP UDP packets incoming to ports
   * 9200-9208, bound to given IP. If no specific IP is needed, use just an asterisk ('*'). If UDP
   * messages are listened to, wapbox-port variable MUST be set.
   */
  private String wdpInterfaceName;

  public String getWdpInterfaceName() {
    return this.wdpInterfaceName;
  }

  public void setWdpInterfaceName(String wdpInterfaceName) {
    this.wdpInterfaceName = wdpInterfaceName;
  }

  /**
   * log-file A file in which to write a log. This in addition to stdout and any log file defined in
   * command line. Log-file in 'core' group is only used by the bearerbox.
   */
  private String logFile;

  public String getLogFile() {
    return this.logFile;
  }

  public void setLogFile(String logFile) {
    this.logFile = logFile;
  }

  /**
   * log-level Minimum level of log-file events logged. 0 is for 'debug', 1 'info', 2 'warning, 3
   * 'error' and 4 'panic' (see Command Line Options)
   */
  private Integer logLevel;

  public Integer getLogLevel() {
    return this.logLevel;
  }

  public void setLogLevel(Integer logLevel) {
    this.logLevel = logLevel;
  }

  /**
   * access-log A file in which information about received/sent SMS messages is stored. Access-log
   * in 'core' group is only used by the bearerbox.
   */
  private String accessLog;

  public String getAccessLog() {
    return this.accessLog;
  }

  public void setAccessLog(String accessLog) {
    this.accessLog = accessLog;
  }

  /**
   * access-log-clean Indicates if access-log will contain standard 'markers', which means the 'Log
   * begins', 'Log ends' markers and the prefixed timestamp. This config directive should be set to
   * 'true' if a custom logging format is desired without a prefixed default timestamp.
   */
  private Boolean accessLogClean;

  public Boolean getAccessLogClean() {
    return this.accessLogClean;
  }

  public void setAccessLogClean(Boolean accessLogClean) {
    this.accessLogClean = accessLogClean;
  }

  /**
   * access-log-format String defining a custom log file line format. May use escape codes as
   * defined later on to substitute values of the messages into the log entry. If no custom log
   * format is used the standard format will be: "%t %l [SMSC:%i] [SVC:%n] [ACT:%A] [BINF:%B]
   * [FID:%F] [META:%D] [from:%p] [to:%P] [flags:%m:%c:%M:%C:%d] [msg:%L:%b] [udh:%U:%u]"
   */
  private String accessLogFormat;

  public String getAccessLogFormat() {
    return this.accessLogFormat;
  }

  public void setAccessLogFormat(String accessLogFormat) {
    this.accessLogFormat = accessLogFormat;
  }

  /**
   * unified-prefix String to unify received phone numbers, for SMSC routing and to ensure that SMS
   * centers can handle them properly. This is applied to 'sender' number when receiving SMS
   * messages from SMS Center and for 'receiver' number when receiving messages from smsbox (either
   * sendsms message or reply to original message). Format is that first comes the unified prefix,
   * then all prefixes which are replaced by the unified prefix, separated with comma (','). For
   * example, for Finland an unified-prefix "+358,00358,0;+,00" should do the trick. If there are
   * several unified prefixes, separate their rules with semicolon (';'), like
   * "+35850,050;+35840,040". Note that prefix routing is next to useless now that there are SMSC ID
   * entries. To remove prefixes, use like "-,+35850,050;-,+35840,040".
   */
  private String[] unifiedPrefix;

  public String[] getUnifiedPrefix() {
    return this.unifiedPrefix;
  }

  public void setUnifiedPrefix(String[] unifiedPrefix) {
    this.unifiedPrefix = unifiedPrefix;
  }

  /**
   * white-list Load a list of accepted senders of SMS messages. If a sender of an SMS message is
   * not in this list, any message received from the SMS Center is discarded. See notes of phone
   * number format from numhash.h header file. NOTE: the system has only a precision of last 9 or 18
   * digits of phone numbers, so beware!
   */
  private URL whiteList;

  public URL getWhiteList() {
    return this.whiteList;
  }

  public void setWhiteList(URL whiteList) {
    this.whiteList = whiteList;
  }

  /** black-list As white-list, but SMS messages to these numbers are automatically discarded */
  private URL blackList;

  public URL getBlackList() {
    return this.blackList;
  }

  public void setBlackList(URL blackList) {
    this.blackList = blackList;
  }

  /**
   * store-type Kannel can use store subsystem that means storing messages on hard disk until they
   * are successfully handled. By using this subsystem, no SMS messages are lost in Kannel even by
   * crash, but theoretically some messages can duplicate when system is taken down violently. This
   * variable defines a type of backend used for store subsystem. Now two types are supported: a)
   * file: writes store into one single file b) spool: writes store into spool directory (one file
   * for each message)
   */
  private String storeType;

  public String getStoreType() {
    return this.storeType;
  }

  public void setStoreType(String storeType) {
    this.storeType = storeType;
  }

  /** store-location Depends on store-type option used, it is ether file or spool directory. */
  private String storeLocation;

  public String getStoreLocation() {
    return this.storeLocation;
  }

  public void setStoreLocation(String storeLocation) {
    this.storeLocation = storeLocation;
  }

  /**
   * store-dump-freq Approximated frequency how often the memory dump of current pending messages
   * are stored to store-file, providing something has happened. Defaults to 10 seconds if not set.
   */
  private Integer storeDumpFreq;

  public Integer getStoreDumpFreq() {
    return this.storeDumpFreq;
  }

  public void setStoreDumpFreq(Integer storeDumpFreq) {
    this.storeDumpFreq = storeDumpFreq;
  }

  /** http-proxy-host Enable the use of an HTTP proxy for all HTTP requests. */
  private String httpProxyHost;

  public String getHttpProxyHost() {
    return this.httpProxyHost;
  }

  public void setHttpProxyHost(String httpProxyHost) {
    this.httpProxyHost = httpProxyHost;
  }

  /** http-proxy-port */
  private Integer httpProxyPort;

  public Integer getHttpProxyPort() {
    return this.httpProxyPort;
  }

  public void setHttpProxyPort(Integer httpProxyPort) {
    this.httpProxyPort = httpProxyPort;
  }

  /**
   * http-proxy-exceptions A list of excluded hosts from being used via a proxy. Separate each entry
   * with space.
   */
  private String[] httpProxyExceptions;

  public String[] getHttpProxyExceptions() {
    return this.httpProxyExceptions;
  }

  public void setHttpProxyExceptions(String[] httpProxyExceptions) {
    this.httpProxyExceptions = httpProxyExceptions;
  }

  /**
   * http-proxy-exceptions-regex Same as http-proxy-exceptions but match against UNIX regular
   * expression.
   */
  private String httpProxyExceptionsRegex;

  public String getHttpProxyExceptionsRegex() {
    return this.httpProxyExceptionsRegex;
  }

  public void setHttpProxyExceptionsRegex(String httpProxyExceptionsRegex) {
    this.httpProxyExceptionsRegex = httpProxyExceptionsRegex;
  }

  /** http-proxy-username Username for authenticating proxy use, for proxies that require this. */
  private String httpProxyUsername;

  public String getHttpProxyUsername() {
    return this.httpProxyUsername;
  }

  public void setHttpProxyUsername(String httpProxyUsername) {
    this.httpProxyUsername = httpProxyUsername;
  }

  /** http-proxy-password Password for authenticating proxy use, for proxies that require this. */
  private String[] httpProxyPassword;

  public String[] getHttpProxyPassword() {
    return this.httpProxyPassword;
  }

  public void setHttpProxyPassword(String[] httpProxyPassword) {
    this.httpProxyPassword = httpProxyPassword;
  }

  /**
   * ssl-client-certkey-file A PEM encoded SSL certificate and private key file to be used with SSL
   * client connections. This certificate is used for the HTTPS client side only, i.e. for SMS
   * service requests to SSL-enabled HTTP servers.
   */
  private String sslClientCertkeyFile;

  public String getSslClientCertkeyFile() {
    return this.sslClientCertkeyFile;
  }

  public void setSslClientCertkeyFile(String sslClientCertkeyFile) {
    this.sslClientCertkeyFile = sslClientCertkeyFile;
  }

  /**
   * ssl-server-cert-file A PEM encoded SSL certificate file to be used with SSL server connections.
   * This certificate is used for the HTTPS server side only, i.e. for the administration HTTP
   * server and the HTTP interface to send SMS messages.
   */
  private String sslServerCertFile;

  public String getSslServerCertFile() {
    return this.sslServerCertFile;
  }

  public void setSslServerCertFile(String sslServerCertFile) {
    this.sslServerCertFile = sslServerCertFile;
  }

  /**
   * ssl-server-key-file A PEM encoded SSL private key file to be used with SSL server connections.
   * This key is associated to the specified certificate and is used for the HTTPS server side only.
   */
  private String sslServerKeyFile;

  public String getSslServerKeyFile() {
    return this.sslServerKeyFile;
  }

  public void setSslServerKeyFile(String sslServerKeyFile) {
    this.sslServerKeyFile = sslServerKeyFile;
  }

  /**
   * ssl-trusted-ca-file This file contains the certificates Kannel is willing to trust when working
   * as a HTTPS client. If this option is not set, certificates are not validated and those the
   * identity of the server is not proven.
   */
  private String sslTrustedCaFile;

  public String getSslTrustedCaFile() {
    return this.sslTrustedCaFile;
  }

  public void setSslTrustedCaFile(String sslTrustedCaFile) {
    this.sslTrustedCaFile = sslTrustedCaFile;
  }

  /**
   * dlr-storage Defines the way DLRs are stored. If you have build-in external DLR storage support,
   * i.e. using MySQL you may define here the alternative storage type like 'mysql'. Supported types
   * are: internal, mysql, pgsql, sdb, mssql and oracle. By default this is set to 'internal'.
   */
  private String dlrStorage;

  public String getDlrStorage() {
    return this.dlrStorage;
  }

  public void setDlrStorage(String dlrStorage) {
    this.dlrStorage = dlrStorage;
  }

  /**
   * sms-incoming-queue-limit Set maximum size of incoming message queue. After number of messages
   * has hit this value, Kannel began to discard them. Value 0 means giving strict priority to
   * outgoing messages. -1, default, means that the queue of infinite length is accepted. (This
   * works with any normal input, use this variable only when Kannel message queues grow very long).
   */
  private Integer smsIncomingQueueLimit;

  public Integer getSmsIncomingQueueLimit() {
    return this.smsIncomingQueueLimit;
  }

  public void setSmsIncomingQueueLimit(Integer smsIncomingQueueLimit) {
    this.smsIncomingQueueLimit = smsIncomingQueueLimit;
  }

  /**
   * sms-outgoing-queue-limit Set maximum size of outgoing message queue. After number of messages
   * has hit this value, Kannel began to discard them. The default value, 1 million, works for most
   * installations.
   */
  private Integer smsOutgoingQueueLimit;

  public Integer getSmsOutgoingQueueLimit() {
    return this.smsOutgoingQueueLimit;
  }

  public void setSmsOutgoingQueueLimit(Integer smsOutgoingQueueLimit) {
    this.smsOutgoingQueueLimit = smsOutgoingQueueLimit;
  }

  /**
   * white-list-regex A regular expression defining the set of accepted senders. See section on
   * Regular Expressions for details.
   */
  private String whiteListRegex;

  public String getWhiteListRegex() {
    return this.whiteListRegex;
  }

  public void setWhiteListRegex(String whiteListRegex) {
    this.whiteListRegex = whiteListRegex;
  }

  /**
   * black-list-regex A regular expression defining the set of rejected senders. See section on
   * Regular Expressions for details.
   */
  private String blackListRegex;

  public String getBlackListRegex() {
    return this.blackListRegex;
  }

  public void setBlackListRegex(String blackListRegex) {
    this.blackListRegex = blackListRegex;
  }

  /**
   * smsbox-max-pending Maximum number of pending messages on the line to smsbox compatible boxes.
   */
  private Integer smsboxMaxPending;

  public Integer getSmsboxMaxPending() {
    return this.smsboxMaxPending;
  }

  public void setSmsboxMaxPending(Integer smsboxMaxPending) {
    this.smsboxMaxPending = smsboxMaxPending;
  }

  /**
   * sms-resend-freq Frequency for the SMS resend thread in which temporarily failed or queued
   * messages will be resent. Defaults to 60 seconds.
   */
  private Integer smsResendFreq;

  public Integer getSmsResendFreq() {
    return this.smsResendFreq;
  }

  public void setSmsResendFreq(Integer smsResendFreq) {
    this.smsResendFreq = smsResendFreq;
  }

  /**
   * sms-resend-retry Maximum retry attempts for the temporarily failed messages. Defaults to -1,
   * means: unlimited.
   */
  private Integer smsResendRetry;

  public Integer getSmsResendRetry() {
    return this.smsResendRetry;
  }

  public void setSmsResendRetry(Integer smsResendRetry) {
    this.smsResendRetry = smsResendRetry;
  }

  /**
   * sms-combine-concatenated-mo Whether Kannel should attempt to combine concatenated MO SMS prior
   * to passing them over to smsbox. Default is true
   */
  private Boolean smsCombineConcatenatedMo;

  public Boolean getSmsCombineConcatenatedMo() {
    return this.smsCombineConcatenatedMo;
  }

  public void setSmsCombineConcatenatedMo(Boolean smsCombineConcatenatedMo) {
    this.smsCombineConcatenatedMo = smsCombineConcatenatedMo;
  }

  /**
   * sms-combine-concatenated-mo-timeout How long to wait for all concatenated message parts to
   * arrive before timeouting. Default 1800 seconds.
   */
  private Integer smsCombineConcatenatedMoTimeout;

  public Integer getSmsCombineConcatenatedMoTimeout() {
    return this.smsCombineConcatenatedMoTimeout;
  }

  public void setSmsCombineConcatenatedMoTimeout(Integer smsCombineConcatenatedMoTimeout) {
    this.smsCombineConcatenatedMoTimeout = smsCombineConcatenatedMoTimeout;
  }

  /**
   * http-timeout Sets socket timeout in seconds for outgoing client http connections. Optional.
   * Defaults to 240 seconds.
   */
  private Integer httpTimeout;

  public Integer getHttpTimeout() {
    return this.httpTimeout;
  }

  public void setHttpTimeout(Integer httpTimeout) {
    this.httpTimeout = httpTimeout;
  }
}


text:
<?php

declare(strict_types=1);

namespace FeedIo\Rule;

use InvalidArgumentException;
use FeedIo\Feed\NodeInterface;
use FeedIo\DateRuleAbstract;

class ModifiedSince extends DateRuleAbstract
{
    public const NODE_NAME = 'pubDate';

    /**
     * @param  NodeInterface $node
     * @param  \DOMElement   $element
     */
    public function setProperty(NodeInterface $node, \DOMElement $element): void
    {
        $node->setLastModified($this->getDateTimeBuilder()->convertToDateTime($element->nodeValue));
    }

    /**
     * @inheritDoc
     */
    protected function hasValue(NodeInterface $node): bool
    {
        return true;
    }

    /**
     * @inheritDoc
     */
    protected function addElement(\DomDocument $document, \DOMElement $rootElement, NodeInterface $node): void
    {
        $date = is_null($node->getLastModified()) ? new \DateTime() : $node->getLastModified();

        $rootElement->appendChild($document->createElement(
            $this->getNodeName(),
            $date->format($this->getDefaultFormat())
        ));
    }
}


text:
QuickSpecBegin(SDLGetAppServiceDataSpec)

describe(@"Getter/Setter Tests", ^{
    __block NSString *testServiceType = nil;
    __block SDLAppServiceType testAppServiceType = nil;
    __block BOOL testSubscribe = nil;

    beforeEach(^{
        testServiceType = SDLAppServiceTypeWeather;
        testAppServiceType = SDLAppServiceTypeMedia;
        testSubscribe = YES;
    });

    it(@"Should set and get correctly", ^{
        SDLGetAppServiceData *testRequest = [[SDLGetAppServiceData alloc] init];
        testRequest.serviceType = testServiceType;
        testRequest.subscribe = @(testSubscribe);

        expect(testRequest.serviceType).to(equal(testServiceType));
        expect(testRequest.subscribe).to(beTrue());
    });

    it(@"Should initialize correctly with a dictionary", ^{
        NSDictionary *dict = @{SDLRPCParameterNameRequest:@{
                                       SDLRPCParameterNameParameters:@{
                                               SDLRPCParameterNameServiceType:testServiceType,
                                               SDLRPCParameterNameSubscribe:@(testSubscribe)
                                               },
                                       SDLRPCParameterNameOperationName:SDLRPCFunctionNameGetAppServiceData}};
        SDLGetAppServiceData *testRequest = [[SDLGetAppServiceData alloc] initWithDictionary:dict];

        expect(testRequest.serviceType).to(equal(testServiceType));
        expect(testRequest.subscribe).to(beTrue());
    });

    it(@"Should initialize correctly with initWithAppServiceType:", ^{
        SDLGetAppServiceData *testRequest = [[SDLGetAppServiceData alloc] initWithAppServiceType:testAppServiceType];

        expect(testRequest.serviceType).to(equal(testAppServiceType));
        expect(testRequest.subscribe).to(beNil());
    });

    it(@"Should initialize correctly with initAndSubscribeToAppServiceType:", ^{
        SDLGetAppServiceData *testRequest = [[SDLGetAppServiceData alloc] initAndSubscribeToAppServiceType:testAppServiceType];

        expect(testRequest.serviceType).to(equal(testAppServiceType));
        expect(testRequest.subscribe).to(beTrue());
    });

    it(@"Should initialize correctly with initAndUnsubscribeToAppServiceType:", ^{
        SDLGetAppServiceData *testRequest = [[SDLGetAppServiceData alloc] initAndUnsubscribeToAppServiceType:testAppServiceType];

        expect(testRequest.serviceType).to(equal(testAppServiceType));
        expect(testRequest.subscribe).to(beFalse());
    });

    it(@"Should return nil if not set", ^{
        SDLGetAppServiceData *testRequest = [[SDLGetAppServiceData alloc] init];

        expect(testRequest.serviceType).to(beNil());
        expect(testRequest.subscribe).to(beNil());
    });
});

QuickSpecEnd


text:
HTTP = {}

HTTP.GetErrorLog = function()
  local start = getTickCount()
  local content = {}
  local result = {}
  local file
  if fileExists(Log.basedir.."error".."/"..Time.GetDateShort()..".json") then
    file = fileOpen(Log.basedir.."error".."/"..Time.GetDateShort()..".json", true)
    content = fileRead(file, fileGetSize(file))
    result.data = fromJSON(content)
    fileClose(file)
  end

  local diff = getTickCount() - start
  return result
end

HTTPGetErrorLog = HTTP.GetErrorLog


text:
<?php

class RestResponse
{
	public $code = null;
	public $body = null;
	public $headers = null;

	public function __construct($code, $body = null, $headers = [])
	{
		$this->code = $code;
		$this->body = $body;
		$this->headers = $headers;
	}

	public function get()
	{
		$response = new StdClass;
		$response->code = $this->code;
		if (isset($this->body)) $response->body = $this->body;
		$response->headers = $this->headers;
		return $response;
	}
}


text:
using System;
using System.Globalization;
using System.Windows.Data;

namespace PoESkillTree.ViewModels.PassiveTree
{
    public class MasteryEffectCheckedConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo _)
        {
            if (values[0] is ushort effect && values[1] is MasteryEffectSelectionViewModel vm)
            {
                return vm.IsEffectChecked(effect);
            }

            return false;
        }
        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
    }
}


text:
/**
 * Architecture Notes:
 * ===================
 * Component - React View Renderer, which must be reusable - this section is intended to
 * go in blogging framework after a stable version with tests, so this should not be
 * intended to be built in process of mix and match, this should be reusable components
 * which can be isolated and can be adapted with style, semantics with SEO and accessibility.
 *
 * Stores / Services - this section should be already prebuilt with api like getAll,
 * createAll and we just call them here from blogging framework and use them for our blog
 * development, but this mostly should be reusable and not a part of renderer in
 * architecture point of view
 * modern patterns for app development like Flux, Redux - should be used and they can also
 * be re-usable if it is possbile but later this
 * content will be separated in a blog prototype
 */

require('../../src/main.scss');

import React from 'react';
import ReactDOM from 'react-dom';
import Wrapper from './components/layout';
import Blog from './components/blog-component';
import BlogRegistration from './components/blog-registration';

ReactDOM.render(
  <Wrapper>
    <Blog title="Blog Title" author="Author" />
    <BlogRegistration />
  </Wrapper>,
  document.getElementById('app'));


text:
<?php

class Services_Nntp_Engine {
    private $_server;
    private $_user;
    private $_pass;
    private $_serverenc;
    private $_serverport;

    /**
     * Registers how many errors there have been for this connection
     * @var float
     */
    private $_connectionErrors = 0;

    /**
     * Actual Net_NNTP's connection class
     *
     * @var Net_NNTP_Client
     */
    private $_nntp;
    private $_connected;
    private $_currentgroup;

    /*
     * Instantiate a new Service NNTP engine object
     */
    function __construct(array $server) {
        $this->_connected = false;
        $this->_server = $server['host'];
        $this->_serverenc = $server['enc'];
        $this->_serverport = $server['port'];
        $this->_user = $server['user'];
        $this->_pass = $server['pass'];
        $this->_connectionErrors = 0;

        $this->_nntp = new Net_NNTP_Client();
    } # ctor

    /**
     * Register an operation as failed
     */
    private function registerError($exception) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->registerError() called: " . $exception->getMessage());
        /*
         * Some exceptions are "final" and will not recover when
         * just tried again.
         *
         * Error code 430 - 'No such article' - is one of them.
         *
         * If these happen, immediatly increase to the highest possible
         * errors
         */
        if ($exception->getCode() == 430) {
            SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->registerError() was: article not found");

            $this->_connectionErrors = 9999;

            return;
        } # if

        $this->_connectionErrors++;

        /*
         * Disconnect from the server, reconnect and
         * sleep in between
         */
        $this->quit();
        $this->_nntp = new Net_NNTP_Client();
        sleep($this->_connectionErrors);

        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->registerError() errorCount is now: " . $this->_connectionErrors);

        // reconnect by selecting the group again
        if (!empty($this->_currentgroup)) {
            $this->selectGroup($this->_currentgroup);
        } # if
    } # registerError

    /**
     * Register a try of a command
     */
    private function registerTryCommand() {
        /*
         * We decrease with 0.10 points, so that each 10 sucessful commands
         * give us another retry.
         */
        $this->_connectionErrors = max(0, $this->_connectionErrors - 0.10);
    } # registerTryCommand

    /**
     * Sometimes we want to be able to reset the errorcount
     * from outside, mostly in the case of error 430 (No Such Article),
     * as this error is handled by an upper layer
     */
    public function resetErrorCount() {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->resetErrorCount()");

        $this->_connectionErrors = 0;
    } # resetErrorCount

    /**
     * Returns true when this connection has had too many errors
     *
     * @return bool
     */
    private function tooManyErrors() {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->tooManyErrors() == " . $this->_connectionErrors);

        return ($this->_connectionErrors > 3);
    } # tooManyErrors

    /**
    /*
     * Select a group as active group
     */
    public function selectGroup($group) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->selectGroup(" . $group . ")");
        $this->connect();

        $this->_currentgroup = $group;

        return $this->_nntp->selectGroup($this->_currentgroup);
    } # selectGroup()

    /*
     * Returns an overview (XOVER) from first id to lastid
     */
    public function getOverview($first, $last) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->getOverView(" . $first . "," . $last . ")");
        $this->connect();

        try {
            $this->registerTryCommand();

            $headerList = $this->_nntp->getOverview($first . '-' . $last);

            /*
             * Remove the <> around the messageid
             */
            foreach($headerList as $k => $v) {
                $headerList[$k]['Message-ID'] = substr($headerList[$k]['Message-ID'], 1, -1);
                $headerList[$k]['References'] = substr($headerList[$k]['References'], 1, -1);
            } # foreach

            return $headerList;
        } catch (Exception $x) {
            $this->registerError($x);

            /**
             * Try this operation again, but make sure we are not overloading
             * the NNTP server with useless requests
             */
            if ($this->tooManyErrors()) {
                throw $x;
            } else {
                return $this->getOverview($first, $last);
            } # else
        } # catch
    } # getOverview()

    /*
     * Get a single messageid given a single articlenumber
     */
    public function getMessageIdByArticleNumber($artNr) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->getMessageIdByArticleNumber(" . $artNr . ")");
        $this->connect();

        try {
            $this->registerTryCommand();

            return substr($this->_nntp->getHeaderField('Message-ID', $artNr), 1, -1);
        } catch (Exception $x) {
            $this->registerError($x);

            /**
             * Try this operation again, but make sure we are not overloading
             * the NNTP server with useless requests
             */
            if ($this->tooManyErrors()) {
                throw $x;
            } else {
                return $this->getMessageIdByArticleNumber($artNr);
            } # else
        } # catch
    } # getMessageIdByArticleNumber

    /*
     * Get a list of messageid's within a range, same as XOVER
     * but only for messageids
     */
    public function getMessageIdList($first, $last) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->getMessageIdList(" . $first . "," . $last . ")");
        $this->connect();

        try {
            $this->registerTryCommand();

            return $this->_nntp->getHeaderField('Message-ID', ($first . '-' . $last));
        } catch (Exception $x) {
            $this->registerError($x);

            /**
             * Try this operation again, but make sure we are not overloading
             * the NNTP server with useless requests
             */
            if ($this->tooManyErrors()) {
                throw $x;
            } else {
                return $this->getMessageIdList($first, $last);
            } # else
        } # catch
    } # getMessageIdList()

    /*
     * Disconnect from the server if we are connected
     */
    public function quit() {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->quit()");

        if (!$this->_connected) {
            return ;
        } # if

        try {
            $this->_nntp->disconnect();
        }
        catch(Exception $x) {
            // dummy, we dont care about exceptions during quitting time
        } # catch

        $this->_connected = false;
    } # quit()

    /*
     * Sends a no-operation to the usenet server to keep the
     * connection alive
     */
    public function sendNoop() {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->sendNoop()");

        if (!$this->_connected) {
            return ;
        } # if

        /* The NNTP protocol has no proper noop command, this will do fine */
        if (!empty($this->_currentgroup)) {
            $this->selectGroup($this->_currentgroup);
        } # if
    } # sendnoop()

    /*
     * Post an article to the server, $article should be an 2-element
     * array with head and body as elements
     */
    public function post($article) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->post() -> " . serialize($article));
        $this->connect();
        /*
         * We cannot run post() directly because it would
         * trigger the autoloader
         */
        $tmpError = $this->_nntp->cmdPost();
        if ($tmpError) {
            return $this->_nntp->cmdPost2($article);
        } else {
            return $tmpError;
        } # else
    } # post()

    /*
     * Returns the header of an messageid
     */
    public function getHeader($msgid) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->getHeader(" . $msgid . ")");
        $this->connect();

        try {
            $this->registerTryCommand();

            return $this->_nntp->getHeader($msgid);
        } catch (Exception $x) {
            $this->registerError($x);

            echo PHP_EOL . 'getHeader(): Failed to retrieve article: ' . $msgid . PHP_EOL;

            /**
             * Try this operation again, but make sure we are not overloading
             * the NNTP server with useless requests
             */
            if ($this->tooManyErrors()) {
                throw $x;
            } else {
                return $this->getHeader($msgid);
            } # else
        } # catch

    } # getHeader()

    /*
     * Returns the body of an messageid
     */
    public function getBody($msgid) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->getBody(" . $msgid . ")");
        $this->connect();

        try {
            $this->registerTryCommand();

            return $this->_nntp->getBody($msgid);
        } catch (Exception $x) {
            $this->registerError($x);

            echo PHP_EOL . 'getBody(): Failed to retrieve article: ' . $msgid . PHP_EOL;

            /**
             * Try this operation again, but make sure we are not overloading
             * the NNTP server with useless requests
             */
            if ($this->tooManyErrors()) {
                throw $x;
            } else {
                return $this->getBody($msgid);
            } # else
        } # catch

    } # getBody	()

    /*
     * Connect to the newsserver and authenticate
     * if necessary
     */
    public function connect() {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->connect()");
        /*
         * Store the username and password in it, we will not put it in member variables
         * because they might show up in a stack trace.
         *
         * We keep an array of tmpUser and tmpPass because when different servers are
         * used for diffferent types of retrieval we need to be able to store seperate passwords
         */
        static $tmpUser;
        static $tmpPass;

        # dummy operation
        if ($this->_connected) {
            return ;
        } # if

        # if an empty hostname is provided, abort
        if (empty($this->_server)) {
            throw new NntpException('Servername is empty', -1);
        }  # if

        # if a portnumber is empty, abort
        if ((!is_numeric($this->_serverport)) || ($this->_serverport < 1)) {
            throw new NntpException('A server portnumber has to be entered', -1);
        }  # if

        # if the type of SSL is invalid, abort
        if (($this->_serverenc !== false) && (strtolower($this->_serverenc) !== 'ssl') && (strtolower($this->_serverenc) !== 'tls')) {
            throw new NntpException('Invalid encryption method specified (' . $this->_serverenc . ')', -1);
        }  # if

        $this->_connected = true;

        /*
         * Erase username/password so it won't show up in any stacktrace
         *
         * Because this class can be reused (e - reconnected) without
         * reconstructing it, we cannot simple
         */
        if (($this->_user !== '*FILTERED*') && ($this->_pass !== '*FILTERED*')) {
            $tmpUser[$this->_server] = $this->_user;
            $tmpPass[$this->_server] = $this->_pass;

            $this->_user = '*FILTERED*';
            $this->_pass = '*FILTERED*';
        } # if

        try {
            $ret = $this->_nntp->connect($this->_server, $this->_serverenc, $this->_serverport, 10);
            if ($ret === false) {
                throw new NntpException('Error while connecting to server (server did not respond)', -1);
            } # if

            SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->connect called, trying to authenticate?: ", array('user' => $tmpUser[$this->_server], 'pass' => $tmpPass[$this->_server]));

            if (!empty($tmpUser[$this->_server])) {
                $authed = $this->_nntp->authenticate($tmpUser[$this->_server], $tmpPass[$this->_server]);
            } # if

        } catch(Exception $x){
            throw new NntpException($x->getMessage(), $x->getCode());
        }
    } # connect()

    /*
     * Returns a full article divided between an
     * header and body part
     */
    public function getArticle($msgId) {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->getArticle(" . $msgId . ")");
        $this->connect();

        $result = array('header' => array(), 'body' => array());

        try {
            $this->registerTryCommand();

            # Fetch the article
            $art = $this->_nntp->getArticle($msgId);
        } catch (Exception $x) {
            $this->registerError($x);

            echo PHP_EOL . 'getArticle(): Failed to retrieve article: ' . $msgId . PHP_EOL;
            /**
             * Try this operation again, but make sure we are not overloading
             * the NNTP server with useless requests
             */
            if ($this->tooManyErrors()) {
                throw $x;
            } else {
                return $this->getArticle($msgId);
            } # else
        } # catch

        /*
         * Now we will split it in both a body and an array, this
         * way it is much easier to work with
         */
        $i = 0;
        $lnCount = count($art);
        while( ($i < $lnCount) && ($art[$i] != '')) {
            $result['header'][] = $art[$i];
            $i++;
        } # while
        $i++;

        while($i < $lnCount) {
            $result['body'][] = $art[$i];
            $i++;
        } # while

        return $result;
    } # getArticle

    /*
     * validates wether can succesfully connect to the usenet
     * server
     */
    public function validateServer() {
        SpotDebug::msg(SpotDebug::TRACE, __CLASS__ . "->validateServer()");
        /*
         * We need to select a group, because authentication
         * is not always entered but sometimes required
         */
        $this->selectGroup('free.pt');

        $this->quit();
    } # validateServer

} # Services_Nntp_Engine


text:
<?php

namespace Rainbow\FormBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\FormBuilderInterface;

class DateRangeType extends AbstractType implements DataTransformerInterface
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('period', 'choice', array(
                'choices' => array(
                    'empty_value' => '-- Select --',
                    'Today',
                    'Yesterday',
                    'Last week',
                    'Last month',
                    'Last year',
                )
            ))
            ->addModelTransformer($this)
        ;

    }

    public function getName()
    {
        return "daterange";
    }

    /**
     * @param mixed $value The value in the original representation
     *
     * @return mixed The value in the transformed representation
     *
     * @throws TransformationFailedException When the transformation fails.
     */
    public function transform($value)
    {
        return $value;
    }

    /**
     * @param mixed $value The value in the transformed representation
     *
     * @return mixed The value in the original representation
     *
     * @throws TransformationFailedException When the transformation fails.
     */
    public function reverseTransform($value)
    {
        switch ($value['period']) {
            case "0" :
                $ret = new \DateTime("now");
                break;
            case "1" :
                // "yesterday" gives back incorrect time 00:00:00
                $ret = new \DateTime("-1 day");
                break;
            case "2" :
                $ret = new \DateTime("last week");
                break;
            case "3" :
                $ret = new \DateTime("last month");
                break;
            case "4" :
                $ret = new \DateTime("last year");
                break;
            default:
                throw new TransformationFailedException();
        }

        return $ret;
    }

}