text:
require 'moped'
module Footnotes::Notes
  class MopedSubscriber < ActiveSupport::LogSubscriber
    include Singleton
    RUNTIME_KEY = name + "#runtime"
    COUNT_KEY = name + "#count"

    def self.runtime=(value)
      Thread.current[RUNTIME_KEY] = value
    end

    def self.runtime
      Thread.current[RUNTIME_KEY] ||= 0
    end

    def self.count=(value)
      Thread.current[COUNT_KEY] = value
    end

    def self.count
      Thread.current[COUNT_KEY] ||= 0
    end

    def self.reset_runtime
      runtime
    end

    def self.events
      @@events
    end
    def self.events=(x)
      @@events=x
    end

    def initialize
      @@events = []
      super
    end

    def moped(event)
      self.class.runtime += event.duration
      self.class.count += 1
      @@events << MopedNotificationEvent.new(event.name, event.time, event.end, event.transaction_id, event.payload)
    end
    def logger
      Rails.logger
    end
    def self.reset!
      @@events.clear
    end
  end

  class MopedNote < AbstractNote
    def self.start!(controller)
      MopedSubscriber.reset!
    end

    def self.events
      MopedSubscriber.events
    end

    def self.title
      queries = MopedSubscriber.events.count
      total_time = MopedSubscriber.runtime
      "Moped Queries (#{queries}) DB (#{"%.3f" % total_time}ms)"
    end

    def content
      html = ''
      MopedSubscriber.events.each_with_index do |event, index|
        begin
          time = '(%.3fms)' % [event.duration]
          html << <<-HTML

                  [#{time}] #{event.database}['#{event.collection}'].#{event.command_type}(#{event.query})
                  #{event.skip.to_i <= 0 ? "" : ".skip(#{event.skip})"}
                  #{event.limit.to_i <= 0 ? "" : ".limit(#{event.limit})"}

          HTML
        rescue Exception => e
          html << e.message
        end
      end
      html
    end
  end

  class MopedNotificationEvent < ActiveSupport::Notifications::Event
    attr_reader :database, :query, :command, :command_type, :collection, :skip, :limit
    def initialize (name, start, ending, transaction_id, payload)
      super(name, start, ending, transaction_id, {})
      message = payload[:ops].first
      @skip = message.skip.to_i
      @limit = message.limit.to_i
      @query = message.selector.inspect
      # decode it here
      case message.class.to_s
        when 'Moped::Protocol::Command'
          @command_type = 'command'
        when 'Moped::Protocol::Query'
          @command_type = 'find'
        when 'Moped::Protocol::Delete'
          @command_type = 'delete'
        when 'Moped::Protocol::Insert'
          @command_type = 'insert'
          @query = message.documents.inspect
        when 'Moped::Protocol::Update'
          @command_type = 'update'
          @query = "(#{message.selector.inspect}), (#{message.update.inspect})"
        else
          @command_type = "unknown"
      end

      @database = message.database
      if message.respond_to? :collection
        @collection = message.collection
      else
        @collection = "$cmd"
      end
      if @collection.eql?("$cmd") && message.selector[:count]
        @collection = message.selector[:count]
        @command_type = "count"
      end
      if message.log_inspect.include?(":mapreduce")
        @command_type = "mapreduce"
      end

    end
  end

end


text:
typedef std::vector<std::string> StrVec;
typedef StrVec::size_type Index;

// The parsing functions always store an error message in this string when they
// fail, before returning null.
extern const char* parseError;

// Parses a complete sentence in prefix notation. Returns null on failure and
// stores an error message in parseError.
Sentence* parseSentence(const StrVec& tokens, Index& i);

// Returns a vector of string tokens by splitting on whitespace. Left and right
// parentheses/braces and commas are always treated as separate tokens.
StrVec tokenize(char* line);

#endif

redpajama_set_name: RedPajamaGithub


text:
/* globals __dirname  */
const express = require('express');
const posts = require('./routes/posts/posts-route');
const users = require('./routes/users/users-route');
const auth = require('./routes/auth/auth-route');
const about = require('./routes/about/about-route');
const start = require('./routes/start/start-route');
const path = require('path');
const bodyParser = require('body-parser');
const authConfig = require('./config/auth.config');
const Database = require('./database/mongodb');
const session = require('express-session');
const cookieParser = require('cookie-parser');
const flash = require('connect-flash');

const init = (serverConfig) => {
    const app = express();

    const connectionstring = serverConfig.connectionString;
    const sessionSecret = serverConfig.sessionSecret;
    const bodyParserType = serverConfig.bodyParserType;
    const newCategories = serverConfig.categories;
    const registratedUser = serverConfig.user;

    app.use(express.static(__dirname + '../Forum'));
    app.set('views', __dirname + '/views');
    app.set('view engine', 'pug');
    app.use('/static', express.static(path.join(__dirname, './static')));
    app.use('/libs', express.static(path.join(__dirname, '../node_modules')));
    if (bodyParserType === 'url') {
        app.use(bodyParser.urlencoded({ extended: true }));
    } else {
        app.use(bodyParser.json());
    }
    app.use(cookieParser('secret'));
    app.use(session({
        secret: sessionSecret,
        resave: false,
        saveUninitialized: true,
        cookie: {
            maxAge: 600000000,
        },
    }));
    app.use(flash());

    const database = new Database(connectionstring);

    /* const category = {
        title: 'Other',
        posts: [],
    };
    database.insert('categories', category);*/
    authConfig(app, database);
    posts(app, database, registratedUser);
    users(app, database);
    auth(app, database);
    about(app);
    start(app, database);

    database.showAll('categories')
        .then((categories) => {
            if (categories.length === 0) {
                for (const category of newCategories) {
                    database.insert('categories', {
                        title: category,
                        bio: '',
                        posts: [],
                    });
                }
            }
        });
    return Promise.resolve(app);
};

module.exports = {
    init,
};

// Tutorial for using database
// database.deleteAll('categories');

// database.showAll('categories').then((th) => console.log(th));
// database.findById('categories','59743f13e392ab1c148c64b0')
// .then((f)=>console.log(f));
// database.update('test',{text:'a'},{text:'b'}).then((d)=>console.log(d));
// database.showAll('users').then(u => console.log(u));
// database.deleteAll('posts/Sport');
// database.deleteAll('users');

// animals, cars, clothing, man, school, space,
// sport, women, sex, movies, music, programming, work, other,games
// const category1 = {
//     title: 'Games',
//     bio: '',
//     posts: [],
// };
// database.insert('categories', category1).then((c) => console.log(c));

// This drops the database.
// database.showAll('categories').then((categories)=>{
//     for (let i = 0; i < categories.length; i+=1) {
//         database.deleteAll(categories[i].title);
//     }
// });
// database.deleteAll('users');
// database.deleteAll('categories');
// database.delete('categories', {title: 'Games'});


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Trichosporum giganteum Vuill.

### Remarks
null


text:
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->

## kops delete sshpublickey

Delete an SSH public key.

```
kops delete sshpublickey [CLUSTER] [flags]
```

### Examples

```
  # Delete the SSH public key for a cluster
  kops delete sshpublickey k8s-cluster.example.com
```

### Options

```
  -h, --help   help for sshpublickey
```

### Options inherited from parent commands

```
      --config string   yaml config file (default is $HOME/.kops.yaml)
      --name string     Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable
      --state string    Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable
  -v, --v Level         number for the log level verbosity
```

### SEE ALSO

* [kops delete](kops_delete.md)	 - Delete clusters, instancegroups, instances, and secrets.


text:
package com.coolweather.app.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import android.widget.Toast;

public class HttpUtil {
	public static void sendHttpRequest(final String address,final HttpCallbackListener listener){
		if(!isNetworkAvailable()){
			Toast.makeText(com.coolweather.app.MyApplication.getContext(), "Network is unavailable", Toast.LENGTH_SHORT).show();
			return;
		}
		new Thread(new Runnable(){
			@Override
			public void run(){
				HttpURLConnection connection=null;
				try
				{
					URL url=new URL(address);
					connection =(HttpURLConnection)url.openConnection();
					connection.setRequestMethod("GET");
					connection.setConnectTimeout(8000);
					connection.setReadTimeout(8000);
					connection.setDoInput(true);
					connection.setDoOutput(true);
					InputStream in = connection.getInputStream();
					BufferedReader reader =new BufferedReader(new InputStreamReader(in));
					StringBuilder response =new StringBuilder();
					String line;
					while((line=reader.readLine())!=null){
						response.append(line);
					}
					if(listener != null){
						listener.onFinish(response.toString());//»Øµ÷onFinish()·½·¨
					}
				}catch(Exception e){
					if(listener != null){
						listener.onError(e);//»Øµ÷onError()·½·¨
					}
				}finally{
					if(connection != null){
						connection.disconnect();
					}
				}
			}
		}).start();

	}

	private static boolean isNetworkAvailable() {
		// TODO Auto-generated method stub
		return false;
	}

}


text:
<?php
session_start();
include('connectionclass/connect.php');
include('connectionclass/function.php');
include('connectionclass/metencrypt.php');
$db=new MyConnection();
$db->connect();
mysql_query("SET NAMES 'UTF8'");
$error="";
if(isset($_POST['btnsave'])){

	$txtusername = $_POST['txtusername'];
	$password = $_POST['txtpassword'];

	$encrypted_txt = encrypt_decrypt('encrypt', $password);

	$select=$db->query("CALL spUserAccSelete('".$txtusername."','".$encrypted_txt."');");
	$numrow=$db->dbCountRows($select);

	if($numrow>0)
	{

		$row=$db->fetch($select);
		$UserID=$row->UserID;

		$Level=$row->UserLever;
		$BranchID=$row->BranchID;
		$BranchName=$row->BranchName;

		$_SESSION['UserID']= $UserID;

		$_SESSION['user']=$txtusername;
		$_SESSION['Level']=$Level;
		$_SESSION['BranchID'] = $BranchID;
		$_SESSION['BranchName'] = $BranchName;
		$_SESSION['startDate'] = date("Y-m-d H:i:s");

		if($Level == 2)
		{
			cRedirect('index.php');

		}
		else if ($Level == 1)
		{

			cRedirect('index.php');
		}
	}
	else
	{
		$error="<blink>Incorrect Username or Password !</blink>";
	}

}
?>
<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>7Technology</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

        <link href="//code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css" rel="stylesheet" type="text/css" />

        <link href="css/morris/morris.css" rel="stylesheet" type="text/css" />

        <link href="css/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" />

        <link href="css/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />

        <link href="css/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />

        <link href="css/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" />

        <link href="css/AdminLTE.css" rel="stylesheet" type="text/css" />

Sign In

            <form role="form" method="post">

                        <input type="text" name="txtusername" class="form-control" placeholder="User Name"/>

                        <input name="txtpassword" type="password" class="form-control" placeholder="Password"/>

                        <input type="checkbox" name="remember_me"/> Remember me <?php echo $error; ?>

                         <input class="btn btn-lg btn-primary btn-block" placeholder="Password" name="btnsave" type="submit" value="Login">

            </form>

    <?php include 'footer.php';
	$db->disconnect();
	?>


text:
package org.testng.internal;

import org.testng.IConfigurationListener;
import org.testng.ITestListener;

/**
 * A convenient interface to use when implementing listeners.
 *
 * @author Alexandru Popescu
 */
public interface IResultListener extends ITestListener, IConfigurationListener {}


text:
<template name="adminMenu">
  {{#if isAdmin}}

      {{_ "admin"}}

          {{#each menu}}
            {{> UI.dynamic template=menuItem data=this}}
          {{/each}}

  {{/if}}
</template>


text:
from morepath import NO_IDENTITY

from conduit.auth.model import User
from .app import App

class ViewPermission:
    pass

class EditPermission:
    pass

@App.permission_rule(model=object, permission=object)
def generic_permission(identity, model, permission):
    return identity != NO_IDENTITY

@App.permission_rule(model=User, permission=object)
def user_generic_permission(identity, model, permission):
    return model.email == identity.userid


text:
|HTTP Method|URL|POST Body|Reselt|
|---|---|---|---|
|POST|/users|JSON String|新增一位使用者|
|GET|/users/?id|empty|取得用戶資料|
|PUT|/users/:id|none|更新用戶資料|
|DELETE|/users/
|POST|/login|JSON String|加入 Token|
|GET|/logout|empty|刪除 Token|

## Add a user

To add a user, you have to POST user's information in JSON format.

Acceptable field:
- **Email**
- **Password**
- **Name**
- **Gender**
- **Birthday**
- Phone Number

The blod items are required, if one of them is null, server will return an error message.
`gender` has only two option: `male` and `female`.
`Birth` field has to use [Date][1] Format.

Example:

```json
{
  "username": "chunyu",
  "email": "junyussh@gmail.com",
  "password": "user12345",
  "name": "Chun Yu Chen",
  "gender": "male",
  "birth": "2000-08-15T16:00:00.000Z",
  "phone": "0987987487"
}
```

## Login

Send an JSON Object to server.

```json
{
  "username": "user",
  "password": "12345"
}
```
##
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/


text:
package org.apache.usergrid.rest.test.resource.endpoints;

import org.apache.usergrid.rest.test.resource.model.ApiResponse;
import org.apache.usergrid.rest.test.resource.model.QueryParameters;
import org.apache.usergrid.rest.test.resource.state.ClientContext;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;

/**
 * Handles making rest calls to system resources.
 */
public class SystemResource extends NamedResource {

    public SystemResource(final ClientContext context, final UrlResource parent ) {
        super( "system",context, parent );
    }

    public DatabaseResource database() {
        return new DatabaseResource(context, this);
    }

    public ApplicationsResource applications(String appid) {
        return new ApplicationsResource(appid,context,this);
    }

    public ApplicationsResource applications(String appid, String additionalPath) {
        return new ApplicationsResource(appid+"/"+additionalPath,context,this);
    }

    public class ApplicationsResource extends NamedResource {

        public ApplicationsResource(final String appid, final ClientContext context, final UrlResource parent) {
            super( "applications/" + appid, context, parent );
        }

        public ApiResponse get(QueryParameters queryParameters){

            WebTarget resource = getTarget();
            resource = addParametersToResource( resource, queryParameters );

            HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
                .credentials( "superuser", "superpassword" ).build();

            return resource.register( feature ).request().accept( MediaType.APPLICATION_JSON )
                .get(ApiResponse.class);
        }

        public ApiResponse delete(QueryParameters queryParameters) {

            WebTarget resource = getTarget();
            resource = addParametersToResource( resource, queryParameters );

            HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
                .credentials( "superuser", "superpassword" ).build();

            return resource.register(feature).request().delete(ApiResponse.class);

        }

        @Override
        public ClientContext getContext() {
            return context;
        }
    }

    public ApiResponse put(){
        ApiResponse response = getTarget(true).request().accept(MediaType.APPLICATION_JSON)
                .put( javax.ws.rs.client.Entity.json(""), ApiResponse.class);
        return response;
    }
}


text:
package com.github.approval.example;

import com.github.approval.Approvals;
import org.junit.Test;

import java.nio.file.Paths;

public class SimpleExampleApprovalTest {

    @Test
    public void shouldReturnSomethingToTestOut() throws Exception {
        //assign
        String title = "myTitle";

        //act
        String actual = SimpleExample.generateHtml(title);

        //verify
        Approvals.verify(actual, Paths.get("src/test/resources/test.txt"));
    }
}


text:
package io.datarouter.aws.s3;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.Headers;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.transfer.Download;
import com.amazonaws.services.s3.transfer.Transfer;
import com.amazonaws.services.s3.transfer.TransferManager;
import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
import com.amazonaws.services.s3.transfer.TransferProgress;
import com.amazonaws.services.s3.transfer.Upload;

import io.datarouter.aws.s3.S3Headers.ContentType;
import io.datarouter.aws.s3.S3Headers.S3ContentType;
import io.datarouter.bytes.ByteUnitTool;
import io.datarouter.instrumentation.trace.TraceSpanGroupType;
import io.datarouter.instrumentation.trace.TracerTool;
import io.datarouter.scanner.Scanner;
import io.datarouter.storage.node.op.raw.read.DirectoryDto;
import io.datarouter.util.Require;
import io.datarouter.util.concurrent.ThreadTool;
import io.datarouter.util.io.ReaderTool;
import io.datarouter.util.number.NumberFormatter;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.core.sync.ResponseTransformer;
import software.amazon.awssdk.http.apache.ApacheHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.Bucket;
import software.amazon.awssdk.services.s3.model.CommonPrefix;
import software.amazon.awssdk.services.s3.model.CompleteMultipartUploadRequest;
import software.amazon.awssdk.services.s3.model.CompletedMultipartUpload;
import software.amazon.awssdk.services.s3.model.CompletedPart;
import software.amazon.awssdk.services.s3.model.CopyObjectRequest;
import software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest;
import software.amazon.awssdk.services.s3.model.CreateMultipartUploadResponse;
import software.amazon.awssdk.services.s3.model.Delete;
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest;
import software.amazon.awssdk.services.s3.model.DeleteObjectsRequest;
import software.amazon.awssdk.services.s3.model.GetBucketLocationRequest;
import software.amazon.awssdk.services.s3.model.GetBucketLocationResponse;
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
import software.amazon.awssdk.services.s3.model.GetObjectResponse;
import software.amazon.awssdk.services.s3.model.HeadBucketRequest;
import software.amazon.awssdk.services.s3.model.HeadBucketResponse;
import software.amazon.awssdk.services.s3.model.HeadObjectRequest;
import software.amazon.awssdk.services.s3.model.HeadObjectResponse;
import software.amazon.awssdk.services.s3.model.ListBucketsResponse;
import software.amazon.awssdk.services.s3.model.ListObjectsV2Request;
import software.amazon.awssdk.services.s3.model.ListObjectsV2Response;
import software.amazon.awssdk.services.s3.model.NoSuchBucketException;
import software.amazon.awssdk.services.s3.model.NoSuchKeyException;
import software.amazon.awssdk.services.s3.model.ObjectCannedACL;
import software.amazon.awssdk.services.s3.model.ObjectIdentifier;
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
import software.amazon.awssdk.services.s3.model.S3Exception;
import software.amazon.awssdk.services.s3.model.S3Object;
import software.amazon.awssdk.services.s3.model.UploadPartRequest;
import software.amazon.awssdk.services.s3.model.UploadPartResponse;
import software.amazon.awssdk.services.s3.paginators.ListObjectsV2Iterable;
import software.amazon.awssdk.services.s3.presigner.S3Presigner;
import software.amazon.awssdk.services.s3.presigner.model.GetObjectPresignRequest;

@SuppressWarnings("serial")
public abstract class BaseDatarouterS3Client implements DatarouterS3Client, Serializable{
	private static final Logger logger = LoggerFactory.getLogger(BaseDatarouterS3Client.class);

	/**
	 * With AWS SDK v2, you need to know the region of the bucket when you make a query to it. This client manages
	 * multiple underlying clients for each region. It will try its best to determine the region of a bucket. To do
	 * this, it uses the getBucketLocation API. This API returns the region of the bucket, if the credentials have
	 * permissions to call it. Otherwise, if called on US-EAST-1, it throws an exception that reveals the region of the
	 * bucket. If called on another region, it throws a 403. Therefore, by parsing the exception, we can determine the
	 * region of all buckets at runtime. We're probably going to persist this information in the future in case their
	 * API changes.
	 */
	private static final Pattern EXPECTED_REGION_EXTRACTOR = Pattern.compile("expecting '(.*)'");
	private static final int MIN_UPLOAD_PART_SIZE_BYTES = 5 * 1024 * 1024;
	private static final Region DEFAULT_REGION = Region.US_EAST_1;

	private final SerializableAwsCredentialsProviderProvider<?> awsCredentialsProviderProvider;

	private transient Map<Region,S3Client> s3ClientByRegion;
	private transient Map<String,Region> regionByBucket;
	private transient S3Presigner s3Presigner;
	private transient Map<Region,TransferManager> transferManagerByRegion;

	public BaseDatarouterS3Client(SerializableAwsCredentialsProviderProvider<?> awsCredentialsProviderProvider){
		this.awsCredentialsProviderProvider = awsCredentialsProviderProvider;
		init();
	}

	/**
	 * Part of the {@link Serializable} interface, sets up transient fields
	 */
	public Object readResolve(){
		init();
		return this;
	}

	private void init(){
		this.s3ClientByRegion = new ConcurrentHashMap<>();
		this.regionByBucket = new ConcurrentHashMap<>();
		this.transferManagerByRegion = new ConcurrentHashMap<>();
		this.s3ClientByRegion.put(DEFAULT_REGION, createClient(DEFAULT_REGION));
		this.s3Presigner = S3Presigner.builder()
				.credentialsProvider(awsCredentialsProviderProvider.get())
				.region(DEFAULT_REGION)
				.build();
	}

	@Override
	public Scanner<Bucket> scanBuckets(){
		S3Client client = getS3ClientForRegion(DEFAULT_REGION);
		ListBucketsResponse response = client.listBuckets();
		return Scanner.of(response.buckets());
	}

	@Override
	public void copyObject(String bucket, String sourceKey, String destinationKey, ObjectCannedACL acl){
		CopyObjectRequest request = CopyObjectRequest.builder()
				.sourceBucket(bucket)
				.sourceKey(sourceKey)
				.destinationBucket(bucket)
				.destinationKey(destinationKey)
				.acl(acl)
				.build();
		S3Client s3Client = getS3ClientForBucket(bucket);
		try(var $ = TracerTool.startSpan("S3 copyObject", TraceSpanGroupType.CLOUD_STORAGE)){
			s3Client.copyObject(request);
		}
	}

	@Override
	public void deleteObject(String bucket, String key){
		DeleteObjectRequest request = DeleteObjectRequest.builder()
				.bucket(bucket)
				.key(key)
				.build();
		S3Client s3Client = getS3ClientForBucket(bucket);
		try(var $ = TracerTool.startSpan("S3 deleteObject", TraceSpanGroupType.CLOUD_STORAGE)){
			s3Client.deleteObject(request);
		}
	}

	@Override
	public void deleteObjects(String bucket, Collection<String> keys){
		List<ObjectIdentifier> objectsToDelete = Scanner.of(keys)
				.map(key -> ObjectIdentifier.builder().key(key).build())
				.list();
		DeleteObjectsRequest request = DeleteObjectsRequest.builder()
				.bucket(bucket)
				.delete(Delete.builder().objects(objectsToDelete).build())
				.build();
		S3Client s3Client = getS3ClientForBucket(bucket);
		try(var $ = TracerTool.startSpan("S3 deleteObjects", TraceSpanGroupType.CLOUD_STORAGE)){
			s3Client.deleteObjects(request);
			TracerTool.appendToSpanInfo("deleted", objectsToDelete.size());
		}
	}

	@Override
	public void putObjectWithHeartbeat(String bucket, String key, ContentType contentType, Path path,
			Runnable heartbeat){
		com.amazonaws.services.s3.model.PutObjectRequest putObjectRequest
				= new com.amazonaws.services.s3.model.PutObjectRequest(bucket, key, path.toFile());
		ObjectMetadata metadata = new ObjectMetadata();
		metadata.setContentType(contentType.getMimeType());
		putObjectRequest.setMetadata(metadata);
		try(var $ = TracerTool.startSpan("S3 upload", TraceSpanGroupType.CLOUD_STORAGE)){
			Upload upload = getTransferManagerForBucket(bucket).upload(putObjectRequest);
			handleTransfer(upload, heartbeat);
		}
	}

	@Override
	public BufferedWriter putAsWriter(String bucket, String key, ContentType contentType){
		return new BufferedWriter(new OutputStreamWriter(put(bucket, key, contentType)));
	}

	@Override
	public OutputStream putWithPublicRead(String bucket, String key, S3ContentType contentType){
		return put(bucket, key, contentType, Optional.of(ObjectCannedACL.PUBLIC_READ));
	}

	@Override
	public OutputStream put(String bucket, String key, S3ContentType contentType){
		return put(bucket, key, contentType, Optional.empty());
	}

	private OutputStream put(String bucket, String key, S3ContentType contentType, Optional<ObjectCannedACL> aclOpt){
		S3Client s3Client = getS3ClientForBucket(bucket);
		CreateMultipartUploadRequest request = CreateMultipartUploadRequest.builder()
				.acl(aclOpt.orElse(null))
				.bucket(bucket)
				.key(key)
				.contentType(contentType.getMimeType())
				.build();
		CreateMultipartUploadResponse response;
		try(var $ = TracerTool.startSpan("S3 createMultipartUpload", TraceSpanGroupType.CLOUD_STORAGE)){
			response = s3Client.createMultipartUpload(request);
		}
		String uploadId = response.uploadId();
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
		List<CompletedPart> completedParts = new ArrayList<>();
		return new OutputStream(){

			private boolean closed;

			private void uploadPart(){
				UploadPartRequest uploadPartRequest = UploadPartRequest.builder()
						.bucket(bucket)
						.key(key)
						.uploadId(uploadId)
						.partNumber(completedParts.size() + 1)
						.build();
				RequestBody requestBody = RequestBody.fromBytes(buffer.toByteArray());
				UploadPartResponse response;
				try(var $ = TracerTool.startSpan("S3 uploadPart", TraceSpanGroupType.CLOUD_STORAGE)){
					response = s3Client.uploadPart(uploadPartRequest, requestBody);
					TracerTool.appendToSpanInfo("Content-Length", uploadPartRequest.contentLength());
				}
				String eTag = response.eTag();
				CompletedPart completedPart = CompletedPart.builder()
						.partNumber(completedParts.size() + 1)
						.eTag(eTag)
						.build();
				completedParts.add(completedPart);
				buffer.reset();
			}

			private void checkBufferSize(){
				if(buffer.size() > MIN_UPLOAD_PART_SIZE_BYTES){
					uploadPart();
				}
			}

			@Override
			public void write(int by){
				Require.isFalse(closed);
				buffer.write(by);
				checkBufferSize();
			}

			@Override
			public void write(byte[] by, int off, int len){
				Require.isFalse(closed);
				buffer.write(by, off, len);
				checkBufferSize();
			}

			@Override
			public void close(){
				uploadPart();
				CompletedMultipartUpload completedMultipartUpload = CompletedMultipartUpload.builder()
						.parts(completedParts)
						.build();
				CompleteMultipartUploadRequest completeMultipartUploadRequest = CompleteMultipartUploadRequest.builder()
						.bucket(bucket)
						.key(key)
						.uploadId(uploadId)
						.multipartUpload(completedMultipartUpload)
						.build();
				try(var $ = TracerTool.startSpan("S3 completeMultipartUpload", TraceSpanGroupType.CLOUD_STORAGE)){
					s3Client.completeMultipartUpload(completeMultipartUploadRequest);
				}
				closed = true;
			}

		};
	}

	@Override
	public void putObjectAsString(String bucket, String key, ContentType contentType, String content){
		S3Client s3Client = getS3ClientForBucket(bucket);
		PutObjectRequest request = makePutObjectRequest(bucket, key, contentType);
		RequestBody requestBody = RequestBody.fromString(content);
		try(var $ = TracerTool.startSpan("S3 putObject", TraceSpanGroupType.CLOUD_STORAGE)){
			s3Client.putObject(request, requestBody);
			TracerTool.appendToSpanInfo("Content-Length", request.contentLength());
		}
	}

	@Override
	public void putObjectAsBytes(String bucket, String key, ContentType contentType, String cacheControl,
			ObjectCannedACL acl, byte[] bytes){
		S3Client s3Client = getS3ClientForBucket(bucket);
		PutObjectRequest request = makePutObjectRequestBuilder(bucket, key, contentType)
				.cacheControl(cacheControl)
				.acl(acl)
				.build();
		RequestBody requestBody = RequestBody.fromBytes(bytes);
		try(var $ = TracerTool.startSpan("S3 putObject", TraceSpanGroupType.CLOUD_STORAGE)){
			s3Client.putObject(request, requestBody);
			TracerTool.appendToSpanInfo("Content-Length", request.contentLength());
		}
	}

	@Override
	public void putObjectAsBytesWithExpirationTime(String bucket, String key, ContentType contentType,
			String cacheControl, ObjectCannedACL acl, byte[] bytes, Instant expirationTime){
		S3Client s3Client = getS3ClientForBucket(bucket);
		PutObjectRequest request = makePutObjectRequestBuilder(bucket, key, contentType)
				.cacheControl(cacheControl)
				.acl(acl)
				.expires(expirationTime)
				.build();
		RequestBody requestBody = RequestBody.fromBytes(bytes);
		try(var $ = TracerTool.startSpan("S3 putObject", TraceSpanGroupType.CLOUD_STORAGE)){
			s3Client.putObject(request, requestBody);
			TracerTool.appendToSpanInfo("Content-Length", request.contentLength());
		}
	}

	@Override
	public void putPublicObject(String bucket, String key, ContentType contentType, Path path){
		putObjectWithAcl(bucket, key, contentType, path, ObjectCannedACL.PUBLIC_READ);
	}

	@Override
	public void putObject(String bucket, String key, ContentType contentType, Path path){
		putObjectWithAcl(bucket, key, contentType, path, ObjectCannedACL.PRIVATE);
	}

	@Override
	public void downloadFilesToDirectory(String bucket, String prefix, Path path){
		scanObjects(bucket, prefix)
				.map(S3Object::key)
				.forEach(key -> downloadFileToDirectory(bucket, key, path));
	}

	@Override
	public Path downloadFileToDirectory(String bucket, String key, Path path){
		Path filePath = path.resolve(key);
		downloadFile(bucket, key, filePath);
		return filePath;
	}

	@Override
	public void downloadFile(String bucket, String key, Path path){
		prepareFileDestination(path);
		S3Client s3Client = getS3ClientForBucket(bucket);
		GetObjectRequest request = makeGetObjectRequest(bucket, key);
		try(var $ = TracerTool.startSpan("S3 getObject", TraceSpanGroupType.CLOUD_STORAGE)){
			GetObjectResponse response = s3Client.getObject(request, ResponseTransformer.toFile(path));
			TracerTool.appendToSpanInfo("Content-Length", response.contentLength());
		}
	}

	@Override
	public void downloadFileWithHeartbeat(String bucket, String key, Path path, Runnable heartbeat){
		prepareFileDestination(path);
		TransferManager transferManager = getTransferManagerForBucket(bucket);
		Download download;
		try(var $ = TracerTool.startSpan("S3 download", TraceSpanGroupType.CLOUD_STORAGE)){
			download = transferManager.download(bucket, key, path.toFile());
			handleTransfer(download, heartbeat);
		}
	}

	@Override
	public Scanner<List<String>> scanBatchesOfLinesWithPrefix(String bucket, String prefix, int batchSize){
		return scanObjects(bucket, prefix)
				.map(S3Object::key)
				.concat(key -> scanBatchesOfLines(bucket, key, batchSize));
	}

	@Override
	public Scanner<String> scanLines(String bucket, String key){
		return ReaderTool.lines(new BufferedReader(new InputStreamReader(getObject(bucket, key))));
	}

	@Override
	public Scanner<List<String>> scanBatchesOfLines(String bucket, String key, int batchSize){
		return scanLines(bucket, key)
				.batch(batchSize);
	}

	@Override
	public ResponseInputStream<GetObjectResponse> getObjectResponse(String bucket, String key){
		S3Client s3Client = getS3ClientForBucket(bucket);
		GetObjectRequest request = makeGetObjectRequest(bucket, key);
		ResponseInputStream<GetObjectResponse> response;
		try(var $ = TracerTool.startSpan("S3 getObject", TraceSpanGroupType.CLOUD_STORAGE)){
			response = s3Client.getObject(request);
			TracerTool.appendToSpanInfo("Content-Length", response.response().contentLength());
		}
		return response;
	}

	@Override
	public InputStream getObject(String bucket, String key){
		return getObjectResponse(bucket, key);
	}

	@Override
	public byte[] getObjectAsBytes(String bucket, String key){
		S3Client s3Client = getS3ClientForBucket(bucket);
		GetObjectRequest request = makeGetObjectRequest(bucket, key);
		ResponseBytes<GetObjectResponse> response;
		try(var $ = TracerTool.startSpan("S3 getObjectAsBytes", TraceSpanGroupType.CLOUD_STORAGE)){
			response = s3Client.getObjectAsBytes(request);
			TracerTool.appendToSpanInfo("Content-Length", response.response().contentLength());
		}
		return response.asByteArray();
	}

	@Override
	public byte[] getPartialObject(String bucket, String key, long offset, int length){
		S3Client s3Client = getS3ClientForBucket(bucket);
		GetObjectRequest request = makeGetPartialObjectRequest(bucket, key, offset, length);
		ResponseBytes<GetObjectResponse> response;
		try(var $ = TracerTool.startSpan("S3 getPartialObject", TraceSpanGroupType.CLOUD_STORAGE)){
			response = s3Client.getObjectAsBytes(request);
			TracerTool.appendToSpanInfo("offset", offset);
			TracerTool.appendToSpanInfo("Content-Length", response.response().contentLength());
		}
		return response.asByteArray();
	}

	@Override
	public String getObjectAsString(String bucket, String key){
		return new String(getObjectAsBytes(bucket, key));
	}

	@Override
	public Optional<Long> length(String bucket, String key){
		return headObject(bucket, key)
				.map(HeadObjectResponse::contentLength);
	}

	@Override
	public Optional<Instant> findLastModified(String bucket, String key){
		return headObject(bucket, key)
				.map(HeadObjectResponse::lastModified);
	}

	@Override
	public Optional<S3Object> findLastModifiedObjectWithPrefix(String bucket, String prefix){
		return scanObjects(bucket, prefix)
				.findMax(Comparator.comparing(S3Object::lastModified));
	}

	@Override
	public URL generateLink(String bucket, String key, Duration expireAfter){
		return s3Presigner.presignGetObject(GetObjectPresignRequest.builder()
					.getObjectRequest(makeGetObjectRequest(bucket, key))
					.signatureDuration(expireAfter)
					.build())
				.url();
	}

	@Override
	public Scanner<List<S3Object>> scanObjectsPaged(String bucket, String prefix){
		var requestBuilder = ListObjectsV2Request.builder()
				.bucket(bucket)
				.prefix(prefix)
				.build();
		var paginator = getS3ClientForBucket(bucket).listObjectsV2Paginator(requestBuilder);
		return Scanner.of(paginator)
				.map(ListObjectsV2Response::contents);
	}

	@Override
	public Scanner<S3Object> scanObjects(String bucket, String prefix, String startAfter, String delimiter){
		var requestBuilder = ListObjectsV2Request.builder()
				.bucket(bucket);
		Optional.ofNullable(prefix).ifPresent(requestBuilder::prefix);
		Optional.ofNullable(startAfter).ifPresent(requestBuilder::startAfter);
		Optional.ofNullable(delimiter).ifPresent(requestBuilder::delimiter);
		var responsePages = getS3ClientForBucket(bucket).listObjectsV2Paginator(requestBuilder.build());
		return Scanner.of(responsePages)
				.concatIter(ListObjectsV2Response::contents);
	}

	@Override
	public Scanner<String> scanPrefixes(String bucket, String prefix, String startAfter, String delimiter){
		var requestBuilder = ListObjectsV2Request.builder()
				.bucket(bucket);
		Optional.ofNullable(prefix).ifPresent(requestBuilder::prefix);
		Optional.ofNullable(startAfter).ifPresent(requestBuilder::startAfter);
		Optional.ofNullable(delimiter).ifPresent(requestBuilder::delimiter);
		var responsePages = getS3ClientForBucket(bucket).listObjectsV2Paginator(requestBuilder.build());
		return Scanner.of(responsePages)
				.concatIter(ListObjectsV2Response::commonPrefixes)
				.map(CommonPrefix::prefix);
	}

	@Override
	public List<String> getCommonPrefixes(String bucket, String prefix, String delimiter){
		S3Client s3Client = getS3ClientForBucket(bucket);
		ListObjectsV2Request request = ListObjectsV2Request.builder()
				.bucket(bucket)
				.prefix(prefix)
				.delimiter(delimiter)
				.build();
		ListObjectsV2Response response;
		try(var $ = TracerTool.startSpan("S3 listObjectsV2", TraceSpanGroupType.CLOUD_STORAGE)){
			response = s3Client.listObjectsV2(request);
			TracerTool.appendToSpanInfo("size", response.contents().size());
		}
		return response
				.commonPrefixes()
				.stream()
				.map(CommonPrefix::prefix)
				.collect(Collectors.toList());
	}

	@Override
	public Scanner<DirectoryDto> scanSubdirectories(String bucket, String prefix, String startAfter, String delimiter,
			int pageSize, boolean currentDirectory){
		ListObjectsV2Request request = ListObjectsV2Request.builder()
				.bucket(bucket)
				.prefix(prefix)
				.startAfter(startAfter)
				.delimiter(delimiter)
				.maxKeys(pageSize)
				.build();
		ListObjectsV2Iterable pages;
		try(var $ = TracerTool.startSpan("S3 listObjectsV2Paginator", TraceSpanGroupType.CLOUD_STORAGE)){
			pages = getS3ClientForBucket(bucket).listObjectsV2Paginator(request);
		}
		return Scanner.of(pages)
				.map(res -> {
					Scanner<DirectoryDto> objects = Scanner.of(res.contents())
							.map(object -> new DirectoryDto(
									object.key(),
									false,
									object.size(),
									object.lastModified(),
									object.storageClass().name()));
					Scanner<DirectoryDto> prefixes = Scanner.of(res.commonPrefixes())
							.map(commonPrefix -> new DirectoryDto(commonPrefix.prefix(), true, 0L, null, null));

					return Scanner.concat(objects, prefixes);
				})
				.concat(Function.identity());
	}

	@Override
	public boolean exists(String bucket, String key){
		return headObject(bucket, key).isPresent();
	}

	@Override
	public boolean existsPrefix(String bucket, String prefix){
		return scanObjects(bucket, prefix).hasAny();
	}

	@Override
	public Region getCachedOrLatestRegionForBucket(String bucket){
		return regionByBucket.computeIfAbsent(bucket, this::getBucketRegion);
	}

	private void putObjectWithAcl(String bucket, String key, ContentType contentType, Path path, ObjectCannedACL acl){
		S3Client s3Client = getS3ClientForBucket(bucket);
		PutObjectRequest request = makePutObjectRequestBuilder(bucket, key, contentType)
				.acl(acl)
				.build();
		RequestBody requestBody = RequestBody.fromFile(path);
		try(var $ = TracerTool.startSpan("S3 putObject", TraceSpanGroupType.CLOUD_STORAGE)){
			s3Client.putObject(request, requestBody);
			TracerTool.appendToSpanInfo("Content-Length", request.contentLength());
		}
	}

	private void handleTransfer(Transfer transfer, Runnable heartbeat){
		TransferProgress progress = transfer.getProgress();
		long totalBytesToTransfer = progress.getTotalBytesToTransfer();
		while(!transfer.isDone()){
			try{
				heartbeat.run();
			}catch(Exception e){
				logger.error("couldn't heartbeat", e);
			}
			logger.warn("{} / {} pct={} bytesTransferred={} totalBytesToTransfer={}", ByteUnitTool
					.byteCountToDisplaySize(progress.getBytesTransferred()), ByteUnitTool.byteCountToDisplaySize(
					totalBytesToTransfer), NumberFormatter.format(progress.getPercentTransferred(), 2), progress
					.getBytesTransferred(), totalBytesToTransfer);
			ThreadTool.sleepUnchecked(1000L);
		}
	}

	private Optional<HeadObjectResponse> headObject(String bucket, String key){
		try{
			S3Client s3Client = getS3ClientForBucket(bucket);
			HeadObjectRequest request = HeadObjectRequest.builder()
					.bucket(bucket)
					.key(key)
					.build();
			HeadObjectResponse response;
			try(var $ = TracerTool.startSpan("S3 headObject", TraceSpanGroupType.CLOUD_STORAGE)){
				response = s3Client.headObject(request);
				TracerTool.appendToSpanInfo("Content-Length", response.contentLength());
			}
			return Optional.of(response);
		}catch(NoSuchKeyException e){
			return Optional.empty();
		}
	}

	private TransferManager getTransferManagerForBucket(String bucket){
		Region region = regionByBucket.computeIfAbsent(bucket, this::getBucketRegion);
		return transferManagerByRegion.computeIfAbsent(region, this::createTransferManager);
	}

	private S3Client getS3ClientForRegion(Region region){
		return s3ClientByRegion.computeIfAbsent(region, this::createClient);
	}

	private S3Client getS3ClientForBucket(String bucket){
		Region region = regionByBucket.computeIfAbsent(bucket, this::getBucketRegion);
		return getS3ClientForRegion(region);
	}

	@Override
	public Region getBucketRegion(String bucket){
		String region;
		S3Client s3Client = s3ClientByRegion.get(DEFAULT_REGION);
		try{
			GetBucketLocationRequest request = GetBucketLocationRequest.builder()
					.bucket(bucket)
					.build();
			GetBucketLocationResponse response;
			try(var $ = TracerTool.startSpan("S3 getBucketLocation", TraceSpanGroupType.CLOUD_STORAGE)){
				response = s3Client.getBucketLocation(request);
			}
			region = response.locationConstraintAsString();
		}catch(NoSuchBucketException e){
			throw new RuntimeException("bucket not found name=" + bucket, e);
		}catch(S3Exception e){
			Matcher matcher = EXPECTED_REGION_EXTRACTOR.matcher(e.getMessage());
			if(matcher.find()){
				region = matcher.group(1);
			}else{
				try{
					HeadBucketRequest request = HeadBucketRequest.builder()
							.bucket(bucket)
							.build();
					HeadBucketResponse response;
					try(var $ = TracerTool.startSpan("S3 headBucket", TraceSpanGroupType.CLOUD_STORAGE)){
						response = s3Client.headBucket(request);
					}
					region = response
							.sdkHttpResponse()
							.firstMatchingHeader(Headers.S3_BUCKET_REGION)
							.get();
				}catch(S3Exception e2){
					region = e2.awsErrorDetails().sdkHttpResponse().firstMatchingHeader(Headers.S3_BUCKET_REGION).get();
				}
			}
		}
		return region.isEmpty() ? DEFAULT_REGION : Region.of(region);
	}

	private S3Client createClient(Region region){
		return S3Client.builder()
				.credentialsProvider(awsCredentialsProviderProvider.get())
				.region(region)
				.httpClientBuilder(ApacheHttpClient.builder().maxConnections(50_000))
				.build();
	}

	private TransferManager createTransferManager(Region region){
		return TransferManagerBuilder.standard()
				.withS3Client(AmazonS3ClientBuilder.standard()
						.withRegion(Regions.fromName(region.id()))
						.withCredentials(new AwsSdkV2ToV1CredentialsProvider(awsCredentialsProviderProvider.get()))
						.build())
				.build();
	}

	private static GetObjectRequest makeGetObjectRequest(String bucket, String key){
		return GetObjectRequest.builder()
				.bucket(bucket)
				.key(key)
				.build();
	}

	private static GetObjectRequest makeGetPartialObjectRequest(String bucket, String key, long offset, int length){
		long startInclusive = offset;
		long endInclusive = offset + length - 1;
		// https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
		// https://github.com/aws/aws-sdk-java-v2/issues/1472
		String range = "bytes=" + startInclusive + "-" + endInclusive;
		return GetObjectRequest.builder()
				.bucket(bucket)
				.key(key)
				.range(range)
				.build();
	}

	private static PutObjectRequest.Builder makePutObjectRequestBuilder(String bucket, String key,
			ContentType contentType){
		return PutObjectRequest.builder()
				.bucket(bucket)
				.key(key)
				.contentType(contentType.getMimeType());
	}

	private static PutObjectRequest makePutObjectRequest(String bucket, String key, ContentType contentType){
		return makePutObjectRequestBuilder(bucket, key, contentType).build();
	}

	private static void prepareFileDestination(Path path){
		try{
			Files.createDirectories(path.getParent());
			Files.deleteIfExists(path);
		}catch(IOException e){
			throw new RuntimeException(e);
		}
	}

}


text:
using System;
using System.Collections.Generic;
using JetBrains.Annotations;

#endregion

namespace Extend
{
    /// <summary>
    ///     Key based equality comparer.
    /// </summary>
    /// <typeparam name="TSource">The type of the objects to test for equality.</typeparam>
    /// <typeparam name="TKey">The type of the key to compare.</typeparam>
    public class KeyEqualityComparer<TSource, TKey> : IEqualityComparer<TSource>
    {
        #region Fields

        /// <summary>
        ///     Stores the key comparer.
        /// </summary>
        private readonly IEqualityComparer<TKey> _comparer;

        /// <summary>
        ///     Stores the key selector.
        /// </summary>
        private readonly Func<TSource, TKey> _keySelector;

        #endregion

        #region Ctor

        /// <summary>
        ///     Creates a new instance of the <see cref="KeyEqualityComparer{TSource, TKey}" /> class.
        /// </summary>
        /// <exception cref="ArgumentNullException">keySelector can not be null.</exception>
        /// <param name="keySelector">The key selector.</param>
        /// <param name="comparer">An optional comparer, used to compare the keys.</param>
        public KeyEqualityComparer( [NotNull] Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer )
        {
            keySelector.ThrowIfNull( nameof(keySelector) );

            _keySelector = keySelector;
            _comparer = comparer ?? EqualityComparer<TKey>.Default;
        }

        #endregion

        #region Implementation of IEqualityComparer<in TSource>

        /// <summary>
        ///     Determines whether the specified objects are equal.
        /// </summary>
        /// <returns>
        ///     true if the specified objects are equal; otherwise, false.
        /// </returns>
        /// <param name="x">The first object of type <typeparamref name="TSource" /> to compare.</param>
        /// <param name="y">The second object of type <typeparamref name="TSource" /> to compare.</param>
        [PublicAPI]
        public Boolean Equals( TSource x, TSource y )
            => _comparer.Equals( _keySelector( x ), _keySelector( y ) );

        /// <summary>
        ///     Returns a hash code for the specified object.
        /// </summary>
        /// <returns>
        ///     A hash code for the specified object.
        /// </returns>
        /// <param name="obj">The <see cref="Object" /> for which a hash code is to be returned.</param>
        /// <exception cref="ArgumentNullException">
        ///     The type of <paramref name="obj" /> is a reference type and
        ///     <paramref name="obj" /> is null.
        /// </exception>
        [PublicAPI]
        public Int32 GetHashCode( TSource obj )
            => _comparer.GetHashCode( _keySelector( obj ) );

        #endregion
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
 <tileset name="SS Anne  Basement" firstgid="1" tilewidth="16" tileheight="16">
<image source="SS Anne  Basement.png" trans="000000"/>
</tileset>


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="images/favicon.png">

    <title>Form Components</title>

    <link href="bs3/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-reset.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet" />

    <link href="js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
    <link href="js/iCheck/skins/minimal/red.css" rel="stylesheet">
    <link href="js/iCheck/skins/minimal/green.css" rel="stylesheet">
    <link href="js/iCheck/skins/minimal/blue.css" rel="stylesheet">
    <link href="js/iCheck/skins/minimal/yellow.css" rel="stylesheet">
    <link href="js/iCheck/skins/minimal/purple.css" rel="stylesheet">

    <link href="js/iCheck/skins/square/square.css" rel="stylesheet">
    <link href="js/iCheck/skins/square/red.css" rel="stylesheet">
    <link href="js/iCheck/skins/square/green.css" rel="stylesheet">
    <link href="js/iCheck/skins/square/blue.css" rel="stylesheet">
    <link href="js/iCheck/skins/square/yellow.css" rel="stylesheet">
    <link href="js/iCheck/skins/square/purple.css" rel="stylesheet">

    <link href="js/iCheck/skins/flat/grey.css" rel="stylesheet">
    <link href="js/iCheck/skins/flat/red.css" rel="stylesheet">
    <link href="js/iCheck/skins/flat/green.css" rel="stylesheet">
    <link href="js/iCheck/skins/flat/blue.css" rel="stylesheet">
    <link href="js/iCheck/skins/flat/yellow.css" rel="stylesheet">
    <link href="js/iCheck/skins/flat/purple.css" rel="stylesheet">

    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet" />

                8

You have 8 pending tasks

Target Sell

25% , Deadline  12 June'13

Product Delivery

45% , Deadline  12 June'13

Payment collection

87% , Deadline  12 June'13

Target Sell

33% , Deadline  12 June'13

                    See All Tasks

                4

You have 4 Mails

                                Jonathan Smith
                                Just now

                                    Hello, this is an example msg.

                                Jane Doe
                                2 min ago

                                    Nice admin template

                                Tasi sam
                                2 days ago

                                    This is an example msg.

                                Mr. Perfect
                                2 hour ago

                                    Hi there, its a test

                    See all messages

                3

Notifications

                             Server #1 overloaded.

                             Server #2 overloaded.

                             Server #3 overloaded.

            <input type="text" class="form-control search" placeholder=" Search">

                John Doe

Profile

 Settings

 Log Out

                    Dashboard

                    Layouts

Boxed Page

Horizontal Menu

Language Switch Bar

                    UI Elements

General

Buttons

Typography

Widget

Slider

Tree View

Nestable

Grids

Calender

Draggable Portlet

                    Fontawesome

                    Data Tables

Basic Table

Responsive Table

Dynamic Table

Editable Table

                    Form Components

Form Elements

Advanced Components

Form Wizard

Form Validation

Muliple File Upload

Dropzone

Inline Editor

                    Mail

Inbox

Compose Mail

View Mail

                    Charts

Morris

Chartjs

Flot Charts

C3 Chart

                    Maps

Google Map

Vector Map

                    Extra

Blank Page

Lock Screen

Profile

Invoice

Pricing Table

Timeline

Media Gallery

404 Error

500 Error

Registration

                    Login Page

                            Basic Forms

                                <form role="form">

                                    Email address
                                    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">

                                    Password
                                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">

                                    File input
                                    <input type="file" id="exampleInputFile">

Example block-level help text here.

                                        <input type="checkbox"> Check me out

                                <button type="submit" class="btn btn-info">Submit</button>
                            </form>

                        Horizontal Forms

                            <form class="form-horizontal" role="form">

                                Email

                                    <input type="email" class="form-control" id="inputEmail1" placeholder="Email">

Example block-level help text here.

                                Password

                                    <input type="password" class="form-control" id="inputPassword1" placeholder="Password">

                                            <input type="checkbox"> Remember me

                                    <button type="submit" class="btn btn-danger">Sign in</button>

                        </form>

                        Inline form

                            <form class="form-inline" role="form">

                                Email address
                                <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email">

                                Password
                                <input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password">

                                    <input type="checkbox"> Remember me

                            <button type="submit" class="btn btn-success">Sign in</button>
                        </form>

                        Modal form

                                    Form in Modal

                                    Form in Modal 2

                                    Form in Modal 3

                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>

Form Tittle

                                        <form role="form">

                                                Email address
                                                <input type="email" class="form-control" id="exampleInputEmail3" placeholder="Enter email">

                                                Password
                                                <input type="password" class="form-control" id="exampleInputPassword3" placeholder="Password">

                                                File input
                                                <input type="file" id="exampleInputFile3">

Example block-level help text here.

                                                    <input type="checkbox"> Check me out

                                            <button type="submit" class="btn btn-default">Submit</button>
                                        </form>

                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>

Form Tittle

                                        <form class="form-horizontal" role="form">

                                                Email

                                                    <input type="email" class="form-control" id="inputEmail4" placeholder="Email">

                                                Password

                                                    <input type="password" class="form-control" id="inputPassword4" placeholder="Password">

                                                            <input type="checkbox"> Remember me

                                                    <button type="submit" class="btn btn-default">Sign in</button>

                                        </form>

                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>

Form Tittle

                                        <form class="form-inline" role="form">

                                                Email address
                                                <input type="email" class="form-control sm-input" id="exampleInputEmail5" placeholder="Enter email">

                                                Password
                                                <input type="password" class="form-control sm-input" id="exampleInputPassword5" placeholder="Password">

                                                    <input type="checkbox"> Remember me

                                            <button type="submit" class="btn btn-default">Sign in</button>
                                        </form>

                Form Elements

                <form class="form-horizontal bucket-form" method="get">

                        Default

                            <input type="text" class="form-control">

                        Help text

                            <input type="text" class="form-control">
                            A block of help text that breaks onto a new line and may extend beyond one line.

                        Rounder

                            <input type="text" class="form-control round-input">

                        Input focus

                            <input class="form-control" id="focusedInput" type="text" value="This is focused...">

                        Disabled

                            <input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>

                        Placeholder

                            <input type="text"  class="form-control" placeholder="placeholder">

                        Password

                            <input type="password"  class="form-control" placeholder="">

                        Static control

email@example.com

                        Input with success

                            <input type="text" class="form-control" id="inputSuccess">

                        Input with warning

                            <input type="text" class="form-control" id="inputWarning">

                        Input with error

                            <input type="text" class="form-control" id="inputError">

                </form>

                <form class="form-horizontal bucket-form" method="get">

                        Control sizing

                            <input class="form-control input-lg m-bot15" type="text" placeholder=".input-lg">
                            <input class="form-control m-bot15" type="text" placeholder="Default input">
                            <input class="form-control input-sm m-bot15" type="text" placeholder=".input-sm">

                            <select class="form-control input-lg m-bot15">
                                <option>Option 1</option>
                                <option>Option 2</option>
                                <option>Option 3</option>
                            </select>
                            <select class="form-control m-bot15">
                                <option>Option 1</option>
                                <option>Option 2</option>
                                <option>Option 3</option>
                            </select>
                            <select class="form-control input-sm m-bot15">
                                <option>Option 1</option>
                                <option>Option 2</option>
                                <option>Option 3</option>
                            </select>

                </form>

                <form class="form-horizontal bucket-form" method="get">

                        Checkboxes and radios

                                    <input type="checkbox" value="">
                                    Option one is this and that—be sure to include why it's great

                                    <input type="checkbox" value="">
                                    Option one is this and that—be sure to include why it's great option one

                                    <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
                                    Option one is this and that—be sure to include why it's great

                                    <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
                                    Option two can be something else and selecting it will deselect option one

                        Inline checkboxes

                                <input type="checkbox" id="inlineCheckbox1" value="option1"> 1

                                <input type="checkbox" id="inlineCheckbox2" value="option2"> 2

                                <input type="checkbox" id="inlineCheckbox3" value="option3"> 3

                        Selects

                            <select class="form-control m-bot15">
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                                <option>5</option>
                            </select>

                            <select multiple class="form-control">
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                                <option>5</option>
                            </select>

                        Column sizing

                                    <input type="text" class="form-control" placeholder=".col-lg-2">

                                    <input type="text" class="form-control" placeholder=".col-lg-3">

                                    <input type="text" class="form-control" placeholder=".col-lg-4">

                </form>

                Input groups

                <form class="form-horizontal bucket-form" method="get">

                        Basic examples

                                @
                                <input type="text" class="form-control" placeholder="Username">

                                <input type="text" class="form-control">
                                .00

                                $
                                <input type="text" class="form-control">
                                .00

                        Sizing

                                @
                                <input type="text" class="form-control input-lg" placeholder="Username">

                                @
                                <input type="text" class="form-control" placeholder="Username">

                                @
                                <input type="text" class="form-control" placeholder="Username">

                        Iconic

                                <input type="text" class="form-control" placeholder="Username">

                                <input type="text" class="form-control" placeholder="Email">

                        Checkboxe and radio

                                                <input type="checkbox">

                                <input type="text" class="form-control">

                                                <input type="radio">

                                <input type="text" class="form-control">

                        Button addons

                                                <button class="btn btn-danger" type="button">Go!</button>

                                <input type="text" class="form-control">

                                <input type="text" class="form-control">

                                                <button class="btn btn-success" type="button">Go!</button>

                                    <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">Action </button>

Action

Another action

Something else here

Separated link

                                <input type="text" class="form-control">

                                <input type="text" class="form-control">

                                    <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">Action </button>

Action

Another action

Something else here

Separated link

                        Segmented buttons

                                    <button tabindex="-1" class="btn btn-info" type="button">Action</button>
                                    <button tabindex="-1" data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">

                                    </button>

Action

Another action

Something else here

Separated link

                                <input type="text" class="form-control">

                                <input type="text" class="form-control">

                                    <button tabindex="-1" class="btn btn-info" type="button">Action</button>
                                    <button tabindex="-1" data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">

                                    </button>

Action

Another action

Something else here

Separated link

                </form>

                        Custom Checkbox & Radio

                                <form class="form-horizontal bucket-form" method="get">

                                        Checkboxes

                                                <input type="checkbox" checked="" >
                                                Checkbox 1

                                                <input type="checkbox" checked="" >
                                                Checkbox 2

                                                <input type="checkbox" checked="" >
                                                Checkbox 3

                                                <input type="checkbox" disabled="" checked="" >
                                                Disabled

                                                <input type="checkbox" disabled="" checked="" id="">
                                                Checked & Disabled

                                </form>

                                <form class="form-horizontal bucket-form" method="get">

                                        Radio

                                                <input tabindex="3" type="radio"  name="demo-radio">
                                                Checkbox 1

                                                <input tabindex="3" type="radio"  name="demo-radio">
                                                Checkbox 2

                                                <input tabindex="3" type="radio"  name="demo-radio">
                                                Checkbox 3

                                                <input type="radio" disabled="" >
                                                Disabled

                                                <input type="radio" disabled="" checked="">
                                                Checked & Disabled

                                </form>

                      Different Color Custom Checkbox & Radio

                                <form class="form-horizontal bucket-form" method="get">

                                        Checkboxes

                                                    <input type="checkbox" >
                                                    Black Checkbox

                                                    <input type="checkbox" >
                                                    Red Checkbox

                                                    <input type="checkbox" >
                                                    Green Checkbox

                                                    <input type="checkbox" >
                                                    Blue Checkbox

                                                    <input type="checkbox" >
                                                    Yellow Checkbox

                                                    <input type="checkbox" >
                                                    Purple Checkbox

                                </form>

                                <form class="form-horizontal bucket-form" method="get">

                                        Checkboxes

                                                    <input type="checkbox" >
                                                    Black Checkbox

                                                    <input type="checkbox" >
                                                    Red Checkbox

                                                    <input type="checkbox" >
                                                    Green Checkbox

                                                    <input type="checkbox" >
                                                    Blue Checkbox

                                                    <input type="checkbox" >
                                                    Yellow Checkbox

                                                    <input type="checkbox" >
                                                    Purple Checkbox

                                </form>

                                <form class="form-horizontal bucket-form" method="get">

                                        Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Black Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Red Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Green Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Blue Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Yellow Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Purple Radio

                                </form>

                                <form class="form-horizontal bucket-form" method="get">

                                        Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Black Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Red Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Green Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Blue Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Yellow Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Purple Radio

                                </form>

                        flat checkbox & radio

                                <form class="form-horizontal bucket-form" method="get">

                                        Radio

                                                    <input type="checkbox">
                                                    Black Checkbox

                                                    <input type="checkbox">
                                                    Red Checkbox

                                                    <input type="checkbox">
                                                    Green Checkbox

                                                    <input type="checkbox">
                                                    Blue Checkbox

                                                    <input type="checkbox">
                                                    Yellow Checkbox

                                                    <input type="checkbox">
                                                    Purple Checkbox

                                </form>

                                <form class="form-horizontal bucket-form" method="get">

                                        Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Black Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Red Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Green Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Blue Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Yellow Radio

                                                    <input tabindex="3" type="radio"  name="demo-radio">
                                                    Purple Radio

                                </form>

                        Textarea

                        <form class="form-horizontal bucket-form" method="get">

                                Textarea label

                                    <textarea class="form-control" rows="6"></textarea>

                        </form>

                        CKEditor

                            <form action="#" class="form-horizontal">

                                    CKEditor

                                        <textarea class="form-control ckeditor" name="editor1" rows="6"></textarea>

                            </form>

                            Input Grid

                                <input type="text" placeholder=".col-md-12" class="form-control">

                                <input type="text" placeholder=".col-md-6" class="form-control">

                                <input type="text" placeholder=".col-md-6" class="form-control">

                                <input type="text" placeholder=".col-md-4" class="form-control">

                                <input type="text" placeholder=".col-md-4" class="form-control">

                                <input type="text" placeholder=".col-md-4" class="form-control">

                                <input type="text" placeholder=".col-md-3" class="form-control">

                                <input type="text" placeholder=".col-md-3" class="form-control">

                                <input type="text" placeholder=".col-md-3" class="form-control">

                                <input type="text" placeholder=".col-md-3" class="form-control">

                                <input type="text" placeholder=".col-md-2" class="form-control">

                                <input type="text" placeholder=".col-md-2" class="form-control">

                                <input type="text" placeholder=".col-md-2" class="form-control">

                                <input type="text" placeholder=".col-md-2" class="form-control">

                                <input type="text" placeholder=".col-md-2" class="form-control">

                                <input type="text" placeholder=".col-md-2" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

                                <input type="text" placeholder=".col-md-1" class="form-control">

    <input type="text" placeholder="Search" class="form-control">

        work progress (5)

Target sell

                        25%, Deadline 12 june 13

product delivery

                        55%, Deadline 12 june 13

payment collection

                        25%, Deadline 12 june 13

delivery pending

                        44%, Deadline 12 june 13

total progress

                        50%, Deadline 12 june 13

                            50% Complete

        contact online (5)

Jonathan Smith

                        Work for fun

Anjelina Joe

                        Available

John Doe

                        Away from Desk

Mark Henry

                        working

Shila Jones

                        Work for fun

                View all Contacts

         recent activity (3)

                        just now

                        Jim Doe Purchased new equipments for zonal office setup

                        2 min ago

                        Jane Doe Purchased new equipments for zonal office setup

                        1 day ago

                        Jim Doe Purchased new equipments for zonal office setup

         shipment status

                        Full sleeve baby wear (SL: 17665)

                            40% Complete

                        Full sleeve baby wear (SL: 17665)

                            70% Completed


text:
 package de.k3b.geo.io.gpx;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.xml.sax.InputSource;

import de.k3b.geo.api.GeoPointDto;
import de.k3b.geo.api.IGeoInfoHandler;
import de.k3b.geo.api.IGeoPointInfo;

/**
 * Class to read {@link List} of {@link de.k3b.geo.api.IGeoPointInfo} points from gpx/kml/xml/... file or stream.
 *
 * ![GpxReader-getTracks](GpxReader-getTracks.png)
 **
 * ```java
 * GpxReader<IGeoPointInfo> parser = new GpxReader<IGeoPointInfo>();
 * List<IGeoPointInfo> points = parser.getTracks(new InputSource(new FileReader( "test.gpx")));
 * for (IGeoPointInfo geo : points) {
 *    System.out.print(String.format("got lat=%f lon=%f\n", geo.getLatitude(),geo.getLongitude()));
 * }
 * ```
 *
 *
 * Supported formats:
 *
 * * [gpx-1.0](https://github.com/k3b/androFotoFinder/wiki/data#gpx10) and [gpx-1.1](https://github.com/k3b/androFotoFinder/wiki/data#gpx) files
 * * [kml-2.2](https://github.com/k3b/androFotoFinder/wiki/data#kml) files used by google
 * * [wikimedia](https://github.com/k3b/androFotoFinder/wiki/data#wikimedia) that is used by web-apis of wikipedia and wikivoyage
 * * [poi](https://github.com/k3b/androFotoFinder/wiki/data#poi) files, k3b-s internal xml format
 *
 * Inspired by http://stackoverflow.com/questions/672454/how-to-parse-gpx-files-with-saxreader
 */
public class GpxReader<T extends IGeoPointInfo> extends GpxReaderBase implements IGeoInfoHandler {
    /** Used to collect the reived points */
    private List<T> track;

    /**
     * Creates a new GpxReader.
     *
     * @since 1.1.5
     */
    public GpxReader() {
        this(new GeoPointDto());
    }
    /**
     * Creates a new GpxReader.
     *
     * @param reuse if not null this instance is cleared and then reused for every new gpx found. This way the reader can load different implementations of {@link de.k3b.geo.api.IGeoPointInfo}
     */
    public GpxReader(final GeoPointDto reuse) {
        super(null,reuse);
        this.onGotNewWaypoint = this; // cannot do this in constructor
    }

    /**
     * Call the parser and return the points contained in the stream
     *
     * ![GpxReader-getTracks](GpxReader-getTracks.png)
     *
     * @startuml GpxReader-getTracks.png
     * title Read gpx/kml/poi/xml data to List
     * interface List
     * interface IGeoPointInfo
     *
     * class GpxReader
     * GpxReader : getTracks
     *
     * GpxReader -> List
     * List *-- IGeoPointInfo
     * InputSource -> GpxReader : "file:points.gpx"
     * InputSource -> GpxReader : "file:points.kml"
     * InputSource -> GpxReader : "file:points.poi"
     * InputSource -> GpxReader : "https://de.wikivoyage.org/w/api.php?..."
     * @enduml
     *
     */
    public List<T> getTracks(InputSource in) throws IOException {
        track = new ArrayList<T>();
        parse(in);
        return track;
    }

    /** Is called for every completed gpx-trackpoint to collect the received tracks. */
    @Override
    public boolean onGeoInfo(IGeoPointInfo geoInfo) {
        if (mReuse != null) {
            track.add((T) mReuse.clone());
        } else {
            track.add((T) this.currentGeoPoint);
        }
        return true;
    }
}