text:
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;

namespace System.Collections.Generic
{
    [Serializable]
    [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
    public abstract partial class Comparer<T> : IComparer, IComparer<T>
    {
        // public static Comparer<T> Default is runtime-specific

        public static Comparer<T> Create(Comparison<T> comparison)
        {
            if (comparison == null)
                throw new ArgumentNullException(nameof(comparison));

            return new ComparisonComparer<T>(comparison);
        }

        public abstract int Compare([AllowNull] T x, [AllowNull] T y);

        int IComparer.Compare(object? x, object? y)
        {
            if (x == null) return y == null ? 0 : -1;
            if (y == null) return 1;
            if (x is T && y is T) return Compare((T)x, (T)y);
            ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArgumentForComparison);
            return 0;
        }
    }

    internal sealed class ComparisonComparer<T> : Comparer<T>
    {
        private readonly Comparison<T> _comparison;

        public ComparisonComparer(Comparison<T> comparison)
        {
            _comparison = comparison;
        }

        public override int Compare(T x, T y)
        {
            return _comparison(x, y);
        }
    }

    // Note: although there is a lot of shared code in the following
    // comparers, we do not incorporate it into a base class for perf
    // reasons. Adding another base class (even one with no fields)
    // means another generic instantiation, which can be costly esp.
    // for value types.
    [Serializable]
    [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
    // Needs to be public to support binary serialization compatibility
    public sealed partial class GenericComparer<T> : Comparer<T> where T : IComparable<T>
    {
        public override int Compare([AllowNull] T x, [AllowNull] T y)
        {
            if (x != null)
            {
                if (y != null) return x.CompareTo(y);
                return 1;
            }
            if (y != null) return -1;
            return 0;
        }

        // Equals method for the comparer itself.
        public override bool Equals(object? obj) =>
            obj != null && GetType() == obj.GetType();

        public override int GetHashCode() =>
            GetType().GetHashCode();
    }

    [Serializable]
    [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
    // Needs to be public to support binary serialization compatibility
    public sealed partial class NullableComparer<T> : Comparer<T?> where T : struct, IComparable<T>
    {
        public override int Compare(T? x, T? y)
        {
            if (x.HasValue)
            {
                if (y.HasValue) return x.value.CompareTo(y.value);
                return 1;
            }
            if (y.HasValue) return -1;
            return 0;
        }

        // Equals method for the comparer itself.
        public override bool Equals(object? obj) =>
            obj != null && GetType() == obj.GetType();

        public override int GetHashCode() =>
            GetType().GetHashCode();
    }

    [Serializable]
    [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
    // Needs to be public to support binary serialization compatibility
    public sealed partial class ObjectComparer<T> : Comparer<T>
    {
        public override int Compare([AllowNull] T x, [AllowNull] T y)
        {
            return System.Collections.Comparer.Default.Compare(x, y);
        }

        // Equals method for the comparer itself.
        public override bool Equals(object? obj) =>
            obj != null && GetType() == obj.GetType();

        public override int GetHashCode() =>
            GetType().GetHashCode();
    }

    [Serializable]
    internal sealed partial class EnumComparer<T> : Comparer<T>, ISerializable where T : struct, Enum
    {
        internal EnumComparer() { }

        // Used by the serialization engine.
        private EnumComparer(SerializationInfo info, StreamingContext context) { }

        // public override int Compare(T x, T y) is runtime-specific

        // Equals method for the comparer itself.
        public override bool Equals(object? obj) =>
            obj != null && GetType() == obj.GetType();

        public override int GetHashCode() =>
            GetType().GetHashCode();

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            // Previously Comparer<T> was not specialized for enums,
            // and instead fell back to ObjectComparer which uses boxing.
            // Set the type as ObjectComparer here so code that serializes
            // Comparer for enums will not break.
            info.SetType(typeof(ObjectComparer<T>));
        }
    }
}


text:
using Boxing.Contracts.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Boxing.Contracts.Requests.Matches
{
    public class UpdateMatchRequest : IRequest
    {
        public MatchDto Match { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
#include "TCPServerConnection.h"

namespace Titanium {

static kroll::Logger* GetLogger()
{
    return kroll::Logger::Get("Network.TCPServerSocketConnection");
}

TCPServerConnection::TCPServerConnection(Poco::Net::StreamSocket& s, Poco::Net::SocketReactor & r)
    : StaticBoundObject("Network.TCPServerSocketConnection")
    , socket(s)
    , reactor(r)
    , closed(false)
    , onRead(0)
    , onWrite(0)
    , onReadComplete(0)
    , currentSendDataOffset(0)
    , readStarted(false)
    , writeReadyHandlerInstalled(false)
{
    GetLogger()->Debug("TCPServerConnection creating");

    /**
     * @tiapi(method=True,name=Network.TCPServerSocketConnection.close,since=1.2)
     * Close the Socket object's connection, if it is open.
     * @tiresult[Boolean] true if the connection was successfully close, false if otherwise
     */
    this->SetMethod("close", &TCPServerConnection::Close);

    /**
     * @tiapi(method=True,name=Network.TCPServerSocketConnection.write,since=1.2)
     * @tiapi Write data to the Socket's connection, if open.
     * @tiarg[String, data] The data to write to the connection.
     * @tiresult[Boolean] True if the write was successful, false otherwise.
     */
    this->SetMethod("write", &TCPServerConnection::Write);

    /**
     * @tiapi(method=True,name=Network.TCPServerSocketConnection.isClosed,since=1.2)
     * @tiapi Check whether the Socket is closed.
     * @tiresult[Boolean] true if a Socket object is closed, false if otherwise
     */
    this->SetMethod("isClosed",&TCPServerConnection::IsClosed);

    /**
     * @tiapi(method=True,name=Network.TCPServerSocketConnection.onRead,since=1.2)
     * @tiapi Set a callback that will be fired when data is received on the Socket.
     * @tiarg[Function, onRead] Function to be called when data is received.
     */
    this->SetMethod("onRead",&TCPServerConnection::SetOnRead);

    /**
     * @tiapi(method=True,name=Network.TCPServerSocketConnection.onWrite,since=1.2)
     * @tiapi Set a callback that will be fired when data is written on the Socket.
     * @tiarg[Function, onWrite] Function to be called when data is written.
     */
    this->SetMethod("onWrite",&TCPServerConnection::SetOnWrite);

    /**
     * @tiapi(method=True,name=Network.TCPServerSocketConnection.onError,version=1.2)
     * @tiapi Set the callback that will be fired when the Socket encounters an error.
     * @tiarg[Function, onError] Function to be called when an error happens.
     */
    this->SetMethod("onError",&TCPServerConnection::SetOnError);

    /**
     * @tiapi(method=True,name=Network.TCPServerSocketConnection.onReadComplete,since=1.2)
     * @tiapi Set the callback function that will be fired when a read finishes. A read is
     * @tiapi considered finished if some bytes have been read and a subsequent call to read
     * @tiapi returns zero bytes.
     * @tiarg[Function, onReadComplete] Function be called when a read completes.
     */
    this->SetMethod("onReadComplete",&TCPServerConnection::SetOnReadComplete);

    reactor.addEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::ReadableNotification>(*this, &TCPServerConnection::onReadable));
    reactor.addEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::ShutdownNotification>(*this, &TCPServerConnection::onShutdown));
    reactor.addEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::ErrorNotification>(*this, &TCPServerConnection::onErrored));
}

TCPServerConnection::~TCPServerConnection()
{
    reactor.removeEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::ReadableNotification>(*this, &TCPServerConnection::onReadable));
    reactor.removeEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::ShutdownNotification>(*this, &TCPServerConnection::onShutdown));
    reactor.removeEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::WritableNotification>(*this, &TCPServerConnection::onWritable));
    reactor.removeEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::ErrorNotification>(*this, &TCPServerConnection::onErrored));

    if (!this->closed)
    {
        this->socket.close();
    }
}

void TCPServerConnection::onReadable (const Poco::AutoPtr<Poco::Net::ReadableNotification>& notification)
{
    if (this->closed)
    {
        return;
    }
    static std::string eprefix("TCPServerConnection::OnRead: ");

    try
    {
        // Always read bytes, so that the tubes get cleared.
        char data[BUFFER_SIZE + 1];
        int size = socket.receiveBytes(&data, BUFFER_SIZE);

        // A read is only complete if we've already read some bytes from the socket.
        bool readComplete = this->readStarted && (size <= 0);
        this->readStarted = (size > 0);

        if (readComplete && !this->onReadComplete.isNull())
        {
            ValueList args;
            RunOnMainThread(this->onReadComplete, args, false);
        }
        else if (size > 0 && !this->onRead.isNull())
        {
            data[size] = '\0';

            BytesRef bytes(new Bytes(data, size));
            ValueList args(Value::NewObject(bytes));
            RunOnMainThread(this->onRead, args, false);
        }
    }
    catch (ValueException& e)
    {
        GetLogger()->Error("Read failed: %s", e.ToString().c_str());
        ValueList args(Value::NewString(e.ToString()));

        if (!this->onError.isNull())
            RunOnMainThread(this->onError, args, false);
    }
    catch (Poco::Exception &e)
    {
        // sometimes we'll get a I/O error (9) after closing during
        // a read, we can safely ignore errors if closed
        if (!this->closed)
        {
            GetLogger()->Error("Read failed: %s", e.displayText().c_str());
            ValueList args(Value::NewString(e.displayText()));

            if (!this->onError.isNull())
                RunOnMainThread(this->onError, args, false);
        }
    }
    catch (...)
    {
        GetLogger()->Error("Read failed: unknown exception");
        ValueList args(Value::NewString("Unknown exception during read"));

        if (!this->onError.isNull())
            RunOnMainThread(this->onError, args, false);
    }
}

void TCPServerConnection::onShutdown (const Poco::AutoPtr<Poco::Net::ShutdownNotification>& notification)
{
    this->closed = true;

    //FIXME? what to do when we shutdown... do we need to auto-release?
}

void TCPServerConnection::onWritable (const Poco::AutoPtr<Poco::Net::WritableNotification>& notification)
{
    if (this->closed)
    {
        return;
    }

    if (sendData.empty())
    {
        this->reactor.removeEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::WritableNotification>(*this, &TCPServerConnection::onWritable));
        writeReadyHandlerInstalled = false;
        return;
    }

    BytesRef buffer(0);
    {
        Poco::Mutex::ScopedLock lock(sendDataMutex);
        buffer = sendData.front();
    }

    const char* data = buffer->Pointer() + currentSendDataOffset;
    size_t length = buffer->Length() - currentSendDataOffset;
    size_t count = this->socket.sendBytes(data, length);
    currentSendDataOffset += count;

    if (currentSendDataOffset == (size_t) buffer->Length())
    {
        // Only send the onWrite message when we've exhausted a Bytes.
        if (!this->onWrite.isNull())
        {
            ValueList args(Value::NewInt(buffer->Length()));
            RunOnMainThread(this->onWrite, args, false);
        }

        Poco::Mutex::ScopedLock lock(sendDataMutex);
        sendData.pop();
        currentSendDataOffset = 0;

        // Uninstall the ReadyForWrite reactor handler, because it will push
        // the CPU to 100% usage if there is nothing to write.
        if (sendData.size() == 0)
        {
            this->reactor.removeEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::WritableNotification>(*this, &TCPServerConnection::onWritable));
            writeReadyHandlerInstalled = false;
        }
    }
}

void TCPServerConnection::onErrored(const Poco::AutoPtr<Poco::Net::ErrorNotification>& notification)
{
    if (this->onError.isNull())
    {
        return;
    }
    ValueList args(Value::NewString(notification->name()));
    RunOnMainThread(this->onError, args, false);
}

void TCPServerConnection::Close(const ValueList& args, KValueRef result)
{
    if (!closed)
    {
        this->closed = true;
        socket.close();
        result->SetBool(true);
    }
    else
    {
        result->SetBool(false);
    }
}

void TCPServerConnection::Write(const ValueList& args, KValueRef result)
{
    args.VerifyException("Write", "o|s");

    static std::string eprefix("TCPServerConnection::Write: ");
    if (this->closed)
        throw ValueException::FromString(eprefix +  "Socket is not open");

    BytesRef data(0);
    if (args.at(0)->IsString())
    {
        std::string sendString(args.GetString(0));
        data = new Bytes(sendString.c_str(), sendString.size());
    }
    else if (args.at(0)->IsObject())
    {
        KObjectRef dataObject(args.GetObject(0));
        data = dataObject.cast<Bytes>();
    }

    if (data.isNull())
        throw ValueException::FromString("Cannot send non-Bytes object");

    {
        Poco::Mutex::ScopedLock lock(sendDataMutex);
        sendData.push(data);

        // Only install the ReadyForWrite handler when there is actually data
        // to write, because otherwise the CPU usage will spike to 100%
        if (!writeReadyHandlerInstalled)
        {
            this->reactor.addEventHandler(socket, Poco::NObserver<TCPServerConnection, Poco::Net::WritableNotification>(*this, &TCPServerConnection::onWritable));
            writeReadyHandlerInstalled = true;
        }
    }

    result->SetBool(true);
}

void TCPServerConnection::SetOnRead(const ValueList& args, KValueRef result)
{
    this->onRead = args.at(0)->ToMethod();
}

void TCPServerConnection::SetOnWrite(const ValueList& args, KValueRef result)
{
    this->onWrite = args.at(0)->ToMethod();
}

void TCPServerConnection::SetOnError(const ValueList& args, KValueRef result)
{
    this->onError = args.at(0)->ToMethod();
}

void TCPServerConnection::SetOnReadComplete(const ValueList& args, KValueRef result)
{
    this->onReadComplete = args.at(0)->ToMethod();
}

void TCPServerConnection::IsClosed(const ValueList& args, KValueRef result)
{
    return result->SetBool(this->closed);
}

} // namespace Titanium


text:
package net.sandstorm.castlauncher;

import android.app.WallpaperManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Display;
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Brian Wing on 2/24/2016.
 * Sandstorm Technologies
 * brian@sandstorm.net
 */
public class Workspace implements View.OnDragListener, View.OnClickListener, View.OnLongClickListener, TextWatcher{

    private static final String SAVE_STATE_FILE_NAME = "desktop.dat";

    private HomeActivity activity;
    private ImageView wallpaper;
    private RelativeLayout desktop;
    private LinearLayout taskbar;
    private AppClickListener appListener;
    private List<App> taskbarAppsList;
    private GridView startMenu;
    private EditText startMenuSearchBar;
    private List<App> startMenuAppsList;

    public Workspace(HomeActivity a){
        this.activity = a;

        //Load wallpaper.
        //TODO: Load and save wallpaper choice with desktop apps.
        this.wallpaper = (ImageView) this.activity.findViewById(R.id.desktop_wallpaper);
        WallpaperManager wpManager = WallpaperManager.getInstance(this.activity);
        this.wallpaper.setBackground(wpManager.getDrawable());

        //Load desktop.
        this.desktop = (RelativeLayout) this.activity.findViewById(R.id.desktop);
        this.desktop.setOnDragListener(this);
        this.desktop.setOnLongClickListener(this);
        appListener = new AppClickListener(this.activity);
        loadState();

        //Load taskbar.
        this.taskbar = (LinearLayout) this.activity.findViewById(R.id.taskbar);
        this.taskbarAppsList = new ArrayList<App>();

        //Load start menu.
        this.startMenu = (GridView) this.activity.findViewById(R.id.start_menu);
        this.startMenuSearchBar = (EditText) this.activity.findViewById(R.id.start_menu_search);
        this.startMenuAppsList = getAppsList();

        //Add apps in list to grid view.
        sortStartMenu("");

        //Launch app when clicked from start menu.
        this.startMenu.setOnItemClickListener(appListener);

        //Enable dragging of icons in start menu.
        this.startMenu.setOnItemLongClickListener(appListener);

        //Add text listener for search bar.
        this.startMenuSearchBar.addTextChangedListener(this);

        //Begin with start menu hidden.
        hideStartMenu();
    }

    /**************************************************************************
     ***************************** DESKTOP METHODS ****************************
     **************************************************************************/

    /**
     * Handle dragging of items on the desktop. Particularly adding icons to the desktop from the start menu and moving items around on the desktop.
     * @param v The view being dragged to.
     * @param event The {@link DragEvent DragEvent} started when the item drag is started.
     * @return True if the drag event was consumed here, false otherwise.
     */
    @Override
    public boolean onDrag(View v, DragEvent event) {
        switch (event.getAction()) {
            case DragEvent.ACTION_DRAG_STARTED:
                //Hide view being dragged while being dragged.
                RelativeLayout view = (RelativeLayout) event.getLocalState();
                view.setVisibility(View.GONE);
                break;
            case DragEvent.ACTION_DRAG_ENTERED:
                break;
            case DragEvent.ACTION_DRAG_EXITED:
                break;
            case DragEvent.ACTION_DROP:
                //Handle the dragged view being dropped over a drop view.
                view = (RelativeLayout) event.getLocalState();
                TextView packageName = (TextView) view.findViewWithTag("package_name");
                TextView label = (TextView) view.findViewWithTag("label");
                ImageView icon = (ImageView) view.findViewWithTag("icon");
                if (label != null && icon != null) {
                    App app = new App(label.getText().toString(), packageName.getText().toString(), icon.getDrawable());
                    PointF p = new PointF(event.getX(), event.getY());
                    addToDesktop(app, p);
                } else {
                    return false;
                }

                //Remove old view from desktop once drag is completed.
                removeFromDesktop(view);
                break;
            case DragEvent.ACTION_DRAG_ENDED:
                //Unhide view if it is dropped somewhere other than on the desktop.
                view = (RelativeLayout) event.getLocalState();
                view.setVisibility(View.VISIBLE);
                break;
            default:
                break;
        }
        return true;
    }

    private PopupWindow popupWindow;

    @Override
    public void onClick(View v) {
        if(this.popupWindow != null && this.popupWindow.isShowing()){
            this.popupWindow.dismiss();
        }

        switch(v.getTag().toString()){
            case "desktop_menu_move":
                //Gray out and disable taskbar and start menu.
                RelativeLayout dock = (RelativeLayout) this.activity.findViewById(R.id.dock);
                dock.setAlpha(.5f);
                for(int i = 0; i < this.taskbar.getChildCount(); i++){
                    this.taskbar.getChildAt(i).setOnClickListener(null);
                    this.taskbar.getChildAt(i).setOnLongClickListener(null);
                }
                ImageButton startButton = (ImageButton) dock.findViewById(R.id.start_button);
                startButton.setEnabled(false);
                this.appListener.setMode(Mode.MOVE_ICONS);
                this.popupWindow.getContentView().findViewById(R.id.desktop_menu_move).setVisibility(View.GONE);
                this.popupWindow.getContentView().findViewById(R.id.desktop_menu_stop_move).setVisibility(View.VISIBLE);
                break;
            case "desktop_menu_stop_move":
                //Unhide and enable taskbar and start menu.
                dock = (RelativeLayout) this.activity.findViewById(R.id.dock);
                dock.setAlpha(1.0f);
                for(int i = 0; i < this.taskbar.getChildCount(); i++){
                    this.taskbar.getChildAt(i).setOnClickListener(this.taskbarListener);
                    this.taskbar.getChildAt(i).setOnLongClickListener(this.taskbarListener);
                }
                startButton = (ImageButton) dock.findViewById(R.id.start_button);
                startButton.setEnabled(true);
                this.appListener.setMode(Mode.SHOW_POPUP_MENU);
                this.popupWindow.getContentView().findViewById(R.id.desktop_menu_move).setVisibility(View.VISIBLE);
                this.popupWindow.getContentView().findViewById(R.id.desktop_menu_stop_move).setVisibility(View.GONE);
                break;
            case "desktop_menu_background":
                //Create intent to get desktop background.
                //TODO: Set background image correctly.
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                this.activity.startActivityForResult(Intent.createChooser(intent, "Select Background Image"), this.activity.GET_DESKTOP_BACKGROUND);
                break;
            default:
                break;
        }
    }

    private int mouseX;
    private int mouseY;

    @Override
    public boolean onLongClick(View v) {
        ViewGroup popupMenu = (ViewGroup) this.activity.getLayoutInflater().inflate(R.layout.desktop_popup_menu, null);
        popupMenu.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);

        if(this.popupWindow == null){
            //Add onTouch listeners for menu items.
            for(int i = 0; i < popupMenu.getChildCount(); i++){
                View view = popupMenu.getChildAt(i);
                if(view instanceof TextView){
                    view.setOnClickListener(this);
                }
            }
            this.popupWindow = new PopupWindow(popupMenu, FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, true);
            this.popupWindow.setBackgroundDrawable(this.activity.getResources().getDrawable(android.R.drawable.editbox_dropdown_light_frame));
        }

        Display display = this.activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        this.popupWindow.showAsDropDown(v, mouseX, mouseY - size.y + popupMenu.getMeasuredHeight() / 2); // Correctly position desktop popup window.
        return true;
    }

    /**
     * Refresh values of mouseX and mouseY for use in the onLongClick method. This helps correctly position the long click menu of the desktop.
     * @param x The x coordinate of the mouse.
     * @param y The y coordinate of the mouse.
     */
    public void updateMouseLocation(int x, int y){
        this.mouseX = x;
        this.mouseY = y;
    }

    /**
     * Creates a drawable out of the given string path and sets it to the wallpaper element of the dekstop.
     * @param imagePath The path of the image to set as the background.
     */
    public void setDesktopBackground(String imagePath){
        if(!imagePath.equals("") && imagePath != null) {
            this.wallpaper.setBackground(Drawable.createFromPath(imagePath));
        }
    }

    /**
     * Sets the given drawable to the wallpaper element of the dekstop.
     * @param image The drawable to set as the background.
     */
    public void setDesktopBackground(Drawable image){
        if(image != null) {
            this.wallpaper.setBackground(image);
        }
    }

    /**
     * Save the current desktop icon configuration for loading next time the app is started.
     */
    public void saveState(){
        FileOutputStream out = null;
        try {
            //TODO: SD card support.
            out = this.activity.openFileOutput(SAVE_STATE_FILE_NAME, Context.MODE_PRIVATE);

            String output = "";
            //Fill output string with app data from desktop.
            for(int i = 0; i < this.desktop.getChildCount(); i++){
                output += ((TextView) this.desktop.getChildAt(i).findViewById(R.id.desktop_item_label)).getText() + ",";
                output += this.desktop.getChildAt(i).getTag() + ",";
                int[] pos = new int[2];
                this.desktop.getChildAt(i).getLocationOnScreen(pos);
                output += pos[0] + ",";
                output += pos[1] + "\n";
            }

            out.write(output.getBytes());
            out.close();
        } catch (Exception e) {
            Toast.makeText(this.activity, R.string.file_write_error, Toast.LENGTH_LONG).show();
        } finally {
            if(out != null) {
                try {
                    out.close();
                }catch(IOException e){

                }
            }
        }
    }

    /**
     * Load the last used desktop icon configuration.
     */
    private void loadState(){
        File f = new File(this.activity.getFilesDir(), SAVE_STATE_FILE_NAME);
        //TODO: SD card support.

        if(f.exists()){
            BufferedReader in = null;
            try{
                in = new BufferedReader(new InputStreamReader(this.activity.openFileInput(SAVE_STATE_FILE_NAME)));

                String input = "";
                while((input = in.readLine()) != null){
                    String[] parsedInput = input.split(",");
                    App app = new App(parsedInput[0], parsedInput[1], null);
                    app = findCompleteApp(app);
                    if(app != null){
                        PointF p = new PointF(Integer.parseInt(parsedInput[2]), Integer.parseInt(parsedInput[3]));
                        addToDesktop(app, p);
                    }
                }

                in.close();
            }catch(Exception e){
                Toast.makeText(this.activity, R.string.file_read_error, Toast.LENGTH_LONG).show();
            }finally {
                if(in != null) {
                    try {
                        in.close();
                    }catch(IOException e){

                    }
                }
            }
        }
    }

    /**
     * Add an {@link App App} to the desktop.
     * @param app The app to add to the desktop.
     * @param point The place to add the app.
     */
    private void addToDesktop(App app, PointF point){
        //Create app view for desktop.
        View desktopItem = this.activity.getLayoutInflater().inflate(R.layout.desktop_item, null);
        ImageView icon = (ImageView) desktopItem.findViewById(R.id.desktop_item_icon);
        icon.setImageDrawable(app.getIcon());
        TextView label = (TextView) desktopItem.findViewById(R.id.desktop_item_label);
        label.setText(app.getLabel());
        TextView packageName = (TextView) desktopItem.findViewById(R.id.desktop_item_package_name);
        packageName.setText(app.getName());
        desktopItem.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);

        //Keep icon within screen bounds.
        RectF child = new RectF(point.x - desktopItem.getMeasuredWidth(), point.y - desktopItem.getMeasuredHeight(), point.x , point.y);
        this.desktop.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
        RectF parent = new RectF(0.0f, 0.0f, this.desktop.getMeasuredWidth() - 60, this.desktop.getMeasuredHeight() - 60);
        child = clampToParent(child, parent);
        desktopItem.setX(child.left);
        desktopItem.setY(child.top);
        desktopItem.setTag(app.getName());

        //Enable dragging of icons on desktop.
        desktopItem.setOnLongClickListener(appListener);

        //Enable launching app from desktop icon.
        desktopItem.setOnClickListener(appListener);
        desktopItem.setTag("desktop_item");

        this.desktop.addView(desktopItem);
    }

    public void removeFromDesktop(View view){
        if(this.desktop.indexOfChild(view) != -1){
            this.desktop.removeView(view);
        }
    }

    /**
     * Clamps the given child {@link RectF rectangle} to the bounds of the given parent rectangle.
     * @param child The rectangular bounds of the object being drawn in the parent.
     * @param parent The rectangular bounds of the object being drawn in the parent.
     * @return The modified child rectangle to draw in the parent.
     */
    private static RectF clampToParent(RectF child, RectF parent){
        //Clamp x's.
        if(child.right > parent.right){
            double xDist = Math.sqrt(Math.pow(child.right - parent.right, 2));
            child.left -= xDist;
            child.right -= xDist;
        }else if(child.left < parent.left){
            double xDist = Math.sqrt(Math.pow(parent.left - child.left, 2));
            child.left += xDist;
            child.right += xDist;
        }

        //Clamp y's.
        if(child.top < parent.top){
            double yDist = Math.sqrt(Math.pow(child.top - parent.top, 2));
            child.top += yDist;
            child.bottom += yDist;
        }else if(child.bottom > parent.bottom){
            double yDist = Math.sqrt(Math.pow(parent.bottom - child.bottom, 2));
            child.top -= yDist;
            child.bottom -= yDist;
        }

        return child;
    }

    /**
     * Returns a list of all apps installed on the device as a {@link App App} list.
     * @return A list of all apps installed on the device.
     */
    public List<App> getAppsList(){
        List<App> appsList = new ArrayList<App>();
        //Populate appList with all available apps.
        Intent i = new Intent(Intent.ACTION_MAIN, null);
        i.addCategory(Intent.CATEGORY_LAUNCHER);
        PackageManager manager = activity.getPackageManager();
        List<ResolveInfo> allActivities = manager.queryIntentActivities(i, 0);
        for(ResolveInfo info : allActivities){
            App app = new App(info.loadLabel(manager).toString(), info.activityInfo.packageName, info.activityInfo.loadIcon(manager));
            appsList.add(app);
        }

        return appsList;
    }

    /**
     * Returns an {@link App app} from the list of apps installed on the device.
     * @param app A partially complete app to search for.
     * @return The complete app, with name, label, and icon.
     */
    private App findCompleteApp(App app){
        App result = null;

        List<App> appsList = getAppsList();
        for(App appInList : appsList){
            if(appInList.getName().equals(app.getName()) && appInList.getLabel().equals(app.getLabel())){
                result = appInList;
                break;
            }
        }

        return result;
    }

    /**************************************************************************
     ***************************** TASKBAR METHODS ****************************
     **************************************************************************/

    /**
     * Adds an app to the list of apps to be displayed on the taskbar and fills the taskbar with those apps.
     * @param app The app to be added to the taskbar view.
     */
    public void addToTaskbar(App app){
        //Check if app is already in taskbar list.
        for(int i = 0; i < this.taskbarAppsList.size(); i++){
            if(app == null){
                break;
            }
            //Check if the new app and any other app are the same in either name, label, or icon.
            App appAtI = this.taskbarAppsList.get(i);
            if(appAtI.getLabel().equals(app.getLabel()) && appAtI.getName().equals(app.getName()) && appAtI.getIcon().getConstantState().equals(app.getIcon().getConstantState())){
                app = null;
            }
        }

        if(app != null){
            this.taskbarAppsList.add(app);
        }

        refreshTaskbar();
    }

    public void removeFromTaskbar(View v){
        if(this.taskbar.indexOfChild(v) != -1){
            this.taskbar.removeView(v);
        }
    }

    private TaskbarClickListener taskbarListener;

    /**
     * Refreshes the view of the taskbar to reflect any recent changes and add click listeners for taskbar items.
     */
    private void refreshTaskbar(){
        if(taskbarListener == null){
            taskbarListener = new TaskbarClickListener(this.activity);
        }

        //Add apps in taskbarAppsList to the taskbar view.
        this.taskbar.removeAllViews();
        for(int i = 0; i < this.taskbarAppsList.size(); i++){
            View taskbarItem = activity.getLayoutInflater().inflate(R.layout.taskbar_item, null);
            ImageView iv = (ImageView) taskbarItem.findViewById(R.id.taskbar_item_icon);
            iv.setImageDrawable(this.taskbarAppsList.get(i).getIcon());
            TextView tv = (TextView) taskbarItem.findViewById(R.id.taskbar_item_label);
            tv.setText(this.taskbarAppsList.get(i).getLabel());

            //Add click listeners to taskbar item.
            taskbarItem.setOnClickListener(taskbarListener);
            taskbarItem.setOnLongClickListener(taskbarListener);

            taskbar.addView(taskbarItem);
        }
    }

    /**
     * Returns the list of apps in the taskbar.
     * @return The list of apps in the taskbar.
     */
    public List<App> getTaskbarAppsList(){
        return this.taskbarAppsList;
    }

    /**************************************************************************
     ************************** START MENU METHODS ****************************
     **************************************************************************/

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {
        sortStartMenu(s.toString());
    }

    /**
     * Set start menu invisible.
     */
    public void hideStartMenu(){
        this.startMenu.setVisibility(View.INVISIBLE);
        this.startMenuSearchBar.setVisibility(View.INVISIBLE);
        this.startMenuSearchBar.clearFocus();
        this.startMenuSearchBar.setText("");
    }

    /**
     * Hide the start menu if the given motion event is outside of the start menu bounds.
     * @param ev The motion event that indicated that the start menu should become hidden.
     */
    public void hideStartMenu(MotionEvent ev){
        if(this.startMenu.getVisibility() == View.VISIBLE) {
            Bounds bounds = getStartMenuBounds();
            if (ev.getY() < bounds.getTop() || ev.getY() > bounds.getBottom() || ev.getX() > bounds.getRight() || ev.getX() < bounds.getLeft()) {
                //TODO: Check if click is not within start menu button.
                hideStartMenu();
            }
        }
    }

    /**
     * Set start menu visible.
     */
    public void showStartMenu(){
        this.startMenu.setVisibility(View.VISIBLE);
        this.startMenuSearchBar.setVisibility(View.VISIBLE);
        this.startMenuSearchBar.requestFocus();
    }

    /**
     * Returns the @{link #Bounds bounds} of the start menu and search bar.
     * @return The @{link #Bounds bounds} of the start menu and search bar.
     */
    private Bounds getStartMenuBounds(){
        return new Bounds(this.startMenuSearchBar.getTop(), this.startMenu.getBottom(), this.startMenu.getLeft(), this.startMenu.getRight());
    }

    public List<App> getStartMenuAppsList(){
        return startMenuAppsList;
    }

    /**
     * Fills the start menu with only the apps whose name matches the search string provided.
     * @param searchString The search string to sort apps by.
     */
    private void sortStartMenu(String searchString){
        PackageManager manager = this.activity.getPackageManager();
        this.startMenuAppsList.clear();
        Intent intent = new Intent(Intent.ACTION_MAIN, null);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);

        //Populate appsList with all available apps that match the search string.
        List<ResolveInfo> allActivities = manager.queryIntentActivities(intent, 0);
        for(ResolveInfo info : allActivities){
            App app = new App(info.loadLabel(manager).toString(), info.activityInfo.packageName, info.activityInfo.loadIcon(manager));
            if(app.getLabel().length() >= searchString.length()) {
                if (app.getLabel().toLowerCase().contains(searchString.toLowerCase())){
                    this.startMenuAppsList.add(app);
                }
            }
        }

        //Add apps from appList to start menu grid view.
        ArrayAdapter<App> adapter = new ArrayAdapter<App>(this.activity, R.layout.start_menu_item, this.startMenuAppsList){
            @Override
            public View getView(int position, View child, ViewGroup parent) {
                if(child == null){
                    child = activity.getLayoutInflater().inflate(R.layout.start_menu_item, null);
                }

                //Set the name of the app in the view.
                TextView packageName = (TextView) child.findViewById(R.id.start_menu_item_package_name);
                packageName.setText(startMenuAppsList.get(position).getName());

                //Set the icon of the app in the view.
                ImageView icon = (ImageView) child.findViewById(R.id.start_menu_item_icon);
                icon.setImageDrawable(startMenuAppsList.get(position).getIcon());

                //Set the label of the app in the view.
                TextView label = (TextView) child.findViewById(R.id.start_menu_item_label);
                label.setText(startMenuAppsList.get(position).getLabel());

                return child;
            }
        };
        ((GridView) this.activity.findViewById(R.id.start_menu)).setAdapter(adapter);
    }
}


text:
This is the official source code repository for the book. You are welcome to browse this repository and use the [issues tab](https://github.com/matryer/goblueprints/issues) to report any problems or ask any questions.

## Select edition

[![First Edition](https://raw.githubusercontent.com/matryer/goblueprints/master/artwork/bookcover-small.jpg)](README-1st.md) [![Second Edition](https://raw.githubusercontent.com/matryer/goblueprints/master/artwork/bookcover-2nd-small.png)](README-2nd.md)

## Get the book

  * From [Amazon.com](https://www.amazon.co.uk/Programming-Blueprints-real-world-production-ready-cutting-edge/dp/1786468948/ref=sr_1_4?keywords=go+programming+blueprints+ryer&qid=1573895643&sr=8-4)
  * Free articles about Go in the real world: [https://medium.com/@matryer](https://medium.com/@matryer)


text:
package com.oslab.eobotsdk;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * Testing Fundamentals
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}


text:
import os
import django

### Useful constants

DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

### Customize/configure Pasteque

DISPLAY_NAME = 'Pasteque'
ENABLED_RENDERERS = ('pygments', 'form', 'raw') # Ensure show-***.html exists
DEFAULT_RENDERER = 'pygments'
MAX_CHARACTERS = 100000
COMPRESS_ENABLED = False
SECRET_KEY = 'change_me'
ALLOWED_HOSTS = ['localhost','127.0.0.1']
TIME_ZONE = 'Europe/Brussels'
LANGUAGE_CODE = 'fr-FR'
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
    ('user', 'user@hostname.domain'),
)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': os.path.join(SITE_ROOT, 'var', 'db', 'webtools.sqlite3'),
        # The following settings are not used with sqlite3:
        'USER': '',
        'PASSWORD': '',
        'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
        'PORT': '',                      # Set to empty string for default.
    }
}

### End of customisation

APP_NAME = 'Pasteque'
APP_VERSION = 'v0.1'
TEMPLATE_CONTEXT_PROCESSORS = (
    "paste.context_processors.app_details",
    "django.core.context_processors.static",
)
SITE_ID = 1
MANAGERS = ADMINS
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_URL = ''
CACHE_PATH = os.path.join(SITE_ROOT, 'var', 'pygments-static')
COMPRESS_ROOT = os.path.join(SITE_ROOT, 'static')
MEDIA_ROOT = os.path.join(SITE_ROOT, 'assets')
STATIC_ROOT = os.path.join(SITE_ROOT, 'static')
STATIC_URL = '/static/'
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)
ROOT_URLCONF = 'webtools.urls'
WSGI_APPLICATION = 'webtools.wsgi.application'
INSTALLED_APPS = (
    'django.contrib.staticfiles',
    'compressor',
    'paste',
)
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
        },
        'logfile': {
            'level': 'DEBUG',
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': os.path.join(SITE_ROOT, 'var', 'logs', 'error.log'),
            'maxBytes': 50000,
            'backupCount': 2,
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['console','logfile'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. Soc. R. Bot. Belg. 60(2): 157 (1928)

#### Original name
Marasmius goossensiae Beeli

### Remarks
null


text:
"""
%prog data.cdt data.nwk

Convert the result from Eisen's CLUSTER program: data.gtr and data.cdt into NEWICK format
"""

import sys
import csv
import logging

from collections import namedtuple
from itertools import groupby

from jcvi.apps.base import OptionParser
from jcvi.formats.base import BaseFile

GTRLine = namedtuple("GTRLine", "parent left_child right_child dist")

class CDT(BaseFile):
    def __init__(self, filename):
        super(CDT, self).__init__(filename)

        pf = filename.rsplit(".", 1)[0]
        self.gtrfile = pf + ".gtr"
        self.atrfile = pf + ".atr"
        self.get_names()

    def get_names(self):
        cdt_file = self.filename
        reader = csv.reader(open(cdt_file), delimiter="\t")

        gid = next(reader)
        assert gid[0] == "GID"
        aid = next(reader)
        if aid[0] == "AID":
            eweight = next(reader)
        else:
            eweight = aid
        assert eweight[0] == "EWEIGHT"

        self.gnames = [x[:2] for x in reader]
        self.anames = list(zip(aid, gid))[4:]

    def get_gtr_tree(self):

        from ete3 import Tree

        fp = open(self.gtrfile)
        reader = csv.reader(fp, delimiter="\t")
        nodes = {}
        gnames = dict(self.gnames)
        for g in map(GTRLine._make, reader):
            node = Tree()
            parent_name, parent_dist = g.parent, float(g.dist)
            for child in (g.left_child, g.right_child):
                if child in gnames:
                    node.add_child(name=gnames[child], dist=1 - parent_dist)
                else:
                    assert child in nodes, child
                    child_node, child_dist = nodes[child]
                    node.add_child(child_node, dist=child_dist - parent_dist)

            nodes[parent_name] = (node, parent_dist)

        self.gtr_tree = node

    def print_newick(self, nwk_file):

        self.gtr_tree.write(format=5, outfile=nwk_file)
        logging.debug("Newick tree written to `{0}`".format(nwk_file))

    def iter_partitions(self, cutoff=0.3, gtr=True):
        from jcvi.utils.grouper import Grouper

        if gtr:
            names = self.gnames
            fp = open(self.gtrfile)
        else:
            names = self.anames
            fp = open(self.atrfile)

        reader = csv.reader(fp, delimiter="\t")
        grouper = Grouper()
        for g in map(GTRLine._make, reader):
            d = float(g.dist)
            if d < cutoff:
                continue

            grouper.join(g.parent, g.left_child, g.right_child)

        parents = {}
        for i, group in enumerate(grouper):
            for g in group:
                parents[g] = i

        partitions = [[parents.get(a, x), x] for a, x in names]
        for key, parts in groupby(partitions, key=lambda x: x[0]):
            yield list(x[1] for x in parts)

def main(args):

    cdt_file, nwk_file = args
    cdt = CDT(cdt_file)
    cdt.get_gtr_tree()
    cdt.print_newick(nwk_file)

if __name__ == "__main__":

    p = OptionParser(__doc__)
    opts, args = p.parse_args()

    if len(args) != 2:
        sys.exit(not p.print_help())

    main(args)


text:
package data.mod;

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

import interfaces.RandomFileAccessible;;

public class AreaInfo implements RandomFileAccessible {
	public static final byte[] AREA = "AREA".getBytes(); // Current Area.
	public static final byte[] PIXELDATA = "PXDT".getBytes(); // Changed pixels data.
	public static final int PixelDataByteSize = (4 * 5 + 1);

	public final byte[] current_area_id = new byte[4];
	public final byte[] current_area_sector_id = new byte[4];
	public final List<byte[]> changedPixelData = new ArrayList<>();
	public int size;

	public AreaInfo() {
		this.size = 0;
	}

	@Override
	public void read(RandomAccessFile raf) throws IOException {
		// Area Info chunk total size
		this.size = raf.readByte();

		// Area Info
		int offset = 0;
		byte[] data = new byte[raf.readByte()];
		raf.read(data);

		for (int i = 0; i < AreaInfo.AREA.length; offset++, i++, this.size--) {
			if (data[offset] != AreaInfo.AREA[i])
				throw new IOException("Incorrect Area Info AREA chunk.");
		}
		for (int i = 0; i < this.current_area_id.length; i++, offset++, this.size--) {
			this.current_area_id[i] = data[offset];
		}
		for (int i = 0; i < this.current_area_sector_id.length; i++, offset++, this.size--) {
			this.current_area_sector_id[i] = data[offset];
		}
		// Changed pixel data

		int arraySize = raf.readChar();
		int pixelSize = (arraySize - 4) / AreaInfo.PixelDataByteSize;

		if (pixelSize > 0) {
			data = new byte[arraySize];
			raf.read(data);
			offset = 0;
			for (int i = 0; i < AreaInfo.PIXELDATA.length; i++, offset++)
				if (data[offset] != AreaInfo.PIXELDATA[i])
					throw new IOException("Incorrect Area Info PIXELDATA chunk.");
			for (; pixelSize > 0; pixelSize--) {
				byte[] px = new byte[AreaInfo.PixelDataByteSize];
				for (int i = 0; i < px.length; i++, offset++)
					px[i] = data[offset];
				this.changedPixelData.add(px);
			}
		}
	}

	@Override
	public void write(RandomAccessFile raf) throws IOException {
		// Total chunk size.
		raf.writeByte(this.size);

		// Current Area Info
		raf.write(AreaInfo.AREA.length + this.current_area_id.length + this.current_area_sector_id.length);
		raf.write(AreaInfo.AREA);
		raf.write(this.current_area_id);
		raf.write(this.current_area_sector_id);

		// Changed pixel data
		raf.writeChar(this.changedPixelData.size() * AreaInfo.PixelDataByteSize + AreaInfo.PIXELDATA.length);
		raf.write(AreaInfo.PIXELDATA);
		for (byte[] b : this.changedPixelData)
			raf.write(b);
	}

	public void increment(byte[] concatenate) {
		this.size += concatenate.length;
	}

	public void reset() {
		this.size = 0;
	}
}


text:
require 'box/api/exceptions'

require 'httmultiparty'

module Box
  # A wrapper and interface to the Box api. Please visit the Box developers
  # site for a full explaination of what each of the Box api methods
  # expect and perform.
  # TODO: Link to the site.

  class Api
    # an extension of HTTParty, adding multi-part upload support
    include HTTMultiParty

    # @return [String] The base url of the box api.
    attr_accessor :base_url

    # @return [String] The upload url of the box api.
    attr_accessor :upload_url

    # Create a new API object using the given parameters.
    #
    # @note Chances are that if the Box api is updated or moves location,
    #       this class will no longer work. However, the option to change
    #       the defaults still remains.
    #
    # @param [String, Api] api_key The api key for your application. You can
    #        request one on the Box developer website at
    #        {http://www.box.net/developers/services}. If an {Api} instance
    #        is passed instead, its key is used.
    #
    # @param [String] url the url of the Box api.
    # @param [String] upload_url the url of the upload host for the Box api.
    # @param [String] version the version of the Box api in use.
    #
    def initialize(key, url = 'https://box.net', upload_url = 'https://upload.box.net', version = '1.0')
      @default_params = { :api_key => key } # add the api_key to every query

      @base_url = "#{ url }/api/#{ version }" # set the base of the request url
      @upload_url = "#{ upload_url }/api/#{ version }" # uploads use a different url than everything else
    end

    # Make a normal REST request.
    #
    # @param [String] expected the normal status expected to be returned.
    #        If the actual status does not match, an exception is thrown.
    # @param [Hash] options The parameters that wish to be passed in the
    #        request. These should coorespond to the api specifications,
    #        and will be passed along with the api key and auth token.
    #
    # @return [Hash] A parsed version of the XML response.
    #
    def query_rest(expected, options = {})
      query_raw('get', "#{ @base_url }/rest", expected, options)['response']
    end

    # Make a download request.
    #
    # @param [String] query the operation to be performed ("download").
    # @param [Array] args an array of arguments to put in the url.
    # @param [Hash] options (see #query_rest)
    #
    # @return The raw binary data of the file.
    #
    def query_download(args, options = {})
      # produces: /download/<auth_token>/<arg1>/<arg2>/<etc>
      url = [ "#{ @base_url }/download", @auth_token, args ].flatten.compact.join('/')
      query_raw('get', url, nil, options)
    end

    # Make an upload request.
    #
    # @param [String] query The operation to be performed.
    # @param [Array] args (see #query_download)
    # @param [String] expected (see #query_rest)
    # @param [Hash] options (see #query_rest)
    #
    # @return (see #query_rest)
    #
    def query_upload(query, args, expected, options = {})
      # produces: /upload/<auth_token>/<arg1>/<arg2>/<etc>
      url = [ "#{ @upload_url }/#{ query }", @auth_token, args ].flatten.compact.join('/')
      query_raw('post', url, expected, options)['response']
    end

    # Make a raw request.
    #
    # @note: HTTParty will automatically parse the response from its native
    #        XML to a nested hash/array structure.
    #
    # @param ['get', 'post'] method The HTTP method to use.
    # @param [String] url The url to make the request.
    # @param [String] expected (see #query_rest)
    # @param [Hash] options (see #query_rest)
    #
    # @return (see #query_rest)
    #
    def query_raw(method, url, expected, options = {})
      response = case method
      when 'get'
        self.class.get(url, :query => @default_params.merge(options))
      when 'post'
        self.class.post(url, :query => @default_params.merge(options), :format => :xml) # known bug with api that only occurs with uploads, will be fixed soon
      end

      handle_response(response, expected)
    end

    # Handle the response of the request.
    #
    # @param [Hash] response The parsed representation of the XML response.
    # @param expected (see #query_rest)
    #
    # @return [Hash] The response if no errors were found.
    # @raise [Exception, UnknownResponse] Raises an exception if the
    #        response status does not match the expected. This exception
    #        is determined by {.get_exception}
    def handle_response(response, expected = nil)
      if expected
        begin
          status = response['response']['status']
        rescue
          raise UnknownResponse, "Unknown response: #{ response }"
        end

        unless status == expected # expected is the normal, successful status for this request
          exception = self.class.get_exception(status)
          raise exception, status
        end
      end

      raise ErrorStatus, response.code unless response.success? # when the http return code is not normal
      response
    end

    # TODO: Add link to API documentation for all functions below.
    # TODO: Document exceptions that could be thrown.

    # Request a ticket for authorization
    def get_ticket
      query_rest('get_ticket_ok', :action => :get_ticket)
    end

    # Request an auth token given a ticket.
    #
    # @param [String] ticket the ticket to use.
    def get_auth_token(ticket)
      query_rest('get_auth_token_ok', :action => :get_auth_token, :ticket => ticket)
    end

    # Add the auth token to every request.
    #
    # @param [String] auth_token The auth token to add to every request.
    def set_auth_token(auth_token)
      @auth_token = auth_token
      @default_params[:auth_token] = auth_token
    end

    # Request the user be logged out.
    def logout
      query_rest('logout_ok', :action => :logout)
    end

    # Register a new user.
    #
    # @param [String] email The email address to use.
    # @param [String] password The password to use.
    def register_new_user(email, password)
      query_rest('successful_register', :action => :register_new_user, :login => email, :password => password)
    end

    # Verify a registration email.
    #
    # @param [String] email The email address to check.
    def verify_registration_email(email)
      query_rest('email_ok', :action => :verify_registration_email, :login => email)
    end

    # Get the user's account info.
    def get_account_info
      query_rest('get_account_info_ok', :action => :get_account_info)
    end

    # Get the entire tree of a given folder.
    #
    # @param [String] folder_id The id of the folder to use.
    # @param [Array] args The arguments to pass along to get_account_tree.
    #
    # @note This function can take a long time for large folders.
    # @todo Use zip compression to save bandwidth.
    #
    # TODO: document the possible arguments.
    def get_account_tree(folder_id, *args)
      query_rest('listing_ok', :action => :get_account_tree, :folder_id => folder_id, :params => [ 'nozip' ] + args)
    end

    # Create a new folder.
    #
    # @param [String] parent_id The id of the parent folder to use.
    # @param [String] name The name of the newly created folder.
    # @param [Integer] shared The shared state of the new folder.
    def create_folder(parent_id, name, share = 0)
      query_rest('create_ok', :action => :create_folder, :parent_id => parent_id, :name => name, :share => share)
    end

    # Move the item to a new destination.
    #
    # @param ["file", "folder"] target The type of item.
    # @param [String] target_id The id of the item to move.
    # @param [String] destination_id The id of the parent to move to.
    def move(target, target_id, destination_id)
      query_rest('s_move_node', :action => :move, :target => target, :target_id => target_id, :destination_id => destination_id)
    end

    # Copy the the item to a new destination.
    #
    # @note The api currently only supports copying files.
    #
    # @param ["file"] target The type of item.
    # @param [String] target_id The id of the item to copy.
    # @param [String] destination_id The id of the parent to copy to.
    def copy(target, target_id, destination_id)
      query_rest('s_copy_node', :action => :copy, :target => target, :target_id => target_id, :destination_id => destination_id)
    end

    # Rename the item.
    #
    # @param ["file", "folder"] target The type of item.
    # @param [String] target_id The id of the item to rename.
    # @param [String] new_name The new name to be used.
    def rename(target, target_id, new_name)
      query_rest('s_rename_node', :action => :rename, :target => target, :target_id => target_id, :new_name => new_name)
    end

    # Delete the item.
    #
    # @param ["file", "folder"] target The type of item.
    # @param [String] target_id The id of the item to delete.
    def delete(target, target_id)
      query_rest('s_delete_node', :action => :delete, :target => target, :target_id => target_id)
    end

    # Get the file info.
    #
    # @param [String] file_id The file id to get info for.
    def get_file_info(file_id)
      query_rest('s_get_file_info', :action => :get_file_info, :file_id => file_id)
    end

    # Set the item description.
    #
    # @param ["file", "folder"] target The type of item.
    # @param [String] target_id The id of the item to describe.
    # @param [String] description The description to use.
    def set_description(target, target_id, description)
      query_rest('s_set_description', :action => :set_description, :target => target, :target_id => target_id, :description => description)
    end

    # Download the file to the given path.
    #
    # @note You cannot download folders.
    #
    # @param [String] path The path to write the file to.
    # @param [String] file_id The file id to download.
    # @param [Optional, String] version The version of the file to download.
    def download(path, file_id, version = nil)
      ::File.open(path, 'w') do |file|
        file << query_download([ file_id, version ]) # write the response directly to file
      end
    end

    # Upload the file to the specified folder.
    #
    # @param [String] path Upload the file at the given path.
    # @param [String] folder_id The folder id of the parent folder to use.
    # @param [Optional, Boolean] new_copy Upload a new copy instead of overwriting.
    def upload(path, folder_id, new_copy = false)
      query_upload('upload', folder_id, 'upload_ok', :file => ::File.new(path), :new_copy => new_copy)
    end

    # Overwrite the given file with a new one.
    #
    # @param [String] path (see #upload)
    # @param [String] file_id Replace the file with this id.
    # @param [Optional, String] name Use a new name as well.
    def overwrite(path, file_id, name = nil)
      query_upload('overwrite', file_id, 'upload_ok', :file => ::File.new(path), :file_name => name)
    end

    # Upload a new copy of the given file.
    #
    # @param [String] path (see #upload)
    # @param [String] file_id The id of the file to copy.
    # @param [Optional, String] name Use a new name as well.
    # TODO: Verfiy this does what I think it does
    def new_copy(path, file_id, name = nil)
      query_upload('new_copy', file_id, 'upload_ok', :file => ::File.new(path), :new_file_name => name)
    end
  end
end


text:
function MeasStruct = icm_init_measure_ret(cp)

%% Initialize the structure array of measurement result for the chosen POI
    ...Will be used in the "Real_Time_ICM_processMeasureTimer.m"

% data structure for each point measurement with all the fields above
MeasStruct = struct(...
    'PixelHeightWidth',[],... % point coordination [height;width]
    'dataX',[],... % point data: array of time (s) in curve fitting
    'rawY',[],... % point data: time-series of pixel grayscale
    'dataY',[],...
    'fitY',[],... % fitted data using curve fitting
    'FittedCoeffs',[],... % Curve fitting coefficients at initial run per point
    'CureFlags', struct('CureFlag_RunNo',0,'CureFlag_FrameIdx',0),...% Flag the curing window, i.e., mark the beginning of curing
...RunNo and frame index that mark the begin of curing
    'Idx_FailFit',zeros(1,1),... % Flag the runs of failed curve fitting, which has low R-square and may yield frequency outlier Idx_FailFit = [failed RunNO]
    'Times',[0],...% array of run time per point, will grow to be a RunNo-by-1 matrix
    'Heights',[0],...% height estimation at initial run per point, will grow to be a RunNo-by-1 matrix
    'zExposed',[],...% ICM Measured Cured Heights when UV closes
    'zDark',[],...% ICM Measured Cured Heights after UV closes at the end of acquisition
    'Freq_w',[],...% frequency of Im = I0 + I1*cos(wt+phi),Freq_w: angular frequency in Im=I0+I1*cos(W*t+phi)
    'Freq',[],...%Freq: frequency = Freq_w/2/pi (unit:Hz)
    'Phase2Pi',0,...%  the phase (unit: 2Pi), i.e.,time cumulative sum of frequencies to measure height
    'lastFitRet', icm_init_fit_ret(cp)...
    );

% FittedCoeffs: Curve fitting coefficients at initial run per point
..."fourier1" returns 4 coefficients y=a0+a1*cos(px)+b1*sin(px)=I0+I1*cos(Wt+phi)
    ...note: first set of coefficients is the initial values
    ...The length of coefficients = 4*(RunNo + 1) due to the initial value
...FittedCoeffs = [fitStatus,fitgof.rsquare,... % goodness of fitting
    ...I0 (baseline amplitude),I1 (Oscillation amplitude), freqW, freq (Hz),... % estimated parameters
    ...movingHorizon, halfLife], % fitting parameters


text:
import { PlayerWidget } from '../../models';
export declare function validate(handler: PlayerWidget.Controller): void;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Proc. Boston Soc. nat. Hist. 31: 399 (1904)

#### Original name
Cintractia limitata var. limitata G.P. Clinton

### Remarks
null


text:
#ifndef __GDIPLUS_PATH_H
#define __GDIPLUS_PATH_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif

#ifndef __cplusplus
#error "A C++ compiler is required to include gdipluspath.h."
#endif

// Note that some methods of GraphicsPath are implemented in gdiplusimpl.h.
// This avoids a cyclic dependency on Graphics and Pen.

class GraphicsPath: public GdiplusBase
{
	friend class CustomLineCap;
	friend class Graphics;
	friend class GraphicsPathIterator;
	friend class PathGradientBrush;
	friend class Region;

public:
	GraphicsPath(FillMode fillMode = FillModeAlternate):
			nativePath(NULL), lastStatus(Ok)
	{
		lastStatus = DllExports::GdipCreatePath(fillMode, &nativePath);
	}
	GraphicsPath(const PointF *points, const BYTE *types, INT count,
			FillMode fillMode = FillModeAlternate):
			nativePath(NULL), lastStatus(Ok)
	{
		lastStatus = DllExports::GdipCreatePath2(
				points, types, count, fillMode, &nativePath);
	}
	GraphicsPath(const Point *points, const BYTE *types, INT count,
			FillMode fillMode = FillModeAlternate):
			nativePath(NULL), lastStatus(Ok)
	{
		lastStatus = DllExports::GdipCreatePath2I(
				points, types, count, fillMode, &nativePath);
	}
	~GraphicsPath()
	{
		DllExports::GdipDeletePath(nativePath);
	}
	GraphicsPath* Clone() const
	{
		GpPath *clonePath = NULL;
		Status status = updateStatus(DllExports::GdipClonePath(
				nativePath, &clonePath));
		if (status == Ok) {
			GraphicsPath *result = new GraphicsPath(clonePath, lastStatus);
			if (!result) {
				DllExports::GdipDeletePath(clonePath);
				lastStatus = OutOfMemory;
			}
			return result;
		} else {
			return NULL;
		}
	}

	Status AddArc(REAL x, REAL y, REAL width, REAL height,
			REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathArc(nativePath,
				x, y, width, height, startAngle, sweepAngle));
	}
	Status AddArc(INT x, INT y, INT width, INT height,
			REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathArcI(nativePath,
				x, y, width, height, startAngle, sweepAngle));
	}
	Status AddArc(const RectF& rect, REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathArc(nativePath,
				rect.X, rect.Y, rect.Width, rect.Height,
				startAngle, sweepAngle));
	}
	Status AddArc(const Rect& rect, REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathArcI(nativePath,
				rect.X, rect.Y, rect.Width, rect.Height,
				startAngle, sweepAngle));
	}
	Status AddBezier(REAL x1, REAL y1, REAL x2, REAL y2,
			REAL x3, REAL y3, REAL x4, REAL y4)
	{
		return updateStatus(DllExports::GdipAddPathBezier(nativePath,
				x1, y1, x2, y2, x3, y3, x4, y4));
	}
	Status AddBezier(INT x1, INT y1, INT x2, INT y2,
			INT x3, INT y3, INT x4, INT y4)
	{
		return updateStatus(DllExports::GdipAddPathBezierI(nativePath,
				x1, y1, x2, y2, x3, y3, x4, y4));
	}
	Status AddBezier(const PointF& pt1, const PointF& pt2,
			const PointF& pt3, const PointF& pt4)
	{
		return updateStatus(DllExports::GdipAddPathBezier(nativePath,
				pt1.X, pt1.Y, pt2.X, pt2.Y,
				pt3.X, pt3.Y, pt4.X, pt4.Y));
	}
	Status AddBezier(const Point& pt1, const Point& pt2,
			const Point& pt3, const Point& pt4)
	{
		return updateStatus(DllExports::GdipAddPathBezierI(nativePath,
				pt1.X, pt1.Y, pt2.X, pt2.Y,
				pt3.X, pt3.Y, pt4.X, pt4.Y));
	}
	Status AddBeziers(const PointF *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathBeziers(
				nativePath, points, count));
	}
	Status AddBeziers(const Point *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathBeziersI(
				nativePath, points, count));
	}
	Status AddClosedCurve(const PointF *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathClosedCurve(
				nativePath, points, count));
	}
	Status AddClosedCurve(const Point *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathClosedCurveI(
				nativePath, points, count));
	}
	Status AddClosedCurve(const PointF *points, INT count, REAL tension)
	{
		return updateStatus(DllExports::GdipAddPathClosedCurve2(
				nativePath, points, count, tension));
	}
	Status AddClosedCurve(const Point *points, INT count, REAL tension)
	{
		return updateStatus(DllExports::GdipAddPathClosedCurve2I(
				nativePath, points, count, tension));
	}
	Status AddCurve(const PointF *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathCurve(
				nativePath, points, count));
	}
	Status AddCurve(const Point *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathCurveI(
				nativePath, points, count));
	}
	Status AddCurve(const PointF *points, INT count, REAL tension)
	{
		return updateStatus(DllExports::GdipAddPathCurve2(
				nativePath, points, count, tension));
	}
	Status AddCurve(const Point *points, INT count, REAL tension)
	{
		return updateStatus(DllExports::GdipAddPathCurve2I(
				nativePath, points, count, tension));
	}
	Status AddCurve(const PointF *points, INT count, INT offset,
			INT numberOfSegments, REAL tension)
	{
		return updateStatus(DllExports::GdipAddPathCurve3(
				nativePath, points, count,
				offset, numberOfSegments, tension));
	}
	Status AddCurve(const Point *points, INT count, INT offset,
			INT numberOfSegments, REAL tension)
	{
		return updateStatus(DllExports::GdipAddPathCurve3I(
				nativePath, points, count,
				offset, numberOfSegments, tension));
	}
	Status AddEllipse(REAL x, REAL y, REAL width, REAL height)
	{
		return updateStatus(DllExports::GdipAddPathEllipse(nativePath,
				x, y, width, height));
	}
	Status AddEllipse(INT x, INT y, INT width, INT height)
	{
		return updateStatus(DllExports::GdipAddPathEllipseI(nativePath,
				x, y, width, height));
	}
	Status AddEllipse(const RectF& rect)
	{
		return updateStatus(DllExports::GdipAddPathEllipse(nativePath,
				rect.X, rect.Y, rect.Width, rect.Height));
	}
	Status AddEllipse(const Rect& rect)
	{
		return updateStatus(DllExports::GdipAddPathEllipseI(nativePath,
				rect.X, rect.Y, rect.Width, rect.Height));
	}
	Status AddLine(REAL x1, REAL y1, REAL x2, REAL y2)
	{
		return updateStatus(DllExports::GdipAddPathLine(nativePath,
				x1, y1, x2, y2));
	}
	Status AddLine(INT x1, INT y1, INT x2, INT y2)
	{
		return updateStatus(DllExports::GdipAddPathLineI(nativePath,
				x1, y1, x2, y2));
	}
	Status AddLine(const PointF& pt1, const PointF& pt2)
	{
		return updateStatus(DllExports::GdipAddPathLine(nativePath,
				pt1.X, pt1.Y, pt2.X, pt2.Y));
	}
	Status AddLine(const Point& pt1, const Point& pt2)
	{
		return updateStatus(DllExports::GdipAddPathLineI(nativePath,
				pt1.X, pt1.Y, pt2.X, pt2.Y));
	}
	Status AddLines(const PointF *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathLine2(nativePath,
				points, count));
	}
	Status AddLines(const Point *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathLine2I(nativePath,
				points, count));
	}
	Status AddPath(const GraphicsPath *addingPath, BOOL connect)
	{
		return updateStatus(DllExports::GdipAddPathPath(nativePath,
				addingPath ? addingPath->nativePath : NULL,
				connect));
	}
	Status AddPie(REAL x, REAL y, REAL width, REAL height,
			REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathPie(nativePath,
				x, y, width, height, startAngle, sweepAngle));
	}
	Status AddPie(INT x, INT y, INT width, INT height,
			REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathPieI(nativePath,
				x, y, width, height, startAngle, sweepAngle));
	}
	Status AddPie(const RectF& rect, REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathPie(nativePath,
				rect.X, rect.Y, rect.Width, rect.Height,
				startAngle, sweepAngle));
	}
	Status AddPie(const Rect& rect, REAL startAngle, REAL sweepAngle)
	{
		return updateStatus(DllExports::GdipAddPathPieI(nativePath,
				rect.X, rect.Y, rect.Width, rect.Height,
				startAngle, sweepAngle));
	}
	Status AddPolygon(const PointF *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathPolygon(nativePath,
				points, count));
	}
	Status AddPolygon(const Point *points, INT count)
	{
		return updateStatus(DllExports::GdipAddPathPolygonI(nativePath,
				points, count));
	}
	Status AddRectangle(const RectF& rect)
	{
		return updateStatus(DllExports::GdipAddPathRectangle(nativePath,
				rect.X, rect.Y, rect.Width, rect.Height));
	}
	Status AddRectangle(const Rect& rect)
	{
		return updateStatus(DllExports::GdipAddPathRectangleI(
				nativePath,
				rect.X, rect.Y, rect.Width, rect.Height));
	}
	Status AddRectangles(const RectF *rects, INT count)
	{
		return updateStatus(DllExports::GdipAddPathRectangles(
				nativePath, rects, count));
	}
	Status AddRectangles(const Rect *rects, INT count)
	{
		return updateStatus(DllExports::GdipAddPathRectanglesI(
				nativePath, rects, count));
	}
	Status AddString(const WCHAR *string, INT length,
			const FontFamily *family, INT style, REAL emSize,
			const PointF& origin, const StringFormat *format)
	{
		RectF layoutRect(origin, SizeF(0.0f, 0.0f));
		return updateStatus(DllExports::GdipAddPathString(nativePath,
				string, length,
				family ? family->nativeFontFamily : NULL,
				style, emSize, &layoutRect,
				format ? format->nativeStringFormat : NULL));
	}
	Status AddString(const WCHAR *string, INT length,
			const FontFamily *family, INT style, REAL emSize,
			const Point& origin, const StringFormat *format)
	{
		Rect layoutRect(origin, Size(0, 0));
		return updateStatus(DllExports::GdipAddPathStringI(nativePath,
				string, length,
				family ? family->nativeFontFamily : NULL,
				style, emSize, &layoutRect,
				format ? format->nativeStringFormat : NULL));
	}
	Status AddString(const WCHAR *string, INT length,
			const FontFamily *family, INT style, REAL emSize,
			const RectF& layoutRect, const StringFormat *format)
	{
		return updateStatus(DllExports::GdipAddPathString(nativePath,
				string, length,
				family ? family->nativeFontFamily : NULL,
				style, emSize, &layoutRect,
				format ? format->nativeStringFormat : NULL));
	}
	Status AddString(const WCHAR *string, INT length,
			const FontFamily *family, INT style, REAL emSize,
			const Rect& layoutRect, const StringFormat *format)
	{
		return updateStatus(DllExports::GdipAddPathStringI(nativePath,
				string, length,
				family ? family->nativeFontFamily : NULL,
				style, emSize, &layoutRect,
				format ? format->nativeStringFormat : NULL));
	}
	Status ClearMarkers()
	{
		return updateStatus(DllExports::GdipClearPathMarkers(
				nativePath));
	}
	Status CloseAllFigures()
	{
		return updateStatus(DllExports::GdipClosePathFigures(
				nativePath));
	}
	Status CloseFigure()
	{
		return updateStatus(DllExports::GdipClosePathFigure(
				nativePath));
	}
	Status Flatten(const Matrix *matrix = NULL,
			REAL flatness = FlatnessDefault)
	{
		return updateStatus(DllExports::GdipFlattenPath(nativePath,
				matrix ? matrix->nativeMatrix : NULL,
				flatness));
	}
	Status GetBounds(RectF *bounds, const Matrix *matrix = NULL,
			const Pen *pen = NULL) const
	{
		return updateStatus(DllExports::GdipGetPathWorldBounds(
				nativePath, bounds,
				matrix ? matrix->nativeMatrix : NULL,
				pen ? pen->nativePen : NULL));
	}
	Status GetBounds(Rect *bounds, const Matrix *matrix = NULL,
			const Pen *pen = NULL) const
	{
		return updateStatus(DllExports::GdipGetPathWorldBoundsI(
				nativePath, bounds,
				matrix ? matrix->nativeMatrix : NULL,
				pen ? pen->nativePen : NULL));
	}
	FillMode GetFillMode() const
	{
		FillMode result = FillModeAlternate;
		updateStatus(DllExports::GdipGetPathFillMode(nativePath,
				&result));
		return result;
	}
	Status GetLastPoint(PointF *lastPoint) const
	{
		return updateStatus(DllExports::GdipGetPathLastPoint(
				nativePath, lastPoint));
	}
	Status GetLastStatus() const
	{
		Status result = lastStatus;
		lastStatus = Ok;
		return result;
	}
	Status GetPathData(PathData *pathData) const
	{
		if (!pathData) return lastStatus = InvalidParameter;

		Status status;
		INT count;

		status = updateStatus(DllExports::GdipGetPointCount(
				nativePath, &count));
		if (status != Ok) return status;

		status = updateStatus(pathData->AllocateArrays(count));
		if (status != Ok) return status;

		return updateStatus(DllExports::GdipGetPathData(
				nativePath, (GpPathData*) pathData));
	}
	Status GetPathPoints(PointF *points, INT count) const
	{
		return updateStatus(DllExports::GdipGetPathPoints(nativePath,
				points, count));
	}
	Status GetPathPoints(Point *points, INT count) const
	{
		return updateStatus(DllExports::GdipGetPathPointsI(nativePath,
				points, count));
	}
	Status GetPathTypes(BYTE *types, INT count) const
	{
		return updateStatus(DllExports::GdipGetPathTypes(nativePath,
				types, count));
	}
	INT GetPointCount() const
	{
		INT result = 0;
		updateStatus(DllExports::GdipGetPointCount(nativePath,
				&result));
		return result;
	}
	BOOL IsOutlineVisible(REAL x, REAL y, const Pen *pen,
			const Graphics *g = NULL) const;
	BOOL IsOutlineVisible(INT x, INT y, const Pen *pen,
			const Graphics *g = NULL) const;
	BOOL IsOutlineVisible(const PointF& point, const Pen *pen,
			const Graphics *g = NULL) const;
	BOOL IsOutlineVisible(const Point& point, const Pen *pen,
			const Graphics *g = NULL) const;
	BOOL IsVisible(REAL x, REAL y, const Graphics *g = NULL) const;
	BOOL IsVisible(INT x, INT y, const Graphics *g = NULL) const;
	BOOL IsVisible(const PointF& point, const Graphics *g = NULL) const;
	BOOL IsVisible(const Point& point, const Graphics *g = NULL) const;
	Status Outline(const Matrix *matrix = NULL,
			REAL flatness = FlatnessDefault)
	{
		return updateStatus(DllExports::GdipWindingModeOutline(
				nativePath,
				matrix ? matrix->nativeMatrix : NULL,
				flatness));
	}
	Status Reset()
	{
		return updateStatus(DllExports::GdipResetPath(nativePath));
	}
	Status Reverse()
	{
		return updateStatus(DllExports::GdipReversePath(nativePath));
	}
	Status SetFillMode(FillMode fillMode)
	{
		return updateStatus(DllExports::GdipSetPathFillMode(
				nativePath, fillMode));
	}
	Status SetMarker()
	{
		return updateStatus(DllExports::GdipSetPathMarker(nativePath));
	}
	Status StartFigure()
	{
		return updateStatus(DllExports::GdipStartPathFigure(
				nativePath));
	}
	Status Transform(const Matrix *matrix)
	{
		return updateStatus(DllExports::GdipTransformPath(
				nativePath,
				matrix ? matrix->nativeMatrix : NULL));
	}
	Status Warp(const PointF *destPoints, INT count, const RectF& srcRect,
			const Matrix *matrix = NULL,
			WarpMode warpMode = WarpModePerspective,
			REAL flatness = FlatnessDefault)
	{
		return updateStatus(DllExports::GdipWarpPath(nativePath,
				matrix ? matrix->nativeMatrix : NULL,
				destPoints, count,
				srcRect.X, srcRect.Y,
				srcRect.Width, srcRect.Height,
				warpMode, flatness));
	}
	Status Widen(const Pen *pen, const Matrix *matrix = NULL,
			REAL flatness = FlatnessDefault)
	{
		return updateStatus(DllExports::GdipWidenPath(nativePath,
				pen ? pen->nativePen : NULL,
				matrix ? matrix->nativeMatrix : NULL,
				flatness));
	}

private:
	GraphicsPath(GpPath *path, Status status):
		nativePath(path), lastStatus(status) {}
	GraphicsPath(const GraphicsPath&);
	GraphicsPath& operator=(const GraphicsPath&);

	Status updateStatus(Status newStatus) const
	{
		if (newStatus != Ok) lastStatus = newStatus;
		return newStatus;
	}

	GpPath *nativePath;
	mutable Status lastStatus;
};

class GraphicsPathIterator: public GdiplusBase
{
public:
	GraphicsPathIterator(GraphicsPath *path):
		nativePathIterator(NULL), lastStatus(Ok)
	{
		lastStatus = DllExports::GdipCreatePathIter(
				&nativePathIterator,
				path ? path->nativePath : NULL);
	}
	~GraphicsPathIterator()
	{
		DllExports::GdipDeletePathIter(nativePathIterator);
	}

	INT CopyData(PointF *points, BYTE *types, INT startIndex, INT endIndex)
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterCopyData(
				nativePathIterator, &result,
				points, types, startIndex, endIndex));
		return result;
	}
	INT Enumerate(PointF *points, BYTE *types, INT count)
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterEnumerate(
				nativePathIterator, &result,
				points, types, count));
		return result;
	}
	INT GetCount() const
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterGetCount(
				nativePathIterator, &result));
		return result;
	}
	Status GetLastStatus() const
	{
		Status result = lastStatus;
		lastStatus = Ok;
		return result;
	}
	INT GetSubpathCount() const
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterGetSubpathCount(
				nativePathIterator, &result));
		return result;
	}
	BOOL HasCurve() const
	{
		BOOL result = FALSE;
		updateStatus(DllExports::GdipPathIterHasCurve(
				nativePathIterator, &result));
		return result;
	}
	INT NextMarker(INT *startIndex, INT *endIndex)
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterNextMarker(
				nativePathIterator, &result,
				startIndex, endIndex));
		return result;
	}
	INT NextMarker(GraphicsPath *path)
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterNextMarkerPath(
				nativePathIterator, &result,
				path ? path->nativePath : NULL));
		return result;
	}
	INT NextPathType(BYTE *pathType, INT *startIndex, INT *endIndex)
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterNextPathType(
				nativePathIterator, &result,
				pathType, startIndex, endIndex));
		return result;
	}
	INT NextSubpath(INT *startIndex, INT *endIndex, BOOL *isClosed)
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterNextSubpath(
				nativePathIterator, &result,
				startIndex, endIndex, isClosed));
		return result;
	}
	INT NextSubpath(GraphicsPath *path, BOOL *isClosed)
	{
		INT result = 0;
		updateStatus(DllExports::GdipPathIterNextSubpathPath(
				nativePathIterator, &result,
				path ? path->nativePath : NULL, isClosed));
		return result;
	}
	VOID Rewind()
	{
		updateStatus(DllExports::GdipPathIterRewind(
				nativePathIterator));
	}

private:
	GraphicsPathIterator(GpPathIterator *pathIterator, Status status):
		nativePathIterator(pathIterator), lastStatus(status) {}
	GraphicsPathIterator(const GraphicsPathIterator&);
	GraphicsPathIterator& operator=(const GraphicsPathIterator&);

	Status updateStatus(Status newStatus) const
	{
		if (newStatus != Ok) lastStatus = newStatus;
		return newStatus;
	}

	GpPathIterator *nativePathIterator;
	mutable Status lastStatus;
};

class PathGradientBrush: public Brush
{
public:
	PathGradientBrush(const PointF *points, INT count,
			WrapMode wrapMode = WrapModeClamp)
	{
		GpPathGradient *nativePathGradient = NULL;
		lastStatus = DllExports::GdipCreatePathGradient(
				points, count, wrapMode, &nativePathGradient);
		nativeBrush = nativePathGradient;
	}
	PathGradientBrush(const Point *points, INT count,
			WrapMode wrapMode = WrapModeClamp)
	{
		GpPathGradient *nativePathGradient = NULL;
		lastStatus = DllExports::GdipCreatePathGradientI(
				points, count, wrapMode, &nativePathGradient);
		nativeBrush = nativePathGradient;
	}
	PathGradientBrush(const GraphicsPath *path)
	{
		GpPathGradient *nativePathGradient = NULL;
		lastStatus = DllExports::GdipCreatePathGradientFromPath(
				path ? path->nativePath : NULL,
				&nativePathGradient);
		nativeBrush = nativePathGradient;
	}
	virtual PathGradientBrush *Clone() const
	{
		GpBrush *cloneBrush = NULL;
		Status status = updateStatus(DllExports::GdipCloneBrush(
				nativeBrush, &cloneBrush));
		if (status == Ok) {
			PathGradientBrush *result =
				new PathGradientBrush(cloneBrush, lastStatus);
			if (!result) {
				DllExports::GdipDeleteBrush(cloneBrush);
				updateStatus(OutOfMemory);
			}
			return result;
		} else {
			return NULL;
		}
	}

	Status GetBlend(REAL *blendFactors, REAL *blendPositions,
			INT count) const
	{
		return updateStatus(DllExports::GdipGetPathGradientBlend(
				(GpPathGradient*) nativeBrush,
				blendFactors, blendPositions, count));
	}
	INT GetBlendCount() const
	{
		INT result = 0;
		updateStatus(DllExports::GdipGetPathGradientBlendCount(
				(GpPathGradient*) nativeBrush, &result));
		return result;
	}
	Status GetCenterColor(Color *color) const
	{
		return updateStatus(DllExports::GdipGetPathGradientCenterColor(
				(GpPathGradient*) nativeBrush,
				color ? &color->Value : NULL));
	}
	Status GetCenterPoint(PointF *point) const
	{
		return updateStatus(DllExports::GdipGetPathGradientCenterPoint(
				(GpPathGradient*) nativeBrush, point));
	}
	Status GetCenterPoint(Point *point) const
	{
		return updateStatus(DllExports::GdipGetPathGradientCenterPointI(
				(GpPathGradient*) nativeBrush, point));
	}
	Status GetFocusScales(REAL *xScale, REAL *yScale) const
	{
		return updateStatus(DllExports::GdipGetPathGradientFocusScales(
				(GpPathGradient*) nativeBrush, xScale, yScale));
	}
	BOOL GetGammaCorrection() const
	{
		BOOL result = FALSE;
		updateStatus(DllExports::GdipGetPathGradientGammaCorrection(
				(GpPathGradient*) nativeBrush, &result));
		return result;
	}
	//Status GetGraphicsPath(GraphicsPath *path) const
	//{
	//	// TODO: implement PathGradientBrush::GetGraphicsPath
	//	return updateStatus(NotImplemented);
	//}
	INT GetInterpolationColorCount() const
	{
		INT result = 0;
		updateStatus(DllExports::GdipGetPathGradientPresetBlendCount(
				(GpPathGradient*) nativeBrush, &result));
		return result;
	}
	Status GetInterpolationColors(Color *presetColors,
			REAL *blendPositions, INT count) const
	{
		if (!presetColors || count <= 0)
			return lastStatus = InvalidParameter;

		ARGB *presetArgb =
			(ARGB*) DllExports::GdipAlloc(count * sizeof(ARGB));
		if (!presetArgb)
			return lastStatus = OutOfMemory;

		Status status = updateStatus(DllExports::GdipGetPathGradientPresetBlend(
				(GpPathGradient*) nativeBrush,
				presetArgb, blendPositions, count));
		for (INT i = 0; i < count; ++i) {
			presetColors[i].SetValue(presetArgb[i]);
		}
		DllExports::GdipFree((void*) presetArgb);
		return status;
	}
	INT GetPointCount() const
	{
		INT result = 0;
		updateStatus(DllExports::GdipGetPathGradientPointCount(
				(GpPathGradient*) nativeBrush, &result));
		return result;
	}
	Status GetRectangle(RectF *rect) const
	{
		return updateStatus(DllExports::GdipGetPathGradientRect(
				(GpPathGradient*) nativeBrush, rect));
	}
	Status GetRectangle(Rect *rect) const
	{
		return updateStatus(DllExports::GdipGetPathGradientRectI(
				(GpPathGradient*) nativeBrush, rect));
	}
	INT GetSurroundColorCount() const
	{
		INT result = 0;
		updateStatus(DllExports::GdipGetPathGradientSurroundColorCount(
				(GpPathGradient*) nativeBrush, &result));
		return result;
	}
	Status GetSurroundColors(Color *colors, INT *count)
	{
		if (!colors || !count || *count <= 0)
			return lastStatus = InvalidParameter;

		ARGB *colorsArgb =
			(ARGB*) DllExports::GdipAlloc(*count * sizeof(ARGB));
		if (!colorsArgb)
			return lastStatus = OutOfMemory;

		Status status = updateStatus(DllExports::GdipGetPathGradientSurroundColorsWithCount(
				(GpPathGradient*) nativeBrush,
				colorsArgb, count));
		for (INT i = 0; i < *count; ++i) {
			colors[i].SetValue(colorsArgb[i]);
		}
		DllExports::GdipFree((void*) colorsArgb);
		return status;
	}
	Status GetTransform(Matrix *matrix) const
	{
		return updateStatus(DllExports::GdipGetPathGradientTransform(
				(GpPathGradient*) nativeBrush,
				matrix ? matrix->nativeMatrix : NULL));
	}
	WrapMode GetWrapMode() const
	{
		WrapMode result = WrapModeTile;
		updateStatus(DllExports::GdipGetPathGradientWrapMode(
				(GpPathGradient*) nativeBrush, &result));
		return result;
	}
	Status MultiplyTransform(const Matrix *matrix,
			MatrixOrder order = MatrixOrderPrepend)
	{
		return updateStatus(DllExports::GdipMultiplyPathGradientTransform(
				(GpPathGradient*) nativeBrush,
				matrix ? matrix->nativeMatrix : NULL, order));
	}
	Status ResetTransform()
	{
		return updateStatus(DllExports::GdipResetPathGradientTransform(
				(GpPathGradient*) nativeBrush));
	}
	Status RotateTransform(REAL angle,
			MatrixOrder order = MatrixOrderPrepend)
	{
		return updateStatus(DllExports::GdipRotatePathGradientTransform(
				(GpPathGradient*) nativeBrush, angle, order));
	}
	Status ScaleTransform(REAL sx, REAL sy,
			MatrixOrder order = MatrixOrderPrepend)
	{
		return updateStatus(DllExports::GdipScalePathGradientTransform(
				(GpPathGradient*) nativeBrush, sx, sy, order));
	}
	Status SetBlend(REAL *blendFactors, REAL *blendPositions, INT count)
	{
		return updateStatus(DllExports::GdipSetPathGradientBlend(
				(GpPathGradient*) nativeBrush,
				blendFactors, blendPositions, count));
	}
	Status SetBlendBellShape(REAL focus, REAL scale = 1.0f)
	{
		return updateStatus(DllExports::GdipSetPathGradientSigmaBlend(
				(GpPathGradient*) nativeBrush, focus, scale));
	}
	Status SetBlendTriangularShape(REAL focus, REAL scale = 1.0f)
	{
		return updateStatus(DllExports::GdipSetPathGradientLinearBlend(
				(GpPathGradient*) nativeBrush, focus, scale));
	}
	Status SetCenterColor(const Color& color)
	{
		return updateStatus(DllExports::GdipSetPathGradientCenterColor(
				(GpPathGradient*) nativeBrush,
				color.GetValue()));
	}
	Status SetCenterPoint(const PointF& point)
	{
		return updateStatus(DllExports::GdipSetPathGradientCenterPoint(
				(GpPathGradient*) nativeBrush, &point));
	}
	Status SetCenterPoint(const Point& point)
	{
		return updateStatus(DllExports::GdipSetPathGradientCenterPointI(
				(GpPathGradient*) nativeBrush, &point));
	}
	Status SetFocusScales(REAL xScale, REAL yScale)
	{
		return updateStatus(DllExports::GdipSetPathGradientFocusScales(
				(GpPathGradient*) nativeBrush, xScale, yScale));
	}
	Status SetGammaCorrection(BOOL useGammaCorrection)
	{
		return updateStatus(DllExports::GdipSetPathGradientGammaCorrection(
				(GpPathGradient*) nativeBrush,
				useGammaCorrection));
	}
	//Status SetGraphicsPath(const GraphicsPath *path)
	//{
	//	// TODO: implement PathGradientBrush::SetGraphicsPath
	//	return updateStatus(NotImplemented);
	//}
	Status SetInterpolationColors(const Color *presetColors,
			REAL *blendPositions, INT count)
	{
		if (!presetColors || count <= 0)
			return lastStatus = InvalidParameter;

		ARGB *presetArgb =
			(ARGB*) DllExports::GdipAlloc(count * sizeof(ARGB));
		if (!presetArgb)
			return lastStatus = OutOfMemory;
		for (INT i = 0; i < count; ++i) {
			presetArgb[i] = presetColors[i].GetValue();
		}

		Status status = updateStatus(DllExports::GdipSetPathGradientPresetBlend(
				(GpPathGradient*) nativeBrush,
				presetArgb, blendPositions, count));
		DllExports::GdipFree((void*) presetArgb);
		return status;
	}
	Status SetSurroundColors(const Color *colors, INT *count)
	{
		if (!colors || !count || *count <= 0)
			return lastStatus = InvalidParameter;

		ARGB *colorsArgb =
			(ARGB*) DllExports::GdipAlloc(*count * sizeof(ARGB));
		if (!colorsArgb)
			return lastStatus = OutOfMemory;
		for (INT i = 0; i < *count; ++i) {
			colorsArgb[i] = colors[i].GetValue();
		}

		Status status = updateStatus(DllExports::GdipSetPathGradientSurroundColorsWithCount(
				(GpPathGradient*) nativeBrush,
				colorsArgb, count));
		DllExports::GdipFree((void*) colorsArgb);
		return status;
	}
	Status SetTransform(const Matrix *matrix)
	{
		return updateStatus(DllExports::GdipSetPathGradientTransform(
				(GpPathGradient*) nativeBrush,
				matrix ? matrix->nativeMatrix : NULL));
	}
	Status SetWrapMode(WrapMode wrapMode)
	{
		return updateStatus(DllExports::GdipSetPathGradientWrapMode(
				(GpPathGradient*) nativeBrush, wrapMode));
	}
	Status TranslateTransform(REAL dx, REAL dy,
			MatrixOrder order = MatrixOrderPrepend)
	{
		return updateStatus(DllExports::GdipTranslatePathGradientTransform(
				(GpPathGradient*) nativeBrush, dx, dy, order));
	}

private:
	PathGradientBrush(GpBrush *brush, Status status): Brush(brush, status) {}
	PathGradientBrush(const PathGradientBrush&);
	PathGradientBrush& operator=(const PathGradientBrush&);
};

#endif /* __GDIPLUS_PATH_H */


text:
<window>
	<defaultcontrol>-</defaultcontrol>
	<controls>

		<control type="image">
			<description>media info background image</description>
			<posx>0</posx>
			<posy>0</posy>
			<width>1280</width>
			<height>162</height>
			<texture>white.png</texture>
			<colordiffuse>osd-background</colordiffuse>
		</control>
		<control type="label" id="10">
			<description>row 1 label</description>
			<posx>17</posx>
			<posy>12</posy>
			<width>1239</width>
			<height>31</height>
			-
			<align>left</align>
			font12
			<wrapmultiline>true</wrapmultiline>
		</control>
		<control type="label" id="11">
			<description>row 2 label</description>
			<posx>17</posx>
			<posy>50</posy>
			<width>1239</width>
			<height>31</height>
			-
			<align>left</align>
			font12
			<wrapmultiline>true</wrapmultiline>
		</control>
		<control type="label" id="12">
			<description>row 3 label</description>
			<posx>17</posx>
			<posy>100</posy>
			<width>1239</width>
			<height>31</height>
			-
			<align>left</align>
			font12
			<wrapmultiline>true</wrapmultiline>
		</control>
	</controls>
</window>


text:
package com.spm.android.exception;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Date;
import android.content.Context;
import android.os.Bundle;
import com.spm.R;
import com.spm.android.common.AndroidApplication;
import com.spm.android.common.utils.AndroidUtils;
import com.spm.android.common.utils.NotificationUtils;
import com.spm.common.utils.DateUtils;
import com.spm.common.utils.IdGenerator;

/**
 *
 * @author Maxi Rosson
 */
public class ExceptionReporter {

	/**
	 * Sends an error report.
	 *
	 * @param thread The thread where the exception occurred (e.g. {@link java.lang.Thread#currentThread()})
	 * @param ex The exception
	 */
	public void reportException(Thread thread, Throwable ex, String user) {

		Context context = AndroidApplication.get();

		Writer writer = new StringWriter();
		ex.printStackTrace(new PrintWriter(writer));

		Date now = DateUtils.now();
		Bundle bundle = new Bundle();
		bundle.putString(ExceptionReportService.EXTRA_THREAD_NAME, thread.getName());
		bundle.putString(ExceptionReportService.EXTRA_EXCEPTION_TIME,
			DateUtils.unTransform(now, DateUtils.YYYYMMDDHHMMSSZ_DATE_FORMAT));
		bundle.putString(ExceptionReportService.EXTRA_STACK_TRACE, writer.toString());
		if (user != null) {
			bundle.putString(ExceptionReportService.EXTRA_USER_NAME, user);
		}

		String notificationTitle = context.getString(R.string.exceptionReportNotificationTitle,
			AndroidUtils.getApplicationName());
		String notificationText = context.getString(R.string.exceptionReportNotificationText);

		NotificationUtils.sendNotification(IdGenerator.getRandomIntId(), android.R.drawable.stat_notify_error,
			notificationTitle, notificationTitle, notificationText, ExceptionReportActivity.class, now.getTime(),
			bundle);
	}
}


text:
class CreateAssets < ActiveRecord::Migration
  def change
    create_table :assets do |t|
      t.string :name
      t.string :service_tag
      t.string :manufacturer
      t.string :model
      t.string :express_service_code
      t.string :tag
      t.date :purchase_date
      t.string :purchase_entity

      t.timestamps
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                             http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

    <display-name>Discussion Board Application</display-name>

    <jsp-config>
        <jsp-property-group>
            <url-pattern>*.jsp</url-pattern>
            <url-pattern>*.jspf</url-pattern>
            <page-encoding>UTF-8</page-encoding>
            <scripting-invalid>true</scripting-invalid>
            <include-prelude>/WEB-INF/jsp/base.jspf</include-prelude>
            <trim-directive-whitespaces>true</trim-directive-whitespaces>
            <default-content-type>text/html</default-content-type>
        </jsp-property-group>
    </jsp-config>

    <!--
            Session
         -->
    <session-config>
'        <cookie-config>
            <http-only>true</http-only>
        </cookie-config>
        <tracking-mode>COOKIE</tracking-mode>
    </session-config>

    <distributable />

</web-app>


text:
namespace boost {
namespace asio {

template <typename Allocator = std::allocator<char> >
class basic_streambuf;

} // namespace asio
} // namespace boost

#endif // !defined(BOOST_ASIO_NO_IOSTREAM)

#endif // BOOST_ASIO_BASIC_STREAMBUF_FWD_HPP


text:
require 'validates_duplicity_of'
require 'active_record'

ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: File.dirname(__FILE__) + "/validates_duplicity_of.sqlite3")

load File.dirname(__FILE__) + '/support/schema.rb'
load File.dirname(__FILE__) + '/support/models.rb'


text:
<?php

namespace Zogs\MailerBundle\Mailer;

use Symfony\Component\Templating\EngineInterface;

use Zogs\UserBundle\Entity\User;
use Zogs\MailerBundle\Entity\Settings;
use Zogs\CommentBundle\Entity\Comment;

class Mailer
{
    protected $mailer;
    protected $templating;
    protected $expediteur;

    public function __construct(\Swift_Mailer $mailer, EngineInterface $templating, $sender)
    {
        $this->mailer = $mailer;
        $this->expediteur = $sender;
        $this->templating = $templating;
    }

    public function sendTestMessage($email)
    {
        return $this->sendMessage('symfony@local.dev', $email, 'test mailer', 'Hello world');;
    }

    protected function sendMessage($from, $to, $subject, $body)
    {
        $mail = \Swift_Message::newInstance();

        $mail
            ->setFrom($from)
            ->setTo($to)
            ->setSubject($subject)
            ->setBody($body)
            ->setContentType('text/html');

        return $this->mailer->send($mail);
    }

    public function registerPlugin(\Swift_Events_EventListener $plugin)
    {
        $this->mailer->registerPlugin($plugin);
    }
}


text:
MEDUSA_BEGIN;

class PFXEffect:public IEffect
{
public:
	PFXEffect(const FileIdRef& fileId);
	virtual ~PFXEffect();

	static Share<PFXEffect> CreateFromFile(const FileIdRef& fileId);
	static Share<PFXEffect> CreateFromData(const FileIdRef& fileId,MemoryData data);
	static Share<PFXEffect> CreateFromLines(const FileIdRef& fileId,const List<HeapString>& lines);
};

MEDUSA_END;