text:
#include <math.h>
#include "tvgSwCommon.h"
#include "tvgTaskScheduler.h"
#include "tvgSwRenderer.h"
#include "tvgMath.h"

/************************************************************************/
/* Internal Class Implementation                                        */
/************************************************************************/
static int32_t initEngineCnt = false;
static int32_t rendererCnt = 0;
static SwMpool* globalMpool = nullptr;
static uint32_t threadsCnt = 0;

struct SwTask : Task
{
    Matrix* transform = nullptr;
    SwSurface* surface = nullptr;
    SwMpool* mpool = nullptr;
    RenderUpdateFlag flags = RenderUpdateFlag::None;
    Array<RenderData> clips;
    uint32_t opacity;
    SwBBox bbox = {{0, 0}, {0, 0}};       //Whole Rendering Region
    bool pushed = false;                  //Pushed into task list?
    bool disposed = false;                //Disposed task?

    RenderRegion bounds() const
    {
        RenderRegion region;

        //Range over?
        region.x = bbox.min.x > 0 ? bbox.min.x : 0;
        region.y = bbox.min.y > 0 ? bbox.min.y : 0;
        region.w = bbox.max.x - region.x;
        region.h = bbox.max.y - region.y;
        if (region.w < 0) region.w = 0;
        if (region.h < 0) region.h = 0;

        return region;
    }

    virtual bool dispose() = 0;

    virtual ~SwTask()
    {
        free(transform);
    }
};

struct SwShapeTask : SwTask
{
    SwShape shape;
    const Shape* sdata = nullptr;
    bool cmpStroking = false;

    void run(unsigned tid) override
    {
        if (opacity == 0) return;  //Invisible

        uint8_t strokeAlpha = 0;
        auto visibleStroke = false;
        bool visibleFill = false;
        auto clipRegion = bbox;

        if (HALF_STROKE(sdata->strokeWidth()) > 0) {
            sdata->strokeColor(nullptr, nullptr, nullptr, &strokeAlpha);
            visibleStroke = sdata->strokeFill() || (static_cast<uint32_t>(strokeAlpha * opacity / 255) > 0);
        }

        //This checks also for the case, if the invisible shape turned to visible by alpha.
        auto prepareShape = false;
        if (!shapePrepared(&shape) && (flags & RenderUpdateFlag::Color)) prepareShape = true;

        //Shape
        if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform) || prepareShape) {
            uint8_t alpha = 0;
            sdata->fillColor(nullptr, nullptr, nullptr, &alpha);
            alpha = static_cast<uint8_t>(static_cast<uint32_t>(alpha) * opacity / 255);
            visibleFill = (alpha > 0 || sdata->fill());
            if (visibleFill || visibleStroke) {
                shapeReset(&shape);
                if (!shapePrepare(&shape, sdata, transform, clipRegion, bbox, mpool, tid, clips.count > 0 ? true : false)) goto err;
            }
        }

        //Decide Stroking Composition
        if (visibleStroke && visibleFill && opacity < 255) cmpStroking = true;
        else cmpStroking = false;

        //Fill
        if (flags & (RenderUpdateFlag::Gradient | RenderUpdateFlag::Transform | RenderUpdateFlag::Color)) {
            if (visibleFill) {
                /* We assume that if stroke width is bigger than 2,
                   shape outline below stroke could be full covered by stroke drawing.
                   Thus it turns off antialising in that condition.
                   Also, it shouldn't be dash style. */
                auto antiAlias = (strokeAlpha == 255 && sdata->strokeWidth() > 2 && sdata->strokeDash(nullptr) == 0) ? false : true;

                if (!shapeGenRle(&shape, sdata, antiAlias)) goto err;
            }
            if (auto fill = sdata->fill()) {
                auto ctable = (flags & RenderUpdateFlag::Gradient) ? true : false;
                if (ctable) shapeResetFill(&shape);
                if (!shapeGenFillColors(&shape, fill, transform, surface, cmpStroking ? 255 : opacity, ctable)) goto err;
            } else {
                shapeDelFill(&shape);
            }
        }

        //Stroke
        if (flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform)) {
            if (visibleStroke) {
                shapeResetStroke(&shape, sdata, transform);
                if (!shapeGenStrokeRle(&shape, sdata, transform, clipRegion, bbox, mpool, tid)) goto err;

                if (auto fill = sdata->strokeFill()) {
                    auto ctable = (flags & RenderUpdateFlag::GradientStroke) ? true : false;
                    if (ctable) shapeResetStrokeFill(&shape);
                    if (!shapeGenStrokeFillColors(&shape, fill, transform, surface, cmpStroking ? 255 : opacity, ctable)) goto err;
                } else {
                    shapeDelStrokeFill(&shape);
                }
            } else {
                shapeDelStroke(&shape);
            }
        }

        //Clip Path
        for (auto clip = clips.data; clip < (clips.data + clips.count); ++clip) {
            auto clipper = &static_cast<SwShapeTask*>(*clip)->shape;
            //Clip shape rle
            if (shape.rle) {
                if (clipper->fastTrack) rleClipRect(shape.rle, &clipper->bbox);
                else if (clipper->rle) rleClipPath(shape.rle, clipper->rle);
                else goto err;
            }
            //Clip stroke rle
            if (shape.strokeRle) {
                if (clipper->fastTrack) rleClipRect(shape.strokeRle, &clipper->bbox);
                else if (clipper->rle) rleClipPath(shape.strokeRle, clipper->rle);
                else goto err;
            }
        }
        goto end;

    err:
        shapeReset(&shape);
    end:
        shapeDelOutline(&shape, mpool, tid);
    }

    bool dispose() override
    {
       shapeFree(&shape);
       return true;
    }
};

struct SwImageTask : SwTask
{
    SwImage image;

    void run(unsigned tid) override
    {
        auto clipRegion = bbox;

        //Invisible shape turned to visible by alpha.
        if ((flags & (RenderUpdateFlag::Image | RenderUpdateFlag::Transform | RenderUpdateFlag::Color)) && (opacity > 0)) {
            imageReset(&image);
            if (!image.data || image.w == 0 || image.h == 0) goto end;

            if (!imagePrepare(&image, transform, clipRegion, bbox, mpool, tid)) goto end;

            if (clips.count > 0) {
                if (!imageGenRle(&image, bbox, false)) goto end;
                if (image.rle) {
                    for (auto clip = clips.data; clip < (clips.data + clips.count); ++clip) {
                        auto clipper = &static_cast<SwShapeTask*>(*clip)->shape;
                        if (clipper->fastTrack) rleClipRect(image.rle, &clipper->bbox);
                        else if (clipper->rle) rleClipPath(image.rle, clipper->rle);
                        else goto err;
                    }
                }
            }
        }
        goto end;

    err:
        rleReset(image.rle);
    end:
        imageDelOutline(&image, mpool, tid);
    }

    bool dispose() override
    {
       imageFree(&image);
       return true;
    }
};

static void _termEngine()
{
    if (rendererCnt > 0) return;

    mpoolTerm(globalMpool);
    globalMpool = nullptr;
}

/************************************************************************/
/* External Class Implementation                                        */
/************************************************************************/

SwRenderer::~SwRenderer()
{
    clearCompositors();

    if (surface) delete(surface);

    if (!sharedMpool) mpoolTerm(mpool);

    --rendererCnt;

    if (rendererCnt == 0 && initEngineCnt == 0) _termEngine();
}

bool SwRenderer::clear()
{
    for (auto task = tasks.data; task < (tasks.data + tasks.count); ++task) {
        if ((*task)->disposed) {
            delete(*task);
        } else {
            (*task)->done();
            (*task)->pushed = false;
        }
    }
    tasks.clear();

    if (!sharedMpool) mpoolClear(mpool);

    if (surface) {
        vport.x = vport.y = 0;
        vport.w = surface->w;
        vport.h = surface->h;
    }

    return true;
}

bool SwRenderer::sync()
{
    return true;
}

RenderRegion SwRenderer::viewport()
{
    return vport;
}

bool SwRenderer::viewport(const RenderRegion& vp)
{
    vport = vp;
    return true;
}

bool SwRenderer::target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, uint32_t cs)
{
    if (!buffer || stride == 0 || w == 0 || h == 0 || w > stride) return false;

    if (!surface) surface = new SwSurface;

    surface->buffer = buffer;
    surface->stride = stride;
    surface->w = w;
    surface->h = h;
    surface->cs = cs;

    vport.x = vport.y = 0;
    vport.w = surface->w;
    vport.h = surface->h;

    return rasterCompositor(surface);
}

bool SwRenderer::preRender()
{
    return rasterClear(surface);
}

void SwRenderer::clearCompositors()
{
    //Free Composite Caches
    for (auto comp = compositors.data; comp < (compositors.data + compositors.count); ++comp) {
        free((*comp)->compositor->image.data);
        delete((*comp)->compositor);
        delete(*comp);
    }
    compositors.reset();
}

bool SwRenderer::postRender()
{
    //Unmultiply alpha if needed
    if (surface->cs == SwCanvas::ABGR8888_STRAIGHT || surface->cs == SwCanvas::ARGB8888_STRAIGHT) {
        rasterUnpremultiply(surface);
    }

    for (auto task = tasks.data; task < (tasks.data + tasks.count); ++task) {
        (*task)->pushed = false;
    }
    tasks.clear();

    clearCompositors();
    return true;
}

bool SwRenderer::renderImage(RenderData data)
{
    auto task = static_cast<SwImageTask*>(data);
    task->done();

    if (task->opacity == 0) return true;

    return rasterImage(surface, &task->image, task->transform, task->bbox, task->opacity);
}

bool SwRenderer::renderShape(RenderData data)
{
    auto task = static_cast<SwShapeTask*>(data);
    if (!task) return false;

    task->done();

    if (task->opacity == 0) return true;

    uint32_t opacity;
    Compositor* cmp = nullptr;

    //Do Stroking Composition
    if (task->cmpStroking) {
        opacity = 255;
        cmp = target(task->bounds());
        beginComposite(cmp, CompositeMethod::None, task->opacity);
    //No Stroking Composition
    } else {
        opacity = task->opacity;
    }

    //Main raster stage
    uint8_t r, g, b, a;

    if (auto fill = task->sdata->fill()) {
        rasterGradientShape(surface, &task->shape, fill->identifier());
    } else {
        task->sdata->fillColor(&r, &g, &b, &a);
        a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
        if (a > 0) rasterShape(surface, &task->shape, r, g, b, a);
    }

    if (auto strokeFill = task->sdata->strokeFill()) {
        rasterGradientStroke(surface, &task->shape, strokeFill->identifier());
    } else {
        if (task->sdata->strokeColor(&r, &g, &b, &a) == Result::Success) {
            a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
            if (a > 0) rasterStroke(surface, &task->shape, r, g, b, a);
        }
    }

    if (task->cmpStroking) endComposite(cmp);

    return true;
}

RenderRegion SwRenderer::region(RenderData data)
{
    return static_cast<SwTask*>(data)->bounds();
}

bool SwRenderer::beginComposite(Compositor* cmp, CompositeMethod method, uint32_t opacity)
{
    if (!cmp) return false;
    auto p = static_cast<SwCompositor*>(cmp);

    p->method = method;
    p->opacity = opacity;

    //Current Context?
    if (p->method != CompositeMethod::None) {
        surface = p->recoverSfc;
        surface->compositor = p;
    }

    return true;
}

bool SwRenderer::mempool(bool shared)
{
    if (shared == sharedMpool) return true;

    if (shared) {
        if (!sharedMpool) {
            if (!mpoolTerm(mpool)) return false;
            mpool = globalMpool;
        }
    } else {
        if (sharedMpool) mpool = mpoolInit(threadsCnt);
    }

    sharedMpool = shared;

    if (mpool) return true;
    return false;
}

Compositor* SwRenderer::target(const RenderRegion& region)
{
    auto x = region.x;
    auto y = region.y;
    auto w = region.w;
    auto h = region.h;
    auto sw = static_cast<int32_t>(surface->w);
    auto sh = static_cast<int32_t>(surface->h);

    //Out of boundary
    if (x > sw || y > sh) return nullptr;

    SwSurface* cmp = nullptr;

    //Use cached data
    for (auto p = compositors.data; p < (compositors.data + compositors.count); ++p) {
        if ((*p)->compositor->valid) {
            cmp = *p;
            break;
        }
    }

    //New Composition
    if (!cmp) {
        cmp = new SwSurface;
        if (!cmp) goto err;

        //Inherits attributes from main surface
        *cmp = *surface;

        cmp->compositor = new SwCompositor;
        if (!cmp->compositor) goto err;

        //SwImage, Optimize Me: Surface size from MainSurface(WxH) to Parameter W x H
        cmp->compositor->image.data = (uint32_t*) malloc(sizeof(uint32_t) * surface->stride * surface->h);
        if (!cmp->compositor->image.data) goto err;
        compositors.push(cmp);
    }

    //Boundary Check
    if (x + w > sw) w = (sw - x);
    if (y + h > sh) h = (sh - y);

    TVGLOG("SW_ENGINE", "Using intermediate composition [Region: %d %d %d %d]", x, y, w, h);

    cmp->compositor->recoverSfc = surface;
    cmp->compositor->recoverCmp = surface->compositor;
    cmp->compositor->valid = false;
    cmp->compositor->bbox.min.x = x;
    cmp->compositor->bbox.min.y = y;
    cmp->compositor->bbox.max.x = x + w;
    cmp->compositor->bbox.max.y = y + h;
    cmp->compositor->image.stride = surface->stride;
    cmp->compositor->image.w = surface->w;
    cmp->compositor->image.h = surface->h;
    cmp->compositor->image.direct = true;

    //We know partial clear region
    cmp->buffer = cmp->compositor->image.data + (cmp->stride * y + x);
    cmp->w = w;
    cmp->h = h;

    rasterClear(cmp);

    //Recover context
    cmp->buffer = cmp->compositor->image.data;
    cmp->w = cmp->compositor->image.w;
    cmp->h = cmp->compositor->image.h;

    //Switch render target
    surface = cmp;

    return cmp->compositor;

err:
    if (cmp) {
        if (cmp->compositor) delete(cmp->compositor);
        delete(cmp);
    }

    return nullptr;
}

bool SwRenderer::endComposite(Compositor* cmp)
{
    if (!cmp) return false;

    auto p = static_cast<SwCompositor*>(cmp);
    p->valid = true;

    //Recover Context
    surface = p->recoverSfc;
    surface->compositor = p->recoverCmp;

    //Default is alpha blending
    if (p->method == CompositeMethod::None) {
        return rasterImage(surface, &p->image, nullptr, p->bbox, p->opacity);
    }

    return true;
}

bool SwRenderer::dispose(RenderData data)
{
    auto task = static_cast<SwTask*>(data);
    if (!task) return true;
    task->done();
    task->dispose();

    if (task->pushed) task->disposed = true;
    else delete(task);

    return true;
}

void* SwRenderer::prepareCommon(SwTask* task, const RenderTransform* transform, uint32_t opacity, const Array<RenderData>& clips, RenderUpdateFlag flags)
{
    if (!surface) return task;
    if (flags == RenderUpdateFlag::None) return task;

    //Finish previous task if it has duplicated request.
    task->done();

    if (clips.count > 0) {
        //Guarantee composition targets get ready.
        for (auto clip = clips.data; clip < (clips.data + clips.count); ++clip) {
            static_cast<SwShapeTask*>(*clip)->done();
        }
        task->clips = clips;
    }

    if (transform) {
        if (!task->transform) task->transform = static_cast<Matrix*>(malloc(sizeof(Matrix)));
        *task->transform = transform->m;
    } else {
        if (task->transform) free(task->transform);
        task->transform = nullptr;
    }

    task->opacity = opacity;
    task->surface = surface;
    task->mpool = mpool;
    task->flags = flags;
    task->bbox.min.x = mathMax(static_cast<SwCoord>(0), static_cast<SwCoord>(vport.x));
    task->bbox.min.y = mathMax(static_cast<SwCoord>(0), static_cast<SwCoord>(vport.y));
    task->bbox.max.x = mathMin(static_cast<SwCoord>(surface->w), static_cast<SwCoord>(vport.x + vport.w));
    task->bbox.max.y = mathMin(static_cast<SwCoord>(surface->h), static_cast<SwCoord>(vport.y + vport.h));

    if (!task->pushed) {
        task->pushed = true;
        tasks.push(task);
    }

    TaskScheduler::request(task);

    return task;
}

RenderData SwRenderer::prepare(Surface* image, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags)
{
    //prepare task
    auto task = static_cast<SwImageTask*>(data);
    if (!task) {
        task = new SwImageTask;
        if (flags & RenderUpdateFlag::Image) {
            task->image.data = image->buffer;
            task->image.w = image->w;
            task->image.h = image->h;
            task->image.stride = image->stride;
        }
    }
    return prepareCommon(task, transform, opacity, clips, flags);
}

RenderData SwRenderer::prepare(const Shape& sdata, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags)
{
    //prepare task
    auto task = static_cast<SwShapeTask*>(data);
    if (!task) {
        task = new SwShapeTask;
        task->sdata = &sdata;
    }
    return prepareCommon(task, transform, opacity, clips, flags);
}

SwRenderer::SwRenderer():mpool(globalMpool)
{
}

bool SwRenderer::init(uint32_t threads)
{
    if ((initEngineCnt++) > 0) return true;

    threadsCnt = threads;

    //Share the memory pool among the renderer
    globalMpool = mpoolInit(threads);
    if (!globalMpool) {
        --initEngineCnt;
        return false;
    }

    return true;
}

int32_t SwRenderer::init()
{
    return initEngineCnt;
}

bool SwRenderer::term()
{
    if ((--initEngineCnt) > 0) return true;

    initEngineCnt = 0;

   _termEngine();

    return true;
}

SwRenderer* SwRenderer::gen()
{
    ++rendererCnt;
    return new SwRenderer();
}


text:
<!--
Please use https://www.cuba-platform.com/discuss for discussion, support, and reporting problems about CUBA Studio.
This repository is only for issues of the CUBA platform Gradle plugin.

When creating an issue, provide as much as possible of the following information:
-->

### Environment

- Platform version: X.Y.Z <!-- e.g. 6.8.7 -->
- Gradle version: X.Y <!-- e.g. 4.3 -->
<!-- Optional. Remove irrelevant lines. -->
- Operating system: <!-- Windows, Linux, macOS -->

### Description of the bug or enhancement

- Minimal reproducible example
- Expected behavior
- Actual behavior

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'

describe PrivateMessenger, '#invitation' do
  it 'sends the correct invitation' do
    event_owner = create(:user)
    invitee = create(:user)
    message = :invitation
    event = create(:event, owner: event_owner)
    invitation = build(:invitation, event: event, invitee: invitee)

    PrivateMessenger.new(
      recipient: invitee,
      message: message,
      sender: event_owner,
      message_object: invitation
    ).deliver

    FakeYammer.messages_endpoint_hits.should == 1
    FakeYammer.message.should include('vote')
    FakeYammer.message.should include(event_owner.name)
  end
end

describe PrivateMessenger, '#reminder' do
  it 'sends the correct reminder' do
    event_owner = create(:user)
    invitee = create(:user)
    message = :reminder
    event = create(:event, owner: event_owner)
    invitation = build(:invitation, event: event, invitee: invitee)

    PrivateMessenger.new(
      recipient: invitee,
      message: message,
      sender: event_owner,
      message_object: invitation
    ).deliver

    FakeYammer.messages_endpoint_hits.should == 1
    FakeYammer.message.should include('Reminder')
    FakeYammer.message.should include(event_owner.name)
  end
end

describe PrivateMessenger, '#group_invitation' do
  it 'sends a group invitation' do
    event_owner = create(:user)
    group = create(:group)
    message = :group_invitation
    event = create(:event, owner: event_owner)
    invitation = build(:invitation, event: event, invitee: group)

    PrivateMessenger.new(
      recipient: group,
      message: message,
      sender: event_owner,
      message_object: invitation
    ).deliver

    FakeYammer.messages_endpoint_hits.should == 1
    FakeYammer.message.should include('I want your input')
    FakeYammer.message.should include(group.name)
  end
end

describe PrivateMessenger, '#group_reminder' do
  it 'sends a group reminder' do
    event_owner = create(:user)
    group = create(:group)
    message = :group_reminder
    event = create(:event, owner: event_owner)
    invitation = build(:invitation, event: event, invitee: group)

    PrivateMessenger.new(
      recipient: group,
      message: message,
      sender: event_owner,
      message_object: invitation
    ).deliver

    FakeYammer.messages_endpoint_hits.should == 1
    FakeYammer.message.should include('Reminder')
    FakeYammer.message.should include(event_owner.name)
  end
end


text:
package com.hazelcast.sql.impl.exec.io;

import com.hazelcast.sql.impl.LoggingFlowControl;
import com.hazelcast.sql.impl.LoggingQueryOperationHandler;
import com.hazelcast.sql.impl.QueryId;
import com.hazelcast.sql.impl.SqlTestSupport;
import com.hazelcast.sql.impl.exec.IterationResult;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.annotation.ParallelJVMTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import java.util.UUID;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@RunWith(HazelcastParallelClassRunner.class)
@Category({QuickTest.class, ParallelJVMTest.class})
public class ReceiveExecTest extends SqlTestSupport {
    @Test
    public void testReceive() {
        UUID localMemberId = UUID.randomUUID();
        QueryId queryId = QueryId.create(UUID.randomUUID());
        int edgeId = 1;
        int rowWidth = 100;
        LoggingQueryOperationHandler operationHandler = new LoggingQueryOperationHandler();
        LoggingFlowControl flowControl = new LoggingFlowControl(queryId, edgeId, localMemberId, operationHandler);

        Inbox inbox = new Inbox(
            operationHandler,
            queryId,
            edgeId,
            false,
            rowWidth,
            localMemberId,
            2,
            flowControl
        );

        ReceiveExec exec = new ReceiveExec(1, inbox);

        // Test setup.
        exec.setup(emptyFragmentContext());

        assertTrue(flowControl.isSetupInvoked());

        // Advance on empty.
        assertEquals(IterationResult.WAIT, exec.advance());
        checkMonotonicBatch(exec.currentBatch(), 0, 0);

        // Read non-last batch.
        inbox.onBatch(new InboundBatch(createMonotonicBatch(0, 10), 0L, false, UUID.randomUUID()), 100L);

        assertEquals(IterationResult.FETCHED, exec.advance());
        checkMonotonicBatch(exec.currentBatch(), 0, 10);

        assertEquals(IterationResult.WAIT, exec.advance());
        checkMonotonicBatch(exec.currentBatch(), 10, 0);

        // Read last batch, with one stream still opened.
        inbox.onBatch(new InboundBatch(createMonotonicBatch(10, 20), 0L, true, UUID.randomUUID()), 100L);

        assertEquals(IterationResult.FETCHED, exec.advance());
        checkMonotonicBatch(exec.currentBatch(), 10, 20);

        assertEquals(IterationResult.WAIT, exec.advance());
        checkMonotonicBatch(exec.currentBatch(), 30, 0);

        // One more last batch, now closing the stream.
        inbox.onBatch(new InboundBatch(createMonotonicBatch(30, 30), 0L, false, UUID.randomUUID()), 100L);
        inbox.onBatch(new InboundBatch(createMonotonicBatch(60, 40), 0L, true, UUID.randomUUID()), 100L);

        assertEquals(IterationResult.FETCHED, exec.advance());
        checkMonotonicBatch(exec.currentBatch(), 30, 30);

        assertEquals(IterationResult.FETCHED_DONE, exec.advance());
        checkMonotonicBatch(exec.currentBatch(), 60, 40);

        // Re-check after close.
        assertThrows(IllegalStateException.class, exec::advance);
    }
}


text:
<?php

/**
 * Interface for assertions in layout configuration
 *
 */
interface EcomDev_PHPUnit_Design_Package_Interface
{
    /**
     * Asserts layout file existance in design packages,
     * and returns actual and expected filenames as result
     *
     * @param string $fileName
     * @param string $area
     * @param string|null $designPackage if not specified any theme will be used
     * @param string|null $theme if not specified any theme will be used
     * @return array of 'expected' and 'actual' file names
     */
    public function getLayoutFileAssertion($fileName, $area, $designPackage = null, $theme = null);

}


text:
"use strict";

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var EventEmitter = require("events").EventEmitter,
    ul = require("ul"),
    deffy = require("deffy"),
    typpy = require("typpy"),
    noop = require("noop6"),
    asyncer = require("asyncer.js"),
    fnResult = require("fn-result");

var Transformer = function (_EventEmitter) {
    _inherits(Transformer, _EventEmitter);

    /**
     * Transformer
     * Transforms the data using synchronous and asynchronous functions.
     *
     * @name transformer
     * @function
     * @param {Object} data The data object.
     * @param {Object} opts The options object:
     *
     *  - `autostart` (Boolean): If `true`, the functions will be executed,
     *    without calling the `start()` method.
     *
     * @return {Number} Return description.
     */
    function Transformer(data, opts) {
        _classCallCheck(this, Transformer);

        var _this = _possibleConstructorReturn(this, (Transformer.__proto__ || Object.getPrototypeOf(Transformer)).call(this));

        _this._originalData = data;

        _this._cUnordered = [];
        _this._lastFn = {};

        _this._asyncerTasks = [_this._parallel = [], _this._ordered = []];

        opts = ul.merge(opts, {
            autostart: true
        });

        _this.autostart = opts.autostart;
        process.nextTick(function () {
            _this.autostart && _this.start();
        });
        return _this;
    }

    _createClass(Transformer, [{
        key: "_wrapFn",
        value: function _wrapFn(fn) {
            var _this2 = this;

            return function (cb) {
                fnResult(fn, [_this2._originalData], cb);
            };
        }

        /**
         * add
         * Adds a new function.
         *
         * There are three levels where the functions are added to be executed:
         *
         * Parallel:               | <0: [.............................................]>
         * Unordered (don't wait): |                                <4a: [........]>
         *                         +                                <4b: [....]>
         *                         +                                <4c: [......]>
         * Ordered (wait):         | <1: [...]> <2: [.]> <3:[.....]>                <5: [....]>
         *
         * @name add
         * @function
         * @param {Function|Transformer} fn The function to add. Note you can add
         * an existing transformer instance as well.
         * @param {TransformerType} type One of the following:
         *
         *    - `Transformer.PARALLEL`: Used to append on the parallel timeline.
         *    - `Transformer.UNORDERED`: Grouped, but unordered.
         *    - `Transformer.ORDERED`: Grouped, but ordered.
         *
         * @return {Transformer} The current Transformer instance.
         *
         */

    }, {
        key: "add",
        value: function add(fn, type) {
            var _this3 = this;

            if (typeof type === "string") {
                type = Transformer[type];
                if (typeof type !== "number") {
                    throw new Error("Invalid type.");
                }
            }

            if (typpy(fn, Array)) {
                fn.forEach(function (c) {
                    return _this3.add(c, type);
                });
                return this;
            }

            type = deffy(type, Transformer.ORDERED);
            if (typpy(fn, Transformer)) {
                (function () {
                    var tr = fn;
                    tr.autostart = false;
                    fn = function fn(data, cb) {
                        tr.start(data, cb);
                    };
                })();
            }

            fn = this._wrapFn(fn);

            switch (type) {
                case Transformer.PARALLEL:
                    this._parallel.push(fn);
                    break;
                case Transformer.UNORDERED:
                    if (this._lastFn.type !== Transformer.UNORDERED) {
                        this._cUnordered = [];
                        this._ordered.push({
                            parallel: this._cUnordered
                        });
                    }
                    this._cUnordered.push(fn);
                    break;
                case Transformer.ORDERED:
                    this._ordered.push(fn);
                    break;
            }

            this._lastFn = {
                fn: fn,
                type: type
            };

            this._ordered.push();
            return this;
        }

        /**
         * start
         * Starts the function execution.
         *
         * @name start
         * @function
         * @param {Object} data The data object.
         * @param {Function} fn The callback function.
         */

    }, {
        key: "start",
        value: function start(data, fn) {
            var _this4 = this;

            if (fn) {
                this._originalData = data;
            } else {
                fn = data;
            }

            fn = fn || noop;
            asyncer(this._asyncerTasks, function (err) {
                _this4.emit("end", err, _this4._originalData);
                fn(err, _this4._originalData);
            });
        }
    }]);

    return Transformer;
}(EventEmitter);

Transformer.PARALLEL = 1;
Transformer.UNORDERED = 2;
Transformer.ORDERED = 3;

module.exports = Transformer;


text:
![An Asian palm
civet](https://upload.wikimedia.org/wikipedia/commons/thumb/c/ce/Asian_Palm_Civet_Over_A_Tree.jpg/1024px-Asian_Palm_Civet_Over_A_Tree.jpg)

A civet is a smaller relative of the mongoose. Similarly, Civet is a smaller
relative of Mongoose (which we use to interact with Mongo), as in it's a small, lightweight ORM that exposes some of
the same methods as Mongoose, especially as relate to collection-level CRUD.

## Why is Civet?
Civet exists because it can be useful to play around with Express without first
learning all of the ins and outs of Mongo and Mongoose. Sometimes you just want
to be able to get started quickly, store your records in memory, and worry about
persistence later.

Specifically, this was put together as a sort of "training lightsaber" for the
younglings in General Assembly's Web Development Intensive. _Hi, WDI DTLA 6!_

## How is Civet?
> I'm good– how are you?

First, install Civet on your project:

```
npm install --save civet-orm
```

In your `app.js` (or wherever else you're going to want to use Civet):

```js
var civetInstance = require('civet-orm');
```
Note that above, the variable name `civetInstance` can be whatever you want it
to be– I'm using `civetInstance` so that we're perfectly clear what it is I'm
talking about.

### `Civet#create`
The first method you'll want to use is `create`. `create` takes two arguments:
an object of the record you want to create, and a callback. The
_callback_, meanwhile, takes one argument: an error (if there is one). Here's a
simple example:

```js
civetInstance.create({foo: "bar"}, function(error){
  if(error) {
    console.log(error);
  }
});
```

After running this, your Civet's data store will have one element in it: the object `{foo: "bar", id: "1"}`. The `id` property was added by Civet– we'll see why in a second.

### `Civet#find`
Civet's `find` method returns all the records in its data store. This is something of a misnomer, but it's by design. In Mongoose, if you call `find` without specifying what you're looking for (as we're going to), it behaves similarly to ActiveRecord's `all` method– that is, it returns an array of all records. `find` takes only one argument: a callback function. The callback function takes two arguments: an __error__, and an array of __records__. Once again, let's see an example:

```js
civetInstance.find(function(error, records){
	if(error) {
		console.log(error);
	} else {
		console.log(records);
	}
});
```
If we run this after we run the code we have for `create`, we'd hopefully get `[{foo: "bar"}]`.

### `Civet#findById`
`findById` does pretty much exactly what it says on the tin: you pass it an integer and a callback, it finds the record with that ID (set in `create`) and passes it to the callback. The method itself takes two arguments: an ID (as an integer), and a callback function (which, again, is called with an error and the record being returned). Again, let's look at an example:

```js
civetInstance.findById(1, function(error, record){
	if(error) {
		console.log(error);
	} else {
		console.log(record);
	}
});
```
Calling this after the code we wrote above would log `{foo: "bar"}` out to console. `find` does double duty: we can also update our record within the callback:

```js
civetInstance.findById(1, function(error, record){
	if(record) {
		record.baz = "wab";
	}
});
```
If we look at the record now, it would be `{foo: "bar", baz: "wab"}`. Because this is all in memory, we don't need to save anything– it'll update immediately. This changes in Mongoose, but we'll cross that bridge when we come to it.

### `Civet#remove`
We've created, we've read (two ways), we've updated– now, it's time to delete. The `remove` method takes two arguments: the ID of the record to be deleted, and a callback to run after it deletes. The callback takes the customary `error`, but you can also give it the record you just deleted, in case you want to say goodbye. Again, let's see an example:

```js
civetInstance.remove(1, function(error, record){
	if(error) {
		console.log(error);
	} else {
		console.log("Good riddance, " + record + "!");
	}
});
```


text:
require 'rmagick'
require 'test/unit'
require 'test/unit/ui/console/testrunner' unless RUBY_VERSION[/^1\.9|^2/]

module Magick
  def self._tmpnam_
    @@_tmpnam_
  end
end

class Magick::AlphaChannelType
  def self.enumerators
    @@enumerators
  end
end

class Magick::AlignType
  def self.enumerators
    @@enumerators
  end
end

class Magick::AnchorType
  def self.enumerators
    @@enumerators
  end
end

class Magick_UT < Test::Unit::TestCase
  def test_colors
    res = nil
    assert_nothing_raised { res = Magick.colors }
    assert_instance_of(Array, res)
    res.each do |c|
    assert_instance_of(Magick::Color, c)
    assert_instance_of(String, c.name)
    assert_instance_of(Magick::ComplianceType, c.compliance)
    assert_instance_of(Magick::Pixel, c.color)
    end
    Magick.colors {|c| assert_instance_of(Magick::Color, c) }
  end

  # Test a few of the @@enumerator arrays in the Enum subclasses.
  # No need to test all of them.
  def test_enumerators
    ary = nil
    assert_nothing_raised do
    ary = Magick::AlphaChannelType.enumerators
    end
    assert_instance_of(Array, ary)

    assert_nothing_raised do
    ary = Magick::AlignType.enumerators
    end
    assert_instance_of(Array, ary)
    assert_equal(4, ary.length)

    assert_nothing_raised do
    ary = Magick::AnchorType.enumerators
    end
    assert_instance_of(Array, ary)
    assert_equal(3, ary.length)
  end

  def test_features
    res = nil
    assert_nothing_raised { res = Magick::Magick_features }
    assert_instance_of(String, res)
  end

  def test_fonts
    res = nil
    assert_nothing_raised { res = Magick.fonts }
    assert_instance_of(Array, res)
    res.each do |f|
    assert_instance_of(Magick::Font, f)
    assert_instance_of(String, f.name)
    assert_instance_of(String, f.description) unless f.description.nil?
    assert_instance_of(String, f.family)
    assert_instance_of(Magick::StyleType, f.style)
    assert_instance_of(Magick::StretchType, f.stretch)
    assert_instance_of(Fixnum, f.weight)
    assert_instance_of(String, f.encoding) unless f.encoding.nil?
    assert_instance_of(String, f.foundry) unless f.foundry.nil?
    assert_instance_of(String, f.format) unless f.format.nil?
    end
    Magick.fonts {|f| assert_instance_of(Magick::Font, f) }
  end

  def test_formats
    res = nil
    assert_nothing_raised { res = Magick.formats }
    assert_instance_of(Hash, res)
    res.each do |f, v|
    assert_instance_of(String, f)
    assert_instance_of(String, v)
    end
    Magick.formats.each { |f, v| assert_not_nil(f); assert_not_nil(v) }
  end

  def test_geometry
    g = nil
    gs = nil
    g2 = nil
    gs2 = nil
    assert_nothing_raised { g = Magick::Geometry.new }
    assert_nothing_raised { gs = g.to_s }
    assert_equal('', gs)

    g = Magick::Geometry.new(40)
    gs = g.to_s
    assert_equal('40x', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50)
    gs = g.to_s
    assert_equal('40x50', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50, 10)
    gs = g.to_s
    assert_equal('40x50+10+0', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50, 10, -15)
    gs = g.to_s
    assert_equal('40x50+10-15', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50, 0, 0, Magick::AreaGeometry)
    gs = g.to_s
    assert_equal('40x50@', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50, 0, 0, Magick::AspectGeometry)
    gs = g.to_s
    assert_equal('40x50!', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50, 0, 0, Magick::LessGeometry)
    gs = g.to_s
    assert_equal('40x50<', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50, 0, 0, Magick::GreaterGeometry)
    gs = g.to_s
    assert_equal('40x50>', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 50, 0, 0, Magick::MinimumGeometry)
    gs = g.to_s
    assert_equal('40x50^', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 0, 0, 0, Magick::PercentGeometry)
    gs = g.to_s
    assert_equal('40%', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 60, 0, 0, Magick::PercentGeometry)
    gs = g.to_s
    assert_equal('40%x60%', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 60, 10, 0, Magick::PercentGeometry)
    gs = g.to_s
    assert_equal('40%x60%+10+0', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40, 60, 10, 20, Magick::PercentGeometry)
    gs = g.to_s
    assert_equal('40%x60%+10+20', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40.5, 60.75)
    gs = g.to_s
    assert_equal('40.50x60.75', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(40.5, 60.75, 0, 0, Magick::PercentGeometry)
    gs = g.to_s
    assert_equal('40.50%x60.75%', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(0, 0, 10, 20)
    gs = g.to_s
    assert_equal('+10+20', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    g = Magick::Geometry.new(0, 0, 10)
    gs = g.to_s
    assert_equal('+10+0', gs)

    assert_nothing_raised { g2 = Magick::Geometry.from_s(gs) }
    gs2 = g2.to_s
    assert_equal(gs, gs2)

    # assert behavior with empty string argument
    assert_nothing_raised { g = Magick::Geometry.from_s('') }
    assert_equal('', g.to_s)

    assert_raise(ArgumentError) { Magick::Geometry.new(Magick::AreaGeometry) }
    assert_raise(ArgumentError) { Magick::Geometry.new(40, Magick::AreaGeometry) }
    assert_raise(ArgumentError) { Magick::Geometry.new(40, 20, Magick::AreaGeometry) }
    assert_raise(ArgumentError) { Magick::Geometry.new(40, 20, 10, Magick::AreaGeometry) }
  end

  def test_set_log_event_mask
    assert_nothing_raised { Magick.set_log_event_mask('Module,Coder') }
  end

  def test_set_log_format
    assert_nothing_raised { Magick.set_log_format('format %d%e%f') }
  end

  def test_limit_resources
    cur = new = nil

    assert_nothing_raised {cur = Magick.limit_resource(:memory, 500)}
    assert_kind_of(Integer, cur)
    assert(cur > 1024 ** 2)
    assert_nothing_raised {new = Magick.limit_resource('memory')}
    assert_equal(500, new)
    Magick.limit_resource(:memory, cur)

    assert_nothing_raised {cur = Magick.limit_resource(:map, 3500)}
    assert_kind_of(Integer, cur)
    assert(cur > 1024 ** 2)
    assert_nothing_raised {new = Magick.limit_resource('map')}
    assert_equal(3500, new)
    Magick.limit_resource(:map, cur)

    assert_nothing_raised {cur = Magick.limit_resource(:disk, 3*1024*1024*1024)}
    assert_kind_of(Integer, cur)
    assert(cur > 1024 ** 2)
    assert_nothing_raised {new = Magick.limit_resource('disk')}
    assert_equal(3221225472, new)
    Magick.limit_resource(:disk, cur)

    assert_nothing_raised {cur = Magick.limit_resource(:file, 500)}
    assert_kind_of(Integer, cur)
    assert(cur > 512)
    assert_nothing_raised {new = Magick.limit_resource('file')}
    assert_equal(500, new)
    Magick.limit_resource(:file, cur)

    assert_raise(ArgumentError) { Magick.limit_resource(:xxx) }
    assert_raise(ArgumentError) { Magick.limit_resource('xxx') }
    assert_raise(ArgumentError) { Magick.limit_resource('map', 3500, 2) }
    assert_raise(ArgumentError) { Magick.limit_resource }
  end

  def test_trace_proc
    Magick.trace_proc = proc do |which, description, id, method|
    assert(which == :c)
    assert_instance_of(String, description)
    assert_instance_of(String, id)
    assert_equal(:initialize, method)
    end
    begin
    img = Magick::Image.new(20,20)
    ensure
    Magick.trace_proc = nil
    end
  end
end

if __FILE__ == $PROGRAM_NAME
Test::Unit::UI::Console::TestRunner.run(Magick_UT) unless RUBY_VERSION[/^1\.9|^2/]
end


text:
package com.michaelszymczak.speccare.specminer.core;

import com.eclipsesource.json.JsonObject;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.http.HttpStatus;

import static com.michaelszymczak.speccare.specminer.core.ResultStatus.*;

public class ScenarioResponseShould {

    @Test public void
    returnContentUsingScenarioData() {
        Scenario scenario = ScenarioBuilder.use()
                .withName("Foo scenario name")
                .withContent("Scenario: Foo scenario name")
                .withResult(ResultStatus.FOUND)
                .withWrappingFeature(FeatureBuilder.use()
                        .withPath("/path/to/foo.feature").build()
                ).build();

        ScenarioResponse response = new ScenarioResponse(scenario);

        Assert.assertEquals(
                "{\"name\":\"Foo scenario name\",\"path\":\"/path/to/foo.feature\",\"content\":[\"Scenario: Foo scenario name\"],\"result\":\"found\"}",
                response.getContent()
        );
    }

    @Test public void
    returnOKHttpStatusForPositiveResults() {
        assertHttpStatusForScenarioStatus(HttpStatus.OK, PASSED);
        assertHttpStatusForScenarioStatus(HttpStatus.OK, FOUND);
    }

    @Test public void
    returnOKHttpStatusForResponsesThatValidatesDocumentationEvenIfTheValidationIsNegative() {
        assertHttpStatusForScenarioStatus(HttpStatus.OK, IGNORED);
        assertHttpStatusForScenarioStatus(HttpStatus.OK, SKIPPED);
        assertHttpStatusForScenarioStatus(HttpStatus.OK, FAILED);
    }

    @Test public void
    returnNotFoundHttpStatusForNotFoundResults() {
        assertHttpStatusForScenarioStatus(HttpStatus.NOT_FOUND, NOT_FOUND);
    }

    @Test public void
    returnUnprocessableEntityHttpStatusWhenProblemWithScenarioOccurred() {
        assertHttpStatusForScenarioStatus(HttpStatus.UNPROCESSABLE_ENTITY, AMBIGUOUS);
        assertHttpStatusForScenarioStatus(HttpStatus.UNPROCESSABLE_ENTITY, UNKNOWN);
    }

    @Test public void
    provideEasyAccessToTheNonHttpResultStatus() {
        Assert.assertEquals(SKIPPED, responseWithScenarioStatus(SKIPPED).getStatus());
    }

    private void assertHttpStatusForScenarioStatus(HttpStatus expectedHttpStatus, ResultStatus originalResponseStatus) {
        Assert.assertEquals(expectedHttpStatus, responseWithScenarioStatus(originalResponseStatus).getHttpStatus());
    }

    private ScenarioResponse responseWithScenarioStatus(ResultStatus status) {
        return new ScenarioResponse(ScenarioBuilder.use().withResult(status).build());
    }

    private void assertResult(ResultStatus expectedResult, ScenarioResponse response) {
        Assert.assertEquals(expectedResult.toString(), JsonObject.readFrom(response.getContent()).get("result").asString());
    }

}


text:
export default class ChatService {
  constructor(webSocketService, $q, $rootScope) {
    this.channelName = 'chat';
    this.webSocketService = webSocketService;
    this.$q = $q;
  }

  enterChat(){
    var deferred = this.$q.defer();
    if(this.webSocketService.isConnected()){
      this.webSocketService.enterRoom(this.channelName, (data) => {
        deferred.resolve(data);
      });
    }
    return deferred.promise;
  }

  leaveChat(){
    this.webSocketService.leaveRoom(this.channelName, () => {
      this.webSocketService.socket.off('chat new message');
      this.webSocketService.socket.off('chat user joined');
      this.webSocketService.socket.off('chat user left');
    });
  }

  sendMessage(message){
    var deferred = this.$q.defer();
    this.webSocketService.socket.emit('chat message', message, (resp) => {
      deferred.resolve(resp);
    });
    return deferred.promise;
  }

  listenNewMessage(cb){
    this.webSocketService.listen('chat new message', cb);
  }

  listenUserJoin(cb){
    this.webSocketService.listen('chat user joined', cb);
  }

  listenUserLeave(cb){
    this.webSocketService.listen('chat user left', cb);
  }
}

ChatService.$inject = ['webSocketService', '$q', '$rootScope'];


text:
Tropo Webapi Java <img src="http://hudson.voxeolabs.com/hudson/job/Tropo%202/lastSuccessfulBuild/buildStatus"/>
==============

Java library to interact with [Tropo's Webapi](https://www.tropo.com/docs/webapi/new_tropo_web_api_overview.htm).

Overview
--------

This is a very lightweight library that will help you to create applications that interact with Tropo from your Java based server. This library offers a type-safe object model that helps you to create requests to Tropo without having to deal with JSON at all. This way, you can minimize the errors that may happen due to invalid JSON being sent or parsed.

Additionally, this library implements the session method from Tropo [Rest API](https://www.tropo.com/docs/rest/rest_api.htm) which means it can be used from Java web or stand-alone applications to execute remote scripts. For example you can integrate this library with a Java Swing application to do simple but powerful tasks like sending SMS, sending voice calls, transfering calls, etc.

Requirements
------------

Current version is 0.3.1.

License
------------

[MIT License](https://github.com/tropo/tropo-webapi-java/blob/master/LICENSE)

Requirements
------------

You can install this library in any Java application or application server. The library depends primarily on Json-lib and Commons Httpclient. These libraries also depend on other artifacts. The following listing shows all the libraries that need to be present in an application that uses Tropo's Java Webapi:

	* commons-beanutils-1.8.1.jar
	* commons-collections-3.2.1.jar
	* commons-lang-2.5.jar
	* commons-logging-1.1.1.jar
	* commons-httpclient-3.1.jar
	* json-lib-2.4-jdk15.jar
	* ezmorph-1.0.6.jar

All libraries have been included in the [dist/dependencies](https://github.com/tropo/tropo-webapi-java/tree/master/dist/dependencies) folder.

Using the Maven artifact
------------------------

If you want to use the Maven artifact from your own projects you can add the following dependency to your project's pom.xml:

```xml
  <dependency>
    <groupId>com.voxeo.tropo</groupId>
    <artifactId>tropo-webapi-java</artifactId>
    <version>0.3.1</version>
  </dependency>
```

You will have also to link to our public maven Repository:

```xml
  <repositories>
    <repository>
      <id>tropo-public</id>
      <name>Uncle Tropos's Public Maven Repo</name>
      <url>http://maven.tropo.com:8081/nexus/content/groups/public</url>
    </repository>
  </repositories>
```

You can also check the build status of the project at any time from our public [CI server](http://ci.voxeolabs.net/jenkins/job/tropo-java-webapi/).

Building it from Source
------------------------

Tropo Java Webapi is based in [Maven](http://maven.apache.org). Once that you have maven installed you can easily build this library by running the following command from the project's root folder:

    mvn package

Examples
--------

You can find loads of examples on how to use this library from the [unit tests folder|https://github.com/tropo/tropo-webapi-java/tree/master/src/test/java]. There is more than 100 different examples there. Below you will find a few examples.

Say Hello and render text to the HTTP Servlet response object:

    HttpServletResponse response = ...
    Tropo tropo = new Tropo();
    tropo.say("1234");
    tropo.render(response)

Launch an application (can also be done from stand-alone apps) :

		String token = "bb308b34ed83d54cab226f4af7969e4c7d7d9196cdb3210b5ef0cb345616629005bfd05efe3f4409cd496ca2";
		Tropo tropo = new Tropo();
		TropoLaunchResult result = tropo.launchSession(token);

Launch an application and send some arguments (like for example passing an SMS number to a Tropo hosted file that sends SMS)

		String token = "bb308b34ed83d54cab226f4af7969e4c7d7d9196cdb3210b5ef0cb345616629005bfd05efe3f4409cd496ca2";
		Tropo tropo = new Tropo();
		Map params = new HashMap();
		params.put("number","623767896");
		TropoLaunchResult result = tropo.launchSession(token, params);

With Tropo's Java Webapi you can build Tropo apps with type-safety and traditional Java syntax:

		// Example 1
		Tropo tropo = new Tropo();
		RecordAction record = tropo.record("foo","http://sendme.com/tropo",true,true,"#");
		record.transcription(ID("bling"), URL("mailto:jose@voxeo.com"), EMAIL_FORMAT("encoded"));
		record.say(VALUE("Please say your account number"));
		record.choices(VALUE("[5 DIGITS]"));

		// Example 2
		Tropo tropo = new Tropo();
		tropo.on(EVENT("error"), NEXT("/error.json")); // For fatal programming errors. Log some details so we can fix it
		tropo.on(EVENT("hangup"), NEXT("/hangup.json")); // When a user hangs or call is done. We will want to log some details.
		tropo.on(EVENT("continue"), NEXT("/next.json"));
		tropo.say("Hello");
		tropo.startRecording(URL("http://heroku-voip.marksilver.net/post_audio_to_s3?filename=foo.wav&unique_id=bar"));
		// [From this point, until stop_recording(), we will record what the caller *and* the IVR say]
		tropo.say("You are now on the record.");
		// Prompt the user to incriminate themselve on-the-record
		tropo.say("Go ahead, sing-along.");
		tropo.say("http://denalidomain.com/music/keepers/HappyHappyBirthdaytoYou-Disney.mp3");

		// Example 3
		Tropo tropo = new Tropo();
		tropo.hangup();

At the same time, Tropo's Java Webapi defines a complete DSL to create applications in a much less verbosely manner. You can choose whatever syntax you are more comfortable with:

		// Example 1
		Tropo tropo = new Tropo();
		tropo
			.ask(NAME("foo"),BARGEIN(true),TIMEOUT(30.0f),REQUIRED(true)).and(
				Do.say("Please say your account number"),
				Do.on(EVENT("success"),NEXT("/result.json")),
				Do.choices(VALUE("[5 DIGITS]")));

		// Example 2
		Tropo tropo = new Tropo();
		tropo
			.conference(NAME("foo"),ID("1234"),MUTE(false),SEND_TONES(false),EXIT_TONE("#")).and(
				Do.on(EVENT("join")).say("Welcome to the conference")
			);

		// Example 3
		Tropo tropo = new Tropo();
		tropo.call(TO("foo"), FROM("bar"), NETWORK(Network.SMS), CHANNEL(Channel.TEXT), TIMEOUT(10.0f), ANSWER_ON_MEDIA(false)).and(
			Do.headers(new String[]{"fooKey","fooValue"}, new String[]{"barKey","barValue"}),
			Do.startRecording(URL("http://foobar"), METHOD("POST"), FORMAT(Format.MP3), USERNAME("jose"), PASSWORD("passwd")));

		// Example 4
		Tropo tropo = new Tropo();
		tropo.message(TO("foo"), FROM("bar"), NETWORK(Network.SMS), CHANNEL(Channel.TEXT), TIMEOUT(10.0f), ANSWER_ON_MEDIA(false)).and(
			Do.headers(new String[]{"fooKey","fooValue"}, new String[]{"barKey","barValue"}),
			Do.startRecording(URL("http://foobar"), METHOD("POST"), FORMAT(Format.MP3), USERNAME("jose"), PASSWORD("passwd")),
			Do.say("Please say your account number"));

Below you can also find a very trivial servlet POST method:

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		Tropo tropo = new Tropo();
		tropo.say("Hello from Tropo. This is our first application.");
		tropo.render(response);
	}

And of course, you can read Tropo's session from the request and use it in your Java apps. Again, no Json knowledge required!

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		Tropo tropo = new Tropo();
		TropoSession session = tropo.session(request);
		System.out.println("Call id: " + session.getCallId());
	}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Turfa</logradouro><bairro>Jacuí</bairro><cidade>João Monlevade</cidade><uf>MG</uf><cep>35930413</cep></feed>


text:
***
### Description ###
A simple project to count your pomodoros time.

### How use it ###
First of all, install it...

    gem install pomodoro_timer

After that you can open irb, require and include:

    require 'rubygems'
    require 'pomodoro_timer'
    include PomodoroTimer

Now you have the methods:

* *start*: Start one pomodoro.
* *status*: Show if you are in break or work time and how much least to end.
* *cancel*: Cancel your pomodoro.

### How it works ###
*First:* Calling the start method, your 25 minutes of work will start counting.
*Second:* When this time end a ding sound will be played and your 5 minutes of break will starts counting automaticaly.
*Third:* When break time ends you have to start another pomodoro manualy, using the start method.

Maybe you will want to ignore the break ding and work a litte more, it's okay, you can cancel the actual pomodoro and when you want take a break you can call the method start passing :break like this...

    start :break

### Limitations ###
* Was tested only in ubuntu, and I think that will not work in anothers OSs, because the gem uses the "aplay" built-in command to play the ding.
* Has no way to pause a pomodoro. (Puporsely)

### About me ###
* _Name:_ Hugo Roque
* _Email:_ hugo.roque@caelum.com.br
* _Twitter:_ http://twitter.com/hugolnx
*	_Blog:_ http://hugolnx.com/
*	_Labs:_ http://lnxlabs.heroku.com/


text:
/*
* Copy current page url to clipboard.
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT License
*/

function copyLink(url) {
  if (!url || 0 === url.length)
  url = window.location.href;
  var $temp = $("<input>");

  $("body").append($temp);
  $temp.val(url).select();
  document.execCommand("copy");
  $temp.remove();

  alert("Link copied successfully!");
}


text:
@implementation MyAnnotation

@end


text:
#include "PolyEventHandler.h"

namespace Polycode {

	EventHandler::EventHandler() {
	}

	EventHandler::~EventHandler() {

	}

}


text:
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
        "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
        "https://checkstyle.org/dtds/suppressions_1_2.dtd">

<!-- Empty suppressions file: copy it into gradle/config/checkstyle and specify required suppressions
     (https://checkstyle.sourceforge.io/config_filters.html#SuppressionFilter)-->
<suppressions>

    <!--<suppress checks="NewlineAtEndOfFileCheck" files="Sample.java"/>-->

    <!--<suppress message="Missing a Javadoc comment."/>-->

</suppressions>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>CSS scroll snapping polyfill</title>

Section 1

Section 2

Section 3

Section 4


text:
function view_init(win) {

	win.backgroundColor = '#f1eddd';
	win.backgroundImage = '../images/background_window.png';
	win.barColor = '#004586';

	// bottom wave bar
	var view2 = Ti.UI.createView({
		backgroundImage: '../images/background_bottom.png',
		zIndex:11,
		width:'100%',
		height:9,
		bottom:0,
		left:0
	});
	win.add(view2);

	win.imageApp = Ti.UI.createImageView({
		image:'../images/logo_lent2011.png',
		top:20,
		left:25,
		height:72,
		width:72
	});
	if (Titanium.Platform.name == 'iPhone OS') {
		win.add(win.imageApp);
	}

	win.label_title = Titanium.UI.createLabel({
		top:30,
		height:30,
		width:'auto',
		color:'#576996',
		font:{fontSize:20,fontWeight:'bold', fontFamily:'Arial'},
		textAlign:'center',
		text:lang['festival_lent']
	});
	if (Titanium.Platform.name != 'iPhone OS') {
		if (Titanium.Platform.displayCaps.density == 'low') {
			win.label_title.height = win.label_title.height*Titanium.App.Properties.getDouble('lowResDelimiter')+5;
			win.label_title.font.fontSize = 18;
			win.label_title.top = 15;
		} else if (Titanium.Platform.displayCaps.density == 'high') {
			win.label_title.font.fontSize = 24;
			win.label_title.top = 15;
		}
	} else {
		win.label_title.left = 110;
	}
	win.add(win.label_title);

	win.label_author = Titanium.UI.createLabel({
		top:60,
		height:30,
		width:'auto',
		font:{fontSize:16,fontFamily:'Arial'},
		textAlign:'center',
		text:lang['info_author']
	});
	if (Titanium.Platform.name != 'iPhone OS') {
		if (Titanium.Platform.displayCaps.density == 'low') {
			win.label_author.height = win.label_author.height*Titanium.App.Properties.getDouble('lowResDelimiter')+3;
			win.label_author.font.fontSize = 14;
			win.label_author.top = 40;
		} else if (Titanium.Platform.displayCaps.density == 'high') {
			win.label_author.font.fontSize = 20;
		}
	} else {
		win.label_author.left = 140;
	}
	win.add(win.label_author);

	win.imageFramework = Ti.UI.createImageView({
		image:'../images/logo_titanium.png',
		bottom:95,
		left:80,
		height:50,
		width:50
	});
	if (Titanium.Platform.name != 'iPhone OS') {
		if (Titanium.Platform.displayCaps.density == 'low') {
			win.imageFramework.height = win.imageFramework.height*Titanium.App.Properties.getDouble('lowResDelimiter');
			win.imageFramework.width = win.imageFramework.width*Titanium.App.Properties.getDouble('lowResDelimiter');
		}
	}
	win.add(win.imageFramework);

	win.imageOS = Ti.UI.createImageView({
		image:'../images/logo_OS.png',
		bottom:85,
		right:80,
		height:65,
		width:65
	});
	if (Titanium.Platform.name != 'iPhone OS') {
		if (Titanium.Platform.displayCaps.density == 'low') {
			win.imageOS.height = win.imageOS.height*Titanium.App.Properties.getDouble('lowResDelimiter');
			win.imageOS.width = win.imageOS.width*Titanium.App.Properties.getDouble('lowResDelimiter');
		}
	}
	win.add(win.imageOS);

	win.imageSponsor = Ti.UI.createImageView({
		image:'../images/logo_epk.png',
		bottom:165,
		height:75,
		width:175
	});
	if (Titanium.Platform.name != 'iPhone OS') {
		if (Titanium.Platform.displayCaps.density == 'low') {
			win.imageSponsor.height = win.imageSponsor.height*Titanium.App.Properties.getDouble('lowResDelimiter');
			win.imageSponsor.width = win.imageSponsor.width*Titanium.App.Properties.getDouble('lowResDelimiter');
		}
	}
	win.add(win.imageSponsor);

	win.imageCompany = Ti.UI.createImageView({
		image:'../images/logo_agenda.png',
		bottom:30,
		height:48,
		width:200
	});
	if (Titanium.Platform.name != 'iPhone OS') {
		if (Titanium.Platform.displayCaps.density == 'low') {
			win.imageCompany.height = win.imageCompany.height*Titanium.App.Properties.getDouble('lowResDelimiter');
			win.imageCompany.width = win.imageCompany.width*Titanium.App.Properties.getDouble('lowResDelimiter');
		}
	}
	win.add(win.imageCompany);

}


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class com.github.maven_nar.cpptasks.LinkerParam (CPPTasks (parallel) 1.1.1-SNAPSHOT API)
</TITLE>

<META NAME="date" CONTENT="2013-09-13">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
com.github.maven_nar.cpptasks.LinkerParam

Packages that use LinkerParam

com.github.maven_nar.cpptasks
C++ and other compiled languages build support for Ant.

com.github.maven_nar.cpptasks.compiler

Uses of LinkerParam in com.github.maven_nar.cpptasks

Methods in com.github.maven_nar.cpptasks with parameters of type LinkerParam

 void
LinkerDef.addConfiguredLinkerParam(LinkerParam param)

          Adds a compiler command-line arg.

Uses of LinkerParam in com.github.maven_nar.cpptasks.compiler

Methods in com.github.maven_nar.cpptasks.compiler that return LinkerParam

 LinkerParam
CommandLineLinkerConfiguration.getParam(String name)

 LinkerParam
LinkerConfiguration.getParam(String name)

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2001-2013. All Rights Reserved.


text:
/**
 * @fileoverview a comment without a suppress tag.
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
// here comes code.
goog.module('test_files.file_comment.fileoverview_comment_add_suppress');
var module = module || { id: 'test_files/file_comment/fileoverview_comment_add_suppress.ts' };
module = module;
exports = {};
/** @type {number} */
exports.x = 1;


text:
export * from "./underlyings-interface";
export * from "./underlyings-reducer";
export * from "./underlyings-reducer";
export * from "./underlyings-actions";
export * from "./underlyings-service";


text:
struct LibLoader
{
	struct elem
	{
		const wchar_t *name;
		const char *sourcename;
		intro::Type::pointer_t type;
	};
protected:
	std::vector<std::wstring> path;
	static std::vector<LibLoader *> instances;
	void load(const elem elems[])
	{
		size_t i = 0;
		intro::Environment::Module *ti_module = intro::Environment::getRootModule()->getCreatePath(path);
		intro::CodeGenModule *cg_module = intro::CodeGenModule::getRoot()->getRelativePath(path);
		intro::CodeGenEnvironment::element cgelem(nullptr, nullptr);
		while (elems[i].name != nullptr)
		{
			// Add to module
			ti_module->addExport(elems[i].name, elems[i].type, false);
			cg_module->importElement(elems[i].name, cgelem)->second.altname = elems[i].sourcename;
			++i;
		}
	}
public:
	LibLoader(std::wstring name)
	{
		path.push_back(name);
	};

	LibLoader(std::vector<std::wstring> &path_)
		: path(path_)
	{};
	virtual void create() = 0;
	static void initialize(void)
	{
		for (LibLoader *instance : instances) instance->create();
	};
};

#define MKCLOSURE(name,codeptr) rtclosure name ## _src = { \
	{false, gcdata::Octarine, 1}, \
	(void*)(codeptr), \
	1, { 0ll, 0} }; \
rtclosure * name = & name ## _src; \
rtt_t name ## _rtt = intro::rtt::Function;

#define EXPORT_CLOSURE(name) FORCE_EXPORT extern rtclosure *name; \
FORCE_EXPORT extern rtt_t name ## _rtt;

#define REGISTER_MODULE(name) struct name ## Loader_ : public LibLoader { \
static const elem elems[]; \
name ## Loader_(void) : LibLoader(L ## #name) {	instances.push_back(this); }; \
virtual void create() { load(elems); }; \
} name ## loader; \
const LibLoader::elem name ## Loader_::elems[] = {

#define EXPORT(name,closure,type) {name,closure,type},

#define CLOSE_MODULE { nullptr,nullptr,nullptr } };

#endif


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.appservice.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The ContainerCpuStatistics model. */
@Fluent
public final class ContainerCpuStatistics {
    /*
     * The cpuUsage property.
     */
    @JsonProperty(value = "cpuUsage")
    private ContainerCpuUsage cpuUsage;

    /*
     * The systemCpuUsage property.
     */
    @JsonProperty(value = "systemCpuUsage")
    private Long systemCpuUsage;

    /*
     * The onlineCpuCount property.
     */
    @JsonProperty(value = "onlineCpuCount")
    private Integer onlineCpuCount;

    /*
     * The throttlingData property.
     */
    @JsonProperty(value = "throttlingData")
    private ContainerThrottlingData throttlingData;

    /**
     * Get the cpuUsage property: The cpuUsage property.
     *
     * @return the cpuUsage value.
     */
    public ContainerCpuUsage cpuUsage() {
        return this.cpuUsage;
    }

    /**
     * Set the cpuUsage property: The cpuUsage property.
     *
     * @param cpuUsage the cpuUsage value to set.
     * @return the ContainerCpuStatistics object itself.
     */
    public ContainerCpuStatistics withCpuUsage(ContainerCpuUsage cpuUsage) {
        this.cpuUsage = cpuUsage;
        return this;
    }

    /**
     * Get the systemCpuUsage property: The systemCpuUsage property.
     *
     * @return the systemCpuUsage value.
     */
    public Long systemCpuUsage() {
        return this.systemCpuUsage;
    }

    /**
     * Set the systemCpuUsage property: The systemCpuUsage property.
     *
     * @param systemCpuUsage the systemCpuUsage value to set.
     * @return the ContainerCpuStatistics object itself.
     */
    public ContainerCpuStatistics withSystemCpuUsage(Long systemCpuUsage) {
        this.systemCpuUsage = systemCpuUsage;
        return this;
    }

    /**
     * Get the onlineCpuCount property: The onlineCpuCount property.
     *
     * @return the onlineCpuCount value.
     */
    public Integer onlineCpuCount() {
        return this.onlineCpuCount;
    }

    /**
     * Set the onlineCpuCount property: The onlineCpuCount property.
     *
     * @param onlineCpuCount the onlineCpuCount value to set.
     * @return the ContainerCpuStatistics object itself.
     */
    public ContainerCpuStatistics withOnlineCpuCount(Integer onlineCpuCount) {
        this.onlineCpuCount = onlineCpuCount;
        return this;
    }

    /**
     * Get the throttlingData property: The throttlingData property.
     *
     * @return the throttlingData value.
     */
    public ContainerThrottlingData throttlingData() {
        return this.throttlingData;
    }

    /**
     * Set the throttlingData property: The throttlingData property.
     *
     * @param throttlingData the throttlingData value to set.
     * @return the ContainerCpuStatistics object itself.
     */
    public ContainerCpuStatistics withThrottlingData(ContainerThrottlingData throttlingData) {
        this.throttlingData = throttlingData;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (cpuUsage() != null) {
            cpuUsage().validate();
        }
        if (throttlingData() != null) {
            throttlingData().validate();
        }
    }
}


text:
import MapCache from './_MapCache';
import cachePush from './_cachePush';

/**
 *
 * Creates a set cache object to store unique values.
 *
 * @private
 * @constructor
 * @param {Array} [values] The values to cache.
 */
function SetCache(values) {
  var index = -1,
      length = values ? values.length : 0;

  this.__data__ = new MapCache;
  while (++index < length) {
    this.push(values[index]);
  }
}

// Add methods to `SetCache`.
SetCache.prototype.push = cachePush;

export default SetCache;


text:
{% extends 'tools/base.html' %} {% block content %}

    <input name="usermsg" type="text" id="usermsg" size="63" />
    <button id="submitmsg" onclick="submit()">Send</button>

{% endblock %}


text:
Do you speak english, amigo? [click here](#eng)

Otra guía de estilo *cool* para C#
=

Seguramente te estarás preguntando para qué necesitas una guía de estilo si tu ya sabes programar. Cierto, pero déjame decirte algo esperando no sonar ofensivo: Cualquiera puede programar. Cualquiera con unos cuantos meses de experiencia, alguno que otro curso o vídeo en internet puede escribir una aplicación funcional en poco tiempo. Hacer código que funcione es sencillo, hacer un buen código que funcione es lo complicado.
### La guía
El archivo a leer es [sharp-guide-es.md](/sharp-guide-es.md), mientras que [sharp-guide-en.md](/sharp-guide-en.md) es una copia de la guía, pero en inglés. Para exportar la guía a un formato más amigable en línea recomiendo [Dillinger](http://dillinger.io) o [StackEdit](https://stackedit.io).
### Contribuciones
¿Crees que hay algo que falta? ¿crees que hay algo que sobra? ¿Alguna duda, comentario o simplemente alguna idea? ¿cometí un error ortográgico? puedes escribirme a antonio.feregrino@hotmail.es o a @io_exception en Twitter.

> Escrita con [Dillinger](http://dillinger.io/).

Yet another *cool* style guide for C#
=

I'm sure you are wondering why do you need a style guide if you already know how to program. True that, but let me tell you something (and I don't mean to be rude): Anyone can program. Anyone with some months of experience, maybe a lecture or even an internet video can write a functional app in little time. Writing code that works is easy, writing good code that works is way harder.
### The guide
The file to read is [sharp-guide-en.md](/sharp-guide-en.md), while [sharp-guide-es.md](/sharp-guide-es.md) is a copy of the guide written in spanish. To export this guide to a more friendly format online I recommend [Dillinger](http://dillinger.io) o [StackEdit](https://stackedit.io).
### Contribute
Do you think I missed something? or there is something that shouldn't be here? Are there doubts, comments or just ideas? maybe I made an spelling mistake. Feel free to reach at antonio.feregrino@hotmail.es or @io_exception at Twitter.

> Writte with [Dillinger](http://dillinger.io/#eng).


text:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="history" name="save" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>InstrumentExtensionMethods Class</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            A MIDI Library for .NET

InstrumentExtensionMethods Class

 Extension methods for the Instrument enum.

								For a list of all members of this type, see InstrumentExtensionMethods Members
								.

        System.Object

   InstrumentExtensionMethods

[Extension]

public static class InstrumentExtensionMethods

Requirements

        Namespace:
        Midi

        Assembly: Midi (in Midi.dll)

See Also

        InstrumentExtensionMethods Members | Midi Namespace

          Copyright © 2009 Tom Lokovic

Generated from assembly Midi [1.1.0.0] by NDoc3


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE401_Memory_Leak__char_malloc_74a.cpp
Label Definition File: CWE401_Memory_Leak.c.label.xml
Template File: sources-sinks-74a.tmpl.cpp
*/
/*
 * @description
 * CWE: 401 Memory Leak
 * BadSource: malloc Allocate data using malloc()
 * GoodSource: Allocate data on the stack
 * Sinks:
 *    GoodSink: call free() on data
 *    BadSink : no deallocation of data
 * Flow Variant: 74 Data flow: data passed in a map from one function to another in different source files
 *
 * */

#include "std_testcase.h"
#include <map>

#include <wchar.h>

using namespace std;

namespace CWE401_Memory_Leak__char_malloc_74
{

#ifndef OMITBAD

/* bad function declaration */
void badSink(map<int, char *> dataMap);

void bad()
{
    char * data;
    map<int, char *> dataMap;
    data = NULL;
    /* POTENTIAL FLAW: Allocate memory on the heap */
    data = (char *)malloc(100*sizeof(char));
    /* Initialize and make use of data */
    strcpy(data, "A String");
    printLine(data);
    /* Put data in a map */
    dataMap[0] = data;
    dataMap[1] = data;
    dataMap[2] = data;
    badSink(dataMap);
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(map<int, char *> dataMap);

static void goodG2B()
{
    char * data;
    map<int, char *> dataMap;
    data = NULL;
    /* FIX: Use memory allocated on the stack with ALLOCA */
    data = (char *)ALLOCA(100*sizeof(char));
    /* Initialize and make use of data */
    strcpy(data, "A String");
    printLine(data);
    /* Put data in a map */
    dataMap[0] = data;
    dataMap[1] = data;
    dataMap[2] = data;
    goodG2BSink(dataMap);
}

/* goodB2G uses the BadSource with the GoodSink */
void goodB2GSink(map<int, char *> dataMap);

static void goodB2G()
{
    char * data;
    map<int, char *> dataMap;
    data = NULL;
    /* POTENTIAL FLAW: Allocate memory on the heap */
    data = (char *)malloc(100*sizeof(char));
    /* Initialize and make use of data */
    strcpy(data, "A String");
    printLine(data);
    dataMap[0] = data;
    dataMap[1] = data;
    dataMap[2] = data;
    goodB2GSink(dataMap);
}

void good()
{
    goodG2B();
    goodB2G();
}

#endif /* OMITGOOD */

} /* close namespace */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

using namespace CWE401_Memory_Leak__char_malloc_74; /* so that we can use good and bad easily */

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif


text:
using System.Collections.Generic;
using Cake.Common.Tools.ILMerge;
using Cake.Core.IO;

namespace Cake.Common.Tests.Fixtures.Tools
{
    internal sealed class ILMergeRunnerFixture : ToolFixture<ILMergeSettings>
    {
        public FilePath OutputAssemblyPath { get; set; }
        public FilePath PrimaryAssemblyPath { get; set; }
        public List<FilePath> AssemblyPaths { get; set; }

        public ILMergeRunnerFixture()
            : base("ILMerge.exe")
        {
            OutputAssemblyPath = "output.exe";
            PrimaryAssemblyPath = "input.exe";
            AssemblyPaths = new List<FilePath>();
        }

        protected override void RunTool()
        {
            var runner = new ILMergeRunner(FileSystem, Environment, Globber, ProcessRunner);
            runner.Merge(OutputAssemblyPath, PrimaryAssemblyPath, AssemblyPaths, Settings);
        }
    }
}


text:
package com.example.administrator.yicheng.retrofit;

import com.example.administrator.yicheng.bean.CityBean;
import com.example.administrator.yicheng.bean.CityContent;
import com.example.administrator.yicheng.bean.CityContentBean;

import java.util.HashMap;

import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.QueryMap;

/**
 * Created by Jensen on 2016/8/5.
 */
public interface ICityService {
    @GET("channel/getcitydata")
    Call<CityBean> getCityList();
    @GET("content/ztMsgMore")
    Call<CityContentBean> getCityContentList(@QueryMap()HashMap<String,String> params);
}


text:
dbm.registerClass("dbm.adobeextendscript.aftereffects.AfterEffectsProject", "dbm.core.ExtendedEventBaseObject", function(objectFunctions, staticFunctions, ClassReference) {
	//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject");
	//"use strict";

	//Self reference
	var AfterEffectsProject = dbm.importClass("dbm.adobeextendscript.aftereffects.AfterEffectsProject");

	//Error report
	var ErrorManager = dbm.importClass("dbm.core.globalobjects.errormanager.ErrorManager");
	var ReportTypes = dbm.importClass("dbm.constants.error.ReportTypes");
	var ReportLevelTypes = dbm.importClass("dbm.constants.error.ReportLevelTypes");

	//Dependencies
	var TreeStructure = dbm.importClass("dbm.utils.data.treestructure.TreeStructure");
	var ItemBaseObject = dbm.importClass("dbm.adobeextendscript.aftereffects.items.ItemBaseObject");
	var CompositionItem = dbm.importClass("dbm.adobeextendscript.aftereffects.items.CompositionItem");

	//Utils
	var VariableAliases = dbm.importClass("dbm.utils.data.VariableAliases");
	var ArrayFunctions = dbm.importClass("dbm.utils.native.array.ArrayFunctions");

	//Constants

	/**
	 * Constructor
	 */
	objectFunctions._init = function() {
		//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject::_init");

		this.superCall();

		this._nativeProject = null;
		this._items = null;
		this._activeItem = null;

		return this;
	};

	objectFunctions.setNativeProject = function(aNativeProject) {
		this._nativeProject = aNativeProject;

		return this;
	};

	objectFunctions.setupItems = function() {
		//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject::setupItems");
		var treeStructure = TreeStructure.create();
		this._items = this.addDestroyableObject(treeStructure);

		var currentItem = this._items.getRoot();
		var currentFolder = this._nativeProject.rootFolder;
		this._createItem(currentFolder, currentItem);
		this._setupItemsInFolder(currentFolder, currentItem);

		//console.log("//dbm.adobeextendscript.aftereffects.AfterEffectsProject::setupItems");
		return this;
	};

	objectFunctions._setupItemsInFolder = function(aFolder, aTreeStructureItem) {
		//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject::_setupItemsInFolder");
		//console.log(aFolder, aTreeStructureItem);

		var numberOfItems = aFolder.numItems;
		for(var i = 1; i <= numberOfItems; i++) { //MENOTE: count starts at 1
			var currentItem = aFolder.item(i);
			var encodedName = encodeURIComponent(currentItem.name);
			var newTreeStructureItem = this._items.getItemByPath(encodedName, aTreeStructureItem);

			if(this._nativeProject.activeItem === currentItem) {
				if(this._activeItem === null) {
					var currentRealItem = this._createItem(currentItem, newTreeStructureItem);
					this._activeItem = currentRealItem;
				}
				else {
					newTreeStructureItem.data = this._activeItem;
				}
			}
			else {
				this._createItem(currentItem, newTreeStructureItem);
			}

			if(currentItem instanceof FolderItem) {
				this._setupItemsInFolder(currentItem, newTreeStructureItem);
			}
		}
	};

	objectFunctions._createItem = function(aNativeItem, aTreeStructureItem) {
		//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject::_createItem");
		//console.log(aNativeItem, aTreeStructureItem);

		var newItem;

		if(aNativeItem instanceof CompItem) {
			newItem = CompositionItem.create(aNativeItem);
		}
		else {
			newItem = ItemBaseObject.create(aNativeItem);
		}

		if(VariableAliases.isSet(aTreeStructureItem)) {
			aTreeStructureItem.data = newItem;
		}

		//console.log("//dbm.adobeextendscript.aftereffects.AfterEffectsProject::_createItem");
		return newItem;
	};

	objectFunctions.getActiveItem = function() {
		if(this._activeItem === null) {
			this._activeItem = this._createItem(this._nativeProject.activeItem);
		}

		return this._activeItem;
	};

	objectFunctions.getItemByNativeItem = function(aNativeItem) {
		//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject::getItemByNativeItem");

		return this._getItemByNativeItemRecursive(this._items.getRoot().getChildren(), aNativeItem);
	};

	objectFunctions._getItemByNativeItemRecursive = function(aTreeStructureItems, aNativeItem) {
		//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject::_getItemByNativeItemRecursive");

		var currentArray = aTreeStructureItems;
		var currentArrayLength = currentArray.length;
		for(var i = 0; i < currentArrayLength; i++) {
			var currentTreeStructureItem = currentArray[i];
			var currentItem = currentTreeStructureItem.data;
			if(currentItem.getNativeItem() === aNativeItem) {
				return currentItem;
			}

			var childResult = this._getItemByNativeItemRecursive(currentTreeStructureItem.getChildren(), aNativeItem);
			if(childResult !== null) {
				return childResult;
			}
		}

		return null;
	};

	objectFunctions.deselectAllItems = function() {
		var currentArray = ArrayFunctions.copyArray(this._nativeProject.selection);
		var currentArrayLength = currentArray.length;
		for(var i = 0; i < currentArrayLength; i++) {
			currentArray[i].selected = false;
		}
	}

	objectFunctions.setAllReferencesToNull = function() {

		this._nativeProject = null;
		this._items = null;

		this.superCall();
	};

	objectFunctions._extendedEvent_eventIsExpected = function(aName) {

		/*
		switch(aName) {
			case "":
				return true;
		}
		*/

		return this.superCall(aName);
	};

	staticFunctions.create = function() {
		//console.log("dbm.adobeextendscript.aftereffects.AfterEffectsProject::create");

		var newAfterEffectsProject = (new ClassReference()).init();

		newAfterEffectsProject.setNativeProject(app.project);
		newAfterEffectsProject.setupItems();

		return newAfterEffectsProject;
	};
});


text:
an example var

**Kind**: global variable
**Example**
```js
var thisVar = funtion(){
    return "a value"
}
```


text:
<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration xmlns:xi="http://www.w3.org/2001/XInclude">
	<property>
		<name>ranger.plugin.sqoop.policy.rest.url</name>
		<value>http://localhost:6080</value>
		<description>
			URL to Ranger Admin
		</description>
	</property>

	<property>
		<name>ranger.plugin.sqoop.service.name</name>
		<value>sqoopTest</value>
		<description>
			Name of the Ranger service containing policies for this SampleApp instance
		</description>
	</property>

	<property>
		<name>ranger.plugin.sqoop.policy.source.impl</name>
		<value>org.apache.ranger.authorization.sqoop.authorizer.RangerAdminClientImpl</value>
		<description>
			Policy source.
		</description>
	</property>

	<property>
		<name>ranger.plugin.sqoop.policy.pollIntervalMs</name>
		<value>30000</value>
		<description>
			How often to poll for changes in policies?
		</description>
	</property>

	<property>
		<name>ranger.plugin.sqoop.policy.cache.dir</name>
		<value>./target</value>
		<description>
			Directory where Ranger policies are cached after successful retrieval from the source
		</description>
	</property>

</configuration>


text:
TEST(test_compare_call, same_type)
{
    stub::compare_call<int, bool, double> expect(5, true, 4.0);

    auto t1 = std::make_tuple(4, true, 4.0);
    EXPECT_FALSE(expect.compare(t1));

    auto t2 = std::make_tuple(5, true, 4.0);
    EXPECT_TRUE(expect.compare(t2));
}

TEST(test_compare_call, argument_types)
{
    stub::compare_call<int, const bool&, double&> expect(5, true, 4.0);

    auto t1 = std::make_tuple(4, true, 4.0);
    EXPECT_FALSE(expect.compare(t1));

    auto t2 = std::make_tuple(5, true, 4.0);
    EXPECT_TRUE(expect.compare(t2));
}

TEST(test_compare_call, store_in_vector)
{
    using expect = stub::compare_call<int, bool, double>;
    std::vector<expect> expectations;

    expectations.emplace_back(4, true, 4.0);
    expectations.emplace_back(5, true, 4.0);

    auto t1 = std::make_tuple(4, true, 4.0);
    EXPECT_TRUE(expectations[0].compare(t1));
    EXPECT_FALSE(expectations[1].compare(t1));
}

TEST(test_compare_call, ignore)
{
    stub::compare_call<int, bool, double> expect(5, true, stub::ignore());

    auto t1 = std::make_tuple(4, true, 4.0);
    EXPECT_FALSE(expect.compare(t1));

    auto t2 = std::make_tuple(5, true, 4.0);
    EXPECT_TRUE(expect.compare(t2));
}

TEST(test_compare_call, string)
{
    stub::compare_call<std::string> expect("hello");
    auto t1 = std::make_tuple("hello");
    EXPECT_TRUE(expect.compare(t1));
}


text:
from __future__ import print_function

import os
import sys
import json
import tempfile
import subprocess

filepath = sys.argv[1]
filename = os.path.basename(filepath)
equajson = json.load(open(filepath))

try:
    latex_documents = equajson["markup-languages"]["LaTeX"]
except KeyError:
    # If there isn't any LaTeX markup, there is nothing to validate.
    sys.exit(0)

for document in latex_documents:
    try:
        latex = document["markup"]
    except KeyError:
        sys.stdout.write("Missing LaTeX markup in file `{}'".format(filepath))
    fp = tempfile.NamedTemporaryFile(mode='w')
    fp.file.write(latex)
    fp.file.flush()
    try:
        subprocess.check_output(['pdflatex', '-halt-on-error', fp.name], stderr=subprocess.STDOUT, cwd=tempfile.gettempdir())
    except subprocess.CalledProcessError as latex_err:
        sys.stderr.write(latex_err.output.decode())
        raise
    finally:
        fp.close()


text:
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* tests/asn.1/ktest_equal.h */
/*
 * Copyright (C) 1994 by the Massachusetts Institute of Technology.
 * All rights reserved.
 *
 * Export of this software from the United States of America may
 *   require a specific license from the United States Government.
 *   It is the responsibility of any person or organization contemplating
 *   export to obtain such a license before exporting.
 *
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
 * distribute this software and its documentation for any purpose and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of M.I.T. not be used in advertising or publicity pertaining
 * to distribution of the software without specific, written prior
 * permission.  Furthermore if you modify this software you must label
 * your software as modified software and not distribute it in such a
 * fashion that it might be confused with the original M.I.T. software.
 * M.I.T. makes no representations about the suitability of
 * this software for any purpose.  It is provided "as is" without express
 * or implied warranty.
 */

#ifndef __KTEST_EQUAL_H__
#define __KTEST_EQUAL_H__

#include "k5-int.h"
#include "kdb.h"

/* int ktest_equal_structure(krb5_structure *ref, *var) */
/* effects  Returns true (non-zero) if ref and var are
             semantically equivalent (i.e. have the same values,
             but aren't necessarily the same object).
            Returns false (zero) if ref and var differ. */

#define generic(funcname,type)\
int funcname (type *ref, type *var)

#define len_array(funcname,type)\
int funcname (int length, type *ref, type *var)
#define len_unsigned_array(funcname,type)\
int funcname (unsigned int length, type *ref, type *var)

generic(ktest_equal_authenticator,krb5_authenticator);
generic(ktest_equal_principal_data,krb5_principal_data);
generic(ktest_equal_checksum,krb5_checksum);
generic(ktest_equal_keyblock,krb5_keyblock);
generic(ktest_equal_data,krb5_data);
generic(ktest_equal_authdata,krb5_authdata);
generic(ktest_equal_ticket,krb5_ticket);
generic(ktest_equal_enc_tkt_part,krb5_enc_tkt_part);
generic(ktest_equal_transited,krb5_transited);
generic(ktest_equal_ticket_times,krb5_ticket_times);
generic(ktest_equal_address,krb5_address);
generic(ktest_equal_enc_data,krb5_enc_data);

generic(ktest_equal_enc_kdc_rep_part,krb5_enc_kdc_rep_part);
generic(ktest_equal_priv,krb5_priv);
generic(ktest_equal_cred,krb5_cred);
generic(ktest_equal_error,krb5_error);
generic(ktest_equal_ap_req,krb5_ap_req);
generic(ktest_equal_ap_rep,krb5_ap_rep);
generic(ktest_equal_ap_rep_enc_part,krb5_ap_rep_enc_part);
generic(ktest_equal_safe,krb5_safe);

generic(ktest_equal_last_req_entry,krb5_last_req_entry);
generic(ktest_equal_pa_data,krb5_pa_data);
generic(ktest_equal_cred_info,krb5_cred_info);

generic(ktest_equal_enc_cred_part,krb5_cred_enc_part);
generic(ktest_equal_enc_priv_part,krb5_priv_enc_part);
generic(ktest_equal_as_rep,krb5_kdc_rep);
generic(ktest_equal_tgs_rep,krb5_kdc_rep);
generic(ktest_equal_as_req,krb5_kdc_req);
generic(ktest_equal_tgs_req,krb5_kdc_req);
generic(ktest_equal_kdc_req_body,krb5_kdc_req);
generic(ktest_equal_encryption_key,krb5_keyblock);

generic(ktest_equal_krb5_pa_enc_ts,krb5_pa_enc_ts);

generic(ktest_equal_sam_challenge_2,krb5_sam_challenge_2);
generic(ktest_equal_sam_challenge_2_body,krb5_sam_challenge_2_body);

int ktest_equal_last_req(krb5_last_req_entry **ref, krb5_last_req_entry **var);
int ktest_equal_sequence_of_ticket(krb5_ticket **ref, krb5_ticket **var);
int ktest_equal_sequence_of_pa_data(krb5_pa_data **ref, krb5_pa_data **var);
int ktest_equal_sequence_of_cred_info(krb5_cred_info **ref,
                                      krb5_cred_info **var);
int ktest_equal_sequence_of_principal(krb5_principal *ref,
                                      krb5_principal *var);
int ktest_equal_sequence_of_checksum(krb5_checksum **ref, krb5_checksum **var);
int
ktest_equal_sequence_of_algorithm_identifier(krb5_algorithm_identifier **ref,
                                             krb5_algorithm_identifier **var);
int ktest_equal_sequence_of_otp_tokeninfo(krb5_otp_tokeninfo **ref,
                                          krb5_otp_tokeninfo **var);

len_array(ktest_equal_array_of_enctype,krb5_enctype);
len_array(ktest_equal_array_of_data,krb5_data);
len_unsigned_array(ktest_equal_array_of_octet,krb5_octet);

int ktest_equal_authorization_data(krb5_authdata **ref, krb5_authdata **var);
int ktest_equal_addresses(krb5_address **ref, krb5_address **var);
int ktest_equal_array_of_char(const unsigned int length, char *ref, char *var);

int ktest_equal_etype_info(krb5_etype_info_entry **ref,
                           krb5_etype_info_entry **var);

int ktest_equal_krb5_etype_info_entry(krb5_etype_info_entry *ref,
                                      krb5_etype_info_entry *var);
int ktest_equal_pa_for_user(krb5_pa_for_user *ref, krb5_pa_for_user *var);
int ktest_equal_pa_s4u_x509_user(krb5_pa_s4u_x509_user *ref,
                                 krb5_pa_s4u_x509_user *var);
int ktest_equal_ad_kdcissued(krb5_ad_kdcissued *ref, krb5_ad_kdcissued *var);
int ktest_equal_ad_signedpath_data(krb5_ad_signedpath_data *ref,
                                   krb5_ad_signedpath_data *var);
int ktest_equal_ad_signedpath(krb5_ad_signedpath *ref,
                              krb5_ad_signedpath *var);
int ktest_equal_iakerb_header(krb5_iakerb_header *ref,
                              krb5_iakerb_header *var);
int ktest_equal_iakerb_finished(krb5_iakerb_finished *ref,
                                krb5_iakerb_finished *var);
int ktest_equal_fast_response(krb5_fast_response *ref,
                              krb5_fast_response *var);
int ktest_equal_otp_tokeninfo(krb5_otp_tokeninfo *ref,
                              krb5_otp_tokeninfo *var);
int ktest_equal_pa_otp_challenge(krb5_pa_otp_challenge *ref,
                                 krb5_pa_otp_challenge *var);
int ktest_equal_pa_otp_req(krb5_pa_otp_req *ref, krb5_pa_otp_req *var);

int ktest_equal_ldap_sequence_of_keys(ldap_seqof_key_data *ref,
                                      ldap_seqof_key_data *var);

#ifndef DISABLE_PKINIT
generic(ktest_equal_pa_pk_as_req, krb5_pa_pk_as_req);
generic(ktest_equal_pa_pk_as_req_draft9, krb5_pa_pk_as_req_draft9);
generic(ktest_equal_pa_pk_as_rep, krb5_pa_pk_as_rep);
generic(ktest_equal_auth_pack, krb5_auth_pack);
generic(ktest_equal_auth_pack_draft9, krb5_auth_pack_draft9);
generic(ktest_equal_kdc_dh_key_info, krb5_kdc_dh_key_info);
generic(ktest_equal_reply_key_pack, krb5_reply_key_pack);
generic(ktest_equal_reply_key_pack_draft9, krb5_reply_key_pack_draft9);
#endif /* not DISABLE_PKINIT */

int ktest_equal_kkdcp_message(krb5_kkdcp_message *ref,
                              krb5_kkdcp_message *var);
int ktest_equal_cammac(krb5_cammac *ref, krb5_cammac *var);

int ktest_equal_secure_cookie(krb5_secure_cookie *ref,
                              krb5_secure_cookie *var);

#endif


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace HarmonicOscillation
{
    /**
     * Diese Klasse enthält die Logik für das Graph-Fenster
     */
    public partial class Graph : Form
    {
        /**
         * Konstruktor
         */
        public Graph()
        {
            InitializeComponent();
        }

        /**
         * Neuen Datenpunk im Weg-Diagramm anlegen
         */
        public void addGraphWay(Series graph) {
            chart1.Series.Add(graph);
        }

        /**
         * Neuen Datenpunk im Geschwindigkeit-Diagramm anlegen
         */
        public void addGraphSpeed(Series graph)
        {
            chart2.Series.Add(graph);
        }

        /**
         * Neuen Datenpunk im Beschleunigung-Diagramm anlegen
         */
        public void addGraphAcceleration(Series graph)
        {
            chart3.Series.Add(graph);
        }
    }
}


text:
@implementation ISO8601DateFormatter (RKValueTransformers)

+ (instancetype)defaultISO8601DateFormatter
{
    ISO8601DateFormatter *iso8601DateFormatter = [ISO8601DateFormatter new];
    iso8601DateFormatter.defaultTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
    iso8601DateFormatter.includeTime = YES;
    iso8601DateFormatter.parsesStrictly = YES;
    return iso8601DateFormatter;
}

- (BOOL)validateTransformationFromClass:(Class)inputValueClass toClass:(Class)outputValueClass
{
    return (([inputValueClass isSubclassOfClass:[NSDate class]] && [outputValueClass isSubclassOfClass:[NSString class]]) ||
            ([inputValueClass isSubclassOfClass:[NSString class]] && [outputValueClass isSubclassOfClass:[NSDate class]]));
}

- (BOOL)transformValue:(id)inputValue toValue:(id *)outputValue ofClass:(Class)outputValueClass error:(NSError **)error
{
    RKValueTransformerTestInputValueIsKindOfClass(inputValue, (@[ [NSString class], [NSDate class] ]), error);
    RKValueTransformerTestOutputValueClassIsSubclassOfClass(outputValueClass, (@[ [NSString class], [NSDate class] ]), error);
    if ([inputValue isKindOfClass:[NSString class]]) {
        NSString *errorDescription = nil;
        BOOL success = [self getObjectValue:outputValue forString:inputValue errorDescription:&errorDescription];
        RKValueTransformerTestTransformation(success, error, @"%@", errorDescription);
    } else if ([inputValue isKindOfClass:[NSDate class]]) {
        *outputValue = [self stringFromDate:inputValue];
    }
    return YES;
}

@end


text:
{% extends 'layouts/base.html' %}
{% set page_title = 'Mailchimp test' %}
{% block container %}

Email

Please send us an email so we can keep in touch with you

{% endblock %}