text:
namespace tensorflow {
namespace serving {

}  // namespace tensorflow
}  // namespace serving

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.Docs.MarkdownLite.Dfm
{
    using System;
    using System.Text.RegularExpressions;

    public class DfmFencesInlineRule : DfmFencesRule
    {
        public override string Name => "DfmFencesInline";

        private static readonly Regex _dfmFencesRegex = new Regex(@"^ *\[\!((?i)code(\-(?<lang>[\w|\-]+))?)\s*\[(?<name>(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*)\]\(\s*<?(?<path>[^\n]*?)((?<option>[\#|\?])(?<optionValue>\S+))?>?(?:\s+(?<quote>['""])(?<title>[\s\S]*?)\k<quote>)?\s*\)\]\s*", RegexOptions.Compiled, TimeSpan.FromSeconds(10));

        public override IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context)
        {
            if (!parser.Context.GetIsInTable())
            {
                if (!parser.Options.LegacyMode)
                {
                    return null;
                }
            }
            var match = _dfmFencesRegex.Match(context.CurrentMarkdown);
            if (match.Length == 0)
            {
                return null;
            }
            var sourceInfo = context.Consume(match.Length);

            // [!code-REST-i[name](path "optionalTitle")]
            var name = match.Groups["name"].Value;
            var path = match.Groups["path"].Value;
            var lang = match.Groups["lang"]?.Value;
            var title = match.Groups["title"]?.Value;
            var pathQueryOption = ParsePathQueryString(match.Groups["option"]?.Value, match.Groups["optionValue"]?.Value);

            if (!parser.Context.GetIsInTable())
            {
                Logger.LogWarning("Inline code snippet is only allowed inside tables.", line: sourceInfo.LineNumber.ToString(), code: "InvalidInlineCodeSnippet");
            }
            return new DfmFencesBlockToken(this, parser.Context, name, path, sourceInfo, lang, title, pathQueryOption, pathQueryOption != null ? match.Groups["option"]?.Value + match.Groups["optionValue"]?.Value : null);
        }
    }
}


text:
#import <Foundation/Foundation.h>

/**
 * Each key/value pair of a COItem has a COType associated with it.
 *
 * The type defines the set of permissible values which can be set for
 * that attribute, and possibly additional semantics of the value
 * which aren't captured by the Objective-C object alone - for example,
 * one value in a COItem might be an NSArray instance, but the corresponding
 * COType might additionally indicate that the array contains inner item
 * UUIDs, and the array has a restriction that its elements must be unique.
 *
 * COType is designed with a few things in mind:
 *
 * <list>
 * <item>being able to store the values of a COItem in an SQL database, so the
 * primitive types map cleanly to SQL types</item>
 * <item>validation of ObjC objects against the schema</item>
 * <item>plist import/export of ObjC objects of a known COType</item>
 * </list>
 */
typedef NS_OPTIONS(uint32_t, COType)
{
#pragma mark Primitive types

    /**
     * Represented as NSNumber
     */
    kCOTypeInt64 = 0x01,
    /**
     * Represented as NSNumber
     */
    kCOTypeDouble = 0x02,
    /**
     * Represented as NSString
     */
    kCOTypeString = 0x03,
    /**
     * A byte array. Represented as NSData
     */
    kCOTypeBlob = 0x04,
    /**
     * A reference that does not necessairily model parent-child relationships -
     * could be graphs with cycles, etc.
     *
     * Represented as ETUUID for inner references and COPath for references
     * to other persistent roots.
     */
    kCOTypeReference = 0x05,
    /**
     * A composite reference from a parent to a child. The reference is stored
     * in the parent.
     *
     * N.B. this could be lumped together with kCOTypeReference and
     * distinguished at the metamodel level only, but they are kept separate
     * to enhance support for loading data with no metamodel available, and ease
     * debugging.
     *
     * Represented as ETUUID.
     */
    kCOTypeCompositeReference = 0x06,
    /**
     * A token which can be given to COSQLiteStore to retrieve a local
     * filesystem path to an immutable attached file.
     *
     * Represented as COAttachmentID (a hash of the attached file's contents).
     */
    kCOTypeAttachment = 0x07,

#pragma mark Multivalued types

    /**
     * Represented as NSSet.
     */
    kCOTypeSet = 0x10,
    /**
     * Represented as NSArray
     */
    kCOTypeArray = 0x20,

#pragma mark Masks

    kCOTypePrimitiveMask = 0x0f,
    kCOTypeMultivaluedMask = 0xf0
};

static inline COType COTypeMultivaluedPart(COType type)
{
    return type & kCOTypeMultivaluedMask;
}

static inline COType COTypePrimitivePart(COType type)
{
    return type & kCOTypePrimitiveMask;
}

static inline BOOL COTypeIsMultivalued(COType type)
{
    return COTypeMultivaluedPart(type) != 0;
}

static inline BOOL COTypeIsUnivalued(COType type)
{
    return COTypeMultivaluedPart(type) == 0;
}

static inline BOOL COTypeIsOrdered(COType type)
{
    return COTypeMultivaluedPart(type) == kCOTypeArray;
}

static inline COType COTypeMakeSetOf(COType type)
{
    return type | kCOTypeSet;
}

static inline COType COTypeMakeArrayOf(COType type)
{
    return type | kCOTypeArray;
}

static inline BOOL COTypeIsValid(COType type)
{
    if (!(COTypePrimitivePart(type) >= kCOTypeInt64
          && COTypePrimitivePart(type) <= kCOTypeAttachment))
    {
        return NO;
    }

    if (!(COTypeMultivaluedPart(type) == 0
          || COTypeMultivaluedPart(type) == kCOTypeArray
          || COTypeMultivaluedPart(type) == kCOTypeSet))
    {
        return NO;
    }

    if (0 != (type & (~(kCOTypeMultivaluedMask | kCOTypePrimitiveMask))))
    {
        return NO;
    }

    return YES;
}

NSString *COTypeDescription(COType type);

BOOL COTypeValidateObject(COType type, id anObject);


text:
begin;

select

sf1.team_id as home,
sf2.team_id as away,
(exp(i.estimate)*sf1.offensive*o.exp_factor*sf2.defensive)::numeric(4,1) as e_home,
(exp(i.estimate)*sf2.offensive*d.exp_factor*sf1.defensive)::numeric(4,1) as e_away,
((exp(i.estimate)*sf1.offensive*o.exp_factor*sf2.defensive)-
(exp(i.estimate)*sf2.offensive*d.exp_factor*sf1.defensive))::numeric(4,1) as e_d

from sr._schedule_factors sf1, sr._schedule_factors sf2

join sr._factors o
  on (o.parameter,o.level)=('field','offense_home')
join sr._factors d
  on (d.parameter,d.level)=('field','defense_home')

join sr._basic_factors i
  on (i.factor)=('(Intercept)')

where
    (sf1.team_id,sf2.team_id) in
(
('Sharks','Lions')
);


text:
<staff type="staff" id="id0">
  <employees>
    <employee firstname="john" lastname="harrison" gender="m" phone="1111 1111"/>
    <employee firstname="jane" lastname="doe" gender="f" phone="2222 2222"/>
    <employee firstname="Harry" lastname="No Phone" gender="m" phone=""/>
  </employees>
  <managers>
    <manager name="Larry" lastname="Larson" phone="4444 4444"/>
    <manager name="John" lastname="Johnson" gender="M" phone="6666 6666"/>
  </managers>
</staff>


text:
Shows how create simple widget
![Sample](https://github.com/nans/devdocs/blob/master/Magestudy/Widget.png "Widget screenshot")
* Go to CONTENT -> Widgets -> Add Widget
* Select "Magestudy Sample Widget" as type and choose your theme
* Click on continue and fill all fields (in "Widget Options" set some data to label and limit)
* Go to CONTENT -> Pages -> Home Page: add widget to page
* Go to main page for result

License
----
MIT


text:
rm -rf /etc/yum.repos.d/*

cat << EOF > /etc/yum.repos.d/nailgun.repo
[nailgun]
name=Nailgun Local Repo
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/repo/os/x86_64/
gpgcheck=0

[mos]
name=MOS Local Repo
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/mos-repo/
gpgcheck=0
EOF

for repo in ${EXTRA_RPM_REPOS}; do
  IFS=, read -a repo_args <<< "$repo"
  cat << EOF >> /etc/yum.repos.d/nailgun.repo

[extra-repo-${repo_args[0]}]
name=MOS Extra Repo ${repo_args[0]}
baseurl=http://$(route -n | awk '/^0.0.0.0/ {print $2}'):${DOCKER_PORT}/extra-repos/${repo_args[0]}
gpgcheck=0
EOF
done

yum clean expire-cache
yum update -y

packages="sudo mcollective shotgun fuel-agent fuel-provisioning-scripts psmisc daemonize"
echo $packages | xargs -n1 yum install -y

# /var/lib/fuel/ibp is a mount point for IBP host volume
mkdir -p /var/lib/hiera /var/lib/fuel/ibp
touch /etc/puppet/hiera.yaml /var/lib/hiera/common.yaml

systemctl daemon-reload
puppet apply --debug --verbose --color false --detailed-exitcodes \
  /etc/puppet/modules/nailgun/examples/mcollective-only.pp || [[ $? == 2 ]]

#FIXME(mattymo): Workaround to make diagnostic snapshots work
mkdir -p /opt/nailgun/bin /var/www/nailgun/dump
ln -s /usr/bin/nailgun_dump /opt/nailgun/bin/nailgun_dump

cat << EOF > /etc/yum.repos.d/nailgun.repo
[nailgun]
name=Nailgun Local Repo
baseurl=file:/var/www/nailgun/centos/x86_64
gpgcheck=0

[mos]
name=MOS Local Repo
baseurl=file:/var/www/nailgun/mos-centos/x86_64
gpgcheck=0
EOF

yum clean all

systemctl enable start-container.service


text:
define( [ 'dojo/_base/declare' ],
        function( declare ) {

return declare( null,
{
    /**
     *  Selection manager for bio-features
     *     handles deselection of any ancestors/descendants of selected features
     *        (which is desired behavior for feature selection)
     *     assumes features have had their parent property set before calling selection manager methods
     *  Sends selectionAdded() and selectionRemoved() function calls to listeners
     */
    constructor: function()  {
        this.selected = [];
        this.listeners = [];
        this.clearOnAdd = [];
        this.unselectableTypes = { "non_canonical_five_prime_splice_site" : true,
			           "non_canonical_three_prime_splice_site" : true };
    },

    /**
     *  sets an array of other FeatureSelectionManagers to call clearSelection() on
     *     whenever addToSelection() is called on _this_ FeatureSelectionManager
     *     effectively ensures that selection is mutually exclusive between this manager
     *        and the set of other managers passed in as setClearOnAdd args
     */
    //FeatureSelectionManager.prototype.setClearOnAdd = function(other_smanagers)  {
    //    this.clearOnAdd = other_smanagers;
    //};
    addMutualExclusion: function(other_smanager)  {
        this.clearOnAdd.push(other_smanager);
    },

    // adding a parent should remove all children
    // adding a child should remove all parents
    // attempting to add a feature that's already part of the selection does nothing (and doesn't trigger listener calls)
    addToSelection: function( rec )  {

        // if this selection manager has had setClearOnAdd(others)
        // called to set other selection managers to clear selection
        // from when
        if (this.clearOnAdd)  {
	    for (var i=0; i<this.clearOnAdd.length; i++)  {
	        this.clearOnAdd[i].clearSelection();
	    }
        }
        //    console.log("called FeatureselectionManager.addToSelection()");
        // do nothing if feat is already in selection
        if ( this.isSelected( rec ) )  {
	    console.log("called FeatureSelectionManager.addToSelection(), but feature already in selection");
	    return;
        }
        // remove any children of the selected feature (originating from same track)
        var selarray = this.selected;
        var slength = selarray.length;
        for ( var sindex = 0; sindex < slength; sindex++ )  {
            var srec = selarray[sindex];
	    if ( srec.feature.parent() == rec.feature && srec.track == rec.track )  {
	        this._removeSelectionAt(sindex);
	        slength--;
	    }
        }

        // remove any parents of the selected feature (originating from same track)
        var parent = rec.feature.parent();
        if( parent )  {
	    this.removeFromSelection( { feature: parent, track: rec.track } );
        }
        selarray.push( rec );
        var lislength = this.listeners.length;
        for (var lindex = 0; lindex < lislength; lindex++)  {
	    var listener = this.listeners[lindex];
	    listener.selectionAdded( rec, this );
        }
        //    console.log("done calling FeatureselectionManager.addToSelection()");
    },

    /**
     *  attempting to remove a feature that isn't selected does nothing (and doesn't trigger listener calls)
     */
    removeFromSelection: function( rec )  {
        var index = this._indexOf( rec );
        if (index >= 0)  {
	    this._removeSelectionAt(index);
        }
    },

    _removeSelectionAt: function( index )  {
	var rec = this.selected[index];
        this.selected.splice(index, 1);
        var lislength = this.listeners.length;
        for (var lindex = 0; lindex<lislength; lindex++)  {
	    var listener = this.listeners[lindex];
	    listener.selectionRemoved(rec, this);
        }
    },

    _indexOf: function( rec ) {
        var index = -1;
        for( var i = 0; i < this.selected.length; i++ ) {
            if( this.selected[i].feature === rec.feature && this.selected[i].track == rec.track )
                index = i;
        }
        return index;
    },

    /**
     *  clearing an empty selection does nothing (and doesn't trigger listener calls)
     *
     *  intended for optimizing when selection is cleared, rather than
     *     multiple calls to removeSelectionAt (and subsequent multiple calls to listeners.selectionRemoved();
     */
    clearSelection: function()  {
        //    console.log("called FeatureselectionManager.clearSelection()");
        var previous_selected = this.selected;
        this.selected = [];
        var lislength = this.listeners.length;
        for (var lindex=0; lindex<lislength; lindex++)  {
    	var listener = this.listeners[lindex];
    	listener.selectionCleared(previous_selected, this);
        }
        /*
          for (var sindex in previous_selected)  {
          var feat = previous_selected[sindex];
          for (var lindex in this.listeners)  {
          var listener = this.listeners[lindex];
          listener.selectionRemoved(feat);
          }
          }
        */
        //  console.log("done calling FeatureselectionManager.clearSelection()");
    },

    isSelected: function( rec )  {
        return this._indexOf( rec ) >= 0;
    },

    /**
     * returns array of currently selected feature records { feature: feature, track: track }
     * this is a (shallow) copy of the selected array, therefore a snapshot of what is selected
     *     as of when getSelection is called
     *  so if selection changes, previous value returned from getSelection will not change
     */
    getSelection: function()  {
        //    return this.selected;
        //    return this.selected.slice(0);  // return shallow copy of array
        return this.selected.slice(0, this.selected.length);  // return shallow copy of array
    },

    /**
     *  since getSelection now returns feature records { feature: feature, track: track },
     *  also want a method that returns only the feautures (not wrapped in records)
     */
    getSelectedFeatures: function()  {
	var selfeats = new Array(this.selected.length);
	for (var i=0; i<this.selected.length; i++)  {
	    selfeats[i] = this.selected[i].feature;
	}
	return selfeats;
    },

    addListener: function( listener )  {
	var index = dojo.indexOf(this.listeners, listener);
	if( index < 0 )  {  // only add if not already in listener list
	    this.listeners.push(listener);
	}
    },

    removeListener: function( listener )  {
        var index = dojo.indexOf(this.listeners, listener);
        if( index >= 0 )  {  // only remove if already in listener list
	    this.listeners.splice(index, 1);
        }
    }
});
});


text:
from abc import ABCMeta, abstractmethod

class Disposable(object):
    """Abstract disposable class"""

    __metaclass__ = ABCMeta

    @abstractmethod
    def dispose(self):
        return NotImplemented

    def __enter__(self):
        """Context management protocol."""
        pass

    def __exit__(self, type, value, traceback):
        """Context management protocol."""
        self.dispose()


text:
<?php
/**
 * mucaptcha PHP lib. Procedural style.
 * @author Luis A. Leiva
 * @version 1.1.0
 */
function mucaptcha_verify($secret, $referer, $challenge, $strokes)
{
  if (empty($secret)) {
    throw new Exception("No secret key provided.");
  }
  if (empty($referer)) {
    throw new Exception("No referer provided.");
  }

  $url = 'https://api.mucaptcha.com/v1/verify';
  $fields = array(
    'secret'    => $secret,
    'referer'   => $referer,
    'challenge' => $challenge,
    'strokes'   => $strokes,
  );
  $response = mucaptcha_post_request($url, $fields);
  return json_decode($response);
}

// TODO: Provide alt. methods for servers without curl support.
function mucaptcha_post_request($url, $data)
{
  $options = array(
    CURLOPT_URL            => $url,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_SSL_VERIFYPEER => TRUE,
    CURLOPT_HEADER         => FALSE,
    CURLOPT_POST           => TRUE,
    CURLOPT_POSTFIELDS     => $data,
  );
  $ch = curl_init();
  curl_setopt_array($ch, $options);
  $content = curl_exec($ch);
  curl_close($ch);
  return $content;
}
?>


text:
package org.caleydo.data.importer.tcga;

import org.caleydo.core.util.color.AlexColorPalette;
import org.caleydo.core.util.color.Color;

/**
 * A list of different dataset types that we are able to load for TCGA and which have a grouping. These are the dataset
 * types that we want to compare between analysis runs.
 *
 * @author Marc Streit
 *
 */
public enum EDataSetType {

	mRNA("mRNA", AlexColorPalette.Medium.get().get(0)),
	mRNAseq("mRNA-seq", AlexColorPalette.Medium.get().get(0).darker()),
	microRNA("microRNA", AlexColorPalette.Medium.get().get(1)),
	microRNAseq("microRNA-seq", AlexColorPalette.Medium.get().get(1).darker()),
	methylation("Methylation", AlexColorPalette.Medium.get().get(2)),
	RPPA("RPPA", AlexColorPalette.Medium.get().get(3)),
	copyNumber("Copy Number", AlexColorPalette.Medium.get().get(4)),
	mutation("Mutations", AlexColorPalette.Medium.get().get(5)),
	clinical("Clinical", AlexColorPalette.Medium.get().get(6));

	private final Color color;

	private final String name;

	private EDataSetType(String name, Color color) {
		this.name = name;
		this.color = color;
	}

	/**
	 * @return the color, see {@link #color}
	 */
	public Color getColor() {
		return color;
	}

	/**
	 * @return the name, see {@link #name}
	 */
	public String getName() {
		return name;
	}

	public String getTCGAAbbr() {
		switch (this) {
		case copyNumber:
			return "CopyNumber";
		case mutation:
			return "Mutation";
		case clinical:
			return "Clinical";
		case mRNAseq:
			return "mRNAseq";
		case microRNA:
			return "miR";
		case microRNAseq:
			return "miRseq";
		default:
			return this.getName();
		}
	}
}


text:
package org.eclipse.collections.impl.map.mutable.primitive;

public class ObjectBooleanHashMapTest extends ObjectBooleanHashMapTestCase
{
    private final ObjectBooleanHashMap<String> map = this.classUnderTest();

    @Override
    protected ObjectBooleanHashMap<String> classUnderTest()
    {
        return ObjectBooleanHashMap.newWithKeysValues("0", true, "1", true, "2", false);
    }

    @Override
    protected <T> ObjectBooleanHashMap<T> newWithKeysValues(T key1, boolean value1)
    {
        return ObjectBooleanHashMap.newWithKeysValues(key1, value1);
    }

    @Override
    protected <T> ObjectBooleanHashMap<T> newWithKeysValues(T key1, boolean value1, T key2, boolean value2)
    {
        return ObjectBooleanHashMap.newWithKeysValues(key1, value1, key2, value2);
    }

    @Override
    protected <T> ObjectBooleanHashMap<T> newWithKeysValues(T key1, boolean value1, T key2, boolean value2, T key3, boolean value3)
    {
        return ObjectBooleanHashMap.newWithKeysValues(key1, value1, key2, value2, key3, value3);
    }

    @Override
    protected <T> ObjectBooleanHashMap<T> newWithKeysValues(T key1, boolean value1, T key2, boolean value2, T key3, boolean value3, T key4, boolean value4)
    {
        return ObjectBooleanHashMap.newWithKeysValues(key1, value1, key2, value2, key3, value3, key4, value4);
    }

    @Override
    protected <T> ObjectBooleanHashMap<T> getEmptyMap()
    {
        return new ObjectBooleanHashMap<>();
    }

    @Override
    protected <T> ObjectBooleanHashMap<T> newMapWithInitialCapacity(int size)
    {
        return new ObjectBooleanHashMap<>(size);
    }

    @Override
    protected Class<?> getTargetClass()
    {
        return ObjectBooleanHashMap.class;
    }
}


text:
/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#include "EzBakeBaseService.h"
#include "thrift/async/TAsyncChannel.h"

namespace ezbake { namespace base { namespace thrift {

uint32_t EzBakeBaseService_ping_args::read(::apache::thrift::protocol::TProtocol* iprot) {

  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    xfer += iprot->skip(ftype);
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

uint32_t EzBakeBaseService_ping_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("EzBakeBaseService_ping_args");

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

uint32_t EzBakeBaseService_ping_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("EzBakeBaseService_ping_pargs");

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

uint32_t EzBakeBaseService_ping_result::read(::apache::thrift::protocol::TProtocol* iprot) {

  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->success);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

uint32_t EzBakeBaseService_ping_result::write(::apache::thrift::protocol::TProtocol* oprot) const {

  uint32_t xfer = 0;

  xfer += oprot->writeStructBegin("EzBakeBaseService_ping_result");

  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_BOOL, 0);
    xfer += oprot->writeBool(this->success);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

uint32_t EzBakeBaseService_ping_presult::read(::apache::thrift::protocol::TProtocol* iprot) {

  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool((*(this->success)));
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

uint32_t EzBakeBaseService_ping_presult::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("EzBakeBaseService_ping_presult");

  xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_BOOL, 0);
  xfer += oprot->writeBool((*(this->success)));
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

uint32_t EzBakeBaseService_getMetricRegistryThrift_args::read(::apache::thrift::protocol::TProtocol* iprot) {

  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    xfer += iprot->skip(ftype);
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

uint32_t EzBakeBaseService_getMetricRegistryThrift_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("EzBakeBaseService_getMetricRegistryThrift_args");

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

uint32_t EzBakeBaseService_getMetricRegistryThrift_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("EzBakeBaseService_getMetricRegistryThrift_pargs");

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

uint32_t EzBakeBaseService_getMetricRegistryThrift_result::read(::apache::thrift::protocol::TProtocol* iprot) {

  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->success.read(iprot);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

uint32_t EzBakeBaseService_getMetricRegistryThrift_result::write(::apache::thrift::protocol::TProtocol* oprot) const {

  uint32_t xfer = 0;

  xfer += oprot->writeStructBegin("EzBakeBaseService_getMetricRegistryThrift_result");

  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0);
    xfer += this->success.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

uint32_t EzBakeBaseService_getMetricRegistryThrift_presult::read(::apache::thrift::protocol::TProtocol* iprot) {

  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += (*(this->success)).read(iprot);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

uint32_t EzBakeBaseService_getMetricRegistryThrift_presult::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("EzBakeBaseService_getMetricRegistryThrift_presult");

  xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0);
  xfer += (*(this->success)).write(oprot);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

bool EzBakeBaseServiceClient::ping()
{
  send_ping();
  return recv_ping();
}

void EzBakeBaseServiceClient::send_ping()
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("ping", ::apache::thrift::protocol::T_CALL, cseqid);

  EzBakeBaseService_ping_pargs args;
  args.write(oprot_);

  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}

bool EzBakeBaseServiceClient::recv_ping()
{

  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;

  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("ping") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  bool _return;
  EzBakeBaseService_ping_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();

  if (result.__isset.success) {
    return _return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "ping failed: unknown result");
}

void EzBakeBaseServiceClient::getMetricRegistryThrift( ::ezbake::base::thrift::metrics::MetricRegistryThrift& _return)
{
  send_getMetricRegistryThrift();
  recv_getMetricRegistryThrift(_return);
}

void EzBakeBaseServiceClient::send_getMetricRegistryThrift()
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("getMetricRegistryThrift", ::apache::thrift::protocol::T_CALL, cseqid);

  EzBakeBaseService_getMetricRegistryThrift_pargs args;
  args.write(oprot_);

  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}

void EzBakeBaseServiceClient::recv_getMetricRegistryThrift( ::ezbake::base::thrift::metrics::MetricRegistryThrift& _return)
{

  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;

  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("getMetricRegistryThrift") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  EzBakeBaseService_getMetricRegistryThrift_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();

  if (result.__isset.success) {
    // _return pointer has now been filled
    return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getMetricRegistryThrift failed: unknown result");
}

bool EzBakeBaseServiceProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) {
  ProcessMap::iterator pfn;
  pfn = processMap_.find(fname);
  if (pfn == processMap_.end()) {
    iprot->skip(::apache::thrift::protocol::T_STRUCT);
    iprot->readMessageEnd();
    iprot->getTransport()->readEnd();
    ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'");
    oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return true;
  }
  (this->*(pfn->second))(seqid, iprot, oprot, callContext);
  return true;
}

void EzBakeBaseServiceProcessor::process_ping(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("EzBakeBaseService.ping", callContext);
  }
  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "EzBakeBaseService.ping");

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "EzBakeBaseService.ping");
  }

  EzBakeBaseService_ping_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "EzBakeBaseService.ping", bytes);
  }

  EzBakeBaseService_ping_result result;
  try {
    result.success = iface_->ping();
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "EzBakeBaseService.ping");
    }

    ::apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("ping", ::apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "EzBakeBaseService.ping");
  }

  oprot->writeMessageBegin("ping", ::apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "EzBakeBaseService.ping", bytes);
  }
}

void EzBakeBaseServiceProcessor::process_getMetricRegistryThrift(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("EzBakeBaseService.getMetricRegistryThrift", callContext);
  }
  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "EzBakeBaseService.getMetricRegistryThrift");

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "EzBakeBaseService.getMetricRegistryThrift");
  }

  EzBakeBaseService_getMetricRegistryThrift_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "EzBakeBaseService.getMetricRegistryThrift", bytes);
  }

  EzBakeBaseService_getMetricRegistryThrift_result result;
  try {
    iface_->getMetricRegistryThrift(result.success);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "EzBakeBaseService.getMetricRegistryThrift");
    }

    ::apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("getMetricRegistryThrift", ::apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "EzBakeBaseService.getMetricRegistryThrift");
  }

  oprot->writeMessageBegin("getMetricRegistryThrift", ::apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "EzBakeBaseService.getMetricRegistryThrift", bytes);
  }
}

::boost::shared_ptr< ::apache::thrift::TProcessor > EzBakeBaseServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
  ::apache::thrift::ReleaseHandler< EzBakeBaseServiceIfFactory > cleanup(handlerFactory_);
  ::boost::shared_ptr< EzBakeBaseServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
  ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new EzBakeBaseServiceProcessor(handler));
  return processor;
}
void EzBakeBaseServiceCobClient::ping(tcxx::function<void(EzBakeBaseServiceCobClient* client)> cob)
{
  send_ping();
  channel_->sendAndRecvMessage(tcxx::bind(cob, this), otrans_.get(), itrans_.get());
}

void EzBakeBaseServiceCobClient::send_ping()
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("ping", ::apache::thrift::protocol::T_CALL, cseqid);

  EzBakeBaseService_ping_pargs args;
  args.write(oprot_);

  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}

bool EzBakeBaseServiceCobClient::recv_ping()
{

  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  bool completed = false;

  try {
    iprot_->readMessageBegin(fname, mtype, rseqid);
    if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
      ::apache::thrift::TApplicationException x;
      x.read(iprot_);
      iprot_->readMessageEnd();
      iprot_->getTransport()->readEnd();
      completed = true;
      completed__(true);
      throw x;
    }
    if (mtype != ::apache::thrift::protocol::T_REPLY) {
      iprot_->skip(::apache::thrift::protocol::T_STRUCT);
      iprot_->readMessageEnd();
      iprot_->getTransport()->readEnd();
      completed = true;
      completed__(false);
    }
    if (fname.compare("ping") != 0) {
      iprot_->skip(::apache::thrift::protocol::T_STRUCT);
      iprot_->readMessageEnd();
      iprot_->getTransport()->readEnd();
      completed = true;
      completed__(false);
    }
    bool _return;
    EzBakeBaseService_ping_presult result;
    result.success = &_return;
    result.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();

    if (result.__isset.success) {
      completed = true;
      completed__(true);
      return _return;
    }
    completed = true;
    completed__(true);
    throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "ping failed: unknown result");
  } catch (...) {
    if (!completed) {
      completed__(false);
    }
    throw;
  }
}

void EzBakeBaseServiceCobClient::getMetricRegistryThrift(tcxx::function<void(EzBakeBaseServiceCobClient* client)> cob)
{
  send_getMetricRegistryThrift();
  channel_->sendAndRecvMessage(tcxx::bind(cob, this), otrans_.get(), itrans_.get());
}

void EzBakeBaseServiceCobClient::send_getMetricRegistryThrift()
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("getMetricRegistryThrift", ::apache::thrift::protocol::T_CALL, cseqid);

  EzBakeBaseService_getMetricRegistryThrift_pargs args;
  args.write(oprot_);

  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}

void EzBakeBaseServiceCobClient::recv_getMetricRegistryThrift( ::ezbake::base::thrift::metrics::MetricRegistryThrift& _return)
{

  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  bool completed = false;

  try {
    iprot_->readMessageBegin(fname, mtype, rseqid);
    if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
      ::apache::thrift::TApplicationException x;
      x.read(iprot_);
      iprot_->readMessageEnd();
      iprot_->getTransport()->readEnd();
      completed = true;
      completed__(true);
      throw x;
    }
    if (mtype != ::apache::thrift::protocol::T_REPLY) {
      iprot_->skip(::apache::thrift::protocol::T_STRUCT);
      iprot_->readMessageEnd();
      iprot_->getTransport()->readEnd();
      completed = true;
      completed__(false);
    }
    if (fname.compare("getMetricRegistryThrift") != 0) {
      iprot_->skip(::apache::thrift::protocol::T_STRUCT);
      iprot_->readMessageEnd();
      iprot_->getTransport()->readEnd();
      completed = true;
      completed__(false);
    }
    EzBakeBaseService_getMetricRegistryThrift_presult result;
    result.success = &_return;
    result.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();

    if (result.__isset.success) {
      // _return pointer has now been filled
      completed = true;
      completed__(true);
      return;
    }
    completed = true;
    completed__(true);
    throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getMetricRegistryThrift failed: unknown result");
  } catch (...) {
    if (!completed) {
      completed__(false);
    }
    throw;
  }
}

void EzBakeBaseServiceAsyncProcessor::dispatchCall(tcxx::function<void(bool ok)> cob, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid) {
  ProcessMap::iterator pfn;
  pfn = processMap_.find(fname);
  if (pfn == processMap_.end()) {
    iprot->skip(::apache::thrift::protocol::T_STRUCT);
    iprot->readMessageEnd();
    iprot->getTransport()->readEnd();
    ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'");
    oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return cob(true);
  }
  (this->*(pfn->second))(cob, seqid, iprot, oprot);
  return;
}

void EzBakeBaseServiceAsyncProcessor::process_ping(tcxx::function<void(bool ok)> cob, int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot)
{
  EzBakeBaseService_ping_args args;
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("EzBakeBaseService.ping", NULL);
  }
  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "EzBakeBaseService.ping");

  try {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->preRead(ctx, "EzBakeBaseService.ping");
    }
    args.read(iprot);
    iprot->readMessageEnd();
    uint32_t bytes = iprot->getTransport()->readEnd();
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->postRead(ctx, "EzBakeBaseService.ping", bytes);
    }
  }
  catch (const std::exception&) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "EzBakeBaseService.ping");
    }
    return cob(false);
  }
  freer.unregister();
  void (EzBakeBaseServiceAsyncProcessor::*return_fn)(tcxx::function<void(bool ok)> cob, int32_t seqid, ::apache::thrift::protocol::TProtocol* oprot, void* ctx, const bool& _return) =
    &EzBakeBaseServiceAsyncProcessor::return_ping;
  iface_->ping(
      tcxx::bind(return_fn, this, cob, seqid, oprot, ctx, tcxx::placeholders::_1));
}

void EzBakeBaseServiceAsyncProcessor::return_ping(tcxx::function<void(bool ok)> cob, int32_t seqid, ::apache::thrift::protocol::TProtocol* oprot, void* ctx, const bool& _return)
{
  EzBakeBaseService_ping_presult result;
  result.success = const_cast<bool*>(&_return);
  result.__isset.success = true;

  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("EzBakeBaseService.ping", NULL);
  }
  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "EzBakeBaseService.ping");

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "EzBakeBaseService.ping");
  }

  oprot->writeMessageBegin("ping", ::apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  uint32_t bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "EzBakeBaseService.ping", bytes);
  }
  return cob(true);
}

void EzBakeBaseServiceAsyncProcessor::process_getMetricRegistryThrift(tcxx::function<void(bool ok)> cob, int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot)
{
  EzBakeBaseService_getMetricRegistryThrift_args args;
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("EzBakeBaseService.getMetricRegistryThrift", NULL);
  }
  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "EzBakeBaseService.getMetricRegistryThrift");

  try {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->preRead(ctx, "EzBakeBaseService.getMetricRegistryThrift");
    }
    args.read(iprot);
    iprot->readMessageEnd();
    uint32_t bytes = iprot->getTransport()->readEnd();
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->postRead(ctx, "EzBakeBaseService.getMetricRegistryThrift", bytes);
    }
  }
  catch (const std::exception&) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "EzBakeBaseService.getMetricRegistryThrift");
    }
    return cob(false);
  }
  freer.unregister();
  void (EzBakeBaseServiceAsyncProcessor::*return_fn)(tcxx::function<void(bool ok)> cob, int32_t seqid, ::apache::thrift::protocol::TProtocol* oprot, void* ctx, const  ::ezbake::base::thrift::metrics::MetricRegistryThrift& _return) =
    &EzBakeBaseServiceAsyncProcessor::return_getMetricRegistryThrift;
  iface_->getMetricRegistryThrift(
      tcxx::bind(return_fn, this, cob, seqid, oprot, ctx, tcxx::placeholders::_1));
}

void EzBakeBaseServiceAsyncProcessor::return_getMetricRegistryThrift(tcxx::function<void(bool ok)> cob, int32_t seqid, ::apache::thrift::protocol::TProtocol* oprot, void* ctx, const  ::ezbake::base::thrift::metrics::MetricRegistryThrift& _return)
{
  EzBakeBaseService_getMetricRegistryThrift_presult result;
  result.success = const_cast< ::ezbake::base::thrift::metrics::MetricRegistryThrift*>(&_return);
  result.__isset.success = true;

  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("EzBakeBaseService.getMetricRegistryThrift", NULL);
  }
  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "EzBakeBaseService.getMetricRegistryThrift");

  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "EzBakeBaseService.getMetricRegistryThrift");
  }

  oprot->writeMessageBegin("getMetricRegistryThrift", ::apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  uint32_t bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "EzBakeBaseService.getMetricRegistryThrift", bytes);
  }
  return cob(true);
}

::boost::shared_ptr< ::apache::thrift::async::TAsyncProcessor > EzBakeBaseServiceAsyncProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
  ::apache::thrift::ReleaseHandler< EzBakeBaseServiceCobSvIfFactory > cleanup(handlerFactory_);
  ::boost::shared_ptr< EzBakeBaseServiceCobSvIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
  ::boost::shared_ptr< ::apache::thrift::async::TAsyncProcessor > processor(new EzBakeBaseServiceAsyncProcessor(handler));
  return processor;
}
}}} // namespace


text:
package com.hendriksen.adapters;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.hendriksen.database.DatabaseHelper;
import com.hendriksen.model.Match;
import com.hendriksen.squashtracker.R;

import java.util.List;

/**
 * Custom adapter class for the History fragment.
 * This custom adapter formats the list based on the match.
 * @author Sam Hendriksen
 *
 */
public class HistoryAdapter extends ArrayAdapter<Match> {

	//Application context.
	private final Activity act;
	//Values to be shown in the log.
	private List<Match> values;

	public HistoryAdapter(Activity act, List<Match> values) {
		super(act, R.layout.terminal_list_item, values);
        this.act = act;
        this.values = values;
	}

    /**
     * Load our list values.
     */
    private void loadValues(){
        this.values = DatabaseHelper.getInstance(act).getAllMatches();
    }

	/**
	 * Override the getView method so that we can manipulate the view before it is drawn.
	 */
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) act
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View rowView = inflater.inflate(R.layout.history_list_item, parent, false);

		//Get the view elements.
        TextView tvScore = (TextView) rowView.findViewById(R.id.tvScore);
        TextView tvOpponentsName = (TextView) rowView.findViewById(R.id.tvOpponentsName);
        TextView tvDate = (TextView) rowView.findViewById(R.id.tvDate);

        int yourScore = values.get(position).getWins();
        int opponentsScore = values.get(position).getLosses();

		//Set the view values.
        tvScore.setText("" + yourScore + " - " + opponentsScore);
        tvOpponentsName.setText(values.get(position).getOpponentsName());
        tvDate.setText(values.get(position).getDateStarted());

        //Set the box colour depending on the highest score.
        if(yourScore > opponentsScore){
            //Win.
            tvScore.setBackgroundColor(act.getResources().getColor(R.color.green_end));
        }else if(yourScore < opponentsScore){
            //Loss.
            tvScore.setBackgroundColor(act.getResources().getColor(R.color.red_end));
        }else{
            //Draw.
            tvScore.setBackgroundColor(act.getResources().getColor(R.color.yellow_end));
        }

		return rowView;
	}

    /**
     * Get the amount of items in the list.
     * @return
     */
    public int getSize(){
        if(values != null){
            return values.size();
        }else{
            return 0;
        }
    }

    /**
     * Get a Match from the list.
     * @param index
     * @return Match object.
     */
    public Match getMatch(int index){
        if(values != null){
            return values.get(index);
        }else{
            return null;
        }
    }

    /**
     * Update the data in the list.
     */
    public void updateList(){
        //Makes changes first, then update.
        loadValues();
        notifyDataSetChanged();
    }
}


text:
order: 0
title:
  zh-CN: 禁用部分时间
  en-US: Type
---

## zh-CN

## en-US

````jsx
<v-time-picker @change="timePickerChange" :disabled-minutes="disabledMinutes" :disabled-seconds="disabledSeconds"></v-time-picker>
````

````vue-script
new Vue({
    el: 'body',
    components: {
      vTimePicker: atui.TimePicker
    },
    methods: {
      disabledMinutes: function() {
          return [...Array(60).keys()].filter(value => value % 10 !== 0)
      },
      disabledSeconds: function() {
          return [...Array(60).keys()].filter(value => value % 30 !== 0)
      },
      timePickerChange: function(date,timeString) {
          console.log('timepicker',date, timeString)
      }
    }
})
````


text:
A collection of graph algorithms implemented in C++. What's included:
* `graph.h` defines a simple data structure for graphs and several standard algorithms.
* `parse.h` provides a naive line-by-line parser for `.graphml` files. Beware: it only works
for a small subset of GraphML.
* `analyse.cpp` is a graph analyser, computing several metrics of a `.graphml` graph given
in the standard input.

## Build

To build the graph analyser run:
```
g++ -std=c++11 -O2 analyse.cpp -o analyse
```

## Run

Here is an example of running the graph analyser:
```
$ ./analyse < graph.graphml
Graph size: |V| = 1628, |E| = 53406.
Total number of reachable pairs of vertices: 2648756
Total distance between reachable pairs of vertices: 6759254
Radius: 3
Diameter: 5
Accumulated eccentricity: 6492
Runtime (microseconds): 190933
```
Here the _accumulated eccentricity_ is the sum of maximum distances from each node.

## Edge probabilities

You can specify the *edge probability* P that allows you to sample random subgraphs
from the analysed graph using the command-line flag `--edge-probability=P`. For
example:

```
$ ./analyse --edge-probability=0.9 < graph.graphml
Graph size: |V| = 1628, |E| = 48204.
Total number of reachable pairs of vertices: 2648756
Total distance between reachable pairs of vertices: 6910228
Radius: 3
Diameter: 6
Accumulated eccentricity: 6839
Runtime (microseconds): 176927
```

As you can see, the sampled subgraph contains only 48204 edges, which is
90.25% of all 53406 edges in the graph.

To write the resulting subgraph into a GraphML file, use command-line flag
`--write-file=FILENAME`, for example:
```
$ ./analyse --edge-probability=0.9 --write-file=subgraph.graphml < graph.graphml
```


text:
sh -e /etc/init.d/xvfb start
echo "echo \"127.0.0.1    test.example.com\" >> /etc/hosts" | sudo sh
sudo hostname test.example.com


text: Benchmark startup overhead introduced by profileinstaller's use of startup library


text:
<polymer-element name="optinomic-header" attributes="header patient">

    <template>
        <link rel="stylesheet" href="/styles/h5bp.css"></link>
        <link rel="stylesheet" href="/styles/components/components.css"></link>
        <link rel="stylesheet" href="/styles/main.css"></link>

            <template id="div_mytitle" if="{{header}}">

                    {{ mytitle }}
                    {{mytitle_small}}

            </template>
            <template if="{{patient.address1}}">

                    <core-icon icon="chevron-right"></core-icon>{{mysubtitle}}

            </template>

    </template>

</polymer-element>


text:
package com.stabilishednetwork.tatanpoker09.cob;

import java.io.File;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import com.stabilishednetwork.tatanpoker09.cob.commands.StartCommand;
import com.stabilishednetwork.tatanpoker09.cob.listeners.BlockListener;
import com.stabilishednetwork.tatanpoker09.cob.listeners.PlayerListener;
import com.stabilishednetwork.tatanpoker09.cob.utils.ScoreboardUtils;

/*TODO
 * KNOWN BUGS:
 * TNT SOMETIMES DISSAPEARS INSTEAD OF EXPLODING
 * PLAYERS FOODBAR SHOULD BE ALWAYS AT MAX.
 *
 */

public class Main extends JavaPlugin{
	private static final File mapsDirectory = new File("COBMaps/");
	private static World currentWorld;
	public void onEnable(){
		Map.loadMaps();
		PluginManager pm = Bukkit.getPluginManager();
		pm.registerEvents(new PlayerListener(), this);
		pm.registerEvents(new BlockListener(), this);
		getCommand("start").setExecutor(new StartCommand());
		loadMap(Map.getMaps().get(0));
	}
	public void onDisable(){

	}
	public static void loadMap(Map map){
		Map mapToLoad = Map.getMaps().get(0);
		Location center = ScoreboardUtils.getLocation(mapToLoad.getYml().getString("center"));
		Match.loadMatch(new Match(center, map));
	}
	public static File getMapsDirectory() {
		return mapsDirectory ;
	}
	public static World getCurrentWorld() {
		return currentWorld;
	}
	public static void setCurrentWorld(World worldToPlay) {
		currentWorld = worldToPlay;

	}
}


text:
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "NetSnmp" do

#  it "should get columns" do
#    Net::SNMP::Session.open(:peername => 'localhost', :version => '2c', :community => 'public') do |sess|
#      result = sess.get_columns(['ifIndex', 'ifInOctets', 'ifOutOctets'])
#      expect(result.size).to eql(7)
#      expect(result['1']['ifIndex']).to eql('1')
#      expect(result['2']['ifInOctets']).to be > 10
#    end
#  end

end


text:
package com.deleidos.rtws.webapp.caapi.servlet.enunciate;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.ws.rs.Path;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;

import org.apache.log4j.Logger;

import com.deleidos.rtws.ca.CertUtils;
import com.deleidos.rtws.ca.bo.CSR;
import com.deleidos.rtws.ca.bo.CSRResult;
import com.deleidos.rtws.ca.properties.CAProperties.CERT_TYPE;
import com.deleidos.rtws.ca.properties.CAProperties.SIGN_TYPE;
import com.deleidos.rtws.ca.util.StorageUtils;
import com.deleidos.rtws.commons.exception.PermissionDeniedException;
import com.deleidos.rtws.commons.model.response.ErrorResponse;
import com.deleidos.rtws.commons.model.response.PropertiesResponse;
import com.deleidos.rtws.commons.model.response.StandardResponse;
import com.deleidos.rtws.commons.util.HashUtil;
import com.deleidos.rtws.webapp.caapi.authorization.AuthorizationManager;

@Path ( "/cert" )
public class CertAuthorityServiceImpl implements CertAuthorityService {

	private static CertUtils certHandler;
	private static Logger log;

	public CertAuthorityServiceImpl(){
		try {
			log = Logger.getLogger(CertAuthorityServiceImpl.class);
			certHandler = new CertUtils();

		} catch (Exception ex) {
			log.error("Fail to initialize CertAuthorityService data structures. Message: " + ex.getMessage());
		}
	}

	@Override
	public StandardResponse<?> signCert(String request, String hash, String certFileName, String certType, String cn) {
		StandardResponse<String> ret = new StandardResponse<String>();

		if(AuthorizationManager.getInstance().validateHash(hash)){
			ret.setStandardHeaderCode(200);
			ret.setResponseBody(certHandler.signRequest(request, certFileName, CERT_TYPE.valueOf(certType), cn, SIGN_TYPE.cert));
		}else{
			ret.setStandardHeaderCode(403);
			ret.setResponseBody("Certificate Request was not accepted.");
		}
		return ret;
	}

	@Override
	public InputStream signPublicCert(String domain, String hash, String certFileName, String certType, String keyStore) throws PermissionDeniedException {
		InputStream is = null;
		if(AuthorizationManager.getInstance().validateHash(hash)){
			try{
				is = certHandler.signPublicCert(domain, certFileName, CERT_TYPE.valueOf(certType), keyStore, domain, SIGN_TYPE.cert);
			} catch(Exception e){
				log.error(e.toString() ,e);
			}
		}else{
			throw new PermissionDeniedException("Authorization denied to sign public certificate.");
		}

		return is;
	}

	@Override
	public InputStream getSigningCert() {
		InputStream is = null;
		try{
			is = StorageUtils.getTrustChain();
		} catch(Exception e){
			log.error(e.toString() ,e);
		}

		return is;
	}

	@Override
	public InputStream getPublicSigningCert() {
		InputStream is = null;
		try{
			is = StorageUtils.getPublicTrustChain();
		} catch(Exception e){
			log.error(e.toString() ,e);
		}

		return is;
	}

	@Override
	public StandardResponse<String> getHashValue(String uniqueValue) {
		try{
			StandardResponse<String> ret = new StandardResponse<String>();
			HashUtil hashUtil = new HashUtil();
			byte [] hash = hashUtil.hash(uniqueValue);
			String encodedHash = hashUtil.encode(hash);

			AuthorizationManager.getInstance().addValidHash(encodedHash);
			ret.setResponseBody(encodedHash);
			ret.setStandardHeaderCode(200);
			return ret;
		}
		catch(Exception e){
			log.error(e.toString(), e);
			return getErrorResponse(e.getMessage());
		}

	}

	@Override
	public StandardResponse<?> storeCert(InputStream is, String setupKey) {

		try {
			StorageUtils.encryptAndStoreCertificate(is);

			return getPropertyResponse();
		} catch (Exception ex) {
			log.error("fail to store certificate.", ex);
		}

		return getErrorResponse("Unable to store certificate.");

	}

	@Override
	public InputStream retrieveCert() {

		try {
			return StorageUtils.decryptAndRetrieveCertificate();
		} catch (Exception ex) {
			log.error("fail to retrieve certificate.", ex);

			ResponseBuilder responseBuilder = Response.status(Response.Status.BAD_REQUEST);
			responseBuilder.type(MediaType.TEXT_PLAIN_TYPE);
			responseBuilder.entity("Unable to retrieve certificate.");

			throw new WebApplicationException(responseBuilder.build());
		}

	}

	@Override
	public StandardResponse<?> storePrivateKey(InputStream is) {

		try {
			StorageUtils.encryptAndStoreCertificate(is);
			return getPropertyResponse();
		} catch (Exception ex) {
			log.error("fail to store private key.", ex);
		}

		return getErrorResponse("Unable to store private key.");

	}

	@Override
	public InputStream retrievePrivateKey() {

		try {
			return StorageUtils.decryptAndRetrievePrivateKey();
		} catch (Exception ex) {
			log.error("fail to retrieve private key.", ex);

			ResponseBuilder responseBuilder = Response.status(Response.Status.BAD_REQUEST);
			responseBuilder.type(MediaType.TEXT_PLAIN_TYPE);
			responseBuilder.entity("Unable to retrieve private key.");

			throw new WebApplicationException(responseBuilder.build());
		}

	}

	@Override
	public StandardResponse<?> storeTruststore(InputStream is) {

		try {
			StorageUtils.storeTruststore(is);
			return getPropertyResponse();
		} catch (Exception ex) {
			log.error("fail to store truststore.", ex);
		}

		return getErrorResponse("Unable to store truststore.");

	}

	@Override
	public InputStream retrieveTruststore() {

		try {
			return StorageUtils.retrieveTruststore();
		} catch (Exception ex) {
			log.error("fail to retrieve truststore.", ex);

			ResponseBuilder responseBuilder = Response.status(Response.Status.BAD_REQUEST);
			responseBuilder.type(MediaType.TEXT_PLAIN_TYPE);
			responseBuilder.entity("Unable to retrieve truststore.");

			throw new WebApplicationException(responseBuilder.build());
		}

	}

	@Override
	public InputStream retrieveKeystore() {

		try {
			return StorageUtils.retrieveKeystore();
		} catch (Exception ex) {
			log.error("fail to retrieve keystore.", ex);

			ResponseBuilder responseBuilder = Response.status(Response.Status.BAD_REQUEST);
			responseBuilder.type(MediaType.TEXT_PLAIN_TYPE);
			responseBuilder.entity("Unable to retrieve keystore.");

			throw new WebApplicationException(responseBuilder.build());
		}

	}

	private PropertiesResponse getPropertyResponse(){
		PropertiesResponse response = new PropertiesResponse();
		response.setStandardHeaderCode(200);
		response.setProperty("Status", "true");

		return response;
	}

	private ErrorResponse getErrorResponse(String message){
		ErrorResponse response = new ErrorResponse();
		response.setStandardHeaderCode(500);
		response.setMessage(message);

		return response;
	}

	@Override
	public Collection<String> getFiles() {
		Collection<String> collection = null;
		try{
			List<String> files = StorageUtils.listFiles();
			collection = new ArrayList<String>(files);
		} catch(Exception e){
			log.error(e.toString(), e);
		}
		return collection;
	}

	@Override
	public StandardResponse<?> signAll(String privateDomainCsr, String privateDomainUniqueCn, String signType, String setupKey) {

		StandardResponse<CSRResult> ret = new StandardResponse<CSRResult>();
		try{

		if(AuthorizationManager.getInstance().validateHash(setupKey)){
			ret.setStandardHeaderCode(200);

			CSR csr = new CSR();
			csr.setPrivateDomainCsr(privateDomainCsr);
			csr.setUniquePrivateDomainCn(privateDomainUniqueCn);

			CSRResult csrResult = certHandler.processCsrRequests(csr, SIGN_TYPE.valueOf(signType));

			HashUtil hashUtil = new HashUtil();
			byte [] hash = hashUtil.hash(String.valueOf(System.currentTimeMillis()));
			String encodedHash = hashUtil.encode(hash);

			csrResult.setSetupKeyForPublicCert(encodedHash);
			AuthorizationManager.getInstance().addValidHash(encodedHash);

			ret.setResponseBody(csrResult);

		}else{
			ret.setStandardHeaderCode(403);
			ret.setResponseBody(new CSRResult());
		}
		}catch(Exception e){
			log.error(e.toString(), e);
			ret.setStandardHeaderCode(500);
			ret.setResponseBody(new CSRResult());
		}

		return ret;
	}

}


text:
Update User

    <form action="<?php echo site_url('users/update/'.$user->id) ?>" method="POST">
        Username
        <input type="text" name="username" value="<?php echo $user->username?>">
        Password
        <input type="password" name="password" value="<?php echo $user->password?>">
        Email
        <input type="text" name="email" value="<?php echo $user->email?>">
        <input type="submit" name="submit" value="Update">
    </form>


text:
namespace base {
class Value;
}

namespace content_settings {

// Converts |value| to |ContentSetting|.
ContentSetting ValueToContentSetting(const base::Value& value);

// Returns a base::Value representation of |setting| if |setting| is
// a valid content setting. Otherwise, returns an empty value.
base::Value ContentSettingToValue(ContentSetting setting);

// Adaptor for converting from the new way of base::Value to the old one.
// Like base::Value::ToUniquePtrValue but converts NONE-type values to nullptr.
std::unique_ptr<base::Value> ToNullableUniquePtrValue(base::Value value);
// Adaptor for converting from the old way of base::Value to the new one.
// Like base::Value::FromUniquePtrValue but converts nullptr to NONE-type value.
base::Value FromNullableUniquePtrValue(std::unique_ptr<base::Value> value);

// Whether |primary_pattern| and |secondary_pattern| pair applies to a single
// origin.
bool PatternAppliesToSingleOrigin(
    const ContentSettingsPattern& primary_pattern,
    const ContentSettingsPattern& secondary_pattern);

}  // namespace content_settings

#endif  // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_UTILS_H_


text:
package sos.fire_v2.base.worldmodel;

import java.util.ArrayList;

import sos.base.entities.Building;
import sos.base.entities.Road;
import sos.base.util.geom.ShapeInArea;
import sos.base.util.sosLogger.SOSLoggerSystem;
import sos.base.util.sosLogger.SOSLoggerSystem.OutputType;
import sos.fire_v2.FireBrigadeAgent;
import sos.fire_v2.base.tools.BuildingBlock;
import sos.fire_v2.base.tools.FireBuilding;
import sos.fire_v2.base.worldmodel.FireWorldModel.SystemType;

public class FirePrecompute {

	public enum Mode {
		Compute, ReadFromFile
	};

	private FireWorldModel world;
	private FireBrigadeAgent owner;

	// Morteza2011************************************************************************************************************
	public FirePrecompute(FireWorldModel world) {
		this.world = world;
		this.owner = world.owner();
	}

	/** @author Hesam 002 & Morteza2011 & nima */
	public void execute() {
		long FPTimeS = System.currentTimeMillis();
		world.al = new SOSLoggerSystem(owner.me(), "Agent/FireBrigade/" + SystemType.Agent.toString(), true, OutputType.File, true);
		world.al.consoleInfo("Start of Fire PreCompute...");
		long startTime = System.currentTimeMillis();
		world.wl = new SOSLoggerSystem(owner.me(), "Agent/FireBrigade/" + SystemType.World.toString(), true, OutputType.File, true);
		world.fzl = new SOSLoggerSystem(owner.me(), "Agent/FireBrigade/" + SystemType.FireZone.toString(), true, OutputType.File, true);
		world.bl = new SOSLoggerSystem(owner.me(), "Agent/FireBrigade/" + SystemType.Building.toString(), true, OutputType.File, true);

		setFireBuildings();
		world.al.consoleInfo("setFireBuildings got: " + (System.currentTimeMillis() - startTime) + "ms");
		startTime = System.currentTimeMillis();
		setExtinguishableAreas();
		world.al.consoleInfo("setExtinguishableArea: " + (System.currentTimeMillis() - startTime) + "ms");
		startTime = System.currentTimeMillis();
		makeBuildingBlocks(); // nima
		world.al.consoleInfo("makeBuildingBlocks got: " + (System.currentTimeMillis() - startTime) + "ms");
		startTime = System.currentTimeMillis();
		makeIslands(); // nima
		world.al.consoleInfo("makeIslands got: " + (System.currentTimeMillis() - startTime) + "ms");
		startTime = System.currentTimeMillis();
		world.al.consoleInfo("Fire PreComput Time: " + (System.currentTimeMillis() - FPTimeS) + "ms ------------------------");
		setVisiblityForRoads();

	}

	private void setExtinguishableAreas() {

		for (Building b : world.buildings()) {
			b.getFireBuilding().getExtinguishableArea();
			//			b.getFireBuilding().getExtinguishableBuildingsDistanceShapeInArea();
			//			if (b.getFireBuilding().getExtinguishableArea().canExtinguish.isEmpty() && b.getFireBuilding().getExtinguishableRoadsDistanceShapeInArea().isEmpty()) {
			//				world.al.error("why it come here????" + b + " both ExtinguishableBuildings and ExtinguishableRoads are empty");
			//			}
		}
	}

	private void setVisiblityForRoads() {
		for (Building b : world.buildings()) {

			for (ShapeInArea a : b.fireSearchBuilding().sensibleAreasOfAreas())
				if (a.getArea(world) instanceof Road)
					((Road) a.getArea(world)).visibleBuilding().add(b);
		}

	}
	// Morteza2011**************************************************************************************************************
	private void setFireBuildings() {
		ArrayList<FireBuilding> fireBuildings = new ArrayList<FireBuilding>();
		for (Building b : world.buildings()) {
			FireBuilding fb = new FireBuilding(world, b);
			b.setFireBuilding(fb);
			fireBuildings.add(fb);
		}
		world.setFireBuildings(fireBuildings);
	}

	// Morteza2011**************************************************************************************************************
	private void makeBuildingBlocks() {
		ArrayList<Building> allBuildings = new ArrayList<Building>(world.buildings());
		while (allBuildings.size() > 0) {
			BuildingBlock bb = new BuildingBlock(world);
			allBuildings = bb.makeByRoad(Mode.Compute, allBuildings);
			if (bb.buildings().size() > 0)
				world.buildingBlocks().add(bb);
		}
		for (BuildingBlock bb : world.buildingBlocks())
			bb.setBuildingBlockNeighbors();
		for (BuildingBlock bb : world.buildingBlocks())
			bb.setImportanceB();
	}

	// Morteza2011**************************************************************************************************************
	private void makeIslands() {
		ArrayList<Building> allBuildings = new ArrayList<Building>(world.buildings());
		while (allBuildings.size() > 0) {
			BuildingBlock bb = new BuildingBlock(world);
			allBuildings = bb.makeByDistance(Mode.Compute, allBuildings);
			if (bb.buildings().size() > 0) {
				world.islands().add(bb);
			}
		}
		for (BuildingBlock bb : world.islands())
			bb.setIslandNeighbors();
		for (BuildingBlock bb : world.islands())
			bb.setImportanceI();
	}

}


text:
package lykrast.eirinislegacy.common.world;

import java.util.Random;

import com.google.common.base.Predicate;

import lykrast.eirinislegacy.common.block.BlockAnimiteOre;
import lykrast.eirinislegacy.common.init.ModBlocks;
import lykrast.eirinislegacy.common.util.Config;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.pattern.BlockMatcher;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraftforge.fml.common.IWorldGenerator;

public class WorldGenOre implements IWorldGenerator {

	public WorldGenOre() {
	}

	@Override
	public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
	{
		//Only generate in Overworld for now
		if (world.provider.getDimension() == 0)
		{
			genOverworld(world, random, chunkX, chunkZ);
		}
	}

	private void genOverworld(World world, Random random, int chunkX, int chunkZ)
	{
		addOreSpawnPetra(ModBlocks.petramite.getDefaultState(), world, random, chunkX, chunkZ, 16, 16,
				Config.genPetramiteMaxVein, Config.genPetramiteCount, Config.genPetramiteMinY, Config.genPetramiteMaxY, BlockMatcher.forBlock(Blocks.STONE));
		addOreSpawn(ModBlocks.animiteOre.getDefaultState(), world, random, chunkX, chunkZ, 16, 16,
				Config.genAnimiteMaxVein, Config.genAnimiteCount, Config.genAnimiteMinY, Config.genAnimiteMaxY, BlockMatcher.forBlock(Blocks.STONE));
	}

	private void addOreSpawnPetra(IBlockState block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ,
			int maxVeinSize, int chance, int minY, int maxY, Predicate<IBlockState> blockToSpawnIn)
	{
		int diffY = maxY - minY;
		for (int i=0;i<chance;i++)
		{
			int posX = blockXPos * 16 + random.nextInt(maxX);
			int posY = minY + random.nextInt(diffY);
			int posZ = blockZPos * 16 + random.nextInt(maxZ);
			new WorldGenMinable(block, maxVeinSize, blockToSpawnIn).generate(world, random, new BlockPos(posX, posY, posZ));

			if (Config.genAnimitePetramiteChance > 0 && Config.genAnimitePetramiteMaxVein > 0 && random.nextInt(Config.genAnimitePetramiteChance) == 0)
			{
				new WorldGenMinable(ModBlocks.animiteOre.getDefaultState().withProperty(BlockAnimiteOre.VARIANT, BlockAnimiteOre.VariantsAnimiteOre.PETRAMITE),
						Config.genAnimitePetramiteMaxVein, BlockMatcher.forBlock(ModBlocks.petramite)).generate(world, random, new BlockPos(posX, posY, posZ));
			}
		}
	}

	private void addOreSpawn(IBlockState block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ,
			int maxVeinSize, int chance, int minY, int maxY, Predicate<IBlockState> blockToSpawnIn)
	{
		int diffY = maxY - minY;
		for (int i=0;i<chance;i++)
		{
			int posX = blockXPos * 16 + random.nextInt(maxX);
			int posY = minY + random.nextInt(diffY);
			int posZ = blockZPos * 16 + random.nextInt(maxZ);
			new WorldGenMinable(block, maxVeinSize, blockToSpawnIn).generate(world, random, new BlockPos(posX, posY, posZ));
		}
	}

	private void addOreSpawn(IBlockState block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ,
			int maxVeinSize, float chance, int minY, int maxY, Predicate<IBlockState> blockToSpawnIn)
	{
		if (chance >= 1) addOreSpawn(block, world, random, blockXPos, blockZPos, maxX, maxZ, maxVeinSize, Math.round(chance), minY, maxY, blockToSpawnIn);
		else
		{
			if (random.nextFloat() <= chance)
				addOreSpawn(block, world, random, blockXPos, blockZPos, maxX, maxZ, maxVeinSize, 1, minY, maxY, blockToSpawnIn);
		}
	}

}


text:
[![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat
)](https://developer.apple.com/iphone/index.action)
[![Language](http://img.shields.io/badge/language-objc-brightgreen.svg?style=flat
)](https://developer.apple.com/swift)
[![Version](https://img.shields.io/cocoapods/v/SABlurImageViewObjc.svg?style=flat)](http://cocoapods.org/pods/SABlurImageView)
[![License](https://img.shields.io/cocoapods/l/SABlurImageViewObjc.svg?style=flat)](http://cocoapods.org/pods/SABlurImageView)

![](./SampleImage/sample.gif)

This is Objective-C version of [SABlurImageView](https://github.com/szk-atmosphere/SABlurImageView).

You can use blur effect and it's animation easily to call only two methods.

## Features

- [x] Blur effect with box size
- [x] Blur animation
- [x] 0.0 to 1.0 parameter blur

## Installation

#### CocoaPods

SABlurImageView is available through [CocoaPods](http://cocoapods.org). If you have cocoapods 0.36.0 or greater, you can install
it, simply add the following line to your Podfile:

    pod "SABlurImageViewObjc"

#### Manually

Add the [SABlurImageViewObjc](./SABlurImageViewObjc) directory to your project.

## Usage

To run the example project, clone the repo, and run `pod install` from the Example directory first.

You have to write `#import "SABlurImageView.h"`.

If you want to apply blur effect for image

```objective-c
	SABlurImageView *imageView = [[SABlurImageView alloc] initWithImage:image];
	[imageView addBlurEffect:30.0f times:1];
```

If you want to animate

```objective-c
	SABlurImageView *imageView = [[SABlurImageView alloc] initWithImage:image];
	[imageView configrationForBlurAnimation:100.0f];
	[imageView startBlurAnimation:2.0f];
```

First time of blur animation is normal to blur. Second time is blur to normal. (automatically set configration of reverse animation)

If you want to use 0.0 to 1.0 parameter

```objective-c
	SABlurImageView *imageView = [[SABlurImageView alloc] initWithImage:image];
	[imageView configrationForBlurAnimation:100.0f];
	[imageView blur:0.5f];
```

## Installation

SABlurImageViewObjc is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "SABlurImageViewObjc"
```
## Requirements

- Xcode 6.3 or greater
- iOS7.0(manually only) or greater
- QuartzCore
- Accelerate

## Author

Taiki Suzuki, s1180183@gmail.com

## License

SABlurImageView is available under the MIT license. See the LICENSE file for more info.


text:
using UnityEngine;

public class NodeMaster : MonoBehaviour {

    public static Transform[] nodes;

    void Awake()
    {
        var nodes = new Transform[transform.childCount];
        for (int i = 0; i < nodes.Length; i++)
        {
            nodes[i] = transform.GetChild(i);
        }
    }
}


text:
require "google/cloud/spanner"
require "google/cloud/spanner/admin/database"

def postgresql_create_database project_id:, instance_id:, database_id:
  # project_id  = "Your Google Cloud project ID"
  # instance_id = "Your Spanner instance ID"
  # database_id = "Your Spanner database ID"

  database_admin_client = Google::Cloud::Spanner::Admin::Database.database_admin project: project_id

  instance_path = database_admin_client.instance_path project: project_id, instance: instance_id

  job = database_admin_client.create_database parent: instance_path,
                                              create_statement: "CREATE DATABASE \"#{database_id}\"",
                                              database_dialect: :POSTGRESQL

  puts "Waiting for create database operation to complete"

  job.wait_until_done!

  puts "Created database #{database_id} on instance #{instance_id}"
end
# [END spanner_postgresql_create_database]

if $PROGRAM_NAME == __FILE__
  postgresql_create_database project_id: ARGV.shift, instance_id: ARGV.shift, database_id: ARGV.shift
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>OpenCV::restore() \ language (API)</title>

OPENCV

/ references

				Name
				restore()

				Examples

import hypermedia.video.*;

OpenCV opencv;

size( 640, 480 );

opencv = new OpenCV(this);
opencv.loadImage( "hypermedia_robot.jpg" );
opencv.convert( OpenCV.GRAY );    // convert to gray
image( opencv.image(), 0, 0 );    // display the result
opencv.restore();                 // revert to RGB
image( opencv.image(), 320, 0 );  // display the result

				Description
				Revert to the original image.
 By default returns to RGB image, or GRAY (if specified).

				Syntax
				restore();
restore(type);

				Parameters

							type
							int : the target color space : RGB or GRAY

				Return
				None

				Usage
				Application

				Related
				blobs()


text:
- Fix CheckListingOnHostPort
- Warnings do not count for total failures
### 2.12.0
- Added CheckListingOnHostPort
- Added CheckEnvironmentProperty
### 2.11.0
- OGNL and Javassist are now shaded into selfdiagnose. This solves dependency conflict issues.
### 2.10.1
- Read version from pom.properties
- fix problem with override task config
### 2.10.0
- Prevent `java.lang.OutOfMemoryError: unable to create new native thread` that might happen if diagnostic tasks do not complete within a timeout period
### 2.9.0
- adds "checks" and "failures" attributes to JSON and XML reporter, just like HTML
### 2.8.8
- replaced usage of reflection method with a cast to the correct type in ReportMavenPOMProperties
### 2.8.7
- changed msg of environment property checker
### 2.8.6
- fixed since
### 2.8.5
- add remoteConfigurationAllowed = false
- no duplicate content-type header fix (by soudmaijer)
### 2.8.2
- fixed a security issue related to OGNL expression usage (https://www.intelligentexploit.com/view-details.html?id=17155)


text:
@implementation UIFont (LondrinaShadow)

+ (instancetype)londrinaShadowRegularFontOfSize:(CGFloat)size {
  static dispatch_once_t onceToken;
  [GFIFontLoader loadFontFile:@"LondrinaShadow-Regular"
                   fromBundle:@"LondrinaShadow"
                    onceToken:&onceToken];
  return [self fontWithName:@"LondrinaShadow-Regular" size:size];
}

@end


text:
"""Tests for the models of the freckle_budgets app."""
import datetime

from django.test import TestCase

from mixer.backend.django import mixer

from . import fixtures
from .. import models

class EmployeeTestCase(TestCase):
    """Tests for the ``Employee`` model."""
    longMessage = True

    def test_class(self):
        obj = mixer.blend('freckle_budgets.Employee')
        self.assertTrue(obj.pk, msg=('Object can be saved'))
        self.assertEqual(obj.__str__(), str(obj.name), msg=(
            '__str__ should return correct string'))

    def test_get_employee_project_months(self):
        fixtures.create_employee_project_months(self)
        result = self.employee1.get_employee_project_months(self.month)
        self.assertEqual(result.count(), 1, msg=(
            'Should return the projects this employee is responsible for'
            ' during this month'))

class FreeTimeTestCase(TestCase):
    """Tests for the ``FreeTime`` model."""
    longMessage = True

    def test_class(self):
        obj = mixer.blend('freckle_budgets.FreeTime')
        self.assertTrue(obj.pk, msg=('Object can be saved'))
        expected = '{0} - {1}'.format(obj.employee, obj.day)
        self.assertEqual(obj.__str__(), expected, msg=(
            '__str__ should return correct string'))

class YearTestCase(TestCase):
    """Tests for the ``Year`` model."""
    longMessage = True

    def test_model(self):
        obj = mixer.blend('freckle_budgets.Year')
        self.assertTrue(obj.pk, msg=('Object can be saved'))
        self.assertEqual(obj.__str__(), str(obj.year), msg=(
            '__str__ should return correct string'))

    def test_get_total_cashflow_budget(self):
        fixtures.create_project_months(self)
        result = self.year.get_total_cashflow_budget()
        self.assertEqual(result, 3000, msg=(
            'Should add up all planned budgets for all projects that have'
            ' is_investment==False for this year'))

    def test_get_total_investment_budget(self):
        fixtures.create_project_months(self)
        result = self.year.get_total_investment_budget()
        self.assertEqual(result, 4000, msg=(
            'Should add up all planned budgets for all projects that have'
            ' is_investment==True for this year'))

    def test_get_total_unused_budget(self):
        fixtures.create_project_months(self)
        result = self.year.get_total_unused_budget()
        self.assertEqual(result, 31000, msg=(
            'Should add up all unused budgets for all months of the year'))

class MonthManagerTestCase(TestCase):
    """Tests for the ``MonthManager`` model manager."""
    longMessage = True

    def test_get_months_with_projects(self):
        fixtures.create_project_months(self)
        mixer.blend('freckle_budgets.Month', month=3, year=self.year)

        manager = models.Month.objects
        result = manager.get_months_with_projects(2015)
        self.assertEqual(result.count(), 2, msg=(
            'Should return all months that have a project'))

class MonthTestCase(TestCase):
    """Tests for the ``Month`` model."""
    longMessage = True

    def test_model(self):
        obj = mixer.blend('freckle_budgets.Month')
        self.assertTrue(obj.pk, msg=('Obj can be saved'))

        expected = '{0} {1}'.format(obj.month, obj.year)
        self.assertEqual(obj.__str__(), expected, msg=(
            '__str__ should return correct string'))

    def test_get_available_ressources(self):
        fixtures.create_month(self)
        result = self.month.get_available_ressources()
        self.assertEqual(result, 190, msg=(
            'January has 22 work days. Minus holidays, vacations and sick'
            ' leave, 19 days remain. Multiplied with the daily hours (5) and'
            ' number of employees (2), the result should be 19 * 5 * 2 = 190'))

    def test_get_available_ressources_max(self):
        fixtures.create_month(self)
        result = self.month.get_available_ressources_max()
        self.assertEqual(result, 210, msg=(
            'January has 22 work days. Minus holidays, 21 days remain.'
            ' Multiplied with the daily hours (5) and number of employees (2),'
            ' the result should be 21 * 5 * 2 = 210'))

    def test_get_available_ressources_max_per_person(self):
        fixtures.create_month(self)
        result = self.month.get_available_ressources_max_per_person()
        self.assertEqual(result, 105, msg=(
            'January has 22 work days. Minus holidays, 21 days remain.'
            ' Multiplied with the daily hours (5) the result should be'
            ' 21 * 5 = 105'))

    def test_get_average_rate(self):
        fixtures.create_project_months(self)
        result = self.month.get_average_rate()
        self.assertEqual(result, 100, msg=(
            'Should divide the total profit by the total cashflow hours'))

    def test_get_cashflow_projects(self):
        fixtures.create_project_months(self)
        result = self.month.get_cashflow_projects()
        self.assertEqual(result.count(), 1, msg=(
            'Should return all projects that have is_investment=False'))
        self.assertFalse(result[0].project.is_investment, msg=(
            'Should return all projects that have is_investment=False'))

    def test_get_date(self):
        fixtures.create_month(self)
        result = self.month.get_date()
        expected = datetime.date(2015, 1, 1)
        self.assertEqual(result, expected, msg=(
            'Should return a date object for this month'))

    def test_get_employees(self):
        fixtures.create_employee_project_months(self)
        result = self.month.get_employees()
        self.assertEqual(result.count(), 2, msg=(
            'Should return all employees that have projects in this month'))

    def test_get_employee_public_holiday_days(self):
        fixtures.create_employee_project_months(self)
        result = self.month.get_employee_public_holiday_days(self.employee1)
        self.assertEqual(result.count(), 1, msg=(
            'Should return public holidays for given employee and month'))

    def test_get_employee_sick_leave_days(self):
        fixtures.create_employee_project_months(self)
        result = self.month.get_employee_sick_leave_days(self.employee1)
        self.assertEqual(result.count(), 1, msg=(
            'Should return sick leave days for given employee and month'))

    def test_get_employee_vacation_days(self):
        fixtures.create_employee_project_months(self)
        result = self.month.get_employee_vacation_days(self.employee1)
        self.assertEquals(result.count(), 1, msg=(
            'Should return vacation days for the given employee and month'))

    def test_get_free_time_for_employee(self):
        fixtures.create_employee_project_months(self)
        result = self.month.get_free_time_for_employee(self.employee1)
        self.assertEqual(result.count(), 3, msg=(
            'Should return all FreeTime objects for this month and employee'))

    def test_get_investment_projects(self):
        fixtures.create_project_months(self)
        result = self.month.get_investment_projects()
        self.assertEqual(result.count(), 1, msg=(
            'Should return all projects that have is_investment=True'))
        self.assertTrue(result[0].project.is_investment, msg=(
            'Should return all projects that have is_investment=True'))

    def test_get_total_cashflow_hours(self):
        fixtures.create_project_months(self)
        result = self.month.get_total_cashflow_hours()
        self.assertEqual(result, 10, msg=(
            'Should add up all budget hours for each cashflow project (the'
            ' hours that can be spend on projects for the given budget and'
            ' rate)'))

    def test_get_total_investment_hours(self):
        fixtures.create_project_months(self)
        result = self.month.get_total_investment_hours()
        self.assertEqual(result, 20, msg=(
            'Should add up all budget hours for each investment project (the'
            ' hours that can be spend on projects for the given budget and'
            ' rate)'))

    def test_get_total_investment(self):
        fixtures.create_project_months(self)
        result = self.month.get_total_investment()
        self.assertEqual(result, 4000, msg=(
            'Should add up all budgets for all investment projects.'))

    def test_get_total_profit(self):
        fixtures.create_project_months(self)
        result = self.month.get_total_profit()
        self.assertEqual(result, 1000, msg=(
            'Should add up all budgets for all cashflow projects.'))

    def test_get_unused_hours(self):
        fixtures.create_project_months(self)
        result = self.month.get_unused_hours()
        self.assertEqual(result, 160, msg=(
            'Should add up all budget hours for all projects in this month,'
            ' then substract this from the total available ressources of this'
            ' month.'))

    def test_get_unused_daily_hours(self):
        fixtures.create_project_months(self)
        result = self.month.get_unused_daily_hours()
        self.assertEqual(result, 160.0 / 19, msg=(
            'Should take the total unused hours and divide them by the number'
            ' of work days in this month'))

    def test_get_unused_budget(self):
        fixtures.create_project_months(self)
        result = self.month.get_unused_budget()
        self.assertEqual(result, 160.0 * 100, msg=(
            'Should multiply the unused hours with the default rate for this'
            ' year.'))

    def test_get_weekdays(self):
        fixtures.create_month(self)
        result = self.month.get_weekdays()
        self.assertEqual(result, 22, msg=(
            'Should return 22 weekdays for January 2015'))

    def test_get_work_days(self):
        fixtures.create_month(self)
        result = self.month.get_work_days()
        self.assertEqual(result, 19, msg=(
            'January has 22 work days. Minus one public holiday. Minus 1'
            ' vacation day (12 / 12). Minus one sick leave day (12 / 12).'
            ' Therefore, the result should be 22 - 1 - 1 -1 = 19'))

        result = self.month.get_work_days(minus_sick_leave=False)
        self.assertEqual(result, 20, msg=(
            'Like above, but this time we do not substract the sick-leave'
            ' days'))

        result = self.month.get_work_days(
            minus_sick_leave=False, minus_vacations=False)
        self.assertEqual(result, 21, msg=(
            'Like above, but this time we do not substract the sick-leave'
            ' and vacation days'))

    def test_get_work_days_max(self):
        fixtures.create_month(self)
        result = self.month.get_work_days_max()
        self.assertEqual(result, 21, msg=(
            'January has 22 work days. Minus public holidays, the result'
            ' should be 21'))

    def test_get_workload(self):
        fixtures.create_employee_project_months(self)
        result = self.month.get_workloads()
        expected = self.project_month1_1.get_daily_hours()
        self.assertEqual(
            result[self.employee1.freckle_id]['cashflow_workload'], expected,
            msg=('When the employee has 100% responsibility for the project,'
                 ' the result should equal the daily hours for that project'
                 ' in this month'))

        expected = self.project_month1_2.get_daily_hours() * 0.5
        self.assertEqual(
            result[self.employee2.freckle_id]['investment_workload'], expected,
            msg=('When the employee has 50% responsibility for the project,'
                 ' the result should equal 50% of the daily hours for that'
                 ' project in this month'))

class ProjectManagerTestCase(TestCase):
    """Tests for the ``ProjectManager`` model manager."""
    longMessage = True

    def test_get_for_year(self):
        fixtures.create_project_months(self)
        mixer.blend(
            'freckle_budgets.Project', freckle_project_id='101')
        manager = models.Project.objects
        result = manager.get_for_year(2015)
        self.assertEqual(result.count(), 2, msg=(
            'Should return all projects that have ProjectMonth instances for'
            ' the given year'))

class ProjectTestCase(TestCase):
    """Tests for the ``Project`` model."""
    longMessage = True

    def test_model(self):
        obj = mixer.blend('freckle_budgets.Project')
        self.assertTrue(obj.pk, msg=('Object can be saved'))
        self.assertEqual(obj.__str__(), obj.name, msg=(
            '__str__ should return correct string'))

class ProjectMonthManagerTestCase(TestCase):
    """Tests for the ``ProjectManager` model manager."""
    longMessage = True

    def test_get_project_months(self):
        fixtures.create_project_months(self)
        mixer.blend('freckle_budgets.Month', month=2, year__year=2015)
        manager = models.ProjectMonth.objects
        result = manager.get_project_months(2015)
        self.assertEqual(result[0][0], self.month, msg=(
            'Should return a list of lists. The inner lists consist of a month'
            ' and a list of projects for this month.'))

    def test_get_freckle_projects(self):
        fixtures.create_project_months(self)
        manager = models.ProjectMonth.objects
        result = manager.get_freckle_projects(2015)
        self.assertEqual(list(result), [u'1', u'2'], msg=(
            'Should return all freckle project IDs for this month'))

class ProjectMonthTestCase(TestCase):
    """Tests for the ``ProjectMonth`` model."""
    longMessage = True

    def test_model(self):
        obj = mixer.blend('freckle_budgets.ProjectMonth')
        self.assertTrue(obj.pk, msg=('Object can be saved'))

        result = obj.__str__()
        expected = '{0} - {1}'.format(obj.project, obj.month)
        self.assertEqual(result, expected, msg=(
            '__str__ should return correct string'))

    def test_get_budget_hours(self):
        fixtures.create_project_months(self)

        result = self.project_month1_1.get_budget_hours()
        expected = self.project_month1_1.budget / self.project_month1_1.rate
        self.assertEqual(result, expected, msg=(
            'Should return the hours that can be worked on this project given'
            ' the budget and hourly rate'))

        self.project_month1_1.overhead_previous_month = \
            self.project_month1_1.budget / 2
        self.project_month1_1.save()
        expected = expected / 2
        result = self.project_month1_1.get_budget_hours()
        self.assertEqual(result, expected, msg=(
            'Should return the hours that can be worked on this project given'
            ' the budget and hourly rate, should deduct eventual overhead'
            ' hours from the budget when calculating the result'))

    def test_get_daily_hours(self):
        fixtures.create_project_months(self)
        pm = self.project_month1_1
        result = pm.get_daily_hours()
        expected = pm.get_budget_hours() / pm.month.get_work_days()
        self.assertEqual(result, expected, msg=(
            'Should return the daily hours that need to be worked on this'
            ' given the project budget, rate and work days of this month.'))

class EmployeeProjectMonthTestCase(TestCase):
    """Tests for the ``EmployeeProjectMonth`` model."""
    longMessage = True

    def test_model(self):
        obj = mixer.blend('freckle_budgets.EmployeeProjectMonth')
        self.assertTrue(obj.pk, msg=('Object can be saved'))

        expected = '{0} - {1}'.format(obj.project_month, obj.employee)
        self.assertEqual(obj.__str__(), expected, msg=(
            '__str__ should return correct string'))

    def test_get_budget_hours(self):
        fixtures.create_employee_project_months(self)
        result = self.employee_project_month.get_budget_hours()
        self.assertEqual(result, 10, msg=(
            'Should return the hours this employee should be working on this'
            ' project according to the project budget and his responsibility'))