text:
package com.example.nick.countrypedia.model.restprovider;

import android.graphics.Bitmap;
import android.os.Handler;

import com.example.nick.countrypedia.view.item.Country;

public interface Notify {
    void sendNotify(Country country, Handler handler);
}


text:
package com.whitelaning.whitefragment.thirdparty.magicindicator;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;

import com.whitelaning.whitefragment.thirdparty.magicindicator.abs.IPagerNavigator;

/**
 * 整个框架的入口,核心
 * 博客: http://hackware.lucode.net
 * Created by hackware on 2016/6/26.
 */
public class MagicIndicator extends FrameLayout {
    private static final String TAG = "MagicIndicator";
    private IPagerNavigator mNavigator;

    public MagicIndicator(Context context) {
        super(context);
    }

    public MagicIndicator(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        Log.d(TAG, "onPageScrolled() position = " + position + ", positionOffset = " + positionOffset + ", positionOffsetPixels = " + positionOffsetPixels);
        if (mNavigator != null) {
            mNavigator.onPageScrolled(position, positionOffset, positionOffsetPixels);
        }
    }

    public void onPageSelected(int position) {
        Log.d(TAG, "onPageSelected() position = " + position);
        if (mNavigator != null) {
            mNavigator.onPageSelected(position);
        }
    }

    public void onPageScrollStateChanged(int state) {
        Log.d(TAG, "onPageScrollStateChanged() state = " + state);
        if (mNavigator != null) {
            mNavigator.onPageScrollStateChanged(state);
        }
    }

    public IPagerNavigator getNavigator() {
        return mNavigator;
    }

    public void setNavigator(IPagerNavigator navigator) {
        if (mNavigator == navigator) {
            return;
        }
        if (mNavigator != null) {
            mNavigator.onDetachFromMagicIndicator();
        }
        mNavigator = navigator;
        removeAllViews();
        if (mNavigator instanceof View) {
            LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            addView((View) mNavigator, lp);
            mNavigator.onAttachToMagicIndicator();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using Microsoft.Azure.Commands.Common.Authentication;

namespace Microsoft.WindowsAzure.Commands.Test.Utilities.Common
{
    public class FakeAccessToken : IAccessToken
    {
        public void AuthorizeRequest(Action<string, string> authTokenSetter)
        {
            authTokenSetter("Bearer", AccessToken);
        }

        public string AccessToken { get; set; }

        public string UserId { get; set; }

        public string LoginType { get; set; }

        public string TenantId { get; set; }
    }
}


text:
#include "com/centreon/broker/neb/statistics/services.hh"
#include <sstream>
#include "com/centreon/broker/config/applier/state.hh"
#include "com/centreon/broker/neb/internal.hh"
#include "com/centreon/engine/common.hh"
#include "com/centreon/engine/globals.hh"

using namespace com::centreon::broker;
using namespace com::centreon::broker::neb;
using namespace com::centreon::broker::neb::statistics;

/**
 *  Default constructor.
 */
services::services() : plugin("services") {}

/**
 *  Copy constructor.
 *
 *  @param[in] right Object to copy.
 */
services::services(services const& right) : plugin(right) {}

/**
 *  Destructor.
 */
services::~services() {}

/**
 *  Assignment operator.
 *
 *  @param[in] right Object to copy.
 *
 *  @return This object.
 */
services& services::operator=(services const& right) {
  plugin::operator=(right);
  return (*this);
}

/**
 *  Get statistics.
 *
 *  @param[out] output   The output return by the plugin.
 *  @param[out] perfdata The perf data return by the plugin.
 */
void services::run(std::string& output, std::string& perfdata) {
  // Count services ok / warning / unknown / critical.
  uint32_t total[4] = {0, 0, 0, 0};
  for (service_map::const_iterator
           it{com::centreon::engine::service::services.begin()},
       end{com::centreon::engine::service::services.end()};
       it != end; ++it)
    ++total[it->second->get_current_state()];

  uint32_t not_ok{total[com::centreon::engine::service::state_warning] +
                  total[com::centreon::engine::service::state_critical] +
                  total[com::centreon::engine::service::state_unknown]};

  // Output.
  std::ostringstream oss;
  oss << "Engine " << config::applier::state::instance().poller_name()
      << " has " << total[com::centreon::engine::service::state_ok]
      << " services on status OK and " << not_ok
      << " services on non-OK status";
  output = oss.str();

  // Perfdata.
  oss.str("");
  oss << "ok=" << total[com::centreon::engine::service::state_ok]
      << " warning=" << total[com::centreon::engine::service::state_warning]
      << " critical=" << total[com::centreon::engine::service::state_critical]
      << " unknown=" << total[com::centreon::engine::service::state_unknown];
  perfdata = oss.str();
}


text:
/**
 * 本地存储实现,优先本地存储localStorage,如果浏览器不支持,优雅降级为cookie
 * fork from https://github.com/marcuswestin/store.js
 */

'use strict';

// Store.js
var store = {},
	win = window,
	doc = win.document,
	localStorageName = 'localStorage',
	scriptTag = 'script',
	storage;

store.disabled = false;
store.version = '1.3.17';
store.set = function (key, value) {
};
store.get = function (key, defaultVal) {
};
store.has = function (key) {
	return store.get(key) !== undefined
};
store.remove = function (key) {
};
store.clear = function () {
};
store.transact = function (key, defaultVal, transactionFn) {
	if (transactionFn == null) {
		transactionFn = defaultVal;
		defaultVal = null;
	}
	if (defaultVal == null) {
		defaultVal = {};
	}
	var val = store.get(key, defaultVal);
	transactionFn(val);
	store.set(key, val);
};
store.getAll = function () {
};
store.forEach = function () {
};

store.serialize = function (value) {
	return JSON.stringify(value)
};
store.deserialize = function (value) {
	if (typeof value != 'string') {
		return undefined;
	}
	try {
		return JSON.parse(value);
	}
	catch (e) {
		return value || undefined;
	}
};

// Functions to encapsulate questionable FireFox 3.6.13 behavior
// when about.config::dom.storage.enabled === false
// See https://github.com/marcuswestin/store.js/issues#issue/13
function isLocalStorageNameSupported() {
	try {
		return (localStorageName in win && win[localStorageName]);
	}
	catch (err) {
		return false;
	}
}

//if support localStorage
if (isLocalStorageNameSupported()) {
	storage = win[localStorageName];
	store.set = function (key, val) {
		if (val === undefined) {
			return store.remove(key);
		}
		storage.setItem(key, store.serialize(val));
		return val;
	};
	store.get = function (key, defaultVal) {
		var val = store.deserialize(storage.getItem(key));
		return (val === undefined ? defaultVal : val);
	};
	store.remove = function (key) {
		storage.removeItem(key);
	};
	store.clear = function () {
		storage.clear();
	};
	store.getAll = function () {
		var ret = {};
		store.forEach(function (key, val) {
			ret[key] = val;
		});
		return ret;
	};
	store.forEach = function (callback) {
		for (var i = 0; i < storage.length; i++) {
			var key = storage.key(i);
			callback(key, store.get(key));
		}
	};
} else {
	var cookie = require('cookie');

	store.set = function (key, val) {
		if (val === undefined) {
			return store.remove(key);
		}
		//cookie support serialize already
		cookie.set(key, val);
		return val;
	};
	store.get = function (key, defaultVal) {
		var val = cookie.get(key);
		return (val === undefined ? defaultVal : val);
	};
	store.remove = function (key) {
		cookie.remove(key);
	};
	store.clear = function () {
		storage.clear();
	};
}

try {
	var testKey = '__storejs__';
	store.set(testKey, testKey);
	if (store.get(testKey) != testKey) {
		store.disabled = true;
	}
	store.remove(testKey);
} catch (e) {
	store.disabled = true;
}

store.enabled = !store.disabled;

module.exports = store;


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>SessionCallback (HornetQ Server 2.4.0.Final API)</title>
<meta name="date" content="2013-12-16">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.hornetq.spi.core.protocol

Interface SessionCallback

<map id="APIVIZ" name="APIVIZ">
<area shape="rect" id="node1" href="SessionCallback.html" title="«interface» SessionCallback" alt="" coords="5,5,123,45"/>
</map>

public interface SessionCallback

A SessionCallback

Author:

Tim Fox

Method Summary

Methods

Modifier and Type
Method and Description

void
addReadyListener(ReadyListener listener)

void
closed()

void
disconnect(long consumerId,
          String queueName)

void
removeReadyListener(ReadyListener listener)

int
sendLargeMessage(org.hornetq.core.server.ServerMessage message,
                long consumerID,
                long bodySize,
                int deliveryCount)

int
sendLargeMessageContinuation(long consumerID,
                            byte[] body,
                            boolean continues,
                            boolean requiresResponse)

int
sendMessage(org.hornetq.core.server.ServerMessage message,
           long consumerID,
           int deliveryCount)

void
sendProducerCreditsFailMessage(int credits,
                              SimpleString address)

void
sendProducerCreditsMessage(int credits,
                          SimpleString address)

Method Detail

sendProducerCreditsMessage

void sendProducerCreditsMessage(int credits,
                              SimpleString address)

sendProducerCreditsFailMessage

void sendProducerCreditsFailMessage(int credits,
                                  SimpleString address)

sendMessage

int sendMessage(org.hornetq.core.server.ServerMessage message,
              long consumerID,
              int deliveryCount)

sendLargeMessage

int sendLargeMessage(org.hornetq.core.server.ServerMessage message,
                   long consumerID,
                   long bodySize,
                   int deliveryCount)

sendLargeMessageContinuation

int sendLargeMessageContinuation(long consumerID,
                               byte[] body,
                               boolean continues,
                               boolean requiresResponse)

closed

void closed()

addReadyListener

void addReadyListener(ReadyListener listener)

removeReadyListener

void removeReadyListener(ReadyListener listener)

disconnect

void disconnect(long consumerId,
              String queueName)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.


text:
cask :v1 => 'goofy' do
  version :latest
  sha256 :no_check

  # amazonaws.com is the official download host per the vendor homepage
  url 'https://goofyapp.s3.amazonaws.com/Goofy.app.zip'
  name 'Goofy'
  homepage 'http://www.goofyapp.com/'
  license :gratis

  app 'Goofy.app'
end


text:
/// <reference path="../../../typings/main.d.ts" />

import { IMinemeldStatusService, IMinemeldStatus, IMinemeldStatusNode } from  '../../app/services/status';
import { IThrottleService, IThrottled } from '../../app/services/throttle';
import { IMineMeldRunningConfigStatusService, IMineMeldRunningConfigStatus, IMinemeldResolvedConfigNode } from '../../app/services/runningconfigstatus';
import { IMinemeldPrototypeService } from '../../app/services/prototype';
import { IMineMeldCurrentUserService } from '../services/currentuser';

declare var he: any;

interface INodeStatus {
    status: IMinemeldStatusNode;
    nodeType?: string;
}

export class NodesController {
    mmstatus: IMinemeldStatusService;
    MineMeldRunningConfigStatusService: IMineMeldRunningConfigStatusService;
    MinemeldPrototypeService: IMinemeldPrototypeService;
    MineMeldCurrentUserService: IMineMeldCurrentUserService;
    toastr: any;
    $interval: angular.IIntervalService;
    $scope: angular.IScope;
    $compile: angular.ICompileService;
    $state: angular.ui.IStateService;
    $q: angular.IQService;
    DTColumnBuilder: any;
    DTOptionsBuilder: any;

    mmStatusListener: () => void;
    mmRunningConfigListener: () => void;
    mmThrottledUpdate: IThrottled;

    dtNodes: any = {};
    dtColumns: any[];
    dtOptions: any;

    /* @ngInject */
    constructor(toastr: any,
        $interval: angular.IIntervalService,
        MinemeldStatusService: IMinemeldStatusService,
        MineMeldRunningConfigStatusService: IMineMeldRunningConfigStatusService,
        MinemeldPrototypeService: IMinemeldPrototypeService,
        MineMeldCurrentUserService: IMineMeldCurrentUserService,
        $scope: angular.IScope,
        DTOptionsBuilder: any,
        DTColumnBuilder: any,
        $compile: angular.ICompileService,
        $state: angular.ui.IStateService,
        $q: angular.IQService,
        $rootScope: angular.IRootScopeService,
        $timeout: angular.ITimeoutService,
        ThrottleService: IThrottleService) {
        this.toastr = toastr;
        this.mmstatus = MinemeldStatusService;
        this.MineMeldRunningConfigStatusService = MineMeldRunningConfigStatusService;
        this.MinemeldPrototypeService = MinemeldPrototypeService;
        this.MineMeldCurrentUserService = MineMeldCurrentUserService;
        this.$interval = $interval;
        this.$scope = $scope;
        this.DTColumnBuilder = DTColumnBuilder;
        this.DTOptionsBuilder = DTOptionsBuilder;
        this.$compile = $compile;
        this.$state = $state;
        this.$q = $q;

        this.setupNodesTable();

        this.mmThrottledUpdate = ThrottleService.throttle(this.updateNodesTable.bind(this), 5000);
        this.mmStatusListener = $rootScope.$on(
            'mm-status-changed',
            this.mmThrottledUpdate
        );
        this.mmRunningConfigListener = $rootScope.$on(
            'mm-running-config-changed',
            this.mmThrottledUpdate
        );

        this.$scope.$on('$destroy', this.destroy.bind(this));
    }

    public go(newstate: string) {
        this.$state.transitionTo('nodedetail', { nodename: newstate });
    }

    private updateNodesTable() {
        var vm: any = this;
        var tbody: JQuery;

        if (vm.dtNodes && vm.dtNodes.reloadData) {
            tbody = angular.element('#nodesTable > tbody').children().unbind();

            vm.dtNodes.reloadData(
                () => { tbody.remove(); tbody = null; },
                false
            );
        }
    }

    private setupNodesTable() {
        var vm: NodesController = this;

        this.dtOptions = this.DTOptionsBuilder.fromFnPromise(() => {
            return vm.MineMeldRunningConfigStatusService.getStatus().then((rconfig: IMineMeldRunningConfigStatus) => {
                return vm.mmstatus.getStatus().then((value: IMinemeldStatus) => {
                    var nodes: INodeStatus[] = [];

                    angular.forEach(value, (x: IMinemeldStatusNode) => {
                        var nt: string;
                        var rcnode: IMinemeldResolvedConfigNode;

                        rcnode = rconfig.nodes[x.name];

                        // running config doesn't contain the node (?) => set nodeType to LOADING
                        if (typeof rcnode === 'undefined') {
                            console.log('no proto ' + x.name + ' ' + rcnode);
                            nodes.push({
                                status: x,
                                nodeType: 'loading'
                            });
                            return;
                        }

                        nt = 'unknown';
                        if (rcnode.resolvedPrototype && rcnode.resolvedPrototype.node_type) {
                            nt = rcnode.resolvedPrototype.node_type;
                        }
                        nodes.push({ status: x, nodeType: nt });
                    });

                    return nodes;
                });
            });
        })
        .withBootstrap()
        .withPaginationType('simple_numbers')
        .withOption('order', [[2, 'asc'], [1, 'asc']])
        .withOption('aaSorting', [])
        .withOption('stateSave', true)
        .withOption('aaSortingFixed', [])
        .withOption('bDeferRender', true)
        .withOption('redraw', true)
        .withOption('lengthMenu', [[50, -1], [50, 'All']])
        .withOption('pageLength', -1)
        .withOption('createdRow', function(row: HTMLScriptElement, data: INodeStatus) {
            var c: string;
            var fc: HTMLElement;
            var j: number;

            row.className += ' nodes-table-row';

            if (data.nodeType === 'miner') {
                c = 'nodes-dt-header-miner';
            } else if (data.nodeType === 'output') {
                c = 'nodes-dt-header-output';
            } else if (data.nodeType === 'processor') {
                c = 'nodes-dt-header-processor';
            } else {
                c = 'nodes-dt-header-default';
            }

            fc = <HTMLElement>(row.childNodes[0]);
            fc.className += ' ' + c;

            for (var j = 0; j < row.childNodes.length; j++) {
                fc = <HTMLElement>(row.childNodes[j]);
                fc.setAttribute('ng-click', 'nodes.go("' + data.status.name + '")');
            }

            vm.$compile(angular.element(row).contents())(vm.$scope);
        })
        .withLanguage({
            'oPaginate': {
                'sNext': '>',
                'sPrevious': '<'
            }
        })
        ;

        this.dtColumns = [
            this.DTColumnBuilder.newColumn(null).withTitle('').renderWith(function(data: any, type: any, full: any) {
                return '';
            }).withOption('width', '5px').notSortable(),
            this.DTColumnBuilder.newColumn(null).withClass('nodes-dt-name').withTitle('NAME').renderWith(function(data: any, type: any, full: INodeStatus) {
                var result: string = he.encode(full.status.name, {strict: true});

                if (full.status.sub_state && full.status.sub_state === 'ERROR') {
                    result = result + ' ';
                }

                return result;
            }),
            this.DTColumnBuilder.newColumn(null).withTitle('TYPE').renderWith(function(data: any, type: any, full: INodeStatus) {
                var c: string;
                var v: string;

                if (full.nodeType === 'miner') {
                    c = 'nodes-label-miner';
                    v = 'MINER';
                } else if (full.nodeType === 'output') {
                    c = 'nodes-label-output';
                    v = 'OUTPUT';
                } else if (full.nodeType === 'processor') {
                    c = 'nodes-label-processor';
                    v = 'PROCESSOR';
                } else if (full.nodeType === 'loading') {
                    c = 'nodes-label-loading';
                    v = 'UNKNOWN';
                } else {
                    c = 'nodes-label-default';
                    v = 'UNKNOWN';
                }

                return '' + v + '';
            }),
            this.DTColumnBuilder.newColumn(null).withTitle('STATE').renderWith(function(data: any, type: any, full: INodeStatus) {
                var m: string = vm.mmstatus.NODE_STATES[full.status.state];
                var c: string;

                c = 'label-primary';
                if (m === 'STARTED') {
                    c = 'label-success';
                } else if (m === 'INIT') {
                    c = 'label-warning';
                }

                return '' + m + '';
            }),
            this.DTColumnBuilder.newColumn(null).withTitle('INDICATORS').renderWith(function(data: any, type: any, full: INodeStatus) {
                if (typeof full.status.length === 'undefined' || full.status.length === null) {
                    return '';
                }

                return '' + full.status.length;
            }),
            this.DTColumnBuilder.newColumn(null).withTitle('ADD/REM/AO').notSortable().renderWith(function(data: any, type: any, full: INodeStatus) {
                var stats: string[] = ['
'];
                var s: number;

                data = full.status.statistics;

                s = 0;
                if (data.added) {
                    s = data.added;
                }
                stats.push('
ADDED: ' + s + '
');

                s  = 0;
                if (data.aged_out) {
                    s = data.aged_out;
                    stats.push('
AGED OUT: ' + s + '
');
                } else {
                    if (data.removed) {
                        s = data.removed;
                    }
                    stats.push('
REMOVED: ' + s + '
');
                }

                stats.push('
');

                return stats.join('');
            }),
            this.DTColumnBuilder.newColumn(null).withTitle('UPDATES').notSortable().renderWith(function(data: any, type: any, full: INodeStatus) {
                var stats: string[] = ['
'];
                var s: number;

                data = full.status.statistics;

                s = 0;
                if (data['update.rx']) {
                    s = data['update.rx'];
                }
                stats.push('
RX: ' + s + '
');

                s = 0;
                if (data['update.processed']) {
                    s = data['update.processed'];
                }
                stats.push('
PROCESSED: ' + s + '
');

                s = 0;
                if  (data['update.tx']) {
                    s = data['update.tx'];
                }
                stats.push('
TX: ' + s + '
');

                stats.push('
');

                return stats.join('');
            }),
            this.DTColumnBuilder.newColumn(null).withTitle('WITHDRAWS').notSortable().renderWith(function(data: any, type: any, full: INodeStatus) {
                var stats: string[] = ['
'];
                var s: number;

                data = full.status.statistics;

                s = 0;
                if (data['withdraw.rx']) {
                    s = data['withdraw.rx'];
                }
                stats.push('
RX: ' + s + '
');

                s = 0;
                if (data['withdraw.processed']) {
                    s = data['withdraw.processed'];
                }
                stats.push('
PROCESSED: '  + s + '
');

                s = 0;
                if (data['withdraw.tx']) {
                    s = data['withdraw.tx'];
                }
                stats.push('
TX: ' + s + '
');

                stats.push('
');

                return stats.join('');
            }),
            this.DTColumnBuilder.newColumn(null).withTitle('').notSortable().renderWith(function(data: any, type: any, full: INodeStatus) {
                return '';
            }).withOption('width', '30px')
        ];
    }

    private destroy() {
        if (this.mmStatusListener) {
            this.mmStatusListener();
        }
        if (this.mmRunningConfigListener) {
            this.mmRunningConfigListener();
        }
        if (this.mmThrottledUpdate) {
            this.mmThrottledUpdate.cancel();
        }
    }
}


text:
package org.dcm4chee.dashboard.ui.report.display;

import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.imageio.ImageIO;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.IRequestTarget;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.protocol.http.WebResponse;
import org.dcm4chee.dashboard.model.ReportModel;
import org.dcm4chee.dashboard.ui.common.JFreeChartImage;
import org.dcm4chee.dashboard.ui.config.delegate.DashboardCfgDelegate;
import org.dcm4chee.dashboard.ui.util.DatabaseUtils;
import org.dcm4chee.icons.ImageManager;
import org.dcm4chee.icons.behaviours.ImageSizeBehaviour;
import org.dcm4chee.web.common.behaviours.TooltipBehaviour;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.AxisState;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryTick;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.CategoryStepRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.text.TextBlock;
import org.jfree.ui.RectangleEdge;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Robert David <robert.david@agfa.com>
 * @version $Revision$ $Date$
 * @since 18.11.2009
 */
public class DisplayReportDiagramPanel extends Panel {

    private static final long serialVersionUID = 1L;

    private static Logger log = LoggerFactory.getLogger(DisplayReportDiagramPanel.class);

    private ReportModel report;
    private Map<String, String> parameters;

    public DisplayReportDiagramPanel(String id, ReportModel report, Map<String, String> parameters) {
        super(id);
        this.report = report;
        this.parameters = parameters;
    }

    @Override
    public void onBeforeRender() {
        super.onBeforeRender();

        Connection jdbcConnection = null;
        try {
            if (report == null) throw new Exception("No report given to render diagram");

            jdbcConnection = DatabaseUtils.getDatabaseConnection(report.getDataSource());
            ResultSet resultSet = DatabaseUtils.getResultSet(jdbcConnection, report.getStatement(), parameters);

            ResultSetMetaData metaData = resultSet.getMetaData();
            JFreeChart chart = null;
            resultSet.beforeFirst();

            // Line chart - 1 numeric value
            if (report.getDiagram() == 0) {
                if (metaData.getColumnCount() != 1) throw new Exception(new ResourceModel("dashboard.report.reportdiagram.image.render.error.1numvalues").wrapOnAssignment(this).getObject());

                DefaultCategoryDataset dataset = new DefaultCategoryDataset();
                while (resultSet.next()) dataset.addValue(resultSet.getDouble(1), metaData.getColumnName(1), String.valueOf(resultSet.getRow()));

                chart = ChartFactory.createLineChart(new ResourceModel("dashboard.report.reportdiagram.image.label").wrapOnAssignment(this).getObject(),
                        new ResourceModel("dashboard.report.reportdiagram.image.row-label").wrapOnAssignment(this).getObject(),
                        metaData.getColumnName(1),
                        dataset,
                        PlotOrientation.VERTICAL,
                        true,
                        true,
                        true);

            // XY Series chart - 2 numeric values
            } else if (report.getDiagram() == 1) {
                if (metaData.getColumnCount() != 2) throw new Exception(new ResourceModel("dashboard.report.reportdiagram.image.render.error.2numvalues").wrapOnAssignment(this).getObject());

                XYSeries series = new XYSeries(metaData.getColumnName(1) + " / " + metaData.getColumnName(2));
                while (resultSet.next()) series.add(resultSet.getDouble(1), resultSet.getDouble(2));

                chart = ChartFactory.createXYLineChart(new ResourceModel("dashboard.report.reportdiagram.image.label").wrapOnAssignment(this).getObject(),
                        metaData.getColumnName(1),
                        metaData.getColumnName(2),
                        new XYSeriesCollection(series),
                        PlotOrientation.VERTICAL,
                        true,
                        true,
                        true);

            // Category chart - 1 numeric value, 1 comparable value
            } else if (report.getDiagram() == 2) {
                if (metaData.getColumnCount() != 2) throw new Exception(new ResourceModel("dashboard.report.reportdiagram.image.render.error.2values").wrapOnAssignment(this).getObject());

                DefaultCategoryDataset dataset = new DefaultCategoryDataset();
                while (resultSet.next()) dataset.setValue(resultSet.getDouble(1), metaData.getColumnName(1) + " / " + metaData.getColumnName(2), resultSet.getString(2));

                chart = new JFreeChart(new ResourceModel("dashboard.report.reportdiagram.image.label").wrapOnAssignment(this).getObject(),
                                       new CategoryPlot(dataset,
                                       new LabelAdaptingCategoryAxis(14, metaData.getColumnName(2)),
                                       new NumberAxis(metaData.getColumnName(1)),
                                       new CategoryStepRenderer(true)));

            // Pie chart - 1 numeric value, 1 comparable value (used as category)
            } else if ((report.getDiagram() == 3) || (report.getDiagram() == 4)) {
                if (metaData.getColumnCount() != 2) throw new Exception(new ResourceModel("dashboard.report.reportdiagram.image.render.error.2values").wrapOnAssignment(this).getObject());

                DefaultPieDataset dataset = new DefaultPieDataset();
                while (resultSet.next()) dataset.setValue(resultSet.getString(2), resultSet.getDouble(1));

                if (report.getDiagram() == 3)
                    // Pie chart 2D
                    chart = ChartFactory.createPieChart(new ResourceModel("dashboard.report.reportdiagram.image.label").wrapOnAssignment(this).getObject(),
                            dataset,
                            true,
                            true,
                            true);
                else if (report.getDiagram() == 4) {
                    // Pie chart 3D
                    chart = ChartFactory.createPieChart3D(new ResourceModel("dashboard.report.reportdiagram.image.label").wrapOnAssignment(this).getObject(),
                            dataset,
                            true,
                            true,
                            true);
                    ((PiePlot3D) chart.getPlot()).setForegroundAlpha(Float.valueOf(new ResourceModel("dashboard.report.reportdiagram.image.alpha").wrapOnAssignment(this).getObject()));
                }

            // Bar chart - 1 numeric value, 2 comparable values (used as category, series)
            } else if (report.getDiagram() == 5) {
                if ((metaData.getColumnCount() != 2) && (metaData.getColumnCount() != 3)) throw new Exception(new ResourceModel("dashboard.report.reportdiagram.image.render.error.3values").wrapOnAssignment(this).getObject());

                DefaultCategoryDataset dataset = new DefaultCategoryDataset();
                while (resultSet.next()) dataset.setValue(resultSet.getDouble(1), resultSet.getString(2), resultSet.getString(metaData.getColumnCount()));

                chart = ChartFactory.createBarChart(new ResourceModel("dashboard.report.reportdiagram.image.label").wrapOnAssignment(this).getObject(),
                        metaData.getColumnName(2),
                        metaData.getColumnName(1),
                        dataset,
                        PlotOrientation.VERTICAL,
                        true,
                        true,
                        true);
            }

            int[] winSize = DashboardCfgDelegate.getInstance().getWindowSize("reportDiagramImage");
            addOrReplace(new JFreeChartImage("diagram",
                                    chart,
                                    winSize[0], winSize[1])
            );

            final JFreeChart downloadableChart = chart;
            addOrReplace(new Link<Object>("diagram-download") {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick() {

                    RequestCycle.get().setRequestTarget(new IRequestTarget() {

                        public void respond(RequestCycle requestCycle) {

                            WebResponse wr = (WebResponse) requestCycle.getResponse();
                            wr.setContentType("image/png");
                            wr.setHeader( "content-disposition", "attachment;filename=diagram.png");

                                OutputStream os = wr.getOutputStream();
                                try {
                                    ImageIO.write(downloadableChart.createBufferedImage(800, 600), "png", os);
                                    os.close();
                                } catch (IOException e) {
                                    log.error(this.getClass().toString() + ": " + "respond: " + e.getMessage());
                                    log.debug("Exception: ", e);
                                }
                                wr.close();
                        }

                        @Override
                        public void detach(RequestCycle arg0) {
                        }
                    });
                }
            }
            .add(new Image("diagram-download-image", ImageManager.IMAGE_DASHBOARD_REPORT_DOWNLOAD)
            .add(new ImageSizeBehaviour())
            .add(new TooltipBehaviour("dashboard.report.reportdiagram.", "image.downloadlink"))
                )
            );

            addOrReplace(new Image("diagram-print-image", ImageManager.IMAGE_DASHBOARD_REPORT_PRINT)
            .add(new ImageSizeBehaviour())
            .add(new TooltipBehaviour("dashboard.report.reportdiagram.", "image.printbutton"))
            );

            addOrReplace(new Label("error-message", "").setVisible(false));
            addOrReplace(new Label("error-reason", "").setVisible(false));
        } catch (Exception e) {
            log.error("Exception: " + e.getMessage());

            addOrReplace(((DynamicDisplayPage) this.getPage()).new PlaceholderLink("diagram-download").setVisible(false));
            addOrReplace(new Image("diagram-print-image").setVisible(false));
            addOrReplace(new Image("diagram").setVisible(false));
            addOrReplace(new Label("error-message", new ResourceModel("dashboard.report.reportdiagram.statement.error").wrapOnAssignment(this).getObject()).add(new AttributeModifier("class", true, new Model<String>("message-error"))));
            addOrReplace(new Label("error-reason", e.getMessage()).add(new AttributeModifier("class", true, new Model<String>("message-error"))));
            log.debug(getClass() + ": ", e);
        } finally {
            try {
                jdbcConnection.close();
            } catch (Exception ignore) {
            }
        }
    }

    public class LabelAdaptingCategoryAxis extends CategoryAxis {

        private static final long serialVersionUID = 1L;

        private final float labeledTicks;

        public LabelAdaptingCategoryAxis(float labeledTicks, String label) {
            super(label);
            this.labeledTicks = labeledTicks;
        }

        @SuppressWarnings("unchecked")
        @Override
        public List<CategoryTick> refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) {

            List<CategoryTick> standardTicks = super.refreshTicks(g2, state, dataArea, edge);
            int interval;
            if (standardTicks.isEmpty() || ((interval = Math.round((float) standardTicks.size() / labeledTicks)) < 1)) return standardTicks;
            List<CategoryTick> newTicks = new ArrayList<CategoryTick>(standardTicks.size());
            for (int i = 0; i < standardTicks.size(); i+=interval) {
                if (i % interval == 0) {
                    CategoryTick tick = standardTicks.get(i);
                    TextBlock textBlock = new TextBlock();
                    textBlock.addLine(tick.getCategory().toString().substring(0, Math.min(tick.getCategory().toString().length(), 8)),
                                      tick.getLabel().getLastLine().getFirstTextFragment().getFont(),
                                      tick.getLabel().getLastLine().getFirstTextFragment().getPaint());
                    newTicks.add(new CategoryTick(
                                      tick.getCategory(),
                                      textBlock,
                                      tick.getLabelAnchor(),
                                      tick.getRotationAnchor(),
                                      tick.getAngle()
                                )
                    );
                }
            }
            return newTicks;
        }
    }
}


text:
package org.omg.CORBA;

/**
 * The class is used to describe a call parameter, having name,
 * value and the passing mode flags ({@link  ARG_IN}, {@link ARG_OUT} or
 * {@link ARG_INOUT}. The same class is also used in {@link Context} to
 * pass the property names and values. This class is normally created by
 * {@link ORB#create_named_value(String, Any, int)}.
 *
 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
 */
public abstract class NamedValue
{
  /**
   * Get the parameter flags.
   * @return normally one of ({@link  ARG_IN}, {@link ARG_OUT} or
   * {@link ARG_INOUT}).
   */
  public abstract int flags();

  /**
   * Get the name of this parameter.
   * @return the name of this instance.
   */
  public abstract String name();

  /**
   * Get the value of this parameter. The parameter value is wrapped into
   * the instance of {@link Any}.
   *
   * @return the value of this parameter.
   */
  public abstract Any value();
}


text:
package tests.support;

import java.net.NetworkInterface;

public class Support_NetworkInterface {

    /**
     * On windows platforms with IPV6 enabled there are a number of pseudo
     * interfaces which don't work with our tests. This function is called to
     * make sure we only use the non-pseudo interfaces
     */
    public static boolean useInterface(NetworkInterface theInterface) {
        boolean result = true;
        String platform = System.getProperty("os.name");
        // only use these on windows platforms
        if (platform.startsWith("Windows")) {
            if ((theInterface.getDisplayName()
                    .equals("Teredo Tunneling Pseudo-Interface"))
                    || (theInterface.getDisplayName()
                            .equals("6to4 Tunneling Pseudo-Interface"))
                    || (theInterface.getDisplayName()
                            .equals("Automatic Tunneling Pseudo-Interface"))
                    || (theInterface.getDisplayName()
                            .equals("Loopback Pseudo-Interface"))) {
                result = false;
            }
        }
        return result;
    }
}


text:
package org.hcjf.log;

import org.hcjf.utils.Messages;

/**
 * @author javaito
 *
 */
public final class LogMessages extends Messages {

    private static final LogMessages instance;

    static {
        instance = new LogMessages();
    }

    private LogMessages() {
    }

    /**
     * Returnt he message associated to the log code.
     * @param logCode Log code.
     * @param params Parameters to complete the message.
     * @return Message complete and translated.
     */
    public static String getMessage(String logCode, Object... params) {
        return instance.getInternalMessage(logCode, params);
    }

    /**
     * Add the default value associated to log code.
     * @param logCode Log code.
     * @param defaultMessage Default message.
     */
    public static void addDefault(String logCode, String defaultMessage) {
        instance.addInternalDefault(logCode, defaultMessage);
    }

}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Assets.GetSocialDemo.Scripts.Utils;
using Facebook.Unity;
using GetSocialDemo.Scripts.GUI.Sections;
using GetSocialSdk.Core;
using GetSocialSdk.Ui;
using UnityEngine;
using GetSocialSdk.MiniJSON;

public class GetSocialDemoController : MonoBehaviour {
    const string MainMenuTitle = "Main Menu";

    Texture2D _avatar;
    string _getSocialUnitySdkVersion;
    string _getSocialUnderlyingNativeSdkVersion;

    bool _isInMainMenu = true;

    Vector2 _scrollPos;
    DemoAppConsole _console;

    public string CurrentViewTitle { set; get; }
    private string _latestReferralData;
    private ChatId _latestChatId;
    private bool _isTestDevice;

    // store user info to avoid constant calls to native
    private CurrentUser _currentUser;
    private bool _enterIdentityData;
    private bool _isInitialized;

    #region lifecycle

    [SuppressMessage ("ReSharper", "UnusedMember.Local")]
    void Awake () {
        // change default framerate
        Application.targetFrameRate = 100;
        _console = gameObject.GetComponent<DemoAppConsole> ().Init ();
        SetupAppsFlyer ();
        ShowMainMenu();
        SetupGetSocial();
#if UNITY_IOS
        OnApplicationPause (false);
#endif
    }

    void SetupAppsFlyer () {
        AppsFlyer.setAppsFlyerKey ("AP8P3GvwHgw9NBdBTWAqrb");
        /* For detailed logging */
        /* AppsFlyer.setIsDebug (true); */
#if UNITY_IOS
        /* Mandatory - set your apple app ID
           NOTE: You should enter the number only and not the "ID" prefix */
        AppsFlyer.setAppID ("313131310");
        AppsFlyer.trackAppLaunch ();
#elif UNITY_ANDROID
        /* Mandatory - set your Android package name */
        AppsFlyer.setAppID ("im.getsocial.demo.unity");
        AppsFlyer.init ("AP8P3GvwHgw9NBdBTWAqrb");;
#endif
    }

    private void OnApplicationPause (bool pauseStatus) {
        if (!pauseStatus) {
            GetSocial.AddOnInitializedListener (() => {
                if (_latestChatId != null) {
                    ShowChat ();
                }
            });
        } else {
            _latestChatId = null;
            GetSocialUi.CloseView (false);
        }
    }

    protected virtual void Start () {
        // Initialize FB SDK
        FB.Init (OnFacebookInited, OnHideUnity);
    }

    protected void Update () {
        deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f;
        HandleAndroidBackButton ();
        if (_notification != null) {
            var notification = _notification;
            _notification = null;
            var popup = new MNPopup (notification.Title, notification.Text);
            notification.ActionButtons.ForEach (button => {
                popup.AddAction (button.Title, () => { ProcessAction (button.ActionId, notification); });
            });
            popup.AddAction ("Dismiss", () => { });
            popup.Show ();
        }
    }

    void HandleAndroidBackButton () {
        if (Application.platform == RuntimePlatform.Android && Input.GetKeyDown (KeyCode.Escape)) {
            if (_isInMainMenu) {
                Application.Quit ();
            }
        }
    }

    protected void OnGUI () {
        DemoGuiUtils.DrawHeaderWrapper (DrawHeader);
        _scrollPos = DemoGuiUtils.DrawScrollBodyWrapper (_scrollPos, DrawBody);
        DemoGuiUtils.DrawFooter (DrawFooter);
    }

    #endregion

    #region callbacks

    protected void OnFacebookInited () {
        _console.LogD ("Facebook successfully initialized");
    }

    protected void OnHideUnity (bool isGameShown) {
        if (isGameShown) {
            ResumeGame ();
        } else {
            PauseGame ();
        }
    }

    #endregion

    #region methods

    public void SetupGetSocial () {
        Notifications.SetOnTokenReceivedListener (deviceToken => {
            _console.LogD (string.Format ("DeviceToken: {0}", deviceToken), false);
        });
        Notifications.SetOnNotificationReceivedListener(notification => {
            GetSocialUi.CloseView();
            _console.LogD(string.Format("Notification was received: {0}", notification));
            var notificationIds = new List<string>();
            notificationIds.Add(notification.Id);
            Notifications.SetStatus(NotificationStatus.Read, notificationIds, () => {}, (error) => { });
            if (notification.Action.Type.Equals(GetSocialActionType.AddFriend))
            {
                ShowPopup(notification);
            } else
            {
                HandleAction(notification.Action);
            }
        });
        Notifications.SetOnNotificationClickedListener((notification, context) => {
            GetSocialUi.CloseView();
            _console.LogD(string.Format("Notification was clicked: {0}", notification));
            var notificationIds = new List<string>();
            notificationIds.Add(notification.Id);
            Notifications.SetStatus(NotificationStatus.Read, notificationIds, () => {}, (error) => { });
            HandleAction(notification.Action);
        });

        _console.LogD ("Setting up GetSocial...");
        _getSocialUnitySdkVersion = GetSocial.UnitySdkVersion;
        _getSocialUnderlyingNativeSdkVersion = GetSocial.NativeSdkVersion;

        GetSocialFBMessengerPluginHelper.RegisterFBMessengerPlugin ();
        if (GetSocial.IsInitialized)
        {
            _console.LogD("GetSocial is initialized and user is retrieved");
            _currentUser = GetSocial.GetCurrentUser();
            _isTestDevice = GetSocial.Device.IsTestDevice;
            FetchCurrentUserData();
        } else
        {
            GetSocial.AddOnCurrentUserChangedListener(user => {
                _console.LogD("GetSocial is initialized and user is retrieved");
                _currentUser = user;
                _isTestDevice = GetSocial.Device.IsTestDevice;
                FetchCurrentUserData();
            });
        }

        Invites.SetOnReferralDataReceivedListener((referralData) => {
            var logMessage = string.Empty;

            if (referralData != null)
            {
                logMessage += string.Format("Token: {0}\n", referralData.Token);
                logMessage += string.Format("Referrer user id: {0}\n", referralData.ReferrerUserId);
                logMessage += string.Format("Referrer channel: {0}\n", referralData.ReferrerChannelId);
                logMessage += string.Format("Is first match: {0}\n", referralData.IsFirstMatch);
                logMessage += string.Format("Is guarateed match: {0}\n", referralData.IsGuaranteedMatch);
                logMessage += "Referral Link params:\n" + referralData.LinkParams.ToDebugString();
            }
            _console.LogD("Referral data: \n" + logMessage);
        });

        GetSocial.Init();
    }

    private void ShowChat () {
        MainThreadExecutor.Queue (() => {
            PushMenuSection<ChatMessagesView>(section =>
            {
                section.SetChatId(_latestChatId);
                //_latestChatId = null;
            });
            if (_console.IsVisible)
            {
                _console.Toggle();
            }
        });
    }

    private void ShowPopup (Notification notification) {
        _notification = notification;
    }

    public static void ProcessAction (string actionButtonId, Notification notification) {
        if (actionButtonId.Equals (NotificationButton.ConsumeAction)) {
            Notifications.SetStatus (NotificationStatus.Consumed, new List<string> { notification.Id }, () => { }, Debug.LogError);
            GetSocial.Handle (notification.Action);
        } else if (actionButtonId.Equals (NotificationButton.IgnoreAction)) {
            Notifications.SetStatus (NotificationStatus.Ignored, new List<string> { notification.Id }, () => { }, Debug.LogError);
        }
    }

    private void AddFriend(string userId)
    {
        Communities.AddFriends(UserIdList.Create(userId),
            friendsCount =>
            {
                var message = "Friend added";
                _console.LogD(message);
            },
            error => _console.LogE("Failed to add a friend " + userId + ", error:" + error.Message));
    }

    public void HandleAction (GetSocialAction action) {
        if (action == null) { return; }

        _console.LogD("Action: " + action.ToString(), false);
        if (action.Type == GetSocialActionType.AddFriend && action.Data.ContainsKey(GetSocialActionKeys.AddFriend.UserId))
        {
            var userId = action.Data[GetSocialActionKeys.AddFriend.UserId];
            AddFriend(userId);
        } else if (action.Type == GetSocialActionType.OpenProfile && action.Data.ContainsKey(GetSocialActionKeys.OpenProfile.UserId))
        {
            ShowUserDetails(action.Data[GetSocialActionKeys.OpenProfile.UserId]);
        } else if (action.Type == GetSocialActionType.Custom)
        {
            var popup = new MNPopup("Custom Action", action.ToString());
            popup.Show();
        } else if (action.Type.Equals(GetSocialActionType.OpenChat))
        {
            _latestChatId = ChatId.Create(action.Data[GetSocialActionKeys.OpenChat.ChatId]);
            if (GetSocial.IsInitialized)
            {
                ShowChat();
            }
        } else {
            GetSocial.Handle(action);
        }
    }

    void ShowUserDetails (string userId) {
        Communities.GetUser(UserId.Create(userId), user => {
            DemoUtils.ShowPopup ("Details", user.ToString());
        }, error => {
            _console.LogE ("Failed to get user: " + error.Message + ", code: " + error.ErrorCode);
        });
    }

    protected void DrawHeader () {
        DrawConsoleToggle ();

        GUILayout.BeginVertical (GUILayout.MaxWidth (150));
        GUILayout.Box (_avatar ?? Texture2D.whiteTexture, GUILayout.Width (100), GUILayout.Height (100));

        GUI.DrawTexture (GUILayoutUtility.GetLastRect (), _avatar ?? Texture2D.blackTexture, ScaleMode.StretchToFill);
        // Click area for avatar
        if (GUI.Button (new Rect (0, 0, 120, 120), string.Empty, GUIStyle.none) && _currentUser != null) {
            DemoUtils.ShowPopup ("Info", _currentUser.ToString ());
            _console.LogD (_currentUser.ToString ());
        }
        GUIStyle fpsStyle = new GUIStyle {
            margin = new RectOffset (4, 4, 4, 4),
            fontSize = 16,
            alignment = TextAnchor.UpperLeft,
            wordWrap = true,
            richText = false,
            stretchWidth = true
        };
        GUILayout.Label ("FPS: " + GetFPS (), fpsStyle);
        if (_isTestDevice)
        {
            GUILayout.Label("TestDevice", fpsStyle);
        }
        GUILayout.EndVertical ();

        if (_currentUser != null) {
            DrawUserInfo ();
        }
    }

    void DrawUserInfo () {
        GUILayout.BeginVertical ();
        GUILayout.Label ("GUID: " + _currentUser.Id, GSStyles.NormalLabelText);
        GUILayout.Label ("Display Name: " + _currentUser.DisplayName, GSStyles.NormalLabelText);
        GUILayout.Label ("AvatarUrl: " + _currentUser.AvatarUrl, GSStyles.NormalLabelText);
        GUILayout.Label ("Is anonymous? " + _currentUser.IsAnonymous, GSStyles.NormalLabelText);
        GUILayout.EndVertical ();
    }

    void DrawConsoleToggle () {
        if (GUI.Button (new Rect (Screen.width - 115, 15, 100, 100), "Toggle\nConsole")) {
            _console.Toggle ();
        }
    }

    protected void DrawBody () {
        if (_console.IsVisible || !_isInMainMenu) {
            return;
        }

        GUILayout.Label (CurrentViewTitle, GSStyles.BigLabelText);
        DrawMainView ();
    }

    void DrawFooter () {
        GUILayout.Label (GetFooterText (), GSStyles.NormalLabelText);
    }

    float deltaTime = 0.0f;
    private Notification _notification;

    protected virtual string GetFPS () {
        float msec = deltaTime * 1000.0f;
        float fps = 1.0f / deltaTime;
        return string.Format ("{0:0.} fps ({1:0.} ms)", fps, msec);
    }

    protected virtual string GetFooterText () {
        return string.Format ("Native: v{0}, Unity: v{1}", _getSocialUnderlyingNativeSdkVersion,
            _getSocialUnitySdkVersion);
    }

    private string _identityId;
    private string _identityToken;

    void DrawMainView() {
        GUILayout.Label("API", GSStyles.NormalLabelText);
        if (!_isInitialized)
        {
            _isInitialized = GetSocial.IsInitialized;
        }
        if (_isInitialized)
        {
            Button("User Management", ShowMenuSection<AuthSection>);
        }
        else
        {
            Button("Init with anonymous", () => GetSocial.Init());
            if (_enterIdentityData)
            {
                DemoGuiUtils.DrawRow(() =>
                {
                    _identityId = GUILayout.TextField(_identityId, GSStyles.TextField);
                    _identityToken = GUILayout.TextField(_identityToken, GSStyles.TextField);
                });
                DemoGuiUtils.DrawRow(() =>
                {
                    Button("Init", InitWithCustom);
                    Button("Cancel", () => { _enterIdentityData = false; });
                });
            }
            else
            {
                Button("Init with custom identity", () => { _enterIdentityData = true; });
            }
            Button("Init with FB", InitWithFacebook);
        }
        Button("InApp Purchase Api", ShowMenuSection<InAppPurchaseApiSection>);
        Button("Promo Codes", ShowMenuSection<PromoCodesSection>);
        Button("Custom Analytics Events", ShowMenuSection<CustomAnalyticsEventSection>);
        GUILayout.Space(30f);
        GUILayout.Label("Invites", GSStyles.NormalLabelText);
        Button("Smart Invites", ShowMenuSection<SmartInvitesApiSection>);
        Button("Set Referrer", ShowMenuSection<SetReferrerSection>);
        Button("Referred Users", ShowMenuSection<ReferredUsersSection>);
        Button("Referrer Users", ShowMenuSection<ReferrerUsersSection>);
        GUILayout.Space(30f);
        GUILayout.Label("Notification", GSStyles.NormalLabelText);
        Button("Send Notification", ShowMenuSection<SendNotificationSection>);
        Button("Notifications", ShowMenuSection<NotificationsSection>);
        GUILayout.Space(30f);
        GUILayout.Label("Communities", GSStyles.NormalLabelText);
        Button("Timeline", () => PushMenuSection<ActivitiesSection>(section => {
            section.Query = ActivitiesQuery.Timeline();
            section.ShowFilter = false;
        }));
        Button ("Find Tags", ShowMenuSection<TagsSection>);
        Button ("Post to Timeline", () => PushMenuSection<PostActivitySection>(section => section.Target = PostActivityTarget.Timeline() ));
        Button ("My Friends", () => PushMenuSection<FriendsSection>(section => section.User = UserId.CurrentUser()));
        Button ("Suggested Friends", ShowMenuSection<SuggestedFriendsSection>);
        Button ("My Followers", () => PushMenuSection<FollowersSection>(section =>
        {
            section.Name = "Me";
            section.Query = FollowersQuery.OfUser(UserId.CurrentUser());
        }));
        Button ("Followed By Me", () => PushMenuSection<FollowingSection>(section =>
        {
            section.Name = "Me";
            section.User = UserId.CurrentUser();
        }));
        Button ("Search Topics", ShowMenuSection<TopicsSearchSection>);
        Button ("My Topics", () => PushMenuSection<FollowedTopicsSection>(section =>
        {
            section.User = UserId.CurrentUser();
        }));
        Button ("Search Users", ShowMenuSection<UsersSearchSection>);
        Button("Chats", ShowMenuSection<ChatsSection>);
        Button("Create Group", ShowMenuSection<CreateGroupSection>);
        Button("Search Groups", ShowMenuSection<GroupsSearchSection>);
        Button("My Groups", ShowMenuSection<MyGroupsSection>);
        GUILayout.Space (30f);
        GUILayout.Label ("UI", GSStyles.NormalLabelText);
        Button ("Activity Feed", ShowMenuSection<ActivityFeedUiSection>);
        Button ("Notification Center", ShowMenuSection<NotificationUiSection>);
        Button ("UI Customization", ShowMenuSection<UiCustomizationSection>);
        GUILayout.Space (30f);
        GUILayout.Label ("Other", GSStyles.NormalLabelText);
        DrawSettings();
    }

    protected virtual void DrawSettings()
    {
        Button ("Settings", ShowMenuSection<SettingsSection>);
    }
    #endregion

    #region navigation

    public void ShowMainMenu () {
        _isInMainMenu = true;
        CurrentViewTitle = MainMenuTitle;
    }

    public void ShowMenuSection<Menu> () where Menu : DemoMenuSection {
        PushMenuSection<Menu>(section => { });
    }

    Stack<DemoMenuSection> _stack = new Stack<DemoMenuSection>();

    public void PushMenuSection<Menu>(Action<Menu> onCreate) where Menu : DemoMenuSection
    {
        ShowMainMenu();
        _isInMainMenu = false;
        if (_stack.Count > 0)
        {
            _stack.Peek().gameObject.SetActive(false);
        }

        var gameObj = new GameObject();
        gameObj.SetActive(false);
        var section = gameObj.AddComponent<Menu>();
        section.enabled = false;
        onCreate(section);
        gameObj.transform.parent = gameObject.transform;
        section.Initialize(this, _console);
        gameObj.SetActive(true);
        section.enabled = true;

        _stack.Push(section);
    }

    public void PopMenuSection()
    {
        var section = _stack.Pop();
        section.gameObject.SetActive(false);
        Destroy(section.gameObject);
        if (_stack.Count > 0)
        {
            _stack.Peek().gameObject.SetActive(true);
        }
        else
        {
            ShowMainMenu();
        }
    }

    #endregion

    #region helpers
    void InitWithCustom()
    {
        GetSocial.Init(
            Identity.Custom(AuthSection.CustomProviderId, _identityId, _identityToken),
            () =>
            {
                _enterIdentityData = false;
                _console.LogD("Successfully logged into identity");
                FetchCurrentUserData();
            },
            error => _console.LogE(string.Format("Failed to log into identity '{0}', reason: {1}", AuthSection.CustomProviderId,
                error))
            );
    }

    void InitWithFacebook()
    {
        if (FB.IsLoggedIn)
        {
            SwitchToFacebookUserInternal();
        }
        else
        {
            FB.LogInWithReadPermissions(AuthSection.FacebookPermissions, result =>
            {
                if (result.Cancelled)
                {
                    _console.LogE("Facebook login was cancelled");
                    return;
                }

                if (!string.IsNullOrEmpty(result.Error))
                {
                    _console.LogE("Error happened during Facebook login: " + result.Error);
                    return;
                }

                _console.LogD("Logged in to Facebook: " + result.RawResult);
                SwitchToFacebookUserInternal();
            });
        }
    }

    private void SwitchToFacebookUserInternal()
    {
        GetSocial.Init(Identity.Facebook(AccessToken.CurrentAccessToken.TokenString),
            () =>
            {
                _console.LogD("Successfully initialized with identity");
                SetFacebookUserDetails();
            },
            error => _console.LogE("Initialize with identity failed:" + error)
            );
    }
    private void SetFacebookUserDetails()
    {
        FB.API("me?fields=first_name,last_name,picture", HttpMethod.GET, result =>
        {
            var dictionary = result.ResultDictionary;
            var displayName = dictionary["first_name"] + " " + dictionary["last_name"];
            var pictureDictionary = (IDictionary<string, object>) dictionary["picture"];
            var dataDictionary = (IDictionary<string, object>) pictureDictionary["data"];
            var pictureUrl = dataDictionary["url"].ToString();
            var update = new UserUpdate
            {
                DisplayName = displayName, AvatarUrl = pictureUrl
            };
            GetSocial.GetCurrentUser().UpdateDetails(update, () =>
            {
                _console.LogD("Display name is set to:" + displayName + ", avatar set to " + pictureUrl);
                FetchCurrentUserData();
            }, error =>
            {
                _console.LogE("Failed to set Facebook details");
            });
        });
    }

    public void FetchCurrentUserData ()
    {
        _currentUser = GetSocial.GetCurrentUser();
        _avatar = Resources.Load<Texture2D> ("GUI/default_demo_avatar");
        if (!string.IsNullOrEmpty (_currentUser?.AvatarUrl)) {
            StartCoroutine (DownloadAvatar (_currentUser.AvatarUrl));
        }
    }

    public bool HasIdentity (string provider) {
        return _currentUser.Identities.ContainsKey (provider);
    }

#pragma warning disable 0618
    private IEnumerator DownloadAvatar (string url) {
        Debug.Log ("Downloading avatar: " + url);
        var www = new WWW (url);
        yield return www;
        if (!string.IsNullOrEmpty (www.error)) {
            Debug.LogError ("Failed to download avatar, reason: " + www.error);
        }
        _avatar = www.texture;
    }
#pragma warning restore 0618

    protected static void Button (string text, Action onClickCallback, bool isEnabled = true) {
        DemoGuiUtils.DrawButton (text, onClickCallback, isEnabled, GSStyles.Button);
    }

    public ActionDialog Dialog()
    {
        return GetComponentInChildren<ActionDialog>();
    }

    static void PauseGame () {
        Time.timeScale = 0;
        Debug.Log ("Paused game");
    }

    static void ResumeGame () {
        Debug.Log ("Resuming game");
        Time.timeScale = 1;
    }
    #endregion
}


text:
require '../base'
require '../namespace'

module RemoteEntities
	module Entities
		class RemoteIronGolemImpl < BaseAttackingEntity
			include RemoteEntities::Entities::RemoteIronGolem
		end

		class RemoteIronGolemEntity < NMS::EntityIronGolem
			extend RemoteEntities::EntityMixins::EntityHandle
			include RemoteEntities::EntityMixins::RemoteMethodDefaults

			def self.default_movement_desires
				[
						# TODO
				]
			end

			def self.default_target_desires
				[
						# TODO
				]
			end
		end
	end
end


text:
import {Component, EventEmitter, Input, OnInit, Output} from "@angular/core";
import {ModalService} from "../../../../ui/modal/modal.service";
import {AddSourceModalComponent} from "../../../../core/modals/add-source-modal/add-source-modal.component";
import {AuthService} from "../../../../auth/auth.service";
import {skip, take} from "rxjs/operators";

@Component({
    selector: "ct-get-started-notification",
    template: `
        You've connected your {{environment}} account ({{username}}) to the Rabix Composer.
        Get started by
        <button class="btn-inline-link" (click)="openProject()" data-test="get-started-notification-open-project">opening a project.
        </button>
    `
})
export class GetStartedNotificationComponent implements OnInit {

    @Input()
    environment: string;

    @Input()
    username: string;

    @Output()
    dismiss = new EventEmitter();

    constructor(private modal: ModalService, private auth: AuthService) {
    }

    ngOnInit() {
        this.auth.getActive().pipe(
            skip(1),
            take(1)
        ).subscribe(() => {
            this.dismiss.next();
        });
    }

    openProject() {
        const component = this.modal.fromComponent(AddSourceModalComponent, "Open a Project");
        component.activeTab = "platform";
    }
}


text:
cd /var/www/
chown www-data:www-data -R *

cd /var/lib/
chown mysql:mysql -R mysql
service apache2 start

if [[ "$INIT_DB" != "" ]]
then
  service mysql stop
  rm /var/lib/mysql/* -rf
  TMP_PASS=$(mysqld --initialize 2>&1 | grep "temporary password" | sed -e "s/.*temporary password.*: \(.*\)/\1/g")
  if [[ "$TMP_PASS" == "" ]]
  then
    echo "ERROR: cannot get temp pass"
    exit 1
  fi
  service mysql start
  mysql -uroot -p$TMP_PASS --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$MYSQL_ROOT_PASSWORD';"
else
  service mysql start
fi


text:
var Emitter,
    componentEmitter = 'emitter'

try {
    // Requiring without a string literal will make browserify
    // unable to parse the dependency, thus preventing it from
    // stopping the compilation after a failed lookup.
    Emitter = require(componentEmitter)
} catch (e) {
    Emitter = require('events').EventEmitter
    Emitter.prototype.off = function () {
        var method = arguments.length > 1
            ? this.removeListener
            : this.removeAllListeners
        return method.apply(this, arguments)
    }
}

module.exports = Emitter


text:
#ifndef __ASTAR_PPHASH__
#define __ASTAR_PPHASH__

#define FSH_SUCCESS       0
#define FSH_KEY_OCCUPIED  1
#define FSH_NO_SUCH_KEY   2
#define FSH_HASHSIZE     37
#define FSH_NULL 0

#include "astar.h"

/**
 * The FixedSizeHash is a hash that does not grow in size.
 * In each bin there are a number of elements, which are maintained
 * via a linked list.
 * This is used to find out whether a path with the same word history
 * as the one being expanded has already been search.  If yes, we can
 * abort this one.
 */
typedef struct
{
  int hashsize;
  partial_path* items[FSH_HASHSIZE];
  srec* rec;
}
FixedSizeHash;

void hash_init(FixedSizeHash* hash, srec* rec);
int hash_del(FixedSizeHash* hash, partial_path* parp);
unsigned int hashfunc(partial_path* parp);
int compare_parp(partial_path* parp1, partial_path* parp2, srec* rec);
int hash_get(FixedSizeHash* hash, partial_path* parp, void** hval);
int hash_set(FixedSizeHash* hash, partial_path* parp);

#endif


text:
<?php

class Approval_signaturesManagement extends CI_Model {

    public function get_all_approval_signature()
    {

    }
    public function get_approval_signature_by_document($id_documentHeader)
    {}
    public function get_approval_signature_by_date($dateMin,$dateMax)
    {}

    public function get_message_user($userA,$userB)
    {
        $this->db->select('*');
        $this->db->from('messages');
        $this->db->join('users', 'users.id_user = messages.id_to');
        $this->db->where('messages.id_to',$userA);
        $this->db->where('messages.id_from',$userB);

        $this->db->or_where('messages.id_to',$userB);
        $this->db->where('messages.id_from',$userA);
        $this->db->order_by('messages.message_created_date', 'DESC');

        $result = $this->db->get();
        $result = $result->result();

        $this->load->model('entities/messages');
        $temporary_message_element = new Messages();

        foreach ($result as $key => $value)
        {
            $temporary_message_element->id_message = $value->id_message;
            $temporary_message_element->id_from = $value->id_from;
            $temporary_message_element->id_to = $value->id_to;
            $temporary_message_element->message_content = $value->message_content;
            $temporary_message_element->message_seen = $value->message_seen;
            $temporary_message_element->message_created_date=$value->message_created_date;
             $message->message_object=$result->message_object;
            $msgs[$key]=$temporary_message_element;
        }
        return $msgs;
    }

    public function get_message($id)
    {
        $this->db->select('*');
        $this->db->where('id_message',$id);
        $this->db->from('messages');
        $result = $this->db->get('message');
        $result = $result->result();
        if(count($result)>0)
        {
            $this->load->model('entities/message');
            $message = new Messages();
            $result = $result[0];
            $message->id_message=$result->id_message;
            $message->id_from=$result->id_from;
            $message->id_to=$result->id_to;
            $message->message_content=$result->message_content;
            $message->message_seen=$result->message_seen;
            $message->message_created_date=$result->message_created_date;
            $message->message_object=$result->message_object;

            return $message;
        }
        else
            return false;
    }

    public function add_message($message)
    {
        $this->db->insert('messages',$message);
    }

    public function update_message($message)
    {
        $this->db->where('id_message',$message->id);
        $this->db->update('messages',$message);
    }

    public function delete_user($id)
    {
        $this->db->where('id_message',$id);
        $this->db->delete('messages');
    }

}

?>


text:
package org.apache.camel.dsl.jbang.core.others;

import org.apache.camel.dsl.jbang.core.api.Printer;
import org.apache.camel.dsl.jbang.core.types.Other;

public class OtherPrinter implements Printer<Other> {
    @Override
    public void inject(Other other) {
        System.out.printf("%-35s %-45s %s%n", other.shortName, other.description, other.link);
    }
}


text:
package main

import (
	"context"
	"flag"
	"fmt"
	"log"
	"os"
	"os/signal"
	"syscall"
	"time"

	"github.com/jabley/monitoring-spike/pkg/apps"
	"github.com/jabley/monitoring-spike/pkg/servers"
)

func main() {
	flag.Parse()

	port := apps.GetDefaultConfig("PORT", "8080")

	errorChan := make(chan error, 1)

	backends := servers.NewBackends(errorChan)

	srv := servers.NewFrontendServer(backends)

	signalChan := make(chan os.Signal, 1)
	signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)

	quit := make(chan struct{})
	go apps.MonitorProcess("frontend", quit)

	go servers.ListenAndServe(port, srv, errorChan)

	for {
		select {
		case err := <-errorChan:
			if err != nil {
				log.Fatal(err)
			}
		case s := <-signalChan:
			log.Println(fmt.Sprintf("Captured %v. Exiting ...", s))
			d := time.Now().Add(1 * time.Second)
			ctx, cancel := context.WithDeadline(context.Background(), d)
			defer cancel()
			srv.Shutdown(ctx)
			quit <- struct{}{}
			os.Exit(0)
		}
	}
}


text:
package org.jvending.registry.impl;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import org.jvending.registry.RegistryLoader;
import org.jvending.registry.Repository;
import org.jvending.registry.RepositoryLoader;
import org.kxml2.io.KXmlParser;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/**
 * The default loader for the registry-config.xml file.
 *
 * @author Shane Isbell
 * @since 1.2.0
 */

public class StandardRegistryLoader implements RegistryLoader {
    /**
     * Internal list of RepositoryObjects
     */
    private List<RepositoryObject> repositories = new ArrayList<RepositoryObject>();

    private Hashtable<String, Repository> repoMap = new Hashtable<String, Repository>();

    private RepositoryLoader repositoryLoader;

    public void setRepositoryLoader(RepositoryLoader repositoryLoader) {
        this.repositoryLoader = repositoryLoader;
    }

    /**
     * Loads the registry-config file
     *
     * @param inputStream inputstream containing registry-config file
     * @throws java.io.IOException
     */
    public final void loadRegistry(InputStream inputStream) throws IOException {

        KXmlParser parser = new KXmlParser();
        try {
            parser.setInput(inputStream, null);
        } catch (XmlPullParserException e) {
            throw new IOException(e.toString());
        }
        try {
            parser.nextTag();
            parser.require(XmlPullParser.START_TAG, null, "registry-config");
            parser.nextTag();
            parser.require(XmlPullParser.START_TAG, null, "repositories");

            while (parser.nextTag() == XmlPullParser.START_TAG) {
                parser.require(XmlPullParser.START_TAG, null, "repository");
                repositories.add(getRepositoryObject(parser));
            }
        } catch (XmlPullParserException e) {
            throw new IOException("JV-000-010:" + e.toString());
        }
        loadIntoRegistry();
    }

    public final Hashtable<String, Repository> getRepositories() {
        return repoMap;
    }

      /**
     * Resolves system variables within the path
     *
     * @param fileName name of the configuration file
     * @return path of the file with resolved system variables. Default value is '.'
     */
    private String toPath(String fileName) {
        byte[] path = fileName.getBytes();
        int length = path.length;
        StringBuffer env = new StringBuffer();
        StringBuffer filePath = new StringBuffer();
        for (int i = 0; i < length;) {
            if (i >= length - 2) {
                filePath.append((char) path[i++]);
            } else if (path[i] == 36) {
                if (path[++i] == 123) {
                    i++;
                    while (i < length - 1 && path[i] != 125) {
                        env.append((char) path[i++]);
                    }
                    if (path[i] == 125) i++;
                } else {
                    i--;
                    i--;
                }
                String pathEnv = System.getProperty(env.toString().trim(), ".");
                filePath.append(pathEnv.toString());
            } else {
                filePath.append((char) path[i++]);
            }
        }//end for:i
        return filePath.toString();
    }

    /**
     * Loads all of the repositories into the registry
     *
     * @throws IOException
     */
    private void loadIntoRegistry() throws IOException {
        if(repositoryLoader == null) throw new IOException("JV-000-011: Repository Loader does not exist");
        for ( RepositoryObject repositoryObject: repositories) {
            String repositoryName = repositoryObject.getRepositoryName();
            String className = repositoryObject.getRepositoryClass();
            String fileName = repositoryObject.getRepositoryConfig();
            //instantiate class based on info in the registry-config file
            Repository repository = null;
			try {
				repository = repositoryLoader.loadRepository(toPath(fileName), className, repositoryObject.getInitParams());
			} catch (Exception e) {
				e.printStackTrace();
			}
			if(repository == null) {
				System.out.println("Tried to load repository but failed");
				throw new IOException("Tried to load repository but failed");
			}
            repoMap.put(repositoryName, repository);
        }
    }

    /**
     * Constructs a RepositoryObject from the registry-config file
     *
     * @param parser
     * @return RepositoryObject
     * @throws IOException
     * @throws XmlPullParserException
     */
    private RepositoryObject getRepositoryObject(KXmlParser parser) throws IOException, XmlPullParserException {
        RepositoryObject repositoryObject = new RepositoryObject();
        Hashtable<String, String> initParams = new Hashtable<String, String>();
        for (int i = 0; parser.nextTag() == XmlPullParser.START_TAG; i++) {
            switch (i) {
                case 0:
                    parser.require(XmlPullParser.START_TAG, null, "repository-name");
                    repositoryObject.setRepositoryName(parser.nextText());
                    break;
                case 1:
                    parser.require(XmlPullParser.START_TAG, null, "repository-class");
                    repositoryObject.setRepositoryClass(parser.nextText());
                    break;
                case 2:
                    parser.require(XmlPullParser.START_TAG, null, "repository-config");
                    repositoryObject.setRepositoryConfig(parser.nextText());
                    break;
                default:
                    parser.require(XmlPullParser.START_TAG, null, "init-param");

                    String paramName = null;
                    String paramValue = null;
                    for (int j = 0; parser.nextTag() == XmlPullParser.START_TAG; j++) {

                        switch (j) {
                            case 0:
                                parser.require(XmlPullParser.START_TAG, null, "param-name");
                                paramName = parser.nextText();
                                break;
                            case 1:
                                parser.require(XmlPullParser.START_TAG, null, "param-value");
                                paramValue = parser.nextText();
                                break;
                            default:
                                throw new IOException();
                        }
                    }//end params
                    if (paramName != null && paramValue != null) initParams.put(paramName, paramValue);
            }//end all tags
            repositoryObject.setInitParams(initParams);
        }

        return repositoryObject;
    }

    /**
     * Value Object for Repository Information
     */
    private class RepositoryObject {

        /**
         * Name of the repository
         */
        private String repositoryName;

        /**
         * package and class name of the repository
         */
        private String repositoryClass;

        /*Path and name of the repository config file*/
        private String repositoryConfig;

        /**
         * Initialization parameters of the repository
         */
        private Hashtable<String, String> initParams;

        /**
         * Empty Constructor
         */
        RepositoryObject() {
        }

        String getRepositoryName() {
            return repositoryName;
        }

        void setRepositoryName(String repositoryName) {
            this.repositoryName = repositoryName;
        }

        String getRepositoryClass() {
            return repositoryClass;
        }

        void setRepositoryClass(String repositoryClass) {
            this.repositoryClass = repositoryClass;
        }

        String getRepositoryConfig() {
            return repositoryConfig;
        }

        void setRepositoryConfig(String repositoryConfig) {
            this.repositoryConfig = repositoryConfig;
        }

        Hashtable<String, String> getInitParams() {
            return initParams;
        }

        void setInitParams(Hashtable<String, String> initParams) {
            this.initParams = initParams;
        }

        /**
         * Classes are equal if they have the same values for class, config and name
         */
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof RepositoryObject)) return false;

            final RepositoryObject repositoryObject = (RepositoryObject) o;

            if (!repositoryClass.equals(repositoryObject.repositoryClass)) return false;
            if (!repositoryConfig.equals(repositoryObject.repositoryConfig)) return false;
            if (!repositoryName.equals(repositoryObject.repositoryName)) return false;

            return true;
        }

        /**
         * Classes have identical hash code if they have the same values for class, config and name
         */
        public int hashCode() {
            int result;
            result = repositoryName.hashCode();
            result = 29 * result + repositoryClass.hashCode();
            result = 29 * result + repositoryConfig.hashCode();
            return result;
        }

        public String toString() {
            return "Name = " + repositoryName +
                    ", Class = " + repositoryClass +
                    ", Config = " + repositoryConfig;
        }
    }

}


text:
brick-a-brack
=============

A dark theme for Brackets with useful (I hope) text styling.

version history
---------------

0.0.1 Basing it off of the Skullomania theme


text:
using System;

namespace AGO.Reporting.Service
{
	public class Starter
	{
		private static ReportingService service;

		public static void Main(string[] args)
		{
			try
			{
				service = new ReportingService();
				service.Initialize();

				Console.WriteLine("Reporting service is running. Servicing projects '{0}'. Press Enter for stop",
					service.ServicedProjects);
				Console.ReadLine();

				service.Dispose();
				Console.WriteLine("Reporting service stopped");
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex);
			}
		}
	}
}


text:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="line">
            <solid android:color="#ffffff" />
            <stroke
                android:dashGap="5dp"
                android:dashWidth="5dp"
                android:width="1dp"
                android:color="@color/black" />
            <!--<padding
                android:top="35dp" />-->
        </shape>
    </item>
</layer-list>


text:
BOT_NAME = 'splash_crawlera_example'
SPIDER_MODULES = ['splash_crawlera_example.spiders']
NEWSPIDER_MODULE = 'splash_crawlera_example.spiders'

SPIDER_MIDDLEWARES = {
    'scrapy_splash.SplashDeduplicateArgsMiddleware': 100,
}

DOWNLOADER_MIDDLEWARES = {
    'scrapy_splash.SplashCookiesMiddleware': 723,
    'scrapy_splash.SplashMiddleware': 725,
    'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware': 810,
}

CRAWLERA_APIKEY = ''  # Your crawlera API key

# Splash settings
SPLASH_URL = ''     # Splash instance URL from Scrapy Cloud
SPLASH_APIKEY = ''  # Your API key for the Splash instance hosted on Scrapy Cloud
DUPEFILTER_CLASS = 'scrapy_splash.SplashAwareDupeFilter'


text:
<!DOCTYPE html>

    <meta content="Monty Python's Flying Circus" name="author" />
    <title>The Lumberjack Song</title>

The Lumberjack Song

      I'm a lumberjack and I'm OK,

      I sleep all night and I work all day,

        He's a lumberjack and he's OK,

        He sleeps all night and he works all day,

      I cut down trees, I eat my lunch,

      I go to the lavatory;

      On Wednesdays I go shopping,

      And have buttered scones for tea!

    Et cetera,

      Google this song

    to hear it or get all its lyrics.


text:
import { AnyAction } from 'redux';

import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';

import {
    CLEAR_TOOLBOX_TIMEOUT,
    SET_FULL_SCREEN,
    SET_TOOLBOX_TIMEOUT
} from './actionTypes';

import './subscriber';

/**
 * Middleware which intercepts Toolbox actions to handle changes to the
 * visibility timeout of the Toolbox.
 *
 * @param {Store} store - The redux store.
 * @returns {Function}
 */
MiddlewareRegistry.register(store => next => action => {

    switch (action.type) {
    case CLEAR_TOOLBOX_TIMEOUT: {
        const { timeoutID } = store.getState()['features/toolbox'];

        clearTimeout(timeoutID ?? undefined);
        break;
    }

    case SET_FULL_SCREEN:
        return _setFullScreen(next, action);

    case SET_TOOLBOX_TIMEOUT: {
        const { timeoutID } = store.getState()['features/toolbox'];
        const { handler, timeoutMS }: { handler: Function; timeoutMS: number; } = action;

        clearTimeout(timeoutID ?? undefined);
        action.timeoutID = setTimeout(handler, timeoutMS);

        break;
    }
    }

    return next(action);
});

type DocumentElement = {
    mozRequestFullScreen?: Function;
    requestFullscreen?: Function;
    webkitRequestFullscreen?: Function;
};

/**
 * Makes an external request to enter or exit full screen mode.
 *
 * @param {Dispatch} next - The redux dispatch function to dispatch the
 * specified action to the specified store.
 * @param {Action} action - The redux action SET_FULL_SCREEN which is being
 * dispatched in the specified store.
 * @private
 * @returns {Object} The value returned by {@code next(action)}.
 */
function _setFullScreen(next: Function, action: AnyAction) {
    const result = next(action);

    if (typeof APP === 'object') {
        const { fullScreen } = action;

        if (fullScreen) {
            const documentElement: DocumentElement
                = document.documentElement || {};

            if (typeof documentElement.requestFullscreen === 'function') {
                documentElement.requestFullscreen();
            } else if (
                typeof documentElement.mozRequestFullScreen === 'function') {
                documentElement.mozRequestFullScreen();
            } else if (
                typeof documentElement.webkitRequestFullscreen === 'function') {
                documentElement.webkitRequestFullscreen();
            }

            return result;
        }

        if (typeof document.exitFullscreen === 'function') {
            document.exitFullscreen();

        // @ts-ignore
        } else if (typeof document.mozCancelFullScreen === 'function') {
            // @ts-ignore
            document.mozCancelFullScreen();

        // @ts-ignore
        } else if (typeof document.webkitExitFullscreen === 'function') {
            // @ts-ignore
            document.webkitExitFullscreen();
        }
    }

    return result;
}


text:
<?xml version="1.0"?>
<!--

Copyright (c) 2010 - 2012, The University of Edinburgh
All Rights Reserved

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <name>Jacomax samples</name>
  <artifactId>jacomax-samples</artifactId>
  <packaging>jar</packaging>
  <parent>
    <groupId>uk.ac.ed.ph.jacomax</groupId>
    <artifactId>jacomax-parent</artifactId>
    <version>0.2-SNAPSHOT</version>
  </parent>
  <dependencies>
    <dependency>
      <groupId>uk.ac.ed.ph.jacomax</groupId>
      <artifactId>jacomax</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j.version}</version>
      <scope>runtime</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <!--
      Plugin for running the samples and diagnostics.

      To run the diagnostic helper, do:

      $ mvn exec:exec -Dexample.class=uk.ac.ed.ph.jacomax.diagnostics.JacomaxDiagnostic

      To run the examples, do something like:

      $ mvn exec:exec -Dexample.class=uk.ac.ed.ph.jacomax.samples.InteractiveProcessExample

      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2</version>
        <configuration>
          <executable>java</executable>
          <classpathScope>runtime</classpathScope>
          <arguments>
            <argument>-classpath</argument>
            <classpath/>
            <argument>${example.class}</argument>
          </arguments>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
> ES6 [`String.includes()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) [ponyfill](https://ponyfill.com)

> Ponyfill: A polyfill that doesn't overwrite the native method

## Install

```
$ npm install --save string-includes
```

## Usage

```js
const stringIncludes = require('string-includes');

stringIncludes('unicorns and rainbows', 'unicorns');
//=> true

stringIncludes('unicorns and rainbows', 'rainbows');
//=> true

stringIncludes('unicorns and rainbows', 'unicorns', 1);
//=> false
```

## API

### stringIncludes(string, searchString, [position])

#### string

Type: `string`

The string to search in.

#### searchString

Type: `string`

A string to be searched for.

#### position

Type: `Number`<br>
Default: `0`

The position in this string at which to begin searching for `searchString`.

## License

MIT © [Kevin Martensson](https://github.com/kevva)


text:
// Copyright 2010 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.

// This code was generated by google-apis-code-generator 1.5.1
//   Build date: 2016-07-08 17:28:43 UTC
//   on: 2016-08-08, 17:19:17 UTC
//   C++ generator version: 0.1.4

// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
//   Gmail API (gmail/v1)
// Generated from:
//   Version: v1
//   Revision: 48
// Generated by:
//    Tool: google-apis-code-generator 1.5.1
//     C++: 0.1.4
#ifndef  GOOGLE_GMAIL_API_LIST_LABELS_RESPONSE_H_
#define  GOOGLE_GMAIL_API_LIST_LABELS_RESPONSE_H_

#include "googleapis/base/macros.h"
#include "googleapis/client/data/jsoncpp_data.h"
#include "googleapis/strings/stringpiece.h"

#include "google/gmail_api/label.h"

namespace Json {
class Value;
}  // namespace Json

namespace google_gmail_api {
using namespace googleapis;

/**
 * No description provided.
 *
 * @ingroup DataObject
 */
class ListLabelsResponse : public client::JsonCppData {
 public:
  /**
   * Creates a new default instance.
   *
   * @return Ownership is passed back to the caller.
   */
  static ListLabelsResponse* New();

  /**
   * Standard constructor for an immutable data object instance.
   *
   * @param[in] storage  The underlying data storage for this instance.
   */
  explicit ListLabelsResponse(const Json::Value& storage);

  /**
   * Standard constructor for a mutable data object instance.
   *
   * @param[in] storage  The underlying data storage for this instance.
   */
  explicit ListLabelsResponse(Json::Value* storage);

  /**
   * Standard destructor.
   */
  virtual ~ListLabelsResponse();

  /**
   * Returns a string denoting the type of this data object.
   *
   * @return google_gmail_api::ListLabelsResponse
   */
  const StringPiece GetTypeName() const {
    return StringPiece("google_gmail_api::ListLabelsResponse");
  }

  /**
   * Determine if the 'labels' attribute was set.
   *
   * @return true if the 'labels' attribute was set.
   */
  bool has_labels() const {
    return Storage().isMember("labels");
  }

  /**
   * Clears the 'labels' attribute.
   */
  void clear_labels() {
    MutableStorage()->removeMember("labels");
  }

  /**
   * Get a reference to the value of the 'labels' attribute.
   */
  const client::JsonCppArray get_labels() const;

  /**
   * Gets a reference to a mutable value of the 'labels' property.
   *
   * List of labels.
   *
   * @return The result can be modified to change the attribute value.
   */
  client::JsonCppArray mutable_labels();

 private:
  void operator=(const ListLabelsResponse&);
};  // ListLabelsResponse
}  // namespace google_gmail_api
#endif  // GOOGLE_GMAIL_API_LIST_LABELS_RESPONSE_H_


text:
'use strict';

describe('Service: stAlert', function () {

  // load the service's module
  beforeEach(module('yololiumApp'));

  // instantiate service
  var stAlert;
  beforeEach(inject(function (_stAlert_) {
    stAlert = _stAlert_;
  }));

  it('should do something', function () {
    expect(!!stAlert).toBe(true);
  });

});


text:
'use strict';

var React = require('react/addons');
var ModalProgressTrigger = require('./ModalProgressTrigger.js');
var ModalProgressTriggerAction = require('../action/ModalProgressTriggerActions.js');
var ModalProjectSettingsTriggerActions = require('../action/ModalProjectSettingsTriggerActions.js');
var ModalFileListUploadTriggerActions = require('../action/ModalFileListUploadTriggerActions.js');
var Button = require('react-bootstrap').Button;
var DeskAction = require('../action/DeskActions.js');
var ApplicationActions = require('../action/ApplicationActions.js');
var DeskPageFrameActions = require('../action/DeskPageFrameActions.js');

var cx = React.addons.classSet;

var ToolbarLeft = React.createClass({

    componentDidMount: function(){

    },

    render: function(){

        var leftSideStyle = {
            'position': 'absolute',
            'top': 0,
            'left': 0,
            'bottom': 0
        };

        var leftSideStyleInner = {
            'position': 'relative',
            'minWidth': '4em',
            'width': '4em',
            'padding': '0 0.5em 0 0.5em'
        };

        var btnGroupStyle = {
            'width': '100%',
            'textAlign': 'center'
        };

        return (

                                 Project settings

                                 Publish project

                                 Forum / Help

                                 Close project

                    <Button
                        bsStyle={this.props.isAvailableComponentsButtonActive ? 'primary' : 'default'}
                        style={{marginTop: '1em', width: '100%'}}
                        disabled={!this.props.isEditMode}
                        onClick={DeskAction.toggleAvailableComponents}>

                    </Button>

                    <Button
                        bsStyle={this.props.isComponentsHierarchyButtonActive ? 'primary' : 'default'}
                        style={{marginTop: '0.25em', width: '100%'}}
                        disabled={!this.props.isEditMode}
                        onClick={DeskAction.toggleComponentsHierarchy}>

                    </Button>

                    {/*<Button
                        bsStyle={this.props.isStyleOptionsButtonActive ? 'primary' : 'default'}
                        style={{marginTop: '0.25em', width: '100%'}}
                        disabled={!this.props.isEditMode}
                        onClick={DeskAction.toggleStyleOptions}>

                    </Button>*/}

                    <Button
                        bsStyle={this.props.isEditMode ? 'primary' : 'default'}
                        style={{marginTop: '1em', width: '100%'}}
                        onClick={DeskAction.startEditMode}>

                    </Button>

                    <Button
                        bsStyle={this.props.isLivePreviewMode ? 'primary' : 'default'}
                        style={{marginTop: '0.25em', width: '100%'}}
                        onClick={DeskAction.startLivePreviewMode}>

                    </Button>

        )

    },

    _handleDummy: function(e){
        e.stopPropagation();
        e.preventDefault();
    },

    _handlePublishProject: function(e){
        e.stopPropagation();
        e.preventDefault();
        ModalFileListUploadTriggerActions.showModal();
    },

    _handleProjectSettings: function(e){
        e.stopPropagation();
        e.preventDefault();
        ModalProjectSettingsTriggerActions.showModal();
    },

    _handleShowProjectComponents: function(e){
        e.stopPropagation();
        e.preventDefault();
        DeskPageFrameActions.showProjectComponents();
    }

});

module.exports = ToolbarLeft;