text:
(function () {

    // Main module
    var app = angular.module('odalic-app');

    // Current folder
    var currentFolder = $.getPathForRelativePath('');

    // Create a controller for task-creation screen
    app.controller('odalic-kbconfig-ctrl', function ($scope, $location, $routeParams, rest, formsval, reporth, persist, datamap) {

        // Initialization
        $scope.dataload = {};
        $scope.predicateSetsProxy = {};
        $scope.alerts = [];
        $scope.confirm = {};
        $scope.predicateSetsAlerts = [];
        $scope.modalEmptyEndpoint = {};
        $scope.activeTab = 0;
        formsval.toScope($scope);

        // Are we editing an existing configuration, or creating a new one?
        $scope.edited = $routeParams['kbid'];
        $scope.editing = !!$scope.edited;
        $scope.cloning = false;
        if ($scope.editing) {
            // Maybe we are just cloning an existing configuration?
            var urlParts = $location.absUrl().split('/');
            if (urlParts[urlParts.length - 2] === 'clone') {
                $scope.editing = false;
                $scope.cloning = true;
            }
        }

        // Predicate sets
        $scope.predicateSets = {
            data: [],
            load: function (callback) {
                rest.pcg.list.all().exec(
                    // Success
                    function (response) {
                        // Copy the data
                        $scope.predicateSets.data = response;

                        // Update pagination directive
                        $scope.predicateSetsProxy.model = $scope.predicateSets.data;
                        $scope.$broadcast('pagination');

                        // Callback
                        objhelp.callDefined(callback);
                    },
                    // Failure
                    function (response) {
                        $scope.alerts.push('error', reporth.constrErrorMsg($scope['msgtxt.loadFailure'], response.data));
                    }
                );
            },
            getIndex: function (psID) {
                var data = $scope.predicateSets.data;
                for (var i = 0; i < data.length; i++) {
                    if (data[i].id === psID) {
                        return i;
                    }
                }

                return -1;
            },
            remove: function (psID, callback) {
                rest.pcg.name(psID).remove.exec(
                    // Success
                    function (response) {
                        // Remove from the array
                        var ps = $scope.predicateSets;
                        ps.data.splice(ps.getIndex(psID), 1);

                        // Callback
                        objhelp.callDefined(callback);
                    },
                    // Failure
                    function (response) {
                        $scope.predicateSetsAlerts.push('error', reporth.constrErrorMsg($scope['msgtxt.removeFailure'], response.data));
                    }
                );
            },
            getSelected: function () {
                var ps = [];
                $scope.predicateSets.data.forEach(function (item) {
                    if (item.selected === true) {
                        ps.push(item.id);
                    }
                });

                return ps;
            },
            setSelected: function (idArray) {
                // Fill a data structure for easing the search
                var selected = {};
                idArray.forEach(function (item) {
                    selected[item] = true;
                });

                // Set 'selected' property
                $scope.predicateSets.data.forEach(function (item) {
                    item.selected = !!(item.id in selected);
                });
            }
        };

        // Page variables
        $scope.pageVariables = {
            identifier: text.empty(),
            description: text.empty(),
            endpoint: text.empty(),
            method: 'fulltext',
            languageTag: 'en',
            skippedAttributes: [],
            skippedClasses: [],
            predicateSets: [],
            autodetect: true,
            insertEnabled: false,
            insertEndpoint: text.empty(),
            insertGraph: text.empty(),
            userClassesPrefix: text.empty(),
            userResourcePrefix: text.empty(),
            objectProperty : text.empty(),
            datatypeProperty: text.empty(),
            login: text.empty(),
            password: text.empty(),
            type: {},
            keyValuePairs: []
        };

        // Data mapping
        var mapper = (function () {
            var mapFromList = function (item, index) {
                return item.value;
            };
            var mapToList = function (item, index) {
                return {
                    id: index,
                    value: item
                };
            };

            return datamap.create([
                ['identifier', 'name'],
                ['description', 'description'],
                ['endpoint', 'endpoint'],
                ['method', 'textSearchingMethod'],
                ['languageTag', 'languageTag'],
                ['skippedAttributes', 'skippedAttributes', mapFromList, mapToList],
                ['skippedClasses', 'skippedClasses', mapFromList, mapToList],
                ['insertEnabled', 'insertEnabled'],
                ['insertEndpoint', 'insertEndpoint'],
                ['insertGraph', 'insertGraph'],
                ['userClassesPrefix', 'userClassesPrefix'],
                ['userResourcePrefix', 'userResourcesPrefix'],
                ['objectProperty', 'objectProperty'],
                ['datatypeProperty', 'datatypeProperty'],
                ['autodetect', 'groupsAutoSelected'],
                ['login', 'login'],
                ['password', 'password'],

                // Selected predicate sets
                ['predicateSets', 'selectedGroups', '1->2', function (object1) {
                    return $scope.predicateSets.getSelected();
                }],
                ['predicateSets', 'selectedGroups', '2->1', function (object2) {
                    $scope.predicateSets.setSelected(object2);
                    return $scope.predicateSets.data;
                }],

                // Type
                ['type', 'advancedType', '1->2', function (object1) {
                    return object1.name;
                }],
                ['type', 'advancedType', '2->1', function (object2) {
                    var kv = $scope.keyValues;
                    return kv.data[kv.getIndex(object2)];
                }],

                // Custom key-value pairs
                ['keyValuePairs', 'advancedProperties', '1->2', function (object1) {
                    var object2 = {};
                    object1.forEach(function (item) {
                        object2[item.key] = item.value;
                    });

                    return object2;
                }],
                ['keyValuePairs', 'advancedProperties', '2->1', function (object2) {
                    var object1 = [];
                    objhelp.objForEach(object2, function (key, value) {
                        object1.push({
                            key: key,
                            value: value,
                            comment: text.empty()
                        });
                    });

                    return object1;
                }]
            ]);
        })();

        // Key-values
        $scope.keyValues = {
            data: [],
            load: function (callback) {
                rest.abt.list.exec(
                    // Success
                    function (response) {
                        // Copy the data
                        $scope.keyValues.data = response;

                        // Callback
                        objhelp.callDefined(callback);
                    },
                    // Failure
                    function (response) {
                        $scope.alerts.push('error', reporth.constrErrorMsg($scope['msgtxt.loadFailure'], response.data));
                    }
                );
            },
            getIndex: function (name) {
                var data = $scope.keyValues.data;
                for (var i = 0; i < data.length; i++) {
                    if (data[i].name === name) {
                        return i;
                    }
                }

                return -1;
            }
        };

        // Save state
        var saveState = function () {
            var context = persist.context.create('kbconfig');
            context.routeParam = $scope.edited;
            context.wasCloning = $scope.cloning;
            context.pageVariables = objhelp.objCopy($scope.pageVariables, 0);
            context.predicateSetsVariables = $scope.predicateSets.getSelected();
        };

        // Open an end-point URL
        $scope.fopenEndPoint = function () {
            window.open($scope.pageVariables.endpoint);
        };

        // Configure a predicate set
        $scope.fconfigure = function (psID) {
            // Save state
            saveState();

            // Redirect to the corresponding screen
            window.location.href = text.urlConcat('#', 'setproperties', psID);
        };

        // Remove a predicate set
        $scope.fremove = function (psID) {
            $scope.predicateSets.remove(psID, function () {
                // Update pagination directive
                $scope.$broadcast('pagination');
            });
        };

        // Add to predicate sets
        $scope.psAdd = function () {
            // Save state
            saveState();

            // Redirect to the corresponding screen
            window.location.href = '#/setproperties/';
        };

        // Fill key-values table with default data
        $scope.kvFill = function () {
            var pv = $scope.pageVariables;
            var type = pv.type;

            var result = [];
            type.keys.forEach(function (key) {
                result.push({
                    key: key,
                    value: text.safe(type.keysToDefaultValues[key]),
                    comment: text.safe(type.keysToComments[key])
                });
            });

            pv.keyValuePairs = result;
        };

        // Add to key-values
        $scope.kvAdd = function () {
            $scope.pageVariables.keyValuePairs.push({
                key: text.empty(),
                value: text.empty(),
                comment: text.empty()
            });
        };

        // Remove from key-values
        $scope.kvRemove = function (record) {
            var kvp = $scope.pageVariables.keyValuePairs;
            kvp.splice(kvp.indexOf(record), 1);
        };

        // Cancel
        $scope.cancel = function () {
            window.location.href = '#/kblist/';
        };

        // Save
        $scope.save = function (f) {
            // Validate the form
            if (!formsval.validateNonNested($scope.kbConfigForm)) {
                f();
                return;
            }

            // Generic preparations
            var kbID = $scope.pageVariables.identifier;

            // Editing
            if ($scope.editing) {
                rest.bases.name(kbID).create(mapper.mapToObject2($scope.pageVariables)).exec(
                    // Success
                    function (response) {
                        $scope.cancel();
                    },
                    // Failure
                    function (response) {
                        $scope.alerts.push('error', reporth.constrErrorMsg($scope['msgtxt.saveFailure'], response.data));
                        f();
                    }
                );
            }
            // Creating
            else {
                var create = function () {
                    rest.bases.name(kbID).create(mapper.mapToObject2($scope.pageVariables)).exec(
                        // Success
                        function (response) {
                            $scope.cancel();
                        },
                        // Failure
                        function (response) {
                            $scope.alerts.push('error', reporth.constrErrorMsg($scope['msgtxt.saveFailure'], response.data));
                            f();
                        }
                    );
                };

                // Handle overwrites
                rest.bases.name(kbID).exists(
                    function () {
                        $scope.confirm.open(function (response) {
                            if (response === true) {
                                create();
                            } else {
                                f();
                                if (!$scope.$$phase) {
                                    $scope.$apply();
                                }
                            }
                        });
                    },
                    create
                );
            }
        };

        // Firefox password pre-fill 'bugfix' (or hack)
        $scope.changeToPassword = (function() {
            var changed = false;

            return function () {
                if (!changed) {
                    var element = document.getElementsByName('kbcpassword')[0];
                    element.type = 'password';
                    changed = true;
                }
            };
        })();

        // Data loading
        (function () {
            // Additional actions once all the data is loaded
            var afterLoad = function () {
                persist.context.remove('kbconfig');
                $scope.dataload.show = true;

                // Change password type if already filled
                if (!!$scope.pageVariables.password) {
                    timed.executeAfterDigest(function () {
                        $scope.changeToPassword();
                    });
                }
            };

            // Load the data to table of "Predicate and Class Groups"
            $scope.predicateSets.load(function () {

            // Load the data for 'advanced type' combobox
            $scope.keyValues.load(function () {

                // Gather data
                var hasContext = persist.context.contains('kbconfig');
                var context = objhelp.getFirstArg(persist.context.get('kbconfig'), {});
                var routeParam = $scope.edited;

                // Option 1: the page was already visited and has a saved state
                if (hasContext && (context.routeParam === routeParam)) {
                    // Load data from the saved state
                    $scope.pageVariables = objhelp.objCopy(context.pageVariables, 0);
                    $scope.predicateSets.setSelected(context.predicateSetsVariables);

                    // Special case: selected type (cannot copy an object; must be an object reference for ng-options)
                    var kv = $scope.keyValues;
                    $scope.pageVariables.type = kv.data[kv.getIndex($scope.pageVariables.type.name)];

                    // Change the active tab to 'Search'
                    $scope.activeTab = 1;

                    // Everything loaded and set
                    afterLoad();

                    // Scroll to the bottom of the page once DOM is loaded
                    timed.executeAfterDigest(function () {
                        window.scrollTo(0, document.body.scrollHeight);
                    });
                }
                // Option 2: we are editing an existing knowledge base configuration
                else if (routeParam) {
                    // Load data from the server
                    var kbID = routeParam;
                    rest.bases.name(kbID).retrieve.exec(
                        // Success
                        function (response) {
                            // Load data
                            $scope.pageVariables = mapper.mapToObject1(response);

                            // Everything loaded
                            afterLoad();
                        },

                        // Failure
                        function (response) {
                            $scope.alerts.push('error', reporth.constrErrorMsg($scope['msgtxt.loadFailure'], response.data));
                            afterLoad();
                        }
                    );
                }
                // Option 3: we are creating a completely new knowledge base configuration
                else {
                    // Special case: selected type default to first type
                    $scope.pageVariables.type = $scope.keyValues.data[0];

                    afterLoad();
                }

            })});
        })();

        // Redirect to login screen if not logged
        rest.users.test.automatic.exec(objhelp.emptyFunction);

    });

})();


text:
namespace Kingdom.OrTools.ConstraintSolver
{
    using Google.OrTools.ConstraintSolver;

    /// <inheritdoc />
    public class ReceiveAssignmentEventArgs : AgentEventArgsBase
    {
        /// <summary>
        /// Gets the Assignment.
        /// </summary>
        public Assignment Assignment { get; internal set; }

        internal ReceiveAssignmentEventArgs(Solver solver)
            : base(solver)
        {
        }

        internal ReceiveAssignmentEventArgs(Solver solver, Assignment assignment)
            : base(solver)
        {
            Assignment = assignment;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package net.daw.dao.implementation;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import net.daw.bean.implementation.ReciboBean;
import net.daw.dao.publicinterface.TableDaoInterface;
import net.daw.dao.publicinterface.ViewDaoInterface;
import net.daw.data.implementation.MysqlDataSpImpl;
import net.daw.helper.statics.AppConfigurationHelper;
import net.daw.helper.statics.ExceptionBooster;
import net.daw.helper.statics.FilterBeanHelper;
import net.daw.helper.statics.SqlBuilder;

public class ReciboDao implements ViewDaoInterface<ReciboBean>, TableDaoInterface<ReciboBean> {

    private String strTable = "recibo";
    private String strSQL = "select * from recibo where 1=1 ";
    private MysqlDataSpImpl oMysql = null;
    private Connection oConnection = null;

    public ReciboDao(Connection oPooledConnection) throws Exception {
        try {
            oConnection = oPooledConnection;
            oMysql = new MysqlDataSpImpl(oConnection);
        } catch (Exception ex) {
            ExceptionBooster.boost(new Exception(this.getClass().getName() + ":constructor ERROR: " + ex.getMessage()));
        }
    }

    @Override
    public int getPages(int intRegsPerPag, ArrayList<FilterBeanHelper> hmFilter) throws Exception {
        strSQL += SqlBuilder.buildSqlWhere(hmFilter);
        int pages = 0;
        try {
            pages = oMysql.getPages(strSQL, intRegsPerPag);
        } catch (Exception ex) {
            ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getPages ERROR: " + ex.getMessage()));
        }
        return pages;
    }

    @Override
    public int getCount(ArrayList<FilterBeanHelper> hmFilter) throws Exception {
        strSQL += SqlBuilder.buildSqlWhere(hmFilter);
        int pages = 0;
        try {
            pages = oMysql.getCount(strSQL);
        } catch (Exception ex) {
            ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getCount ERROR: " + ex.getMessage()));
        }
        return pages;
    }

    @Override
    public ArrayList<ReciboBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBeanHelper> hmFilter, HashMap<String, String> hmOrder, Integer expand) throws Exception {
        strSQL += SqlBuilder.buildSqlWhere(hmFilter);
        strSQL += SqlBuilder.buildSqlOrder(hmOrder);
        strSQL += SqlBuilder.buildSqlLimit(oMysql.getCount(strSQL), intRegsPerPag, intPage);
        ArrayList<ReciboBean> arrRecibo = new ArrayList<>();
        try {
            ResultSet oResultSet = oMysql.getAllSql(strSQL);
            if (oResultSet != null) {
                while (oResultSet.next()) {
                    ReciboBean oReciboBean = new ReciboBean();
                    arrRecibo.add(oReciboBean.fill(oResultSet, oConnection, expand));
                }
            }
        } catch (Exception ex) {
            ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
        }
        return arrRecibo;
    }

    @Override
    public ArrayList<ReciboBean> getAll(ArrayList<FilterBeanHelper> alFilter, HashMap<String, String> hmOrder, Integer expand) throws Exception {
        strSQL += SqlBuilder.buildSqlOrder(hmOrder);
        ArrayList<ReciboBean> arrRecibo= new ArrayList<>();
        try {
            ResultSet oResultSet = oMysql.getAllSql(strSQL);
            if (oResultSet != null) {
                while (oResultSet.next()) {
                    ReciboBean oReciboBean = new ReciboBean();
                    arrRecibo.add(oReciboBean.fill(oResultSet, oConnection, expand));
                }
            }
        } catch (Exception ex) {
            ExceptionBooster.boost(new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
        }
        return arrRecibo;
    }

    @Override
    public ReciboBean get(ReciboBean oReciboBean, Integer expand) throws Exception {
        if (oReciboBean.getId() > 0) {
            try {
                ResultSet oResultSet = oMysql.getAllSql(strSQL + " And id= " + oReciboBean.getId() + " ");
                if (oResultSet != null) {
                    while (oResultSet.next()) {
                        oReciboBean = oReciboBean.fill(oResultSet, oConnection, expand);
                    }
                }
            } catch (Exception ex) {
                ExceptionBooster.boost(new Exception(this.getClass().getName() + ":get ERROR: " + ex.getMessage()));
            }
        } else {
            oReciboBean.setId(0);
        }
        return oReciboBean;
    }

    @Override
    public Integer set(ReciboBean oReciboBean) throws Exception {
          Integer iResult = null;
        try {
            if (oReciboBean.getId() == 0) {
                strSQL = "INSERT INTO " + strTable + " ";
                strSQL += "(" + oReciboBean.getColumns() + ")";
                strSQL += "VALUES(" + oReciboBean.getValues() + ")";
                iResult = oMysql.executeInsertSQL(strSQL);
            } else {
                strSQL = "UPDATE " + strTable + " ";
                strSQL += " SET " + oReciboBean.toPairs();
                strSQL += " WHERE id=" + oReciboBean.getId();
                iResult = oMysql.executeUpdateSQL(strSQL);
            }

        } catch (Exception ex) {
            ExceptionBooster.boost(new Exception(this.getClass().getName() + ":set ERROR: " + ex.getMessage()));
        }
        return iResult;
    }

    @Override
    public Integer remove(Integer id) throws Exception {
        int result = 0;
        try {
            result = oMysql.removeOne(id, strTable);
        } catch (Exception ex) {
            ExceptionBooster.boost(new Exception(this.getClass().getName() + ":remove ERROR: " + ex.getMessage()));
        }
        return result;
    }

}


text:
ALL_IMAGES = \
	gin.svg \
	pagelayout.svg

DITAA = ditaa
DOT = dot
XSLTPROC = xsltproc

all: $(ALL_IMAGES)

%.svg.tmp: %.gv
	$(DOT) -T svg -o $@ $<

%.svg.tmp: %.txt
	$(DITAA) -E -S --svg $< $@

# Post-processing for SVG files coming from other tools
#
# Use --novalid to avoid loading SVG DTD if a file specifies it, since
# it might not be available locally, and we don't need it.
%.svg: %.svg.tmp fixup-svg.xsl
	$(XSLTPROC) --novalid -o $@ $(word 2,$^) $<


text:
namespace is
{
  class GenerateMap
  {
   public:
    GenerateMap(std::string const &fileName);

    virtual ~GenerateMap();

    void generate();

    void initMap();

    int fillMap(std::string const &line);

    unsigned int genRandNumber(unsigned int min, unsigned int max);

    void startGeneration();

    void genRandBorder(unsigned int col);

    unsigned int nbOfBlock();

    std::vector<int> &getMap();

   private:
    unsigned int _nbBlock;
    std::vector<int> _map;
    std::string _mapFile;
    int _X;
    int _Y;
  };
}

#endif //MAP_GENERATEMAP_HPP


text:
from pyramid.renderers import render

from seth.tests import IntegrationTestBase, UnitTestBase
from seth.renderers import BaseSethRenderer, SethRendererException

class BaseRendererTestCase(UnitTestBase):

    def test_base_renderer_class(self):
        request = self.get_csrf_request()
        renderer = BaseSethRenderer()
        # Test prepare response flow
        renderer.prepare_response(request, 'text/html', file_name='file.pdf')

class CsvRendererTestCase(IntegrationTestBase):

    def extend_app_configuration(self, config):
        config.include('seth')

    def test_csv_renderer_raises_exception_when_inappropriate_params(self):
        self.assertRaises(SethRendererException, lambda: render('csv', {}))

    def test_csv_renderer_render_empty_rows(self):
        body = render('csv', {'rows': []})
        self.assertEqual(body, u"")

    def test_csv_renderer_is_succesful(self):
        body = render('csv', {'rows': [('a', 'b'), ('c', 'd')]})
        assert body
        for el in ['a', 'b', 'c', 'd']:
            self.assertIn(el, body)

    def test_csv_renderer_with_header_is_succesful(self):
        body = render('csv', {'header': ('d1', 'd2'), 'rows': [('a', 'b'), ('c', 'd')]})
        assert body
        for el in ['d1', 'd2', 'a', 'b', 'c', 'd']:
            self.assertIn(el, body)

class PdfRendererTestCase(IntegrationTestBase):

    def extend_app_configuration(self, config):
        config.include('seth')

    def test_pdf_renderer_raises_exception_when_inappropriate_params(self):
        self.assertRaises(SethRendererException, lambda: render('pdf', {}))
        self.assertRaises(SethRendererException, lambda: render('pdf', {'template': 'ads.txt'}))

    def test_pdf_renderer_render_empty_html(self):
        body = render('pdf', {'html': ''})
        assert body

    def test_pdf_renderer_is_succesful(self):
        body = render('pdf', {'html': 'aasd'})
        assert body

    def test_wrong_html_raises_pdf_error(self):
        self.assertRaises(SethRendererException, lambda: render('pdf', {'html': 123123123123}))


text:
MODULES=gplibpq
PG_CONFIG=pg_config

subdir = src/test/walrep
top_builddir = ../../..

include $(top_builddir)/src/Makefile.global

REGRESS = setup
REGRESS += replication_views_mirrored missing_xlog walreceiver generate_ao_xlog generate_aoco_xlog

NO_PGXS = 1
include $(top_srcdir)/src/makefiles/pgxs.mk

# Ease the top-level Makefile's job a little bit, and install supporting
# libraries as part of installcheck.
installcheck: install


text:
"""
    app
    ~~~

    Provides the flask application
"""
###########################################################################
# WARNING: if running on a a staging server, you MUST set the 'STAGE' env
# heroku config:set STAGE=true --remote staging
###########################################################################
from __future__ import (
    absolute_import, division, print_function, with_statement,
    unicode_literals)

import config

from functools import partial
from inspect import isclass, getmembers
from operator import itemgetter

from savalidation import ValidationError
from sqlalchemy.exc import IntegrityError, OperationalError

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restless import APIManager
from flask.ext.compress import Compress
from flask.ext.cors import CORS

API_EXCEPTIONS = [
    ValidationError, ValueError, AttributeError, TypeError, IntegrityError,
    OperationalError]

db = SQLAlchemy()

__title__ = 'HDX-FILE-PROXY-API'
__author__ = 'Reuben Cummings'
__description__ = 'Service to proxy csv and excel files on HDX'
__email__ = 'reubano@gmail.com'
__version__ = '0.3.0'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 Reuben Cummings'

def _get_tables():
    from . import models

    classes = map(itemgetter(1), getmembers(models, isclass))
    return [t for t in classes if 'app.models' in str(t)]

def create_app(config_mode=None, config_file=None):
    """ Creates the Flask application

    Kwargs:
        config_mode (str): The configuration mode. Must be a `class` in
            `config.py`. One of ('Production', 'Development', 'Test')
        config_file (str): The configuration file.

    Returns:
        (obj): Flask application

    Examples:
        >>> create_app('Test')
        <Flask 'app'>
    """
    app = Flask(__name__)
    mgr = APIManager(app, flask_sqlalchemy_db=db)

    if config_mode:
        app.config.from_object(getattr(config, config_mode))
    elif config_file:
        app.config.from_pyfile(config_file)
    else:
        app.config.from_envvar('APP_SETTINGS', silent=True)

    db.init_app(app)
    CORS(app)
    Compress(app)

    @app.route('%s/' % app.config['API_URL_PREFIX'])
    def home():
        return 'Welcome to the HDX File Proxy API!'

    kwargs = {
        'methods': app.config['API_METHODS'],
        'validation_exceptions': API_EXCEPTIONS,
        'max_results_per_page': app.config['API_MAX_RESULTS_PER_PAGE'],
        'url_prefix': app.config['API_URL_PREFIX']}

    # Create API endpoints from `models.py`. Each model is available at
    # the endpoint `/<tablename>`.
    create_api = partial(mgr.create_api, **kwargs)

    with app.app_context():
        map(create_api, _get_tables())

    return app


text:
#ifndef _COMMANDLINE_H
#define _COMMANDLINE_H

/* command line structure */
typedef struct commandline_t {
    /* video stuff */
    int video_resolution;
    int smooth_graphics;
    int fullscreen; /* fullscreen mode? */
    int color_depth; /* bits per pixel */
    int show_fps;

    /* run custom level */
    int custom_level; /* user needs to run a custom level? */
    char custom_level_path[1024]; /* filepath */

    /* run custom quest */
    int custom_quest; /* user needs to run a custom quest? */
    char custom_quest_path[1024]; /* filepath */

    /* other */
    char language_filepath[1024];
    char basedir[1024];
    int use_gamepad;
    int optimize_cpu_usage;
    int allow_font_smoothing;
} commandline_t;

/* command line interface */
commandline_t commandline_parse(int argc, char **argv);

#endif


text:
> Documentation and development interface for component libraries

# @patternplate/client

* Framework independent
* Bring design docs to live with real components
* Powerful search and meta data system

This is the contributor documentation for `@patternplate/cli`
For user docs see [patternplate.github.io](https://patternplate.github.io)

## About @patternplate/client

`@patternplate/client` is a universally rendering application that provides
the GUI available at `http://localhost:1337` when executing `patternplate start`.

The client entry point is `src/client`, the server entry point `src/server`.

`@patternplate/client` also provides means to export required client
assets statically.

`@patternplate/client` interfaces with `@patternplate/api` to fetch data
and uses fronted compenents `@patternplate/components`.

## Quick start

```sh
git clone https://github.com/patternplate/patternplate.git
cd patternplate/packages/client
yarn
yarn start
```

## Usage

### Use the express middleware

```js
const client = require("@patternplate/client");

(async () => {
  const app = express();
  const server = http.createServer(app);

  const clientMiddleware = await client({
    cwd: options.cwd,
    config: options.config,
    server
  });

  app.use(clientMiddleware);
})();
```

### Render a page

```js
const render = require("@patternplate/client/render");

(async () => {
  const html = await render("/", {
    base: "" // base url to assume, e.g. patternplate in https://git.io/patternplate,
    config: {},
    schema: {
      meta: {}, // pattern tree, see @patternplate/load-meta
      docs: {} // pattern docs, see @patternplate/load-docs
    },
    isStatic:
  });
})();
```

### Eject a virtual fs with static assets

```js
const eject = require("@patternplate/client/eject");

(async () => {
  const vfs = await eject(); // MemoryFilesystem({ /static/, /lib/ });
})();
```

## License

Copyright by SinnerSchrader. All `@patternplate` packages are released under the MIT license.


text:
using base::RecordAction;
using base::UserMetricsAction;

namespace app_list {

namespace {

bool InSpeechRecognition(SpeechRecognitionState state) {
  return state == SPEECH_RECOGNITION_RECOGNIZING ||
      state == SPEECH_RECOGNITION_IN_SPEECH;
}

}

class StartPageService::ProfileDestroyObserver
    : public content::NotificationObserver {
 public:
  explicit ProfileDestroyObserver(StartPageService* service)
      : service_(service) {
    registrar_.Add(this,
                   chrome::NOTIFICATION_PROFILE_DESTROYED,
                   content::Source<Profile>(service_->profile()));
  }
  virtual ~ProfileDestroyObserver() {}

 private:
  // content::NotificationObserver
  virtual void Observe(int type,
                       const content::NotificationSource& source,
                       const content::NotificationDetails& details) OVERRIDE {
    DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
    DCHECK_EQ(service_->profile(), content::Source<Profile>(source).ptr());
    service_->Shutdown();
  }

  StartPageService* service_;  // Owner of this class.
  content::NotificationRegistrar registrar_;

  DISALLOW_COPY_AND_ASSIGN(ProfileDestroyObserver);
};

class StartPageService::StartPageWebContentsDelegate
    : public content::WebContentsDelegate {
 public:
  StartPageWebContentsDelegate() {}
  virtual ~StartPageWebContentsDelegate() {}

  virtual void RequestMediaAccessPermission(
      content::WebContents* web_contents,
      const content::MediaStreamRequest& request,
      const content::MediaResponseCallback& callback) OVERRIDE {
    if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback))
      NOTREACHED() << "Media stream not allowed for WebUI";
  }

  virtual bool CheckMediaAccessPermission(
      content::WebContents* web_contents,
      const GURL& security_origin,
      content::MediaStreamType type) OVERRIDE {
    return MediaCaptureDevicesDispatcher::GetInstance()
        ->CheckMediaAccessPermission(web_contents, security_origin, type);
  }

 private:
  DISALLOW_COPY_AND_ASSIGN(StartPageWebContentsDelegate);
};

// static
StartPageService* StartPageService::Get(Profile* profile) {
  return StartPageServiceFactory::GetForProfile(profile);
}

StartPageService::StartPageService(Profile* profile)
    : profile_(profile),
      profile_destroy_observer_(new ProfileDestroyObserver(this)),
      recommended_apps_(new RecommendedApps(profile)),
      state_(app_list::SPEECH_RECOGNITION_OFF),
      speech_button_toggled_manually_(false),
      speech_result_obtained_(false) {
  // If experimental hotwording is enabled, then we're always "ready".
  // Transitioning into the "hotword recognizing" state is handled by the
  // hotword extension.
  if (HotwordService::IsExperimentalHotwordingEnabled())
    state_ = app_list::SPEECH_RECOGNITION_READY;

  if (app_list::switches::IsExperimentalAppListEnabled())
    LoadContents();
}

StartPageService::~StartPageService() {}

void StartPageService::AddObserver(StartPageObserver* observer) {
  observers_.AddObserver(observer);
}

void StartPageService::RemoveObserver(StartPageObserver* observer) {
  observers_.RemoveObserver(observer);
}

void StartPageService::AppListShown() {
  if (!contents_) {
    LoadContents();
  } else {
    // If experimental hotwording is enabled, don't enable hotwording in the
    // start page, since the hotword extension is taking care of this.
    bool hotword_enabled = HotwordEnabled() &&
        !HotwordService::IsExperimentalHotwordingEnabled();
    contents_->GetWebUI()->CallJavascriptFunction(
        "appList.startPage.onAppListShown",
        base::FundamentalValue(hotword_enabled));
  }
}

void StartPageService::AppListHidden() {
  contents_->GetWebUI()->CallJavascriptFunction(
      "appList.startPage.onAppListHidden");
  if (!app_list::switches::IsExperimentalAppListEnabled())
    UnloadContents();
}

void StartPageService::ToggleSpeechRecognition() {
  speech_button_toggled_manually_ = true;
  contents_->GetWebUI()->CallJavascriptFunction(
      "appList.startPage.toggleSpeechRecognition");
}

bool StartPageService::HotwordEnabled() {
  if (HotwordService::IsExperimentalHotwordingEnabled()) {
    return HotwordServiceFactory::IsServiceAvailable(profile_) &&
        profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled);
  }
#if defined(OS_CHROMEOS)
  return HotwordServiceFactory::IsServiceAvailable(profile_) &&
      profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled);
#else
  return false;
#endif
}

content::WebContents* StartPageService::GetStartPageContents() {
  return app_list::switches::IsExperimentalAppListEnabled() ? contents_.get()
                                                            : NULL;
}

content::WebContents* StartPageService::GetSpeechRecognitionContents() {
  if (app_list::switches::IsVoiceSearchEnabled()) {
    if (!contents_)
      LoadContents();
    return contents_.get();
  }
  return NULL;
}

void StartPageService::OnSpeechResult(
    const base::string16& query, bool is_final) {
  if (is_final) {
    speech_result_obtained_ = true;
    RecordAction(UserMetricsAction("AppList_SearchedBySpeech"));
  }
  FOR_EACH_OBSERVER(StartPageObserver,
                    observers_,
                    OnSpeechResult(query, is_final));
}

void StartPageService::OnSpeechSoundLevelChanged(int16 level) {
  FOR_EACH_OBSERVER(StartPageObserver,
                    observers_,
                    OnSpeechSoundLevelChanged(level));
}

void StartPageService::OnSpeechRecognitionStateChanged(
    SpeechRecognitionState new_state) {
  if (!InSpeechRecognition(state_) && InSpeechRecognition(new_state)) {
    if (!speech_button_toggled_manually_ &&
        state_ == SPEECH_RECOGNITION_HOTWORD_LISTENING) {
      RecordAction(UserMetricsAction("AppList_HotwordRecognized"));
    } else {
      RecordAction(UserMetricsAction("AppList_VoiceSearchStartedManually"));
    }
  } else if (InSpeechRecognition(state_) && !InSpeechRecognition(new_state) &&
             !speech_result_obtained_) {
    RecordAction(UserMetricsAction("AppList_VoiceSearchCanceled"));
  }
  speech_button_toggled_manually_ = false;
  speech_result_obtained_ = false;
  state_ = new_state;
  FOR_EACH_OBSERVER(StartPageObserver,
                    observers_,
                    OnSpeechRecognitionStateChanged(new_state));
}

void StartPageService::Shutdown() {
  UnloadContents();
}

void StartPageService::LoadContents() {
  contents_.reset(content::WebContents::Create(
      content::WebContents::CreateParams(profile_)));
  contents_delegate_.reset(new StartPageWebContentsDelegate());
  contents_->SetDelegate(contents_delegate_.get());

  GURL url(chrome::kChromeUIAppListStartPageURL);
  CommandLine* command_line = CommandLine::ForCurrentProcess();
  if (command_line->HasSwitch(::switches::kAppListStartPageURL)) {
    url = GURL(
        command_line->GetSwitchValueASCII(::switches::kAppListStartPageURL));
  }

  contents_->GetController().LoadURL(
      url,
      content::Referrer(),
      ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
      std::string());
}

void StartPageService::UnloadContents() {
  contents_.reset();
}

}  // namespace app_list


text:
namespace IECoreGL
{

void bindPointsPrimitive();

}

#endif // IE_COREGL_POINTSPRIMITIVEBINDING_H


text:
package junit.runner;

import java.util.*;

/**
 * Collects Test class names to be presented
 * by the TestSelector.
 * @see TestSelector
 * {@hide} - Not needed for 1.0 SDK
 */
public interface TestCollector {
    /**
     * Returns an enumeration of Strings with qualified class names
     */
    public Enumeration collectTests();
}


text:
package org.piraso.ui.base;

import org.piraso.api.JacksonUtils;
import org.piraso.ui.api.ExportHandler;
import org.piraso.ui.api.ObjectEntrySettings;
import org.piraso.ui.api.extension.AbstractDialog;
import org.piraso.ui.api.util.NotificationUtils;
import org.piraso.ui.base.manager.ImportExportProviderManager;
import org.piraso.io.impl.PirasoSettingsFileFilter;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.openide.ErrorManager;
import org.openide.filesystems.FileChooserBuilder;
import org.openide.util.NbBundle;

import javax.swing.*;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author adeleon
 */
public class ExportDialog extends AbstractDialog {

    private DefaultTableModel tableModel = new DefaultTableModel(0, 2) {
        @Override
        public boolean isCellEditable(int row, int column) {
            return column == 0;
        }
    };

    private Map<String, ExportHandler> handlers;

    /**
     * Creates new form ExportDialog
     */
    public ExportDialog() {
        super();
        setTitle("Export");
        initComponents();
        initTable();

        addButtonRefreshListeners();
        setLocationRelativeTo(getOwner());
        getRootPane().setDefaultButton(btnExport);

        refresh();
    }

    private void refresh() {
        handlers = new HashMap<String, ExportHandler>();
        List<ExportHandler> options = ImportExportProviderManager.INSTANCE.getExportHandlers();
        tableModel.setRowCount(0);

        if(CollectionUtils.isNotEmpty(options)) {
            for(ExportHandler handler : options) {
                tableModel.addRow(new Object[]{Boolean.FALSE, handler.getOption()});

                handlers.put(handler.getOption(), handler);
            }
        }
    }

    protected void addButtonRefreshListeners() {
        jtable.getSelectionModel().addListSelectionListener(REFRESH_BUTTON_LIST_SELECTION_LISTENER);
        tableModel.addTableModelListener(new TableModelListener() {
            @Override
            public void tableChanged(TableModelEvent e) {
                refreshButtons();
            }
        });
    }

    @Override
    protected void refreshButtons() {
        btnExport.setEnabled(StringUtils.isNotBlank(txtTargetFile.getText()) && hasSelectedOption());
    }

    protected boolean hasSelectedOption() {
        for(int i = 0; i < tableModel.getRowCount(); i++) {
            if((Boolean) tableModel.getValueAt(i, 0)) {
                return true;
            }
        }

        return false;
    }

    private void initTable() {
        TableColumn selectionColumn = jtable.getColumnModel().getColumn(0);
        TableColumn boldOption = jtable.getColumnModel().getColumn(1);

        selectionColumn.setHeaderValue("");
        selectionColumn.setPreferredWidth(30);
        selectionColumn.setMaxWidth(30);
        selectionColumn.setCellEditor(jtable.getDefaultEditor(Boolean.class));
        selectionColumn.setCellRenderer(jtable.getDefaultRenderer(Boolean.class));

        boldOption.setHeaderValue("Option");
        boldOption.setPreferredWidth(200);

        jtable.setShowHorizontalLines(false);
        jtable.setAutoscrolls(true);
        jtable.setColumnSelectionAllowed(false);
        jtable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        jtable.getTableHeader().setReorderingAllowed(false);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtable = new javax.swing.JTable();
        jLabel2 = new javax.swing.JLabel();
        txtTargetFile = new javax.swing.JTextField();
        btnBrowse = new javax.swing.JButton();
        btnExport = new javax.swing.JButton();
        btnCancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText(org.openide.util.NbBundle.getMessage(ExportDialog.class, "ExportDialog.jLabel1.text")); // NOI18N

        jtable.setModel(tableModel);
        jScrollPane1.setViewportView(jtable);

        jLabel2.setText(org.openide.util.NbBundle.getMessage(ExportDialog.class, "ExportDialog.jLabel2.text")); // NOI18N

        txtTargetFile.setEditable(false);
        txtTargetFile.setText(org.openide.util.NbBundle.getMessage(ExportDialog.class, "ExportDialog.txtTargetFile.text")); // NOI18N

        btnBrowse.setText(org.openide.util.NbBundle.getMessage(ExportDialog.class, "ExportDialog.btnBrowse.text")); // NOI18N
        btnBrowse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBrowseActionPerformed(evt);
            }
        });

        btnExport.setText(org.openide.util.NbBundle.getMessage(ExportDialog.class, "ExportDialog.btnExport.text")); // NOI18N
        btnExport.setEnabled(false);
        btnExport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExportActionPerformed(evt);
            }
        });

        btnCancel.setText(org.openide.util.NbBundle.getMessage(ExportDialog.class, "ExportDialog.btnCancel.text")); // NOI18N
        btnCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(12, 12, 12)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(jLabel1)
                        .addContainerGap())
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createSequentialGroup()
                                .add(jLabel2)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(txtTargetFile)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(btnBrowse))
                            .add(jScrollPane1))
                        .add(12, 12, 12))))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(392, Short.MAX_VALUE)
                .add(btnExport)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(btnCancel)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(7, 7, 7)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(txtTargetFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btnBrowse))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(btnCancel)
                    .add(btnExport))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
        dispose();
    }//GEN-LAST:event_btnCancelActionPerformed

    private void btnBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseActionPerformed
        File home = new File (System.getProperty("user.home"));
        File pirasoDir = new File(home, "piraso");
        if(!pirasoDir.isDirectory()) {
            pirasoDir.mkdirs();
        }

        String username = System.getProperty("user.name");

        JFileChooser browserFileChooser = new FileChooserBuilder("piraso-dir")
                .setTitle(NbBundle.getMessage(ExportDialog.class, "ExportDialog.browser.title"))
                .setDefaultWorkingDirectory(pirasoDir)
                .setFileFilter(new PirasoSettingsFileFilter())
                .createFileChooser();

        browserFileChooser.setSelectedFile(new File(pirasoDir, String.format("%s-piraso.settings.prz", username)));
        int result = browserFileChooser.showDialog(this, NbBundle.getMessage(ExportDialog.class, "ExportDialog.browser.approveText"));

        if (JFileChooser.APPROVE_OPTION == result) {
            txtTargetFile.setText(browserFileChooser.getSelectedFile().getAbsolutePath());
            refreshButtons();
        }
    }//GEN-LAST:event_btnBrowseActionPerformed

    private void btnExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportActionPerformed
        ObjectEntrySettings settings = new ObjectEntrySettings();

        for(int i = 0; i < tableModel.getRowCount(); i++) {
            if((Boolean) tableModel.getValueAt(i, 0)) {
                String key = String.valueOf(tableModel.getValueAt(i, 1));
                ExportHandler handler = handlers.get(key);

                settings.add(key, handler.getExportEntry());
            }
        }

        try {
            File file = new File(txtTargetFile.getText());
            JacksonUtils.MAPPER.writeValue(new FileWriter(file), settings);
            NotificationUtils.info(String.format("Export to file '%s' was successful.", file.getName()));
            dispose();
        } catch (IOException e) {
            ErrorManager.getDefault().notify(e);
        }
    }//GEN-LAST:event_btnExportActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBrowse;
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnExport;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jtable;
    private javax.swing.JTextField txtTargetFile;
    // End of variables declaration//GEN-END:variables
}


text:
/** @file
    @brief Implementation

    @date 2015

    @author
    Sensics, Inc.
    <http://sensics.com/osvr>
*/

// Copyright 2015 Sensics, 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.

// Internal Includes
#include <osvr/Common/AliasProcessor.h>
#include <osvr/Common/PathTree.h>
#include <osvr/Common/PathNode.h>
#include <osvr/Common/PathElementTools.h>
#include <osvr/Util/Flag.h>
#include <osvr/Util/TreeTraversalVisitor.h>
#include <osvr/Util/Verbosity.h>
#include <osvr/Common/ParseAlias.h>
#include <osvr/Common/RoutingKeys.h>

#include "PathParseAndRetrieve.h"

// Library/third-party includes
#include <boost/noncopyable.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/erase.hpp>

// Standard includes
// - none

namespace osvr {
namespace common {
    namespace {
        static const char PRIORITY_KEY[] = "$priority";
        static const char WILDCARD_SUFFIX[] = "/*";
        static const size_t WILDCARD_SUFFIX_LEN = sizeof(WILDCARD_SUFFIX) - 1;

        /// @brief Handles wildcards with a functor of your choice: it should
        /// take in a PathNode& node, std::string const& relPath
        /// where relPath is relative to the parent of the wildcard.
        template <typename T>
        inline void applyWildcard(PathNode &node,
                                  std::string const &pathWithWildcard,
                                  T functor) {
            auto startingPath = pathWithWildcard;
            boost::algorithm::erase_tail(startingPath, WILDCARD_SUFFIX_LEN);
            auto &startingNode = treePathRetrieve(node, startingPath);
            auto absoluteStartingPath = getFullPath(startingNode);
            auto absoluteStartingPathLen = absoluteStartingPath.length();
            util::traverseWith(startingNode, [&](PathNode &node) {
                // Don't visit null nodes
                if (elements::isNull(node.value())) {
                    return;
                }
                auto visitPath = getFullPath(node);
                /// This is relative to the initial starting path stem: where we
                /// started the traversal.
                auto relPath = visitPath;
                boost::algorithm::erase_head(relPath,
                                             absoluteStartingPathLen + 1);
                functor(node, relPath);
            });
        }

        /// @brief Predicate that checks if this path contains a wildcard.
        inline bool doesPathContainWildcard(std::string const &path) {
            return boost::algorithm::ends_with(path, WILDCARD_SUFFIX);
        }

        /// @brief Implementation functor for AliasProcessor.
        class AutomaticAliases : boost::noncopyable {
          public:
            AutomaticAliases(PathNode &devNode,
                             detail::AliasProcessorOptions opts)
                : m_devNode(devNode), m_opts(opts) {}

            /// @brief Function call operator: pass any Json::Value. If it is an
            /// object with aliases, or an array of objects with aliases, it
            /// will handle them.
            /// @return whether any changes were made to the tree
            util::Flag operator()(Json::Value const &val) {
                if (val.isArray()) {
                    m_processArray(val);
                } else if (val.isObject()) {
                    m_processObject(val);
                }
                return m_flag;
            }

          private:
            /// @brief Takes in an array of objects, and passes them each, in
            /// order, to m_processObject()
            void m_processArray(Json::Value const &arr) {
                for (auto const &elt : arr) {
                    if (elt.isObject()) {
                        m_processObject(elt);
                    }
                }
            }

            /// @brief Takes in an object, retrieves the priority specified by
            /// the PRIORITY_KEY, if any, then passes all other entries in
            /// the object to m_processEntry() along with the default or
            /// retrieved priority.
            void m_processObject(Json::Value const &obj) {
                AliasPriority priority{m_opts.defaultPriority};
                if (obj.isMember(PRIORITY_KEY)) {
                    priority =
                        static_cast<AliasPriority>(obj[PRIORITY_KEY].asInt());
                }
                for (auto const &key : obj.getMemberNames()) {
                    if (PRIORITY_KEY == key) {
                        continue;
                    }
                    m_processEntry(key, obj[key], priority);
                }
            }

            /// @brief Process a name:value entry in an alias description
            /// object, with the given priority. Calls m_processSingleEntry() to
            /// actually complete its work.
            void m_processEntry(std::string const &path,
                                Json::Value const &source,
                                AliasPriority priority) {
                if (!m_opts.permitRelativePath && !isPathAbsolute(path)) {
                    OSVR_DEV_VERBOSE(
                        "Got a non-permitted relative path: " << path);
                    return;
                }
                ParsedAlias parsedSource(source);
                auto leaf = parsedSource.getLeaf();
                if (!m_opts.permitRelativeSource && !isPathAbsolute(leaf)) {
                    OSVR_DEV_VERBOSE(
                        "Got a non-permitted relative source leaf: " << leaf);
                    return;
                }
                if (!doesPathContainWildcard(leaf)) {
                    /// Handle the simple ones first.
                    m_processSingleEntry(path, parsedSource.getAlias(),
                                         priority);
                    return;
                }

                /// OK, handle wildcard here
                if (!m_opts.permitWildcard) {
                    OSVR_DEV_VERBOSE(
                        "Got a non-permitted wildcard in the source leaf of: "
                        << parsedSource.getAlias());
                }

                if (parsedSource.isSimple()) {
                    applyWildcard(
                        m_devNode, leaf,
                        [&](PathNode &node, std::string const &relPath) {
                            m_processSingleEntry(path + getPathSeparator() +
                                                     relPath,
                                                 getFullPath(node), priority);
                        });
                    return;
                }

                applyWildcard(m_devNode, leaf, [&](PathNode &node,
                                                   std::string const &relPath) {
                    parsedSource.setLeaf(getFullPath(node));
                    m_processSingleEntry(path + getPathSeparator() + relPath,
                                         parsedSource.getAlias(), priority);
                });
            }

            /// @brief Called for each individual alias path to be processed for
            /// (and potentially added to/updated in) the path tree.
            void m_processSingleEntry(std::string const &path,
                                      std::string const &source,
                                      AliasPriority priority) {
                m_flag += addAliasFromSourceAndRelativeDest(m_devNode, source,
                                                            path, priority);
            }

            PathNode &m_devNode;
            detail::AliasProcessorOptions m_opts;
            util::Flag m_flag;
        };

    } // namespace

    bool AliasProcessor::process(PathNode &node, Json::Value const &val) {
        AutomaticAliases processor{node, m_opts};
        return processor(val).get();
    }

    Json::Value createJSONAlias(std::string const &path,
                                Json::Value const &destination) {
        Json::Value ret{Json::nullValue};
        if (path.empty()) {
            return ret;
        }
        if (destination.isNull()) {
            return ret;
        }
        ret = Json::objectValue;
        ret[path] = destination;
        return ret;
    }

    Json::Value convertRouteToAlias(Json::Value const &val) {
        Json::Value ret{val};
        if (!val.isObject()) {
            // Can't be a route if it's not an object.
            return ret;
        }
        if (val.isMember(routing_keys::destination()) &&
            val.isMember(routing_keys::source())) {
            // By golly this is an old-fashioned route.
            ret = createJSONAlias(val[routing_keys::destination()].asString(),
                                  val[routing_keys::source()]);
        }
        return ret;
    }

    Json::Value applyPriorityToAlias(Json::Value const &alias,
                                     AliasPriority priority) {
        Json::Value ret{alias};
        if (ret.isObject()) {
            ret[PRIORITY_KEY] = priority;
        }
        return ret;
    }
} // namespace common
} // namespace osvr


text:
(function() {
  console.log('JavaScript Loaded');

  $(document).foundation();

}).call(this);


text:
/**
 * @license  Highcharts JS v6.1.1 (2018-06-27)
 *
 * Indicator series type for Highstock
 *
 * (c) 2010-2017 Pawel Fus, Sebastian Bochan
 *
 * License: www.highcharts.com/license
 */
'use strict';
(function (factory) {
	if (typeof module === 'object' && module.exports) {
		module.exports = factory;
	} else {
		factory(Highcharts);
	}
}(function (Highcharts) {
	(function (H) {

		var pick = H.pick,
		    each = H.each,
		    error = H.error,
		    Series = H.Series,
		    isArray = H.isArray,
		    addEvent = H.addEvent,
		    seriesType = H.seriesType;

		/**
		 * The SMA series type.
		 *
		 * @constructor seriesTypes.sma
		 * @augments seriesTypes.line
		 */
		seriesType('sma', 'line',
		    /**
		     * Simple moving average indicator (SMA). This series requires `linkedTo`
		     * option to be set.
		     *
		     * @extends {plotOptions.line}
		     * @product highstock
		     * @sample {highstock} stock/indicators/sma Simple moving average indicator
		     * @since 6.0.0
		     * @excluding
		     *             allAreas,colorAxis,compare,compareBase,joinBy,keys,stacking,
		     *             showInNavigator,navigatorOptions,pointInterval,
		     *             pointIntervalUnit,pointPlacement,pointRange,pointStart,joinBy
		     * @optionparent plotOptions.sma
		     */
		    {
		        /**
		         * The name of the series as shown in the legend, tooltip etc. If not
		         * set, it will be based on a technical indicator type and default
		         * params.
		         *
		         * @type {String}
		         * @since 6.0.0
		         * @product highstock
		         */
		        name: undefined,
		        tooltip: {
		            /**
		             * Number of decimals in indicator series.
		             *
		             * @type {Number}
		             * @since 6.0.0
		             * @product highstock
		             */
		            valueDecimals: 4
		        },
		        /**
		         * The main series ID that indicator will be based on. Required for this
		         * indicator.
		         *
		         * @type {String}
		         * @since 6.0.0
		         * @product highstock
		         */
		        linkedTo: undefined,
		        params: {
		            /**
		             * The point index which indicator calculations will base. For
		             * example using OHLC data, index=2 means the indicator will be
		             * calculated using Low values.
		             *
		             * @type {Number}
		             * @since 6.0.0
		             * @product highstock
		             */
		            index: 0,
		            /**
		             * The base period for indicator calculations. This is the number of
		             * data points which are taken into account for the indicator
		             * calculations.
		             *
		             * @type {Number}
		             * @since 6.0.0
		             * @product highstock
		             */
		            period: 14
		        }
		    }, /** @lends Highcharts.Series.prototype */ {
		        bindTo: {
		            series: true,
		            eventName: 'updatedData'
		        },
		        useCommonDataGrouping: true,
		        nameComponents: ['period'],
		        nameSuffixes: [], // e.g. Zig Zag uses extra '%'' in the legend name
		        calculateOn: 'init',
		        init: function (chart, options) {
		            var indicator = this;

		            Series.prototype.init.call(
		                indicator,
		                chart,
		                options
		            );

		            // Make sure we find series which is a base for an indicator
		            chart.linkSeries();

		            indicator.dataEventsToUnbind = [];

		            function recalculateValues() {
		                var processedData = indicator.getValues(
		                    indicator.linkedParent,
		                    indicator.options.params
		                ) || {
		                    values: [],
		                    xData: [],
		                    yData: []
		                };

		                indicator.xData = processedData.xData;
		                indicator.yData = processedData.yData;
		                indicator.options.data = processedData.values;

		                //    Removal of processedXData property is required because on
		                //    first translate processedXData array is empty
		                if (indicator.bindTo.series === false) {
		                    delete indicator.processedXData;

		                    indicator.isDirty = true;
		                    indicator.redraw();
		                }
		                indicator.isDirtyData = false;
		            }

		            if (!indicator.linkedParent) {
		                return error(
		                    'Series ' +
		                    indicator.options.linkedTo +
		                    ' not found! Check `linkedTo`.'
		                );
		            }

		            indicator.dataEventsToUnbind.push(
		                addEvent(
		                    indicator.bindTo.series ?
		                        indicator.linkedParent : indicator.linkedParent.xAxis,
		                    indicator.bindTo.eventName,
		                    recalculateValues
		                )
		            );

		            if (indicator.calculateOn === 'init') {
		                recalculateValues();
		            } else {
		                var unbinder = addEvent(
		                    indicator.chart,
		                    indicator.calculateOn,
		                    function () {
		                        recalculateValues();
		                        // Call this just once, on init
		                        unbinder();
		                    }
		                );
		            }

		            return indicator;
		        },
		        getName: function () {
		            var name = this.name,
		                params = [];

		            if (!name) {

		                each(
		                    this.nameComponents,
		                    function (component, index) {
		                        params.push(
		                            this.options.params[component] +
		                            pick(this.nameSuffixes[index], '')
		                        );
		                    },
		                    this
		                );

		                name = (this.nameBase || this.type.toUpperCase()) +
		                    (this.nameComponents ? ' (' + params.join(', ') + ')' : '');
		            }

		            return name;
		        },
		        getValues: function (series, params) {
		            var period = params.period,
		                xVal = series.xData,
		                yVal = series.yData,
		                yValLen = yVal.length,
		                range = 0,
		                sum = 0,
		                SMA = [],
		                xData = [],
		                yData = [],
		                index = -1,
		                i,
		                SMAPoint;

		            if (xVal.length < period) {
		                return false;
		            }

		            // Switch index for OHLC / Candlestick / Arearange
		            if (isArray(yVal[0])) {
		                index = params.index ? params.index : 0;
		            }

		            // Accumulate first N-points
		            while (range < period - 1) {
		                sum += index < 0 ? yVal[range] : yVal[range][index];
		                range++;
		            }

		            // Calculate value one-by-one for each period in visible data
		            for (i = range; i < yValLen; i++) {
		                sum += index < 0 ? yVal[i] : yVal[i][index];

		                SMAPoint = [xVal[i], sum / period];
		                SMA.push(SMAPoint);
		                xData.push(SMAPoint[0]);
		                yData.push(SMAPoint[1]);

		                sum -= index < 0 ? yVal[i - range] : yVal[i - range][index];
		            }

		            return {
		                values: SMA,
		                xData: xData,
		                yData: yData
		            };
		        },
		        destroy: function () {
		            each(this.dataEventsToUnbind, function (unbinder) {
		                unbinder();
		            });
		            Series.prototype.destroy.call(this);
		        }
		    });

		/**
		 * A `SMA` series. If the [type](#series.sma.type) option is not
		 * specified, it is inherited from [chart.type](#chart.type).
		 *
		 * @type {Object}
		 * @since 6.0.0
		 * @extends series,plotOptions.sma
		 * @excluding data,dataParser,dataURL
		 * @product highstock
		 * @apioption series.sma
		 */

		/**
		 * An array of data points for the series. For the `SMA` series type,
		 * points are calculated dynamically.
		 *
		 * @type {Array<Object|Array>}
		 * @since 6.0.0
		 * @extends series.line.data
		 * @product highstock
		 * @apioption series.sma.data
		 */

	}(Highcharts));
	return (function () {

	}());
}));


text:
WORKINGDIR=$(pwd)
SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPTDIR"
args="$@"
dropin="$1"

sourcefile='&sourcefile&'
targetfile='&targetfile&'
changes="changes.vcdiff"
olddir="old"

find_xdelta3() {
	chmod +x ./xdelta3_mac 2>/dev/null
	case $(uname -m) in
		i*86) arch=x86;;
		Pentium*|AMD?Athlon*) arch=x86;;
		amd64|x86_64) arch=x86_64;;
		*) arch=other;;
	esac
	if [ "x`uname -s`" = "xDarwin" ] && [ "$arch" = "x86_64" ] && [ -x ./xdelta3_mac ] && file ./xdelta3_mac | grep -q "Mach-O"; then
		app="./xdelta3_mac"
	elif hash xdelta3 2>/dev/null; then
		app="xdelta3"
	elif hash wine 2>/dev/null && [ -f "xdelta3.exe" ]; then
		app="wine ./xdelta3.exe"
	else
		echo "Error: The required application is not found or inaccessible."
		echo "Please either make sure the file \"xdelta3_mac\" has execute rights, install xdelta3 [recommended], or install WinE."
		cd "$WORKINGDIR"
		return 1
	fi
	return 0
}

find_inputs() {
	if [ ! -z "$dropin" ] && [ ! "$dropin" = " " ]; then
		if [ -f "$dropin" ]; then
			sourcefile="$dropin"
            targetfile="$(dirname "$sourcefile")/$targetfile"
            olddir="$(dirname "$sourcefile")/$olddir"
		else
			echo "Warning: Input file \"$dropin\" is not found. Ignored."
		fi
	fi
	if [ ! -f "$sourcefile" ]; then
		if [ -f "../$sourcefile" ]; then
			sourcefile="../$sourcefile"
			targetfile="../$targetfile"
			olddir="../$olddir"
		else
			if [ -f "../../$sourcefile" ]; then
				sourcefile="../../$sourcefile"
				targetfile="../../$targetfile"
				olddir="../../$olddir"
			else
				if [ -f "../../../$sourcefile" ]; then
					sourcefile="../../../$sourcefile"
					targetfile="../../../$targetfile"
					olddir="../../../$olddir"
				else
					echo "Error: Source file not found."
					echo "The file \"$sourcefile\" must be in the same folder as this script."
					cd "$WORKINGDIR"
					return 1
				fi
			fi
		fi
	fi
	if [ ! -f "$changes" ]; then
		echo "Error: VCDIFF file \"$changes\" is missing."
		echo "Please extract everything from the archive."
		cd "$WORKINGDIR"
		return 1
	fi
	return 0
}

run_patch () {
	echo "Attempting to patch \"$sourcefile\"..."
	`$app -d -f -s "$sourcefile" "$changes" "$targetfile"`
	return $?
}

move_old_file () {
	if [ -f "$targetfile" ] && [ ! -f "do_not_move_old_file.txt" ]; then
		mkdir -p "$olddir" >/dev/null
		if mv "$sourcefile" "$olddir/"; then
			echo "Moved the old file to directory \"$olddir\"."
			return 0
		else
			echo "Warning: Couldn't moved the old file."
			return 1
		fi
	fi
	return 0
}

if find_xdelta3 && find_inputs; then
	if run_patch; then
		if ! move_old_file; then
			ignore=1
		fi
		echo "Done."
		cd "$WORKINGDIR"
		return 0 2>/dev/null || exit 0
	else
		echo "Error: Patching wasn't successful!"
	fi
fi

cd "$WORKINGDIR"
return 1 2>/dev/null || exit 1


text:
namespace TwitterFeed
{
    public class TwitterObject
    {
        public object contributors { get; set; }
        public object coordinates { get; set; }
        public string created_at { get; set; }
        public bool favorited { get; set; }
        public object geo { get; set; }
        public object id { get; set; }
        public string id_str { get; set; }
        public string in_reply_to_screen_name { get; set; }
        public object in_reply_to_status_id { get; set; }
        public object in_reply_to_status_id_str { get; set; }
        public int? in_reply_to_user_id { get; set; }
        public string in_reply_to_user_id_str { get; set; }
        public object place { get; set; }
        public int retweet_count { get; set; }
        public bool retweeted { get; set; }
        public string source { get; set; }
        public string text { get; set; }
        public bool truncated { get; set; }
        public User user { get; set; }
    }

    public class User
    {
        public bool contributors_enabled { get; set; }
        public string created_at { get; set; }
        public bool default_profile { get; set; }
        public bool default_profile_image { get; set; }
        public string description { get; set; }
        public int favourites_count { get; set; }
        public object follow_request_sent { get; set; }
        public int followers_count { get; set; }
        public object following { get; set; }
        public int friends_count { get; set; }
        public bool geo_enabled { get; set; }
        public int id { get; set; }
        public string id_str { get; set; }
        public bool is_translator { get; set; }
        public string lang { get; set; }
        public int listed_count { get; set; }
        public string location { get; set; }
        public string name { get; set; }
        public object notifications { get; set; }
        public string profile_background_color { get; set; }
        public string profile_background_image_url { get; set; }
        public string profile_background_image_url_https { get; set; }
        public bool profile_background_tile { get; set; }
        public string profile_image_url { get; set; }
        public string profile_image_url_https { get; set; }
        public string profile_link_color { get; set; }
        public string profile_sidebar_border_color { get; set; }
        public string profile_sidebar_fill_color { get; set; }
        public string profile_text_color { get; set; }
        public bool profile_use_background_image { get; set; }
        public bool @protected { get; set; }
        public string screen_name { get; set; }
        public int statuses_count { get; set; }
        public object time_zone { get; set; }
        public string url { get; set; }
        public object utc_offset { get; set; }
        public bool verified { get; set; }
    }
}


text:
using blink::WebAXObject;
using blink::WebCString;
using blink::WebDataSource;
using blink::WebDocument;
using blink::WebElement;
using blink::WebFrame;
using blink::WebGestureEvent;
using blink::WebIconURL;
using blink::WebLocalFrame;
using blink::WebNode;
using blink::WebNodeList;
using blink::WebRect;
using blink::WebSecurityOrigin;
using blink::WebSize;
using blink::WebString;
using blink::WebTouchEvent;
using blink::WebURL;
using blink::WebURLRequest;
using blink::WebView;
using blink::WebVector;
using blink::WebWindowFeatures;

// Delay in milliseconds that we'll wait before capturing the page contents
// and thumbnail.
static const int kDelayForCaptureMs = 500;

// Typically, we capture the page data once the page is loaded.
// Sometimes, the page never finishes to load, preventing the page capture
// To workaround this problem, we always perform a capture after the following
// delay.
static const int kDelayForForcedCaptureMs = 6000;

// define to write the time necessary for thumbnail/DOM text retrieval,
// respectively, into the system debug log
// #define TIME_TEXT_RETRIEVAL

// maximum number of characters in the document to index, any text beyond this
// point will be clipped
static const size_t kMaxIndexChars = 65535;

// Constants for UMA statistic collection.
static const char kTranslateCaptureText[] = "Translate.CaptureText";

namespace {

#if defined(OS_ANDROID)
// Parses the DOM for a <meta> tag with a particular name.
// |meta_tag_content| is set to the contents of the 'content' attribute.
// |found_tag| is set to true if the tag was successfully found.
// Returns true if the document was parsed without errors.
bool RetrieveMetaTagContent(const WebFrame* main_frame,
                            const GURL& expected_url,
                            const std::string& meta_tag_name,
                            bool* found_tag,
                            std::string* meta_tag_content) {
  WebDocument document =
      main_frame ? main_frame->document() : WebDocument();
  WebElement head = document.isNull() ? WebElement() : document.head();
  GURL document_url = document.isNull() ? GURL() : GURL(document.url());

  // Search the DOM for the <meta> tag with the given name.
  *found_tag = false;
  *meta_tag_content = "";
  if (!head.isNull()) {
    WebNodeList children = head.childNodes();
    for (unsigned i = 0; i < children.length(); ++i) {
      WebNode child = children.item(i);
      if (!child.isElementNode())
        continue;
      WebElement elem = child.to<WebElement>();
      if (elem.hasHTMLTagName("meta")) {
        if (elem.hasAttribute("name") && elem.hasAttribute("content")) {
          std::string name = elem.getAttribute("name").utf8();
          if (name == meta_tag_name) {
            *meta_tag_content = elem.getAttribute("content").utf8();
            *found_tag = true;
            break;
          }
        }
      }
    }
  }

  // Make sure we're checking the right page and that the length of the content
  // string is reasonable.
  bool success = document_url == expected_url;
  if (meta_tag_content->size() > chrome::kMaxMetaTagAttributeLength) {
    *meta_tag_content = "";
    success = false;
  }

  return success;
}
#endif

}  // namespace

ChromeRenderViewObserver::ChromeRenderViewObserver(
    content::RenderView* render_view,
    web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer)
    : content::RenderViewObserver(render_view),
      web_cache_render_process_observer_(web_cache_render_process_observer),
      translate_helper_(new translate::TranslateHelper(
          render_view,
          chrome::ISOLATED_WORLD_ID_TRANSLATE,
          0,
          extensions::kExtensionScheme)),
      phishing_classifier_(NULL),
      capture_timer_(false, false) {
  const base::CommandLine& command_line =
      *base::CommandLine::ForCurrentProcess();
  if (!command_line.HasSwitch(switches::kDisableClientSidePhishingDetection))
    OnSetClientSidePhishingDetection(true);
}

ChromeRenderViewObserver::~ChromeRenderViewObserver() {
}

bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
  bool handled = true;
  IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message)
#if !defined(OS_ANDROID) && !defined(OS_IOS)
    IPC_MESSAGE_HANDLER(ChromeViewMsg_WebUIJavaScript, OnWebUIJavaScript)
#endif
#if defined(ENABLE_EXTENSIONS)
    IPC_MESSAGE_HANDLER(ChromeViewMsg_SetVisuallyDeemphasized,
                        OnSetVisuallyDeemphasized)
#endif
#if defined(OS_ANDROID)
    IPC_MESSAGE_HANDLER(ChromeViewMsg_UpdateTopControlsState,
                        OnUpdateTopControlsState)
    IPC_MESSAGE_HANDLER(ChromeViewMsg_RetrieveMetaTagContent,
                        OnRetrieveMetaTagContent)
#endif
    IPC_MESSAGE_HANDLER(ChromeViewMsg_GetWebApplicationInfo,
                        OnGetWebApplicationInfo)
    IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection,
                        OnSetClientSidePhishingDetection)
    IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures)
    IPC_MESSAGE_UNHANDLED(handled = false)
  IPC_END_MESSAGE_MAP()

  return handled;
}

#if !defined(OS_ANDROID) && !defined(OS_IOS)
void ChromeRenderViewObserver::OnWebUIJavaScript(
    const base::string16& javascript) {
  webui_javascript_.push_back(javascript);
}
#endif

#if defined(OS_ANDROID)
void ChromeRenderViewObserver::OnUpdateTopControlsState(
    content::TopControlsState constraints,
    content::TopControlsState current,
    bool animate) {
  render_view()->UpdateTopControlsState(constraints, current, animate);
}

void ChromeRenderViewObserver::OnRetrieveMetaTagContent(
    const GURL& expected_url,
    const std::string tag_name) {
  bool found_tag;
  std::string content_str;
  bool parsed_successfully = RetrieveMetaTagContent(
      render_view()->GetWebView()->mainFrame(),
      expected_url,
      tag_name,
      &found_tag,
      &content_str);

  Send(new ChromeViewHostMsg_DidRetrieveMetaTagContent(
      routing_id(),
      parsed_successfully && found_tag,
      tag_name,
      content_str,
      expected_url));
}
#endif

void ChromeRenderViewObserver::OnGetWebApplicationInfo() {
  WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
  DCHECK(main_frame);

  WebApplicationInfo web_app_info;
  web_apps::ParseWebAppFromWebDocument(main_frame, &web_app_info);

  // The warning below is specific to mobile but it doesn't hurt to show it even
  // if the Chromium build is running on a desktop. It will get more exposition.
  if (web_app_info.mobile_capable ==
        WebApplicationInfo::MOBILE_CAPABLE_APPLE) {
    blink::WebConsoleMessage message(
        blink::WebConsoleMessage::LevelWarning,
        "<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is "
        "deprecated. Please include <meta name=\"mobile-web-app-capable\" "
        "content=\"yes\"> - "
        "http://developers.google.com/chrome/mobile/docs/installtohomescreen");
    main_frame->addMessageToConsole(message);
  }

  // Prune out any data URLs in the set of icons.  The browser process expects
  // any icon with a data URL to have originated from a favicon.  We don't want
  // to decode arbitrary data URLs in the browser process.  See
  // http://b/issue?id=1162972
  for (std::vector<WebApplicationInfo::IconInfo>::iterator it =
          web_app_info.icons.begin(); it != web_app_info.icons.end();) {
    if (it->url.SchemeIs(url::kDataScheme))
      it = web_app_info.icons.erase(it);
    else
      ++it;
  }

  // Truncate the strings we send to the browser process.
  web_app_info.title =
      web_app_info.title.substr(0, chrome::kMaxMetaTagAttributeLength);
  web_app_info.description =
      web_app_info.description.substr(0, chrome::kMaxMetaTagAttributeLength);

  Send(new ChromeViewHostMsg_DidGetWebApplicationInfo(
      routing_id(), web_app_info));
}

void ChromeRenderViewObserver::OnSetWindowFeatures(
    const WebWindowFeatures& window_features) {
  render_view()->GetWebView()->setWindowFeatures(window_features);
}

void ChromeRenderViewObserver::Navigate(const GURL& url) {
  // Execute cache clear operations that were postponed until a navigation
  // event (including tab reload).
  if (web_cache_render_process_observer_)
    web_cache_render_process_observer_->ExecutePendingClearCache();
  // Let translate_helper do any preparatory work for loading a URL.
  if (translate_helper_)
    translate_helper_->PrepareForUrl(url);
}

void ChromeRenderViewObserver::OnSetClientSidePhishingDetection(
    bool enable_phishing_detection) {
#if defined(FULL_SAFE_BROWSING) && !defined(OS_CHROMEOS)
  phishing_classifier_ = enable_phishing_detection ?
      safe_browsing::PhishingClassifierDelegate::Create(render_view(), NULL) :
      NULL;
#endif
}

#if defined(ENABLE_EXTENSIONS)
void ChromeRenderViewObserver::OnSetVisuallyDeemphasized(bool deemphasized) {
  bool already_deemphasized = !!dimmed_color_overlay_.get();
  if (already_deemphasized == deemphasized)
    return;

  if (deemphasized) {
    // 70% opaque grey.
    SkColor greyish = SkColorSetARGB(178, 0, 0, 0);
    dimmed_color_overlay_.reset(
        new WebViewColorOverlay(render_view(), greyish));
  } else {
    dimmed_color_overlay_.reset();
  }
}
#endif

void ChromeRenderViewObserver::DidStartLoading() {
  if ((render_view()->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) &&
      !webui_javascript_.empty()) {
    for (size_t i = 0; i < webui_javascript_.size(); ++i) {
      render_view()->GetMainRenderFrame()->ExecuteJavaScript(
          webui_javascript_[i]);
    }
    webui_javascript_.clear();
  }
}

void ChromeRenderViewObserver::DidStopLoading() {
  WebFrame* main_frame = render_view()->GetWebView()->mainFrame();

  // Remote frames don't host a document, so return early if that's the case.
  if (main_frame->isWebRemoteFrame())
    return;

  GURL osdd_url = main_frame->document().openSearchDescriptionURL();
  if (!osdd_url.is_empty()) {
    Send(new ChromeViewHostMsg_PageHasOSDD(
        routing_id(), main_frame->document().url(), osdd_url,
        search_provider::AUTODETECTED_PROVIDER));
  }

  // Don't capture pages including refresh meta tag.
  if (HasRefreshMetaTag(main_frame))
    return;

  CapturePageInfoLater(
      false,  // preliminary_capture
      base::TimeDelta::FromMilliseconds(
          render_view()->GetContentStateImmediately() ?
              0 : kDelayForCaptureMs));
}

void ChromeRenderViewObserver::DidCommitProvisionalLoad(
    WebLocalFrame* frame, bool is_new_navigation) {
  // Don't capture pages being not new, or including refresh meta tag.
  if (!is_new_navigation || HasRefreshMetaTag(frame))
    return;

  base::debug::SetCrashKeyValue(
      crash_keys::kViewCount,
      base::SizeTToString(content::RenderView::GetRenderViewCount()));

  CapturePageInfoLater(
      true,  // preliminary_capture
      base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs));
}

void ChromeRenderViewObserver::CapturePageInfoLater(bool preliminary_capture,
                                                    base::TimeDelta delay) {
  capture_timer_.Start(
      FROM_HERE,
      delay,
      base::Bind(&ChromeRenderViewObserver::CapturePageInfo,
                 base::Unretained(this),
                 preliminary_capture));
}

void ChromeRenderViewObserver::CapturePageInfo(bool preliminary_capture) {
  if (!render_view()->GetWebView())
    return;

  WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
  if (!main_frame)
    return;

  // TODO(creis): Refactor WebFrame::contentAsText to handle RemoteFrames,
  // likely by moving it to the browser process.  For now, only capture page
  // info from main frames that are LocalFrames, and ignore their RemoteFrame
  // children.
  if (main_frame->isWebRemoteFrame())
    return;

  // Don't index/capture pages that are in view source mode.
  if (main_frame->isViewSourceModeEnabled())
    return;

  // Don't index/capture pages that failed to load.  This only checks the top
  // level frame so the thumbnail may contain a frame that failed to load.
  WebDataSource* ds = main_frame->dataSource();
  if (ds && ds->hasUnreachableURL())
    return;

  // Don't index/capture pages that are being prerendered.
  if (prerender::PrerenderHelper::IsPrerendering(
          render_view()->GetMainRenderFrame())) {
    return;
  }

  // Retrieve the frame's full text (up to kMaxIndexChars), and pass it to the
  // translate helper for language detection and possible translation.
  base::string16 contents;
  base::TimeTicks capture_begin_time = base::TimeTicks::Now();
  CaptureText(main_frame, &contents);
  UMA_HISTOGRAM_TIMES(kTranslateCaptureText,
                      base::TimeTicks::Now() - capture_begin_time);
  if (translate_helper_)
    translate_helper_->PageCaptured(contents);

  TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo");

#if defined(FULL_SAFE_BROWSING)
  // Will swap out the string.
  if (phishing_classifier_)
    phishing_classifier_->PageCaptured(&contents, preliminary_capture);
#endif
}

void ChromeRenderViewObserver::CaptureText(WebFrame* frame,
                                           base::string16* contents) {
  contents->clear();
  if (!frame)
    return;

#ifdef TIME_TEXT_RETRIEVAL
  double begin = time_util::GetHighResolutionTimeNow();
#endif

  // get the contents of the frame
  *contents = frame->contentAsText(kMaxIndexChars);

#ifdef TIME_TEXT_RETRIEVAL
  double end = time_util::GetHighResolutionTimeNow();
  char buf[128];
  sprintf_s(buf, "%d chars retrieved for indexing in %gms\n",
            contents.size(), (end - begin)*1000);
  OutputDebugStringA(buf);
#endif

  // When the contents are clipped to the maximum, we don't want to have a
  // partial word indexed at the end that might have been clipped. Therefore,
  // terminate the string at the last space to ensure no words are clipped.
  if (contents->size() == kMaxIndexChars) {
    size_t last_space_index = contents->find_last_of(base::kWhitespaceUTF16);
    if (last_space_index != base::string16::npos)
      contents->resize(last_space_index);
  }
}

bool ChromeRenderViewObserver::HasRefreshMetaTag(WebFrame* frame) {
  if (!frame)
    return false;
  WebElement head = frame->document().head();
  if (head.isNull() || !head.hasChildNodes())
    return false;

  const WebString tag_name(base::ASCIIToUTF16("meta"));
  const WebString attribute_name(base::ASCIIToUTF16("http-equiv"));

  WebNodeList children = head.childNodes();
  for (size_t i = 0; i < children.length(); ++i) {
    WebNode node = children.item(i);
    if (!node.isElementNode())
      continue;
    WebElement element = node.to<WebElement>();
    if (!element.hasHTMLTagName(tag_name))
      continue;
    WebString value = element.getAttribute(attribute_name);
    if (value.isNull() ||
        !base::LowerCaseEqualsASCII(base::StringPiece16(value), "refresh"))
      continue;
    return true;
  }
  return false;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;

namespace ServerBroadcastSample
{
	[HubName("stockTickerMini")]
	public class StockTickerHub : Hub
	{
		private readonly StockTicker stockTicker;

		public StockTickerHub() : this(StockTicker.Instance) { }

		public StockTickerHub(StockTicker stockTicker)
		{
			this.stockTicker = stockTicker;
		}

		public IEnumerable<Stock> GetAllStocks()
		{
			return stockTicker.GetAllStocks();
		}
	}
}


text:
/**
 * @author Brandon Alexander - baalexander@gmail.com
 */

/**
 * Publish and/or subscribe to a topic in ROS.
 *
 * Emits the following events:
 *  * 'warning' - if there are any warning during the Topic creation
 *  * 'message' - the message data from rosbridge
 *
 * @constructor
 * @param options - object with following keys:
 *   * ros - the ROSLIB.Ros connection handle
 *   * name - the topic name, like /cmd_vel
 *   * messageType - the message type, like 'std_msgs/String'
 *   * compression - the type of compression to use, like 'png'
 *   * throttle_rate - the rate at which to throttle the topics
 */
ROSLIB.Topic = function(options) {
  options = options || {};
  this.ros = options.ros;
  this.name = options.name;
  this.messageType = options.messageType;
  this.isAdvertised = false;
  this.compression = options.compression || 'none';
  this.throttle_rate = options.throttle_rate || 0;
  this.latch = options.latch || false;

  // Check for valid compression types
  if (this.compression && this.compression !== 'png' && this.compression !== 'none') {
    this.emit('warning', this.compression +
      ' compression is not supported. No compression will be used.');
  }

  // Check if throttle rate is negative
  if (this.throttle_rate < 0) {
    this.emit('warning', this.throttle_rate + ' is not allowed. Set to 0');
    this.throttle_rate = 0;
  }
};
ROSLIB.Topic.prototype.__proto__ = EventEmitter2.prototype;

/**
 * Every time a message is published for the given topic, the callback
 * will be called with the message object.
 *
 * @param callback - function with the following params:
 *   * message - the published message
 */
ROSLIB.Topic.prototype.subscribe = function(callback) {
  var that = this;

  this.on('message', function(message) {
    callback(message);
  });

  this.ros.on(this.name, function(data) {
    var message = new ROSLIB.Message(data);
    that.emit('message', message);
  });

  this.ros.idCounter++;
  var subscribeId = 'subscribe:' + this.name + ':' + this.ros.idCounter;
  var call = {
    op : 'subscribe',
    id : subscribeId,
    type : this.messageType,
    topic : this.name,
    compression : this.compression,
    throttle_rate : this.throttle_rate
  };

  this.ros.callOnConnection(call);
};

/**
 * Unregisters as a subscriber for the topic. Unsubscribing will remove
 * all subscribe callbacks.
 */
ROSLIB.Topic.prototype.unsubscribe = function() {
  this.ros.removeAllListeners([ this.name ]);
  this.ros.idCounter++;
  var unsubscribeId = 'unsubscribe:' + this.name + ':' + this.ros.idCounter;
  var call = {
    op : 'unsubscribe',
    id : unsubscribeId,
    topic : this.name
  };
  this.ros.callOnConnection(call);
};

/**
 * Registers as a publisher for the topic.
 */
ROSLIB.Topic.prototype.advertise = function() {
  this.ros.idCounter++;
  var advertiseId = 'advertise:' + this.name + ':' + this.ros.idCounter;
  var call = {
    op : 'advertise',
    id : advertiseId,
    type : this.messageType,
    topic : this.name,
    latch : this.latch
  };
  this.ros.callOnConnection(call);
  this.isAdvertised = true;
};

/**
 * Unregisters as a publisher for the topic.
 */
ROSLIB.Topic.prototype.unadvertise = function() {
  this.ros.idCounter++;
  var unadvertiseId = 'unadvertise:' + this.name + ':' + this.ros.idCounter;
  var call = {
    op : 'unadvertise',
    id : unadvertiseId,
    topic : this.name
  };
  this.ros.callOnConnection(call);
  this.isAdvertised = false;
};

/**
 * Publish the message.
 *
 * @param message - A ROSLIB.Message object.
 */
ROSLIB.Topic.prototype.publish = function(message) {
  if (!this.isAdvertised) {
    this.advertise();
  }

  this.ros.idCounter++;
  var publishId = 'publish:' + this.name + ':' + this.ros.idCounter;
  var call = {
    op : 'publish',
    id : publishId,
    topic : this.name,
    msg : message,
    latch : this.latch
  };
  this.ros.callOnConnection(call);
};


text:
package com.company;

/**
 * Created by frederik on 3/5/15.
 */
public class OperatorNode extends Node {
    private Operator _o;
    public Operator o () {
        return _o;
    }
    public OperatorNode(Operator o) {
        _o = o;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using ZeroFormatter.Internal;

namespace ZeroFormatter.DotNetCore.Tests
{
    public enum CharacterType
    {
        Human, Monster
    }

    [Union(typeof(Human), typeof(Monster))]
    public abstract class Character
    {
        [UnionKey]
        public abstract CharacterType Type { get; }
    }

    [ZeroFormattable]
    public class Human : Character
    {
        [IgnoreFormat]
        public override CharacterType Type
        {
            get
            {
                return CharacterType.Human;
            }
        }

        [Index(0)]
        public virtual string Name { get; set; }

        [Index(1)]
        public virtual int Age { get; set; }

        [Index(2)]
        public virtual int Faith { get; set; }
    }

    [ZeroFormattable]
    public class Monster : Character
    {
        [IgnoreFormat]
        public override CharacterType Type
        {
            get
            {
                return CharacterType.Monster;
            }
        }

        [Index(0)]
        public virtual string Race { get; set; }

        [Index(1)]
        public virtual int Power { get; set; }

        [Index(2)]
        public virtual int Magic { get; set; }
    }

    public class UnionTest
    {
        [Fact]
        public void Union()
        {
            {
                var demon = new Monster { Race = "Demon", Power = 9999, Magic = 1000 };

                var data = ZeroFormatterSerializer.Serialize<Character>(demon);

                var union = ZeroFormatterSerializer.Deserialize<Character>(data);
                switch (union.Type)
                {
                    case CharacterType.Monster:
                        var demon2 = (Monster)union;
                        demon2.Race.Is("Demon");
                        demon2.Power.Is(9999);
                        demon2.Magic.Is(1000);
                        break;
                    default:
                        throw new Exception("fail");
                }
            }

            {
                var human = new Human { Name = "Tokugawa", Age = 32, Faith = 9999 };

                var data = ZeroFormatterSerializer.Serialize<Character>(human);

                var union = ZeroFormatterSerializer.Deserialize<Character>(data);
                switch (union.Type)
                {
                    case CharacterType.Human:
                        var human2 = (Human)union;
                        human2.Name.Is("Tokugawa");
                        human2.Age.Is(32);
                        human2.Faith.Is(9999);
                        break;
                    default:
                        throw new Exception("fail");
                }
            }
        }
    }
}