text:
<?php

declare(strict_types=1);

namespace Sylius\Component\Resource\Annotation;

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
final class SyliusCrudRoutes
{
    public ?string $alias = null;

    public ?string $path = null;

    public ?string $identifier = null;

    public ?array $criteria = null;

    public ?bool $filterable = null;

    public ?string $form = null;

    public ?string $serializationVersion = null;

    public ?string $section = null;

    public ?string $redirect = null;

    public ?string $templates = null;

    public ?string $grid = null;

    public ?bool $permission = null;

    public ?array $except = null;

    public ?array $only = null;

    public ?array $vars = null;

    public function __construct(
        ?string $alias = null,
        ?string $path = null,
        ?string $identifier = null,
        ?array $criteria = null,
        ?bool $filterable = null,
        ?string $form = null,
        ?string $serializationVersion = null,
        ?string $section = null,
        ?string $redirect = null,
        ?string $templates = null,
        ?string $grid = null,
        ?bool $permission = null,
        ?array $except = null,
        ?array $only = null,
        ?array $vars = null
    ) {
        $this->alias = $alias;
        $this->path = $path;
        $this->identifier = $identifier;
        $this->criteria = $criteria;
        $this->filterable = $filterable;
        $this->form = $form;
        $this->serializationVersion = $serializationVersion;
        $this->section = $section;
        $this->redirect = $redirect;
        $this->templates = $templates;
        $this->grid = $grid;
        $this->permission = $permission;
        $this->except = $except;
        $this->only = $only;
        $this->vars = $vars;
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace Nancy.Template.WebService.Entities
{
    public class Host
    {
        public string Description { get; set; }
        public string Url { get; set; }
    }
}


text:
package com.mattunderscore.tcproxy.io.socket;

/**
 * An outbound {@link IOSocketChannel}.
 * @author Matt Champion on 05/12/2015
 */
public interface IOOutboundSocketChannel extends IOSocketChannel, IOOutboundSocket, IOConnectableSocket {
}


text:
package org.apache.poi.xslf;

import org.apache.poi.POIDataSamples;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xslf.usermodel.XMLSlideShow;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @author Yegor Kozlov
 */
public class XSLFTestDataSamples {

    public static XMLSlideShow openSampleDocument(String sampleName) {
        InputStream is = POIDataSamples.getSlideShowInstance().openResourceAsStream(sampleName);
        try {
            return new XMLSlideShow(OPCPackage.open(is));
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static XMLSlideShow writeOutAndReadBack(XMLSlideShow doc) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
        try {
            doc.write(baos);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        InputStream bais;
        bais = new ByteArrayInputStream(baos.toByteArray());
        try {
            return new XMLSlideShow(OPCPackage.open(bais));
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            try {
                baos.close();
                bais.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }
}


text:
/* audience.go
 */

package main

import (
	"encoding/json"
	"io"
	"net"
	o "orchestra"
	"os"
	"path"
	"syscall"
)

type GenericJsonRequest struct {
	Op      *string           `json:"op"`
	Score   *string           `json:"score"`
	Players []string          `json:"players"`
	Scope   *JobScope         `json:"scope"`
	Params  map[string]string `json:"params"`
	Id      *uint64           `json:"id"`
}

type JsonPlayerStatus struct {
	Status   ResponseState     `json:"status"`
	Response map[string]string `json:"response"`
}

type JsonStatusResponse struct {
	Status  JobState                     `json:"status"`
	Players map[string]*JsonPlayerStatus `json:"players"`
}

func NewJsonStatusResponse() (jsr *JsonStatusResponse) {
	jsr = new(JsonStatusResponse)
	jsr.Players = make(map[string]*JsonPlayerStatus)

	return jsr
}

func NewJsonPlayerStatus() (jps *JsonPlayerStatus) {
	jps = new(JsonPlayerStatus)
	jps.Response = make(map[string]string)

	return jps
}

func handleAudienceRequest(c net.Conn) {
	defer c.Close()

	r, _ := c.(io.Reader)
	w, _ := c.(io.Writer)
	dec := json.NewDecoder(r)
	enc := json.NewEncoder(w)

	outobj := new(GenericJsonRequest)
	err := dec.Decode(outobj)
	if err != nil {
		o.Warn("Error decoding JSON request from audience: %s", err)
		return
	}

	if nil == outobj.Op {
		o.Warn("Malformed JSON request from audience: missing op")
		return
	}
	switch *(outobj.Op) {
	case "status":
		if nil == outobj.Id {
			o.Warn("Malformed status request from audience: missing job ID")
			return
		}
		job := JobGet(*outobj.Id)
		jresp := new([2]interface{})
		if nil != job {
			jresp[0] = "OK"
			iresp := NewJsonStatusResponse()
			iresp.Status = job.State
			resnames := JobGetResultNames(*outobj.Id)
			for i := range resnames {
				tr := JobGetResult(*outobj.Id, resnames[i])
				if nil != tr {
					presp := NewJsonPlayerStatus()
					presp.Status = tr.State
					for k, v := range tr.Response {
						presp.Response[k] = v
					}
					iresp.Players[resnames[i]] = presp
				}
			}
			jresp[1] = iresp
		} else {
			jresp[0] = "Error"
			jresp[1] = nil
		}
		enc.Encode(jresp)
	case "queue":
		if nil == outobj.Score {
			o.Warn("Malformed queue request from audience: missing score")
			sendQueueFailureResponse("Missing Score", enc)
			return
		}
		if nil == outobj.Scope {
			o.Warn("Malformed queue request from audience: missing scope")
			sendQueueFailureResponse("Missing Scope", enc)
			return
		}
		if nil == outobj.Players || len(outobj.Players) < 1 {
			o.Warn("Malformed queue request from audience: missing players")
			sendQueueFailureResponse("Missing Players", enc)
			return
		}
		for _, player := range outobj.Players {
			if !HostAuthorised(player) {
				o.Warn("Malformed queue request from audience: unknown player %s specified", player)
				sendQueueFailureResponse("Invalid Player", enc)
				return
			}
		}
		job := NewRequest()
		job.Score = *outobj.Score
		job.Scope = *outobj.Scope
		job.Players = outobj.Players
		job.Params = outobj.Params

		QueueJob(job)
		sendQueueSuccessResponse(job, enc)
	default:
		o.Warn("Unknown operation in request from audience: %s", *(outobj.Op))
		return
	}

	_ = enc
}

func sendQueueSuccessResponse(job *JobRequest, enc *json.Encoder) {
	resp := make([]interface{}, 2)
	resperr := new(string)
	*resperr = "OK"
	resp[0] = resperr

	// this probably looks odd, but all numbers cross through float64 when being json encoded.  d'oh!
	jobid := new(uint64)
	*jobid = uint64(job.Id)
	resp[1] = jobid

	err := enc.Encode(resp)
	if nil != err {
		o.Warn("Couldn't encode response to audience: %s", err)
	}
}

func sendQueueFailureResponse(reason string, enc *json.Encoder) {
	resp := make([]interface{}, 2)
	resperr := new(string)
	*resperr = "Error"
	resp[0] = resperr
	if reason != "" {
		resp[1] = &reason
	}
	err := enc.Encode(resp)
	if nil != err {
		o.Warn("Couldn't encode response to audience: %s", err)
	}
}

func AudienceListener(l net.Listener) {
	for {
		c, err := l.Accept()
		if err != nil {
			o.Warn("Accept() failed on Audience listener")
			break
		}
		go handleAudienceRequest(c)
	}
}

func UnixAudienceListener(sockaddr string, sockmode os.FileMode, sockuid int, sockgid int) {
	fi, err := os.Stat(sockaddr)
	if err == nil {
		if (fi.Mode() & os.ModeSocket) != 0 {
			os.Remove(sockaddr)
		} else {
			o.Fail("%s exists and is not a socket", sockaddr)
		}
	}
	err = os.MkdirAll(path.Dir(sockaddr), 0755)
	o.MightFail(err, "Couldn't create socket directory")
	laddr, err := net.ResolveUnixAddr("unix", sockaddr)
	o.MightFail(err, "Couldn't resolve audience socket address")
	old_umask := syscall.Umask(0777)
	defer syscall.Umask(old_umask)
	l, err := net.ListenUnix("unix", laddr)
	o.MightFail(err, "Couldn't start audience unixsock listener")
	if sockuid >= 0 || sockgid >= 0 {
		err = os.Chown(sockaddr, sockuid, sockgid)
		o.MightFail(err, "Couldn't chown audience unixsock listener")
	}
	err = os.Chmod(sockaddr, sockmode)
	o.MightFail(err, "Couldn't chmod audience unixsock listener")

	// make sure we clean up the unix socket when we die.
	defer l.Close()
	defer os.Remove(sockaddr)
	AudienceListener(l)
}

func StartAudienceSock() {
	audienceSockPath := GetStringOpt("audience socket path")
	audienceSockMode := GetModeOpt("audience socket mode")
	audienceSockUID := GetIntOpt("audience socket uid")
	audienceSockGID := GetIntOpt("audience socket gid")

	go UnixAudienceListener(audienceSockPath, audienceSockMode, audienceSockUID, audienceSockGID)
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Opuntia whipplei Engelm. & Bigelow

### Remarks
null


text:
![npm](https://badge.fury.io/js/project-mouse2.svg)
![dep](https://david-dm.org/geisslercom/project-mouse2.svg)
[![Build Status](https://travis-ci.org/geisslercom/project-mouse2.svg?branch=master)](https://travis-ci.org/geisslercom/project-mouse2)

A desktop tool to overview your project folders.

## Default View
![Pic1](http://i.imgur.com/hNUtMOD.png)

## with Git Notification-Badge (Dirty-Projectfolder)
![Pic1](http://i.imgur.com/QgDWEI7.png)

## Dev

```
$ npm install && bower install
```

### Run

```
$ electron .
```

### Build

```
$ npm run build
```

Builds the app for OS X, Linux, and Windows, using [electron-packager](https://github.com/maxogden/electron-packager).

## License

MIT © [Benjamin Geissler](http://geissler-com.de)


text:
namespace base {
class FilePath;
}

namespace sessions {

// Adds the ability to snapshot the current session file. The snapshot is
// referred to as 'last'
class SESSIONS_EXPORT SnapshottingCommandStorageBackend
    : public CommandStorageBackend {
 public:
  // Creates a CommandStorageBackend. This method is invoked on the MAIN thread,
  // and does no IO. The real work is done from Init, which is invoked on
  // a background task runer.
  //
  // |path_to_dir| gives the path the files are written two, and |type|
  // indicates which service is using this backend. |type| is used to determine
  // the name of the files to use as well as for logging.
  SnapshottingCommandStorageBackend(
      scoped_refptr<base::SequencedTaskRunner> owning_task_runner,
      SnapshottingCommandStorageManager::SessionType type,
      const base::FilePath& path_to_dir);

  SnapshottingCommandStorageBackend(const SnapshottingCommandStorageBackend&) =
      delete;
  SnapshottingCommandStorageBackend& operator=(
      const SnapshottingCommandStorageBackend&) = delete;

  // Runs |callback| with commands from the last session file.
  void ReadLastSessionCommands(
      const base::CancelableTaskTracker::IsCanceledCallback& is_canceled,
      GetCommandsCallback callback);

  // Deletes the file containing the commands for the last session.
  void DeleteLastSession();

  // Moves the current session file to the last session file. This is typically
  // called during startup or if the user launches the app and no tabbed
  // browsers are running.
  void MoveCurrentSessionToLastSession();

 protected:
  void DoInit() override;

 private:
  friend class base::RefCountedDeleteOnSequence<
      SnapshottingCommandStorageBackend>;
  friend class base::DeleteHelper<SnapshottingCommandStorageBackend>;

  ~SnapshottingCommandStorageBackend() override;

  // Directory files are relative to.
  const base::FilePath last_file_path_;

  // Whether the previous target file is valid.
  bool last_session_valid_ = false;
};

}  // namespace sessions

#endif  // COMPONENTS_SESSIONS_CORE_SNAPSHOTTING_COMMAND_STORAGE_BACKEND_H_


text:
package com.yuzhouwan.bigdata.zookeeper.zxid;

import org.apache.zookeeper.client.StaticHostProvider;
import org.junit.Test;

import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Random;

import static org.apache.zookeeper.server.util.ZxidUtils.makeZxid;

public class ZxidUtilTest {

    @Test
    public void normal() {
        System.out.println(makeZxid(0, 0));        // 0
        System.out.println(makeZxid(0, 1));        // 1
        System.out.println(makeZxid(1, 0) == Math.pow(2, 32));        // true
        System.out.println(makeZxid(1, 1) == Math.pow(2, 32) + 1);    // true

        System.out.println(makeZxid(0, 0) >> 32L);    // 0
        System.out.println(makeZxid(0, 1) >> 32L);    // 1
        System.out.println(makeZxid(1, 0) >> 32L);    // 0
        System.out.println(makeZxid(1, 1) >> 32L);    // 1

        System.out.println(0xffffffffL == Math.pow(2, 32) - 1);    // true (2^31 + 2^30 + ... + 2^0)
        System.out.println(makeZxid(0, 0) & 0xffffffffL);          // 0
        System.out.println(makeZxid(0, 1) & 0xffffffffL);          // 1
        System.out.println(makeZxid(1, 0) & 0xffffffffL);          // 0
        System.out.println(makeZxid(1, 1) & 0xffffffffL);          // 1
        System.out.println((makeZxid(1, 1) & 0xffffffffL) == (makeZxid(1, 1) & 0x00000000ffffffffL));  // true

        char[] chars = Long.toBinaryString(Long.valueOf("FFFFFFFF", 16)).toCharArray();
        long counter = 0L;
        for (int i = 0; i < chars.length; i++) {
            counter += chars[i] == '1' ? (long) Math.pow(2, i) : 0;
        }
        System.out.println(0xffffffffL == counter);     // true
    }

    @Test
    public void concurrent() {
        long zxid;
        System.out.println(zxid = ((1L << 40L) | (2L & 0xffffffffffL)));  // 1099511627778
        System.out.println((zxid >> 40L) == 1);                     // true
        System.out.println((zxid & 0xffffffffffL) == 2);            // true

        System.out.println(zxid = ((1L << 40L) | (2L & 0xffffffffffL)));  // 1099511627778
        System.out.println((zxid >> 40L) == 1);                     // true
        System.out.println(zxid = (((zxid >> 40L) + 2) << 40L));    // 3298534883328
        System.out.println((zxid >> 40L) == 3);                     // true
        System.out.println((zxid & 0xffffffffffL) == 0);            // true
    }

    @Test
    public void initZxid() {
        long zxid = ((1L << 40L) | (2L & 0xffffffffffL));
        System.out.println((zxid & 0xffffff0000000000L));
        System.out.println(((zxid & 0xffffff0000000000L) >> 40L));                  // 1
        System.out.println(((zxid & 0xffffff0000000000L) & 0xffffffffffL));         // 0
        System.out.println((zxid & 0x000000ffffffffffL));
        System.out.println(((zxid & 0x000000ffffffffffL) >> 40L));                  // 0
        System.out.println(((zxid & 0x000000ffffffffffL) & 0xffffffffffL));         // 2
        System.out.println(((zxid & 0xffffff0000000000L) | zxid));
        System.out.println(((zxid & 0xffffff0000000000L) | zxid) >> 40L);           // 1
        System.out.println(((zxid & 0xffffff0000000000L) | zxid) & 0xffffffffffL);  // 2
    }

    @Test
    public void testShuffle() throws Exception {
        LinkedList<InetSocketAddress> inetSocketAddressesList = new LinkedList<>();
        inetSocketAddressesList.add(new InetSocketAddress(0));
        inetSocketAddressesList.add(new InetSocketAddress(1));
        inetSocketAddressesList.add(new InetSocketAddress(2));
        /*
        1442045361
        currentTime: 1499253530044, currentTime ^ hashCode: 1500143845389, Result: 1 2 0
        currentTime: 1499253530044, currentTime ^ hashCode: 1500143845389, Result: 2 0 1
        currentTime: 1499253530045, currentTime ^ hashCode: 1500143845388, Result: 0 1 2
        currentTime: 1499253530045, currentTime ^ hashCode: 1500143845388, Result: 1 2 0
        currentTime: 1499253530046, currentTime ^ hashCode: 1500143845391, Result: 1 2 0
        currentTime: 1499253530046, currentTime ^ hashCode: 1500143845391, Result: 1 2 0
        currentTime: 1499253530046, currentTime ^ hashCode: 1500143845391, Result: 1 2 0
        currentTime: 1499253530046, currentTime ^ hashCode: 1500143845391, Result: 1 2 0
        currentTime: 1499253530047, currentTime ^ hashCode: 1500143845390, Result: 1 2 0
        currentTime: 1499253530047, currentTime ^ hashCode: 1500143845390, Result: 1 2 0
         */
        internalShuffleMillis(inetSocketAddressesList);
        /*
        146611050
        currentTime: 22618159623770, currentTime ^ hashCode: 22618302559536, Result: 2 1 0
        currentTime: 22618159800738, currentTime ^ hashCode: 22618302085832, Result: 0 1 2
        currentTime: 22618159967442, currentTime ^ hashCode: 22618302248888, Result: 1 0 2
        currentTime: 22618160135080, currentTime ^ hashCode: 22618302013634, Result: 2 1 0
        currentTime: 22618160302095, currentTime ^ hashCode: 22618301535077, Result: 2 1 0
        currentTime: 22618160490260, currentTime ^ hashCode: 22618301725822, Result: 1 0 2
        currentTime: 22618161566373, currentTime ^ hashCode: 22618300303823, Result: 1 0 2
        currentTime: 22618161745518, currentTime ^ hashCode: 22618300355844, Result: 2 1 0
        currentTime: 22618161910357, currentTime ^ hashCode: 22618291603775, Result: 2 1 0
        currentTime: 22618162079549, currentTime ^ hashCode: 22618291387479, Result: 0 1 2
         */
        internalShuffleNano(inetSocketAddressesList);

        inetSocketAddressesList.clear();
        inetSocketAddressesList.add(new InetSocketAddress(0));
        inetSocketAddressesList.add(new InetSocketAddress(1));

        /*
        415138788
        currentTime: 1499253530050, currentTime ^ hashCode: 1499124456998, Result: 0 1
        currentTime: 1499253530050, currentTime ^ hashCode: 1499124456998, Result: 0 1
        currentTime: 1499253530050, currentTime ^ hashCode: 1499124456998, Result: 0 1
        currentTime: 1499253530050, currentTime ^ hashCode: 1499124456998, Result: 0 1
        currentTime: 1499253530050, currentTime ^ hashCode: 1499124456998, Result: 0 1
        currentTime: 1499253530050, currentTime ^ hashCode: 1499124456998, Result: 0 1
        currentTime: 1499253530053, currentTime ^ hashCode: 1499124456993, Result: 0 1
        currentTime: 1499253530055, currentTime ^ hashCode: 1499124456995, Result: 0 1
        currentTime: 1499253530055, currentTime ^ hashCode: 1499124456995, Result: 0 1
        currentTime: 1499253530055, currentTime ^ hashCode: 1499124456995, Result: 0 1
         */
        internalShuffleMillis(inetSocketAddressesList);
        /*
        13326370
        currentTime: 22618168292396, currentTime ^ hashCode: 22618156149774, Result: 1 0
        currentTime: 22618168416181, currentTime ^ hashCode: 22618156535703, Result: 1 0
        currentTime: 22618168534056, currentTime ^ hashCode: 22618156432394, Result: 0 1
        currentTime: 22618168666548, currentTime ^ hashCode: 22618155774358, Result: 0 1
        currentTime: 22618168818946, currentTime ^ hashCode: 22618155623712, Result: 0 1
        currentTime: 22618168936821, currentTime ^ hashCode: 22618156011863, Result: 1 0
        currentTime: 22618169056251, currentTime ^ hashCode: 22618155893721, Result: 1 0
        currentTime: 22618169611103, currentTime ^ hashCode: 22618157370237, Result: 1 0
        currentTime: 22618169744528, currentTime ^ hashCode: 22618156713138, Result: 1 0
        currentTime: 22618171273170, currentTime ^ hashCode: 22618184562672, Result: 1 0
         */
        internalShuffleNano(inetSocketAddressesList);
    }

    private void internalShuffleMillis(LinkedList<InetSocketAddress> inetSocketAddressesList) throws Exception {
        int hashCode = new StaticHostProvider(inetSocketAddressesList).hashCode();
        System.out.println(hashCode);
        int count = 10;
        Random r;
        while (count > 0) {
            long currentTime = System.currentTimeMillis();
            r = new Random(currentTime ^ hashCode);
            System.out.print(String.format("currentTime: %s, currentTime ^ hashCode: %s, Result: ",
                    currentTime, currentTime ^ hashCode));
            Collections.shuffle(inetSocketAddressesList, r);
            for (InetSocketAddress inetSocketAddress : inetSocketAddressesList) {
                System.out.print(String.format("%s ", inetSocketAddress.getPort()));
            }
            System.out.println();
            count--;
        }
    }

    private void internalShuffleNano(LinkedList<InetSocketAddress> inetSocketAddressesList) throws Exception {
        int hashCode = new StaticHostProvider(inetSocketAddressesList).hashCode();
        System.out.println(hashCode);
        int count = 10;
        Random r;
        while (count > 0) {
            long currentTime = System.nanoTime();
            r = new Random(currentTime ^ hashCode);
            System.out.print(String.format("currentTime: %s, currentTime ^ hashCode: %s, Result: ",
                    currentTime, currentTime ^ hashCode));
            Collections.shuffle(inetSocketAddressesList, r);
            for (InetSocketAddress inetSocketAddress : inetSocketAddressesList) {
                System.out.print(String.format("%s ", inetSocketAddress.getPort()));
            }
            System.out.println();
            count--;
        }
    }
}


text:
import proto  # type: ignore

__protobuf__ = proto.module(
    package="google.ads.googleads.v10.errors",
    marshal="google.ads.googleads.v10",
    manifest={
        "KeywordPlanAdGroupKeywordErrorEnum",
    },
)

class KeywordPlanAdGroupKeywordErrorEnum(proto.Message):
    r"""Container for enum describing possible errors from applying
    an ad group keyword or a campaign keyword from a keyword plan.

    """

    class KeywordPlanAdGroupKeywordError(proto.Enum):
        r"""Enum describing possible errors from applying a keyword plan
        ad group keyword or keyword plan campaign keyword.
        """
        UNSPECIFIED = 0
        UNKNOWN = 1
        INVALID_KEYWORD_MATCH_TYPE = 2
        DUPLICATE_KEYWORD = 3
        KEYWORD_TEXT_TOO_LONG = 4
        KEYWORD_HAS_INVALID_CHARS = 5
        KEYWORD_HAS_TOO_MANY_WORDS = 6
        INVALID_KEYWORD_TEXT = 7
        NEGATIVE_KEYWORD_HAS_CPC_BID = 8
        NEW_BMM_KEYWORDS_NOT_ALLOWED = 9

__all__ = tuple(sorted(__protobuf__.manifest))


text:
//
//  TodayViewController.m
//  DPToday
//
//  Created by 土老帽 on 16/4/27.
//  Copyright © 2016年 DPRuin. All rights reserved.
//

#import "TodayViewController.h"
#import <NotificationCenter/NotificationCenter.h>
#import "DPTimerView.h"
//#import "PureLayout.h"
#import "DPConst.h"

#define TimerViewWH 100.0

@interface TodayViewController () <NCWidgetProviding>

@property (nonatomic, strong) NSDate *endDate;
@property (nonatomic, strong) NSTimer *timer;
@property (nonatomic, assign) NSInteger maxValue;
//@property (nonatomic, weak) DPTimerView *timerView;
//@property (nonatomic, weak) UIButton *button;
@property (weak, nonatomic) IBOutlet UIButton *button;

@property (weak, nonatomic) IBOutlet DPTimerView *timerView;

@end

@implementation TodayViewController

- (void)viewDidLoad {
    [super viewDidLoad];

//    DPTimerView *timerView = [[DPTimerView alloc] init];
//    timerView.translatesAutoresizingMaskIntoConstraints = NO;
//    [self.view addSubview:timerView];
//    self.timerView = timerView;

    UIFont *timeLabelFont = [UIFont fontWithName:@"HelveticaNeue-Thin" size:(TimerViewWH*0.9/3.0-10.0)];
    [self.timerView setTimeLabelFont:timeLabelFont];

//    UIButton *btn = [[UIButton alloc] init];
//    btn.translatesAutoresizingMaskIntoConstraints = NO;
//    [self.view addSubview:btn];
//    self.button = btn;
    self.button.backgroundColor = [UIColor clearColor];

//    [self.button addTarget:self action:@selector(openApp) forControlEvents:UIControlEventTouchUpInside];

    // 布局
//    [self.timerView autoSetDimension:ALDimensionWidth toSize:TimerViewWH];
//    [self.timerView autoSetDimension:ALDimensionHeight toSize:TimerViewWH];
//    [self.timerView autoAlignAxisToSuperviewAxis:ALAxisVertical];
//    [self.timerView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:10.0];

//    [self.button autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero];
}

- (UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMarginInsets
{
    // return UIEdgeInsetsMake(0, 50, 88, 50);
    return UIEdgeInsetsZero;
}

- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {

    NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.dpruin.dppomodoro"];

    double startDateAsTimeStamp = [defaults doubleForKey:@"date"];
    self.endDate = [NSDate dateWithTimeIntervalSince1970:startDateAsTimeStamp];
    self.maxValue = [defaults integerForKey:@"maxValue"];

    DPLog(@"widgeUpdate-endate:%@ -maxValue-%ld", self.endDate, self.maxValue);

    [self.timerView setDuration:0.0 maxValue:1.0];

    [self.timer invalidate];
    if (self.endDate != nil) {
        self.timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
    }

    completionHandler(NCUpdateResultNewData);
}

/**
 *  更新label
 */
- (void)updateLabel
{
    double durationInSeconds = [self.endDate timeIntervalSinceNow];
    if (durationInSeconds > 0) {
        [self.timerView setDuration:(CGFloat)durationInSeconds maxValue:(CGFloat)self.maxValue];
    } else {
        [self.timer invalidate];
    }
}

/**
 *  打开ContainingApp
 */
- (IBAction)openApp:(UIButton *)sender {
    DPLog(@"openApp--");
    NSURL *url = [NSURL URLWithString:@"DPTomate://"];
    [self.extensionContext openURL:url completionHandler:^(BOOL success) {
        if (!success) {
            DPLog(@"打开app失败");
        }
    }];
}

@end


text:
unicategories
=============

Unicode category database, generated on setup.

Project moved to `https://gitlab.com/ergoithz/unicategories <https://gitlab.com/ergoithz/unicategories>`_.

**This repository is archived.**


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <size android:height="8dp" />
    <solid android:color="@color/primaryGrayLine" />
</shape>


text:
import { Injectable } from '@angular/core';
import { Http, Response, Headers, URLSearchParams, RequestOptions } from '@angular/http';
import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Rx';

@Injectable()
export class DetalleFacturaService {

  constructor() { }

}


text:
using UnityEngine;
using System.Collections;
using DG.Tweening;
using JetBrains.Annotations;

public class MusicService : Singleton<MusicService>
{
    public AudioClip BeachSnow;
    public AudioClip Lighthouse;
    public AudioSource PrimaryAudioSource;

    // Use this for initialization
    void Start()
    {
        PrimaryAudioSource = GetComponent<AudioSource>();
    }

    public void PlayBeachSnow()
    {
        PrimaryAudioSource.clip = BeachSnow;
        PrimaryAudioSource.Play();
    }

    public void TransitionToFight()
    {
        DOTween.Sequence()
            .Append(PrimaryAudioSource.DOFade(0f, .5f))
            .AppendCallback(() =>
            {
                PrimaryAudioSource.clip = Lighthouse;
                PrimaryAudioSource.Stop();
            });
    }

    public void TransitionToLighthouse()
    {
        DOTween.Sequence()
            .Append(PrimaryAudioSource.DOFade(0f, .5f))
            .AppendCallback(() =>
            {
                PrimaryAudioSource.clip = Lighthouse;
                PrimaryAudioSource.Play();
            })
            .Append(PrimaryAudioSource.DOFade(1f, 1f));
    }

    public void TransitionToBeachSnow()
    {
        DOTween.Sequence()
            .Append(PrimaryAudioSource.DOFade(0f, .5f))
            .AppendCallback(() =>
            {
                PrimaryAudioSource.clip = BeachSnow;
                PrimaryAudioSource.Play();
            })
            .Append(PrimaryAudioSource.DOFade(1f, 1f));
    }

    public void OnLevelWasLoaded(int level)
    {
        if (Application.loadedLevelName == "Lighthouse")
        {
            TransitionToLighthouse();
        }

        if (Application.loadedLevelName == "Village")
        {
            TransitionToLighthouse();
        }

        if (Application.loadedLevelName == "Main")
        {
            TransitionToBeachSnow();
        }

        if (Application.loadedLevelName == "Fight")
        {
            TransitionToFight();
        }
    }

}


text:
#pragma warning(disable:4786)

#include <iostream>

using namespace std;

#include "ActionWord.h"				// Needed for list of valid action words
#include "ActionWordList.h"			// Needed for list of action word types
#include "ActionWordPart.h"			// Class definition
#include "ComposedInterpreter.h"	// Composition class
#include "StrUtil.h"				// Needed for trim functionality

#define BASECLASS Interpreter

///////////////////////////////////////////////////////////////////////////////
// Construction and destruction

// Default constructor
ActionWordPart::ActionWordPart()
{
}

// Destructor
ActionWordPart::~ActionWordPart()
{
}

///////////////////////////////////////////////////////////////////////////////
// Attributes and operations

//						=========================
bool					ActionWordPart::Interpret
//						=========================
(
	const string&		strActionWordArgument		// argument to check for action word
)
{
	bool bResult = false;			// result of Interpret

	// trim specified argument to determine action word
	string strActionWord = trim(strActionWordArgument);

	// check if the specified action word is empty
	if (strActionWord.empty())
	{
		// no action word, so argument belongs to an empty line or a comment line
		GetTheComposedInterpreter()->SetActionType(ActionWordList::EMPTY);
		bResult = true;
	}
	else
	{
		int	   nActionType;		// action word type
		string strFunction;		// action word function

		// check if action word is valid
		if (GetTheActionWord()->Find(strActionWord, nActionType, strFunction))
		{
			// store the attributes in the composed interpreter
			GetTheComposedInterpreter()->SetActionWordFunction(strFunction);
			GetTheComposedInterpreter()->SetActionType(nActionType);
			bResult = true;
		}
		else
		{
			GetTheComposedInterpreter()->SetActionType(ActionWordList::UNDEFINED);
		}
	}

	return bResult;
}


text:
package com.notronix.lw.impl.method.inventory;

import com.google.api.client.http.HttpContent;
import com.google.gson.Gson;
import com.notronix.lw.impl.method.AbstractLinnworksAPIMethod;

import java.util.List;
import java.util.UUID;

import static com.notronix.lw.impl.method.MethodUtils.urlEncode;
import static java.util.Objects.requireNonNull;

public class DeleteInventoryItemPricesMethod extends AbstractLinnworksAPIMethod<Void>
{
    private List<UUID> inventoryItemPriceIds;

    @Override
    public String getURI() {
        return "Inventory/DeleteInventoryItemPrices";
    }

    @Override
    public HttpContent getContent(Gson gson) {
        return urlEncode("inventoryItemPriceIds", gson.toJson(requireNonNull(inventoryItemPriceIds)));
    }

    @Override
    public Void getResponse(Gson gson, String jsonPayload) {
        return null;
    }

    public List<UUID> getInventoryItemPriceIds() {
        return inventoryItemPriceIds;
    }

    public void setInventoryItemPriceIds(List<UUID> inventoryItemPriceIds) {
        this.inventoryItemPriceIds = inventoryItemPriceIds;
    }

    public DeleteInventoryItemPricesMethod withInventoryItemPriceIds(List<UUID> inventoryItemPriceIds) {
        this.inventoryItemPriceIds = inventoryItemPriceIds;
        return this;
    }
}


text:
package org.apache.sshd.agent.common;

import java.io.IOException;
import java.security.KeyPair;
import java.security.PublicKey;
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.apache.sshd.agent.SshAgent;
import org.apache.sshd.agent.SshAgentConstants;
import org.apache.sshd.agent.SshAgentKeyConstraint;
import org.apache.sshd.common.SshException;
import org.apache.sshd.common.config.keys.KeyUtils;
import org.apache.sshd.common.session.SessionContext;
import org.apache.sshd.common.util.GenericUtils;
import org.apache.sshd.common.util.buffer.Buffer;
import org.apache.sshd.common.util.buffer.BufferUtils;
import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
import org.apache.sshd.common.util.logging.AbstractLoggingBean;
import org.apache.sshd.common.util.threads.CloseableExecutorService;
import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
import org.apache.sshd.core.CoreModuleProperties;

/**
 * @author Apache MINA SSHD Project
 */
public abstract class AbstractAgentProxy extends AbstractLoggingBean implements SshAgent, ExecutorServiceCarrier {

    private CloseableExecutorService executor;
    private String channelType = CoreModuleProperties.AGENT_FORWARDING_TYPE_OPENSSH;

    protected AbstractAgentProxy(CloseableExecutorService executorService) {
        executor = executorService;
    }

    public String getChannelType() {
        return channelType;
    }

    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }

    @Override
    public CloseableExecutorService getExecutorService() {
        return executor;
    }

    @Override
    public Iterable<? extends Map.Entry<PublicKey, String>> getIdentities() throws IOException {
        int cmd = SshAgentConstants.SSH2_AGENTC_REQUEST_IDENTITIES;
        int okcmd = SshAgentConstants.SSH2_AGENT_IDENTITIES_ANSWER;
        if (CoreModuleProperties.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) {
            cmd = SshAgentConstants.SSH_AGENT_LIST_KEYS;
            okcmd = SshAgentConstants.SSH_AGENT_KEY_LIST;
        }

        Buffer buffer = createBuffer((byte) cmd, 1);
        buffer = request(prepare(buffer));
        int type = buffer.getUByte();
        if (type != okcmd) {
            throw new SshException("Bad agent identities answer: " + SshAgentConstants.getCommandMessageName(type));
        }

        int nbIdentities = buffer.getInt();
        // TODO make the maximum a Property
        if ((nbIdentities < 0) || (nbIdentities > 1024)) {
            throw new SshException("Illogical identities count: " + nbIdentities);
        }

        List<SimpleImmutableEntry<PublicKey, String>> keys = new ArrayList<>(nbIdentities);
        boolean debugEnabled = log.isDebugEnabled();
        for (int i = 0; i < nbIdentities; i++) {
            PublicKey key = buffer.getPublicKey();
            String comment = buffer.getString();
            if (debugEnabled) {
                log.debug("getIdentities() key type={}, comment={}, fingerprint={}",
                        KeyUtils.getKeyType(key), comment, KeyUtils.getFingerPrint(key));
            }
            keys.add(new SimpleImmutableEntry<>(key, comment));
        }

        return keys;
    }

    @Override
    public Map.Entry<String, byte[]> sign(SessionContext session, PublicKey key, String algo, byte[] data) throws IOException {
        int cmd = SshAgentConstants.SSH2_AGENTC_SIGN_REQUEST;
        int okcmd = SshAgentConstants.SSH2_AGENT_SIGN_RESPONSE;
        if (CoreModuleProperties.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) {
            cmd = SshAgentConstants.SSH_AGENT_PRIVATE_KEY_OP;
            okcmd = SshAgentConstants.SSH_AGENT_OPERATION_COMPLETE;
        }

        Buffer buffer = createBuffer((byte) cmd);
        String keyType = KeyUtils.getKeyType(key);
        int flags = 0;
        if (CoreModuleProperties.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) {
            buffer.putString("sign");
        } else {
            String signatureAlgorithm;
            if (!GenericUtils.isEmpty(algo)) {
                if (!KeyUtils.getCanonicalKeyType(algo).equals(keyType)) {
                    throw new IllegalArgumentException(
                            "Bad signing request: signature algorithm '" + algo + "' not applicable to '" + keyType + "' key");
                }
                signatureAlgorithm = algo;
            } else {
                signatureAlgorithm = keyType;
            }
            switch (signatureAlgorithm) {
                case KeyUtils.RSA_SHA512_KEY_TYPE_ALIAS:
                case KeyUtils.RSA_SHA512_CERT_TYPE_ALIAS:
                    flags = 4;
                    break;
                case KeyUtils.RSA_SHA256_KEY_TYPE_ALIAS:
                case KeyUtils.RSA_SHA256_CERT_TYPE_ALIAS:
                    flags = 2;
                    break;
                default:
                    break;
            }
        }
        buffer.putPublicKey(key);
        buffer.putBytes(data);
        buffer.putInt(flags);
        buffer = request(prepare(buffer));

        int responseType = buffer.getUByte();
        if (responseType != okcmd) {
            throw new SshException("Bad signing response type: " + SshAgentConstants.getCommandMessageName(responseType));
        }

        byte[] signature = buffer.getBytes();
        boolean debugEnabled = log.isDebugEnabled();
        if (CoreModuleProperties.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) {
            if (debugEnabled) {
                log.debug("sign({}/{})[{}] : {}",
                        algo, keyType, KeyUtils.getFingerPrint(key), BufferUtils.toHex(':', signature));
            }
            return new SimpleImmutableEntry<>(keyType, signature);
        } else {
            Buffer buf = new ByteArrayBuffer(signature);
            String algorithm = buf.getString();
            signature = buf.getBytes();
            if (debugEnabled) {
                log.debug("sign({}/{})[{}] {}: {}",
                        algo, keyType, KeyUtils.getFingerPrint(key), algorithm, BufferUtils.toHex(':', signature));
            }
            return new SimpleImmutableEntry<>(algorithm, signature);
        }
    }

    @Override
    public void addIdentity(KeyPair kp, String comment, SshAgentKeyConstraint... constraints) throws IOException {
        byte cmd = SshAgentConstants.SSH2_AGENTC_ADD_IDENTITY;
        if (!GenericUtils.isEmpty(constraints)) {
            cmd = SshAgentConstants.SSH2_AGENTC_ADD_ID_CONSTRAINED;
        }
        Buffer buffer = createBuffer(cmd);
        buffer.putKeyPair(kp);
        buffer.putString(comment);
        if (!GenericUtils.isEmpty(constraints)) {
            for (SshAgentKeyConstraint constraint : constraints) {
                constraint.put(buffer);
            }
        }
        if (log.isDebugEnabled()) {
            log.debug("addIdentity({})[{}]: {}", KeyUtils.getKeyType(kp), comment, KeyUtils.getFingerPrint(kp.getPublic()));
        }
        buffer = request(prepare(buffer));

        int available = buffer.available();
        int response = (available >= 1) ? buffer.getUByte() : -1;
        if ((available != 1) || (response != SshAgentConstants.SSH_AGENT_SUCCESS)) {
            throw new SshException(
                    "Bad addIdentity response (" + SshAgentConstants.getCommandMessageName(response) + ") - available="
                                   + available);
        }
    }

    @Override
    public void removeIdentity(PublicKey key) throws IOException {
        Buffer buffer = createBuffer(SshAgentConstants.SSH2_AGENTC_REMOVE_IDENTITY);
        buffer.putPublicKey(key);
        if (log.isDebugEnabled()) {
            log.debug("removeIdentity({}) {}", KeyUtils.getKeyType(key), KeyUtils.getFingerPrint(key));
        }

        buffer = request(prepare(buffer));

        int available = buffer.available();
        int response = (available >= 1) ? buffer.getUByte() : -1;
        if ((available != 1) || (response != SshAgentConstants.SSH_AGENT_SUCCESS)) {
            throw new SshException(
                    "Bad removeIdentity response (" + SshAgentConstants.getCommandMessageName(response) + ") - available="
                                   + available);
        }
    }

    @Override
    public void removeAllIdentities() throws IOException {
        Buffer buffer = createBuffer(SshAgentConstants.SSH2_AGENTC_REMOVE_ALL_IDENTITIES, 1);
        if (log.isDebugEnabled()) {
            log.debug("removeAllIdentities");
        }
        buffer = request(prepare(buffer));

        int available = buffer.available();
        int response = (available >= 1) ? buffer.getUByte() : -1;
        if ((available != 1) || (response != SshAgentConstants.SSH_AGENT_SUCCESS)) {
            throw new SshException(
                    "Bad removeAllIdentities response (" + SshAgentConstants.getCommandMessageName(response) + ") - available="
                                   + available);
        }
    }

    @Override
    public void close() throws IOException {
        CloseableExecutorService service = getExecutorService();
        if ((service != null) && (!service.isShutdown())) {
            Collection<?> runners = service.shutdownNow();
            if (log.isDebugEnabled()) {
                log.debug("close() - shutdown runners count={}", GenericUtils.size(runners));
            }
        }
    }

    protected Buffer createBuffer(byte cmd) {
        return createBuffer(cmd, 0);
    }

    protected Buffer createBuffer(byte cmd, int extraLen) {
        Buffer buffer = new ByteArrayBuffer((extraLen <= 0) ? ByteArrayBuffer.DEFAULT_SIZE : extraLen + Byte.SIZE, false);
        buffer.putUInt(0L);
        buffer.putByte(cmd);
        return buffer;
    }

    protected Buffer prepare(Buffer buffer) {
        int wpos = buffer.wpos();
        buffer.wpos(0);
        buffer.putUInt(wpos - 4);
        buffer.wpos(wpos);
        return buffer;
    }

    protected abstract Buffer request(Buffer buffer) throws IOException;
}


text:
package org.efaps.admin.index;

import org.efaps.admin.EFapsSystemConfiguration;
import org.efaps.admin.KernelSettings;
import org.efaps.db.Instance;
import org.efaps.util.EFapsException;
import org.efaps.util.RandomUtil;
import org.efaps.util.cache.InfinispanCache;
import org.infinispan.AdvancedCache;

/**
 * TODO comment!
 *
 * @author The eFaps Team
 */
public final class Queue
{

    /**
     * Name of the Cache for Instances.
     */
    public static final String CACHENAME = Queue.class.getName() + ".Cache";

    /**
     * Instantiates a new queue.
     */
    private Queue()
    {
    }

    /**
     * Register update.
     *
     * @param _instance the _instance
     * @throws EFapsException the e faps exception
     */
    public static void registerUpdate(final Instance _instance)
        throws EFapsException
    {
        // check if SystemConfiguration exists, necessary during install
        if (EFapsSystemConfiguration.get() != null
                        && EFapsSystemConfiguration.get().getAttributeValueAsBoolean(KernelSettings.INDEXACTIVATE)) {
            if (_instance != null && _instance.getType() != null
                            && IndexDefinition.get(_instance.getType().getUUID()) != null) {
                final AdvancedCache<String, String> cache = InfinispanCache.get()
                                .<String, String>getIgnReCache(CACHENAME);
                cache.put(RandomUtil.random(12), _instance.getOid());
            }
        }
    }
}


text:
<?php
    //Pick the post data
    $postdata = file_get_contents("php://input");
    //Convert json to Array
    $postArr = json_decode($postdata);
    // Read the existing moderation pending data from file
    $inp = file_get_contents('moderationPending.json');
    //Convert json to Array
    $tempArray = json_decode($inp);
    // Merges the 2 arrays and picks out the unique values only, SORT_REGULAR is used to convert object as string. Array values will return a json compatible array as array can also be a map in PHP! Darn!
    $tempArray = array_values(array_unique(array_merge($tempArray, $postArr), SORT_REGULAR ));
    // convert back to json
    $jsonData = json_encode($tempArray);
    // write back to file
    file_put_contents('moderationPending.json', $jsonData);
?>


text:
<?php

namespace rrPrizeTool;

use Illuminate\Database\Eloquent\Model;

class Account extends Model {

	protected $table = 'accounts';
	public $timestamps = false;

}


text:
require 'triglav/agent/base/monitor'
require 'triglav-agent-hdfs_jars'
require 'triglav/agent/hdfs/connection'
require 'uri'
require 'securerandom'

module Triglav::Agent
  module Hdfs
    class Monitor < Base::Monitor
      attr_reader :connection, :resource_uri_prefix, :resource, :last_modification_times

      # @param [Triglav::Agent::Hdfs::Connection] connection
      # @param [TriglavClient::ResourceResponse] resource
      # resource:
      #   uri: hdfs://host/path
      #   unit: 'daily', 'hourly', or 'singular'
      #   timezone: '+09:00'
      #   span_in_days: 32
      def initialize(connection, resource_uri_prefix, resource)
        @connection = connection
        @resource_uri_prefix = resource_uri_prefix
        @resource = resource
        @status = Triglav::Agent::Status.new(resource_uri_prefix, resource.uri)
        @last_modification_times = get_last_modification_times
      end

      def process
        unless resource_valid?
          $logger.warn { "Broken resource: #{resource.to_s}" }
          return nil
        end
        $logger.debug { "Start process #{resource.uri}" }

        events, new_last_modification_times = get_events

        $logger.debug { "Finish process #{resource.uri}" }

        return nil if events.nil? || events.empty?
        yield(events) if block_given? # send_message
        update_status_file(new_last_modification_times)
        true
      end

      private

      def get_events
        new_last_modification_times = get_new_last_modification_times
        latest_files = select_latest_files(new_last_modification_times)
        events = build_events(latest_files)
        [events, new_last_modification_times]
      rescue => e
        $logger.warn { "#{e.class} #{e.message} #{e.backtrace.join("\n  ")}" }
        nil
      end

      def update_status_file(last_modification_times)
        last_modification_times[:max] = last_modification_times.values.max
        @status.set(last_modification_times)
      end

      def get_last_modification_times
        last_modification_times = @status.get || {}
        max_last_modification_time = last_modification_times[:max] || @status.getsetnx([:max], $setting.debug? ? 0 : get_current_time)
        removes = last_modification_times.keys - paths.keys
        appends = paths.keys - last_modification_times.keys
        removes.each {|path| last_modification_times.delete(path) }
        appends.each {|path| last_modification_times[path] = max_last_modification_time }
        last_modification_times
      end

      def get_current_time
        (Time.now.to_f * 1000).to_i # msec
      end

      def resource_valid?
        self.class.resource_valid?(resource)
      end

      def self.resource_valid?(resource)
        resource_unit_valid?(resource) && !resource.timezone.nil? && !resource.span_in_days.nil?
      end

      # Two or more combinations are not allowed for hdfs because
      # * hourly should have %d, %H
      # * daily should have %d, but not have %H
      # * singualr should not have %d
      # These conditions conflict.
      def self.resource_unit_valid?(resource)
        units = resource.unit.split(',').sort
        return false if units.size >= 2
        # if units.include?('hourly')
        #   return false unless resource.uri.match(/%H/)
        # end
        # if units.include?('daily')
        #   return false unless resource.uri.match(/%d/)
        # end
        if units.include?('singular')
          return false if resource.uri.match(/%[YmdH]/)
        end
        true
      end

      def dates
        return @dates if @dates
        now = Time.now.localtime(resource.timezone)
        @dates = resource.span_in_days.times.map do |i|
          (now - (i * 86400)).to_date
        end
      end

      def paths
        return @paths if @paths
        paths = {}
        # If path becomes same, use newer date
        case resource.unit
        when 'hourly'
          dates.each do |date|
            date_time = date.to_time
            (0..23).each do |hour|
              path = (date_time + hour * 3600).strftime(resource.uri)
              paths[path.to_sym] = [date, hour]
            end
          end
        when 'daily'
          hour = 0
          dates.each do |date|
            path = date.strftime(resource.uri)
            paths[path.to_sym] = [date, hour]
          end
        when 'singular'
          path = resource.uri
          paths[path.to_sym] = [nil, nil]
        end
        @paths = paths
      end

      def get_new_last_modification_times
        new_last_modification_times = {}
        paths.each do |path, date_hour|
          latest_file = connection.get_latest_file_under(path.to_s)
          unless latest_file
            $logger.debug { "get_latest_file_under(\"#{path.to_s}\") #=> does not exist" }
            next
          end
          new_last_modification_times[path.to_sym] = latest_file.modification_time
        end
        new_last_modification_times
      end

      def select_latest_files(new_last_modification_times)
        new_last_modification_times.select do |path, new_last_modification_time|
          is_newer = new_last_modification_time > (last_modification_times[path] || 0)
          $logger.debug { "#{path.to_s} #=> last_modification_time:#{new_last_modification_time}, is_newer:#{is_newer}" }
          is_newer
        end
      end

      def build_events(latest_files)
        latest_files.map do |path, last_modification_time|
          date, hour = date_hour = paths[path]
          {
            uuid: SecureRandom.uuid,
            resource_uri: resource.uri,
            resource_unit: resource.unit,
            resource_time: date_hour_to_i(date, hour, resource.timezone),
            resource_timezone: resource.timezone,
            payload: {path: path.to_s, modification_time: last_modification_time}.to_json, # msec
          }
        end
      end

      def date_hour_to_i(date, hour, timezone)
        return 0 if date.nil?
        Time.strptime("#{date.to_s} #{hour.to_i} #{timezone}", '%Y-%m-%d %H %z').to_i
      end
    end
  end
end


text:
const util = require('../../helpers/util.helper');

exports.spacesDelete = function (req, res, next) {
    /**
     * parameters expected in the args:
     * stewardname (String)
     * namespace (String)
     * authorization (String)
     **/

    var examples = {};

    examples['application/json'] = {
        "id": "aeiou",
        "ok": true
    };

    var request = {};
    request.stewardname = req.swagger.params.stewardname.value;
    request.namespace = req.swagger.params.namespace.value;
    request.publicKey = req.user.publicKey;

    spacesDelete(request, function (err, result) {
        res.setHeader('Content-Type', 'application/json');
        if (err) {
            // throw error
            examples['application/json'] = err;
            res.statusCode = util.setStatus(err);
        } else {
            examples['application/json'] = result;
        }
        res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
    });
}

const spacesDelete = function(request, spacesDeleteCallback) {
    //this essentially removes yourself from stewardship of the space
    //check that namespace exists
    //check if there are any currencies or accounts using this space
    //delete space globally
    //delete space locally
    //notify those affected
    var error = {};
    error.status = 503;
    error.code = 2009;
    error.message = 'method not implemented at this time.';
    spacesDeleteCallback(error, false);
};


text:
package fi.vtt.nubomedia.webrtcpeerandroid;

import android.graphics.ImageFormat;

import org.webrtc.VideoRenderer;

/**
 * Media configuration object used in construction of NBMWebRTCPeer
 */
public class NBMMediaConfiguration {

    /**
     * Renderer type
     */
    public enum NBMRendererType {
        NATIVE, OPENGLES
    }

    /**
     * Audio codec
     */
    public enum NBMAudioCodec {
        OPUS, ISAC
    }

    /**
     * Video codec
     */
    public enum NBMVideoCodec {
        VP8, VP9, H264
    }

    /**
     * Camera position
     *

     * Synonymous to active camera. Currently supports back, front and any cameras
     *

     */
    public enum NBMCameraPosition {
        ANY, BACK, FRONT
    }

    /**
     * Video format struct
     */
    public static class NBMVideoFormat {
        /**
         * Video frame height in pixels
         */
        public final int heigth;
        /**
         * Video frame width in pixels
         */
        public final int width;
        /**
         * Video image format.
         *
Values are in android.graphics.PixelFormat and android.graphics.ImageFormat. See
         * documentation at

         * http://developer.android.com/reference/android/graphics/ImageFormat.html

         * http://developer.android.com/reference/android/graphics/PixelFormat.html
         *

         */
        public final int imageFormat;
        /**
         * Video frames per second
         */
        public final double frameRate;

        public NBMVideoFormat(int width, int heigth, int imageFormat, double frameRate) {
            this.width = width;
            this.heigth = heigth;

            this.imageFormat = imageFormat;
            this.frameRate = frameRate;
        }
    }

    private NBMRendererType rendererType;
    private NBMAudioCodec audioCodec;
    private int audioBandwidth;
    private NBMVideoCodec videoCodec;
    private int videoBandwidth;
    private NBMCameraPosition cameraPosition;
    private NBMVideoFormat receiverVideoFormat;

    public NBMCameraPosition getCameraPosition() {
        return cameraPosition;
    }
    public NBMRendererType getRendererType() {
        return rendererType;
    }
    public NBMAudioCodec getAudioCodec() {
        return audioCodec;
    }
    public int getAudioBandwidth() {
        return audioBandwidth;
    }
    public NBMVideoCodec getVideoCodec() {
        return videoCodec;
    }
    public int getVideoBandwidth() {
        return videoBandwidth;
    }
    public NBMVideoFormat getReceiverVideoFormat() {
        return receiverVideoFormat;
    }

    /**
     * Default constructor
     *

     * Default values:

     * rendererType NATIVE

     * audioCodec OPUS

     * audioBandwidth unlimited

     * videoCodec VP8

     * videoBandwidth unlimited

     * receiverVideoFormat

     * width 640

     * height 480

     * ImageFormat.NV21

     * fram rate 30

     * cameraPosition FRONT
     *

     */
    public NBMMediaConfiguration() {
        rendererType = NBMRendererType.NATIVE;
        audioCodec = NBMAudioCodec.OPUS;
        audioBandwidth = 0;

        videoCodec = NBMVideoCodec.VP8;
        videoBandwidth = 0;

        receiverVideoFormat = new NBMVideoFormat(640, 480, ImageFormat.NV21, 30);
        cameraPosition = NBMCameraPosition.FRONT;

    }

    public NBMMediaConfiguration(NBMRendererType rendererType, NBMAudioCodec audioCodec,
                                 int audioBandwidth, NBMVideoCodec videoCodec,
                                 int videoBandwidth, NBMVideoFormat receiverVideoFormat,
                                 NBMCameraPosition cameraPosition) {
        this.rendererType = rendererType;
        this.audioCodec = audioCodec;
        this.audioBandwidth = audioBandwidth;
        this.videoCodec = videoCodec;
        this.videoBandwidth = videoBandwidth;
        this.receiverVideoFormat = receiverVideoFormat;
        this.cameraPosition = cameraPosition;
    }
}


text:
Privacy tools
=============

Privacy tools for PHP. This package includes:
- Do Not Track

## Do Not Track
Do Not Track is a feature in most browsers that allow you to let a website know you
would like to opt-out of third-party tracking for purposes including behavioral
advertising. It does this by transmitting a Do Not Track HTTP header every time
your data is requested from the web.

https://www.mozilla.org/en-US/firefox/dnt/

Example usage
```php
$canTrack = DoNotTrack::canTrack();

echo ($canTrack) ? 'You prefer not to be tracked.' : 'You don\'t seem to mind getting tracked.';
```


text:
package com.salesmanager.core.business.customer.model.attribute;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;

import org.hibernate.annotations.Index;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.web.multipart.MultipartFile;

import com.salesmanager.core.business.generic.model.SalesManagerEntity;
import com.salesmanager.core.business.merchant.model.MerchantStore;
import com.salesmanager.core.constants.SchemaConstant;

@Entity
@Table(name="CUSTOMER_OPTION_VALUE", schema=SchemaConstant.SALESMANAGER_SCHEMA, uniqueConstraints=
	@UniqueConstraint(columnNames = {"MERCHANT_ID", "CUSTOMER_OPT_VAL_CODE"}))
public class CustomerOptionValue extends SalesManagerEntity<Long, CustomerOptionValue> {
	private static final long serialVersionUID = 3736085877929910891L;

	@Id
	@Column(name="CUSTOMER_OPTION_VALUE_ID")
	@TableGenerator(name = "TABLE_GEN", table = "SM_SEQUENCER", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "CUSTOMER_OPT_VAL_SEQ_NEXT_VAL")
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "TABLE_GEN")
	private Long id;

	@Column(name="SORT_ORDER")
	private Integer sortOrder = 0;

	@Column(name="CUSTOMER_OPT_VAL_IMAGE")
	private String customerOptionValueImage;

	@NotEmpty
	@Pattern(regexp="^[a-zA-Z0-9_]*$")
	@Column(name="CUSTOMER_OPT_VAL_CODE")
	@Index(name="CUST_OPT_VAL_CODE_IDX")
	private String code;

	@Transient
	private MultipartFile image = null;

	@Valid
	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "customerOptionValue")
	private Set<CustomerOptionValueDescription> descriptions = new HashSet<CustomerOptionValueDescription>();

	@Transient
	private List<CustomerOptionValueDescription> descriptionsList = new ArrayList<CustomerOptionValueDescription>();

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="MERCHANT_ID", nullable=false)
	private MerchantStore merchantStore;

	public CustomerOptionValue() {
	}

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public void setId(Long id) {
		this.id = id;
	}

	public Set<CustomerOptionValueDescription> getDescriptions() {
		return descriptions;
	}

	public void setDescriptions(Set<CustomerOptionValueDescription> descriptions) {
		this.descriptions = descriptions;
	}

	public MerchantStore getMerchantStore() {
		return merchantStore;
	}

	public void setMerchantStore(MerchantStore merchantStore) {
		this.merchantStore = merchantStore;
	}

	public void setDescriptionsList(List<CustomerOptionValueDescription> descriptionsList) {
		this.descriptionsList = descriptionsList;
	}

	public List<CustomerOptionValueDescription> getDescriptionsList() {
		return descriptionsList;
	}

	public List<CustomerOptionValueDescription> getDescriptionsSettoList() {
		if(descriptionsList==null || descriptionsList.size()==0) {
			descriptionsList = new ArrayList<CustomerOptionValueDescription>(this.getDescriptions());
		}
		return descriptionsList;
	}

	public void setImage(MultipartFile image) {
		this.image = image;
	}

	public MultipartFile getImage() {
		return image;
	}

	public String getCustomerOptionValueImage() {
		return customerOptionValueImage;
	}

	public void setCustomerOptionValueImage(String customerOptionValueImage) {
		this.customerOptionValueImage = customerOptionValueImage;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public void setSortOrder(Integer sortOrder) {
		this.sortOrder = sortOrder;
	}

	public Integer getSortOrder() {
		return sortOrder;
	}

}


text:
<title>Zend Framework Extras API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="css/jquery-ui.css" type="text/css"></link><link rel="stylesheet" href="css/docblox/jquery-ui-1.8.16.custom.css" type="text/css"></link><link rel="stylesheet" href="css/jquery.treeview.css" type="text/css"></link><link rel="stylesheet" href="css/theme.css" type="text/css"></link>

API Documentation

ZendX/JQuery/View/Helper/DatePicker.php

              Show:
              inherited

                          Classes

\ZendX_JQuery_View_Helper_DatePicker

              Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.

Category

ZendX

Copyright

Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)

License

New BSD License

Package

ZendX_JQuery

Subpackage

View

Version

$Id: DatePicker.php 21867 2010-04-16 07:45:34Z beberlei $

\ZendX_JQuery_View_Helper_DatePicker
jump to top

Package: ZendX\JQuery\View
jQuery Date Picker View Helper

Parent(s)

\ZendX_JQuery_View_Helper_UiWidget
            <
            \Zend_View_Helper_HtmlElement

Copyright

Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)

License

New BSD License

Uses

\Zend_View_Helper_FormText

Methods

datePicker(
          string $id, string $value
              =
              null, array $params
              =
              array(), array $attribs
              =
              array()
          )

        :
          string

Create a jQuery UI Widget Date Picker

Parameters

Name
Type
Description

$id
string

$value
string

$params
array

jQuery Widget Parameters

$attribs
array

HTML Element Attributes

Returns

Type
Description

string

Details

Link

http://docs.jquery.com/UI/Datepicker

resolveZendLocaleToDatePickerFormat(
           $format
              =
              null
          )

        :
          string

static
A Check for Zend_Locale existance has already been done in {@link datePicker()}
this function only resolves the default format from Zend Locale to
a jQuery Date Picker readable format. This function can be potentially buggy
because of its easy nature and is therefore stripped from the core functionality
to be easily overriden.

Parameters

Name
Type
Description

$format

Returns

Type
Description

string

Documentation was generated by DocBlox 0.15.1.


text:
package alluxio.client.file.options;

import alluxio.ConfigurationRule;
import alluxio.LoginUserRule;
import alluxio.PropertyKey;
import alluxio.security.authorization.Mode;
import alluxio.security.group.provider.IdentityUserGroupsMapping;
import alluxio.thrift.CompleteUfsFileTOptions;
import alluxio.util.CommonUtils;

import com.google.common.collect.ImmutableMap;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;

import java.io.IOException;
import java.util.Random;

/**
 * Tests for the {@link CompleteUfsFileOptions} class.
 */
public final class CompleteUfsFileOptionsTest {
  private static final String TEST_USER = "test";

  @Rule
  public LoginUserRule mLoginUser = new LoginUserRule(TEST_USER);

  @Rule
  public ConfigurationRule mConfiguration = new ConfigurationRule(ImmutableMap
      .of(PropertyKey.SECURITY_GROUP_MAPPING_CLASS, IdentityUserGroupsMapping.class.getName()));

  /**
   * Tests that building a {@link CompleteUfsFileOptions} with the defaults works.
   */
  @Test
  public void defaults() throws IOException {
    CompleteUfsFileOptions options = CompleteUfsFileOptions.defaults();
    Assert.assertEquals(TEST_USER, options.getOwner());
    Assert.assertEquals(TEST_USER, options.getGroup());
    Assert.assertEquals(Mode.defaults().applyFileUMask(), options.getMode());
  }

  /**
   * Tests getting and setting fields.
   */
  @Test
  public void fields() throws IOException {
    Random random = new Random();
    String owner = CommonUtils.randomAlphaNumString(10);
    String group = CommonUtils.randomAlphaNumString(10);
    Mode mode = new Mode((short) random.nextInt());

    CompleteUfsFileOptions options = CompleteUfsFileOptions.defaults();
    options.setOwner(owner);
    options.setGroup(group);
    options.setMode(mode);

    Assert.assertEquals(owner, options.getOwner());
    Assert.assertEquals(group, options.getGroup());
    Assert.assertEquals(mode, options.getMode());
  }

  /**
   * Tests conversion to thrift representation.
   */
  @Test
  public void toThrift() throws IOException {
    Random random = new Random();
    String owner = CommonUtils.randomAlphaNumString(10);
    String group = CommonUtils.randomAlphaNumString(10);
    Mode mode = new Mode((short) random.nextInt());

    CompleteUfsFileOptions options = CompleteUfsFileOptions.defaults();
    options.setOwner(owner);
    options.setGroup(group);
    options.setMode(mode);

    CompleteUfsFileTOptions thriftOptions = options.toThrift();
    Assert.assertEquals(owner, thriftOptions.getOwner());
    Assert.assertEquals(group, thriftOptions.getGroup());
    Assert.assertEquals(mode.toShort(), thriftOptions.getMode());
  }

  @Test
  public void equalsTest() throws Exception {
    alluxio.test.util.CommonUtils.testEquals(CompleteUfsFileOptions.class);
  }
}


text:
# Redux Persist
Persist and rehydrate a redux store.

Redux Persist is [performant](#why-redux-persist), easy to [implement](#basic-usage), and easy to [extend](./docs/ecosystem.md).

`npm i --save redux-persist`

[![build status](https://img.shields.io/travis/rt2zz/redux-persist/master.svg?style=flat-square)](https://travis-ci.org/rt2zz/redux-persist)
[![npm version](https://img.shields.io/npm/v/redux-persist.svg?style=flat-square)](https://www.npmjs.com/package/redux-persist)
[![npm downloads](https://img.shields.io/npm/dm/redux-persist.svg?style=flat-square)](https://www.npmjs.com/package/redux-persist)

## Basic Usage
Basic usage requires adding a few lines to a traditional redux application:
```js
import {compose, applyMiddleware, createStore} from 'redux'
import {persistStore, autoRehydrate} from 'redux-persist'

// add `autoRehydrate` as an enhancer to your store (note: `autoRehydrate` is not a middleware)
const store = createStore(
  reducer,
  undefined,
  compose(
    applyMiddleware(...),
    autoRehydrate()
  )
)

// begin periodically persisting the store
persistStore(store)
```
For per reducer rehydration logic, you can opt-in by adding a handler to your reducer:
```js
import {REHYDRATE} from 'redux-persist/constants'
//...
case REHYDRATE:
  var incoming = action.payload.myReducer
  if (incoming) return {...state, ...incoming, specialKey: processSpecial(incoming.specialKey)}
  return state
```
You may also need to configure the persistence layer, or take action after rehydration has completed:
```js
persistStore(store, {blacklist: ['someTransientReducer']}, () => {
  console.log('rehydration complete')
})
```
And if things get out of wack, just purge the storage
```js
persistStore(store, config, callback).purge()
```

## API
[Full API](./docs/api.md)
#### `persistStore(store, [config, callback])`
  - arguments
    - **store** *redux store* The store to be persisted.
    - **config** *object*
      - **blacklist** *array* keys (read: reducers) to ignore
      - **whitelist** *array* keys (read: reducers) to persist, if set all other keys will be ignored.
      - **storage** *object* a [conforming](https://github.com/rt2zz/redux-persist#storage-engines) storage engine.
      - **transforms** *array* transforms to be applied during storage and during rehydration.
      - **debounce** *integer* debounce interval applied to storage calls (in miliseconds).
      - **keyPrefix** *string* change localstorage default key (default: **reduxPersist:**) [Discussion on why we need this feature ?](https://github.com/rt2zz/redux-persist/issues/137)
    - **callback** *function* will be called after rehydration is finished.
  - returns **persistor** object

#### `persistor object`
  - the persistor object is returned by persistStore with the following methods:
    - `.purge(keys)`
      - **keys** *array* An array of keys to be purged from storage. If not provided all keys will be purged.
    - `.rehydrate(incoming, options)`
      - **incoming** *object* Data to be rehydrated into the store.
      - **options** *object* If `serial:true`, incoming should be a *string*, that will be deserialized and passed through the transforms defined in the persistor.
      - Manually rehydrates the store with the passed data, dispatching the rehydrate action.
    - `pause()`
      - pauses persistence
    - `resume()`
      - resumes persistence

#### `autoRehydrate(config)`
  - This is a store enhancer that will automatically shallow merge the persisted state for each key. Additionally it queues any actions that are dispatched before rehydration is complete, and fires them after rehydration is finished.
  - arguments
    - **config** *object*
      - **log** *boolean* Turn on debug mode. Default: *false*.
      - **stateReconciler** *function* override the default shallow merge state reconciliation.

#### `constants`
  - `import * as constants from 'redux-persist/constants'`. This includes `REHYDRATE` and `KEY_PREFIX`.

## Alternate Usage
#### getStoredState / createPersistor
If you need more control over persistence flow, you can implement `getStoredState` and `createPersistor`. For example you can skip autoRehydrate and directly pass restoredState into your store as initialState:

```js
import {getStoredState, autoRehydrate, createPersistor} from 'redux-persist'

const persistConfig = { /* ... */ }

getStoredState(persistConfig, (err, restoredState) => {
  const store = createStore(reducer, restoredState)
  const persistor = createPersistor(store, persistConfig)
})
```

#### Secondary Persistor
```js
import {persistStore, createPersistor} from 'redux-persist'
const persistor = persistStore(store) // persistStore restores and persists
const secondaryPersistor = createPersistor(store, {storage: specialBackupStorage}) // createPersistor only persists
```

## Storage Engines
- **localStorage** (default) web
- **sessionStorage**
- **[localForage](https://github.com/mozilla/localForage)** (recommended) web, see usage below
- **[AsyncStorage](http://facebook.github.io/react-native/docs/asyncstorage.html#content)** for react-native
- **[redux-persist-node-storage](https://github.com/pellejacobs/redux-persist-node-storage)** for use in nodejs environments.
- **custom** any conforming storage api implementing the following methods: `setItem` `getItem` `removeItem` `getAllKeys`. [[example](https://github.com/facebook/react-native/blob/master/Libraries/Storage/AsyncStorage.js)]

```js
// sessionStorage
import { persistStore } from 'redux-persist'
import { asyncSessionStorage } from 'redux-persist/storages'
persistStore(store, {storage: asyncSessionStorage})

// react-native
import {AsyncStorage} from 'react-native'
persistStore(store, {storage: AsyncStorage})

// web with recommended localForage
import localForage from 'localForage'
persistStore(store, {storage: localForage})

```

## Transforms
Transforms allow for arbitrary state transforms before saving and during rehydration.
- [immutable](https://github.com/rt2zz/redux-persist-transform-immutable) - support immutable reducers
- [compress](https://github.com/rt2zz/redux-persist-transform-compress) - compress your serialized state with lz-string
- [encrypt](https://github.com/maxdeviant/redux-persist-transform-encrypt) - encrypt your serialized state with AES
- [filter](https://github.com/edy/redux-persist-transform-filter) - store or load a subset of your state
- [filter-immutable](https://github.com/actra-development/redux-persist-transform-filter-immutable) - store or load a subset of your state with support for immutablejs
- [expire](https://github.com/gabceb/redux-persist-transform-expire) - expire a specific subset of your state based on a property
- custom transforms:
```js
import { createTransform, persistStore } from 'redux-persist'

let myTransform = createTransform(
  // transform state coming from redux on its way to being serialized and stored
  (inboundState, key) => specialSerialize(inboundState, key),
  // transform state coming from storage, on its way to be rehydrated into redux
  (outboundState, key) => specialDeserialize(outboundState, key),
  // configuration options
  {whitelist: ['specialReducer']}
)

persistStore(store, {transforms: [myTransform]})
```

## Migrations
One challenge developers encounter when persisting state for the first time is what happens when the shape of the application state changes between deployments? Solution: [redux-persist-migrate](https://github.com/wildlifela/redux-persist-migrate)

## Action Buffer
A common mistake is to fire actions that modify state before rehydration is complete which then will be overwritten by the rehydrate action. You can either defer firing of those actions until rehydration is complete, or you can use an [action buffer](https://github.com/rt2zz/redux-action-buffer/blob/master/README.md#redux-persist-example).

## Why Redux Persist

* Performant out of the box (uses a time iterator and operates on state partials)
* Keeps custom rehydration logic in the reducers (where it intuitively belongs)
* Supports localStorage, react-native AsyncStorage, or any conforming storage api

Because persisting state is inherently stateful, `persistStore` lives outside of the redux store. Importantly this keeps the store 'pure' and makes testing and extending the persistor much easier.

## About Auto Rehydrate
autoRehydrate is a store enhancer that automatically rehydrates state.

While auto rehydration works out of the box, individual reducers can opt in to handling their own rehydration, allowing for more complex operations like data transforms and cache invalidation. Simply define a handler for the rehydrate action in your reducer, and if the state is mutated, auto rehydrate will skip that key.

Auto rehydrate is provided as a convenience. In a large application, or one with atypical reducer composition, auto rehydration may not be convenient. In this case, simply omit autoRehydrate. Rehydration actions will still be fired by `persistStore`, and can then be handled individually by reducers or using a custom rehydration handler.


text:
/**
 * @class Stage 舞台类
 * @module lego/Stage
 * @memberof lego
 * @requires lego
 * @requires lego/View
 * @property {Canvas} canvas
 * @property {CavansContext2d} ctx
 * @property {Number} _lastTime 上次执行时间
 * @extends lego.View
 * @constructor Stage
*/
var Stage = function(cfg){
	this.canvas = null;
	this.ctx = null;
	this._lastTime = 0;

	View.call(this, cfg);
	this._init();
};

lego.extend(Stage, View,
	/** @lends lego.Stage.prototype */
	{
	/**
     * @function
	*/
	_init:function(){
		if(!this.canvas){
			this.canvas = document.createElement("canvas");
			document.body.appendChild(this.canvas);
		}
		this.ctx = this.canvas.getContext("2d");
		this.resize(this.width, this.height);
	},
	/**
     * @function
	*/
	_tick:function _tick(){
		var nowTime = +new Date();
		var ctx = this.ctx;
		ctx.clearRect(0, 0, this.width, this.height);
		this.render(ctx, nowTime - this._lastTime);
		this._lastTime = nowTime;
	},
	/**
     * @function
	*/
	start:function(fps){
		var that = this;
		this.interval = setInterval(function(){
			that._tick();
		}, 1000/fps);
		this._lastTime = +new Date();
		that._tick();
	},
	/**
     * @function
	*/
	stop:function(){
		clearInterval(this.interval);
	},
	/**
     * @function
	*/
	resize:function(width, height){
		this.width = width;
		this.height = height;
		this.canvas.width = width;
		this.canvas.height = height;
	}
});


text:
The [node-couchbase](https://npmjs.org/package/couchbase) module is supported through the built-in
"couchbase" vault type. It supports sharding by creating hashes on strings that your `shard`
function may provide.

Alternatively, you can also use the [Memcached vault](../memcached/Readme.md) which is based on
[node-memcached](https://npmjs.org/package/memcached).

Read more on Couchbase at [couchbase.com](http://www.couchbase.com/couchbase-server/overview).

### Sharding

The Couchbase vault supports sharding. That is a great way to cluster user data onto a single
vbucket. You can implement this by giving your topic API a shard function, and returning a string or
number to shard on (called our hash-key). In many cases, this will be a user ID. This hash key may
not come from the data you are writing, because we need to be able to generate this value on-read as
well, before we have data in our hands.

Example:

```javascript
exports.user = {
	index: ['userId'],
	vaults: {
		couchbase: {
			shard: function (value) {
				return value.index.userId;
			}
		}
	}
};
```

### Flags

Couchbase allows one to set 4 bytes of meta information (flags) with each document that will be
returned when you retrieve it. People generally use these flags to store the data type. The
Couchbase vault does this too. Two flag styles have been implemented, and through configuration you
can switch between them.

The default flag style turns the file extension that goes with the media type into a binary 4-byte
representation. For example: `txt`, `json`, `tome`, `bin`.

There is an alternative flag style called `node-memcached`. Use this if you want to be compatible
with the Memcached vault.

### Switching between Memcached and Couchbase vaults

You can do this, but there are two limitations you must be aware of. Please ask your system
operators for advice. The two issues to take into account are the following.

#### Flag style

If you roll out this vault and you want to be able to switch to a memcached vault some time in the
future, you need to make sure you set `flagStyle` to `node-memcached`. If you do not do this, the
file types of your documents will not match up once you make the switch! The reason for this is that
we cannot control what the flags look like when using `node-memcached`, as it's built-in.

#### Sharding

The Couchbase vault supports sharding. That is a great way to cluster user data onto a single
vbucket. Please note however, that `node-memcached` using Moxi will not be able to apply the same
sharding logic. Once you start sharding, you cannot switch back to a Memcached vault.

### Configuration

```yaml
type: couchbase
config:
    options:
        user: Administrator         # optional, usually not required
        password: "password"        # optional, usually not required
        hosts: [ "localhost:8091" ] # optional
        bucket: default             # optional
    prefix: "prefix for all keys"   # eg: "bob/"
    flagStyle: default              # "default" or "node-memcached"
```

### Supported operations

operation | supported | implementation
----------|:---------:|---------------
list      |           |
get       | ✔         | `couchbase.get()`
add       | ✔         | `couchbase.add()`
set       | ✔         | `couchbase.set()`
touch     | ✔         | `couchbase.touch()`
del       | ✔         | `couchbase.remove()`

### Required Topic API

signature                             | required | default implementation
--------------------------------------|----------|-----------------------
`createKey(topic, index)`             |          | "topic/indexProp:indexValue/indexProp:indexValue/..." (index is sorted)
`shard(value)`                        |          | undefined
`createFlags(mediaType, flagStyle)`   |          | either `default` or `node-memcached` compatible style flag creation based on mediaType
`parseFlags(flags, flagStyle)`        |          | will turn both `default` and `node-memcached` style flags into a media type
`serialize(value)`                    |          | returns a `utf8` representation of `value.data`
`deserialize(data, mediaType, value)` |          | writes `data` and `mediaType` into `value`

### Views Migration

Archivist allows for [schema migrations](../../SchemaMigrations.md), and the Couchbase vault
supports this. This should however only be used to migrate document views.

Also as couchbase only allows for 20MB of data per key and as this feature stores all the version
data into a single key, please write short concise reports to avoid breaking that limit.


text:
.. _falcon-io:

========
IO space
========

.. contents::

Introduction
============

Every falcon engine has an associated IO space. The space consists of 32-bit IO
registers, and is accessible in two ways:

- host access by MMIO areas in BAR0
- falcon access by io* instructions

The IO space contains control registers for the microprocessor itself,
interrupt and timer setup, code/data space access ports, PFIFO communication
registers, as well as registers for the engine-specific hardware that falcon
is meant to control.

The addresses are different between falcon and host. From falcon POV, the IO space
is word-addressable 0x40000-byte space. However, most registers are duplicated
64 times: bits 2-7 of the address are ignored. The few registers that don't
ignore these bits are called "indexed" registers. From host POV, the falcon IO
space is a 0x1000-byte window in BAR0. Its base address is engine-dependent.
First 0xf00 bytes of this window are tied to the falcon IO space, while last 0x100
bytes contain several host-only registers. On G98:GF119, host mmio address
falcon_base + X is directed to falcon IO space address X << 6 | HOST_IO_INDEX << 2.
On GF119+, some engines stopped using the indexed accesses. On those,
host mmio address falcon_base + X is directed to falcon IO space address X.
HOST_IO_INDEX is specified in the host-only MMIO register falcon_base + 0xffc:

MMIO 0xffc: HOST_IO_INDEX
  bits 0-5: selects bits 2-7 of the falcon IO space when accessed from host.

Unaligned accesses to the IO space are unsupported, both from host and falcon.
Low 2 bits of addresses should be 0 at all times.

.. todo:: document v4 new addressing

.. _falcon-io-common:

Common IO register list
=======================

===== ======= ============ ================= ===========
Host  Falcon  Present on   Name              Description
===== ======= ============ ================= ===========
0x000 0x00000 all units    INTR_SET          :ref:`trigger interrupt <falcon-io-intr>`
0x004 0x00100 all units    INTR_CLEAR        :ref:`clear interrupt <falcon-io-intr>`
0x008 0x00200 all units    INTR              :ref:`interrupt status <falcon-io-intr>`
0x00c 0x00300 v3+ units    INTR_MODE         :ref:`interrupt edge/level <falcon-io-intr-mode>`
0x010 0x00400 all units    INTR_EN_SET       :ref:`interrupt enable set <falcon-io-intr-enable>`
0x014 0x00500 all units    INTR_EN_CLR       :ref:`interrupt enable clear <falcon-io-intr-enable>`
0x018 0x00600 all units    INTR_EN           :ref:`interrupt enable status <falcon-io-intr-enable>`
0x01c 0x00700 all units    INTR_DISPATCH     :ref:`interrupt routing <falcon-io-intr-route>`
0x020 0x00800 all units    PERIODIC_PERIOD   :ref:`periodic timer period <falcon-io-periodic>`
0x024 0x00900 all units    PERIODIC_TIME     :ref:`periodic timer counter <falcon-io-periodic>`
0x028 0x00a00 all units    PERIODIC_ENABLE   :ref:`periodic interrupt enable <falcon-io-periodic>`
0x02c 0x00b00 all units    TIME_LOW          :ref:`PTIMER time low <falcon-io-ptimer>`
0x030 0x00c00 all units    TIME_HIGH         :ref:`PTIMER time high <falcon-io-ptimer>`
0x034 0x00d00 all units    WATCHDOG_TIME     :ref:`watchdog timer counter <falcon-io-watchdog>`
0x038 0x00e00 all units    WATCHDOG_ENABLE   :ref:`watchdog interrupt enable <falcon-io-watchdog>`
0x040 0x01000 all units    SCRATCH0          :ref:`scratch register <falcon-io-scratch>`
0x044 0x01100 all units    SCRATCH1          :ref:`scratch register <falcon-io-scratch>`
0x048 0x01200 all units    FIFO_ENABLE       :ref:`PFIFO access enable <falcon-io-fifo-enable>`
0x04c 0x01300 all units    STATUS            busy/idle status        [falcon/io.txt]
0x050 0x01400 all units    CHANNEL_CUR       :ref:`current PFIFO channel <falcon-io-channel>`
0x054 0x01500 all units    CHANNEL_NEXT      :ref:`next PFIFO channel <falcon-io-channel>`
0x058 0x01600 all units    CHANNEL_CMD       :ref:`PFIFO channel control <falcon-io-channel>`
0x05c 0x01700 all units    STATUS_MASK       busy/idle status mask?  [falcon/io.txt]
0x060 0x01800 all units    ???               ???
0x064 0x01900 all units    FIFO_DATA         :ref:`FIFO command data <falcon-io-fifo>`
0x068 0x01a00 all units    FIFO_CMD          :ref:`FIFO command <falcon-io-fifo>`
0x06c 0x01b00 v4+ units    ???               :ref:`FIFO ??? <falcon-io-fifo>`
0x070 0x01c00 all units    FIFO_OCCUPIED     :ref:`FIFO commands available <falcon-io-fifo>`
0x074 0x01d00 all units    FIFO_ACK          :ref:`FIFO command ack <falcon-io-fifo>`
0x078 0x01e00 all units    FIFO_LIMIT        :ref:`FIFO size <falcon-io-fifo>`
0x07c 0x01f00 all units    SUBENGINE_RESET   reset subengines        [falcon/io.txt]
0x080 0x02000 all units    SCRATCH2          :ref:`scratch register <falcon-io-scratch>`
0x084 0x02100 all units    SCRATCH3          :ref:`scratch register <falcon-io-scratch>`
0x088 0x02200 all units    PM_TRIGGER        :ref:`perfmon triggers <falcon-io-perf-user>`
0x08c 0x02300 all units    PM_MODE           :ref:`perfmon signal mode <falcon-io-perf-user>`
0x090 0x02400 all units    ???               ???
0x094 0x02500 v3+ units    ???               ???
0x098 0x02600 v3+ units    BREAKPOINT[0]     :ref:`code breakpoint <falcon-io-breakpoint>`
0x09c 0x02700 v3+ units    BREAKPOINT[1]     :ref:`code breakpoint <falcon-io-breakpoint>`
0x0a0 0x02800 v3+ units    ???               ???
0x0a4 0x02900 v3+ units    ???               ???
0x0a8 0x02a00 v4+ units    PM_SEL            perfmon signal select   [falcon/perf.txt]
0x0ac 0x02b00 v4+ units    HOST_IO_INDEX     IO space index for host [falcon/io.txt] [XXX: doc]
0x100 0x04000 all units    UC_CTRL           microprocessor control  [falcon/proc.txt]
0x104 0x04100 all units    UC_ENTRY          microcode entry point   [falcon/proc.txt]
0x108 0x04200 all units    UC_CAPS           microprocessor caps     [falcon/proc.txt]
0x10c 0x04300 all units    UC_BLOCK_ON_FIFO  microprocessor block    [falcon/proc.txt]
0x110 0x04400 all units    XFER_EXT_BASE     :ref:`xfer external base <falcon-io-xfer>`
0x114 0x04500 all units    XFER_FALCON_ADDR  :ref:`xfer falcon address <falcon-io-xfer>`
0x118 0x04600 all units    XFER_CTRL         :ref:`xfer control <falcon-io-xfer>`
0x11c 0x04700 all units    XFER_EXT_ADDR     :ref:`xfer external offset <falcon-io-xfer>`
0x120 0x04800 all units    XFER_STATUS       :ref:`xfer status <falcon-io-xfer-status>`
0x124 0x04900 crypto units CX_STATUS         crypt xfer status       [falcon/crypt.txt]
0x128 0x04a00 v3+ units    UC_STATUS         microprocessor status   [falcon/proc.txt]
0x12c 0x04b00 v3+ units    UC_CAPS2          microprocessor caps     [falcon/proc.txt]
0x140 0x05000 v3+ units    TLB_CMD           :ref:`code VM command <falcon-io-tlb>`
0x144 0x05100 v3+ units    TLB_CMD_RES       :ref:`code VM command result <falcon-io-tlb>`
0x148 0x05200 v4+ units    ???               ???
0x14c 0x05300 v4+ units    ???               ???
0x150 0x05400 UNK31 units  ???               ???
0x154 0x05500 UNK31 units  ???               ???
0x158 0x05600 UNK31 units  ???               ???
0x160 0x05800 UAS units    UAS_IO_WINDOW     UAS I[] space window    [falcon/data.txt]
0x164 0x05900 UAS units    UAS_CONFIG        UAS configuration       [falcon/data.txt]
0x168 0x05a00 UAS units    UAS_FAULT_ADDR    UAS MMIO fault address  [falcon/data.txt]
0x16c 0x05b00 UAS units    UAS_FAULT_STATUS  UAS MMIO fault status   [falcon/data.txt]
0x180 0x06000 v3+ units    CODE_INDEX        :ref:`code access window addr <falcon-io-code>`
0x184 0x06100 v3+ units    CODE              :ref:`code access window <falcon-io-code>`
0x188 0x06200 v3+ units    CODE_VIRT_ADDR    :ref:`code access virt addr <falcon-io-code>`
0x1c0 0x07000 v3+ units    DATA_INDEX[0]     :ref:`data access window addr <falcon-io-data>`
0x1c4 0x07100 v3+ units    DATA[0]           :ref:`data access window <falcon-io-data>`
0x1c8 0x07200 v3+ units    DATA_INDEX[1]     :ref:`data access window addr <falcon-io-data>`
0x1cc 0x07300 v3+ units    DATA[1]           :ref:`data access window <falcon-io-data>`
0x1d0 0x07400 v3+ units    DATA_INDEX[2]     :ref:`data access window addr <falcon-io-data>`
0x1d4 0x07500 v3+ units    DATA[2]           :ref:`data access window <falcon-io-data>`
0x1d8 0x07600 v3+ units    DATA_INDEX[3]     :ref:`data access window addr <falcon-io-data>`
0x1dc 0x07700 v3+ units    DATA[3]           :ref:`data access window <falcon-io-data>`
0x1e0 0x07800 v3+ units    DATA_INDEX[4]     :ref:`data access window addr <falcon-io-data>`
0x1e4 0x07900 v3+ units    DATA[4]           :ref:`data access window <falcon-io-data>`
0x1e8 0x07a00 v3+ units    DATA_INDEX[5]     :ref:`data access window addr <falcon-io-data>`
0x1ec 0x07b00 v3+ units    DATA[5]           :ref:`data access window <falcon-io-data>`
0x1f0 0x07c00 v3+ units    DATA_INDEX[6]     :ref:`data access window addr <falcon-io-data>`
0x1f4 0x07d00 v3+ units    DATA[6]           :ref:`data access window <falcon-io-data>`
0x1f8 0x07e00 v3+ units    DATA_INDEX[7]     :ref:`data access window addr <falcon-io-data>`
0x1fc 0x07f00 v3+ units    DATA[7]           :ref:`data access window <falcon-io-data>`
0x200 0x08000 v4+ units    DEBUG_CMD         debuging command        [falcon/debug.txt]
0x204 0x08100 v4+ units    DEBUG_ADDR        address for DEBUG_CMD   [falcon/debug.txt]
0x208 0x08200 v4+ units    DEBUG_DATA_WR     debug data to write     [falcon/debug.txt]
0x20c 0x08300 v4+ units    DEBUG_DATA_RD     debug data last read    [falcon/debug.txt]
0xfe8 \-      GF100- v3    PM_SEL            perfmon signal select        [falcon/perf.txt]
0xfec \-      v0, v3       UC_SP             microprocessor $sp reg        [falcon/proc.txt]
0xff0 \-      v0, v3       UC_PC             microprocessor $pc reg        [falcon/proc.txt]
0xff4 \-      v0, v3       UPLOAD            :ref:`old code/data upload <falcon-io-upload>`
0xff8 \-      v0, v3       UPLOAD_ADDR       :ref:`old code/data up addr <falcon-io-upload>`
0xffc \-      v0, v3       HOST_IO_INDEX     IO space index for host        [falcon/io.txt]
===== ======= ============ ================= ===========

.. todo:: list incomplete for v4

Registers starting from 0x400/0x10000 are engine-specific and described in engine
documentation.

.. _falcon-io-scratch:

Scratch registers
=================

::

    MMIO 0x040 / I[0x01000]: SCRATCH0
    MMIO 0x044 / I[0x01100]: SCRATCH1
    MMIO 0x080 / I[0x02000]: SCRATCH2
    MMIO 0x084 / I[0x02100]: SCRATCH3
      Scratch 32-bit registers, meant for host <-> falcon communication.

.. _falcon-status:

Engine status and control registers
===================================

MMIO 0x04c / I[0x01300]: STATUS
  Status of various parts of the engine. For each bit, 1 means busy, 0 means
  idle.
  bit 0: UC. Microcode. 1 if microcode is running and not on a sleep insn.
  bit 1: ???
  Further bits are engine-specific.

MMIO 0x05c / I[0x01700]: STATUS_MASK
  A bitmask of nonexistent status bits. Each of bits 0-15 is set to 0 if
  corresponding STATUS line is tied to anything in this particular engine, 1
  if it's unused. [?]

.. todo:: clean. fix. write. move.

MMIO 0x07c / I[0x01f00]: SUBENGINE_RESET
  When written with value 1, resets all subengines that this falcon engine
  controls - that is, everything in IO space addresses 0x10000:0x20000. Note
  that this includes the memory interface - using this register while an xfer
  is in progress is ill-advised.

.. _falcon-io-upload:

v0 code/data upload registers
=============================

MMIO 0xff4: UPLOAD
  The data to upload, see below
MMIO 0xff8: UPLOAD_ADDR
  bits 2-15: bits 2-15 of the code/data address being uploaded.
  bit 20: target segment. 0 means data, 1 means code.
  bit 21: readback.
  bit 24: xfer busy [RO]
  bit 28: secret flag - secret engines only [see falcon/crypt.txt]
  bit 29: code busy [RO]

This pair of registers can be used on v0 to read/write code and data
segments. It's quite fragile and should only be used when no xfers are active.
bit 24 of UPLOAD_ADDR is set when this is the case. On v3+, this pair is
broken and should be avoided in favor of the new-style access via
:ref:`CODE <falcon-io-code>` and :ref:`DATA <falcon-io-data>` ports.

To write data, poke address to UPLOAD_ADDR, then poke the data words to
UPLOAD. The address will auto-increment as words are uploaded.

To read data or code, poke address + readback flag to UPLOAD_ADDR, then read
the word from UPLOAD. This only works for a single word, and you need to poke
UPLOAD_ADDR again for each subsequent word.

The code segment is organised in 0x100-byte pages. On secretful engines, each
page can be secret or not. Reading from secret pages doesn't work and you just
get 0. Writing code segment can only be done in aligned page units.

To write a code page, write start address of the page + secret flag [if
needed] to UPLOAD_ADDR, then poke multiple of 0x40 words to UPLOAD. The
address will autoincrement. The process cannot be interrupted except between
pages. The "code busy" flag in UPLOAD_ADDR will be lit when this is the case.

.. _falcon-isa-iowr:

IO space writes: iowr, iowrs
============================

Writes a word to IO space. iowr does asynchronous writes [queues the write,
but doesn't wait for completion], iowrs does synchronous write [write is
guaranteed to complete before executing next instruction]. On v0 cards,
iowrs doesn't exist and synchronisation can instead be done by re-reading
the relevant register.

Instructions:
    ===== ============================ ========== =========
    Name  Description                  Present on Subopcode
    ===== ============================ ========== =========
    iowr  Asynchronous IO space write  all units  0
    iowrs Synchronous IO space write   v3+ units  1
    ===== ============================ ========== =========
Instruction class:
    unsized
Operands:
    BASE, IDX, SRC
Forms:
    ========== =========
    Form       Subopcode
    ========== =========
    R2, I8, R1 d0
    R2, 0, R1  fa
    ========== =========
Immediates:
    zero-extended
Operation:
    ::

        if (op == iowr)
                IOWR(BASE + IDX * 4, SRC);
        else
                IOWRS(BASE + IDX * 4, SRC);

.. _falcon-isa-iord:

IO space reads: iord
====================

Reads a word from IO space.

Instructions:
    ===== ============================ ========== =========
    Name  Description                  Present on Subopcode
    ===== ============================ ========== =========
    ???   ???                          v3+ units  e
    iord  IO space read                all units  f
    ===== ============================ ========== =========
Instruction class:
    unsized
Operands:
    DST, BASE, IDX
Forms:
    ========== =========
    Form       Subopcode
    ========== =========
    R1, R2, I8 c0
    R3, R2, R1 ff
    ========== =========
Immediates:
    zero-extended
Operation:
    ::

        if (op == iord)
                DST = IORD(BASE + IDX * 4);
        else
                ???;

.. todo:: subop e


text:
namespace llvm {
using namespace object;

ErrorOr<ObjectFile *>
ObjectFile::createELFObjectFile(std::unique_ptr<MemoryBuffer> &Obj) {
  std::pair<unsigned char, unsigned char> Ident =
      getElfArchType(Obj->getBuffer());
  std::size_t MaxAlignment =
    1ULL << countTrailingZeros(uintptr_t(Obj->getBufferStart()));

  std::error_code EC;
  std::unique_ptr<ObjectFile> R;
  if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2LSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
    if (MaxAlignment >= 4)
      R.reset(new ELFObjectFile<ELFType<support::little, 4, false>>(
          std::move(Obj), EC));
    else
#endif
    if (MaxAlignment >= 2)
      R.reset(new ELFObjectFile<ELFType<support::little, 2, false>>(
          std::move(Obj), EC));
    else
      return object_error::parse_failed;
  else if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2MSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
    if (MaxAlignment >= 4)
      R.reset(new ELFObjectFile<ELFType<support::big, 4, false>>(std::move(Obj),
                                                                 EC));
    else
#endif
    if (MaxAlignment >= 2)
      R.reset(new ELFObjectFile<ELFType<support::big, 2, false>>(std::move(Obj),
                                                                 EC));
    else
      return object_error::parse_failed;
  else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2MSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
    if (MaxAlignment >= 8)
      R.reset(new ELFObjectFile<ELFType<support::big, 8, true>>(std::move(Obj),
                                                                EC));
    else
#endif
    if (MaxAlignment >= 2)
      R.reset(new ELFObjectFile<ELFType<support::big, 2, true>>(std::move(Obj),
                                                                EC));
    else
      return object_error::parse_failed;
  else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2LSB) {
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
    if (MaxAlignment >= 8)
      R.reset(new ELFObjectFile<ELFType<support::little, 8, true>>(
          std::move(Obj), EC));
    else
#endif
    if (MaxAlignment >= 2)
      R.reset(new ELFObjectFile<ELFType<support::little, 2, true>>(
          std::move(Obj), EC));
    else
      return object_error::parse_failed;
  }
  else
    llvm_unreachable("Buffer is not an ELF object file!");

  if (EC)
    return EC;
  return R.release();
}

} // end namespace llvm