text:
#include <TransporterRegistry.hpp>
#include <TransporterCallback.hpp>
#include "Transporter.hpp"
#include "TransporterInternalDefinitions.hpp"
#include <NdbSleep.h>
#include <SocketAuthenticator.hpp>
#include <InputStream.hpp>
#include <OutputStream.hpp>

#include <EventLogger.hpp>
extern EventLogger g_eventLogger;

Transporter::Transporter(TransporterRegistry &t_reg,
			 TransporterType _type,
			 const char *lHostName,
			 const char *rHostName,
			 int s_port,
			 bool _isMgmConnection,
			 NodeId lNodeId,
			 NodeId rNodeId,
			 NodeId serverNodeId,
			 int _byteorder,
			 bool _compression, bool _checksum, bool _signalId)
  : m_s_port(s_port), remoteNodeId(rNodeId), localNodeId(lNodeId),
    isServer(lNodeId==serverNodeId),
    m_packer(_signalId, _checksum),  isMgmConnection(_isMgmConnection),
    m_type(_type),
    m_transporter_registry(t_reg)
{
  DBUG_ENTER("Transporter::Transporter");
  if (rHostName && strlen(rHostName) > 0){
    strncpy(remoteHostName, rHostName, sizeof(remoteHostName));
    Ndb_getInAddr(&remoteHostAddress, rHostName);
  }
  else
  {
    if (!isServer) {
      ndbout << "Unable to setup transporter. Node " << rNodeId
	     << " must have hostname. Update configuration." << endl;
      exit(-1);
    }
    remoteHostName[0]= 0;
  }
  strncpy(localHostName, lHostName, sizeof(localHostName));

  DBUG_PRINT("info",("rId=%d lId=%d isServer=%d rHost=%s lHost=%s s_port=%d",
		     remoteNodeId, localNodeId, isServer,
		     remoteHostName, localHostName,
		     s_port));

  byteOrder       = _byteorder;
  compressionUsed = _compression;
  checksumUsed    = _checksum;
  signalIdUsed    = _signalId;

  m_connected     = false;
  m_timeOutMillis = 30000;

  m_connect_address.s_addr= 0;
  if(s_port<0)
    s_port= -s_port; // was dynamic

  if (isServer)
    m_socket_client= 0;
  else
  {
    m_socket_client= new SocketClient(remoteHostName, s_port,
				      new SocketAuthSimple("ndbd",
							   "ndbd passwd"));

    m_socket_client->set_connect_timeout((m_timeOutMillis+999)/1000);
  }
  DBUG_VOID_RETURN;
}

Transporter::~Transporter(){
  if (m_socket_client)
    delete m_socket_client;
}

bool
Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
  // all initial negotiation is done in TransporterRegistry::connect_server
  DBUG_ENTER("Transporter::connect_server");

  if(m_connected)
  {
    DBUG_RETURN(false); // TODO assert(0);
  }

  {
    struct sockaddr_in addr;
    SOCKET_SIZE_TYPE addrlen= sizeof(addr);
    getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
    m_connect_address= (&addr)->sin_addr;
  }

  bool res = connect_server_impl(sockfd);
  if(res){
    m_connected  = true;
    m_errorCount = 0;
  }

  DBUG_RETURN(res);
}

bool
Transporter::connect_client() {
  NDB_SOCKET_TYPE sockfd;

  if(m_connected)
    return true;

  if(isMgmConnection)
  {
    sockfd= m_transporter_registry.connect_ndb_mgmd(m_socket_client);
  }
  else
  {
    if (!m_socket_client->init())
    {
      return false;
    }
    if (strlen(localHostName) > 0)
    {
      if (m_socket_client->bind(localHostName, 0) != 0)
	return false;
    }
    sockfd= m_socket_client->connect();
  }

  return connect_client(sockfd);
}

bool
Transporter::connect_client(NDB_SOCKET_TYPE sockfd) {

  if(m_connected)
    return true;

  if (sockfd == NDB_INVALID_SOCKET)
    return false;

  DBUG_ENTER("Transporter::connect_client");

  DBUG_PRINT("info",("port %d isMgmConnection=%d",m_s_port,isMgmConnection));

  SocketOutputStream s_output(sockfd);
  SocketInputStream s_input(sockfd);

  // send info about own id
  // send info about own transporter type

  s_output.println("%d %d", localNodeId, m_type);
  // get remote id
  int nodeId, remote_transporter_type= -1;

  char buf[256];
  if (s_input.gets(buf, 256) == 0) {
    NDB_CLOSE_SOCKET(sockfd);
    DBUG_RETURN(false);
  }

  int r= sscanf(buf, "%d %d", &nodeId, &remote_transporter_type);
  switch (r) {
  case 2:
    break;
  case 1:
    // we're running version prior to 4.1.9
    // ok, but with no checks on transporter configuration compatability
    break;
  default:
    NDB_CLOSE_SOCKET(sockfd);
    DBUG_RETURN(false);
  }

  DBUG_PRINT("info", ("nodeId=%d remote_transporter_type=%d",
		      nodeId, remote_transporter_type));

  if (remote_transporter_type != -1)
  {
    if (remote_transporter_type != m_type)
    {
      DBUG_PRINT("error", ("Transporter types mismatch this=%d remote=%d",
			   m_type, remote_transporter_type));
      NDB_CLOSE_SOCKET(sockfd);
      g_eventLogger.error("Incompatible configuration: transporter type "
			  "mismatch with node %d", nodeId);
      DBUG_RETURN(false);
    }
  }
  else if (m_type == tt_SHM_TRANSPORTER)
  {
    g_eventLogger.warning("Unable to verify transporter compatability with node %d", nodeId);
  }

  {
    struct sockaddr_in addr;
    SOCKET_SIZE_TYPE addrlen= sizeof(addr);
    getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
    m_connect_address= (&addr)->sin_addr;
  }

  bool res = connect_client_impl(sockfd);
  if(res){
    m_connected  = true;
    m_errorCount = 0;
  }
  DBUG_RETURN(res);
}

void
Transporter::doDisconnect() {

  if(!m_connected)
    return; //assert(0); TODO will fail

  m_connected= false;
  disconnectImpl();
}


text:
.. include:: ../../Includes.txt

=========================================================================================
Breaking: #67890 - Redesign FluidTemplateDataProcessorInterface to DataProcessorInterface
=========================================================================================

See :issue:`67890`

Description
===========

The `FluidTemplateDataProcessorInterface` introduced with #66907 has been refactored to `DataProcessorInterface`.

This decouples it from the Fluid StandaloneView and makes the ContentObjectRenderer available in the process method
so the different DataProcessor classes do no have to initiate it on their own.
Instead of manipulating the `$data` property of the `ContentObjectRenderer` a new key/value store can be filled/manipulated
by the different dataProcessor classes.

The new interface expects the following `process()` method:

.. code-block:: php

	/**
	 * Process content object data
	 *
	 * @param ContentObjectRenderer $cObj The data of the content element or page
	 * @param array $processorConfiguration The configuration of this processor
	 * @param array $contentObjectConfiguration The configuration of Content Object
	 * @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
	 * @return array the processed data as key/value store
	 */
	public function process(
		ContentObjectRenderer $cObj,
		array $contentObjectConfiguration,
		array $processorConfiguration,
		array $processedData
	);

Impact
======

This will break all frontend rendering for TYPO3 7.3 installations that use `FLUIDTEMPLATE` `.dataProcessing`.

Affected Installations
======================

All TYPO3 7.3 installations that already use the new `FLUIDTEMPLATE` `.dataProcessing` option.

Migration
=========

Change the interface of all DataProcessor classes from `FluidTemplateDataProcessorInterface` to the new
`DataProcessorInterface` and adjust the `process()` method to match the new parameters and make sure it returns the
processed data as the processed data.

redpajama_set_name: RedPajamaGithub


text:
/*
 * Header: Algoritmos de ordenação: Heap Sort, Shell Sort, Rank Sort
 * Trabalho III - Estruturas de Dados II
 * Autor: Luiz Eduardo Favalessa Peruch
 * http://inf.ufes.br/~lefperuch/
 */

#ifndef _HP_SH_RK_H_
#define _HP_SH_RK_H_

/** implementa um heapsort
 * @param <vet> vetor que será ordenado
 * @param <size> tamanho do vetor
 */
void _heap_sort (int *, int);

/** implementa um shellsort
 * @param <vet> vetor que será ordenado
 * @param <size> tamanho do vetor
 */
void _shell_sort (int *, int);

/** implementa um ranksort
 * @param <vet> vetor que será ordenado
 * @param <sorted> vetor para armazenar a saída ordenada
 * @param <size> tamanho do vetor
 */
void _rank_sort (int *, int *, int);

#endif


text:
<!DOCTYPE html>
<meta charset=utf-8>
<title>Redirecting...</title>
<link rel=canonical href="../梵/index.html">
<meta http-equiv=refresh content="0; url='../梵/index.html'">

Redirecting...

Click here if you are not redirected.


text:
package com.google.gerrit.acceptance.server.change;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.testutil.TestChanges.newChange;
import static com.google.gerrit.testutil.TestChanges.newPatchSet;
import static java.util.Collections.singleton;

import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.extensions.api.changes.FixInput;
import com.google.gerrit.extensions.common.ProblemInfo;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.change.ConsistencyChecker;
import com.google.gerrit.testutil.TestChanges;
import com.google.inject.Inject;
import com.google.inject.Provider;

import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Before;
import org.junit.Test;

import java.util.List;

@NoHttpd
public class ConsistencyCheckerIT extends AbstractDaemonTest {
  @Inject
  private Provider<ConsistencyChecker> checkerProvider;

  private RevCommit tip;
  private Account.Id adminId;
  private ConsistencyChecker checker;

  @Before
  public void setUp() throws Exception {
    // Ignore client clone of project; repurpose as server-side TestRepository.
    testRepo = new TestRepository<>(
        (InMemoryRepository) repoManager.openRepository(project));
    tip = testRepo.getRevWalk().parseCommit(
        testRepo.getRepository().getRef("HEAD").getObjectId());
    adminId = admin.getId();
    checker = checkerProvider.get();
  }

  @Test
  public void validNewChange() throws Exception {
    Change c = insertChange();
    insertPatchSet(c);
    incrementPatchSet(c);
    insertPatchSet(c);
    assertProblems(c);
  }

  @Test
  public void validMergedChange() throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    insertPatchSet(c);
    incrementPatchSet(c);

    incrementPatchSet(c);
    RevCommit commit2 = testRepo.branch(c.currentPatchSetId().toRefName()).commit()
        .parent(tip).create();
    PatchSet ps2 = newPatchSet(c.currentPatchSetId(), commit2, adminId);
    db.patchSets().insert(singleton(ps2));

    testRepo.branch(c.getDest().get()).update(commit2);
    assertProblems(c);
  }

  @Test
  public void missingOwner() throws Exception {
    Change c = newChange(project, new Account.Id(2));
    db.changes().insert(singleton(c));
    RevCommit commit = testRepo.branch(c.currentPatchSetId().toRefName()).commit()
        .parent(tip).create();
    PatchSet ps = newPatchSet(c.currentPatchSetId(), commit, adminId);
    db.patchSets().insert(singleton(ps));

    assertProblems(c, "Missing change owner: 2");
  }

  @Test
  public void missingRepo() throws Exception {
    Change c = newChange(new Project.NameKey("otherproject"), adminId);
    db.changes().insert(singleton(c));
    insertMissingPatchSet(c, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
    assertProblems(c, "Destination repository not found: otherproject");
  }

  @Test
  public void invalidRevision() throws Exception {
    Change c = insertChange();

    db.patchSets().insert(singleton(newPatchSet(c.currentPatchSetId(),
            "fooooooooooooooooooooooooooooooooooooooo", adminId)));
    incrementPatchSet(c);
    insertPatchSet(c);

    assertProblems(c,
        "Invalid revision on patch set 1:"
        + " fooooooooooooooooooooooooooooooooooooooo");
  }

  // No test for ref existing but object missing; InMemoryRepository won't let
  // us do such a thing.

  @Test
  public void patchSetObjectAndRefMissing() throws Exception {
    Change c = insertChange();
    PatchSet ps = newPatchSet(c.currentPatchSetId(),
        ObjectId.fromString("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"), adminId);
    db.patchSets().insert(singleton(ps));

    assertProblems(c,
        "Ref missing: " + ps.getId().toRefName(),
        "Object missing: patch set 1: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
  }

  @Test
  public void patchSetObjectAndRefMissingWithFix() throws Exception {
    Change c = insertChange();
    PatchSet ps = newPatchSet(c.currentPatchSetId(),
        ObjectId.fromString("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"), adminId);
    db.patchSets().insert(singleton(ps));

    String refName = ps.getId().toRefName();
    List<ProblemInfo> problems = checker.check(c, new FixInput()).problems();
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo("Ref missing: " + refName);
    assertThat(p.status).isNull();
  }

  @Test
  public void patchSetRefMissing() throws Exception {
    Change c = insertChange();
    PatchSet ps = insertPatchSet(c);
    String refName = ps.getId().toRefName();
    testRepo.update("refs/other/foo", ObjectId.fromString(ps.getRevision().get()));
    deleteRef(refName);

    assertProblems(c, "Ref missing: " + refName);
  }

  @Test
  public void patchSetRefMissingWithFix() throws Exception {
    Change c = insertChange();
    PatchSet ps = insertPatchSet(c);
    String refName = ps.getId().toRefName();
    testRepo.update("refs/other/foo", ObjectId.fromString(ps.getRevision().get()));
    deleteRef(refName);

    List<ProblemInfo> problems = checker.check(c, new FixInput()).problems();
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo("Ref missing: " + refName);
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIXED);
    assertThat(p.outcome).isEqualTo("Repaired patch set ref");

    assertThat(testRepo.getRepository().getRef(refName).getObjectId().name())
        .isEqualTo(ps.getRevision().get());
  }

  @Test
  public void patchSetObjectAndRefMissingWithDeletingPatchSet()
      throws Exception {
    Change c = insertChange();
    PatchSet ps1 = insertPatchSet(c);
    incrementPatchSet(c);
    PatchSet ps2 = insertMissingPatchSet(c,
        "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");

    FixInput fix = new FixInput();
    fix.deletePatchSetIfCommitMissing = true;
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(2);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo("Ref missing: " + ps2.getId().toRefName());
    assertThat(p.status).isNull();
    p = problems.get(1);
    assertThat(p.message).isEqualTo(
        "Object missing: patch set 2: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIXED);
    assertThat(p.outcome).isEqualTo("Deleted patch set");

    c = db.changes().get(c.getId());
    assertThat(c.currentPatchSetId().get()).isEqualTo(1);
    assertThat(db.patchSets().get(ps1.getId())).isNotNull();
    assertThat(db.patchSets().get(ps2.getId())).isNull();
  }

  @Test
  public void patchSetMultipleObjectsMissingWithDeletingPatchSets()
      throws Exception {
    Change c = insertChange();
    PatchSet ps1 = insertPatchSet(c);

    incrementPatchSet(c);
    PatchSet ps2 = insertMissingPatchSet(c,
        "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");

    incrementPatchSet(c);
    PatchSet ps3 = insertPatchSet(c);

    incrementPatchSet(c);
    PatchSet ps4 = insertMissingPatchSet(c,
        "c0ffeeeec0ffeeeec0ffeeeec0ffeeeec0ffeeee");

    FixInput fix = new FixInput();
    fix.deletePatchSetIfCommitMissing = true;
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(4);

    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo("Ref missing: " + ps4.getId().toRefName());
    assertThat(p.status).isNull();

    p = problems.get(1);
    assertThat(p.message).isEqualTo(
        "Object missing: patch set 4: c0ffeeeec0ffeeeec0ffeeeec0ffeeeec0ffeeee");
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIXED);
    assertThat(p.outcome).isEqualTo("Deleted patch set");

    p = problems.get(2);
    assertThat(p.message).isEqualTo("Ref missing: " + ps2.getId().toRefName());
    assertThat(p.status).isNull();

    p = problems.get(3);
    assertThat(p.message).isEqualTo(
        "Object missing: patch set 2: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIXED);
    assertThat(p.outcome).isEqualTo("Deleted patch set");

    c = db.changes().get(c.getId());
    assertThat(c.currentPatchSetId().get()).isEqualTo(3);
    assertThat(db.patchSets().get(ps1.getId())).isNotNull();
    assertThat(db.patchSets().get(ps2.getId())).isNull();
    assertThat(db.patchSets().get(ps3.getId())).isNotNull();
    assertThat(db.patchSets().get(ps4.getId())).isNull();
  }

  @Test
  public void onlyPatchSetObjectMissingWithFix() throws Exception {
    Change c = insertChange();
    PatchSet ps1 = insertMissingPatchSet(c,
        "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");

    FixInput fix = new FixInput();
    fix.deletePatchSetIfCommitMissing = true;
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(2);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo("Ref missing: " + ps1.getId().toRefName());
    assertThat(p.status).isNull();
    p = problems.get(1);
    assertThat(p.message).isEqualTo(
        "Object missing: patch set 1: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIX_FAILED);
    assertThat(p.outcome)
        .isEqualTo("Cannot delete patch set; no patch sets would remain");

    c = db.changes().get(c.getId());
    assertThat(c.currentPatchSetId().get()).isEqualTo(1);
    assertThat(db.patchSets().get(ps1.getId())).isNotNull();
  }

  @Test
  public void currentPatchSetMissing() throws Exception {
    Change c = insertChange();
    assertProblems(c, "Current patch set 1 not found");
  }

  @Test
  public void duplicatePatchSetRevisions() throws Exception {
    Change c = insertChange();
    PatchSet ps1 = insertPatchSet(c);
    String rev = ps1.getRevision().get();
    incrementPatchSet(c);
    PatchSet ps2 = insertMissingPatchSet(c, rev);
    updatePatchSetRef(ps2);

    assertProblems(c,
        "Multiple patch sets pointing to " + rev + ": [1, 2]");
  }

  @Test
  public void missingDestRef() throws Exception {
    String ref = "refs/heads/master";
    // Detach head so we're allowed to delete ref.
    testRepo.reset(testRepo.getRepository().getRef(ref).getObjectId());
    RefUpdate ru = testRepo.getRepository().updateRef(ref);
    ru.setForceUpdate(true);
    assertThat(ru.delete()).isEqualTo(RefUpdate.Result.FORCED);
    Change c = insertChange();
    RevCommit commit = testRepo.commit().create();
    PatchSet ps = newPatchSet(c.currentPatchSetId(), commit, adminId);
    updatePatchSetRef(ps);
    db.patchSets().insert(singleton(ps));

    assertProblems(c, "Destination ref not found (may be new branch): " + ref);
  }

  @Test
  public void mergedChangeIsNotMerged() throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    PatchSet ps = insertPatchSet(c);
    String rev = ps.getRevision().get();

    assertProblems(c,
        "Patch set 1 (" + rev + ") is not merged into destination ref"
        + " refs/heads/master (" + tip.name()
        + "), but change status is MERGED");
  }

  @Test
  public void newChangeIsMerged() throws Exception {
    Change c = insertChange();
    RevCommit commit = testRepo.branch(c.currentPatchSetId().toRefName()).commit()
        .parent(tip).create();
    PatchSet ps = newPatchSet(c.currentPatchSetId(), commit, adminId);
    db.patchSets().insert(singleton(ps));
    testRepo.branch(c.getDest().get()).update(commit);

    assertProblems(c,
        "Patch set 1 (" + commit.name() + ") is merged into destination ref"
        + " refs/heads/master (" + commit.name()
        + "), but change status is NEW");
  }

  @Test
  public void newChangeIsMergedWithFix() throws Exception {
    Change c = insertChange();
    RevCommit commit = testRepo.branch(c.currentPatchSetId().toRefName()).commit()
        .parent(tip).create();
    PatchSet ps = newPatchSet(c.currentPatchSetId(), commit, adminId);
    db.patchSets().insert(singleton(ps));
    testRepo.branch(c.getDest().get()).update(commit);

    List<ProblemInfo> problems = checker.check(c, new FixInput()).problems();
    assertThat(problems).hasSize(1);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo(
        "Patch set 1 (" + commit.name() + ") is merged into destination ref"
        + " refs/heads/master (" + commit.name()
        + "), but change status is NEW");
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIXED);
    assertThat(p.outcome).isEqualTo("Marked change as merged");

    c = db.changes().get(c.getId());
    assertThat(c.getStatus()).isEqualTo(Change.Status.MERGED);
    assertProblems(c);
  }

  @Test
  public void expectedMergedCommitIsLatestPatchSet() throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    PatchSet ps = insertPatchSet(c);
    RevCommit commit = parseCommit(ps);
    testRepo.update(c.getDest().get(), commit);

    FixInput fix = new FixInput();
    fix.expectMergedAs = commit.name();
    assertThat(checker.check(c, fix).problems()).isEmpty();
  }

  @Test
  public void expectedMergedCommitNotMergedIntoDestination() throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    PatchSet ps = insertPatchSet(c);
    RevCommit commit = parseCommit(ps);
    testRepo.update(c.getDest().get(), commit);

    FixInput fix = new FixInput();
    RevCommit other =
        testRepo.commit().message(commit.getFullMessage()).create();
    fix.expectMergedAs = other.name();
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(1);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo(
        "Expected merged commit " + other.name()
        + " is not merged into destination ref refs/heads/master"
        + " (" + commit.name() + ")");
  }

  @Test
  public void createNewPatchSetForExpectedMergeCommitWithNoChangeId()
      throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    RevCommit parent =
        testRepo.branch(c.getDest().get()).commit().message("parent").create();
    PatchSet ps = insertPatchSet(c);
    RevCommit commit = parseCommit(ps);

    RevCommit mergedAs = testRepo.commit().parent(parent)
        .message(commit.getShortMessage()).create();
    testRepo.getRevWalk().parseBody(mergedAs);
    assertThat(mergedAs.getFooterLines(FooterConstants.CHANGE_ID)).isEmpty();
    testRepo.update(c.getDest().get(), mergedAs);

    assertProblems(c, "Patch set 1 (" + commit.name() + ") is not merged into"
        + " destination ref refs/heads/master (" + mergedAs.name()
        + "), but change status is MERGED");

    FixInput fix = new FixInput();
    fix.expectMergedAs = mergedAs.name();
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(1);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo(
        "No patch set found for merged commit " + mergedAs.name());
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIXED);
    assertThat(p.outcome).isEqualTo("Inserted as patch set 2");

    c = db.changes().get(c.getId());
    PatchSet.Id psId2 = new PatchSet.Id(c.getId(), 2);
    assertThat(c.currentPatchSetId()).isEqualTo(psId2);
    assertThat(db.patchSets().get(psId2).getRevision().get())
        .isEqualTo(mergedAs.name());

    assertProblems(c);
  }

  @Test
  public void createNewPatchSetForExpectedMergeCommitWithChangeId()
      throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    RevCommit parent =
        testRepo.branch(c.getDest().get()).commit().message("parent").create();
    PatchSet ps = insertPatchSet(c);
    RevCommit commit = parseCommit(ps);

    RevCommit mergedAs = testRepo.commit().parent(parent)
        .message(commit.getShortMessage() + "\n"
            + "\n"
            + "Change-Id: " + c.getKey().get() + "\n").create();
    testRepo.getRevWalk().parseBody(mergedAs);
    assertThat(mergedAs.getFooterLines(FooterConstants.CHANGE_ID))
        .containsExactly(c.getKey().get());
    testRepo.update(c.getDest().get(), mergedAs);

    assertProblems(c, "Patch set 1 (" + commit.name() + ") is not merged into"
        + " destination ref refs/heads/master (" + mergedAs.name()
        + "), but change status is MERGED");

    FixInput fix = new FixInput();
    fix.expectMergedAs = mergedAs.name();
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(1);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo(
        "No patch set found for merged commit " + mergedAs.name());
    assertThat(p.status).isEqualTo(ProblemInfo.Status.FIXED);
    assertThat(p.outcome).isEqualTo("Inserted as patch set 2");

    c = db.changes().get(c.getId());
    PatchSet.Id psId2 = new PatchSet.Id(c.getId(), 2);
    assertThat(c.currentPatchSetId()).isEqualTo(psId2);
    assertThat(db.patchSets().get(psId2).getRevision().get())
        .isEqualTo(mergedAs.name());

    assertProblems(c);
  }

  @Test
  public void expectedMergedCommitIsOldPatchSetOfSameChange()
      throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    PatchSet ps1 = insertPatchSet(c);
    String rev1 = ps1.getRevision().get();
    incrementPatchSet(c);
    PatchSet ps2 = insertPatchSet(c);
    testRepo.branch(c.getDest().get()).update(parseCommit(ps1));

    FixInput fix = new FixInput();
    fix.expectMergedAs = rev1;
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(1);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo(
        "Expected merged commit " + rev1 + " corresponds to patch set "
        + ps1.getId() + ", which is not the current patch set " + ps2.getId());
  }

  @Test
  public void expectedMergedCommitWithMismatchedChangeId() throws Exception {
    Change c = insertChange();
    c.setStatus(Change.Status.MERGED);
    RevCommit parent =
        testRepo.branch(c.getDest().get()).commit().message("parent").create();
    PatchSet ps = insertPatchSet(c);
    RevCommit commit = parseCommit(ps);

    String badId = "I0000000000000000000000000000000000000000";
    RevCommit mergedAs = testRepo.commit().parent(parent)
        .message(commit.getShortMessage() + "\n"
            + "\n"
            + "Change-Id: " + badId + "\n")
        .create();
    testRepo.getRevWalk().parseBody(mergedAs);
    testRepo.update(c.getDest().get(), mergedAs);

    FixInput fix = new FixInput();
    fix.expectMergedAs = mergedAs.name();
    List<ProblemInfo> problems = checker.check(c, fix).problems();
    assertThat(problems).hasSize(1);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo(
        "Expected merged commit " + mergedAs.name() + " has Change-Id: "
        + badId + ", but expected " + c.getKey().get());
  }

  @Test
  public void expectedMergedCommitMatchesMultiplePatchSets()
      throws Exception {
    Change c1 = insertChange();
    c1.setStatus(Change.Status.MERGED);
    insertPatchSet(c1);

    RevCommit commit = testRepo.branch(c1.getDest().get()).commit().create();
    Change c2 = insertChange();
    PatchSet ps2 = newPatchSet(c2.currentPatchSetId(), commit, adminId);
    updatePatchSetRef(ps2);
    db.patchSets().insert(singleton(ps2));

    Change c3 = insertChange();
    PatchSet ps3 = newPatchSet(c3.currentPatchSetId(), commit, adminId);
    updatePatchSetRef(ps3);
    db.patchSets().insert(singleton(ps3));

    FixInput fix = new FixInput();
    fix.expectMergedAs = commit.name();
    List<ProblemInfo> problems = checker.check(c1, fix).problems();
    assertThat(problems).hasSize(1);
    ProblemInfo p = problems.get(0);
    assertThat(p.message).isEqualTo(
        "Multiple patch sets for expected merged commit " + commit.name()
        + ": [" + ps2 + ", " + ps3 + "]");
  }

  private Change insertChange() throws Exception {
    Change c = newChange(project, adminId);
    db.changes().insert(singleton(c));
    return c;
  }

  private void incrementPatchSet(Change c) throws Exception {
    TestChanges.incrementPatchSet(c);
    db.changes().upsert(singleton(c));
  }

  private PatchSet insertPatchSet(Change c) throws Exception {
    db.changes().upsert(singleton(c));
    RevCommit commit = testRepo.branch(c.currentPatchSetId().toRefName()).commit()
        .parent(tip).message("Change " + c.getId().get()).create();
    PatchSet ps = newPatchSet(c.currentPatchSetId(), commit, adminId);
    updatePatchSetRef(ps);
    db.patchSets().insert(singleton(ps));
    return ps;
  }

  private PatchSet insertMissingPatchSet(Change c, String id) throws Exception {
    PatchSet ps = newPatchSet(c.currentPatchSetId(),
        ObjectId.fromString(id), adminId);
    db.patchSets().insert(singleton(ps));
    return ps;
  }

  private void updatePatchSetRef(PatchSet ps) throws Exception {
    testRepo.update(ps.getId().toRefName(),
        ObjectId.fromString(ps.getRevision().get()));
  }

  private void deleteRef(String refName) throws Exception {
    RefUpdate ru = testRepo.getRepository().updateRef(refName, true);
    ru.setForceUpdate(true);
    assertThat(ru.delete()).isEqualTo(RefUpdate.Result.FORCED);
  }

  private RevCommit parseCommit(PatchSet ps) throws Exception {
    RevCommit commit = testRepo.getRevWalk()
        .parseCommit(ObjectId.fromString(ps.getRevision().get()));
    testRepo.getRevWalk().parseBody(commit);
    return commit;
  }

  private void assertProblems(Change c, String... expected) {
    assertThat(Lists.transform(checker.check(c).problems(),
          new Function<ProblemInfo, String>() {
            @Override
            public String apply(ProblemInfo in) {
              checkArgument(in.status == null,
                  "Status is not null: " + in.message);
              return in.message;
            }
          })).containsExactly((Object[]) expected);
  }
}


text:
package reads

//go:generate env GO111MODULE=on go run github.com/benbjohnson/tmpl -data=@array_cursor.gen.go.tmpldata array_cursor.gen.go.tmpl
//go:generate env GO111MODULE=on go run github.com/benbjohnson/tmpl -data=@array_cursor.gen.go.tmpldata -o=array_cursor_gen_test.go array_cursor_test.gen.go.tmpl


text:
Accesslog analyzer in clojure

## Prerequisites

You will need [Leiningen][1] 1.7.0 or above installed.

[1]: https://github.com/technomancy/leiningen

## Running

Load the sql schema from clog.sql into your mysql database.
Configure mysql settings in src/clog/config.clj.

To start a web server for the application, run:

    lein run

It will be located at http://localhost:3000

## License

Copyright © 2013 FIXME


text: Practicing git while learning React Native


text:
package org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;

import org.apache.hadoop.util.Shell;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerEventType;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerExitEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.UnsupportedFileSystemException;
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.concurrent.HadoopExecutors;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
import org.apache.hadoop.yarn.server.nodemanager.Context;
import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManagerImpl;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService;

import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;

/**
 * The launcher for the containers. This service should be started only after
 * the {@link ResourceLocalizationService} is started as it depends on creation
 * of system directories on the local file-system.
 *
 */
public class ContainersLauncher extends AbstractService
    implements AbstractContainersLauncher {

  private static final Logger LOG =
       LoggerFactory.getLogger(ContainersLauncher.class);

  private Context context;
  private ContainerExecutor exec;
  private Dispatcher dispatcher;
  private ContainerManagerImpl containerManager;

  private LocalDirsHandlerService dirsHandler;
  @VisibleForTesting
  public ExecutorService containerLauncher =
      HadoopExecutors.newCachedThreadPool(
        new ThreadFactoryBuilder()
          .setNameFormat("ContainersLauncher #%d")
          .build());
  @VisibleForTesting
  public final Map<ContainerId, ContainerLaunch> running =
    Collections.synchronizedMap(new HashMap<ContainerId, ContainerLaunch>());

  public ContainersLauncher() {
    super("containers-launcher");
  }

  @VisibleForTesting
  public ContainersLauncher(Context context, Dispatcher dispatcher,
      ContainerExecutor exec, LocalDirsHandlerService dirsHandler,
      ContainerManagerImpl containerManager) {
    this();
    init(context, dispatcher, exec, dirsHandler, containerManager);
  }

  @Override
  public void init(Context nmContext, Dispatcher nmDispatcher,
      ContainerExecutor containerExec, LocalDirsHandlerService nmDirsHandler,
      ContainerManagerImpl nmContainerManager) {
    this.exec = containerExec;
    this.context = nmContext;
    this.dispatcher = nmDispatcher;
    this.dirsHandler = nmDirsHandler;
    this.containerManager = nmContainerManager;
  }

  @Override
  protected void serviceInit(Configuration conf) throws Exception {
    try {
      //TODO Is this required?
      FileContext.getLocalFSFileContext(conf);
    } catch (UnsupportedFileSystemException e) {
      throw new YarnRuntimeException("Failed to start ContainersLauncher", e);
    }
    super.serviceInit(conf);
  }

  @Override
  protected  void serviceStop() throws Exception {
    containerLauncher.shutdownNow();
    super.serviceStop();
  }

  @Override
  public void handle(ContainersLauncherEvent event) {
    // TODO: ContainersLauncher launches containers one by one!!
    Container container = event.getContainer();
    ContainerId containerId = container.getContainerId();
    switch (event.getType()) {
      case LAUNCH_CONTAINER:
        Application app =
          context.getApplications().get(
              containerId.getApplicationAttemptId().getApplicationId());

        ContainerLaunch launch =
            new ContainerLaunch(context, getConfig(), dispatcher, exec, app,
              event.getContainer(), dirsHandler, containerManager);
        containerLauncher.submit(launch);
        running.put(containerId, launch);
        break;
      case RELAUNCH_CONTAINER:
        app = context.getApplications().get(
                containerId.getApplicationAttemptId().getApplicationId());

        ContainerRelaunch relaunch =
            new ContainerRelaunch(context, getConfig(), dispatcher, exec, app,
                event.getContainer(), dirsHandler, containerManager);
        containerLauncher.submit(relaunch);
        running.put(containerId, relaunch);
        break;
      case RECOVER_CONTAINER:
        app = context.getApplications().get(
            containerId.getApplicationAttemptId().getApplicationId());
        launch = new RecoveredContainerLaunch(context, getConfig(), dispatcher,
            exec, app, event.getContainer(), dirsHandler, containerManager);
        containerLauncher.submit(launch);
        running.put(containerId, launch);
        break;
      case RECOVER_PAUSED_CONTAINER:
        app = context.getApplications().get(
            containerId.getApplicationAttemptId().getApplicationId());
        launch = new RecoverPausedContainerLaunch(context, getConfig(),
            dispatcher, exec, app, event.getContainer(), dirsHandler,
            containerManager);
        containerLauncher.submit(launch);
        break;
      case CLEANUP_CONTAINER:
        cleanup(event, containerId, true);
        break;
      case CLEANUP_CONTAINER_FOR_REINIT:
        cleanup(event, containerId, false);
        break;
      case SIGNAL_CONTAINER:
        SignalContainersLauncherEvent signalEvent =
            (SignalContainersLauncherEvent) event;
        ContainerLaunch runningContainer = running.get(containerId);
        if (runningContainer == null) {
          // Container not launched. So nothing needs to be done.
          LOG.info("Container " + containerId + " not running, nothing to signal.");
          return;
        }

        try {
          runningContainer.signalContainer(signalEvent.getCommand());
        } catch (IOException e) {
          LOG.warn("Got exception while signaling container " + containerId
              + " with command " + signalEvent.getCommand());
        }
        break;
      case PAUSE_CONTAINER:
        ContainerLaunch launchedContainer = running.get(containerId);
        if (launchedContainer == null) {
          // Container not launched. So nothing needs to be done.
          return;
        }

        // Pause the container
        try {
          launchedContainer.pauseContainer();
        } catch (Exception e) {
          LOG.info("Got exception while pausing container: " +
            StringUtils.stringifyException(e));
        }
        break;
      case RESUME_CONTAINER:
        ContainerLaunch launchCont = running.get(containerId);
        if (launchCont == null) {
          // Container not launched. So nothing needs to be done.
          return;
        }

        // Resume the container.
        try {
          launchCont.resumeContainer();
        } catch (Exception e) {
          LOG.info("Got exception while resuming container: " +
            StringUtils.stringifyException(e));
        }
        break;
    }
  }

  @VisibleForTesting
  void cleanup(ContainersLauncherEvent event, ContainerId containerId,
      boolean async) {
    ContainerLaunch existingLaunch = running.remove(containerId);
    if (existingLaunch == null) {
      // Container not launched.
      // triggering KILLING to CONTAINER_CLEANEDUP_AFTER_KILL transition.
      dispatcher.getEventHandler().handle(
          new ContainerExitEvent(containerId,
              ContainerEventType.CONTAINER_KILLED_ON_REQUEST,
              Shell.WINDOWS ?
                  ContainerExecutor.ExitCode.FORCE_KILLED.getExitCode() :
                  ContainerExecutor.ExitCode.TERMINATED.getExitCode(),
              "Container terminated before launch."));
      return;
    }

    // Cleanup a container whether it is running/killed/completed, so that
    // no sub-processes are alive.
    ContainerCleanup cleanup = new ContainerCleanup(context, getConfig(),
        dispatcher, exec, event.getContainer(), existingLaunch);
    if (async) {
      containerLauncher.submit(cleanup);
    } else {
      cleanup.run();
    }
  }
}


text:
/*!
 * Start Bootstrap - Freelancer Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

body {
    overflow-x: hidden;
}

p {
    font-size: 20px;
}

p.small {
    font-size: 16px;
}

a,
a:hover,
a:focus,
a:active,
a.active {
    outline: 0;
    color: greenyellow;
}
/*html link colors. a*/

h1,
h2,
h3,
h4,
h5,
h6 {
    text-transform: uppercase;
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
    font-weight: 700;
}

/* lilnes shape */
hr.star-light,
hr.star-primary {
    margin: 25px auto 30px;
    padding: 0;
    max-width: 250px;
    border: 0;
    border-top: solid 5px;
    text-align: center;
}

/* star shape definition*/
hr.star-light:after,
hr.star-primary:after {
    content: "\f0c8";
    display: inline-block;
    position: relative;
    top: -.8em;
    padding: 0 .25em;
    font-family: FontAwesome;
    font-size: 2em;
}

/* star lines over gray*/
hr.star-light {
    border-color: brown;
}

/*stars used under titles over gray*/
hr.star-light:after {
    color: brown;
    background-color: rgba(0,0,0,0) ;
}

/* star lines color */
hr.star-primary {
    border-color: orange;
}
/* star color over white*/
hr.star-primary:after {
    color: orange;
    background-color: #fff;
}

.img-centered {
    margin: 0 auto;
}

/* main section on page*/
header {
    text-align: center;
    color: #fff ; /*text color */
    background: slategray;
}

header .container {
    padding-top: 100px;
    padding-bottom: 50px;
}

header img {
    display: block;
    margin: 0 auto 20px;
}

header .intro-text .name {
    display: block;
    text-transform: uppercase;
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
    font-size: 2em;
    font-weight: 700;
}

header .intro-text .skills {
    font-size: 1.25em;
    font-weight: 300;
}

@media(min-width:768px) {
    header .container {
        padding-top: 125px;
        padding-bottom: 100px;
    }

    header .intro-text .name {
        font-size: 4.75em;
    }

    header .intro-text .skills {
        font-size: 1.75em;
    }
}

@media(min-width:768px) {
    .navbar-fixed-top {
        padding: 25px 0;
        -webkit-transition: padding .3s;
        -moz-transition: padding .3s;
        transition: padding .3s;
    }

    .navbar-fixed-top .navbar-brand {
        font-size: 6.5em;
        -webkit-transition: all .3s;
        -moz-transition: all .3s;
        transition: all .3s;
    }
/*used for images. still not working quite right*/
/*    .navbar-fixed-top .navbar-brand img{
        width: 50%;
        max-width: 50%

    }*/

    .navbar-fixed-top.navbar-shrink {
        padding: 2px 0;
    }

/* font in navbar */
    .navbar-fixed-top.navbar-shrink .navbar-brand {
        font-size: 3.5em;

    }
    /*used for images. still not workign quite right*/
/*    .navbar-fixed-top.navbar-shrink .navbar-brand  img{
        width: 25%;
        max-width: 25%;
        height: 150px;
    }*/
}

.navbar {
    /*text-transform: uppercase;*/
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
    font-weight: 500;
}

.navbar a:focus {
    outline: 0;
}

.navbar .navbar-nav {
    letter-spacing: 1px;
}

.navbar .navbar-nav li a:focus {
    outline: 0;
}

.navbar-default,
.navbar-inverse {
    border: 0;
}

section {
    padding: 100px 0;
}

section h2 {
    margin: 0;
    font-size: 3em;
}

/* about page */
section.success {
    color: #fff;
    background: brown;
}

@media(max-width:767px) {
    section {
        padding: 75px 0;
    }

    section.first {
        padding-top: 75px;
    }
}

#portfolio .portfolio-item {
    right: 0;
    margin: 0 0 15px;
}

/*each button on front page no hover probably*/
#portfolio .portfolio-item .portfolio-link {
    display: block;
    position: relative;
    margin: 0 auto;
    max-width: 400px;
}

/* each button on front page hover over*/
#portfolio .portfolio-item .portfolio-link .caption {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    /*background: orange;*/ /* use rgba color for alpha. it's nicer. */
    background: rgba(24,188,156,.9);
    -webkit-transition: all ease .5s;
    -moz-transition: all ease .5s;
    transition: all ease .5s;
}

#portfolio .portfolio-item .portfolio-link .caption:hover {
    opacity: 1;
}

#portfolio .portfolio-item .portfolio-link .caption .caption-content {
    position: absolute;
    top: 50%;
    width: 100%;
    height: 20px;
    margin-top: -12px;
    text-align: center;
    font-size: 20px;
    color: #fff;
}

#portfolio .portfolio-item .portfolio-link .caption .caption-content i {
    margin-top: -12px;
}

#portfolio .portfolio-item .portfolio-link .caption .caption-content h3,
#portfolio .portfolio-item .portfolio-link .caption .caption-content h4 {
    margin: 0;
}

#portfolio * {
    z-index: 2;
}

@media(min-width:767px) {
    #portfolio .portfolio-item {
        margin: 0 0 30px;
    }
}

.btn-outline {
    margin-top: 15px;
    border: solid 2px #fff;
    font-size: 20px;
    color: #fff;
    background: 0 0;
    transition: all .3s ease-in-out;
}

.btn-outline-top {
    margin-top: 10px;
    border: solid 2px #fff;
    font-size: 20px;
    color: #fff;
    background: 0 0;
    transition: all .3s ease-in-out;
}

.btn-outline:hover,
.btn-outline:focus,
.btn-outline:active,
.btn-outline.active,
.btn-outline-top:hover,
.btn-outline-top:focus,
.btn-outline-top:active,
.btn-outline-top.active {
    border: solid 2px yellow;
    color: green;
    background: pink;
}
/*buttons: social media buttons, hover bottom download button.*/

.floating-label-form-group {
    position: relative;
    margin-bottom: 0;
    padding-bottom: .5em;
    border-bottom: 1px solid #eee;
}

.floating-label-form-group input,
.floating-label-form-group textarea {
    z-index: 1;
    position: relative;
    padding-right: 0;
    padding-left: 0;
    border: 0;
    border-radius: 0;
    font-size: 1.5em;
    background: 0 0;
    box-shadow: none!important;
    resize: none;
}

.floating-label-form-group label {
    display: block;
    z-index: 0;
    position: relative;
    top: 2em;
    margin: 0;
    font-size: .85em;
    line-height: 1.764705882em;
    vertical-align: middle;
    vertical-align: baseline;
    opacity: 0;
    -webkit-transition: top .3s ease,opacity .3s ease;
    -moz-transition: top .3s ease,opacity .3s ease;
    -ms-transition: top .3s ease,opacity .3s ease;
    transition: top .3s ease,opacity .3s ease;
}

.floating-label-form-group::not(:first-child) {
    padding-left: 14px;
    border-left: 1px solid #eee;
}

.floating-label-form-group-with-value label {
    top: 0;
    opacity: 1;
}

.floating-label-form-group-with-focus label {
    color: #18bc9c;
}

form .row:first-child .floating-label-form-group {
    border-top: 1px solid #eee;
}

footer {
    color: #fff;
}

/* footer text */
footer h3 {
    margin-bottom: 30px;
}

/*bottom footer*/
footer .footer-above {
    padding-top: 50px;
    background-color: blue;
}

footer .footer-col {
    margin-bottom: 50px;
}

/* bottom most footer*/
footer .footer-below {
    padding: 25px 0;
    background-color: red;
}

/*bottom social buttons*/
.btn-social {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 2px solid #fff;
    border-radius: 100%;
    text-align: center;
    font-size: 20px;
    line-height: 45px;
}

.btn-social-top {
    display: inline-block;
    width: 40px;
    height: 50px;
    border: 2px solid #fff;
    border-radius: 10%;
    text-align: center;
    font-size: 20px;
    line-height: 45px;
}

.btn:focus,
.btn:active,
.btn.active {
    outline: 0;
}

.scroll-top {
    z-index: 1049;
    position: fixed;
    right: 2%;
    bottom: 2%;
    width: 50px;
    height: 50px;
}

.scroll-top .btn {
    width: 50px;
    height: 50px;
    border-radius: 100%;
    font-size: 20px;
    line-height: 28px;
}

.scroll-top .btn:focus {
    outline: 0;
}

.portfolio-modal .modal-content {
    padding: 100px 0;
    min-height: 100%;
    border: 0;
    border-radius: 0;
    text-align: center;
    background-clip: border-box;
    -webkit-box-shadow: none;
    box-shadow: none;
}

.portfolio-modal .modal-content h2 {
    margin: 0;
    font-size: 3em;
}

.portfolio-modal .modal-content img {
    margin-bottom: 30px;
}

.portfolio-modal .modal-content .item-details {
    margin: 30px 0;
}

.portfolio-modal .close-modal {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 75px;
    height: 75px;
    background-color: transparent;
    cursor: pointer;
}

.portfolio-modal .close-modal:hover {
    opacity: .3;
}

/*half of the x for portfolio*/
.portfolio-modal .close-modal .lr {
    z-index: 1051;
    width: 1px;
    height: 75px;
    margin-left: 35px;
    background-color: orange;
    -webkit-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    transform: rotate(45deg);
}

/* other half of portfolio X */
.portfolio-modal .close-modal .lr .rl {
    z-index: 1052;
    width: 5px;
    height: 75px;
    background-color: green;
    -webkit-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);
}

.portfolio-modal .modal-backdrop {
    display: none;
    opacity: 0;
}

.videoWrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    padding-top: 25px;
    height: 0;
}
.videoWrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.profile-img img{
    width:175px;
}


text:
package be.rubengerits.buildstatus.model.database;

import android.content.ContentValues;
import android.content.Context;
import android.util.Log;

import com.squareup.sqlbrite.BriteDatabase;
import com.squareup.sqlbrite.QueryObservable;
import com.squareup.sqlbrite.SqlBrite;

import javax.inject.Inject;

import be.rubengerits.buildstatus.api.global.Repository;
import be.rubengerits.buildstatus.model.data.Account;

public class DataBaseHelperImpl implements DataBaseHelper {

    private Context context;

    @Inject
    public DataBaseHelperImpl(Context context) {
        this.context = context;
    }

    @Override
    public QueryObservable getAccounts() {
        SqlBrite sqlBrite = SqlBrite.create();
        BriteDatabase db = sqlBrite.wrapDatabaseHelper(new BuildStatusOpenHelper(context));

        return db.createQuery(BuildStatusOpenHelper.TABLE_ACCOUNTS, "SELECT * FROM " + BuildStatusOpenHelper.TABLE_ACCOUNTS);
    }

    @Override
    public boolean hasAccounts() {
        SqlBrite sqlBrite = SqlBrite.create();
        BriteDatabase db = sqlBrite.wrapDatabaseHelper(new BuildStatusOpenHelper(context));

        return db.query("SELECT 1 FROM " + BuildStatusOpenHelper.TABLE_ACCOUNTS).getCount() > 0;
    }

    @Override
    public void saveAccount(Account account) {
        SqlBrite sqlBrite = SqlBrite.create();

        BriteDatabase db = sqlBrite.wrapDatabaseHelper(new BuildStatusOpenHelper(context));

        try (BriteDatabase.Transaction transaction = db.newTransaction()) {
            db.insert(BuildStatusOpenHelper.TABLE_ACCOUNTS, account.toDatabase());
            transaction.markSuccessful();
        }
    }

    @Override
    public QueryObservable getRepositories() {
        SqlBrite sqlBrite = SqlBrite.create();
        BriteDatabase db = sqlBrite.wrapDatabaseHelper(new BuildStatusOpenHelper(context));

        return db.createQuery(BuildStatusOpenHelper.TABLE_REPOSITORIES, "SELECT * FROM " + BuildStatusOpenHelper.TABLE_REPOSITORIES);
    }

    @Override
    public void saveRepository(Repository repository) {
        SqlBrite sqlBrite = SqlBrite.create();

        BriteDatabase db = sqlBrite.wrapDatabaseHelper(new BuildStatusOpenHelper(context));

        try (BriteDatabase.Transaction transaction = db.newTransaction()) {
            int update = db.update(BuildStatusOpenHelper.TABLE_REPOSITORIES, toDatabase(repository), "name LIKE '" + repository.getName() + "'");
            if (update == 0) {
                db.insert(BuildStatusOpenHelper.TABLE_REPOSITORIES, toDatabase(repository));
            }
            transaction.markSuccessful();
        } catch (Exception e) {
            Log.e("dbfail", e.getMessage(), e);
            throw e;
        }
    }

    public ContentValues toDatabase(Repository repo) {
        ContentValues contentValues = new ContentValues();
        contentValues.put("id", repo.getId());
        contentValues.put("name", repo.getName());
        contentValues.put("description", repo.getDescription());
        contentValues.put("lastBuildNumber", repo.getLastBuildNumber());
        contentValues.put("lastBuildState", repo.getLastBuildStatus().getName());
        contentValues.put("lastBuildDuration", repo.getLastBuildDuration());
        contentValues.put("lastBuildFinished", repo.getLastBuildFinishedAt().getTime());
        return contentValues;
    }

    @Override
    public void removeAllRepositories() {
        SqlBrite sqlBrite = SqlBrite.create();

        BriteDatabase db = sqlBrite.wrapDatabaseHelper(new BuildStatusOpenHelper(context));

        try (BriteDatabase.Transaction transaction = db.newTransaction()) {
            db.delete(BuildStatusOpenHelper.TABLE_REPOSITORIES, "name LIKE '*'");
            transaction.markSuccessful();
        } catch (Exception e) {
            Log.e("dbfail", e.getMessage(), e);
            throw e;
        }
    }

}


text:
layout: post
author:
    name: Nikhil Khandelwal
    url: https://twitter.com/nikhilkh
title:  "Apache Cordova Windows 4.0.0 release"
categories: announcements
tags: news releases
---

We are happy to announce that Cordova Windows 4.0.0 has been released!

##Key features
* The default Windows target version is now 8.1. Windows 8.0 support is deprecated and a warning will be issued when building for Windows 8.0. The support for Windows 8.0 will be removed in 6 months. If you have `windows-target-version` preference in config.xml set to 8.0, you will see this warning and you should consider changing it to 8.1.
* `windows8` platform keyword is deprecated. For all plugins, use `windows` as the platform keyword.
* Support for Windows 10 Insider Preview and building using Visual Studio 2015 RC. More details can be found below. This support will evolve as Windows 10 release comes along.
* Support for specifying parameters for signing Windows apps - like signing certificate, publisher identity etc. More details can be found in [docs](http://cordova.apache.org/docs/en/edge/guide_platforms_win8_packaging.md.html#Windows%20Plugins)

##What's new in Windows 10
* Windows 10 Insider Preview introduces the [Universal Windows Platform (UWP)](https://msdn.microsoft.com/en-us/library/windows/apps/dn894631.aspx) which provides a guaranteed core API layer across devices. You can create a single app package that can be installed onto a wide range of devices. A single store makes it easy to publish apps across all device types - desktop, mobile, Xbox, iOT.
* In Windows 8 and 8.1, the app was loaded in the ms-appx  context. In Windows 10 for Cordova, by default the app is loaded in ms-appx-web  and have access to most Windows Runtime APIs. This allows you to [host remote content](https://msdn.microsoft.com/en-us/library/windows/apps/dn705792.aspx) in your Windows Cordova app. More details on how to customize this behavior can be found [here](http://cordova.apache.org/docs/en/edge/guide_platforms_win8_win10-support.md.html#Cordova%20for%20Windows%2010).
* Some JavaScript libraries could not run in Windows 8/8.1 due to the safeHTML restriction and we needed to use winstore-jscompat. In Windows 10 Cordova apps, the security can be applied using [Content Security Policies](http://content-security-policy.com/).

<!--more-->
##Install
You will need to update to cordova-cli 5.1.1 or higher to use this version of the Windows platform:

To add it to an existing project:

    npm install -g cordova
    cordova platform update windows

Alternatively, to add it to a new project:

    npm install -g cordova
    cordova platform add windows

## Changes include:

* [CB-8954](https://issues.apache.org/jira/browse/CB-8954) Adds `requirements` command support to check_reqs module
* [CB-9073](https://issues.apache.org/jira/browse/CB-9073) Fixes build error when path to project contains `&` symbol
* [CB-8889](https://issues.apache.org/jira/browse/CB-8889) Persist app/package name and product ID during platform update.
* Updating appx manifest to a large extent now happens in the `prepare` step as opposed to the `build` step. This change implies that cordova-windows 4.0.0 can only work with with cordova CLI > 5.0
* [CB-8486](https://issues.apache.org/jira/browse/CB-8486) Support for creating signed package and build.json for Windows
* Add preview support for Windows 10 Universal Apps. To target Windows 10, add `<preference name="windows-target-version" value="10.0" />` to config.xml.
* The default windows target version is now 8.1.
* Support for `--appx` command line argument to override the windows target version
* [CB-8946](https://issues.apache.org/jira/browse/CB-8946): Added the `WindowsToastCapable` preference to indicate that the app can support toasts.  This is to support the Local Notifications plugin.
* [CB-8856](https://issues.apache.org/jira/browse/CB-8856) Fix 'Id' attribute is invalid when creating Windows Store submission build
* [CB-8307](https://issues.apache.org/jira/browse/CB-8307): Adding a 25-year expiration temporary certificate.
* [CB-8760](https://issues.apache.org/jira/browse/CB-8760) platform list doesn't show version for windows platform.

##Known Issues with 4.0.0 and Windows 10

* Windows 10 Insider Preview does not have a command-line compatible emulator deployment scenario.  To deploy to an emulator, open your solution file in Visual Studio.
* The Windows SDK included with Visual Studio 2015 RC does not include a tool to deploy to a Windows 10 Phone.  To deploy to a phone, open your solution file in Visual Studio.
* WinJS is included inline in the package.  In the future, it might be migrated to an NPM dependency. WinJS UI functionality is not included and should be add by you. (see [WinJS on Github](http://github.com/winjs/winjs))


text:
<?php
/**
 * Test class for CompleXml_Dataset_Request.
 * @group Dataset
 */
class CompleXml_Dataset_RequestTest extends PHPUnit_Framework_TestCase
{

    public function testRequestCreate()
    {
        $request = new CompleXml_Dataset_Request();

        $this->assertEquals($request->Post->getAllValues(), array());
        $this->assertEquals($request->Get->getAllValues(), array());
    }

    public function testIsPost()
    {
        $request = new CompleXml_Dataset_Request();
        $this->assertFalse($request->isPost());
        $_SERVER['REQUEST_METHOD'] = 'post';
        $this->assertTrue($request->isPost());
    }

    public function testIsGet()
    {
        $request = new CompleXml_Dataset_Request();
        $this->assertFalse($request->isGet());
        $_SERVER['REQUEST_METHOD'] = 'get';
        $this->assertTrue($request->isGet());
    }

    public function testIsAjax()
    {
        $request = new CompleXml_Dataset_Request();
        $this->assertFalse($request->isAjax());
        $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] = 'XMLHttpRequest';
        $this->assertTrue($request->isAjax());
    }
}


text:
package webserviceclients.audit2

import com.google.inject.Inject
import play.api.http.Status
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.util.control.NonFatal
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.{TrackingId, ClientSideSessionFactory}
import uk.gov.dvla.vehicles.presentation.common.LogFormats.DVLALogger
import uk.gov.dvla.vehicles.presentation.common.services.DateService
import uk.gov.dvla.vehicles.presentation.common.webserviceclients.healthstats.HealthStats
import uk.gov.dvla.vehicles.presentation.common.webserviceclients.healthstats.HealthStatsFailure
import uk.gov.dvla.vehicles.presentation.common.webserviceclients.healthstats.HealthStatsSuccess
import utils.helpers.Config

class AuditServiceImpl @Inject()(config: Config,
                                 ws: AuditMicroService,
                                 dateService: DateService,
                                 healthStats: HealthStats)
                                (implicit clientSideSessionFactory: ClientSideSessionFactory)
  extends AuditService with DVLALogger {

  override def send(auditRequest: AuditRequest, trackingId: TrackingId): Future[Unit] = {
    import AuditServiceImpl.ServiceName

    if (config.auditMicroServiceUrlBase == "NOT FOUND") {
      val msg = "auditMicroServiceUrlBase not set in config so not attempting to call the micro-service"
      Future.successful(logMessage(trackingId, Info, msg))
    }
    else ws.invoke(auditRequest, trackingId).map { resp =>
      if (resp.status == Status.OK)
        healthStats.success(HealthStatsSuccess(ServiceName, dateService.now))
      else {
        val msg = s"Audit micro-service call http status not OK, it was: ${resp.status}"
        logMessage(trackingId, Error, msg)
        val error = new RuntimeException(msg)
        healthStats.failure(HealthStatsFailure(ServiceName, dateService.now, error))
        throw error
      }
    }.recover {
      case NonFatal(e) =>
        logMessage(trackingId, Error, s"Audit call failed because of: $e")
        healthStats.failure(HealthStatsFailure(ServiceName, dateService.now, e))
        throw e
    }
  }
}

object AuditServiceImpl {
  final val ServiceName = "audit-microservice"
}


text:
/**
 * Various Spring aspects for Genie web.
 *
 * @author amajumdar
 * @since 3.0.0
 */
package com.netflix.genie.web.aspects;


text:
#ifndef v4l2_decode_h
#define v4l2_decode_h

#include <vector>

#include "v4l2_codecbase.h"
#include "VideoDecoderInterface.h"

#ifdef __ENABLE_EGL__
namespace YamiMediaCodec {
    class EglVaapiImage;
}
#endif

using namespace YamiMediaCodec;
typedef SharedPtr < IVideoDecoder > DecoderPtr;
class V4l2Decoder : public V4l2CodecBase
{
  public:
    V4l2Decoder();
     ~V4l2Decoder();

    virtual int32_t ioctl(int request, void* arg);
    virtual void* mmap(void* addr, size_t length,
                         int prot, int flags, unsigned int offset);
#ifdef __ENABLE_EGL__
    virtual int32_t useEglImage(EGLDisplay eglDisplay, EGLContext eglContext, uint32_t buffer_index, void* egl_image);
#endif

  protected:
    virtual bool start();
    virtual bool stop();
    virtual bool acceptInputBuffer(struct v4l2_buffer *qbuf);
    virtual bool giveOutputBuffer(struct v4l2_buffer *dqbuf);
    virtual bool inputPulse(uint32_t index);
    virtual bool outputPulse(uint32_t &index);
    virtual bool recycleOutputBuffer(int32_t index);
    virtual bool recycleInputBuffer(struct v4l2_buffer *qbuf);
    virtual void releaseCodecLock(bool lockable);
    virtual void flush();

  private:
    DecoderPtr m_decoder;
    std::vector<uint8_t> m_codecData;
    bool m_bindEglImage;
    // VideoFormatInfo m_videoFormatInfo;
    // chrome requires m_maxBufferCount[OUTPUT] to be big enough (dpb size + some extra ones), it is correct when we export YUV buffer direcly
    // however, we convert YUV frame to temporary RGBX frame; so the RGBX frame pool is not necessary to be that big.
    uint32_t m_actualOutBufferCount;

    uint32_t m_maxBufferSize[2];
    uint8_t *m_bufferSpace[2];

    std::vector<VideoDecodeBuffer> m_inputFrames;
    std::vector<VideoFrameRawData> m_outputRawFrames;

    uint32_t m_videoWidth;
    uint32_t m_videoHeight;
    uint32_t m_outputBufferCountOnInit;

    // debug
    uint32_t m_outputBufferCountQBuf;
    uint32_t m_outputBufferCountPulse;
    uint32_t m_outputBufferCountGive;
#ifdef __ENABLE_EGL__
    std::vector <SharedPtr<EglVaapiImage> > m_eglVaapiImages;
#endif
};
#endif


text:
//
//  LoginTool.h
//  YueSheng
//
//  Created by yellow on 16/8/1.
//  Copyright © 2016年 yellow. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "LoginParam.h"
#import "LoginStatus.h"

@interface LoginTool : NSObject
/**
 *  @param param   请求参数,请求参数应该由外面决定
 *  @param success 请求成功后的回调
 *  @param failure 请求失败后的回调
 */
+ (void)loginStatusesWithParameters:(LoginParam *)param success:(void(^)(LoginStatus *status))success failure:(void(^)(NSError *error))failure;
@end


text:
/**
 * @module gallery-mathcanvas
 */

/**********************************************************************
 *
Quotient of values.

 *
 * @namespace MathFunction
 * @class Quotient
 * @extends MathFunction.FunctionWithArgs
 * @constructor
 * @param n {MathFunction} numerator
 * @param d {MathFunction} denominator
 */

function MathQuotient(
	/* MathFunction */	n,
	/* MathFunction */	d)
{
	MathQuotient.superclass.constructor.call(this, "/", n, d);
}

Y.extend(MathQuotient, MathFunctionWithArgs,
{
	/**
	 * @method evaluate
	 * @param var_list {Object} map of variable names to values or MathFunctions
	 * @return the value of the function
	 */
	evaluate: function(
		/* map */	var_list)
	{
		return Y.ComplexMath.divide(this.args[0].evaluate(var_list),
									this.args[1].evaluate(var_list));
	},

	/**
	 * @method prepareToRender
	 * @param canvas {MathCanvas} the drawing canvas
	 * @param top_left {point} x,y coordinates of the top left of the bounding box
	 * @param font_size {float} percentage of the base font size
	 * @param rect_list {RectList} layout information
	 * @return {int} index of this items info in rect_list
	 */
	prepareToRender: function(
		/* Context2d */		context,
		/* point */			top_left,
		/* percentage */	font_size,
		/* RectList */		rect_list)
	{
		var total_rect =
		{
			top:    top_left.y,
			left:   top_left.x,
			bottom: top_left.y,
			right:  top_left.x
		};

		var space_width = context.getStringWidth(font_size, ' ');

		var arg_top_left = Y.clone(top_left, true);
		arg_top_left.x += space_width;

		// get rectangle for numerator

		var n_arg_index = this.args[0].prepareToRender(context, arg_top_left, font_size, rect_list);
		var n_arg_info  = rect_list.get(n_arg_index);
		arg_top_left.y  = n_arg_info.rect.bottom;
		total_rect      = RectList.cover(total_rect, n_arg_info.rect);

		// create space for division line

		var bar_height    = context.getHorizontalBarHeight();
		var total_midline = arg_top_left.y + bar_height/2;
		arg_top_left.y   += bar_height;

		// get rectangle for denominator

		var d_arg_index = this.args[1].prepareToRender(context, arg_top_left, font_size, rect_list);
		var d_arg_info  = rect_list.get(d_arg_index);
		total_rect      = RectList.cover(total_rect, d_arg_info.rect);

		// align centers of numerator and denominator horizontally
		// (this is guaranteed to leave ourRect constant)

		var dx = (n_arg_info.rect.right - d_arg_info.rect.right)/2;
		if (dx > 0)
		{
			rect_list.shift(d_arg_index, dx, 0);
		}
		else if (dx < 0)
		{
			rect_list.shift(n_arg_index, -dx, 0);
		}

		// add one extra space at the right so division line is wider than arguments

		total_rect.right += space_width;

		return rect_list.add(total_rect, total_midline, font_size, this);
	},

	/**
	 * @method render
	 * @param canvas {MathCanvas} the drawing canvas
	 * @param rect_list {RectList} layout information
	 */
	render: function(
		/* Context2d */	context,
		/* RectList */	rect_list)
	{
		var info = rect_list.find(this);

		var bar_height = context.getHorizontalBarHeight();
		var bar_rect =
		{
			top:    info.midline - bar_height/2,
			left:   info.rect.left,
			bottom: info.midline + bar_height/2,
			right:  info.rect.right
		};

		this.args[0].render(context, rect_list);
		context.drawHorizontalBar(bar_rect);
		this.args[1].render(context, rect_list);
	},

	/**
	 * @method toString
	 * @return text representation of the function
	 */
	toString: function()
	{
		return this._printArg(0) + '/' + this._printArg(1);
	}
});

MathFunction.Quotient = MathQuotient;


text:
'use strict';

var _ = require('lodash'),
    expect = require('chai').expect,
    sinon = require('sinon'),
    circuitbox = require('../lib'),
    ComponentDefinitionBuilderFactory = require('../lib/componentDefinitionBuilderFactory'),
    ComponentCreatorFactory = require('../lib/componentCreatorFactory'),
    ScopeHandlerFactory = require('../lib/scopeHandlerFactory'),
    SelectorFactory = require('../lib/selectorFactory');

describe('circuitbox', function () {
  /*jshint expr: true*/

  afterEach(function () {
    _.each([
      ComponentDefinitionBuilderFactory,
      ComponentCreatorFactory,
      ScopeHandlerFactory,
      SelectorFactory
    ], function (f) {
      f._reset();
    });
  });

  it('should export ComponentDefinition', function () {
    expect(circuitbox.ComponentDefinition).to.be.equal(require('../lib/componentDefinition'));
  });

  it('should export SimpleComponentDefinition', function () {
    expect(circuitbox.SimpleComponentDefinition).to.be.equal(require('../lib/simpleComponentDefinition'));
  });

  it('should export ModuleComponentDefinition', function () {
    expect(circuitbox.ModuleComponentDefinition).to.be.equal(require('../lib/moduleComponentDefinition'));
  });

  it('should export ComponentDefinitionBuilder', function () {
    expect(circuitbox.ComponentDefinitionBuilder).to.be.equal(require('../lib/componentDefinitionBuilder'));
  });

  it('should export SimpleComponentDefinitionBuilder', function () {
    expect(circuitbox.SimpleComponentDefinitionBuilder).to.be.equal(require('../lib/simpleComponentDefinitionBuilder'));
  });

  it('should export ModuleComponentDefinitionBuilder', function () {
    expect(circuitbox.ModuleComponentDefinitionBuilder).to.be.equal(require('../lib/moduleComponentDefinitionBuilder'));
  });

  it('should export ComponentCreator', function () {
    expect(circuitbox.ComponentCreator).to.be.equal(require('../lib/componentCreator'));
  });

  it('should export SimpleComponentCreator', function () {
    expect(circuitbox.SimpleComponentCreator).to.be.equal(require('../lib/simpleComponentCreator'));
  });

  it('should export ModuleComponentCreator', function () {
    expect(circuitbox.ModuleComponentCreator).to.be.equal(require('../lib/moduleComponentCreator'));
  });

  it('should be able to create a new Circuitbox with only default any bindings', function (done) {
    circuitbox.create('myKernel', function (err, k) {
      expect(err).to.be.null;
      expect(k.name).to.be.equal('myKernel');
      done();
    });
  });

  it('should record the parent module path when created', function (done) {
    circuitbox.create('myKernel', function (err, k) {
      expect(global.__cbx._basePath).to.be.equal(__dirname);
      expect(k.name).to.be.equal('myKernel');
      done();
    });
  });

  it('should be able to create a new Circuitbox with specified bindings', function (done) {
    var modA = sinon.spy(),
        modB = sinon.spy();

    circuitbox.withBindings(modA, modB).create('myKernel', function (err, k) {
      expect(err).to.be.null;
      expect(k.name).to.be.equal('myKernel');

      expect(modA.calledOnce).to.be.true;
      expect(modB.calledOnce).to.be.true;

      done();
    });
  });

  it('should load a specified binding module passing it a binder and create a new circuitbox and invoke the callback', function (done) {
    /*jshint expr: true*/

    circuitbox.withBindings('./fixtures/aBinding').create(function () {
      done();
    });

  });

  it('should load a specified binding module passing it a binder and create a new circuitbox and fulfill a promise', function (done) {
    /*jshint expr: true*/

    circuitbox.withBindings('./fixtures/aBinding').create().then(function () {
      done();
    });

  });

  it('should prefix binding module id with "circuitbox-", then load it by passing it a binder and create a new circuitbox', function (done) {
    /*jshint expr: true*/

    circuitbox.withBindings('express').create().then(function () {}, function (err) {
      expect(err.message).to.be.equal('Cannot find module \'circuitbox-express\'');
      done();
    });

  });

});


text:
/**************************8
 * test.c
 *
 * test for myprintf.c
 *
 * Author: Simon Lee (sijlee)
 * Date Created: 01/28/2016
 * Last Modified by: Simon Lee (sijlee)
 * Date Last Modified: 01/28/2016
 * Assignment: Lab 2
 * Part of: C335
 */

#include <stdio.h>

//declare & initialize myprintf function from other c file
extern void myprintf(const char *, ...);
//running actual test
//should print out the contents
int main() {
  myprintf("Nothing much\n");
  myprintf("The letter %c\n", 'A');
  myprintf("A string: %s\n", "Splash!");
  myprintf("The number %d\n", 11);
  myprintf("The number %x in hexadecimal\n", 11);
  myprintf("%d is a negative number\n", -5);
  myprintf("The number %d\n", 'A');
  myprintf("The number %x in hexadecimal\n", 'A');
  return 0;
}


text:
NoteWarnWidget::NoteWarnWidget(QWidget* parent, Qt::WindowFlags flags) :
  QWidget(parent, flags) {

  setupUi(this);
}

// initModel connects the widget elements to the underlying model
// NOTE: To make the code a bit more compact the interface is created
// programmatically based on the NotificationsModel and WarningsModel
void NoteWarnWidget::initModel(NotificationsModel* noteModel,
  WarningsModel* warnModel) {

  auto keys = noteModel->noteKeyWords;
  auto vals = noteModel->noteValues;
  for (int i=0; i<keys.size(); ++i) {
    QDataWidgetMapper* mapper = new QDataWidgetMapper;
    mapper->setModel(noteModel);
    noteGrid->addWidget(new QLabel(keys[i]), i, 0);

    if (keys[i] == "PROBABILITY_REPORT_THRESHOLD") {
      auto l = new QLineEdit(vals[i][0], this);
      l->setValidator(new QIntValidator);
      noteGrid->addWidget(l, i, 1);
      mapper->addMapping(l, 1);
    } else {
      auto c = new QComboBox(this);
      c->insertItems(0,vals[i]);
      noteGrid->addWidget(c, i, 1);

      auto del = new ComboBoxModelDelegate(this);
      mapper->setItemDelegate(del);
      mapper->addMapping(c, 1);
      connect(c, SIGNAL(currentIndexChanged(int)), del,
        SLOT(onCurrentIndexChanged(int)));
    }
    mapper->setCurrentIndex(i);
  }

  keys = warnModel->warnKeyWords;
  vals = warnModel->warnValues;
  for (int i=0; i<keys.size(); ++i) {
    QDataWidgetMapper* mapper = new QDataWidgetMapper;
    mapper->setModel(warnModel);
    warnGrid->addWidget(new QLabel(keys[i]), i, 0);

    if (keys[i] == "HIGH_PROBABILITY_THRESHOLD" ||
        keys[i] == "LIFETIME_THRESHOLD" ||
        keys[i] == "MISSED_REACTION_THRESHOLD") {
      auto l = new QLineEdit(vals[i][0], this);
      if (keys[i] == "LIFETIME_THRESHOLD") {
        l->setValidator(new QIntValidator);
      } else {
        l->setValidator(new QDoubleValidator);
      }
      warnGrid->addWidget(l, i, 1);
      mapper->addMapping(l, 1);
    } else {
      auto c = new QComboBox(this);
      c->insertItems(0,vals[i]);
      warnGrid->addWidget(c, i, 1);

      auto del = new ComboBoxModelDelegate(this);
      mapper->setItemDelegate(del);
      mapper->addMapping(c, 1);
      connect(c, SIGNAL(currentIndexChanged(int)), del,
        SLOT(onCurrentIndexChanged(int)));
    }
    mapper->setCurrentIndex(i);
  }
}


text:
'use strict'
AppServices.Controllers.controller('UsersGroupsCtrl', ['ug', '$scope', '$rootScope', '$location',
  function (ug, $scope, $rootScope, $location) {

    $scope.userGroupsCollection = {};
    $scope.groups_previous_display = 'none';
    $scope.groups_next_display = 'none';
    $scope.groups_check_all = '';
    $scope.groupsSelected = 'active';
    $scope.title = '';
    $scope.master = '';
    $scope.hasGroups = false;

    var init = function () {
      $scope.name = '';
      if (!$rootScope.selectedUser) {
        $location.path('/users');
        return;
      } else {
        ug.getGroupsForUser($rootScope.selectedUser.get('uuid'));
      }

      ug.getGroupsTypeAhead();
    };
    init();

    //---------modals
    $scope.addUserToGroupDialog = function(modalId){
      if ($scope.path) {
        var username =  $rootScope.selectedUser.get('uuid');
        ug.addUserToGroup(username, $scope.path);
        $scope.hideModal(modalId);
        $scope.path = '';
        $scope.title = '';
      } else {
        $rootScope.$broadcast('alert', 'error', 'You must specify a group.');
      }
    }
    $scope.selectGroup = function(group){
      $scope.path = group.path;
      $scope.title = group.title;
    }

    $scope.leaveGroupDialog = function(modalId){
      $scope.deleteEntities($scope.userGroupsCollection, 'user-left-group', 'error removing user from group');
      $scope.hideModal(modalId);
    }

//    $scope.groupsTypeaheadValues = [];

    $scope.$on('user-groups-received', function(event, groups) {
      $scope.userGroupsCollection = groups;
      $scope.userGroupsSelected =false;
      $scope.hasGroups = groups._list.length;
      $scope.checkNextPrev();
      if(!$rootScope.$$phase) {
        $rootScope.$apply();
      }
    });

    $scope.resetNextPrev = function() {
      $scope.previous_display = 'none';
      $scope.next_display = 'none';
    }
    $scope.checkNextPrev = function() {
      $scope.resetNextPrev();
      if ($scope.userGroupsCollection.hasPreviousPage()) {
        $scope.previous_display = 'block';
      }

      if($scope.userGroupsCollection.hasNextPage()) {
        $scope.next_display = 'block';
      }
    }

    $rootScope.getPrevious = function () {
      $scope.userGroupsCollection.getPreviousPage(function(err) {
        if (err) {
          $rootScope.$broadcast('alert', 'error', 'error getting previous page of groups');
        }
        $scope.checkNextPrev();
        if(!$rootScope.$$phase) {
          $rootScope.$apply();
        }
      });
    };

    $rootScope.getNext = function () {

      $scope.userGroupsCollection.getNextPage(function(err) {
        if (err) {
          $rootScope.$broadcast('alert', 'error', 'error getting next page of groups');
        }
        $scope.checkNextPrev();
        if(!$rootScope.$$phase) {
          $rootScope.$apply();
        }
      });
    };

    $scope.$on('user-left-group', function(event) {
      $scope.checkNextPrev();
      $scope.userGroupsSelected = false;
      if(!$rootScope.$$phase) {
        $rootScope.$apply();
      }
      init();
    });

    $scope.$on('user-added-to-group-received', function(event) {
      $scope.checkNextPrev();
      if(!$rootScope.$$phase) {
        $rootScope.$apply();
      }
      init();
    });

  }]);


text:
//
// Created by Harrison on 9/8/2016.
//

#include "../headers/ppm3.h"
#include "../headers/ppm_header.h"

#define INVALID_FILE_ERROR_MESSAGE "Error: Unable to read PPM3 data. "
#define UNEXPECTED_EOF "Unexpected EOF.\n"
#define INVALID_COLOR_VALUE "Color value out of bounds (must be above 0 and below the max value as defined in the header).\n"

/**
 * Reads a set of 3 values from the input filestream and stores it in the provided ColorRef
 * @param filePointer - the file pointer to read from
 * @param maxValue - the maximum value a number in the file could be (taken from the header)
 * @param color - the color reference to store the values into
 * @return 1 if success, 0 if failure
 */
int ppm3_read_triple(FILE* filePointer, unsigned short maxValue, ColorRef color) {
    int count;
    int nextValue;

    // Red
    skip_ignored_characters(filePointer);
    count = fscanf(filePointer, "%d", &nextValue);
    if (count == 0 || count == EOF) {
        fprintf(stderr, INVALID_FILE_ERROR_MESSAGE);
        fprintf(stderr, UNEXPECTED_EOF);
        return 0;
    } else if (nextValue < 0 || nextValue > maxValue) {
        fprintf(stderr, INVALID_FILE_ERROR_MESSAGE);
        fprintf(stderr, INVALID_COLOR_VALUE);
        return 0;
    }
    color->r = (double)nextValue / maxValue;

    // Green
    skip_ignored_characters(filePointer);
    count = fscanf(filePointer, "%d", &nextValue);
    if (count == 0 || count == EOF) {
        fprintf(stderr, INVALID_FILE_ERROR_MESSAGE);
        fprintf(stderr, UNEXPECTED_EOF);
        return 0;
    } else if (nextValue < 0 || nextValue > maxValue) {
        fprintf(stderr, INVALID_FILE_ERROR_MESSAGE);
        fprintf(stderr, INVALID_COLOR_VALUE);
        return 0;
    }
    color->g = (double)nextValue / maxValue;

    // Blue
    skip_ignored_characters(filePointer);
    count = fscanf(filePointer, "%d", &nextValue);
    if (count == 0 || count == EOF) {
        fprintf(stderr, INVALID_FILE_ERROR_MESSAGE);
        fprintf(stderr, UNEXPECTED_EOF);
        return 0;
    } else if (nextValue < 0 || nextValue > maxValue) {
        fprintf(stderr, INVALID_FILE_ERROR_MESSAGE);
        fprintf(stderr, INVALID_COLOR_VALUE);
        return 0;
    }
    color->b = (double)nextValue / maxValue;

    return 1;
}

int ppm3_parse_data(FILE* filePointer, PpmHeaderRef header, ColorRef colorGrid) {
    int i, arrLength = header->imageHeight * header->imageWidth;

    // Loop through each position, parse the triple to it
    for (i = 0; i < arrLength; i++) {
        if (!ppm3_read_triple(filePointer, header->maxVal, colorGrid + i)) {
            return 0;
        }
    }

    skip_ignored_characters(filePointer);

    return 1;
}

int ppm3_write_data(FILE* filePointer, PpmHeaderRef header, ColorRef colorGrid) {
    int x = 0, i, arrLength = header->imageHeight * header->imageWidth;

    // Write the color values
    for (i = 0; i < arrLength; i++) {
        fprintf(filePointer, "%d %d %d ",
                (int)(colorGrid[i].r * header->maxVal),
                (int)(colorGrid[i].g * header->maxVal),
                (int)(colorGrid[i].b * header->maxVal)
        );
        x++;
        if (x == header->imageWidth) {
            x = 0;
            fprintf(filePointer, "\n");
        }
    }

    return 1;
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pesegato.MonkeySheet.actions;

import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.control.AbstractControl;
import com.pesegato.MonkeySheet.MonkeySheetAppState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author Pesegato
 * @deprecated use MSFiniteStateMachine instead
 */
public abstract class MSActionMachine extends AbstractControl {

     static Logger log = LoggerFactory.getLogger(MSActionMachine.class);

    MSAction[] actions;
    MSAction currentAction;

    public MSActionMachine(MSAction... actions) {
        initActions(actions);
    }

    public void initActions(MSAction... actions){
        this.actions = actions;
    }

    @Override
    protected void controlUpdate(float tpf) {
        if (currentAction == null) {
            init();
            nextAction();
        }
        if (MonkeySheetAppState.tTPF == 0) {
            if (currentAction.maybeEnd()) {
                nextAction();
            }
        }
        tpf *= MonkeySheetAppState.timeable.getClockspeed();
        msUpdate(tpf);
        currentAction.controlUpdate(tpf);
    }

    protected <T extends MSAction> T startAction(Class <T> msActionClass){
        for (MSAction act:actions){
            if (msActionClass.isAssignableFrom(act.getClass())){
                startAction(act);
                return (T)act;
            }
        }
        return null;
    }

    private void nextAction() {
        startAction(actions[getNextAction()]);
    }

    private void startAction(MSAction action){
        log.trace("start action {}",action);
        if (currentAction==action)
            return;
        currentAction = action;
        currentAction.init(spatial);
    }

    abstract protected void init();

    abstract protected void msUpdate(float tpf);

    abstract protected int getNextAction();

    @Override
    protected void controlRender(RenderManager rm, ViewPort vp) {
    }

}


text:
open-road
=========

# Development Setup
===========

## Prerequisites

1. Install Oracle VirtualBox (ensure it is in your system path)
2. Install Vagrant
3. Install plugins for Vagrant
  1. `vagrant plugin install vagrant-omnibus` - Bootstraps chef runtime to the vagrantbox
  2. `vagrant plugin install vagrant-berkshelf` - Setup cookbook dependency manager for Chef
  3. `vagrant plugin install vagrant-cachier` - Something like apt-cache but for vagrant

## Install and run

```
vagrant up
# or
mkdir -p ~/vagrantboxes
cd ~/vagrantboxes
wget http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.10_chef-provisionerless.box
cd {prject.dir}
vagrant box add openroad ~/vagrantboxes/opscode_ubuntu-13.10_chef-provisionerless.box
vagrant up

# if no errors
vagrant ssh
cd /vagrant/dockerfiles/cloud9
sudo docker build -t cloud9 .
docker run cloud9 -p 3131
```

License and Author
------------------
Copyright:: 2014, Antons Kranga

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.