text:
#include <math.h>

#include <initializer_list>
#include <vector>

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "flatbuffers/flatbuffers.h"  // from @flatbuffers
#include "tensorflow/lite/kernels/test_util.h"
#include "tensorflow/lite/schema/schema_generated.h"

namespace tflite {
namespace {

using ::testing::ElementsAreArray;

class ExpOpModel : public SingleOpModel {
 public:
  ExpOpModel(const TensorData& input, const TensorType& output) {
    input_ = AddInput(input);
    output_ = AddOutput(output);
    SetBuiltinOp(BuiltinOperator_EXP, BuiltinOptions_ExpOptions,
                 CreateExpOptions(builder_).Union());
    BuildInterpreter({GetShape(input_)});
  }

  template <class T>
  void SetInput(std::initializer_list<T> data) {
    PopulateTensor(input_, data);
  }

  template <class T>
  std::vector<T> GetOutput() {
    return ExtractVector<T>(output_);
  }
  std::vector<int> GetOutputShape() { return GetTensorShape(output_); }

 protected:
  int input_;
  int output_;
};

TEST(ExpOpTest, FloatTest) {
  std::initializer_list<float> data = {0.0f,    1.0f,  -1.0f, 100.0f,
                                       -100.0f, 0.01f, -0.01f};
  ExpOpModel m({TensorType_FLOAT32, {1, 1, 7}}, TensorType_FLOAT32);
  m.SetInput<float>(data);
  ASSERT_EQ(m.Invoke(), kTfLiteOk);
  EXPECT_THAT(m.GetOutputShape(), ElementsAreArray({1, 1, 7}));
  EXPECT_THAT(
      m.GetOutput<float>(),
      ElementsAreArray(ArrayFloatNear(
          {std::exp(0.0f), std::exp(1.0f), std::exp(-1.0f), std::exp(100.0f),
           std::exp(-100.0f), std::exp(0.01f), std::exp(-0.01f)})));
}

}  // namespace
}  // namespace tflite


text:
<?php

namespace App\Http\Controllers\Admin;

use App\Models\Auth\Role\Role;
use App\Models\Auth\User\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Access\User\EloquentUserRepository;
use Validator;

class UserController extends Controller
{
    /**
     * Repository
     *
     * @var object
     */
    protected $repository;

    /**
     * Construct
     *
     */
    public function __construct()
    {
        $this->repository = new EloquentUserRepository;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        return view('admin.users.index', ['users' => User::with('roles')->sortable(['email' => 'asc'])->paginate()]);
    }

    /**
     * Restore Users
     *
     * @return \Illuminate\Http\Response
     */
    public function restore(Request $request)
    {
        return view('admin.users.restore', ['users' => User::onlyTrashed()->with('roles')->sortable(['email' => 'asc'])->paginate()]);
    }

    /**
     * Restore Users
     *
     * @param int $id
     * @return \Illuminate\Http\Response
     */
    public function restoreUser($id)
    {
        $status = $this->repository->restore($id);

        if($status)
        {
            return redirect()->route('admin.users')->withFlashSuccess('User Restored Successfully!');
        }

        return redirect()->route('admin.users')->withFlashDanger('Unable to Restore User!');
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param User $user
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function show(User $user)
    {
        return view('admin.users.show', ['user' => $user]);
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param User $user
     * @return \Illuminate\Http\Response
     */
    public function edit(User $user)
    {
        return view('admin.users.edit', ['user' => $user, 'roles' => Role::get()]);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request $request
     * @param User $user
     * @return mixed
     */
    public function update(Request $request, User $user)
    {
        $validator = Validator::make($request->all(), [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255',
            'active' => 'sometimes|boolean',
            'confirmed' => 'sometimes|boolean',
        ]);

        $validator->sometimes('email', 'unique:users', function ($input) use ($user) {
            return strtolower($input->email) != strtolower($user->email);
        });

        $validator->sometimes('password', 'min:6|confirmed', function ($input) {
            return $input->password;
        });

        if ($validator->fails()) return redirect()->back()->withErrors($validator->errors());

        $user->name = $request->get('name');
        $user->email = $request->get('email');

        if ($request->has('password')) {
            $user->password = bcrypt($request->get('password'));
        }

        $user->active = $request->get('active', 0);
        $user->confirmed = $request->get('confirmed', 0);

        $user->save();

        //roles
        if ($request->has('roles')) {
            $user->roles()->detach();

            if ($request->get('roles')) {
                $user->roles()->attach($request->get('roles'));
            }
        }

        return redirect()->intended(route('admin.users'));
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $status = $this->repository->destroy($id);

        if($status)
        {
            return redirect()->route('admin.users')->withFlashSuccess('User Deleted Successfully!');
        }

        return redirect()->route('admin.users')->withFlashDanger('Unable to Delete User!');
    }
}

redpajama_set_name: RedPajamaGithub


text:
FROM ubuntu:15.04
MAINTAINER Tom <tmbdev@gmail.com>
ENV DEBIAN_FRONTEND noninteractive

RUN echo hi
RUN apt-get -qqy update
RUN apt-get -qqy install mercurial
RUN apt-get -qqy install build-essential
RUN apt-get -qqy install g++ gdb swig2.0 scons
RUN apt-get -qqy install git
RUN apt-get -qqy install wget
RUN cd /tmp && wget -nd http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1504/x86_64/cuda-repo-ubuntu1504_7.5-18_amd64.deb
RUN cd /tmp && dpkg -i cuda-repo-ubuntu1504*.deb
RUN apt-get -qqy update
RUN apt-get -qqy install cuda-7-5
RUN apt-get -qqy install cuda-command-line-tools-7-5
RUN apt-get -qqy install cuda-core-7-5
RUN apt-get -qqy install cuda-cublas-7-5
RUN apt-get -qqy install cuda-cublas-dev-7-5
RUN apt-get -qqy install cuda-cudart-7-5
RUN apt-get -qqy install cuda-cudart-dev-7-5
RUN apt-get -qqy install cuda-cufft-7-5
RUN apt-get -qqy install cuda-cufft-dev-7-5
RUN apt-get -qqy install cuda-curand-7-5
RUN apt-get -qqy install cuda-curand-dev-7-5
RUN apt-get -qqy install cuda-cusolver-7-5
RUN apt-get -qqy install cuda-cusolver-dev-7-5
RUN apt-get -qqy install cuda-cusparse-7-5
RUN apt-get -qqy install cuda-cusparse-dev-7-5
RUN apt-get -qqy install cuda-minimal-build-7-5
RUN apt-get -qqy install cuda-misc-headers-7-5
RUN apt-get -qqy install cuda-npp-7-5
RUN apt-get -qqy install cuda-npp-dev-7-5
RUN apt-get -qqy install cuda-nvrtc-7-5
RUN apt-get -qqy install cuda-nvrtc-dev-7-5
RUN apt-get -qqy install cuda-runtime-7-5
RUN apt-get -qqy install cuda-toolkit-7-5
RUN apt-get -qqy install cuda-visual-tools-7-5
RUN apt-get -qqy install cuda-samples-7-5

RUN apt-get -qqy install apt-utils
RUN apt-get -qqy install protobuf-compiler libprotobuf-dev
RUN apt-get -qqy install libpng12-dev
RUN cd /usr/local/include && hg clone http://bitbucket.org/eigen/eigen eigen3
RUN apt-get -qqy install strace

RUN apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

VOLUME /work
WORKDIR /work


text:
package io.airlift.http.server;

import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import io.airlift.event.client.EventField;
import io.airlift.event.client.EventType;
import io.airlift.tracetoken.TraceTokenManager;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;

import java.security.Principal;
import java.time.Instant;
import java.util.Enumeration;

import static io.airlift.event.client.EventField.EventFieldMapping.TIMESTAMP;
import static io.airlift.http.server.TraceTokenFilter.TRACETOKEN_HEADER;
import static java.lang.Math.max;

@EventType("HttpRequest")
public class HttpRequestEvent
{
    public static HttpRequestEvent createHttpRequestEvent(
            Request request,
            Response response,
            TraceTokenManager traceTokenManager,
            long currentTimeInMillis,
            long beginToDispatchMillis,
            long beginToEndMillis,
            long firstToLastContentTimeInMillis,
            DoubleSummaryStats responseContentInterarrivalStats)
    {
        String user = null;
        Principal principal = request.getUserPrincipal();
        if (principal != null) {
            user = principal.getName();
        }

        // This is required, because async responses are processed in a different thread.
        String token = request.getHeader(TRACETOKEN_HEADER);
        if (token == null && traceTokenManager != null) {
            token = traceTokenManager.getCurrentRequestToken();
        }

        long dispatchTime = request.getTimeStamp();
        long timeToDispatch = max(dispatchTime - request.getTimeStamp(), 0);

        Long timeToFirstByte = null;
        Object firstByteTime = request.getAttribute(TimingFilter.FIRST_BYTE_TIME);
        if (firstByteTime instanceof Long) {
            Long time = (Long) firstByteTime;
            timeToFirstByte = max(time - request.getTimeStamp(), 0);
        }

        long timeToLastByte = max(currentTimeInMillis - request.getTimeStamp(), 0);

        ImmutableList.Builder<String> builder = ImmutableList.builder();
        if (request.getRemoteAddr() != null) {
            builder.add(request.getRemoteAddr());
        }
        for (Enumeration<String> e = request.getHeaders("X-FORWARDED-FOR"); e != null && e.hasMoreElements(); ) {
            String forwardedFor = e.nextElement();
            builder.addAll(Splitter.on(',').trimResults().omitEmptyStrings().split(forwardedFor));
        }
        String clientAddress = null;
        ImmutableList<String> clientAddresses = builder.build();
        for (String address : Lists.reverse(clientAddresses)) {
            try {
                if (!Inet4Networks.isPrivateNetworkAddress(address)) {
                    clientAddress = address;
                    break;
                }
            }
            catch (IllegalArgumentException ignored) {
            }
        }
        if (clientAddress == null) {
            clientAddress = request.getRemoteAddr();
        }

        String requestUri = null;
        if (request.getRequestURI() != null) {
            requestUri = request.getRequestURI();
            String parameters = request.getQueryString();
            if (parameters != null) {
                requestUri += "?" + parameters;
            }
        }

        String method = request.getMethod();
        if (method != null) {
            method = method.toUpperCase();
        }

        String protocol = request.getHeader("X-FORWARDED-PROTO");
        if (protocol == null) {
            protocol = request.getScheme();
        }
        if (protocol != null) {
            protocol = protocol.toLowerCase();
        }

        return new HttpRequestEvent(
                Instant.ofEpochMilli(request.getTimeStamp()),
                token,
                clientAddress,
                protocol,
                method,
                requestUri,
                user,
                request.getHeader("User-Agent"),
                request.getHeader("Referer"),
                request.getContentRead(),
                request.getHeader("Content-Type"),
                response.getContentCount(),
                response.getStatus(),
                response.getHeader("Content-Type"),
                timeToDispatch,
                timeToFirstByte,
                timeToLastByte,
                beginToDispatchMillis,
                beginToEndMillis,
                firstToLastContentTimeInMillis,
                responseContentInterarrivalStats,
                request.getHttpVersion().toString());
    }

    private final Instant timeStamp;
    private final String traceToken;
    private final String clientAddress;
    private final String protocol;
    private final String method;
    private final String requestUri;
    private final String user;
    private final String agent;
    private final String referrer;
    private final long requestSize;
    private final String requestContentType;
    private final long responseSize;
    private final int responseCode;
    private final String responseContentType;
    private final long timeToDispatch;
    private final Long timeToFirstByte;
    private final long timeToLastByte;
    private final long beginToDispatchMillis;
    private final long beginToEndMillis;
    private final long firstToLastContentTimeInMillis;
    private final DoubleSummaryStats responseContentInterarrivalStats;
    private final String protocolVersion;

    public HttpRequestEvent(
            Instant timeStamp,
            String traceToken,
            String clientAddress,
            String protocol,
            String method,
            String requestUri,
            String user,
            String agent,
            String referrer,
            long requestSize,
            String requestContentType,
            long responseSize,
            int responseCode,
            String responseContentType,
            long timeToDispatch,
            Long timeToFirstByte,
            long timeToLastByte,
            long beginToDispatchMillis,
            long beginToEndMillis,
            long firstToLastContentTimeInMillis,
            DoubleSummaryStats responseContentInterarrivalStats,
            String protocolVersion)
    {
        this.timeStamp = timeStamp;
        this.traceToken = traceToken;
        this.clientAddress = clientAddress;
        this.protocol = protocol;
        this.method = method;
        this.requestUri = requestUri;
        this.user = user;
        this.agent = agent;
        this.referrer = referrer;
        this.requestSize = requestSize;
        this.requestContentType = requestContentType;
        this.responseSize = responseSize;
        this.responseCode = responseCode;
        this.responseContentType = responseContentType;
        this.timeToDispatch = timeToDispatch;
        this.timeToFirstByte = timeToFirstByte;
        this.timeToLastByte = timeToLastByte;
        this.beginToDispatchMillis = beginToDispatchMillis;
        this.beginToEndMillis = beginToEndMillis;
        this.firstToLastContentTimeInMillis = firstToLastContentTimeInMillis;
        this.responseContentInterarrivalStats = responseContentInterarrivalStats;
        this.protocolVersion = protocolVersion;
    }

    @EventField(fieldMapping = TIMESTAMP)
    public Instant getTimeStamp()
    {
        return timeStamp;
    }

    @EventField
    public String getTraceToken()
    {
        return traceToken;
    }

    @EventField
    public String getClientAddress()
    {
        return clientAddress;
    }

    @EventField
    public String getProtocol()
    {
        return protocol;
    }

    @EventField
    public String getMethod()
    {
        return method;
    }

    @EventField
    public String getRequestUri()
    {
        return requestUri;
    }

    @EventField
    public String getUser()
    {
        return user;
    }

    @EventField
    public String getAgent()
    {
        return agent;
    }

    @EventField
    public String getReferrer()
    {
        return referrer;
    }

    @EventField
    public long getRequestSize()
    {
        return requestSize;
    }

    @EventField
    public String getRequestContentType()
    {
        return requestContentType;
    }

    @EventField
    public long getResponseSize()
    {
        return responseSize;
    }

    @EventField
    public int getResponseCode()
    {
        return responseCode;
    }

    @EventField
    public String getResponseContentType()
    {
        return responseContentType;
    }

    @EventField
    public long getTimeToDispatch()
    {
        return timeToDispatch;
    }

    @EventField
    public Long getTimeToFirstByte()
    {
        return timeToFirstByte;
    }

    @EventField
    public long getTimeToLastByte()
    {
        return timeToLastByte;
    }

    @EventField
    public long getBeginToDispatchMillis()
    {
        return beginToDispatchMillis;
    }

    @EventField
    public long getBeginToEndMillis()
    {
        return beginToEndMillis;
    }

    @EventField
    public long getFirstToLastContentTimeInMillis()
    {
        return firstToLastContentTimeInMillis;
    }

    @EventField
    public DoubleSummaryStats getResponseContentInterarrivalStats()
    {
        return responseContentInterarrivalStats;
    }

    @EventField
    public String getProtocolVersion()
    {
        return protocolVersion;
    }
}


text:
mgraph
======

Music graph using D3.js and last.fm API


text:
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec

import sys

from thrift.transport import TTransport
all_structs = []

class AdjacencyType(object):
    CONJUNCTIVE = 0
    DISJUNCTIVE = 1

    _VALUES_TO_NAMES = {
        0: "CONJUNCTIVE",
        1: "DISJUNCTIVE",
    }

    _NAMES_TO_VALUES = {
        "CONJUNCTIVE": 0,
        "DISJUNCTIVE": 1,
    }

class NodeType(object):
    OPERATOR = 0
    STAGE = 1

    _VALUES_TO_NAMES = {
        0: "OPERATOR",
        1: "STAGE",
    }

    _NAMES_TO_VALUES = {
        "OPERATOR": 0,
        "STAGE": 1,
    }

class OperatorType(object):
    JOIN = 0
    MAPJOIN = 1
    EXTRACT = 2
    FILTER = 3
    FORWARD = 4
    GROUPBY = 5
    LIMIT = 6
    SCRIPT = 7
    SELECT = 8
    TABLESCAN = 9
    FILESINK = 10
    REDUCESINK = 11
    UNION = 12
    UDTF = 13
    LATERALVIEWJOIN = 14
    LATERALVIEWFORWARD = 15
    HASHTABLESINK = 16
    HASHTABLEDUMMY = 17
    PTF = 18
    MUX = 19
    DEMUX = 20
    EVENT = 21
    ORCFILEMERGE = 22
    RCFILEMERGE = 23
    MERGEJOIN = 24
    SPARKPRUNINGSINK = 25
    TOPNKEY = 26

    _VALUES_TO_NAMES = {
        0: "JOIN",
        1: "MAPJOIN",
        2: "EXTRACT",
        3: "FILTER",
        4: "FORWARD",
        5: "GROUPBY",
        6: "LIMIT",
        7: "SCRIPT",
        8: "SELECT",
        9: "TABLESCAN",
        10: "FILESINK",
        11: "REDUCESINK",
        12: "UNION",
        13: "UDTF",
        14: "LATERALVIEWJOIN",
        15: "LATERALVIEWFORWARD",
        16: "HASHTABLESINK",
        17: "HASHTABLEDUMMY",
        18: "PTF",
        19: "MUX",
        20: "DEMUX",
        21: "EVENT",
        22: "ORCFILEMERGE",
        23: "RCFILEMERGE",
        24: "MERGEJOIN",
        25: "SPARKPRUNINGSINK",
        26: "TOPNKEY",
    }

    _NAMES_TO_VALUES = {
        "JOIN": 0,
        "MAPJOIN": 1,
        "EXTRACT": 2,
        "FILTER": 3,
        "FORWARD": 4,
        "GROUPBY": 5,
        "LIMIT": 6,
        "SCRIPT": 7,
        "SELECT": 8,
        "TABLESCAN": 9,
        "FILESINK": 10,
        "REDUCESINK": 11,
        "UNION": 12,
        "UDTF": 13,
        "LATERALVIEWJOIN": 14,
        "LATERALVIEWFORWARD": 15,
        "HASHTABLESINK": 16,
        "HASHTABLEDUMMY": 17,
        "PTF": 18,
        "MUX": 19,
        "DEMUX": 20,
        "EVENT": 21,
        "ORCFILEMERGE": 22,
        "RCFILEMERGE": 23,
        "MERGEJOIN": 24,
        "SPARKPRUNINGSINK": 25,
        "TOPNKEY": 26,
    }

class TaskType(object):
    MAP = 0
    REDUCE = 1
    OTHER = 2

    _VALUES_TO_NAMES = {
        0: "MAP",
        1: "REDUCE",
        2: "OTHER",
    }

    _NAMES_TO_VALUES = {
        "MAP": 0,
        "REDUCE": 1,
        "OTHER": 2,
    }

class StageType(object):
    CONDITIONAL = 0
    COPY = 1
    DDL = 2
    MAPRED = 3
    EXPLAIN = 4
    FETCH = 5
    FUNC = 6
    MAPREDLOCAL = 7
    MOVE = 8
    STATS = 9
    DEPENDENCY_COLLECTION = 10
    COLUMNSTATS = 11
    REPL_DUMP = 12
    REPL_BOOTSTRAP_LOAD = 13
    REPL_STATE_LOG = 14
    REPL_TXN = 15
    REPL_INCREMENTAL_LOAD = 16
    SCHEDULED_QUERY_MAINT = 17
    ACK = 18
    RANGER_DUMP = 19
    RANGER_LOAD = 20
    ATLAS_DUMP = 21
    ATLAS_LOAD = 22

    _VALUES_TO_NAMES = {
        0: "CONDITIONAL",
        1: "COPY",
        2: "DDL",
        3: "MAPRED",
        4: "EXPLAIN",
        5: "FETCH",
        6: "FUNC",
        7: "MAPREDLOCAL",
        8: "MOVE",
        9: "STATS",
        10: "DEPENDENCY_COLLECTION",
        11: "COLUMNSTATS",
        12: "REPL_DUMP",
        13: "REPL_BOOTSTRAP_LOAD",
        14: "REPL_STATE_LOG",
        15: "REPL_TXN",
        16: "REPL_INCREMENTAL_LOAD",
        17: "SCHEDULED_QUERY_MAINT",
        18: "ACK",
        19: "RANGER_DUMP",
        20: "RANGER_LOAD",
        21: "ATLAS_DUMP",
        22: "ATLAS_LOAD",
    }

    _NAMES_TO_VALUES = {
        "CONDITIONAL": 0,
        "COPY": 1,
        "DDL": 2,
        "MAPRED": 3,
        "EXPLAIN": 4,
        "FETCH": 5,
        "FUNC": 6,
        "MAPREDLOCAL": 7,
        "MOVE": 8,
        "STATS": 9,
        "DEPENDENCY_COLLECTION": 10,
        "COLUMNSTATS": 11,
        "REPL_DUMP": 12,
        "REPL_BOOTSTRAP_LOAD": 13,
        "REPL_STATE_LOG": 14,
        "REPL_TXN": 15,
        "REPL_INCREMENTAL_LOAD": 16,
        "SCHEDULED_QUERY_MAINT": 17,
        "ACK": 18,
        "RANGER_DUMP": 19,
        "RANGER_LOAD": 20,
        "ATLAS_DUMP": 21,
        "ATLAS_LOAD": 22,
    }

class Adjacency(object):
    """
    Attributes:
     - node
     - children
     - adjacencyType

    """

    def __init__(self, node=None, children=None, adjacencyType=None,):
        self.node = node
        self.children = children
        self.adjacencyType = adjacencyType

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.node = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.children = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        self.children.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.adjacencyType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('Adjacency')
        if self.node is not None:
            oprot.writeFieldBegin('node', TType.STRING, 1)
            oprot.writeString(self.node.encode('utf-8') if sys.version_info[0] == 2 else self.node)
            oprot.writeFieldEnd()
        if self.children is not None:
            oprot.writeFieldBegin('children', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.children))
            for iter6 in self.children:
                oprot.writeString(iter6.encode('utf-8') if sys.version_info[0] == 2 else iter6)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.adjacencyType is not None:
            oprot.writeFieldBegin('adjacencyType', TType.I32, 3)
            oprot.writeI32(self.adjacencyType)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)

class Graph(object):
    """
    Attributes:
     - nodeType
     - roots
     - adjacencyList

    """

    def __init__(self, nodeType=None, roots=None, adjacencyList=None,):
        self.nodeType = nodeType
        self.roots = roots
        self.adjacencyList = adjacencyList

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.I32:
                    self.nodeType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.roots = []
                    (_etype10, _size7) = iprot.readListBegin()
                    for _i11 in range(_size7):
                        _elem12 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        self.roots.append(_elem12)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.adjacencyList = []
                    (_etype16, _size13) = iprot.readListBegin()
                    for _i17 in range(_size13):
                        _elem18 = Adjacency()
                        _elem18.read(iprot)
                        self.adjacencyList.append(_elem18)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('Graph')
        if self.nodeType is not None:
            oprot.writeFieldBegin('nodeType', TType.I32, 1)
            oprot.writeI32(self.nodeType)
            oprot.writeFieldEnd()
        if self.roots is not None:
            oprot.writeFieldBegin('roots', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.roots))
            for iter19 in self.roots:
                oprot.writeString(iter19.encode('utf-8') if sys.version_info[0] == 2 else iter19)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.adjacencyList is not None:
            oprot.writeFieldBegin('adjacencyList', TType.LIST, 3)
            oprot.writeListBegin(TType.STRUCT, len(self.adjacencyList))
            for iter20 in self.adjacencyList:
                iter20.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)

class Operator(object):
    """
    Attributes:
     - operatorId
     - operatorType
     - operatorAttributes
     - operatorCounters
     - done
     - started

    """

    def __init__(self, operatorId=None, operatorType=None, operatorAttributes=None, operatorCounters=None, done=None, started=None,):
        self.operatorId = operatorId
        self.operatorType = operatorType
        self.operatorAttributes = operatorAttributes
        self.operatorCounters = operatorCounters
        self.done = done
        self.started = started

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.operatorId = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.operatorType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.MAP:
                    self.operatorAttributes = {}
                    (_ktype22, _vtype23, _size21) = iprot.readMapBegin()
                    for _i25 in range(_size21):
                        _key26 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val27 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        self.operatorAttributes[_key26] = _val27
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.MAP:
                    self.operatorCounters = {}
                    (_ktype29, _vtype30, _size28) = iprot.readMapBegin()
                    for _i32 in range(_size28):
                        _key33 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val34 = iprot.readI64()
                        self.operatorCounters[_key33] = _val34
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.BOOL:
                    self.done = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.BOOL:
                    self.started = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('Operator')
        if self.operatorId is not None:
            oprot.writeFieldBegin('operatorId', TType.STRING, 1)
            oprot.writeString(self.operatorId.encode('utf-8') if sys.version_info[0] == 2 else self.operatorId)
            oprot.writeFieldEnd()
        if self.operatorType is not None:
            oprot.writeFieldBegin('operatorType', TType.I32, 2)
            oprot.writeI32(self.operatorType)
            oprot.writeFieldEnd()
        if self.operatorAttributes is not None:
            oprot.writeFieldBegin('operatorAttributes', TType.MAP, 3)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.operatorAttributes))
            for kiter35, viter36 in self.operatorAttributes.items():
                oprot.writeString(kiter35.encode('utf-8') if sys.version_info[0] == 2 else kiter35)
                oprot.writeString(viter36.encode('utf-8') if sys.version_info[0] == 2 else viter36)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.operatorCounters is not None:
            oprot.writeFieldBegin('operatorCounters', TType.MAP, 4)
            oprot.writeMapBegin(TType.STRING, TType.I64, len(self.operatorCounters))
            for kiter37, viter38 in self.operatorCounters.items():
                oprot.writeString(kiter37.encode('utf-8') if sys.version_info[0] == 2 else kiter37)
                oprot.writeI64(viter38)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.done is not None:
            oprot.writeFieldBegin('done', TType.BOOL, 5)
            oprot.writeBool(self.done)
            oprot.writeFieldEnd()
        if self.started is not None:
            oprot.writeFieldBegin('started', TType.BOOL, 6)
            oprot.writeBool(self.started)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)

class Task(object):
    """
    Attributes:
     - taskId
     - taskType
     - taskAttributes
     - taskCounters
     - operatorGraph
     - operatorList
     - done
     - started

    """

    def __init__(self, taskId=None, taskType=None, taskAttributes=None, taskCounters=None, operatorGraph=None, operatorList=None, done=None, started=None,):
        self.taskId = taskId
        self.taskType = taskType
        self.taskAttributes = taskAttributes
        self.taskCounters = taskCounters
        self.operatorGraph = operatorGraph
        self.operatorList = operatorList
        self.done = done
        self.started = started

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.taskId = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.taskType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.MAP:
                    self.taskAttributes = {}
                    (_ktype40, _vtype41, _size39) = iprot.readMapBegin()
                    for _i43 in range(_size39):
                        _key44 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val45 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        self.taskAttributes[_key44] = _val45
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.MAP:
                    self.taskCounters = {}
                    (_ktype47, _vtype48, _size46) = iprot.readMapBegin()
                    for _i50 in range(_size46):
                        _key51 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val52 = iprot.readI64()
                        self.taskCounters[_key51] = _val52
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRUCT:
                    self.operatorGraph = Graph()
                    self.operatorGraph.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.LIST:
                    self.operatorList = []
                    (_etype56, _size53) = iprot.readListBegin()
                    for _i57 in range(_size53):
                        _elem58 = Operator()
                        _elem58.read(iprot)
                        self.operatorList.append(_elem58)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.BOOL:
                    self.done = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.BOOL:
                    self.started = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('Task')
        if self.taskId is not None:
            oprot.writeFieldBegin('taskId', TType.STRING, 1)
            oprot.writeString(self.taskId.encode('utf-8') if sys.version_info[0] == 2 else self.taskId)
            oprot.writeFieldEnd()
        if self.taskType is not None:
            oprot.writeFieldBegin('taskType', TType.I32, 2)
            oprot.writeI32(self.taskType)
            oprot.writeFieldEnd()
        if self.taskAttributes is not None:
            oprot.writeFieldBegin('taskAttributes', TType.MAP, 3)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.taskAttributes))
            for kiter59, viter60 in self.taskAttributes.items():
                oprot.writeString(kiter59.encode('utf-8') if sys.version_info[0] == 2 else kiter59)
                oprot.writeString(viter60.encode('utf-8') if sys.version_info[0] == 2 else viter60)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.taskCounters is not None:
            oprot.writeFieldBegin('taskCounters', TType.MAP, 4)
            oprot.writeMapBegin(TType.STRING, TType.I64, len(self.taskCounters))
            for kiter61, viter62 in self.taskCounters.items():
                oprot.writeString(kiter61.encode('utf-8') if sys.version_info[0] == 2 else kiter61)
                oprot.writeI64(viter62)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.operatorGraph is not None:
            oprot.writeFieldBegin('operatorGraph', TType.STRUCT, 5)
            self.operatorGraph.write(oprot)
            oprot.writeFieldEnd()
        if self.operatorList is not None:
            oprot.writeFieldBegin('operatorList', TType.LIST, 6)
            oprot.writeListBegin(TType.STRUCT, len(self.operatorList))
            for iter63 in self.operatorList:
                iter63.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.done is not None:
            oprot.writeFieldBegin('done', TType.BOOL, 7)
            oprot.writeBool(self.done)
            oprot.writeFieldEnd()
        if self.started is not None:
            oprot.writeFieldBegin('started', TType.BOOL, 8)
            oprot.writeBool(self.started)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)

class Stage(object):
    """
    Attributes:
     - stageId
     - stageType
     - stageAttributes
     - stageCounters
     - taskList
     - done
     - started

    """

    def __init__(self, stageId=None, stageType=None, stageAttributes=None, stageCounters=None, taskList=None, done=None, started=None,):
        self.stageId = stageId
        self.stageType = stageType
        self.stageAttributes = stageAttributes
        self.stageCounters = stageCounters
        self.taskList = taskList
        self.done = done
        self.started = started

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.stageId = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.stageType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.MAP:
                    self.stageAttributes = {}
                    (_ktype65, _vtype66, _size64) = iprot.readMapBegin()
                    for _i68 in range(_size64):
                        _key69 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val70 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        self.stageAttributes[_key69] = _val70
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.MAP:
                    self.stageCounters = {}
                    (_ktype72, _vtype73, _size71) = iprot.readMapBegin()
                    for _i75 in range(_size71):
                        _key76 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val77 = iprot.readI64()
                        self.stageCounters[_key76] = _val77
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.LIST:
                    self.taskList = []
                    (_etype81, _size78) = iprot.readListBegin()
                    for _i82 in range(_size78):
                        _elem83 = Task()
                        _elem83.read(iprot)
                        self.taskList.append(_elem83)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.BOOL:
                    self.done = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.BOOL:
                    self.started = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('Stage')
        if self.stageId is not None:
            oprot.writeFieldBegin('stageId', TType.STRING, 1)
            oprot.writeString(self.stageId.encode('utf-8') if sys.version_info[0] == 2 else self.stageId)
            oprot.writeFieldEnd()
        if self.stageType is not None:
            oprot.writeFieldBegin('stageType', TType.I32, 2)
            oprot.writeI32(self.stageType)
            oprot.writeFieldEnd()
        if self.stageAttributes is not None:
            oprot.writeFieldBegin('stageAttributes', TType.MAP, 3)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.stageAttributes))
            for kiter84, viter85 in self.stageAttributes.items():
                oprot.writeString(kiter84.encode('utf-8') if sys.version_info[0] == 2 else kiter84)
                oprot.writeString(viter85.encode('utf-8') if sys.version_info[0] == 2 else viter85)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.stageCounters is not None:
            oprot.writeFieldBegin('stageCounters', TType.MAP, 4)
            oprot.writeMapBegin(TType.STRING, TType.I64, len(self.stageCounters))
            for kiter86, viter87 in self.stageCounters.items():
                oprot.writeString(kiter86.encode('utf-8') if sys.version_info[0] == 2 else kiter86)
                oprot.writeI64(viter87)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.taskList is not None:
            oprot.writeFieldBegin('taskList', TType.LIST, 5)
            oprot.writeListBegin(TType.STRUCT, len(self.taskList))
            for iter88 in self.taskList:
                iter88.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.done is not None:
            oprot.writeFieldBegin('done', TType.BOOL, 6)
            oprot.writeBool(self.done)
            oprot.writeFieldEnd()
        if self.started is not None:
            oprot.writeFieldBegin('started', TType.BOOL, 7)
            oprot.writeBool(self.started)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)

class Query(object):
    """
    Attributes:
     - queryId
     - queryType
     - queryAttributes
     - queryCounters
     - stageGraph
     - stageList
     - done
     - started

    """

    def __init__(self, queryId=None, queryType=None, queryAttributes=None, queryCounters=None, stageGraph=None, stageList=None, done=None, started=None,):
        self.queryId = queryId
        self.queryType = queryType
        self.queryAttributes = queryAttributes
        self.queryCounters = queryCounters
        self.stageGraph = stageGraph
        self.stageList = stageList
        self.done = done
        self.started = started

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.queryId = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.queryType = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.MAP:
                    self.queryAttributes = {}
                    (_ktype90, _vtype91, _size89) = iprot.readMapBegin()
                    for _i93 in range(_size89):
                        _key94 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val95 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        self.queryAttributes[_key94] = _val95
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.MAP:
                    self.queryCounters = {}
                    (_ktype97, _vtype98, _size96) = iprot.readMapBegin()
                    for _i100 in range(_size96):
                        _key101 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                        _val102 = iprot.readI64()
                        self.queryCounters[_key101] = _val102
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRUCT:
                    self.stageGraph = Graph()
                    self.stageGraph.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.LIST:
                    self.stageList = []
                    (_etype106, _size103) = iprot.readListBegin()
                    for _i107 in range(_size103):
                        _elem108 = Stage()
                        _elem108.read(iprot)
                        self.stageList.append(_elem108)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.BOOL:
                    self.done = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.BOOL:
                    self.started = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('Query')
        if self.queryId is not None:
            oprot.writeFieldBegin('queryId', TType.STRING, 1)
            oprot.writeString(self.queryId.encode('utf-8') if sys.version_info[0] == 2 else self.queryId)
            oprot.writeFieldEnd()
        if self.queryType is not None:
            oprot.writeFieldBegin('queryType', TType.STRING, 2)
            oprot.writeString(self.queryType.encode('utf-8') if sys.version_info[0] == 2 else self.queryType)
            oprot.writeFieldEnd()
        if self.queryAttributes is not None:
            oprot.writeFieldBegin('queryAttributes', TType.MAP, 3)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.queryAttributes))
            for kiter109, viter110 in self.queryAttributes.items():
                oprot.writeString(kiter109.encode('utf-8') if sys.version_info[0] == 2 else kiter109)
                oprot.writeString(viter110.encode('utf-8') if sys.version_info[0] == 2 else viter110)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.queryCounters is not None:
            oprot.writeFieldBegin('queryCounters', TType.MAP, 4)
            oprot.writeMapBegin(TType.STRING, TType.I64, len(self.queryCounters))
            for kiter111, viter112 in self.queryCounters.items():
                oprot.writeString(kiter111.encode('utf-8') if sys.version_info[0] == 2 else kiter111)
                oprot.writeI64(viter112)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.stageGraph is not None:
            oprot.writeFieldBegin('stageGraph', TType.STRUCT, 5)
            self.stageGraph.write(oprot)
            oprot.writeFieldEnd()
        if self.stageList is not None:
            oprot.writeFieldBegin('stageList', TType.LIST, 6)
            oprot.writeListBegin(TType.STRUCT, len(self.stageList))
            for iter113 in self.stageList:
                iter113.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.done is not None:
            oprot.writeFieldBegin('done', TType.BOOL, 7)
            oprot.writeBool(self.done)
            oprot.writeFieldEnd()
        if self.started is not None:
            oprot.writeFieldBegin('started', TType.BOOL, 8)
            oprot.writeBool(self.started)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)

class QueryPlan(object):
    """
    Attributes:
     - queries
     - done
     - started

    """

    def __init__(self, queries=None, done=None, started=None,):
        self.queries = queries
        self.done = done
        self.started = started

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.LIST:
                    self.queries = []
                    (_etype117, _size114) = iprot.readListBegin()
                    for _i118 in range(_size114):
                        _elem119 = Query()
                        _elem119.read(iprot)
                        self.queries.append(_elem119)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BOOL:
                    self.done = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.BOOL:
                    self.started = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('QueryPlan')
        if self.queries is not None:
            oprot.writeFieldBegin('queries', TType.LIST, 1)
            oprot.writeListBegin(TType.STRUCT, len(self.queries))
            for iter120 in self.queries:
                iter120.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.done is not None:
            oprot.writeFieldBegin('done', TType.BOOL, 2)
            oprot.writeBool(self.done)
            oprot.writeFieldEnd()
        if self.started is not None:
            oprot.writeFieldBegin('started', TType.BOOL, 3)
            oprot.writeBool(self.started)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(Adjacency)
Adjacency.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'node', 'UTF8', None, ),  # 1
    (2, TType.LIST, 'children', (TType.STRING, 'UTF8', False), None, ),  # 2
    (3, TType.I32, 'adjacencyType', None, None, ),  # 3
)
all_structs.append(Graph)
Graph.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'nodeType', None, None, ),  # 1
    (2, TType.LIST, 'roots', (TType.STRING, 'UTF8', False), None, ),  # 2
    (3, TType.LIST, 'adjacencyList', (TType.STRUCT, [Adjacency, None], False), None, ),  # 3
)
all_structs.append(Operator)
Operator.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'operatorId', 'UTF8', None, ),  # 1
    (2, TType.I32, 'operatorType', None, None, ),  # 2
    (3, TType.MAP, 'operatorAttributes', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.MAP, 'operatorCounters', (TType.STRING, 'UTF8', TType.I64, None, False), None, ),  # 4
    (5, TType.BOOL, 'done', None, None, ),  # 5
    (6, TType.BOOL, 'started', None, None, ),  # 6
)
all_structs.append(Task)
Task.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'taskId', 'UTF8', None, ),  # 1
    (2, TType.I32, 'taskType', None, None, ),  # 2
    (3, TType.MAP, 'taskAttributes', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.MAP, 'taskCounters', (TType.STRING, 'UTF8', TType.I64, None, False), None, ),  # 4
    (5, TType.STRUCT, 'operatorGraph', [Graph, None], None, ),  # 5
    (6, TType.LIST, 'operatorList', (TType.STRUCT, [Operator, None], False), None, ),  # 6
    (7, TType.BOOL, 'done', None, None, ),  # 7
    (8, TType.BOOL, 'started', None, None, ),  # 8
)
all_structs.append(Stage)
Stage.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'stageId', 'UTF8', None, ),  # 1
    (2, TType.I32, 'stageType', None, None, ),  # 2
    (3, TType.MAP, 'stageAttributes', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.MAP, 'stageCounters', (TType.STRING, 'UTF8', TType.I64, None, False), None, ),  # 4
    (5, TType.LIST, 'taskList', (TType.STRUCT, [Task, None], False), None, ),  # 5
    (6, TType.BOOL, 'done', None, None, ),  # 6
    (7, TType.BOOL, 'started', None, None, ),  # 7
)
all_structs.append(Query)
Query.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'queryId', 'UTF8', None, ),  # 1
    (2, TType.STRING, 'queryType', 'UTF8', None, ),  # 2
    (3, TType.MAP, 'queryAttributes', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.MAP, 'queryCounters', (TType.STRING, 'UTF8', TType.I64, None, False), None, ),  # 4
    (5, TType.STRUCT, 'stageGraph', [Graph, None], None, ),  # 5
    (6, TType.LIST, 'stageList', (TType.STRUCT, [Stage, None], False), None, ),  # 6
    (7, TType.BOOL, 'done', None, None, ),  # 7
    (8, TType.BOOL, 'started', None, None, ),  # 8
)
all_structs.append(QueryPlan)
QueryPlan.thrift_spec = (
    None,  # 0
    (1, TType.LIST, 'queries', (TType.STRUCT, [Query, None], False), None, ),  # 1
    (2, TType.BOOL, 'done', None, None, ),  # 2
    (3, TType.BOOL, 'started', None, None, ),  # 3
)
fix_spec(all_structs)
del all_structs


text:
BEGIN;

SELECT has_function_privilege(
  'delete_cookbook_artifact_version(bigint)',
  'execute');

ROLLBACK;


text:
MV Cors Documentation
==========================

Introduction
-------------

`api_routes/Cors.js` allows you to your server cors cross domain
`configurations/Cors.js` Configuration your cors domain

Configuration
-------------

Add this line to the `API SECTION` section in the `server.js` file:

`app.use('AllowCrossDomain',require('./api_routes/cors'));`


text:
yii2-cycle2
============

#### Cycle2 jQuery slide show for Yii 2.0 ####

**yii2-cycle2** is a widget to render the excellent [Cycle2](http://jquery.malsup.com/cycle2/) jQuery slideshow widget in the [Yii 2.0](http://www.yiiframework.com/ "Yii") PHP Framework. Like a [GridView](http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html "Yii"), its data is fed from an [ActiveDataProvider](http://www.yiiframework.com/doc-2.0/yii-data-activedataprovider.html "Yii") (or, more generally, from a class derived from [BaseDataProvider](http://www.yiiframework.com/doc-2.0/yii-data-basedataprovider.html "Yii")).

A demonstration of **Yii2-cycle2** is [here](http://www.sjaakpriester.nl/software/cycle).

## Installation ##

Install **yii2-cycle2** with [Composer](https://getcomposer.org/). Either add the following to the require section of your `composer.json` file:

`"sjaakp/yii2-cycle2": "*"`

Or run:

`composer require sjaakp/yii2-cycle2 "*"`

You can manually install **yii2-cycle2** by [downloading the source in ZIP-format](https://github.com/sjaakp/yii2-cycle2/archive/master.zip).

## Using yii2-cycle2 ##

**yii2-cycle2** implements a widget of the class `Cycle`. It gets its data from an `ActiveDataProvider`, `ArrayDataProvider`, or other class derived from [`BaseDataProvider`](http://www.yiiframework.com/doc-2.0/yii-data-basedataprovider.html "Yii") Using it is not unlike using a [GridView](http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html "Yii Framework"). For instance, in the Controller you might have something like:

	<?php
	// ...
	public function actionPie()	{
		$dataProvider = new ActiveDataProvider([
			'query' => NicePlace::find(),
		    'pagination' => false
		]);

		return $this->render('cycle', [
			'dataProvider' => $dataProvider
		]);
	}
	// ...
	?>

To render a `Cycle` in the `View` we could use:

	<?php
	use sjaakp\cycle\Cycle;
	?>
	...
    <?= Cycle::widget([
        'dataProvider' => $dataProvider,
		'imgAttribute' => 'photo',
        'captionAttributes' => [
            'name',
            'country'
        ],
        'overlayAttributes' => [
            'description'
        ],
        'options' => [
            'speed' => 2000
        ],
    ]) ?>
	...

## Options ##

`Cycle` has the following options:

### dataProvider ###

The data provider for the widget. This property is required. In most cases, it will be an `ActiveDataProvider` or an `ArrayDataProvider`.

### imgAttribute ###

Image attribute, required.

- `string`: name of the attribute that holds the source URL for the slide image. Note that this could be a virtual attribute.
- `callable`: a callable with signature `function($model, $widget)` that returns the source URL for the slide image.

### urlAttribute ###

Link URL attribute, optional.

- `null`: the slides are not embedded in links (default).
- `string`: name of the attribute that holds the link URL for the slide. Note that this could be a virtual attribute.
- `callable`: a callable with signature `function($model, $widget)` that returns the link URL for the slide.

### tooltipAttribute ###

Tooltip attribute, optional.

- `null`: the slides don't have tooltips (default).
- `string`: name of the attribute that holds the text or HTML for the slide tooltip. Note that this could be a virtual attribute.
- `callable`: a callable with signature `function($model, $widget)` that returns the text or HTML for the slide tooltip.

### captionAttributes, overlayAttributes ###

The attributes displayed in the caption or the overlay. See the [Cycle2 documentation](http://jquery.malsup.com/cycle2/demo/caption.php "Cycle2").

Members can be:

- `string` name of the attribute holding the text or HTML for the caption or overlay element;
- `<key> => <value>` where `<key>` is a name and `<value>` is
	- the name of the attribute;
	- or a callable with the signature `function($model, $widget)` returning the text or HTML.

The attribute values will be rendered inside Cycle's caption or overlay `div`, each inside its own `span` element with class `"slide-<key>"`.

### content ###

Extra elements in the Cycle container, apart from the slides, caption, and overlay. Could be filled with elements like `'<div class="cycle-pager"></div>'` (see: [Cycle2 pagers](http://jquery.malsup.com/cycle2/demo/pager.php "Cycle2")).

### plugins ###

Plugins for the Cycle2 jQuery widget. **Notice** that **yii2-cycle2** attempts to load the required plugins automatically.

### options ###

Client options for the underlying [Cycle2 jQuery](http://jquery.malsup.com/cycle2/api/#options "Cycle2") widget. **Notice** that the option names must be camelCased.

### htmlOptions ###

HTML options of the `Cycle` container. Use this if you want to explicitly set the `ID`.

### slideOptions ###

HTML options for each slide. One use would be to set this to: `[ 'target' => '_blank' ]`


text:
using System.IO;
using Microsoft.WindowsAzure.Storage.Blob;

namespace MessageVault.Cloud {

	public sealed class CloudPageReader : IPageReader {
		readonly CloudPageBlob _blob;

		public CloudPageReader(CloudPageBlob blob) {
			Require.NotNull("blob", blob);
			_blob = blob;
		}

		public void DownloadRangeToStream(Stream stream, long offset, int length) {
			Require.NotNull("stream", stream);
			Require.ZeroOrGreater("offset", offset);
			Require.Positive("length", length);

			_blob.DownloadRangeToStream(stream, offset, length);
		}

	    public void Dispose() {

	    }
	}

}


text:
package main

import (
	"flag"
	"log"
	"net/http"
	"os"
	"time"

	"github.com/labstack/echo"
	"github.com/labstack/echo/engine/standard"
	"github.com/yanatan16/golang-instagram/instagram"

	"github.com/maddevsio/screen-monitoring/agents/instagram_agent/agent"
	"github.com/maddevsio/screen-monitoring/agents/instagram_agent/models"
)

const (
	defaultPort         = "8090"
	defaultDashboardURL = "http://localhost:8080/dashboard/v1/register"
)

var (
	clientID    = envString("CLIEND_ID", "")
	accessToken = envString("ACCESS_TOKEN", "")
)

type Env struct {
	db models.Datastore
}

func main() {
	var (
		addr         = envString("PORT", defaultPort)
		dashboardUrl = envString("DASHBOARD_URL", defaultDashboardURL)

		httpAddr     = flag.String("httpAddr", "127.0.0.1:"+addr, "HTTP listen address")
		dashboardURL = flag.String("dashboardURL", dashboardUrl, "Dashboard service URL")
	)

	flag.Parse()

	err := agent.Register(*dashboardURL, "http://"+*httpAddr)
	if err != nil {
		log.Fatal(err)
	}

	db, err := models.NewDB("instagram.db")
	if err != nil {
		log.Fatal(err)
	}

	env := &Env{db}

	api := &instagram.Api{
		ClientId:    clientID,
		AccessToken: accessToken,
	}

	ticker := time.NewTicker(time.Minute * 2)
	go func() {
		for _ = range ticker.C {
			if ok, err := api.VerifyCredentials(); !ok {
				log.Fatal(err)
			}

			if resp, err := api.GetSelf(); err != nil {
				log.Fatal(err)
			} else {
				me := resp.User
				counter := &models.Counter{
					Username:   me.Username,
					Media:      me.Counts.Media,
					FollowedBy: me.Counts.FollowedBy,
					Follows:    me.Counts.Follows,
				}
				env.db.CountersCreate(counter)
			}
		}
	}()

	e := echo.New()
	e.File("/", "tmpl/index.html")
	e.Static("/static", "assets")
	e.GET("/counters", env.countersLast)
	e.GET("/counters-last-month", env.countersLastMonth)
	e.Run(standard.New(*httpAddr))
}

func (env *Env) countersLast(c echo.Context) error {
	counters, err := env.db.CountersFindLast()
	if err != nil {
		// TODO: handle this
		log.Fatal(err)
		return err
	}
	return c.JSON(http.StatusOK, counters)
}

func (env *Env) countersLastMonth(c echo.Context) error {
	avgCounters, err := env.db.CountersLastMonth()
	if err != nil {
		return err
	}

	var media []models.CounterObject
	var follows []models.CounterObject
	var followed_by []models.CounterObject

	for _, avgCounter := range avgCounters {
		media = append(media, models.CounterObject{
			Date:  avgCounter.Date,
			Value: avgCounter.Media,
		})
		follows = append(follows, models.CounterObject{
			Date:  avgCounter.Date,
			Value: avgCounter.Follows,
		})
		followed_by = append(followed_by, models.CounterObject{
			Date:  avgCounter.Date,
			Value: avgCounter.FollowedBy,
		})
	}

	response := models.CountersLastMonthResponse{
		Media:      media,
		Follows:    follows,
		FollowedBy: followed_by,
	}

	return c.JSON(http.StatusOK, response)
}

func envString(env, fallback string) string {
	e := os.Getenv(env)
	if e == "" {
		return fallback
	}
	return e
}


text:
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Ads.GoogleAds.V12.Errors {

  /// Holder for reflection information generated from google/ads/googleads/v12/errors/date_range_error.proto
  public static partial class DateRangeErrorReflection {

    #region Descriptor
    /// File descriptor for google/ads/googleads/v12/errors/date_range_error.proto
    public static pbr::FileDescriptor Descriptor {
      get { return descriptor; }
    }
    private static pbr::FileDescriptor descriptor;

    static DateRangeErrorReflection() {
      byte[] descriptorData = global::System.Convert.FromBase64String(
          string.Concat(
            "CjZnb29nbGUvYWRzL2dvb2dsZWFkcy92MTIvZXJyb3JzL2RhdGVfcmFuZ2Vf",
            "ZXJyb3IucHJvdG8SH2dvb2dsZS5hZHMuZ29vZ2xlYWRzLnYxMi5lcnJvcnMi",
            "5gEKEkRhdGVSYW5nZUVycm9yRW51bSLPAQoORGF0ZVJhbmdlRXJyb3ISDwoL",
            "VU5TUEVDSUZJRUQQABILCgdVTktOT1dOEAESEAoMSU5WQUxJRF9EQVRFEAIS",
            "HQoZU1RBUlRfREFURV9BRlRFUl9FTkRfREFURRADEhsKF0NBTk5PVF9TRVRf",
            "REFURV9UT19QQVNUEAQSIAocQUZURVJfTUFYSU1VTV9BTExPV0FCTEVfREFU",
            "RRAFEi8KK0NBTk5PVF9NT0RJRllfU1RBUlRfREFURV9JRl9BTFJFQURZX1NU",
            "QVJURUQQBkLzAQojY29tLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnYxMi5lcnJv",
            "cnNCE0RhdGVSYW5nZUVycm9yUHJvdG9QAVpFZ29vZ2xlLmdvbGFuZy5vcmcv",
            "Z2VucHJvdG8vZ29vZ2xlYXBpcy9hZHMvZ29vZ2xlYWRzL3YxMi9lcnJvcnM7",
            "ZXJyb3JzogIDR0FBqgIfR29vZ2xlLkFkcy5Hb29nbGVBZHMuVjEyLkVycm9y",
            "c8oCH0dvb2dsZVxBZHNcR29vZ2xlQWRzXFYxMlxFcnJvcnPqAiNHb29nbGU6",
            "OkFkczo6R29vZ2xlQWRzOjpWMTI6OkVycm9yc2IGcHJvdG8z"));
      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
          new pbr::FileDescriptor[] { },
          new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V12.Errors.DateRangeErrorEnum), global::Google.Ads.GoogleAds.V12.Errors.DateRangeErrorEnum.Parser, null, null, new[]{ typeof(global::Google.Ads.GoogleAds.V12.Errors.DateRangeErrorEnum.Types.DateRangeError) }, null, null)
          }));
    }
    #endregion

  }
  #region Messages
  ///
  /// Container for enum describing possible date range errors.
  ///
  public sealed partial class DateRangeErrorEnum : pb::IMessage<DateRangeErrorEnum>
  #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      , pb::IBufferMessage
  #endif
  {
    private static readonly pb::MessageParser<DateRangeErrorEnum> _parser = new pb::MessageParser<DateRangeErrorEnum>(() => new DateRangeErrorEnum());
    private pb::UnknownFieldSet _unknownFields;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public static pb::MessageParser<DateRangeErrorEnum> Parser { get { return _parser; } }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public static pbr::MessageDescriptor Descriptor {
      get { return global::Google.Ads.GoogleAds.V12.Errors.DateRangeErrorReflection.Descriptor.MessageTypes[0]; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    pbr::MessageDescriptor pb::IMessage.Descriptor {
      get { return Descriptor; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public DateRangeErrorEnum() {
      OnConstruction();
    }

    partial void OnConstruction();

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public DateRangeErrorEnum(DateRangeErrorEnum other) : this() {
      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public DateRangeErrorEnum Clone() {
      return new DateRangeErrorEnum(this);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override bool Equals(object other) {
      return Equals(other as DateRangeErrorEnum);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public bool Equals(DateRangeErrorEnum other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      return Equals(_unknownFields, other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override int GetHashCode() {
      int hash = 1;
      if (_unknownFields != null) {
        hash ^= _unknownFields.GetHashCode();
      }
      return hash;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override string ToString() {
      return pb::JsonFormatter.ToDiagnosticString(this);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void WriteTo(pb::CodedOutputStream output) {
    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      output.WriteRawMessage(this);
    #else
      if (_unknownFields != null) {
        _unknownFields.WriteTo(output);
      }
    #endif
    }

    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
      if (_unknownFields != null) {
        _unknownFields.WriteTo(ref output);
      }
    }
    #endif

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public int CalculateSize() {
      int size = 0;
      if (_unknownFields != null) {
        size += _unknownFields.CalculateSize();
      }
      return size;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void MergeFrom(DateRangeErrorEnum other) {
      if (other == null) {
        return;
      }
      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void MergeFrom(pb::CodedInputStream input) {
    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      input.ReadRawMessage(this);
    #else
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
            break;
        }
      }
    #endif
    }

    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
            break;
        }
      }
    }
    #endif

    #region Nested types
    /// Container for nested types declared in the DateRangeErrorEnum message type.
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public static partial class Types {
      ///
      /// Enum describing possible date range errors.
      ///
      public enum DateRangeError {
        ///
        /// Enum unspecified.
        ///
        [pbr::OriginalName("UNSPECIFIED")] Unspecified = 0,
        ///
        /// The received error code is not known in this version.
        ///
        [pbr::OriginalName("UNKNOWN")] Unknown = 1,
        ///
        /// Invalid date.
        ///
        [pbr::OriginalName("INVALID_DATE")] InvalidDate = 2,
        ///
        /// The start date was after the end date.
        ///
        [pbr::OriginalName("START_DATE_AFTER_END_DATE")] StartDateAfterEndDate = 3,
        ///
        /// Cannot set date to past time
        ///
        [pbr::OriginalName("CANNOT_SET_DATE_TO_PAST")] CannotSetDateToPast = 4,
        ///
        /// A date was used that is past the system "last" date.
        ///
        [pbr::OriginalName("AFTER_MAXIMUM_ALLOWABLE_DATE")] AfterMaximumAllowableDate = 5,
        ///
        /// Trying to change start date on a resource that has started.
        ///
        [pbr::OriginalName("CANNOT_MODIFY_START_DATE_IF_ALREADY_STARTED")] CannotModifyStartDateIfAlreadyStarted = 6,
      }

    }
    #endregion

  }

  #endregion

}

#endregion Designer generated code


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity"
    android:background="#8bc34a"
    android:orientation="vertical"
    android:gravity="center_horizontal"
    >

    <RelativeLayout
        android:id="@+id/one"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_marginBottom="10dp"
        >

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@mipmap/header"
            android:scaleType="centerCrop"
            />

        <com.chiemy.widget.maskprogress.HollowCircleProgress
            android:id="@+id/mask_circle_progress"
            android:layout_centerHorizontal="true"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="150dp"
        android:layout_height="150dp">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@mipmap/header"
            android:scaleType="centerCrop"
            />

        <com.chiemy.widget.maskprogress.RectangleProgress
            android:layout_centerHorizontal="true"
            android:id="@+id/mask_progress"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </RelativeLayout>

    <SeekBar
        android:id="@+id/seekbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/mask_progress"
        />

</LinearLayout>


text:
require "rails_helper"

RSpec.describe ArticleMailer do
  let(:user) { create(:user, email: 'aimee@hanso.dk') }

  context ".notify_author_of_staleness" do
    let(:articles) do
      3.times { create(:article, :stale, author: user) }
      user.articles
    end
    let(:mailer) { described_class.notify_author_of_staleness(articles) }

    subject { mailer }

    it { is_expected.to send_email_to(email: user.email) }
    it { is_expected.to use_template('stale-article-alert') }
    it { is_expected.to have_subject('Some of your Orientation articles might be stale') }
    # If the slug for all artuckes are in the email, it's a safe bet the full URLs are as well.
    it { articles.each { |article| is_expected.to include_merge_var_content(article.slug) } }
    it { is_expected.to include_merge_var_content(articles.second.slug) }
    it { is_expected.to include_merge_var_content(articles.third.slug) }
    it { is_expected.to be_from(email: 'orientation@codeschool.com') }
  end

  context ".send_updates_for(article, user)" do
    let(:article) { create(:article) }
    let(:mailer) { described_class.send_updates_for(article, user) }

    subject { mailer }

    it { is_expected.to send_email_to(email: user.email) }
    it { is_expected.to use_template('article-subscription-update') }
    it { is_expected.to have_subject("#{article.title} was just updated") }
    it { is_expected.to be_from(email: 'orientation@codeschool.com') }
  end

  context ".send_rotten_notification_for(article, contributors)" do
    let(:article) { create(:article) }
    let(:contributors) do
      [article.author, article.editor].compact.map do |user|
        { name: user.name, email: user.email }
      end
    end

    let(:mailer) { described_class.send_rotten_notification_for(article, contributors) }

    subject { mailer }

    it { is_expected.to send_email_to(email: contributors.first[:email]) }
    it { is_expected.to use_template('article-rotten-update') }
    it { is_expected.to have_subject('Article Rotten Update') }
    it { is_expected.to be_from(email: 'orientation@codeschool.com') }
  end

  context ".send_endorsement_notification_for(article, author, endorser)" do
    let(:article) { create(:article) }
    let(:contributors) { article.contributors }
    let(:endorsement) { create(:article_endorsement, article: article) }
    let(:endorser) { endorsement.user }

    let(:mailer) { described_class.send_endorsement_notification_for(article, contributors, endorser) }

    subject { mailer }

    it { is_expected.to send_email_to(email: contributors.first[:email]) }
    it { is_expected.to use_template('article-endorsement-notification') }
    it { is_expected.to have_subject("#{endorser.name} found #{article.title} useful!") }
    it { is_expected.to be_from(email: 'orientation@codeschool.com') }
  end

end


text:
package com.mercadolibre.restclient;

import com.mercadolibre.restclient.exception.RestException;

import java.io.Closeable;

public interface ExecREST extends Closeable {

    Response get(Request r) throws RestException;

    Response post(Request r) throws RestException;

    Response put(Request r) throws RestException;

    Response delete(Request r) throws RestException;

    Response head(Request rl) throws RestException;

    Response options(Request r) throws RestException;

    Response purge(Request r) throws RestException;

}


text:
module Gapic
  class Operation
    ##
    # The policy for retrying operation reloads using an incremental backoff. A new object instance should be used for
    # every Operation invocation.
    #
    class RetryPolicy
      ##
      # Create new Operation RetryPolicy.
      #
      # @param initial_delay [Numeric] client-side timeout
      # @param multiplier [Numeric] client-side timeout
      # @param max_delay [Numeric] client-side timeout
      # @param timeout [Numeric] client-side timeout
      #
      def initialize initial_delay: nil, multiplier: nil, max_delay: nil, timeout: nil
        @initial_delay = initial_delay
        @multiplier    = multiplier
        @max_delay     = max_delay
        @timeout       = timeout
        @delay         = nil
      end

      def initial_delay
        @initial_delay || 10
      end

      def multiplier
        @multiplier || 1.3
      end

      def max_delay
        @max_delay || 300 # Five minutes
      end

      def timeout
        @timeout || 3600 # One hour
      end

      def call
        return unless retry?

        delay!
        increment_delay!

        true
      end

      private

      def deadline
        # memoize the deadline
        @deadline ||= Time.now + timeout
      end

      def retry?
        deadline > Time.now
      end

      ##
      # The current delay value.
      def delay
        @delay || initial_delay
      end

      def delay!
        # Call Kernel.sleep so we can stub it.
        Kernel.sleep delay
      end

      ##
      # Calculate and set the next delay value.
      def increment_delay!
        @delay = [delay * multiplier, max_delay].min
      end
    end
  end
end


text:
<?php
/**
 * Dependencias
 */
App::uses('AppHelper', 'View');

/**
 * Ayudante de la plataforma.
 */
class PlataformaHelper extends AppHelper {

/**
 * Ayudantes
 *
 * @var array
 */
	public $helpers = array('Html');

/**
 * Obtiene la versión de la plataforma.
 *
 * @param bool $link Indica si se devuelve un enlace HTML.
 *
 * @return string
 */
	public function obtenerVersion($link = true) {
		$archivo = APP . 'Config' . DS . 'VERSION.txt';
		$version = 'master';

		if (file_exists($archivo)) {
			$hash = file_get_contents($archivo);
			if (!empty($hash)) {
				$version = substr($hash, 0, 7);
			}
		}

		return !$link ? $version : $this->Html->link($version, "https://github.com/UTN-FRD/tutorias/tree/$version",
			array('target' => '_blank'));
	}

/**
 * Obtiene el título de la plataforma.
 *
 * @param string|null $texto Especifica una cadena adicional para el título.
 *
 * @return string
 */
	public function obtenerTitulo($texto = null) {
		$titulo = !$this->esGraduados() ? 'Tutorías' : 'Graduados';
		if ($texto) {
			$titulo .= " - $texto";
		}

		return h($titulo);
	}

/**
 * Comprueba si la instalación corresponde a la versión de Graduados.
 *
 * @return bool
 */
	public function esGraduados() {
		if (!Configure::check('Plataforma.Graduados')) {
			return stripos(__FILE__, 'graduados') !== false;
		}

		return Configure::read('Plataforma.Graduados') === true;
	}
}


text:
from abc import ABCMeta, abstractmethod
from six import add_metaclass
from uuid import uuid4

@add_metaclass(ABCMeta)
class Broker(object):

    @abstractmethod
    def add_job(self, job_class, *args, **kwargs):
        """
        Add a job to the broker

        :param job_class: python class of the payload job
        :param args: arguments to execute the job
        :param kwargs: keyword arguments to execute the job
        """
        raise NotImplementedError

    def gen_job_id(self):
        """
        Generate a new unique job ID
        """
        return str(uuid4())

    def serialize_job(self, job_class, job_id, args, kwargs):
        """
        Serialize a job into a string to be sent to the broker

        :param job_class: python class of the payload job
        :param job_id: the ID of the job
        :param args: arguments of the job
        :param kwargs: keyword arguments of the job
        """
        return self.connector.serialize_job(job_class, job_id, args, kwargs)

    def unserialize_job(self, job_class, queue_name, payload):
        """
        Build a job given a payload returned from the broker

        :param job_class: python class of the payload job
        :param queue_name: queue where the job was located
        :param payload: python dict with the job arguments
        """
        return self.connector.unserialize_job(job_class, queue_name, payload)


text:
class Sundae {
  private Sundae() {}
  static Sundae makeASundae() {
    return new Sundae();
  }
}

public class IceCream {
  public static void main(String[] args) {
    //- Sundae x = new Sundae();
    Sundae x = Sundae.makeASundae();
  }
}


text:
#if TARGET_OS_IPHONE

#import <Foundation/Foundation.h>

@interface WebMIMETypeRegistry : NSObject

+ (NSString *)mimeTypeForExtension:(NSString *)extension;

+ (NSString *)preferredExtensionForMIMEType:(NSString *)mimeType;

// Check to see if a mime type is suitable for being loaded inline as an
// image (e.g., <img> tags).
+ (BOOL)isSupportedImageMIMEType:(NSString *)mimeType;

// Check to see if a mime type is suitable for being loaded using <video> and <audio>
+ (BOOL)isSupportedMediaMIMEType:(NSString *)mimeType;

@end

#endif


text:
layout: post
title: "The Comic Book Club 1st Anniversary Limited Special Exclusive Variant Non-Slabbed Edition"
description: "One year ago, on this day, we got together for a pint and chips to chat about a comic book we read."
tags: [blog]
modified: 2016-05-28
author: Chao Xian
image:
  feature: comic/a-years-worth-of-comic-book-club-books.jpg
  credit: Chao Xian
  creditlink: https://www.instagram.com/chao_xian/
---

A year ago today, I got together with a small bunch of friends who I knew had a passion for comics. I had an idea that if my wife was reading a book a month from her book club, I could do the same with a Comic Book Club.

## Meeting up

The gatherings have been a tremendous success. We have had such a good time not just discussing the books we've picked but on comic book topics in general. So much so I've even started up a Slack team where we also discuss comics with more of our chums who live further afield.

Slack has given us a chance to chat about things like lamenting [DC's many, many failings](https://www.subtraction.com/2016/05/18/yet-another-new-dc-comics-logo/) or the latest [controversies](https://www.instagram.com/p/BF8K2Wqvu60/) in the 4 weeks in between our meetups (by which time we'd normally forget to bring it up), and to hear more opinions (and jokes) from some very funny people

Several bowls full of chips with our drinks have also added to the pleasantness when we do meet IRL. We've turned into typical village life old men. Always going to our favourite pub, sitting in our favourite spot and always eating our favourite grub.

![Meetup]({{site.url}}/images/DCBC-colour.jpg)

## "I absolutely hate it"

But the real fun is when we each have our say on the book one of us has picked for that month to read. We either gush over a brilliant choice or absolutely hate it while enjoying being able to express our views.

Choosing a book though can be slightly wrought with anxiety. For me it is at least. My club mates are clearly people of good tastes (musically less so maybe) with brilliant shortlists kept ready to pluck a great book from. I feel a pressure to pick a decent book and I am terrible at it. It doesn't help that I am not as knowledgable with the comic book scene as the others. There was a time I was deep in it, when I worked in a comic book shop for my Saturday job as a teenager. But nowadays I avoid reading up on comics as it is full of spoilers or details of books I don't want to read. Or worse: too many that I want to waste money on.

## There's more to life than Batman!

Otherwise though I am really lucky with this small group as we could easily have ended up all having terrible book choices as I do. And that would render the club slightly pointless in terms of reading. I can make my bad decisions on my own after all. What's really great is that the club has opened me up to a whole world of books that aren't just Batman or X-Men. These have been books that would not have been purchases I would have made otherwise. And though there have been some I have not enjoyed, the ones I did have been revelations to me.

[The Metabarons]({{site.url}}/the-metabarons) is a clear example.

![The Metabarons]({{site.url}}/images/comic/the-metabarons/metabarons-lineage.jpg)

## Precious time

What started out as a slight excuse to buy myself a graphic novel a month has become the one point in my (quite barren) social calendar that I look forward to the most. Dan, Tom and Jake are great company and I am really pleased at how well this little idea I had has turned out.

Long may it continue.


text:
<?php

declare(strict_types=1);

namespace spec\FSi\Bundle\AdminSecurityBundle\EventListener;

use FSi\Bundle\AdminSecurityBundle\Event\AdminSecurityEvents;
use FSi\Bundle\AdminSecurityBundle\Event\ChangePasswordEvent;
use FSi\Bundle\AdminSecurityBundle\Event\UserEvent;
use FSi\Bundle\AdminSecurityBundle\Security\User\ChangeablePasswordInterface;
use FSi\Bundle\AdminSecurityBundle\Security\User\UserInterface;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;

class EncodePasswordListenerSpec extends ObjectBehavior
{
    public function let(EncoderFactoryInterface $encoderFactory): void
    {
        $this->beConstructedWith($encoderFactory);
    }

    public function it_subscribes_change_password_event(): void
    {
        $this->getSubscribedEvents()->shouldReturn([
            AdminSecurityEvents::CHANGE_PASSWORD => 'onChangePassword',
            AdminSecurityEvents::USER_CREATED => 'onUserCreated',
        ]);
    }

    public function it_does_nothing_if_plain_password_is_not_set(
        ChangePasswordEvent $event,
        ChangeablePasswordInterface $user
    ): void {
        $event->getUser()->willReturn($user);
        $user->getPlainPassword()->willReturn(null);

        $user->setPassword(Argument::any())->shouldNotBeCalled();

        $this->onChangePassword($event);
    }

    public function it_encodes_password_for_user(
        EncoderFactoryInterface $encoderFactory,
        PasswordEncoderInterface $encoder,
        ChangePasswordEvent $event,
        UserInterface $user
    ): void {
        $event->getUser()->willReturn($user);
        $user->getPlainPassword()->willReturn('new-password');
        $encoderFactory->getEncoder($user)->willReturn($encoder);
        $user->getSalt()->willReturn('salt');
        $encoder->encodePassword('new-password', 'salt')->willReturn('encoded-new-password');

        $user->setPassword('encoded-new-password')->shouldBeCalled();
        $user->eraseCredentials()->shouldBeCalled();

        $this->onChangePassword($event);
    }

    public function it_encodes_password_for_new_user(
        EncoderFactoryInterface $encoderFactory,
        PasswordEncoderInterface $encoder,
        UserEvent $event,
        UserInterface $user
    ): void {
        $event->getUser()->willReturn($user);
        $user->getPlainPassword()->willReturn('new-password');
        $encoderFactory->getEncoder($user)->willReturn($encoder);
        $user->getSalt()->willReturn('salt');
        $encoder->encodePassword('new-password', 'salt')->willReturn('encoded-new-password');

        $user->setPassword('encoded-new-password')->shouldBeCalled();
        $user->eraseCredentials()->shouldBeCalled();

        $this->onUserCreated($event);
    }
}


text:
package validator

import (
	"fmt"
	"regexp"
	"strings"
)

type CommitMessageValidator struct {
	message                 string
	commit_types            []string
	first_line_length_limit int
	other_line_length_limit int
}

func NewCommitMessageValidator(message string) (v *CommitMessageValidator) {
	v = new(CommitMessageValidator)
	v.message = message
	v.commit_types = append(v.commit_types, "feat", "fix", "docs", "style", "refactor", "test", "chore")
	v.first_line_length_limit = 70
	v.other_line_length_limit = 100
	return v
}

func (v *CommitMessageValidator) IsValidCommitMessage() (valid bool) {
	err := v.ValidateCommitMessage()
	if err == nil {
		valid = true
	}
	return
}

func (v *CommitMessageValidator) ValidateCommitMessage() (err error) {
	if len(v.message) == 0 {
		err = fmt.Errorf("Empty commit message")
		return
	}
	lines := strings.Split(v.message, "\n")

	firstline := lines[0]
	validFirstLine := regexp.MustCompile(`^(.*)\((.*)\): (.*)$`)

	groups := validFirstLine.FindStringSubmatch(firstline)
	if len(groups) != 4 {
		err = fmt.Errorf("First commit message line (header) does not follow format: type(scope): message")
		return
	}

	commit_message := groups[3]

	capitalMatch, _ := regexp.MatchString("^[A-Z]", commit_message)
	if capitalMatch {
		err = fmt.Errorf("Commit subject '%s' must not have a capital first letter!", commit_message)
		return
	}

	dotMatch, _ := regexp.MatchString("\\.$", commit_message)
	if dotMatch {
		err = fmt.Errorf("Commit subject '%s' must not end with a dot (.)!", commit_message)
		return
	}

	commit_type := groups[1]
	if !v.isValidType(commit_type) {
		err = fmt.Errorf("Commit type '%s' not in valid ones: %s!", commit_type, strings.Join(v.commit_types, ", "))
		return
	}

	if len(lines) > 1 {
		if lines[1] != "" {
			err = fmt.Errorf("Second commit message line must be empty!")
			return
		}
		for _, l := range lines[1:] {
			if len(l) > v.other_line_length_limit {
				if string(l[0]) == "#" { // Ignore comments.
					continue
				}
				err = fmt.Errorf("Other lines should not be longer than %d characters! It has %d characters.", v.other_line_length_limit, len(l))
				return
			}
		}
	}

	if len(firstline) > v.first_line_length_limit {
		err = fmt.Errorf("First line should not be longer than %d characters! It has %d characters.", v.first_line_length_limit, len(firstline))
		return
	}
	return
}

func (v *CommitMessageValidator) isValidType(t string) (b bool) {
	for _, v := range v.commit_types {
		if v == t {
			return true
		}
	}
	return
}