text:
package org.apache.ignite.internal;

import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.internal.*;

import java.io.*;
import java.util.*;
import java.util.concurrent.*;

/**
 *
 */
@GridToStringExclude
public class GridKernalGatewayImpl implements GridKernalGateway, Serializable {
    /** */
    private static final long serialVersionUID = 0L;

    /** */
    @GridToStringExclude
    private final GridSpinReadWriteLock rwLock = new GridSpinReadWriteLock();

    /** */
    @GridToStringExclude
    private final Collection<Runnable> lsnrs = new GridSetWrapper<>(new IdentityHashMap<Runnable, Object>());

    /** */
    private volatile GridKernalState state = GridKernalState.STOPPED;

    /** */
    @GridToStringExclude
    private final String gridName;

    /**
     * User stack trace.
     *
     * Intentionally uses non-volatile variable for optimization purposes.
     */
    private String stackTrace;

    /**
     * @param gridName Grid name.
     */
    public GridKernalGatewayImpl(String gridName) {
        this.gridName = gridName;
    }

    /** {@inheritDoc} */
    @Override public void lightCheck() throws IllegalStateException {
        if (state != GridKernalState.STARTED)
            throw illegalState();
    }

    /** {@inheritDoc} */
    @SuppressWarnings({"LockAcquiredButNotSafelyReleased", "BusyWait"})
    @Override public void readLock() throws IllegalStateException {
        if (stackTrace == null)
            stackTrace = stackTrace();

        rwLock.readLock();

        if (state != GridKernalState.STARTED) {
            // Unlock just acquired lock.
            rwLock.readUnlock();

            throw illegalState();
        }
    }

    /** {@inheritDoc} */
    @Override public void readUnlock() {
        rwLock.readUnlock();
    }

    /** {@inheritDoc} */
    @SuppressWarnings({"BusyWait"})
    @Override public void writeLock() {
        if (stackTrace == null)
            stackTrace = stackTrace();

        boolean interrupted = false;

        // Busy wait is intentional.
        while (true)
            try {
                if (rwLock.tryWriteLock(200, TimeUnit.MILLISECONDS))
                    break;
                else
                    Thread.sleep(200);
            }
            catch (InterruptedException ignore) {
                // Preserve interrupt status & ignore.
                // Note that interrupted flag is cleared.
                interrupted = true;
            }

        if (interrupted)
            Thread.currentThread().interrupt();
    }

    /** {@inheritDoc} */
    @Override public boolean tryWriteLock(long timeout) throws InterruptedException {
        boolean acquired = rwLock.tryWriteLock(timeout, TimeUnit.MILLISECONDS);

        if (acquired) {
            if (stackTrace == null)
                stackTrace = stackTrace();

            return true;
        }

        return false;
    }

    /**
     * Retrieves user stack trace.
     *
     * @return User stack trace.
     */
    private static String stackTrace() {
        StringWriter sw = new StringWriter();

        new Throwable().printStackTrace(new PrintWriter(sw));

        return sw.toString();
    }

    /**
     * Creates new illegal state exception.
     *
     * @return Newly created exception.
     */
    private IllegalStateException illegalState() {
        return new IllegalStateException("Grid is in invalid state to perform this operation. " +
            "It either not started yet or has already being or have stopped [gridName=" + gridName +
            ", state=" + state + ']');
    }

    /** {@inheritDoc} */
    @Override public void writeUnlock() {
        rwLock.writeUnlock();
    }

    /** {@inheritDoc} */
    @Override public void setState(GridKernalState state) {
        assert state != null;

        // NOTE: this method should always be called within write lock.
        this.state = state;

        if (state == GridKernalState.STOPPING) {
            Runnable[] runs;

            synchronized (lsnrs) {
                lsnrs.toArray(runs = new Runnable[lsnrs.size()]);
            }

            // In the same thread.
            for (Runnable r : runs)
                r.run();
        }
    }

    /** {@inheritDoc} */
    @Override public GridKernalState getState() {
        return state;
    }

    /** {@inheritDoc} */
    @Override public void addStopListener(Runnable lsnr) {
        assert lsnr != null;

        if (state == GridKernalState.STARTING || state == GridKernalState.STARTED)
            synchronized (lsnrs) {
                lsnrs.add(lsnr);
            }
        else
            // Call right away in the same thread.
            lsnr.run();
    }

    /** {@inheritDoc} */
    @Override public void removeStopListener(Runnable lsnr) {
        assert lsnr != null;

        synchronized (lsnrs) {
            lsnrs.remove(lsnr);
        }
    }

    /** {@inheritDoc} */
    @Override public String userStackTrace() {
        return stackTrace;
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(GridKernalGatewayImpl.class, this);
    }
}


text:
<dom-module id="channel-list-item">
  <template>

{{data.name}}

  </template>

</dom-module>

redpajama_set_name: RedPajamaGithub


text:
namespace CQRSExample.Model.Plant
{
    public class PlantDetails
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public string SAPId { get; set; }
        public string SAPWarehouse { get; set; }
        public int WorkCenterCount { get; set; }
    }
}


text:
;(function() {
'use strict';

var dataRef = new Firebase("https://vidsync.firebaseio.com/");
var chatRef = new Firebase("https://vidsync.firebaseio.com/**chats**");
var id = Math.random().toString(16).slice(2);

var ytplayer;
var mp4player;
var controls;

var roomName;
var tokboxSession;
var tokboxToken;

var last_command;

// variables to modify behavior of incoming on room creation
var first_run;
var creating;

// how far behind a standardized time our local clock is
var realTimeOffset;

// setup
function init(){
  // listeners
  $("#create").click(function() {
    makeRoom($("#room")[0].value)
  });
  $("#join").click(function() {
    joinRoom($("#room")[0].value)
  });

  if (window.location.hash != "")
    joinRoom(window.location.hash.substring(1));

  filepicker.setKey("AzauR2MBSBeslVoQIcZ8gz");

  $.getJSON("php/time.php", function(res){
    realTimeOffset = parseInt(res.timestamp) - now()
    console.log(realTimeOffset)
  })

  toggleSidebar();
  $("#slide").click(toggleSidebar);

  if (window.location.hash != "")
    joinRoom(window.location.hash.substring(1));
}

// initiate room creation
function makeRoom (name) {
  dataRef = dataRef.root();
  creating = true;
  // get tokbox credentials
  $.getJSON("php/generate.php", function(res){
    dataRef = dataRef.child(name);
    dataRef.on('value', incoming);
    dataRef.update(
    {
      type: null,
      video: null,
      seek: 0,
      timestamp: now() + realTimeOffset,
      playing: false,
      sessionId: res.sessionId,
      token: res.token,
      owner: id
    });
    chatRef = chatRef.child(name);
    chatRef.set(null);
    chatRef.on('child_added', chatIn);
    first_run = true;
    roomName = name;
  });
}

// join a room
function joinRoom (name) {
  dataRef = dataRef.root();
  dataRef = dataRef.child(name);
  dataRef.on('value', incoming);
  chatRef = chatRef.child(name);
  chatRef.on('child_added', chatIn)
  first_run = true;
  roomName = name;

  if (!$("#slide").hasClass("flip"))
    toggleSidebar();

  window.location.hash=name;
}
function setupRoom(){
  $("#inputs").html("
	" +
      "<input id='vid' type='text' placeholder='Choose a video (Youtube or MP4)'></input>	" +
      "<button id='choose'>Load</button><button id='upload'>Upload</button>" +
      "

");

  $("#choose").click(function(){
    var vid = $("#vid")[0].value + "#";
    if (vid.indexOf("youtube.com")>-1){
      var key = vid.substring(vid.indexOf("v=")+2, vid.indexOf("#"));
      var type = "YT";
      dataRef.update({type: type, video: key, seek: 0, playing: false});
    }
    else if (vid.indexOf(".mp4") > -1){
      dataRef.update({type:"mp4", video: $("#vid")[0].value, seek: 0, playing: false});
    }
    else
      alert ("Link not recognized");
  });

  $("#message").keyup(function(e){
    e.preventDefault();
    var key = window.event ? e.keyCode : e.which;
    if (key == '13') {
      chatOut($("#message")[0].value);
      $("#message")[0].value = null;
    }
  });
  $("#upload").click(function(){
    // hack for filepicker logo
    function coverUp() {
      var iframe = $("#filepicker_dialog")
      var x = iframe.offset().left;
      var y = iframe.offset().top;
      var cover = $("<div class='cover' style=\"z-index: 99999999999999; position:absolute;background:white; width:200px; height:75px;top:"+y+";left:"+x+"\"
").appendTo("body")
    }

    filepicker.pickAndStore(
      {extension: '.mp4', multiple:false},
      {location: 'S3'},
      function(InkBlobs){
        console.log(InkBlobs);
        var key = InkBlobs[0].key;
        var url = "http://s3-us-west-2.amazonaws.com/vidsync/" + key;
        dataRef.update({type: "mp4", video: url, seek: 0, playing: false});
        $(".cover").hide();
      },
      function(FEError){
        $(".cover").hide();
      });
    coverUp();
  });

  if ($("#chat h1").length == 0)
    $("#chat").prepend("
"+roomName+"
");
  $("#chat").show();
  if (tokboxSession == 0)
    alert ("Sorry, our Tokbox trial has expired. Please enjoy VidSync without webcam service for now.");
  else
    runWebcam(tokboxSession, tokboxToken);
  first_run = false;
}
// handle an incoming firebase message
function incoming (fb) {
  var data = fb.val();

  if (!creating && data == null){
    alert("This room does not exist! Creating a new room.");
    makeRoom(roomName);
    return;
  }
  else if (data == null){
    return;
  }
  creating = false;

  if (last_command && (data.video != last_command.video || data.type != last_command.type)){
    $("#players").html("");
    ytplayer = null;
    mp4player = null;
  }

  last_command = data;
  if (first_run){
    tokboxSession = data.sessionId;
    tokboxToken = data.token;
    setupRoom();
  }

  data.timestamp -= realTimeOffset;

  if (data.type == "YT") {
    if (ytplayer == null)
      makeYtPlayer(data.video);
    else
      handleYtCommand(data);
  }
  else if (data.type == "mp4"){
    if (mp4player == null)
      makeMp4Player(data);
    else
      handleMp4Command(data);
  }
}

function handleYtCommand (data){
  if (!ytplayer.seekTo)
    return;
  if (data.playing){
    data.seek += now() - data.timestamp;
  }
  ytplayer.seekTo(data.seek);
  controls.seek(data.seek)

  if (data.playing){
    ytplayer.playVideo()
    controls.playPause(true)
    setTimeout(updateSeek,1000)
  }
  else if (!data.playing){
    ytplayer.pauseVideo()
    controls.playPause(false)
  }
}

function handleMp4Command (data){
  if (!mp4player.play)
    return
  if (data.playing){
    data.seek += now() - data.timestamp;
  }
  mp4player.currentTime = data.seek;
  controls.seek(data.seek)

  if (data.playing){
    mp4player.play();
    controls.playPause(true)
    setTimeout(updateSeek,1000)
  }
  else if (!data.playing){
    mp4player.pause();
    controls.playPause(false)
  }

}

// send a player action to the server
function outgoing (playing, seek) {
  dataRef.update(
    {playing: playing, seek: seek, timestamp: now() + realTimeOffset, owner: id}
  );
}

// handle an incoming chat firebase message
function chatIn (fb) {
  var data = fb.val();
  if (!data || !data.name || !  data.message)
    return;
  var date = new Date(data.timestamp).toLocaleTimeString()
  var me = data.id == id ? " class='self'" : "";
  var html = "
" +
                "" + data.name + " " +
                "" +
                date.substring(0, date.length - 6) + " " +
                "" + data.message + "" +
            "
";
  $("#chat ul").append(html);

  var chatbox = $("#chatbox")[0];
  chatbox.scrollTop = chatbox.scrollHeight;
}

// send a chat to the server
function chatOut (msg) {
  var nickname = $("#nickname")[0].value;
  if (msg == "" || !msg)
    return;
  chatRef.push({
    id: id,
    name: (nickname ? nickname : id),
    message: msg,
    timestamp: new Date().getTime()
  })
}

function now () {
  return new Date().getTime() / 1000;
}

// player functions

function makeYtPlayer(vid) {
  function onPlayerReady (){
    makeControls(ytplayer.getDuration())
    handleYtCommand(last_command);
  }

  $("#players").html("

");
  ytplayer = new YT.Player('ytplayer', {
    height: '100%',
    width: '100%',
    videoId: vid,
    events: {
      'onReady': onPlayerReady,
    },
    playerVars: {
      'controls': 0,
      'showinfo': 0,
      'modestbranding': 1,
      'enablejsapi': 1,
      'disablekb': 1,
      'fs': 0,

    },
  });
}

function makeMp4Player(data){

  function onPlayerReady(){
    makeControls(mp4player.duration);
    handleMp4Command(last_command);
  }
  $("#players").html(
    "<video id='mp4player' width='100%' height='100%'>" +
    "  <source src='" + data.video + "' type='video/mp4'>" +
    "  Sorry, your browser does not support HTML5 videos!" +
    "</video>")
  mp4player = $("#mp4player")[0];
  mp4player.onloadeddata = onPlayerReady
}

function updateSeek (){
  if (!getPlaying())
    return

  controls.seek(getCurrentTime())

  setTimeout(updateSeek, 500)
}

function getCurrentTime(){
  if (ytplayer)
    return ytplayer.getCurrentTime();
  else if (mp4player)
    return mp4player.currentTime;
  else
    return null;
}

function getPlaying(){
  if (ytplayer)
    return ytplayer.getPlayerState() == 1;
  else if (mp4player)
    return !mp4player.paused;
  else
    return null;
}

function makeControls(duration){
  $("#controls").css({
    top: $("#players").offset().top,
    left: $("#players").offset().left,
    width: $("#players").width(),
    height: $("#players").height()
  })
  controls = Controls("controls", duration, {
    onPlayPause: function(playing){
      outgoing(playing, getCurrentTime())
    },
    onSeek: function(seek){
      outgoing(getPlaying(), seek)
    }
  })
  updateSeek()
}

function toggleSidebar (){
  if($("#slide").hasClass("flip"))
    $("#right").animate({width: 50})
  else
    $("#right").animate({width: 200})
  $("#slide").toggleClass('flip');
}

// start!
$(document).ready(function(){
  init();
})

})(); // end anonymous wrapper


text:
package index

import (
	"fmt"
	"testing"
	"time"

	"github.com/golang/mock/gomock"
	"github.com/stretchr/testify/require"

	"github.com/m3db/m3/src/m3ninx/doc"
	xtime "github.com/m3db/m3/src/x/time"
)

func TestWriteBatchForEachUnmarkedBatchByBlockStart(t *testing.T) {
	ctrl := gomock.NewController(t)
	defer ctrl.Finish()

	blockSize := time.Hour
	now := xtime.Now().Truncate(blockSize)
	tn := func(n int64) xtime.UnixNano {
		nDur := time.Duration(n)
		return now.Add(nDur * blockSize).Add(nDur * time.Minute)
	}
	d := func(n int64) doc.Metadata {
		return doc.Metadata{
			ID: []byte(fmt.Sprintf("doc-%d", n)),
		}
	}
	batch := NewWriteBatch(WriteBatchOptions{
		IndexBlockSize: blockSize,
	})
	for _, n := range []int64{2, 0, 1} {
		batch.Append(WriteBatchEntry{
			Timestamp:     tn(n),
			OnIndexSeries: doc.NewMockOnIndexSeries(ctrl),
		}, d(n))
	}

	numCalls := 0
	// entries.ForEachBlockStart(func(ts xtime.UnixNano, writes []WriteBatchEntry) {
	batch.ForEachUnmarkedBatchByBlockStart(func(
		blockStart xtime.UnixNano,
		batch *WriteBatch,
	) {
		require.Equal(t, 1, batch.Len())
		switch numCalls {
		case 0:
			require.Equal(t, "doc-0", string(batch.PendingDocs()[0].ID))
		case 1:
			require.Equal(t, "doc-1", string(batch.PendingDocs()[0].ID))
		case 2:
			require.Equal(t, "doc-2", string(batch.PendingDocs()[0].ID))
		default:
			require.FailNow(t, "should never get here")
		}
		numCalls++
	})
	require.Equal(t, 3, numCalls)
}

func TestWriteBatchForEachUnmarkedBatchByBlockStartMore(t *testing.T) {
	ctrl := gomock.NewController(t)
	defer ctrl.Finish()

	blockSize := time.Hour
	now := xtime.Now().Truncate(blockSize)
	tn := func(n int64) xtime.UnixNano {
		nDur := time.Duration(n)
		return now.Add(nDur * blockSize).Add(nDur * time.Minute)
	}
	d := func(n int64) doc.Metadata {
		return doc.Metadata{
			ID: []byte(fmt.Sprintf("doc-%d", n)),
		}
	}
	batch := NewWriteBatch(WriteBatchOptions{
		IndexBlockSize: blockSize,
	})
	for _, v := range []struct {
		nTime int64
		nDoc  int64
	}{
		{0, 0},
		{1, 3},
		{0, 1},
		{1, 4},
		{0, 2},
	} {
		batch.Append(WriteBatchEntry{
			Timestamp:     tn(v.nTime),
			OnIndexSeries: doc.NewMockOnIndexSeries(ctrl),
		}, d(v.nDoc))
	}

	numCalls := 0
	batch.ForEachUnmarkedBatchByBlockStart(func(
		blockStart xtime.UnixNano,
		batch *WriteBatch,
	) {
		switch numCalls {
		case 0:
			require.Equal(t, 3, batch.Len())
			require.Equal(t, "doc-0", string(batch.PendingDocs()[0].ID))
			require.Equal(t, "doc-1", string(batch.PendingDocs()[1].ID))
			require.Equal(t, "doc-2", string(batch.PendingDocs()[2].ID))
		case 1:
			require.Equal(t, 2, batch.Len())
			require.Equal(t, "doc-3", string(batch.PendingDocs()[0].ID))
			require.Equal(t, "doc-4", string(batch.PendingDocs()[1].ID))
		default:
			require.FailNow(t, "should never get here")
		}
		numCalls++
	})
	require.Equal(t, 2, numCalls)
}


text:
<?php

namespace Fisharebest\Webtrees\Module;

use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\Filter;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\GedcomTag;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Theme;
use Rhumsaa\Uuid\Uuid;

/**
 * Class ResearchTaskModule
 */
class ResearchTaskModule extends AbstractModule implements ModuleBlockInterface {
	const DEFAULT_SHOW_OTHER      = '1';
	const DEFAULT_SHOW_UNASSIGNED = '1';
	const DEFAULT_SHOW_FUTURE     = '1';
	const DEFAULT_BLOCK           = '1';

	/** {@inheritdoc} */
	public function getTitle() {
		return /* I18N: Name of a module. Tasks that need further research. */ I18N::translate('Research tasks');
	}

	/** {@inheritdoc} */
	public function getDescription() {
		return /* I18N: Description of "Research tasks" module */ I18N::translate('A list of tasks and activities that are linked to the family tree.');
	}

	/**
	 * Generate the HTML content of this block.
	 *
	 * @param int      $block_id
	 * @param bool     $template
	 * @param string[] $cfg
	 *
	 * @return string
	 */
	public function getBlock($block_id, $template = true, $cfg = array()) {
		global $ctype, $controller, $WT_TREE;

		$show_other      = $this->getBlockSetting($block_id, 'show_other', self::DEFAULT_SHOW_OTHER);
		$show_unassigned = $this->getBlockSetting($block_id, 'show_unassigned', self::DEFAULT_SHOW_UNASSIGNED);
		$show_future     = $this->getBlockSetting($block_id, 'show_future', self::DEFAULT_SHOW_FUTURE);
		$block           = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);

		foreach (array('show_unassigned', 'show_other', 'show_future', 'block') as $name) {
			if (array_key_exists($name, $cfg)) {
				$$name = $cfg[$name];
			}
		}

		$id    = $this->getName() . $block_id;
		$class = $this->getName() . '_block';
		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
			$title = 'getNameHtml() . '&ctype=' . $ctype . '">';
		} else {
			$title = '';
		}
		$title .= $this->getTitle();

		$table_id = Uuid::uuid4(); // create a unique ID

		$controller
			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
			->addInlineJavascript('
			jQuery("#' . $table_id . '").dataTable({
				dom: \'t\',
				' . I18N::datatablesI18N() . ',
				autoWidth: false,
				paginate: false,
				lengthChange: false,
				filter: false,
				info: true,
				jQueryUI: true,
				columns: [
					null,
					null,
					null,
					null
				]
			});
			jQuery("#' . $table_id . '").css("visibility", "visible");
			jQuery(".loading-image").css("display", "none");
		');

		$content = '';
		$content .= '

';
		$content .= '
';
		$content .= '

';
		$content .= '' . GedcomTag::getLabel('DATE') . '	';
		$content .= '' . I18N::translate('Record') . '	';
		$content .= '' . I18N::translate('Username') . '	';
		$content .= '' . GedcomTag::getLabel('TEXT') . '	';
		$content .= '

';

		$found  = false;
		$end_jd = $show_future ? 99999999 : WT_CLIENT_JD;

		$xrefs = Database::prepare(
			"SELECT DISTINCT d_gid FROM `##dates`" .
			" WHERE d_file = :tree_id AND d_fact = '_TODO' AND d_julianday1 < :jd"
		)->execute(array(
			'tree_id' => $WT_TREE->getTreeId(),
			'jd'      => $end_jd,
		))->fetchOneColumn();

		$facts = array();
		foreach ($xrefs as $xref) {
			$record = GedcomRecord::getInstance($xref, $WT_TREE);
			if ($record->canShow()) {
				foreach ($record->getFacts('_TODO') as $fact) {
					$facts[] = $fact;
				}
			}
		}

		foreach ($facts as $fact) {
			$record    = $fact->getParent();
			$user_name = $fact->getAttribute('_WT_USER');
			if ($user_name === Auth::user()->getUserName() || !$user_name && $show_unassigned || $user_name && $show_other) {
				$content .= '
';
				$content .= 'getDate()->julianDay() . '">' . $fact->getDate()->display() . '	';
				$content .= 'getSortName()) . '">getHtmlUrl() . '">' . $record->getFullName() . '	';
				$content .= '' . $user_name . '	';
				$content .= '' . $fact->getValue() . '	';
				$content .= '
';
				$found = true;
			}
		}

		$content .= '

';
		if (!$found) {
			$content .= '
' . I18N::translate('There are no research tasks in this family tree.') . '
';
		}

		if ($template) {
			if ($block) {
				$class .= ' small_inner_block';
			}

			return Theme::theme()->formatBlock($id, $title, $class, $content);
		} else {
			return $content;
		}
	}

	/** {@inheritdoc} */
	public function loadAjax() {
		return false;
	}

	/** {@inheritdoc} */
	public function isUserBlock() {
		return true;
	}

	/** {@inheritdoc} */
	public function isGedcomBlock() {
		return true;
	}

	/**
	 * An HTML form to edit block settings
	 *
	 * @param int $block_id
	 */
	public function configureBlock($block_id) {
		if (Filter::postBool('save') && Filter::checkCsrf()) {
			$this->setBlockSetting($block_id, 'show_other', Filter::postBool('show_other'));
			$this->setBlockSetting($block_id, 'show_unassigned', Filter::postBool('show_unassigned'));
			$this->setBlockSetting($block_id, 'show_future', Filter::postBool('show_future'));
			$this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
		}

		$show_other      = $this->getBlockSetting($block_id, 'show_other', self::DEFAULT_SHOW_OTHER);
		$show_unassigned = $this->getBlockSetting($block_id, 'show_unassigned', self::DEFAULT_SHOW_UNASSIGNED);
		$show_future     = $this->getBlockSetting($block_id, 'show_future', self::DEFAULT_SHOW_FUTURE);
		$block           = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);

		?>

				<?php echo I18N::translate('Research tasks are special events, added to individuals in your family tree, which identify the need for further research. You can use them as a reminder to check facts against more reliable sources, to obtain documents or photographs, to resolve conflicting information, etc.'); ?>
				<?php echo I18N::translate('To create new research tasks, you must first add "research task" to the list of facts and events in the family tree's preferences.'); ?>
				<?php echo I18N::translate('Research tasks are stored using the custom GEDCOM tag "_TODO". Other genealogy applications may not recognize this tag.'); ?>

		<?php

		echo '
';
		echo I18N::translate('Show research tasks that are assigned to other users');
		echo '	';
		echo FunctionsEdit::editFieldYesNo('show_other', $show_other);
		echo '
';

		echo '
';
		echo I18N::translate('Show research tasks that are not assigned to any user');
		echo '	';
		echo FunctionsEdit::editFieldYesNo('show_unassigned', $show_unassigned);
		echo '
';

		echo '
';
		echo I18N::translate('Show research tasks that have a date in the future');
		echo '	';
		echo FunctionsEdit::editFieldYesNo('show_future', $show_future);
		echo '
';

		echo '
';
		echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
		echo '	';
		echo FunctionsEdit::editFieldYesNo('block', $block);
		echo '
';
	}
}


text:
package mysql

import (
	"database/sql"
	"github.com/silvasur/mailremind/model"
	"log"
	"time"
)

type User struct {
	con *MySQLDBCon

	id                    DBID
	email, passwd, acCode string
	location              *time.Location
	added                 time.Time
	active                bool
}

func userFromSQL(con *MySQLDBCon, s scanner) (*User, error) {
	var id uint64
	var added int64
	var email, passwd, _loc, acCode string
	var active int

	switch err := s.Scan(&id, &email, &passwd, &_loc, &active, &acCode, &added); err {
	case nil:
	case sql.ErrNoRows:
		return nil, model.NotFound
	default:
		return nil, err
	}

	user := &User{
		con:    con,
		id:     DBID(id),
		email:  email,
		passwd: passwd,
		acCode: acCode,
		added:  time.Unix(added, 0),
		active: i2b(active),
	}

	loc, err := time.LoadLocation(_loc)
	if err != nil {
		loc = time.UTC
	}
	user.location = loc

	return user, nil
}

func (con *MySQLDBCon) UserByID(_id model.DBID) (model.User, error) {
	id := _id.(DBID)

	row := con.stmt[qUserByID].QueryRow(uint64(id))
	return userFromSQL(con, row)
}

func (con *MySQLDBCon) UserByMail(email string) (model.User, error) {
	row := con.stmt[qUserByEmail].QueryRow(email)
	return userFromSQL(con, row)
}

func (u *User) ID() model.DBID           { return u.id }
func (u *User) Email() string            { return u.email }
func (u *User) PWHash() []byte           { return []byte(u.passwd) }
func (u *User) Active() bool             { return u.active }
func (u *User) ActivationCode() string   { return u.acCode }
func (u *User) Location() *time.Location { return u.location }

func (u *User) SetPWHash(_pwhash []byte) error {
	pwhash := string(_pwhash)

	if _, err := u.con.stmt[qSetPWHash].Exec(pwhash, uint64(u.id)); err != nil {
		return err
	}

	u.passwd = string(_pwhash)
	return nil
}

func (u *User) SetActive(b bool) error {
	if _, err := u.con.stmt[qSetActive].Exec(b2i(b), uint64(u.id)); err != nil {
		return err
	}

	u.active = b
	return nil
}

func (u *User) SetActivationCode(c string) error {
	if _, err := u.con.stmt[qSetAcCode].Exec(c, uint64(u.id)); err != nil {
		return err
	}

	u.acCode = c
	return nil
}

func (u *User) SetLocation(loc *time.Location) error {
	if _, err := u.con.stmt[qSetLocation].Exec(loc.String(), uint64(u.id)); err != nil {
		return err
	}

	u.location = loc
	return nil
}

func (u *User) Delete() error {
	tx, err := u.con.con.Begin()
	if err != nil {
		return err
	}

	id := uint64(u.id)

	deljobs := tx.Stmt(u.con.stmt[qDelUsersJobs])
	deluser := tx.Stmt(u.con.stmt[qDelUser])

	if _, err := deljobs.Query(id); err != nil {
		return rollbackAfterFail(err, tx)
	}

	if _, err := deluser.Query(id); err != nil {
		return rollbackAfterFail(err, tx)
	}

	return tx.Commit()
}

func (con *MySQLDBCon) InactiveUsers(olderthan time.Time) []model.DBID {
	ids := make([]model.DBID, 0)

	rows, err := con.stmt[qGetOldInactiveUsers].Query(olderthan.Unix())
	if err != nil {
		log.Printf("Failed to get old, inactive users: %s", err)
		return ids
	}

	for rows.Next() {
		var _id uint64

		if err := rows.Scan(&_id); err != nil {
			log.Printf("Failed to get old, inactive users: %s", err)
			return ids
		}

		ids = append(ids, DBID(_id))
	}

	return ids
}

func (con *MySQLDBCon) AddUser(email string, pwhash []byte, location *time.Location, active bool, acCode string) (model.User, error) {
	now := time.Now()

	tx, err := con.con.Begin()
	if err != nil {
		return nil, err
	}

	insjob := tx.Stmt(con.stmt[qInsertUser])

	res, err := insjob.Exec(email, string(pwhash), location.String(), b2i(active), acCode, now.Unix())
	if err != nil {
		tx.Rollback()
		return nil, err
	}

	_id, err := res.LastInsertId()
	if err != nil {
		tx.Rollback()
		return nil, err
	}

	if err := tx.Commit(); err != nil {
		return nil, err
	}

	return &User{
		con:      con,
		id:       DBID(_id),
		email:    email,
		passwd:   string(pwhash),
		acCode:   acCode,
		location: location,
		added:    now,
		active:   active,
	}, nil
}


text:
<?php

$mess = array(
    "1" => "Invio Rapido",
    "2" => "Inviare un file, condividerlo e spedirne il link in un'unica azione",
    "3" => "Selezionare il file",
    "4" => "Click per selezionare il file, o trascinalo nella zona sottostante",
);


text:
require 'spec_helper'

describe "comments/index_atom_feed.atom.builder" do
  before do
    stub_default_blog
  end

  describe "rendering comments with one comment" do
    let(:article) { stub_full_article }
    let(:comment) { Factory.build(:comment, :article => article, :body => "Comment body") }

    before do
      assign(:comments, [comment])
      render
    end

    it "should render a valid feed" do
      assert_feedvalidator rendered
    end

    it "shows typo with the current version as the generator" do
      xml = Nokogiri::XML.parse(rendered)
      generator = xml.css("generator").first
      generator.content.should == "Typo"
      generator["version"].should == TYPO_VERSION
    end

    it "should render an Atom feed with one item" do
      assert_atom10 rendered, 1
    end

    describe "the comment entry" do
      it "should have all the required attributes" do
        xml = Nokogiri::XML.parse(rendered)
        entry_xml = xml.css("entry").first

        entry_xml.css("title").first.content.should ==
          "Comment on #{article.title} by #{comment.author}"
        entry_xml.css("id").first.content.should == "urn:uuid:12313123123123123"
        entry_xml.css("content").first.content.should == "
Comment body
"
        link_xml = entry_xml.css("link").first
        link_xml["href"].should == "#{article.permalink_url}#comment-#{comment.id}"
      end
    end
  end
end


text:
import tornado.gen
import tornado.web

from core.requesthandler import RequestHandler
import core.util

class PushByRequestServlet(RequestHandler):

    @tornado.web.asynchronous
    @tornado.gen.engine
    def get(self):
        requestid = core.util.get_int_arg(self.request, 'id')
        response = yield tornado.gen.Task(
                        self.async_api_call,
                        "pushbyrequest",
                        {"id": requestid}
                    )

        push = self.get_api_results(response)
        if push:
            self.redirect('/push?id=%s' % push['id'])


text:
const {InvestorAppModel, InvestorAppColl, InvestorLoginModel} = require('./investor-model.js')
const {AllStudentsColl, SingleStudentModel, StudentModel, StudentAppColl,StudentLoginModel, StudentPayment} = require("./student-model.js")
const {SchoolColl, SchoolModel} = require("./schools-model.js")
const {StockColl, StockModel} = require("./investment-model.js")
const {LoanModel, LoanCollection} = require('./loan-model.js')
const STORE = require('./store.js')

const ACTIONS = {

   logOut: function(){
      let mod = new StudentModel()

      mod.logOut()

      mod.save().then(function(){
         location.hash = ""

      })

   },

   fetchAllStudents: function(route = "/students"){
      let allStudents = new AllStudentsColl(route)

      allStudents.fetch().then(function(){

         STORE.setStore('allStudents', allStudents.models)
      })
   },
   submitLoanForm: function(formInfo){
      let loanForm = new LoanModel()

      loanForm.set(formInfo)
      loanForm.save().then(function(serverRes){
         let mod = new StudentModel()
         mod.set(serverRes)
         STORE.setStore("currentUser", mod)
      })
      location.hash = "/dash/students"

   },

   fetchSchoolData: function(){
      let schoolInst = new SchoolColl()

      schoolInst.fetch().then(function(){
         STORE.setStore('schools', schoolInst.models)
      })
   },

   submitStudentForm: function(formInfo){
      let formInst = new StudentModel()

      formInst.set(formInfo)

      formInst.save().then(function(){
         // let mod = new StudentModel()
         // mod.set(serverRes)
         // STORE.setStore('currentUser', mod)
         // STORE.setStore("userType", "")
      })

   },

   submitInvestorForm: function(formInfo){
      let formInvstForm = new InvestorAppModel()

      formInvstForm.set(formInfo)

      formInvstForm.save().then(function(serverRes){
         formInvstForm.set(serverRes)
         STORE.setStore('currentUser', formInvstForm)
         STORE.setStore("userType", "")

      })
      location.hash = "/dash/investors"
   },
//
   handleInvestorLogin: function(usrInfo){
      let invstLogin = new InvestorLoginModel()

      invstLogin.set(usrInfo)

      invstLogin.save().then(function(serverRes){
         invstLogin.set(serverRes)
         STORE.setStore('currentUser', invstLogin)
         STORE.setStore("userType", "")

         location.hash = "/dash/investors"
      })

   },
   handleStudentLogin: function(usrInfo){
      let stdntLogin = new StudentLoginModel()

      stdntLogin.set(usrInfo)

      stdntLogin.save().then(function(serverRes){
         let mod = new StudentModel()
         mod.set(serverRes)
         STORE.setStore('currentUser', mod)
         STORE.setStore("userType", "")

         location.hash = "/dash/students"

      })
   },

   fetchCurrentStudent: function(){
      let newModel = new StudentModel()
      newModel.checkAuth("/currentstudent").then(function(){

         STORE.setStore('currentUser', newModel)
      }).fail(function(){
      })
   },
   fetchCurrentInvestor: function(){
      let newModel = new InvestorAppModel()
      newModel.checkAuth().then(function(){

         STORE.setStore('currentUser', newModel)
      }).fail(function(){
      })
   },

   handleInvestment: function(loanInfo){
      let stockInvst = new StockModel()

      stockInvst.set(loanInfo)

      stockInvst.save().then(function(serverRes){
         ACTIONS.fetchAllStudents()
         ACTIONS.fetchCurrentInvestor()
         STORE.setStore("selectedStudent", {})
         location.hash = "dash/investors"
      })

   },
   submitPayment: function(payInfo){
      let pay = new StudentPayment()
      pay.set(payInfo)
      pay.save().then(function(){

      })
   },

   changeView: function(viewInput){

      STORE.setStore('currentView', viewInput)

   }

}

module.exports = ACTIONS


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>de.bytefish.fcmjava</groupId>
        <artifactId>fcmjava-parent</artifactId>
        <version>2.5</version>
        <relativePath>..</relativePath>
    </parent>

    <artifactId>fcmjava-core</artifactId>
    <name>fcmjava-core</name>

    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <scope>test</scope>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

        <dependency>
            <scope>test</scope>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
        </dependency>

    </dependencies>

</project>


text:
layout: page
title: Project Soli in reality
date: 2015-06-11 19:14
author: Pranav Kumar
comments: true
permalink: /project-soli-in-reality
categories: [Applications]
tags: [ATAP, computing, Technology, Google]
sidebar: right
image:
    title: "unsplash_1.jpg"
    caption: Unsplash.com
    caption_url: http://unsplash.com
    thumb:  unsplash_4-303x182.jpg

---
We are glad to inform about the latest innovations that are to be occurring in the nearest future so today, a project by google which is code named as "Project soli".

Google is now in the middle of developing a new interaction design sensor using radar technology that can track movement with a lot of accuracy.

It's only the size of a small computer chip and can be inserted into everyday objects and the things we daily use.

Ivan poupyrev says," the hand is alternate input device, extremely precise,its extremely fast, it's very natural for us to use it,capturing the possibilities of human hand was one of my passions".

The fineness of human actions and fineness of using our hand is appropriate functionality that has to be carried out with the help of chip.

The chip emits the radar frequency above the surface area of the device which indeed traces the movements of the fingers resulting with fulfillment of user operations.

The team behind google's Project Ara and Project Tango said the interactions among smartwatches and other wearable could be transformed.

Project Soli is a small, gesture-recognizing, radar-enabled sensor that aims to provide a way for people to interact with their smartwatches without touching their displays. The experimental project was introduced by ATAP, Google's Advanced technology and Projects group, during a session at the company's I/O developer conference Friday.

The major applications of the chip would be like that tracks the cars,big objects,satellites, and planes. Even the chip is capable of tracking the micro motions, twitches of the human hand. Which can be used in interacting with other computing devices available  and or  on the Internet.

Jaime Lien,Lead research engineer at Project Soli,said - our team is focused on taking radar hardware and turning it into gesture sensor. Radar is the technology which transmits a radio wave towards a target and then the receiver of the radar intercepts the reflected energy from that target. The various stages of this pipeline are designed to extract specific gestures information from that one radar signal that we receive at a high frame rate."

We know that radars are having very high positional accuracy,which means that we can sense the tiniest motions
The actual demonstration of Project soli.


text:
Welcome to the developer's guide of PetIBM!

## Adding new features and fixing bugs

All new features and bug fixes must go through a pull-request review procedure.
If you want to contribute to PetIBM, please fork the Barbagroup's [PetIBM](https://github.com/barbagroup/PetIBM) repository, make your changes on your fork, and then open a pull-request with your changes against the main PetIBM repository.

For new features and minor bugs (with small impact), the base branch of the pull-request should be the `develop` branch of the main repository.
(The `develop` branch will be merged into the `master` one once we are ready for a new release of PetIBM.)

For major bugs, the base branch should be the `master` branch of the main repository; it will be considered as a hotfix (bugfix) and a new version of PetIBM will be released as soon as possible by the maintainers with the micro number incremented.

New features should come with some kind of test or example to verify and/or validate the implementation.

## Reporting bugs and requesting new features

To report bugs, request new features, or simply ask questions, please open a GitHub issue on the Barbagroup's PetIBM repository.

## Writing documentation

New classes, methods, functions, and namespaces must be documented with Doxygen-style doctrings.

To locally generate and check the Doxygen documentation, use the command-line:

    > cd doc
    > doxygen Doxyfile

and open the file `doc/html/index.html` in your favorite browser.

You should also add code documentation whenever necessary; it will greatly help other developers to review your new features and bug fixes.

For new features, user's documentation must also be written.
For this purpose, we use Markdown files that are located in the `doc` folder of the root directory of PetIBM.

The User's documentation and API documentation are up-to-date with the latest release of PetIBM, which should be close to the latest commit on the `master` branch.


text:
      Nick Bekeris

        Administrator,

        Designer,

        Developer,

        Gamer,

        Musician...

        Nerd.

          About

          Portfolio

          Blog

          Contact

      Contact Me

    <form name="contactForm" ng-submit="checkForm(contactForm.$valid)" novalidate>

        Name:
        <input type="text" name="name" class="form-control" ng-model="name" required>

Please enter your name

        Email:
        <input type="email" name="email" class="form-control" ng-model="email" required>

Please enter a valid email

        Question / Concern:
        <textarea class="form-control" name="question" ng-model="question" rows="4" required></textarea>

Please enter something...

      <button type="submit" class="btn btn-primary" ng-disabled="contactForm.$invalid">Go Go Go!</button>
    </form>


text:
namespace blink {

class Headers;

class HeadersForEachCallback {
public:
    virtual ~HeadersForEachCallback() { }
    virtual bool handleItem(ScriptValue thisValue, const String& value, const String& key, Headers*) = 0;
    virtual bool handleItem(const String& value, const String& key, Headers*) = 0;
};

} // namespace blink

#endif // HeadersForEachCallback_h


text:
cask :v1 => 'glyphish-gallery' do
  version '2.0'
  sha256 'c5f224d44ecf4a853a51105d1fce8b4e3eab099ddc16791ce412a7a679b104a7'

  url "https://github.com/glyphish/gallery/releases/download/v#{version}/v#{version}.zip"
  homepage 'https://github.com/glyphish/gallery'
  license :unknown    # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder

  app 'Glyphish Gallery.app'
end


text:
dirname="$(pwd)"
lib="/usr/local/lib"
bin="/usr/local/bin"
wallpaperdir='$HOME/wallpaper'

PIP_MODULES="numpy scipy matplotlib pymatbridge simplejson pyserial pyzmq pyqtgraph"
APT_FORMULAS="clang cmake curl fortune-mod gcc-avr git-core ipython minicom \
php5 cowsay python-matplotlib python-scipy python-numpy tmux vim weechat xaos zsh docker git"
BREW_FORMULAS="vim wget gcc node python git qt gnu-tar gnu-sed gawk gnutls \
  mobile-shell zsh gnu-indent gnu-getopt grc coreutils spark bash findutils tmux"
binaries=(
    graphicsmagick
    webkit2png
    rename
    zopfli
    ffmpeg
    python
    sshfs
    trash
    node
    tree
    ack
    hub
    git
    cowthink
    fortune
)
apps=(
    alfred
    dropbox
    google-chrome
    slack
    spotify
    vagrant
    flash
    flux
    vlc
    skype
    transmission
)

if [ "$(uname)" == "Darwin" ]; then
  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  brew install -with-default-names $BREW_FORMULAS
  brew linkapps qt
  brew tap homebrew/dupes
  brew install homebrew/dupes/grep
  PATH="usr/local/opt/coreutils/libexec/gnubin":$PATH
  MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
  echo "installing binaries..."
  brew install ${binaries[@]}
  brew cleanup
  brew install caskroom/cask/brew-cask
 # default install is /Users/$user/Applications
  echo "installing cask apps.."
  brew cask install --appdir="/Applications" ${apps[@]}
  brew cleanup

  #Use AirDrop over every interface. srsly this should be a default.
  defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1

  # Always open everything in Finder's list view. This is important.
  defaults write com.apple.Finder FXPreferredViewStyle Nlsv

  # Set a really fast key repeat.
  defaults write NSGlobalDomain KeyRepeat -int 0

  mkdir repos && cd repos
  git clone https://github.com/neale/Dotfiles.git && cd Dotfiles
  cp .bashrc .tmux.conf .vimrc .zlogin .zpreztorc .zshrc $HOME
  cd $HOME
  chsh -s /bin/zsh && zsh
  exit
  zsh
  cd $HOME/repos
  git clone https://github.com/neale/music-collaboratory.git
  git clone https://github.com/neale/relations.git
  git clone https://github.com/neale/EnCom.git
  git clone https://github.com/neale/neural-net-node.git
  git clone https://github.com/neale/nrf-basic.git
  easy_install pip
  pip install $PIP_FORMULAS
  curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh

  echo "done"
elif [ "$(uname)" == "Linux" ]; then
  sudo apt-get install curl
  curl -sL https://deb.nodesource.com/setup | sudo bash -
  sudo apt-get install -y $APT_FORMULAS
  sudo apt-get install zsh tmux
  cd $HOME
  mkdir repos
  cd repos
  curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh
  git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
  echo changing default shell to zsh
  chsh -s /bin/zsh
  echo getting dotfiles
  git clone https://github.com/neale/Dotfiles.git
  cd Dotfiles
  sudo cp .bashrc .tmux.conf .vimrc .zlogin .zpreztorc .zshrc $HOME
  cd $HOME
  zsh
  exit && zsh
  exit && zsh
  cd $HOME/repos
  #git repos
  echo cloning repos
  git clone https://github.com/neale/music-collaboratory.git
  git clone https://github.com/neale/relations.git
  git clone https://github.com/neale/EnCom.git
  git clone https://github.com/neale/neural-net-node.git
  git clone https://github.com/neale/nrf-basic.git
  echo getting wallpaper
  #wallpaper (yosemite)
  wget https://9to5mac.files.wordpress.com/2014/08/yosemite.jpg
  mkdir wallpaper
  mv yosemite.jpg $wallpaperdir
  files=($wallpaperdir/*)
  yellowstone=`printf "%s\n" "${files[RANDOM % ${files[@]}]}"`
  gconftool-2 -t str --set /desktop/gnome/background/picture_filename "$randompic" cd $HOME
  wget https://bootstrap.pypa.io/get-pip.py
  python get-pip.py

fi

echo "done"


text:
/*
 * RF24_ESP_IDF.h
 *
 *  Created on: Feb 18, 2017
 *      Author: kolban
 */

#ifndef COMPONENTS_RF24_UTILITY_ESP_IDF_RF24_ESP_IDF_H_
#define COMPONENTS_RF24_UTILITY_ESP_IDF_RF24_ESP_IDF_H_

#define OUTPUT 0
void     delay(int value);
void     delayMicroseconds(int value);
void     digitalWrite(int pin, int value);
uint32_t millis();
void     pinMode(int pin, int mode);

#endif /* COMPONENTS_RF24_UTILITY_ESP_IDF_RF24_ESP_IDF_H_ */


text:
<?php

Route::group(['prefix' => 'library'], function () {

    /**
     * -------------------------------------------------------------------------
     * Catalogue Routes
     * -------------------------------------------------------------------------
     *
     */
    Route::delete('catalogues/delete/many', '\Catalogue\Controllers\CatalogueManyController@delete')->name('catalogues.many.delete');
    Route::delete('catalogues/delete/{catalogue}', '\Catalogue\Controllers\CatalogueController@delete')->name('catalogues.delete');
    Route::delete('catalogues/destroy/many', '\Catalogue\Controllers\CatalogueManyController@destroy')->name('catalogues.many.destroy');
    Route::get('catalogues/refresh', '\Catalogue\Controllers\CatalogueRefreshController@index')->name('catalogues.refresh.index');
    Route::get('catalogues/trash', '\Catalogue\Controllers\CatalogueController@trash')->name('catalogues.trash');
    Route::post('catalogues/refresh', '\Catalogue\Controllers\CatalogueRefreshController@refresh')->name('catalogues.refresh.refresh');
    Route::post('catalogues/restore/many', '\Catalogue\Controllers\CatalogueManyController@restore')->name('catalogues.many.restore');
    Route::post('catalogues/{catalogue}/restore', '\Catalogue\Controllers\CatalogueController@restore')->name('catalogues.restore');
    Route::resource('catalogues', '\Catalogue\Controllers\CatalogueController');
});


text:
package org.auraframework.impl.util;

import java.io.IOException;
import java.util.List;

import org.auraframework.system.AuraContext;
import org.auraframework.system.Client.Type;

public class TemplateUtil {
    public enum Script {
        SYNC("<script src=\"%s\"></script>"),
        ASYNC("<script src=\"%s\" async defer></script>"),
        DEFER("<script src=\"%s\" defer></script>"),
        LAZY("<script data-src=\"%s\"></script>"),
        UNSAFELINE("<script>%s</script>");

        private final String tag;

        Script(String tag) {
            this.tag = tag;
        }

        public String toHTML(String url) {
            return String.format(tag, url);
        }
    }

    private static final String SCRIPT_PREFETCH_TAG = "<link rel=\"prefetch\" href=\"%s\" as=\"script\"/>\n";
    private static final String CSS_PRELOAD_TAG = "<link rel=\"preload\" href=\"%s\" as=\"style\"/>\n";
    private static final String SCRIPT_PRELOAD_TAG = "<link rel=\"preload\" href=\"%s\" as=\"script\"/>\n";

    private static final String HTML_STYLE = "<link href=\"%s\" rel=\"stylesheet\" type=\"text/css\"/>\n";
    private static final String HTML_STYLE_CLASSED = "<link href=\"%s\" class=\"%s\" rel=\"stylesheet\" type=\"text/css\"/>\n";

    private static final String HTML_DATA_HREF_STYLE = "<link data-href=\"%s\" rel=\"stylesheet\" type=\"text/css\"/>\n";
    private static final String HTML_DATA_HREF_STYLE_CLASSED = "<link data-href=\"%s\" class=\"%s\" rel=\"stylesheet\" type=\"text/css\"/>\n";

    public void writeHtmlStyle(String url, String clazz, Appendable out) throws IOException {
        if (url != null) {
            if (clazz != null) {
                out.append(String.format(HTML_STYLE_CLASSED, url, clazz));
            } else {
                out.append(String.format(HTML_STYLE, url));
            }
        }
    }

    public void writeHtmlStyles(List<String> styles, String clazz, Appendable out) throws IOException {
        if (styles != null) {
            for (String style : styles) {
                if (clazz != null) {
                    out.append(String.format(HTML_STYLE_CLASSED, style, clazz));
                } else {
                    out.append(String.format(HTML_STYLE, style));
                }
            }
        }
    }

    public void writeHtmlDataHrefStyles(List<String> styles, String clazz, Appendable out) throws IOException {
        if (styles != null) {
            for (String style : styles) {
                if (clazz != null) {
                    out.append(String.format(HTML_DATA_HREF_STYLE_CLASSED, style, clazz));
                } else {
                    out.append(String.format(HTML_DATA_HREF_STYLE, style));
                }
            }
        }
    }

    public void writeUnsafeInlineHtmlScripts(AuraContext context, List<String> scripts, Appendable out) throws IOException {
        if (scripts != null) {
            for (String src : scripts) {
                out.append(Script.UNSAFELINE.toHTML(src));
            }
        }
    }

    public void writeInlineHtmlScripts(AuraContext context, List<String> scripts, Appendable out) throws IOException {
        if (scripts != null) {
            for (String src : scripts) {
                out.append(Script.SYNC.toHTML(src));
            }
        }
    }

    public void writeHtmlScript(AuraContext context, String scriptUrl, Script scriptLoadingType, Appendable out)
            throws IOException {
        if (scriptUrl != null) {
            Type type = context.getClient().getType();
            if (type == Type.IE9 || type == Type.IE8 || type == Type.IE7 || type == Type.IE6) {
                scriptLoadingType = Script.DEFER;
            }
            out.append(scriptLoadingType.toHTML(scriptUrl));
        }
    }

    public void writeHtmlScripts(AuraContext context, List <String> scripts, Script scriptLoadingType, Appendable out)
            throws IOException {
        if (scripts != null && !scripts.isEmpty()) {
            Type type = context.getClient().getType();
            if (type == Type.IE9 || type == Type.IE8 || type == Type.IE7 || type == Type.IE6) {
                scriptLoadingType = Script.DEFER;
            }
            for (String src : scripts) {
                out.append(scriptLoadingType.toHTML(src));
            }
        }
    }

    public void writePrefetchScriptTags(List <String> scriptUrls, Appendable out) throws IOException {
        if (scriptUrls != null) {
            for (String url : scriptUrls) {
                out.append(String.format(SCRIPT_PREFETCH_TAG, url));
            }
        }
    }

    public void writePreloadLinkTags(List <String> cssUrls, Appendable out) throws IOException {
        if (cssUrls != null) {
            for (String url : cssUrls) {
                out.append(String.format(CSS_PRELOAD_TAG, url));
            }
        }
    }

    public void writePreloadScriptTags(List<String> scriptUrls, Appendable out) throws IOException {
        if (scriptUrls != null) {
            for (String url : scriptUrls) {
                out.append(String.format(SCRIPT_PRELOAD_TAG, url));
            }
        }
    }
}


text:
<?php

namespace Admin\Controller\Common;
use Oculus\Engine\Controller;
use Oculus\Engine\Action;
use Oculus\Service\ActionService;

class Dashboard extends Controller {
    private $error;
    private $errors = array(
        'install',
        'image',
        'image_cache',
        'cache',
        'download',
        'logs'
    );

    public function index() {
        $data = $this->theme->language('common/dashboard');

        $this->theme->setTitle($this->language->get('lang_heading_title'));

        $this->javascript->register('flot.min', 'summernote.min')
            ->register('flot.resize.min', 'flot.min');

        if (strtotime('-24 hours', time()) > $this->user->getLastAccess()):
            $this->checkFolders();
        endif;

        foreach ($this->errors as $error):
            if (isset($this->error[$error])):
                $data["error_{$error}"] = $this->error[$error];
            else:
                $data["error_{$error}"] = '';
            endif;
        endforeach;

        $data['token'] = $this->session->data['token'];

        if (isset($this->session->data['success'])):
            $data['success'] = $this->session->data['success'];
            unset($this->session->data['success']);
        else:
            $data['success'] = '';
        endif;

        if (isset($this->session->data['warning'])):
            $data['error_warning'] = $this->session->data['warning'];
            unset($this->session->data['warning']);
        else:
            $data['error_warning'] = '';
        endif;

        $this->theme->model('sale/order');

        $data['total_sale']      = $this->currency->format($this->model_sale_order->getTotalSales() , $this->config->get('config_currency'));
        $data['total_sale_year'] = $this->currency->format($this->model_sale_order->getTotalSalesByYear(date('Y')) , $this->config->get('config_currency'));
        $data['total_order']     = $this->model_sale_order->getTotalOrders();

        $this->theme->model('people/customer');

        $data['total_customer']          = $this->model_people_customer->getTotalCustomers();
        $data['total_customer_approval'] = $this->model_people_customer->getTotalCustomersAwaitingApproval();

        $this->theme->model('catalog/review');

        $data['total_review']          = $this->model_catalog_review->getTotalReviews();
        $data['total_review_approval'] = $this->model_catalog_review->getTotalReviewsAwaitingApproval();

        $data['orders'] = array();

        $filter = array(
            'sort'  => 'o.date_added',
            'order' => 'DESC',
            'start' => 0,
            'limit' => 10
        );

        $results = $this->model_sale_order->getOrders($filter);

        foreach ($results as $result) {
            $action = array();

            $action[] = array(
                'text' => $this->language->get('lang_text_view') ,
                'href' => $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'], 'SSL')
            );

            $data['orders'][] = array(
                'order_id'   => $result['order_id'],
                'customer'   => $result['customer'],
                'status'     => $result['status'],
                'date_added' => date($this->language->get('lang_date_format_short') , strtotime($result['date_added'])) ,
                'total'      => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']) ,
                'action'     => $action
            );
        }

        if ($this->config->get('config_currency_auto')) {
            $this->theme->model('localization/currency');

            $this->model_localization_currency->updateCurrencies();
        }

        $this->theme->loadjs('javascript/common/dashboard', $data);

        $data = $this->theme->listen(__CLASS__, __FUNCTION__, $data);

        $data = $this->theme->render_controllers($data);

        $this->response->setOutput($this->theme->view('common/dashboard', $data));
    }

    public function sale() {
        $this->theme->language('common/dashboard');

        $json = array();

        $this->theme->model('report/dashboard');

        $json['orders']            = array();
        $json['customers']         = array();
        $json['xaxis']             = array();

        $json['order']['label']    = $this->language->get('lang_text_order');
        $json['customer']['label'] = $this->language->get('lang_text_customer');

        if (isset($this->request->get['range'])) {
            $range = $this->request->get['range'];
        } else {
            $range = 'day';
        }

        switch ($range) {
            default:
            case 'day':
                $results = $this->model_report_dashboard->getTotalOrdersByDay();

                foreach ($results as $key => $value) {
                    $json['order']['data'][] = array($key, $value['total']);
                }

                $results = $this->model_report_dashboard->getTotalCustomersByDay();

                foreach ($results as $key => $value) {
                    $json['customer']['data'][] = array($key,$value['total']);
                }

                for ($i = 0; $i < 24; $i++) {
                    $json['xaxis'][] = array($i, $i);
                }
                break;

            case 'week':
                $results = $this->model_report_dashboard->getTotalOrdersByWeek();

                foreach ($results as $key => $value) {
                    $json['order']['data'][] = array($key, $value['total']);
                }

                $results = $this->model_report_dashboard->getTotalCustomersByWeek();

                foreach ($results as $key => $value) {
                    $json['customer']['data'][] = array($key, $value['total']);
                }

                $date_start = strtotime('-' . date('w') . ' days');

                for ($i = 0; $i < 7; $i++) {
                    $date = date('Y-m-d', $date_start + ($i * 86400));

                    $json['xaxis'][] = array(date('w', strtotime($date)), date('D', strtotime($date)));
                }
                break;

            case 'month':
                $results = $this->model_report_dashboard->getTotalOrdersByMonth();

                foreach ($results as $key => $value) {
                    $json['order']['data'][] = array($key, $value['total']);
                }

                $results = $this->model_report_dashboard->getTotalCustomersByMonth();

                foreach ($results as $key => $value) {
                    $json['customer']['data'][] = array($key, $value['total']);
                }

                $date_t = date('t');
                for ($i = 1; $i <= $date_t; $i++) {
                    $date = date('Y') . '-' . date('m') . '-' . $i;

                    $json['xaxis'][] = array(date('j', strtotime($date)), date('d', strtotime($date)));
                }
                break;

            case 'year':
                $results = $this->model_report_dashboard->getTotalOrdersByYear();

                foreach ($results as $key => $value) {
                    $json['order']['data'][] = array($key, $value['total']);
                }

                $results = $this->model_report_dashboard->getTotalCustomersByYear();

                foreach ($results as $key => $value) {
                    $json['customer']['data'][] = array($key, $value['total']);
                }

                for ($i = 1; $i <= 12; $i++) {
                    $json['xaxis'][] = array($i, date('M', mktime(0, 0, 0, $i)));
                }
                break;
        }

        $json = $this->theme->listen(__CLASS__, __FUNCTION__, $json);

        $this->response->setOutput(json_encode($json));
    }

    public function login() {
        $route = '';

        if (isset($this->request->get['route'])) {
            $part = explode('/', $this->request->get['route']);

            if (isset($part[0])) {
                $route.= $part[0];
            }

            if (isset($part[1])) {
                $route.= '/' . $part[1];
            }
        }

        $ignore = array(
            'common/login',
            'common/forgotten',
            'common/reset',
            'common/javascript',
            'common/css'
        );

        if (!$this->user->isLogged() && !in_array($route, $ignore)) {
            return new Action(new ActionService($this->app, 'common/login'));
        }

        if (isset($this->request->get['route'])) {
            $ignore = array(
                'common/login',
                'common/logout',
                'common/forgotten',
                'common/reset',
                'error/notfound',
                'error/permission',
                'common/breadcrumb',
                'common/menu',
                'common/javascript',
                'common/css'
            );

            $config_ignore = array();

            $ignore = array_merge($ignore, $config_ignore);

            if (!in_array($route, $ignore) && (!isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token']))) {
                return new Action(new ActionService($this->app, 'common/login'));
            }
        } else {
            if (!isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token'])) {
                return new Action(new ActionService($this->app, 'common/login'));
            }
        }
    }

    public function permission() {
        if (isset($this->request->get['route'])) {
            $route = '';

            $part = explode('/', $this->request->get['route']);

            if (isset($part[0])) {
                $route.= $part[0];
            }

            if (isset($part[1])) {
                $route.= '/' . $part[1];
            }

            $ignore = array(
                'common/dashboard',
                'common/login',
                'common/logout',
                'common/forgotten',
                'common/reset',
                'common/breadcrumb',
                'common/menu',
                'error/notfound',
                'error/permission',
                'common/javascript',
                'common/css'
            );

            if (!in_array($route, $ignore) && !$this->user->hasPermission('access', $route)) {
                return new Action(new ActionService($this->app, 'error/permission'));
            }
        }
    }

    public function checkFolders() {
        $this->theme->language('common/dashboard');

        // Check image directory is writable
        $file = $this->app['path.image'] . 'test';
        $handle = fopen($file, 'a+');

        fwrite($handle, '');
        fclose($handle);

        if (!is_readable($file)):
            $this->error['image'] = sprintf($this->language->get('lang_error_image') , $this->app['path.image']);
        else:
            $this->error['image'] = '';
            unlink($file);
        endif;

        // Check image cache directory is writable
        $file = $this->app['path.image'] . 'cache/test';
        $handle = fopen($file, 'a+');

        fwrite($handle, '');
        fclose($handle);

        if (!is_readable($file)):
            $this->error['image_cache'] = sprintf($this->language->get('lang_error_image_cache') , $this->app['path.image'] . 'cache/');
        else:
            $this->error['image_cache'] = '';
            unlink($file);
        endif;

        // Check cache directory is writable
        $file = $this->app['path.cache'] . 'test';
        $handle = fopen($file, 'a+');

        fwrite($handle, '');
        fclose($handle);

        if (!is_readable($file)):
            $this->error['cache'] = sprintf($this->language->get('lang_error_image_cache') , $this->app['path.cache']);
        else:
            $this->error['cache'] = '';
            unlink($file);
        endif;

        // Check download directory is writable
        $file = $this->app['path.download'] . 'test';
        $handle = fopen($file, 'a+');

        fwrite($handle, '');
        fclose($handle);

        if (!is_readable($file)):
            $this->error['download'] = sprintf($this->language->get('lang_error_download') , $this->app['path.download']);
        else:
            $this->error['download'] = '';
            unlink($file);
        endif;

        // Check logs directory is writable
        $file = $this->app['path.logs'] . 'test';
        $handle = fopen($file, 'a+');

        fwrite($handle, '');
        fclose($handle);

        if (!is_readable($file)):
            $this->error['logs'] = sprintf($this->language->get('lang_error_logs') , $this->app['path.logs']);
        else:
            $this->error['logs'] = '';
            unlink($file);
        endif;

        if (!$this->error):
            $this->theme->model('report/dashboard');
            $this->model_report_dashboard->setLastAccess($this->user->getId());
            $this->session->data['user_last_access'] = time();
        endif;

        return !$this->error;
    }
}


text:
using MathSite.Common.Entities;

namespace MathSite.Entities
{
    public class SiteSetting : Entity
    {
        public SiteSetting()
        {
        }

        public SiteSetting(string key, byte[] value)
        {
            Key = key;
            Value = value;
        }

        public string Key { get; set; }
        public byte[] Value { get; set; }
    }
}


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * The status view at the top of the page.  It displays what mode net-internals
 * is in (capturing, viewing only, viewing loaded log), and may have extra
 * information and actions depending on the mode.
 */
var StatusView = (function() {
  'use strict';

  // We inherit from View.
  var superClass = View;

  /**
   * Main entry point. Called once the page has loaded.
   * @constructor
   */
  function StatusView() {
    assertFirstConstructorCall(StatusView);

    superClass.call(this);

    this.subViews_ = {
      capture: new CaptureStatusView(),
      loaded: new LoadedStatusView(),
      halted: new HaltedStatusView()
    };

    this.activeSubViewName_ = 'capture';

    // Hide the non-active views.
    for (var k in this.subViews_) {
      if (k != this.activeSubViewName_)
        this.subViews_[k].show(false);
    }
  }

  cr.addSingletonGetter(StatusView);

  StatusView.prototype = {
    // Inherit the superclass's methods.
    __proto__: superClass.prototype,

    setGeometry: function(left, top, width, height) {
      superClass.prototype.setGeometry.call(this, left, top, width, height);
      this.getActiveSubView_().setGeometry(left, top, width, height);
    },

    getHeight: function() {
      return this.getActiveSubView_().getHeight();
    },

    show: function(isVisible) {
      superClass.prototype.show.call(this, isVisible);
      this.getActiveSubView_().show(isVisible);
    },

    setLayoutParent: function(view) {
      this.layoutParent_ = view;
    },

    /**
     * Switch the active subview.
     */
    switchToSubView: function(name) {
      if (!this.subViews_[name])
        throw 'Invalid subview name: ' + name;

      var prevSubView = this.getActiveSubView_();
      this.activeSubViewName_ = name;
      var newSubView = this.getActiveSubView_();

      prevSubView.show(false);
      newSubView.show(this.isVisible());

      // Since the subview's dimensions may have changed, re-trigger a layout
      // for our parent.
      var view = this.layoutParent_;
      view.setGeometry(view.getLeft(), view.getTop(),
                       view.getWidth(), view.getHeight());

      return newSubView;
    },

    getActiveSubView_: function() {
      return this.subViews_[this.activeSubViewName_];
    }
  };

  return StatusView;
})();


text:
describe Raml::Nodes::NamedParameter do

  let(:valid_attributes) do
    {
      :name => "max",
      :display_name => "Maximum",
      :description => "Maximum value to allow in the query",
      :type => "string",
      :pattern => "/(\d+)/",
      :enum => ["10", "20", '30'],
      :min_length => 2,
      :max_length => 2,
      :example => "10",
      :required => true,
      :repeat => false,
      :default => "30"
    }
  end

  it "is valid" do
    expect(Raml::Nodes::NamedParameter.new(valid_attributes).valid?).to eq(true)
  end

  it "sets defaults" do
    namedParameter = Raml::Nodes::NamedParameter.new({:name => "name"})
    expect(namedParameter.type).to eq("string")
    expect(namedParameter.repeat).to eq(false)
    expect(namedParameter.required).to eq(false)
  end

  it "is not valid when type is unknown" do
    attrs = valid_attributes.merge(:type => "unknown")
    namedParameter = Raml::Nodes::NamedParameter.new(attrs)
    namedParameter.valid?
    expect(namedParameter.errors[:type]).to be_present
  end

  it "is not valid when not string and enum present" do
    attrs = valid_attributes.merge(:type => "number", :enum => ["anything"])
    namedParameter = Raml::Nodes::NamedParameter.new(attrs)
    namedParameter.valid?
    expect(namedParameter.errors[:enum]).to be_present
  end

  it "is not valid when not string and min_length present" do
    attrs = valid_attributes.merge(:type => "number", :min_length => 1)
    namedParameter = Raml::Nodes::NamedParameter.new(attrs)
    namedParameter.valid?
    expect(namedParameter.errors[:min_length]).to be_present
  end

  it "is not valid when not string and max_length present" do
    attrs = valid_attributes.merge(:type => "number", :max_length => 10)
    namedParameter = Raml::Nodes::NamedParameter.new(attrs)
    namedParameter.valid?
    expect(namedParameter.errors[:max_length]).to be_present
  end

  it "is not valid when not number and minimum present" do
    attrs = valid_attributes.merge(:type => "string", :minimum => 10)
    namedParameter = Raml::Nodes::NamedParameter.new(attrs)
    namedParameter.valid?
    expect(namedParameter.errors[:minimum]).to be_present
  end

  it "is not valid when not number and maximum present" do
    attrs = valid_attributes.merge(:type => "string", :maximum => 10)
    namedParameter = Raml::Nodes::NamedParameter.new(attrs)
    namedParameter.valid?
    expect(namedParameter.errors[:maximum]).to be_present
  end

end


text:
::: warning TODO
This whole page will need to be revisited due to the revamped event store/projections implementation in v4. Code samples are unavailable as well.
:::

This use case demonstrates how to create immutable projections from event streams.

## Scenario

To make projections immutable, the event application methods invoked by aggregators need to be made private, as well as any property setters.

-- snippet: sample_scenarios-immutableprojections-projection

To run aggregators against such projections, aggregator lookup strategy is configured to use aggregators that look for private `Apply([Event Type])` methods. Furthermore, document deserialization is configured to look for private property setters, allowing hydration of the projected objects from the database.

This can be done in the store configuration as follows:

-- snippet: sample_scenarios-immutableprojections-storesetup

The serializer contract applied customizes the default behavior of the Json.NET serializer:

-- snippet: sample_scenarios-immutableprojections-serializer

Given the setup, a stream can now be projected using `AggregateWithPrivateEventApply` shown above. Furthermore, the created projection can be hydrated from the document store:

-- snippet: sample_scenarios-immutableprojections-projectstream