text:
using System;
using System.Diagnostics;
using System.Reflection;
using System.Threading.Tasks;
using WikiClientLibrary;
using WikiClientLibrary.Sites;
using WikiClientLibrary.Tests.UnitTestProject1.Fixtures;
using Xunit;
using Xunit.Abstractions;

namespace WikiClientLibrary.Tests.UnitTestProject1.Tests
{

    [Trait("Category", "SiteTests")]
    public class SiteTests : WikiSiteTestsBase, IClassFixture<WikiSiteProvider>
    {

        /// <inheritdoc />
        public SiteTests(ITestOutputHelper output, WikiSiteProvider wikiSiteProvider) : base(output, wikiSiteProvider)
        {
        }

        private void ValidateNamespace(WikiSite site, int id, string name, bool isContent, string? normalizedName = null)
        {
            // normalizedName: null means using `name` as normalized name
            Assert.True(site.Namespaces.Contains(id), $"Cannot find namespace id={id}.");
            var ns = site.Namespaces[id];
            var expectedName = normalizedName ?? name;
            Assert.True(ns.CanonicalName == expectedName || ns.Aliases.Contains(expectedName));
            Assert.Equal(isContent, site.Namespaces[id].IsContent);
            // Should also be able to retrieve namespaces via name.
            Assert.True(site.Namespaces.Contains(name), $"Cannot find namespace {name} (id={id}).");
            Assert.Equal(ns, site.Namespaces[name]);
        }

        private void ValidateNamespaces(WikiSite site)
        {
            Assert.True(site.Namespaces.Contains(0));
            Assert.True(site.Namespaces[0].IsContent);
            ValidateNamespace(site, -2, "Media", false);
            ValidateNamespace(site, -1, "Special", false);
            ValidateNamespace(site, 1, "Talk", false);
            // btw test normalization functionality.
            ValidateNamespace(site, 1, "___ talk __", false, "Talk");
            ValidateNamespace(site, 10, "Template", false);
            ValidateNamespace(site, 11, "template_talk_", false, "Template talk");
            ValidateNamespace(site, 14, "Category", false);
        }

        private void ValidateWpInterwikiMap(WikiSite site)
        {
            // Standard names
            Assert.True(site.InterwikiMap.Contains("en"));
            Assert.True(site.InterwikiMap.Contains("zh"));
            Assert.True(site.InterwikiMap.Contains("fr"));
            Assert.Equal("English", site.InterwikiMap["en"].LanguageAutonym);
            Assert.Equal("中文", site.InterwikiMap["zh"].LanguageAutonym);
            Assert.Equal("français", site.InterwikiMap["fr"].LanguageAutonym);
            // Normalization
            Assert.True(site.InterwikiMap.Contains("EN"));
            Assert.True(site.InterwikiMap.Contains(" _zh__"));
            Assert.True(site.InterwikiMap.Contains(" FR "));
            Assert.Equal("English", site.InterwikiMap["EN"].LanguageAutonym);
            Assert.Equal("中文", site.InterwikiMap[" _zh__"].LanguageAutonym);
            Assert.Equal("français", site.InterwikiMap[" FR "].LanguageAutonym);
        }

        [Fact]
        public async Task TestWpTest2()
        {
            var site = await WpTest2SiteAsync;
            ShallowTrace(site);
            Assert.Equal("Wikipedia", site.SiteInfo.SiteName);
            Assert.Equal("Main Page", site.SiteInfo.MainPage);
            Assert.Equal("https://test2.wikipedia.org/wiki/test%20page", site.SiteInfo.MakeArticleUrl("test page"));
            Assert.Equal("https://test2.wikipedia.org/wiki/test%20page%20%28DAB%29", site.SiteInfo.MakeArticleUrl("test page (DAB)"));
            var messages = await site.GetMessagesAsync(new[] { "august" });
            Assert.Equal("August", messages["august"]);
            ValidateNamespaces(site);
            ValidateWpInterwikiMap(site);
            //ShallowTrace(site.InterwikiMap);
            var stat = await site.GetStatisticsAsync();
            ShallowTrace(stat);
            Assert.True(stat.PagesCount > 20000); // 39244 @ 2016-08-29
            Assert.True(stat.ArticlesCount > 800); // 1145 @ 2016-08-29
            Assert.True(stat.EditsCount > 300000); // 343569 @ 2016-08-29
            Assert.True(stat.FilesCount > 50); // 126 @ 2016-08-29
            Assert.True(stat.UsersCount > 5000); // 6321 @ 2016-08-29
        }

        [Fact]
        public async Task TestWpLzh()
        {
            var site = await WpLzhSiteAsync;
            ShallowTrace(site);
            Assert.Equal("維基大典", site.SiteInfo.SiteName);
            Assert.Equal("維基大典:卷首", site.SiteInfo.MainPage);
            ValidateNamespaces(site);
            ValidateWpInterwikiMap(site);
            ValidateNamespace(site, BuiltInNamespaces.Project, "Wikipedia", false);
            ValidateNamespace(site, 100, "門", false);
        }

        [Fact]
        public async Task TestWikia()
        {
            var site = await WikiaTestSiteAsync;
            ShallowTrace(site);
            Assert.Equal("Dman Wikia", site.SiteInfo.SiteName);
            ValidateNamespaces(site);
        }

        [Theory]
        [InlineData(Endpoints.WikipediaEn)]
        [InlineData(Endpoints.WikiaTest)]
        [InlineData(Endpoints.WikipediaTest2)]
        [InlineData(Endpoints.TFWiki)]
        public async Task LoginWikiSiteFailureTest(string endpointUrl)
        {
            var site = await CreateIsolatedWikiSiteAsync(endpointUrl, true);
            var ex = await Assert.ThrowsAsync<OperationFailedException>(() => site.LoginAsync("wcl_login_failure_test", "password"));
            Output.WriteLine(ex.ToString());
        }

        [Theory]
        [InlineData(Endpoints.WikipediaEn)]
        [InlineData(Endpoints.WikiaTest)]
        [InlineData(Endpoints.WikipediaTest2)]
        [InlineData(Endpoints.TFWiki)]
        public async Task LoginWikiSiteTest(string endpointUrl)
        {
            var site = await CreateIsolatedWikiSiteAsync(endpointUrl, true);
            Assert.False(site.AccountInfo.IsUser);
            Assert.True(site.AccountInfo.IsAnonymous);

            await CredentialManager.LoginAsync(site);
            Assert.True(site.AccountInfo.IsUser);
            Assert.False(site.AccountInfo.IsAnonymous);
            Output.WriteLine($"{site.AccountInfo.Name} has logged into {site}");

            await site.LogoutAsync();
            Assert.False(site.AccountInfo.IsUser);
            Assert.True(site.AccountInfo.IsAnonymous);
            Output.WriteLine($"{site.AccountInfo.Name} has logged out.");
        }

        [Fact]
        public async Task LoginWpTest2_2()
        {
            var site = await CreateIsolatedWikiSiteAsync(Endpoints.WikipediaTest2, true);
            await CredentialManager.LoginAsync(site);
            Assert.True(site.AccountInfo.IsUser);
            Assert.False(site.AccountInfo.IsAnonymous);
            Output.WriteLine($"{site.AccountInfo.Name} has logged into {site}");
            await site.LogoutAsync();
            Assert.False(site.AccountInfo.IsUser);
            Assert.True(site.AccountInfo.IsAnonymous);
            Output.WriteLine($"{site.AccountInfo.Name} has logged out.");
        }

        [Fact]
        public async Task LoginWpTest2_3()
        {
            var site = new WikiSite(CreateWikiClient(),
                new SiteOptions(Endpoints.WikipediaTest2), "!!RandomUserName!!", "!!RandomPassword!!");
            await Assert.ThrowsAsync<OperationFailedException>(() => site.Initialization);
            // The initialization has failed.
            Assert.Throws<InvalidOperationException>(() => site.SiteInfo);
        }

        /// <summary>
        /// Tests legacy way for logging in. That is, to call "login" API action
        /// twice, with the second call using the token returned from the first call.
        /// </summary>
        [Fact]
        public async Task LoginWpTest2_4()
        {
            var site = await CredentialManager.EarlyLoginAsync(CreateWikiClient(),
                new SiteOptions(Endpoints.WikipediaTest2));
            ShallowTrace(site);
            await site.LogoutAsync();
        }

        /// <summary>
        /// Tests <see cref="SiteOptions.ExplicitInfoRefresh"/>.
        /// </summary>
        [SkippableFact]
        public async Task LoginPrivateWikiTest()
        {
            if (string.IsNullOrEmpty(CredentialManager.PrivateWikiTestsEntryPointUrl))
                throw new SkipException("The test needs CredentialManager.PrivateWikiTestsEntryPointUrl to be set.");
            var client = CreateWikiClient();
            // In your client code, you may load cookies beforehand,
            // and use the following statements to check whether you have already logged in
            //      var site = new WikiSite(WikiClient, "api-endpoint");
            //      await site.Initialization;
            // The second statement will throw exception if you haven't logged in.
            var site = await CredentialManager.EarlyLoginAsync(client,
                new SiteOptions(CredentialManager.PrivateWikiTestsEntryPointUrl));
            ShallowTrace(site);
            await site.LogoutAsync();
        }

        [Fact]
        public async Task WpTest2OpenSearchTest()
        {
            var site = await WpTest2SiteAsync;
            var result = await site.OpenSearchAsync("San");
            ShallowTrace(result);
            Assert.True(result.Count > 0);
            Assert.Contains(result, e => e.Title == "Sandbox");
        }

        [Fact]
        public async Task WikiaOpenSearchTest()
        {
            var site = await WikiaTestSiteAsync;
            var result = await Task.WhenAll(site.OpenSearchAsync("Dman Wi"),
                site.OpenSearchAsync("THISTITLEDOESNOTEXIST"));
            ShallowTrace(result[0]);
            ShallowTrace(result[1]);
            Assert.True(result[0].Count > 0);
            Assert.Contains(result[0], e => e.Title == "Dman Wikia");
            Assert.True(result[1].Count == 0);
        }

        [Fact]
        public async Task SearchApiEndpointTest()
        {
            var client = CreateWikiClient();
            var result = await WikiSite.SearchApiEndpointAsync(client, "en.wikipedia.org");
            Assert.Equal("https://en.wikipedia.org/w/api.php", result);
            result = await WikiSite.SearchApiEndpointAsync(client, "warriors.fandom.com");
            Assert.Equal("https://warriors.fandom.com/api.php", result);
            result = await WikiSite.SearchApiEndpointAsync(client, "warriors.fandom.com/abc/def");
            Assert.Equal("https://warriors.fandom.com/api.php", result);
            result = await WikiSite.SearchApiEndpointAsync(client, "wikipedia.org");
            Assert.Null(result);
        }

        [Theory]
        [InlineData(Endpoints.WikipediaEn)]
        [InlineData(Endpoints.WikiaTest)]
        [InlineData(Endpoints.WikipediaTest2)]
        [InlineData(Endpoints.TFWiki)]
        public async Task InterlacingLoginLogoutTest(string endpointUrl)
        {
            // The two sites belong to different WikiClient instances.
            var site1 = await CreateIsolatedWikiSiteAsync(endpointUrl, true);
            var site2 = await CreateIsolatedWikiSiteAsync(endpointUrl, true);
            Assert.False(site1.AccountInfo.IsUser);
            Assert.False(site1.AccountInfo.IsUser);
            await CredentialManager.LoginAsync(site1);
            await CredentialManager.LoginAsync(site2);
            await site2.LogoutAsync();
            await site1.RefreshAccountInfoAsync();
            // MediaWiki Phabricator Task T51890: Logging out on a different device logs me out everywhere else
            Assert.True(site1.AccountInfo.IsUser,
                "If you are logged in with your normal password instead of Bot Password, " +
                "This case will fail due to [[phab:T51890]] and you can safely ignore it." +
                "If you are logged in with Bot Password, please re-open the issue: " +
                "https://github.com/CXuesong/WikiClientLibrary/issues/11 .");
        }

        [Theory]
        [InlineData(Endpoints.WikipediaEn)]
        [InlineData(Endpoints.WikiaTest)]
        [InlineData(Endpoints.WikipediaTest2)]
        // [InlineData(Endpoints.TFWiki)] account assertion does not work on MW 1.19.
        public async Task AccountAssertionTest1(string endpointUrl)
        {
            // This method will fiddle with the Site instance…
            var site = await CreateIsolatedWikiSiteAsync(endpointUrl, true);
            Assert.False(site.AccountInfo.IsUser, "You should have not logged in.");
            // Make believe that we're bots…
            typeof(AccountInfo).GetProperty(nameof(AccountInfo.Groups))!.SetValue(site.AccountInfo, new[] { "*", "user", "bot" });
            Assert.True(site.AccountInfo.IsUser, "Failed to fiddle with user information.");
            // Send a request…
            await Assert.ThrowsAsync<AccountAssertionFailureException>(() => site.GetMessageAsync("edit"));
        }

        [Theory]
        [InlineData(Endpoints.WikipediaEn)]
        [InlineData(Endpoints.WikiaTest)]
        [InlineData(Endpoints.WikipediaTest2)]
        [InlineData(Endpoints.TFWiki)]
        public async Task AccountAssertionTest2(string endpointUrl)
        {
            // This method will fiddle with the Site instance…
            var site = await CreateIsolatedWikiSiteAsync(endpointUrl, true);
            site.AccountAssertionFailureHandler = new MyAccountAssertionFailureHandler(async s =>
            {
                await CredentialManager.LoginAsync(site);
                return true;
            });
            Assert.False(site.AccountInfo.IsUser, "You should have not logged in.");
            // Make believe that we're bots…
            typeof(AccountInfo).GetProperty(nameof(AccountInfo.Groups))!.SetValue(site.AccountInfo, new[] { "*", "user", "bot" });
            Assert.True(site.AccountInfo.IsUser, "Failed to fiddle with user information.");
            // Send a request…
            var message = await site.GetMessageAsync("edit");
            Output.WriteLine("Message(edit) = " + message);
        }

        private class MyAccountAssertionFailureHandler : IAccountAssertionFailureHandler
        {
            private readonly Func<WikiSite, Task<bool>> _Handler;

            public MyAccountAssertionFailureHandler(Func<WikiSite, Task<bool>> handler)
            {
                if (handler == null) throw new ArgumentNullException(nameof(handler));
                _Handler = handler;
            }

            /// <inheritdoc />
            public Task<bool> Login(WikiSite site)
            {
                if (site == null) throw new ArgumentNullException(nameof(site));
                return _Handler(site);
            }
        }

    }
}


text:
![](./doc/app_window.png)

[Download](https://github.com/baku89/GLSLRenderer/releases)

**NOTE: The binary in the release page appears not to work because of FFmpeg dependency. Please re-compile it in your own environment to run.**

## About

GLSL Rendering tool for video production use. The app can export GLSL image using FFmpeg with more detailed composition settings such like duration, size, and fps. This is compiled with [openFrameworks v0.9.8](http://openframeworks.cc/).

Develped by [Baku Hashimoto](http://baku89.com)

### Uniforms

This app passes some uniforms same as Patricio Gonzalez Vivo's [The Book of Shaders Editor](http://editor.thebookofshaders.com/). Please see the [instruction](http://thebookofshaders.com/03/) for more detailed information.

```glsl
uniform vec2 u_resolution; // Canvas size (width,height)
uniform float u_time;     // Time in seconds since load
```

NOTE: `u_mouse` is not passed.

### Textures

You can pass also textures just like hidden feature of The Book of Shaders Editor.

```glsl
uniform sampler2D textureName; // http://baku89.com/res/baku_grad3.png
```

The textures will be cached automatically. So please hit **[R]** to clear caches if you find textures you changed on remote does not appear to be reflected.

## License

GLSL Renderer is published under a MIT License. See the included [LISENCE file](./LICENSE).

## TODO

* Image Capturing
* "Open in Editor/Finder" option for Windows
* Uniforms control (via ImGui, and OSC)
* [ISF](https://www.interactiveshaderformat.com/) Support (I am also thinking to support ISF as another app)

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<tei xmlns="http://www.tei-c.org/ns/1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML">
	<teiHeader>
		<fileDesc>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>

						<affiliation>
							<marker>1</marker>
							<orgName type="department">Division of Hematology/Oncology</orgName>,
							<orgName type="department">Department of Medicine</orgName>,
							<orgName type="institution">Northwest University <lb/> Medical School</orgName>
							and the
							<orgName type="department">Robert H. Lurie Cancer Center</orgName>
							of
							<orgName type="institution">Northwestern University</orgName>,
							<lb/>
							<address>
								<settlement>Chicago</settlement>,
								<country>USA</country>;
							</address>
						</affiliation>
						<affiliation>
							<marker>2</marker>
							<orgName type="department">Medicine Branch</orgName>,
							<orgName type="institution">National Cancer Institute</orgName>,
							<orgName type="institution">National Institutes of Health</orgName>,
							<lb/>
							<address>
								<settlement>Bethesda</settlement>,
								<region>MD</region>,
							</address>
						</affiliation>
						<affiliation>
							<orgName type="institution">National Institutes</orgName>,
							<orgName type="institution">National Institutes</orgName>
							<address>
								<country>USA</country>;
							</address>
						</affiliation>
						<affiliation>
							<marker>3</marker>
							<orgName type="department">Surgery Branch</orgName>,
							<orgName type="institution">National<lb/> Cancer Institute</orgName>,
							<orgName type="institution">National Institutes of Health</orgName>,
							<address>
								<settlement>Bethesda</settlement>,
								<region>MD</region>,
								<country>USA</country>;
							</address>
						</affiliation>
						<affiliation>
							<marker>4</marker>
							<orgName type="department">Division of Cancer<lb/> Prevention</orgName>,
							<orgName type="institution">National Cancer Institute</orgName>,
							<orgName type="institution">National Institutes of Health</orgName>,
							<address>
								<settlement>Bethesda</settlement>,
								<region>MD</region>,
								<country>USA</country>;<lb/> and
							</address>
						</affiliation>
						<affiliation>
							<marker>5</marker>
							<orgName type="department">Department of Pathology</orgName>,
							<orgName type="department">Northwestern University Medical School</orgName>
							and the
							<orgName type="department">Robert H.<lb/> Lurie Cancer Center</orgName>
							of
							<orgName type="institution">Northwestern University</orgName>,
							<address>
								<settlement>Chicago</settlement>,
								<country>USA</country>
							</address>
						</affiliation>

						</author>
					</analytic>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
	</teiHeader>
</tei>


text:
<template name="locationList">

Locations at Brandeis

            Category
            {{selectedCat}}

                    All
                    Art
                    Dorm
                    Library
                    Student life

                    Academics
                    Athletics
                    Health
                    Offices
                    Transport

                    Administrative
                    Dining
                    Landscape
                    Parking
                    Religious

            Area
            {{selectedArea}}

                All

Upper campus

                    North Quad
                    East Quad
                    Mandel Quad
                    Libraries
                    Chapels
                    Science complex

Lower campus

                    Rosenthal Quad
                    Ziv Quad
                    Ridgewood Quad
                    Massell Quad
                    Charles River Apartments

Athletics

                    Athletics complex
                    Foster Mods

        {{#each locationsData}}
            {{> locationListing}}
        {{/each}}

</template>


text:
package nats.client.spring;

import nats.client.Nats;
import org.springframework.context.ApplicationEvent;

/**
 * Abstract application event class for NATS events.
 *
 * @author Mike Heath <elcapo@gmail.com>
 */
public abstract class AbstractNatsApplicationEvent extends ApplicationEvent {
	private final Nats nats;

	public AbstractNatsApplicationEvent(Nats nats) {
		super(nats);
		this.nats = nats;
	}

	public Nats getNats() {
		return nats;
	}

	@Override
	public Nats getSource() {
		return (Nats)super.getSource();
	}
}


text:
using System;
using PS.Build.Types;

namespace PS.Build.Services
{
    public class NugetPackage : INugetPackage
    {
        #region Constructors

        public NugetPackage(string id, Version version, string folder)
        {
            Folder = folder;
            ID = id;
            Version = version;
        }

        #endregion

        #region Properties

        public string Folder { get; }
        public string ID { get; }
        public Version Version { get; }

        #endregion

        #region Override members

        public override string ToString()
        {
            return $"[{Version}] {ID}";
        }

        #endregion
    }
}


text:
#ifndef _LINUX_RESERVATION_H
#define _LINUX_RESERVATION_H

#include <linux/ww_mutex.h>
#include <linux/fence.h>
#include <linux/slab.h>
#include <linux/seqlock.h>
#include <linux/rcupdate.h>

extern struct ww_class reservation_ww_class;
extern struct lock_class_key reservation_seqcount_class;
extern const char reservation_seqcount_string[];

/**
 * struct reservation_object_list - a list of shared fences
 * @rcu: for internal use
 * @shared_count: table of shared fences
 * @shared_max: for growing shared fence table
 * @shared: shared fence table
 */
struct reservation_object_list {
	struct rcu_head rcu;
	u32 shared_count, shared_max;
	struct fence __rcu *shared[];
};

/**
 * struct reservation_object - a reservation object manages fences for a buffer
 * @lock: update side lock
 * @seq: sequence count for managing RCU read-side synchronization
 * @fence_excl: the exclusive fence, if there is one currently
 * @fence: list of current shared fences
 * @staged: staged copy of shared fences for RCU updates
 */
struct reservation_object {
	struct ww_mutex lock;
	seqcount_t seq;

	struct fence __rcu *fence_excl;
	struct reservation_object_list __rcu *fence;
	struct reservation_object_list *staged;
};

#define reservation_object_held(obj) lockdep_is_held(&(obj)->lock.base)
#define reservation_object_assert_held(obj) \
	lockdep_assert_held(&(obj)->lock.base)

/**
 * reservation_object_init - initialize a reservation object
 * @obj: the reservation object
 */
static inline void
reservation_object_init(struct reservation_object *obj)
{
	ww_mutex_init(&obj->lock, &reservation_ww_class);

	__seqcount_init(&obj->seq, reservation_seqcount_string, &reservation_seqcount_class);
	RCU_INIT_POINTER(obj->fence, NULL);
	RCU_INIT_POINTER(obj->fence_excl, NULL);
	obj->staged = NULL;
}

/**
 * reservation_object_fini - destroys a reservation object
 * @obj: the reservation object
 */
static inline void
reservation_object_fini(struct reservation_object *obj)
{
	int i;
	struct reservation_object_list *fobj;
	struct fence *excl;

	/*
	 * This object should be dead and all references must have
	 * been released to it, so no need to be protected with rcu.
	 */
	excl = rcu_dereference_protected(obj->fence_excl, 1);
	if (excl)
		fence_put(excl);

	fobj = rcu_dereference_protected(obj->fence, 1);
	if (fobj) {
		for (i = 0; i < fobj->shared_count; ++i)
			fence_put(rcu_dereference_protected(fobj->shared[i], 1));

		kfree(fobj);
	}
	kfree(obj->staged);

	ww_mutex_destroy(&obj->lock);
}

/**
 * reservation_object_get_list - get the reservation object's
 * shared fence list, with update-side lock held
 * @obj: the reservation object
 *
 * Returns the shared fence list.  Does NOT take references to
 * the fence.  The obj->lock must be held.
 */
static inline struct reservation_object_list *
reservation_object_get_list(struct reservation_object *obj)
{
	return rcu_dereference_protected(obj->fence,
					 reservation_object_held(obj));
}

/**
 * reservation_object_get_excl - get the reservation object's
 * exclusive fence, with update-side lock held
 * @obj: the reservation object
 *
 * Returns the exclusive fence (if any).  Does NOT take a
 * reference.  The obj->lock must be held.
 *
 * RETURNS
 * The exclusive fence or NULL
 */
static inline struct fence *
reservation_object_get_excl(struct reservation_object *obj)
{
	return rcu_dereference_protected(obj->fence_excl,
					 reservation_object_held(obj));
}

/**
 * reservation_object_get_excl_rcu - get the reservation object's
 * exclusive fence, without lock held.
 * @obj: the reservation object
 *
 * If there is an exclusive fence, this atomically increments it's
 * reference count and returns it.
 *
 * RETURNS
 * The exclusive fence or NULL if none
 */
static inline struct fence *
reservation_object_get_excl_rcu(struct reservation_object *obj)
{
	struct fence *fence;
	unsigned seq;
retry:
	seq = read_seqcount_begin(&obj->seq);
	rcu_read_lock();
	fence = rcu_dereference(obj->fence_excl);
	if (read_seqcount_retry(&obj->seq, seq)) {
		rcu_read_unlock();
		goto retry;
	}
	fence = fence_get(fence);
	rcu_read_unlock();
	return fence;
}

int reservation_object_reserve_shared(struct reservation_object *obj);
void reservation_object_add_shared_fence(struct reservation_object *obj,
					 struct fence *fence);

void reservation_object_add_excl_fence(struct reservation_object *obj,
				       struct fence *fence);

int reservation_object_get_fences_rcu(struct reservation_object *obj,
				      struct fence **pfence_excl,
				      unsigned *pshared_count,
				      struct fence ***pshared);

long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
					 bool wait_all, bool intr,
					 unsigned long timeout);

bool reservation_object_test_signaled_rcu(struct reservation_object *obj,
					  bool test_all);

#endif /* _LINUX_RESERVATION_H */


text:
struct MetadataTagProcessorImpl
{
  MetadataTagProcessorImpl(FeatureParams &params)
  : m_params(params)
  {
  }

  string ValidateAndFormat_maxspeed(string const & v) const;
  string ValidateAndFormat_stars(string const & v) const;
  string ValidateAndFormat_cuisine(string v) const;
  string ValidateAndFormat_operator(string const & v) const;
  string ValidateAndFormat_url(string const & v) const;
  string ValidateAndFormat_phone(string const & v) const;
  string ValidateAndFormat_opening_hours(string const & v) const;
  string ValidateAndFormat_ele(string const & v) const;
  string ValidateAndFormat_turn_lanes(string const & v) const;
  string ValidateAndFormat_turn_lanes_forward(string const & v) const;
  string ValidateAndFormat_turn_lanes_backward(string const & v) const;
  string ValidateAndFormat_email(string const & v) const;
  string ValidateAndFormat_postcode(string const & v) const;
  string ValidateAndFormat_flats(string const & v) const;
  string ValidateAndFormat_internet(string v) const;
  string ValidateAndFormat_height(string const & v) const;
  string ValidateAndFormat_building_levels(string v) const;
  string ValidateAndFormat_denomination(string const & v) const;
  string ValidateAndFormat_wikipedia(string v) const;
  string ValidateAndFormat_price_rate(string const & v) const;
  string ValidateAndFormat_sponsored_id(string const & v) const;
  string ValidateAndFormat_rating(string const & v) const;

protected:
  FeatureParams & m_params;
};

class MetadataTagProcessor : private MetadataTagProcessorImpl
{
public:
  /// Make base class constructor public.
  using MetadataTagProcessorImpl::MetadataTagProcessorImpl;
  /// Since it is used as a functor wich stops iteration in ftype::ForEachTag
  /// and the is no need for interrupting it always returns false.
  /// TODO(mgsergio): Move to cpp after merge with https://github.com/mapsme/omim/pull/1314
  bool operator() (string const & k, string const & v)
  {
    if (v.empty())
      return false;

    using feature::Metadata;
    Metadata & md = m_params.GetMetadata();

    Metadata::EType mdType;
    if (!Metadata::TypeFromString(k, mdType))
    {
      // Specific cases which do not map directly to our metadata types.
      if (k == "building:min_level")
      {
        // Converting this attribute into height only if min_height has not been already set.
        if (!md.Has(Metadata::FMD_MIN_HEIGHT))
          md.Set(Metadata::FMD_MIN_HEIGHT, ValidateAndFormat_building_levels(v));
      }
      return false;
    }

    string valid;
    switch (mdType)
    {
    case Metadata::FMD_CUISINE: valid = ValidateAndFormat_cuisine(v); break;
    case Metadata::FMD_OPEN_HOURS: valid = ValidateAndFormat_opening_hours(v); break;
    case Metadata::FMD_FAX_NUMBER:  // The same validator as for phone.
    case Metadata::FMD_PHONE_NUMBER: valid = ValidateAndFormat_phone(v); break;
    case Metadata::FMD_STARS: valid = ValidateAndFormat_stars(v); break;
    case Metadata::FMD_OPERATOR: valid = ValidateAndFormat_operator(v); break;
    case Metadata::FMD_URL:  // The same validator as for website.
    case Metadata::FMD_WEBSITE: valid = ValidateAndFormat_url(v); break;
    case Metadata::FMD_INTERNET: ValidateAndFormat_internet(v); break;
    case Metadata::FMD_ELE: valid = ValidateAndFormat_ele(v); break;
    case Metadata::FMD_TURN_LANES: valid = ValidateAndFormat_turn_lanes(v); break;
    case Metadata::FMD_TURN_LANES_FORWARD: valid = ValidateAndFormat_turn_lanes_forward(v); break;
    case Metadata::FMD_TURN_LANES_BACKWARD: valid = ValidateAndFormat_turn_lanes_backward(v); break;
    case Metadata::FMD_EMAIL: valid = ValidateAndFormat_email(v); break;
    case Metadata::FMD_POSTCODE: valid = ValidateAndFormat_postcode(v); break;
    case Metadata::FMD_WIKIPEDIA: valid = ValidateAndFormat_wikipedia(v); break;
    case Metadata::FMD_MAXSPEED: valid = ValidateAndFormat_maxspeed(v); break;
    case Metadata::FMD_FLATS: valid = ValidateAndFormat_flats(v); break;
    case Metadata::FMD_MIN_HEIGHT:  // The same validator as for height.
    case Metadata::FMD_HEIGHT: valid = ValidateAndFormat_height(v); break;
    case Metadata::FMD_DENOMINATION: valid = ValidateAndFormat_denomination(v); break;
    case Metadata::FMD_BUILDING_LEVELS: valid = ValidateAndFormat_building_levels(v); break;
    case Metadata::FMD_SPONSORED_ID: valid = ValidateAndFormat_sponsored_id(v); break;
    case Metadata::FMD_PRICE_RATE: valid = ValidateAndFormat_price_rate(v); break;
    case Metadata::FMD_RATING: valid = ValidateAndFormat_rating(v); break;

    case Metadata::FMD_TEST_ID:
    case Metadata::FMD_COUNT: CHECK(false, ("FMD_COUNT can not be used as a type."));
    }
    md.Set(mdType, valid);
    return false;
  }
};


text:
'use strict'

if (process.env.NODE_ENV !== 'production') {
  require('dotenv').config()
}

var Discord = require('discord.io');
var logger  = require('winston');
var fetch   = require('isomorphic-unfetch');
var express = require('express');
var app     = express();
var config = {
  "consumerKey": process.env.CONSUMER_KEY,
  "consumerSecret": process.env.CONSUMER_SECRET,
  "accessToken": process.env.ACCESS_TOKEN,
  "accessTokenSecret": process.env.ACCESS_TOKEN_SECRET,
  "callbackUrl": process.env.CALLBACK_URL
}
var allowedUserIds = process.env.ALLOWED_USER_IDS.split(',');
var Twitter = require('twitter-node-client').Twitter;
var twitter = new Twitter(config);

/* @TODO: Look into these - not firing */
app.get('/', function (req, res) {
  res.send('Hello World');
});

app.all('/twitter/callback', function (req, res) {
  res.send('Hello');
});

app.listen(process.env.PORT);
console.log('listening on ', process.env.PORT);

// Callback functions
/* @TODO: Move into utility file */
function error (err, response, body) {
  console.log('ERROR [%s]', err);
};
function success (data) {
  console.log('Data [%s]', data);
};
function postAsPromised (data) {
  return new Promise(function (resolve, reject) {
    twitter.postMedia({
      media_data: data
    }, reject, resolve)
  });
}
function isApprovedUser (userID) {
  return allowedUserIds.indexOf(userID) === -1 ? false : true;
}
function isTweetEmoji (emoji) {
  /* Could set this as process.env variable or array if wanted */
  return emoji.id === '359853241728499713' || emoji.name === 'tweet';
}
function tweetWithAttachments (evt, message) {
  /* Not sure you can actually upload more than one thing at a time.... */
  return Promise.all(evt.d.attachments.map(item => {
    // do stuff
    return fetch(item.url)
      .then(res => res.buffer())
      .then(buffer => buffer.toString('base64'))
      .then(data => postAsPromised(data))
      .then(data => JSON.parse(data).media_id_string)
      .catch(console.log); /* @TODO: Better error handling, possibly don't even tweet without image? */
  }))
  .then(array => {
    const string = array.join(',');
    twitter.postTweet({
      status: message,
      media_ids: string
    }, error, success)
  })
}
function tweet (message) {
  return twitter.postTweet({
    status: message
  }, error, success);
}

// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(logger.transports.Console, {
  colorize: true
});
logger.level = 'debug';

/* @TODO: Make this more dynamic - could be active in more channels */
var activeChannelID;

// Initialize Discord Bot
var bot = new Discord.Client({
  token: process.env.AUTH_TOKEN,
  autorun: true
});

bot.on('ready', function (evt) {
  logger.info('Connected');
  logger.info('Logged in as: ');
  logger.info(bot.username + ' - (' + bot.id + ')');
});

bot.on('message', function (user, userID, channelID, message, evt) {
  const authorId = evt.d.author.id;
  if (!isApprovedUser(authorId)) { return; }
  /* On every message in active channel, if bot is active, post message to Twitter */
  if (activeChannelID === channelID && message.substring(0,1) !== '!') {

    /* If there are attachments, upload first and then upload tweet */
    if (evt.d && evt.d.attachments.length) {
      console.log('tweeting with attachments from active');
      tweetWithAttachments(evt, message);
    } else {
      /* No attachments, straight tweet */
      console.log('tweeting from active');
      tweet(message);
    }
  }

  // Our bot needs to know if it will execute a command
  // It will listen for messages that will start with `!`
  if (message.substring(0, 1) == '!') {
    var args = message.substring(1).split(' ');
    var cmd = args[0];

    args = args.splice(1);
    switch(cmd) {
      case 'activate':
      /* Only allow one active channel at a time for now - @TODO: multiple active channels */
      if (!activeChannelID) {
        console.log('activating ', channelID);
        activeChannelID = channelID;
      }
        break;
      case 'deactivate':
        if (activeChannelID === channelID) {
          console.log('deactivating ', channelID);
          activeChannelID = undefined;
        }
        break;
      case 'ping':
        bot.sendMessage({
          to: channelID,
          message: 'alive'
        });
      default:
      break;
    }
  }
});

bot.on('any', function (event) {
  const type = event.t;
  const data = event.d;
  let userID;
  let channelID;
  if (data) {
    userID = data.user_id;
    channelID = data.channel_id;
  }

  if (type === 'MESSAGE_REACTION_ADD' && channelID && data.message_id) {
    if (isApprovedUser(userID) && isTweetEmoji(data.emoji)) {
      bot.getMessage({ channelID: channelID, messageID: data.message_id }, (err, msg) => {
        if (msg) {
          /* Only tweet once */
          const reactions = msg.reactions;
          const tweetCount = reactions.find(item => isTweetEmoji(item.emoji)).count;
          if (tweetCount > 1) {
            console.log('more than one reaction')
            return;
          }

          if (msg.attachments.length) {
            console.log('tweeting with attachments from reaction');
            tweetWithAttachments({ d: msg }, msg.content);
          } else {
            console.log('tweeting from reaction')
            tweet(msg.content);
          }
        } else {
          console.log('no message found', channelID, data.message_id);
        }
      });
    }
  }
});

bot.on('disconnect', function (errMsg, code) {
  logger.error('DISCONNECTED', errMsg);
  logger.error('CODE: ', code);

  bot.connect();
});


text: docker build -t kaltura-broker .


text:
using RestSharp.Serializers;

namespace Harvest.Net.Models
{
    /// <summary>
    /// A failed request or missing resource, in which case an error message may be returned.
    /// </summary>
    [SerializeAs(Name = "request")]
    public class ErrorResult
    {
        /// <summary>
        /// Message of the error.
        /// </summary>
        public string Message { get; set; }
    }
}


text:
var nodeStatic = require('node-static');
var tanxServer = require('tanx');

var internals = {
  node_env: process.env.NODE_ENVIRONMENT || 'development',
  host: process.env.MOZ_TANX_HOST || process.env.HOST || '0.0.0.0',
  port: process.env.MOZ_TANX_PORT || process.env.PORT || 4000
};

function Server(requestListener, opts) {
  if (typeof requestListener === 'object') {
    opts = requestListener;
  }
  if (!opts) {
    opts = {};
  }

  var tanxServerOpts = {
    host: opts.host || internals.host,
    port: opts.port || internals.port
  };

  var staticOpts = {
    cache: false
  };

  console.log('[%s] Server listening on http://%s:%s',
    internals.node_env, internals.host, internals.port);

  return tanxServer(function (req, res) {
    // Set CORS headers.
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.setHeader('Access-Control-Request-Method', '*');
    res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
    res.setHeader('Access-Control-Allow-Headers', '*');
    if (req.method === 'OPTIONS') {
      res.writeHead(200);
      res.end();
      return;
    }

    var fileServer = new nodeStatic.Server('./node_modules/tanx-client/',
                                           staticOpts);
    req.addListener('end', function (err) {
      if (err) {
        console.warn('[%s] [%s] %s', req.method, err.status, req.url);
      }

      fileServer.serve(req, res);
    }).resume();

    // Just a nicety for if this server is ever required as a module.
    if (typeof requestListener === 'function') {
      requestListener(req, res);
    }
  }, tanxServerOpts);
}

// If the server is called directly (i.e., not required as a module),
// immediately start the server.
if (require.main === module) {
    Server();
}

module.exports = Server;


text:
/**
 * Sample plugin.
 */
Draw.loadPlugin(function(ui) {

	var graph = ui.editor.graph;
	var enabled = true;
	var counter = 0;

	var graphViewResetValidationState = graph.view.resetValidationState;

	graph.view.resetValidationState = function()
	{
		graphViewResetValidationState.apply(this, arguments);
		this.numberCounter = 0;
	};

	var graphViewValidateCellState = graph.view.validateCellState;

	graph.view.validateCellState = function(cell, recurse)
	{
		var state = graphViewValidateCellState.apply(this, arguments);
		recurse = (recurse != null) ? recurse : true;

		if (recurse && state != null && graph.model.isVertex(state.cell) &&
			mxUtils.getValue(state.style, 'numbered', 1) == 1)
		{
			this.numberCounter++;
			this.redrawNumberShape(state);
		}

		return state;
	};

	graph.view.redrawNumberShape = function(state)
	{
		var numbered = mxUtils.getValue(state.style, 'numbered', 1) == 1;
		var value = '
' +
			(this.numberCounter) + '
';

		if (enabled && numbered && graph.model.isVertex(state.cell) &&
			state.shape != null && state.secondLabel == null)
		{
			state.secondLabel = new mxText(value, new mxRectangle(),
					mxConstants.ALIGN_LEFT, mxConstants.ALIGN_BOTTOM);

			// Styles the label
			state.secondLabel.size = 12;
			state.secondLabel.dialect = mxConstants.DIALECT_STRICTHTML;
			graph.cellRenderer.initializeLabel(state, state.secondLabel);
		}

		if (state.secondLabel != null)
		{
			if (!numbered)
			{
				state.secondLabel.destroy();
				state.secondLabel = null;
			}
			else
			{
				var scale = graph.getView().getScale();
				var bounds = new mxRectangle(state.x + state.width - 4 * scale, state.y + 4 * scale, 0, 0);
				state.secondLabel.value = value;
				state.secondLabel.state = state;
				state.secondLabel.scale = scale;
				state.secondLabel.bounds = bounds;
				state.secondLabel.redraw();
			}
		}
	};

	// Destroys the shape number
	var destroy = graph.cellRenderer.destroy;
	graph.cellRenderer.destroy = function(state)
	{
		destroy.apply(this, arguments);

		if (state.secondLabel != null)
		{
			state.secondLabel.destroy();
			state.secondLabel = null;
		}
	};

	graph.cellRenderer.getShapesForState = function(state)
	{
		return [state.shape, state.text, state.secondLabel, state.control];
	};

	// Extends View menu
	mxResources.parse('number=Number');

    // Adds action
    var action = ui.actions.addAction('number...', function()
    {
		enabled = !enabled;
		graph.refresh();
    });

    action.setToggleAction(true);
	action.setSelectedCallback(function() { return enabled; });

	var menu = ui.menus.get('view');
	var oldFunct = menu.funct;

	menu.funct = function(menu, parent)
	{
		oldFunct.apply(this, arguments);

		ui.menus.addMenuItems(menu, ['-', 'number'], parent);
	};

	// Forces refresh if file was loaded before plugin
	if (ui.getCurrentFile() != null)
	{
		graph.refresh();
	}
});


text:
Yelp API Examples
=================

Examples and libraries for working with the Yelp API.


text:
<?php

namespace WellCommerce\Bundle\AdminBundle\Repository;

use Doctrine\ORM\NoResultException;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface;
use WellCommerce\Bundle\AdminBundle\Entity\UserInterface;
use WellCommerce\Bundle\CoreBundle\Repository\EntityRepository;

/**
 * Class UserRepository
 *
 * @author Adam Piotrowski <adam@wellcommerce.org>
 */
class UserRepository extends EntityRepository implements UserRepositoryInterface
{
    public function refreshUser(BaseUserInterface $user)
    {
        $class = get_class($user);
        if (!$this->supportsClass($class)) {
            throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $class));
        }

        return $this->loadUserByUsername($user->getUsername());
    }

    public function supportsClass($class)
    {
        return $this->getEntityName() === $class || is_subclass_of($class, $this->getEntityName());
    }

    public function loadUserByUsername($username)
    {
        $queryBuilder = $this->createQueryBuilder('u');
        $queryBuilder->select('u, r');
        $queryBuilder->leftJoin('u.roles', 'r');
        $queryBuilder->where('u.username = :username OR u.email = :email');
        $queryBuilder->setParameter('username', $username);
        $queryBuilder->setParameter('email', $username);

        try {
            $user = $queryBuilder->getQuery()->getSingleResult();
        } catch (NoResultException $e) {
            $msg = sprintf('Unable to find an active admin identified by "%s".', $username);

            throw new UsernameNotFoundException($msg);
        }

        return $user;
    }

    public function getUserPermission(string $name, UserInterface $user)
    {
        $queryBuilder = $this->createQueryBuilder('u');
        $queryBuilder->select('ugp.id');
        $queryBuilder->leftJoin('u.groups', 'ug');
        $queryBuilder->leftJoin('ug.permissions', 'ugp');
        $queryBuilder->where('u.id = :id');
        $queryBuilder->andWhere('ugp.name = :name');
        $queryBuilder->andWhere('ugp.enabled = :enabled');
        $queryBuilder->setParameter('id', $user->getId());
        $queryBuilder->setParameter('name', $name);
        $queryBuilder->setParameter('enabled', 1);

        return $queryBuilder->getQuery()->getResult();
    }
}


text:
namespace base {
namespace internal {

#if !BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS
template <typename Dst, typename Src>
struct SaturateFastAsmOp {
  static constexpr bool is_supported = false;
  static constexpr Dst Do(Src) {
    // Force a compile failure if instantiated.
    return CheckOnFailure::template HandleFailure<Dst>();
  }
};
#endif  // BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS
#undef BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS

// The following special case a few specific integer conversions where we can
// eke out better performance than range checking.
template <typename Dst, typename Src, typename Enable = void>
struct IsValueInRangeFastOp {
  static constexpr bool is_supported = false;
  static constexpr bool Do(Src value) {
    // Force a compile failure if instantiated.
    return CheckOnFailure::template HandleFailure<bool>();
  }
};

// Signed to signed range comparison.
template <typename Dst, typename Src>
struct IsValueInRangeFastOp<
    Dst,
    Src,
    typename std::enable_if<
        std::is_integral<Dst>::value && std::is_integral<Src>::value &&
        std::is_signed<Dst>::value && std::is_signed<Src>::value &&
        !IsTypeInRangeForNumericType<Dst, Src>::value>::type> {
  static constexpr bool is_supported = true;

  static constexpr bool Do(Src value) {
    // Just downcast to the smaller type, sign extend it back to the original
    // type, and then see if it matches the original value.
    return value == static_cast<Dst>(value);
  }
};

// Signed to unsigned range comparison.
template <typename Dst, typename Src>
struct IsValueInRangeFastOp<
    Dst,
    Src,
    typename std::enable_if<
        std::is_integral<Dst>::value && std::is_integral<Src>::value &&
        !std::is_signed<Dst>::value && std::is_signed<Src>::value &&
        !IsTypeInRangeForNumericType<Dst, Src>::value>::type> {
  static constexpr bool is_supported = true;

  static constexpr bool Do(Src value) {
    // We cast a signed as unsigned to overflow negative values to the top,
    // then compare against whichever maximum is smaller, as our upper bound.
    return as_unsigned(value) <= as_unsigned(CommonMax<Src, Dst>());
  }
};

// Convenience function that returns true if the supplied value is in range
// for the destination type.
template <typename Dst, typename Src>
constexpr bool IsValueInRangeForNumericType(Src value) {
  using SrcType = typename internal::UnderlyingType<Src>::type;
  return internal::IsValueInRangeFastOp<Dst, SrcType>::is_supported
             ? internal::IsValueInRangeFastOp<Dst, SrcType>::Do(
                   static_cast<SrcType>(value))
             : internal::DstRangeRelationToSrcRange<Dst>(
                   static_cast<SrcType>(value))
                   .IsValid();
}

// checked_cast<> is analogous to static_cast<> for numeric types,
// except that it CHECKs that the specified numeric conversion will not
// overflow or underflow. NaN source will always trigger a CHECK.
template <typename Dst,
          class CheckHandler = internal::CheckOnFailure,
          typename Src>
constexpr Dst checked_cast(Src value) {
  // This throws a compile-time error on evaluating the constexpr if it can be
  // determined at compile-time as failing, otherwise it will CHECK at runtime.
  using SrcType = typename internal::UnderlyingType<Src>::type;
  return BASE_NUMERICS_LIKELY((IsValueInRangeForNumericType<Dst>(value)))
             ? static_cast<Dst>(static_cast<SrcType>(value))
             : CheckHandler::template HandleFailure<Dst>();
}

// Default boundaries for integral/float: max/infinity, lowest/-infinity, 0/NaN.
// You may provide your own limits (e.g. to saturated_cast) so long as you
// implement all of the static constexpr member functions in the class below.
template <typename T>
struct SaturationDefaultLimits : public std::numeric_limits<T> {
  static constexpr T NaN() {
    return std::numeric_limits<T>::has_quiet_NaN
               ? std::numeric_limits<T>::quiet_NaN()
               : T();
  }
  using std::numeric_limits<T>::max;
  static constexpr T Overflow() {
    return std::numeric_limits<T>::has_infinity
               ? std::numeric_limits<T>::infinity()
               : std::numeric_limits<T>::max();
  }
  using std::numeric_limits<T>::lowest;
  static constexpr T Underflow() {
    return std::numeric_limits<T>::has_infinity
               ? std::numeric_limits<T>::infinity() * -1
               : std::numeric_limits<T>::lowest();
  }
};

template <typename Dst, template <typename> class S, typename Src>
constexpr Dst saturated_cast_impl(Src value, RangeCheck constraint) {
  // For some reason clang generates much better code when the branch is
  // structured exactly this way, rather than a sequence of checks.
  return !constraint.IsOverflowFlagSet()
             ? (!constraint.IsUnderflowFlagSet() ? static_cast<Dst>(value)
                                                 : S<Dst>::Underflow())
             // Skip this check for integral Src, which cannot be NaN.
             : (std::is_integral<Src>::value || !constraint.IsUnderflowFlagSet()
                    ? S<Dst>::Overflow()
                    : S<Dst>::NaN());
}

// We can reduce the number of conditions and get slightly better performance
// for normal signed and unsigned integer ranges. And in the specific case of
// Arm, we can use the optimized saturation instructions.
template <typename Dst, typename Src, typename Enable = void>
struct SaturateFastOp {
  static constexpr bool is_supported = false;
  static constexpr Dst Do(Src value) {
    // Force a compile failure if instantiated.
    return CheckOnFailure::template HandleFailure<Dst>();
  }
};

template <typename Dst, typename Src>
struct SaturateFastOp<
    Dst,
    Src,
    typename std::enable_if<std::is_integral<Src>::value &&
                            std::is_integral<Dst>::value &&
                            SaturateFastAsmOp<Dst, Src>::is_supported>::type> {
  static constexpr bool is_supported = true;
  static constexpr Dst Do(Src value) { return SaturateFastAsmOp<Dst, Src>::Do(value); }
};

template <typename Dst, typename Src>
struct SaturateFastOp<
    Dst,
    Src,
    typename std::enable_if<std::is_integral<Src>::value &&
                            std::is_integral<Dst>::value &&
                            !SaturateFastAsmOp<Dst, Src>::is_supported>::type> {
  static constexpr bool is_supported = true;
  static constexpr Dst Do(Src value) {
    // The exact order of the following is structured to hit the correct
    // optimization heuristics across compilers. Do not change without
    // checking the emitted code.
    const Dst saturated = CommonMaxOrMin<Dst, Src>(
        IsMaxInRangeForNumericType<Dst, Src>() ||
        (!IsMinInRangeForNumericType<Dst, Src>() && IsValueNegative(value)));
    return BASE_NUMERICS_LIKELY(IsValueInRangeForNumericType<Dst>(value))
               ? static_cast<Dst>(value)
               : saturated;
  }
};

// saturated_cast<> is analogous to static_cast<> for numeric types, except
// that the specified numeric conversion will saturate by default rather than
// overflow or underflow, and NaN assignment to an integral will return 0.
// All boundary condition behaviors can be overriden with a custom handler.
template <typename Dst,
          template <typename> class SaturationHandler = SaturationDefaultLimits,
          typename Src>
constexpr Dst saturated_cast(Src value) {
  using SrcType = typename UnderlyingType<Src>::type;
  return !IsConstantEvaluated() && SaturateFastOp<Dst, SrcType>::is_supported &&
                 std::is_same<SaturationHandler<Dst>,
                              SaturationDefaultLimits<Dst>>::value
             ? SaturateFastOp<Dst, SrcType>::Do(static_cast<SrcType>(value))
             : saturated_cast_impl<Dst, SaturationHandler, SrcType>(
                   static_cast<SrcType>(value),
                   DstRangeRelationToSrcRange<Dst, SaturationHandler, SrcType>(
                       static_cast<SrcType>(value)));
}

// strict_cast<> is analogous to static_cast<> for numeric types, except that
// it will cause a compile failure if the destination type is not large enough
// to contain any value in the source type. It performs no runtime checking.
template <typename Dst, typename Src>
constexpr Dst strict_cast(Src value) {
  using SrcType = typename UnderlyingType<Src>::type;
  static_assert(UnderlyingType<Src>::is_numeric, "Argument must be numeric.");
  static_assert(std::is_arithmetic<Dst>::value, "Result must be numeric.");

  // If you got here from a compiler error, it's because you tried to assign
  // from a source type to a destination type that has insufficient range.
  // The solution may be to change the destination type you're assigning to,
  // and use one large enough to represent the source.
  // Alternatively, you may be better served with the checked_cast<> or
  // saturated_cast<> template functions for your particular use case.
  static_assert(StaticDstRangeRelationToSrcRange<Dst, SrcType>::value ==
                    NUMERIC_RANGE_CONTAINED,
                "The source type is out of range for the destination type. "
                "Please see strict_cast<> comments for more information.");

  return static_cast<Dst>(static_cast<SrcType>(value));
}

// Some wrappers to statically check that a type is in range.
template <typename Dst, typename Src, class Enable = void>
struct IsNumericRangeContained {
  static constexpr bool value = false;
};

template <typename Dst, typename Src>
struct IsNumericRangeContained<
    Dst,
    Src,
    typename std::enable_if<ArithmeticOrUnderlyingEnum<Dst>::value &&
                            ArithmeticOrUnderlyingEnum<Src>::value>::type> {
  static constexpr bool value =
      StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
      NUMERIC_RANGE_CONTAINED;
};

// StrictNumeric implements compile time range checking between numeric types by
// wrapping assignment operations in a strict_cast. This class is intended to be
// used for function arguments and return types, to ensure the destination type
// can always contain the source type. This is essentially the same as enforcing
// -Wconversion in gcc and C4302 warnings on MSVC, but it can be applied
// incrementally at API boundaries, making it easier to convert code so that it
// compiles cleanly with truncation warnings enabled.
// This template should introduce no runtime overhead, but it also provides no
// runtime checking of any of the associated mathematical operations. Use
// CheckedNumeric for runtime range checks of the actual value being assigned.
template <typename T>
class StrictNumeric {
 public:
  using type = T;

  constexpr StrictNumeric() : value_(0) {}

  // Copy constructor.
  template <typename Src>
  constexpr StrictNumeric(const StrictNumeric<Src>& rhs)
      : value_(strict_cast<T>(rhs.value_)) {}

  // This is not an explicit constructor because we implicitly upgrade regular
  // numerics to StrictNumerics to make them easier to use.
  template <typename Src>
  constexpr StrictNumeric(Src value)  // NOLINT(runtime/explicit)
      : value_(strict_cast<T>(value)) {}

  // If you got here from a compiler error, it's because you tried to assign
  // from a source type to a destination type that has insufficient range.
  // The solution may be to change the destination type you're assigning to,
  // and use one large enough to represent the source.
  // If you're assigning from a CheckedNumeric<> class, you may be able to use
  // the AssignIfValid() member function, specify a narrower destination type to
  // the member value functions (e.g. val.template ValueOrDie<Dst>()), use one
  // of the value helper functions (e.g. ValueOrDieForType<Dst>(val)).
  // If you've encountered an _ambiguous overload_ you can use a static_cast<>
  // to explicitly cast the result to the destination type.
  // If none of that works, you may be better served with the checked_cast<> or
  // saturated_cast<> template functions for your particular use case.
  template <typename Dst,
            typename std::enable_if<
                IsNumericRangeContained<Dst, T>::value>::type* = nullptr>
  constexpr operator Dst() const {
    return static_cast<typename ArithmeticOrUnderlyingEnum<Dst>::type>(value_);
  }

 private:
  const T value_;
};

// Convience wrapper returns a StrictNumeric from the provided arithmetic type.
template <typename T>
constexpr StrictNumeric<typename UnderlyingType<T>::type> MakeStrictNum(
    const T value) {
  return value;
}

#define BASE_NUMERIC_COMPARISON_OPERATORS(CLASS, NAME, OP)              \
  template <typename L, typename R,                                     \
            typename std::enable_if<                                    \
                internal::Is##CLASS##Op<L, R>::value>::type* = nullptr> \
  constexpr bool operator OP(const L lhs, const R rhs) {                \
    return SafeCompare<NAME, typename UnderlyingType<L>::type,          \
                       typename UnderlyingType<R>::type>(lhs, rhs);     \
  }

BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsLess, <)
BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsLessOrEqual, <=)
BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsGreater, >)
BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsGreaterOrEqual, >=)
BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsEqual, ==)
BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsNotEqual, !=)

}  // namespace internal

using internal::as_signed;
using internal::as_unsigned;
using internal::checked_cast;
using internal::strict_cast;
using internal::saturated_cast;
using internal::SafeUnsignedAbs;
using internal::StrictNumeric;
using internal::MakeStrictNum;
using internal::IsValueInRangeForNumericType;
using internal::IsTypeInRangeForNumericType;
using internal::IsValueNegative;

// Explicitly make a shorter size_t alias for convenience.
using SizeT = StrictNumeric<size_t>;

// floating -> integral conversions that saturate and thus can actually return
// an integral type.  In most cases, these should be preferred over the std::
// versions.
template <typename Dst = int,
          typename Src,
          typename = std::enable_if_t<std::is_integral<Dst>::value &&
                                      std::is_floating_point<Src>::value>>
Dst ClampFloor(Src value) {
  return saturated_cast<Dst>(std::floor(value));
}
template <typename Dst = int,
          typename Src,
          typename = std::enable_if_t<std::is_integral<Dst>::value &&
                                      std::is_floating_point<Src>::value>>
Dst ClampCeil(Src value) {
  return saturated_cast<Dst>(std::ceil(value));
}
template <typename Dst = int,
          typename Src,
          typename = std::enable_if_t<std::is_integral<Dst>::value &&
                                      std::is_floating_point<Src>::value>>
Dst ClampRound(Src value) {
  const Src rounded =
      (value >= 0.0f) ? std::floor(value + 0.5f) : std::ceil(value - 0.5f);
  return saturated_cast<Dst>(rounded);
}

}  // namespace base

#endif  // BASE_NUMERICS_SAFE_CONVERSIONS_H_


text:
<?php

declare(strict_types=1);

namespace Telegram\API\Method;

use Telegram\API\Type;
use Telegram\API\Base\Abstracts\ABaseObject;
use Telegram\API\Base\Interfaces\IOutbound;
use Telegram\API\Bot;

/**
 * Class UnbanChatMember
 * @package Telegram\API\Method
 * @property string|int|float $chatId
 * @property int $userId
 * @property null|bool $onlyIfBanned
 */
class UnbanChatMember extends ABaseObject implements IOutbound {

    /**
     * @inheritdoc
     */
    public static function GetDatamodel() : array {
        $datamodel = [
            'chatId'        => ['type' => [ABaseObject::T_STRING, ABaseObject::T_INT, ABaseObject::T_FLOAT],    'optional' => FALSE,    'external' => 'chat_id'],
            'userId'        => ['type' => ABaseObject::T_INT,                                                   'optional' => FALSE,    'external' => 'user_id'],
            'onlyIfBanned'  => ['type' => ABaseObject::T_BOOL,                                                  'optional' => TRUE,     'external' => 'only_if_banned']
        ];
        return array_merge(parent::GetDatamodel(), $datamodel);
    }

    /**
     * @inheritdoc
     */
    public function call(Bot $bot) {
        $reply = $bot->call('unbanChatMember', $this);
        if ($reply instanceof \stdClass) {
            if ($reply->ok) {
                if (!empty($reply->result)) {
                    return $reply->result;
                }
            } else {
                if (isset($reply->description)) {
                    throw new \Exception("Could not properly execute the request!\n" . $reply->description);
                } else {
                    throw new \Exception('An unknown error has occurred!');
                }
            }
        }
    }
}


text:
@interface BWObjectMapping ()

@end

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
@implementation BWObjectMapping

////////////////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithObjectClass:(Class)objectClass {
    self = [self init];
    if (self) {
        self.objectClass = objectClass;
        _attributeMappings = [NSMutableDictionary dictionary];
        _hasOneMappings = [NSMutableDictionary dictionary];
        _hasManyMappings = [NSMutableDictionary dictionary];

        [self generateAutoMapping];
    }
    return self;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)mappingForObject:(Class)objectClass block:(void(^)(BWObjectMapping *mapping))block {
    BWObjectMapping *mapping = [[self alloc] initWithObjectClass:objectClass];
    if (block) {
        block(mapping);
    }
    return mapping;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)mappingForObject:(Class)objectClass {
    return [self mappingForObject:objectClass block:nil];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)mapPrimaryKeyAttribute:(NSString *)primaryKey toAttribute:(NSString *)attribute {
    BWObjectAttributeMapping *attributeMapping = [BWObjectAttributeMapping attributeMapping];
    attributeMapping.keyPath = primaryKey;
    attributeMapping.attribute = attribute;

    self.primaryKeyAttribute = attributeMapping;
    [self addAttributeMappingToObjectMapping:attributeMapping];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)mapKeyPath:(NSString *)keyPath toAttribute:(NSString *)attribute {
    BWObjectAttributeMapping *attributeMapping = [BWObjectAttributeMapping attributeMapping];
    attributeMapping.keyPath = keyPath;
    attributeMapping.attribute = attribute;

    [self addAttributeMappingToObjectMapping:attributeMapping];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)mapKeyPath:(NSString *)keyPath toAttribute:(NSString *)attribute dateFormat:(NSString *)dateFormat {
    BWObjectAttributeMapping *attributeMapping = [BWObjectAttributeMapping attributeMapping];
    attributeMapping.keyPath = keyPath;
    attributeMapping.attribute = attribute;
    attributeMapping.dateFormat = dateFormat;

    [self addAttributeMappingToObjectMapping:attributeMapping];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)mapKeyPath:(NSString *)keyPath
       toAttribute:(NSString *)attribute
        valueBlock:(BWObjectMappingValueBlock)valueBlock {

    BWObjectAttributeMapping *attributeMapping = [BWObjectAttributeMapping attributeMapping];
    attributeMapping.keyPath = keyPath;
    attributeMapping.attribute = attribute;
    attributeMapping.valueBlock = valueBlock;

    [self addAttributeMappingToObjectMapping:attributeMapping];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)mapAttributeFromArray:(NSArray *)attributes {
    [attributes enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        [self mapKeyPath:obj toAttribute:obj];
    }];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)mapRailsAttributeFormatFromCoreDataFormatWithArray:(NSArray *)attributes {
    [attributes enumerateObjectsUsingBlock:^(NSString *coreDataAttribute, NSUInteger idx, BOOL *stop) {
        NSString *railsAttribute = [coreDataAttribute BWO_stringByUnderscoringWord];
        [self mapKeyPath:railsAttribute toAttribute:coreDataAttribute];
    }];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)mapAttributeFromDictionary:(NSDictionary *)attributes {
    [attributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
        [self mapKeyPath:key toAttribute:obj];
    }];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasManyWithRelationMapping:(BWObjectMapping *)mapping
                        forKeyPath:(NSString *)keyPath {

    [self hasManyWithRelationMapping:mapping forKeyPath:keyPath attribute:nil];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasManyWithRelationMapping:(BWObjectMapping *)mapping
                        forKeyPath:(NSString *)keyPath
                         attribute:(NSString *)attribute {

    [self addRelationAttributeMappingForKeyPath:keyPath
                                      attribute:attribute
                                  objectMapping:mapping
                             objectMappingClass:nil
                                        hasMany:YES];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasManyWithRelationObjectMappingClass:(Class)objectMappingClass
                                   forKeyPath:(NSString *)keyPath {

    [self hasManyWithRelationObjectMappingClass:objectMappingClass forKeyPath:keyPath attribute:nil];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasManyWithRelationObjectMappingClass:(Class)objectMappingClass
                                   forKeyPath:(NSString *)keyPath
                                    attribute:(NSString *)attribute {

    [self addRelationAttributeMappingForKeyPath:keyPath
                                      attribute:attribute
                                  objectMapping:nil
                             objectMappingClass:objectMappingClass
                                        hasMany:YES];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasOneWithRelationMapping:(BWObjectMapping *)mapping
                       forKeyPath:(NSString *)keyPath {

    [self hasOneWithRelationMapping:mapping forKeyPath:keyPath attribute:nil];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasOneWithRelationMapping:(BWObjectMapping *)mapping
                       forKeyPath:(NSString *)keyPath
                        attribute:(NSString *)attribute {

    [self addRelationAttributeMappingForKeyPath:keyPath
                                      attribute:attribute
                                  objectMapping:mapping
                             objectMappingClass:nil
                                        hasMany:NO];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasOneWithRelationObjectMappingClass:(Class)objectMappingClass
                                  forKeyPath:(NSString *)keyPath {

    [self hasOneWithRelationObjectMappingClass:objectMappingClass forKeyPath:keyPath attribute:nil];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)hasOneWithRelationObjectMappingClass:(Class)objectMappingClass
                                  forKeyPath:(NSString *)keyPath
                                   attribute:(NSString *)attribute {

    [self addRelationAttributeMappingForKeyPath:keyPath
                                      attribute:attribute
                                  objectMapping:nil
                             objectMappingClass:objectMappingClass
                                        hasMany:NO];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)setObjectClass:(Class)objectClass {
    _objectClass = objectClass;
    _objectClassString = NSStringFromClass([objectClass class]);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString *)description {
    return [NSString stringWithFormat:@"%@ %@", self.objectClassString, self.rootKeyPath];
}

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark Private

////////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)isPropertyPrimitive:(NSString *)propertyName {
    NSString *propertyType = [BWObjectValueMapper propertyStringTypeForName:propertyName klass:self.objectClass];
    Class propertyKlass = NSClassFromString(propertyType);

    if ([NSNumber class] == propertyKlass ||
        [NSString class] == propertyKlass ||
        [NSDate class] == propertyKlass) {
        return YES;
    }

    return NO;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)isPropertyPrimaryKey:(NSString *)propertyName {
    if ([propertyName rangeOfString:@"ID"].location == NSNotFound) {
        return NO;
    }

    NSString *className = [NSStringFromClass(self.objectClass) lowercaseString];
    NSString *propertyEscapedName = [[propertyName stringByReplacingOccurrencesOfString:@"ID" withString:@""] lowercaseString];

    if ([className isEqualToString:propertyEscapedName]) {
        return YES;
    }

    return NO;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)generateAutoMapping {
    Class klass = self.objectClass;

    while ([NSObject class] != klass) {
        unsigned int outCount, i;
        objc_property_t *properties = class_copyPropertyList(klass, &outCount);

        for(i = 0; i < outCount; i++) {
            objc_property_t property = properties[i];
            [self generateMappingForProperty:property];
        }
        free(properties);

        klass = class_getSuperclass(klass);
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)generateMappingForProperty:(objc_property_t)property {
    NSString *propertyName = @(property_getName(property));
    if ([self isPropertyPrimitive:propertyName]) {

        if ([self isPropertyPrimaryKey:propertyName]) {
            [self mapPrimaryKeyAttribute:@"id" toAttribute:propertyName];

        } else if ([[BWObjectMapper shared].defaultMappings objectForKey:propertyName]) {
            [self mapKeyPath:[[BWObjectMapper shared].defaultMappings objectForKey:propertyName]
                 toAttribute:propertyName];

        } else {
            [self mapRailsAttributeFormatFromCoreDataFormatWithArray:@[ propertyName ]];
        }
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)addRelationAttributeMappingForKeyPath:(NSString *)keyPath
                                    attribute:(NSString *)attribute
                                objectMapping:(BWObjectMapping *)objectMapping
                           objectMappingClass:(Class)objectMappingClass
                                      hasMany:(BOOL)hasMany {

    BWOjectRelationAttributeMapping *attributeMapping = [[BWOjectRelationAttributeMapping alloc] init];

    attributeMapping.keyPath = keyPath;
    attributeMapping.attribute = attribute ?: keyPath;
    attributeMapping.objectMapping = objectMapping;
    attributeMapping.objectMappingClass = objectMappingClass;

    if (hasMany) {
        [self.hasManyMappings setValue:attributeMapping forKey:keyPath];
    } else {
        [self.hasOneMappings setValue:attributeMapping forKey:keyPath];
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)addAttributeMappingToObjectMapping:(BWObjectAttributeMapping *)attributeMapping {
    [self.attributeMappings setObject:attributeMapping forKey:attributeMapping.attribute];
}

@end


text:
<?php define( 'K_TEMPLATE_NAME', 'arrangements.php' ); ?>
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Arrangements'>

</cms:template>
<cms:template>

     <cms:editable
        name='product1_header'
        label='Product 1 Header'
        type='text'
        order='1'
      />
    <cms:editable
        name='product1_desc'
        label='Product 1 Description'
        type='text'
        order='2'
      />

    <cms:editable
        name='image1'
        type='image'
        desc='Upload first product image here'
        order='3'
    />

    <cms:editable
        name='product2_header'
        label='Product 2 Header'
        type='text'
        order='4'
      />
    <cms:editable
        name='product2_desc'
        label='Product 2 Description'
        type='text'
        order='5'
      />

    <cms:editable
        name='image2'
        type='image'
        desc='Upload second product image here'
        order='6'
    />

    <cms:editable
        name='product3_header'
        label='Product 3 Header'
        type='text'
        order='7'
      />
    <cms:editable
        name='product3_desc'
        label='Product 3 Description'
        type='text'
        order='8'
      />

    <cms:editable
        name='image3'
        type='image'
        desc='Upload third product image here'
        order='9'
    />

    <cms:editable
        name='product4_header'
        label='Product 3 Header'
        type='text'
        order='10'
      />
    <cms:editable
        name='product4_desc'
        label='Product 4 Description'
        type='text'
        order='11'
      />

    <cms:editable
        name='image4'
        type='image'
        desc='Upload forth product image here'
        order='12'
    />

    <cms:editable
        name='product5_header'
        label='Product 5 Header'
        type='text'
        order='13'
      />
   <cms:editable
        name='product5_desc'
        label='Product 5 Description'
        type='text'
        order='14'
      />

    <cms:editable
        name='image5'
        type='image'
        desc='Upload fifth product image here'
        order='15'
    />

    <cms:editable
        name='product6_header'
        label='Product 6 Header'
        type='text'
        order='16'
      />
  <cms:editable
        name='product6_desc'
        label='Product 6 Description'
        type='text'
        order='17'
      />
    <cms:editable
        name='image6'
        type='image'
        desc='Upload fifth product image here'
        order='18'
    />

    <cms:editable
        name='product7_header'
        label='Product 7 Header'
        type='text'
        order='19'
      />

  <cms:editable
        name='product7_desc'
        label='Product 7 Description'
        type='text'
        order='20'
      />

    <cms:editable
        name='image7'
        type='image'
        desc='Upload fifth product image here'
        order='21'
    />
    <cms:editable
        name='product8_header'
        label='Product 6 Header'
        type='text'
        order='22'
      />
  <cms:editable
        name='product8_desc'
        label='Product 8 Description'
        type='text'
        order='23'
      />
    <cms:editable
        name='image8'
        type='image'
        desc='Upload fifth product image here'
        order='24'
    />
  </cms:template>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Avalon Floral - Home</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/shop-homepage.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
   <link href='http://fonts.googleapis.com/css?family=Lato:700' rel='stylesheet' type='text/css'>

<link type="text/css"
  id="snipcart-theme"
  href="https://app.snipcart.com/themes/base/snipcart.css"
  rel="stylesheet" />

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                Avalon Floral

   <button type="button" class="btn dropdown-toggle" id="dropdownMenu1"
      data-toggle="dropdown">
       .Shop

   </button>

         Hand-Crafted Arrangements

         Build Your Own

            Subscription

                        About

                        Services

                        <img id ="fbook"src = "images/cart.jpg"

                        <img id ="fbook"src = "images/facebook.jpg"

Arrangements

                    <img src="<cms:show image1 />" alt="">

<cms:show product1_header />

<cms:show product1_desc />

                            <button class="snipcart-add-item"

  data-item-id="roses1"
  data-item-name="Roses"
  data-item-price="10.50"
  data-item-image="images/roes3.jpg"
   data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

                    <img src="<cms:show image2 />" alt="Grand Display Arrangement">

<cms:show product2_header />

<cms:show product2_desc />

                            <button class="snipcart-add-item"

  data-item-id="grand"
  data-item-name="Grand Display"
  data-item-price="10.50"
  data-item-image="images/grand2.jpg"
  data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

                    <img src="<cms:show image3 />" alt="">

<cms:show product3_header />

<cms:show product3_desc />

                            <button class="snipcart-add-item"

  data-item-id="designers"
  data-item-name="Designers Mix"
  data-item-price="10.50"
  data-item-image="images/designers2.jpg"
    data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

                    <img src="<cms:show image4 />" alt="Drama Arrangement">

<cms:show product4_header />

<cms:show product4_desc />

                            <button class="snipcart-add-item"

  data-item-id="drama"
  data-item-name="Drama Display"
  data-item-price="10.50"
  data-item-image="images/drama2.jpg"
    data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

                    <img src="<cms:show image5 />" alt="">

<cms:show product5_header />

<cms:show product5_desc />

                            <button class="snipcart-add-item"

  data-item-id="wild"
  data-item-name="Wild Flower Flavor"
  data-item-price="10.50"
  data-item-image="images/wild2.jpg"
    data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

                    <img src="<cms:show image6 />" alt="">

<cms:show product6_header />

<cms:show product6_desc />

                            <button class="snipcart-add-item"

  data-item-id="green"
  data-item-name="Green & Blooming"
  data-item-price="10.50"
  data-item-image="images/green2.jpg"
    data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

                    <img src="<cms:show image7 />" alt="">

<cms:show product7_header />

<cms:show product7_desc />

                            <button class="snipcart-add-item"

  data-item-id="seasonal"
  data-item-name="Seasonal Bouquet"
  data-item-price="10.50"
  data-item-image="images/seasonal2.jpg"
    data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

                    <img src="<cms:show image8 />" alt="">

<cms:show product8_header />

<cms:show product8_desc />

                            <button class="snipcart-add-item"

  data-item-id="special"
  data-item-name="Someone Special"
  data-item-price="10.50"
  data-item-image="images/spontaneous2.jpg"
   data-item-url="http://yoda.cs.uwec.edu/cs321/students/muganrp/Avalon/arrangements.html">Buy Now</button>
                            More Info

504 Water Street | Eau Claire, WI 54703 | (715) 838.8880 |  avalonfloralso@gmail.com

Copyright © Avalon Floral 2014

 <?php COUCH::invoke(); ?>


text:
#ifndef _IVW_QTEDITOR_DEFINE_H_
#define _IVW_QTEDITOR_DEFINE_H_

#ifdef INVIWO_ALL_DYN_LINK  // DYNAMIC
// If we are building DLL files we must declare dllexport/dllimport
#ifdef IVW_QTEDITOR_EXPORTS
#ifdef _WIN32
#define IVW_QTEDITOR_API __declspec(dllexport)
#else  // UNIX (GCC)
#define IVW_QTEDITOR_API __attribute__((visibility("default")))
#endif
#else
#ifdef _WIN32
#define IVW_QTEDITOR_API __declspec(dllimport)
#else
#define IVW_QTEDITOR_API
#endif
#endif
#else  // STATIC
#define IVW_QTEDITOR_API
#endif

#endif /* _IVW_QTEDITOR_DEFINE_H_ */


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

/**
 * The core package contains classes for network messages like {@link org.bitcoinj.core.Block} and
 * {@link org.bitcoinj.core.Transaction}, peer connectivity via {@link org.bitcoinj.core.PeerGroup},
 * and block chain management.
 * If what you're doing can be described as basic bitcoin tasks, the code is probably found here.
 * To learn more please consult the documentation on the website.
 */
package org.bitcoinj.core;


text:
package android.content.pm;

import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
import static android.content.pm.PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;

import android.util.ArraySet;

import com.android.internal.util.ArrayUtils;

/**
 * Per-user state information about a package.
 * @hide
 */
public class PackageUserState {
    public long ceDataInode;
    public boolean installed;
    public boolean stopped;
    public boolean notLaunched;
    public boolean hidden; // Is the app restricted by owner / admin
    public boolean suspended;
    public boolean blockUninstall;
    public int enabled;
    public String lastDisableAppCaller;
    public int domainVerificationStatus;
    public int appLinkGeneration;

    public ArraySet<String> disabledComponents;
    public ArraySet<String> enabledComponents;

    public PackageUserState() {
        installed = true;
        hidden = false;
        suspended = false;
        enabled = COMPONENT_ENABLED_STATE_DEFAULT;
        domainVerificationStatus =
                PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
    }

    public PackageUserState(PackageUserState o) {
        ceDataInode = o.ceDataInode;
        installed = o.installed;
        stopped = o.stopped;
        notLaunched = o.notLaunched;
        hidden = o.hidden;
        suspended = o.suspended;
        blockUninstall = o.blockUninstall;
        enabled = o.enabled;
        lastDisableAppCaller = o.lastDisableAppCaller;
        domainVerificationStatus = o.domainVerificationStatus;
        appLinkGeneration = o.appLinkGeneration;
        disabledComponents = ArrayUtils.cloneOrNull(o.disabledComponents);
        enabledComponents = ArrayUtils.cloneOrNull(o.enabledComponents);
    }

    /**
     * Test if this package is installed.
     */
    public boolean isInstalled(int flags) {
        return (this.installed && !this.hidden)
                || (flags & PackageManager.MATCH_UNINSTALLED_PACKAGES) != 0;
    }

    /**
     * Test if the given component is considered installed, enabled and a match
     * for the given flags.
     *
     * <p>
     * Expects at least one of {@link PackageManager#MATCH_DIRECT_BOOT_AWARE} and
     * {@link PackageManager#MATCH_DIRECT_BOOT_UNAWARE} are specified in {@code flags}.
     * </p>
     */
    public boolean isMatch(ComponentInfo componentInfo, int flags) {
        if (!isInstalled(flags)) return false;
        if (!isEnabled(componentInfo, flags)) return false;

        if ((flags & MATCH_SYSTEM_ONLY) != 0) {
            if (!componentInfo.applicationInfo.isSystemApp()) {
                return false;
            }
        }

        final boolean matchesUnaware = ((flags & MATCH_DIRECT_BOOT_UNAWARE) != 0)
                && !componentInfo.directBootAware;
        final boolean matchesAware = ((flags & MATCH_DIRECT_BOOT_AWARE) != 0)
                && componentInfo.directBootAware;
        return matchesUnaware || matchesAware;
    }

    /**
     * Test if the given component is considered enabled.
     */
    public boolean isEnabled(ComponentInfo componentInfo, int flags) {
        if ((flags & MATCH_DISABLED_COMPONENTS) != 0) {
            return true;
        }

        // First check if the overall package is disabled; if the package is
        // enabled then fall through to check specific component
        switch (this.enabled) {
            case COMPONENT_ENABLED_STATE_DISABLED:
            case COMPONENT_ENABLED_STATE_DISABLED_USER:
                return false;
            case COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED:
                if ((flags & MATCH_DISABLED_UNTIL_USED_COMPONENTS) == 0) {
                    return false;
                }
            case COMPONENT_ENABLED_STATE_DEFAULT:
                if (!componentInfo.applicationInfo.enabled) {
                    return false;
                }
            case COMPONENT_ENABLED_STATE_ENABLED:
                break;
        }

        // Check if component has explicit state before falling through to
        // the manifest default
        if (ArrayUtils.contains(this.enabledComponents, componentInfo.name)) {
            return true;
        }
        if (ArrayUtils.contains(this.disabledComponents, componentInfo.name)) {
            return false;
        }

        return componentInfo.enabled;
    }
}


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

namespace Eimbo.Aplicativo.Controlador.ModuloAtendimento.Tipo
{
    public enum TipoEstadoAtendimento
    {
        DigitacaoCabecalho = 0,
        DigitacaoItens = 1
    }
}


text:
#!/usr/bin/env python

from setuptools import setup
from setuptools.command.install import install
import os
import os.path
import sys
import glob

install_requires = [pkg_name.rstrip('\r\n') for pkg_name in open('requirements.txt').readlines()]

# version
here = os.path.dirname(os.path.abspath(__file__))
version = next(
    (line.split('=')[1].strip().replace("'", '')
     for line in open(os.path.join(here, 'scopyon', '__init__.py'))
     if line.startswith('__version__ = ')),
    '0.0.0dev')  ## default

def readme():
    with open('README.md') as f:
        return f.read()

class verify_version_command(install):
    description = "verify that the git tag matches the version"

    def run(self):
        tag = os.getenv('CIRCLE_TAG')
        if tag is not None and tag != 'v' + version:
            info = "Git tag: {0} does not match the version of this library: {1}".format(tag, version)
            sys.exit(info)

setup(
    name='scopyon',
    version=version,
    url='https://github.com/ecell/scopyon',
    description='Monte Carlo simulation toolkit for bioimaging systems',
    long_description=readme(),
    long_description_content_type='text/markdown',
    author='Masaki Watabe',
    author_email='masaki@riken.jp',
    maintainer='Kazunari Kaizu',
    maintainer_email='kaizu@riken.jp',
    packages=['scopyon', 'scopyon.analysis'],
    package_dir={'scopyon': 'scopyon', 'scopyon.analysis': 'scopyon/analysis'},
    package_data={'scopyon': ['scopyon.yaml', 'catalog/*.txt', 'catalog/*/*.csv']},
    data_files=[('examples', ['examples/tirf.py', 'examples/tirf_000.png', 'examples/twocolor.py', 'examples/twocolor_000.png', 'examples/bleaching.py'])],
    install_requires=install_requires,
    test_suite='test',
    license='BSD-3-Clause',
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
        'Programming Language :: Python :: 3.8',
        'Programming Language :: Python :: 3 :: Only',
        'Topic :: Scientific/Engineering :: Bio-Informatics',
        # 'Topic :: Scientific/Engineering :: Physics',
        # 'Topic :: Scientific/Engineering :: Visualization',
        'License :: OSI Approved :: BSD License',
        ],
    python_requires='>=3',
    cmdclass={'verify': verify_version_command}
    )


text:
<?php

namespace frontend\controllers;

use common\models\database\TAccount;
use frontend\models\ChangeForm;
use Yii;

class UserController extends BaseController {

    public function actions() {
        return [
            'captcha' => [
                'class' => 'yii\captcha\CaptchaAction',
                'fixedVerifyCode' => null,
            ],
        ];
    }

    public function actionIndex() {
        return $this->render('index');
    }

    public function actionChangepass() {
        $model = new ChangeForm();
        if ($model->load(Yii::$app->request->post())) {
            $user = TAccount::findOne(\Yii::$app->user->getId());
            $user->pwd = md5($model->password);
            $save = $user->save(false);
            if ($save) {
                \Yii::$app->session->setFlash('success', 'Thay đổi mật khẩu thành công');
            }
            return $this->refresh();
        }
        return $this->render('changepass', [
                    'model' => $model
        ]);
    }

    public function actionAddcard() {

    }

}


text:
Launcher/installer for the h2codez modified halo 2 editing toolkit.
### Features
* Autoupdates itself and h2codez.
* GUI for new features added to tool by h2codez.
* Patches toolkit executables to load h2codez.
* Patches executable headers to allow more memory to be used.


text:
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices

' Information about this assembly is defined by the following
' attributes.
'
' change them to the information which is associated with the assembly
' you compile.

<assembly: AssemblyTitle("xtag")>
<assembly: AssemblyDescription("")>
<assembly: AssemblyConfiguration("")>
<assembly: AssemblyCompany("")>
<assembly: AssemblyProduct("xtag")>
<assembly: AssemblyCopyright("Copyright 2015")>
<assembly: AssemblyTrademark("")>
<assembly: AssemblyCulture("")>

' This sets the default COM visibility of types in the assembly to invisible.
' If you need to expose a type to COM, use <ComVisible(true)> on that type.
<assembly: ComVisible(False)>

' The assembly version has following format :
'
' Major.Minor.Build.Revision
'
' You can specify all values by your own or you can build default build and revision
' numbers with the '*' character (the default):

<assembly: AssemblyVersion("1.0.*")>


text:
namespace ndnboost { namespace mpl {

template< typename Tag > struct clear_impl;
template< typename Sequence > struct clear;

}}

#endif // NDNBOOST_MPL_CLEAR_FWD_HPP_INCLUDED


text:
<component name="libraryTable">
  <library name="annotations6">
    <CLASSES>
      <root url="jar://$PROJECT_DIR$/Github_client/app/build/intermediates/exploded-aar/com.android.support/support-compat/25.0.0/annotations.zip!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
package com.anchortab.constantcontact.model

import net.liftweb._
  import common._
  import json._
    import ext._
    import Extraction._
    import JsonDSL._
  import util._
    import Helpers._

import org.joda.time._

import com.anchortab.constantcontact.ConstantContact

object ContactLists {
  implicit val formats = DefaultFormats

  object ContactListStatus {
    val Active = "ACTIVE"
    val Hidden = "HIDDEN"
  }

  case class ContactList( id:String, name:Option[String] = None, contact_count:Option[Int] = None, status:Option[String] = None) {
    def delete(implicit accessToken:String) = {
      ContactList.delete(id)
    }

    def save(implicit accessToken:String) = {
      ContactList.save(decompose(this), id)
    }
  }
  object ContactList {
    def find(id:String)(implicit accessToken:String) = {
      ConstantContact.get("lists/" + id).flatMap { json =>
        tryo(json.extract[ContactList])
      }
    }

    def findAll(implicit accessToken:String) = {
      ConstantContact.get("lists").flatMap { json =>
        tryo(json.extract[List[ContactList]])
      }
    }

    def delete(id:String)(implicit accessToken:String) = {
      ConstantContact.delete("lists/" + id).flatMap { json=>
        tryo(json.extract[Boolean])
      }
    }

    def save(contactListJson:JValue, id:String)(implicit accessToken:String) = {
      Failure("Not implemented.")
    }
  }
}