text:
describe("Core/Function", function() {
  "use strict";

  var testCase = sc.test.testCase;
  var $$ = sc.test.object;
  var $  = sc.lang.$;
  var SCFunction = $("Function");
  var SCArray = $("Array");

  describe("SCFunction", function() {
    before(function() {
      this.createInstance = function(func, def) {
        return $.Function(function() {
          return [ func || function() {} ];
        }, def || null, null);
      };
    });

    it("#__tag", function() {
      var instance, test;

      instance = this.createInstance();

      test = instance.__tag;
      expect(test).to.be.a("JSNumber").that.equals(sc.TAG_FUNC);
    });
    it.skip("<def", function() {
    });

    it(".new", function() {
      expect(SCFunction.new.__errorType).to.equal(sc.ERRID_SHOULD_USE_LITERALS);
    });

    it("#isFunction", function() {
      var instance, test;

      instance = this.createInstance();

      test = instance.isFunction();
      expect(test).to.be.a("SCBoolean").that.is.true;
    });
    it.skip("#isClosed", function() {
    });

    it("#archiveAsCompileString", function() {
      var instance, test;

      instance = this.createInstance();

      test = instance.archiveAsCompileString();
      expect(test).to.be.a("SCBoolean").that.is.true;
    });

    it("#archiveAsObject", function() {
      var instance, test;

      instance = this.createInstance();

      test = instance.archiveAsObject();
      expect(test).to.be.a("SCBoolean").that.is.true;
    });
    it.skip("#checkCanArchive", function() {
    });

    it("#shallowCopy", function() {
      var instance = this.createInstance();
      expect(instance.shallowCopy).to.doNothing;
    });

    it("#choose", sinon.test(function() {
      var instance, test;

      instance = this.createInstance();
      this.stub(instance, "value", sc.test.func());

      test = instance.choose();
      expect(instance.value).to.be.calledLastIn(test);
    }));

    it("#update", sinon.test(function() {
      var instance, test;
      var $arg1 = $$();
      var $arg2 = $$();
      var $arg3 = $$();
      var func = this.spy(sc.test.func());

      instance = this.createInstance(func);

      test = instance.update($arg1, $arg2, $arg3);
      expect(func).to.be.calledWith($arg1, $arg2, $arg3);
      expect(func).to.be.calledLastIn(test);
    }));

    it("#value", sinon.test(function() {
      var instance, test;
      var func = this.spy(sc.test.func());

      instance = this.createInstance(func);

      test = instance.value(1, 2, 3);
      expect(func).to.be.calledWith(1, 2, 3);
      expect(func).to.be.calledLastIn(test);
    }));

    it("#valueArray", sinon.test(function() {
      var instance, test;
      var $arg1 = $$();
      var $arg2 = $$();
      var $arg3 = $$();
      var func = this.spy(sc.test.func());

      instance = this.createInstance(func);
      test = instance.valueArray($arg1);

      expect(func).to.be.calledWith($arg1);
      expect(func).to.be.calledLastIn(test);
      func.reset();

      test = instance.valueArray($$([ $arg1, $arg2, $arg3 ]));
      expect(func).to.be.calledWith($arg1, $arg2, $arg3);
      expect(func).to.be.calledLastIn(test);
    }));

    it("#valueEnvir", sinon.test(sc.test(function() {
      var instance, test;
      var $arg1 = $$();
      var func = this.spy(sc.test.func());

      instance = this.createInstance(func, "a=1; b=2; c=3");
      $.Environment("c", $$(300));

      test = instance.valueEnvir($arg1);
      expect(func.args[0]).that.deep.equals($$([ $arg1, 2, 300 ])._);
      expect(func).to.be.calledLastIn(test);
    })));

    it("#valueArrayEnvir", sinon.test(sc.test(function() {
      var instance, test;
      var $arg1 = $$();
      var $arg2 = $$(null);
      var func = this.spy(sc.test.func());

      instance = this.createInstance(func, "a=1; b=2; c=3");
      $.Environment("c", $$(300));

      test = instance.valueArrayEnvir($$([ $arg1, $arg2 ]));

      expect(func.args[0]).that.deep.equals($$([ $arg1, null, 300 ])._);
      expect(func).to.be.calledLastIn(test);
    })));

    it("#functionPerformList", sinon.test(function() {
      var instance, test;

      instance = this.createInstance();
      this.stub(instance, "value", sc.test.func());

      test = instance.functionPerformList($$("\\value"), $$([ 1, 2, 3 ]));
      expect(instance.value.args[0]).to.deep.equal($$([ 1, 2, 3 ])._);
      expect(instance.value).to.be.calledLastIn(test);
    }));
    it.skip("#valueWithEnvir", function() {
    });
    it.skip("#performWithEnvir", function() {
    });
    it.skip("#performKeyValuePairs", function() {
    });
    it.skip("#numArgs", function() {
    });
    it.skip("#numVars", function() {
    });

    it("#loop", sinon.test(function() {
      var instance, test;
      var iter = {};

      instance = this.createInstance();
      this.stub(sc.lang.iterator, "function$loop", function() {
        return iter;
      });
      this.stub(sc.lang.iterator, "execute");

      test = instance.loop();
      expect(sc.lang.iterator.function$loop).to.be.calledWith(undefined);
      expect(sc.lang.iterator.execute).to.be.calledWith(iter, instance);
      expect(test).to.equal(instance);
    }));
    it.skip("#block", function() {
    });

    it("#asRoutine", function() {
      var instance, test;

      instance = this.createInstance();

      test = instance.asRoutine();
      expect(test).to.be.a("SCRoutine");
    });

    it("#dup", sinon.test(function() {
      var instance, test;
      var $n = $$(3);
      var SCArray$fill = this.spy(sc.test.func());

      instance = this.createInstance();
      this.stub(SCArray, "fill", SCArray$fill);

      test = instance.dup($n);
      expect(SCArray$fill).to.be.calledWith($n, instance);
      expect(SCArray$fill).to.be.calledLastIn(test);
    }));
    it.skip("#sum", function() {
    });
    it.skip("#defer", function() {
    });
    it.skip("#thunk", function() {
    });
    it.skip("#transformEvent", function() {
    });
    it.skip("#set", function() {
    });
    it.skip("#get", function() {
    });
    it.skip("#fork", function() {
    });
    it.skip("#forkIfNeeded", function() {
    });
    it.skip("#awake", function() {
    });
    it.skip("#cmdPeriod", function() {
    });
    it.skip("#bench", function() {
    });

    it("#protect", sinon.test(function() {
      var instance, test;
      var func = this.spy();
      var $handler = $$(func);

      instance = this.createInstance(function() {
        return $$(1);
      });

      test = instance.protect($handler);
      expect(test).to.be.a("SCInteger").that.equals(1);
      expect(func).to.be.called;
    }));

    it("#protect with error", sinon.test(function() {
      var instance, test;
      var func = this.spy();
      var $handler = $$(func);

      instance = this.createInstance(function() {
        throw new Error("error");
      });

      test = instance.protect($handler);
      expect(test).to.be.a("SCNil");
      expect(func).to.be.called;
    }));
    it.skip("#handleError", function() {
    });

    it("#case", function() {
      testCase(this, [
        {
          source: function() {
            return $$(false);
          },
          args: [
            "\\ng",
            true, "\\ok"
          ],
          result: "\\ok"
        },
        {
          source: function() {
            return $$(false);
          },
          args: [
            "\\ng",
            false, "\\ok",
            "\\etc"
          ],
          result: "\\etc"
        },
        {
          source: function() {
            return $$(false);
          },
          args: [
            "\\ng",
            false, "\\ok",
          ],
          result: null
        },
      ]);
    });

    it("#r", function() {
      var instance, test;

      instance = this.createInstance();

      test = instance.r();
      expect(test).to.be.a("SCRoutine");
    });

    it("#p", sinon.test(function() {
      var instance, test;
      var SCProut$new = this.spy(sc.test.func());

      instance = this.createInstance();
      this.stub(sc.lang.klass, "get").withArgs("Prout").returns($$({
        new: SCProut$new
      }));

      test = instance.p();
      expect(SCProut$new).to.be.calledWith(instance);
      expect(SCProut$new).to.be.calledLastIn(test);
    }));
    it.skip("#matchItem", function() {
    });
    it.skip("#performDegreeToKey", function() {
    });

    it("#flop", function() {
      var instance, test;

      instance = this.createInstance(function($a, $b) {
        return $a ["+"] ($b);
      });

      test = instance.flop();
      expect(test).to.be.a("SCFunction");

      test = test.value(
        $$([  1,  2     ]),
        $$([ 10, 20, 30 ])
      );
      expect(test).to.be.a("SCArray").that.deep.equals([ 11, 22, 31 ]);
    });
    it.skip("#envirFlop", function() {
    });
    it.skip("#makeFlopFunc", function() {
    });
    it.skip("#inEnvir", function() {
    });

    it("#while", sinon.test(function() {
      var instance, test;
      var iter = {};
      var $body = $$();

      instance = this.createInstance();
      this.stub(sc.lang.iterator, "function$while", function() {
        return iter;
      });
      this.stub(sc.lang.iterator, "execute");

      test = instance.while($body);
      expect(sc.lang.iterator.function$while).to.be.calledWith(instance);
      expect(sc.lang.iterator.execute).to.be.calledWith(iter, $body);
      expect(test).to.equal(instance);
    }));
  });

});


text:
@interface FLCodeClassName : FLCodeClassNameBaseClass {
@private
}

+ (id) codeClassName;

@end

redpajama_set_name: RedPajamaGithub


text:
require 'rails_helper'

describe "Markdown wikis" do
	let(:user) { wiki.user }
	let!(:wiki) { create(:wiki, body: "this is
		gem in ruby
		on rails") }

	before do
		login_as(user, scope: :user)
	end

	it "View a wiki page built with Markdown" do

	end
end


text:
=head1 NAME

Funknet::Config::Encryption

=cut

package Funknet::Config::Encryption;
use strict;
use base qw/ Funknet::Config /;

use Funknet::Config::Validate qw/ is_valid_encryption /;
use Funknet::Config::Encryption::IPSec;
use Funknet::Config::Encryption::OpenVPN;
use Funknet::KeyStash::Client;
use Funknet::Config::SystemFile;

=head2 new

Constructor for an Encryption::* object.

Takes the following args:

* tun    => a F::C::Tunnel object
* type   => the encryption to apply
* source => 'host' or 'whois', as usual.

=cut

sub new {
    my ($class, %args) = @_;
    my $self = bless {}, $class;
    my $l = Funknet::ConfigFile::Tools->local;

    # Check basic params.

    unless (defined $args{source} && ($args{source} eq 'whois' || $args{source} eq 'host')) {
	$self->warn("encryption: missing or invalid source");
	return undef;
    } else {
	$self->{_source} = $args{source};
    }

    unless (defined $args{tun} && (ref $args{tun}) =~ m/^Funknet::Config::Tunnel/) {
	$self->warn("encryption: missing or invalid Tunnel object");
	return undef;
    } else {
	$self->{_tun} = $args{tun};
    }

    # this is mandatory for whois source only.
    if ($self->{_source} eq 'whois') {
         unless (defined $args{type} && is_valid_encryption($args{type})) {
              $self->warn("encryption: missing or invalid type");
              return undef;
         } else {
              $self->{_type} = $args{type};
         }
    }

    # If this object is source 'whois', call the Encryption-type-specific init method.
    if ($self->{_source} eq 'whois') {
	if ($self->{_type} eq 'ipsec') {
	    Funknet::Config::Encryption::IPSec::whois_init( $self, $args{tun}, $args{param} );
	}
	if ($self->{_type} eq 'openvpn') {
	    Funknet::Config::Encryption::OpenVPN::whois_init( $self, $args{tun}, $args{param} );
	}
    }

    # If this object is source 'host', call the generic 'find encryption' init method.
    if ($self->{_source} eq 'host') {
       if($self->_host_init()) {
           return $self;
	} else {
           return undef;
        }
    }

    return $self;
}

=head2 host_init

Decide here which type of encryption to try and find.

=cut

sub _host_init {
    my ($self) = @_;
    my $tun = $self->{_tun};
    my $l = Funknet::ConfigFile::Tools->local;

    if (defined $l->{ipsec} && $tun->type ne 'tun') {

	if ($l->{ipsec} eq 'kame') {
	    bless $self, 'Funknet::Config::Encryption::IPSec::KAME';
	} elsif ($l->{ipsec} eq 'freeswan') {
	    bless $self, 'Funknet::Config::Encryption::IPSec::Freeswan';
	} else {
	    return undef;
	}
    }

    if ($tun->type eq 'tun') {
	bless $self, 'Funknet::Config::Encryption::OpenVPN';
    }

    return $self->host_init($tun);
}

sub host_init {
     # virtual
}

sub apply {
    my ($self) = @_;
    $self->warn("generic Encryption apply method called...");
    return undef;
}

sub diff {
     my ($whois, $host) = @_;
     my @changes;

     my $certdiff = $whois->{_certfile}->diff();
     my $keydiff  = $whois->{_keyfile}->diff();

     if ($certdiff) {
          push @changes, $whois->{_certfile};
     }
     if ($keydiff) {
          push @changes, $whois->{_keyfile};
     }

     return @changes;
}

# this is used by Encryption types which need a key and cert
# (IPSec and OpenVPN)

sub get_keycert {
    my ($self, $param) = @_;

    my $k = Funknet::ConfigFile::Tools->keystash;
    my $ks = Funknet::KeyStash::Client->new(%$k);
    unless (defined $ks) {
	$self->warn("Couldn't get a KeyStash::Client");
	return undef;
    }

    # get values from whois and wherever, call $self->new( ... );
    # $param is the CN of cert in the whois.

    # get the cert.
    my $cert = $ks->get_cert($param);
    if (!defined $cert) {
	$self->warn("certificate not found: $param");
	return undef;
    }
    my $cert_text = $cert->rawtext;

    # get the private key that corresponds to this cert
    # the CN of the cert is in the owner field
    my $cn = $cert->owner;
    if (!defined $cn) {
	$self->warn("using cert filename for key filename: $param");
	$cn = $param;
    }
    my $key_text = $ks->get_key($cn);

    if (!defined $key_text) {
	$self->warn("key not found: $cn");
	return undef;
    }

    return ($key_text, $cert_text);
}

# stub, this only applies to OpenVPN
sub tun_data {}

# virtuals for firewall rules
sub nat_firewall_rules {
     return;
}
sub filter_firewall_rules {
     return;
}

1;


text:
package org.innovateuk.ifs.filestorage.web;

import lombok.extern.slf4j.Slf4j;
import org.innovateuk.ifs.api.filestorage.v1.delete.FileDeletion;
import org.innovateuk.ifs.api.filestorage.v1.delete.FileDeletionRequest;
import org.innovateuk.ifs.api.filestorage.v1.delete.FileDeletionResponse;
import org.innovateuk.ifs.filestorage.storage.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class FileDeletionController implements FileDeletion {

    @Autowired
    private StorageService storageService;

    @Override
    public ResponseEntity<FileDeletionResponse> deleteFile(FileDeletionRequest fileDeletionRequest) {
        return ResponseEntity.ok(storageService.deleteFile(fileDeletionRequest));
    }

}


text:
#ifndef CCB_IO_EVENTS_HH
#define CCB_IO_EVENTS_HH

#include <unordered_map>

#include "com/centreon/broker/io/event_info.hh"

CCB_BEGIN()

namespace io {
/**
 *  @class events events.hh "com/centreon/broker/io/events.hh"
 *  @brief Data events registration.
 *
 *  Maintain the set of existing events.
 */
class events {
 public:
  typedef std::unordered_map<uint32_t, event_info> events_container;
  struct category_info {
    std::string name;
    events_container events;
  };
  typedef std::unordered_map<uint16_t, category_info> categories_container;
  // Reserved categories, for reference.
  // Their values are very important to maintain the bbdo protocol retro
  // compatible.
  enum data_category {
    neb = 1,
    bbdo = 2,
    storage = 3,
    dumper = 5,
    bam = 6,
    extcmd = 7,
    generator = 8,
    internal = 65535
  };
  // Internal events used by the core.
  enum internal_event_category { de_raw = 1, de_instance_broadcast, de_buffer };
  // Extcmd events used by the core.
  enum extcmd_event_category {
    de_command_request = 1,
    de_command_result,
  };

  template <uint16_t category, uint16_t element>
  struct data_type {
    enum { value = static_cast<uint32_t>(category << 16 | element) };
  };

  // Singleton.
  static events& instance();
  static void load();
  static void unload();

  // Category.
  uint16_t register_category(std::string const& name, uint16_t hint);
  void unregister_category(uint16_t category_id);

  // Events.
  uint32_t register_event(uint16_t category_id,
                          uint16_t event_id,
                          std::string const& name = std::string(),
                          event_info::event_operations const* ops = nullptr,
                          mapping::entry const* entries = nullptr,
                          std::string const& table_v2 = std::string());
  void unregister_event(uint32_t type_id);

  // ID manipulations.
  static uint16_t category_of_type(uint32_t type) noexcept {
    return static_cast<uint16_t>(type >> 16);
  }
  static uint16_t element_of_type(uint32_t type) noexcept {
    return static_cast<uint16_t>(type);
  }
  static uint32_t make_type(uint16_t category_id,
                            uint16_t element_id) noexcept {
    return (static_cast<uint32_t>(category_id) << 16) | element_id;
  }

  // Event browsing.
  categories_container::const_iterator begin() const;
  categories_container::const_iterator end() const;
  events_container get_events_by_category_name(std::string const& name) const;
  event_info const* get_event_info(uint32_t type);
  events_container get_matching_events(std::string const& name) const;

 private:
  events();
  events(events const& other);
  ~events();
  events& operator=(events const& other);

  categories_container _elements;
};
}  // namespace io

CCB_END()

#endif  // !CCB_IO_EVENTS_HH


text:
"""hc_api_excel_concat - Takes a CSV file containing rows of addresses and zipcodes,
                calls the HouseCanary Value Report or Rental Report API to retrieve Excel output
                for the addresses and combines the results into a single Excel file.

Usage: hc_api_excel_concat (<input>) [-o FILE] [-f PATH] [-e ENDPOINT] [-k KEY] [-s SECRET] [-t TYPE] [-h?] [-r]

Examples:
    hc_api_excel_concat sample_input/sample-input.csv -o vr_output.xlsx -f output_files -e value_report

    hc_api_excel_concat sample_input/sample-input.csv -o rr_output.xlsx -f output_files -e rental_report

Options:
    input                     Required. An input CSV file containing addresses and zipcodes

    -o FILE --output=FILE     Optional. A file name for the Excel output.
                              Defaults to 'output.xlsx'

    -f PATH --files=PATH      Optional. A path to save the individual Excel files for each address.
                              Defaults to 'output_files'.

    -e ENDPOINT --endpoint=ENDPOINT Optional. One of 'value_report' or 'rental_report'
                                    to determine which API endpoint to call.
                                    Defaults to 'value_report'

    -k KEY --key=KEY          Optional API Key. Alternatively, you can use the HC_API_KEY
                              environment variable

    -s SECRET --secret=SECRET Optional API Secret. Alternatively, you can use the HC_API_SECRET
                              environment variable

    -t TYPE --type=TYPE       Optional Report Type of 'full' or 'summary'. Default is 'full'

    -r --retry                Optional. When specified, if any of the API calls fail due to
                              exceeding the rate limit, the command will wait and retry once
                              the limit has reset. However, if the rate limit will take more
                              than 5 minutes to reset, the retry flag is ignored and the
                              command will exit.

    -h -? --help              Show usage
"""

from __future__ import print_function
import sys
from builtins import str
from docopt import docopt
import housecanary

def hc_api_excel_concat(docopt_args):
    input_file_name = docopt_args['<input>']
    output_file_name = docopt_args['--output'] or 'output.xlsx'
    endpoint = docopt_args['--endpoint'] or 'value_report'
    api_key = docopt_args['--key'] or None
    api_secret = docopt_args['--secret'] or None
    report_type = docopt_args['--type'] or 'full'
    retry = docopt_args['--retry'] or False
    files_path = docopt_args['--files'] or 'output_files'

    try:
        addresses = housecanary.excel_utilities.get_addresses_from_input_file(input_file_name)
    except Exception as ex:
        print(str(ex))
        sys.exit(2)

    if len(addresses) == 0:
        print('No addresses were found in the input file')
        sys.exit(2)

    if endpoint != 'value_report' and endpoint != 'rental_report':
        print("""Invalid endpoint '{}'. Must be one of 'value_report' or 'rental_report'.
You can omit the endpoint param to default to 'value_report'""".format(endpoint))
        sys.exit(2)

    housecanary.concat_excel_reports(
        addresses, output_file_name, endpoint, report_type, retry, api_key, api_secret, files_path)

def main():
    args = docopt(__doc__)
    hc_api_excel_concat(args)


text:
package org.apache.ignite.internal.processors.cache;

import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.WithSystemProperty;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.junit.Test;

/**
 *
 */
public class CacheNoAffinityExchangeTest extends GridCommonAbstractTest {
    /** */
    private volatile boolean startClient;

    /** */
    private volatile boolean startClientCaches;

    /** Tx cache name from client static configuration. */
    private static final String PARTITIONED_TX_CLIENT_CACHE_NAME = "p-tx-client-cache";

    /** */
    private final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder().setShared(true);

    /** */
    private final TcpDiscoveryIpFinder CLIENT_IP_FINDER = new TcpDiscoveryVmIpFinder()
        .setAddresses(Collections.singleton("127.0.0.1:47500"));

    /** {@inheritDoc} */
    @Override protected void beforeTestsStarted() throws Exception {
        MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);

        super.beforeTestsStarted();
    }

    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

        cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

        cfg.setDiscoverySpi(new TestDiscoverySpi().setIpFinder(IP_FINDER));

        cfg.setActiveOnStart(false);

        cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024)));

        if (startClient) {
            cfg.setClientMode(true);

            // It is necessary to ensure that client always connects to grid(0).
            ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(CLIENT_IP_FINDER);

            if (startClientCaches) {
                CacheConfiguration<Integer, Integer> txCfg = new CacheConfiguration<Integer, Integer>()
                    .setName(PARTITIONED_TX_CLIENT_CACHE_NAME)
                    .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
                    .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
                    .setAffinity(new RendezvousAffinityFunction(false, 32))
                    .setBackups(2);

                cfg.setCacheConfiguration(txCfg);
            }
        }

        return cfg;
    }

    /** {@inheritDoc} */
    @Override protected void afterTest() throws Exception {
        stopAllGrids();

        startClient = false;

        startClientCaches = false;

        super.afterTest();
    }

    /**
     * @throws Exception If failed.
     */
    @Test
    public void testNoAffinityChangeOnClientJoin() throws Exception {
        Ignite ig = startGrids(4);

        ig.cluster().active(true);

        IgniteCache<Integer, Integer> atomicCache = ig.createCache(new CacheConfiguration<Integer, Integer>()
                .setName("atomic").setAtomicityMode(CacheAtomicityMode.ATOMIC));

        IgniteCache<Integer, Integer> txCache = ig.createCache(new CacheConfiguration<Integer, Integer>()
                .setName("tx").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));

        assertTrue(GridTestUtils.waitForCondition(() ->
                new AffinityTopologyVersion(4, 3).equals(grid(3).context().discovery().topologyVersionEx()),
            5_000));

        TestDiscoverySpi discoSpi = (TestDiscoverySpi) grid(2).context().discovery().getInjectedDiscoverySpi();

        CountDownLatch latch = new CountDownLatch(1);

        discoSpi.latch = latch;

        startClient = true;

        startGrid(4);

        assertTrue(GridTestUtils.waitForCondition(() ->
                new AffinityTopologyVersion(5, 0).equals(grid(0).context().discovery().topologyVersionEx()) &&
                    new AffinityTopologyVersion(5, 0).equals(grid(1).context().discovery().topologyVersionEx()) &&
                    new AffinityTopologyVersion(4, 3).equals(grid(2).context().discovery().topologyVersionEx()) &&
                    new AffinityTopologyVersion(4, 3).equals(grid(3).context().discovery().topologyVersionEx()),
            10_000));

        for (int k = 0; k < 100; k++) {
            atomicCache.put(k, k);
            txCache.put(k, k);

            Lock lock = txCache.lock(k);
            lock.lock();
            lock.unlock();
        }

        for (int k = 0; k < 100; k++) {
            assertEquals(Integer.valueOf(k), atomicCache.get(k));
            assertEquals(Integer.valueOf(k), txCache.get(k));
        }

        assertEquals(new AffinityTopologyVersion(5, 0), grid(0).context().discovery().topologyVersionEx());
        assertEquals(new AffinityTopologyVersion(5, 0), grid(1).context().discovery().topologyVersionEx());
        assertEquals(new AffinityTopologyVersion(4, 3), grid(2).context().discovery().topologyVersionEx());
        assertEquals(new AffinityTopologyVersion(4, 3), grid(3).context().discovery().topologyVersionEx());

        latch.countDown();
    }

    /**
     * @throws Exception If failed.
     */
    @Test
    public void testNoAffinityChangeOnClientLeft() throws Exception {
        Ignite ig = startGrids(4);

        ig.cluster().active(true);

        IgniteCache<Integer, Integer> atomicCache = ig.createCache(new CacheConfiguration<Integer, Integer>()
            .setName("atomic").setAtomicityMode(CacheAtomicityMode.ATOMIC));

        IgniteCache<Integer, Integer> txCache = ig.createCache(new CacheConfiguration<Integer, Integer>()
            .setName("tx").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));

        assertTrue(GridTestUtils.waitForCondition(() ->
            new AffinityTopologyVersion(4, 3).equals(grid(3).context().discovery().topologyVersionEx()),
            5_000));

        startClient = true;

        startGrid(4);

        TestDiscoverySpi discoSpi = (TestDiscoverySpi)grid(2).context().discovery().getInjectedDiscoverySpi();

        CountDownLatch latch = new CountDownLatch(1);

        discoSpi.latch = latch;

        stopGrid(4);

        assertTrue(GridTestUtils.waitForCondition(() ->
                new AffinityTopologyVersion(6, 0).equals(grid(0).context().discovery().topologyVersionEx()) &&
                    new AffinityTopologyVersion(6, 0).equals(grid(1).context().discovery().topologyVersionEx()) &&
                    new AffinityTopologyVersion(5, 0).equals(grid(2).context().discovery().topologyVersionEx()) &&
                    new AffinityTopologyVersion(5, 0).equals(grid(3).context().discovery().topologyVersionEx()),
            10_000));

        for (int k = 0; k < 100; k++) {
            atomicCache.put(k, k);
            txCache.put(k, k);

            Lock lock = txCache.lock(k);
            lock.lock();
            lock.unlock();
        }

        for (int k = 0; k < 100; k++) {
            assertEquals(Integer.valueOf(k), atomicCache.get(k));
            assertEquals(Integer.valueOf(k), txCache.get(k));
        }

        assertEquals(new AffinityTopologyVersion(6, 0), grid(0).context().discovery().topologyVersionEx());
        assertEquals(new AffinityTopologyVersion(6, 0), grid(1).context().discovery().topologyVersionEx());
        assertEquals(new AffinityTopologyVersion(5, 0), grid(2).context().discovery().topologyVersionEx());
        assertEquals(new AffinityTopologyVersion(5, 0), grid(3).context().discovery().topologyVersionEx());

        latch.countDown();
    }

    /**
     * @throws Exception If failed.
     */
    @Test
    public void testNoAffinityChangeOnClientLeftWithMergedExchanges() throws Exception {
        System.setProperty(IgniteSystemProperties.IGNITE_EXCHANGE_MERGE_DELAY, "1000");

        try {
            Ignite ig = startGridsMultiThreaded(4);

            ig.cluster().active(true);

            IgniteCache<Integer, Integer> atomicCache = ig.createCache(new CacheConfiguration<Integer, Integer>()
                .setName("atomic").setAtomicityMode(CacheAtomicityMode.ATOMIC).setCacheMode(CacheMode.REPLICATED));

            IgniteCache<Integer, Integer> txCache = ig.createCache(new CacheConfiguration<Integer, Integer>()
                .setName("tx").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setCacheMode(CacheMode.REPLICATED));

            startClient = true;

            Ignite client = startGrid("client");

            startClient = false;

            stopGrid(1);
            stopGrid(2);
            stopGrid(3);

            awaitPartitionMapExchange();

            atomicCache.put(-1, -1);
            txCache.put(-1, -1);

            TestRecordingCommunicationSpi.spi(ig).blockMessages(new IgniteBiPredicate<ClusterNode, Message>() {
                @Override public boolean apply(ClusterNode node, Message msg) {
                    return msg instanceof GridDhtPartitionSupplyMessageV2;
                }
            });

            startGridsMultiThreaded(1, 3);

            CountDownLatch latch = new CountDownLatch(1);
            for (Ignite ignite : G.allGrids()) {
                if (ignite.cluster().localNode().order() == 9) {
                    TestDiscoverySpi discoSpi =
                        (TestDiscoverySpi)((IgniteEx)ignite).context().discovery().getInjectedDiscoverySpi();

                    discoSpi.latch = latch;

                    break;
                }
            }

            client.close();

            for (int k = 0; k < 100; k++) {
                atomicCache.put(k, k);
                txCache.put(k, k);

                Lock lock = txCache.lock(k);
                lock.lock();
                lock.unlock();
            }

            for (int k = 0; k < 100; k++) {
                assertEquals(Integer.valueOf(k), atomicCache.get(k));
                assertEquals(Integer.valueOf(k), txCache.get(k));
            }

            latch.countDown();
        }
        finally {
            System.clearProperty(IgniteSystemProperties.IGNITE_EXCHANGE_MERGE_DELAY);
        }
    }

    /**
     * Tests that multiple client events won't fail transactions due to affinity assignment history expiration.
     *
     * @throws Exception If failed.
     */
    @Test
    @WithSystemProperty(key = IgniteSystemProperties.IGNITE_AFFINITY_HISTORY_SIZE, value = "10")
    public void testMulipleClientLeaveJoin() throws Exception {
        Ignite ig = startGrids(2);

        ig.cluster().active(true);

        startClient = true;

        IgniteEx stableClient = startGrid(2);

        IgniteCache<Integer, Integer> stableClientTxCacheProxy = stableClient.createCache(
            new CacheConfiguration<Integer, Integer>()
                .setName("tx")
                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
                .setBackups(1)
                .setAffinity(new RendezvousAffinityFunction(false, 32)));

        awaitPartitionMapExchange();

        IgniteInternalFuture fut = GridTestUtils.runAsync(new Runnable() {
            @Override public void run() {
                for (int i = 0; i < 10; i++) {
                    try {
                        startGrid(3);

                        stopGrid(3);
                    }
                    catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        });

        CountDownLatch clientTxLatch = new CountDownLatch(1);

        IgniteInternalFuture loadFut = GridTestUtils.runAsync(new Runnable() {
            @Override public void run() {
                try (Transaction tx = stableClient.transactions().txStart()) {
                    ThreadLocalRandom r = ThreadLocalRandom.current();

                    stableClientTxCacheProxy.put(r.nextInt(100), r.nextInt());

                    try {
                        clientTxLatch.await();
                    }
                    catch (InterruptedException e) {
                        throw new IgniteInterruptedException(e);
                    }

                    tx.commit();
                }
            }
        });

        fut.get();

        clientTxLatch.countDown();

        loadFut.get();
    }

     /**
      * @throws Exception If failed.
      */
    @Test
    public void testAffinityChangeOnClientConnectWithStaticallyConfiguredCaches() throws Exception {
        Ignite ig = startGrids(2);

        ig.cluster().active(true);

        TestDiscoverySpi discoSpi = (TestDiscoverySpi)grid(1).context().discovery().getInjectedDiscoverySpi();

        CountDownLatch latch = new CountDownLatch(1);

        discoSpi.latch = latch;

        startClient = true;

        startClientCaches = true;

        Ignite client = startGrid(2);

        assertTrue(GridTestUtils.waitForCondition(() -> {
                AffinityTopologyVersion topVer0 = grid(0).context().discovery().topologyVersionEx();
                AffinityTopologyVersion topVer1 = grid(1).context().discovery().topologyVersionEx();

                return topVer0.topologyVersion() == 3 && topVer1.topologyVersion() == 2;
            }, 10_000));

        final IgniteCache<Integer, Integer> txCache = client.cache(PARTITIONED_TX_CLIENT_CACHE_NAME);

        final AtomicBoolean updated = new AtomicBoolean();

        GridTestUtils.runAsync(() -> {
            for (int i = 0; i < 32; ++i)
                txCache.put(i, i);

            updated.set(true);
        });

        assertFalse(GridTestUtils.waitForCondition(updated::get, 5_000));

        latch.countDown();

        assertTrue(GridTestUtils.waitForCondition(updated::get, 5_000));

        for (int i = 0; i < 32; ++i)
            assertEquals(Integer.valueOf(i), txCache.get(i));

        assertEquals("Expected major topology version is 3.",
            3, grid(1).context().discovery().topologyVersionEx().topologyVersion());
    }

    /**
     *
     */
    public static class TestDiscoverySpi extends TcpDiscoverySpi {
        /** */
        private volatile CountDownLatch latch;

        /** {@inheritDoc} */
        @Override protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {
            if (msg instanceof TcpDiscoveryNodeAddFinishedMessage
                || msg instanceof TcpDiscoveryNodeLeftMessage
                || msg instanceof TcpDiscoveryNodeFailedMessage) {
                CountDownLatch latch0 = latch;

                if (latch0 != null)
                    try {
                        latch0.await();
                    }
                    catch (InterruptedException ex) {
                        throw new IgniteException(ex);
                    }
            }

            super.startMessageProcess(msg);
        }
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="ch.hslu.mobpro.proj.thinkquick.activities.GameModeActivity">

    <Button
        android:id="@+id/endlessButton"
        android:layout_width="0dp"
        android:layout_height="75dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:background="@color/colorPrimaryDark"
        android:onClick="onEndlessButtonClick"
        android:text="@string/game_mode_btn_endless"
        android:textColor="@android:color/white"
        android:textSize="24sp"
        app:layout_constraintBottom_toTopOf="@+id/hardcoreButton"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="1.0" />

    <Button
        android:id="@+id/hardcoreButton"
        android:layout_width="0dp"
        android:layout_height="75dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:background="@color/colorPrimaryDark"
        android:onClick="onHardcoreButtonClick"
        android:text="@string/game_mode_btn_hardcore"
        android:textColor="@android:color/white"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="1.0" />

    <TextView
        android:id="@+id/gameModeTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:text="Think Quick"
        android:textSize="30sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/gameModeSubTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:text="Game Mode"
        android:textColor="@color/colorPrimaryDark"
        android:textSize="55sp"
        app:layout_constraintBottom_toTopOf="@+id/endlessButton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/gameModeTitle" />

</android.support.constraint.ConstraintLayout>


text:
class CreatePaymentLogs < ActiveRecord::Migration
  def change
    create_table :payment_logs, id: false do |t|
      t.string :out_trade_no, :null => false
      t.string :trade_no
      t.string :subject
      t.string :trade_status, :default => :CREATED, :null => false
      t.string :seller_id
      t.string :seller_email
      t.string :buyer_id
      t.string :buyer_email
      t.float :total_fee
      t.string :plat_form
      t.integer :order_id, :null => false
      t.timestamps :null => false
    end
    add_foreign_key "payment_logs", "orders", :column => "order_id"
    execute "ALTER TABLE payment_logs ADD PRIMARY KEY (out_trade_no);"
  end
end


text:
"""service

A rpc service provider, to be executed within the coroutine framework
"""

from gogreen import coro
from gogreen import corowork

import exceptions
import time
import sys
import os

import decorators
import error
import access

def statistics_filter(args, kwargs):
    return args[1].get('command', 'none')

class SimpleWorker(corowork.Worker):
    def __init__(self, *args, **kwargs):
        super(SimpleWorker, self).__init__(*args, **kwargs)

        self._notifier = kwargs['notifier']
        self._waiter   = coro.coroutine_cond()
        self._objname  = kwargs['object']
        self._msgqueue = []

    def execute(self, vid, call, seq, server, **kwargs):
        cmd      = call.get('command', None)
        args     = call.get('args', ())
        kwargs   = call.get('kwargs', {})
        tlb, tval = call.get('tlb', ('tlb-%s' % self._objname, False))
        slv, sval = call.get('slave', ('slave-read', False))
        source    = call.get('source')

        self.debug(
            'execute command %r id %r args %r kwargs %r tlb %s slv %s',
            cmd, vid, args, kwargs, (tlb,tval), (slv,sval))

        try:
            coro.set_local(tlb, tval)
            coro.set_local(slv, sval)
            if source: coro.set_local(access.CORO_LOCAL_SOURCE, source)
            try:
                result = self._execute(vid, cmd, args, kwargs)
            finally:
                coro.pop_local(slv)
                coro.pop_local(tlb)
                coro.pop_local(access.CORO_LOCAL_SOURCE)
        except error.AccessError, e:
            self.warn('AccessError: %r %r' % (e, e.args,))

            result = {
                'rc':   e.id,
                'msg':  e[0],
                'args': e.args,
                'envl': True}

            self.clear()
        except exceptions.Exception, e:
            self.traceback()
            t,v,tb = coro.traceback_info()
            result = {
                'rc':  error.ServiceTraceback.id,
                'tb':  tb,
                'msg': 'Traceback: [%s|%s]' % (t,v),
                'args': getattr(e, 'args', str(e)),
                'envl': True}
        except:
            self.traceback()
            t,v,tb = coro.traceback_info()
            result = {
                'rc':  error.ServiceTraceback.id,
                'tb':  tb,
                'msg': 'Traceback: [%s|%s]' % (t,v),
                'envl': True}

            self.clear()
        else:
            self.flush()

        server.rpc_response(seq, result)

    def _execute(self, vid, cmd, args, kwargs):
        handler = getattr(self, cmd, None)
        if handler is None or not getattr(handler, 'command', 0):
            return {
                'rc': error.NoServiceHandler.id,
                'msg': 'no handler: %s' % cmd,
                'args': (cmd,),
                'envl': True}

        return self._call(handler, vid, *args, **kwargs)

    def _call(self, handler, *args, **kwargs):
        self.preemptable_set(True)
        try:
            result = handler(*args, **kwargs)
        finally:
            self.preemptable_set(False)

        if getattr(handler, 'envelope', False):
            result = {'rc': 0, 'result': result, 'envl': True}

        return result

    def complete(self):
        super(SimpleWorker, self).complete()

        self._notifier = None
    #
    # We act as an RPC proxy to ensure that messages are queued and only
    # flushed once the transaction has completed.
    #
    def rpcs(self, *args, **kwargs):
        return self._notifier.rpcs(*args, **kwargs)

    def rpc(self, *args, **kwargs):
        return self._notifier.rpc(*args, **kwargs)

    def publish(self, object, id, cmd, args):
        self._msgqueue.append((object, id, cmd, args))

    def clear(self):
        self._msgqueue = []

    def flush(self):
        for object, id, cmd, args in self._msgqueue:
            self._notifier.publish(object, id, cmd, args)

        self.clear()
    #
    # common testing commands
    #
    @decorators.command
    def sleep(self, vid, timeout):
        self._waiter.wait(timeout)
        return {'timeout': timeout}

    @decorators.command
    def ping(self, vid, args):
        return args

class Worker(SimpleWorker):
    def __init__(self, *args, **kwargs):
        super(Worker, self).__init__(*args, **kwargs)

    def _execute(self, vid, cmd, args, kwargs):
        handler = getattr(self, cmd, None)
        if handler is None or not getattr(handler, 'command', 0):
            return {
                'rc': error.NoServiceHandler.id,
                'msg': 'no handler: %s' % cmd,
                'args': (cmd,),
                'envl': True}

        if not getattr(handler, 'cursor', 0):
            return self._call(handler, vid, *args, **kwargs)

        slave = getattr(handler, 'readonly', False) and access.slave_read()

        extra_dbc_hints = getattr(handler, 'extra_dbc_hints', [])
        extra = {}
        for hint in extra_dbc_hints:
            extra[hint] = kwargs.get(hint)

        if getattr(handler, 'nopartition', 0):
            dbc = self._get_dbc(None, slave = slave, **extra)
        else:
            dbc = self._get_dbc(vid, slave = slave, **extra)

        if dbc is None:
            return {
                'rc': error.DatabaseUnavailable.id,
                'msg': 'DB currently offline',
                'args': (),
                'envl': True}

        try:
            result = self._call(handler, vid, dbc.cursor(), *args, **kwargs)
            dbc.commit()
        finally:
            self._put_dbc(dbc, slave = slave)

        return result

    def complete(self):
        super(Worker, self).complete()

class Server(object):
    worker_class = Worker
    subscription = 'base'
    statistics   = 'basestat'

    def __init__(self, size, notifier, **kwargs):
        self._clean  = False

        if isinstance(size, list):
            kwargs['sizes'] = size
        else:
            kwargs['size']   = size
        kwargs['object'] = self.subscription
        kwargs['worker'] = self.worker_class
        kwargs['notifier'] = notifier
        kwargs['filter'] = lambda *a: '%s.%s' % (
            self.__module__,
            statistics_filter(*a))

        self._server = corowork.Server(**kwargs)
        self._server.name = self.__class__.__name__
        self._server.start()

        self._notifier = kwargs['notifier']
        self._bounds   = {}
        self._active   = False

        if 'loglevel' in kwargs:
            self._server.set_log_level(kwargs['loglevel'])
            self._notifier.set_log_level(kwargs['loglevel'])

        self.load_config(kwargs['bounds'])

    def __del__(self):
        if not self._clean:
            self.drain()

    def active(self):
        return bool(self._bounds)

    def drain(self, timeout = None, grace = 0.0):
        # if not active ignore grace period and timeout
        #
        if not self._active:
            timeout = None
            grace   = 0.0
        self._notifier.rpc_unregister_all(self)
        coro.sleep(grace)
        shutdown_start = time.time()
        join = self._server.shutdown(timeout = timeout)
        return {
            'join' : join,
            'time' : time.time() - shutdown_start
        }

    def rpc_call(self, obj, id, cmd, args, seq, server):
        if obj == self.statistics:
            self._server.command_push(obj, id, cmd, args, seq, server)
        else:
            prio = getattr(
                self, 'command_prios', {}).get(args.get('command'), 0)
            self._server.request(id, args, seq, server, prio = 0)

    def load_config(self, bounds):
        #
        # work queue (re)size
        #
        self._server.resize(bounds.get('workers'))
        #
        # old and new RPC service mask/value
        #
        oldsub = (self._bounds.get('mask'),  self._bounds.get('value'))
        oldbrd = (self._bounds.get('bmask'), self._bounds.get('bvalue'))
        newsub = (bounds.get('mask'), bounds.get('value'))
        newbrd = (bounds.get('bmask'), bounds.get('bvalue'))
        #
        # old and new service enabler
        #
        oldsrv = self._bounds.get('service', bool(None not in oldsub))
        newsrv = bounds.get('service', bool(None not in newsub))

        oweight = self._bounds.get('weight', 1.0)
        nweight = bounds.get('weight', 1.0)

        if (oldsub, oldbrd, oldsrv, oweight) == (newsub,newbrd,newsrv,nweight):
            return None, None

        unreg = nweight != oweight or oldsub != newsub or \
                oldbrd != newbrd or not newsrv

        if self._active and unreg:
            self._notifier.rpc_unregister_all(self)
            self._active = False

        if not self._active and newsrv:
            for command in self._server.command_list():
                self._notifier.rpc_register(self.statistics, 0, command, self)

            self._notifier.rpc_slice(
                self.subscription, newsub, 'execute', self, weight = nweight)

            if getattr(self, 'sub_broadcast', None):
                self._notifier.rpc_register(
                    self.sub_broadcast, newbrd, 'execute', self)

            self._active = True

        self._bounds = bounds
        # JRM: i think it would be fine to add old and new brd values to
        # this return but not sure how that'll effect the itemservs so will
        # leave to libor to decide
        #
        return (oldsub, oldsrv, oweight), (newsub, newsrv, nweight)
    #
    # statistics
    #
    def rate(self):
        return self._server.stats.rate()

    def details(self):
        return self._server.stats.details()

    def averages(self):
        return self._server.stats.averages()
#
# end...


text:
package com.itheima.b_di;

public interface BookDao {

	public void save();

}


text:
//
//  TreatmentEntity.m
//  MedicineCure
//
//  Created by line0 on 15/8/4.
//  Copyright (c) 2015年 zhanglei. All rights reserved.
//

#import "TreatmentEntity.h"

@implementation TreatmentEntity

- (instancetype)initWithDict:(NSDictionary *)dict
{
    self = [super initWithDict:dict];
    if (self)
    {
        self.name               = [dict safeBindStringValue:@"name"];
        self.pushPeriod         = [[dict safeBindStringValue:@"pushPeriod"] integerValue];
        self.status             = [[dict safeBindStringValue:@"status"] integerValue];
        self.treatmentProcessId = [[dict safeBindStringValue:@"treatmentProcessId"] integerValue];
        self.type               = [[dict safeBindStringValue:@"type"] integerValue];
        self.isDeleted          = [[dict safeBindStringValue:@"isDeleted"] boolValue];
    }
    return self;
}

- (NSArray *)serializeProperties
{
    return @[ @"name", @"pushPeriod", @"status", @"isDeleted", @"treatmentProcessId", @"type" ];
}

@end
/*
 "name": "手术",

 "pushPeriod": 1,

 "status": 0,

 "treatmentProcessId": 1,

 "type": 0
 */


text:
package com.google.android.exoplayer.text.tx3g;

import com.google.android.exoplayer.text.Cue;
import com.google.android.exoplayer.text.Subtitle;
import com.google.android.exoplayer.util.Assertions;

import java.util.Collections;
import java.util.List;

/**
 * A representation of a tx3g subtitle.
 */
/* package */ final class Tx3gSubtitle implements Subtitle {

  private final List<Cue> cues;

  public Tx3gSubtitle(Cue cue) {
    this.cues = Collections.singletonList(cue);
  }

  @Override
  public int getNextEventTimeIndex(long timeUs) {
    return timeUs < 0 ? 0 : -1;
  }

  @Override
  public int getEventTimeCount() {
    return 1;
  }

  @Override
  public long getEventTime(int index) {
    Assertions.checkArgument(index == 0);
    return 0;
  }

  @Override
  public long getLastEventTime() {
    return 0;
  }

  @Override
  public List<Cue> getCues(long timeUs) {
    return timeUs >= 0 ? cues : Collections.<Cue>emptyList();
  }

}


text:
package IFTest::TestContext;

use base qw(
    Test::Class
    IFTest::Type::SiteClassifier
);
use Test::More;
use IFTest::Application;
use IF::Request::Offline;
use IF::Context;
use IFTest::Entity::SiteClassifier;

sub setUp : Test(startup => 4) {
    my ($self) = @_;

    IFTest::Type::SiteClassifier::_setUp($self);

    my $URI = '/IFTest/root/en/Home/boohoo';
    my $request = IF::Request::Offline->new();
    ok($request, "Create an offline request");
    $request->setApplicationName('IFTest');
    $request->setUri($URI);
    ok($request->uri() eq $URI, "Set the uri on the request");

    $self->{request} = $request;
}

sub tearDown : Test(shutdown) {
    my ($self) = @_;
    IFTest::Type::SiteClassifier::_tearDown($self);
}

sub test_request_params : Test(10) {
    my ($self) = @_;

    ok($self->{rootSiteClassifier}, "Root site classifier set");

    my $request = $self->{request};
    $request->param('abc' => '123');
    $request->param('def' => ['555', '666', '777']);
    $request->param('blank' => '');

    ok($request->param('abc') eq '123', "Scalar param fetched back from request correctly");
    ok([$request->param('def')]->[0] eq '555', "Array param fetched back from request correctly");

    my $context = IF::Context->contextForRequest($request);
    ok($context, "Create and inflated a context");

    my $rv = $context->formValueForKey('abc');
    ok($rv eq '123', "Scalar key value from request fetched correctly. (abc eq $rv)");

    my $rv = $context->formValuesForKey('abc');
    ok($rv->[0] eq '123', "Scalar key value from request fetched correctly in list context. ([abc]->[0] eq $rv->[0])");

    my $rv = $context->formValueForKey('def');
    my @rvl = split("\0", $rv);
    ok($rvl[2] eq "777", "Multiple value key fetched as scalar. (def[2] eq 777)");

    my $rv = $context->formValuesForKey('def');
    ok(scalar @$rv == 3 && $rv->[0] eq '555', "Multiple value key fetched as list. ([def]->[0] eq $rv->[0])");

    my $rv = $context->formValueForKey('blank');
    ok(!length($rv), "Key with empty string value returned correctly.");

    # Test setting form values on the context
    $context->setFormValueForKey('999', 'abc');
    my $rv = $context->formValueForKey('abc');
    ok($rv eq '999', "Scalar value following setFormValueForKey on context returned ok. (abc eq $rv)");
}

1;


text:
* Android app to discover popular movies.
* Uses [themoviedb](https://www.themoviedb.org/) API to get the movie information.
* Ability to sort by Most Popular, Top Rated, Now Playing, Upcoming.
* Ability to mark movies as favourite (favourites available offline).
* Movie details includes list of trailers.
* Optimized for both phone and tablet.
* SQLite to store the favourite data.
* [Retrofit](http://square.github.io/retrofit/) for REST calls.
* [Picasso](https://github.com/square/picasso) for efficient image loading.
* To build and use the app, you will need to get an api key from themoviedb.org and put it in TmdbApiService class
  private static final String TMDB_API_KEY ="YOUR_API_KEY_HERE";

### Screenshots:

#### Phone: Movie List (Portrait)
![PopMovies movie list phone portrait](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/phone_movies_portrait.png)

#### Phone: Movie List (Landscape)

![PopMovies movie list phone landscape](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/phone_movies_landscape.png)

#### Phone: Sorting options

![Sorting Options](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/phone_sort_options.png)

#### Phone: Movie Details

![Movie Details](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/phone_movie_detail.png)

#### Phone: Movie Details - Trailer List

![Trailer List](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/phone_movie_detail_trailer_list.png)

#### Tablet: Movie List (Landscape)

![Tablet movie list](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/tablet_initialview_landscape.PNG)

#### Tablet: Movie Details (Landscape)

![Tablet movie details](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/tablet_movie_details_landscape.PNG)

#### Tablet: Portrait

![Tablet Portrait](https://github.com/navdeepsekhon/PopMovies/blob/master/screenshots/tablet_portrait.PNG)


text:
package core.time.format;

import org.junit.Test;

import java.time.LocalDate;
import java.time.Month;
import java.time.format.DateTimeFormatter;

import static org.junit.Assert.assertEquals;

public class FormatDateTest implements DateTimeFormatUtils {

	@Test
	public void formatDateWithISOFormatter() {
		DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE;
		LocalDate date = LocalDate.of(2015, Month.OCTOBER, 30);
		// Format date from formatter or from date
		assertEquals(formatter.format(date), "2015-10-30");
		assertEquals(date.format(formatter), "2015-10-30");
	}

	@Test
	public void formatDateWithCustomFormatter() {
		LocalDate date = LocalDate.of(2016, Month.JANUARY, 1);

		checkDateCustomFormat(date, "yy/M/d", "16/1/1");
		checkDateCustomFormat(date, "yy/M/dd", "16/1/01");
		checkDateCustomFormat(date, "yy/MM/dd", "16/01/01");
		checkDateCustomFormat(date, "yy/MMM/dd", "16/Jan/01");
		checkDateCustomFormat(date, "yyyy/MMM/dd", "2016/Jan/01");
	}

	private void checkDateCustomFormat(LocalDate date, String pattern, String expected) {
		DateTimeFormatter formatter = customLocalFormatter(pattern);
		assertEquals(date.format(formatter), expected);
	}
}


text:
#!/usr/bin/env bash
set -e

# Parameters:
# $1: Path to the new truststore
# $2: Truststore password
# $3: Public key to be imported
# $4: Alias of the certificate
function create_truststore {
   keytool -keystore "$1" -storepass "$2" -noprompt -alias "$4" -import -file "$3" -storetype PKCS12
}

# Parameters:
# $1: Path to the new keystore
# $2: Truststore password
# $3: Public key to be imported
# $4: Private key to be imported
# $5: CA public key to be imported
# $6: Alias of the certificate
function create_keystore {
   RANDFILE=/tmp/.rnd openssl pkcs12 -export -in "$3" -inkey "$4" -chain -CAfile "$5" -name "$6" -password pass:"$2" -out "$1"
}

# Parameters:
# $1: Path to the new keystore
# $2: Truststore password
# $3: Public key to be imported
# $4: Private key to be imported
# $5: Alias of the certificate
function create_keystore_without_ca_file {
   RANDFILE=/tmp/.rnd openssl pkcs12 -export -in "$3" -inkey "$4" -name "$5" -password pass:"$2" -out "$1"
}

# Searches the directory with the CAs and finds the CA matching our key.
# This is useful during certificate renewals
#
# Parameters:
# $1: The directory with the CA certificates
# $2: Public key to be imported
function find_ca {
    for ca in "$1"/*; do
        if openssl verify -CAfile "$ca" "$2" &> /dev/null; then
            echo "$ca"
        fi
    done
}

echo "Preparing truststore for replication listener"
# Add each certificate to the trust store
STORE=/tmp/kafka/cluster.truststore.p12
rm -f "$STORE"
for CRT in /opt/kafka/cluster-ca-certs/*.crt; do
  ALIAS=$(basename "$CRT" .crt)
  echo "Adding $CRT to truststore $STORE with alias $ALIAS"
  create_truststore "$STORE" "$CERTS_STORE_PASSWORD" "$CRT" "$ALIAS"
done
echo "Preparing truststore for replication listener is complete"

echo "Looking for the right CA"
CA=$(find_ca /opt/kafka/cluster-ca-certs "/opt/kafka/broker-certs/$HOSTNAME.crt")

if [ ! -f "$CA" ]; then
    echo "No CA found. Thus exiting."
    exit 1
fi
echo "Found the right CA: $CA"

echo "Preparing keystore for replication and clienttls listener"
STORE=/tmp/kafka/cluster.keystore.p12
rm -f "$STORE"
create_keystore "$STORE" "$CERTS_STORE_PASSWORD" \
    "/opt/kafka/broker-certs/$HOSTNAME.crt" \
    "/opt/kafka/broker-certs/$HOSTNAME.key" \
    "$CA" \
    "$HOSTNAME"
echo "Preparing keystore for replication and clienttls listener is complete"

regex="^\/opt\/kafka\/certificates\/(custom|oauth)-(.+)-(.+)-certs$"
for CERT_DIR in /opt/kafka/certificates/*; do
  if [[ $CERT_DIR =~ $regex ]]; then
    listener=${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]}
    echo "Preparing store for $listener listener"
    if [[ ${BASH_REMATCH[1]} == "custom"  ]]; then
      echo "Creating keystore /tmp/kafka/$listener.keystore.p12"
      rm -f /tmp/kafka/"$listener".keystore.p12
      create_keystore_without_ca_file /tmp/kafka/"$listener".keystore.p12 "$CERTS_STORE_PASSWORD" "${CERT_DIR}/tls.crt" "${CERT_DIR}/tls.key" custom-key
    elif [[ ${BASH_REMATCH[1]} == "oauth"  ]]; then
      OAUTH_STORE="/tmp/kafka/$listener.truststore.p12"
      rm -f "$OAUTH_STORE"
      # Add each certificate to the trust store
      declare -i INDEX=0
      for CRT in "$CERT_DIR"/**/*; do
        ALIAS="oauth-${INDEX}"
        echo "Adding $CRT to truststore $OAUTH_STORE with alias $ALIAS"
        create_truststore "$OAUTH_STORE" "$CERTS_STORE_PASSWORD" "$CRT" "$ALIAS"
        INDEX+=1
      done
    fi
    echo "Preparing store for ${BASH_REMATCH[1]} ${BASH_REMATCH[2]} listener is complete"
  fi
done

echo "Preparing truststore for client authentication"
# Add each certificate to the trust store
STORE=/tmp/kafka/clients.truststore.p12
rm -f "$STORE"
for CRT in /opt/kafka/client-ca-certs/*.crt; do
  ALIAS=$(basename "$CRT" .crt)
  echo "Adding $CRT to truststore $STORE with alias $ALIAS"
  create_truststore "$STORE" "$CERTS_STORE_PASSWORD" "$CRT" "$ALIAS"
done
echo "Preparing truststore for client authentication is complete"

AUTHZ_KEYCLOAK_DIR="/opt/kafka/certificates/authz-keycloak-certs"
AUTHZ_KEYCLOAK_STORE="/tmp/kafka/authz-keycloak.truststore.p12"
rm -f "$AUTHZ_KEYCLOAK_STORE"
if [ -d "$AUTHZ_KEYCLOAK_DIR" ]; then
  echo "Preparing truststore for Authorization with Keycloak"

  # Add each certificate to the trust store
  declare -i INDEX=0
  for CRT in "$AUTHZ_KEYCLOAK_DIR"/**/*; do
    ALIAS="authz-keycloak-${INDEX}"
    echo "Adding $CRT to truststore $AUTHZ_KEYCLOAK_STORE with alias $ALIAS"
    create_truststore "$AUTHZ_KEYCLOAK_STORE" "$CERTS_STORE_PASSWORD" "$CRT" "$ALIAS"
    INDEX+=1
  done
  echo "Preparing truststore for Authorization with Keycloak is complete"
fi


text:
{% extends "layouts/" + render_mode + ".html" %}
{% block content %}
{% set result = use_data_view('/api/0/md5sum/wordy/', result) %}

Result: {{ result }}

{% endblock %}


text:
<?php
/**
 * WordPress Administration for Navigation Menus
 * Interface functions
 *
 * @version 2.0.0
 *
 * @package WordPress
 * @subpackage Administration
 */

/** Load WordPress Administration Bootstrap */
require_once( './admin.php' );

// Load all the nav menu interface functions
require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );

if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
	wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );

// Permissions Check
if ( ! current_user_can('edit_theme_options') )
	wp_die( __( 'Cheatin’ uh?' ) );

// jQuery
wp_enqueue_script( 'jquery-ui-draggable' );
wp_enqueue_script( 'jquery-ui-droppable' );
wp_enqueue_script( 'jquery-ui-sortable' );

// Nav Menu functions
wp_enqueue_script( 'nav-menu' );

// Metaboxes
wp_enqueue_script( 'common' );
wp_enqueue_script( 'wp-lists' );
wp_enqueue_script( 'postbox' );

// Container for any messages displayed to the user
$messages = array();

// Container that stores the name of the active menu
$nav_menu_selected_title = '';

// The menu id of the current menu being edited
$nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0;

// Allowed actions: add, update, delete
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit';

switch ( $action ) {
	case 'add-menu-item':
		check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' );
		if ( isset( $_REQUEST['nav-menu-locations'] ) )
			set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) );
		elseif ( isset( $_REQUEST['menu-item'] ) )
			wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] );
		break;
	case 'move-down-menu-item' :
		// moving down a menu item is the same as moving up the next in order
		check_admin_referer( 'move-menu_item' );
		$menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
		if ( is_nav_menu_item( $menu_item_id ) ) {
			$menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
			if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
				$menu_id = (int) $menus[0];
				$ordered_menu_items = wp_get_nav_menu_items( $menu_id );
				$menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );

				// set up the data we need in one pass through the array of menu items
				$dbids_to_orders = array();
				$orders_to_dbids = array();
				foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
					if ( isset( $ordered_menu_item_object->ID ) ) {
						if ( isset( $ordered_menu_item_object->menu_order ) ) {
							$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
							$orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
						}
					}
				}

				// get next in order
				if (
					isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1] )
				) {
					$next_item_id = $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1];
					$next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) );

					// if not siblings of same parent, bubble menu item up but keep order
					if (
						! empty( $menu_item_data['menu_item_parent'] ) &&
						(
							empty( $next_item_data['menu_item_parent'] ) ||
							$next_item_data['menu_item_parent'] != $menu_item_data['menu_item_parent']
						)
					) {

						$parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;

						$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );

						if ( ! is_wp_error( $parent_object ) ) {
							$parent_data = (array) $parent_object;
							$menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
							update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );

						}

					// make menu item a child of its next sibling
					} else {
						$next_item_data['menu_order'] = $next_item_data['menu_order'] - 1;
						$menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1;

						$menu_item_data['menu_item_parent'] = $next_item_data['ID'];
						update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );

						wp_update_post($menu_item_data);
						wp_update_post($next_item_data);
					}

				// the item is last but still has a parent, so bubble up
				} elseif (
					! empty( $menu_item_data['menu_item_parent'] ) &&
					in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids )
				) {
					$menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true);
					update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
				}
			}
		}

		break;
	case 'move-up-menu-item' :
		check_admin_referer( 'move-menu_item' );
		$menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
		if ( is_nav_menu_item( $menu_item_id ) ) {
			$menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
			if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
				$menu_id = (int) $menus[0];
				$ordered_menu_items = wp_get_nav_menu_items( $menu_id );
				$menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );

				// set up the data we need in one pass through the array of menu items
				$dbids_to_orders = array();
				$orders_to_dbids = array();
				foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
					if ( isset( $ordered_menu_item_object->ID ) ) {
						if ( isset( $ordered_menu_item_object->menu_order ) ) {
							$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
							$orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
						}
					}
				}

				// if this menu item is not first
				if ( ! empty( $dbids_to_orders[$menu_item_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) {

					// if this menu item is a child of the previous
					if (
						! empty( $menu_item_data['menu_item_parent'] ) &&
						in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) &&
						isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) &&
						( $menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] )
					) {
						$parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
						$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );

						if ( ! is_wp_error( $parent_object ) ) {
							$parent_data = (array) $parent_object;

							// if there is something before the parent and parent a child of it, make menu item a child also of it
							if (
								! empty( $dbids_to_orders[$parent_db_id] ) &&
								! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) &&
								! empty( $parent_data['menu_item_parent'] )
							) {
								$menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];

							// else if there is something before parent and parent not a child of it, make menu item a child of that something's parent
							} elseif (
								! empty( $dbids_to_orders[$parent_db_id] ) &&
								! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] )
							) {
								$_possible_parent_id = (int) get_post_meta( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true);
								if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) )
									$menu_item_data['menu_item_parent'] = $_possible_parent_id;
								else
									$menu_item_data['menu_item_parent'] = 0;

							// else there isn't something before the parent
							} else {
								$menu_item_data['menu_item_parent'] = 0;
							}

							// set former parent's [menu_order] to that of menu-item's
							$parent_data['menu_order'] = $parent_data['menu_order'] + 1;

							// set menu-item's [menu_order] to that of former parent
							$menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1;

							// save changes
							update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
							wp_update_post($menu_item_data);
							wp_update_post($parent_data);
						}

					// else this menu item is not a child of the previous
					} elseif (
						empty( $menu_item_data['menu_order'] ) ||
						empty( $menu_item_data['menu_item_parent'] ) ||
						! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) ||
						empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ||
						$orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] != $menu_item_data['menu_item_parent']
					) {
						// just make it a child of the previous; keep the order
						$menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1];
						update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
						wp_update_post($menu_item_data);
					}
				}
			}
		}
		break;

	case 'delete-menu-item':
		$menu_item_id = (int) $_REQUEST['menu-item'];

		check_admin_referer( 'delete-menu_item_' . $menu_item_id );

		if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) )
			$messages[] = '

' . __('The menu item has been successfully deleted.') . '

';
		break;
	case 'delete':
		check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );

		if ( is_nav_menu( $nav_menu_selected_id ) ) {
			$deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_selected_id );
			$delete_nav_menu = wp_delete_nav_menu( $nav_menu_selected_id );

			if ( is_wp_error($delete_nav_menu) ) {
				$messages[] = '

' . $delete_nav_menu->get_error_message() . '

';
			} else {
				// Remove this menu from any locations.
				$locations = get_theme_mod( 'nav_menu_locations' );
				foreach ( (array) $locations as $location => $menu_id ) {
					if ( $menu_id == $nav_menu_selected_id )
						$locations[ $location ] = 0;
				}
				set_theme_mod( 'nav_menu_locations', $locations );
				$messages[] = '

' . __('The menu has been successfully deleted.') . '

';
				// Select the next available menu
				$nav_menu_selected_id = 0;
				$_nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
				foreach( $_nav_menus as $index => $_nav_menu ) {
					if ( strcmp( $_nav_menu->name, $deleted_nav_menu->name ) >= 0
					 || $index == count( $_nav_menus ) - 1 ) {
						$nav_menu_selected_id = $_nav_menu->term_id;
						break;
					}
				}
			}
			unset( $delete_nav_menu, $deleted_nav_menu, $_nav_menus );
		} else {
			// Reset the selected menu
			$nav_menu_selected_id = 0;
			unset( $_REQUEST['menu'] );
		}
		break;

	case 'update':
		check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );

		// Update menu theme locations
		if ( isset( $_POST['menu-locations'] ) )
			set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );

		// Add Menu
		if ( 0 == $nav_menu_selected_id ) {
			$new_menu_title = trim( esc_html( $_POST['menu-name'] ) );

			if ( $new_menu_title ) {
				$_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) );

				if ( is_wp_error( $_nav_menu_selected_id ) ) {
					$messages[] = '

' . $_nav_menu_selected_id->get_error_message() . '

';
				} else {
					$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
					$nav_menu_selected_id = $_nav_menu_selected_id;
					$nav_menu_selected_title = $_menu_object->name;
					$messages[] = '

' . sprintf( __('The %s menu has been successfully created.'), $nav_menu_selected_title ) . '

';
				}
			} else {
				$messages[] = '

' . __('Please enter a valid menu name.') . '

';
			}

		// update existing menu
		} else {

			$_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );

			$menu_title = trim( esc_html( $_POST['menu-name'] ) );
			if ( ! $menu_title ) {
				$messages[] = '

' . __('Please enter a valid menu name.') . '

';
				$menu_title = $_menu_object->name;
			}

			if ( ! is_wp_error( $_menu_object ) ) {
				$_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) );
				if ( is_wp_error( $_nav_menu_selected_id ) ) {
					$_menu_object = $_nav_menu_selected_id;
					$messages[] = '

' . $_nav_menu_selected_id->get_error_message() . '

';
				} else {
					$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
					$nav_menu_selected_title = $_menu_object->name;
				}
			}

			// Update menu items

			if ( ! is_wp_error( $_menu_object ) ) {
				$unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish') );
				$menu_items = array();
				// Index menu items by db ID
				foreach( $unsorted_menu_items as $_item )
					$menu_items[$_item->db_id] = $_item;

				$post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn' );
				wp_defer_term_counting(true);
				// Loop through all the menu items' POST variables
				if ( ! empty( $_POST['menu-item-db-id'] ) ) {
					foreach( (array) $_POST['menu-item-db-id'] as $_key => $k ) {

						// Menu item title can't be blank
						if ( empty( $_POST['menu-item-title'][$_key] ) )
							continue;

						$args = array();
						foreach ( $post_fields as $field )
							$args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';

						$menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );

						if ( is_wp_error( $menu_item_db_id ) )
							$messages[] = '

' . $menu_item_db_id->get_error_message() . '

';
						elseif ( isset( $menu_items[$menu_item_db_id] ) )
							unset( $menu_items[$menu_item_db_id] );
					}
				}

				// Remove menu items from the menu that weren't in $_POST
				if ( ! empty( $menu_items ) ) {
					foreach ( array_keys( $menu_items ) as $menu_item_id ) {
						if ( is_nav_menu_item( $menu_item_id ) ) {
							wp_delete_post( $menu_item_id );
						}
					}
				}

				// Store 'auto-add' pages.
				$auto_add = ! empty( $_POST['auto-add-pages'] );
				$nav_menu_option = (array) get_option( 'nav_menu_options' );
				if ( ! isset( $nav_menu_option['auto_add'] ) )
					$nav_menu_option['auto_add'] = array();
				if ( $auto_add ) {
					if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
						$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
				} else {
					if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
						unset( $nav_menu_option['auto_add'][$key] );
				}
				// Remove nonexistent/deleted menus
				$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
				update_option( 'nav_menu_options', $nav_menu_option );

				wp_defer_term_counting(false);

				do_action( 'wp_update_nav_menu', $nav_menu_selected_id );

				$messages[] = '

' . sprintf( __('The %s menu has been updated.'), $nav_menu_selected_title ) . '

';
				unset( $menu_items, $unsorted_menu_items );
			}
		}
		break;
}

// Get all nav menus
$nav_menus = wp_get_nav_menus( array('orderby' => 'name') );

// Get recently edited nav menu
$recently_edited = (int) get_user_option( 'nav_menu_recently_edited' );

// If there was no recently edited menu, and $nav_menu_selected_id is a nav menu, update recently edited menu.
if ( !$recently_edited && is_nav_menu( $nav_menu_selected_id ) ) {
	$recently_edited = $nav_menu_selected_id;

// Else if $nav_menu_selected_id is not a menu and not requesting that we create a new menu, but $recently_edited is a menu, grab that one.
} elseif ( 0 == $nav_menu_selected_id && ! isset( $_REQUEST['menu'] ) && is_nav_menu( $recently_edited ) ) {
	$nav_menu_selected_id = $recently_edited;

// Else try to grab the first menu from the menus list
} elseif ( 0 == $nav_menu_selected_id && ! isset( $_REQUEST['menu'] ) && ! empty($nav_menus) ) {
	$nav_menu_selected_id = $nav_menus[0]->term_id;
}

// Update the user's setting
if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )
	update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );

// If there's a menu, get its name.
if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) {
	$_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
	$nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : '';
}

// Generate truncated menu names
foreach( (array) $nav_menus as $key => $_nav_menu ) {
	$_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40 ) );
	if ( $_nav_menu->truncated_name != $_nav_menu->name )
		$_nav_menu->truncated_name .= '…';

	$nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
}

// Ensure the user will be able to scroll horizontally
// by adding a class for the max menu depth.
global $_wp_nav_menu_max_depth;
$_wp_nav_menu_max_depth = 0;

// Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth
if ( is_nav_menu( $nav_menu_selected_id ) )
	$edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id  );

function wp_nav_menu_max_depth($classes) {
	global $_wp_nav_menu_max_depth;
	return "$classes menu-max-depth-$_wp_nav_menu_max_depth";
}

add_filter('admin_body_class', 'wp_nav_menu_max_depth');

wp_nav_menu_setup();
wp_initial_nav_menu_meta_boxes();

if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() )
	$messages[] = '

' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '

';

get_current_screen()->add_help_tab( array(
'id'		=> 'overview',
'title'		=> __('Overview'),
'content'	=>
	'
' . __('This feature allows you to use a custom menu in place of your theme’s default menus.') . '
' .
	'
' . __('Custom menus may contain links to pages, categories, custom links or other content types (use the Screen Options tab to decide which ones to show on the screen). You can specify a different navigation label for a menu item as well as other attributes. You can create multiple menus. If your theme includes more than one menu, you can choose which custom menu to associate with each. You can also use custom menus in conjunction with the Custom Menus widget.') . '
' .
	'
' . __('If your theme does not support the custom menus feature yet (the default themes, Twenty Eleven and Twenty Ten, do), you can learn about adding this support by following the Documentation link to the side.') . '
'
) );
get_current_screen()->add_help_tab( array(
'id'		=> 'create-menus',
'title'		=> __('Create Menus'),
'content'	=>
	'
' . __('To create a new custom menu, click on the + tab, give the menu a name, and click Create Menu. Next, add menu items from the appropriate boxes. You’ll be able to edit the information for each menu item, and can drag and drop to put them in order. You can also drag a menu item a little to the right to make it a submenu, to create menus with hierarchy. Drop the item into its new nested placement when the dotted rectangle target shifts over, also a little to the right. Don’t forget to click Save when you’re finished.') . '
'
) );

get_current_screen()->set_help_sidebar(
	'
' . __('For more information:') . '
' .
	'
' . __('Documentation on Menus') . '
' .
	'
' . __('Support Forums') . '
'
);

// Get the admin header
require_once( './admin-header.php' );
?>

	<?php screen_icon(); ?>

<?php esc_html_e('Menus'); ?>

	<?php
	foreach( $messages as $message ) :
		echo $message . "\n";
	endforeach;
	?>

	<div id="menu-settings-column" class="metabox-holder<?php if ( !$nav_menu_selected_id ) { echo ' metabox-holder-disabled'; } ?>">

		<form id="nav-menu-meta" action="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-menu-meta" method="post" enctype="multipart/form-data">
			<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
			<input type="hidden" name="action" value="add-menu-item" />
			<?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?>
			<?php do_meta_boxes( 'nav-menus', 'side', null ); ?>
		</form>

				<form id="select-nav-menu" action="">
					<?php esc_html_e( 'Select Menu:' ); ?>
					<select class="select-nav-menu" name="menu">
						<?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
							<option value="<?php echo esc_attr($_nav_menu->term_id) ?>" <?php selected($nav_menu_selected_id, $_nav_menu->term_id); ?>>
								<?php echo esc_html( $_nav_menu->truncated_name ); ?>
							</option>
						<?php endforeach; ?>
						<option value="0"><?php esc_html_e('Add New Menu'); ?></option>
					</select>
					<input type="hidden" name="action" value="edit" />
					<?php submit_button( __( 'Select' ), 'secondary', 'select_menu', false ); ?>
				</form>

				<?php
				foreach( (array) $nav_menus as $_nav_menu ) :
					if ( $nav_menu_selected_id == $_nav_menu->term_id ) : ?>
							<?php echo esc_html( $_nav_menu->truncated_name ); ?>
						<?php else : ?><a href="<?php
							echo esc_url(add_query_arg(
								array(
									'action' => 'edit',
									'menu' => $_nav_menu->term_id,
								),
								admin_url( 'nav-menus.php' )
							));
						?>" class="nav-tab hide-if-no-js">
							<?php echo esc_html( $_nav_menu->truncated_name ); ?>
						<?php endif;
				endforeach;
				if ( 0 == $nav_menu_selected_id ) : ?>
					<?php printf( '+', esc_html__( 'Add menu' ) ); ?>
				<?php else : ?><a href="<?php
					echo esc_url(add_query_arg(
						array(
							'action' => 'edit',
							'menu' => 0,
						),
						admin_url( 'nav-menus.php' )
					));
				?>" class="nav-tab menu-add-new">
					<?php printf( '+', esc_html__( 'Add menu' ) ); ?>
				<?php endif; ?>

				<form id="update-nav-menu" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">

									<?php _e('Menu Name'); ?>
									<input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Enter menu name here'); ?>" value="<?php echo esc_attr( $nav_menu_selected_title  ); ?>" />

								<?php if ( !empty( $nav_menu_selected_id ) ) :
									if ( ! isset( $auto_add ) ) {
										$auto_add = get_option( 'nav_menu_options' );
										if ( ! isset( $auto_add['auto_add'] ) )
											$auto_add = false;
										elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
											$auto_add = true;
										else
											$auto_add = false;
									}
								?>

									<input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" value="1" /> <?php printf( __('Automatically add new top-level pages' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?>

								<?php endif; ?>

									<?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>

								<?php if ( ! empty( $nav_menu_selected_id ) ) : ?>

									<a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( admin_url('nav-menus.php?action=delete&menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ) ); ?>"><?php _e('Delete Menu'); ?>

								<?php endif; ?>

						<?php
						wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
						wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
						wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
						?>
						<input type="hidden" name="action" value="update" />
						<input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />

							<?php
							if ( isset( $edit_markup ) ) {
								if ( ! is_wp_error( $edit_markup ) )
									echo $edit_markup;
							} else if ( empty( $nav_menu_selected_id ) ) {
								echo '
';
								echo '
' . __('To create a custom menu, give it a name above and click Create Menu. Then choose items like pages, categories or custom links from the left column to add to this menu.') . '
';
								echo '
' . __('After you have added your items, drag and drop to put them in the order you want. You can also click each item to reveal additional configuration options.') . '
';
								echo '
' . __('When you have finished building your custom menu, make sure you click the Save Menu button.') . '
';
								echo '
';
							}
							?>

							<?php
							if ( ! empty( $nav_menu_selected_id ) )
								submit_button( __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) );
							?>

				</form>

<?php include( './admin-footer.php' ); ?>


text:
package org.apache.asterix.app.result.fields;

import java.io.PrintWriter;

import org.apache.asterix.api.http.server.ResultUtil;
import org.apache.asterix.common.api.IApplicationContext;
import org.apache.asterix.common.api.IResponseFieldPrinter;
import org.apache.asterix.translator.IStatementExecutor;
import org.apache.asterix.translator.SessionConfig;
import org.apache.asterix.translator.SessionOutput;
import org.apache.hyracks.api.exceptions.HyracksDataException;

public class ExplainOnlyResultsPrinter implements IResponseFieldPrinter {

    private final IApplicationContext appCtx;
    private final String plan;
    private final SessionOutput sessionOutput;

    public ExplainOnlyResultsPrinter(IApplicationContext appCtx, String plan, SessionOutput sessionOutput) {
        this.appCtx = appCtx;
        this.plan = plan;
        this.sessionOutput = sessionOutput;
    }

    @Override
    public void print(PrintWriter pw) throws HyracksDataException {
        boolean quoteResult = sessionOutput.config().getPlanFormat() == SessionConfig.PlanFormat.STRING;
        sessionOutput.config().set(SessionConfig.FORMAT_QUOTE_RECORD, quoteResult);
        ResultUtil.printResults(appCtx, plan, sessionOutput, new IStatementExecutor.Stats(), null);
    }

    @Override
    public String getName() {
        return ResultsPrinter.FIELD_NAME;
    }
}


text:
package org.gradle.api.internal;

import org.gradle.api.internal.classpath.Module;
import org.gradle.api.internal.classpath.ModuleRegistry;
import org.gradle.api.internal.classpath.PluginModuleRegistry;
import org.gradle.internal.classpath.ClassPath;
import org.gradle.internal.classpath.DefaultClassPath;

public class DynamicModulesClassPathProvider implements ClassPathProvider {
    private final ModuleRegistry moduleRegistry;
    private final PluginModuleRegistry pluginModuleRegistry;

    public DynamicModulesClassPathProvider(ModuleRegistry moduleRegistry, PluginModuleRegistry pluginModuleRegistry) {
        this.moduleRegistry = moduleRegistry;
        this.pluginModuleRegistry = pluginModuleRegistry;
    }

    public ClassPath findClassPath(String name) {
        if (name.equals("GRADLE_PLUGINS")) {
            ClassPath classpath = new DefaultClassPath();
            for (Module pluginModule : pluginModuleRegistry.getPluginModules()) {
                classpath = classpath.plus(pluginModule.getClasspath());
            }
            return classpath;
        }
        if (name.equals("GRADLE_CORE_IMPL")) {
            return moduleRegistry.getModule("gradle-core-impl").getClasspath();
        }

        return null;
    }
}


text:
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 5                                                        |
// +----------------------------------------------------------------------+
// | Copyright 2005-2007 the Seasar Foundation and the Others.            |
// +----------------------------------------------------------------------+
// | 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.             |
// +----------------------------------------------------------------------+
// | Authors: yonekawa                                                    |
// +----------------------------------------------------------------------+
// $Id: $
//
/**
 * @author yonekawa
 */
class S2Dao_PagerJsonResultSetWrapperTest extends PHPUnit2_Framework_TestCase {

    private $wrapper = null;
    private $condition;

    public static function main() {
        $suite  = new PHPUnit2_Framework_TestSuite("S2Dao_PagerJsonResultSetWrapperTest");
        $result = PHPUnit2_TextUI_TestRunner::run($suite);
    }

    protected function setUp() {
        $this->wrapper = new S2Dao_PagerJsonResultSetWrapper();
        $this->condition = new S2Dao_DefaultPagerCondition();
    }

    protected function tearDown() {
        $this->wrapper = null;
        $this->condition = null;
    }

    public function testFilter() {
        $array1 = array("aaa", "bbb", "ccc", "ddd", "eee");
        $array2 = array("ccc", "ddd", "eee");
        $json = json_encode($array1);
        $filter_json = json_encode($array2);

        $this->condition->setLimit(3);
        $this->condition->setOffset(2);

        $json = $this->wrapper->filter($json, $this->condition);

        $this->assertEquals($json, $filter_json);
    }
}

?>


text:
version=$1
echo $version
readarray -d . -t versionNumbers <<< $version
if [[ ${versionNumbers[1]} -eq "0" && ${versionNumbers[2]} -eq "0" ]]
then
    oldVersion=$(({versionNumbers[0]} - 1))
else
    oldVersion=${versionNumbers[0]}
fi
oldVersion="$oldVersion.0.0"
echo $oldVersion
rm -rf ../LastMajorVersionBinary
curl https://globalcdn.nuget.org/packages/automapper.$oldVersion.nupkg --create-dirs -o ../LastMajorVersionBinary/automapper.$oldVersion.nupkg
unzip -j ../LastMajorVersionBinary/automapper.$oldVersion.nupkg lib/netstandard2.1/AutoMapper.dll -d ../LastMajorVersionBinary


text:
<!DOCTYPE html>

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

	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="icon" href="../../favicon.ico">

	<title>loading...</title>

	  <link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/8.5.0/styles/solarized_light.min.css">

     <link href="css/app.css" rel="stylesheet">