text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Example: Adapting a legacy geometry object model</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Geometry">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="../examples.html" title="Examples">
<link rel="next" href="example_source_code__adapting_a_legacy_geometry_object_model.html" title="Example source code: Adapting a legacy geometry object model">

Home
Libraries
People
FAQ
More

Example:
      Adapting a legacy geometry object model

        One of the primary benefits of Boost.Geometry, and the reason for its fairly
        complex template-based implementation, is that it allows for integration
        with legacy classes/objects.

        By defining the relationship between the Boost.Geometry concepts and an existing,
        legacy object model, the legacy objects can be used in place of Boost.Geometry's
        own geometry classes.

        Boost.Geometry will then happliy read and write directly from and to the
        legacy object, treating it as a native Boost.Geometry object.

        This means that one can adapt algorithms and methods from Boost.Geometry
        to any existing legacy geometry object model at a very small runtime cost,
        which is simply not possible with most geometry libraries, where one has
        to make an intermediate object specific to the geometry library one is using.

        The following example will demonstrate the adaption process of a legacy geometry
        object model for use with Boost.Geometry.

        Adapting
        a shared geometry legacy object model

        Example
        code: object hierarcy

class QPoint
{
    public:
        double x;
        double y;
        QPoint(double x, double y) : x(x), y(y) {}
};

class QLineString
{
    public:
        bool cw;
        std::vector<QPoint*> points;
};

class QRing
{
    public:
        std::vector<QLineString*> lines;
};

class QPolygon
{
    public:
        QRing* exterior;
        std::vector<QRing*> interiors;
};

        The legacy object hierarcy is based on topology (e.g. two QRings might share
        one QLineString) instead of points directly (i.e. each object does not point
        directly to it's QPoints), and it also uses pointers for access.

        This is the other common way to approach geometries, to enable e.g. shared
        boundaries between surfaces. Boost.Geometry's approach use simple features,
        and does not have shared geometries.

        The mismatch in representation is fixed by creating a custom iterator, that
        exposes a Boost.Range of Points for every object. This way, Boost.Geometry's
        functions will operate on the QRing as if it was a collection of Points,
        which is a requirement.

        Adapting
        QPoint

        The adaption of the QPoint
        is fairly straightforward, one just needs to implement the requirements.

        Even though the geometries in our legacy object model use pointers of QPoints,
        Boost.Geometry automatically handles the conversion from pointers-to-Points
        to references-to-Points internally, so we do not have to convert them manually.

        Alternatively, we can use the BOOST_GEOMETRY_REGISTER_POINT_2D(QPoint,
        double, cs::cartesian, x, y) helper macro, which does exactly the
        same as our manual adaption.

        The sample code adapts QPoint to the Point
        Concept using specialization of the traits class.

        Adapting
        QLineString

        The adaption of the QLineString
        is very simple on the surface, as it is just "a specialization of traits::tag
        defining linestring_tag as type". Alternatively, we can use the BOOST_GEOMETRY_REGISTER_LINESTRING(QLineString)
        helper macro, which does exactly the same as our manual adaption.

        However, the LineString
        concept also requires that the collection of Points "must behave
        like a Boost.Range Random Access Range" and "the type defined by
        the metafunction range_value<...>::type must fulfill the Point Concept".

        This means that we have to do two things:

            Make QLineString behave like a Boost.Range, with Random Access requirements

            Make sure that the Boost.Range iterates over QPoints, which we already
            have adapted

        This might look like a lot of work, but we are in luck: a std::vector is
        nearly a Boost.Range, and already iterate over pointers-to-QPoints, that
        are handled by Boost.Geometry. The code
        for making QLineString a Boost.Range is therefore fairly straightforward.

        Adapting
        QRing

        The adaption of the QRing
        is mostly equal to the QLineString in that there is a tag and a collection
        to iterate through. Alternatively, we can use the BOOST_GEOMETRY_REGISTER_RING(QRing)
        helper macro, which does exactly the same as our manual adaption.

        However, the QRing expose pointers-to-QLineStrings, and not QPoints directly,
        which is required
        in the Ring concept, so it is not enough to trivially make the std::vector
        into a Boost.Range. We need to create a Boost.Iterator that expose QPoints,
        and because we are dealing with a legacy object model, we are not allowed
        to change the class definition.

        The custom iterator
        that does this uses Boost.Iterator Facade, and is not very different
        from the example
        provided in Boost.Iterator's own documentation(link), except that
        our Boost.Range need to be random access.

        Now, with the custom iterator made, we can define
        the Boost.Range that traverses through QPoints.

        Adapting
        QPolygon

        Adapting the QPolygon
        to the Polygon
        Concept is a little more involved than the other geometry types.

        The only requirement that is not straightforward to adapt is the interior_rings'
        get method.

        A Boost.Geometry Polygon operates on Ring objects, and unfortunately, Boost.Geometry
        does not automatically handle the conversion from pointers to references
        for Rings internally (only Points, as mentioned).

        Therefore, we need to expose QRings instead of pointers-to-QRings for the
        interior Rings, which means a little more work than the pointers-to-QPoints
        for QLineString and QRing.

        First, we create
        a Boost.Iterator Facade that returns QRing instead of pointer-to-QRing:

        Now we have an iterator that can "convert" our pointer-to-QRing
        into QRing. However, the get method of the interior Rings must return a Boost.Range
        compatible object, which a plain PolygonRingIterator is not.

        We need to define
        another Boost.Range, that can be constructed with PolygonRingIterators
        as arguments, and returned from the get method.

        Conclusion

        That's it! The methods of Boost.Geometry can now be used directly on instances
        of our legacy object model.

Copyright © 2009-2015 Barend Gehrels, Bruno Lalande,
      Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
package authoring_environment;

import gamedata.gamecomponents.Patch;
import gamedata.gamecomponents.Piece;

import java.awt.geom.Point2D;
import java.util.LinkedList;
import java.util.List;

import authoring.data.PatchInstanceData;
import authoring.data.PieceInstanceData;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Shape;

public abstract class ShapeGrid extends Pane {
	protected int myRows;
	protected int myCols;
	protected int myTileSize;

	private PieceInstanceData myPieceData;
	private PatchInstanceData myPatchData;
	protected String myID;

	protected List<List<SandyTile>> myGrid;

	protected ShapeGrid(int cols, int rows, int tileSize,
			PieceInstanceData pieceData, PatchInstanceData patchData, String myID) {

		myRows = rows;
		myCols = cols;
		myTileSize = tileSize;

		myPieceData = pieceData;
		myPatchData = patchData;

		initGridTiles();
	}

	private void initGridTiles(){
		myGrid = new LinkedList<List<SandyTile>>();
		for (int r = 0; r < myRows; r++) {
			List<SandyTile> tileCol = new LinkedList<SandyTile>();
			for (int c = 0; c < myCols; c++) {
				Point2D centerLoc = getCenter(r, c, myTileSize);
				Shape bgShape = makeShape(centerLoc, r, c, myTileSize);
				Point2D coor = new Point2D.Double(c,r);
				SandyTile tile = new SandyTile(bgShape, myTileSize, coor, centerLoc);
				tile.setStyle("-fx-cursor: hand");
				tileCol.add(tile);
				super.getChildren().add(tile);
			}
			myGrid.add(tileCol);
		}
	}

	protected abstract Point2D getCenter(int row, int col, double height);

	protected abstract Shape makeShape(Point2D center, int row, int col, double height);

	protected void setCheckeredColor(int row, int col, Shape shape) {
		if (((row % 2 == 0) && (col % 2 == 0)) || ((row % 2 == 1) && (col % 2 == 1))) {
            shape.setFill(Color.WHITE);
		}
        else {
            shape.setFill(Color.WHITESMOKE);
        }
		shape.setStroke(Color.GRAY);
		shape.setStrokeWidth(0.75);
	}

	public abstract SandyTile findTile(MouseEvent event);

	protected void addUnit(SandyTile tile, Piece unit){
		myPieceData.removePiece(tile.getLocation());
		unit.setLoc(tile.getLocation());
		tile.myPieceImage.setImage(unit.getImageView().getImage());
		tile.myPieceImage.setVisible(true);
		myPieceData.add(unit);
	}

	protected void addTerrain(SandyTile tile, Patch terrain){
		myPatchData.removePatchAtLoc(tile.getLocation());
		terrain.setLoc(tile.getLocation());
		tile.myPatchImage.setImage(terrain.getImageView().getImage());
		tile.myPatchImage.setVisible(true);
		myPatchData.add(terrain);
	}

	protected void removeUnit(SandyTile tile, Piece unit) {
		tile.myPieceImage.setVisible(false);
		myPieceData.remove(unit);
	}

	protected void removeTerrain(SandyTile tile, Patch terrain) {
		tile.myPatchImage.setVisible(false);
		myPatchData.remove(terrain);
	}

	protected void editUnit(SandyTile tile, Piece unit) {
		// TO DO: Open individual unit editor.
	}

	protected void editTerrain(SandyTile tile, Patch terrain) {
		// TO DO: Open individual terrain editor.
	}

	public void removePieces(Piece unit) {
		for (int r = 0; r < myRows; r++) {
			for (int c = 0; c < myCols; c++) {
				if(myPieceData.unitAtLoc(unit, c, r)){
					SandyTile tile = myGrid.get(r).get(c);
					tile.myPieceImage.setVisible(false);
				}
			}
		}
	}

	public void removePatches(Patch terrain) {
		for (int r = 0; r < myRows; r++) {
			for (int c = 0; c < myCols; c++) {
				if(myPatchData.terrainAtLoc(terrain, c, r)){
					SandyTile tile = myGrid.get(r).get(c);
					tile.myPatchImage.setVisible(false);
				}
			}
		}
	}

	public String getID() {
		return myID;
	}
}

redpajama_set_name: RedPajamaGithub


text:
DELIMITER /
INSERT INTO KRIM_ROLE_PERM_ID_BS_S VALUES(NULL)
/
INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, OBJ_ID, VER_NBR, ROLE_ID, PERM_ID, ACTV_IND)
VALUES ((SELECT (MAX(ID)) FROM KRIM_ROLE_PERM_ID_BS_S), UUID(), 1,
(SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM='COI Administrator'),
(SELECT PERM_ID FROM KRIM_PERM_T WHERE NM='Maintain Questionnaire Usage' AND NMSPC_CD='KC-COIDISCLOSURE'), 'Y')
/
INSERT INTO KRIM_ROLE_PERM_ID_BS_S VALUES(NULL)
/
INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, OBJ_ID, VER_NBR, ROLE_ID, PERM_ID, ACTV_IND)
VALUES ((SELECT (MAX(ID)) FROM KRIM_ROLE_PERM_ID_BS_S), UUID(), 1,
(SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM='COI Administrator'),
(SELECT PERM_ID FROM KRIM_PERM_T WHERE NM='Modify Questionnaire' AND NMSPC_CD='KC-QUESTIONNAIRE'), 'Y')
/
INSERT INTO KRIM_ROLE_PERM_ID_BS_S VALUES(NULL)
/
INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, OBJ_ID, VER_NBR, ROLE_ID, PERM_ID, ACTV_IND)
VALUES ((SELECT (MAX(ID)) FROM KRIM_ROLE_PERM_ID_BS_S), UUID(), 1,
(SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM='COI Administrator'),
(SELECT PERM_ID FROM KRIM_PERM_T WHERE NM='Modify Question' and nmspc_cd='KC-QUESTIONNAIRE'), 'Y')
/
INSERT INTO KRIM_ROLE_PERM_ID_BS_S VALUES(NULL)
/
INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, OBJ_ID, VER_NBR, ROLE_ID, PERM_ID, ACTV_IND)
VALUES ((SELECT (MAX(ID)) FROM KRIM_ROLE_PERM_ID_BS_S), UUID(), 1,
(SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM='IACUC Administrator'),
(SELECT PERM_ID FROM KRIM_PERM_T WHERE NM='Modify Questionnaire' AND NMSPC_CD='KC-QUESTIONNAIRE'), 'Y')
/
INSERT INTO KRIM_ROLE_PERM_ID_BS_S VALUES(NULL)
/
INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, OBJ_ID, VER_NBR, ROLE_ID, PERM_ID, ACTV_IND)
VALUES ((SELECT (MAX(ID)) FROM KRIM_ROLE_PERM_ID_BS_S), UUID(), 1,
(SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM='IACUC Administrator'),
(SELECT PERM_ID FROM KRIM_PERM_T WHERE NM='Modify Question' and nmspc_cd='KC-QUESTIONNAIRE'), 'Y')
/

DELIMITER ;


text:
/*****************************************************************************/
/* Directory.cpp                          Copyright (c) Ladislav Zezula 2014 */
/*---------------------------------------------------------------------------*/
/* System-dependent directory functions for CascLib                          */
/*---------------------------------------------------------------------------*/
/*   Date    Ver   Who  Comment                                              */
/* --------  ----  ---  -------                                              */
/* 29.04.14  1.00  Lad  The first version of Directory.cpp                   */
/*****************************************************************************/

#define __CASCLIB_SELF__
#include "../CascLib.h"
#include "../CascCommon.h"

#ifndef PLATFORM_WINDOWS
#include <sys/types.h>
#include <dirent.h>
#endif

//-----------------------------------------------------------------------------
// Public functions

bool DirectoryExists(const TCHAR * szDirectory)
{
#ifdef PLATFORM_WINDOWS

    DWORD dwAttributes = GetFileAttributes(szDirectory);
    if((dwAttributes != INVALID_FILE_ATTRIBUTES) && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
        return true;

#else // PLATFORM_WINDOWS

    DIR * dir = opendir(szDirectory);

    if(dir != NULL)
    {
        closedir(dir);
        return true;
    }

#endif

    return false;
}

int ScanIndexDirectory(
    const TCHAR * szIndexPath,
    INDEX_FILE_FOUND pfnOnFileFound,
    PDWORD MainIndexes,
    PDWORD OldIndexArray,
    void * pvContext)
{
#ifdef PLATFORM_WINDOWS

    WIN32_FIND_DATA wf;
    TCHAR * szSearchMask;
    HANDLE hFind;

    // Prepare the search mask
    szSearchMask = CombinePath(szIndexPath, _T("*"));
    if(szSearchMask == NULL)
        return ERROR_NOT_ENOUGH_MEMORY;

    // Prepare directory search
    hFind = FindFirstFile(szSearchMask, &wf);
    if(hFind != INVALID_HANDLE_VALUE)
    {
        // Skip the first file as it's always just "." or ".."
        while(FindNextFile(hFind, &wf))
        {
            // If the found object is a file, pass it to the handler
            if(!(wf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
            {
                // Let the callback scan the file name
                pfnOnFileFound(wf.cFileName, MainIndexes, OldIndexArray, pvContext);
            }
        }

        // Close the search handle
        FindClose(hFind);
    }

    CASC_FREE(szSearchMask);

#else // PLATFORM_WINDOWS

    struct dirent * dir_entry;
    DIR * dir;

    dir = opendir(szIndexPath);
    if(dir != NULL)
    {
        while((dir_entry = readdir(dir)) != NULL)
        {
            if(dir_entry->d_type != DT_DIR)
            {
                pfnOnFileFound(dir_entry->d_name, MainIndexes, OldIndexArray, pvContext);
            }
        }

        closedir(dir);
    }

#endif

    return ERROR_SUCCESS;
}


text:
@interface PodsDummy_DWSegmentControl : NSObject
@end
@implementation PodsDummy_DWSegmentControl
@end


text:
  <input class="mdl-textfield__input" type="text" id="search_question" ng-model="searchQ" />
  Search question Name, Tag, body etc

    <div
        ng-repeat="option in quizVm.previewQuestion.options"
        style="
            position: absolute;
            left: {{1.6 + 24.6 * $index + '%'}};
            width: 23%;
            bottom: 4px;
            height: 76px;
            box-sizing: border-box;
            border: 1px dashed {{quizVm.isOptionCorrect(quizVm.previewQuestion, option) ? '#333' : '#ddd'}};
            overflow: hidden;
            padding: 2px;
        "
        ng-bind-html="mainVm.markDownFormat(option.name)"
    >

        add
        done

          {{question.name}}

            {{tag.name}}

            Edit

            Score: +{{question.positive}} -{{question.negative}}

            done
             1" class="material-icons" style="font-size:16px">done_all

             0">
               0.75"
                  class="bold text-green">
                Easy {{ question.difficulty * 100 | number:0 }}%

              <span
                  ng-if="question.difficulty < 0.35"
                  class="bold text-red">
                Hard {{ question.difficulty * 100 | number:0 }}%

              = 0.35 && question.difficulty <= 0.75"
                  class="bold"
              >
                Average {{ question.difficulty * 100 | number:0 }}%

            {{question.answerCount}} Answers ({{question.skipCount}} skips)


text:
package com.alipay.api.domain;

import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;

/**
 * 中再核保查询结果
 *
 * @author auto create
 * @since 1.0, 2018-01-22 10:52:15
 */
public class AlipayChinareModelResult extends AlipayObject {

	private static final long serialVersionUID = 5269486469851414997L;

	/**
	 * 体检记录id
	 */
	@ApiField("id")
	private String id;

	/**
	 * 规则id
	 */
	@ApiField("rule_id")
	private String ruleId;

	/**
	 * 核保结果
	 */
	@ApiField("rule_result")
	private String ruleResult;

	/**
	 * 交易流水记录id
	 */
	@ApiField("trans_id")
	private String transId;

	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}

	public String getRuleId() {
		return this.ruleId;
	}
	public void setRuleId(String ruleId) {
		this.ruleId = ruleId;
	}

	public String getRuleResult() {
		return this.ruleResult;
	}
	public void setRuleResult(String ruleResult) {
		this.ruleResult = ruleResult;
	}

	public String getTransId() {
		return this.transId;
	}
	public void setTransId(String transId) {
		this.transId = transId;
	}

}


text:
'use strict';/**
 * @module
 * @description
 * Maps application URLs into application states, to support deep-linking and navigation.
 */
function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var router_1 = require('./src/router/router');
exports.Router = router_1.Router;
var router_outlet_1 = require('./src/router/router_outlet');
exports.RouterOutlet = router_outlet_1.RouterOutlet;
var router_link_1 = require('./src/router/router_link');
exports.RouterLink = router_link_1.RouterLink;
var instruction_1 = require('./src/router/instruction');
exports.RouteParams = instruction_1.RouteParams;
exports.RouteData = instruction_1.RouteData;
var route_registry_1 = require('./src/router/route_registry');
exports.RouteRegistry = route_registry_1.RouteRegistry;
var location_strategy_1 = require('./src/router/location_strategy');
exports.LocationStrategy = location_strategy_1.LocationStrategy;
var hash_location_strategy_1 = require('./src/router/hash_location_strategy');
exports.HashLocationStrategy = hash_location_strategy_1.HashLocationStrategy;
var path_location_strategy_1 = require('./src/router/path_location_strategy');
exports.PathLocationStrategy = path_location_strategy_1.PathLocationStrategy;
var location_1 = require('./src/router/location');
exports.Location = location_1.Location;
exports.APP_BASE_HREF = location_1.APP_BASE_HREF;
__export(require('./src/router/route_config_decorator'));
__export(require('./src/router/route_definition'));
var lifecycle_annotations_1 = require('./src/router/lifecycle_annotations');
exports.CanActivate = lifecycle_annotations_1.CanActivate;
var instruction_2 = require('./src/router/instruction');
exports.Instruction = instruction_2.Instruction;
exports.ComponentInstruction = instruction_2.ComponentInstruction;
var angular2_1 = require('angular2/angular2');
exports.OpaqueToken = angular2_1.OpaqueToken;
var location_strategy_2 = require('./src/router/location_strategy');
var path_location_strategy_2 = require('./src/router/path_location_strategy');
var router_2 = require('./src/router/router');
var router_outlet_2 = require('./src/router/router_outlet');
var router_link_2 = require('./src/router/router_link');
var route_registry_2 = require('./src/router/route_registry');
var location_2 = require('./src/router/location');
var angular2_2 = require('angular2/angular2');
var lang_1 = require('./src/facade/lang');
var exceptions_1 = require('angular2/src/facade/exceptions');
/**
 * Token used to bind the component with the top-level {@link RouteConfig}s for the
 * application.
 *
 * ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
 *
 * ```
 * import {Component} from 'angular2/angular2';
 * import {
 *   ROUTER_DIRECTIVES,
 *   ROUTER_PROVIDERS,
 *   RouteConfig
 * } from 'angular2/router';
 *
 * @Component({directives: [ROUTER_DIRECTIVES]})
 * @RouteConfig([
 *  {...},
 * ])
 * class AppCmp {
 *   // ...
 * }
 *
 * bootstrap(AppCmp, [ROUTER_PROVIDERS]);
 * ```
 */
exports.ROUTER_PRIMARY_COMPONENT = lang_1.CONST_EXPR(new angular2_2.OpaqueToken('RouterPrimaryComponent'));
/**
 * A list of directives. To use the router directives like {@link RouterOutlet} and
 * {@link RouterLink}, add this to your `directives` array in the {@link View} decorator of your
 * component.
 *
 * ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
 *
 * ```
 * import {Component} from 'angular2/angular2';
 * import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router';
 *
 * @Component({directives: [ROUTER_DIRECTIVES]})
 * @RouteConfig([
 *  {...},
 * ])
 * class AppCmp {
 *    // ...
 * }
 *
 * bootstrap(AppCmp, [ROUTER_PROVIDERS]);
 * ```
 */
exports.ROUTER_DIRECTIVES = lang_1.CONST_EXPR([router_outlet_2.RouterOutlet, router_link_2.RouterLink]);
/**
 * A list of {@link Provider}s. To use the router, you must add this to your application.
 *
 * ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
 *
 * ```
 * import {Component} from 'angular2/angular2';
 * import {
 *   ROUTER_DIRECTIVES,
 *   ROUTER_PROVIDERS,
 *   RouteConfig
 * } from 'angular2/router';
 *
 * @Component({directives: [ROUTER_DIRECTIVES]})
 * @RouteConfig([
 *  {...},
 * ])
 * class AppCmp {
 *   // ...
 * }
 *
 * bootstrap(AppCmp, [ROUTER_PROVIDERS]);
 * ```
 */
exports.ROUTER_PROVIDERS = lang_1.CONST_EXPR([
    route_registry_2.RouteRegistry,
    lang_1.CONST_EXPR(new angular2_2.Provider(location_strategy_2.LocationStrategy, { useClass: path_location_strategy_2.PathLocationStrategy })),
    location_2.Location,
    lang_1.CONST_EXPR(new angular2_2.Provider(router_2.Router, {
        useFactory: routerFactory,
        deps: lang_1.CONST_EXPR([route_registry_2.RouteRegistry, location_2.Location, exports.ROUTER_PRIMARY_COMPONENT, angular2_2.ApplicationRef])
    })),
    lang_1.CONST_EXPR(new angular2_2.Provider(exports.ROUTER_PRIMARY_COMPONENT, { useFactory: routerPrimaryComponentFactory, deps: lang_1.CONST_EXPR([angular2_2.ApplicationRef]) }))
]);
/**
 * @deprecated
 */
exports.ROUTER_BINDINGS = exports.ROUTER_PROVIDERS;
function routerFactory(registry, location, primaryComponent, appRef) {
    var rootRouter = new router_2.RootRouter(registry, location, primaryComponent);
    appRef.registerDisposeListener(function () { return rootRouter.dispose(); });
    return rootRouter;
}
function routerPrimaryComponentFactory(app) {
    if (app.componentTypes.length == 0) {
        throw new exceptions_1.BaseException("Bootstrap at least one component before injecting Router.");
    }
    return app.componentTypes[0];
}
//# sourceMappingURL=router.js.map


text:
package com.github.tomakehurst.wiremock.common;

public interface Source<T> {
    T load();
    void save(T item);
    boolean exists();
}


text:
using System.Web;
using Glimpse.Core.Extensions;
using Glimpse.AspNet;
using Moq;
using Xunit;

namespace Glimpse.Test.AspNet
{
    public class HttpApplicationStateBaseDataAdapterShould
    {
        public Mock<HttpApplicationStateBase> ApplicationStateMock { get; set; }

        public HttpApplicationStateBaseDataAdapterShould()
        {
            var applicationStateMock = new Mock<HttpApplicationStateBase>();
            applicationStateMock.Setup(st => st.Set(It.IsAny<string>(), It.IsAny<object>()));
            applicationStateMock.Setup(st => st.Get(typeof(int).AssemblyQualifiedName)).Returns(5);
            ApplicationStateMock = applicationStateMock;
        }

        [Fact]
        public void ContainItems()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.True(dataStore.Contains(typeof(int).AssemblyQualifiedName));
        }

        [Fact]
        public void NotContainItems()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.False(dataStore.Contains("random key"));
        }

        [Fact]
        public void ConstructWithAnHttpApplicationStateBase()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.NotNull(dataStore);
        }

        [Fact]
        public void GetViaGenerics()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.Equal(5, dataStore.Get<int>());
            ApplicationStateMock.Verify(st => st.Get(typeof(int).AssemblyQualifiedName), Times.Once());
        }

        [Fact]
        public void GetViaGenericsWithKey()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            var result = dataStore.Get<int>(typeof(int).AssemblyQualifiedName);
            Assert.Equal(5, result);
            Assert.IsType<int>(result);
            ApplicationStateMock.Verify(st => st.Get(typeof(int).AssemblyQualifiedName), Times.Once());
        }

        [Fact]
        public void GetViaKey()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.Equal(5, dataStore.Get(typeof(int).AssemblyQualifiedName));
            ApplicationStateMock.Verify(st => st.Get(typeof(int).AssemblyQualifiedName), Times.Once());
        }

        [Fact]
        public void SetViaGenerics()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            dataStore.Set<int>(5);

            Assert.Equal(5, dataStore.Get<int>());
            ApplicationStateMock.Verify(st => st.Set(typeof(int).AssemblyQualifiedName, 5), Times.Once());

        }

        [Fact]
        public void SetViaKey()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            dataStore.Set("aKey", "thing");
            ApplicationStateMock.Verify(st => st.Set("aKey", "thing"), Times.Once());

        }
    }
}


text:
declare module "classnames" {
  export default function classnames(...inputs: (string | number | false | object | undefined)[]): string;
  export class x {}
  export interface y {}
  export type z = y;
}

declare module "x" {
  export default class x {}
}

declare module "y" {
  const y = 5;
  export default y;
}


text:
#pragma once

#include "types.h"
#include <sys/time.h>

#include <stack>

#include <cuda_runtime.h>

namespace lift {

/**
 * Timer structure that measures the time difference between user-defined events.
 *
 * Lift timers measure the time between start() and stop() calls. Time is measured on the target compute device.
 * Note that because GPU timers are asynchronous, calling stop() does not necessarily mean that the timer has
 * completed the measurement.
 *
 * Timers can be used multiple times and will accumulate timing information. Calling elapsed_time() will always return
 * the total amount of time measured between successive start() / stop() calls. This implies that elapsed_time() is a
 * synchronization point for GPU timers.
 *
 * In addition to measuring time, this object has the ability to keep track of the amount of data processed
 * and return a throughput value.
 */
template <target_system system>
struct timer
{
    struct timeval start_event;
    bool started;
    float time_counter;
    uint64 bytes_tracked;

    timer()
        : started(false),
          time_counter(0.0),
          bytes_tracked(0)
    { }

    /**
     * Starts the timer. Must be followed by a stop() call.
     */
    void start(void)
    {
        if (started)
        {
            fprintf(stderr, "ERROR: inconsistent timer state\n");
            abort();
        }

        gettimeofday(&start_event, NULL);
        started = true;
    }

    /**
     * Increment the byte counter for this timer. This is meant to track the
     * amount of data processed in the section of code that's being timed,
     * in order to compute throughput metrics.
     */
    void data(uint64 bytes)
    {
        bytes_tracked += bytes;
    }

    /**
     * Increment the byte counter by the number of bytes in the pointer.
     * This is meant to track the amount of data processed in the section
     * of code that's being timed, in order to compute throughput metrics.
     */
    template <typename T>
    void data(pointer<system, T> ptr)
    {
        data(ptr.size() * sizeof(T));
    }

    /**
     * Stops the timer. Must only be called after start().
     */
    void stop(void)
    {
        if (!started)
        {
            fprintf(stderr, "ERROR: inconsistent timer state\n");
            abort();
        }

        struct timeval stop_event, res;

        gettimeofday(&stop_event, NULL);

        timersub(&stop_event, &start_event, &res);
        time_counter += res.tv_sec + res.tv_usec / 1000000.0;

        started = false;
    }

    /**
     * Returns the elapsed time between start() / stop() calls in seconds.
     *
     * Note that for GPU timers, this will wait for all commands prior to the last stop() call to be executed.
     *
     * @return  Elapsed time in seconds.
     */
    float elapsed_time(void)
    {
        return time_counter;
    }

    /**
     * Return the throughput value in bytes/s. Throughput is computed
     * based on the number of bytes that were tracked by the timer.
     *
     * @return Throughput value in bytes/second.
     */
    float throughput_b(void)
    {
        return float(bytes_tracked) / elapsed_time();
    }

    /**
     * Return the throughput value in KB/s. Throughput is computed
     * based on the number of bytes that were tracked by the timer.
     *
     * @return Throughput value in KB/second.
     */
    float throughput_KB(void)
    {
        return throughput_b() / 1024.0;
    }

    /**
     * Return the throughput value in MB/s. Throughput is computed
     * based on the number of bytes that were tracked by the timer.
     *
     * @return Throughput value in MB/second.
     */
    float throughput_MB(void)
    {
        return throughput_KB() / 1024.0;
    }

    /**
     * Return the throughput value in GB/s. Throughput is computed
     * based on the number of bytes that were tracked by the timer.
     *
     * @return Throughput value in GB/second.
     */
    float throughput_GB(void)
    {
        return throughput_MB() / 1024.0;
    }
};

template <>
struct timer<cuda>
{
    typedef struct
    {
        cudaEvent_t start;
        cudaEvent_t end;
    } sample_type;

    std::stack<sample_type> retired_events;

    sample_type active_sample;
    bool started;
    float time_counter;
    uint64 bytes_tracked;

    timer()
        : retired_events(),
          started(false),
          time_counter(0.0),
          bytes_tracked(0)
    { }

    timer(const timer&) = delete;

    ~timer()
    {
        flush();
    }

    void start(void)
    {
        if (started)
        {
            fprintf(stderr, "ERROR: inconsistent timer state\n");
            abort();
        }

        cudaError_t err;

        err = cudaEventCreate(&active_sample.start);
        if (err != cudaSuccess)
        {
            fprintf(stderr, "ERROR: cudaEventCreate failed (%d): %s\n", err, cudaGetErrorName(err));
        }

        err = cudaEventCreate(&active_sample.end);
        if (err != cudaSuccess)
        {
            fprintf(stderr, "ERROR: cudaEventCreate failed (%d): %s\n", err, cudaGetErrorName(err));
        }

        err = cudaEventRecord(active_sample.start);
        if (err != cudaSuccess)
        {
            fprintf(stderr, "ERROR: start: cudaEventRecord failed (%d): %s\n", err, cudaGetErrorName(err));
        }

        started = true;
    }

    void data(uint64 bytes)
    {
        bytes_tracked += bytes;
    }

    template <typename T>
    void data(pointer<cuda, T> ptr)
    {
        data(ptr.size() * sizeof(T));
    }

    void stop(void)
    {
        if (!started)
        {
            fprintf(stderr, "ERROR: inconsistent timer state\n");
            abort();
        }

        cudaError_t err;
        err = cudaEventRecord(active_sample.end);
        if (err != cudaSuccess)
        {
            fprintf(stderr, "ERROR: stop: cudaEventRecord failed (%d): %s\n", err, cudaGetErrorName(err));
        }

        retired_events.push(active_sample);
        started = false;
    }

private:
    void flush(void)
    {
        while(!retired_events.empty())
        {
            float ms;

            sample_type sample = retired_events.top();
            retired_events.pop();

            cudaEventSynchronize(sample.end);
            cudaEventElapsedTime(&ms, sample.start, sample.end);
            time_counter += ms / 1000.0;

            cudaEventDestroy(sample.start);
            cudaEventDestroy(sample.end);
        }
    }

public:
    float elapsed_time(void)
    {
        flush();
        return time_counter;
    }

    float throughput_b(void)
    {
        return float(bytes_tracked) / elapsed_time();
    }

    float throughput_KB(void)
    {
        return throughput_b() / 1024.0;
    }

    float throughput_MB(void)
    {
        return throughput_KB() / 1024.0;
    }

    float throughput_GB(void)
    {
        return throughput_MB() / 1024.0;
    }
};

} // namespace lift


text:
package com.basho.riak.client.core.operations;

import com.basho.riak.client.core.RiakMessage;
import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.protobuf.RiakMessageCodes;
import com.basho.riak.protobuf.RiakPB;
import com.google.protobuf.ByteString;

/**
 *
 * @author Brian Roach <roach at basho dot com>
 * @since 2.0
 */
public class StoreBucketPropsOperation extends StorePropertiesOperation<Namespace>
{
    private final RiakPB.RpbSetBucketReq.Builder reqBuilder;

    private StoreBucketPropsOperation(Builder builder)
    {
        super(builder.namespace);
        this.reqBuilder = builder.reqBuilder;
    }

    @Override
    protected RiakMessage createChannelMessage()
    {
        RiakPB.RpbSetBucketReq req = reqBuilder.build();
        return new RiakMessage(RiakMessageCodes.MSG_SetBucketReq, req.toByteArray());
    }

    @Override
    protected Void decode(RiakMessage rawMessage)
    {
        Operations.checkPBMessageType(rawMessage, RiakMessageCodes.MSG_SetBucketResp);
        return null;
    }

    public static class Builder extends PropsBuilder<Builder>
    {
        private final RiakPB.RpbSetBucketReq.Builder reqBuilder
            = RiakPB.RpbSetBucketReq.newBuilder();
        private final Namespace namespace;

        /**
         * Constructs a builder for a StoreBucketPropsOperation.
         * @param namespace The namespace in Riak.
         */
        public Builder(Namespace namespace)
        {
            if (namespace == null)
            {
                throw new IllegalArgumentException("Namespace cannot be null");
            }
            reqBuilder.setBucket(ByteString.copyFrom(namespace.getBucketName().unsafeGetValue()));
            reqBuilder.setType(ByteString.copyFrom(namespace.getBucketType().unsafeGetValue()));
            this.namespace = namespace;
        }

        @Override
        protected Builder self()
        {
            return this;
        }

        public StoreBucketPropsOperation build()
        {
            reqBuilder.setProps(propsBuilder);
            return new StoreBucketPropsOperation(this);
        }
    }
}


text:
from tgext.pluggable import PluggableSession

DBSession = PluggableSession()

def init_model(app_session):
    DBSession.configure(app_session)

from models import TemporaryPhotosBucket


text:
namespace litehtml
{
	class el_title : public html_tag
	{
	public:
		el_title(const std::shared_ptr<litehtml::document>& doc);
		virtual ~el_title();

	protected:
		virtual void	parse_attributes() override;
	};
}


text:
package com.coolweather.app.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

/**
 * Created by ·É on 2015/10/23 0023.
 */
public class CoolWeatherOpenHelper extends SQLiteOpenHelper {

    //    Province½¨±íÓï¾ä
    public static final String CREATE_PROVINCE = "create table Province ("
            + "id integer primary key autoincrement,"
            + "province_name text,"
            + "province_code text )";
    //    City½¨±íÓï¾ä
    public static final String CREATE_CITY = "create table City ("
            + "id integer primary key autoincrement,"
            + "city_name text,"
            + "city_code text,"
            + "province_id integer )";
    //    County½¨±íÓï¾ä
    public static final String CREATE_COUNTY = "create table County ("
            + "id integer primary key autoincrement,"
            + "county_name text,"
            + "county_code text,"
            + "city_id integer )";

    private Context mContext;

    public CoolWeatherOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        mContext = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_PROVINCE);
        db.execSQL(CREATE_CITY);
        db.execSQL(CREATE_COUNTY);
        Toast.makeText(mContext, "Create succeeded", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}


text:
SYNONYM

#### According to
IRMNG Homonym List

#### Published in
Neues Mag. Bot. 1: 123 (1794)

#### Original name
Racodium Persoon, 1794

### Remarks
null


text:
package twitter4j.examples.help;

import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;

/**
 * @author Yusuke Yamamoto - yusuke at mac.com
 * @since Twitter4J 2.1.7
 */
public class Test {
    /**
     * Usage: java twitter4j.examples.help.Test
     *
     * @param args String[]
     */
    public static void main(String[] args) {
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            System.out.println(twitter.test() ? "Ok" : "something went wrong");
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to call test method: " + te.getMessage());
            System.exit(-1);
        }
    }
}


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
L. Beissner et al. , Handb. Landholzben. 410. 1903

#### Original name
null

### Remarks
null


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Persistence.SqlSyntax;

namespace Umbraco.Core.Persistence.Querying
{
    internal class ModelToSqlExpressionHelper<T> : BaseExpressionHelper<T>
    {

        private readonly BaseMapper _mapper;

        public ModelToSqlExpressionHelper()
        {
            _mapper = MappingResolver.Current.ResolveMapperByType(typeof(T));
        }

        protected override string VisitMemberAccess(MemberExpression m)
        {
            if (m.Expression != null &&
                m.Expression.NodeType == ExpressionType.Parameter
                && m.Expression.Type == typeof(T))
            {
                var field = _mapper.Map(m.Member.Name, true);
                if (field.IsNullOrWhiteSpace())
                    throw new InvalidOperationException("The mapper returned an empty field for the member name: " + m.Member.Name);
                return field;
            }

            if (m.Expression != null && m.Expression.NodeType == ExpressionType.Convert)
            {
                var field = _mapper.Map(m.Member.Name, true);
                if (field.IsNullOrWhiteSpace())
                    throw new InvalidOperationException("The mapper returned an empty field for the member name: " + m.Member.Name);
                return field;
            }

            var member = Expression.Convert(m, typeof(object));
            var lambda = Expression.Lambda<Func<object>>(member);
            var getter = lambda.Compile();
            object o = getter();

            SqlParameters.Add(o);
            return string.Format("@{0}", SqlParameters.Count - 1);

            //return GetQuotedValue(o, o != null ? o.GetType() : null);

        }

        //protected bool IsFieldName(string quotedExp)
        //{
        //    //Not entirely sure this is reliable, but its better then simply returning true
        //    return quotedExp.LastIndexOf("'", StringComparison.InvariantCultureIgnoreCase) + 1 != quotedExp.Length;
        //}
    }
}


text:
class CreateFaculties < ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end


text:
"""

  fs.tests.test_xattr:  testcases for extended attribute support

"""

import unittest
import os

from fs.path import *
from fs.errors import *
from fs.tests import FSTestCases

class XAttrTestCases:
    """Testcases for filesystems providing extended attribute support.

    This class should be used as a mixin to the unittest.TestCase class
    for filesystems that provide extended attribute support.
    """

    def test_getsetdel(self):
        def do_getsetdel(p):
            self.assertEqual(self.fs.getxattr(p,"xattr1"),None)
            self.fs.setxattr(p,"xattr1","value1")
            self.assertEqual(self.fs.getxattr(p,"xattr1"),"value1")
            self.fs.delxattr(p,"xattr1")
            self.assertEqual(self.fs.getxattr(p,"xattr1"),None)
        self.fs.setcontents("test.txt","hello")
        do_getsetdel("test.txt")
        self.assertRaises(ResourceNotFoundError,self.fs.getxattr,"test2.txt","xattr1")
        self.fs.makedir("mystuff")
        self.fs.setcontents("/mystuff/test.txt","")
        do_getsetdel("mystuff")
        do_getsetdel("mystuff/test.txt")

    def test_list_xattrs(self):
        def do_list(p):
            self.assertEquals(sorted(self.fs.listxattrs(p)),[])
            self.fs.setxattr(p,"xattr1","value1")
            self.assertEquals(self.fs.getxattr(p,"xattr1"),"value1")
            self.assertEquals(sorted(self.fs.listxattrs(p)),["xattr1"])
            self.assertTrue(isinstance(self.fs.listxattrs(p)[0],unicode))
            self.fs.setxattr(p,"attr2","value2")
            self.assertEquals(sorted(self.fs.listxattrs(p)),["attr2","xattr1"])
            self.assertTrue(isinstance(self.fs.listxattrs(p)[0],unicode))
            self.assertTrue(isinstance(self.fs.listxattrs(p)[1],unicode))
            self.fs.delxattr(p,"xattr1")
            self.assertEquals(sorted(self.fs.listxattrs(p)),["attr2"])
            self.fs.delxattr(p,"attr2")
            self.assertEquals(sorted(self.fs.listxattrs(p)),[])
        self.fs.setcontents("test.txt","hello")
        do_list("test.txt")
        self.fs.makedir("mystuff")
        self.fs.setcontents("/mystuff/test.txt","")
        do_list("mystuff")
        do_list("mystuff/test.txt")

    def test_copy_xattrs(self):
        self.fs.setcontents("a.txt","content")
        self.fs.setxattr("a.txt","myattr","myvalue")
        self.fs.setxattr("a.txt","testattr","testvalue")
        self.fs.makedir("stuff")
        self.fs.copy("a.txt","stuff/a.txt")
        self.assertTrue(self.fs.exists("stuff/a.txt"))
        self.assertEquals(self.fs.getxattr("stuff/a.txt","myattr"),"myvalue")
        self.assertEquals(self.fs.getxattr("stuff/a.txt","testattr"),"testvalue")
        self.assertEquals(self.fs.getxattr("a.txt","myattr"),"myvalue")
        self.assertEquals(self.fs.getxattr("a.txt","testattr"),"testvalue")
        self.fs.setxattr("stuff","dirattr","a directory")
        self.fs.copydir("stuff","stuff2")
        self.assertEquals(self.fs.getxattr("stuff2/a.txt","myattr"),"myvalue")
        self.assertEquals(self.fs.getxattr("stuff2/a.txt","testattr"),"testvalue")
        self.assertEquals(self.fs.getxattr("stuff2","dirattr"),"a directory")
        self.assertEquals(self.fs.getxattr("stuff","dirattr"),"a directory")

    def test_move_xattrs(self):
        self.fs.setcontents("a.txt","content")
        self.fs.setxattr("a.txt","myattr","myvalue")
        self.fs.setxattr("a.txt","testattr","testvalue")
        self.fs.makedir("stuff")
        self.fs.move("a.txt","stuff/a.txt")
        self.assertTrue(self.fs.exists("stuff/a.txt"))
        self.assertEquals(self.fs.getxattr("stuff/a.txt","myattr"),"myvalue")
        self.assertEquals(self.fs.getxattr("stuff/a.txt","testattr"),"testvalue")
        self.fs.setxattr("stuff","dirattr","a directory")
        self.fs.movedir("stuff","stuff2")
        self.assertEquals(self.fs.getxattr("stuff2/a.txt","myattr"),"myvalue")
        self.assertEquals(self.fs.getxattr("stuff2/a.txt","testattr"),"testvalue")
        self.assertEquals(self.fs.getxattr("stuff2","dirattr"),"a directory")

    def test_remove_file(self):
        def listxattrs(path):
            return list(self.fs.listxattrs(path))
        #  Check that xattrs aren't preserved after a file is removed
        self.fs.createfile("myfile")
        self.assertEquals(listxattrs("myfile"),[])
        self.fs.setxattr("myfile","testattr","testvalue")
        self.assertEquals(listxattrs("myfile"),["testattr"])
        self.fs.remove("myfile")
        self.assertRaises(ResourceNotFoundError,listxattrs,"myfile")
        self.fs.createfile("myfile")
        self.assertEquals(listxattrs("myfile"),[])
        self.fs.setxattr("myfile","testattr2","testvalue2")
        self.assertEquals(listxattrs("myfile"),["testattr2"])
        self.assertEquals(self.fs.getxattr("myfile","testattr2"),"testvalue2")
        #  Check that removing a file without xattrs still works
        self.fs.createfile("myfile2")
        self.fs.remove("myfile2")

    def test_remove_dir(self):
        def listxattrs(path):
            return list(self.fs.listxattrs(path))
        #  Check that xattrs aren't preserved after a dir is removed
        self.fs.makedir("mydir")
        self.assertEquals(listxattrs("mydir"),[])
        self.fs.setxattr("mydir","testattr","testvalue")
        self.assertEquals(listxattrs("mydir"),["testattr"])
        self.fs.removedir("mydir")
        self.assertRaises(ResourceNotFoundError,listxattrs,"mydir")
        self.fs.makedir("mydir")
        self.assertEquals(listxattrs("mydir"),[])
        self.fs.setxattr("mydir","testattr2","testvalue2")
        self.assertEquals(listxattrs("mydir"),["testattr2"])
        self.assertEquals(self.fs.getxattr("mydir","testattr2"),"testvalue2")
        #  Check that removing a dir without xattrs still works
        self.fs.makedir("mydir2")
        self.fs.removedir("mydir2")
        #  Check that forcibly removing a dir with xattrs still works
        self.fs.makedir("mydir3")
        self.fs.createfile("mydir3/testfile")
        self.fs.removedir("mydir3",force=True)
        self.assertFalse(self.fs.exists("mydir3"))

from fs.xattrs import ensure_xattrs

from fs import tempfs
class TestXAttr_TempFS(unittest.TestCase,FSTestCases,XAttrTestCases):

    def setUp(self):
        fs = tempfs.TempFS()
        self.fs = ensure_xattrs(fs)

    def tearDown(self):
        try:
            td = self.fs._temp_dir
        except AttributeError:
            td = self.fs.wrapped_fs._temp_dir
        self.fs.close()
        self.assert_(not os.path.exists(td))

    def check(self, p):
        try:
            td = self.fs._temp_dir
        except AttributeError:
            td = self.fs.wrapped_fs._temp_dir
        return os.path.exists(os.path.join(td, relpath(p)))

from fs import memoryfs
class TestXAttr_MemoryFS(unittest.TestCase,FSTestCases,XAttrTestCases):

    def setUp(self):
        self.fs = ensure_xattrs(memoryfs.MemoryFS())

    def check(self, p):
        return self.fs.exists(p)


text:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Rope Test</title>
  <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<canvas id="canvas"></canvas>
<!-- <img id="cam" src="http://192.168.1.5/mjpeg.cgi"> -->
<script src="built.js"></script>
</body>
</html>


text:
namespace RLToolkit.Widgets
{
	public partial class OutputList
	{
		private global::Gtk.VBox verticalControl;
		private global::Gtk.HBox labelAlignment;
		private global::Gtk.Label lblOutput;
		private global::Gtk.Label lblEmpty;
		private global::Gtk.ScrolledWindow GtkScrolledWindow;
		private global::Gtk.TextView outputList;

        /// <summary>
        /// Build this instance.
        /// </summary>
		protected virtual void Build ()
		{
			global::Stetic.Gui.Initialize (this);
			// Widget RLToolkit.Widgets.OutputList
			global::Stetic.BinContainer.Attach (this);
			this.Name = "RLToolkit.Widgets.OutputList";
			// Container child RLToolkit.Widgets.OutputList.Gtk.Container+ContainerChild
			this.verticalControl = new global::Gtk.VBox ();
			this.verticalControl.Name = "verticalControl";
			this.verticalControl.Spacing = 6;
			// Container child verticalControl.Gtk.Box+BoxChild
			this.labelAlignment = new global::Gtk.HBox ();
			this.labelAlignment.Name = "labelAlignment";
			this.labelAlignment.Spacing = 6;
			// Container child labelAlignment.Gtk.Box+BoxChild
			this.lblOutput = new global::Gtk.Label ();
			this.lblOutput.WidthRequest = 50;
			this.lblOutput.HeightRequest = 16;
			this.lblOutput.Name = "lblOutput";
			this.lblOutput.LabelProp = global::Mono.Unix.Catalog.GetString ("Output:");
			this.labelAlignment.Add (this.lblOutput);
			global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.labelAlignment [this.lblOutput]));
			w1.Position = 0;
			w1.Expand = false;
			w1.Fill = false;
			// Container child labelAlignment.Gtk.Box+BoxChild
			this.lblEmpty = new global::Gtk.Label ();
			this.lblEmpty.HeightRequest = 16;
			this.lblEmpty.Name = "lblEmpty";
			this.labelAlignment.Add (this.lblEmpty);
			global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.labelAlignment [this.lblEmpty]));
			w2.Position = 1;
			this.verticalControl.Add (this.labelAlignment);
			global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.verticalControl [this.labelAlignment]));
			w3.Position = 0;
			w3.Expand = false;
			w3.Fill = false;
			// Container child verticalControl.Gtk.Box+BoxChild
			this.GtkScrolledWindow = new global::Gtk.ScrolledWindow ();
			this.GtkScrolledWindow.Name = "GtkScrolledWindow";
			this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
			// Container child GtkScrolledWindow.Gtk.Container+ContainerChild
			this.outputList = new global::Gtk.TextView ();
			this.outputList.CanFocus = true;
			this.outputList.Name = "outputList";
			this.GtkScrolledWindow.Add (this.outputList);
			this.verticalControl.Add (this.GtkScrolledWindow);
			global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.verticalControl [this.GtkScrolledWindow]));
			w5.Position = 1;
			this.Add (this.verticalControl);
			if ((this.Child != null)) {
				this.Child.ShowAll ();
			}
			this.Hide ();
		}
	}
}


text:
using Monkeyspeak.Editor.Notifications;
using Monkeyspeak.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace Monkeyspeak.Editor.Logging
{
    public class NotificationPanelLogOutput : ILogOutput
    {
        private readonly Level level;

        public NotificationPanelLogOutput(Level level)
        {
            this.level = level;
        }

        public void Log(LogMessage logMsg)
        {
            Color color = Colors.White;
            if (logMsg.Level != level) return;
            NotificationWithIcon.IconKind icon = NotificationWithIcon.IconKind.Info;
            switch (logMsg.Level)
            {
                case Level.Error:
                    color = Colors.Red;
                    icon = NotificationWithIcon.IconKind.Hazard;
                    break;

                case Level.Warning:
                    color = Colors.Yellow;
                    icon = NotificationWithIcon.IconKind.Warning;
                    break;

                case Level.Debug:
                    color = Colors.Silver;
                    icon = NotificationWithIcon.IconKind.Bug;
                    break;

                default:
                    icon = NotificationWithIcon.IconKind.Info;
                    break;
            }
            var sb = new StringBuilder();
            sb.AppendLine(logMsg.TimeStamp.ToString("hh:mm:fff"));
            sb.AppendLine(logMsg.message);
            try
            {
                if (logMsg.Level == Level.Error)
                    NotificationManager.Instance.AddNotification(ExceptionNotification.Instance);
                else NotificationManager.Instance.AddNotification(new NotificationWithIcon(icon, sb.ToString()));
            }
            catch { }
        }
    }
}


text:
SELECT `_class`, `href` FROM `Link` WHERE 1;

--
-- INSERT template for table `Link`
--
INSERT INTO `Link`(`_class`, `href`) VALUES (?, ?);

--
-- UPDATE template for table `Link`
--
UPDATE `Link` SET `_class` = ?, `href` = ? WHERE 1;

--
-- DELETE template for table `Link`
--
DELETE FROM `Link` WHERE 0;


text:
<?php
define('ROUTE_PATH', realpath(__DIR__ . '/routes'));

include ROUTE_PATH . '/autentification_providers.php';

include ROUTE_PATH . '/comments.php';

include ROUTE_PATH . '/email_confirmation.php';

include ROUTE_PATH . '/images.php';

include ROUTE_PATH . '/password_reset.php';

include ROUTE_PATH . '/posts.php';

include ROUTE_PATH . '/roles.php';

include ROUTE_PATH . '/tags.php';

include ROUTE_PATH . '/users.php';


text:
.friends li:first-child {
    display: none;
}


text:
package com.arnaugarcia.realstatecamp.web.rest.util;

import org.springframework.data.domain.Page;
import org.springframework.http.HttpHeaders;
import org.springframework.web.util.UriComponentsBuilder;

import java.net.URISyntaxException;
import java.util.Map;

/**
 * Utility class for handling pagination.
 *
 *

 * Pagination uses the same principles as the Github API,
 * and follow RFC 5988 (Link header).
 */
public final class PaginationUtil {

    private PaginationUtil() {
    }

    public static HttpHeaders generatePaginationHttpHeaders(Page<?> page, String baseUrl)
        throws URISyntaxException {

        HttpHeaders headers = new HttpHeaders();
        headers.add("X-Total-Count", "" + page.getTotalElements());
        String link = "";
        if ((page.getNumber() + 1) < page.getTotalPages()) {
            link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\",";
        }
        // prev link
        if ((page.getNumber()) > 0) {
            link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\",";
        }
        // last and first link
        int lastPage = 0;
        if (page.getTotalPages() > 0) {
            lastPage = page.getTotalPages() - 1;
        }
        link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\",";
        link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\"";
        headers.add(HttpHeaders.LINK, link);
        return headers;
    }

    public static HttpHeaders generatePaginationHttpHeaders(Page<?> page, Map<String, Object> params, String baseUrl)
        throws URISyntaxException {

        HttpHeaders headers = new HttpHeaders();
        headers.add("X-Total-Count", "" + page.getTotalElements());
        String link = "";

        if ((page.getNumber() + 1) < page.getTotalPages()) {
            //+ ">; rel=\"next\",";
            link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize());
            for (String currentVal: params.keySet()) {
                link+="&"+currentVal+"="+params.get(currentVal);
            }
            link+=">; rel=\"next\",";
        }
        // prev link
        if ((page.getNumber()) > 0) {
            // + ">; rel=\"prev\","
            link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize());
            for (String currentVal: params.keySet()) {
                link+="&"+currentVal+"="+params.get(currentVal);
            }
            link+=">; rel=\"prev\",";
        }
        // last and first link
        int lastPage = 0;
        if (page.getTotalPages() > 0) {
            lastPage = page.getTotalPages() - 1;

        }
        //+ ">; rel=\"last\","
        link += "<" + generateUri(baseUrl, lastPage, page.getSize());

        for (String currentVal: params.keySet()) {
            link+="&"+currentVal+"="+params.get(currentVal);
        }
        link+=">; rel=\"last\",";

        link += "<" + generateUri(baseUrl, 0, page.getSize());

        for (String currentVal: params.keySet()) {
            link+="&"+currentVal+"="+params.get(currentVal);
        }

        link +=">; rel=\"first\"";
        headers.add(HttpHeaders.LINK, link);
        return headers;
    }

    private static String generateUri(String baseUrl, int page, int size) throws URISyntaxException {
        return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString();
    }
}


text:
from __future__ import absolute_import
from builtins import range
from .belief_structure import BeliefStructure

class QTable(BeliefStructure):
    """
    Creates a Q table and visit frequency table for quick and dirty Q learning

    Indexing into the Q-table is done by

        q_table[action_idx][state_idx] = Q(s,a)

    <b>Only useful for fully-observable problems</b>

    """

    def __init__(self, agent):
        self.agent = agent
        self.q_table = None
        self.visit_frequency_table = None

    def reset(self):
        self.initialize()

    def initialize(self, init_value=None):
        """
        Create multidimensional tables of dim: num_observations x num_actions x num_states to
        store the estimated Q values and the visit frequency
        :param init_value - used to initialize the Q values to some arbitrary value
        :return:
        """
        self.q_table = [[init_value for _ in
                         range(self.agent.model.get_all_actions()[1])]
                        for _ in range(self.agent.model.get_all_states()[1])]

        self.visit_frequency_table = [[0 for _ in
                                       range(self.agent.model.get_all_actions()[1])]
                                      for _ in range(self.agent.model.get_all_states()[1])]


text:
class Expense
  include DataMapper::Resource

  property :id, Serial
  property :amount, Integer, :null => false
  property :subject, String
  property :spent_at, Date

  has n, :taggings
  has n, :tags, :through => :taggings

  # an expense _can_ belong to an event if it is a shared expense
  belongs_to :event
  # an expense always belongs to a user; the one who paid
  belongs_to :user

  before :create do
    self.spent_at = Date.today unless self.spent_at
  end

  def tagged_with?(*tag_ids)
    tag_ids = tag_ids.map { |tag| tag.id } if tag_ids.first.is_a?(Tag)
    tag_ids.empty? || tag_ids.any? { |tag_id| !taggings.select { |tagging| tagging.tag_id == tag_id }.empty? }
  end

  def spent_before?(date)
    !date || self.spent_at <= date
  end

  def spent_after?(date)
    !date || self.spent_at >= date
  end
end