text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PDFSidebar = exports.SidebarView = void 0;

var _ui_utils = require("./ui_utils");

var _pdf_rendering_queue = require("./pdf_rendering_queue");

const UI_NOTIFICATION_CLASS = 'pdfSidebarNotification';
const SidebarView = {
  UNKNOWN: -1,
  NONE: 0,
  THUMBS: 1,
  OUTLINE: 2,
  ATTACHMENTS: 3,
  LAYERS: 4
};
exports.SidebarView = SidebarView;

class PDFSidebar {
  constructor({
    elements,
    pdfViewer,
    pdfThumbnailViewer,
    eventBus,
    l10n = _ui_utils.NullL10n,
    disableNotification = false
  }) {
    this.isOpen = false;
    this.active = SidebarView.THUMBS;
    this.isInitialViewSet = false;
    this.onToggled = null;
    this.pdfViewer = pdfViewer;
    this.pdfThumbnailViewer = pdfThumbnailViewer;
    this.outerContainer = elements.outerContainer;
    this.viewerContainer = elements.viewerContainer;
    this.toggleButton = elements.toggleButton;
    this.thumbnailButton = elements.thumbnailButton;
    this.outlineButton = elements.outlineButton;
    this.attachmentsButton = elements.attachmentsButton;
    this.thumbnailView = elements.thumbnailView;
    this.outlineView = elements.outlineView;
    this.attachmentsView = elements.attachmentsView;
    this.eventBus = eventBus;
    this.l10n = l10n;
    this._disableNotification = disableNotification;

    this._addEventListeners();
  }

  reset() {
    this.isInitialViewSet = false;

    this._hideUINotification(null);

    this.switchView(SidebarView.THUMBS);
    this.outlineButton.disabled = false;
    this.attachmentsButton.disabled = false;
  }

  get visibleView() {
    return this.isOpen ? this.active : SidebarView.NONE;
  }

  get isThumbnailViewVisible() {
    return this.isOpen && this.active === SidebarView.THUMBS;
  }

  get isOutlineViewVisible() {
    return this.isOpen && this.active === SidebarView.OUTLINE;
  }

  get isAttachmentsViewVisible() {
    return this.isOpen && this.active === SidebarView.ATTACHMENTS;
  }

  setInitialView(view = SidebarView.NONE) {
    if (this.isInitialViewSet) {
      return;
    }

    this.isInitialViewSet = true;

    if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) {
      this._dispatchEvent();

      return;
    }

    if (!this._switchView(view, true)) {
      this._dispatchEvent();
    }
  }

  switchView(view, forceOpen = false) {
    this._switchView(view, forceOpen);
  }

  _switchView(view, forceOpen = false) {
    const isViewChanged = view !== this.active;
    let shouldForceRendering = false;

    switch (view) {
      case SidebarView.NONE:
        if (this.isOpen) {
          this.close();
          return true;
        }

        return false;

      case SidebarView.THUMBS:
        if (this.isOpen && isViewChanged) {
          shouldForceRendering = true;
        }

        break;

      case SidebarView.OUTLINE:
        if (this.outlineButton.disabled) {
          return false;
        }

        break;

      case SidebarView.ATTACHMENTS:
        if (this.attachmentsButton.disabled) {
          return false;
        }

        break;

      default:
        console.error(`PDFSidebar._switchView: "${view}" is not a valid view.`);
        return false;
    }

    this.active = view;
    this.thumbnailButton.classList.toggle('toggled', view === SidebarView.THUMBS);
    this.outlineButton.classList.toggle('toggled', view === SidebarView.OUTLINE);
    this.attachmentsButton.classList.toggle('toggled', view === SidebarView.ATTACHMENTS);
    this.thumbnailView.classList.toggle('hidden', view !== SidebarView.THUMBS);
    this.outlineView.classList.toggle('hidden', view !== SidebarView.OUTLINE);
    this.attachmentsView.classList.toggle('hidden', view !== SidebarView.ATTACHMENTS);

    if (forceOpen && !this.isOpen) {
      this.open();
      return true;
    }

    if (shouldForceRendering) {
      this._updateThumbnailViewer();

      this._forceRendering();
    }

    if (isViewChanged) {
      this._dispatchEvent();
    }

    this._hideUINotification(this.active);

    return isViewChanged;
  }

  open() {
    if (this.isOpen) {
      return;
    }

    this.isOpen = true;
    this.toggleButton.classList.add('toggled');
    this.outerContainer.classList.add('sidebarMoving', 'sidebarOpen');

    if (this.active === SidebarView.THUMBS) {
      this._updateThumbnailViewer();
    }

    this._forceRendering();

    this._dispatchEvent();

    this._hideUINotification(this.active);
  }

  close() {
    if (!this.isOpen) {
      return;
    }

    this.isOpen = false;
    this.toggleButton.classList.remove('toggled');
    this.outerContainer.classList.add('sidebarMoving');
    this.outerContainer.classList.remove('sidebarOpen');

    this._forceRendering();

    this._dispatchEvent();
  }

  toggle() {
    if (this.isOpen) {
      this.close();
    } else {
      this.open();
    }
  }

  _dispatchEvent() {
    this.eventBus.dispatch('sidebarviewchanged', {
      source: this,
      view: this.visibleView
    });
  }

  _forceRendering() {
    if (this.onToggled) {
      this.onToggled();
    } else {
      this.pdfViewer.forceRendering();
      this.pdfThumbnailViewer.forceRendering();
    }
  }

  _updateThumbnailViewer() {
    let {
      pdfViewer,
      pdfThumbnailViewer
    } = this;
    let pagesCount = pdfViewer.pagesCount;

    for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {
      let pageView = pdfViewer.getPageView(pageIndex);

      if (pageView && pageView.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) {
        let thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);
        thumbnailView.setImage(pageView);
      }
    }

    pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);
  }

  _showUINotification(view) {
    if (this._disableNotification) {
      return;
    }

    this.l10n.get('toggle_sidebar_notification.title', null, 'Toggle Sidebar (document contains outline/attachments)').then(msg => {
      this.toggleButton.title = msg;
    });

    if (!this.isOpen) {
      this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);
    } else if (view === this.active) {
      return;
    }

    switch (view) {
      case SidebarView.OUTLINE:
        this.outlineButton.classList.add(UI_NOTIFICATION_CLASS);
        break;

      case SidebarView.ATTACHMENTS:
        this.attachmentsButton.classList.add(UI_NOTIFICATION_CLASS);
        break;
    }
  }

  _hideUINotification(view) {
    if (this._disableNotification) {
      return;
    }

    let removeNotification = view => {
      switch (view) {
        case SidebarView.OUTLINE:
          this.outlineButton.classList.remove(UI_NOTIFICATION_CLASS);
          break;

        case SidebarView.ATTACHMENTS:
          this.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS);
          break;
      }
    };

    if (!this.isOpen && view !== null) {
      return;
    }

    this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);

    if (view !== null) {
      removeNotification(view);
      return;
    }

    for (view in SidebarView) {
      removeNotification(SidebarView[view]);
    }

    this.l10n.get('toggle_sidebar.title', null, 'Toggle Sidebar').then(msg => {
      this.toggleButton.title = msg;
    });
  }

  _addEventListeners() {
    this.viewerContainer.addEventListener('transitionend', evt => {
      if (evt.target === this.viewerContainer) {
        this.outerContainer.classList.remove('sidebarMoving');
      }
    });
    this.toggleButton.addEventListener('click', () => {
      this.toggle();
    });
    this.thumbnailButton.addEventListener('click', () => {
      this.switchView(SidebarView.THUMBS);
    });
    this.outlineButton.addEventListener('click', () => {
      this.switchView(SidebarView.OUTLINE);
    });
    this.outlineButton.addEventListener('dblclick', () => {
      this.eventBus.dispatch('toggleoutlinetree', {
        source: this
      });
    });
    this.attachmentsButton.addEventListener('click', () => {
      this.switchView(SidebarView.ATTACHMENTS);
    });
    this.eventBus.on('outlineloaded', evt => {
      let outlineCount = evt.outlineCount;
      this.outlineButton.disabled = !outlineCount;

      if (outlineCount) {
        this._showUINotification(SidebarView.OUTLINE);
      } else if (this.active === SidebarView.OUTLINE) {
        this.switchView(SidebarView.THUMBS);
      }
    });
    this.eventBus.on('attachmentsloaded', evt => {
      if (evt.attachmentsCount) {
        this.attachmentsButton.disabled = false;

        this._showUINotification(SidebarView.ATTACHMENTS);

        return;
      }

      Promise.resolve().then(() => {
        if (this.attachmentsView.hasChildNodes()) {
          return;
        }

        this.attachmentsButton.disabled = true;

        if (this.active === SidebarView.ATTACHMENTS) {
          this.switchView(SidebarView.THUMBS);
        }
      });
    });
    this.eventBus.on('presentationmodechanged', evt => {
      if (!evt.active && !evt.switchInProgress && this.isThumbnailViewVisible) {
        this._updateThumbnailViewer();
      }
    });
  }

}

exports.PDFSidebar = PDFSidebar;


text:
@interface NSManagedObject (Sugar)

// create objects
+ (instancetype)managedObject;
+ (NSArray *)managedObjectArrayWithLength:(NSUInteger)length;

// fetch existing objects
+ (NSArray *)allObjects;
+ (NSArray *)objectsMatching:(NSString *)predicateFormat, ...;
+ (NSArray *)objectsMatching:(NSString *)predicateFormat arguments:(va_list)args;
+ (NSArray *)objectsSortedBy:(NSString *)key ascending:(BOOL)ascending;
+ (NSArray *)objectsSortedBy:(NSString *)key ascending:(BOOL)ascending offset:(NSUInteger)offset limit:(NSUInteger)lim;
+ (NSArray *)fetchObjects:(NSFetchRequest *)request;

// count existing objects
+ (NSUInteger)countAllObjects;
+ (NSUInteger)countObjectsMatching:(NSString *)predicateFormat, ...;
+ (NSUInteger)countObjectsMatching:(NSString *)predicateFormat arguments:(va_list)args;
+ (NSUInteger)countObjects:(NSFetchRequest *)request;

// delete objects
+ (NSUInteger)deleteObjects:(NSArray *)objects;

// call this before any NSManagedObject+Sugar methods to use a concurrency type other than NSMainQueueConcurrencyType
+ (void)setConcurrencyType:(NSManagedObjectContextConcurrencyType)type;

// set the fetchBatchSize to use when fetching objects, default is 100
+ (void)setFetchBatchSize:(NSUInteger)fetchBatchSize;

// returns the managed object context for the application, or if the context doesn't already exist, creates it and binds
// it to the persistent store coordinator for the application
+ (NSManagedObjectContext *)context;

// sets a different context for NSManagedObject+Sugar methods to use for this type of entity
+ (void)setContext:(NSManagedObjectContext *)context;

+ (void)saveContext; // persists changes (this is called automatically for the main context when the app terminates)

+ (NSString *)entityName; // override this if entity name differs from class name
+ (NSFetchRequest *)fetchRequest;
+ (NSFetchedResultsController *)fetchedResultsController:(NSFetchRequest *)request;

- (id)objectForKeyedSubscript:(id<NSCopying>)key; // id value = entity[@"key"]; thread safe valueForKey:
- (void)setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key; // entity[@"key"] = value; thread safe setValue:forKey:
- (void)deleteObject;

@end

redpajama_set_name: RedPajamaGithub


text:
Cryptoapples - a fork of Litecoin version with faster confirmations (3 confirmations needed instead of 6). Like Litecoin it uses scrypt as a proof of work scheme.

	- 2 minutes block target
	- Difficulty retargets every 2 minutes / KGW implemented
	- Total coins will be around 8,5 million.
	- First 10.080 blocks will have 32 coins per block (14 days)
	- Next 76320 blocks will have 16 coins per block (106 days)
	- After 4 months, each block will have 16 coins per block then decrease 1% per 3 days (or 2160 blocks) with a minimum reward of 1 CRA.
	- The default ports are 53286 (connect) and 53287 (json rpc).
	- Starting difficulty is 0,000244141


text:
using DnDGen.TreasureGen.Items;
using DnDGen.TreasureGen.Tables;
using NUnit.Framework;

namespace DnDGen.TreasureGen.Tests.Integration.Tables.Items.Magical.Armor.Medium
{
    [TestFixture]
    public class MediumArmorsTests : PercentileTests
    {
        protected override string tableName
        {
            get { return string.Format(TableNameConstants.Percentiles.Formattable.POWERITEMTYPEs, PowerConstants.Medium, ItemTypeConstants.Armor); }
        }

        [Test]
        public override void ReplacementStringsAreValid()
        {
            AssertReplacementStringsAreValid();
        }

        [Test]
        public override void TableIsComplete()
        {
            AssertTableIsComplete();
        }

        [TestCase("1", 1, 10)]
        [TestCase("2", 11, 20)]
        [TestCase("3", 31, 50)]
        [TestCase("4", 51, 57)]
        [TestCase(ItemTypeConstants.Armor, 58, 63)]
        [TestCase("SpecialAbility", 64, 100)]
        public override void Percentile(string value, int lower, int upper)
        {
            base.Percentile(value, lower, upper);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using MMCar_Finder;

namespace MarkerFinderTest
{
    class Camera
    {
        List<CaptureDevice> devices;
        CaptureDevice activeDevice;

        public Camera(PictureBox pb)
        {
            devices = CaptureDevice.GetDevices();
            if (devices.Count > 0)
            {
                activeDevice = devices[0];
                activeDevice.Attach(pb);
            }
        }

        public Bitmap getBitmap()
        {
            if (activeDevice != null)
            {
                Image camImage = activeDevice.Capture();
                Bitmap cam = new Bitmap(camImage.Width, camImage.Height);
                Graphics g2 = Graphics.FromImage(cam);
                g2.DrawImage(camImage, new Rectangle(0, 0, cam.Width - 1, cam.Height - 1), new Rectangle(0, 0, camImage.Width - 1, camImage.Height - 1), GraphicsUnit.Pixel);
                return cam;
            }
            else return null;
        }
    }
}


text:
/**
 * @author mr.doob / http://mrdoob.com/
 * @author mikael emtinger / http://gomo.se/
 * @author alteredq / http://alteredqualia.com/
 */

THREE.Object3D = function() {

	this.id = THREE.Object3DCounter.value ++;

	this.parent = undefined;
	this.children = [];

	this.position = new THREE.Vector3();
	this.positionScreen = new THREE.Vector4();
	this.rotation = new THREE.Vector3();
	this.scale = new THREE.Vector3( 1.0, 1.0, 1.0 );

	this.matrix = new THREE.Matrix4();
	this.matrixWorld = new THREE.Matrix4();
	this.matrixRotation = new THREE.Matrix4();
	this.matrixRotationWorld = new THREE.Matrix4();
	this.matrixNeedsUpdate = true;
	this.matrixAutoUpdate = true;

	this.quaternion = new THREE.Quaternion();
	this.useQuaternion = false;

	this.boundRadius = 0.0;
	this.boundRadiusScale = 1.0;

	this.visible = true;

};

THREE.Object3D.prototype = {

	addChild: function ( child ) {

		if ( this.children.indexOf( child ) === - 1 ) {

			if( child.parent !== undefined ) {

				child.parent.removeChild( child );

			}

			child.parent = this;
			this.children.push( child );

		}

	},

	removeChild: function ( child ) {

		var childIndex = this.children.indexOf( child );

		if ( childIndex !== - 1 ) {

			child.parent = undefined;
			this.children.splice( childIndex, 1 );

		}

	},

	updateMatrix: function () {

		this.matrix.setPosition( this.position );

		if ( this.useQuaternion )  {

			this.matrixRotation.setRotationFromQuaternion( this.quaternion );

		} else {

			this.matrixRotation.setRotationFromEuler( this.rotation );

		}

		this.matrix.n11 = this.matrixRotation.n11;
		this.matrix.n12 = this.matrixRotation.n12;
		this.matrix.n13 = this.matrixRotation.n13;

		this.matrix.n21 = this.matrixRotation.n21;
		this.matrix.n22 = this.matrixRotation.n22;
		this.matrix.n23 = this.matrixRotation.n23;

		this.matrix.n31 = this.matrixRotation.n31;
		this.matrix.n32 = this.matrixRotation.n32;
		this.matrix.n33 = this.matrixRotation.n33;

		if ( this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) {

			this.matrix.scale( this.scale );
			this.boundRadiusScale = Math.max( this.scale.x, Math.max( this.scale.y, this.scale.z ) );

		}

		return true;

	},

	// TODO: Add link to parent so rotationWorld can be updated too.

	update: function ( parentMatrixWorld, forceUpdate, camera ) {

		if ( this.visible ) {

			if ( this.matrixAutoUpdate ) {

				forceUpdate |= this.updateMatrix();

			}

			// update matrixWorld

			if ( forceUpdate || this.matrixNeedsUpdate ) {

				if ( parentMatrixWorld ) {

					this.matrixWorld.multiply( parentMatrixWorld, this.matrix );

				} else {

					this.matrixWorld.copy( this.matrix );

				}

				this.matrixNeedsUpdate = false;
				forceUpdate = true;

			}

			// update children

			for ( var i = 0, l = this.children.length; i < l; i ++ ) {

				this.children[ i ].update( this.matrixWorld, forceUpdate, camera );

			}

		}

	}

}

THREE.Object3DCounter = { value: 0 };


text:
<?php

namespace Symfony\Component\HttpFoundation\Tests\Session\Flash;

use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag as FlashBag;

/**
 * AutoExpireFlashBagTest.
 *
 * @author Drak <drak@zikula.org>
 */
class AutoExpireFlashBagTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag
     */
    private $bag;

    /**
     * @var array
     */
    protected $array = array();

    protected function setUp()
    {
        parent::setUp();
        $this->bag = new FlashBag();
        $this->array = array('new' => array('notice' => array('A previous flash message')));
        $this->bag->initialize($this->array);
    }

    public function tearDown()
    {
        $this->bag = null;
        parent::tearDown();
    }

    public function testInitialize()
    {
        $bag = new FlashBag();
        $array = array('new' => array('notice' => array('A previous flash message')));
        $bag->initialize($array);
        $this->assertEquals(array('A previous flash message'), $bag->peek('notice'));
        $array = array('new' => array(
                'notice' => array('Something else'),
                'error' => array('a'),
            ));
        $bag->initialize($array);
        $this->assertEquals(array('Something else'), $bag->peek('notice'));
        $this->assertEquals(array('a'), $bag->peek('error'));
    }

    public function testGetStorageKey()
    {
        $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey());
        $attributeBag = new FlashBag('test');
        $this->assertEquals('test', $attributeBag->getStorageKey());
    }

    public function testGetSetName()
    {
        $this->assertEquals('flashes', $this->bag->getName());
        $this->bag->setName('foo');
        $this->assertEquals('foo', $this->bag->getName());
    }

    public function testPeek()
    {
        $this->assertEquals(array(), $this->bag->peek('non_existing'));
        $this->assertEquals(array('default'), $this->bag->peek('non_existing', array('default')));
        $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
        $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
    }

    public function testSet()
    {
        $this->bag->set('notice', 'Foo');
        $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
    }

    public function testHas()
    {
        $this->assertFalse($this->bag->has('nothing'));
        $this->assertTrue($this->bag->has('notice'));
    }

    public function testKeys()
    {
        $this->assertEquals(array('notice'), $this->bag->keys());
    }

    public function testPeekAll()
    {
        $array = array(
            'new' => array(
                'notice' => 'Foo',
                'error' => 'Bar',
            ),
        );

        $this->bag->initialize($array);
        $this->assertEquals(array(
            'notice' => 'Foo',
            'error' => 'Bar',
            ), $this->bag->peekAll()
        );

        $this->assertEquals(array(
            'notice' => 'Foo',
            'error' => 'Bar',
            ), $this->bag->peekAll()
        );
    }

    public function testGet()
    {
        $this->assertEquals(array(), $this->bag->get('non_existing'));
        $this->assertEquals(array('default'), $this->bag->get('non_existing', array('default')));
        $this->assertEquals(array('A previous flash message'), $this->bag->get('notice'));
        $this->assertEquals(array(), $this->bag->get('notice'));
    }

    public function testSetAll()
    {
        $this->bag->setAll(array('a' => 'first', 'b' => 'second'));
        $this->assertFalse($this->bag->has('a'));
        $this->assertFalse($this->bag->has('b'));
    }

    public function testAll()
    {
        $this->bag->set('notice', 'Foo');
        $this->bag->set('error', 'Bar');
        $this->assertEquals(array(
            'notice' => array('A previous flash message'),
            ), $this->bag->all()
        );

        $this->assertEquals(array(), $this->bag->all());
    }

    public function testClear()
    {
        $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear());
    }
}


text:
@interface NYStatusCell ()
@property (weak, nonatomic) IBOutlet UIImageView *profile_image_View;
@property (weak, nonatomic) IBOutlet UILabel *name_label;
@property (weak, nonatomic) IBOutlet UILabel *created_time_label;
@property (weak, nonatomic) IBOutlet UILabel *text_label;
@property (weak, nonatomic) IBOutlet UIButton *reposts_count_button;
@property (weak, nonatomic) IBOutlet UIButton *comments_count_button;
@property (weak, nonatomic) IBOutlet UIButton *attitudes_count_button;

@end
@implementation NYStatusCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setStatus:(NYStatus *)status
{
    _status = status;
    NYUser *user = status.user;
    [self.profile_image_View sd_setImageWithURL:[NSURL URLWithString:user.profile_image_url] placeholderImage:[UIImage imageNamed:@"timeline_image_placeholder"]];
    self.name_label.text = user.name;
    self.created_time_label.text = status.created_at;

    self.text_label.text = status.text;

    [self.reposts_count_button setTitle:[NSString stringWithFormat:@"%zd",status.reposts_count] forState:UIControlStateNormal];
    [self.comments_count_button setTitle:[NSString stringWithFormat:@"%zd",status.comments_count] forState:UIControlStateNormal];
    [self.attitudes_count_button setTitle:[NSString stringWithFormat:@"%zd",status.attitudes_count] forState:UIControlStateNormal];

}
- (void)setFrame:(CGRect)frame
{
    frame.size.height -= 10;
    [super setFrame:frame];
}
@end


text:
<?php

namespace common\models;

use Yii;
use yii\base\Model;

/**
 * Class SignupForm
 *
 * @author Agiel K. Saputra <13nightevil@gmail.com>
 * @since 0.1.0
 */
class SignupForm extends Model
{
    /**
     * @var string
     */
    public $username;
    /**
     * @var string
     */
    public $email;
    /**
     * @var string
     */
    public $password;
    /**
     * @var boolean
     */
    public $term_condition;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['username', 'email'], 'filter', 'filter' => 'trim'],
            [['username', 'email', 'password', 'term_condition'], 'required'],
            [
                'username',
                'unique',
                'targetClass' => '\common\models\User',
                'message' => Yii::t('writesdown', 'This username has already been taken.'),
            ],
            ['username', 'string', 'min' => 2, 'max' => 255],
            ['email', 'email'],
            [
                'email',
                'unique',
                'targetClass' => '\common\models\User',
                'message' => Yii::t('writesdown', 'This email address has already been taken.'),
            ],
            ['password', 'string', 'min' => 6],
        ];
    }

    /**
     * Signs user up.
     *
     * @return User|null the saved model or null if saving fails
     */
    public function signup()
    {
        if ($this->validate()) {
            $user = new User();
            $user->username = $this->username;
            $user->email = $this->email;
            $user->setPassword($this->password);
            $user->generateAuthKey();
            if ($user->save()) {
                Yii::$app->authManager->assign(Yii::$app->authManager->getRole(Option::get('default_role')), $user->id);

                return $user;
            }
        }

        return null;
    }
}


text:
package main

import (
	"text/template"
)

// tmpl is a Template to convert one schema file to markdown.
var tmpl = template.Must(template.New("").Parse(`# {{.Title}}

<!-- These files are auto generated -->

## Properties

| Property | Description | Type | Required | Default | Pattern |
| -------- | ----------- | ---- | -------- | ------- | ------- |
{{- range $name, $_ := .Properties}}
| {{$name}} | {{or .Description "-"}} | {{or .Type "-"}} | {{.RequiredByParent}} | {{or .Default "-"}} | {{or .Pattern "-"}} |
{{- end}}
`))


text:
namespace BrowserAutomationStudioFramework
{
    PostPrepareStrategyFactory::PostPrepareStrategyFactory(QObject *parent) :
        IPostPrepareStrategyFactory(parent)
    {
    }

    IPostPrepareStrategy* PostPrepareStrategyFactory::Create(const QString& type)
    {
        IPostPrepareStrategy* res = 0;
        if(type == "multipart")
        {
            res = new PostPrepareStrategyMultipart();
        }else if (type == "urlencode")
        {
            res = new PostPrepareStrategyUrlEncode();
        }else if (type == "json")
        {
            res = new PostPrepareStrategyJsonEncode();
        }else
        {
            PostPrepareStrategyCustomEncode *r = new PostPrepareStrategyCustomEncode();
            r->SetContentType(type);
            res = r;
        }
        return res;

    }
}


text:
"""
Utility functions for Image transfer.
"""

import os

from nova import exception
from nova.image import glance
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import io_util
from nova.virt.vmwareapi import read_write_util

LOG = logging.getLogger(__name__)

QUEUE_BUFFER_SIZE = 10

def start_transfer(context, read_file_handle, data_size,
        write_file_handle=None, image_service=None, image_id=None,
        image_meta=None):
    """Start the data transfer from the reader to the writer.
    Reader writes to the pipe and the writer reads from the pipe. This means
    that the total transfer time boils down to the slower of the read/write
    and not the addition of the two times.
    """

    if not image_meta:
        image_meta = {}

    # The pipe that acts as an intermediate store of data for reader to write
    # to and writer to grab from.
    thread_safe_pipe = io_util.ThreadSafePipe(QUEUE_BUFFER_SIZE, data_size)
    # The read thread. In case of glance it is the instance of the
    # GlanceFileRead class. The glance client read returns an iterator
    # and this class wraps that iterator to provide datachunks in calls
    # to read.
    read_thread = io_util.IOThread(read_file_handle, thread_safe_pipe)

    # In case of Glance - VMware transfer, we just need a handle to the
    # HTTP Connection that is to send transfer data to the VMware datastore.
    if write_file_handle:
        write_thread = io_util.IOThread(thread_safe_pipe, write_file_handle)
    # In case of VMware - Glance transfer, we relinquish VMware HTTP file read
    # handle to Glance Client instance, but to be sure of the transfer we need
    # to be sure of the status of the image on glance changing to active.
    # The GlanceWriteThread handles the same for us.
    elif image_service and image_id:
        write_thread = io_util.GlanceWriteThread(context, thread_safe_pipe,
                image_service, image_id, image_meta)
    # Start the read and write threads.
    read_event = read_thread.start()
    write_event = write_thread.start()
    try:
        # Wait on the read and write events to signal their end
        read_event.wait()
        write_event.wait()
    except Exception as exc:
        # In case of any of the reads or writes raising an exception,
        # stop the threads so that we un-necessarily don't keep the other one
        # waiting.
        read_thread.stop()
        write_thread.stop()

        # Log and raise the exception.
        LOG.exception(exc)
        raise exception.NovaException(exc)
    finally:
        # No matter what, try closing the read and write handles, if it so
        # applies.
        read_file_handle.close()
        if write_file_handle:
            write_file_handle.close()

def upload_iso_to_datastore(iso_path, instance, **kwargs):
    LOG.debug(_("Uploading iso %s to datastore") % iso_path,
              instance=instance)
    with open(iso_path, 'r') as iso_file:
        write_file_handle = read_write_util.VMwareHTTPWriteFile(
            kwargs.get("host"),
            kwargs.get("data_center_name"),
            kwargs.get("datastore_name"),
            kwargs.get("cookies"),
            kwargs.get("file_path"),
            os.fstat(iso_file.fileno()).st_size)

        LOG.debug(_("Uploading iso of size : %s ") %
                  os.fstat(iso_file.fileno()).st_size)
        block_size = 0x10000
        data = iso_file.read(block_size)
        while len(data) > 0:
            write_file_handle.write(data)
            data = iso_file.read(block_size)
        write_file_handle.close()

    LOG.debug(_("Uploaded iso %s to datastore") % iso_path,
              instance=instance)

def fetch_image(context, instance, host, dc_name, ds_name, file_path,
                cookies=None):
    """Download image from the glance image server."""
    image_ref = instance['image_ref']
    LOG.debug("Downloading image file data %(image_ref)s to the "
              "data store %(data_store_name)s",
              {'image_ref': image_ref,
               'data_store_name': ds_name},
              instance=instance)

    (image_service, image_id) = glance.get_remote_image_service(context,
                                                                image_ref)
    metadata = image_service.show(context, image_id)
    file_size = int(metadata['size'])
    read_iter = image_service.download(context, image_id)
    read_file_handle = read_write_util.GlanceFileRead(read_iter)
    write_file_handle = read_write_util.VMwareHTTPWriteFile(
        host, dc_name, ds_name, cookies, file_path, file_size)
    start_transfer(context, read_file_handle, file_size,
                   write_file_handle=write_file_handle)
    LOG.debug("Downloaded image file data %(image_ref)s to "
              "%(upload_name)s on the data store "
              "%(data_store_name)s",
              {'image_ref': image_ref,
               'upload_name': 'n/a' if file_path is None else file_path,
               'data_store_name': 'n/a' if ds_name is None else ds_name},
              instance=instance)

def upload_image(context, image, instance, **kwargs):
    """Upload the snapshotted vm disk file to Glance image server."""
    LOG.debug(_("Uploading image %s to the Glance image server") % image,
              instance=instance)
    read_file_handle = read_write_util.VMwareHTTPReadFile(
                                kwargs.get("host"),
                                kwargs.get("data_center_name"),
                                kwargs.get("datastore_name"),
                                kwargs.get("cookies"),
                                kwargs.get("file_path"))
    file_size = read_file_handle.get_size()
    (image_service, image_id) = glance.get_remote_image_service(context, image)
    metadata = image_service.show(context, image_id)

    # The properties and other fields that we need to set for the image.
    image_metadata = {"disk_format": "vmdk",
                      "is_public": "false",
                      "name": metadata['name'],
                      "status": "active",
                      "container_format": "bare",
                      "size": file_size,
                      "properties": {"vmware_adaptertype":
                                            kwargs.get("adapter_type"),
                                     "vmware_disktype":
                                            kwargs.get("disk_type"),
                                     "vmware_ostype": kwargs.get("os_type"),
                                     "vmware_image_version":
                                            kwargs.get("image_version"),
                                     "owner_id": instance['project_id']}}
    start_transfer(context, read_file_handle, file_size,
                   image_service=image_service,
                   image_id=image_id, image_meta=image_metadata)
    LOG.debug(_("Uploaded image %s to the Glance image server") % image,
              instance=instance)

def get_vmdk_size_and_properties(context, image, instance):
    """Get size of the vmdk file that is to be downloaded for attach in spawn.
    Need this to create the dummy virtual disk for the meta-data file. The
    geometry of the disk created depends on the size.
    """

    LOG.debug(_("Getting image size for the image %s") % image,
              instance=instance)
    (image_service, image_id) = glance.get_remote_image_service(context, image)
    meta_data = image_service.show(context, image_id)
    size, properties = meta_data["size"], meta_data["properties"]
    LOG.debug(_("Got image size of %(size)s for the image %(image)s"),
              {'size': size, 'image': image}, instance=instance)
    return size, properties


text:
package com.purejadeite.jadegreen.definition.option.cell;

import org.junit.Test;

import com.purejadeite.jadegreen.definition.option.AbstractOptionTest;
import com.purejadeite.jadegreen.option.cell.UpperUnderscore;

public class UpperUnderscoreTest extends AbstractOptionTest {

	@Test
	public void fromLowerCamel() {
		assertOption(UpperUnderscore.class, "abcDef" ,"ABC_DEF");
	}

	@Test
	public void fromLowerHyphen() {
		assertOption(UpperUnderscore.class, "abc-def" ,"ABC_DEF");
	}

	@Test
	public void fromLowerUnderscore() {
		assertOption(UpperUnderscore.class, "abc_def" ,"ABC_DEF");
	}

	@Test
	public void fromUpperCamel() {
		assertOption(UpperUnderscore.class, "AbcDef" ,"ABC_DEF");
	}

	@Test
	public void fromUpperHyphen() {
		assertOption(UpperUnderscore.class, "ABC-DEF" ,"ABC_DEF");
	}

	@Test
	public void fromUpperUnderscore() {
		assertOption(UpperUnderscore.class, "ABC_DEF" ,"ABC_DEF");
	}

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ES5.Script.EcmaScript.Objects
{
    public class Undefined
    {
        static Undefined fInstance = new Undefined();

        private Undefined() { }

        public static readonly System.Reflection.MethodInfo Method_Instance = typeof(Undefined).GetMethod("get_Instance");

        public static Undefined Instance
        {
            get
            {
                return fInstance;
            }
        }

        public override string ToString()
        {
            return "undefined";
        }
    }
}


text:
<button type="button" class="btn btn-primary btn-block" >Chat</button>
<form name="publish_form" class="form-validation jumbotron" >

        Client Id
        <input type="text" class="form-control" required placeholder="Client Id" data-ng-model="msg.topic">

        Message
        <textarea class="form-control"
                  rows="2"
                  required
                  placeholder='Message'
                  data-ng-model="msg.message"></textarea>

    <button type="submit" class="btn btn-primary btn-lg btn-block" data-ng-disabled="!canSubmit()"  data-ng-click="send(msg)">Send</button>
</form>


text:
package de.st_ddt.crazyutil.paramitrisable;

import de.st_ddt.crazyplugin.exceptions.CrazyException;
import de.st_ddt.crazyutil.poly.room.Room;

public class PolyRoomParamitrisable extends TypedParamitrisable<Room>
{

	public PolyRoomParamitrisable(final Room defaultValue)
	{
		super(defaultValue);
	}

	@Override
	public void setParameter(final String parameter) throws CrazyException
	{
		// EDIT Implementiere TypedParamitrisable<Room>.setParameter()
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="6dip" >

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/name"
        android:textColor="#008000"
        android:textSize="20sp" >
    </TextView>

    <TextView
        android:id="@+id/openTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/name"
        android:layout_alignBottom="@+id/name"
        android:layout_alignParentRight="true"
        android:text="@string/openTime"
        android:textColor="#ee0000"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/dbID"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/name"
        android:textSize="20sp"
        android:visibility="gone" />

</RelativeLayout>


text:
I've been running into a lot of build environment setups lately, and wanted a
central place to keep a few common things.  While there will be a few
self-made, make-like tools in here, the repository is mostly geared towards
things that help setting up new projects easier.


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { BasicExpansionComponent } from './basic-expansion.component';

describe('BasicExpansionComponent', () => {
  let component: BasicExpansionComponent;
  let fixture: ComponentFixture<BasicExpansionComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ BasicExpansionComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(BasicExpansionComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
class CreateTreaties < ActiveRecord::Migration
  def change
    create_table :treaties do |t|
      t.references :persona, index: true
      t.references :treaty_type, polymorphic: true, index: true
      t.references :reign, index: true
      t.integer :foreign_branch_id, index: true
      t.text :user_comment
      t.text :royal_comment
      t.text :foreign_comment
      t.datetime :royal_approved
      t.datetime :foreign_approved
      t.string :royal_status, limit: 1
      t.string :foreign_status, limit: 1

      t.timestamps null: false
    end
  end
end


text:
package logbuddy

import (
	"errors"
	"fmt"
)

//WSClientMessage A universal message to send to web socket clients
type WSClientMessage struct {
	Type int    `json:"type"` //Type of Message
	ID   int    `json:"id"`   //ID associated with message
	Data []byte `json:"data"` //Payload of Message
}

//AddDataPayload adds a []byte payload to Data
func (wscm *WSClientMessage) AddDataPayload(data []byte) error {
	if len(data) > 0 {
		wscm.Data = data
		return nil
	}
	return errors.New("Unable to add payload")
}

//MarshalJSON returns a JSON version of WSClientMessage
func (wscm *WSClientMessage) MarshalJSON() ([]byte, error) {
	return []byte(fmt.Sprintf("{\"type\":%d, \"id\":%d,\"data\":%s}", wscm.Type, wscm.ID, wscm.Data)), nil

}


text:
import ev3
import time

brick = ev3.connect_to_brick(address='10.0.1.1')

gyro = ev3.EV3GyroSensor(brick, 1)
angle = gyro.get_mode("Angle")

print "Angle 1:", angle.fetch_sample()
time.sleep(5)

print "Angle 2:", angle.fetch_sample()
time.sleep(5)

print "RESET"
gyro.reset()
time.sleep(5)

print "Angle 1:", angle.fetch_sample()
time.sleep(5)

print "Angle 2:", angle.fetch_sample()

rate = gyro.get_mode("Rate")

print "Rate 1:", rate.fetch_sample()
time.sleep(5)

print "Rate 2:", rate.fetch_sample()
time.sleep(5)

print "RESET"
gyro.reset()
time.sleep(5)

print "Rate 1:", rate.fetch_sample()
time.sleep(5)

print "Rate 2:", rate.fetch_sample()


text:
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="16dp" >

    <EditText
            android:id="@+id/group_name_edit"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

</RelativeLayout>


text:
package pbdrone

import (
	context "context"
	fmt "fmt"
	math "math"

	proto "github.com/golang/protobuf/proto"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"

	types "openpitrix.io/openpitrix/pkg/pb/metadata/types"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package

func init() { proto.RegisterFile("metadata/drone/drone.proto", fileDescriptor_1725cf0b7409fde2) }

var fileDescriptor_1725cf0b7409fde2 = []byte{
	// 476 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x4f, 0x6f, 0xd3, 0x40,
	0x10, 0xc5, 0x6f, 0x48, 0x19, 0x20, 0x45, 0x5b, 0xfe, 0x08, 0x23, 0x40, 0x5c, 0x10, 0xa7, 0x58,
	0x02, 0x09, 0x51, 0x10, 0x07, 0xd2, 0xb8, 0x51, 0xa4, 0x94, 0x46, 0x31, 0xea, 0x81, 0xdb, 0x26,
	0x9e, 0x58, 0xab, 0xda, 0xb3, 0x8b, 0x3d, 0x46, 0xf4, 0x9b, 0xf0, 0x71, 0x91, 0xbd, 0x71, 0xfe,
	0x6c, 0xb2, 0x41, 0x6d, 0x2f, 0x8e, 0x32, 0xef, 0xcd, 0xdb, 0xdf, 0x8e, 0xb5, 0x6b, 0x08, 0x72,
	0x64, 0x99, 0x48, 0x96, 0x61, 0x52, 0x68, 0x42, 0xfb, 0xec, 0x99, 0x42, 0xb3, 0x16, 0xdd, 0x56,
	0xeb, 0x35, 0xd5, 0x60, 0xed, 0xe5, 0x6b, 0x83, 0xa5, 0x7d, 0x5a, 0xef, 0x8e, 0x36, 0xd7, 0xb4,
	0x48, 0x3c, 0xda, 0xc6, 0x1a, 0xc1, 0x2b, 0x47, 0x5b, 0x14, 0x9a, 0x38, 0x95, 0xbc, 0xd4, 0xdf,
	0xff, 0xbd, 0x0f, 0x0f, 0x06, 0xb5, 0x3f, 0xc6, 0xe2, 0xb7, 0x9a, 0xa3, 0x98, 0xc0, 0xd1, 0x40,
	0x95, 0x5c, 0xa8, 0x59, 0xc5, 0xd8, 0x28, 0xe2, 0x6d, 0x6f, 0x05, 0x6a, 0x91, 0x1c, 0xc3, 0x14,
	0x7f, 0x55, 0x58, 0x72, 0xf0, 0xc4, 0xf5, 0x45, 0xb9, 0xe1, 0x6b, 0xf1, 0x0d, 0x8e, 0x86, 0xc8,
	0x13, 0x95, 0x69, 0xbe, 0xc4, 0xa2, 0x54, 0x9a, 0xc4, 0x7e, 0x67, 0xf0, 0xcc, 0x2d, 0xb7, 0xfe,
	0x08, 0x8e, 0x87, 0xc8, 0x67, 0x2d, 0xfb, 0x6d, 0x63, 0x46, 0x0d, 0x49, 0xc3, 0xdc, 0x96, 0x5e,
	0xee, 0xec, 0xad, 0x56, 0x23, 0x4a, 0x8c, 0x56, 0xc4, 0xfe, 0xa8, 0x01, 0x74, 0xdb, 0xa8, 0x53,
	0x4d, 0x0b, 0x95, 0xfa, 0x60, 0x5e, 0xec, 0x5d, 0x60, 0xd9, 0x33, 0x80, 0x6e, 0xbc, 0x9d, 0x72,
	0xc8, 0xee, 0x1b, 0xb0, 0x65, 0xa9, 0x3d, 0xc9, 0x0d, 0x59, 0x36, 0x7b, 0x2c, 0xcb, 0x66, 0xe5,
	0x90, 0xdd, 0xc7, 0x32, 0x06, 0xb1, 0xf9, 0xa6, 0x0e, 0xf3, 0xbc, 0x76, 0xcb, 0x6e, 0xdf, 0x18,
	0x44, 0xbc, 0x9b, 0xf6, 0xbf, 0x36, 0x1f, 0xdb, 0x57, 0xe8, 0x8e, 0xca, 0x66, 0x0f, 0xd3, 0x8a,
	0x48, 0x91, 0x97, 0xeb, 0xb1, 0x5b, 0xee, 0x6b, 0x9d, 0x89, 0xcf, 0x00, 0x31, 0xcb, 0xc2, 0x8e,
	0xc8, 0xd7, 0xea, 0x59, 0xfa, 0x04, 0x3a, 0x31, 0x6b, 0x73, 0x9b, 0xd6, 0x08, 0x1e, 0x0d, 0x91,
	0x7f, 0x60, 0x6e, 0x32, 0xc9, 0x78, 0xa6, 0x32, 0x2c, 0x7d, 0x09, 0x81, 0x5b, 0x8e, 0xb9, 0x50,
	0x94, 0x8e, 0x55, 0xc9, 0xa2, 0x0f, 0x9d, 0x21, 0xf2, 0xa5, 0xcc, 0x2a, 0x2c, 0xc5, 0x01, 0x63,
	0xf0, 0x7c, 0xbf, 0x76, 0x2e, 0x8d, 0x88, 0xa0, 0x33, 0x51, 0x94, 0x36, 0x47, 0x59, 0xbc, 0xf1,
	0xbe, 0x85, 0xd5, 0xe9, 0xf1, 0xec, 0x68, 0x04, 0x0f, 0xeb, 0x98, 0x95, 0xff, 0x0e, 0x51, 0x27,
	0x96, 0xc8, 0xde, 0x53, 0x37, 0x9b, 0xeb, 0x05, 0x1c, 0xd7, 0xad, 0xe7, 0x4b, 0xad, 0x2f, 0xe7,
	0x57, 0x48, 0xc9, 0x1d, 0x58, 0xbe, 0x03, 0x4c, 0x2b, 0x3a, 0xd5, 0x79, 0x2e, 0x29, 0x11, 0xef,
	0x5c, 0xd3, 0x5a, 0xbb, 0xa0, 0xad, 0x6b, 0xf3, 0xe9, 0xfe, 0x81, 0xf7, 0x3f, 0xfd, 0xfc, 0xa8,
	0x0d, 0x92, 0x51, 0x5c, 0xa8, 0x3f, 0x3d, 0xa5, 0xc3, 0xf5, 0xbf, 0xd0, 0x5c, 0xa5, 0xa1, 0x99,
	0x85, 0xdb, 0x1f, 0x97, 0x2f, 0x66, 0xd6, 0xfc, 0xce, 0xee, 0x35, 0x77, 0xfb, 0x87, 0x7f, 0x01,
	0x00, 0x00, 0xff, 0xff, 0x4a, 0xfb, 0x57, 0xf4, 0x7d, 0x06, 0x00, 0x00,
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// DroneServiceClient is the client API for DroneService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type DroneServiceClient interface {
	DistributeDrone(ctx context.Context, in *types.DistributeDroneRequest, opts ...grpc.CallOption) (*types.Empty, error)
	GetPilotVersion(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Version, error)
	GetFrontgateVersion(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Version, error)
	GetDroneVersion(ctx context.Context, in *types.DroneEndpoint, opts ...grpc.CallOption) (*types.Version, error)
	GetDroneConfig(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.DroneConfig, error)
	SetDroneConfig(ctx context.Context, in *types.DroneConfig, opts ...grpc.CallOption) (*types.Empty, error)
	GetConfdConfig(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.ConfdConfig, error)
	SetConfdConfig(ctx context.Context, in *types.ConfdConfig, opts ...grpc.CallOption) (*types.Empty, error)
	GetFrontgateConfig(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.FrontgateConfig, error)
	SetFrontgateConfig(ctx context.Context, in *types.FrontgateConfig, opts ...grpc.CallOption) (*types.Empty, error)
	IsConfdRunning(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Bool, error)
	StartConfd(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Empty, error)
	StopConfd(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Empty, error)
	GetTemplateFiles(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.StringList, error)
	GetValues(ctx context.Context, in *types.StringList, opts ...grpc.CallOption) (*types.StringMap, error)
	PingPilot(ctx context.Context, in *types.FrontgateEndpoint, opts ...grpc.CallOption) (*types.Empty, error)
	PingFrontgate(ctx context.Context, in *types.FrontgateEndpoint, opts ...grpc.CallOption) (*types.Empty, error)
	PingDrone(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Empty, error)
	PingMetadataBackend(ctx context.Context, in *types.FrontgateEndpoint, opts ...grpc.CallOption) (*types.Empty, error)
	RunCommand(ctx context.Context, in *types.RunCommandOnDroneRequest, opts ...grpc.CallOption) (*types.String, error)
}

type droneServiceClient struct {
	cc *grpc.ClientConn
}

func NewDroneServiceClient(cc *grpc.ClientConn) DroneServiceClient {
	return &droneServiceClient{cc}
}

func (c *droneServiceClient) DistributeDrone(ctx context.Context, in *types.DistributeDroneRequest, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/DistributeDrone", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetPilotVersion(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Version, error) {
	out := new(types.Version)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetPilotVersion", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetFrontgateVersion(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Version, error) {
	out := new(types.Version)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetFrontgateVersion", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetDroneVersion(ctx context.Context, in *types.DroneEndpoint, opts ...grpc.CallOption) (*types.Version, error) {
	out := new(types.Version)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetDroneVersion", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetDroneConfig(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.DroneConfig, error) {
	out := new(types.DroneConfig)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetDroneConfig", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) SetDroneConfig(ctx context.Context, in *types.DroneConfig, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/SetDroneConfig", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetConfdConfig(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.ConfdConfig, error) {
	out := new(types.ConfdConfig)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetConfdConfig", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) SetConfdConfig(ctx context.Context, in *types.ConfdConfig, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/SetConfdConfig", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetFrontgateConfig(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.FrontgateConfig, error) {
	out := new(types.FrontgateConfig)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetFrontgateConfig", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) SetFrontgateConfig(ctx context.Context, in *types.FrontgateConfig, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/SetFrontgateConfig", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) IsConfdRunning(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Bool, error) {
	out := new(types.Bool)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/IsConfdRunning", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) StartConfd(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/StartConfd", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) StopConfd(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/StopConfd", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetTemplateFiles(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.StringList, error) {
	out := new(types.StringList)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetTemplateFiles", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) GetValues(ctx context.Context, in *types.StringList, opts ...grpc.CallOption) (*types.StringMap, error) {
	out := new(types.StringMap)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/GetValues", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) PingPilot(ctx context.Context, in *types.FrontgateEndpoint, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/PingPilot", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) PingFrontgate(ctx context.Context, in *types.FrontgateEndpoint, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/PingFrontgate", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) PingDrone(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/PingDrone", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) PingMetadataBackend(ctx context.Context, in *types.FrontgateEndpoint, opts ...grpc.CallOption) (*types.Empty, error) {
	out := new(types.Empty)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/PingMetadataBackend", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *droneServiceClient) RunCommand(ctx context.Context, in *types.RunCommandOnDroneRequest, opts ...grpc.CallOption) (*types.String, error) {
	out := new(types.String)
	err := c.cc.Invoke(ctx, "/metadata.drone.DroneService/RunCommand", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// DroneServiceServer is the server API for DroneService service.
type DroneServiceServer interface {
	DistributeDrone(context.Context, *types.DistributeDroneRequest) (*types.Empty, error)
	GetPilotVersion(context.Context, *types.Empty) (*types.Version, error)
	GetFrontgateVersion(context.Context, *types.Empty) (*types.Version, error)
	GetDroneVersion(context.Context, *types.DroneEndpoint) (*types.Version, error)
	GetDroneConfig(context.Context, *types.Empty) (*types.DroneConfig, error)
	SetDroneConfig(context.Context, *types.DroneConfig) (*types.Empty, error)
	GetConfdConfig(context.Context, *types.Empty) (*types.ConfdConfig, error)
	SetConfdConfig(context.Context, *types.ConfdConfig) (*types.Empty, error)
	GetFrontgateConfig(context.Context, *types.Empty) (*types.FrontgateConfig, error)
	SetFrontgateConfig(context.Context, *types.FrontgateConfig) (*types.Empty, error)
	IsConfdRunning(context.Context, *types.Empty) (*types.Bool, error)
	StartConfd(context.Context, *types.Empty) (*types.Empty, error)
	StopConfd(context.Context, *types.Empty) (*types.Empty, error)
	GetTemplateFiles(context.Context, *types.Empty) (*types.StringList, error)
	GetValues(context.Context, *types.StringList) (*types.StringMap, error)
	PingPilot(context.Context, *types.FrontgateEndpoint) (*types.Empty, error)
	PingFrontgate(context.Context, *types.FrontgateEndpoint) (*types.Empty, error)
	PingDrone(context.Context, *types.Empty) (*types.Empty, error)
	PingMetadataBackend(context.Context, *types.FrontgateEndpoint) (*types.Empty, error)
	RunCommand(context.Context, *types.RunCommandOnDroneRequest) (*types.String, error)
}

// UnimplementedDroneServiceServer can be embedded to have forward compatible implementations.
type UnimplementedDroneServiceServer struct {
}

func (*UnimplementedDroneServiceServer) DistributeDrone(ctx context.Context, req *types.DistributeDroneRequest) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DistributeDrone not implemented")
}
func (*UnimplementedDroneServiceServer) GetPilotVersion(ctx context.Context, req *types.Empty) (*types.Version, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetPilotVersion not implemented")
}
func (*UnimplementedDroneServiceServer) GetFrontgateVersion(ctx context.Context, req *types.Empty) (*types.Version, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetFrontgateVersion not implemented")
}
func (*UnimplementedDroneServiceServer) GetDroneVersion(ctx context.Context, req *types.DroneEndpoint) (*types.Version, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetDroneVersion not implemented")
}
func (*UnimplementedDroneServiceServer) GetDroneConfig(ctx context.Context, req *types.Empty) (*types.DroneConfig, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetDroneConfig not implemented")
}
func (*UnimplementedDroneServiceServer) SetDroneConfig(ctx context.Context, req *types.DroneConfig) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetDroneConfig not implemented")
}
func (*UnimplementedDroneServiceServer) GetConfdConfig(ctx context.Context, req *types.Empty) (*types.ConfdConfig, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetConfdConfig not implemented")
}
func (*UnimplementedDroneServiceServer) SetConfdConfig(ctx context.Context, req *types.ConfdConfig) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetConfdConfig not implemented")
}
func (*UnimplementedDroneServiceServer) GetFrontgateConfig(ctx context.Context, req *types.Empty) (*types.FrontgateConfig, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetFrontgateConfig not implemented")
}
func (*UnimplementedDroneServiceServer) SetFrontgateConfig(ctx context.Context, req *types.FrontgateConfig) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetFrontgateConfig not implemented")
}
func (*UnimplementedDroneServiceServer) IsConfdRunning(ctx context.Context, req *types.Empty) (*types.Bool, error) {
	return nil, status.Errorf(codes.Unimplemented, "method IsConfdRunning not implemented")
}
func (*UnimplementedDroneServiceServer) StartConfd(ctx context.Context, req *types.Empty) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method StartConfd not implemented")
}
func (*UnimplementedDroneServiceServer) StopConfd(ctx context.Context, req *types.Empty) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method StopConfd not implemented")
}
func (*UnimplementedDroneServiceServer) GetTemplateFiles(ctx context.Context, req *types.Empty) (*types.StringList, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetTemplateFiles not implemented")
}
func (*UnimplementedDroneServiceServer) GetValues(ctx context.Context, req *types.StringList) (*types.StringMap, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetValues not implemented")
}
func (*UnimplementedDroneServiceServer) PingPilot(ctx context.Context, req *types.FrontgateEndpoint) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method PingPilot not implemented")
}
func (*UnimplementedDroneServiceServer) PingFrontgate(ctx context.Context, req *types.FrontgateEndpoint) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method PingFrontgate not implemented")
}
func (*UnimplementedDroneServiceServer) PingDrone(ctx context.Context, req *types.Empty) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method PingDrone not implemented")
}
func (*UnimplementedDroneServiceServer) PingMetadataBackend(ctx context.Context, req *types.FrontgateEndpoint) (*types.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method PingMetadataBackend not implemented")
}
func (*UnimplementedDroneServiceServer) RunCommand(ctx context.Context, req *types.RunCommandOnDroneRequest) (*types.String, error) {
	return nil, status.Errorf(codes.Unimplemented, "method RunCommand not implemented")
}

func RegisterDroneServiceServer(s *grpc.Server, srv DroneServiceServer) {
	s.RegisterService(&_DroneService_serviceDesc, srv)
}

func _DroneService_DistributeDrone_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.DistributeDroneRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).DistributeDrone(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/DistributeDrone",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).DistributeDrone(ctx, req.(*types.DistributeDroneRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetPilotVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetPilotVersion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetPilotVersion",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetPilotVersion(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetFrontgateVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetFrontgateVersion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetFrontgateVersion",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetFrontgateVersion(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetDroneVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.DroneEndpoint)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetDroneVersion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetDroneVersion",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetDroneVersion(ctx, req.(*types.DroneEndpoint))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetDroneConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetDroneConfig(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetDroneConfig",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetDroneConfig(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_SetDroneConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.DroneConfig)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).SetDroneConfig(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/SetDroneConfig",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).SetDroneConfig(ctx, req.(*types.DroneConfig))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetConfdConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetConfdConfig(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetConfdConfig",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetConfdConfig(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_SetConfdConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.ConfdConfig)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).SetConfdConfig(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/SetConfdConfig",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).SetConfdConfig(ctx, req.(*types.ConfdConfig))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetFrontgateConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetFrontgateConfig(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetFrontgateConfig",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetFrontgateConfig(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_SetFrontgateConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.FrontgateConfig)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).SetFrontgateConfig(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/SetFrontgateConfig",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).SetFrontgateConfig(ctx, req.(*types.FrontgateConfig))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_IsConfdRunning_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).IsConfdRunning(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/IsConfdRunning",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).IsConfdRunning(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_StartConfd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).StartConfd(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/StartConfd",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).StartConfd(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_StopConfd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).StopConfd(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/StopConfd",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).StopConfd(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetTemplateFiles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetTemplateFiles(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetTemplateFiles",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetTemplateFiles(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_GetValues_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.StringList)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).GetValues(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/GetValues",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).GetValues(ctx, req.(*types.StringList))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_PingPilot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.FrontgateEndpoint)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).PingPilot(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/PingPilot",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).PingPilot(ctx, req.(*types.FrontgateEndpoint))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_PingFrontgate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.FrontgateEndpoint)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).PingFrontgate(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/PingFrontgate",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).PingFrontgate(ctx, req.(*types.FrontgateEndpoint))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_PingDrone_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).PingDrone(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/PingDrone",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).PingDrone(ctx, req.(*types.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_PingMetadataBackend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.FrontgateEndpoint)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).PingMetadataBackend(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/PingMetadataBackend",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).PingMetadataBackend(ctx, req.(*types.FrontgateEndpoint))
	}
	return interceptor(ctx, in, info, handler)
}

func _DroneService_RunCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(types.RunCommandOnDroneRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(DroneServiceServer).RunCommand(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/metadata.drone.DroneService/RunCommand",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(DroneServiceServer).RunCommand(ctx, req.(*types.RunCommandOnDroneRequest))
	}
	return interceptor(ctx, in, info, handler)
}

var _DroneService_serviceDesc = grpc.ServiceDesc{
	ServiceName: "metadata.drone.DroneService",
	HandlerType: (*DroneServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "DistributeDrone",
			Handler:    _DroneService_DistributeDrone_Handler,
		},
		{
			MethodName: "GetPilotVersion",
			Handler:    _DroneService_GetPilotVersion_Handler,
		},
		{
			MethodName: "GetFrontgateVersion",
			Handler:    _DroneService_GetFrontgateVersion_Handler,
		},
		{
			MethodName: "GetDroneVersion",
			Handler:    _DroneService_GetDroneVersion_Handler,
		},
		{
			MethodName: "GetDroneConfig",
			Handler:    _DroneService_GetDroneConfig_Handler,
		},
		{
			MethodName: "SetDroneConfig",
			Handler:    _DroneService_SetDroneConfig_Handler,
		},
		{
			MethodName: "GetConfdConfig",
			Handler:    _DroneService_GetConfdConfig_Handler,
		},
		{
			MethodName: "SetConfdConfig",
			Handler:    _DroneService_SetConfdConfig_Handler,
		},
		{
			MethodName: "GetFrontgateConfig",
			Handler:    _DroneService_GetFrontgateConfig_Handler,
		},
		{
			MethodName: "SetFrontgateConfig",
			Handler:    _DroneService_SetFrontgateConfig_Handler,
		},
		{
			MethodName: "IsConfdRunning",
			Handler:    _DroneService_IsConfdRunning_Handler,
		},
		{
			MethodName: "StartConfd",
			Handler:    _DroneService_StartConfd_Handler,
		},
		{
			MethodName: "StopConfd",
			Handler:    _DroneService_StopConfd_Handler,
		},
		{
			MethodName: "GetTemplateFiles",
			Handler:    _DroneService_GetTemplateFiles_Handler,
		},
		{
			MethodName: "GetValues",
			Handler:    _DroneService_GetValues_Handler,
		},
		{
			MethodName: "PingPilot",
			Handler:    _DroneService_PingPilot_Handler,
		},
		{
			MethodName: "PingFrontgate",
			Handler:    _DroneService_PingFrontgate_Handler,
		},
		{
			MethodName: "PingDrone",
			Handler:    _DroneService_PingDrone_Handler,
		},
		{
			MethodName: "PingMetadataBackend",
			Handler:    _DroneService_PingMetadataBackend_Handler,
		},
		{
			MethodName: "RunCommand",
			Handler:    _DroneService_RunCommand_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "metadata/drone/drone.proto",
}


text:
package com.vmware.ward.library;

/**
 * @author Rostislav Hristov
 */
public class Library {

	private Version version = new Version(1.0);

	public Version getVersion() {
		return version;
	}

}


text:
async.parallel([
    function(callback) {
        setTimeout(function() {
            callback(null, 'one'); // err, result
        }, 200);
    },
    function(callback) {
        setTimeout(function() {
            callback(null, 'two');
        }, 100);
    }
],
// optional callback
function(err, results) {
    // the results array will equal ['one','two'] even though
    // the second function had a shorter timeout.
});

// an example using an object instead of an array
async.parallel({
    one: function(callback) {
        setTimeout(function() {
            callback(null, 1);
        }, 200);
    },
    two: function(callback) {
        setTimeout(function() {
            callback(null, 2);
        }, 100);
    }
}, function(err, results) {
    // results is now equals to: {one: 1, two: 2}
});

//
// series
////////////////////////////

async.series([
    function(callback) {
        // do some stuff ...
        callback(null, 'one');
    },
    function(callback) {
        // do some more stuff ...
        callback(null, 'two');
    }
],
// optional callback
function(err, results) {
    // results is now equal to ['one', 'two']
});

async.series({
    one: function(callback) {
        setTimeout(function() {
            callback(null, 1);
        }, 200);
    },
    two: function(callback){
        setTimeout(function() {
            callback(null, 2);
        }, 100);
    }
}, function(err, results) {
    // results is now equal to: {one: 1, two: 2}
});

//
// waterfall
////////////////////////////

async.waterfall([
    function(callback) {
        callback(null, 'one', 'two');
    },
    function(arg1, arg2, callback) {
        // arg1 now equals 'one' and arg2 now equals 'two'
        callback(null, 'three');
		// Got some error ? Don't wanna go further.
      	// Provide true in callback and execution will stop.
      	//callback(true,"Some error");
    },
    function(arg1, callback) {
        // arg1 now equals 'three'
        callback(null, 'done');
    }
], function (err, result) {
    // result now equals 'done'
});

// Or, with named functions:
async.waterfall([
    myFirstFunction,
    mySecondFunction,
    myLastFunction,
], function (err, result) {
    // result now equals 'done'
});
function myFirstFunction(callback) {
    callback(null, 'one', 'two');
}
function mySecondFunction(arg1, arg2, callback) {
    // arg1 now equals 'one' and arg2 now equals 'two'
    callback(null, 'three');
}
function myLastFunction(arg1, callback) {
    // arg1 now equals 'three'
    callback(null, 'done');
}

//
// each
/////////////////////

async.each(emails,function(singleEmail,callback) {
  // Emailer code
  // singleEmail will be one value at a time.
},function(err,data) {
  // Once all done, comes here.
});


text:
FOUNDATION_EXPORT double Pods_EMA02_ToDoAppVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_EMA02_ToDoAppVersionString[];


text:
package de.tobiaserthal.akgbensheim.backend.sync;

import android.accounts.Account;
import android.annotation.TargetApi;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
import android.content.Context;
import android.content.OperationApplicationException;
import android.content.SyncResult;
import android.database.Cursor;
import android.os.Build;
import android.os.Bundle;
import android.os.RemoteException;

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

import de.tobiaserthal.akgbensheim.backend.model.ModelUtils;
import de.tobiaserthal.akgbensheim.backend.model.event.EventModel;
import de.tobiaserthal.akgbensheim.backend.model.news.NewsModel;
import de.tobiaserthal.akgbensheim.backend.model.substitution.SubstitutionModel;
import de.tobiaserthal.akgbensheim.backend.model.teacher.TeacherModel;
import de.tobiaserthal.akgbensheim.backend.provider.event.EventContentValues;
import de.tobiaserthal.akgbensheim.backend.provider.event.EventCursor;
import de.tobiaserthal.akgbensheim.backend.provider.event.EventSelection;
import de.tobiaserthal.akgbensheim.backend.provider.news.NewsColumns;
import de.tobiaserthal.akgbensheim.backend.provider.news.NewsContentValues;
import de.tobiaserthal.akgbensheim.backend.provider.news.NewsCursor;
import de.tobiaserthal.akgbensheim.backend.provider.news.NewsSelection;
import de.tobiaserthal.akgbensheim.backend.provider.substitution.SubstitutionContentValues;
import de.tobiaserthal.akgbensheim.backend.provider.substitution.SubstitutionCursor;
import de.tobiaserthal.akgbensheim.backend.provider.substitution.SubstitutionSelection;
import de.tobiaserthal.akgbensheim.backend.provider.teacher.TeacherContentValues;
import de.tobiaserthal.akgbensheim.backend.provider.teacher.TeacherCursor;
import de.tobiaserthal.akgbensheim.backend.provider.teacher.TeacherSelection;
import de.tobiaserthal.akgbensheim.backend.rest.api.ApiError;
import de.tobiaserthal.akgbensheim.backend.rest.api.RestServer;
import de.tobiaserthal.akgbensheim.backend.rest.model.event.EventResponse;
import de.tobiaserthal.akgbensheim.backend.rest.model.news.NewsKeys;
import de.tobiaserthal.akgbensheim.backend.rest.model.news.NewsResponse;
import de.tobiaserthal.akgbensheim.backend.rest.model.substitution.SubstitutionResponse;
import de.tobiaserthal.akgbensheim.backend.rest.model.teacher.TeacherResponse;
import de.tobiaserthal.akgbensheim.backend.utils.Log;
import de.tobiaserthal.akgbensheim.backend.utils.NetworkManager;

public class SyncAdapter extends AbstractThreadedSyncAdapter {
    public static final String TAG = "SyncAdapter";

    public static final class ARGS {
        public static final String ID = "sync_id";
        public static final String NEWS_START = "sync_extra_newsStart";
        public static final String NEWS_COUNT = "sync_extra_newsCount";
    }

    public SyncAdapter(Context context, boolean autoInitialize) {
        super(context, autoInitialize);
    }

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public SyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
        super(context, autoInitialize, allowParallelSyncs);
    }

    @Override
    public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
        if (!NetworkManager.getInstance().isAccessAllowed()) {
            Log.w(TAG, "Not allowed to start sync due to network settings! Aborting...");
            //syncResult.stats.numIoExceptions ++; // FIXME: might be critical to the adapter pending issue
            return;
        }

        Log.d(TAG, "Beginning sync with options: %s", extras.toString());
        try {
            ArrayList<ContentProviderOperation> batchList = new ArrayList<>();

            int which = extras.getInt(ARGS.ID, ModelUtils.ALL);
            if((which & ModelUtils.NEWS) == ModelUtils.NEWS) {
                syncNews(provider, batchList, syncResult, extras);
            }

            if((which & ModelUtils.EVENTS) == ModelUtils.EVENTS) {
                syncEvents(provider, batchList, syncResult);
            }

            if((which & ModelUtils.TEACHERS) == ModelUtils.TEACHERS) {
                syncTeachers(provider, batchList, syncResult);
            }

            if((which & ModelUtils.SUBSTITUTIONS) == ModelUtils.SUBSTITUTIONS) {
                syncSubstitutions(provider, batchList, syncResult);
            }

            Log.i(TAG, "Merge solution ready. Applying batch update to database...");
            provider.applyBatch(batchList);

        } catch (IOException e) {
            Log.e(TAG, e, "Error while trying to parse response!");
            syncResult.stats.numIoExceptions++; // FIXME: might be critical to the adapter pending issue
        } catch (ApiError e) {
            Log.e(TAG, e, "Response object returned from server invalid!");
            syncResult.stats.numParseExceptions ++;
        } catch (RemoteException e) {
            Log.e(TAG, e, "Error while trying to insert into database!");
            syncResult.databaseError = true;
        } catch (OperationApplicationException e) {
            Log.e(TAG, e, "Failed to send operations to content provider!");
            syncResult.databaseError = true;
        } finally {
            Log.i(TAG, "Finished syncing: %s", syncResult.toString());
        }
    }

    private void syncEvents(ContentProviderClient provider, ArrayList<ContentProviderOperation> batch,
                           SyncResult syncResult) throws ApiError, RemoteException, OperationApplicationException, IOException {
        Log.d(TAG, "Computing update solution for events table...");

        Log.i(TAG, "Parsing results from rest server...");
        List<EventResponse.Entry> entries = RestServer.getInstance().getEvents();

        Log.i(TAG, "Parsed %d entries. Mapping fetched data...", entries.size());
        HashMap<Long, EventModel> entryMap = new HashMap<>();
        for(EventResponse.Entry response : entries) {
            entryMap.put(response.getId(), response);
        }

        Log.i(TAG, "Fetching local database...");
        EventSelection query = new EventSelection();
        EventCursor cursor = EventCursor.wrap(
                provider.query(query.uri(), null, query.sel(), query.args(), query.order()));

        Log.i(TAG, "Fetched %d entries from database. Computing merge solution...", cursor.getCount());
        while (cursor.moveToNext()) {
            long id = cursor.getId();
            syncResult.stats.numEntries ++;

            EventModel match = entryMap.get(id);
            EventSelection entry = new EventSelection().id(id);

            if(match != null) {
                entryMap.remove(id);

                if(!ModelUtils.equal(match, cursor)) {
                    Log.i(TAG, "Scheduling update for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    batch.add(ContentProviderOperation.newUpdate(entry.uri())
                            .withSelection(entry.sel(), entry.args())
                            .withValues(EventContentValues.wrap(match).values())
                            .build());
                    syncResult.stats.numUpdates ++;
                } else {
                    Log.i(TAG, "No action for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    syncResult.stats.numSkippedEntries ++;
                }
            } else {
                Log.i(TAG, "Scheduling delete for: %s/%s", entry.uri().toString(), String.valueOf(id));
                batch.add(ContentProviderOperation.newDelete(entry.uri())
                        .withSelection(entry.sel(), entry.args())
                        .build());
                syncResult.stats.numDeletes ++;
            }
        }
        cursor.close();

        for(EventModel model : entryMap.values()) {
            EventContentValues values = EventContentValues.wrap(model);

            Log.i(TAG, "Scheduling insert for: %s/%s", values.uri(), String.valueOf(model.getId()));
            batch.add(ContentProviderOperation.newInsert(values.uri())
                    .withValues(values.values())
                    .build());

            syncResult.stats.numInserts ++;
        }

        Log.i(TAG, "Finished adding update solution for event table.");
    }

    private void syncNews(ContentProviderClient provider, ArrayList<ContentProviderOperation> batch,
                         SyncResult syncResult, Bundle extras) throws ApiError, RemoteException, OperationApplicationException, IOException {
        Log.d(TAG, "Computing update solution for news table...");

        int start = Math.max(extras.getInt(ARGS.NEWS_START, 0), 0);
        int count = Math.max(extras.getInt(ARGS.NEWS_COUNT, 0), 0);

        // this means we should either refresh everything or fire up an initial sync
        if(count == 0) {
            NewsSelection selection = NewsSelection.getAll();
            String[] projection = {"count(" + NewsColumns._ID + ")"};

            Cursor cursor = provider.query(
                    selection.uri(),
                    projection,
                    selection.sel(),
                    selection.args(),
                    selection.order()
            );

            if(cursor != null) {
                if (cursor.moveToFirst()) {
                    // refresh at least the first 10 entries
                    count = Math.max(cursor.getInt(0), NewsKeys.ITEMS_PER_PAGE);
                }

                cursor.close();
            }
        }

        Log.i(TAG, "Parsing results from rest server with start: %d and count: %d...", start, count);
        List<NewsResponse.Entry> entries = RestServer.getInstance().getNews(start, count);

        Log.i(TAG, "Parsed %d entries. Mapping fetched data...", entries.size());
        HashMap<Long, NewsModel> entryMap = new HashMap<>();
        for(NewsResponse.Entry response : entries) {
            entryMap.put(response.getId(), response);
        }

        Log.i(TAG, "Fetching local database with offset: %d and limit: %d...", start, count);
        NewsSelection query = NewsSelection.getAll()
                .limit(count)
                .offset(start);

        NewsCursor cursor = NewsCursor.wrap(
                provider.query(query.uri(), null, query.sel(), query.args(), query.order()));

        Log.i(TAG, "Fetched %d entries from database. Computing merge solution...", cursor.getCount());
        while (cursor.moveToNext()) {
            long id = cursor.getId();
            syncResult.stats.numEntries ++;

            NewsModel match = entryMap.get(id);
            NewsSelection entry = new NewsSelection().id(id);

            if(match != null) {
                entryMap.remove(id);

                if(!ModelUtils.equal(match, cursor)) {
                    Log.i(TAG, "Scheduling update for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    batch.add(ContentProviderOperation.newUpdate(entry.uri())
                            .withSelection(entry.sel(), entry.args())
                            .withValues(NewsContentValues.wrap(match).values())
                            .build());
                    syncResult.stats.numUpdates ++;
                } else {
                    Log.i(TAG, "No action for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    syncResult.stats.numSkippedEntries ++;
                }

            } else {
                Log.i(TAG, "Scheduling delete for: %s/%s", entry.uri().toString(), String.valueOf(id));
                batch.add(ContentProviderOperation.newDelete(entry.uri())
                        .withSelection(entry.sel(), entry.args())
                        .build());
                syncResult.stats.numDeletes ++;
            }
        }
        cursor.close();

        for(NewsModel model : entryMap.values()) {
            NewsContentValues values = NewsContentValues.wrap(model);

            Log.i(TAG, "Scheduling insert for: %s/%s", values.uri(), String.valueOf(model.getId()));
            batch.add(ContentProviderOperation.newInsert(values.uri())
                    .withValues(values.values())
                    .build());
            syncResult.stats.numInserts ++;
        }

        Log.i(TAG, "Finished adding update solution for news table.");
    }

    private void syncSubstitutions(ContentProviderClient provider, ArrayList<ContentProviderOperation> batch,
                                   SyncResult syncResult) throws RemoteException, ApiError, OperationApplicationException, IOException {
        Log.d(TAG, "Computing update solution for substitutions table...");

        Log.i(TAG, "Parsing results from rest server...");
        List<SubstitutionResponse.Entry> entries = RestServer.getInstance().getSubstitutions();

        Log.i(TAG, "Parsed %d entries. Mapping fetched data...", entries.size());
        HashMap<Long, SubstitutionModel> entryMap = new HashMap<>();
        for(SubstitutionResponse.Entry response : entries) {
            entryMap.put(response.getId(), response);
        }

        Log.i(TAG, "Fetching local database...");
        SubstitutionSelection query = new SubstitutionSelection();
        SubstitutionCursor cursor = SubstitutionCursor.wrap(
                provider.query(query.uri(), null, query.sel(), query.args(), query.order()));

        Log.i(TAG, "Fetched %d entries from database. Computing merge solution...", cursor.getCount());
        while (cursor.moveToNext()) {
            long id = cursor.getId();
            syncResult.stats.numEntries ++;

            SubstitutionModel match = entryMap.get(id);
            SubstitutionSelection entry = new SubstitutionSelection().id(id);

            if (match != null) {
                entryMap.remove(id);

                if (!ModelUtils.equal(match, cursor)) {
                    Log.i(TAG, "Scheduling update for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    batch.add(ContentProviderOperation.newUpdate(entry.uri())
                            .withSelection(entry.sel(), entry.args())
                            .withValues(SubstitutionContentValues.wrap(match).values())
                            .build());
                    syncResult.stats.numUpdates ++;
                } else {
                    Log.i(TAG, "No action for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    syncResult.stats.numSkippedEntries++;
                }

            } else {
                Log.i(TAG, "Scheduling delete for: %s/%s", entry.uri().toString(), String.valueOf(id));
                batch.add(ContentProviderOperation.newDelete(entry.uri())
                        .withSelection(entry.sel(), entry.args())
                        .build());
                syncResult.stats.numDeletes ++;
            }
        }
        cursor.close();

        for(SubstitutionModel model : entryMap.values()) {
            SubstitutionContentValues values = SubstitutionContentValues.wrap(model);

            Log.i(TAG, "Scheduling insert for: %s/%s", values.uri(), String.valueOf(model.getId()));
            batch.add(ContentProviderOperation.newInsert(values.uri())
                    .withValues(values.values())
                    .build());
            syncResult.stats.numInserts ++;
        }

        Log.i(TAG, "Finished adding update solution for substitution table");
    }

    private void syncTeachers(ContentProviderClient provider, ArrayList<ContentProviderOperation> batch,
                             SyncResult syncResult) throws RemoteException, ApiError, OperationApplicationException, IOException {
        Log.d(TAG, "Computing update solution for teachers table...");

        Log.i(TAG, "Parsing results from rest server...");
        List<TeacherResponse.Entry> entries = RestServer.getInstance().getTeachers();

        Log.i(TAG, "Parsed %d entries. Mapping fetched data...", entries.size());
        HashMap<Long, TeacherModel> entryMap = new HashMap<>();
        for(TeacherResponse.Entry response : entries) {
            entryMap.put(response.getId(), response);
        }

        Log.i(TAG, "Fetching local database...");
        TeacherSelection query = new TeacherSelection();
        TeacherCursor cursor = TeacherCursor.wrap(
                provider.query(query.uri(), null, query.sel(), query.args(), query.order()));

        Log.i(TAG, "Fetched %d entries from database. Computing merge solution...", cursor.getCount());
        while (cursor.moveToNext()) {
            long id = cursor.getId();
            syncResult.stats.numEntries ++;

            TeacherModel match = entryMap.get(id);
            TeacherSelection entry = new TeacherSelection().id(id);

            if(match != null) {
                entryMap.remove(id);

                if(!ModelUtils.equal(match, cursor)) {
                    Log.i(TAG, "Scheduling update for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    batch.add(ContentProviderOperation.newUpdate(entry.uri())
                            .withSelection(entry.sel(), entry.args())
                            .withValues(TeacherContentValues.wrap(match).values())
                            .build());
                    syncResult.stats.numUpdates ++;
                } else {
                    Log.i(TAG, "No action for: %s/%s", entry.uri().toString(), String.valueOf(id));
                    syncResult.stats.numSkippedEntries ++;
                }
            } else {
                Log.i(TAG, "Scheduling delete for: %s/%s", entry.uri().toString(), String.valueOf(id));
                batch.add(ContentProviderOperation.newDelete(entry.uri())
                        .withSelection(entry.sel(), entry.args())
                        .build());
                syncResult.stats.numDeletes ++;
            }
        }
        cursor.close();

        for(TeacherModel model : entryMap.values()) {
            TeacherContentValues values = TeacherContentValues.wrap(model);

            Log.i(TAG, "Scheduling insert for: %s/%s", values.uri(), String.valueOf(model.getId()));
            batch.add(ContentProviderOperation.newInsert(values.uri())
                    .withValues(values.values())
                    .build());
            syncResult.stats.numInserts ++;
        }

        Log.i(TAG, "Finished adding update solution for teachers table.");
    }
}