text:
html {
	height:100%;
	overflow: hidden;
	font-family: 'Open Sans', sans-serif;
}
body {
	height: 100%;
}
/*
#title-big-div,#map-div,#info-div ,#title-label-div,#main_div ,.title-options1{
	border: 1px dashed #fff;
}
*/
/* start label kuang*/
#title-big-div{
	width:100%;
	height:40px;
	background-color:#000;
}
#title-label-div{ /*inside title-big-div, for the logo*/
	cursor:pointer;
	display:inline-block;
	width:15%;
	height:100%;
	font-size:23px;
	/*font-family:sans-serif;*/
	color:#FFF;
	padding-left:8px;
	padding-top:3px;
	}
.title-options1{
	border-radius: 3px;
	cursor:pointer;
	display:inline-block;
	width:10%;
	/*height:100%;*/
	text-align:center;
	/*font-family:open sans condensed,sans-serif;*/
	color:#FFF;
	font-size: 18px ;
	padding-top:3px;
	padding-bottom:3px;
	border-left:1px #666 solid;
}
#about-div {
	border-right:1px #666 solid;
	}

.title-options1:hover {
	background-color:#7A7A7A;
	color:#fff;
}
.title-selected {
	border-radius: 3px;
	cursor:pointer;
	display:inline-block;
	width:10%;
	/*height:100%;*/
	text-align:center;
	/*font-family:sans-serif;*/
	color:#000;
	font-size: 18px ;
	background-color:#FFF;
	padding-top:3px;
	padding-bottom:3px;
}
/*  end label kuang*

/* Rental page, the right click MMoverlay style*/
/* seems that the syle of extended class MMoverlay cannot be control here*/
#menu-contain-div{
	border:#000 thick solid;
}

/*start search conditions*/
.search-div{
	z-index:1;
	background-color:#ededed;
	color:#000;	box-shadow: 0px 0px 3px #000;
	}

.search-div div {  /*div under search div all incline block*/
display:inline-block;

}

.search-div-padding {
	width:0px;
	display:inline-block;
}

#rental-search-slot {
	width: 670px;

}
#rental-search-slot > ul {
  text-align: left;
  display: inline;
  list-style: none;
  -webkit-padding-start: 0px; /* to counter the user agent stylesheet*/
}
#rental-search-slot > ul> li {  /*This decorating price-range per bed, Bedrooms/Baths and so on*/
	color:#666;
	font-size:15px;
	/*font-family:sans-serif;*/
	/*font:  15px sans-serif;*/
	display: inline-block;
	margin-right: -4px;
	position: relative;
	padding: 13px 30px;   /*top bottom  15px, right left 30px*/
	background: #fff;
	cursor: pointer;
	width:220px;
	height:48px;
	-webkit-transition: all 0.2s;
	-moz-transition: all 0.2s;
	-ms-transition: all 0.2s;
	-o-transition: all 0.2s;
	transition: all 0.2s;
	border-left:1px #CCC solid;
}
#rental-search-slot > ul> li:
last-child {
	border-right:1px #CCC solid;
}

#rental-search-slot > ul li:hover {   /*change color */
  background: #555;
  color: #fff;
	border-color: #555;
}
#rental-search-slot > ul>li >ul {
  padding: 0;
  position: absolute;
  top: 48px;  /*leave space for the horizontal three options*/
  left: 0;
  width: 200px;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
  display: none;
  opacity: 0;
  visibility: hidden;
  -webkit-transiton: opacity 0.2s;
  -moz-transition: opacity 0.2s;
  -ms-transition: opacity 0.2s;
  -o-transition: opacity 0.2s;
  -transition: opacity 0.2s;
}
#rental-search-slot > ul li ul li {

	font-size:15px;
	/*font-family:sans-serif;*/
	/*font:  15px sans-serif;*/

  margin-right: -4px;
  position: relative;
  padding: 10px 30px;   /*top bottom  15px, right left 30px*/

  cursor: pointer;
	width:220px;
	/*height:48px;*/
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  -ms-transition: all 0.2s;
  -o-transition: all 0.2s;
  transition: all 0.2s;
  background: #555;
  display: block;
  color: #fff;
  /*text-shadow: 0 -1px 0 #000;*/
	z-index:1;
}
#rental-search-slot > ul li ul li input {
	background-color:#333;
	width:100%;
	border:1px solid #333;
	margin-bottom:5px;
	margin-left:-10px;
	height:30px;
	}
#rental-search-slot > ul li ul li:hover { background: #666; }
#rental-search-slot > ul li:hover ul {
  display: block;
  opacity: 1;
  visibility: visible;
}

#sql-bash {
	display:inline;
}

/*////// start travel search slot //////*/
#travel-search-slot{
	display: none;
}

#travel-search-div {
  font: bold 12px/18px sans-serif;
  display: inline-block;
  margin-right: -4px;
  position: relative;
  padding: 7px 10px;
  background: #fff;
  cursor: pointer;
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  -ms-transition: all 0.2s;
  -o-transition: all 0.2s;
  transition: all 0.2s;
}
.travel-search-inputgrp-contrl {
	display:inline-block;
}
#ipt-origin-tr-srch, #ipt-destiny-tr-srch {
	width:270px;
}
#ipt-startdate-tr-srch, #ipt-enddate-tr-srch {
	width:100px;
}

.travel-search-hidden-inputgrp-contrl > input {  /* .travel-search-hidden-inputgrp-contrl itself inherites display:inline-block */
	display:none;
}
/*here is decoration of the search button in the travel search slot*/
/*here is decoration of the search button in the travel search slot*/
/*here is decoration of the search button in the travel search slot*/
.travel-search-btn {
	background-color:#666;
	color:#fff;
	/*font-family:sans-serif;*/
	font-size:15px;
	border-width:0px;
	border-radius:2px;
	-webkit-border-radius:2px;
	-moz-border-radius:3px;
	width:120px;
	height:32px
}

.travel-search-btn:hover {
  text-decoration: none;
	background-color:#333;
}

/*end travel search conditions*/

/*Travel form begin*/

#ipt-origin-tr, #ipt-destiny-tr, #ipt-url-tr,#ipt-date-tr {
	z-index: 1; /* If it is set to 2, #ipt-origin-tr will block date input, so I decrease z-index by 1*/
}
/*Travel form ends*/

/*I put style definition of gadgets at here*/
/* travel control panel div */
#travel-control-panel {
	position: absolute;
	top: 110px;
	left:40%;
	margin-left: 0px;
	z-index:1;
	background-color: #fff;
	padding: 5px;
	border: 1px solid #999;
	display:none; /*this one is used to hide this control panel in other map-mode*/
	cursor:pointer;
	box-shadow: 0px 0px 5px grey;
}
#travel-control-panel:hover {
	background-color: #F0F0F0;
}
/* end of travel control panel div*/

#about-panel{
	position: absolute;
	top:40px;
	left:10%;
	width:80%;
	height:80%;
	z-index:3;
	padding:10px;
	background-color: #fff;
	border: 1px solid #999;
	display:none;
	box-shadow: 0px 0px 5px grey;
	overflow: auto;
}

#menu-panel{
	border: 1px solid #BBB;
	background-color:#fff;
	box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 2px 0px;
	cursor: default;
	display: none;  /*at beginning this one cannot be shown*/
	/*font-family: Roboto, Arial, sans-serif;*/
	height: 87px;
	left: 187px; /*temp*/
	padding-bottom: 6px;
	padding-left: 0px;
	padding-right: 0px;
	padding-top: 6px;
	position: absolute;
	top: 159px;
	width: 178px;
	z-index: 1;
}
#menu-panel> div {
	color: rgb(51, 51, 51);
	cursor: pointer;
	display: block;
	/*font-family: Roboto, Arial, sans-serif;*/
	font-size: 13px;
	font-weight: normal;
	height: 25px;
	padding-bottom: 4px;
	padding-left: 16px;
	padding-top: 4px;
	position: relative;
}
#menu-panel> div:hover {
	background-color: #f1f1f1;
}
/*### END of gadgets area####*/
/**/

.poped-up-a{
	font-size:20px;
	}

#map-div{
	float:left;
	display:block;
	width:100%;
	/* Firefox */
	height: -moz-calc(100% - 88px);
	/* WebKit */
	height: -webkit-calc(100% - 88px);
	/* Opera */
	height: -o-calc(100% - 88px);
	/* Standard */
	height: calc(100% - 88px);
	z-index:0;
	overflow:scroll;

}
#pano-div{
	/*border-left:2px #CCC solid;*/
	/*at the beginning, this dive locates at left virtual place of the screen*/
	opacity: 0;
	position: absolute;
	left:-70%;
	display: block;
	z-index:0;

  float:left;
  width:70%;  /* normally info-div form mode, the width is 30%, so add them together 100%*/
	/* Firefox */
	height: -moz-calc(100% - 88px);
	/* WebKit */
	height: -webkit-calc(100% - 88px);
	/* Opera */
	height: -o-calc(100% - 88px);
	/* Standard */
	height: calc(100% - 88px);
	overflow:scroll;
	box-shadow: 3px 0px 5px #888888;
}
#info-div{
	opacity: 0.85;
	border-left:2px #CCC solid;
	z-index:2;
	text-align:left;
  float:left;
  width:30%;
	/* Firefox */
	height: -moz-calc(100% - 88px);
	/* WebKit */
	height: -webkit-calc(100% - 88px);
	/* Opera */
	height: -o-calc(100% - 88px);
	/* Standard */
	height: calc(100% - 88px);
	overflow: auto;
}
#info-div:hover{
	opacity:1;
}

.easysub-form-control{
	border-radius: 0px;

}

.info-div-results-style{
	position: absolute;
	left:100%;
	background-color:#FFF;
	/*width:60%;*/
}

.input-group-dimension-control{   /*info-div style control*/

}
.form-rtn-btn {
}
.btn-cusom-contrl {
		width:10%;
	   margin-left:10%;
		display:inline-block;
}
.input-group-dimension-control textarea{
	width:80%;
	margin-left:10%;
	margin-top:5%;

	}
.input-group-dimension-control>div div{  /*This is means every div inside #info-dive will inheritate here!*/  /*.input-group-dimension-control>div is for the slot*/
	margin-right:10%;
	margin-left:10%;
	margin-top:5%;
	}
#n-bdrm input, #n-btrm input {
	width:90%;
	}
#main_div {
	height:100%;
}

/*for travel results content*/
/*for travel results content*/

#ride-results-slot{ /*The container div of ride results*/

}
#info-div #travel_search_results_container>.travel_data_entry_div>.TDE_NONE_DISPLAY {
	display:none;

}
.travel_data_entry_div {
	border-top:1px #CCC solid;
	padding-top: 5px;
	padding-bottom: 5px;
	/*height:150px;*/
	text-align: left;
	background-color: #F5F5F0;
	/*border:1px dashed #000;*/

}
.travel_data_entry_div > div{
	padding-left:20px;
}
div.TDE_origin_pad, div.TDE_destiny_pad, div.TDE_origin, div.TDE_destiny{
	float: left;
}

div.TDE_origin_pad, div.TDE_destiny_pad{
	display:inline-block;
	/*height:60px;*/
	overflow: auto;
	width:10%;
}
div.TDE_origin, div.TDE_destiny{
	display:inline-block;
	/*padding-top: 5px;*/
	padding-bottom:10px;
	height:50px;
	width :40%;
	overflow: auto;

}

div.TDE_cat {
	clear:left;
}
div.TDE_cat, div.TDE_date{

  -webkit-border-radius: 2;
  -moz-border-radius: 2;
  border-radius: 2px;
  color: #ffffff;
  background-color: #8a8a8a;
  padding: 2px 5px 2px 5px;
  text-decoration: none;

	display:inline-block;

	text-align: center;
	margin-left: 20px;
}
div.TDE_date{
	margin-left:10px;
}
 div.TDE_source {
 	display:inline-block;
	text-align: center;
 }
div.TDE_padding_btw_markoutdated_source{
	visibility: hidden;
	display:inline-block;
	height:20px;
		border:1px dashed #000;
	/* Firefox */
	width: -moz-calc(100% - 570px);
	/* WebKit */
	width: -webkit-calc(100% - 570px);
	/* Opera */
	width: -o-calc(100% - 570px);
	/* Standard */
	width: calc(100% - 570px);

}
div.TDE_markoutdated {
		display:inline-block;
		height:20px;
		width:120px;
}

.travel_data_entry_div .TDE_bold {
	font-weight:bold;

}
#info-div #travel_search_results_container>.travel_data_entry_div:hover  {
	box-shadow: inset 0px 0px 8px #85C2FF;

}


text:
package org.cyclops.integrateddynamics.blockentity;

import com.google.common.collect.Sets;
import net.minecraft.world.level.block.entity.BlockEntityType;
import org.cyclops.cyclopscore.config.extendedconfig.BlockEntityConfig;
import org.cyclops.integrateddynamics.IntegratedDynamics;
import org.cyclops.integrateddynamics.RegistryEntries;

/**
 * Config for the {@link BlockEntityMechanicalDryingBasin}.
 * @author rubensworks
 *
 */
public class BlockEntityMechanicalDryingBasinConfig extends BlockEntityConfig<BlockEntityMechanicalDryingBasin> {

    public BlockEntityMechanicalDryingBasinConfig() {
        super(
                IntegratedDynamics._instance,
                "mechanical_drying_basin",
                (eConfig) -> new BlockEntityType<>(BlockEntityMechanicalDryingBasin::new,
                        Sets.newHashSet(RegistryEntries.BLOCK_MECHANICAL_DRYING_BASIN), null)
        );
    }

}

redpajama_set_name: RedPajamaGithub


text:
package edu.nju.web.json;

import lombok.Data;

/**
 * Check out data(optional)
 */
@Data
public class CheckOutJson {
    private int memberId = -1;
    private String payway;
}


text:
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name   : return_statement_specs.js
* Created at  : 2019-03-01
* Updated at  : 2019-08-06
* Author      : jeefo
* Purpose     :
* Description :
* Reference   :
.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.*/
// ignore:start
"use strict";

/* globals*/
/* exported*/

// ignore:end

const expect          = require("expect.js"),
      parser          = require("../parser.js"),
      test_keyword    = require("../../helpers/test_keyword"),
      test_substring  = require("../../helpers/test_substring"),
      test_delimiter  = require("../../helpers/test_delimiter"),
      precedence_enum = require("../../../src/es5/enums/precedence_enum");

describe("Return statement >", () => {
    const test = test_cases => {
        test_cases.forEach(test_case => {
            const text = test_case.source.replace(/\n/g, "\\n");
            describe(`Test against source text '${ text }'`, () => {
                parser.tokenizer.init(test_case.source);
                parser.prepare_next_state();

                const streamer = parser.tokenizer.streamer;
                let node;
                try {
                    node = parser.parse_next_node(
                        precedence_enum.TERMINATION
                    );
                } catch (e) {}

                it("should be Return statement", () => {
                    expect(node.id).to.be("Return statement");
                    expect(node.type).to.be("Statement");
                    expect(node.precedence).to.be(40);
                });

                it("should be has correct keyword", () => {
                    test_case.keyword(node.keyword, streamer);
                });

                it("should be has correct expression", () => {
                    test_case.expression(node.expression, streamer);
                });

                it("should be has correct terminator", () => {
                    test_case.terminator(node.terminator, streamer);
                });

                it(`should be in correct range`, () => {
                    const last_index = test_case.code.length - 1;

                    test_substring(test_case.code, streamer, node);
                    expect(streamer.get_current_character()).to.be(
                        test_case.source.charAt(last_index)
                    );
                    expect(streamer.cursor.position.index).to.be(last_index);
                });
            });
        });
    };

    describe("Semicolon terminated >", () => {
        test([
            // return;
            {
                code   : "return;",
                source : "return;",

                keyword : (keyword, streamer) => {
                    test_keyword("return", null, keyword, streamer);
                },
                expression : expression => {
                    expect(expression).to.be(null);
                },
                terminator : (terminator, streamer) => {
                    test_delimiter(';', null, terminator, streamer);
                }
            },

            // return /*a*/ a + b + c /*b*/;
            {
                code   : "return /*a*/ a + b + c /*b*/;",
                source : "return /*a*/ a + b + c /*b*/;",

                keyword : (keyword, streamer) => {
                    test_keyword("return", null, keyword, streamer);
                },
                expression : (expression, streamer) => {
                    expect(expression).not.to.be(null);
                    test_substring("a + b + c", streamer, expression);
                },
                terminator : (terminator, streamer) => {
                    test_delimiter(';', "/*b*/", terminator, streamer);
                }
            },
        ]);
    });

    describe("Automatic semicolon insertion >", () => {
        test([
            // return
            {
                code   : "return",
                source : "return",

                keyword : (keyword, streamer) => {
                    test_keyword("return", null, keyword, streamer);
                },
                expression : expression => {
                    expect(expression).to.be(null);
                },
                terminator : terminator => {
                    expect(terminator).to.be(null);
                }
            },

            // return\n 1 + 2;
            {
                code   : "return",
                source : "return\n 1 + 2;",

                keyword : (keyword, streamer) => {
                    test_keyword("return", null, keyword, streamer);
                },
                expression : expression => {
                    expect(expression).to.be(null);
                },
                terminator : terminator => {
                    expect(terminator).to.be(null);
                }
            },

            // return 1\n +\n 2\n;
            {
                code   : "return 1\n +\n 2",
                source : "return 1\n +\n 2\n;",

                keyword : (keyword, streamer) => {
                    test_keyword("return", null, keyword, streamer);
                },
                expression : (expression, streamer) => {
                    expect(expression).not.to.be(null);
                    test_substring("1\n +\n 2", streamer, expression);
                },
                terminator : terminator => {
                    expect(terminator).to.be(null);
                }
            },
        ]);
    });
});


text:
/**
 * This class handles business logic for feed-related operations.
 *
 * @property {WeightAWSDao} 	weightDao 		- Interacts with the weight data store
 * @property {BabyAWSDao} 		babyDao			- Interacts with the baby data store
 *
 * @author Christina Sickelco
 */

//Used to write more secure javascript. See http://www.w3schools.com/js/js_strict.asp.
'use strict';

//Alexa app server hotswap module will reload code changes to apps
//if this is set to 1. Handy for local development and testing
//See https://runkit.com/npm/alexa-app-server
module.change_code = 1;

//Dependencies
var _ = require('lodash');
var Response = require('../common/response');
var Weight = require('./weight');
var WeightPercentileDao = require('./weight_percentile_dao');
var Utils = require('../common/utils');
var IllegalStateError = require('../common/illegal_state_error');
var ActivityLimitError = require('../common/activity_limit_error');
var ValidationUtils = require('../common/validation_utils');
var Winston = require('winston');

//Configure the logger with basic logging template
var logger = new (Winston.Logger)({
    transports: [
      new (Winston.transports.Console)({
    	  timestamp: function() {
    		  return new Date();
    	  },
    	  formatter: function(options) {
    		  return '[' + options.level.toUpperCase() + '] '+ options.timestamp() +' Weight_Controller - '+ (undefined !== options.message ? options.message : '') +
              (options.meta && Object.keys(options.meta).length ? '\n\t'+ JSON.stringify(options.meta) : '' );
    	  }
      })
    ]
  });

//Constants
/**
 * The maximum number of weight entries that can be added in any given day
 */
var ADD_LIMIT = 5;

//http://stackoverflow.com/questions/20425771/how-to-replace-1-with-first-2-with-second-3-with-third-etc
var special = ['zeroth','first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelvth', 'thirteenth', 'fourteenth', 'fifteenth', 'sixteenth', 'seventeenth', 'eighteenth', 'nineteenth'];
var deca = ['twent', 'thirt', 'fourt', 'fift', 'sixt', 'sevent', 'eight', 'ninet'];

/**
 * Helper method to return position text for the given number.
 * e.g. returns "first" if n === 0, "second" if n === 2, and so on.
 * @param n {number}	the number to stringify. Non-nullable.
 * @returns {string} position text for the given number.
 */
function stringifyNumber(n) {
  if (n < 20) {
	  return special[n];
  }
  if (n%10 === 0) {
	  return deca[Math.floor(n/10)-2] + 'ieth';
  }
  return deca[Math.floor(n/10)-2] + 'y-' + special[n%10];
}

/**
 * Represents business logic for weight-related operations.
 * @constructor
 */
function WeightController (weightDao, babyDao) {
	this.weightDao = weightDao;
	this.babyDao = babyDao;
	this.weightPercentileDao = new WeightPercentileDao();
}

/**
 * Asynchronous operation to setup any needed weight data in the data store.
 *
 * @returns {Promise<Response|DaoError} Returns an empty promise if the operation succeeded,
 * 			else returns a rejected promise with a DaoError
 * 			if an error occurred interacting with DynamoDB.
 */
WeightController.prototype.initWeightData = function() {
	logger.debug("initWeightData: Starting initialization...");
	return this.weightDao.createTable();
};

/**
 * Asynchronous operation to add (or overwrite) a new weight to the data store
 * and return a response.
 *
 * @param 	userId {string}		the userId whose baby's weight to add. Non-nullable.
 * @param	date {Date}			the date the weight measurement was taken. Non-nullable. Must be >= birthdate.
 * @param	pounds {number}		the number of pounds the baby is. Non-nullable.  Must be an integer >= 0.
 * @param	ounces {number}		number of ounces after pounds the baby is. Nullable (if null, assumed to be 0).
 * 								Must be an integer between 0 and 15.
 * @param 	{string} baby				the name of the baby to add the weight for. Nullable.
 * 										If not specified, the weight is assumed to be for the most
 * 										recently added baby.
 *
 * @returns {Promise<Response|DaoError, IllegalArgumentError, TypeError} Returns a promise with a
 * 			response if the operation succeeded,
 * 			where the response has both a verbal message and written card
 * 			confirming the action,
 * 			else returns a rejected promise with a DaoError
 * 			if an error occurred interacting with DynamoDB,
 * 			or an illegalArgumentError if invalid input provider,
 * 			or TypeError if one of the specified arguments was of the wrong type,
 * 			or RangeError if pounds or ounces fall outside the range.
 */
WeightController.prototype.addWeight = function(userId, date, pounds, ounces, baby) {
	logger.debug("pounds - " + pounds + ", ounces - " + ounces);
	logger.debug("addWeight: Adding weight for %s, date: %s, pounds: %d, ounces: %d, baby: %s", userId, date, pounds, ounces, baby);
	var template = _.template('Added weight ${pounds} pound${poundsPlural}, ${ounces} ounce${ouncePlural} for ${babyName}.');
	if( !ounces ) {
		ounces = 0;
	}
	var totalOunces = (pounds*16) + parseInt(ounces);
	var loadedBaby;

	var weight = new Weight();
	weight.userId = userId;
	weight.weight = totalOunces;
	weight.date = date;

	var self = this;

	return ValidationUtils.validateRequired("userId", userId)
		.then( function(result) {
			return ValidationUtils.validateRequired("weight date", date);
		})
		.then( function(result) {
			return ValidationUtils.validateRequired("weight pounds", pounds);
		})
		.then( function(result) {
			return ValidationUtils.validateNumber("weight pounds", pounds);
		})
		.then( function(result) {
			return ValidationUtils.validateNumberGreaterThanOrEqualTo("weight pounds", pounds, 0);
		})
		.then( function(result) {
			return ValidationUtils.validateNumber("weight ounces", ounces);
		})
		.then( function(result) {
			return ValidationUtils.validateNumberGreaterThanOrEqualTo("weight ounces", ounces, 0);
		})
		.then( function(result) {
			return ValidationUtils.validateNumberLessThan("weight ounces", ounces, 16);
		})
		.then( function(result) {
			if( baby ) {
				logger.debug("addWeight: Adding weight for %s", baby);
				return self.babyDao.readBabyByName(userId, baby);
			} else {
				return self.babyDao.readBaby(userId);
			}
		})
		.then(function(readBabyResult) {
			if(readBabyResult) {
				loadedBaby = readBabyResult;
				weight.seq = loadedBaby.seq;
				weight.timezone = loadedBaby.timezone;
			} else {
				if(baby) {
					return Promise.reject(new IllegalStateError(
							"Before adding weight for " + baby + ", you must first add " + baby +
							" by saying 'tell Newbie to add baby'"));
				} else {
					return Promise.reject(new IllegalStateError("Before adding weight, you must first add a baby"));
				}
			}
			var dateAfter;
			if(loadedBaby.birthdate) {
				dateAfter = new Date(loadedBaby.birthdate);
			} else {
				dateAfter = new Date(1900, 1, 1);
			}
			return ValidationUtils.validateDateAfter("weight date", date, dateAfter);
		}).then(function(result) {
			return self.weightDao.getWeightCountForDay(weight.userId, loadedBaby.seq, date, loadedBaby.timezone);
		})
		.then(function(weightCountResult) {
			if( weightCountResult + 1 > ADD_LIMIT ) {
				return Promise.reject(new ActivityLimitError("You cannot add more than " + ADD_LIMIT +
					" weight entries in any given day"));
			}
			return self.weightDao.createWeight(weight);
		}).then(function(createWeightResult) {
			var responseMsg = template(
			{
				pounds: pounds,
				poundsPlural: Utils.pluralizeIfNeeded(pounds),
				ounces: ounces,
				ouncePlural: Utils.pluralizeIfNeeded(ounces),
				babyName: loadedBaby.name
			});
			logger.debug("addWeight: Response %s", responseMsg);
			return new Response(responseMsg, "Weight", responseMsg);
		});
};

/**
 * Asynchronous operation to remove the most recent weight entry from the data store
 * and return a response.
 *
 * @param 	userId {string}		the userId whose last weight entry to remove. Non-nullable.
 * @param 	{string} baby				the name of the baby to get the weight for. Nullable.
 * 										If not specified, the weight is assumed to be for the most
 * 										recently added baby.
 * @returns {Promise<Response|DaoError} Returns a promise with a
 * 			response if the operation succeeded,
 * 			where the response has both a verbal message and written card
 * 			confirming the action,
 * 			else returns a rejected promise with a DaoError
 * 			if an error occurred interacting with DynamoDB.
 */
WeightController.prototype.removeLastWeight = function(userId, baby) {
	logger.debug("removeLastWeight: Removing weight for %s", userId);
	var loadedBaby;
	var self = this;
	var lastWeight;
	var lastWeightDate;

	//First, validate all input arguments
	return ValidationUtils.validateRequired("userId", userId)
		.then( function(result) {
			//Next, get this user's baby (to make sure it exists and to use the
			//name in the response)
			if( baby ) {
				logger.debug("removeLastWeight: Removing weight for %s", baby);
				return self.babyDao.readBabyByName(userId, baby);
			} else {
				return self.babyDao.readBaby(userId);
			}
		})
		.then( function(readBabyResult) {
			//Then, get the most recent weight entry from the datastore provided the baby exists
			if(readBabyResult) {
				loadedBaby = readBabyResult;
			} else {
				if(baby) {
					return Promise.reject(new IllegalStateError(
							"Before removing weight for " + baby + ", you must first add " + baby +
							" by saying 'tell Newbie to add baby'"));
				} else {
					return Promise.reject(new IllegalStateError("Before removing weight, you must first add a baby"));
				}
			}
			return self.weightDao.getLastWeight(userId, loadedBaby.seq);
		})
		.then( function(getLastWeightResult) {
			//TODO: Handle the case where there are no weight entries
			getLastWeightResult.Items.forEach(function(item) {
	            logger.debug("getLastWeight: lastWeight %s %d", item.date, item.weight);
	            lastWeightDate = new Date(item.date); //TODO: Can't the DAO do this?
	            lastWeight = item.weight;
	        });

			//Then delete that weight
			if( lastWeightDate ) {
				logger.debug("Deleting weight");
				return self.weightDao.deleteWeight(userId, loadedBaby.seq, new Date(lastWeightDate), loadedBaby.timezone);
			} else {
				return Promise.resolve();
			}
		})
		.then( function(deleteWeightResult)
		{
			logger.debug("Delete weight result: %s", JSON.stringify(deleteWeightResult));
			//Finally, put it all together in a response
			var babyName = loadedBaby.name;
			var responseMsg;
			if( lastWeightDate ) {
				responseMsg = "Removed weight " + Utils.getPoundsAndOuncesString(lastWeight) + " for " + babyName + ".";
			} else {
				responseMsg =  "No previous weight entries recorded for " + babyName;
			}
			logger.debug("removeWeight: Response %s", responseMsg);
			return new Response(responseMsg, "Weight", responseMsg);
		});
};

module.exports = WeightController;


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.apache.jena.assembler.Assembler (Apache Jena)</title>
<meta name="date" content="2015-12-08">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
org.apache.jena.assembler.Assembler

Packages that use Assembler

Package
Description

org.apache.jena.assembler

Uses of Assembler in org.apache.jena.assembler

Fields in org.apache.jena.assembler declared as Assembler

Modifier and Type
Field and Description

static Assembler
Assembler.content

static Assembler
Assembler.defaultModel

static Assembler
Assembler.documentManager

static Assembler
Assembler.fileManager

static Assembler
Assembler.infModel

static Assembler
Assembler.locationMapper

static Assembler
Assembler.memoryModel

static Assembler
Assembler.modelSource

static Assembler
Assembler.ontModel

static Assembler
Assembler.ontModelSpec

static Assembler
Assembler.prefixMapping

static Assembler
Assembler.reasonerFactory

static Assembler
Assembler.ruleSet

static Assembler
Assembler.unionModel

Methods in org.apache.jena.assembler that return Assembler

Modifier and Type
Method and Description

static Assembler
ConstAssembler.content()

static Assembler
ConstAssembler.defaultModel()

static Assembler
ConstAssembler.documentManager()

static Assembler
ConstAssembler.fileManager()

static Assembler
ConstAssembler.infModel()

static Assembler
ConstAssembler.locationMapper()

static Assembler
ConstAssembler.memoryModel()

static Assembler
ConstAssembler.modelSource()

static Assembler
ConstAssembler.ontModel()

static Assembler
ConstAssembler.ontModelSpec()

static Assembler
ConstAssembler.prefixMapping()

static Assembler
ConstAssembler.reasonerFactory()

static Assembler
ConstAssembler.ruleSet()

static Assembler
ConstAssembler.unionModel()

Methods in org.apache.jena.assembler with parameters of type Assembler

Modifier and Type
Method and Description

Object
Assembler.open(Assembler a,
    Resource root)

Answer open( a, root, Mode.DEFAULT ).

Object
Assembler.open(Assembler a,
    Resource root,
    Mode mode)

The core operation: answer a new object constructed according to the
        object description hanging from root, using the assembler
        a for any sub-objects.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Licenced under the Apache License, Version 2.0


text:
package io.trivium.dep.com.google.gson;

import java.lang.reflect.Type;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

/**
 * This type adapter supports three subclasses of date: Date, Timestamp, and
 * java.sql.Date.
 *
 * @author Inderjeet Singh
 * @author Joel Leitch
 */
final class DefaultDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {

  // TODO: migrate to streaming adapter

  private final DateFormat enUsFormat;
  private final DateFormat localFormat;
  private final DateFormat iso8601Format;

  DefaultDateTypeAdapter() {
    this(DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.US),
        DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT));
  }

  DefaultDateTypeAdapter(String datePattern) {
    this(new SimpleDateFormat(datePattern, Locale.US), new SimpleDateFormat(datePattern));
  }

  DefaultDateTypeAdapter(int style) {
    this(DateFormat.getDateInstance(style, Locale.US), DateFormat.getDateInstance(style));
  }

  public DefaultDateTypeAdapter(int dateStyle, int timeStyle) {
    this(DateFormat.getDateTimeInstance(dateStyle, timeStyle, Locale.US),
        DateFormat.getDateTimeInstance(dateStyle, timeStyle));
  }

  DefaultDateTypeAdapter(DateFormat enUsFormat, DateFormat localFormat) {
    this.enUsFormat = enUsFormat;
    this.localFormat = localFormat;
    this.iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
    this.iso8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
  }

  // These methods need to be synchronized since JDK DateFormat classes are not thread-safe
  // See issue 162
  public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
    synchronized (localFormat) {
      String dateFormatAsString = enUsFormat.format(src);
      return new JsonPrimitive(dateFormatAsString);
    }
  }

  public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
      throws JsonParseException {
    if (!(json instanceof JsonPrimitive)) {
      throw new JsonParseException("The date should be a string value");
    }
    Date date = deserializeToDate(json);
    if (typeOfT == Date.class) {
      return date;
    } else if (typeOfT == Timestamp.class) {
      return new Timestamp(date.getTime());
    } else if (typeOfT == java.sql.Date.class) {
      return new java.sql.Date(date.getTime());
    } else {
      throw new IllegalArgumentException(getClass() + " cannot deserialize to " + typeOfT);
    }
  }

  private Date deserializeToDate(JsonElement json) {
    synchronized (localFormat) {
      try {
        return localFormat.parse(json.getAsString());
      } catch (ParseException ignored) {
      }
      try {
        return enUsFormat.parse(json.getAsString());
      } catch (ParseException ignored) {
      }
      try {
        return iso8601Format.parse(json.getAsString());
      } catch (ParseException e) {
        throw new JsonSyntaxException(json.getAsString(), e);
      }
    }
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append(DefaultDateTypeAdapter.class.getSimpleName());
    sb.append('(').append(localFormat.getClass().getSimpleName()).append(')');
    return sb.toString();
  }
}


text:
<?php

/*
 * This file is part of the RollerworksSearch package.
 *
 * (c) Sebastiaan Stok <s.stok@rollerscapes.net>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Rollerworks\Bundle\SearchBundle\ExceptionParser;

use Rollerworks\Component\ExceptionParser\ExceptionParserInterface;
use Rollerworks\Component\Search\Input\FilterQuery\QueryException;

class QueryExceptionParser implements ExceptionParserInterface
{
    public function accepts(\Exception $exception)
    {
        return $exception instanceof QueryException;
    }

    /**
     * @param QueryException|\Exception $exception
     *
     * @return array
     */
    public function parseException(\Exception $exception)
    {
        if ($exception->getExpected()) {
            return [
                'message' => '[Syntax Error] line {{ line }} col {{ column }}: Expected {{ expected }}, got "{{ got }}".',
                'parameters' => [
                    'line' => $exception->getSyntaxLine(),
                    'column' => $exception->getCol(),
                    'expected' => $exception->getExpected(),
                    'got' => $exception->getInstead(),
                ],
            ];
        } else {
            return [
                'message' => '[Syntax Error] line {{ line }} col {{ column }}: Unexpected {{ unexpected }}.',
                'parameters' => [
                    'line' => $exception->getSyntaxLine(),
                    'column' => $exception->getCol(),
                    'unexpected' => $exception->getInstead(),
                ],
            ];
        }
    }
}


text:
<?php declare(strict_types=1);

namespace ApiClients\Client\Travis\CommandBus\Handler;

use ApiClients\Client\Pusher\AsyncClient as PusherAsyncClient;
use ApiClients\Client\Pusher\Event;
use ApiClients\Client\Pusher\Service\SharedAppClientService;
use ApiClients\Client\Travis\ApiSettings;
use ApiClients\Client\Travis\CommandBus\Command\JobLogCommand;
use ApiClients\Client\Travis\Resource\LogLineInterface;
use ApiClients\Foundation\Hydrator\Hydrator;
use React\Promise\PromiseInterface;
use Rx\Observable;
use Rx\ObserverInterface;
use function React\Promise\resolve;

final class JobLogHandler
{
    /**
     * @var SharedAppClientService
     */
    private $pusher;

    /**
     * @var Hydrator
     */
    private $hydrator;

    /**
     * JobLogHandler constructor.
     * @param SharedAppClientService $pusher
     * @param Hydrator               $hydrator
     */
    public function __construct(SharedAppClientService $pusher, Hydrator $hydrator)
    {
        $this->pusher = $pusher;
        $this->hydrator = $hydrator;
    }

    /**
     * Fetch the given repository and hydrate it.
     *
     * @param  JobLogCommand    $command
     * @return PromiseInterface
     */
    public function handle(JobLogCommand $command): PromiseInterface
    {
        return $this->pusher->share(
            ApiSettings::PUSHER_KEY
        )->then(function (PusherAsyncClient $pusher) use ($command) {
            return resolve(Observable::create(function (
                ObserverInterface $observer
            ) use (
                $pusher,
                $command
            ) {
                $subscription = $pusher->channel('job-' . (string)$command->getId())->filter(function (Event $event) {
                    return $event->getEvent() === 'job:log';
                })->map(function (Event $event) {
                    return $this->hydrator->hydrate(LogLineInterface::HYDRATE_CLASS, $event->getData());
                })->subscribe(
                    function (LogLineInterface $line) use ($observer, &$subscription) {
                        $observer->onNext($line);

                        if ($line->final()) {
                            $subscription->dispose();
                        }
                    },
                    function ($error) use ($observer) {
                        $observer->onError($error);
                    },
                    function () use ($observer) {
                        $observer->onComplete();
                    }
                );
            }));
        });
    }
}


text:
<!DOCTYPE html>
<html>
<head>
        <title>Order and Address MultiView</title>
</head>
<body>

<form action="." method="post">

{{ order_form }}

<input type="submit" value="Submit" />

</form>

<form action="." method="post">

{{ address_form }}

<input type="submit" value="Submit" />

</form>

</body>
</html>


text:
package org.broadleafcommerce.core.order.dao;

import org.broadleafcommerce.common.persistence.EntityConfiguration;
import org.broadleafcommerce.core.order.domain.GiftWrapOrderItem;
import org.broadleafcommerce.core.order.domain.OrderItem;
import org.broadleafcommerce.core.order.domain.OrderItemImpl;
import org.broadleafcommerce.core.order.domain.OrderItemPriceDetail;
import org.broadleafcommerce.core.order.domain.OrderItemPriceDetailImpl;
import org.broadleafcommerce.core.order.domain.OrderItemQualifier;
import org.broadleafcommerce.core.order.domain.OrderItemQualifierImpl;
import org.broadleafcommerce.core.order.domain.PersonalMessage;
import org.broadleafcommerce.core.order.service.type.OrderItemType;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Repository("blOrderItemDao")
public class OrderItemDaoImpl implements OrderItemDao {

    @PersistenceContext(unitName="blPU")
    protected EntityManager em;

    @Resource(name="blEntityConfiguration")
    protected EntityConfiguration entityConfiguration;

    public OrderItem save(final OrderItem orderItem) {
        return em.merge(orderItem);
    }

    public OrderItem readOrderItemById(final Long orderItemId) {
        return em.find(OrderItemImpl.class, orderItemId);
    }

    public void delete(OrderItem orderItem) {
        if (!em.contains(orderItem)) {
            orderItem = readOrderItemById(orderItem.getId());
        }
        if (GiftWrapOrderItem.class.isAssignableFrom(orderItem.getClass())) {
            final GiftWrapOrderItem giftItem = (GiftWrapOrderItem) orderItem;
            for (OrderItem wrappedItem : giftItem.getWrappedItems()) {
                wrappedItem.setGiftWrapOrderItem(null);
                wrappedItem = save(wrappedItem);
            }
        }
        em.remove(orderItem);
        em.flush();
    }

    public OrderItem create(final OrderItemType orderItemType) {
        final OrderItem item = (OrderItem) entityConfiguration.createEntityInstance(orderItemType.getType());
        item.setOrderItemType(orderItemType);
        return item;
    }

    public PersonalMessage createPersonalMessage() {
        PersonalMessage personalMessage = (PersonalMessage) entityConfiguration.createEntityInstance(PersonalMessage.class.getName());
        return personalMessage;
    }

    public OrderItem saveOrderItem(final OrderItem orderItem) {
        return em.merge(orderItem);
    }

    public OrderItemPriceDetail createOrderItemPriceDetail() {
        return new OrderItemPriceDetailImpl();
    }

    public OrderItemQualifier createOrderItemQualifier() {
        return new OrderItemQualifierImpl();
    }

    public OrderItemPriceDetail initializeOrderItemPriceDetails(OrderItem item) {
        OrderItemPriceDetail detail = createOrderItemPriceDetail();
        detail.setOrderItem(item);
        detail.setQuantity(item.getQuantity());
        detail.setUseSalePrice(item.getIsOnSale());
        item.getOrderItemPriceDetails().add(detail);
        return detail;
    }
}


text:
package manager

func defaultDownloadBufferProvider() WriterReadFromProvider {
	return NewPooledBufferedWriterReadFromProvider(1024 * 1024)
}


text:
require 'spec_helper'

describe Padrino::OrmAdapter::Base do
  subject { Padrino::OrmAdapter::Base.new(Object) }

  describe "#extract_conditions!" do
    let(:conditions) { {:foo => 'bar'} }
    let(:order) { [[:foo, :asc]] }
    let(:limit) { 1 }
    let(:offset) { 2 }

    it "(<conditions>)" do
      expect(subject.send(:extract_conditions!, conditions)).to eq([conditions, [], nil, nil])
    end

    it "(:conditions => <conditions>)" do
      expect(subject.send(:extract_conditions!, :conditions => conditions)).to eq([conditions, [], nil, nil])
    end

    it "(:order => <order>)" do
      expect(subject.send(:extract_conditions!, :order => order)).to eq([{}, order, nil, nil])
    end

    it "(:limit => <limit>)" do
      expect(subject.send(:extract_conditions!, :limit => limit)).to eq([{}, [], limit, nil])
    end

    it "(:offset => <offset>)" do
      expect(subject.send(:extract_conditions!, :offset => offset)).to eq([{}, [], nil, offset])
    end

    it "(:conditions => <conditions>, :order => <order>)" do
      expect(subject.send(:extract_conditions!, :conditions => conditions, :order => order)).to eq([conditions, order, nil, nil])
    end

    it "(:conditions => <conditions>, :limit => <limit>)" do
      expect(subject.send(:extract_conditions!, :conditions => conditions, :limit => limit)).to eq([conditions, [], limit, nil])
    end

    it "(:conditions => <conditions>, :offset => <offset>)" do
      expect(subject.send(:extract_conditions!, :conditions => conditions, :offset => offset)).to eq([conditions, [], nil, offset])
    end

    describe "#valid_object?" do
      it "determines whether an object is valid for the current model class" do
        expect(subject.send(:valid_object?, Object.new)).to be_truthy
        expect(subject.send(:valid_object?, String.new)).to be_falsey
      end
    end

    describe "#normalize_order" do
      specify "(nil) returns []" do
        expect(subject.send(:normalize_order, nil)).to eq([])
      end

      specify ":foo returns [[:foo, :asc]]" do
        expect(subject.send(:normalize_order, :foo)).to eq([[:foo, :asc]])
      end

      specify "[:foo] returns [[:foo, :asc]]" do
        expect(subject.send(:normalize_order, [:foo])).to eq([[:foo, :asc]])
      end

      specify "[:foo, :desc] returns [[:foo, :desc]]" do
        expect(subject.send(:normalize_order, [:foo, :desc])).to eq([[:foo, :desc]])
      end

      specify "[:foo, [:bar, :asc], [:baz, :desc], :bing] returns [[:foo, :asc], [:bar, :asc], [:baz, :desc], [:bing, :asc]]" do
        expect(subject.send(:normalize_order, [:foo, [:bar, :asc], [:baz, :desc], :bing])).to eq([[:foo, :asc], [:bar, :asc], [:baz, :desc], [:bing, :asc]])
      end

      specify "[[:foo, :wtf]] raises ArgumentError" do
        expect { subject.send(:normalize_order, [[:foo, :wtf]]) }.to raise_error(ArgumentError)
      end

      specify "[[:foo, :asc, :desc]] raises ArgumentError" do
        expect { subject.send(:normalize_order, [[:foo, :asc, :desc]]) }.to raise_error(ArgumentError)
      end
    end
  end
end


text:
.class public abstract Landroid/service/wallpaper/IWallpaperConnection$Stub;
.super Landroid/os/Binder;
.source "IWallpaperConnection.java"

# interfaces
.implements Landroid/service/wallpaper/IWallpaperConnection;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/service/wallpaper/IWallpaperConnection;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x409
    name = "Stub"
.end annotation

.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/service/wallpaper/IWallpaperConnection$Stub$Proxy;
    }
.end annotation

# static fields
.field private static final DESCRIPTOR:Ljava/lang/String; = "android.service.wallpaper.IWallpaperConnection"

.field static final TRANSACTION_attachEngine:I = 0x1

.field static final TRANSACTION_setWallpaper:I = 0x2

# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 17
    invoke-direct {p0}, Landroid/os/Binder;-><init>()V

    .line 18
    const-string v0, "android.service.wallpaper.IWallpaperConnection"

    invoke-virtual {p0, p0, v0}, Landroid/service/wallpaper/IWallpaperConnection$Stub;->attachInterface(Landroid/os/IInterface;Ljava/lang/String;)V

    .line 19
    return-void
.end method

.method public static asInterface(Landroid/os/IBinder;)Landroid/service/wallpaper/IWallpaperConnection;
    .locals 2
    .parameter "obj"

    .prologue
    .line 26
    if-nez p0, :cond_0

    .line 27
    const/4 v0, 0x0

    .line 33
    :goto_0
    return-object v0

    .line 29
    :cond_0
    const-string v1, "android.service.wallpaper.IWallpaperConnection"

    invoke-interface {p0, v1}, Landroid/os/IBinder;->queryLocalInterface(Ljava/lang/String;)Landroid/os/IInterface;

    move-result-object v0

    .line 30
    .local v0, iin:Landroid/os/IInterface;
    if-eqz v0, :cond_1

    instance-of v1, v0, Landroid/service/wallpaper/IWallpaperConnection;

    if-eqz v1, :cond_1

    .line 31
    check-cast v0, Landroid/service/wallpaper/IWallpaperConnection;

    goto :goto_0

    .line 33
    :cond_1
    new-instance v0, Landroid/service/wallpaper/IWallpaperConnection$Stub$Proxy;

    .end local v0           #iin:Landroid/os/IInterface;
    invoke-direct {v0, p0}, Landroid/service/wallpaper/IWallpaperConnection$Stub$Proxy;-><init>(Landroid/os/IBinder;)V

    goto :goto_0
.end method

# virtual methods
.method public asBinder()Landroid/os/IBinder;
    .locals 0

    .prologue
    .line 37
    return-object p0
.end method

.method public onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
    .locals 4
    .parameter "code"
    .parameter "data"
    .parameter "reply"
    .parameter "flags"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    const/4 v2, 0x1

    .line 41
    sparse-switch p1, :sswitch_data_0

    .line 74
    invoke-super {p0, p1, p2, p3, p4}, Landroid/os/Binder;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    move-result v2

    :goto_0
    return v2

    .line 45
    :sswitch_0
    const-string v3, "android.service.wallpaper.IWallpaperConnection"

    invoke-virtual {p3, v3}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    goto :goto_0

    .line 50
    :sswitch_1
    const-string v3, "android.service.wallpaper.IWallpaperConnection"

    invoke-virtual {p2, v3}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V

    .line 52
    invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;

    move-result-object v3

    invoke-static {v3}, Landroid/service/wallpaper/IWallpaperEngine$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/wallpaper/IWallpaperEngine;

    move-result-object v0

    .line 53
    .local v0, _arg0:Landroid/service/wallpaper/IWallpaperEngine;
    invoke-virtual {p0, v0}, Landroid/service/wallpaper/IWallpaperConnection$Stub;->attachEngine(Landroid/service/wallpaper/IWallpaperEngine;)V

    .line 54
    invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V

    goto :goto_0

    .line 59
    .end local v0           #_arg0:Landroid/service/wallpaper/IWallpaperEngine;
    :sswitch_2
    const-string v3, "android.service.wallpaper.IWallpaperConnection"

    invoke-virtual {p2, v3}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V

    .line 61
    invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v0

    .line 62
    .local v0, _arg0:Ljava/lang/String;
    invoke-virtual {p0, v0}, Landroid/service/wallpaper/IWallpaperConnection$Stub;->setWallpaper(Ljava/lang/String;)Landroid/os/ParcelFileDescriptor;

    move-result-object v1

    .line 63
    .local v1, _result:Landroid/os/ParcelFileDescriptor;
    invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V

    .line 64
    if-eqz v1, :cond_0

    .line 65
    invoke-virtual {p3, v2}, Landroid/os/Parcel;->writeInt(I)V

    .line 66
    invoke-virtual {v1, p3, v2}, Landroid/os/ParcelFileDescriptor;->writeToParcel(Landroid/os/Parcel;I)V

    goto :goto_0

    .line 69
    :cond_0
    const/4 v3, 0x0

    invoke-virtual {p3, v3}, Landroid/os/Parcel;->writeInt(I)V

    goto :goto_0

    .line 41
    nop

    :sswitch_data_0
    .sparse-switch
        0x1 -> :sswitch_1
        0x2 -> :sswitch_2
        0x5f4e5446 -> :sswitch_0
    .end sparse-switch
.end method


text:
Use the hand controllers to scale your avatar.

Run scaleAvatar.js script in High Fidelity client via "Edit" > "Running Scripts...".

In VR, when you hold down both grips and both triggers, your avatar can scale itself:
- Moving hands away from eachother will scale your avatar larger
- Moving hands together will scale your avatar smaller

# Release Notes
## Version 2019-03-04_58_00
commit 08b5c68
- Initial release


text:
module Hasql.Postgres.Session.ResultProcessing where

import Hasql.Postgres.Prelude
import qualified Database.PostgreSQL.LibPQ as PQ
import qualified Hasql.Postgres.ErrorCode as ErrorCode
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import qualified Data.Attoparsec.ByteString.Char8 as Atto
import qualified Data.Vector as Vector
import qualified Data.Vector.Mutable as MVector
import qualified ListT

newtype M r =
  M (EitherT Error (ReaderT PQ.Connection IO) r)
  deriving (Functor, Applicative, Monad, MonadIO)

data Error =
  UnexpectedResult Text |
  ErroneousResult Text |
  TransactionConflict

run :: PQ.Connection -> M r -> IO (Either Error r)
run e (M m) =
  flip runReaderT e $ runEitherT m

just :: Maybe PQ.Result -> M PQ.Result
just =
  ($ return) $ maybe $ M $ do
    m <- lift $ ask >>= liftIO . PQ.errorMessage
    left $ ErroneousResult $ case m of
      Nothing ->
        "Sending a command to the server failed"
      Just m ->
        "Sending a command to the server failed due to: " <>
        TE.decodeLatin1 m

checkStatus :: (PQ.ExecStatus -> Bool) -> PQ.Result -> M ()
checkStatus g r =
  do
    s <- liftIO $ PQ.resultStatus r
    unless (g s) $ do
      case s of
        PQ.BadResponse   -> failWithErroneousResult "Bad response"
        PQ.NonfatalError -> failWithErroneousResult "Non-fatal error"
        PQ.FatalError    -> failWithErroneousResult "Fatal error"
        _ -> M $ left $ UnexpectedResult $ "Unexpected result status: " <> (fromString $ show s)
  where
    failWithErroneousResult status =
      do
        code <- liftIO $ PQ.resultErrorField r PQ.DiagSqlstate
        let transactionConflict =
              case code of
                Just x ->
                  elem x $
                  [
                    ErrorCode.transaction_rollback,
                    ErrorCode.transaction_integrity_constraint_violation,
                    ErrorCode.serialization_failure,
                    ErrorCode.statement_completion_unknown,
                    ErrorCode.deadlock_detected
                  ]
                Nothing ->
                  False
            in when transactionConflict $ M $ left $ TransactionConflict
        message <- liftIO $ PQ.resultErrorField r PQ.DiagMessagePrimary
        detail <- liftIO $ PQ.resultErrorField r PQ.DiagMessageDetail
        hint <- liftIO $ PQ.resultErrorField r PQ.DiagMessageHint
        M $ left $ ErroneousResult $ erroneousResultMessage status code message detail hint
    erroneousResultMessage status code message details hint =
      formatFields fields
      where
        formatFields =
          formatList . map formatField . catMaybes
          where
            formatList items =
              T.intercalate "; " items <> "."
            formatField (n, v) =
              n <> ": \"" <> v <> "\""
        fields =
          [
            Just ("Status", fromString $ show status),
            fmap (("Code",) . TE.decodeLatin1) $ code,
            fmap (("Message",) . TE.decodeLatin1) $ message,
            fmap (("Details",) . TE.decodeLatin1) $ details,
            fmap (("Hint",) . TE.decodeLatin1) $ hint
          ]

unit :: PQ.Result -> M ()
unit r =
  checkStatus (\case PQ.CommandOk -> True; _ -> False) r

count :: PQ.Result -> M Word64
count r =
  do  checkStatus (\case PQ.CommandOk -> True; _ -> False) r
      (liftIO $ PQ.cmdTuples r) >>=
        maybe (M $ left $ UnexpectedResult $ "No number of affected rows")
              (parseWord64)

parseWord64 :: ByteString -> M Word64
parseWord64 b =
  either (\m -> M $ left $ UnexpectedResult $ "Couldn't parse Word64: " <> fromString m)
         (return)
         (Atto.parseOnly (Atto.decimal <* Atto.endOfInput) b)

vector :: PQ.Result -> M (Vector (Vector (Maybe ByteString)))
vector r =
  do
    checkStatus (\case PQ.TuplesOk -> True; _ -> False) r
    liftIO $ do
      nr <- PQ.ntuples r
      nc <- PQ.nfields r
      mvx <- MVector.new (rowInt nr)
      forM_ [0..pred nr] $ \ir -> do
        mvy <- MVector.new (colInt nc)
        forM_ [0..pred nc] $ \ic -> do
          MVector.write mvy (colInt ic) =<< PQ.getvalue r ir ic
        vy <- Vector.unsafeFreeze mvy
        MVector.write mvx (rowInt ir) vy
      Vector.unsafeFreeze mvx

{-# INLINE colInt #-}
colInt :: PQ.Column -> Int
colInt (PQ.Col n) = fromIntegral n

{-# INLINE rowInt #-}
rowInt :: PQ.Row -> Int
rowInt (PQ.Row n) = fromIntegral n


text:
def create_questionnaire(questionnaire_attrs = {}, field_attrs = {})
  questionnaire_attributes = FactoryGirl.attributes_for(:questionnaire).merge(questionnaire_attrs)
  questionnaire = FactoryGirl.create(:questionnaire, questionnaire_attrs)
  field_attributes = FactoryGirl.attributes_for(:questionnaire_field).merge(field_attrs)
  questionnaire.questionnaire_fields << FactoryGirl.create(
    :questionnaire_field, field_attributes
  )
  questionnaire
end

def create_section(questionnaire, section_attrs = {}, field_attrs = {})
  section_attributes = FactoryGirl.attributes_for(:section).merge(section_attrs)
  section = FactoryGirl.create(:section)
  field_attributes = FactoryGirl.attributes_for(:section_field).merge(field_attrs)
  section.section_fields << FactoryGirl.create(
    :section_field, field_attributes
  )
  FactoryGirl.create(
    :questionnaire_part, part_id: section.id, part_type: 'Section', questionnaire: questionnaire
  )
  section
end

def create_subsection(section, section_attrs = {}, field_attrs = {})
  section_attributes = FactoryGirl.attributes_for(:section).merge(section_attrs)
  subsection = FactoryGirl.create(:section, section_attributes)
  field_attributes = FactoryGirl.attributes_for(:section_field).merge(field_attrs)
  subsection.section_fields << FactoryGirl.create(
    :section_field, field_attributes
  )
  FactoryGirl.create(
    :questionnaire_part, part_id: subsection.id, part_type: 'Section', parent: section.questionnaire_part
  )
  subsection
end

def create_question(section, question_attrs = {}, field_attrs = {})
  question_attributes = FactoryGirl.attributes_for(:question).merge(question_attrs).merge(section: section)
  question = FactoryGirl.create(
    :question, question_attributes
  )
  field_attributes = FactoryGirl.attributes_for(:question_field).merge(field_attrs)
  question.question_fields << FactoryGirl.create(
    :question_field, field_attrs
  )
  FactoryGirl.create(
    :questionnaire_part, part_id: question.id, part_type: 'Question', parent: section.questionnaire_part
  )
  question
end

def create_loop_item(loop_item_type)
  loop_item_name = FactoryGirl.create(:loop_item_name)
  FactoryGirl.create(:loop_item_name_field, loop_item_name: loop_item_name)
  FactoryGirl.create(:loop_item, loop_item_type: loop_item_type, loop_item_name: loop_item_name)
end


text:
where your data is saved, calculated, controlled, and sometimes viewed

## Running locally via Docker (Windows/OS X/Linux)
* [Install and start docker](https://docs.docker.com/engine/installation/)
* `cd` or `dir` to the `fabbit-iot/server` directory
* build the docker image (and label it fabbit-iot) `docker build -t fabbit-iot .`
* run the docker app you just built `docker run -p 5000:5000 --name app fabbit-iot`
* Visit the server at http://localhost:5000/

* To close the app type `docker stop app`
* if you want to rebuild with new code also run `docker rm app`

## Additional Notes
* if `localhost` does not work, get the IP of your docker machine via the following command `docker-machine ip`
* if you'd like to login to the terminal of the running docker instance use `docker exec -it app bash`
* to stop the running app (and remove the image) use `docker stop app` and `docker rm $(docker ps -aq)'`
* if the above commands don't work on linux try `sudo`!!
* see [run_local_linux.sh](./run_local_linux.sh) and [run_local_osx.sh](run_local_osx) for more examples

## Deploying to AWS
* `cd` to `fabbit-iot/server`
* zip all the files in the source directory (so that when they're extracted the Dockerfile and such will NOT be inside a diretory)... for unix-like systems something like `zip -r deployment.zip *` from inside `fabbit-iot/server`
* start an [elastic beanstalk instance, ready to receive a docker container](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.html) (start with Sample Application if you like)
* upload your zip file
* enjoy!

## TODO
* Someone with windows please build a `run_local_windows.sh` script
* If you run on azure or linode or something, write a deployment guide


text:
<?php

namespace Weikit\Component\Layout;

use Weikit\Component\Component;
use Weikit\Component\Traits\HasChildren;
use Weikit\Component\Traits\HasMakeChildren;

/**
 * Class Grid
 * @package Weikit\Component\Layout
 *
 * @property numeric $columns
 */
class Grid extends Component
{
    use HasChildren {
        HasChildren::child as addChild;
    }
    use HasMakeChildren;

    public function child(Component $component)
    {
        $return = $this->addChild($component);

        $this->set('columns', count($this->children));

        return $return;
    }

    public function getColumns()
    {
        return $this->get('columns', 0);
    }
}


text:
A CLI to capture screenshots, video, logs, device info and device vitals(memory, cpu) for Android (Devices & Emulators) and iOS (Devices).

Features
--------

* Easily capture screenshots for Android and iOS.
* Video record real android devices. (OS > 4.4)
	* Extend recording past the 180 seconds SDK limit.
* Save video formats in mp4 or gif.
* Flick auto detects if a device is recordable.
	* Falls back to screenshot recording if video record is not available.
* Video record android emulators and **real** iOS devices.
	* Takes a screenshot every 0.5 seconds (default), then combines the screenshots into a single mp4 or gif.
	* Android pulls only unique (default) screenshots from devices/emulators. e.g. A 1 minute test run might convert to only 30 seconds of video based on unique images. You can change this by passing `-q false` to pull all images instead.
	* iOS example [here](https://www.dropbox.com/s/4pjhhmnsx9gj5pi/ios-flick-example.mp4?dl=0)
	* Android Emulator example [here](https://www.dropbox.com/s/gwunrvgzxkny13z/android-flick-example.mp4?dl=0)
* Flick auto selects device when only one device is connected, per platform.
* Save log output for Android or iOS.
* Display device information or save it to a file.
* Install or Uninstall applications from devices.
* Capture device vitals (Android Only) for app and system performance.
   * If anyone knows of a tool to capture performance for iOS please let me know and I'll add it to Flick.
* Checkout the latest release notes [here](https://github.com/isonic1/flick/releases).

Reason
------
I wanted an easy way to video record my automation tests for mobile, and I didn't need the video quality to be perfect. Unfortunately, you cannot video record on android emulators, but you can take screenshots! You also cannot video record iOS without using QuickTime, or doing what [this](https://github.com/appium/screen_recording) did, but it's not maintained anymore.

So I created Flick to work for my needs, and included a couple other tools I use frequently. Hopefully this will be as helpful for others too. It's also a CLI and language-agnostic, it can be used with any framework where you can make a system call. See examples [here](https://github.com/isonic1/appium-mobile-grid/blob/flick/ios/spec/spec_helper.rb#L15-L16) and [here](https://github.com/isonic1/appium-mobile-grid/blob/flick/android/spec/spec_helper.rb#L22-L23). I suppose there are use cases for this outside of test automation. I'd love to hear them if so.

If you're looking for high-quality video, then this wouldn't be the tool for you. Take a look at this great tool [androidtool-mac](https://github.com/mortenjust/androidtool-mac) instead.

Prerequisites
-------------
#### System Tools
* Install ffmpeg. [OSX](https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX)
	* ```$ brew install ffmpeg```
* Install mp4box. [OSX](http://hunterford.me/compiling-mp4box-on-mac-os-x/)
	* ```$ brew install mp4box```

#### Android
* Install [SDK Tools](http://developer.android.com/sdk/installing/index.html?pkg=tools).
* SDK tools are added to your $PATH. [OSX](http://stackoverflow.com/questions/5526470/trying-to-add-adb-to-path-variable-osx)
* Enable [USB Debugging](https://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android.htm) on your device(s).
* Emulator or Devices have approximately 1GB of [sdcard space](http://developer.android.com/tools/help/mksdcard.html).

#### iOS
* Install [Xcode](https://developer.apple.com/xcode/download/).
* Install Xcode [Command Line Tools](http://railsapps.github.io/xcode-command-line-tools.html).
* Enable [Developer Mode](http://apple.stackexchange.com/questions/159196/enable-developer-inside-the-settings-app-on-ios) on iPhone or iPad devices.
* Install [libimobiledevice](http://www.libimobiledevice.org/).
	* ```$ brew install libimobiledevice```

#### Known Issues
* IOS:
   * Sometimes ideviceinstaller gets out of sync with your OS due to various reasons. When this happens, screenshots and video will not work for iOS.
      * Follow steps in [here](https://github.com/isonic1/flick/issues/10) to uninstall and reinstall dependencies.
      * Make sure xcode and command line tools are up to date.
      * Make sure iOS device is up to date with latest iOS version.
      * Validate your device is paired to your machine. `$ idevicepair -u <udid> validate`
      * Additionally, try to unpair and pair again.
         * `$ idevicepair -u <udid> unpair`
         * `$ idevicepair -u <udid> pair` Accept the Trust popup on the device.

* Android:
   * Some devices/emulators are read-only. Flick requires access to internal storage of the device/emulator to write files to. If the device is read-only it cannot do this so it will Abort. There is probably a solution to this but I, unfortunately, don't have a lot of time to figure it out. Pull Requests are highly encouragaged if you find this tool useful!

Installation
------------

    $ gem install flick

Usage:
------
    $ flick --help

    DESCRIPTION:

    A CLI to capture screenshots, video, logs, and device info for Android (Devices & Emulators) and iOS (Devices).

	COMMANDS:

    help       Display global or [command] help documentation
    info       Get device information
    log        Get device log output
    manager    Manage apps on devices
    screenshot Take a screenshot
    video      Record video
    vitals     Android Only! Get apps and device vitals - App Memory Used, App CPU %. System Stats: (User, System, IQW, IRQ)
    applitools Validate images with Applitools

    GLOBAL OPTIONS:

    -h, --help
      Display help documentation

    -v, --version
      Display version information

    -t, --trace
      Display backtrace when an error occurs

	 $ flick info --help

		$ flick info -p (ios or android)
		$ flick info -p (ios or android) -s true -o $HOME

	 $ flick log --help

		$ flick log -a start -p (ios or android) -o $HOME -n iosLog
		$ flick log -a stop -p (ios or android)

	 $ flick screenshot --help

		$ flick screenshot -p (ios or android) -o $HOME -n myImage

	 $ flick video --help

		$ flick video -a start -p (ios or android)
		$ flick video -a stop -p (ios or android) -o /output -n myVideo -f gif
		$ flick video -a start -p android -u emulator-5554 -c 1000
		$ flick video -a stop -p android -u emulator-5554

	 $ flick manager --help
		$ flick manager -a install -p (ios or android) -f ~/myApp/my-awesome-app.apk or .app
		$ flick maanger -a uninstall -p (ios or android) -n com.package.name

	 $ flick vitals --help
		$ flick vitals -p android -n com.awsome-package.name

    $ flick applitools --help
      $ flick applitools -p android --appName Twitter --testName Messages

##Demo

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/isonic1/flick. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://github.com/isonic1/Appium-Native-Crawler/blob/master/CODE_OF_CONDUCT.md) code of conduct.

## TODO
* Dry the code a bit.
* Setup Flick android for cross platform os's (windows & linux)
* Add screenshot capture for iOS Simulators.
* Multithread the screenshot and pull process.
* Look into capturing video for iOS similar to [this](https://github.com/mortenjust/androidtool-mac/blob/9347cd9aeca9e7370e323d12f862bc5d8beacc25/AndroidTool/IOSDeviceHelper.swift#L56)

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
<?php
/**
 * With markdown language there is no need to have more
 * than three linefeed (no empty lines)
 */
namespace MarkNotes\Plugins\Markdown\Beautify_Actions;

defined('_MARKNOTES') or die('No direct access allowed');

class LineFeeds
{
	public function doIt(array $params) : string
	{
		$markdown=preg_replace('/\n{3,}/si', "\n\n", $params['markdown']);
		// and no need to have a line with space characters
		$markdown=preg_replace('/\n {1,}\n/si', "\n\n", $markdown);

		/*<!-- build:debug -->*/
		$aeSettings = \MarkNotes\Settings::getInstance();
		if ($aeSettings->getDebugMode()) {
			if ($params['markdown']!==$markdown) {
				$aeDebug = \MarkNotes\Debug::getInstance();
				$aeDebug->log("   ".__CLASS__." has modify the markdown content", "debug");
			}
		}
		/*<!-- endbuild -->*/

		return $markdown;
	}
}


text:
import 'core-js/features/array/find';
import 'core-js/features/array/includes';
import 'core-js/features/string/includes';


text:
describe("Ext.data.validations tests", function() {

    var validations = Ext.data.validations;

    // since file validation uses the same internal function as vtype we don't need extensive tests
    it("should allow validate file extensions", function() {
        var config = {type: 'file', field: 'avatar', extension:['jpg','jpeg','gif','png']};
        expect(validations.file(config,'user.gif')).toBeTruthy();
        expect(validations.file(config,'user.doc')).toBeFalsy();
    });

    it("should pass ranges with no configs when they are numbers", function() {
        var config = {type: 'range', field: 'euro'};
        expect(validations.range(config,34)).toBeTruthy();
        expect(validations.range(config,3.4)).toBeTruthy();
        expect(validations.range(config,'3.4')).toBeTruthy();
    });

    it("should validate min of ranges", function() {
        var config = {type: 'range', field: 'euro', min:0};
        expect(validations.range(config,3.4)).toBeTruthy();
        expect(validations.range(config,0)).toBeTruthy();
        expect(validations.range(config,-3.4)).toBeFalsy();
    });

    it("should validate max of ranges", function() {
        var config = {type: 'range', field: 'euro', max: 10};
        expect(validations.range(config,2)).toBeTruthy();
        expect(validations.range(config,10)).toBeTruthy();
        expect(validations.range(config,11)).toBeFalsy();
    });

    it("should validate min and max of ranges", function() {
        var config = {type: 'range', field: 'euro', min:0, max: 10};
        expect(validations.range(config,-3.4)).toBeFalsy();
        expect(validations.range(config,0)).toBeTruthy();
        expect(validations.range(config,10)).toBeTruthy();
        expect(validations.range(config,11)).toBeFalsy();
    });
});


text:
<component name="CopyrightManager">
  <settings>
    <module2copyright>
      <element module="All" copyright="MIT" />
    </module2copyright>
  </settings>
</component>


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Dapr Labs" file="InvocationController.cs">
//   Copyright © Dapr Labs. All rights reserved.
// </copyright>
// <summary>
//   The command invocation controller.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Console.Controllers
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Reflection;
    using System.Threading.Tasks;
    using System.Web.Http;

    using Actor.Interfaces;

    using EventJournal;
    using EventJournal.Execution;
    using EventJournal.Metadata;

    using Newtonsoft.Json;

    using Orleans.Runtime;

    /// <summary>
    /// The command invocation controller.
    /// </summary>
    [RoutePrefix("invoke")]
    public class InvocationController : ApiController
    {
        /// <summary>
        /// The actors.
        /// </summary>
        public static readonly Lazy<Dictionary<string, ActorDescription>> Actors;

        /// <summary>
        /// The dispatcher.
        /// </summary>
        public static readonly Task<IEventDispatcher> Dispatcher;

        /// <summary>
        /// The dispatcher source code.
        /// </summary>
        public static readonly Task<string> DispatcherSource;

        /// <summary>
        /// The JSON serializer settings.
        /// </summary>
        private readonly JsonSerializerSettings jsonSettings = new JsonSerializerSettings();

        /// <summary>
        /// Initializes static members of the <see cref="InvocationController"/> class.
        /// </summary>
        static InvocationController()
        {
            var assemblies = new List<Assembly> { typeof(ICalculatorActor).Assembly, typeof(IManagementGrain).Assembly };

            Actors =
                new Lazy<Dictionary<string, ActorDescription>>(
                    () => ActorDescriptionGenerator.GetActorDescriptions(assemblies));
            var dispatcherCompletion = new TaskCompletionSource<IEventDispatcher>();
            var sourceCompletion = new TaskCompletionSource<string>();
            Dispatcher = dispatcherCompletion.Task;
            DispatcherSource = sourceCompletion.Task;

            // Generate the dispatchers asynchronously.
            Task.Run(
                () =>
                {
                    try
                    {
                        string source;
                        var dispatcher = EventDispatcherGenerator.GetDispatcher(Actors.Value.Values.ToList(), out source);
                        dispatcherCompletion.TrySetResult(dispatcher);
                        sourceCompletion.TrySetResult(source);
                    }
                    catch (Exception e)
                    {
                        dispatcherCompletion.TrySetException(e);
                        sourceCompletion.TrySetException(e);
                    }
                });
        }

        /// <summary>
        /// Initializes this class.
        /// </summary>
        public static void Initialize()
        {
        }

        /// <summary>
        /// Invokes the command and returns the results.
        /// </summary>
        /// <param name="command">
        /// The command.
        /// </param>
        /// <returns>
        /// The result of invoking the command.
        /// </returns>
        [HttpPost]
        [Route]
        public Task<object> InvokeMethod([FromBody] Event command)
        {
            return this.DispatchEvent(Guid.Empty, command);
        }

        /// <summary>
        /// Dispatches the provided <paramref name="event"/>, returning the response.
        /// </summary>
        /// <param name="userId">
        /// The user id.
        /// </param>
        /// <param name="event">
        /// The event.
        /// </param>
        /// <returns>
        /// The response.
        /// </returns>
        private async Task<object> DispatchEvent(Guid userId, Event @event)
        {
            try
            {
                Trace.CorrelationManager.StartLogicalOperation();
                Trace.CorrelationManager.ActivityId = Guid.NewGuid();
                Orleans.Runtime.RequestContext.PropagateActivityId = true;

                ActorDescription actor;
                if (@event.To == null || @event.To.Kind == null || !Actors.Value.TryGetValue(@event.To.Kind, out actor))
                {
                    throw new ArgumentException("Actor kind not specified.");
                }

                ActorMethodDescription method;
                if (!actor.Methods.TryGetValue(@event.Type, out method))
                {
                    throw new ArgumentException(
                        string.Format("Method \"{0}\" not found on actor \"{1}\".", @event.Type, @event.To.Kind));
                }

                var inArgs = @event.Arguments == null ? 0 : @event.Arguments.Length;
                var reqArgs = method.Args == null ? 0 : method.Args.Count;
                if (inArgs != reqArgs)
                {
                    throw new ArgumentException(
                        string.Format(
                            "Incorrect number of arguments. Received {0} but expected {1}. Method: {2}",
                            inArgs,
                            reqArgs,
                            method));
                }

                var resultTask = (await Dispatcher).Dispatch(@event);
                if (resultTask == null)
                {
                    throw new InvalidOperationException(
                        "The specified method does not exist. Input: "
                        + JsonConvert.SerializeObject(@event, this.jsonSettings));
                }

                return await resultTask;
            }
            finally
            {
                Trace.CorrelationManager.StopLogicalOperation();
            }
        }
    }
}