text:
'use strict'

const EventEmitter = require('events')

function debounce (state, cb, debounceTime) {
  cb()
  clearTimeout(state.timer)
  state.timer = setTimeout(() => unregisterShortcuts(state), debounceTime)
}

function registerShortcuts (state) {
  if (!state.active) {
    state.emit('active')
    state.active = true
    Object.keys(state.shortcuts).forEach(keyCombo => {
      state.globalShortcut.register(`${keyCombo}`, () => debounce(state, state.shortcuts[keyCombo], state.debounceTime))
    })
  }
}

function unregisterShortcuts (state) {
  if (state.active) {
    state.emit('inactive')
    state.active = false
    Object.keys(state.shortcuts).forEach(keyCombo => {
      state.globalShortcut.unregister(keyCombo)
    })
  }
}

module.exports = function Shorty (globalShortcut, leader, debounceTime, cancelShortcut = 'Esc') {
  let state = {
    globalShortcut,
    leader,
    debounceTime,
    shortcuts: {},
    timer: null,
    active: false
  }
  globalShortcut.register(leader, () => registerShortcuts(state))
  globalShortcut.register(cancelShortcut, () => {
    clearTimeout(state.timer)
    unregisterShortcuts(state)
  })
  const emitter = new EventEmitter()
  const emitterMethods = Object.keys(EventEmitter.prototype).reduce((methods, key) => {
    if (typeof EventEmitter.prototype[key] === 'function') {
      methods[key] = emitter[key]
    }
    return methods
  }, {})
  return Object.assign(state, emitterMethods, {
    register: function (shortcut, cb) {
      state.shortcuts[shortcut] = cb
    },
    leader: function (newLeader) {
      globalShortcut.unregister(leader)
      globalShortcut.register(newLeader, () => registerShortcuts(state))
      state.leader = newLeader
    },
    debounceTimer: function (newTime) {
      state.debounceTime = newTime
    }
  })
}

redpajama_set_name: RedPajamaGithub


text:
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PatienLogType] (
		[PatientLogTypeID]           [int] NOT NULL,
		[PatientLogTypeName]         [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
		[PatientLogTypeDataType]     [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PatienLogType]
	ADD
	CONSTRAINT [PK_PatienLogType]
	PRIMARY KEY
	CLUSTERED
	([PatientLogTypeID])
	ON [PRIMARY]
GO
ALTER TABLE [dbo].[PatienLogType] SET (LOCK_ESCALATION = TABLE)
GO


text:
namespace blink {

namespace {

// TODO(mlamouri): refactor in one common place.
WebPresentationClient* presentationClient(ExecutionContext* executionContext) {
  ASSERT(executionContext && executionContext->isDocument());

  Document* document = toDocument(executionContext);
  if (!document->frame())
    return nullptr;
  PresentationController* controller =
      PresentationController::from(*document->frame());
  return controller ? controller->client() : nullptr;
}

const AtomicString& connectionStateToString(
    WebPresentationConnectionState state) {
  DEFINE_STATIC_LOCAL(const AtomicString, connectingValue, ("connecting"));
  DEFINE_STATIC_LOCAL(const AtomicString, connectedValue, ("connected"));
  DEFINE_STATIC_LOCAL(const AtomicString, closedValue, ("closed"));
  DEFINE_STATIC_LOCAL(const AtomicString, terminatedValue, ("terminated"));

  switch (state) {
    case WebPresentationConnectionState::Connecting:
      return connectingValue;
    case WebPresentationConnectionState::Connected:
      return connectedValue;
    case WebPresentationConnectionState::Closed:
      return closedValue;
    case WebPresentationConnectionState::Terminated:
      return terminatedValue;
  }

  ASSERT_NOT_REACHED();
  return terminatedValue;
}

const AtomicString& connectionCloseReasonToString(
    WebPresentationConnectionCloseReason reason) {
  DEFINE_STATIC_LOCAL(const AtomicString, errorValue, ("error"));
  DEFINE_STATIC_LOCAL(const AtomicString, closedValue, ("closed"));
  DEFINE_STATIC_LOCAL(const AtomicString, wentAwayValue, ("wentaway"));

  switch (reason) {
    case WebPresentationConnectionCloseReason::Error:
      return errorValue;
    case WebPresentationConnectionCloseReason::Closed:
      return closedValue;
    case WebPresentationConnectionCloseReason::WentAway:
      return wentAwayValue;
  }

  ASSERT_NOT_REACHED();
  return errorValue;
}

void throwPresentationDisconnectedError(ExceptionState& exceptionState) {
  exceptionState.throwDOMException(InvalidStateError,
                                   "Presentation connection is disconnected.");
}

}  // namespace

class PresentationConnection::Message final
    : public GarbageCollectedFinalized<PresentationConnection::Message> {
 public:
  Message(const String& text) : type(MessageTypeText), text(text) {}

  Message(DOMArrayBuffer* arrayBuffer)
      : type(MessageTypeArrayBuffer), arrayBuffer(arrayBuffer) {}

  Message(PassRefPtr<BlobDataHandle> blobDataHandle)
      : type(MessageTypeBlob), blobDataHandle(blobDataHandle) {}

  DEFINE_INLINE_TRACE() { visitor->trace(arrayBuffer); }

  MessageType type;
  String text;
  Member<DOMArrayBuffer> arrayBuffer;
  RefPtr<BlobDataHandle> blobDataHandle;
};

class PresentationConnection::BlobLoader final
    : public GarbageCollectedFinalized<PresentationConnection::BlobLoader>,
      public FileReaderLoaderClient {
 public:
  BlobLoader(PassRefPtr<BlobDataHandle> blobDataHandle,
             PresentationConnection* PresentationConnection)
      : m_PresentationConnection(PresentationConnection),
        m_loader(FileReaderLoader::create(FileReaderLoader::ReadAsArrayBuffer,
                                          this)) {
    m_loader->start(m_PresentationConnection->getExecutionContext(),
                    std::move(blobDataHandle));
  }
  ~BlobLoader() override {}

  // FileReaderLoaderClient functions.
  void didStartLoading() override {}
  void didReceiveData() override {}
  void didFinishLoading() override {
    m_PresentationConnection->didFinishLoadingBlob(
        m_loader->arrayBufferResult());
  }
  void didFail(FileError::ErrorCode errorCode) override {
    m_PresentationConnection->didFailLoadingBlob(errorCode);
  }

  void cancel() { m_loader->cancel(); }

  DEFINE_INLINE_TRACE() { visitor->trace(m_PresentationConnection); }

 private:
  Member<PresentationConnection> m_PresentationConnection;
  std::unique_ptr<FileReaderLoader> m_loader;
};

PresentationConnection::PresentationConnection(LocalFrame* frame,
                                               const String& id,
                                               const KURL& url)
    : DOMWindowProperty(frame),
      m_id(id),
      m_url(url),
      m_state(WebPresentationConnectionState::Connecting),
      m_binaryType(BinaryTypeBlob) {}

PresentationConnection::~PresentationConnection() {
  ASSERT(!m_blobLoader);
}

// static
PresentationConnection* PresentationConnection::take(
    ScriptPromiseResolver* resolver,
    std::unique_ptr<WebPresentationConnectionClient> client,
    PresentationRequest* request) {
  ASSERT(resolver);
  ASSERT(client);
  ASSERT(request);
  ASSERT(resolver->getExecutionContext()->isDocument());

  Document* document = toDocument(resolver->getExecutionContext());
  if (!document->frame())
    return nullptr;

  PresentationController* controller =
      PresentationController::from(*document->frame());
  if (!controller)
    return nullptr;

  return take(controller, std::move(client), request);
}

// static
PresentationConnection* PresentationConnection::take(
    PresentationController* controller,
    std::unique_ptr<WebPresentationConnectionClient> client,
    PresentationRequest* request) {
  ASSERT(controller);
  ASSERT(request);

  PresentationConnection* connection = new PresentationConnection(
      controller->frame(), client->getId(), client->getUrl());
  controller->registerConnection(connection);
  request->dispatchEvent(PresentationConnectionAvailableEvent::create(
      EventTypeNames::connectionavailable, connection));

  return connection;
}

// static
PresentationConnection* PresentationConnection::take(
    PresentationReceiver* receiver,
    std::unique_ptr<WebPresentationConnectionClient> client) {
  DCHECK(receiver);
  DCHECK(client);

  PresentationConnection* connection = new PresentationConnection(
      receiver->frame(), client->getId(), client->getUrl());
  receiver->registerConnection(connection);

  return connection;
}

const AtomicString& PresentationConnection::interfaceName() const {
  return EventTargetNames::PresentationConnection;
}

ExecutionContext* PresentationConnection::getExecutionContext() const {
  if (!frame())
    return nullptr;
  return frame()->document();
}

void PresentationConnection::addedEventListener(
    const AtomicString& eventType,
    RegisteredEventListener& registeredListener) {
  EventTargetWithInlineData::addedEventListener(eventType, registeredListener);
  if (eventType == EventTypeNames::connect)
    UseCounter::count(getExecutionContext(),
                      UseCounter::PresentationConnectionConnectEventListener);
  else if (eventType == EventTypeNames::close)
    UseCounter::count(getExecutionContext(),
                      UseCounter::PresentationConnectionCloseEventListener);
  else if (eventType == EventTypeNames::terminate)
    UseCounter::count(getExecutionContext(),
                      UseCounter::PresentationConnectionTerminateEventListener);
  else if (eventType == EventTypeNames::message)
    UseCounter::count(getExecutionContext(),
                      UseCounter::PresentationConnectionMessageEventListener);
}

DEFINE_TRACE(PresentationConnection) {
  visitor->trace(m_blobLoader);
  visitor->trace(m_messages);
  EventTargetWithInlineData::trace(visitor);
  DOMWindowProperty::trace(visitor);
}

const AtomicString& PresentationConnection::state() const {
  return connectionStateToString(m_state);
}

void PresentationConnection::send(const String& message,
                                  ExceptionState& exceptionState) {
  if (!canSendMessage(exceptionState))
    return;

  m_messages.append(new Message(message));
  handleMessageQueue();
}

void PresentationConnection::send(DOMArrayBuffer* arrayBuffer,
                                  ExceptionState& exceptionState) {
  ASSERT(arrayBuffer && arrayBuffer->buffer());
  if (!canSendMessage(exceptionState))
    return;

  m_messages.append(new Message(arrayBuffer));
  handleMessageQueue();
}

void PresentationConnection::send(DOMArrayBufferView* arrayBufferView,
                                  ExceptionState& exceptionState) {
  ASSERT(arrayBufferView);
  if (!canSendMessage(exceptionState))
    return;

  m_messages.append(new Message(arrayBufferView->buffer()));
  handleMessageQueue();
}

void PresentationConnection::send(Blob* data, ExceptionState& exceptionState) {
  ASSERT(data);
  if (!canSendMessage(exceptionState))
    return;

  m_messages.append(new Message(data->blobDataHandle()));
  handleMessageQueue();
}

bool PresentationConnection::canSendMessage(ExceptionState& exceptionState) {
  if (m_state != WebPresentationConnectionState::Connected) {
    throwPresentationDisconnectedError(exceptionState);
    return false;
  }

  // The connection can send a message if there is a client available.
  return !!presentationClient(getExecutionContext());
}

void PresentationConnection::handleMessageQueue() {
  WebPresentationClient* client = presentationClient(getExecutionContext());
  if (!client)
    return;

  while (!m_messages.isEmpty() && !m_blobLoader) {
    Message* message = m_messages.first().get();
    switch (message->type) {
      case MessageTypeText:
        client->sendString(m_url, m_id, message->text);
        m_messages.removeFirst();
        break;
      case MessageTypeArrayBuffer:
        client->sendArrayBuffer(m_url, m_id, static_cast<const uint8_t*>(
                                                 message->arrayBuffer->data()),
                                message->arrayBuffer->byteLength());
        m_messages.removeFirst();
        break;
      case MessageTypeBlob:
        ASSERT(!m_blobLoader);
        m_blobLoader = new BlobLoader(message->blobDataHandle, this);
        break;
    }
  }
}

String PresentationConnection::binaryType() const {
  switch (m_binaryType) {
    case BinaryTypeBlob:
      return "blob";
    case BinaryTypeArrayBuffer:
      return "arraybuffer";
  }
  ASSERT_NOT_REACHED();
  return String();
}

void PresentationConnection::setBinaryType(const String& binaryType) {
  if (binaryType == "blob") {
    m_binaryType = BinaryTypeBlob;
    return;
  }
  if (binaryType == "arraybuffer") {
    m_binaryType = BinaryTypeArrayBuffer;
    return;
  }
  ASSERT_NOT_REACHED();
}

void PresentationConnection::didReceiveTextMessage(const String& message) {
  if (m_state != WebPresentationConnectionState::Connected)
    return;

  dispatchEvent(MessageEvent::create(message));
}

void PresentationConnection::didReceiveBinaryMessage(const uint8_t* data,
                                                     size_t length) {
  if (m_state != WebPresentationConnectionState::Connected)
    return;

  switch (m_binaryType) {
    case BinaryTypeBlob: {
      std::unique_ptr<BlobData> blobData = BlobData::create();
      blobData->appendBytes(data, length);
      Blob* blob =
          Blob::create(BlobDataHandle::create(std::move(blobData), length));
      dispatchEvent(MessageEvent::create(blob));
      return;
    }
    case BinaryTypeArrayBuffer:
      DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, length);
      dispatchEvent(MessageEvent::create(buffer));
      return;
  }
  ASSERT_NOT_REACHED();
}

void PresentationConnection::close() {
  if (m_state != WebPresentationConnectionState::Connecting &&
      m_state != WebPresentationConnectionState::Connected) {
    return;
  }
  WebPresentationClient* client = presentationClient(getExecutionContext());
  if (client)
    client->closeSession(m_url, m_id);

  tearDown();
}

void PresentationConnection::terminate() {
  if (m_state != WebPresentationConnectionState::Connected)
    return;
  WebPresentationClient* client = presentationClient(getExecutionContext());
  if (client)
    client->terminateSession(m_url, m_id);

  tearDown();
}

bool PresentationConnection::matches(
    WebPresentationConnectionClient* client) const {
  return client && m_url == KURL(client->getUrl()) &&
         m_id == static_cast<String>(client->getId());
}

void PresentationConnection::didChangeState(
    WebPresentationConnectionState state) {
  if (m_state == state)
    return;

  m_state = state;
  switch (m_state) {
    case WebPresentationConnectionState::Connecting:
      NOTREACHED();
      return;
    case WebPresentationConnectionState::Connected:
      dispatchEvent(Event::create(EventTypeNames::connect));
      return;
    case WebPresentationConnectionState::Terminated:
      dispatchEvent(Event::create(EventTypeNames::terminate));
      return;
    // Closed state is handled in |didClose()|.
    case WebPresentationConnectionState::Closed:
      NOTREACHED();
      return;
  }
  NOTREACHED();
}

void PresentationConnection::didClose(
    WebPresentationConnectionCloseReason reason,
    const String& message) {
  if (m_state == WebPresentationConnectionState::Closed)
    return;

  m_state = WebPresentationConnectionState::Closed;
  dispatchEvent(PresentationConnectionCloseEvent::create(
      EventTypeNames::close, connectionCloseReasonToString(reason), message));
}

void PresentationConnection::didFinishLoadingBlob(DOMArrayBuffer* buffer) {
  ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
  ASSERT(buffer && buffer->buffer());
  // Send the loaded blob immediately here and continue processing the queue.
  WebPresentationClient* client = presentationClient(getExecutionContext());
  if (client)
    client->sendBlobData(m_url, m_id,
                         static_cast<const uint8_t*>(buffer->data()),
                         buffer->byteLength());

  m_messages.removeFirst();
  m_blobLoader.clear();
  handleMessageQueue();
}

void PresentationConnection::didFailLoadingBlob(
    FileError::ErrorCode errorCode) {
  ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
  // FIXME: generate error message?
  // Ignore the current failed blob item and continue with next items.
  m_messages.removeFirst();
  m_blobLoader.clear();
  handleMessageQueue();
}

void PresentationConnection::tearDown() {
  // Cancel current Blob loading if any.
  if (m_blobLoader) {
    m_blobLoader->cancel();
    m_blobLoader.clear();
  }
  m_messages.clear();
}

}  // namespace blink


text:
namespace clang {
namespace tidy {
namespace cppcoreguidelines {

/// Checks for classes where some, but not all, of the special member functions
/// are defined.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-special-member-functions.html
class SpecialMemberFunctionsCheck : public ClangTidyCheck {
public:
  SpecialMemberFunctionsCheck(StringRef Name, ClangTidyContext *Context);
  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  void onEndOfTranslationUnit() override;

  enum class SpecialMemberFunctionKind : uint8_t {
    Destructor,
    DefaultDestructor,
    NonDefaultDestructor,
    CopyConstructor,
    CopyAssignment,
    MoveConstructor,
    MoveAssignment
  };

  using ClassDefId = std::pair<SourceLocation, std::string>;

  using ClassDefiningSpecialMembersMap =
      llvm::DenseMap<ClassDefId,
                     llvm::SmallVector<SpecialMemberFunctionKind, 5>>;

private:
  void checkForMissingMembers(
      const ClassDefId &ID,
      llvm::ArrayRef<SpecialMemberFunctionKind> DefinedSpecialMembers);

  const bool AllowMissingMoveFunctions;
  const bool AllowSoleDefaultDtor;
  ClassDefiningSpecialMembersMap ClassWithSpecialMembers;
};

} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

namespace llvm {
/// Specialisation of DenseMapInfo to allow ClassDefId objects in DenseMaps
/// FIXME: Move this to the corresponding cpp file as is done for
/// clang-tidy/readability/IdentifierNamingCheck.cpp.
template <>
struct DenseMapInfo<
    clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId> {
  using ClassDefId =
      clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId;

  static inline ClassDefId getEmptyKey() {
    return ClassDefId(
        clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-1)),
        "EMPTY");
  }

  static inline ClassDefId getTombstoneKey() {
    return ClassDefId(
        clang::SourceLocation::getFromRawEncoding(static_cast<unsigned>(-2)),
        "TOMBSTONE");
  }

  static unsigned getHashValue(ClassDefId Val) {
    assert(Val != getEmptyKey() && "Cannot hash the empty key!");
    assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");

    std::hash<ClassDefId::second_type> SecondHash;
    return Val.first.getRawEncoding() + SecondHash(Val.second);
  }

  static bool isEqual(const ClassDefId &LHS, const ClassDefId &RHS) {
    if (RHS == getEmptyKey())
      return LHS == getEmptyKey();
    if (RHS == getTombstoneKey())
      return LHS == getTombstoneKey();
    return LHS == RHS;
  }
};

} // namespace llvm

#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_SPECIAL_MEMBER_FUNCTIONS_H


text:
package org.hl7.fhir.instance.model;

// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0

import java.util.*;

import org.hl7.fhir.instance.model.annotations.ResourceDef;
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.api.*;
/**
 * Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification.
 */
@ResourceDef(name="Basic", profile="http://hl7.org/fhir/Profile/Basic")
public class Basic extends DomainResource {

    /**
     * Identifier assigned to the resource for business purposes, outside the context of FHIR.
     */
    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED)
    @Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the resource for business purposes, outside the context of FHIR." )
    protected List<Identifier> identifier;

    /**
     * Identifies the 'type' of resource - equivalent to the resource name for other resources.
     */
    @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1)
    @Description(shortDefinition="Kind of Resource", formalDefinition="Identifies the 'type' of resource - equivalent to the resource name for other resources." )
    protected CodeableConcept code;

    /**
     * Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.
     */
    @Child(name = "subject", type = {}, order=2, min=0, max=1)
    @Description(shortDefinition="Identifies the focus of this resource", formalDefinition="Identifies the patient, practitioner, device or any other resource that is the 'focus' of this resoruce." )
    protected Reference subject;

    /**
     * The actual object that is the target of the reference (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
     */
    protected Resource subjectTarget;

    /**
     * Indicates who was responsible for creating the resource instance.
     */
    @Child(name = "author", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1)
    @Description(shortDefinition="Who created", formalDefinition="Indicates who was responsible for creating the resource instance." )
    protected Reference author;

    /**
     * The actual object that is the target of the reference (Indicates who was responsible for creating the resource instance.)
     */
    protected Resource authorTarget;

    /**
     * Identifies when the resource was first created.
     */
    @Child(name = "created", type = {DateType.class}, order=4, min=0, max=1)
    @Description(shortDefinition="When created", formalDefinition="Identifies when the resource was first created." )
    protected DateType created;

    private static final long serialVersionUID = 916539354L;

  /*
   * Constructor
   */
    public Basic() {
      super();
    }

  /*
   * Constructor
   */
    public Basic(CodeableConcept code) {
      super();
      this.code = code;
    }

    /**
     * @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
     */
    public List<Identifier> getIdentifier() {
      if (this.identifier == null)
        this.identifier = new ArrayList<Identifier>();
      return this.identifier;
    }

    public boolean hasIdentifier() {
      if (this.identifier == null)
        return false;
      for (Identifier item : this.identifier)
        if (!item.isEmpty())
          return true;
      return false;
    }

    /**
     * @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
     */
    // syntactic sugar
    public Identifier addIdentifier() { //3
      Identifier t = new Identifier();
      if (this.identifier == null)
        this.identifier = new ArrayList<Identifier>();
      this.identifier.add(t);
      return t;
    }

    // syntactic sugar
    public Basic addIdentifier(Identifier t) { //3
      if (t == null)
        return this;
      if (this.identifier == null)
        this.identifier = new ArrayList<Identifier>();
      this.identifier.add(t);
      return this;
    }

    /**
     * @return {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.)
     */
    public CodeableConcept getCode() {
      if (this.code == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create Basic.code");
        else if (Configuration.doAutoCreate())
          this.code = new CodeableConcept(); // cc
      return this.code;
    }

    public boolean hasCode() {
      return this.code != null && !this.code.isEmpty();
    }

    /**
     * @param value {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.)
     */
    public Basic setCode(CodeableConcept value) {
      this.code = value;
      return this;
    }

    /**
     * @return {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
     */
    public Reference getSubject() {
      if (this.subject == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create Basic.subject");
        else if (Configuration.doAutoCreate())
          this.subject = new Reference(); // cc
      return this.subject;
    }

    public boolean hasSubject() {
      return this.subject != null && !this.subject.isEmpty();
    }

    /**
     * @param value {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
     */
    public Basic setSubject(Reference value) {
      this.subject = value;
      return this;
    }

    /**
     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
     */
    public Resource getSubjectTarget() {
      return this.subjectTarget;
    }

    /**
     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
     */
    public Basic setSubjectTarget(Resource value) {
      this.subjectTarget = value;
      return this;
    }

    /**
     * @return {@link #author} (Indicates who was responsible for creating the resource instance.)
     */
    public Reference getAuthor() {
      if (this.author == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create Basic.author");
        else if (Configuration.doAutoCreate())
          this.author = new Reference(); // cc
      return this.author;
    }

    public boolean hasAuthor() {
      return this.author != null && !this.author.isEmpty();
    }

    /**
     * @param value {@link #author} (Indicates who was responsible for creating the resource instance.)
     */
    public Basic setAuthor(Reference value) {
      this.author = value;
      return this;
    }

    /**
     * @return {@link #author} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates who was responsible for creating the resource instance.)
     */
    public Resource getAuthorTarget() {
      return this.authorTarget;
    }

    /**
     * @param value {@link #author} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates who was responsible for creating the resource instance.)
     */
    public Basic setAuthorTarget(Resource value) {
      this.authorTarget = value;
      return this;
    }

    /**
     * @return {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
     */
    public DateType getCreatedElement() {
      if (this.created == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create Basic.created");
        else if (Configuration.doAutoCreate())
          this.created = new DateType(); // bb
      return this.created;
    }

    public boolean hasCreatedElement() {
      return this.created != null && !this.created.isEmpty();
    }

    public boolean hasCreated() {
      return this.created != null && !this.created.isEmpty();
    }

    /**
     * @param value {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
     */
    public Basic setCreatedElement(DateType value) {
      this.created = value;
      return this;
    }

    /**
     * @return Identifies when the resource was first created.
     */
    public Date getCreated() {
      return this.created == null ? null : this.created.getValue();
    }

    /**
     * @param value Identifies when the resource was first created.
     */
    public Basic setCreated(Date value) {
      if (value == null)
        this.created = null;
      else {
        if (this.created == null)
          this.created = new DateType();
        this.created.setValue(value);
      }
      return this;
    }

      protected void listChildren(List<Property> childrenList) {
        super.listChildren(childrenList);
        childrenList.add(new Property("identifier", "Identifier", "Identifier assigned to the resource for business purposes, outside the context of FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier));
        childrenList.add(new Property("code", "CodeableConcept", "Identifies the 'type' of resource - equivalent to the resource name for other resources.", 0, java.lang.Integer.MAX_VALUE, code));
        childrenList.add(new Property("subject", "Reference(Any)", "Identifies the patient, practitioner, device or any other resource that is the 'focus' of this resoruce.", 0, java.lang.Integer.MAX_VALUE, subject));
        childrenList.add(new Property("author", "Reference(Practitioner|Patient|RelatedPerson)", "Indicates who was responsible for creating the resource instance.", 0, java.lang.Integer.MAX_VALUE, author));
        childrenList.add(new Property("created", "date", "Identifies when the resource was first created.", 0, java.lang.Integer.MAX_VALUE, created));
      }

      public Basic copy() {
        Basic dst = new Basic();
        copyValues(dst);
        if (identifier != null) {
          dst.identifier = new ArrayList<Identifier>();
          for (Identifier i : identifier)
            dst.identifier.add(i.copy());
        };
        dst.code = code == null ? null : code.copy();
        dst.subject = subject == null ? null : subject.copy();
        dst.author = author == null ? null : author.copy();
        dst.created = created == null ? null : created.copy();
        return dst;
      }

      protected Basic typedCopy() {
        return copy();
      }

      @Override
      public boolean equalsDeep(Base other) {
        if (!super.equalsDeep(other))
          return false;
        if (!(other instanceof Basic))
          return false;
        Basic o = (Basic) other;
        return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
           && compareDeep(author, o.author, true) && compareDeep(created, o.created, true);
      }

      @Override
      public boolean equalsShallow(Base other) {
        if (!super.equalsShallow(other))
          return false;
        if (!(other instanceof Basic))
          return false;
        Basic o = (Basic) other;
        return compareValues(created, o.created, true);
      }

      public boolean isEmpty() {
        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (code == null || code.isEmpty())
           && (subject == null || subject.isEmpty()) && (author == null || author.isEmpty()) && (created == null || created.isEmpty())
          ;
      }

  @Override
  public ResourceType getResourceType() {
    return ResourceType.Basic;
   }

  @SearchParamDefinition(name="code", path="Basic.code", description="Kind of Resource", type="token" )
  public static final String SP_CODE = "code";
  @SearchParamDefinition(name="subject", path="Basic.subject", description="Identifies the focus of this resource", type="reference" )
  public static final String SP_SUBJECT = "subject";
  @SearchParamDefinition(name="created", path="Basic.created", description="When created", type="date" )
  public static final String SP_CREATED = "created";
  @SearchParamDefinition(name="patient", path="Basic.subject", description="Identifies the focus of this resource", type="reference" )
  public static final String SP_PATIENT = "patient";
  @SearchParamDefinition(name="author", path="Basic.author", description="Who created", type="reference" )
  public static final String SP_AUTHOR = "author";

}


text:
require 'api/spec_helper'
require 'date'

describe Adyen::API::RecurringService do
  include APISpecHelper

  before do
    @params = {
      :reference => 'order-id',
      :amount => {
        :currency => 'EUR',
        :value => '1234',
      },
      :shopper => {
        :email => 's.hopper@example.com',
        :reference => 'user-id',
        :ip => '61.294.12.12',
        :statement => 'invoice number 123456'
      },
      :card => {
        :expiry_month => 12,
        :expiry_year => 2012,
        :holder_name => 'Simon わくわく Hopper',
        :number => '4444333322221111',
        :cvc => '737',
        # Maestro UK/Solo only
        #:issue_number => ,
        #:start_month => ,
        #:start_year => ,
      },
      # German's Direct Debit (Elektronisches Lastschriftverfahren)
      :elv => {
        :holder_name      => 'Simon わくわく Hopper',
        :number           => '1234567890',
        :bank_location    => 'Berlin',
        :bank_location_id => '12345678',
        :bank_name        => 'TestBank',
      }
    }
    @recurring = @object = Adyen::API::RecurringService.new(@params)
  end

  describe_request_body_of :list, '//recurring:listRecurringDetails/recurring:request' do
    it_should_validate_request_parameters :merchant_account,
                                          :shopper => [:reference]

    it "includes the merchant account handle" do
      text('./recurring:merchantAccount').should == 'SuperShopper'
    end

    it "includes the shopper's reference" do
      text('./recurring:shopperReference').should == 'user-id'
    end

    it "includes the type of contract, which is always `RECURRING'" do
      text('./recurring:recurring/payment:contract').should == 'RECURRING'
    end
  end

  describe_response_from :list, LIST_RESPONSE, 'listRecurringDetails' do
    it_should_return_params_for_each_xml_backend({
      :creation_date => DateTime.parse('2009-10-27T11:26:22.203+01:00'),
      :last_known_shopper_email => 's.hopper@example.com',
      :shopper_reference => 'user-id',
      :details => [
        {
          :card => {
            :expiry_date => Date.new(2012, 12, 31),
            :holder_name => 'S. Hopper',
            :number => '1111'
          },
          :recurring_detail_reference => 'RecurringDetailReference1',
          :variant => 'mc',
          :creation_date => DateTime.parse('2009-10-27T11:50:12.178+01:00')
        },
        {
          :bank => {
            :number => '123456789',
            :bank_location_id => 'bank-location-id',
            :bank_name => 'AnyBank',
            :bic => 'BBBBCCLLbbb',
            :country_code => 'NL',
            :iban => 'NL69PSTB0001234567',
            :holder_name => 'S. Hopper'
          },
          :recurring_detail_reference => 'RecurringDetailReference2',
          :variant => 'IDEAL',
          :creation_date => DateTime.parse('2009-10-27T11:26:22.216+01:00')
        },
        {
          :elv => {
            :holder_name      => 'S. Hopper',
            :number           => '1234567890',
            :bank_location    => 'Berlin',
            :bank_location_id => '12345678',
            :bank_name        => 'TestBank',
          },
          :recurring_detail_reference => 'RecurringDetailReference3',
          :variant => 'elv',
          :creation_date => DateTime.parse('2009-10-27T11:26:22.216+01:00')
        }
      ],
    })

    it "returns an array with just the detail references" do
      @response.references.should == %w{ RecurringDetailReference1 RecurringDetailReference2 RecurringDetailReference3 }
    end
  end

  describe_response_from :list, LIST_EMPTY_RESPONSE, 'listRecurringDetails' do
    it "returns an empty hash when there are no details" do
      @recurring.list.params.should == {}
    end

    it "returns an empty array when there are no references" do
      @response.references.should == []
    end
  end

  describe_request_body_of :disable, '//recurring:disable/recurring:request' do
    it_should_validate_request_parameters :merchant_account,
                                          :shopper => [:reference]

    it "includes the merchant account handle" do
      text('./recurring:merchantAccount').should == 'SuperShopper'
    end

    it "includes the shopper's reference" do
      text('./recurring:shopperReference').should == 'user-id'
    end

    it "includes the shopper's recurring detail reference if it is given" do
      xpath('./recurring:recurringDetailReference').should be_empty
      @recurring.params[:recurring_detail_reference] = 'RecurringDetailReference1'
      text('./recurring:recurringDetailReference').should == 'RecurringDetailReference1'
    end
  end

  describe_response_from :disable, (DISABLE_RESPONSE % '[detail-successfully-disabled]'), 'disable' do
    it "returns whether or not it was disabled" do
      @response.should be_success
      @response.should be_disabled

      stub_net_http(DISABLE_RESPONSE % '[all-details-successfully-disabled]')
      @response = @recurring.disable
      @response.should be_success
      @response.should be_disabled
    end

    it_should_return_params_for_each_xml_backend(:response => '[detail-successfully-disabled]')
  end

  describe_request_body_of :store_token, '//recurring:storeToken/recurring:request' do
    it_should_validate_request_parameters :merchant_account,
                                          :shopper => [:email, :reference]

    it "includes the merchant account handle" do
      text('./recurring:merchantAccount').should == 'SuperShopper'
    end

    it "includes the shopper's reference" do
      text('./recurring:shopperReference').should == 'user-id'
    end

    it "includes the shopper's email" do
      text('./recurring:shopperEmail').should == 's.hopper@example.com'
    end

    it "includes the creditcard details" do
      xpath('./recurring:card') do |card|
        # there's no reason why Nokogiri should escape these characters, but as long as they're correct
        card.text('./payment:holderName').should == 'Simon わくわく Hopper'
        card.text('./payment:number').should == '4444333322221111'
        card.text('./payment:cvc').should == '737'
        card.text('./payment:expiryMonth').should == '12'
        card.text('./payment:expiryYear').should == '2012'
      end
    end

    it "formats the creditcard's expiry month as a two digit number" do
      @recurring.params[:card][:expiry_month] = 6
      text('./recurring:card/payment:expiryMonth').should == '06'
    end

    it "includes the necessary recurring and one-click contract info if the `:recurring' param is truthful" do
      text('./recurring:recurring/payment:contract').should == 'RECURRING'
    end
  end

  describe_request_body_of :store_token, '//recurring:storeToken/recurring:request' do
    it_should_validate_request_parameters :merchant_account,
                                          :shopper => [:email, :reference]

    it "includes the merchant account handle" do
      text('./recurring:merchantAccount').should == 'SuperShopper'
    end

    it "includes the shopper's reference" do
      text('./recurring:shopperReference').should == 'user-id'
    end

    it "includes the shopper's email" do
      text('./recurring:shopperEmail').should == 's.hopper@example.com'
    end

    it "includes the ELV details" do
      xpath('./recurring:elv') do |elv|
        # there's no reason why Nokogiri should escape these characters, but as long as they're correct
        elv.text('./payment:accountHolderName').should == 'Simon わくわく Hopper'
        elv.text('./payment:bankAccountNumber').should == '1234567890'
        elv.text('./payment:bankLocation').should == 'Berlin'
        elv.text('./payment:bankLocationId').should == '12345678'
        elv.text('./payment:bankName').should == 'TestBank'
      end
    end

    it "includes the necessary recurring and one-click contract info if the `:recurring' param is truthful" do
      text('./recurring:recurring/payment:contract').should == 'RECURRING'
    end
  end

  describe_response_from :disable, (DISABLE_RESPONSE % '[detail-successfully-disabled]'), 'disable' do
    it "returns whether or not it was disabled" do
      @response.should be_success
      @response.should be_disabled

      stub_net_http(DISABLE_RESPONSE % '[all-details-successfully-disabled]')
      @response = @recurring.disable
      @response.should be_success
      @response.should be_disabled
    end

    it_should_return_params_for_each_xml_backend(:response => '[detail-successfully-disabled]')
  end
end


text:
package org.killbill.billing.plugin.ingenico.api;

import java.util.UUID;

import org.killbill.billing.plugin.api.payment.PluginPaymentMethodInfoPlugin;
import org.killbill.billing.plugin.ingenico.dao.IngenicoDao;
import org.killbill.billing.plugin.ingenico.dao.gen.tables.records.IngenicoPaymentMethodsRecord;

public class IngenicoPaymentMethodInfoPlugin extends PluginPaymentMethodInfoPlugin {

    public IngenicoPaymentMethodInfoPlugin(final IngenicoPaymentMethodsRecord record) {
        super(UUID.fromString(record.getKbAccountId()),
              UUID.fromString(record.getKbPaymentMethodId()),
              record.getIsDefault() == IngenicoDao.TRUE,
              record.getToken());
    }
}


text:
My first page
======
**4press** is A simple static blog framework, powered by Node.js.


text:
module Analyze.Ops
  ( oneHot
  ) where

import           Analyze.Common      (Data)
import           Analyze.RFrame      (RFrame (..), RFrameUpdate (..), col, splitCols, update)
import           Control.Monad.Catch (MonadThrow (..))
import qualified Data.HashSet        as HS
import           Data.Vector         (Vector)
import qualified Data.Vector         as V

uniq :: Data k => Vector k -> Vector k
uniq ks = V.reverse (V.fromList newKsR)
  where
    acc (hs, uks) k =
      if HS.member k hs
        then (hs, uks)
        else (HS.insert k hs, k:uks)
    (_, newKsR) = V.foldl acc (HS.empty, []) ks

match :: Eq k => Vector k -> v -> v -> k -> Vector v
match ks yesVal noVal tk = V.map (\k -> if k == tk then yesVal else noVal) ks

-- | One-hot encode a given column. (See tests for usage.)
oneHot :: (Data k, MonadThrow m) => (k -> v -> k) -> k -> v -> v -> RFrame k v -> m (RFrame k v)
oneHot combine key yesVal noVal frame = do
  let (target, cold) = splitCols (== key) frame
  rawVs <- col key target
  let cookedKs = V.map (combine key) rawVs
      newKs = uniq cookedKs
      newVs = V.map (match newKs yesVal noVal) cookedKs
      hot = RFrameUpdate newKs newVs
  update hot cold


text:
import json

from django.core.serializers.python import Deserializer as PythonDeserializer
from django.core.serializers.json import Serializer as JSONSerializer
from django.core.serializers.python import _get_model
from django.utils import six

from djmoney.models.fields import MoneyField
from djmoney.utils import get_currency_field_name
from moneyed import Money

Serializer = JSONSerializer

def Deserializer(stream_or_string, **options):
    """
    Deserialize a stream or string of JSON data.
    """
    if not isinstance(stream_or_string, (bytes, six.string_types)):
        stream_or_string = stream_or_string.read()
    if isinstance(stream_or_string, bytes):
        stream_or_string = stream_or_string.decode('utf-8')
    try:
        for obj in json.loads(stream_or_string):
            money_fields = {}
            fields = {}
            Model = _get_model(obj["model"])
            for (field_name, field_value) in six.iteritems(obj['fields']):
                field = Model._meta.get_field(field_name)
                if isinstance(field, MoneyField) and field_value is not None:
                    money_fields[field_name] = Money(field_value, obj['fields'][get_currency_field_name(field_name)])
                else:
                    fields[field_name] = field_value
            obj['fields'] = fields

            for obj in PythonDeserializer([obj], **options):
                for field, value in money_fields.items():
                    setattr(obj.object, field, value)
                yield obj
    except GeneratorExit:
        raise


text:
//
//  UIView+MKLayoutItem.h
//  MKLayoutLibrary
//
//  Created by Martin Klöppner on 21/08/14.
//  Copyright (c) 2014 Martin Klöppner. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LKLayoutItem.h"

@interface UIView (LKLayoutItem)

/**
 *  The associated layout item
 *
 * Once the view is added in any of the layouts,
 * layout item provides access to its corresponding item in order to configure the visual
 * layout behaviour for that view.
 *
 */
@property (weak, nonatomic, readonly) LKLayoutItem * _Nullable item;

@end


text:
/* */
"format cjs";
/*eslint-disable no-empty */
'use strict';

export { saveState };
export { readState };
import warning from 'warning';

var KeyPrefix = '@@History/';
var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR'];

var SecurityError = 'SecurityError';

function createKey(key) {
  return KeyPrefix + key;
}

function saveState(key, state) {
  try {
    if (state == null) {
      window.sessionStorage.removeItem(createKey(key));
    } else {
      window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
    }
  } catch (error) {
    if (error.name === SecurityError) {
      // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
      // attempt to access window.sessionStorage.
      process.env.NODE_ENV !== 'production' ? warning(false, '[history] Unable to save state; sessionStorage is not available due to security settings') : undefined;

      return;
    }

    if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) {
      // Safari "private mode" throws QuotaExceededError.
      process.env.NODE_ENV !== 'production' ? warning(false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : undefined;

      return;
    }

    throw error;
  }
}

function readState(key) {
  var json = undefined;
  try {
    json = window.sessionStorage.getItem(createKey(key));
  } catch (error) {
    if (error.name === SecurityError) {
      // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
      // attempt to access window.sessionStorage.
      process.env.NODE_ENV !== 'production' ? warning(false, '[history] Unable to read state; sessionStorage is not available due to security settings') : undefined;

      return null;
    }
  }

  if (json) {
    try {
      return JSON.parse(json);
    } catch (error) {
      // Ignore invalid JSON.
    }
  }

  return null;
}


text:
.class final Lcom/google/android/gms/internal/zzbu$2;
.super Lcom/google/android/gms/internal/zzbu;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/google/android/gms/internal/zzbu;->zza(Ljava/lang/String;I)Lcom/google/android/gms/internal/zzbu;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/google/android/gms/internal/zzbu",
        "<",
        "Ljava/lang/Integer;",
        ">;"
    }
.end annotation

# direct methods
.method constructor <init>(Ljava/lang/String;Ljava/lang/Integer;)V
    .registers 4

    const/4 v0, 0x0

    invoke-direct {p0, p1, p2, v0}, Lcom/google/android/gms/internal/zzbu;-><init>(Ljava/lang/String;Ljava/lang/Object;Lcom/google/android/gms/internal/zzbu$1;)V

    return-void
.end method

# virtual methods
.method public synthetic zza(Landroid/content/SharedPreferences;)Ljava/lang/Object;
    .registers 3

    invoke-virtual {p0, p1}, Lcom/google/android/gms/internal/zzbu$2;->zzc(Landroid/content/SharedPreferences;)Ljava/lang/Integer;

    move-result-object v0

    return-object v0
.end method

.method public zzc(Landroid/content/SharedPreferences;)Ljava/lang/Integer;
    .registers 4

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzbu$2;->getKey()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0}, Lcom/google/android/gms/internal/zzbu$2;->zzde()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    invoke-interface {p1, v1, v0}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v0

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    return-object v0
.end method


text:
<!DOCTYPE html>

	<link href="js/bootstrap.min.css" rel="stylesheet"type="text/css">
	<link href="css/moncss.css" rel="stylesheet"type="text/css">

	<title>List of AMD graphics processing units -  {{anchor|Volcanic Islands (Rx 2xx) Series}}Radeon Rx 2xx Series </title>
	<meta charset="utf-8">

List of AMD graphics processing units -  {{anchor|Volcanic Islands (Rx 2xx) Series}}Radeon Rx 2xx Series

			<fieldset>

					<form action="" method="post">
						<legend style="color:red;font-weight: bold;font-style:italic;text-align: center;" >Formulaire</legend>

								Launch :

											<input type="checkbox" name="Feature" >Dec 17

											<input type="checkbox" name="Feature" >2013

											<input type="checkbox" name="Feature" >Oct 8

											<input type="checkbox" name="Feature" >Feb 10

											<input type="checkbox" name="Feature" >2014

											<input type="checkbox" name="Feature" >Feb 13

											<input type="checkbox" name="Feature" >Mar 4

											<input type="checkbox" name="Feature" >Sep 2

											<input type="checkbox" name="Feature" >Oct 24

											<input type="checkbox" name="Feature" >Nov 5

											<input type="checkbox" name="Feature" >Apr 3

											<input type="checkbox" name="Feature" >Nov 13

											<input type="checkbox" name="Feature" >Apr 8

										<input type='checkbox'>autre:
<input type="text"/>

								Memory (MB) :
 <input style="display:block;" id="id1Memory (MB)" type="number" name="Feature">
												<input style="display:none;" id="id2Memory (MB)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Memory (MB)','id2Memory (MB)');">Changer type</button>

								Architecture :
 <input id="0" type="text" name="Feature">

								TDP (W) - Max. :
 <input style="display:block;" id="id1TDP (W) - Max." type="number" name="Feature">
												<input style="display:none;" id="id2TDP (W) - Max." type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1TDP (W) - Max.','id2TDP (W) - Max.');">Changer type</button>

								TDP (W) - Idle :
 <input id="1" type="text" name="Feature">

								Codename :
 <input id="2" type="text" name="Feature">

								Memory - Bus width (bit) :
 <input style="display:block;" id="id1Memory - Bus width (bit)" type="number" name="Feature">
												<input style="display:none;" id="id2Memory - Bus width (bit)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Memory - Bus width (bit)','id2Memory - Bus width (bit)');">Changer type</button>

								Memory - Bus type :
 <input id="3" type="text" name="Feature">

								Memory - Bandwidth (GB/s) :
 <input style="display:block;" id="id1Memory - Bandwidth (GB/s)" type="number" name="Feature">
												<input style="display:none;" id="id2Memory - Bandwidth (GB/s)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Memory - Bandwidth (GB/s)','id2Memory - Bandwidth (GB/s)');">Changer type</button>

								Bus interface :
 <input id="4" type="text" name="Feature">

								Config core :
 <input id="5" type="text" name="Feature">

								API support (version) - Mantle :

 <input type="radio" name="FeatureAPI support (version) - Mantle" value="oui">Yes <input type="radio" name="FeatureAPI support (version) - Mantle" value = "non">No <input type="radio" name="FeatureAPI support (version) - Mantle" value = "non">Partial

											<input  style="display:none;" id ="id2API support (version) - Mantle"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1API support (version) - Mantle','id2API support (version) - Mantle');">Changer type</button>

								API support (version) - DirectX :
 <input style="display:block;" id="id1API support (version) - DirectX" type="number" name="Feature">
												<input style="display:none;" id="id2API support (version) - DirectX" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1API support (version) - DirectX','id2API support (version) - DirectX');">Changer type</button>

								API support (version) - OpenGL :
 <input style="display:block;" id="id1API support (version) - OpenGL" type="number" name="Feature">
												<input style="display:none;" id="id2API support (version) - OpenGL" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1API support (version) - OpenGL','id2API support (version) - OpenGL');">Changer type</button>

								API support (version) - OpenCL :
 <input style="display:block;" id="id1API support (version) - OpenCL" type="number" name="Feature">
												<input style="display:none;" id="id2API support (version) - OpenCL" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1API support (version) - OpenCL','id2API support (version) - OpenCL');">Changer type</button>

								Model :
 <input id="6" type="text" name="Feature">

								Transistors (Million) :
 <input style="display:block;" id="id1Transistors (Million)" type="number" name="Feature">
												<input style="display:none;" id="id2Transistors (Million)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Transistors (Million)','id2Transistors (Million)');">Changer type</button>

								Fab (nm) :
 <input style="display:block;" id="id1Fab (nm)" type="number" name="Feature">
												<input style="display:none;" id="id2Fab (nm)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Fab (nm)','id2Fab (nm)');">Changer type</button>

								Die Size (mm) :
 <input style="display:block;" id="id1Die Size (mm)" type="number" name="Feature">
												<input style="display:none;" id="id2Die Size (mm)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Die Size (mm)','id2Die Size (mm)');">Changer type</button>

								GFLOPS/W Single Precision :
 <input style="display:block;" id="id1GFLOPS/W Single Precision" type="number" name="Feature">
												<input style="display:none;" id="id2GFLOPS/W Single Precision" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1GFLOPS/W Single Precision','id2GFLOPS/W Single Precision');">Changer type</button>

								Products :
 <input id="7" type="text" name="Feature">

								Processing PowerGFLOPS - Double Precision :
 <input id="8" type="text" name="Feature">

								Processing PowerGFLOPS - Single Precision :
 <input style="display:block;" id="id1Processing PowerGFLOPS - Single Precision" type="number" name="Feature">
												<input style="display:none;" id="id2Processing PowerGFLOPS - Single Precision" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Processing PowerGFLOPS - Single Precision','id2Processing PowerGFLOPS - Single Precision');">Changer type</button>

								Release Price (USD) :
 <input id="9" type="text" name="Feature">

								Clock rate - Core (MHz) :
 <input style="display:block;" id="id1Clock rate - Core (MHz)" type="number" name="Feature">
												<input style="display:none;" id="id2Clock rate - Core (MHz)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Clock rate - Core (MHz)','id2Clock rate - Core (MHz)');">Changer type</button>

								Clock rate - Boost (MHz) :
 <input id="10" type="text" name="Feature">

								Clock rate - Memory (MT/s) :
 <input style="display:block;" id="id1Clock rate - Memory (MT/s)" type="number" name="Feature">
												<input style="display:none;" id="id2Clock rate - Memory (MT/s)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Clock rate - Memory (MT/s)','id2Clock rate - Memory (MT/s)');">Changer type</button>

								TrueAudio :

 <input type="radio" name="FeatureTrueAudio" value="oui">Yes <input type="radio" name="FeatureTrueAudio" value = "non">No <input type="radio" name="FeatureTrueAudio" value = "non">Partial

											<input  style="display:none;" id ="id2TrueAudio"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1TrueAudio','id2TrueAudio');">Changer type</button>

								Fillrate - Texture (GT/s) :
 <input style="display:block;" id="id1Fillrate - Texture (GT/s)" type="number" name="Feature">
												<input style="display:none;" id="id2Fillrate - Texture (GT/s)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Fillrate - Texture (GT/s)','id2Fillrate - Texture (GT/s)');">Changer type</button>

								Fillrate - Pixel (GP/s) :
 <input style="display:block;" id="id1Fillrate - Pixel (GP/s)" type="number" name="Feature">
												<input style="display:none;" id="id2Fillrate - Pixel (GP/s)" type="text"/>
												<button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Fillrate - Pixel (GP/s)','id2Fillrate - Pixel (GP/s)');">Changer type</button>

<input type="submit" class="btn btn-info" value="Ajouter un produit" />
					</form>

			</fieldset>


text:
/**
 * Style for forms
 */

fieldset {
    border: 2px solid darkred;

}

input, textarea {

    border-radius: 2px;
}

label {
    font-size: smaller;
}

input[type=text],
input[type=password] {
    font-size: 1.2em;
    width: 500px;
}

input[type=submit],
input[type=reset] {
    font-size: 1em;
    background-color: darkblue;
    color: lightgoldenrodyellow;
    padding-top: 2px;
    padding-bottom: 2px;
    border: 1px solid transparent;
    margin-right: 5px;
}

input[type=submit]:hover,
input[type=reset]:hover {
    box-shadow: 2px 2px 4px #848d95;
    cursor: pointer;
}

textarea {
    font-size: 1.2em;
    width: 500px;
    min-height: 200px;
    resize: none;
}

p.buttons {
    padding-top: 22px;
    padding-bottom: 22px;
}


text:
package com.pedromassango.programmers.presentation.reset.password;

import android.util.Patterns;

import com.pedromassango.programmers.interfaces.Callbacks;
import com.pedromassango.programmers.server.Worker;

import static com.pedromassango.programmers.extras.Util.showLog;

/**
 * Created by Pedro Massango on 07-03-2017 10:46.
 */

class Presenter implements Contract.Presenter, Callbacks.IRequestCallback {

    private Contract.View view;

    public Presenter(Contract.View view){
        this.view = view;
    }

    @Override
    public void sendVerificationClicked() {

        showLog("CLICKED");

        String email = view.getEmail();

        if(email.isEmpty()){
            view.setEmailError();
            return;
        }

        if (!Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
            view.clearCurrentEmailText();
            view.setEmailError();
            return;
        }

        // show a progress dialog
        view.showProgress();

        Worker.sendEmailVerification(this, email);
        view.clearCurrentEmailText();
    }

    @Override
    public void onSuccess() {
        view.dismissProgress();

        view.showDialogSuccess();
    }

    @Override
    public void onError() {

        view.dismissProgress();
        view.showError();
    }
}


text:
MergedCommand = Command:extends{}
MergedCommand.className = "MergedCommand"

function MergedCommand:init(cmds)
    self.cmds = cmds
end

function MergedCommand:onMerge()
    self.cmd = self.cmds[1]
    self.displayText = self.cmd:display()
    if self.cmd._execute_unsynced and Script.GetName() == "LuaRules" then
        self._execute_unsynced = true
        self.cmd = nil
        return
    end

    self.cmd.opts = self.cmds[#self.cmds].opts
    self.cmd.old = self.cmds[1].old
    for i = #self.cmds, 2, -1 do
        local c = self.cmds[i]
        Table.Merge(self.cmd.opts, c.opts)
    end
    for i = 2, #self.cmds do
        local c = self.cmds[i]
        -- Spring.Echo(not not self.cmd.old, not not c.opts.old, i)
        Table.Merge(self.cmd.old, c.old)
    end
end

function MergedCommand:execute()
    if self._execute_unsynced then
        SB.commandManager:execute(RedoCommand(), true)
        return
    end
    self.cmd:execute()
end

function MergedCommand:unexecute()
    if self._execute_unsynced then
        SB.commandManager:execute(UndoCommand(), true)
        return
    end
    self.cmd:unexecute()
end

function MergedCommand:display()
    return self.displayText
end


text:
// ==========================================================================
//                                  FMIndex
// ==========================================================================
// Copyright (c) 2006-2012, Knut Reinert, FU Berlin
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of Knut Reinert or the FU Berlin nor the names of
//       its contributors may be used to endorse or promote products derived
//       from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
// ==========================================================================
// Author: Jochen Singer <jochen.singer@fu-berlin.de>
// ==========================================================================

#ifndef INDEX_FM_SPARSE_STRING_H_
#define INDEX_FM_SPARSE_STRING_H_

namespace seqan {

template <typename TString, typename TSpec>
struct SparseString;

struct FibreValueString_;
struct FibreIndicatorString_;

typedef Tag<FibreValueString_>       const FibreValueString;
typedef Tag<FibreIndicatorString_>    const FibreIndicatorString;

// ==========================================================================
//Metafunctions
// ==========================================================================
template <typename TFibreValueString, typename TSpec>
struct Value<SparseString<TFibreValueString, TSpec> >
{
    typedef typename Value<TFibreValueString>::Type Type;
};

template <typename TFibreValueString, typename TSpec>
struct Value<SparseString<TFibreValueString, TSpec> const>
{
    typedef typename Value<TFibreValueString>::Type const Type;
};

template <typename TFibreValueString, typename TSpec>
struct GetValue<SparseString<TFibreValueString, TSpec> > :
    Value<SparseString<TFibreValueString, TSpec> > {};

template <typename TFibreValueString, typename TSpec>
struct GetValue<SparseString<TFibreValueString, TSpec> const> :
    Value<SparseString<TFibreValueString, TSpec> const> {};

template <typename TFibreValueString, typename TSpec>
struct Reference<SparseString<TFibreValueString, TSpec> >
{
    typedef typename Value<SparseString<TFibreValueString, TSpec> >::Type Type;
};

template <typename TFibreValueString, typename TSpec>
struct Reference<SparseString<TFibreValueString, TSpec> const>
{
    typedef typename Value<SparseString<TFibreValueString, TSpec> >::Type const Type;
};

template <typename TSpec>
struct DefaultValue {};

template <typename TFibreValueString, typename TSpec>
struct DefaultValue<SparseString<TFibreValueString, TSpec> const>
{
    typedef typename GetValue<SparseString<TFibreValueString, TSpec> const>::Type Type;
    static const Type VALUE = -1;
};

template <typename TFibreValueString, typename TSpec>
struct DefaultValue<SparseString<TFibreValueString, TSpec> >
{
    typedef typename GetValue<SparseString<TFibreValueString, TSpec> const>::Type Type;
    static const Type VALUE = -1;
};

template <typename TFibreValueString, typename TSpec>
struct Fibre<SparseString<TFibreValueString, TSpec>, FibreValueString>
{
    typedef TFibreValueString Type;
};

template <typename TFibreValueString, typename TSpec>
struct Fibre<SparseString<TFibreValueString, TSpec> const, FibreValueString>
{
    typedef TFibreValueString const Type;
};

template <typename TFibreValueString, typename TSpec>
struct Fibre<SparseString<TFibreValueString, TSpec>, FibreIndicatorString>
{
    typedef RankSupportBitString<void> Type;
};

template <typename TFibreValueString, typename TSpec>
struct Fibre<SparseString<TFibreValueString, TSpec> const, FibreIndicatorString>
{
    typedef RankSupportBitString<void> const Type;
};

template <typename TFibreValueString, typename TSpec>
struct Iterator<SparseString<TFibreValueString, TSpec> const, Standard>
{
    typedef Iter<SparseString<TFibreValueString, TSpec> const, PositionIterator> Type;
};

template <typename TFibreValueString, typename TSpec>
struct Iterator<SparseString<TFibreValueString, TSpec>, Standard>
{
    typedef Iter<SparseString<TFibreValueString, TSpec>, PositionIterator> Type;
};

template <typename TFibreValueString, typename TSpec>
struct Iterator<SparseString<TFibreValueString, TSpec>, Rooted>:
    Iterator<SparseString<TFibreValueString, TSpec>, Standard>{};

template <typename TFibreValueString, typename TSpec>
struct Iterator<SparseString<TFibreValueString, TSpec> const, Rooted>:
    Iterator<SparseString<TFibreValueString, TSpec> const, Standard>{};

// ==========================================================================
// Classes
// ==========================================================================

/**
.Class.SparseString:
..cat:String
..summary:A string storing only a fraction of the values of the original string..
..signature:SparseString<TValueString, TSpec>
..param.TValueString:The string containing the values.
..param.TSpec:The specialisation tag.
...default:void.
..include:seqan/String.h
*/
template <typename TValueString, typename TSpec = void>
struct SparseString
{
    typedef typename Fibre<SparseString, FibreValueString>::Type TFibreValueString_;
    typedef typename Fibre<SparseString, FibreIndicatorString>::Type TFibreIndicatorString;

    TFibreValueString_              	valueString;
    TFibreIndicatorString               indicatorString;
    // TODO(singer): get rid of compressionFactor
    //typename Size<TValueString>::Type   compressionFactor;

    // TODO(singer): get rid of compressionFactor
//    SparseString(unsigned compressionFactor = 0) :
      //  compressionFactor(compressionFactor)
  //  {}

//    inline SparseString & operator=(SparseString const & other)
//    {
//        valueString = other.valueString;
//        indicatorString = other.indicatorString;
//        compressionFactor = other.compressionFactor;
//        return *this;
//    }

   inline bool operator==(const SparseString & b) const
   {
       return valueString == b.valueString &&
              indicatorString == b.indicatorString;// &&
              //compressionFactor == b.compressionFactor);
   }
};

// ==========================================================================
// Functions
// ==========================================================================

// TODO(singer): get rid of compressionFactor
/*
.Function.assignCompressionFactor
..summary:Assings the compression factor of the container.
..signature:assignCompressionFactor(container, value)
..param.container:The container holding the entries.
...type:Class.SparseString
..param.value.
..include:seqan/index.h
*/
// template <typename TFibreValueString, typename TSpec, typename TValue>
// inline void assignCompressionFactor(SparseString<TFibreValueString, TSpec> & string, TValue value)
// {
//     SEQAN_ASSERT_GT_MSG(value, 0u, "The compresssion factor is not acceptable!");
//     string.compressionFactor = value;
// }

/*
.Function.assignValueInValueString_
..param.container:
...type:Class.CompressedSA
*/
template <typename TFibreValueString, typename TSpec, typename TPos, typename TValue>
inline void assignValueInValueString_(SparseString<TFibreValueString, TSpec> & string, TPos pos, TValue value)
{
    getFibre(string, FibreValueString())[pos] = value;
}

/**
.Function.clear
..param.object:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec>
inline void clear(SparseString<TFibreValueString, TSpec> & string)
{
    clear(getFibre(string, FibreValueString()));
    clear(getFibre(string, FibreIndicatorString()));
}

/**
.Function.empty
..param.object:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec>
inline bool empty(SparseString<TFibreValueString, TSpec> const & string)
{
    return empty(getFibre(string, FibreIndicatorString()));
}

// TODO(singer): change name of the function
template <typename TFibreValueString, typename TSpec, typename TPos>
inline bool isContained_(SparseString<TFibreValueString, TSpec> const & string, TPos const & pos)
{
    return getBit(getFibre(string, FibreIndicatorString()), pos);
}

// TODO(singer): remove
/**
.Function.getCompressionFactor
..summary:Returns the compression factor of the container.
..signature:getCompressionFactor(container)
..param.container:The container holding the entries.
...type:Class.SparseString
..include:seqan/index.h
*/
template <typename TFibreValueString, typename TSpec>
inline typename Size<typename Fibre<SparseString<TFibreValueString, TSpec>, FibreValueString>::Type>::Type
getCompressionFactor(SparseString<TFibreValueString, TSpec> & string)
{
    return length(getFibre(string, FibreIndicatorString()))
        / length(getFibre(string, FibreValueString()));
}

/**
.Function.getValue
..param.object:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec, typename TPos, typename TValue>
inline void
assignValue(SparseString<TFibreValueString, TSpec> & string, TPos pos, TValue value)
{
//     if (DefaultValue<SparseString<TFibreValueString, TSpec> >::VALUE)
//     {
//         if (isContained_(string, pos))
//         {
//             setBit(getFibre(string, FibreIndicatorString()), pos, 0);
//             updateRanks_(getFibre(string, FibreIndicatorString()), pos);
//         }
//         return;
//     }

    if (!isContained_(string, pos))
    {
        setBit(getFibre(string, FibreIndicatorString()), pos, 0);
    }
    getFibre(string, FibreValueString())[getRank(getFibre(string, FibreIndicatorString()), pos) - 1] = value;
}

/**
.Function.getValue
..param.object:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec, typename TPos>
inline typename GetValue<SparseString<TFibreValueString, TSpec> >::Type
getValue(SparseString<TFibreValueString, TSpec> & string, TPos pos)
{
    if (isContained_(string, pos))
        return getValue(getFibre(string, FibreValueString()), getRank(getFibre(string, FibreIndicatorString()), pos) - 1);
    else
        return DefaultValue<SparseString<TFibreValueString, TSpec> >::VALUE;
}

template <typename TFibreValueString, typename TSpec, typename TPos>
inline typename GetValue<SparseString<TFibreValueString, TSpec> const>::Type
getValue(SparseString<TFibreValueString, TSpec> const & string, TPos pos)
{
    if (isContained_(string, pos))
        return getValue(getFibre(string, FibreValueString()), getRank(getFibre(string, FibreIndicatorString()), pos) - 1);
    else
        return DefaultValue<SparseString<TFibreValueString, TSpec> const>::VALUE;
}

/**
.Function.value
..param.container:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec, typename TPos>
inline typename Reference<SparseString<TFibreValueString, TSpec> >::Type
value(SparseString<TFibreValueString, TSpec>&string, TPos pos)
{
    return getValue(string, pos);
}

template <typename TFibreValueString, typename TSpec, typename TPos>
inline typename Reference<SparseString<TFibreValueString, TSpec> >::Type
value(SparseString<TFibreValueString, TSpec> const & string, TPos pos)
{
    return getValue(string, pos);
}

/**
.Function.getFibre
..param.container:
...type:Class.CompressedSA
*/
template <typename TFibreValueString, typename TSpec>
inline typename Fibre<SparseString<TFibreValueString, TSpec>, FibreValueString>::Type const &
getFibre(SparseString<TFibreValueString, TSpec> const & sparseString, FibreValueString)
{
    return sparseString.valueString;
}

template <typename TFibreValueString, typename TSpec>
inline typename Fibre<SparseString<TFibreValueString, TSpec>, FibreValueString>::Type &
getFibre(SparseString<TFibreValueString, TSpec>&sparseString, FibreValueString)
{
    return sparseString.valueString;
}

template <typename TFibreValueString, typename TSpec>
inline typename Fibre<SparseString<TFibreValueString, TSpec>, FibreIndicatorString>::Type const &
getFibre(SparseString<TFibreValueString, TSpec> const & sparseString, FibreIndicatorString)
{
    return sparseString.indicatorString;
}

template <typename TFibreValueString, typename TSpec>
inline typename Fibre<SparseString<TFibreValueString, TSpec>, FibreIndicatorString>::Type &
getFibre(SparseString<TFibreValueString, TSpec>&sparseString, FibreIndicatorString)
{
    return sparseString.indicatorString;
}

/**
.Function.length
..param.object:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec>
inline typename Size<typename Fibre<SparseString<TFibreValueString, TSpec>, FibreValueString>::Type>::Type
length(SparseString<TFibreValueString, TSpec> const & string)
{
    return length(getFibre(string, FibreIndicatorString()));
}

// TODO(singer): change to account for default and non default values! tag und 0 oder 1 for indicator
/**
.Function.resize
..param.object:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec, typename TSize, typename TValue, typename TExpand>
inline void resize(SparseString<TFibreValueString, TSpec> & string,
                   TSize const size,
                   TValue const value,
                   Tag<TExpand> const tag)
{
    if (value != DefaultValue<SparseString<TFibreValueString, TSpec> >::VALUE)
    {
        TSize _length = length(getFibre(string, FibreIndicatorString()));
        if (_length < size)
            resize(getFibre(string, FibreValueString()), length(getFibre(string, FibreValueString())) + (size - length), value, tag);
        else
            resize(getFibre(string, FibreValueString()), getRank(string, size), value, tag);
        resize(getFibre(string, FibreIndicatorString()), size, 1, tag);
    }
    resize(getFibre(string, FibreIndicatorString()), size, 0);
}

template <typename TFibreValueString, typename TSpec, typename TSize>
inline void resize(SparseString<TFibreValueString, TSpec> & string,
                   TSize const size)
{
    resize(getFibre(string, FibreIndicatorString()), size, 0);
}

/**
.Function.open
..param.string:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec>
inline bool open(
    SparseString<TFibreValueString, TSpec> & sparseString,
    const char * fileName,
    int openMode)
{
    String<char> name;
    name = fileName;    append(name, ".val");
    if (!open(getFibre(sparseString, FibreValueString()), toCString(name), openMode)) // val = value string
    {
        return false;
    }
    name = fileName;    append(name, ".ind");   open(getFibre(sparseString, FibreIndicatorString()), toCString(name), openMode); // ind = indicator string
    return true;
}

template <typename TFibreValueString, typename TSpec>
inline bool open(
    SparseString<TFibreValueString, TSpec> & sparseString,
    const char * fileName)
{
    return open(sparseString, fileName, DefaultOpenMode<SparseString<TFibreValueString, TSpec> >::VALUE);
}

/**
.Function.save
..param.string:
...type:Class.SparseString
*/
template <typename TFibreValueString, typename TSpec>
inline bool save(
    SparseString<TFibreValueString, TSpec> const & sparseString,
    const char * fileName)
{
    return save(sparseString, fileName, DefaultOpenMode<SparseString<TFibreValueString, TSpec> >::VALUE);
}

template <typename TFibreValueString, typename TSpec>
inline bool save(
    SparseString<TFibreValueString, TSpec> const & sparseString,
    const char * fileName,
    int openMode)
{
    String<char> name;
    name = fileName;    append(name, ".val");
    if (!save(getFibre(sparseString, FibreValueString()), toCString(name), openMode))
    {
        return false;
    }
    name = fileName;    append(name, ".ind");   save(getFibre(sparseString, FibreIndicatorString()), toCString(name), openMode);
    return true;
}

// TODO(singer): setValue function

}
#endif // INDEX_FM_SPARSE_STRING_H_


text:
#ifndef CHECKHEADER_SLIB_MEDIA_AUDIO_UTIL
#define CHECKHEADER_SLIB_MEDIA_AUDIO_UTIL

#include "definition.h"

#include "../core/math.h"

namespace slib
{
	class SLIB_EXPORT AudioUtil
	{
	public:
		// S8 => S8
		static void convertSample(sl_int8 _in, sl_int8& _out);

		static void convertSamples(sl_size count, const sl_int8* _in, sl_int8* _out);

		// S8 => U8
		static void convertSample(sl_int8 _in, sl_uint8& _out);

		static void convertSamples(sl_size count, const sl_int8* _in, sl_uint8* _out);

		// S8 => S16
		static void convertSample(sl_int8 _in, sl_int16& _out);

		static void convertSamples(sl_size count, const sl_int8* _in, sl_int16* _out);

		// S8 => U16
		static void convertSample(sl_int8 _in, sl_uint16& _out);

		static void convertSamples(sl_size count, const sl_int8* _in, sl_uint16* _out);

		// S8 => Float
		static void convertSample(sl_int8 _in, float& _out);

		static void convertSamples(sl_size count, const sl_int8* _in, float* _out);

		// U8 => S8
		static void convertSample(sl_uint8 _in, sl_int8& _out);

		static void convertSamples(sl_size count, const sl_uint8* _in, sl_int8* _out);

		// U8 => U8
		static void convertSample(sl_uint8 _in, sl_uint8& _out);

		static void convertSamples(sl_size count, const sl_uint8* _in, sl_uint8* _out);

		// U8 => S16
		static void convertSample(sl_uint8 _in, sl_int16& _out);

		static void convertSamples(sl_size count, const sl_uint8* _in, sl_int16* _out);

		// U8 => U16
		static void convertSample(sl_uint8 _in, sl_uint16& _out);

		static void convertSamples(sl_size count, const sl_uint8* _in, sl_uint16* _out);

		// U8 => Float
		static void convertSample(sl_uint8 _in, float& _out);

		static void convertSamples(sl_size count, const sl_uint8* _in, float* _out);

		// S16 => S8
		static void convertSample(sl_int16 _in, sl_int8& _out);

		static void convertSamples(sl_size count, const sl_int16* _in, sl_int8* _out);

		// S16 => U8
		static void convertSample(sl_int16 _in, sl_uint8& _out);

		static void convertSamples(sl_size count, const sl_int16* _in, sl_uint8* _out);

		// S16 => S16
		static void convertSample(sl_int16 _in, sl_int16& _out);

		static void convertSamples(sl_size count, const sl_int16* _in, sl_int16* _out);

		// S16 => U16
		static void convertSample(sl_int16 _in, sl_uint16& _out);

		static void convertSamples(sl_size count, const sl_int16* _in, sl_uint16* _out);

		// S16 => Float
		static void convertSample(sl_int16 _in, float& _out);

		static void convertSamples(sl_size count, const sl_int16* _in, float* _out);

		// U16 => S8
		static void convertSample(sl_uint16 _in, sl_int8& _out);

		static void convertSamples(sl_size count, const sl_uint16* _in, sl_int8* _out);

		// U16 => U8
		static void convertSample(sl_uint16 _in, sl_uint8& _out);

		static void convertSamples(sl_size count, const sl_uint16* _in, sl_uint8* _out);

		// U16 => S16
		static void convertSample(sl_uint16 _in, sl_int16& _out);

		static void convertSamples(sl_size count, const sl_uint16* _in, sl_int16* _out);

		// U16 => U16
		static void convertSample(sl_uint16 _in, sl_uint16& _out);

		static void convertSamples(sl_size count, const sl_uint16* _in, sl_uint16* _out);

		// U16 => Float
		static void convertSample(sl_uint16 _in, float& _out);

		static void convertSamples(sl_size count, const sl_uint16* _in, float* _out);

		// Float => S8
		static void convertSample(float _in, sl_int8& _out);

		static void convertSamples(sl_size count, const float* _in, sl_int8* _out);

		// Float => U8
		static void convertSample(float _in, sl_uint8& _out);

		static void convertSamples(sl_size count, const float* _in, sl_uint8* _out);

		// Float => S16
		static void convertSample(float _in, sl_int16& _out);

		static void convertSamples(sl_size count, const float* _in, sl_int16* _out);

		// Float => U16
		static void convertSample(float _in, sl_uint16& _out);

		static void convertSamples(sl_size count, const float* _in, sl_uint16* _out);

		// Float => Float
		static void convertSample(float _in, float& _out);

		static void convertSamples(sl_size count, const float* _in, float* _out);

		static void mixSamples(sl_int8 in1, sl_int8 in2, sl_int8& _out);

		static void mixSamples(sl_uint8 in1, sl_uint8 in2, sl_uint8& _out);

		static void mixSamples(sl_int16 in1, sl_int16 in2, sl_int16& _out);

		static void mixSamples(sl_uint16 in1, sl_uint16 in2, sl_uint16& _out);

		static void mixSamples(float in1, float in2, float& _out);

	};

}

#include "detail/audio_util.inc"

#endif


text:
namespace {

// An ASN.1-encoded PrivateKeyInfo block from PKCS #8.
const char kPrivateKey[] =
    "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgS8wRbDOWz0lKExvIVQiRKtPAP8"
    "dgHUHAw5gyOd5d4jKhRANCAARZb49Va5MD/KcWtc0oiWc2e8njBDtQzj0mzcOl1fDSt16Pvu6p"
    "fTU3MTWnImDNnkPxtXm58K7Uax8jFxA4TeXJ";

TEST(JSONWebTokenUtilTest, VerifiesCreateJSONWebToken) {
  std::string private_key_info;
  ASSERT_TRUE(base::Base64Decode(kPrivateKey, &private_key_info));
  std::unique_ptr<crypto::ECPrivateKey> private_key =
      crypto::ECPrivateKey::CreateFromPrivateKeyInfo(std::vector<uint8_t>(
          private_key_info.begin(), private_key_info.end()));
  ASSERT_TRUE(private_key);

  // Create JWS.
  base::Value claims(base::Value::Type::DICTIONARY);
  claims.SetKey("aud", base::Value("https://chromium.org"));
  absl::optional<std::string> jwt =
      CreateJSONWebToken(claims, private_key.get());
  ASSERT_TRUE(jwt);

  // Decompose JWS into data and signautre.
  std::string::size_type dot_position = jwt->rfind(".");
  ASSERT_NE(std::string::npos, dot_position);

  std::string data = jwt->substr(0, dot_position);
  std::string signature;
  ASSERT_TRUE(base::Base64UrlDecode(jwt->substr(dot_position + 1),
                                    base::Base64UrlDecodePolicy::IGNORE_PADDING,
                                    &signature));

  // Encode the signature.
  bssl::UniquePtr<ECDSA_SIG> ec_sig(ECDSA_SIG_new());
  ASSERT_TRUE(ec_sig);

  std::string::size_type half_size = signature.size() / 2;
  ASSERT_TRUE(BN_bin2bn((uint8_t*)signature.data(), half_size, ec_sig->r));
  ASSERT_TRUE(
      BN_bin2bn((uint8_t*)signature.data() + half_size, half_size, ec_sig->s));

  uint8_t* der;
  size_t der_len;
  ASSERT_TRUE(ECDSA_SIG_to_bytes(&der, &der_len, ec_sig.get()));
  std::vector<uint8_t> der_signature(der, der + der_len);
  OPENSSL_free(der);

  // Verify DER signature using SignatureVerifier.
  std::vector<uint8_t> public_key_info;
  ASSERT_TRUE(private_key->ExportPublicKey(&public_key_info));

  crypto::SignatureVerifier verifier;
  ASSERT_TRUE(verifier.VerifyInit(crypto::SignatureVerifier::ECDSA_SHA256,
                                  der_signature, public_key_info));

  verifier.VerifyUpdate(base::as_bytes(base::make_span(data)));
  ASSERT_TRUE(verifier.VerifyFinal());

  std::string::size_type data_dot_position = data.find(".");
  ASSERT_NE(std::string::npos, data_dot_position);

  // Verify header.
  std::string header_decoded;
  ASSERT_TRUE(base::Base64UrlDecode(data.substr(0, data_dot_position),
                                    base::Base64UrlDecodePolicy::IGNORE_PADDING,
                                    &header_decoded));
  absl::optional<base::Value> header_value =
      base::JSONReader::Read(header_decoded);
  ASSERT_TRUE(header_value);
  ASSERT_TRUE(header_value->is_dict());
  ASSERT_EQ(base::Value("ES256"), header_value->ExtractKey("alg"));
  ASSERT_EQ(base::Value("JWT"), header_value->ExtractKey("typ"));

  // Verify payload.
  std::string payload_decoded;
  ASSERT_TRUE(base::Base64UrlDecode(data.substr(data_dot_position + 1),
                                    base::Base64UrlDecodePolicy::IGNORE_PADDING,
                                    &payload_decoded));
  ASSERT_EQ(claims, base::JSONReader::Read(payload_decoded));
}

}  // namespace