text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Testing: Getting closer</title>
    <meta name="description" content="" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="//erramuzpe.github.io/gsoc2016/themes/Casper/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//erramuzpe.github.io/gsoc2016/themes/Casper/assets/css/screen.css?v=1.0.0" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

    <link rel="canonical" href="https://erramuzpe.github.io/gsoc2016/2016/07/15/Testing-Getting-closer.html" />

    <meta property="og:site_name" content="Neurovault: Image Search for Brain Maps" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="Testing: Getting closer" />
    <meta property="og:description" content="These days I&#8217;ve been working on testing different parameters on the Engine. I started with 250 subjects on Monday, made some test with different parameters, figured out how to record better results (explained later) and decided to finally..." />
    <meta property="og:url" content="https://erramuzpe.github.io/gsoc2016/2016/07/15/Testing-Getting-closer.html" />
    <meta property="article:published_time" content="2016-07-14T22:00:00.000Z" />
    <meta property="article:modified_time" content="2016-07-19T15:39:19.018Z" />

    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="Testing: Getting closer" />
    <meta name="twitter:description" content="These days I&#8217;ve been working on testing different parameters on the Engine. I started with 250 subjects on Monday, made some test with different parameters, figured out how to record better results (explained later) and decided to finally..." />
    <meta name="twitter:url" content="https://erramuzpe.github.io/gsoc2016/2016/07/15/Testing-Getting-closer.html" />

    <meta name="generator" content="Ghost ?" />
    <link rel="alternate" type="application/rss+xml" title="Neurovault: Image Search for Brain Maps" href="https://erramuzpe.github.io/gsoc2016/rss" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">

        Home

Testing: Getting closer

                <time class="post-date" datetime="2016-07-15">15 July 2016</time>

These days I’ve been working on testing different parameters on the Engine. I started with 250 subjects on Monday, made some test with different parameters, figured out how to record better results (explained later) and decided to finally load the whole 940 subjects in my local Neurovault and calculate the whole score-set for each of the images (thus, a call to get_similar_images()). I left this running on Monady before leaving the lab and it was done by Tuesday, not a big deal after all.

Advances

My advances so far were:

1.- I ran a command on Neurovault’s  that does the following:

Iterates over different parameters (manually selected) → e.g.

resample_dim_pool = [[4,4,4],[6,6,6],[8,8,8],[10,10,10],[12,12,12],[16,16,16]]
subjects = 940
n_bits_pool = [3,4,5,7]
hash_counts_pool = [10,20,30,40]
metric_pool = ["euclidean", "cosine", "manhattan"]
z_score_pool = ["no","yes"]

resample_dim is how you resample the image before storing in a vector that will be used for the hashing, thus, dimensions of resampling before hashing. The bigger the dimensions, smaller the size of the vector.
There is not saving of storage in the engine, but it’s much faster to hash a small vector, for both indexing and querying. Also in terms of neurovault’s storage is better to have smaller reduced representations if we are using them just  for comparison. From 4mm to 16mm the diff is over 10x faster,
in this comment I made a summarize of the speed tradeoff:

subjects is a static parameter.

n_bits is the number of buckets that your engine will be divided into (2^n_bits)

hash_counts is the number of tables you will have in the Engine. More tables → more overlap between buckets.
More info
 about how n_bits and hash_counts (tables) relate.

metric is the distance that we will use to measure how far/close 2 given points are inside the buckets

z_score is just if we apply zscoring over each of the features. Across individual features (1 per map), not excluding the zeros .

scipy.stats.zscore(x)  ## where x is a feature vector

After this, it loads the necessary data for each of the parameters (features and real_scores (corr_values calculated from the actual implementation), basically). Features are the vectors extracted from image.reduced_representation. In the actual implementation, are obtained after using a [4, 4, 4] resample_dim.
real_scores is what I get from querying the images with the actual implementation (thus, absolute correlation values (corr_values))

2.- Builds and Engine for each of the combinations and stores the data in the Engine.

3.- Queries 1 by 1 each feature against the Engine and compares it with the real_scores using Discounted Cumulative Gain.

4.- Saves and outputs results (mean results for each of the combinations).

Conclusions and actions

It is not enough to calculate which combination has the highest DCG, we need also the error between the real_score and the engine_score. I am calculating both atm.

real = the actual implementation results (correlation values)
engine = the ones I get from Nearpy

Euclidean does slightly better than Cosine or Manhattan distance.

Z scoring the data does not work at all, worst results always.

Dimensions of the feature does not influence at all the results at least from [4, 4, 4] up to [16, 16, 16]. Which is quite important, due to size (features) and speed (in the Engine) improvement when using a higher resample dimension, thus, smaller feature vectors: [4 ,4 ,4] = 28549 size feature vs. [16, 16, 16] = 450 size features.

n_bits and hash_counts represent the number of buckets and the number of tables of the engine. from the tests, a bigger number of n_bits (n_bits ^ 2 = number of buckets), smaller error. BUT this error reduction has a trick. The higher the number of buckets, the less images "fall" into the buckets. Similar images "fall" in the buckets, but then, the queries are done over these buckets. So, if we select a big number for n_bits, we will have more accurate results, but less results. e.g.

for 940 subjects (with queries limited to 100 subjects):

n_bits = 7 → error = 0.5 (100 subjects in the response)

n_bits = 9 → error = 0.3 (20 subjects in the response)

this can be solved increasing the number of tables (hash_count), that allows a bigger collision rate between buckets and reduces the false positive rate. BUT this comes with a computational cost.

Long story short: we are lucky, since we know the size of our problem (ok, the size will increase, but in the worst scenario, n_bits increases the size of buckets exponentially and we could build the engine every time the number of images reaches a given size). The number of tables to choose, depends on the computational cost that we can absorb and the accuracy level we want to achieve.

The difference between 10, 40, 60 or 100 tables is just the time it takes to retrieve the result. For 940 subjects, the diff between 10 and 100 tables is like 3-4 seconds querying the WHOLE dataset (being 10 immediate).

All is about balance.

Example

Now, I will try to put a visual example of the results. Let’s select my local map #74 (http://neurovault.org/images/10896/):

127.0.0.1/images/74/find_similar  gives me the following pks:

248.0, 294.0, 231.0, 295.0, 196.0, 55.0, 81.0, 129.0, 134.0, 289.0, 336.0, 117.0, 137.0, 36.0, 285.0, 212.0, 236.0, 312.0, 352.0, 313.0, 199.0, 219.0, 177.0, 270.0, 54.0, 271.0, 109.0, 190.0, 216.0, 35.0, 343.0, 42.0, 19.0, 311.0, 327.0, 63.0, 279.0, 64.0, 298.0, 207.0, 127.0, 38.0, 93.0, 99.0, 33.0, 46.0, 82.0, 243.0, 29.0, 165.0, 307.0, 27.0, 263.0, 246.0, 335.0, 276.0, 351.0, 223.0, 228.0, 91.0, 301.0, 135.0, 136.0, 333.0, 141.0, 153.0, 318.0, 288.0, 232.0, 40.0, 68.0, 160.0, 162.0, 345.0, 155.0, 122.0, 350.0, 138.0, 79.0, 34.0, 69.0, 150.0, 310.0, 266.0, 62.0, 88.0, 324.0, 200.0, 197.0, 247.0, 340.0, 344.0, 58.0, 119.0, 66.0, 277.0, 306.0, 233.0, 234.0, 51.0]

with their respective corr values (just some of them, for visualization purposes):

(248.0, 0.562883203300397), (294.0, 0.375707749028625), (231.0, 0.305561152552545), (295.0, -0.236087595890327), (196.0, -0.220782727914374), (55.0, -0.217971226241057), (81.0, -0.212523129998579), (129.0, -0.212477329533889), (134.0, -0.209937024281208), (289.0, 0.204322139071006), (336.0, -0.203852042590488), (117.0, -0.200330390890613), (137.0, -0.200330390890613), (36.0, 0.200133232317886), (285.0, -0.194608559481946), (212.0, -0.19272952164319), (236.0, -0.1923215012287), (312.0, -0.191660714996371), (352.0, 0.188959520324262), (313.0, -0.186766338145649), (199.0, 0.184921832942244), (219.0, -0.184475254039742), (177.0, 0.181086977481782), (270.0, -0.17659228779659), (54.0, -0.175276174474736), (271.0, -0.173595158004806), (109.0, -0.173582802408002)

the query over Nearpy (Engine built with [16, 16, 16] dim_resampling, euclidean distance, 7 bits and 40 tables) for the same #74 is the following (pks): (I’ve no pdf to show, because the view is not built yet)

[248, 759, 294, 686, 456, 578, 671, 719, 435, 199, 94, 596, 687, 314, 19, 68, 327, 740, 595, 237, 289, 36, 211, 741, 872, 594, 579, 41, 128, 343, 586, 956, 932, 200, 351, 567, 890, 302, 715, 772, 527, 909, 523, 920, 696, 951, 150, 900, 622, 124, 56, 441, 187, 201, 166, 101, 228, 440, 155, 676, 135, 216, 136, 372, 902, 84, 77, 175, 96, 736, 401, 361, 233, 613, 232, 123, 420, 934, 834, 843, 583, 27, 131, 611, 297, 556, 931, 192, 727, 206, 144, 665, 376, 70, 405, 894, 379, 113, 378]

So, the DCG for this query is 2.56 (DCG of the Nearpy’s response) over a maximum of 4.2 (DCG of actual implementation).

Now, we must do an effort to compare visually the results. The first item is the same, that is clear http://neurovault.org/images/10901. The second from the actual and the third of the Engine are also the same, ok, not bad.

From my point of view, from the 3rd result on, the maps are nothing but similar with respect to the query…

Let’s see what the Engine is giving as response (I’ve to copy and paste the results, as we still don’t have a find_similar() view for the engine):

The second one, 759 is not even in the first 100 of the actual implementation. In my local it is this one:

<img src="https://mail.google.com/mail/u/0/?ui=2&ik=dbccbd2714&view=fimg&th=155e88afc9ef680f&attid=0.0.1&disp=emb&realattid=ii_155e8811f7a1581c&attbid=ANGjdJ8g0-0_iOenFRKb9Y8HpJS2G-QGI05S_e0cxNXYIsYUo4oeArbm8NkNkKK6WffKXwg8-tcshYlZeM5AVTRufkwqRAOhHbebI77fn6Tow2CX2S4P9amgjmauBBY&sz=w624-h258&ats=1468485407026&rm=155e88afc9ef680f&zw&atsh=1" alt="?ui=2&ik=dbccbd2714&view=fimg&th=155e88afc9ef680f&attid=0.0.1&disp=emb&realattid=ii 155e8811f7a1581c&attbid=ANGjdJ8g0 0 iOenFRKb9Y8HpJS2G QGI05S e0cxNXYIsYUo4oeArbm8NkNkKK6WffKXwg8 tcshYlZeM5AVTRufkwqRAOhHbebI77fn6Tow2CX2S4P9amgjmauBBY&sz=w624 h258&ats=1468485407026&rm=155e88afc9ef680f&zw&atsh=1">

which seems similar to #74.

this is #719, the 8th one for the Engine. I took the one that looked more similar from the first 10… (maybe this was advantageous, but it is to show how the engine keeps showing similar images in comparison to the actual implementation, which is giving results based on correlations of 0.22 from the 5th result on and they don’t seem to me very "similar").

<img src="https://mail.google.com/mail/u/0/?ui=2&ik=dbccbd2714&view=fimg&th=155e88afc9ef680f&attid=0.0.2&disp=emb&realattid=ii_155e88610cffcd55&attbid=ANGjdJ_F65vhOBKigVpEDptWZa6qr2AL-W2aq-4YSQLuodslRQl2vX9JGCCNm3rkn0U8-9Ze7go-IcnF5QIy2XqZAyNLoQvQgoZWhU5ZsoKKdymGFsA0Gc22rBCzWFo&sz=w626-h264&ats=1468485407026&rm=155e88afc9ef680f&zw&atsh=1" alt="?ui=2&ik=dbccbd2714&view=fimg&th=155e88afc9ef680f&attid=0.0.2&disp=emb&realattid=ii 155e88610cffcd55&attbid=ANGjdJ F65vhOBKigVpEDptWZa6qr2AL W2aq 4YSQLuodslRQl2vX9JGCCNm3rkn0U8 9Ze7go IcnF5QIy2XqZAyNLoQvQgoZWhU5ZsoKKdymGFsA0Gc22rBCzWFo&sz=w626 h264&ats=1468485407026&rm=155e88afc9ef680f&zw&atsh=1">

                Asier Erramuzpe's Picture

Asier Erramuzpe

Read more posts by this author.

                    Macondo

Share this post

                    Twitter

                    Facebook

                    Google+

Neurovault: Image Search for Brain Maps © 2016

Proudly published with HubPress


text:
| Ingredient | Quantity |
| ------------- | ----------- |
| edamame | 2 cups |
| red onion | 1 cup thinly shaved |
| lemon juice | from 2 lemons |
| tomatoes | 1.5 cups chopped |
| salt | to taste |
| black pepper | to taste |
| basil (dried) | 1 teaspoon |

## Preparation

* Add all ingredients to a large bowl except the oil
* Mix
* Taste and add additional salt and pepper if necessary
* Let stand for a few minutes
* Drain liquid
* Add a drizzle of olive oil when serving

redpajama_set_name: RedPajamaGithub


text:
namespace blink {

// static
scoped_refptr<WebServiceWorkerFetchContext>
WebServiceWorkerFetchContext::Create(
    const RendererPreferences& renderer_preferences,
    const WebURL& worker_script_url,
    std::unique_ptr<network::PendingSharedURLLoaderFactory>
        pending_url_loader_factory,
    std::unique_ptr<network::PendingSharedURLLoaderFactory>
        pending_script_loader_factory,
    const WebURL& script_url_to_skip_throttling,
    std::unique_ptr<URLLoaderThrottleProvider> throttle_provider,
    std::unique_ptr<WebSocketHandshakeThrottleProvider>
        websocket_handshake_throttle_provider,
    CrossVariantMojoReceiver<
        mojom::blink::RendererPreferenceWatcherInterfaceBase>
        preference_watcher_receiver,
    CrossVariantMojoReceiver<
        mojom::blink::SubresourceLoaderUpdaterInterfaceBase>
        pending_subresource_loader_updater,
    const WebVector<WebString>& cors_exempt_header_list) {
  return base::MakeRefCounted<WebServiceWorkerFetchContextImpl>(
      renderer_preferences, KURL(worker_script_url.GetString()),
      std::move(pending_url_loader_factory),
      std::move(pending_script_loader_factory),
      KURL(script_url_to_skip_throttling.GetString()),
      std::move(throttle_provider),
      std::move(websocket_handshake_throttle_provider),
      std::move(preference_watcher_receiver),
      std::move(pending_subresource_loader_updater), cors_exempt_header_list);
}

WebServiceWorkerFetchContextImpl::WebServiceWorkerFetchContextImpl(
    const RendererPreferences& renderer_preferences,
    const KURL& worker_script_url,
    std::unique_ptr<network::PendingSharedURLLoaderFactory>
        pending_url_loader_factory,
    std::unique_ptr<network::PendingSharedURLLoaderFactory>
        pending_script_loader_factory,
    const KURL& script_url_to_skip_throttling,
    std::unique_ptr<URLLoaderThrottleProvider> throttle_provider,
    std::unique_ptr<WebSocketHandshakeThrottleProvider>
        websocket_handshake_throttle_provider,
    mojo::PendingReceiver<mojom::blink::RendererPreferenceWatcher>
        preference_watcher_receiver,
    mojo::PendingReceiver<mojom::blink::SubresourceLoaderUpdater>
        pending_subresource_loader_updater,
    const WebVector<WebString>& cors_exempt_header_list)
    : renderer_preferences_(renderer_preferences),
      worker_script_url_(worker_script_url),
      pending_url_loader_factory_(std::move(pending_url_loader_factory)),
      pending_script_loader_factory_(std::move(pending_script_loader_factory)),
      script_url_to_skip_throttling_(script_url_to_skip_throttling),
      throttle_provider_(std::move(throttle_provider)),
      websocket_handshake_throttle_provider_(
          std::move(websocket_handshake_throttle_provider)),
      preference_watcher_pending_receiver_(
          std::move(preference_watcher_receiver)),
      pending_subresource_loader_updater_(
          std::move(pending_subresource_loader_updater)),
      cors_exempt_header_list_(cors_exempt_header_list) {}

WebServiceWorkerFetchContextImpl::~WebServiceWorkerFetchContextImpl() = default;

void WebServiceWorkerFetchContextImpl::SetTerminateSyncLoadEvent(
    base::WaitableEvent* terminate_sync_load_event) {
  DCHECK(!terminate_sync_load_event_);
  terminate_sync_load_event_ = terminate_sync_load_event;
}

void WebServiceWorkerFetchContextImpl::InitializeOnWorkerThread(
    AcceptLanguagesWatcher* watcher) {
  preference_watcher_receiver_.Bind(
      std::move(preference_watcher_pending_receiver_));
  subresource_loader_updater_.Bind(
      std::move(pending_subresource_loader_updater_));

  web_url_loader_factory_ = std::make_unique<WebURLLoaderFactory>(
      network::SharedURLLoaderFactory::Create(
          std::move(pending_url_loader_factory_)),
      cors_exempt_header_list_, terminate_sync_load_event_);

  internet_disconnected_web_url_loader_factory_ =
      std::make_unique<InternetDisconnectedWebURLLoaderFactory>();

  if (pending_script_loader_factory_) {
    web_script_loader_factory_ = std::make_unique<WebURLLoaderFactory>(
        network::SharedURLLoaderFactory::Create(
            std::move(pending_script_loader_factory_)),
        cors_exempt_header_list_, terminate_sync_load_event_);
  }

  accept_languages_watcher_ = watcher;
}

WebURLLoaderFactory* WebServiceWorkerFetchContextImpl::GetURLLoaderFactory() {
  if (is_offline_mode_)
    return internet_disconnected_web_url_loader_factory_.get();
  return web_url_loader_factory_.get();
}

std::unique_ptr<WebURLLoaderFactory>
WebServiceWorkerFetchContextImpl::WrapURLLoaderFactory(
    CrossVariantMojoRemote<network::mojom::URLLoaderFactoryInterfaceBase>
        url_loader_factory) {
  return std::make_unique<WebURLLoaderFactory>(
      base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>(
          std::move(url_loader_factory)),
      cors_exempt_header_list_, terminate_sync_load_event_);
}

WebURLLoaderFactory*
WebServiceWorkerFetchContextImpl::GetScriptLoaderFactory() {
  return web_script_loader_factory_.get();
}

void WebServiceWorkerFetchContextImpl::WillSendRequest(WebURLRequest& request) {
  if (renderer_preferences_.enable_do_not_track) {
    request.SetHttpHeaderField(WebString::FromUTF8(kDoNotTrackHeader), "1");
  }
  auto url_request_extra_data = base::MakeRefCounted<WebURLRequestExtraData>();
  url_request_extra_data->set_originated_from_service_worker(true);

  const bool needs_to_skip_throttling =
      static_cast<KURL>(request.Url()) == script_url_to_skip_throttling_ &&
      (request.GetRequestContext() ==
           mojom::blink::RequestContextType::SERVICE_WORKER ||
       request.GetRequestContext() == mojom::blink::RequestContextType::SCRIPT);
  if (needs_to_skip_throttling) {
    // Throttling is needed when the skipped script is loaded again because it's
    // served from ServiceWorkerInstalledScriptLoader after the second time,
    // while at the first time the script comes from
    // ServiceWorkerUpdatedScriptLoader which uses ThrottlingURLLoader in the
    // browser process. See also comments at
    // EmbeddedWorkerStartParams::script_url_to_skip_throttling.
    // TODO(https://crbug.com/993641): need to simplify throttling for service
    // worker scripts.
    script_url_to_skip_throttling_ = KURL();
  } else if (throttle_provider_) {
    url_request_extra_data->set_url_loader_throttles(
        throttle_provider_->CreateThrottles(MSG_ROUTING_NONE, request));
  }

  request.SetURLRequestExtraData(std::move(url_request_extra_data));

  if (!renderer_preferences_.enable_referrers) {
    request.SetReferrerString(WebString());
    request.SetReferrerPolicy(network::mojom::ReferrerPolicy::kNever);
  }
}

mojom::ControllerServiceWorkerMode
WebServiceWorkerFetchContextImpl::GetControllerServiceWorkerMode() const {
  return mojom::ControllerServiceWorkerMode::kNoController;
}

net::SiteForCookies WebServiceWorkerFetchContextImpl::SiteForCookies() const {
  // According to the spec, we can use the |worker_script_url_| for
  // SiteForCookies, because "site for cookies" for the service worker is
  // the service worker's origin's host's registrable domain.
  // https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-07#section-2.1.2
  return net::SiteForCookies::FromUrl(GURL(worker_script_url_));
}

absl::optional<WebSecurityOrigin>
WebServiceWorkerFetchContextImpl::TopFrameOrigin() const {
  return absl::nullopt;
}

std::unique_ptr<WebSocketHandshakeThrottle>
WebServiceWorkerFetchContextImpl::CreateWebSocketHandshakeThrottle(
    scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
  if (!websocket_handshake_throttle_provider_)
    return nullptr;
  return websocket_handshake_throttle_provider_->CreateThrottle(
      MSG_ROUTING_NONE, std::move(task_runner));
}

void WebServiceWorkerFetchContextImpl::UpdateSubresourceLoaderFactories(
    std::unique_ptr<PendingURLLoaderFactoryBundle>
        subresource_loader_factories) {
  web_url_loader_factory_ = std::make_unique<WebURLLoaderFactory>(
      network::SharedURLLoaderFactory::Create(
          std::move(subresource_loader_factories)),
      cors_exempt_header_list_, terminate_sync_load_event_);
}

void WebServiceWorkerFetchContextImpl::NotifyUpdate(
    const RendererPreferences& new_prefs) {
  DCHECK(accept_languages_watcher_);
  if (renderer_preferences_.accept_languages != new_prefs.accept_languages)
    accept_languages_watcher_->NotifyUpdate();
  renderer_preferences_ = new_prefs;
}

WebString WebServiceWorkerFetchContextImpl::GetAcceptLanguages() const {
  return WebString::FromUTF8(renderer_preferences_.accept_languages);
}

void WebServiceWorkerFetchContextImpl::SetIsOfflineMode(bool is_offline_mode) {
  is_offline_mode_ = is_offline_mode;
}

}  // namespace blink


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('jdpages', '0014_organisationmember_email'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='blogcategorypage',
            options={'ordering': ('_order',), 'verbose_name': 'Blog categorie pagina', 'verbose_name_plural': "Blog categorie pagina's"},
        ),
        migrations.AlterModelOptions(
            name='homepage',
            options={'ordering': ('_order',), 'verbose_name': 'Home pagina', 'verbose_name_plural': "Home pagina's"},
        ),
        migrations.AlterModelOptions(
            name='organisationpage',
            options={'ordering': ('_order',), 'verbose_name': 'Organisatie pagina', 'verbose_name_plural': "Organisatie pagina's"},
        ),
        migrations.AlterModelOptions(
            name='organisationpartpage',
            options={'ordering': ('_order',), 'verbose_name': 'Organisatie-onderdeel pagina', 'verbose_name_plural': "Organisatie-onderdeel pagina's"},
        ),
        migrations.AlterModelOptions(
            name='visionpage',
            options={'ordering': ('_order',), 'verbose_name': 'Standpunt pagina', 'verbose_name_plural': "Standpunt pagina's"},
        ),
        migrations.AlterModelOptions(
            name='visionspage',
            options={'ordering': ('_order',), 'verbose_name': 'Standpunten pagina', 'verbose_name_plural': "Standpunten pagina's"},
        ),
        migrations.AlterModelOptions(
            name='wordlidpage',
            options={'ordering': ('_order',), 'verbose_name': 'Word lid pagina', 'verbose_name_plural': "Standpunt pagina's"},
        ),
    ]


text:
<?php

declare(strict_types=1);

namespace VonageTest\Client\Factory;

use Vonage\Client;

class TestDouble implements Client\ClientAwareInterface
{
    /**
     * @var Client
     */
    public $client;

    public function setClient(Client $client): void
    {
        $this->client = $client;
    }
}


text:
package com.mikepenz.materialdrawer.app;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;

import com.mikepenz.iconics.typeface.FontAwesome;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.mikepenz.materialdrawer.model.SectionDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.Nameable;

public class SimpleNonTranslucentDrawerActivity extends ActionBarActivity {

    private Drawer.Result result = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        //supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sample_nontranslucent);

        // Handle Toolbar
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        result = new Drawer()
                .withActivity(this)
                .withToolbar(toolbar)
                .withActionBarDrawerToggle(true)
                .withTranslucentStatusBar(false)
                .addDrawerItems(
                        new PrimaryDrawerItem().withName(R.string.drawer_item_action_bar).withIcon(FontAwesome.Icon.faw_home).withIdentifier(1),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_multi_drawer).withIdentifier(2),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye),
                        new SectionDrawerItem().withName(R.string.drawer_item_section_header),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_help).setEnabled(false),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github),
                        new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(FontAwesome.Icon.faw_bullhorn)
                )
                .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) {
                        if (drawerItem instanceof Nameable) {
                            Toast.makeText(SimpleNonTranslucentDrawerActivity.this, SimpleNonTranslucentDrawerActivity.this.getString(((Nameable) drawerItem).getNameRes()), Toast.LENGTH_SHORT).show();
                        }
                    }
                })
                .withSelectedItem(2)
                .withSavedInstance(savedInstanceState)
                .build();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        outState = result.saveInstanceState(outState);
        super.onSaveInstanceState(outState);
    }
}


text:
package ru.andreichernov.dao;

import org.junit.Test;

public class PlaceDataDAOPostgresImplTest {
    @Test
    public void isPlaceExist() throws Exception {

    }

}


text:
cd ..
java -jar dccd-repo-tools-0.0.1-SNAPSHOT.jar cfg/coordinateswapper-context.xml


text:
package de.cosmocode.palava.media.expire;

/**
 * Static constant holder class for asset expiration config key names.
 *
 * @author Willi Schoenborn
 */
final class AssetExpirationServiceConfig {

    public static final String PREFIX = "asset.expire.";

    public static final String CRON_EXPRESSION = PREFIX + "cronExpression";

    private AssetExpirationServiceConfig() {

    }

}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.whichTransitionEvent = whichTransitionEvent;
function whichTransitionEvent() {
  var el = document.createElement('fakeelement');
  var transitions = {
    'transition': 'transitionend',
    'OTransition': 'oTransitionEnd',
    'MozTransition': 'transitionend',
    'WebkitTransition': 'webkitTransitionEnd'
  };

  for (var t in transitions) {
    if (el.style[t] !== undefined) {
      return transitions[t];
    }
  }
}


text:
using namespace sdk_util;  // For sdk_util::ThreadPool

// Global properties used to setup Voronoi demo.
namespace {
const int kMinRectSize = 4;
const int kStartRecurseSize = 32;  // must be power-of-two
const float kHugeZ = 1.0e38f;
const float kPI = M_PI;
const float kTwoPI = kPI * 2.0f;
const int kFramesToBenchmark = 100;
const unsigned int kRandomStartSeed = 0xC0DE533D;
const int kMaxPointCount = 1024;
const int kStartPointCount = 256;
const int kDefaultNumRegions = 256;

unsigned int g_rand_state = kRandomStartSeed;

// random number helper
inline unsigned char rand255() {
  return static_cast<unsigned char>(rand_r(&g_rand_state) & 255);
}

// random number helper
inline float frand() {
  return (static_cast<float>(rand_r(&g_rand_state)) /
      static_cast<float>(RAND_MAX));
}

// reset random seed
inline void rand_reset(unsigned int seed) {
  g_rand_state = seed;
}

// returns true if input is power of two.
inline bool is_pow2(int x) {
  return (x & (x - 1)) == 0;
}

inline double getseconds() {
  const double usec_to_sec = 0.000001;
  timeval tv;
  if (0 == gettimeofday(&tv, NULL))
    return tv.tv_sec + tv.tv_usec * usec_to_sec;
  return 0.0;
}

// BGRA helper function, for constructing a pixel for a BGRA buffer.
inline uint32_t MakeBGRA(uint32_t b, uint32_t g, uint32_t r, uint32_t a) {
  return (((a) << 24) | ((r) << 16) | ((g) << 8) | (b));
}
}  // namespace

// Vec2, simple 2D vector
struct Vec2 {
  float x, y;
  Vec2() {}
  Vec2(float px, float py) {
    x = px;
    y = py;
  }
  void Set(float px, float py) {
    x = px;
    y = py;
  }
};

// The main object that runs Voronoi simulation.
class Voronoi {
 public:
  Voronoi();
  virtual ~Voronoi();
  // Runs a tick of the simulations, update 2D output.
  void Update();
  // Handle event from user, or message from JS.
  void HandleEvent(PSEvent* ps_event);

 private:
  // Methods prefixed with 'w' are run on worker threads.
  uint32_t* wGetAddr(int x, int y);
  int wCell(float x, float y);
  inline void wFillSpan(uint32_t *pixels, uint32_t color, int width);
  void wRenderTile(int x, int y, int w, int h);
  void wProcessTile(int x, int y, int w, int h);
  void wSubdivide(int x, int y, int w, int h);
  void wMakeRect(int region, int *x, int *y, int *w, int *h);
  bool wTestRect(int *m, int x, int y, int w, int h);
  void wFillRect(int x, int y, int w, int h, uint32_t color);
  void wRenderRect(int x0, int y0, int x1, int y1);
  void wRenderRegion(int region);
  static void wRenderRegionEntry(int region, void *thiz);

  // These methods are only called by the main thread.
  void Reset();
  void UpdateSim();
  void RenderDot(float x, float y, uint32_t color1, uint32_t color2);
  void SuperimposePositions();
  void Render();
  void Draw();
  void StartBenchmark();
  void EndBenchmark();
  // Helper to post small update messages to JS.
  void PostUpdateMessage(const char* message_name, double value);

  PSContext2D_t* ps_context_;
  Vec2 positions_[kMaxPointCount];
  Vec2 screen_positions_[kMaxPointCount];
  Vec2 velocities_[kMaxPointCount];
  uint32_t colors_[kMaxPointCount];
  float ang_;
  const int num_regions_;
  int num_threads_;
  int point_count_;
  bool draw_points_;
  bool draw_interiors_;
  ThreadPool* workers_;
  int benchmark_frame_counter_;
  bool benchmarking_;
  double benchmark_start_time_;
  double benchmark_end_time_;
};

void Voronoi::Reset() {
  rand_reset(kRandomStartSeed);
  ang_ = 0.0f;
  for (int i = 0; i < kMaxPointCount; i++) {
    // random initial start position
    const float x = frand();
    const float y = frand();
    positions_[i].Set(x, y);
    // random directional velocity ( -1..1, -1..1 )
    const float speed = 0.0005f;
    const float u = (frand() * 2.0f - 1.0f) * speed;
    const float v = (frand() * 2.0f - 1.0f) * speed;
    velocities_[i].Set(u, v);
    // 'unique' color (well... unique enough for our purposes)
    colors_[i] = MakeBGRA(rand255(), rand255(), rand255(), 255);
  }
}

Voronoi::Voronoi() : num_regions_(kDefaultNumRegions), num_threads_(0),
    point_count_(kStartPointCount), draw_points_(true), draw_interiors_(true),
    benchmark_frame_counter_(0), benchmarking_(false)  {
  Reset();
  // By default, render from the dispatch thread.
  workers_ = new ThreadPool(num_threads_);
  PSEventSetFilter(PSE_ALL);
  ps_context_ = PSContext2DAllocate(PP_IMAGEDATAFORMAT_BGRA_PREMUL);
}

Voronoi::~Voronoi() {
  delete workers_;
  PSContext2DFree(ps_context_);
}

inline uint32_t* Voronoi::wGetAddr(int x, int y) {
  return ps_context_->data + x + y * ps_context_->stride / sizeof(uint32_t);
}

// This is the core of the Voronoi calculation.  At a given point on the
// screen, iterate through all voronoi positions and render them as 3D cones.
// We're looking for the voronoi cell that generates the closest z value.
// (not really cones - since it is all relative, we avoid doing the
// expensive sqrt and test against z*z instead)
// If multithreading, this function is only called by the worker threads.
int Voronoi::wCell(float x, float y) {
  int closest_cell = 0;
  float zz = kHugeZ;
  Vec2* pos = screen_positions_;
  for (int i = 0; i < point_count_; ++i) {
    // measured 5.18 cycles per iteration on a core2
    float dx = x - pos[i].x;
    float dy = y - pos[i].y;
    float dd = (dx * dx + dy * dy);
    if (dd < zz) {
      zz = dd;
      closest_cell = i;
    }
  }
  return closest_cell;
}

// Given a region r, derive a non-overlapping rectangle for a thread to
// work on.
// If multithreading, this function is only called by the worker threads.
void Voronoi::wMakeRect(int r, int* x, int* y, int* w, int* h) {
  const int parts = 16;
  assert(parts * parts == num_regions_);
  *w = ps_context_->width / parts;
  *h = ps_context_->height / parts;
  *x = *w * (r % parts);
  *y = *h * ((r / parts) % parts);
}

// Test 4 corners of a rectangle to see if they all belong to the same
// voronoi cell.  Each test is expensive so bail asap.  Returns true
// if all 4 corners match.
// If multithreading, this function is only called by the worker threads.
bool Voronoi::wTestRect(int* m, int x, int y, int w, int h) {
  // each test is expensive, so exit ASAP
  const int m0 = wCell(x, y);
  const int m1 = wCell(x + w - 1, y);
  if (m0 != m1) return false;
  const int m2 = wCell(x, y + h - 1);
  if (m0 != m2) return false;
  const int m3 = wCell(x + w - 1, y + h - 1);
  if (m0 != m3) return false;
  // all 4 corners belong to the same cell
  *m = m0;
  return true;
}

// Quickly fill a span of pixels with a solid color.  Assumes
// span width is divisible by 4.
// If multithreading, this function is only called by the worker threads.
inline void Voronoi::wFillSpan(uint32_t* pixels, uint32_t color, int width) {
  if (!draw_interiors_) {
    const uint32_t gray = MakeBGRA(128, 128, 128, 255);
    color = gray;
  }
  for (int i = 0; i < width; i += 4) {
    *pixels++ = color;
    *pixels++ = color;
    *pixels++ = color;
    *pixels++ = color;
  }
}

// Quickly fill a rectangle with a solid color.  Assumes
// the width w parameter is evenly divisible by 4.
// If multithreading, this function is only called by the worker threads.
void Voronoi::wFillRect(int x, int y, int w, int h, uint32_t color) {
  const uint32_t stride_in_pixels = ps_context_->stride / sizeof(uint32_t);
  uint32_t* pixels = wGetAddr(x, y);
  for (int j = 0; j < h; j++) {
    wFillSpan(pixels, color, w);
    pixels += stride_in_pixels;
  }
}

// When recursive subdivision reaches a certain minimum without finding a
// rectangle that has four matching corners belonging to the same voronoi
// cell, this function will break the retangular 'tile' into smaller scanlines
//  and look for opportunities to quick fill at the scanline level.  If the
// scanline can't be quick filled, it will slow down even further and compute
// voronoi membership per pixel.
void Voronoi::wRenderTile(int x, int y, int w, int h) {
  // rip through a tile
  const uint32_t stride_in_pixels = ps_context_->stride / sizeof(uint32_t);
  uint32_t* pixels = wGetAddr(x, y);
  for (int j = 0; j < h; j++) {
    // get start and end cell values
    int ms = wCell(x + 0, y + j);
    int me = wCell(x + w - 1, y + j);
    // if the end points are the same, quick fill the span
    if (ms == me) {
      wFillSpan(pixels, colors_[ms], w);
    } else {
      // else compute each pixel in the span... this is the slow part!
      uint32_t* p = pixels;
      *p++ = colors_[ms];
      for (int i = 1; i < (w - 1); i++) {
        int m = wCell(x + i, y + j);
        *p++ = colors_[m];
      }
      *p++ = colors_[me];
    }
    pixels += stride_in_pixels;
  }
}

// Take a rectangular region and do one of -
//   If all four corners below to the same voronoi cell, stop recursion and
// quick fill the rectangle.
//   If the minimum rectangle size has been reached, break out of recursion
// and process the rectangle.  This small rectangle is called a tile.
//   Otherwise, keep recursively subdividing the rectangle into 4 equally
// sized smaller rectangles.
// Note: at the moment, these will always be squares, not rectangles.
// If multithreading, this function is only called by the worker threads.
void Voronoi::wSubdivide(int x, int y, int w, int h) {
  int m;
  // if all 4 corners are equal, quick fill interior
  if (wTestRect(&m, x, y, w, h)) {
    wFillRect(x, y, w, h, colors_[m]);
  } else {
    // did we reach the minimum rectangle size?
    if ((w <= kMinRectSize) || (h <= kMinRectSize)) {
      wRenderTile(x, y, w, h);
    } else {
      // else recurse into smaller rectangles
      const int half_w = w / 2;
      const int half_h = h / 2;
      wSubdivide(x, y, half_w, half_h);
      wSubdivide(x + half_w, y, half_w, half_h);
      wSubdivide(x, y + half_h, half_w, half_h);
      wSubdivide(x + half_w, y + half_h, half_w, half_h);
    }
  }
}

// This function cuts up the rectangle into power of 2 sized squares.  It
// assumes the input rectangle w & h are evenly divisible by
// kStartRecurseSize.
// If multithreading, this function is only called by the worker threads.
void Voronoi::wRenderRect(int x, int y, int w, int h) {
  for (int iy = y; iy < (y + h); iy += kStartRecurseSize) {
    for (int ix = x; ix < (x + w); ix += kStartRecurseSize) {
      wSubdivide(ix, iy, kStartRecurseSize, kStartRecurseSize);
    }
  }
}

// If multithreading, this function is only called by the worker threads.
void Voronoi::wRenderRegion(int region) {
  // convert region # into x0, y0, x1, y1 rectangle
  int x, y, w, h;
  wMakeRect(region, &x, &y, &w, &h);
  // render this rectangle
  wRenderRect(x, y, w, h);
}

// Entry point for worker thread.  Can't pass a member function around, so we
// have to do this little round-about.
void Voronoi::wRenderRegionEntry(int region, void* thiz) {
  static_cast<Voronoi*>(thiz)->wRenderRegion(region);
}

// Function Voronoi::UpdateSim()
// Run a simple sim to move the voronoi positions.  This update loop
// is run once per frame.  Called from the main thread only, and only
// when the worker threads are idle.
void Voronoi::UpdateSim() {
  ang_ += 0.002f;
  if (ang_ > kTwoPI) {
    ang_ = ang_ - kTwoPI;
  }
  float z = cosf(ang_) * 3.0f;
  // push the points around on the screen for animation
  for (int j = 0; j < kMaxPointCount; j++) {
    positions_[j].x += (velocities_[j].x) * z;
    positions_[j].y += (velocities_[j].y) * z;
    screen_positions_[j].x = positions_[j].x * ps_context_->width;
    screen_positions_[j].y = positions_[j].y * ps_context_->height;
  }
}

// Renders a small diamond shaped dot at x, y clipped against the window
void Voronoi::RenderDot(float x, float y, uint32_t color1, uint32_t color2) {
  const int ix = static_cast<int>(x);
  const int iy = static_cast<int>(y);
  const uint32_t stride_in_pixels = ps_context_->stride / sizeof(uint32_t);
  // clip it against window
  if (ix < 1) return;
  if (ix >= (ps_context_->width - 1)) return;
  if (iy < 1) return;
  if (iy >= (ps_context_->height - 1)) return;
  uint32_t* pixel = wGetAddr(ix, iy);
  // render dot as a small diamond
  *pixel = color1;
  *(pixel - 1) = color2;
  *(pixel + 1) = color2;
  *(pixel - stride_in_pixels) = color2;
  *(pixel + stride_in_pixels) = color2;
}

// Superimposes dots on the positions.
void Voronoi::SuperimposePositions() {
  const uint32_t white = MakeBGRA(255, 255, 255, 255);
  const uint32_t gray = MakeBGRA(192, 192, 192, 255);
  for (int i = 0; i < point_count_; i++) {
    RenderDot(
        screen_positions_[i].x, screen_positions_[i].y, white, gray);
  }
}

// Renders the Voronoi diagram, dispatching the work to multiple threads.
void Voronoi::Render() {
  workers_->Dispatch(num_regions_, wRenderRegionEntry, this);
  if (draw_points_)
    SuperimposePositions();
}

void Voronoi::StartBenchmark() {
  Reset();
  printf("Benchmark started...\n");
  benchmark_frame_counter_ = kFramesToBenchmark;
  benchmarking_ = true;
  benchmark_start_time_ = getseconds();
}

void Voronoi::EndBenchmark() {
  benchmark_end_time_ = getseconds();
  printf("Benchmark ended... time: %2.5f\n",
      benchmark_end_time_ - benchmark_start_time_);
  benchmarking_ = false;
  benchmark_frame_counter_ = 0;
  double result = benchmark_end_time_ - benchmark_start_time_;
  PostUpdateMessage("benchmark_result", result);
}

// Handle input events from the user and messages from JS.
void Voronoi::HandleEvent(PSEvent* ps_event) {
  // Give the 2D context a chance to process the event.
  if (0 != PSContext2DHandleEvent(ps_context_, ps_event))
    return;
  if (ps_event->type == PSE_INSTANCE_HANDLEINPUT) {
    // Convert Pepper Simple event to a PPAPI C++ event
    pp::InputEvent event(ps_event->as_resource);
    switch (event.GetType()) {
      case PP_INPUTEVENT_TYPE_KEYDOWN: {
        pp::KeyboardInputEvent key = pp::KeyboardInputEvent(event);
        uint32_t key_code = key.GetKeyCode();
        if (key_code == 84)  // 't' key
          if (!benchmarking_)
            StartBenchmark();
        break;
      }
      default:
        break;
    }
  } else if (ps_event->type == PSE_INSTANCE_HANDLEMESSAGE) {
    // Convert Pepper Simple message to PPAPI C++ var
    pp::Var var(ps_event->as_var);
    if (var.is_dictionary()) {
      pp::VarDictionary dictionary(var);
      std::string message = dictionary.Get("message").AsString();
      if (message == "run_benchmark" && !benchmarking_)
       StartBenchmark();
      else if (message == "draw_points")
        draw_points_ = dictionary.Get("value").AsBool();
      else if (message == "draw_interiors")
        draw_interiors_ = dictionary.Get("value").AsBool();
      else if (message == "set_points") {
        int num_points = dictionary.Get("value").AsInt();
        point_count_ = std::min(kMaxPointCount, std::max(0, num_points));
      } else if (message == "set_threads") {
        int thread_count = dictionary.Get("value").AsInt();
        delete workers_;
        workers_ = new ThreadPool(thread_count);
      }
    }
  }
}

// PostUpdateMessage() helper function for sendimg small messages to JS.
void Voronoi::PostUpdateMessage(const char* message_name, double value) {
  pp::VarDictionary message;
  message.Set("message", message_name);
  message.Set("value", value);
  PSInterfaceMessaging()->PostMessage(PSGetInstanceId(), message.pp_var());
}

void Voronoi::Update() {
  PSContext2DGetBuffer(ps_context_);
  if (NULL == ps_context_->data)
    return;
  assert(is_pow2(ps_context_->width));
  assert(is_pow2(ps_context_->height));

  // When benchmarking is running, don't update display via
  // PSContext2DSwapBuffer() - vsync is enabled by default, and will throttle
  // the benchmark results.
  do {
    UpdateSim();
    Render();
    if (!benchmarking_) break;
    --benchmark_frame_counter_;
  } while (benchmark_frame_counter_ > 0);
  if (benchmarking_)
    EndBenchmark();

  PSContext2DSwapBuffer(ps_context_);
}

// Starting point for the module.  We do not use main since it would
// collide with main in libppapi_cpp.
int example_main(int argc, char* argv[]) {
  Voronoi voronoi;
  while (true) {
    PSEvent* ps_event;
    // Consume all available events.
    while ((ps_event = PSEventTryAcquire()) != NULL) {
      voronoi.HandleEvent(ps_event);
      PSEventRelease(ps_event);
    }
    // Do simulation, render and present.
    voronoi.Update();
  }

  return 0;
}

// Register the function to call once the Instance Object is initialized.
// see: pappi_simple/ps_main.h
PPAPI_SIMPLE_REGISTER_MAIN(example_main);


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

    angular.module('brewApp.directives').directive('myRecipesTab', myRecipesTab);

    function myRecipesTab() {
        return {
            restrict: 'AE',
            templateUrl: '/views/myRecipes'
        };
    }
})();


text:
describe Unitpay::Controller do
  class TestController
    include Unitpay::Controller
    attr_reader :response

    def render(response)
      @response = response
    end

    def params
      {}
    end

    def service
      Unitpay::Service.new('public_key', 'secret_key')
    end
  end

  RSpec::Matchers.define :be_success do |_|
    match do |actual|
      expect(actual).to eq(json: { result: { message: 'Запрос успешно обработан' } })
    end
  end

  RSpec::Matchers.define :be_fail do |expected = 'Неверная сигнатура'|
    match do |actual|
      expect(actual).to eq(json: { error: { message: expected } })
    end
  end

  describe '#sussecc' do
    it 'should raise error' do
      expect_any_instance_of(TestController).to receive(:warn).with('NotImplementedError')
      TestController.new.success
    end
  end

  describe '#fail' do
    it 'should raise error' do
      expect_any_instance_of(TestController).to receive(:warn).with('NotImplementedError')
      TestController.new.fail
    end
  end

  describe '#notify' do
    let(:params) do
      {
        method: method,
        params: {
          account: 'test',
          date: '2015-11-29 12:29:00',
          operator: 'mts',
          paymentType: 'mc',
          projectId: '22760',
          phone: '9001234567',
          profit: '9.5',
          sum: sum,
          orderSum: '10.00',
          signature: signature,
          orderCurrency: 'RUB',
          unitpayId: '87370'
        }
      }
    end

    let(:sum) { 10 }

    let(:response) do
      controller = TestController.new
      controller.notify
      controller.response
    end

    before do
      allow_any_instance_of(TestController).to receive(:params).and_return(params)
    end

    subject { response }

    describe '#check' do
      let(:method) { 'check' }
      let(:signature) { 'df236bfc284beb1a922ceb1f98b4ddb23ac87d5761fcc71acbf09bc06aeca720' }

      context 'when valid signature' do
        before { expect_any_instance_of(TestController).to receive(:check) }

        it { is_expected.to be_success }
      end

      context 'when invalid signature' do
        let(:sum) { 11 }

        it { is_expected.to be_fail }
      end
    end

    describe '#pay' do
      let(:method) { 'pay' }
      let(:signature) { '997061638b15026374257f483e3b55b81727fe53fd329fdb34fda4dc2ab3e245' }

      it 'should raise not implemented error' do
        controller = TestController.new
        expect{ controller.notify }.to raise_error(Unitpay::Controller::PayMethodNotImplemented)
      end

      context 'when valid signature' do
        before { expect_any_instance_of(TestController).to receive(:pay) }

        it { is_expected.to be_success }
      end

      context 'when invalid signature' do
        let(:sum) { 11 }

        it { is_expected.to be_fail }
      end

      context 'when pay raise runtime exception' do
        before do
          expect_any_instance_of(TestController).to receive(:pay).and_raise(Unitpay::Controller::RuntimeException)
        end

        it { is_expected.to be_fail('Unitpay::Controller::RuntimeException') }
      end
    end

    describe '#error' do
      let(:method) { 'error' }
      let(:signature) { '9b3952eb48958f151a86964382b1808f5a9f969ecd6da204c2243b250c3edeb8' }

      it 'should raise not implemented error' do
        controller = TestController.new
        expect{ controller.notify }.to raise_error(Unitpay::Controller::ErrorMethodNotImplemented)
      end

      context 'when valid signature' do
        before { expect_any_instance_of(TestController).to receive(:error) }

        it { is_expected.to be_success }
      end
    end
  end
end


text:
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import mediastore_backends
import json

class MediaStoreResponse(BaseResponse):
    SERVICE_NAME = "mediastore"

    @property
    def mediastore_backend(self):
        return mediastore_backends[self.region]

    def create_container(self):
        name = self._get_param("ContainerName")
        tags = self._get_param("Tags")
        container = self.mediastore_backend.create_container(name=name, tags=tags)
        return json.dumps(dict(Container=container.to_dict()))

    def describe_container(self):
        name = self._get_param("ContainerName")
        container = self.mediastore_backend.describe_container(name=name)
        return json.dumps(dict(Container=container.to_dict()))

    def list_containers(self):
        next_token = self._get_param("NextToken")
        max_results = self._get_int_param("MaxResults")
        containers, next_token = self.mediastore_backend.list_containers(
            next_token=next_token, max_results=max_results,
        )
        return json.dumps(dict(dict(Containers=containers), NextToken=next_token))

    def put_lifecycle_policy(self):
        container_name = self._get_param("ContainerName")
        lifecycle_policy = self._get_param("LifecyclePolicy")
        policy = self.mediastore_backend.put_lifecycle_policy(
            container_name=container_name, lifecycle_policy=lifecycle_policy,
        )
        return json.dumps(policy)

    def get_lifecycle_policy(self):
        container_name = self._get_param("ContainerName")
        lifecycle_policy = self.mediastore_backend.get_lifecycle_policy(
            container_name=container_name,
        )
        return json.dumps(dict(LifecyclePolicy=lifecycle_policy))

    def put_container_policy(self):
        container_name = self._get_param("ContainerName")
        policy = self._get_param("Policy")
        container_policy = self.mediastore_backend.put_container_policy(
            container_name=container_name, policy=policy,
        )
        return json.dumps(container_policy)

    def get_container_policy(self):
        container_name = self._get_param("ContainerName")
        policy = self.mediastore_backend.get_container_policy(
            container_name=container_name,
        )
        return json.dumps(dict(Policy=policy))

    def put_metric_policy(self):
        container_name = self._get_param("ContainerName")
        metric_policy = self._get_param("MetricPolicy")
        self.mediastore_backend.put_metric_policy(
            container_name=container_name, metric_policy=metric_policy,
        )
        return json.dumps(metric_policy)

    def get_metric_policy(self):
        container_name = self._get_param("ContainerName")
        metric_policy = self.mediastore_backend.get_metric_policy(
            container_name=container_name,
        )
        return json.dumps(dict(MetricPolicy=metric_policy))

# add templates from here


text:
ACCEPTED

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

#### Published in
in Batista & Ciferri, Quad. Lab. crittogam. , Pavia 31: 103 (1963)

#### Original name
Microxyphiopsis Bat.

### Remarks
null


text:
//
//  CategoryCell.h
//  OneblogiOS
//
//  Created by Terwer Green on 15/8/4.
//  Copyright (c) 2015年 Terwer Green. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface CategoryCell : UITableViewCell
/**
 *  分类名
 */
@property (nonatomic,strong) NSString *title;
/**
 *  分类别名
 */
@property (nonatomic,strong) NSString *slug;
/**
 *  分类ID
 */
@property (nonatomic,assign) NSInteger catId;

@end