text:
package com.yuzhouwan.bigdata.zookeeper.curator;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.zookeeper.CreateMode;

public class CuratorTry {

    private static final String zkHost = "127.0.0.1:2181";
    private CuratorFramework curatorClient;

    public CuratorTry() {
        init();
    }

    private void init() {

        RetryPolicy retrypolicy = new ExponentialBackoffRetry(3000, 60);

        /*
         * using fluent api.
         */
        curatorClient = CuratorFrameworkFactory.builder()
                .connectString(zkHost)
                .sessionTimeoutMs(5000)
                .connectionTimeoutMs(3000)
                .retryPolicy(retrypolicy)
                .namespace("watcher")       // root path: /watcher
                .build();
        curatorClient.start();
    }

    /**
     * create.
     */
    public void create(String path) throws Exception {
        curatorClient.create().forPath(path);
    }

    public void createWithData(String path, byte[] data) throws Exception {
        curatorClient.create().forPath(path, data);
    }

    public void createPersistentNode(String path, byte[] data) throws Exception {
        curatorClient.create().withMode(CreateMode.PERSISTENT).forPath(path, data);
    }

    public void createEphemeralNodeRecursion(String path, byte[] data) throws Exception {
        curatorClient.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(path, data);
    }

    /**
     * delete.
     */
    public void delete(String path) throws Exception {
        curatorClient.delete().forPath(path);
    }

    public void deleteRecursion(String path) throws Exception {
        curatorClient.delete().deletingChildrenIfNeeded().forPath(path);
    }

    public void deleteRecursionWithVersion(String path, int version) throws Exception {
        curatorClient.delete().deletingChildrenIfNeeded().withVersion(version).forPath(path);
    }

    public void deleteRecursionGuaranteedWithVersion(String path, int version) throws Exception {
        curatorClient.delete().guaranteed().deletingChildrenIfNeeded().withVersion(version).forPath(path);
    }

    /**
     * update.
     */
    public void update(String path) throws Exception {
        curatorClient.setData().forPath(path);
    }

    public void updateWithVersion(String path, int version) throws Exception {
        curatorClient.setData().withVersion(version).forPath(path);
    }

    /**
     * read.
     */
    public String read(String path) throws Exception {
        byte[] data = curatorClient.getData().forPath(path);
        return new String(data);
    }

    public String readWithVersion() {
//        curatorClient.getData().forPath(path);
        throw new RuntimeException("Not support?");
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.kaazing.gateway.management.jmx;

import javax.management.ObjectName;

import org.kaazing.gateway.management.gateway.GatewayManagementBean;
import org.kaazing.gateway.server.util.ProductInfo;

public class VersionInfoMXBeanImpl implements VersionInfoMXBean {

    private final GatewayManagementBean gatewayManagementBean;

    public VersionInfoMXBeanImpl(ObjectName name, GatewayManagementBean gatewayManagementBean) {
        this.gatewayManagementBean = gatewayManagementBean;
    }

    @Override public ProductInfo getPrductInfo() {
        return gatewayManagementBean.getProductInfo();
    }
}


text:
var sortable = function($scope, element, attrs) {
  var initial, final;
  var model = $scope.model;
  $(element).sortable({
    start: function(event, ui) {
      initial = ui.item.index();
    },
    update: function(event, ui) {
      final = ui.item.index();
      model.updateIndex(initial, final);
    }
  });
};


text:
__fuspa__ is a library for creating a Single-Page-Application, written in TypeScript.

fuspa is using [url-pattern](https://github.com/snd/url-pattern), for matching with routes, and [hasher](https://github.com/millermedeiros/Hasher), for listening on url-hash changes.

Use this library to quickly create your own SPA with minimal effort.

## Getting Started

To get started quickly, use [fuspa-cli](https://github.com/fosenutvikling/fuspa-cli).

fuspa requires an id reference to a html-element, and a setup of a render-engine.

```
fuspa.Route.options = {
    container: 'container',
    templateEngine: Handlebars.templates
};
```

fuspa parses url-routes, renders a view using a render-engine. A http-client is also included, everything you need to get started with your own single-page-application.


text:
namespace miner {

SerializableBlockBuilder::SerializableBlockBuilder() :
    useLTOR(true), isFinalized(false), coinbase(nullptr, 0, 0)
{
    block.nNonce = 0;
}

void SerializableBlockBuilder::SetTime(uint32_t t) {
    block.nTime = t;
}

uint32_t SerializableBlockBuilder::GetTime() const {
    return block.GetBlockTime();
}

void SerializableBlockBuilder::SetVersion(uint32_t v) {
    block.nVersion = v;
}

uint32_t SerializableBlockBuilder::GetVersion() const {
    return block.nVersion;
}

void SerializableBlockBuilder::SetCoinbase(BuilderEntry tx) {
    THROW_UNLESS(!coinbase.IsValid());
    THROW_UNLESS(tx.IsValid());
    THROW_UNLESS(tx.IsCoinBase());
    coinbase = std::move(tx);
}

void SerializableBlockBuilder::AddTx(BuilderEntry tx) {
    THROW_UNLESS(tx.IsValid());
    THROW_UNLESS(!tx.IsCoinBase());
    txs.emplace_back(std::move(tx));
}

void SerializableBlockBuilder::SetBits(uint32_t bits) {
    block.nBits = bits;
}

void SerializableBlockBuilder::SetHashPrevBlock(const uint256& hash) {
    block.hashPrevBlock = hash;
}

void SerializableBlockBuilder::DisableLTOR() {
    useLTOR = false;
}

void SerializableBlockBuilder::Finalize(const Consensus::Params&) {
    THROW_UNLESS(!isFinalized);
    THROW_UNLESS(block.nTime);
    THROW_UNLESS(block.nVersion);
    THROW_UNLESS(block.vtx.empty());
    THROW_UNLESS(!block.hashPrevBlock.IsNull());
    THROW_UNLESS(coinbase.IsCoinBase());

    if (useLTOR) {
        std::sort(std::begin(txs), std::end(txs), EntryHashCmp);
    }

    block.vtx.reserve(txs.size() + 1);
    block.vtx.push_back(coinbase.GetTx());

    for (auto& tx : txs) {
        block.vtx.push_back(tx.GetTx());
    }

    isFinalized = true;
}

void SerializableBlockBuilder::CheckValidity(CBlockIndex* pindexPrev) {
    CValidationState state;
    if (!TestBlockValidity(state, block, pindexPrev, false, false)) {
        std::stringstream err;
        err << __func__ << ": TestBlockValidity failed: "
            << FormatStateMessage(state);
        throw std::runtime_error(err.str());
    }
}

CBlock SerializableBlockBuilder::Release() {
    THROW_UNLESS(isFinalized);
    return std::move(block);
}

} // ns miner


text:
@interface EZAudioFloatData : NSObject

//------------------------------------------------------------------------------

+ (instancetype)dataWithNumberOfChannels:(int)numberOfChannels
                                 buffers:(float **)buffers
                              bufferSize:(UInt32)bufferSize;

//------------------------------------------------------------------------------

@property (nonatomic, assign, readonly) int numberOfChannels;
@property (nonatomic, assign, readonly) float **buffers;
@property (nonatomic, assign, readonly) UInt32 bufferSize;

//------------------------------------------------------------------------------

- (float *)bufferForChannel:(int)channel;

//------------------------------------------------------------------------------

@end


text:
/*
  p015.c | Problem 15 - Lattice paths

  Created: Aug 10, 2014
   Author: David Perrot

  Utilizing Pascal's triangle, a 2D array is built using
  the given grid size, adding them together and finding the
  bottom middle number of the triangle set to find the
  number of lattice points used for the given grid.
*/
#include <stdio.h>

void p015() {
  int target = 20;
  unsigned long long** triangle;
  int i, j, t2;

  t2 = target + target;
  triangle = (unsigned long long**)malloc((t2 + 1) * sizeof(unsigned long long));
  for (i = 0; i <= t2; i++) {
    triangle[i] = (unsigned long long*)malloc((i+1) * sizeof(unsigned long long));
    triangle[i][0] = 1;
    triangle[i][i] = 1;
    for (j = 1; j < i; j++) {
      triangle[i][j] = triangle[i-1][j] + triangle[i-1][j-1];
    }
  }

  printf("The number of lattice paths for a %dx%d grid is %llu", target, target, triangle[t2][t2/2]);
  for (i = 0; i <= t2; i++) { free(triangle[i]); }
  free(triangle);
}


text:
#include "QmlMitkBigRenderLock.h"

#include "QVTKQuickItem.h"

QMutex& QmlMitkBigRenderLock::GetMutex()
{
  static QMutex globalRenderingLock;
  return globalRenderingLock;
}

QmlMitkBigRenderLock::QmlMitkBigRenderLock(QObject* parent)
:QObject(parent)
{
}

bool QmlMitkBigRenderLock::eventFilter(QObject* /*obj*/, QEvent* /*event*/)
{
  /*
    TODO

    this should BLOCK during rendering, i.e.

    it should acquire a mutex lock which is also acquired by the rendering method in QVTKQuickItem

    TODO:

    THIS MUST BE CHANGED!

    It is NOT sufficient to delay signal delivery, BUT we must block rendering until the signal is completely processed.
    TODO: what would happen if a signal receiver calls rendering->ForceImmediateUpdateAll ?

  */

  if ( GetMutex().tryLock() )
  {
    // ok, let's continue
  }
  else
  {
    GetMutex().lock();
  }

  GetMutex().unlock();

  return false; // don't actually filter/remove events
}


text:
import { NgModule, ModuleWithProviders } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';

import { SliderComponent } from './slider.component';

export { SliderComponent } from './slider.component';

const COMPONENTS = [
    SliderComponent
];

@NgModule({
    imports: [
        FormsModule,
        CommonModule
    ],
    declarations: COMPONENTS,
    exports: COMPONENTS
})
export class SliderModule {
    static forRoot(): ModuleWithProviders { return {ngModule: SliderModule, providers: []}; }
}


text:
var datepickerArgs = {autoclose: true, format: 'yyyy-mm-dd', language: "sv", calendarWeeks: true, endDate: new Date()};
var bigMode = matchMedia('only screen and (min-width: 463px)').matches;

$(document).ready(function() {
    $('.pop').popover();
    $('.modal').on('shown.bs.modal', function() {
        $(this).find("input:visible").first().focus();
    });
    $('.datepicker').datepicker(datepickerArgs);

    if ($('.qa-table').size() > 0) {
        qaTableFixedHeader();
    }

    $('#partisk-search input').typeahead([
        {
            name: 'questions',
            remote: appRoot + 'fr%C3%A5gor/search/%QUERY',
            minLength: 3
        }
    ]).bind('typeahead:selected', function(event, obj) {
        if (obj.key) {
            window.location = appRoot + "fr%C3%A5gor/" + encodeString(obj.value);
        }

        $(this).val("");
    }).focus();

    attachAccordions($('#accordion'));

    if (!supportsSvg()) {
        $("#graphs").hide();
        $("#no-svg").show();
    }

    initPopovers($("body"));

    $('body').on('click', function(e) {
        $('.popover.in').prev().not(e.target).not($(e.target).parent()).popover('toggle');
    });

    // Open modal without fade if it contains an error
    $('.modal').each(function(index, modal) {
        if ($(modal).find('p.error').size() > 0 || $(modal).hasClass('open-modal-on-load')) {
            $(modal).removeClass('fade');
            $(modal).on('shown.bs.modal', function() {
                $(this).addClass('fade in');
                $('.modal-backdrop').addClass('fade in');
            });
            $(modal).modal('show');

        }
    });
});

var attachAccordions = function (accordion) {
    accordion.find('.panel-collapse').on('show.bs.collapse', function () {
       $(this).parent().find(".toggle").removeClass("fa-plus-square").addClass("fa-minus-square");
       $(this).parent().addClass("accordion-expanded");
       $(this).find('.table-head-container').removeClass('table-fixed').show();
       $(this).find('.table-with-fixed-header').removeClass('table-fixed-header');
    });

    accordion.find('.panel-collapse').on('hide.bs.collapse', function () {
       $(this).parent().find(".toggle").removeClass("fa-minus-square").addClass("fa-plus-square");
       $(this).parent().removeClass("accordion-expanded");
    });

    accordion.find('.panel-collapse.ajax-load-table').on('show.bs.collapse', function () {
       var id = $(this).attr('data-id');
       var type = $(this).attr('data-type');
       var container = $(this);

       var method = type === "category" ? 'getCategoryTable' : 'getQuestionSummaryTable';

       if (!container.hasClass('table-loaded')) {
       $.ajax({
            url: appRoot + 'frågor/' + method + '/' + id,
            success: function(data) {
                var content = $(data);
                content.hide();
                container.append(content);

                if (type === "category") {
                    setupFixedHeader(content);
                }

                initPopovers(container);
                content.fadeIn('slow');
                container.addClass('table-loaded');
            }
        });
        }
    });
}

var encodeString = function(str) {
    return encodeURI(str.split(' ').join('_').toLowerCase()).replace('?', '%3f');
};

var initPopovers = function($container) {
    $container.find('.popover-hover-link').popover({
        html: true,
        placement: "auto",
        trigger: 'hover',
        content: function() {
            return $(this).next('.popover-data').html();
        }
    });

    $container.find('.popover-click-link').popover();

    $container.find('.popover-link').bind('click', function() {
        var $popover = $(this);
        $.ajax({url: appRoot + "answers/info/" + $popover.attr('data-id'), success: function(data) {
                $popover.unbind('click');
                $popover.popover({
                    html: true,
                    placement: "auto",
                    content: function() {
                        return data;
                    }
                }).popover('show');
            }});
    });

    $container.find('.empty-answer-popover').bind('click', function() {
        var $popover = $(this);
        $.ajax({url: appRoot + "questions/empty_answer/" + $popover.attr('data-question-id') + "/"
                    + $popover.attr('data-party-id'), success: function(data) {
                $popover.unbind('click');
                $popover.popover({
                    html: true,
                    placement: "auto",
                    content: function() {
                        return data;
                    }
                }).popover('show');
            }});
    });
}

$(window).resize(function() {
    newBigMode = matchMedia('only screen and (min-width: 463px)').matches;

    if (bigMode !== newBigMode) {
        bigMode = newBigMode;

        if (bigMode) {
            qaTableFixedHeader();
        }
    }
});

var qaTableFixedHeader = function() {
    if (matchMedia('only screen and (min-width: 463px)').matches && $('.table-head-container').size() === 0) {
        var tables = $('.table-with-fixed-header');

        tables.each(function (item) {
            setupFixedHeader($(this));
        });

    }
};

var setupFixedHeader = function (table) {
            var qaTableHead = $('

');
            var qaTableHeadRow = $('

');
            var qaTableHeadBg = $('

');

            qaTableHead.append(qaTableHeadBg);
            qaTableHead.append(qaTableHeadRow);

            table.before(qaTableHead);
            table.find('.table-head.table-row').clone().appendTo(qaTableHeadRow);
            var headerHeight = qaTableHeadRow.find('.table-row.table-head').height();
            //qaTableHeadRow.width(table.width());

            var faded = false;
            var headerVisible = false;
            $(window).scroll(function() {
                if (bigMode) {
                    var scrollTop = $(window).scrollTop();
                    if (!faded && scrollTop >= table.offset().top + table.height()) {
                        qaTableHead.fadeOut("fast", function () { faded = true; });
                    } else if (faded && scrollTop <= table.offset().top + table.height()) {
                        qaTableHead.fadeIn("fast", function () { faded = false; });
                    }

                        //console.log($(window).scrollTop() + ">=" + (table.offset().top));
                    if (scrollTop >= table.offset().top) {
                        if (!headerVisible) {
                            headerVisible = true;
                            qaTableHead.addClass('table-fixed');
                            table.addClass('table-fixed-header');
                        }
                    } else {
                        if (headerVisible) {
                            headerVisible = false;

                            qaTableHead.removeClass('table-fixed');
                            table.removeClass('table-fixed-header');
                        }
                    }
                }
            });
};

var openModal = function(controller, action, parameters) {

    $.ajax({
        url: appRoot + controller + '/' + action + '/' + parameters.join("/"),
        success: function(data) {
            $modal = $(data);
            $("body").append($modal);
            $modal.modal();
            $modal.find('.datepicker').datepicker(datepickerArgs);

            $modal.on('hidden.bs.modal', function() {
                $modal.remove();
            });
        }
    });
};

// http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript
function capitalizeFirstLetter(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
}

function getQuestionAgreeRate() {
    var result = {key: 'questionAgreeRate', values: []};

    var agree_rate = data["question_agree_rate"];

    for (var value in agree_rate) {
	if (parties[value] !== undefined) {
            result.values.push({value: agree_rate[value]['result'], range: agree_rate[value]['range'], plus_points: agree_rate[value]['plus_points'],
				label: capitalizeFirstLetter(parties[value].name), minus_points: agree_rate[value]['minus_points'],
				party_id: parties[value].id, short_label: parties[value].short_name,
				color: parties[value].color, order: parties[value].order});
	}
    }

    result.values.sort(function(a, b) {
        return a.order - b.order;
    });
    return [result];
}

function getPointsPercentage() {
    var result = {key: 'pointsPercentage', values: []};

    var points_percentage = data['points_percentage'];

    for (var value in points_percentage) {
        if (parties[value] !== undefined && points_percentage[value]['result'] > 0) {
            result.values.push({value: points_percentage[value]['result'], range: points_percentage[value]['range'],
                points: points_percentage[value]['points'], label: capitalizeFirstLetter(parties[value].name),
                party_id: parties[value].id, short_label: parties[value].short_name,
                color: parties[value].color, order: parties[value].order});
        }
    }

    result.values.sort(function(a, b) {
        return a.order - b.order;
    });
    return [result];
}

$(document).ready(function() {
    if (typeof data !== 'undefined' && data != null) {
        $("#quiz-summary").show();
        $("#graphs").show();

        if ($.cookie('p[q]') === quizId) {
            $.ajax({
                url: appRoot + "quiz/session_results/" + quizId,
                success: function(data) {
                    var container = $("#session-results");
                    var content = $(data);
                    content.hide();
                    container.append(content);

                    attachAccordions(container);

                    content.fadeIn('slow');
                }
        });
       }

        var items = [];

        for (party in parties) {
            var item = {plus: data.question_agree_rate[party].plus_points,
                minus: data.question_agree_rate[party].minus_points,
                party: party,
                agree_rate: data.question_agree_rate[party].result,
                percentage: data.points_percentage[party].result};
            items.push(item);
        }

        items.sort(function(a, b) {
            return (b.plus - b.minus) - (a.plus - a.minus);
        });

        for (current_item in items) {
            var item = items[current_item];
            var points = (item.plus - item.minus);
            $row = $('
 0 ? "plus" : (points < 0 ? "minus" : "")) + '-points">
');
            $row.append('

' + capitalizeFirstLetter(parties[item.party].name) + '
	');
            $row.append("" + item.plus + "p	");
            $row.append("" + item.minus + "p	");
            $row.append('' + (points > 0 ? "+" : "") + points + 'p	');
            $row.append('' + item.percentage + "%	");
            $("#result-table tbody").append($row);
        }

    nv.addGraph(function() {
        var data = getPointsPercentage();
        var chart = nv.models.pieChart()
                .x(function (d) {
                    return d.label;
                })
                .y(function (d) {
                    return d.value;
                })
                .tooltips(true)
                .margin({left: 1, top: 0, bottom: 10, right: 0})
                .color(function (item) {
                    if (item.data && item.data.color)
                        return item.data.color;
                    return "#333";
                })
                .labelThreshold(.06)
                .tooltipContent(function (key, value, item, graph) {
                    var result = '
' + key + '
' + '
' + Math.round(value) + '%
';
                    result += '
' + item.point.points + 'p' + '
';
                    return result;
                })
                .showLabels(true);

        d3.select("#points-percentage-graph svg")
                .datum(getPointsPercentage())
                .transition().duration(500)
                .call(chart);

        var bars = d3.select('#points-percentage-graph svg').selectAll('g.nv-label');

        if (!isInternetExplorer) {
            bars.append("foreignObject")
              .attr("width", 25)
              .attr("height", 25)
              .attr("y", function (d, i) { return -12; })
              .attr("x", function (d, i) { return -12; })
              .append("xhtml:body")
              .attr("style", "background-color: transparent")
              .attr("text-anchor", "middle")
              .html(function (d, i) {
                  return data[0].values[i].points > 0 ? "

" : null;
              });
          }

        nv.utils.windowResize(chart.update);

        return chart;
    });

    nv.addGraph(function() {
        var data = getQuestionAgreeRate();
        var chart = nv.models.discreteBarChart()
                .x(function (d) {
                    return "(" + d.short_label + ")"; //"?"; //(d["short_label"] !== undefined ? "asd" : "?");
                })
                .y(function (d) {
                    return d.value;
                })
                .margin({left: 40, top: 5, bottom: 40, right: 0})
                .staggerLabels(false)
                .tooltips(true)
                .tooltipContent(function (id, key, value, item) {
                    var result = '
' + item.point.label + '
' + '
' + Math.round(value) + '%
';
                    result += '
För: ' + item.point.plus_points + 'p
';
                    result += '
Emot: ' + item.point.minus_points + 'p
';
                    return result;
                })
                .valueFormat(function (value) {
                    return Math.round(value) + "%";
                })
                .showValues(true);

        d3.select('#question-agree-rate-graph svg')
                .datum(data)
                .transition().duration(500)
                .call(chart);

        nv.utils.windowResize(chart.update);

        var bars = d3.select('#question-agree-rate-graph svg').selectAll('g.nv-x.nv-axis g.nv-wrap.nv-axis > g > g');

        if (!isInternetExplorer) {
            bars.append("foreignObject")
              .attr("width", 25)
              .attr("height", 25)
              .attr("y", function (d, i) { return 5; })
              .attr("x", function (d, i) { return -25/2; })
              .append("xhtml:body")
              .attr("style", "background-color: transparent")
              .attr("text-anchor", "middle")
              .html(function (d, i) {
                  return "

"
              });
          }

        return chart;
    });
    }
});

// http://stackoverflow.com/questions/654112/how-do-you-detect-support-for-vml-or-svg-in-a-browser
function supportsSvg() {
    return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1");
}


text:
package org.apache.lucene.queryparser.flexible.core.nodes;

import java.util.ArrayList;
import java.util.List;

import org.apache.lucene.queryparser.flexible.messages.MessageImpl;
import org.apache.lucene.queryparser.flexible.core.QueryNodeError;
import org.apache.lucene.queryparser.flexible.core.messages.QueryParserMessages;
import org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax;

/**
 * A {@link GroupQueryNode} represents a location where the original user typed
 * real parenthesis on the query string. This class is useful for queries like:
 * a) a AND b OR c b) ( a AND b) OR c
 *
 * Parenthesis might be used to define the boolean operation precedence.
 */
public class GroupQueryNode extends QueryNodeImpl {

  /**
   * This QueryNode is used to identify parenthesis on the original query string
   */
  public GroupQueryNode(QueryNode query) {
    if (query == null) {
      throw new QueryNodeError(new MessageImpl(
          QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, "query", "null"));
    }

    allocate();
    setLeaf(false);
    add(query);
  }

  public QueryNode getChild() {
    return getChildren().get(0);
  }

  @Override
  public String toString() {
    return "<group>" + "\n" + getChild().toString() + "\n</group>";
  }

  public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) {
    if (getChild() == null)
      return "";

    return "( " + getChild().toQueryString(escapeSyntaxParser) + " )";
  }

  @Override
  public QueryNode cloneTree() throws CloneNotSupportedException {
    GroupQueryNode clone = (GroupQueryNode) super.cloneTree();

    return clone;
  }

  public void setChild(QueryNode child) {
    List<QueryNode> list = new ArrayList<QueryNode>();
    list.add(child);
    this.set(list);
  }

}


text:
<?php

namespace WebinoAppLib\Application;

/**
 * Interface AbstractApplicationInterface
 */
interface AbstractApplicationInterface
{
    /**
     * Application core configuration service name
     */
    const CORE_CONFIG = 'CoreConfig';

    /**
     * Application configuration service name
     */
    const CONFIG = 'Config';

    /**
     * Application service name
     */
    const SERVICE = 'Application';

    /**
     * Application events service name
     */
    const EVENTS = 'Events';

    /**
     * Application debugger service name
     */
    const DEBUGGER = 'Debugger';

    /**
     * Application logger service name
     */
    const LOGGER = 'Logger';

    /**
     * Application cache service name
     */
    const CACHE = 'Cache';

    /**
     * Application filesystem service name
     */
    const FILESYSTEMS = 'Files';

    /**
     * Application router service name
     */
    const ROUTER = 'Router';

    /**
     * Application mailer service name
     */
    const MAILER = 'Mailer';
}


text:
NSString *const kGPUImageRGBDilationRadiusOneFragmentShaderString = SHADER_STRING
(
 precision highp float;

 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     lowp vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     lowp vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     lowp vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);

     lowp vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);

     gl_FragColor = max(maxValue, oneStepNegativeIntensity);
 }
);

NSString *const kGPUImageRGBDilationRadiusTwoFragmentShaderString = SHADER_STRING
(
 precision highp float;

 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;
 varying vec2 twoStepsPositiveTextureCoordinate;
 varying vec2 twoStepsNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     lowp vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     lowp vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     lowp vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);
     lowp vec4 twoStepsPositiveIntensity = texture2D(inputImageTexture, twoStepsPositiveTextureCoordinate);
     lowp vec4 twoStepsNegativeIntensity = texture2D(inputImageTexture, twoStepsNegativeTextureCoordinate);

     lowp vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);
     maxValue = max(maxValue, oneStepNegativeIntensity);
     maxValue = max(maxValue, twoStepsPositiveIntensity);
     maxValue = max(maxValue, twoStepsNegativeIntensity);

     gl_FragColor = max(maxValue, twoStepsNegativeIntensity);
 }
);

NSString *const kGPUImageRGBDilationRadiusThreeFragmentShaderString = SHADER_STRING
(
 precision highp float;

 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;
 varying vec2 twoStepsPositiveTextureCoordinate;
 varying vec2 twoStepsNegativeTextureCoordinate;
 varying vec2 threeStepsPositiveTextureCoordinate;
 varying vec2 threeStepsNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     lowp vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     lowp vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     lowp vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);
     lowp vec4 twoStepsPositiveIntensity = texture2D(inputImageTexture, twoStepsPositiveTextureCoordinate);
     lowp vec4 twoStepsNegativeIntensity = texture2D(inputImageTexture, twoStepsNegativeTextureCoordinate);
     lowp vec4 threeStepsPositiveIntensity = texture2D(inputImageTexture, threeStepsPositiveTextureCoordinate);
     lowp vec4 threeStepsNegativeIntensity = texture2D(inputImageTexture, threeStepsNegativeTextureCoordinate);

     lowp vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);
     maxValue = max(maxValue, oneStepNegativeIntensity);
     maxValue = max(maxValue, twoStepsPositiveIntensity);
     maxValue = max(maxValue, twoStepsNegativeIntensity);
     maxValue = max(maxValue, threeStepsPositiveIntensity);

     gl_FragColor = max(maxValue, threeStepsNegativeIntensity);
 }
);

NSString *const kGPUImageRGBDilationRadiusFourFragmentShaderString = SHADER_STRING
(
 precision highp float;

 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;
 varying vec2 twoStepsPositiveTextureCoordinate;
 varying vec2 twoStepsNegativeTextureCoordinate;
 varying vec2 threeStepsPositiveTextureCoordinate;
 varying vec2 threeStepsNegativeTextureCoordinate;
 varying vec2 fourStepsPositiveTextureCoordinate;
 varying vec2 fourStepsNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     lowp vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     lowp vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     lowp vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);
     lowp vec4 twoStepsPositiveIntensity = texture2D(inputImageTexture, twoStepsPositiveTextureCoordinate);
     lowp vec4 twoStepsNegativeIntensity = texture2D(inputImageTexture, twoStepsNegativeTextureCoordinate);
     lowp vec4 threeStepsPositiveIntensity = texture2D(inputImageTexture, threeStepsPositiveTextureCoordinate);
     lowp vec4 threeStepsNegativeIntensity = texture2D(inputImageTexture, threeStepsNegativeTextureCoordinate);
     lowp vec4 fourStepsPositiveIntensity = texture2D(inputImageTexture, fourStepsPositiveTextureCoordinate);
     lowp vec4 fourStepsNegativeIntensity = texture2D(inputImageTexture, fourStepsNegativeTextureCoordinate);

     lowp vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);
     maxValue = max(maxValue, oneStepNegativeIntensity);
     maxValue = max(maxValue, twoStepsPositiveIntensity);
     maxValue = max(maxValue, twoStepsNegativeIntensity);
     maxValue = max(maxValue, threeStepsPositiveIntensity);
     maxValue = max(maxValue, threeStepsNegativeIntensity);
     maxValue = max(maxValue, fourStepsPositiveIntensity);

     gl_FragColor = max(maxValue, fourStepsNegativeIntensity);
 }
);
#else
NSString *const kGPUImageRGBDilationRadiusOneFragmentShaderString = SHADER_STRING
(
 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);

     vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);

     gl_FragColor = max(maxValue, oneStepNegativeIntensity);
 }
 );

NSString *const kGPUImageRGBDilationRadiusTwoFragmentShaderString = SHADER_STRING
(
 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;
 varying vec2 twoStepsPositiveTextureCoordinate;
 varying vec2 twoStepsNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);
     vec4 twoStepsPositiveIntensity = texture2D(inputImageTexture, twoStepsPositiveTextureCoordinate);
     vec4 twoStepsNegativeIntensity = texture2D(inputImageTexture, twoStepsNegativeTextureCoordinate);

     vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);
     maxValue = max(maxValue, oneStepNegativeIntensity);
     maxValue = max(maxValue, twoStepsPositiveIntensity);
     maxValue = max(maxValue, twoStepsNegativeIntensity);

     gl_FragColor = max(maxValue, twoStepsNegativeIntensity);
 }
 );

NSString *const kGPUImageRGBDilationRadiusThreeFragmentShaderString = SHADER_STRING
(
 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;
 varying vec2 twoStepsPositiveTextureCoordinate;
 varying vec2 twoStepsNegativeTextureCoordinate;
 varying vec2 threeStepsPositiveTextureCoordinate;
 varying vec2 threeStepsNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);
     vec4 twoStepsPositiveIntensity = texture2D(inputImageTexture, twoStepsPositiveTextureCoordinate);
     vec4 twoStepsNegativeIntensity = texture2D(inputImageTexture, twoStepsNegativeTextureCoordinate);
     vec4 threeStepsPositiveIntensity = texture2D(inputImageTexture, threeStepsPositiveTextureCoordinate);
     vec4 threeStepsNegativeIntensity = texture2D(inputImageTexture, threeStepsNegativeTextureCoordinate);

     vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);
     maxValue = max(maxValue, oneStepNegativeIntensity);
     maxValue = max(maxValue, twoStepsPositiveIntensity);
     maxValue = max(maxValue, twoStepsNegativeIntensity);
     maxValue = max(maxValue, threeStepsPositiveIntensity);

     gl_FragColor = max(maxValue, threeStepsNegativeIntensity);
 }
);

NSString *const kGPUImageRGBDilationRadiusFourFragmentShaderString = SHADER_STRING
(
 varying vec2 centerTextureCoordinate;
 varying vec2 oneStepPositiveTextureCoordinate;
 varying vec2 oneStepNegativeTextureCoordinate;
 varying vec2 twoStepsPositiveTextureCoordinate;
 varying vec2 twoStepsNegativeTextureCoordinate;
 varying vec2 threeStepsPositiveTextureCoordinate;
 varying vec2 threeStepsNegativeTextureCoordinate;
 varying vec2 fourStepsPositiveTextureCoordinate;
 varying vec2 fourStepsNegativeTextureCoordinate;

 uniform sampler2D inputImageTexture;

 void main()
 {
     vec4 centerIntensity = texture2D(inputImageTexture, centerTextureCoordinate);
     vec4 oneStepPositiveIntensity = texture2D(inputImageTexture, oneStepPositiveTextureCoordinate);
     vec4 oneStepNegativeIntensity = texture2D(inputImageTexture, oneStepNegativeTextureCoordinate);
     vec4 twoStepsPositiveIntensity = texture2D(inputImageTexture, twoStepsPositiveTextureCoordinate);
     vec4 twoStepsNegativeIntensity = texture2D(inputImageTexture, twoStepsNegativeTextureCoordinate);
     vec4 threeStepsPositiveIntensity = texture2D(inputImageTexture, threeStepsPositiveTextureCoordinate);
     vec4 threeStepsNegativeIntensity = texture2D(inputImageTexture, threeStepsNegativeTextureCoordinate);
     vec4 fourStepsPositiveIntensity = texture2D(inputImageTexture, fourStepsPositiveTextureCoordinate);
     vec4 fourStepsNegativeIntensity = texture2D(inputImageTexture, fourStepsNegativeTextureCoordinate);

     vec4 maxValue = max(centerIntensity, oneStepPositiveIntensity);
     maxValue = max(maxValue, oneStepNegativeIntensity);
     maxValue = max(maxValue, twoStepsPositiveIntensity);
     maxValue = max(maxValue, twoStepsNegativeIntensity);
     maxValue = max(maxValue, threeStepsPositiveIntensity);
     maxValue = max(maxValue, threeStepsNegativeIntensity);
     maxValue = max(maxValue, fourStepsPositiveIntensity);

     gl_FragColor = max(maxValue, fourStepsNegativeIntensity);
 }
);
#endif

@implementation GPUImageRGBDilationFilter

#pragma mark -
#pragma mark Initialization and teardown

- (id)initWithRadius:(NSUInteger)dilationRadius;
{
    NSString *fragmentShaderForThisRadius = nil;
    NSString *vertexShaderForThisRadius = nil;

    switch (dilationRadius)
    {
        case 0:
        case 1:
        {
            vertexShaderForThisRadius = kGPUImageDilationRadiusOneVertexShaderString;
            fragmentShaderForThisRadius = kGPUImageRGBDilationRadiusOneFragmentShaderString;
        }; break;
        case 2:
        {
            vertexShaderForThisRadius = kGPUImageDilationRadiusTwoVertexShaderString;
            fragmentShaderForThisRadius = kGPUImageRGBDilationRadiusTwoFragmentShaderString;
        }; break;
        case 3:
        {
            vertexShaderForThisRadius = kGPUImageDilationRadiusThreeVertexShaderString;
            fragmentShaderForThisRadius = kGPUImageRGBDilationRadiusThreeFragmentShaderString;
        }; break;
        case 4:
        {
            vertexShaderForThisRadius = kGPUImageDilationRadiusFourVertexShaderString;
            fragmentShaderForThisRadius = kGPUImageRGBDilationRadiusFourFragmentShaderString;
        }; break;
        default:
        {
            vertexShaderForThisRadius = kGPUImageDilationRadiusFourVertexShaderString;
            fragmentShaderForThisRadius = kGPUImageRGBDilationRadiusFourFragmentShaderString;
        }; break;
    }

    if (!(self = [super initWithFirstStageVertexShaderFromString:vertexShaderForThisRadius firstStageFragmentShaderFromString:fragmentShaderForThisRadius secondStageVertexShaderFromString:vertexShaderForThisRadius secondStageFragmentShaderFromString:fragmentShaderForThisRadius]))
    {
        return nil;
    }

    return self;
}

- (id)init;
{
    if (!(self = [self initWithRadius:1]))
    {
        return nil;
    }

    return self;
}

@end


text:
Variable::Variable() { m_SyncTimer = new Timer(); }

void Variable::SetType(const std::string& a_Type) {
  m_Type = a_Type;
  m_BasicType = TypeFromString(a_Type);
}

void Variable::SendValue() {
  if (Capture::Connect()) {
    Message msg(Msg_SetData);
    msg.m_Header.m_DataTransferHeader.m_Address =
        (ULONG64)GPdbDbg->GetHModule() + (ULONG64)m_Address;
    msg.m_Header.m_DataTransferHeader.m_Type = DataTransferHeader::Data;
    msg.m_Size = m_Size;
    GTcpServer->Send(msg, (void*)&m_Data);
  }
}

void Variable::SyncValue() {
  if (Capture::Connect()) {
    Message msg(Msg_GetData);
    ULONG64 address = (ULONG64)m_Pdb->GetHModule() + (ULONG64)m_Address;
    msg.m_Header.m_DataTransferHeader.m_Address = address;
    msg.m_Header.m_DataTransferHeader.m_Type = DataTransferHeader::Data;
    msg.m_Size = m_Size;
    m_SyncTimer->Start();
    GTcpServer->Send(msg);
  }
}

void Variable::ReceiveValue(const Message& a_Msg) {
  m_SyncTimer->Stop();
  ORBIT_LOGV(m_SyncTimer->ElapsedMillis());
  if (a_Msg.m_Size != m_Size) {
    ORBIT_LOG("Variable::ReceiveValue size mismatch");
  } else {
    if (IsBasicType()) {
      memcpy(&m_Data, a_Msg.GetData(), m_Size);
      GCoreApp->UpdateVariable(this);
    } else {
      m_RawData.resize(m_Size);
      memcpy(m_RawData.data(), a_Msg.GetData(), m_Size);
      UpdateFromRaw(m_RawData, m_Address);
    }
  }
}

void Variable::UpdateFromRaw(const std::vector<char>& a_RawData,
                             DWORD64 a_BaseAddress) {
  for (std::shared_ptr<Variable>& var : m_Children) {
    if (var->IsBasicType()) {
      DWORD64 offset = var->m_Address - a_BaseAddress;
      DWORD64 size = var->m_Size;
      if (offset + size < a_RawData.size()) {
        memcpy(&var->m_Data, a_RawData.data() + offset, size);
      }

      GCoreApp->UpdateVariable(this);
    } else {
      var->UpdateFromRaw(a_RawData, a_BaseAddress);
    }
  }
}

std::string Indent(int a_Indent) {
  std::string str;
  str.reserve(a_Indent);
  for (int i = 0; i < a_Indent; ++i) {
    str += " ";
  }
  return str;
}

int MaxOffsetWidth(DWORD64 a_Size) {
  DWORD64 size = a_Size;
  int count = 1;
  while (size) {
    size = size / 10;
    ++count;
  }
  return count;
}

void Variable::Print() {
  ORBIT_VIZ("\n\nClass hierarchy:\n");
  PrintHierarchy();

  DWORD64 address = 0;
  std::string typeName = GetTypeName();
  ORBIT_VIZ(absl::StrFormat("\n%s size(%i)\n", typeName.c_str(), m_Size));
  Print(1, address, m_Size);
}

void Variable::Print(int a_Indent, DWORD64& a_ByteCounter,
                     DWORD64 a_TotalSize) {
  std::string indent = Indent(a_Indent);
  int width = MaxOffsetWidth(a_TotalSize);

  if (a_ByteCounter != m_Address) {
    int padding = int(m_Address - a_ByteCounter);
    ORBIT_VIZ(absl::StrFormat("[%-*" PRId64 "]%s<alignment member> (size=%i)\n",
                              width, a_ByteCounter, indent.c_str(), padding));
    a_ByteCounter = m_Address;
  }

  ORBIT_VIZ(absl::StrFormat("[%-*" PRId64 "]%s%s (%s)\n", width, m_Address,
                            indent.c_str(), m_Name.c_str(),
                            GetTypeName().c_str()));

  if (!HasChildren()) {
    a_ByteCounter += m_Size;
  }

  for (std::shared_ptr<Variable> child : m_Children) {
    child->Print(a_Indent + 1, a_ByteCounter, a_TotalSize);
  }
}

void Variable::PrintHierarchy(int a_Indent) {
  if (Type* type = GetType()) {
    type->LoadDiaInfo();
    ORBIT_VIZ(absl::StrFormat("%s%s\n", Indent(a_Indent).c_str(),
                              GetTypeName().c_str()));

    for (std::shared_ptr<Variable> var : m_Children) {
      if (var->m_IsParent) {
        var->PrintHierarchy(a_Indent + 1);
      }
    }
  }
}

void Variable::PrintDetails() {
#ifdef _WIN32
  if (Type* type = GetType()) {
    DiaParser parser;
    type->LoadDiaInfo();
    std::shared_ptr<OrbitDiaSymbol> diaSymbol = type->GetDiaSymbol();
    parser.PrintTypeInDetail(diaSymbol ? diaSymbol->m_Symbol : nullptr, 0);
    ORBIT_VIZ("\n\nDetails:\n");
    ORBIT_VIZ(parser.m_Log);
  }
#endif
}

void Variable::Populate() {
  if (!m_Populated) {
    if (Type* type = GetType()) {
      type->LoadDiaInfo();
      const std::map<ULONG, Variable>& TypeMap = type->GetFullVariableMap();
      for (auto& pair : TypeMap) {
        std::shared_ptr<Variable> var = std::make_shared<Variable>(pair.second);
        var->UpdateTypeFromString();
        var->m_Address = this->m_Address + pair.first;
        m_Children.push_back(var);
      }
      m_Populated = true;
    }
  }
}

std::shared_ptr<Variable> Variable::FindVariable(
    std::shared_ptr<Variable> a_Variable, const std::string& a_Name) {
  if (a_Variable->m_Name == a_Name) {
    return a_Variable;
  }

  for (auto& var : a_Variable->m_Children) {
    if (std::shared_ptr<Variable> foundVariable = FindVariable(var, a_Name)) {
      return foundVariable;
    }
  }

  return nullptr;
}

std::shared_ptr<Variable> Variable::FindImmediateChild(
    const std::string& a_Name) {
  for (std::shared_ptr<Variable> var : m_Children) {
    if (var->m_Name == a_Name) {
      return var;
    }
  }

  return nullptr;
}

const Type* Variable::GetType() const {
#ifdef _WIN32
  return m_Pdb ? m_Pdb->GetTypePtrFromId(m_TypeIndex) : nullptr;
#else
  return nullptr;
#endif
}

Type* Variable::GetType() {
#ifdef _WIN32
  return m_Pdb ? m_Pdb->GetTypePtrFromId(m_TypeIndex) : nullptr;
#else
  return nullptr;
#endif
}

std::string Variable::GetTypeName() const {
  const Type* type = GetType();
  std::string typeName = type ? type->GetName() : "";
  return (typeName != "") ? typeName : m_Type;
}

Variable::BasicType Variable::GetBasicType() {
  // TODO: split assignation and get...
  const Type* type = GetType();
  Variable::BasicType basicType = type && type->m_Name != ""
                                      ? Variable::TypeFromString(type->m_Name)
                                      : Variable::TypeFromString(m_Type);
  m_BasicType = basicType;
  return m_BasicType;
}

Variable::BasicType Variable::TypeFromString(const std::string& a_String) {
  static std::map<std::string, BasicType> TypeMap;
  if (TypeMap.size() == 0) {
    TypeMap["int"] = Variable::Int;
    TypeMap["unsigned int"] = Variable::UInt;
    TypeMap["__int8"] = Variable::Int8;
    TypeMap["unsigned __int8"] = Variable::UInt8;
    TypeMap["__int16"] = Variable::Int16;
    TypeMap["unsigned __int16"] = Variable::UInt16;
    TypeMap["__int32"] = Variable::Int32;
    TypeMap["unsigned __int32"] = Variable::UInt32;
    TypeMap["__int64"] = Variable::Int64;
    TypeMap["unsigned __int64"] = Variable::UInt64;
    TypeMap["bool"] = Variable::Bool;
    TypeMap["char"] = Variable::Char;
    TypeMap["signed char"] = Variable::SChar;
    TypeMap["unsigned char"] = Variable::UChar;
    TypeMap["short"] = Variable::Short;
    TypeMap["unsigned short"] = Variable::UShort;
    TypeMap["long"] = Variable::Long;
    TypeMap["unsigned long"] = Variable::ULong;
    TypeMap["long long"] = Variable::LongLong;
    TypeMap["unsigned long long"] = Variable::ULongLong;
    TypeMap["enum"] = Variable::Enum;
    TypeMap["float"] = Variable::Float;
    TypeMap["double"] = Variable::Double;
    TypeMap["long double"] = Variable::LDouble;
    TypeMap["wchar_t"] = Variable::WChar;
  }

  return TypeMap[a_String];
}

void Variable::SetDouble(double a_Value) {
  switch (m_BasicType) {
    case Variable::Double:
      m_Double = a_Value;
      break;
    case Variable::Float:
      m_Float = (float)a_Value;
      break;
    default:
      break;
  }
}

ORBIT_SERIALIZE_WSTRING(Variable, 0) {
  ORBIT_NVP_VAL(0, m_Name);
  ORBIT_NVP_VAL(0, m_Type);
  ORBIT_NVP_VAL(0, m_Function);
  ORBIT_NVP_VAL(0, m_File);
  ORBIT_NVP_VAL(0, m_Line);
  ORBIT_NVP_VAL(0, m_Address);
  ORBIT_NVP_VAL(0, m_Size);
  ORBIT_NVP_VAL(0, m_TypeIndex);
  ORBIT_NVP_VAL(0, m_Children);
}


text:
<?php

declare(strict_types=1);

namespace App\Console\Command\Internal;

use App\Console\Command\CommandAbstract;
use App\Entity;
use App\Media\BatchUtilities;
use App\Message;
use Doctrine\ORM\EntityManagerInterface;
use League\Flysystem\PathPrefixer;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Messenger\MessageBus;

#[AsCommand(
    name: 'azuracast:internal:sftp-event',
    description: 'Send upcoming song feedback from the AutoDJ back to AzuraCast.',
)]
class SftpEventCommand extends CommandAbstract
{
    public function __construct(
        protected EntityManagerInterface $em,
        protected MessageBus $messageBus,
        protected LoggerInterface $logger,
        protected BatchUtilities $batchUtilities,
    ) {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $action = getenv('SFTPGO_ACTION') ?: null;
        $username = getenv('SFTPGO_ACTION_USERNAME') ?: null;
        $path = getenv('SFTPGO_ACTION_PATH') ?: null;
        $targetPath = getenv('SFTPGO_ACTION_TARGET') ?: null;
        $sshCmd = getenv('SFTPGO_ACTION_SSH_CMD') ?: null;

        $this->logger->notice(
            'SFTP file event triggered',
            [
                'action'     => $action,
                'username'   => $username,
                'path'       => $path,
                'targetPath' => $targetPath,
                'sshCmd'     => $sshCmd,
            ]
        );

        // Determine which station the username belongs to.
        $sftpUser = $this->em->getRepository(Entity\SftpUser::class)->findOneBy(
            [
                'username' => $username,
            ]
        );

        if (!$sftpUser instanceof Entity\SftpUser) {
            $this->logger->error('SFTP Username not found.', ['username' => $username]);
            return 1;
        }

        $storageLocation = $sftpUser->getStation()->getMediaStorageLocation();

        if (!$storageLocation->isLocal()) {
            $this->logger->error(sprintf('Storage location "%s" is not local.', (string)$storageLocation));
            return 1;
        }

        if (null === $path) {
            $this->logger->error('No path specified for action.');
            return 1;
        }

        return match ($action) {
            'upload' => $this->handleNewUpload($storageLocation, $path),
            'pre-delete' => $this->handleDelete($storageLocation, $path),
            'rename' => $this->handleRename($storageLocation, $path, $targetPath),
            default => 1,
        };
    }

    protected function handleNewUpload(
        Entity\StorageLocation $storageLocation,
        string $path
    ): int {
        $pathPrefixer = new PathPrefixer($storageLocation->getPath(), DIRECTORY_SEPARATOR);
        $relativePath = $pathPrefixer->stripPrefix($path);

        $this->logger->notice(
            'Processing new SFTP upload.',
            [
                'storageLocation' => (string)$storageLocation,
                'path'            => $relativePath,
            ]
        );

        $message = new Message\AddNewMediaMessage();
        $message->storage_location_id = $storageLocation->getIdRequired();
        $message->path = $relativePath;

        $this->messageBus->dispatch($message);

        return 0;
    }

    protected function handleDelete(
        Entity\StorageLocation $storageLocation,
        string $path
    ): int {
        $pathPrefixer = new PathPrefixer($storageLocation->getPath(), DIRECTORY_SEPARATOR);
        $relativePath = $pathPrefixer->stripPrefix($path);

        $this->logger->notice(
            'Processing SFTP file/folder deletion.',
            [
                'storageLocation' => (string)$storageLocation,
                'path'            => $relativePath,
            ]
        );

        $directories = [];
        $files = [];

        if (is_dir($path)) {
            $directories[] = $relativePath;
        } else {
            $files[] = $relativePath;
        }

        $fs = $storageLocation->getFilesystem();

        $this->batchUtilities->handleDelete(
            $files,
            $directories,
            $storageLocation,
            $fs
        );

        $fs->delete($relativePath);

        return 0;
    }

    protected function handleRename(
        Entity\StorageLocation $storageLocation,
        string $path,
        ?string $newPath
    ): int {
        if (null === $newPath) {
            $this->logger->error('No new path specified for rename.');
            return 1;
        }

        $pathPrefixer = new PathPrefixer($storageLocation->getPath(), DIRECTORY_SEPARATOR);

        $from = $pathPrefixer->stripPrefix($path);
        $to = $pathPrefixer->stripPrefix($newPath);

        $this->logger->notice(
            'Processing SFTP file/folder rename.',
            [
                'storageLocation' => (string)$storageLocation,
                'from'            => $from,
                'to'              => $to,
            ]
        );

        $this->batchUtilities->handleRename(
            $from,
            $to,
            $storageLocation
        );

        return 0;
    }
}


text:
/*
 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
 * Distributed under the MIT License
 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
 */

#ifndef MYGUI_TYPES_H_
#define MYGUI_TYPES_H_

#include "MyGUI_Prerequest.h"

#include <vector>
#include <map>
#include <string>

#include "MyGUI_Align.h"
#include "MyGUI_TPoint.h"
#include "MyGUI_TSize.h"
#include "MyGUI_TRect.h"
#include "MyGUI_TCoord.h"

namespace MyGUI
{

	// определяем типы
	typedef types::TPoint<int> IntPoint;
	typedef types::TPoint<float> FloatPoint;

	typedef types::TSize<int> IntSize;
	typedef types::TSize<float> FloatSize;

	typedef types::TRect<int> IntRect;
	typedef types::TRect<float> FloatRect;

	typedef types::TCoord<int> IntCoord;
	typedef types::TCoord<float> FloatCoord;

	typedef std::map<std::string, std::string> MapString;
	typedef std::vector<std::string> VectorString;
	typedef std::pair<std::string, std::string> PairString;
	typedef std::vector<PairString> VectorStringPairs;

	typedef char int8;
	typedef short int16;
	typedef int int32;
	typedef unsigned char uint8;
	typedef unsigned short uint16;
	typedef unsigned int uint32;
	typedef unsigned int uint;

	typedef unsigned int Char;

} // namespace MyGUI

#endif // MYGUI_TYPES_H_


text:
'use strict';

angular.module('app')
    .factory('rgiQuestionSrvc', ['$resource', function ($resource) {
        return $resource('/api/questions/:_id', {_id: '@id'}, {
            queryCached: {method: 'GET', isArray: true, cache: true},
            update: {method: 'PUT', isArray: false}
        });
    }]);


text:
'use strict';

function loadOptions() {
  // Use default value color = 'red' and likesColor = true.
  chrome.storage.sync.get({
    autolookup: true,
    autolookupOnMultiple: true
  }, function(items) {
    $("input[name='autolookup']").prop('checked', items.autolookup);
    $("input[name='autolookupOnMultiple']").prop('checked', items.autolookupOnMultiple)
  });
}

function saveOptions() {
  var autolookup = $("input[name='autolookup']").prop('checked');
  var autolookupOnMultiple = $("input[name='autolookupOnMultiple']").prop('checked');

  chrome.storage.sync.set({
    autolookup: autolookup,
    autolookupOnMultiple: autolookupOnMultiple
  }, function() {});
}

$('button').click(function() {
  saveOptions();
  self.close();
  return false;
});

document.addEventListener('DOMContentLoaded', loadOptions);


text:
import { useEffect, useRef, useState } from 'react';

import { c } from 'ttag';

import { HOUR } from '@proton/shared/lib/constants';
import { captureMessage } from '@proton/shared/lib/helpers/sentry';
import { getKnowledgeBaseUrl } from '@proton/shared/lib/helpers/url';

import LearnMore from '../../components/link/LearnMore';
import useApiServerTime from '../../hooks/useApiServerTime';
import TopBanner from './TopBanner';

const isOutOfSync = (serverTime: Date) => {
    const timeDifference = Math.abs(serverTime.getTime() - Date.now());
    // We should allow at least a 14-hour time difference,
    // because of potential internal clock issues when using dual-boot with Windows and a different OS
    return timeDifference > 24 * HOUR;
};

const TimeOutOfSyncTopBanner = () => {
    const [ignore, setIgnore] = useState(false);
    const serverTime = useApiServerTime();

    // We warn the user if the server time is too far off from local time.
    // We do not want the server to set arbitrary times (either past or future), to avoid signature replay issues and more.
    const showWarning = !ignore && serverTime && isOutOfSync(serverTime);

    // Log warning to have an idea of how many clients might be affected
    const onceRef = useRef(false);
    useEffect(() => {
        if (!showWarning || onceRef.current) {
            return;
        }

        onceRef.current = true;
        captureMessage('Client time difference larger than 24 hours', {
            level: 'info',
            extra: {
                serverTime: serverTime?.toString(),
                localTime: new Date().toString(),
            },
        });
    }, [showWarning]);

    if (!showWarning) {
        return null;
    }

    const learnMore = <LearnMore url={getKnowledgeBaseUrl('/device-time-warning')} />;

    return (
        <TopBanner onClose={() => setIgnore(true)} className="bg-warning">
            {c('Warning').jt`The date and time settings on your device are out of sync. ${learnMore}`}
        </TopBanner>
    );
};

export default TimeOutOfSyncTopBanner;


text:
<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="experiment_log")
 */
class Log
{
	/**
	 * @ORM\Column(type="integer")
	 * @ORM\Id
	 * @ORM\GeneratedValue(strategy="AUTO")
	 */
	protected $id;

	/**
	 * @ORM\Column(type="datetime")
	 */
	protected $timestamp;

	/**
	 * @ORM\ManyToOne(targetEntity="Player")
	 */
	protected $player;

	/**
	 * @ORM\Column(type="string", length=254)
	 */
	protected $field;

	/**
	 * @ORM\Column(type="string", length=254)
	 */
	protected $message;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set timestamp
     *
     * @param \DateTime $timestamp
     * @return ExperimentLog
     */
    public function setTimestamp($timestamp)
    {
        $this->timestamp = $timestamp;

        return $this;
    }

    /**
     * Get timestamp
     *
     * @return \DateTime
     */
    public function getTimestamp()
    {
        return $this->timestamp;
    }

    /**
     * Set message
     *
     * @param string $message
     * @return ExperimentLog
     */
    public function setMessage($message)
    {
        $this->message = $message;

        return $this;
    }

    /**
     * Get message
     *
     * @return string
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * Set session
     *
     * @param \AppBundle\Entity\Session $session
     * @return Log
     */
    public function setSession(\AppBundle\Entity\Session $session = null)
    {
        $this->session = $session;

        return $this;
    }

    /**
     * Get session
     *
     * @return \AppBundle\Entity\Session
     */
    public function getSession()
    {
        return $this->session;
    }

    /**
     * Set player
     *
     * @param \AppBundle\Entity\Player $player
     * @return Log
     */
    public function setPlayer(\AppBundle\Entity\Player $player = null)
    {
        $this->player = $player;

        return $this;
    }

    /**
     * Get player
     *
     * @return \AppBundle\Entity\Player
     */
    public function getPlayer()
    {
        return $this->player;
    }

    /**
     * Set field
     *
     * @param string $field
     * @return Log
     */
    public function setField($field)
    {
        $this->field = $field;

        return $this;
    }

    /**
     * Get field
     *
     * @return string
     */
    public function getField()
    {
        return $this->field;
    }
}


text:
SelectView = Backbone.View.extend({
    template: _.template($('#select-template').html()),
    events: {
        'click button': 'createData',
        'change select': 'reset'
    },
    initialize: function() {
        this.listenTo(itemCollections, 'add', this.addOne);
        this.listenTo(itemCollections, 'reset', this.s);
    },
    render: function() {
        this.$el.html(this.template(this.model.toJSON()));
        return this;
    },
    addOne: function(item) {
        if (this.model.get('level') != item.get("level")) {
            return;
        }
        var itemview = new ItemView({
            model: item
        });
        this.$select = $('select', this.$el);
        this.$select.append(itemview.render().el);
    },
    createData: function() {
        var len = filterData.length,
            i = 0;
        for (; i < len; i++) {
            itemCollections.add(filterData[i]);
        };
    },
    reset: function() {
        itemCollections.reset();
        this.createData();
    },
    s: function() {
        this.$select.html('');
    }
})


text:
<project name="s2dao-pager-examples" default="dist" basedir=".">
	<property name="ver" value="1.0.52-SNAPSHOT"/>

	<target name="dist">
		<mkdir dir="target"/>
		<zip zipfile="target/s2-dao-pager-examples-${ver}.zip">
			<zipfileset prefix="s2dao-pager-examples" dir=".">
				<exclude name="target/**"/>
				<exclude name="**/.settings/**"/>
				<exclude name="build.xml"/>
				<exclude name="src/main/webapp/WEB-INF/classes/**"/>
			</zipfileset>
			<zipfileset prefix="s2dao-pager-examples" dir="target">
				<include name="s2dao-pager-examples.war"/>
				<include name="s2dao-pager-examples-sources.jar"/>
			</zipfileset>
		</zip>
	</target>

</project>


text:
#ifndef DCS_META_POP_FRONT_HPP
#define DCS_META_POP_FRONT_HPP

#include <dcs/detail/config/boost.hpp>

#if DCS_DETAIL_CONFIG_BOOST_CHECK_VERSION(103000) // 1.30

#include <boost/mpl/pop_front.hpp>
//#include <boost/mpl/pop_front_fwd.hpp>

namespace dcs { namespace meta {

//using ::boost::mpl::pop_front_impl;
using ::boost::mpl::pop_front;

}} // Namespace dcs::meta

#else // DCS_DETAIL_CONFIG_BOOST_CHECK_VERSION

#include <dcs/meta/pop_front_fwd.hpp>
#include <dcs/meta/sequence_tag.hpp>

namespace dcs { namespace meta {

template <typename SequenceT>
struct pop_front: public detail::pop_front_impl< typename sequence_tag<SequenceT>::type >::template apply<SequenceT>
{
};

}} // Namespace dcs::meta

#endif // DCS_DETAIL_CONFIG_BOOST_CHECK_VERSION

#endif // DCS_META_POP_FRONT_HPP


text:
//
//  XWTabBarController.m
//  百思不得姐
//
//  Created by longxianwen on 15/9/1.
//  Copyright (c) 2015年 longxianwen. All rights reserved.
//  表格控制器

#import "XWTabBarController.h"
#import "XWEssenceController.h"
#import "XWFriendTrendsController.h"
#import "XWMeController.h"
#import "XWNewController.h"
#import "XWTabBar.h"
#import "XWNavigationController.h"

@interface XWTabBarController ()

@end

@implementation XWTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    //添加子控件
    [self addChildViews];

    //设置item属性
    [self setItems];

    //处理tabBar
    [self setupTabBar];

}

/**
 *  处理tabBar
 */
- (void)setupTabBar
{
    //用kvc的方式将系统的tabbar换成我们自定义的
    [self setValue:[[XWTabBar alloc]init] forKeyPath:@"tabBar"];

}

/**
 添加所有的子控制器
 */
- (void)addChildViews
{
    [self addChildViewVC:[[XWEssenceController alloc]init] andTitle:@"精华" andImage:@"tabBar_essence_icon" andSelectImage:@"tabBar_essence_click_icon"];

    [self addChildViewVC:[[XWNewController alloc]init] andTitle:@"新帖" andImage:@"tabBar_new_icon" andSelectImage:@"tabBar_new_click_icon"];

    [self addChildViewVC:[[XWFriendTrendsController alloc]init] andTitle:@"关注" andImage:@"tabBar_friendTrends_icon" andSelectImage:@"tabBar_friendTrends_click_icon"];

    [self addChildViewVC:[[XWMeController alloc]initWithStyle:UITableViewStyleGrouped] andTitle:@"我" andImage:@"tabBar_me_icon" andSelectImage:@"tabBar_me_click_icon"];
}

/**
 添加一个子控制器
 */
- (void)addChildViewVC:(UIViewController *) vc andTitle: (NSString *)title andImage:(NSString *)image andSelectImage:(NSString*)selectedImage
{
    XWNavigationController *nav = [[XWNavigationController alloc]initWithRootViewController:vc];

//    nav.view.backgroundColor = [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1.0];

    nav.tabBarItem.title = title;
    nav.tabBarItem.image = [UIImage imageNamed:image];
    //设置选中状态下图片
    nav.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage];
    [self addChildViewController:nav];

}

/**
 *  设置item文字属性
 */
- (void)setItems
{
    //设置文字属性
    NSMutableDictionary *attrsNomal = [NSMutableDictionary dictionary];
    //文字颜色
    attrsNomal[NSForegroundColorAttributeName] = [UIColor grayColor];
    //文字大小
    attrsNomal[NSFontAttributeName] = [UIFont systemFontOfSize:12];

    NSMutableDictionary *attrsSelected = [NSMutableDictionary dictionary];
    //文字颜色
    attrsSelected[NSForegroundColorAttributeName] = [UIColor darkGrayColor];

    //统一整体设置
    UITabBarItem *item = [UITabBarItem appearance]; //拿到底部的tabBarItem
    [item setTitleTextAttributes:attrsNomal forState:UIControlStateNormal];
    [item setTitleTextAttributes:attrsSelected forState:UIControlStateSelected];
}

@end


text:
'use strict';

/* Controllers */
var snackMysticApp = angular.module('snackMysticApp', []);

snackMysticApp.controller('SnacksCaveCtrl', function SnacksCaveCtrl($scope) {
   $scope.snacks = [
     {'name': 'Cheetos',
      'love': 1},
     {'name': 'Sour Gummy Worms',
      'love': 1},
     {'name': 'Veggie Pizza',
      'love': 0}
   ];

  $scope.orderProp = 'name';
});


text:
const operations					= ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'];
const getOperationObject	= (oapi, ep) => oapi.paths[ep.path][ep.operation];
const getIdFromEndpoint 	= ep => `${ep.operation} ${ep.path}`;

export function toolsFromOpenapi(oapi) {
	return getEndpoints(oapi)
		.map(endpoint => endpointsToTool(
			endpoint,
			getOperationObject(oapi, endpoint),
		));
}

export function specNameFromOpenapi(oapi) {
	return (oapi.info && oapi.info.title)
		? oapi.info.title
		: oapi.host;
}

export function specUUIDFromOpenapi(oapi) {
	return (oapi.info && oapi.info['x-tb-uuid'])
		? oapi.info['x-tb-uuid']
		: null;
}

export function toolNameFromEndpoint(ep) {
	const parts = ep.path
		.replace(/^\//, '')
		.replace(/[{}]/g, '')
		.split(/[\/_-]/)
		.map(part => capitalize(part));
	const name = parts.join(' ');
	return (name === '')
		? capitalize(ep.operation)
		: `${capitalize(ep.operation)} ${name}`;
}

export function generateLabelFromValue(value) {
	return value.split(/[ _-]/).map(part => capitalize(part)).join(' ');
}

function getEndpoints(oapi) {
	return Object.keys(oapi.paths).reduce((acc, path) => {
		Object.keys(oapi.paths[path])
			.forEach(operation => {
				(operations.includes(operation.toLowerCase()))
					&& acc.push({path: path, operation: operation});
			});
		return acc;
	}, []);
}

function endpointsToTool(endpoint, opr) {
	const { path: path, operation: operation } = endpoint;
	const name = opr['x-tb-name']
		? opr['x-tb-name']
		: toolNameFromEndpoint(endpoint);
	const id = opr.operationId
		? opr.operationId
		: getIdFromEndpoint(endpoint);
	const ret = {
		name			: name,
		id				: id,
		spec_path	: [path, operation]
	};

	// pass in color if defined
	if (opr['x-tb-color']) {
		ret['color'] = opr['x-tb-color'];
	}

	return ret;
}

function capitalize(str) {
	str = str.toLowerCase();
	return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
}


text:
package quark_ffi_signatures_md;

public class generics_pkg_Foo_quark_Object__get_Method extends quark.reflect.Method implements io.datawire.quark.runtime.QObject {
    public generics_pkg_Foo_quark_Object__get_Method() {
        super("quark.Object", "get", new java.util.ArrayList(java.util.Arrays.asList(new Object[]{})));
    }
    public Object invoke(Object object, java.util.ArrayList<Object> args) {
        generics.pkg.Foo<Object> obj = (generics.pkg.Foo<Object>) (object);
        return (obj).get();
    }
    public String _getClass() {
        return (String) (null);
    }
    public Object _getField(String name) {
        return null;
    }
    public void _setField(String name, Object value) {}
}


text:
package org.gobiiproject.gobidomain.services.impl;

import org.gobiiproject.gobidomain.GobiiDomainException;
import org.gobiiproject.gobidomain.services.LoaderInstructionFilesService;
import org.gobiiproject.gobiidtomapping.DtoMapLoaderInstructions;
import org.gobiiproject.gobiimodel.config.GobiiException;
import org.gobiiproject.gobiimodel.headerlesscontainer.LoaderInstructionFilesDTO;
import org.gobiiproject.gobiimodel.types.GobiiProcessType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Phil on 4/12/2016.
 */
public class LoaderInstructionFileServiceImpl implements LoaderInstructionFilesService {

    private Logger LOGGER = LoggerFactory.getLogger(LoaderInstructionFileServiceImpl.class);

    @Autowired
    private DtoMapLoaderInstructions dtoMapLoaderInstructions = null;

    @Override
    public LoaderInstructionFilesDTO getInstruction(String cropType, String getInstructions) throws GobiiDomainException {

        LoaderInstructionFilesDTO returnVal;

        try {
            returnVal = dtoMapLoaderInstructions.getInstruction(cropType, getInstructions);
            returnVal.getAllowedProcessTypes().add(GobiiProcessType.READ);

        } catch (Exception e) {

            LOGGER.error("Gobii service error", e);
            throw new GobiiDomainException(e);

        }

        return returnVal;
    }

    @Override
    public LoaderInstructionFilesDTO createInstruction(String cropType, LoaderInstructionFilesDTO LoaderInstructionFilesDTO)
            throws GobiiDomainException {
        LoaderInstructionFilesDTO returnVal;

        returnVal = dtoMapLoaderInstructions.createInstruction(cropType, LoaderInstructionFilesDTO);

        // When we have roles and permissions, this will be set programmatically
        returnVal.getAllowedProcessTypes().add(GobiiProcessType.READ);
        returnVal.getAllowedProcessTypes().add(GobiiProcessType.UPDATE);

        return returnVal;
    }
} // LoaderInstructionFileServiceImpl


text:
<?php

	require_once('input.class.php');
	require_once(plugin_dir_path( __FILE__ ).'../resize.class.php');
	require_once(plugin_dir_path( __FILE__ ).'../AJAX.class.php');

	abstract class ImageManipulation extends input{

		protected $canvas_width;
		protected $canvas_height;
		protected $canvas_bg_color = "FFFFFF";
		protected $link_title = "Click to upload and configure your image";
		protected $input_file_name = 'uploadedimage_';

		protected $wp_upload_dir;

		public function __construct($name,$args){
			if($args){
				foreach ($args as $key => $value) {
					switch ($key) {
						case 'canvas_width':
						case 'canvas_height':
						case 'canvas_bg_color':
						case 'context':
							$this->$key = $value;
							break;
						case 'link_text':
						case 'title':
						case 'link_title':
							$this->link_title = $args[$key];
							break;
					}
					unset($args[$key]);
				}
			}
			$this->input_file_name .= $name;
			$this->wp_upload_dir = wp_upload_dir();
			parent::__construct($name,$args);

			add_action('wp_ajax_image_manipulation_'.$this->name, array(&$this,'image_manipulation'));
			add_action('wp_ajax_remove_image_'.$this->name,array('AJAX','remove_image'));
			add_action('admin_enqueue_scripts',array(&$this,'enqueue_thickbox'));
		}

		public function enqueue_thickbox(){
			wp_enqueue_script('thickbox');
			wp_enqueue_style('thickbox');
		}

		public function generate_html(){
			if($this->canvas_width && $this->canvas_height){
				$upload_url = $this->wp_upload_dir['baseurl'];
				$img_src_display_none = $this->get_saved_value() ? 'src="'.$upload_url."/".$this->get_saved_value().'"' : 'style = "display:none"';
			?>

<a id="image_manipulation_upload_link_<?php echo $this->name;?>" class="thickbox" href="<?php echo admin_url('admin-ajax.php'); ?>?action=image_manipulation_<?php echo $this->name;?>&step=1&TB_iframe=true&width=720&height=450" title="<?php echo $this->link_title;?>"><?php echo $this->link_title;?>

				<img style = "max-width:<?php if($this->context == 'normal' || $this->context == 'advanced'){echo 500;}else if($this->context == 'side'){echo 256;}else{echo 350;}?>px" class = "manipulated_image <?php echo $this->name;?>_manipulated_image" <?php echo $img_src_display_none;?>/>
				<?php if($this->get_saved_value()){?>

<a id = "image_manipulation_remove_image_link_<?php echo $this->name;?>" href = "#" onclick = "remove_<?php echo $this->name;?>_image()" title = "Remove">Remove

				<?php } ?>
				<input type = "hidden" name = "<?php echo $this->name;?>" id = "<?php echo $this->name;?>_value_hidden_field" value = "<?php echo $this->get_saved_value();?>"/>
				<?php
			}else{
				?>
A canvas height and width must be set in order to include an image manipulation field
<?php
			}
		}

		public function image_manipulation(){
			$css = str_replace(" ","%20",plugins_url( 'imagemanipulation.css' , __FILE__ ));
			$js = str_replace(" ","%20",plugins_url( 'imagemanipulation.js' , __FILE__ ));
			?>

			<link rel = "stylesheet" type = "text/css" href = "<?php echo $css;?>"></style>
			<?php
			$function = "image_manipulation_step_".$_GET['step'];
			$this->$function();
		}

		protected function image_manipulation_step_1(){
			?>
			<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo admin_url('admin-ajax.php'); ?>?action=image_manipulation_<?php echo $this->name;?>&step=2">
				Choose an image from your computer (.gif | .jpeg |.png)
<input type="file" id="upload" name="<?php echo $this->input_file_name;?>" />
				<?php wp_nonce_field('image_manipulation') ?>

<input type="submit" class = "button-primary" value="<?php esc_attr_e('Upload'); ?>" />

			</form>
			<?php
			die();
		}

		abstract function image_manipulation_step_2();
		abstract function image_manipulation_step_3();

		protected function upload_image(){
			require_once(plugin_dir_path( __FILE__ ).'../fileuploader.class.php');
			$file = $_FILES[$this->input_file_name];
			$result = Fileuploader::upload_file($file,$image_only_upload = true);
		}

		protected function valid_image_or_die($file){
			if(!getimagesize($file)){
				echo "
Your upload was not a valid image file. Please try again";
				$this->image_manipulation_step_1();
				die();
			}
		}

		protected function include_jquery_ui(){
			?>

			<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css">

			<link rel="stylesheet" href="http://jcrop-cdn.tapmodo.com/latest/css/jquery.Jcrop.css" type="text/css" />
			<?php
		}

		protected function get_filename($filename){
			for($i = strlen($filename)-1; $i>=0; $i--){
				if($filename[$i] == "."){
					return substr($filename,0,$i - strlen($filename));
				}
			}
		}

		protected function include_close_window_js($filename){
			?>

			<?php
		}

		protected function save_new_image($image,$destination){
			ob_start();
			imagejpeg($image);
			$i = ob_get_contents();
			$fp = fopen($destination,'w');
			fwrite($fp,$i);
			fclose($fp);
			ob_end_clean();
		}

	}

?>


text:
interface Object {
	entries(obj: Object): Array<Array<any>>;
	values(obj: Object): Array<any>;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
    <Button
        android:id="@+id/fadein"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Fade In"/>
    <Button
        android:id="@+id/fadeout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Fade Out"/>
    <Button
        android:id="@+id/withoutxml"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="With out XML"/>
	<LinearLayout
	    android:layout_width="fill_parent"
	    android:layout_height="fill_parent"
	    android:orientation="vertical"
	    android:gravity="center">

	    <ImageView
	        android:id="@+id/image"
	        android:layout_width="fill_parent"
	        android:layout_height="fill_parent"
	        android:src="@drawable/ic_launcher" />

	</LinearLayout>

</LinearLayout>


text:
import sys

from PyQt5.QtWidgets import QDialog, QApplication
from PyQt5.QtWidgets import QFileDialog

from pyduct import calculate
from pyduct_ui import Ui_Dialog

class main_window(QDialog):
    def __init__(self):
        super(main_window, self).__init__()
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        self.assign_widgets()
        self.show()

    # Setup Callbacks for all buttons or other clickable devices
    def assign_widgets(self):
        self.ui.pushButton.clicked.connect(self.getFileName)
        self.ui.buttonBox.accepted.connect(self.runPyduct)
        self.ui.buttonBox.rejected.connect(self.ExitApp)

    def getFileName(self):  # Get file from user
        filename = QFileDialog.getOpenFileName()
        self.ui.lineEdit.setText(str(filename[0]))

    def runPyduct(self):
        print('Running...')  # Says the program is running
        calculate(str(self.ui.lineEdit.text()))  # Runs pyduct.py and gets all the values, then prints them

    def ExitApp(self):
        app.exit()

if __name__ == "__main__":
    app = QApplication.instance()
    if not app:
        app = QApplication(sys.argv)
        app.aboutToQuit.connect(app.deleteLater)
    main_win = main_window()
    app.exec_()