text:
class CreateFiles < ActiveRecord::Migration
  def change
    create_table :files do |t|
      t.string :filepath, default: 'http://giphy.com/gifs/reaction-shaking-ace-ventura-138L9Bpyg0Tja0'
      t.belongs_to :question, index: true

      t.timestamps(null:false)
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="msapplication-tap-highlight" content="no" />

    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">

    <title>Speech Recognition</title>

Speech Recognition

                <button class="btn-danger" id="talk">Speak</button>


text:
package io.cucumber.guice;

import com.google.inject.AbstractModule;
import com.google.inject.ConfigurationException;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.google.inject.Stage;
import io.cucumber.core.backend.CucumberBackendException;
import io.cucumber.core.backend.ObjectFactory;
import io.cucumber.core.resource.ClasspathSupport;
import io.cucumber.guice.factory.SecondInjectorSource;
import io.cucumber.guice.integration.YourInjectorSource;
import io.cucumber.guice.matcher.ElementsAreAllEqualMatcher;
import io.cucumber.guice.matcher.ElementsAreAllUniqueMatcher;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;

import javax.inject.Singleton;

import java.util.Arrays;
import java.util.List;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

class GuiceFactoryTest {

    final AbstractModule boundScenarioScopedClassModule = new AbstractModule() {
        @Override
        protected void configure() {
            bind(BoundScenarioScopedClass.class).in(ScenarioScoped.class);
        }
    };
    final AbstractModule boundSingletonClassModule = new AbstractModule() {
        @Override
        protected void configure() {
            bind(BoundSingletonClass.class).in(Scopes.SINGLETON);
        }
    };
    private ObjectFactory factory;

    @AfterEach
    void tearDown() {
        // If factory is left in start state it can cause cascading failures due
        // to scope being left open
        try {
            factory.stop();
        } catch (Exception ignored) {
        }
    }

    private void initFactory(Injector injector) {
        this.factory = new GuiceFactory();
        if (injector != null)
            ((GuiceFactory) factory).setInjector(injector);
    }

    @Test
    void factoryCanBeInstantiatedWithDefaultConstructor() {
        ObjectFactory factory = new GuiceFactory();
        assertThat(factory, notNullValue());
    }

    @Test
    void factoryCanBeInstantiatedWithArgConstructor() {
        initFactory(Guice.createInjector());
        assertThat(factory, notNullValue());
    }

    @Test
    void factoryStartFailsIfScenarioScopeIsNotBound() {
        initFactory(Guice.createInjector());

        Executable testMethod = () -> factory.start();
        ConfigurationException actualThrown = assertThrows(ConfigurationException.class, testMethod);
        assertThat("Unexpected exception message", actualThrown.getMessage(), startsWith(
            "Guice configuration errors:\n" +
                    "\n" +
                    "1) [Guice/MissingImplementation]: No implementation for ScenarioScope was bound."));
    }

    @Test
    void shouldGiveNewInstancesOfUnscopedClassWithinAScenario() {
        initFactory(injector(CucumberModules.createScenarioModule()));
        List<?> instancesFromSameScenario = getInstancesFromSameScenario(factory, UnscopedClass.class);
        assertThat(instancesFromSameScenario, ElementsAreAllUniqueMatcher.elementsAreAllUnique());
    }

    private Injector injector(Module... module) {
        return Guice.createInjector(Stage.PRODUCTION, module);
    }

    private <E> List<E> getInstancesFromSameScenario(ObjectFactory factory, Class<E> aClass) {

        // Scenario
        factory.start();
        E o1 = factory.getInstance(aClass);
        E o2 = factory.getInstance(aClass);
        E o3 = factory.getInstance(aClass);
        factory.stop();

        return Arrays.asList(o1, o2, o3);
    }

    @Test
    void shouldGiveNewInstanceOfUnscopedClassForEachScenario() {
        initFactory(injector(CucumberModules.createScenarioModule()));
        List<?> instancesFromDifferentScenarios = getInstancesFromDifferentScenarios(factory, UnscopedClass.class);
        assertThat(instancesFromDifferentScenarios, ElementsAreAllUniqueMatcher.elementsAreAllUnique());
    }

    private <E> List<E> getInstancesFromDifferentScenarios(ObjectFactory factory, Class<E> aClass) {

        // Scenario 1
        factory.start();
        E o1 = factory.getInstance(aClass);
        factory.stop();

        // Scenario 2
        factory.start();
        E o2 = factory.getInstance(aClass);
        factory.stop();

        // Scenario 3
        factory.start();
        E o3 = factory.getInstance(aClass);
        factory.stop();

        return Arrays.asList(o1, o2, o3);
    }

    @Test
    void shouldGiveTheSameInstanceOfAnnotatedScenarioScopedClassWithinAScenario() {
        initFactory(injector(CucumberModules.createScenarioModule()));
        List<?> instancesFromSameScenario = getInstancesFromSameScenario(factory, AnnotatedScenarioScopedClass.class);
        assertThat(instancesFromSameScenario, ElementsAreAllEqualMatcher.elementsAreAllEqual());
    }

    @Test
    void shouldGiveNewInstanceOfAnnotatedScenarioScopedClassForEachScenario() {
        initFactory(injector(CucumberModules.createScenarioModule()));
        List<?> instancesFromDifferentScenarios = getInstancesFromDifferentScenarios(factory,
            AnnotatedScenarioScopedClass.class);
        assertThat(instancesFromDifferentScenarios, ElementsAreAllUniqueMatcher.elementsAreAllUnique());
    }

    @Test
    void shouldGiveTheSameInstanceOfAnnotatedSingletonClassWithinAScenario() {
        initFactory(injector(CucumberModules.createScenarioModule()));
        List<?> instancesFromSameScenario = getInstancesFromSameScenario(factory, AnnotatedSingletonClass.class);
        assertThat(instancesFromSameScenario, ElementsAreAllEqualMatcher.elementsAreAllEqual());
    }

    @Test
    void shouldGiveTheSameInstanceOfAnnotatedSingletonClassForEachScenario() {
        initFactory(injector(CucumberModules.createScenarioModule()));
        List<?> instancesFromDifferentScenarios = getInstancesFromDifferentScenarios(factory,
            AnnotatedSingletonClass.class);
        assertThat(instancesFromDifferentScenarios, ElementsAreAllEqualMatcher.elementsAreAllEqual());
    }

    @Test
    void shouldGiveTheSameInstanceOfBoundScenarioScopedClassWithinAScenario() {
        initFactory(injector(CucumberModules.createScenarioModule(), boundScenarioScopedClassModule));
        List<?> instancesFromSameScenario = getInstancesFromSameScenario(factory, BoundScenarioScopedClass.class);
        assertThat(instancesFromSameScenario, ElementsAreAllEqualMatcher.elementsAreAllEqual());
    }

    @Test
    void shouldGiveNewInstanceOfBoundScenarioScopedClassForEachScenario() {
        initFactory(injector(CucumberModules.createScenarioModule(), boundScenarioScopedClassModule));
        List<?> instancesFromDifferentScenarios = getInstancesFromDifferentScenarios(factory,
            BoundScenarioScopedClass.class);
        assertThat(instancesFromDifferentScenarios, ElementsAreAllUniqueMatcher.elementsAreAllUnique());
    }

    @Test
    void shouldGiveTheSameInstanceOfBoundSingletonClassWithinAScenario() {
        initFactory(injector(CucumberModules.createScenarioModule(), boundSingletonClassModule));
        List<?> instancesFromSameScenario = getInstancesFromSameScenario(factory, BoundSingletonClass.class);
        assertThat(instancesFromSameScenario, ElementsAreAllEqualMatcher.elementsAreAllEqual());
    }

    @Test
    void shouldGiveTheSameInstanceOfBoundSingletonClassForEachScenario() {
        initFactory(injector(CucumberModules.createScenarioModule(), boundSingletonClassModule));
        List<?> instancesFromDifferentScenarios = getInstancesFromDifferentScenarios(factory,
            BoundSingletonClass.class);
        assertThat(instancesFromDifferentScenarios, ElementsAreAllEqualMatcher.elementsAreAllEqual());
    }

    @Test
    void shouldGiveNewInstanceOfAnnotatedSingletonClassForEachScenarioWhenOverridingModuleBindingIsScenarioScope() {
        initFactory(injector(CucumberModules.createScenarioModule(), new AbstractModule() {
            @Override
            protected void configure() {
                bind(AnnotatedSingletonClass.class).in(ScenarioScoped.class);
            }
        }));
        List<AnnotatedSingletonClass> instancesFromDifferentScenarios = getInstancesFromDifferentScenarios(factory,
            AnnotatedSingletonClass.class);
        assertThat(instancesFromDifferentScenarios, ElementsAreAllUniqueMatcher.elementsAreAllUnique());
    }

    @Test
    void shouldStartWhenInjectorSourceIsNull() {
        factory = new GuiceFactory();
        factory.start();
    }

    @Test
    void shouldAddInjectorSource() {
        factory = new GuiceFactory();
        assertTrue(factory.addClass(YourInjectorSource.class));
    }

    @Test
    void shouldReturnSameIfInjectorSourceIsFoundTwice() {
        factory = new GuiceFactory();
        assertTrue(factory.addClass(YourInjectorSource.class));
        assertTrue(factory.addClass(YourInjectorSource.class));
    }

    @Test
    void shouldThrowExceptionIfTwoDifferentInjectorSourcesAreFound() {
        factory = new GuiceFactory();
        assertTrue(factory.addClass(YourInjectorSource.class));

        Executable testMethod = () -> factory.addClass(SecondInjectorSource.class);
        CucumberBackendException actualThrown = assertThrows(CucumberBackendException.class, testMethod);
        String exceptionMessage = String.format("" +
                "Glue class %1$s and %2$s are both implementing io.cucumber.guice.InjectorSource.\n" +
                "Please ensure only one class configures the Guice context\n" +
                "\n" +
                "By default Cucumber scans the entire classpath for context configuration.\n" +
                "You can restrict this by configuring the glue path.\n" +
                ClasspathSupport.configurationExamples(),
            SecondInjectorSource.class,
            YourInjectorSource.class);
        assertThat("Unexpected exception message", actualThrown.getMessage(), is(exceptionMessage));
    }

    static class UnscopedClass {

    }

    @ScenarioScoped
    static class AnnotatedScenarioScopedClass {

    }

    @Singleton
    static class AnnotatedSingletonClass {

    }

    static class BoundScenarioScopedClass {

    }

    static class BoundSingletonClass {

    }

}


text:
class ChromeBrowserState;

namespace web {
class BrowserState;
}

// PolicyConversionsClientIOS provides an implementation of the
// PolicyConversionsClient interface that is based on ChromeBrowserState and is
// suitable for use in //ios/chrome.
class PolicyConversionsClientIOS : public policy::PolicyConversionsClient {
 public:
  // Creates a PolicyConversionsClientIOS which retrieves BrowserState-specific
  // policy information from the given |browser_state|.
  explicit PolicyConversionsClientIOS(web::BrowserState* browser_state);

  PolicyConversionsClientIOS(const PolicyConversionsClientIOS&) = delete;
  PolicyConversionsClientIOS& operator=(const PolicyConversionsClientIOS&) =
      delete;
  ~PolicyConversionsClientIOS() override;

  // PolicyConversionsClient.
  policy::PolicyService* GetPolicyService() const override;
  policy::SchemaRegistry* GetPolicySchemaRegistry() const override;
  const policy::ConfigurationPolicyHandlerList* GetHandlerList() const override;
  bool HasUserPolicies() const override;
  base::Value GetExtensionPolicies(policy::PolicyDomain policy_domain) override;

 private:
  ChromeBrowserState* browser_state_;
};

#endif  // IOS_CHROME_BROWSER_POLICY_POLICY_CONVERSIONS_CLIENT_IOS_H_


text:
layout: post
title: docker-compose配置文件
description: docker-compose配置文件
category: docker
---

```shell
docker-compose up
```

```yaml
version: "3"
services:

  redis:
    image: redis:alpine
    ports:
      - "6379"
    networks:
      - frontend
    deploy:
      replicas: 2
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure

  db:
    image: postgres:9.4
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - backend
    deploy:
      placement:
        constraints: [node.role == manager]

  vote:
    image: dockersamples/examplevotingapp_vote:before
    ports:
      - 5000:80
    networks:
      - frontend
    depends_on:
      - redis
    deploy:
      replicas: 2
      update_config:
        parallelism: 2
      restart_policy:
        condition: on-failure

  result:
    image: dockersamples/examplevotingapp_result:before
    ports:
      - 5001:80
    networks:
      - backend
    depends_on:
      - db
    deploy:
      replicas: 1
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure

  worker:
    image: dockersamples/examplevotingapp_worker
    networks:
      - frontend
      - backend
    deploy:
      mode: replicated
      replicas: 1
      labels: [APP=VOTING]
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 3
        window: 120s
      placement:
        constraints: [node.role == manager]

  visualizer:
    image: dockersamples/visualizer:stable
    ports:
      - "8080:8080"
    stop_grace_period: 1m30s
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    deploy:
      placement:
        constraints: [node.role == manager]

networks:
  frontend:
  backend:

volumes:
  db-data:
```

详解:[Docker Compose 配置文件详解](https://www.jianshu.com/p/2217cfed29d7)


text:
import static java.util.stream.Stream.concat;
import static java.util.stream.Stream.of;

class Test {
  {
    concat(of(""), of(""));
  }
}


text:
@implementation STPCardParams

@synthesize additionalAPIParameters = _additionalAPIParameters;

- (instancetype)init {
    self = [super init];
    if (self) {
        _additionalAPIParameters = @{};
    }
    return self;
}

- (NSString *)last4 {
    if (self.number && self.number.length >= 4) {
        return [self.number substringFromIndex:(self.number.length - 4)];
    } else {
        return nil;
    }
}

#if TARGET_OS_IPHONE

- (STPAddress *)address {
    STPAddress *address = [STPAddress new];
    address.name = self.name;
    address.line1 = self.addressLine1;
    address.line2 = self.addressLine2;
    address.city = self.addressCity;
    address.state = self.addressState;
    address.postalCode = self.addressZip;
    address.country = self.addressCountry;
    return address;
}

- (void)setAddress:(STPAddress *)address {
    self.name = address.name;
    self.addressLine1 = address.line1;
    self.addressLine2 = address.line2;
    self.addressCity = address.city;
    self.addressState = address.state;
    self.addressZip = address.postalCode;
    self.addressCountry = address.country;
}

#endif

- (BOOL)validateNumber:(id *)ioValue error:(NSError **)outError {
    if (*ioValue == nil) {
        return [self.class handleValidationErrorForParameter:@"number" error:outError];
    }
    NSString *ioValueString = (NSString *)*ioValue;

    if ([STPCardValidator validationStateForNumber:ioValueString validatingCardBrand:NO] != STPCardValidationStateValid) {
        return [self.class handleValidationErrorForParameter:@"number" error:outError];
    }
    return YES;
}

- (BOOL)validateCvc:(id *)ioValue error:(NSError **)outError {
    if (*ioValue == nil) {
        return [self.class handleValidationErrorForParameter:@"number" error:outError];
    }
    NSString *ioValueString = (NSString *)*ioValue;

    STPCardBrand brand = [STPCardValidator brandForNumber:self.number];

    if ([STPCardValidator validationStateForCVC:ioValueString cardBrand:brand] != STPCardValidationStateValid) {
        return [self.class handleValidationErrorForParameter:@"cvc" error:outError];
    }
    return YES;
}

- (BOOL)validateExpMonth:(id *)ioValue error:(NSError **)outError {
    if (*ioValue == nil) {
        return [self.class handleValidationErrorForParameter:@"expMonth" error:outError];
    }
    NSString *ioValueString = [(NSString *)*ioValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

    if ([STPCardValidator validationStateForExpirationMonth:ioValueString] != STPCardValidationStateValid) {
        return [self.class handleValidationErrorForParameter:@"expMonth" error:outError];
    }
    return YES;
}

- (BOOL)validateExpYear:(id *)ioValue error:(NSError **)outError {
    if (*ioValue == nil) {
        return [self.class handleValidationErrorForParameter:@"expYear" error:outError];
    }
    NSString *ioValueString = [(NSString *)*ioValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

    NSString *monthString = [@(self.expMonth) stringValue];
    if ([STPCardValidator validationStateForExpirationYear:ioValueString inMonth:monthString] != STPCardValidationStateValid) {
        return [self.class handleValidationErrorForParameter:@"expYear" error:outError];
    }
    return YES;
}

- (BOOL)validateCardReturningError:(NSError **)outError {
    // Order matters here
    NSString *numberRef = [self number];
    NSString *expMonthRef = [NSString stringWithFormat:@"%02lu", (unsigned long)[self expMonth]];
    NSString *expYearRef = [NSString stringWithFormat:@"%02lu", (unsigned long)[self expYear]];
    NSString *cvcRef = [self cvc];

    // Make sure expMonth, expYear, and number are set.  Validate CVC if it is provided
    return [self validateNumber:&numberRef error:outError] && [self validateExpYear:&expYearRef error:outError] &&
    [self validateExpMonth:&expMonthRef error:outError] && (cvcRef == nil || [self validateCvc:&cvcRef error:outError]);
}

#pragma mark Private Helpers
+ (BOOL)handleValidationErrorForParameter:(NSString *)parameter error:(NSError **)outError {
    if (outError != nil) {
        if ([parameter isEqualToString:@"number"]) {
            *outError = [self createErrorWithMessage:[NSError stp_cardErrorInvalidNumberUserMessage]
                                           parameter:parameter
                                       cardErrorCode:STPInvalidNumber
                                     devErrorMessage:@"Card number must be between 10 and 19 digits long and Luhn valid."];
        } else if ([parameter isEqualToString:@"cvc"]) {
            *outError = [self createErrorWithMessage:[NSError stp_cardInvalidCVCUserMessage]
                                           parameter:parameter
                                       cardErrorCode:STPInvalidCVC
                                     devErrorMessage:@"Card CVC must be numeric, 3 digits for Visa, Discover, MasterCard, JCB, and Discover cards, and 3 or 4 "
                         @"digits for American Express cards."];
        } else if ([parameter isEqualToString:@"expMonth"]) {
            *outError = [self createErrorWithMessage:[NSError stp_cardErrorInvalidExpMonthUserMessage]
                                           parameter:parameter
                                       cardErrorCode:STPInvalidExpMonth
                                     devErrorMessage:@"expMonth must be less than 13"];
        } else if ([parameter isEqualToString:@"expYear"]) {
            *outError = [self createErrorWithMessage:[NSError stp_cardErrorInvalidExpYearUserMessage]
                                           parameter:parameter
                                       cardErrorCode:STPInvalidExpYear
                                     devErrorMessage:@"expYear must be this year or a year in the future"];
        } else {
            // This should not be possible since this is a private method so we
            // know exactly how it is called.  We use STPAPIError for all errors
            // that are unexpected within the bindings as well.
            *outError = [[NSError alloc] initWithDomain:StripeDomain
                                                   code:STPAPIError
                                               userInfo:@{
                                                          NSLocalizedDescriptionKey: [NSError stp_unexpectedErrorMessage],
                                                          STPErrorMessageKey: @"There was an error within the Stripe client library when trying to generate the "
                                                          @"proper validation error. Contact support@stripe.com if you see this."
                                                          }];
        }
    }
    return NO;
}

+ (NSError *)createErrorWithMessage:(NSString *)userMessage
                          parameter:(NSString *)parameter
                      cardErrorCode:(NSString *)cardErrorCode
                    devErrorMessage:(NSString *)devMessage {
    return [[NSError alloc] initWithDomain:StripeDomain
                                      code:STPCardError
                                  userInfo:@{
                                             NSLocalizedDescriptionKey: userMessage,
                                             STPErrorParameterKey: parameter,
                                             STPCardErrorCodeKey: cardErrorCode,
                                             STPErrorMessageKey: devMessage
                                             }];
}

#pragma mark - STPFormEncodable

+ (NSString *)rootObjectName {
    return @"card";
}

+ (NSDictionary *)propertyNamesToFormFieldNamesMapping {
    return @{
             @"number": @"number",
             @"cvc": @"cvc",
             @"name": @"name",
             @"addressLine1": @"address_line1",
             @"addressLine2": @"address_line2",
             @"addressCity": @"address_city",
             @"addressState": @"address_state",
             @"addressZip": @"address_zip",
             @"addressCountry": @"address_country",
             @"expMonth": @"exp_month",
             @"expYear": @"exp_year",
             @"currency": @"currency",
             };
}

@end


text:
<?php
include_once '../../includes/sql-manager.php';
include_once '../common.php';
include_once 'rendering.php';
include_once 'pagination.php';

$sqlget = new sqlGetter();
$tagobj = $sqlget->getTagInfo($_GET['tag']);

if (isset($_GET['page'])) {
	$page = $_GET['page'];
} else {
	$page = "";
}

if (isset($_GET['tag'])) {
	$tag = $_GET['tag'];
} else {
	$tag = "";
}

$total = $sqlget->countPostsByTag($tag);
$paginator = new Paginator(Conf::Home_PerPage,$total);
$paginator->setPage($page);
$page = $paginator->page;
$posts = $sqlget->getPostsByTag($tag,$paginator->startIndex,$paginator->perPage);

if ($posts instanceof sqlError) {
	$mess = new Message("error",$posts->message);
	//500, internal server error
	http_response_code(500);
} elseif (count($posts) == 0) {
	$mess = new Message("error","No Posts Found");
	//404, not found
	http_response_code(404);
}

$totalpages = $paginator->totalPages;

//get the previous and next page numbers
$prev = $paginator->prev;
$page = $paginator->page;//setting $page to prevent negative page numbers
$next = $paginator->next;

//Make all the disableds either "disabled" or ""
$firstDisabled = $paginator->firstDisabled?"disabled":"";
$prevDisabled = $paginator->prevDisabled?"disabled":"";
$nextDisabled = $paginator->nextDisabled?"disabled":"";
$lastDisabled = $paginator->lastDisabled?"disabled":"";

$tagurl = htmlspecialchars($tag,ENT_QUOTES);

if ($tagobj instanceof sqlError) {
	$mess = new Message("error",$tagobj->message);
	$GLOBALS['pageTitle'] = "Error";
} else {
	$tagname = htmlspecialchars($tagobj['tag']);
	//display the header
	$GLOBALS['pageTitle'] = "Posts Tagged ".$tagname;
}

if ($page == 1) {
	$GLOBALS['canonical'] = "/tag/$tagname/";
} else {
	$GLOBALS['canonical'] = "/tag/$tagname/$page/";
}

$GLOBALS['breadcrumbs'] = array(
			'blog'=>'/',
			'posts tagged \''.$tagname.'\''=>"/tag/$tagname/"
		);

include_once 'header.php';

if (!$prevDisabled) {
	if ($prev == 1) {
		echo "<link rel=\"prev\" href=\"/tag/$tagname/\" />";
	} else {
		echo "<link rel=\"prev\" href=\"/tag/$tagname/$prev/\" />";
	}
}
if (!$nextDisabled) {
	echo "<link rel=\"next\" href=\"/tag/$tagname/$next/\" />";
}

//Set the global variable for page number
echo "";

include_once 'header-body.php';
?>

<?php if ($tagname):?>

Viewing posts Tagged '<?php echo $tagname ?>'

<?php endif; ?>
<?php
//if there's an error
if (isset($mess)) {
	echo $mess->formatMessage();
} else {
	echo renderPostList($posts);
}

if ($page == 1 && !$nextDisabled) {
	$infinite = <<<HTML

	Click here to enable infinite scroll

HTML;
} else {
	$infinite = "";
}

//Navigation bar
echo <<<"HTML"

Page {$page} / {$totalpages}

{$infinite}

Loading...

HTML;
include_once "footer.php";
?>


text:
<ion-item text-wrap>

{{ 'addon.mod_quiz.quizpassword' | translate }}

{{ 'addon.mod_quiz.requirepasswordmessage' | translate}}

</ion-item>
<ion-item [formGroup]="form">
    <core-show-password item-content [name]="'quizpassword'">
        <ion-input id="addon-mod_quiz-accessrule-password-input" name="quizpassword" type="password" placeholder="{{ 'addon.mod_quiz.quizpassword' | translate }}" [formControlName]="'quizpassword'" [clearOnEdit]="false"></ion-input>
    </core-show-password>
</ion-item>


text:
"use strict";

var Segment = require('../../../../../src/base/HorizontalSegments/Segment');
var dataTypeDefinition = require('agency-pkg-base/dataTypeDefinition');

module.exports = Segment.extend({
    modelConstructor: Segment.prototype.modelConstructor.extend(dataTypeDefinition, {
        session: {
            indicator: {
                type: 'object',
                default: null
            },
            offset: {
                type: 'number',
                required: true,
                default: 0.5
            }
        }
    }),

    initialize: function() {
        Segment.prototype.initialize.apply(this, arguments);
        this.model.on('change:width', onChangeWidth.bind(this));

        this.infoEl = this.queryByHook('info');
        this.barLeftEl = this.queryByHook('barLeft');
        this.barRightEl = this.queryByHook('barRight');

    },

    onActive: function(progress) {
        this.barLeftEl.style.width = (1 - Math.abs(progress)) * 50 + '%';
        this.barRightEl.style.width = (1 - Math.abs(progress)) * 50 + '%';

        if (progress >= -this.model.offset && progress <= this.model.offset) {
            this.el.classList.remove('out');
            this.el.classList.add('in');
        } else {
            this.el.classList.remove('in');
            this.el.classList.add('out');
        }

        var log = [];
        log.push('Index: ' + this.model.index);
        log.push(parseInt(progress*100)/100);
        this.infoEl.innerHTML = log.join('<br />');
    },
    onInactive: function() {
        this.barLeftEl.style.width = '0%';
        this.barRightEl.style.width = '0%';
    }
});

function onChangeWidth(model, width) {
    this.el.style.width = width * 100 + '%';
}


text:
var Analyst = Analyst || {};

(function(A, $) {

	A.project = {};

	A.project.ProjectCreateView = Backbone.Marionette.ItemView.extend({

		template: Handlebars.getTemplate('project', 'project-create-template'),

		ui: {
			name: 			'#name',
			description:  	'#description'
		},

		events: {
		  'click .save': 'saveProject',
		  'click .cancel': 'cancelProject',
		  'click #setLocation' : "setLocation",
		  'click #deleteProject' : 'deleteProject'
		},

		initialize : function(options) {

			if(options && options.id) {
				this.model = new A.models.Project({id: options.id});
				this.model.fetch();
				this.model.on('change', this.render);
			}
		},

		cancelProject : function(evt) {

			A.app.instance.vent.trigger("closeSidePanel");

		},

		saveProject : function(evt) {

			evt.preventDefault();
			var data = Backbone.Syphon.serialize(this);

			if(!this.defaultLat) {
				var latlng = A.map.getCenter();

				data.defaultLat = latlng.lat;
				data.defaultLon = latlng.lng;
				data.defaultZoom = A.map.getZoom();
			}
			else {
				data.defaultLat = this.defaultLat;
				data.defaultLon = this.defaultLon;
				data.defaultZoom = this.defaultZoom;
			}

			var project;

			if(this.model)
				project = this.model;
			else
				project = new A.models.Project();

			project.save(data, {success: function(model){
					A.app.controller.setProject(model.id)
					A.app.projects.fetch({reset: true, success: A.app.controller.initProjects});

					// refetch user so that projectPermissions are fresh
					A.app.user.fetch();
			}});

			A.app.instance.vent.trigger("closeSidePanel");
		},

		deleteProject : function(evt) {

			if(this.model) {
				this.model.destroy({success: function(model){
					A.app.projects.fetch({reset: true, success: A.app.controller.initProjects});
				}});
			}

			A.app.instance.vent.trigger("closeSidePanel");
		},

		setLocation : function(evt) {

			var latlng = A.map.getCenter();

			this.defaultLat = latlng.lat;
			this.defaultLon = latlng.lng;
			this.defaultZoom = A.map.getZoom();

			var locationString = this.defaultLat.toFixed(3) + ", "  + this.defaultLon.toFixed(3) + " (z" + this.defaultZoom + ")";

			this.$('#projectLocation').html(locationString);

		}

	});

	A.project.ProjectSettingsView = Backbone.Marionette.ItemView.extend({
	 	template: Handlebars.getTemplate('project', 'project-create-template'),

	 	ui: {
			name: 		'#name',
			description:  	'#description'
		},

		events: {
		  'click .save': 'saveProject',
		  'click #setLocation' : "setLocation"
		},

		onShow : function() {

			var latlng = A.map.getCenter();

			var data = {};

			data.defaultLat = latlng.lat;
			data.defaultLon = latlng.lng;
			data.defaultZoom = A.map.getZoom();

			var locationString = data.defaultLat.toFixed(3) + ", "  + data.defaultLon.toFixed(3) + " (z" + data.defaultZoom + ")";

			this.$('#projectLocation').html(locationString);

		},

		saveProject : function(evt) {

			evt.preventDefault();
			var data = Backbone.Syphon.serialize(this);

			this.model.set(data);

			this.model.save();

		},

		setLocation : function(evt) {

			var latlng = A.map.getCenter();

			var data = {};

			data.defaultLat = latlng.lat;
			data.defaultLon = latlng.lng;
			data.defaultZoom = A.map.getZoom();

			this.model.set(data);

			var locationString = data.defaultLat.toFixed(3) + ", "  + data.defaultLon.toFixed(3) + " (z" + data.defaultZoom + ")";

			this.$('#projectLocation').html(locationString);

		}
	});

})(Analyst, jQuery);


text:
if [ $# -ne 1 ]; then
	echo "please specify an instance id"
	exit 1
fi
INSTANCEID=$1
aws autoscaling terminate-instance-in-auto-scaling-group --instance-id $INSTANCEID --should-decrement-desired-capacity


text:
layout: default
---

{{page.title}}

            {% unless page.content == '' %}

{{ page.content }}

            {% endunless %}

        {% assign travel_categories = "antipodes|europe|asia|americas" | split:"|" %}
        {% for category in travel_categories %}

{{site.category_titles[category]}}

            {% for post in site.categories[category] %}

                    {{post.title}}

                      {{post.excerpt}}

                          {{post.date | date_to_string}}

            {% endfor %}
        {% endfor %}

      {% include sidebar.html %}


text: Make everyone in your group an Admin


text:
/*
 * stop_command.h
 *
 *  \date       Aug 20, 2010
 *  \author    	Apache Celix Project Team
 *  \copyright	Apache License, Version 2.0
 */

#ifndef STOP_COMMAND_H_
#define STOP_COMMAND_H_

command_pt stopCommand_create(bundle_context_pt context);
void stopCommand_destroy(command_pt command);

#endif /* STOP_COMMAND_H_ */


text:
typedef struct SidebarElement {
  TextLayer *last_bg_text;
  TrendArrowComponent *trend;
  TextLayer *delta_text;
} SidebarElement;

SidebarElement* sidebar_element_create(Layer *parent);
void sidebar_element_destroy(SidebarElement *el);
void sidebar_element_update(SidebarElement *el, DataMessage *data);
void sidebar_element_tick(SidebarElement *el);


text:
identifier: MIR:00000561
name: Electron Microscopy Data Bank
description: The Electron Microscopy Data Bank (EMDB) is a public repository for electron microscopy density maps of macromolecular complexes and subcellular structures. It covers a variety of techniques, including single-particle analysis, electron tomography, and electron (2D) crystallography. The EMDB map distribution format follows the CCP4 definition, which is widely recognized by software packages used by the structural biology community.
prefix: emdb
pattern: ^EMD-\d{4}$
prefixed: 0
local_id: EMD-1001
synonyms:
 - EMDB
resources:
 - identifier: MIR:00100738
   accessurl: http://www.ebi.ac.uk/pdbe/entry/emdb/${lid}
   keyword: acto-myosin
   description: EMDB at Protein Data Bank in Europe
   homepage: http://www.ebi.ac.uk/pdbe/emdb/
   institution: European Bioinformatics Institute, Hinxton, Cambridge
   location: UK
   official: false
   provider_code: ebi
---


text:
"""
This module search for GUI controls by sending TAB button events
and comparing the image with the original.

.. note::
     It does not work if the GUI changes during the scan.
     (e.g. blinking cursor)

"""

import logging
from time import sleep

from PIL import ImageChops, ImageFilter, ImageStat
from pykeyboard import PyKeyboard  # type: ignore

from discogui.imglog import img_log, img_log_rects
from discogui.imgutil import focus_wnd, getbbox, grab
from discogui.screenrect import ScreenRect

log = logging.getLogger(__name__)

def darker(im1, im2, box):
    """
    im1 is darker than im2 in box -> 0
    im2 is darker than im1 in box -> 1
    """
    # add border, because box is an 'inside box', crop needs 'outside box'
    box = box.add_border(1)

    stat1 = ImageStat.Stat(im1.crop(box))
    stat2 = ImageStat.Stat(im2.crop(box))
    sum1 = sum(stat1.sum)
    sum2 = sum(stat2.sum)
    assert sum1 != sum2, box
    return 0 if sum1 > sum2 else 1

def tab_rectangles():
    """
    Return rectangles found by sending TAB button events.

    Does not work if other parts of screen are changing (e.g. blinking cursor)

    :rtype: rectangles list
    """
    ls = []

    img_orig = focus_wnd()

    im1 = img_orig
    k = PyKeyboard()
    while 1:
        k.tap_key(k.tab_key)
        sleep(0.1)
        im2 = grab()

        img_log(im1, "im1")
        img_log(im2, "im2")

        boxes = tab_rect_pair(im1, im2)
        if not boxes:
            return []
        if len(ls):
            if len(boxes) == 2:
                assert boxes[0] == ls[-1]
            if boxes[-1] in ls:
                break
            ls += [boxes[-1]]
        else:
            # first
            ls += boxes
        im1 = im2

    img_log_rects(img_orig, ls, "img_orig")
    log.debug("rectangles found:%s", ls)
    return ls

def tab_rect_pair(img_orig, im_next):
    """ """
    img_diff = ImageChops.difference(img_orig, im_next)
    img_log(img_diff, "img_diff")

    # can be dotted -> filter + enhance color
    # Problem: close buttons -> filter value sohuld be low
    img_diff_filtered = img_diff.filter(ImageFilter.MaxFilter(3))
    img_diff_filtered = img_diff_filtered.point(lambda x: 255 * bool(x))
    img_log(img_diff_filtered, "img_diff_filtered")

    bbox = getbbox(img_diff)
    if not bbox:
        return None

    def check_edges(horiz):
        if horiz:
            r1 = bbox.left
            r2 = bbox.right
        else:
            r1 = bbox.top
            r2 = bbox.bottom
        ls = []
        for c in range(int(r1), int(r2)):
            if horiz:
                p1 = (c, bbox.top)
                p2 = (c, bbox.bottom)
            else:
                p1 = (bbox.left, c)
                p2 = (bbox.right, c)
            color1 = sum(img_diff_filtered.getpixel(p1))
            color2 = sum(img_diff_filtered.getpixel(p2))
            ls += [int(bool(color1 + color2))]

        if 0 not in ls:
            log.debug("split pos not found")
            return
        i = ls.index(0)
        if i == 0:
            ls.reverse()
            i = ls.index(0)
            i = len(ls) - i - 1
        pos = i + r1
        log.debug("split pos found:%s" % pos)
        if horiz:
            rsegment1 = ScreenRect(0, 0, pos, img_orig.size[1])
            rsegment2 = ScreenRect(pos, 0, img_orig.size[0], img_orig.size[1])
        else:
            rsegment1 = ScreenRect(0, 0, img_orig.size[0], pos)
            rsegment2 = ScreenRect(0, pos, img_orig.size[0], img_orig.size[1])
        box1 = getbbox(img_diff.crop(rsegment1))
        box1.move(rsegment1.topleft)

        box2 = getbbox(img_diff.crop(rsegment2))
        box2.move(rsegment2.topleft)

        return box1, box2

    r = check_edges(0)
    if r is None:
        r = check_edges(1)
    if r is None:
        # in new styles the textbox is not changing
        return [bbox]
    box1, box2 = r
    d1 = darker(img_orig, im_next, box1)
    d2 = darker(img_orig, im_next, box2)
    if d1 == d2:
        log.warning("d1 == d2  %s  %s %s %s", d1, d2, box1, box2)
    if d1 == 1:
        boxes = (box1, box2)
    else:
        boxes = (box2, box1)
    return boxes


text:
layout: page
title: Return-Oriented Programming
permalink: /binaries/rop.html
icon: info_outline
---

* [Advanced Return-to-libc](http://phrack.org/issues/58/4.html) (Phrack 0x3a)
* [Practical ROP Slides](https://www.trailofbits.com/resources/practical_rop_slides.pdf)
* [CoreLAN ROP Exploit Writing Tutorial](https://www.corelan.be/index.php/2010/06/16/exploit-writing-tutorial-part-10-chaining-dep-with-rop-the-rubikstm-cube)


text:
require 'abstract_unit'
require 'action_controller'

class AssetHostMailer < ActionMailer::Base
  def email_with_asset
    recipients 'test@localhost'
    subject    "testing email containing asset path while asset_host is set"
    from       "tester@example.com"
  end
end

class AssetHostTest < Test::Unit::TestCase
  def setup
    set_delivery_method :test
    ActionMailer::Base.perform_deliveries = true
    ActionMailer::Base.deliveries.clear
    AssetHostMailer.configure do |c|
      c.asset_host = "http://www.example.com"
      c.assets_dir = ''
    end
  end

  def teardown
    restore_delivery_method
  end

  def test_asset_host_as_string
    mail = AssetHostMailer.email_with_asset
    assert_equal %Q{}, mail.body.to_s.strip
  end

  def test_asset_host_as_one_arguement_proc
    AssetHostMailer.config.asset_host = Proc.new { |source|
      if source.starts_with?('/images')
        "http://images.example.com"
      else
        "http://assets.example.com"
      end
    }
    mail = AssetHostMailer.email_with_asset
    assert_equal %Q{}, mail.body.to_s.strip
  end

  def test_asset_host_as_two_arguement_proc
    ActionController::Base.config.asset_host = Proc.new {|source,request|
      if request && request.ssl?
        "https://www.example.com"
      else
        "http://www.example.com"
      end
    }
    mail = nil
    assert_nothing_raised { mail = AssetHostMailer.email_with_asset }
    assert_equal %Q{}, mail.body.to_s.strip
  end
end


text:
/* globals WebAppInternals */
RocketChat.settings.get('Site_Url', function(key, value) {
	if (value == null || value.trim() === '') {
		return;
	}
	let host = value.replace(/\/$/, '');
	// let prefix = '';
	const match = value.match(/([^\/]+\/{2}[^\/]+)(\/.+)/);
	if (match != null) {
		host = match[1];
		// prefix = match[2].replace(/\/$/, '');
	}
	__meteor_runtime_config__.ROOT_URL = host;

	if (Meteor.absoluteUrl.defaultOptions && Meteor.absoluteUrl.defaultOptions.rootUrl) {
		Meteor.absoluteUrl.defaultOptions.rootUrl = host;
	}
	if (Meteor.isServer) {
		RocketChat.hostname = host.replace(/^https?:\/\//, '');
		process.env.MOBILE_ROOT_URL = host;
		process.env.MOBILE_DDP_URL = host;
		if (typeof WebAppInternals !== 'undefined' && WebAppInternals.generateBoilerplate) {
			return WebAppInternals.generateBoilerplate();
		}
	}
});


text:
<?php

namespace tests\Http\Discovery\Exception;

use Http\Discovery\Exception as DiscoveryException;
use PHPUnit\Framework\TestCase;

class InitializeExceptionTest extends TestCase
{
    public function testInitialize()
    {
        $e[] = new DiscoveryException\ClassInstantiationFailedException();
        $e[] = new DiscoveryException\NotFoundException();
        $e[] = new DiscoveryException\StrategyUnavailableException();
        $e[] = new DiscoveryException\NoCandidateFoundException('CommonClasses', []);
        $e[] = DiscoveryException\DiscoveryFailedException::create($e);

        foreach ($e as $exception) {
            $this->assertInstanceOf(\Http\Discovery\Exception::class, $exception);
        }
    }
}


text:
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.util;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.util.UserDataHolderEx;
import com.intellij.psi.util.*;
import com.intellij.serviceContainer.NonInjectable;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Set;
import java.util.concurrent.ConcurrentMap;

/**
 * @author ven
 */
public final class CachedValuesManagerImpl extends CachedValuesManager {
  private static final Object NULL = new Object();
  private ConcurrentMap<UserDataHolder, Object> myCacheHolders = ContainerUtil.createConcurrentWeakMap(ContainerUtil.identityStrategy());
  private Set<Key<?>> myKeys = ContainerUtil.newConcurrentSet();

  private final Project myProject;
  private final CachedValuesFactory myFactory;

  public CachedValuesManagerImpl(Project project) {
    myProject = project;

    CachedValuesFactory factory = project.getService(CachedValuesFactory.class);
    myFactory = factory == null ? new DefaultCachedValuesFactory(project) : factory;
  }

  @NonInjectable
  public CachedValuesManagerImpl(Project project, CachedValuesFactory factory) {
    myProject = project;
    myFactory = factory == null ? new DefaultCachedValuesFactory(project) : factory;
  }

  @NotNull
  @Override
  public <T> CachedValue<T> createCachedValue(@NotNull CachedValueProvider<T> provider, boolean trackValue) {
    return myFactory.createCachedValue(provider, trackValue);
  }

  @NotNull
  @Override
  public <T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(@NotNull ParameterizedCachedValueProvider<T,P> provider, boolean trackValue) {
    return myFactory.createParameterizedCachedValue(provider, trackValue);
  }

  @Override
  @Nullable
  public <T> T getCachedValue(@NotNull UserDataHolder dataHolder,
                              @NotNull Key<CachedValue<T>> key,
                              @NotNull CachedValueProvider<T> provider,
                              boolean trackValue) {
    CachedValue<T> value = dataHolder.getUserData(key);
    if (value instanceof CachedValueBase && ((CachedValueBase)value).isFromMyProject(myProject)) {
      Getter<T> data = value.getUpToDateOrNull();
      if (data != null) {
        return data.get();
      }

      CachedValueStabilityChecker.checkProvidersEquivalent(provider, value.getValueProvider(), key);
    }
    if (value == null) {
      value = saveInUserData(dataHolder, key, freshCachedValue(dataHolder, key, provider, trackValue));
    }
    return value.getValue();
  }

  private <T> CachedValue<T> saveInUserData(@NotNull UserDataHolder dataHolder,
                                            @NotNull Key<CachedValue<T>> key, CachedValue<T> value) {
    trackKeyHolder(dataHolder, key);

    if (dataHolder instanceof UserDataHolderEx) {
      return ((UserDataHolderEx)dataHolder).putUserDataIfAbsent(key, value);
    }

    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    synchronized (dataHolder) {
      CachedValue<T> existing = dataHolder.getUserData(key);
      if (existing != null) {
        return existing;
      }
      dataHolder.putUserData(key, value);
      return value;
    }
  }

  @Override
  protected void trackKeyHolder(@NotNull UserDataHolder dataHolder,
                                @NotNull Key<?> key) {
    myCacheHolders.put(dataHolder, NULL);
    myKeys.add(key);
  }

  private <T> CachedValue<T> freshCachedValue(UserDataHolder dh, Key<CachedValue<T>> key, CachedValueProvider<T> provider, boolean trackValue) {
    CachedValueLeakChecker.checkProvider(provider, key, dh);
    CachedValue<T> value = createCachedValue(provider, trackValue);
    assert ((CachedValueBase)value).isFromMyProject(myProject);
    return value;
  }

  @ApiStatus.Internal
  public void clearCachedValues() {
    for (UserDataHolder holder : myCacheHolders.keySet()) {
      for (Key<?> key : myKeys) {
        holder.putUserData(key, null);
      }
    }
    CachedValueStabilityChecker.cleanupFieldCache();
    myCacheHolders = ContainerUtil.createConcurrentWeakMap(ContainerUtil.identityStrategy());
    myKeys = ContainerUtil.newConcurrentSet();
  }
}


text:
using System.Collections.Generic;
using Azure.Core;

namespace Azure.ResourceManager.Network.Models
{
    /// <summary> Response for ListBastionHosts API service call. </summary>
    public partial class BastionHostListResult
    {
        /// <summary> Initializes a new instance of BastionHostListResult. </summary>
        internal BastionHostListResult()
        {
            Value = new ChangeTrackingList<BastionHost>();
        }

        /// <summary> Initializes a new instance of BastionHostListResult. </summary>
        /// <param name="value"> List of Bastion Hosts in a resource group. </param>
        /// <param name="nextLink"> URL to get the next set of results. </param>
        internal BastionHostListResult(IReadOnlyList<BastionHost> value, string nextLink)
        {
            Value = value;
            NextLink = nextLink;
        }

        /// <summary> List of Bastion Hosts in a resource group. </summary>
        public IReadOnlyList<BastionHost> Value { get; }
        /// <summary> URL to get the next set of results. </summary>
        public string NextLink { get; }
    }
}


text:
Welcome to SystemView.

SystemView is a program to visualize trading system statistics. It is written in Python and is compatible with Python 2.7 and later versions.

The current SystemView version as of 14 October 2016 is 0.1.

There are two scripts, the main program is systemview.py, which takes its parameters from parameters.py.

SystemView includes logic for a very simple trading system, always in the market based on the direction of a simple moving average.

You can run SystemView as it is and it will do a demo for you. The demo is designed to use the data file, spx.csv, which is included in the package.

You are welcome to contribute. For information drop an email to BBands@gmail.com

The copyright for SystemView is held by John Bollinger (2016).

Enjoy,

    John Bollinger


text:
package overlay

import (
	"github.com/mafredri/cdp/protocol/dom"
)

// HighlightConfig Configuration data for the highlighting of page elements.
type HighlightConfig struct {
	ShowInfo           *bool     `json:"showInfo,omitempty"`           // Whether the node info tooltip should be shown (default: false).
	ShowRulers         *bool     `json:"showRulers,omitempty"`         // Whether the rulers should be shown (default: false).
	ShowExtensionLines *bool     `json:"showExtensionLines,omitempty"` // Whether the extension lines from node to the rulers should be shown (default: false).
	DisplayAsMaterial  *bool     `json:"displayAsMaterial,omitempty"`  // No description.
	ContentColor       *dom.RGBA `json:"contentColor,omitempty"`       // The content box highlight fill color (default: transparent).
	PaddingColor       *dom.RGBA `json:"paddingColor,omitempty"`       // The padding highlight fill color (default: transparent).
	BorderColor        *dom.RGBA `json:"borderColor,omitempty"`        // The border highlight fill color (default: transparent).
	MarginColor        *dom.RGBA `json:"marginColor,omitempty"`        // The margin highlight fill color (default: transparent).
	EventTargetColor   *dom.RGBA `json:"eventTargetColor,omitempty"`   // The event target element highlight fill color (default: transparent).
	ShapeColor         *dom.RGBA `json:"shapeColor,omitempty"`         // The shape outside fill color (default: transparent).
	ShapeMarginColor   *dom.RGBA `json:"shapeMarginColor,omitempty"`   // The shape margin fill color (default: transparent).
	SelectorList       *string   `json:"selectorList,omitempty"`       // Selectors to highlight relevant nodes.
	CSSGridColor       *dom.RGBA `json:"cssGridColor,omitempty"`       // The grid layout color (default: transparent).
}

// InspectMode
type InspectMode string

// InspectMode as enums.
const (
	InspectModeNotSet               InspectMode = ""
	InspectModeSearchForNode        InspectMode = "searchForNode"
	InspectModeSearchForUAShadowDOM InspectMode = "searchForUAShadowDOM"
	InspectModeNone                 InspectMode = "none"
)

func (e InspectMode) Valid() bool {
	switch e {
	case "searchForNode", "searchForUAShadowDOM", "none":
		return true
	default:
		return false
	}
}

func (e InspectMode) String() string {
	return string(e)
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2020 Google Inc. All Rights Reserved.
  ~
  ~ 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.
  ~
  -->

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.google.mlkit.showcase.translate.main.MainFragment">

    <androidx.camera.view.PreviewView
        android:id="@+id/viewfinder"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toTopOf="@id/middle"
        app:layout_constraintTop_toTopOf="parent" />
    <SurfaceView
        android:id="@+id/overlay"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintStart_toStartOf="@id/viewfinder"
        app:layout_constraintEnd_toEndOf="@id/viewfinder"
        app:layout_constraintBottom_toBottomOf="@id/viewfinder"
        app:layout_constraintTop_toTopOf="@id/viewfinder" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/middle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent=".5" />

    <TextView
        android:id="@+id/srcLang"
        style="@style/SrcLangText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="20dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="20dp"
        android:layout_marginBottom="4dp"
        app:layout_constraintBottom_toTopOf="@+id/srcTextScrollView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/middle"
        tools:text="source lang" />

    <ScrollView
        android:id="@+id/srcTextScrollView"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginBottom="4dp"
        android:fillViewport="true"
        android:scrollbars="vertical"
        app:layout_constraintBottom_toTopOf="@+id/divider"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/srcLang">

        <TextView
            android:id="@+id/srcText"
            style="@style/SrcText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:layout_marginEnd="20dp"
            tools:text="source text" />
    </ScrollView>

    <View
        android:id="@+id/divider"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_marginStart="20dp"
        android:layout_marginEnd="20dp"
        android:background="?android:attr/listDivider"
        app:layout_constraintBottom_toTopOf="@+id/targetLangSelector"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/srcTextScrollView" />

    <Spinner
        android:id="@+id/targetLangSelector"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="20dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/divider" />

    <ScrollView
        android:id="@+id/translatedTextScrollView"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginBottom="4dp"
        android:fillViewport="true"
        android:scrollbars="vertical"
        app:layout_constraintBottom_toTopOf="@+id/divider2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/targetLangSelector">

        <TextView
            android:id="@+id/translatedText"
            style="@style/TranslatedText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:layout_marginEnd="20dp"
            android:layout_marginBottom="4dp"
            tools:text="translated text" />
    </ScrollView>

    <View
        android:id="@+id/divider2"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_marginStart="20dp"
        android:layout_marginTop="4dp"
        android:layout_marginEnd="20dp"
        android:layout_marginBottom="4dp"
        android:background="?android:attr/listDivider"
        app:layout_constraintBottom_toTopOf="@id/imageView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/translatedTextScrollView" />

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="18dp"
        android:layout_marginStart="4dp"
        android:layout_marginTop="4dp"
        android:layout_marginEnd="4dp"
        android:layout_marginBottom="4dp"
        android:contentDescription="@string/content_description_google_translate_attribution"
        android:scaleType="fitCenter"
        android:src="@drawable/greyscale_regular_3x"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/divider2" />

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyle"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:visibility="invisible"
        app:layout_constraintStart_toEndOf="@+id/targetLangSelector"
        app:layout_constraintTop_toTopOf="@id/targetLangSelector"
        app:layout_constraintBottom_toBottomOf="@id/targetLangSelector" />

    <TextView
        android:id="@+id/progressText"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:text="@string/downloading_model_files"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/progressBar"
        app:layout_constraintBottom_toBottomOf="@id/progressBar"
        android:gravity="center_vertical"
        app:layout_constraintTop_toTopOf="@id/progressBar" />

</androidx.constraintlayout.widget.ConstraintLayout>


text:
var util = require('util');
var Transform = require('stream').Transform;
var _ = require("underscore");

function Srough(transform, flush, options) {
  options = _.defaults({objectMode: true}, options || {});
  Transform.call(this, options);
  this.__transform = (transform || defaultTransform).bind(this);
  this.__flush = (flush || defaultFlush).bind(this);
  this.queue = this.push;
}
util.inherits(Srough, Transform);

Srough.prototype._transform = function (chunk, encoding, cb) {
  this.__transform(chunk, cb);
}

Srough.prototype._flush = function (cb) {
  this.__flush(cb);
}

function defaultTransform(data, done) {
  this.push(data);
  done();
}

function defaultFlush(done) {
  done();
}

module.exports = function (write, end) {
  return new Srough(write, end);
}


text:
// Package pipelines defines the pipeline and the resources.
package pipelines

import (
	"container/list"
	"fmt"

	"github.com/recruit-tech/walter/messengers"
	"github.com/recruit-tech/walter/services"
	"github.com/recruit-tech/walter/stages"
)

// Pipeline stores the list of stages.
type Pipeline struct {
	Stages list.List
}

// Resources stores the settings loaded from the configuation file.
type Resources struct {
	// Pipeline stores the list of stages to be executed.
	Pipeline *Pipeline

	// Cleanup stores the list of stages extecuted after Pipeline.
	Cleanup *Pipeline

	// Reporter stores the messenger client which report the result to the server.
	Reporter messengers.Messenger

	// RepoService is a client of VCS services such as GitHub and reports the result to the service.
	RepoService services.Service
}

// ReportStageResult throw the results of specified stage to the messenger services.
func (resources *Resources) ReportStageResult(stage stages.Stage, resultStr string) {
	name := stage.GetStageName()
	if !resources.Reporter.Suppress("result") {
		if resultStr == "true" {
			resources.Reporter.Post(
				fmt.Sprintf("[%s][RESULT] Succeeded", name))
		} else if resultStr == "skipped" {
			resources.Reporter.Post(
				fmt.Sprintf("[%s][RESULT] Skipped", name))
		} else {
			resources.Reporter.Post(
				fmt.Sprintf("[%s][RESULT] Failed", name))
		}
	}

	if stage.GetStageOpts().ReportingFullOutput {
		if out := stage.GetOutResult(); (len(out) > 0) && (!resources.Reporter.Suppress("stdout")) {
			resources.Reporter.Post(
				fmt.Sprintf("[%s][STDOUT] %s", name, stage.GetOutResult()))
		}
		if err := stage.GetErrResult(); len(err) > 0 && (!resources.Reporter.Suppress("stderr")) {
			resources.Reporter.Post(
				fmt.Sprintf("[%s][STDERR] %s", name, stage.GetErrResult()))
		}
	}
}

// AddStage appends specified stage to the pipeline.
func (resources *Pipeline) AddStage(stage stages.Stage) {
	resources.Stages.PushBack(stage)
}

// Size returns the number of stages in the pipeline.
func (resources *Pipeline) Size() int {
	return resources.Stages.Len()
}

//Build builds a pipeline for the current resources
func (resources *Pipeline) Build() {
	resources.buildDeps(&resources.Stages)
}

func (resources *Pipeline) buildDeps(stages *list.List) {
}

//NewPipeline create a new pipeline instance
func NewPipeline() *Pipeline {
	return &Pipeline{}
}


text:
package org.elasticsearch.xpack.security.authc;

import org.elasticsearch.Version;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.xpack.core.security.authc.Authentication;

import java.io.IOException;
import java.time.DateTimeException;
import java.time.Instant;
import java.util.Base64;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;

/**
 * This token is a combination of a {@link Authentication} object with an expiry. This token can be
 * serialized for use later. Note, if serializing this token to a entity outside of the cluster,
 * care must be taken to encrypt and validate the serialized bytes or they cannot be trusted.
 *
 * Additionally, care must also be used when transporting these tokens as a stolen token can be
 * used by an adversary to gain access. For this reason, TLS must be enabled for these tokens to
 * be used.
 */
public final class UserToken implements Writeable, ToXContentObject {

    private final Version version;
    private final String id;
    private final Authentication authentication;
    private final Instant expirationTime;
    private final Map<String, Object> metadata;

    /**
     * Create a new token with an autogenerated id
     */
    UserToken(Authentication authentication, Instant expirationTime) {
        this(Version.CURRENT, authentication, expirationTime, Collections.emptyMap());
    }

    /**
     * Create a new token with an autogenerated id
     */
    private UserToken(Version version, Authentication authentication, Instant expirationTime, Map<String, Object> metadata) {
        this(UUIDs.randomBase64UUID(), version, authentication, expirationTime, metadata);
    }

    /**
     * Create a new token from an existing id
     */
    UserToken(String id, Version version, Authentication authentication, Instant expirationTime, Map<String, Object> metadata) {
        this.version = Objects.requireNonNull(version);
        this.id = Objects.requireNonNull(id);
        this.authentication = Objects.requireNonNull(authentication);
        this.expirationTime = Objects.requireNonNull(expirationTime);
        this.metadata = metadata;
    }

    /**
     * Creates a new token based on the values from the stream
     */
    UserToken(StreamInput input) throws IOException {
        this.version = input.getVersion();
        this.id = input.readString();
        this.authentication = new Authentication(input);
        this.expirationTime = Instant.ofEpochSecond(input.readLong(), input.readInt());
        this.metadata = input.readMap();
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        out.writeString(id);
        authentication.writeTo(out);
        out.writeLong(expirationTime.getEpochSecond());
        out.writeInt(expirationTime.getNano());
        out.writeMap(metadata);
    }

    /**
     * Get the authentication (will not be null)
     */
    Authentication getAuthentication() {
        return authentication;
    }

    /**
     * Get the expiration time
     */
    Instant getExpirationTime() {
        return expirationTime;
    }

    /**
     * The ID of this token
     */
    public String getId() {
        return id;
    }

    /**
     * The version of the node this token was created on
     */
    Version getVersion() {
        return version;
    }

    /**
     * The metadata associated with this token
     */
    public Map<String, Object> getMetadata() {
        return metadata;
    }

    @Override
    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
        builder.startObject();
        builder.field("id", id);
        builder.field("expiration_time", expirationTime.toEpochMilli());
        builder.field("version", version.id);
        builder.field("metadata", metadata);
        try (BytesStreamOutput output = new BytesStreamOutput()) {
            output.setVersion(version);
            authentication.writeTo(output);
            builder.field("authentication", output.bytes().toBytesRef().bytes);
        }
        return builder.endObject();
    }

    static UserToken fromSourceMap(Map<String, Object> source) throws IllegalStateException, DateTimeException {
        final String id = (String) source.get("id");
        if (id == null) {
            throw new IllegalStateException("user token source document does not have the \"id\" field");
        }
        final Long expirationEpochMilli = (Long) source.get("expiration_time");
        if (expirationEpochMilli == null) {
            throw new IllegalStateException("user token source document does not have the \"expiration_time\" field");
        }
        final Integer versionId = (Integer) source.get("version");
        if (versionId == null) {
            throw new IllegalStateException("user token source document does not have the \"version\" field");
        }
        final Map<String, Object> metadata = (Map<String, Object>) source.get("metadata");
        final String authString = (String) source.get("authentication");
        if (authString == null) {
            throw new IllegalStateException("user token source document does not have the \"authentication\" field");
        }
        final Version version = Version.fromId(versionId);
        try (StreamInput in = StreamInput.wrap(Base64.getDecoder().decode(authString))) {
            in.setVersion(version);
            Authentication authentication = new Authentication(in);
            return new UserToken(id, version, authentication, Instant.ofEpochMilli(expirationEpochMilli), metadata);
        } catch (IOException e) {
            throw new IllegalStateException("user token source document contains malformed \"authentication\" field", e);
        }
    }
}


text:
package spark.scheduler

import spark.TaskContext

import java.util.Properties

/**
 * Tracks information about an active job in the DAGScheduler.
 */
private[spark] class ActiveJob(
    val runId: Int,
    val finalStage: Stage,
    val func: (TaskContext, Iterator[_]) => _,
    val partitions: Array[Int],
    val callSite: String,
    val listener: JobListener,
    val properties: Properties) {

  val numPartitions = partitions.length
  val finished = Array.fill[Boolean](numPartitions)(false)
  var numFinished = 0
}


text:
<?php
$mymail_capabilities = apply_filters('mymail_capabilities', array(

		'edit_newsletters' => array(
			'title' => __('edit campaigns' ,'mymail'),
			'roles' => array('contributor', 'author', 'editor')
		),

		'publish_newsletters' => array(
			'title' => __('send campaigns' ,'mymail'),
			'roles' => array('author', 'editor')
		),

		'delete_newsletters' => array(
			'title' => __('delete campaigns' ,'mymail'),
			'roles' => array('contributor', 'author', 'editor')
		),

		'edit_others_newsletters' => array(
			'title' => __('edit others campaigns' ,'mymail'),
			'roles' => array('editor')
		),

		'delete_others_newsletters' => array(
			'title' => __('delete others campaigns' ,'mymail'),
			'roles' => array('editor')
		),

		'duplicate_newsletters' => array(
			'title' => __('duplicate campaigns' ,'mymail'),
			'roles' => array('author', 'editor')
		),

		'duplicate_others_newsletters' => array(
			'title' => __('duplicate others campaigns' ,'mymail'),
			'roles' => array('author', 'editor')
		),

		'mymail_edit_autoresponders' => array(
			'title' => __('edit autoresponders' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_edit_others_autoresponders' => array(
			'title' => __('edit others autoresponders' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_change_template' => array(
			'title' => __('change template' ,'mymail'),
			'roles' => array('editor')
		),
		'mymail_save_template' => array(
			'title' => __('save template' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_see_codeview' => array(
			'title' => __('see codeview' ,'mymail'),
			'roles' => array('editor')
		),

		'edit_subscribers' => array(
			'title' => __('edit subscribers' ,'mymail'),
			'roles' => array('contributor', 'author', 'editor')
		),

		'publish_subscribers' => array(
			'title' => __('create subscribers' ,'mymail'),
			'roles' => array('author', 'editor')
		),

		'edit_others_subscribers' => array(
			'title' => __('edit others subscribers' ,'mymail'),
			'roles' => array('editor')
		),

		'delete_subscribers' => array(
			'title' => __('delete subscribers' ,'mymail'),
			'roles' => array('contributor', 'author', 'editor')
		),

		'delete_others_subscribers' => array(
			'title' => __('delete others subscribers' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_edit_lists' => array(
			'title' => __('edit lists' ,'mymail'),
			'roles' => array('author', 'editor')
		),

		'mymail_delete_lists' => array(
			'title' => __('delete lists' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_assign_lists' => array(
			'title' => __('assign lists' ,'mymail'),
			'roles' => array('contributor', 'author', 'editor')
		),

		'mymail_manage_subscribers' => array(
			'title' => __('manage subscribers' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_import_subscribers' => array(
			'title' => __('import subscribers' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_export_subscribers' => array(
			'title' => __('export subscribers' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_manage_templates' => array(
			'title' => __('manage templates' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_edit_templates' => array(
			'title' => __('edit templates' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_delete_templates' => array(
			'title' => __('delete templates' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_upload_templates' => array(
			'title' => __('upload templates' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_dashboard_widget' => array(
			'title' => __('see dashboard widget' ,'mymail'),
			'roles' => array('editor')
		),

		'mymail_manage_capabilities' => array(
			'title' => __('manage capabilities' ,'mymail'),
			'roles' => array()
		),

));

?>


text:
"""Generational ClusterFuzz fuzzer. It generates IPC messages using
GenerateTraits. Support of GenerateTraits for different types will be gradually
added.
"""

import os
import random
import subprocess
import sys
import utils

FUZZER_NAME_OPTION = '--fuzzer-name=generate'
MAX_IPC_MESSAGES_PER_TESTCASE = 1500

class GenerationalFuzzer:

  def __init__(self):
    self.args = utils.parse_arguments()

    self.ipc_fuzzer_binary = utils.get_fuzzer_application_name()
    self.ipc_fuzzer_binary_path = utils.get_application_path(
        self.ipc_fuzzer_binary)

  def generate_ipcdump_testcase(self):
    ipcdump_testcase_path = (
        utils.random_ipcdump_testcase_path(self.args.output_dir))
    num_ipc_messages = random.randint(1, MAX_IPC_MESSAGES_PER_TESTCASE)
    count_option = '--count=%d' % num_ipc_messages

    cmd = [
        self.ipc_fuzzer_binary_path,
        FUZZER_NAME_OPTION,
        count_option,
        ipcdump_testcase_path,
    ]

    if subprocess.call(cmd):
      sys.exit('%s failed.' % self.ipc_fuzzer_binary)

    utils.create_flags_file(ipcdump_testcase_path)

  def main(self):
    for _ in xrange(self.args.no_of_files):
      self.generate_ipcdump_testcase()

    return 0

if __name__ == '__main__':
  fuzzer = GenerationalFuzzer()
  sys.exit(fuzzer.main())


text:
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [7.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.3.0...@quenty/datastore@7.4.0) (2022-11-12)

**Note:** Version bump only for package @quenty/datastore

# [7.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.2.1...@quenty/datastore@7.3.0) (2022-11-08)

**Note:** Version bump only for package @quenty/datastore

## [7.2.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.2.0...@quenty/datastore@7.2.1) (2022-11-04)

**Note:** Version bump only for package @quenty/datastore

# [7.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.1.0...@quenty/datastore@7.2.0) (2022-10-28)

### Bug Fixes

* Import maid ([638e529](https://github.com/Quenty/NevermoreEngine/commit/638e529d87b3ae4df73482e91153540f41baaf36))

### Features

* Free DataStore key after its writer GCs to allow future writers ([9b2e8a2](https://github.com/Quenty/NevermoreEngine/commit/9b2e8a29332aacb99ac47550af37708f58cd39e5))

# [7.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.0.0...@quenty/datastore@7.1.0) (2022-10-11)

### Bug Fixes

* Remove init.meta.json since it breaks in team create ([cba21e6](https://github.com/Quenty/NevermoreEngine/commit/cba21e602b50ea3799044eae9cb690d1cd9c88ec))

# [7.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@6.1.0...@quenty/datastore@7.0.0) (2022-09-27)

### Bug Fixes

* Hide server code by default from replication using cameras and init.meta.json. ([5636dd8](https://github.com/Quenty/NevermoreEngine/commit/5636dd8cafe68db4571ed214a82b84698f2f74c0))

### Features

* Add BindToCloseService package and implement across places binding to close ([afdd829](https://github.com/Quenty/NevermoreEngine/commit/afdd829538c9d0ce2d6f51ad9fee9063f0f5bd24))

# [6.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@6.0.1...@quenty/datastore@6.1.0) (2022-08-22)

**Note:** Version bump only for package @quenty/datastore

## [6.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@6.0.0...@quenty/datastore@6.0.1) (2022-08-16)

**Note:** Version bump only for package @quenty/datastore

# [6.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@5.3.0...@quenty/datastore@6.0.0) (2022-08-14)

### Features

* Add ServiceName to most services for faster debugging ([39fc3f4](https://github.com/Quenty/NevermoreEngine/commit/39fc3f4f2beb92fff49b2264424e07af7907324e))

# [5.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@5.2.0...@quenty/datastore@5.3.0) (2022-07-31)

### Bug Fixes

* Add DataStore SetCacheTime (not implemented yet) ([906e723](https://github.com/Quenty/NevermoreEngine/commit/906e72397075200e8cb8b98bc8b7b7f96d992907))

### Features

* Add GameDataStoreService service for global game data ([5f6d52c](https://github.com/Quenty/NevermoreEngine/commit/5f6d52ca9f2be811c426714cd6d94d9794f366b5))
* Support StoreOnValueChange with non ValueBase instances. ([ab45498](https://github.com/Quenty/NevermoreEngine/commit/ab4549833f41f2b3d8b43202965fd3202b649770))

# [5.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@5.1.0...@quenty/datastore@5.2.0) (2022-07-02)

### Bug Fixes

* Can clean up services properly ([eb45e03](https://github.com/Quenty/NevermoreEngine/commit/eb45e03ce2897b18f1ae460974bf2bbb9e27cb97))

### Features

* Add DataStorePromises support for ordered data stores ([927bdd9](https://github.com/Quenty/NevermoreEngine/commit/927bdd94b68eef114cff5a1eb6dc03d6db5867d8))

# [5.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@5.0.0...@quenty/datastore@5.1.0) (2022-06-21)

### Bug Fixes

* Add better warnings for when store is already destroyed while writing or storing ([77544eb](https://github.com/Quenty/NevermoreEngine/commit/77544ebf9620c1f34b62d92eb45e9c95c819186f))

# [5.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@4.3.0...@quenty/datastore@5.0.0) (2022-05-21)

**Note:** Version bump only for package @quenty/datastore

# [4.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@4.2.0...@quenty/datastore@4.3.0) (2022-03-27)

**Note:** Version bump only for package @quenty/datastore

# [4.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@4.1.0...@quenty/datastore@4.2.0) (2022-03-20)

**Note:** Version bump only for package @quenty/datastore

# [4.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@4.0.0...@quenty/datastore@4.1.0) (2022-03-10)

**Note:** Version bump only for package @quenty/datastore

# [4.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.6.0...@quenty/datastore@4.0.0) (2022-03-06)

### Features

* Can add removing promises to datastore before save ([653bef8](https://github.com/Quenty/NevermoreEngine/commit/653bef8717e4470cf94340e67ff69eab1b7269f6))

# [3.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.5.1...@quenty/datastore@3.6.0) (2022-01-17)

### Features

* Add optional PlayerDataStoreService to centralize datastore usage across submodules. ([1c4349f](https://github.com/Quenty/NevermoreEngine/commit/1c4349fa3ed4ef59ed41117319057ca9e2bd6dfd))

## [3.5.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.5.0...@quenty/datastore@3.5.1) (2022-01-16)

**Note:** Version bump only for package @quenty/datastore

# [3.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.4.0...@quenty/datastore@3.5.0) (2022-01-07)

**Note:** Version bump only for package @quenty/datastore

# [3.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.3.2...@quenty/datastore@3.4.0) (2022-01-03)

**Note:** Version bump only for package @quenty/datastore

## [3.3.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.3.1...@quenty/datastore@3.3.2) (2021-12-30)

**Note:** Version bump only for package @quenty/datastore

## [3.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.3.0...@quenty/datastore@3.3.1) (2021-12-30)

**Note:** Version bump only for package @quenty/datastore

# [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.2.0...@quenty/datastore@3.3.0) (2021-12-18)

**Note:** Version bump only for package @quenty/datastore

# [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.1.2...@quenty/datastore@3.2.0) (2021-11-20)

### Bug Fixes

* Support MacOS syncing ([#225](https://github.com/Quenty/NevermoreEngine/issues/225)) ([03f9183](https://github.com/Quenty/NevermoreEngine/commit/03f918392c6a5bdd33f8a17c38de371d1e06c67a))

## [3.1.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.1.1...@quenty/datastore@3.1.2) (2021-10-30)

**Note:** Version bump only for package @quenty/datastore

## [3.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.1.0...@quenty/datastore@3.1.1) (2021-10-06)

**Note:** Version bump only for package @quenty/datastore

# [3.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.0.1...@quenty/datastore@3.1.0) (2021-10-02)

**Note:** Version bump only for package @quenty/datastore

## [3.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@3.0.0...@quenty/datastore@3.0.1) (2021-09-18)

### Bug Fixes

* Fix undeclare package dependencies that prevented loading in certain situations ([a8be7e0](https://github.com/Quenty/NevermoreEngine/commit/a8be7e06a06506a71257862429934e2ed0f6f56b))

# [3.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@2.1.0...@quenty/datastore@3.0.0) (2021-09-11)

**Note:** Version bump only for package @quenty/datastore

# [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@2.0.0...@quenty/datastore@2.1.0) (2021-09-05)

**Note:** Version bump only for package @quenty/datastore

# [2.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@1.2.0...@quenty/datastore@2.0.0) (2021-09-05)

### Bug Fixes

* Remove peer dependencies. This is because lerna doesn't really support peer dependencies being linked and getting a new version on build, which is unfortunate. ([5f5aeee](https://github.com/Quenty/NevermoreEngine/commit/5f5aeeea8de9975435309e53679f0ef7064f9dd0))

# 1.2.0 (2021-07-31)

### Bug Fixes

* Add CI and CD ([47513e9](https://github.com/Quenty/NevermoreEngine/commit/47513e9b568162707534af132396dd8756947dd3))
* Adjust CI badge to show automatic build and release state ([5a55d3f](https://github.com/Quenty/NevermoreEngine/commit/5a55d3f19bf8d66a760d67da9b56ed47fab74656))
* Fix selene linting ([45fc074](https://github.com/Quenty/NevermoreEngine/commit/45fc07489ee59127ac6582689f19a0e87c1e5b5a))

## 1.0.2 (2021-07-25)

## 1.0.1 (2021-07-25)

# 1.0.0 (2021-07-24)


text:
import time
from functools import wraps
from evaluator import SimpleEvaluator

def get_time(method):
    """
    Decorator for checking function execution time.
    :param method: function to be tested
    :return: tuple containing function result and time (in seconds) float value
    """

    @wraps(method)
    def wrapper(*args, **kwargs):
        start = time.time()
        result = method(*args, **kwargs)
        end = time.time()
        return result, (end - start)

    return wrapper

class Benchmark:
    """
    Takes care of evaluating provided set of methods.
    """

    def __init__(self, test_cases, result_evaluator=SimpleEvaluator()):
        """
        Initializes benchmark instance.
        Benchmark uses provided set of test cases for evaluating algorithms.
        :param test_cases: set of two-element tuples. Each tuple is in form of with (input, answer) where input refers
        to the arguments passed to the tested method and the answer is expected result of tested algorithm.
        :param result_evaluator: instance of an object used to assign scores to individual answers. Uses SimpleEvaluator
        by default.
        """
        self.test_cases = test_cases
        self.evaluator = result_evaluator

    def evaluate_method(self, method):
        """
        Runs method on test cases and returns overall score.
        :param method: function to test. Function should accept one argument, an input from test case tuple.
        :return: float value, score achieved by method
        """

        @get_time
        def test_method_on_input(test_case):
            return method(test_case)

        results = [test_method_on_input(test) for (test, _) in self.test_cases]
        return sum(self.evaluator.get_score(proper_answer, *result)
                   for (_, proper_answer), result in zip(self.test_cases, results))


text:
package org.apache.giraph.edge;

import it.unimi.dsi.fastutil.longs.Long2DoubleMap;
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Iterator;

import org.apache.giraph.utils.EdgeIterables;
import org.apache.giraph.utils.Trimmable;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;

import com.google.common.collect.UnmodifiableIterator;

/**
 * {@link OutEdges} implementation with long ids and double edge values,
 * backed by a {@link Long2DoubleOpenHashMap}.
 * Parallel edges are not allowed.
 * Note: this implementation is optimized for fast random access and mutations,
 * and uses less space than a generic {@link HashMapEdges} (but more than
 * {@link LongDoubleArrayEdges}.
 */
public class LongDoubleHashMapEdges
    implements StrictRandomAccessOutEdges<LongWritable, DoubleWritable>,
    ReuseObjectsOutEdges<LongWritable, DoubleWritable>,
    MutableOutEdges<LongWritable, DoubleWritable>, Trimmable {
  /** Hash map from target vertex id to edge value. */
  private Long2DoubleOpenHashMap edgeMap;
  /** Representative edge value object, used by getEdgeValue(). */
  private DoubleWritable representativeEdgeValue;

  @Override
  public void initialize(Iterable<Edge<LongWritable, DoubleWritable>> edges) {
    EdgeIterables.initialize(this, edges);
  }

  @Override
  public void initialize(int capacity) {
    edgeMap = new Long2DoubleOpenHashMap(capacity);
  }

  @Override
  public void initialize() {
    edgeMap = new Long2DoubleOpenHashMap();
  }

  @Override
  public void add(Edge<LongWritable, DoubleWritable> edge) {
    edgeMap.put(edge.getTargetVertexId().get(), edge.getValue().get());
  }

  @Override
  public void remove(LongWritable targetVertexId) {
    edgeMap.remove(targetVertexId.get());
  }

  @Override
  public DoubleWritable getEdgeValue(LongWritable targetVertexId) {
    if (!edgeMap.containsKey(targetVertexId.get())) {
      return null;
    }
    if (representativeEdgeValue == null) {
      representativeEdgeValue = new DoubleWritable();
    }
    representativeEdgeValue.set(edgeMap.get(targetVertexId.get()));
    return representativeEdgeValue;
  }

  @Override
  public void setEdgeValue(LongWritable targetVertexId,
                           DoubleWritable edgeValue) {
    if (edgeMap.containsKey(targetVertexId.get())) {
      edgeMap.put(targetVertexId.get(), edgeValue.get());
    }
  }

  @Override
  public int size() {
    return edgeMap.size();
  }

  @Override
  public Iterator<Edge<LongWritable, DoubleWritable>> iterator() {
    // Returns an iterator that reuses objects.
    return new UnmodifiableIterator<Edge<LongWritable, DoubleWritable>>() {
      /** Wrapped map iterator. */
      private final ObjectIterator<Long2DoubleMap.Entry> mapIterator =
          edgeMap.long2DoubleEntrySet().fastIterator();
      /** Representative edge object. */
      private final ReusableEdge<LongWritable, DoubleWritable>
      representativeEdge =
          EdgeFactory.createReusable(new LongWritable(), new DoubleWritable());

      @Override
      public boolean hasNext() {
        return mapIterator.hasNext();
      }

      @Override
      public Edge<LongWritable, DoubleWritable> next() {
        Long2DoubleMap.Entry nextEntry = mapIterator.next();
        representativeEdge.getTargetVertexId().set(nextEntry.getLongKey());
        representativeEdge.getValue().set(nextEntry.getDoubleValue());
        return representativeEdge;
      }
    };
  }

  @Override
  public void trim() {
    edgeMap.trim();
  }

  /** Helper class for a mutable edge that modifies the backing map entry. */
  private static class LongDoubleHashMapMutableEdge
      extends DefaultEdge<LongWritable, DoubleWritable> {
    /** Backing entry for the edge in the map. */
    private Long2DoubleMap.Entry entry;

    /** Constructor. */
    public LongDoubleHashMapMutableEdge() {
      super(new LongWritable(), new DoubleWritable());
    }

    /**
     * Make the edge point to the given entry in the backing map.
     *
     * @param entry Backing entry
     */
    public void setEntry(Long2DoubleMap.Entry entry) {
      // Update the id and value objects from the superclass.
      getTargetVertexId().set(entry.getLongKey());
      getValue().set(entry.getDoubleValue());
      // Update the entry.
      this.entry = entry;
    }

    @Override
    public void setValue(DoubleWritable value) {
      // Update the value object from the superclass.
      getValue().set(value.get());
      // Update the value stored in the backing map.
      entry.setValue(value.get());
    }
  }

  @Override
  public Iterator<MutableEdge<LongWritable, DoubleWritable>> mutableIterator() {
    return new Iterator<MutableEdge<LongWritable, DoubleWritable>>() {
      /**
       * Wrapped map iterator.
       * Note: we cannot use the fast iterator in this case,
       * because we need to call setValue() on an entry.
       */
      private final ObjectIterator<Long2DoubleMap.Entry> mapIterator =
          edgeMap.long2DoubleEntrySet().iterator();
      /** Representative edge object. */
      private final LongDoubleHashMapMutableEdge representativeEdge =
          new LongDoubleHashMapMutableEdge();

      @Override
      public boolean hasNext() {
        return mapIterator.hasNext();
      }

      @Override
      public MutableEdge<LongWritable, DoubleWritable> next() {
        representativeEdge.setEntry(mapIterator.next());
        return representativeEdge;
      }

      @Override
      public void remove() {
        mapIterator.remove();
      }
    };
  }

  @Override
  public void write(DataOutput out) throws IOException {
    out.writeInt(edgeMap.size());
    for (Long2DoubleMap.Entry entry : edgeMap.long2DoubleEntrySet()) {
      out.writeLong(entry.getLongKey());
      out.writeDouble(entry.getDoubleValue());
    }
  }

  @Override
  public void readFields(DataInput in) throws IOException {
    int numEdges = in.readInt();
    initialize(numEdges);
    for (int i = 0; i < numEdges; ++i) {
      edgeMap.put(in.readLong(), in.readDouble());
    }
  }
}


text:
from django.conf.urls import url

from api.crossref import views

app_name = 'osf'

urlpatterns = [
    url(r'^email/$', views.ParseCrossRefConfirmation.as_view(), name=views.ParseCrossRefConfirmation.view_name),
]


text:
// Copyright 2015 Google Inc. All rights reserved.
//
// 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.

#ifndef FPL_ZOOSHI_COMPONENTS_SOUND_H_
#define FPL_ZOOSHI_COMPONENTS_SOUND_H_

#include "components_generated.h"
#include "corgi/component.h"
#include "corgi/entity_manager.h"
#include "pindrop/pindrop.h"

namespace fpl {
namespace zooshi {

// Data for scene object components.
struct SoundData {
  pindrop::Channel channel;
};

class SoundComponent : public corgi::Component<SoundData> {
 public:
  virtual ~SoundComponent() {}

  virtual void Init();
  virtual void InitEntity(corgi::EntityRef& /*entity*/) {}
  virtual void AddFromRawData(corgi::EntityRef& parent, const void* raw_data);
  virtual void CleanupEntity(corgi::EntityRef& entity);
  virtual void UpdateAllEntities(corgi::WorldTime delta_time);

 private:
  pindrop::AudioEngine* audio_engine_;
};

}  // zooshi
}  // fpl

CORGI_REGISTER_COMPONENT(fpl::zooshi::SoundComponent, fpl::zooshi::SoundData)

#endif  // FPL_ZOOSHI_COMPONENTS_SOUND_H_


text:
package com.evolveum.midpoint.provisioning.ucf.util;

import java.util.Map;
import java.util.Map.Entry;

import javax.xml.namespace.QName;

import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.common.objects.OperationOptions;

import com.evolveum.midpoint.prism.PrismPropertyValue;
import com.evolveum.midpoint.prism.crypto.EncryptionException;
import com.evolveum.midpoint.prism.crypto.Protector;
import com.evolveum.midpoint.util.PrettyPrinter;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SystemException;

public class UcfUtil {

	public static Object convertValueToIcf(Object value, Protector protector, QName propName) throws SchemaException {
		if (value == null) {
			return null;
		}

		if (value instanceof PrismPropertyValue) {
			return convertValueToIcf(((PrismPropertyValue) value).getValue(), protector, propName);
		}

		if (value instanceof ProtectedStringType) {
			ProtectedStringType ps = (ProtectedStringType) value;
			return toGuardedString(ps, protector, propName.toString());
		}
		return value;
	}

	public static GuardedString toGuardedString(ProtectedStringType ps, Protector protector, String propertyName) {
		if (ps == null) {
			return null;
		}
		if (!protector.isEncrypted(ps)) {
			if (ps.getClearValue() == null) {
				return null;
			}
//			LOGGER.warn("Using cleartext value for {}", propertyName);
			return new GuardedString(ps.getClearValue().toCharArray());
		}
		try {
			return new GuardedString(protector.decryptString(ps).toCharArray());
		} catch (EncryptionException e) {
//			LOGGER.error("Unable to decrypt value of element {}: {}",
//					new Object[] { propertyName, e.getMessage(), e });
			throw new SystemException("Unable to decrypt value of element " + propertyName + ": "
					+ e.getMessage(), e);
		}
	}

	public static String dumpOptions(OperationOptions options) {
		if (options == null) {
			return "null";
		}
		StringBuilder sb = new StringBuilder();
		sb.append("OperationOptions(");
		Map<String, Object> map = options.getOptions();
		if (map == null) {
			sb.append("null");
		} else {
			for (Entry<String,Object> entry: map.entrySet()) {
				sb.append(entry.getKey());
				sb.append("=");
				sb.append(PrettyPrinter.prettyPrint(entry.getValue()));
				sb.append(",");
			}
		}
		sb.append(")");
		return sb.toString();
	}

}


text:
package org.cyclopath.android.gwis;

import org.w3c.dom.Document;

/**
 * Gets a trial condition for this user for the landmarks experiment
 * @author Fernando Torre
 */
public class GWIS_LandmarkTrialGet extends GWIS {

   /** callback to handle trial information */
   public GWIS_LandmarkTrialGetCallback callback;
   /** trial for which to get information */
   public int trial_num;

   /**
    * Constructor
    */
   public GWIS_LandmarkTrialGet(GWIS_LandmarkTrialGetCallback callback) {
      this(-1, callback);
   }

   /**
    * Constructor
    */
   public GWIS_LandmarkTrialGet(int trial_num,
                                GWIS_LandmarkTrialGetCallback callback) {
      super("landmark_trial_get");
      this.trial_num = trial_num;
      this.callback = callback;
      if (trial_num > 0) {
         this.url += "&trial_num=" + trial_num;
      }
   }

   @Override
   public GWIS clone() {
      GWIS_LandmarkTrialGet g = new GWIS_LandmarkTrialGet(this.trial_num,
                                                          this.callback);
      g.retrying = true;
      return g;
   }

   /**
    * Sets the global landmark condition.
    */
   @Override
   protected void processResultset(Document rset) {
      super.processResultset(rset);
      if (this.callback != null) {
         this.callback.handleGWIS_LandmarkTrialGetComplete(rset);
      }
   }

}