text:
// Copyright (c) 2012, Joshua Burke
// All rights reserved.
//
// See LICENSE for more information.

using System;

namespace Frost.Formatting
{
	/// <summary>
	///   represents the break conditions for an item
	/// </summary>
	public struct LineBreakpoint : IEquatable<LineBreakpoint>
	{
		private readonly LineBreakCondition _BreakConditionAfter;
		private readonly LineBreakCondition _BreakConditionBefore;

		private readonly BreakType _BreakType;

		/// <summary>
		///   constructs the <see cref="LineBreakpoint" /> from the given options
		/// </summary>
		/// <param name="before"> the break condition before the item </param>
		/// <param name="after"> the break condition after the item </param>
		/// <param name="isWhitespace"> indicates whether the breakpoint is on whitespace </param>
		/// <param name="isSoftHyphen"> indicates whether the breakpoint is on a soft hyphen </param>
		public LineBreakpoint(
			LineBreakCondition before,
			LineBreakCondition after,
			bool isWhitespace = false,
			bool isSoftHyphen = false) : this()
		{
			_BreakConditionBefore = before;
			_BreakConditionAfter = after;

			if(isSoftHyphen)
			{
				_BreakType = BreakType.SoftHyphen;
			}
			else if(isWhitespace)
			{
				_BreakType = BreakType.Whitespace;
			}
			else
			{
				_BreakType = BreakType.None;
			}
		}

		/// <summary>
		///   indicates the break condition after the item
		/// </summary>
		public LineBreakCondition BreakConditionAfter
		{
			get { return _BreakConditionAfter; }
		}

		/// <summary>
		///   indicates the break condition prior to the item
		/// </summary>
		public LineBreakCondition BreakConditionBefore
		{
			get { return _BreakConditionBefore; }
		}

		/// <summary>
		///   indicates whether the break is whitespace
		/// </summary>
		public bool IsWhitespace
		{
			get { return _BreakType == BreakType.Whitespace; }
		}

		/// <summary>
		///   indicates whether the break is a soft hyphen
		/// </summary>
		public bool IsSoftHyphen
		{
			get { return _BreakType == BreakType.SoftHyphen; }
		}

		public bool Equals(LineBreakpoint other)
		{
			return other.BreakConditionAfter == BreakConditionAfter &&
				other.BreakConditionBefore == BreakConditionBefore &&
					Equals(other._BreakType, _BreakType);
		}

		public override bool Equals(object obj)
		{
			if(ReferenceEquals(null, obj))
			{
				return false;
			}

			return obj is LineBreakpoint && Equals((LineBreakpoint)obj);
		}

		public override int GetHashCode()
		{
			unchecked
			{
				int result = BreakConditionAfter.GetHashCode();
				result = (result * 397) ^ BreakConditionBefore.GetHashCode();
				result = (result * 397) ^ _BreakType.GetHashCode();
				return result;
			}
		}

		private enum BreakType
		{
			None,
			Whitespace,
			SoftHyphen
		}

		public static bool operator ==(LineBreakpoint left, LineBreakpoint right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(LineBreakpoint left, LineBreakpoint right)
		{
			return !left.Equals(right);
		}
	}
}


text:
**Table Of Contents**

[What should I know before I get started?](#what-should-i-know-before-i-get-started)

[Code Of Conduct](#code-of-conduct)

[Setting up your environment](#setting-up-your-environment)

[How to submit changes](#how-to-submit-changes)

[How to suggest enhancements](#suggesting-enhancements)

[How to report a bug](#how-to-report-a-bug)

[Building Release Binaries](#building-release-binaries)

[How do I get recognized for my contributions?](#contribution-recognition)

## What should I know before I get started
CSMark takes advantage of OOP to try to modularize components and that means that making changes is usually pretty easy.

All the calculations logic and benchmark classes are in the [CSMarkLib project](https://www.github.com/CSMarkBenchmark/CSMarkLib/) to allow the 2 projects to be developed at their own pace.

CSMark is built using C# .NET Core. The library with all the benchmarks is maintained seperately. Due to the nature of our benchmarks, we don't want to support 32 Bit PC Devices as they would have substantially worse performance. In some cases we cannot avoid this such as with ARM on Linux and Windows 10.

It is also important to acknowledge that CSMark is cross-platform and works on Windows, Mac and Linux. This is important to note because each release which is published should contain binaries for as many platforms as is reasonable. Any new code that is added should be able to run on Windows, Mac or Linux.

## Setting up your environment
Setting up your environment for developing CSMark is pretty straight forward.

Below I've listed the different recommendations for different OS users.

### Setting up your environment on Windows
Developing CSMark on Windows is pretty straight forward.
* I recommend downloading [Visual Studio 2017](https://www.visualstudio.com) - Ensure that you have selected the .NET Core package for installation.
* You should download [GitHub Desktop](https://desktop.github.com/) to be able to easily [submit changes](#how-to-submit-changes)

You don't need to download anything else to get setup.  If you'd like to try out CSMark on a system without the DotNetCore SDKs (the SDK is included in the Visual Studio DotNetCore package), you'll want to download the [.NET Core Runtime](https://www.microsoft.com/net/download/core#/runtime).

If you want to use [VS Code](https://visualstudio.com/code) instead, that also works.

### Setting up your environment on macOS
Developing CSMark on Mac is also pretty straight forward.

* I recommend downloading [VS Code](https://code.visualstudio.com/).
* You should download [GitHub Desktop](https://desktop.github.com/) to be able to easily clone the repository or [submit changes](#how-to-submit-changes).

You'll also want to download the latest [.NET Core SDK for Mac](https://www.microsoft.com/net/download/macos) (We're using .NET Core 2.0 at the moment so make sure to install the correct SDK for that version.)

 If you'd like to try out CSMark on a system without the .NET Core SDK, you'll want to download the [DotNetCore Runtime](https://www.microsoft.com/net/download/core#/runtime).

If you want to use [Visual Studio 2017 for Mac](https://www.visualstudio.com/vs/visual-studio-mac/) instead, that also works.

### Setting up your environment on Linux
Developing CSMark on Linux has gotten easier recently but you may encounter problems.

If you're running a popular Linux Distro which is supported and the version you're using is supported then this section is for you.

* You'll probably want to install [VS Code](https://code.visualstudio.com).
* You'll want to download the latest [.NET Core SDK for Linux](https://www.microsoft.com/net/download/linux) (We're using .NET Core 2.0 at the moment so make sure to install the correct SDK for that version.)

In all honesty, you can use any Git client you like. GitHub currently doesn't have a linux version of their new GitHub desktop program but I suspect that we could see a linux build in the future.
For now though, any Git client will work but you'll have to configure it yourself.

## How to submit changes
You can submit changes by:
1. Forking this repository - It's as simple as pressing that fork button.
2. Cloning your fork of the repository onto your PC - This can be through GitHub Desktop's easy cloning functionality or through Git clone on any computer.
3. Make whatever changes you want to make
4. Test the changes and debug the app to make sure you haven't introduced any new bugs.
5. Create a Pull request
6. Fill in the required details specified in the Pull Request Template - Make sure that your title does not include an issue number.
7. Include screenshots if possible
8. Ensure that your code is compatible with and/or works on Windows, Mac, and Linux.
9. Wait for a Maintainer to check your Pull Request. If it's up to provides 1 or more meaningful improvements such as new features or bug fixes, then Maintainers can accept the Pull Request and Merge it into the main branch. - In general, try to seperate your pull requests to only focus on the minimum required to achieve its goal so that each individual feature or fix can be reviewed individually.

## Building Release Binaries
So, you want to build release binaries of CSMark?

You'll need all the SDKs and Tools mentioned above in [Setting up your environment](#setting-up-your-environment).

Creating binaries currently requires using the .NET CLI Build commands. I've listed them below for your convenience.

You can run the commands from any Shell such as CMD on Windows or Terminal on Mac or Linux as long as you have .NET Core SDK installed.

For Windows 10 64 Bit: `` dotnet publish -c Release -r win10-x64  ``

For Windows 10 ARM 64 Bit: `` dotnet publish -c Release -r win10-arm64  ``

For Windows 10 ARM 32 Bit: `` dotnet publish -c Release -r win10-arm  ``

For macOS 10.12 "Sierra" and macOS 10.13 "High Sierra" ": `` dotnet publish -c Release -r osx-x64 ``

For 64 Bit Linux Distros: `` dotnet publish -c Release -r linux-x64  ``

For ARM 32 Bit Linux Distros: `` dotnet publish -c Release -r linux-arm  ``

The license file has been set to be copied every time you create a new binary so you don't need to worry about that. Installation Instructions are also included every time a new build is compiled.

You may wish to ZIP the files for publishing or distributing them.

That doesn't mean that if you make or distribute your own releases that you have to. You can use [NSIS](http://nsis.sourceforge.net/Main%5FPage) if you're more familiar with that.

## Code Of Conduct
Everybody participating in the CSMark project must abide by the [CSMark Code of Conduct](https://github.com/AluminiumTech/CSMark/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
Please report unacceptable behavior to aluminiumdev@gmail.com.

## How to report a bug
This section guides you through submitting a bug report for CSMark.

### Before submitting a bug report
* Check to see if there an existing bug report for the bug you've experienced.
* If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.

### How do I submit a good bug report?
Bugs in CSMark are tracked as [GitHub issues](https://guides.github.com/features/issues/).
Create an issue following [the template](https://github.com/CSMarkBenchmark/CSMark/blob/master/ISSUE_TEMPLATE.md).

Explain the problem & include various information to help maintainers reproduce the problem:
* Use a clear and descriptive title - Maintainers should be able to have a good idea about what issue you're experiencing before they click on your issue.
* Describe exactly how to reproduce the problem - State what you did and how you did them.
* Describe the behavior you observed after following the steps and point out what exactly is the problem with that behavior.
* Explain which behavior you expected to see instead and why.
* If the problem wasn't triggered by a specific action, describe what you were doing before the problem happened and share more information using the guidelines below
* Can you reliably reproduce the issue? If not, provide details about how often the problem happens and under which conditions it normally happens.

## Suggesting Enhancements
* Use a clear and descriptive title for the issue to identify the suggestion - It should be obvious to maintainers exactly what you want. Try to keep it under 150 characters.
* Provide a step-by-step description of the suggested enhancement in as many details as possible.
* Describe the current behavior and explain which behavior you expected to see instead and why.
* State what version of CSMark you're using
* State the name and version of the OS you're using.

## Contribution Recognition
Thank you for contributing to this project! You're awesome :) .

redpajama_set_name: RedPajamaGithub


text:
layout: post
title: "New Zealand 7 - Waiheke"
date: 2018-02-23
category: journal
---

<link rel="stylesheet" type="text/css"  href="/keiths-site/css/main.css">

*Part 7 of a journal documenting shenanigans abroad in New Zealand for family and anyone else interested.*

The island of Waiheke is a half hour ferry ride out of Auckland.

![NZWaihekeFerry](/keiths-site/image_dir/NZWaihekeFerry.jpg)

I wanted to get one last stop in before my fall semester here starts, and so I planned to camp on the island at least a night.

![NZWaiheke](/keiths-site/image_dir/NZWaiheke.jpg)

I decided it didn't really matter that I didn't have any equipment, so long as conditions were right. My readers might be asking, "But Keith, what about an air mattress, or a sleeping bag?" To which I would respond that with the number of clothes I was adorning before settling down for the night, I had become the air mattress. I had become the sleeping bag.

![NZWaihekeRoad](/keiths-site/image_dir/NZWaihekeRoad.jpg)

When I arrived at the grounds I couldn't find the ranger at first, so some travelers about my age kindly mentioned that I could stop by their site to get my bearings. They were speaking German to one another, so I took the opportunity to practice a bit and talked to one of them. He mentioned a beach nearby I could visit, though I didn't get the chance to see it. We were, after all, in a large area; Whakanawha Regional Park. As I settled down for the night I was looking directly up at the Milky Way. First time I've seen it, I think.

![NZWaihekeBeach](/keiths-site/image_dir/NZWaihekeBeach.jpg)

The night is always, always there, even if the sun or city lights have thrown themselves in front of it. It patiently waits for our rediscovery of it. This seems organic, natural, even expected. (We are, after all, star stuff.) What perplexes me though is that, at least in one way or another, one has to be lucky to catch on to this at a moment's notice, despite it being so foundational. Something needs to trigger the epiphany... ("Oh, it's you again, Night. Hello.") Some of the best people you'll meet seem to hold the allure of the sky close to them, fold it up and tuck it somewhere safe, like under their pillow or something.


text:
class CreateIssueFilters < ActiveRecord::Migration

  def self.up
    create_table :issue_filters do |t|
      t.column :name,        :string,  :null => false,   :limit => 100
      t.column :user_login,  :string,  :null => true,	   :limit => 40
      t.column :shared,      :boolean, :null => false,   :default => false
      t.column :description, :string,  :null => true,    :limit => 4000
      t.column :data,        :text,    :null => true
      t.column :created_at,  :datetime,  :null => true
      t.column :updated_at,  :datetime,  :null => true
    end
    add_index :issue_filters, :name, :name => 'issue_filters_name'
  end

end


text:
[![npm](https://img.shields.io/npm/v/sequelize-mock.svg)](https://www.npmjs.com/package/sequelize-mock) [![CircleCI](https://img.shields.io/circleci/project/BlinkUX/sequelize-mock.svg)](https://circleci.com/gh/BlinkUX/sequelize-mock) [![Coveralls](https://img.shields.io/coveralls/BlinkUX/sequelize-mock.svg)](https://coveralls.io/github/BlinkUX/sequelize-mock) [![MIT License](https://img.shields.io/github/license/BlinkUX/sequelize-mock.svg)](https://github.com/BlinkUX/sequelize-mock) [![Documentation Status](https://readthedocs.org/projects/sequelize-mock/badge/?version=stable)](http://sequelize-mock.readthedocs.io/en/stable/?badge=stable)

A mocking interface designed for testing code that uses [Sequelize](http://sequelizejs.com).

Documentation at [sequelize-mock.readthedocs.io](https://sequelize-mock.readthedocs.io/)

## Install

```
npm i sequelize-mock --save-dev
```

## Getting Started

The Mock Models created with this library function as drop in replacements for your unit testing.

Start by importing the library

```javascript
var SequelizeMock = require('sequelize-mock');
```

Initialize the library as you would Sequelize

```javascript
var DBConnectionMock = new SequelizeMock();
```

Define your models

```javascript
var UserMock = DBConnectionMock.define('users', {
		'email': 'email@example.com',
		'username': 'blink',
		'picture': 'user-picture.jpg',
	}, {
		instanceMethods: {
			myTestFunc: function () {
				return 'Test User';
			},
		},
	});
```

Once Mock models have been defined, you can use them as drop-in replacements for your Sequelize model objects. Data is not retrieved from a database and instead is returned based on the setup of the mock objects, the query being made, and other applied or included information.

For example, your code might look something like this

```javascript
UserMock.findOne({
	where: {
		username: 'my-user',
	},
}).then(function (user) {
	// `user` is a Sequelize Model-like object
	user.get('id');         // Auto-Incrementing ID available on all Models
	user.get('email');      // 'email@example.com'; Pulled from default values
	user.get('username');   // 'my-user'; Pulled from the `where` in the query

	user.myTestFunc();      // Will return 'Test User' as defined above
});
```

## Contributing

This library is under active development, so you should feel free to submit issues, questions, or pull requests.

## License

Created by Blink UX and licensed under the MIT license. Check the LICENSE file for more information.


text:
/*
 * WSO2 API Manager - Admin
 * This document specifies a **RESTful API** for WSO2 **API Manager** - Admin Portal. Please see [full swagger definition](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.1.66/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin/src/main/resources/admin-api.yaml) of the API which is written using [swagger 2.0](http://swagger.io/) specification.
 *
 * OpenAPI spec version: 0.11.0
 * Contact: architecture@wso2.com
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package org.wso2.carbon.apimgt.samples.utils.admin.rest.client;

import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-11-01T13:06:20.200+05:30")
public class ApiException extends Exception {
    private int code = 0;
    private Map<String, List<String>> responseHeaders = null;
    private String responseBody = null;

    public ApiException() {}

    public ApiException(Throwable throwable) {
        super(throwable);
    }

    public ApiException(String message) {
        super(message);
    }

    public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
        super(message, throwable);
        this.code = code;
        this.responseHeaders = responseHeaders;
        this.responseBody = responseBody;
    }

    public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
        this(message, (Throwable) null, code, responseHeaders, responseBody);
    }

    public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
        this(message, throwable, code, responseHeaders, null);
    }

    public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
        this((String) null, (Throwable) null, code, responseHeaders, responseBody);
    }

    public ApiException(int code, String message) {
        super(message);
        this.code = code;
    }

    public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
        this(code, message);
        this.responseHeaders = responseHeaders;
        this.responseBody = responseBody;
    }

    /**
     * Get the HTTP status code.
     *
     * @return HTTP status code
     */
    public int getCode() {
        return code;
    }

    /**
     * Get the HTTP response headers.
     *
     * @return A map of list of string
     */
    public Map<String, List<String>> getResponseHeaders() {
        return responseHeaders;
    }

    /**
     * Get the HTTP response body.
     *
     * @return Response body in the form of string
     */
    public String getResponseBody() {
        return responseBody;
    }
}


text:
#import <CoreData/NSFetchRequest.h>

@interface NSFetchRequest (_NSCoreDataSPI)
@end


text:
var BatteryOptimizations = function(successCallback,failureCallback) {
    cordova.exec(successCallback, failureCallback, 'BatteryOptimizations', 'run', [true]);
};

module.exports = BatteryOptimizations;


text:
//
//  XJTopView.h
//  TTLive
//
//  Created by Dear on 16/9/12.
//  Copyright © 2016年 Dear. All rights reserved.
//

#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, topType){
    topTypeHot, // 热门
    topTypeNew, // 最新
    topTypeCare // 关注
};
@interface XJTopView : UIView
/**滑动选中的按钮*/
@property (nonatomic, assign) topType selectBtnType;
/**选中block*/
@property (nonatomic, copy) void (^selectBlock)(topType type);
/**下划线*/
@property (nonatomic, weak, readonly) UIView *line;
@end


text:
require.config({

    baseUrl: '/static/',
    paths: {
        nbextensions : '/nbextensions',
        kernelspecs : '/kernelspecs',
        underscore : 'components/underscore/underscore-min',
        backbone : 'components/backbone/backbone-min',
        jquery: 'components/jquery/jquery.min',
        bootstrap: 'components/bootstrap/js/bootstrap.min',
        bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
        jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min',
        moment: 'components/moment/moment',
        codemirror: 'components/codemirror',
        termjs: 'components/term.js/src/term',
        selectize: 'components/selectize/selectize',
        emacs: 'components/codemirror/emacs',
    },
    shim: {
        underscore: {
            exports: '_'
        },
        backbone: {
            deps: ["underscore", "jquery"],
            exports: "Backbone"
        },
        bootstrap: {
            deps: ["jquery"],
            exports: "bootstrap"
        },
        bootstraptour: {
            deps: ["bootstrap"],
            exports: "Tour"
        },
        jqueryui: {
            deps: ["jquery"],
            exports: "$"
        },
        selectize: {
            deps: ["jquery"]
        }
    }
});

require(["widgets/js/widget", "widgets/js/manager", "jquery", "selectize"], function(widget, manager, $){
    var SelectizeView = widget.DOMWidgetView.extend({

        render : function(){
            var theme = this.model.get('theme');
            $('head').append('<link rel="stylesheet" href="/static/custom/selectize.' + theme + '.css">');
            this.$el
                .addClass('widget-hbox widget-selectize');
            this.$label = $('<label></label>')
                .appendTo(this.$el)
                .addClass('widget-hlabel')
                .attr('for', 'input-selectize')
                .hide();
            this.$listbox = $('<input/>')
                .addClass(theme)
                .addClass('widget-listbox')
                .attr('id', 'input-selectize')
                .attr('type', 'text')
                .attr('value', this.model.get('_value_names').join(','))
                .appendTo(this.$el);
            this.update();
        },

        update : function(options){
            if (options === undefined || options.updated_view != this) {
                var description = this.model.get('description'),
                    disabled = this.model.get('disabled');
                this.$listbox.prop('disabled', disabled);
                if (description.length === 0) {
                    this.$label.hide();
                } else {
                    this.$label.show();
                    this.$label.text(description);
                }

                this.$listbox.selectize({
                    persist: false,
                    createOnBlur: true,
                    create: true
                });
                return SelectizeView.__super__.update.apply(this);
            }
        },

        events: {
            "change input" : "handleChanged"
        },

        handleChanged : function(e) { // handle_click
            this.model.set('value_name', e.target.value, {updated_view: this});
            this.touch();
        }
    });

    manager.WidgetManager.register_widget_view('SelectizeView', SelectizeView);
})

require(["base/js/events", "emacs"], function(events){
    events.on('app_initialized.NotebookApp', function(){
        mode = 'emacs';
        IPython.notebook.get_cells().map(function (c) {
            return c.code_mirror.setOption('keyMap', mode);
        });

        IPython.Cell.options_default.cm_config.keyMap = mode;

        // exentensions from IPython-notebook-extensions
        IPython.load_extensions('slidemode/main');
        IPython.load_extensions('usability/chrome_clipboard');
        IPython.load_extensions('usability/dragdrop/drag-and-drop');
        IPython.load_extensions('usability/runtools/runtools');
        IPython.load_extensions('usability/rubberband/main');
        IPython.load_extensions('usability/toggle_full_textarea/main');
    });
})


text:
package org.uberfire.java.nio.file;

public class InvalidPathException extends IllegalArgumentException {

    private String input;
    private String reason;
    private int index;

    public InvalidPathException() {
    }

    public InvalidPathException( String input,
                                 String reason,
                                 int index ) {
        this( input,
              reason );
        this.index = index;
    }

    public InvalidPathException( String input,
                                 String reason ) {
        this.input = input;
        this.reason = reason;
    }

    public String getInput() {
        return this.input;
    }

    public String getReason() {
        return this.reason;
    }

    public int getIndex() {
        return this.index;
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="HandheldFriendly" content="true" />
  <link rel="shortcut icon" href="https://www.epa.gov/sites/all/themes/epa/favicon.ico" type="image/vnd.microsoft.icon" />
  <meta name="MobileOptimized" content="width" />
  <meta http-equiv="cleartype" content="on" />
  <meta http-equiv="ImageToolbar" content="false" />
  <meta name="viewport" content="width=device-width" />
  <meta name="version" content="20161218" />

  <meta name="DC.description" content="" />
  <meta name="DC.title" content="" />
  <title>
  The Effects of Different Land Uses and Management on Stream Ecosystems and Water Quality in the Andean Amazon, Chontabamba Basin, Peru|

  Research Project Database | Grantee Research Project | ORD | US EPA</title>

  <meta name="keywords" content="" />
  <link rel="shortlink" href="" />
  <link rel="canonical" href="" />
  <meta name="DC.creator" content="" />
  <meta name="DC.language" content="en" />
  <meta name="DC.Subject.epachannel" content="" />
  <meta name="DC.type" content="" />
  <meta name="DC.date.created" content="" />
  <meta name="DC.date.modified" content="2004-10-08" />

  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/misc/ui/jquery.ui.autocomplete.css" media="all" />
  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/themes/epa/css/lib/jquery.ui.theme.css" media="all" />
  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/libraries/template2/s.css" media="all" />

	<link rel="alternate" type="application/atom+xml" title="EPA.gov All Press Releases" href="https://www.epa.gov/newsreleases/search/rss" />
	<link rel="alternate" type="application/atom+xml" title="EPA.gov Headquarters Press Releases" href="https://www.epa.gov/newsreleases/search/rss/field_press_office/headquarters" />
	<link rel="alternate" type="application/atom+xml" title="Greenversations, EPA's Blog" href="https://blog.epa.gov/blog/feed/" />

Jump to main content

  <hgroup class="site-name-and-slogan">

US EPA

United States Environmental Protection Agency

  </hgroup>
  <form class="epa-search" method="get" action="https://search.epa.gov/epasearch/epasearch">
    Search
    <input class="form-text" placeholder="Search EPA.gov" name="querytext" id="search-box" value=""/>
    <button class="epa-search-button" id="search-button" type="submit" title="Search">Search</button>
    <input type="hidden" name="fld" value="" />
    <input type="hidden" name="areaname" value="" />
    <input type="hidden" name="areacontacts" value="" />
    <input type="hidden" name="areasearchurl" value="" />
    <input type="hidden" name="typeofsearch" value="epa" />
    <input type="hidden" name="result_template" value="2col.ftl" />
    <input type="hidden" name="filter" value="sample4filt.hts" />
  </form>

Contact Us

Related Information

Research Grants

P3: Student Design Competition

Research Fellowships

Small Business Innovation Research (SBIR)

Grantee Research Project Results Search

      The Effects of Different Land Uses and Management on Stream Ecosystems and Water Quality in the Andean Amazon, Chontabamba Basin, Peru

    EPA Grant Number: MA916356

    Title: The Effects of Different Land Uses and Management on Stream Ecosystems and Water Quality in the Andean Amazon, Chontabamba Basin, Peru

    Investigators:
     Waggoner, Lindsey A

    Institution:

      Florida International University

    	EPA Project Officer:

           Zambrana, Jose

      Project Period:
      January 1, 2004 through
        December 31, 2005

        Project Amount:

          $62,036

      RFA:
      GRO Fellowships for Graduate Environmental Study (2004)

        		RFA Text |
          Recipients Lists

      Research Category:

          Fellowship - Environmental Science
          ,
          Academic Fellowships
          ,
          Ecological Indicators/Assessment/Restoration

Objective:

In the Peruvian Andean Amazon, widespread conversion of forested land to agricultural land is altering ecosystems and habitats.  The goal of my research is to investigate how land-cover change and land-use management practices affect water quality and stream ecosystems within an Amazon headwater basin.  Changes in water quality and stream ecosystems can result in negative health, economic, and environmental impacts for the citizens of the basin who rely on the local aquatic resources in a myriad of ways.  My investigation will be conducted in five sub-watersheds within the Chontabamba Basin near the town of Oxapampa, Peru.  My research will contribute to the development of improved land management strategies to minimize negative impacts to local aquatic resources.

The objectives of my research project are to determine:  (1) the biophysical characteristics of the Chontabamba Basin (land use, land cover, towns, roads, topography, geology, vegetation, climate); (2) the physical, chemical and biological conditions of stream and river reaches; (3) the relationships between catchment characteristics and stream condition across a range of temporal and spatial scales; (4) the relationships between land-management practices and stream condition; and (5) improved land-management strategies to reduce negative impacts.

Approach:

My research  will combine remote sensing data, field surveys, water sampling, human surveys, and laboratory analyses.  Biophysical characteristics of the study area will be determined from Landsat images (Landsat ETM+), aerial photographs, and a digital elevation model.  Derived land-cover and land-use data will be verified using ground-control points.  Stream condition will be assessed using a modified version of EPA's Rapid Bioassessment Protocols.  Water samples will be analyzed for relevant chemical parameters.  Landowners will be interviewed for information regarding land management, land use, and land history.  Data will be analyzed statistically within a geographic information system to determine relationships among stream condition, physical characteristics, and land management.

I expect to find that good water quality and stream ecosystem conditions are related to areas with minimal relief, low-intensity land use, and good land-management practices.  Further, I expect water quality and stream ecosystem conditions to be positively correlated with the width of the riparian buffer zone and percent of forested area within the catchment.  To disseminate my findings to the local communities, the improved land management strategies revealed by my research will be presented in local community meetings and in popular science publications in Spanish.

Supplemental Keywords:

      fellowship, aquatic resources, water quality, stream condition, Andean Amazon, land-cover change, land use management, EPA Rapid Bioassessment Protocols, Peru, land use, land management, deforestation, Amazon., RFA, Scientific Discipline, Geographic Area, Ecosystem Protection/Environmental Exposure & Risk, Aquatic Ecosystems & Estuarine Research, Aquatic Ecosystem, Environmental Monitoring, Ecology and Ecosystems, International, anthropogenic stress, streams, land cover, ecosystem monitoring, Peru, rivers, Andean Amazon, aquatic ecosystems, water quality, remotely sensed data, evaluating alternative land management strategies, human modifications, deforestation

Relevant Websites:

2004 STAR Graduate Fellowship Conference Poster (PDF, 1p., 148KB, about PDF)

Top of Page

 The perspectives, information and conclusions conveyed in research project abstracts, progress reports, final reports, journal abstracts and journal publications convey the viewpoints of the principal investigator and may not represent the views and policies of ORD and EPA.  Conclusions drawn by the principal investigators have not been reviewed by the Agency.

Main menu

Environmental Topics

Laws & Regulations

About EPA

Discover.

Accessibility

EPA Administrator

Budget & Performance

Contracting

Grants

No FEAR Act Data

Privacy and Security

Connect.

Data.gov

Inspector General

Jobs

Newsroom

Open Government

Regulations.gov

Subscribe

USA.gov

White House

Ask.

Contact Us

Hotlines

FOIA Requests

Frequent Questions

Follow.

Facebook

Twitter

YouTube

Flickr

Instagram

Last updated on Friday, October 8, 2004


text:
using System;
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;

namespace Nustache.Core.Tests
{
    [TestFixture]
    public class Describe_Block
    {
        [Test]
        public void It_cant_be_constructed_with_a_null_name()
        {
            Assert.Throws<ArgumentNullException>(() => new Block(null));
        }

        [Test]
        public void It_renders_its_child_parts_if_name_evaluates_to_true()
        {
            var a = new Block("a", new LiteralText("b"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = true }, writer, null);

            a.Render(context);

            Assert.AreEqual("b", writer.GetStringBuilder().ToString());
        }

        [Test]
        public void It_does_not_render_its_child_parts_if_name_evaluates_to_empty_string()
        {
            var a = new Block("a", new LiteralText("b"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = "" }, writer, null);

            a.Render(context);

            Assert.AreEqual("", writer.GetStringBuilder().ToString());
        }

        [Test]
        public void It_renders_its_child_parts_once_for_each_item_if_name_evaluates_to_a_collection()
        {
            var a = new Block("a", new LiteralText("b"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = new [] { 1, 2, 3 } }, writer, null);

            a.Render(context);

            Assert.AreEqual("bbb", writer.GetStringBuilder().ToString());
        }

        [Test]
        public void It_supports_accessing_members_of_child_objects()
        {
            var a = new Block("a.b", new LiteralText("c"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = new { b = new[] { 1, 2, 3 } } }, writer, null);

            a.Render(context);

            Assert.AreEqual("ccc", writer.GetStringBuilder().ToString());
        }

        [Test]
        public void It_does_not_treat_dictionaries_as_lists()
        {
            var a = new Block("a", new LiteralText("x"));
            var writer = new StringWriter();
            var context = new RenderContext(
                null,
                new { a = new Dictionary<string, int> { { "b", 1 }, { "c", 2 }, { "d", 3 } } },
                writer,
                null);

            a.Render(context);

            Assert.AreEqual("x", writer.GetStringBuilder().ToString());
        }

        [Test]
        public void It_Nested_Fully_Qualified_Statements_Are_Evaluated()
        {
            var a = new Block("a.b",
                        new Block("a.c", new LiteralText("I should render."), new EndSection("a.c")),
                        new EndSection("a.b"));
            var writer = new StringWriter();
            var context = new RenderContext(
                null,
                new Dictionary<string, object> { { "a", new Dictionary<string, object> { { "b", 3 }, { "c", true } } } },
                writer,
                null);

            a.Render(context);

            Assert.AreEqual("I should render.", writer.GetStringBuilder().ToString());
        }

        [Test]
        public void It_has_a_useful_ToString_method()
        {
            var a = new Block("a");

            Assert.AreEqual("Block(\"a\")", a.ToString());
        }
    }
}


text:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h"

#include <memory>

#include "base/guid.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/sharing/fake_device_info.h"
#include "chrome/browser/sharing/features.h"
#include "chrome/browser/sharing/mock_sharing_service.h"
#include "chrome/browser/sharing/sharing_constants.h"
#include "chrome/browser/sharing/sharing_service_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "components/gcm_driver/fake_gcm_driver.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h"
#include "components/sync/protocol/device_info_specifics.pb.h"
#include "components/sync_device_info/fake_device_info_tracker.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

using ::testing::Eq;
using ::testing::Property;

namespace {

const char kPhoneNumber[] = "073%2099%209999%2099";
const char kReceiverGuid[] = "test_receiver_guid";
const char kReceiverName[] = "test_receiver_name";

class ClickToCallUiControllerTest : public testing::Test {
 public:
  ClickToCallUiControllerTest() = default;

  void SetUp() override {
    web_contents_ =
        content::WebContentsTester::CreateTestWebContents(&profile_, nullptr);
    SharingServiceFactory::GetInstance()->SetTestingFactory(
        &profile_, base::BindRepeating([](content::BrowserContext* context)
                                           -> std::unique_ptr<KeyedService> {
          return std::make_unique<testing::NiceMock<MockSharingService>>();
        }));
    ClickToCallUiController::ShowDialog(
        web_contents_.get(), /*initiating_origin=*/absl::nullopt,
        GURL(base::StrCat({"tel:", kPhoneNumber})), false);
    controller_ = ClickToCallUiController::GetOrCreateFromWebContents(
        web_contents_.get());
  }

 protected:
  testing::NiceMock<MockSharingService>* service() {
    return static_cast<testing::NiceMock<MockSharingService>*>(
        SharingServiceFactory::GetForBrowserContext(&profile_));
  }

  content::BrowserTaskEnvironment task_environment_;
  content::RenderViewHostTestEnabler test_render_host_factories_;
  TestingProfile profile_;
  std::unique_ptr<content::WebContents> web_contents_;
  raw_ptr<ClickToCallUiController> controller_ = nullptr;
};
}  // namespace

MATCHER_P(ProtoEquals, message, "") {
  std::string expected_serialized, actual_serialized;
  message.SerializeToString(&expected_serialized);
  arg.SerializeToString(&actual_serialized);
  return expected_serialized == actual_serialized;
}

// Check the call to sharing service when a device is chosen.
TEST_F(ClickToCallUiControllerTest, OnDeviceChosen) {
  std::unique_ptr<syncer::DeviceInfo> device_info =
      CreateFakeDeviceInfo(kReceiverGuid, kReceiverName);

  chrome_browser_sharing::SharingMessage sharing_message;
  sharing_message.mutable_click_to_call_message()->set_phone_number(
      kPhoneNumber);
  EXPECT_CALL(
      *service(),
      SendMessageToDevice(Property(&syncer::DeviceInfo::guid, kReceiverGuid),
                          Eq(kSharingMessageTTL), ProtoEquals(sharing_message),
                          testing::_));
  controller_->OnDeviceChosen(*device_info.get());
}

// Check the call to sharing service to get all synced devices.
TEST_F(ClickToCallUiControllerTest, GetSyncedDevices) {
  EXPECT_CALL(*service(),
              GetDeviceCandidates(
                  Eq(sync_pb::SharingSpecificFields::CLICK_TO_CALL_V2)));
  controller_->GetDevices();
}


text:
try:
    from fabric import colors

    def style_args(bold):
        return dict(bold=bold)

except ImportError:
    import colors

    def style_args(bold):
        return dict(style='bold') if bold else dict()

def red(*args, **kwargs):
    bold = kwargs.pop('bold', False)
    kwargs.update(style_args(bold))

    return colors.red(*args, **kwargs)

def green(*args, **kwargs):
    bold = kwargs.pop('bold', False)
    kwargs.update(style_args(bold))

    return colors.green(*args, **kwargs)

def blue(*args, **kwargs):
    bold = kwargs.pop('bold', False)
    kwargs.update(style_args(bold))

    return colors.blue(*args, **kwargs)

def yellow(*args, **kwargs):
    bold = kwargs.pop('bold', False)
    kwargs.update(style_args(bold))

    return colors.yellow(*args, **kwargs)


text:
package linkedLists;

public class Intersection {

	public static <T> LinkedListNode<T> intersection(LinkedListNode<T> l1, LinkedListNode<T> l2) {
		// get lenghts of the lists and last nodes
		Object[] lengthAndTailList1 = getLenghtAndTail(l1);
		Object[] lenghtAndTailList2 = getLenghtAndTail(l2);
		int n1 = (int) lengthAndTailList1[0], n2 = (int) lenghtAndTailList2[0];
		@SuppressWarnings("unchecked")
		LinkedListNode<T> lastl1 = (LinkedListNode<T>) lengthAndTailList1[1], lastl2 = (LinkedListNode<T>) lenghtAndTailList2[1];

		if(lastl1 != lastl2) return null; // no intersection node found

		// trim larger list
		if (n1 > n2)
			for(;l1!=null && n1 > n2; l1 = l1.next) n1--;
		else
			for(;l2!=null && n2 > n1; l2 = l2.next) n2--;
		assert n1 == n2;

		// look for intersection node
		while(l1 != null && l2 != null && l1 != l2) {
			l1 = l1.next;
			l2 = l2.next;
		}

		return l1;
	}

	private static <T> Object[] getLenghtAndTail(LinkedListNode<T> list) {
		int n = 0;
		LinkedListNode<T> last = null;
		for(LinkedListNode<T> iter = list; iter!=null; iter = iter.next) {
			n++;
			last = iter;
		}
		return new Object[] {n,last};
	}

	public static void main(String[] args) {
		LinkedListNode<Integer> intersection = new LinkedListNode<Integer>(5);intersection.appendToTail(4);intersection.appendToTail(3);

		LinkedListNode<Integer> l1 = new LinkedListNode<Integer>(7);l1.appendToTail(6);l1.next = intersection;
		LinkedListNode<Integer> l2 = new LinkedListNode<Integer>(9);l2.appendToTail(8);l2.appendToTail(6);l2.next = intersection;

		LinkedListNode<Integer> intersectionRes = intersection(l1, l2);

		System.out.println(intersection == intersectionRes);
	}

}


text:
using System;

namespace Memoria.Scripts.Battle
{
    /// <summary>
    /// Atomos
    /// </summary>
    [BattleScript(Id)]
    public sealed class AtomosScript : IBattleScript
    {
        public const Int32 Id = 0086;

        private readonly BattleCalculator _v;

        public AtomosScript(BattleCalculator v)
        {
            _v = v;
        }

        public void Perform()
        {
            if (!_v.Target.CheckUnsafetyOrMiss())
                return;

            _v.SetCommandAttack();
            _v.CasterCommand.BonusElement();
            if (!_v.CanAttackMagic())
                return;

            _v.Context.Attack += ff9item.FF9Item_GetCount(225);
            _v.CalcProportionDamage();
        }
    }
}


text:
# coding: us-ascii
# frozen_string_literal: false

require 'rdoc/test_case'

class TestRDocComment < RDoc::TestCase

  def setup
    super

    @top_level = @store.add_file 'file.rb'
    @comment = RDoc::Comment.new
    @comment.location = @top_level
    @comment.text = 'this is a comment'
  end

  def test_empty_eh
    refute_empty @comment

    @comment = ''

    assert_empty @comment
  end

  def test_equals2
    assert_equal @comment, @comment.dup

    c2 = @comment.dup
    c2.text = nil

    refute_equal @comment, c2

    c3 = @comment.dup
    c3.location = nil

    refute_equal @comment, c3
  end

  def test_extract_call_seq
    m = RDoc::AnyMethod.new nil, 'm'

    comment = RDoc::Comment.new <<-COMMENT, @top_level
call-seq:
  bla => true or false

moar comment
    COMMENT

    comment.extract_call_seq m

    assert_equal "bla => true or false\n", m.call_seq
  end

  def test_extract_call_seq_blank
    m = RDoc::AnyMethod.new nil, 'm'

    comment = RDoc::Comment.new <<-COMMENT, @top_level
call-seq:
  bla => true or false

    COMMENT

    comment.extract_call_seq m

    assert_equal "bla => true or false\n", m.call_seq
  end

  def test_extract_call_seq_commented
    m = RDoc::AnyMethod.new nil, 'm'

    comment = RDoc::Comment.new <<-COMMENT, @top_level
# call-seq:
#   bla => true or false
#
# moar comment
    COMMENT

    comment.extract_call_seq m

    assert_equal nil, m.call_seq
  end

  def test_extract_call_seq_no_blank
    m = RDoc::AnyMethod.new nil, 'm'

    comment = RDoc::Comment.new <<-COMMENT, @top_level
call-seq:
  bla => true or false
    COMMENT

    comment.extract_call_seq m

    assert_equal "bla => true or false\n", m.call_seq
  end

  def test_extract_call_seq_undent
    m = RDoc::AnyMethod.new nil, 'm'

    comment = RDoc::Comment.new <<-COMMENT, @top_level
call-seq:
  bla => true or false
moar comment
    COMMENT

    comment.extract_call_seq m

    assert_equal "bla => true or false\nmoar comment\n", m.call_seq
  end

  def test_extract_call_seq_c
    comment = RDoc::Comment.new <<-COMMENT
call-seq:
  commercial() -> Date

  commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8]

  commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]

If no arguments are given:
* ruby 1.8: returns a +Date+ for 1582-10-15 (the Day of Calendar Reform in
  Italy)
* ruby 1.9: returns a +Date+ for julian day 0

Otherwise, returns a +Date+ for the commercial week year, commercial week,
and commercial week day given. Ignores the 4th argument.
    COMMENT

    method_obj = RDoc::AnyMethod.new nil, 'blah'

    comment.extract_call_seq method_obj

    expected = <<-CALL_SEQ.chomp
commercial() -> Date

commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8]

commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]

    CALL_SEQ

    assert_equal expected, method_obj.call_seq
  end

  def test_extract_call_seq_c_no_blank
    comment = RDoc::Comment.new <<-COMMENT
call-seq:
  commercial() -> Date

  commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8]

  commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]
    COMMENT

    method_obj = RDoc::AnyMethod.new nil, 'blah'

    comment.extract_call_seq method_obj

    expected = <<-CALL_SEQ.chomp
commercial() -> Date

commercial(cwyear, cweek=41, cwday=5, sg=nil) -> Date [ruby 1.8]

commercial(cwyear, cweek=1, cwday=1, sg=nil) -> Date [ruby 1.9]

    CALL_SEQ

    assert_equal expected, method_obj.call_seq
  end

  def test_extract_call_seq_c_separator
    comment = RDoc::Comment.new <<-'COMMENT'
call-seq:
   ARGF.readlines(sep=$/)     -> array
   ARGF.readlines(limit)      -> array
   ARGF.readlines(sep, limit) -> array

   ARGF.to_a(sep=$/)     -> array
   ARGF.to_a(limit)      -> array
   ARGF.to_a(sep, limit) -> array

Reads +ARGF+'s current file in its entirety, returning an +Array+ of its
lines, one line per element. Lines are assumed to be separated by _sep_.

   lines = ARGF.readlines
   lines[0]                #=> "This is line one\n"

    COMMENT

    method_obj = RDoc::AnyMethod.new nil, 'blah'

    comment.extract_call_seq method_obj

    expected = <<-CALL_SEQ
ARGF.readlines(sep=$/)     -> array
ARGF.readlines(limit)      -> array
ARGF.readlines(sep, limit) -> array
ARGF.to_a(sep=$/)     -> array
ARGF.to_a(limit)      -> array
ARGF.to_a(sep, limit) -> array
    CALL_SEQ

    assert_equal expected, method_obj.call_seq

    expected = <<-'COMMENT'

Reads +ARGF+'s current file in its entirety, returning an +Array+ of its
lines, one line per element. Lines are assumed to be separated by _sep_.

   lines = ARGF.readlines
   lines[0]                #=> "This is line one\n"

    COMMENT

    assert_equal expected, comment.text
  end

  def test_force_encoding
    skip "Encoding not implemented" unless Object.const_defined? :Encoding

    @comment.force_encoding Encoding::UTF_8

    assert_equal Encoding::UTF_8, @comment.text.encoding
  end

  def test_format
    assert_equal 'rdoc', @comment.format
  end

  def test_format_equals
    c = comment 'content'
    document = c.parse

    c.format = RDoc::RD

    assert_equal RDoc::RD, c.format
    refute_same document, c.parse
  end

  def test_initialize_copy
    copy = @comment.dup

    refute_same @comment.text, copy.text
    assert_same @comment.location, copy.location
  end

  def test_location
    assert_equal @top_level, @comment.location
  end

  def test_normalize
    @comment.text = <<-TEXT
  # comment
    TEXT

    assert_same @comment, @comment.normalize

    assert_equal 'comment', @comment.text
  end

  def test_normalize_twice
    @comment.text = <<-TEXT
  # comment
    TEXT

    @comment.normalize

    text = @comment.text

    @comment.normalize

    assert_same text, @comment.text, 'normalize not cached'
  end

  def test_normalize_document
    @comment.text = nil
    @comment.document = @RM::Document.new

    assert_same @comment, @comment.normalize

    assert_nil @comment.text
  end

  def test_normalize_eh
    refute @comment.normalized?

    @comment.normalize

    assert @comment.normalized?
  end

  def test_text
    assert_equal 'this is a comment', @comment.text
  end

  def test_text_equals
    @comment.text = 'other'

    assert_equal 'other', @comment.text
    refute @comment.normalized?
  end

  def test_text_equals_no_text
    c = RDoc::Comment.new nil, @top_level
    c.document = @RM::Document.new

    e = assert_raises RDoc::Error do
      c.text = 'other'
    end

    assert_equal 'replacing document-only comment is not allowed', e.message
  end

  def test_text_equals_parsed
    document = @comment.parse

    @comment.text = 'other'

    refute_equal document, @comment.parse
  end

  def test_tomdoc_eh
    refute @comment.tomdoc?

    @comment.format = 'tomdoc'

    assert @comment.tomdoc?
  end

  def test_parse
    parsed = @comment.parse

    expected = @RM::Document.new(
      @RM::Paragraph.new('this is a comment'))

    expected.file = @top_level

    assert_equal expected, parsed
    assert_same  parsed, @comment.parse
  end

  def test_parse_rd
    c = comment 'it ((*works*))'
    c.format = 'rd'

    expected =
      @RM::Document.new(
        @RM::Paragraph.new('it works'))
    expected.file = @top_level

    assert_equal expected, c.parse
  end

  def test_remove_private_encoding
    skip "Encoding not implemented" unless Object.const_defined? :Encoding

    comment = RDoc::Comment.new <<-EOS, @top_level
# This is text
#--
# this is private
    EOS

    comment.force_encoding Encoding::IBM437

    comment.remove_private

    assert_equal Encoding::IBM437, comment.text.encoding
  end

  def test_remove_private_hash
    @comment.text = <<-TEXT
#--
# private
#++
# public
    TEXT

    @comment.remove_private

    assert_equal "# public\n", @comment.text
  end

  def test_remove_private_hash_trail
    comment = RDoc::Comment.new <<-EOS, @top_level
# This is text
#--
# this is private
    EOS

    expected = RDoc::Comment.new <<-EOS, @top_level
# This is text
    EOS

    comment.remove_private

    assert_equal expected, comment
  end

  def test_remove_private_long
    comment = RDoc::Comment.new <<-EOS, @top_level
#-----
#++
# this is text
#-----
    EOS

    expected = RDoc::Comment.new <<-EOS, @top_level
# this is text
    EOS

    comment.remove_private

    assert_equal expected, comment
  end

  def test_remove_private_rule
    comment = RDoc::Comment.new <<-EOS, @top_level
# This is text with a rule:
# ---
# this is also text
    EOS

    expected = comment.dup

    comment.remove_private

    assert_equal expected, comment
  end

  def test_remove_private_star
    @comment.text = <<-TEXT
/*
 *--
 * private
 *++
 * public
 */
    TEXT

    @comment.remove_private

    assert_equal "/*\n * public\n */\n", @comment.text
  end

  def test_remove_private_star2
    @comment.text = <<-TEXT
/*--
 * private
 *++
 * public
 */
    TEXT

    @comment.remove_private

    assert_equal "/*--\n * private\n *++\n * public\n */\n", @comment.text
  end

  def test_remove_private_toggle
    comment = RDoc::Comment.new <<-EOS, @top_level
# This is text
#--
# this is private
#++
# This is text again.
    EOS

    expected = RDoc::Comment.new <<-EOS, @top_level
# This is text
# This is text again.
    EOS

    comment.remove_private

    assert_equal expected, comment
  end

  def test_remove_private_toggle_encoding
    skip "Encoding not implemented" unless Object.const_defined? :Encoding

    comment = RDoc::Comment.new <<-EOS, @top_level
# This is text
#--
# this is private
#++
# This is text again.
    EOS

    comment.force_encoding Encoding::IBM437

    comment.remove_private

    assert_equal Encoding::IBM437, comment.text.encoding
  end

  def test_remove_private_toggle_encoding_ruby_bug?
    skip "Encoding not implemented" unless Object.const_defined? :Encoding

    comment = RDoc::Comment.new <<-EOS, @top_level
#--
# this is private
#++
# This is text again.
    EOS

    comment.force_encoding Encoding::IBM437

    comment.remove_private

    assert_equal Encoding::IBM437, comment.text.encoding
  end

end


text:
// --------- This code has been automatically generated !!! 2017-01-16T16:52:10.849Z
"use strict";
require("requirish")._(module);
/**
 * @module opcua.address_space.types
 */
var assert = require("better-assert");
var util = require("util");
var _  = require("underscore");
var makeNodeId = require("lib/datamodel/nodeid").makeNodeId;
var schema_helpers =  require("lib/misc/factories_schema_helpers");
var extract_all_fields                       = schema_helpers.extract_all_fields;
var resolve_schema_field_types               = schema_helpers.resolve_schema_field_types;
var initialize_field                         = schema_helpers.initialize_field;
var initialize_field_array                   = schema_helpers.initialize_field_array;
var check_options_correctness_against_schema = schema_helpers.check_options_correctness_against_schema;
var _defaultTypeMap = require("lib/misc/factories_builtin_types")._defaultTypeMap;
var ec = require("lib/misc/encode_decode");
var encodeArray = ec.encodeArray;
var decodeArray = ec.decodeArray;
var makeExpandedNodeId = ec.makeExpandedNodeId;
var generate_new_id = require("lib/misc/factories").generate_new_id;
var _enumerations = require("lib/misc/factories_enumerations")._private._enumerations;
var schema = require("../schemas/ContentFilterResult_schema").ContentFilterResult_Schema;
var ContentFilterElementResult = require("./_auto_generated_ContentFilterElementResult").ContentFilterElementResult;
var DiagnosticInfo = require("./_auto_generated_DiagnosticInfo").DiagnosticInfo;
var BaseUAObject = require("lib/misc/factories_baseobject").BaseUAObject;

/**
 *
 * @class ContentFilterResult
 * @constructor
 * @extends BaseUAObject
 * @param  options {Object}
 * @param  [options.elementResults] {ContentFilterElementResult[]}
 * @param  [options.elementDiagnosticInfos] {DiagnosticInfo[]}
 */
function ContentFilterResult(options)
{
    options = options || {};
    /* istanbul ignore next */
    if (schema_helpers.doDebug) { check_options_correctness_against_schema(this,schema,options); }
    var self = this;
    assert(this instanceof BaseUAObject); //  ' keyword "new" is required for constructor call')
    resolve_schema_field_types(schema);

    BaseUAObject.call(this,options);

    /**
      *
      * @property elementResults
      * @type {ContentFilterElementResult[]}
      */
    self.elementResults = [];
    if (options.elementResults) {
        assert(_.isArray(options.elementResults));
        self.elementResults = options.elementResults.map(function(e){ return new ContentFilterElementResult(e); } );
    }

    /**
      *
      * @property elementDiagnosticInfos
      * @type {DiagnosticInfo[]}
      */
    self.elementDiagnosticInfos = [];
    if (options.elementDiagnosticInfos) {
        assert(_.isArray(options.elementDiagnosticInfos));
        self.elementDiagnosticInfos = options.elementDiagnosticInfos.map(function(e){ return new DiagnosticInfo(e); } );
    }

   // Object.preventExtensions(self);
}
util.inherits(ContentFilterResult,BaseUAObject);
ContentFilterResult.prototype.encodingDefaultBinary = makeExpandedNodeId(609,0);
ContentFilterResult.prototype.encodingDefaultXml = makeExpandedNodeId(608,0);
ContentFilterResult.prototype._schema = schema;

/**
 * encode the object into a binary stream
 * @method encode
 *
 * @param stream {BinaryStream}
 */
ContentFilterResult.prototype.encode = function(stream,options) {
    // call base class implementation first
    BaseUAObject.prototype.encode.call(this,stream,options);
    encodeArray(this.elementResults,stream,function(obj,stream){ obj.encode(stream,options); });
    encodeArray(this.elementDiagnosticInfos,stream,function(obj,stream){ obj.encode(stream,options); });
};
/**
 * decode the object from a binary stream
 * @method decode
 *
 * @param stream {BinaryStream}
 * @param [option] {object}
 */
ContentFilterResult.prototype.decode = function(stream,options) {
    // call base class implementation first
    BaseUAObject.prototype.decode.call(this,stream,options);
    this.elementResults = decodeArray(stream, function(stream) {
       var obj = new ContentFilterElementResult();
       obj.decode(stream,options);
       return obj;
    });
    this.elementDiagnosticInfos = decodeArray(stream, function(stream) {
       var obj = new DiagnosticInfo();
       obj.decode(stream,options);
       return obj;
    });
};
ContentFilterResult.possibleFields = [
  "elementResults",
         "elementDiagnosticInfos"
];

exports.ContentFilterResult = ContentFilterResult;
var register_class_definition = require("lib/misc/factories_factories").register_class_definition;
register_class_definition("ContentFilterResult",ContentFilterResult);


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

public class StartUp
{
    static void Main()
    {
        var allPersons = new List<Person>();

        string personStr;
        while ((personStr = Console.ReadLine()) != "END")
        {
            var tokens = personStr.Split();
            var currentPerson = new Person(tokens[0], int.Parse(tokens[1]), tokens[2]);

            allPersons.Add(currentPerson);
        }

        var personToUse = allPersons[int.Parse(Console.ReadLine()) -1 ];

        var samePersonCounter = 0;

        foreach (var person in allPersons)
        {
            if (personToUse.CompareTo(person) == 0)
            {
                samePersonCounter++;
            }
        }

        if (samePersonCounter == 1)
        {
            Console.WriteLine("No matches");
        }
        else
        {
            Console.WriteLine($"{samePersonCounter} {allPersons.Count - samePersonCounter} {allPersons.Count}");
        }
    }
}


text:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//  * Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of NVIDIA CORPORATION nor the names of its
//    contributors may be used to endorse or promote products derived
//    from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.

#ifndef PXPVDSDK_PXPROFILEEVENTID_H
#define PXPVDSDK_PXPROFILEEVENTID_H

#include "PxProfileBase.h"

namespace physx { namespace profile {
	/**
	\brief A event id structure. Optionally includes information about
	if the event was enabled at compile time.
	*/
	struct PxProfileEventId
	{
		uint16_t		eventId;
		mutable bool	compileTimeEnabled;

		/**
		\brief Profile event id constructor.
		\param inId Profile event id.
		\param inCompileTimeEnabled Compile time enabled.
		*/
		PxProfileEventId( uint16_t inId = 0, bool inCompileTimeEnabled = true )
			: eventId( inId )
			, compileTimeEnabled( inCompileTimeEnabled )
		{
		}

		operator uint16_t () const { return eventId; }

		bool operator==( const PxProfileEventId& inOther ) const
		{
			return eventId == inOther.eventId;
		}
	};

	/**
	\brief Template event id structure.
	*/
	template<bool TEnabled>
	struct PxProfileCompileTimeFilteredEventId : public PxProfileEventId
	{
		/**
		\brief Constructor.
		\param inId Profile event id.
		*/
		PxProfileCompileTimeFilteredEventId( uint16_t inId = 0 )
			: PxProfileEventId( inId, TEnabled )
		{
		}
	};

} }

#endif // PXPVDSDK_PXPROFILEEVENTID_H


text:
package controllers

import business.PasteManager
import play.api.libs.json._
import play.api.mvc._
import play.api._
import play.api.libs.functional.syntax._
import org.json4s._
import org.json4s.jackson.JsonMethods._
import com.github.tototoshi.play2.json4s.jackson._

case class UpdateVisibilityRequest(pasteId: String, isPublic: Boolean)
case class UpdateVisibilityResponse(status: Boolean, message: String)
case class BaseResponse(status: Option[String], message: Option[String])

object ApplicationApi extends Controller with Json4s {

  implicit val format = DefaultFormats

  def updatePasteVisibility = Action(json) { implicit request =>
    val sessionUserId = request.session.get("loggedInUser_id")
    val requestJson = request.body.extract[UpdateVisibilityRequest]
    val (status, message) = (new PasteManager).updatePasteVisibility(sessionUserId, requestJson.pasteId, !requestJson.isPublic)
    Ok(Extraction.decompose(UpdateVisibilityResponse(status, message)))
  }

  def deleteScheduled(key: String) = Action(json) { implicit request =>
    Ok(Extraction.decompose(BaseResponse(Some("ok"), None)))
  }
}


text:
package com.bitunified.cb.datastoremanager

class DataMetaInformation(private var dbVersion:Int) {

  var isInitiator:Boolean=true

  def getDbVersion:Int={
    dbVersion
  }

}


text:
using XCode.RuningCode.Entity.Base;

namespace XCode.RuningCode.Entity
{
    /// <summary>
    /// 用户实体
    /// </summary>
    public class PageView : BaseEntity
    {

        /// <summary>
        /// UserId
        /// </summary>
        public string UserId { get; set; }
        /// <summary>
        /// UserName
        /// </summary>
        public string LoginName { get; set; }
        /// <summary>
        /// Url
        /// </summary>
        public string Url { get; set; }

        /// <summary>
        /// 访问者IP
        /// </summary>
        public string IP { get; set; }
    }
}


text:
package org.apache.polygene.library.sql.generator.grammar.booleans;

/**
 * The interface for syntax element representing the test of left expression matching the supplied pattern using
 * advanced regular expression match (operator varies). By default this kind of matching is not supported.
 *
 */
public interface RegexpPredicate
    extends BinaryPredicate
{
}


text:
package fr.openwide.core.test.cascade;

import org.junit.Assert;
import org.junit.Test;
import org.springframework.dao.InvalidDataAccessApiUsageException;

import fr.openwide.core.jpa.exception.SecurityServiceException;
import fr.openwide.core.jpa.exception.ServiceException;
import fr.openwide.core.test.AbstractJpaCoreTestCase;
import fr.openwide.core.test.business.company.model.Company;
import fr.openwide.core.test.business.person.model.Person;

public class TestCascades extends AbstractJpaCoreTestCase {

	@Test
	public void testCreate() throws ServiceException, SecurityServiceException {
		Company company = new Company("Company Test Persist");
		Company company1 = new Company("Company Test Persist 1");
		Company company2 = new Company("Company Test Persist 2");
		Company company3 = new Company("Company Test Persist 3");
		Company company4 = new Company("Company Test Persist 4");
		Company company5 = new Company("Company Test Persist 5");
		Company company6 = new Company("Company Test Persist 6");

		Person person = new Person("Persist", "Numéro");
		Person person1 = new Person("Persist1", "Numéro1");
		Person person2 = new Person("Persist2", "Numéro2");
		Person person3 = new Person("Persist3", "Numéro3");
		Person person4 = new Person("Persist4", "Numéro4");
		Person person5 = new Person("Persist5", "Numéro5");
		Person person6 = new Person("Persist6", "Numéro6");

		/* Aucune Cascade (avec une table Join) :
		 *
		 * Lorsque l'on tente de créer la Company liée à une Person non persisté,
		 * on déclenche une exception. Il faut absolument que la Person existe dans
		 * la base pour remplir correctement la table Join de cette relation. Il faut
		 * donc créer la Person avant de créer la Company.
		 */
		company.addEmployee(person);
		try {
			companyService.create(company);
			Assert.fail("La création d'une entité liée à un élément non persisté lève une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(companyService.list().contains(company));
			Assert.assertFalse(personService.list().contains(person));
		}

		company = new Company("Company Test Persist");
		person = new Person("Persist", "Numéro");

		company.addEmployee(person);

		personService.create(person);
		companyService.create(company);
		Assert.assertTrue(companyService.list().contains(company));
		Assert.assertTrue(personService.list().contains(person));

		/* Cascade SAVE_UPDATE :
		 *
		 * La méthode create() utilise la méthode save(). La cascade
		 * SAVE_UPDATE est donc activée lors de la création de la
		 * Company et la personne non persisté est crée. La table Join
		 * peut donc être remplie avec l'id de la Person persistée.
		 */
		company1.addEmployee1(person1);

		companyService.create(company1);
		Assert.assertTrue(companyService.list().contains(company1));
		Assert.assertTrue(personService.list().contains(person1));

		/* Cascade PERSIST :
		 *
		 * La méthode create() provoque un persist jpa ; on a donc cascade de la création de l'utilisateur
		 */
		company2.addEmployee2(person2);
		companyService.create(company2);
		Assert.assertTrue(companyService.list().contains(company2));
		Assert.assertTrue(personService.list().contains(person2));

		/* Cascade REMOVE :
		 *
		 * La méthode create() ne déclenchent pas la cascade
		 * REMOVE. Lorsque l'on tente de créer la Company liée à une
		 * Person non persisté, on déclenche une exception. Il faut absolument que
		 * la Person soit persistée dans la base pour remplir correctement la table
		 * Join de cette relation. Il faut créer la Person avant de créer la Company.
		 */
		company3.addEmployee3(person3);
		try {
			companyService.create(company3);
			Assert.fail("La création d'une entité liée à un élément non persisté lève une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(companyService.list().contains(company3));
		}

		/* Cascade DELETE :
		 *
		 * La méthode create() ne déclenchent pas la cascade
		 * DELETE. Lorsque l'on tente de créer la Company liée à une
		 * Person non persisté, on déclenche une exception. Il faut absolument que
		 * la Person soit persistée dans la base pour remplir correctement la table
		 * Join de cette relation. Il faut créer la Person avant de créer la Company.
		 */
		company4.addEmployee4(person4);

		try {
			companyService.create(company4);
			Assert.fail("La création d'une entité liée à un élément non persisté lève une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(companyService.list().contains(company4));
		}

		/* Cascade DELETE_ORPHAN :
		 *
		 * La méthode create() ne déclenchent pas la cascade
		 * DELETE_ORPHAN. Lorsque l'on tente de créer la Company liée à une
		 * Person non persisté, on déclenche une exception. Il faut absolument que
		 * la Person soit persistée dans la base pour remplir correctement la table
		 * Join de cette relation. Il faut créer la Person avant de créer la Company.
		 */
		company5.addEmployee5(person5);

		try {
			companyService.create(company5);
			Assert.fail("La création d'une entité liée à un élément non persisté lève une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(companyService.list().contains(company5));
		}

		/* Cascade MERGE :
		 *
		 * La méthode create() ne déclenchent pas la cascade
		 * MERGE. Lorsque l'on tente de créer la Company liée à une
		 * Person non persisté, on déclenche une exception. Il faut absolument que
		 * la Person soit persistée dans la base pour remplir correctement la table
		 * Join de cette relation. Il faut créer la Person avant de créer la Company.
		 */
		company6.addEmployee6(person6);

		try {
			companyService.create(company6);
			Assert.fail("La création d'une entité liée à un élément non persisté lève une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(companyService.list().contains(company6));
		}
	}

	@Test
	public void testUpdate() throws ServiceException, SecurityServiceException {
		Company company = createCompany("Company Test Update");

		Person person = new Person("Update", "Numéro");
		Person person1 = new Person("Update1", "Numéro1");
		Person person2 = new Person("Update2", "Numéro2");
		Person person3 = new Person("Update3", "Numéro3");
		Person person4 = new Person("Update4", "Numéro4");
		Person person5 = new Person("Update5", "Numéro5");
		Person person6 = new Person("Update6", "Numéro6");

		/* Aucune Cascade (avec une table Join) :
		 *
		 * Lorsque l'on update la Company, la Person non persistée n'est pas crée
		 * puisqu'il n'y a aucune cascade sur la relation. On a une exception car
		 * on essaye d'ajouter une personne qui n'est pas persistée.
		 */
		company.addEmployee(person);

		try {
			companyService.update(company);
			Assert.fail("Le fait d'updater et d'avoir un élément non persisté lié à l'entité doit provoquer une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(personService.list().contains(person));
		}

		company = companyService.getById(company.getId());
		personService.create(person);
		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person));

		/* Cascade SAVE_UPDATE :
		 *
		 * Lorsque l'on update la Company, la cascade SAVE_UPDATE est déclanchée et la
		 * Person non persistée est crée dans la base.
		 */
		company.addEmployee1(person1);

		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person1));

		/* Cascade PERSIST :
		 *
		 * Lorsque l'on update, la cascade PERSIST est déclenchée à la sortie du scope transactionnel (proxy companyService.*)
		 */
		company.addEmployee2(person2);

		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person2));

		personService.create(person2);
		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person2));

		/* Cascade REMOVE :
		 *
		 * Lorsque l'on update, la cascade PERSIST n'est pas déclanchée. On a une exception
		 * puisque l'on esssaye d'ajouter à la Company une Person qui n'est pas persistée.
		 */
		company.addEmployee3(person3);

		try {
			companyService.update(company);
			Assert.fail("Le fait d'updater et d'avoir une cascade REMOVE sur un élément non persisté doit provoquer une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(personService.list().contains(person3));
		}

		company = companyService.getById(company.getId());
		personService.create(person3);
		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person3));

		/* Cascade DELETE :
		 *
		 * Lorsque l'on update, la cascade REMOVE n'est pas déclanchée. On a une exception
		 * puisque l'on esssaye d'ajouter à la Company une Person qui n'est pas persistée.
		 */
		company.addEmployee4(person4);

		try {
			companyService.update(company);
			Assert.fail("Le fait d'updater et d'avoir une cascade DELETE sur un élément non persisté doit provoquer une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(personService.list().contains(person4));
		}

		company = companyService.getById(company.getId());
		personService.create(person4);
		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person4));

		/* Cascade DELETE_ORPHAN :
		 *
		 * Lorsque l'on update, la cascade PERSIST n'est pas déclanchée. On a une exception
		 * puisque l'on esssaye d'ajouter à la Company une Person qui n'est pas persistée.
		 */
		company.addEmployee5(person5);

		try {
			companyService.update(company);
			Assert.fail("Le fait d'updater et d'avoir une cascade DELETE_ORPHAN sur un élément non persisté doit provoquer une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(personService.list().contains(person5));
		}

		company = companyService.getById(company.getId());
		personService.create(person5);
		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person5));

		/* Cascade MERGE :
		 *
		 * Lorsque l'on update, la cascade PERSIST n'est pas déclanchée. On a une exception
		 * puisque l'on esssaye d'ajouter à la Company une Person qui n'est pas persistée.
		 */
		company.addEmployee6(person6);

		try {
			companyService.update(company);
			Assert.fail("Le fait d'updater et d'avoir une cascade MERGE sur un élément non persisté doit provoquer une exception");
		} catch (InvalidDataAccessApiUsageException e) {
			Assert.assertFalse(personService.list().contains(person6));
		}

		company = companyService.getById(company.getId());
		personService.create(person6);
		companyService.update(company);
		Assert.assertTrue(personService.list().contains(person6));
	}

	@Test
	public void testDelete() throws ServiceException, SecurityServiceException {
		Company company = createCompany("Company Test Delete");
		Company company1 = createCompany("Company Test Delete 1");
		Company company2 = createCompany("Company Test Delete 2");
		Company company3 = createCompany("Company Test Delete 3");
		Company company4 = createCompany("Company Test Delete 4");
		Company company5 = createCompany("Company Test Delete 5");
		Company company6 = createCompany("Company Test Delete 6");

		Person person = createPerson("Delete", "Numéro");
		Person person1 = createPerson("Delete1", "Numéro1");
		Person person2 = createPerson("Delete2", "Numéro2");
		Person person3 = createPerson("Delete3", "Numéro3");
		Person person4 = createPerson("Delete4", "Numéro4");
		Person person5 = createPerson("Delete5", "Numéro5");
		Person person6 = createPerson("Delete6", "Numéro6");

		/* Aucune Cascade (avec table Join) :
		 *
		 * Lorsque l'on essaye de supprimer la Company qui est liée à la Person,
		 * la relation est supprimée mais l'objet Person est conservé.
		 */
		company.addEmployee(person);
		companyService.update(company);
		personService.update(person);
		Assert.assertTrue(companyService.list().contains(company));

		companyService.delete(company);
		Assert.assertFalse(companyService.list().contains(company));
		Assert.assertTrue(personService.list().contains(person));

		/* Cascade SAVE_UPDATE :
		 *
		 * Comme attendu, lors de la suppression de la Company, la cascade
		 * SAVE_UPDATE n'est pas déclenchée et la Person liée n'est pas supprimée.
		 */
		//company1.addEmployee1(person1);
		companyService.update(company1);
		Assert.assertTrue(companyService.list().contains(company1));

		companyService.delete(company1);
		Assert.assertFalse(companyService.list().contains(company1));
		Assert.assertTrue(personService.list().contains(person1));

		/* Cascade PERSIST :
		 *
		 * Comme attendu, lors de la suppression de la Company, la cascade
		 * PERSIST n'est pas déclenchée et la Person liée n'est pas supprimée.
		 */
		company2.addEmployee2(person2);
		companyService.update(company2);
		Assert.assertTrue(companyService.list().contains(company2));

		companyService.delete(company2);
		Assert.assertFalse(companyService.list().contains(company2));
		Assert.assertTrue(personService.list().contains(person2));

		/* Cascade REMOVE :
		 *
		 *  Même en utilisant delete(), la cascade REMOVE est activée
		 *  et la Person liée à la Company est supprimée en cascade.
		 */
		company3.addEmployee3(person3);
		companyService.update(company3);
		Assert.assertTrue(companyService.list().contains(company3));

		companyService.delete(company3);
		Assert.assertFalse(companyService.list().contains(company3));
		Assert.assertFalse(personService.list().contains(person3));

		/* Cascade DELETE
		 *
		 * Dans cet exemple, on lie la Person à deux Company différentes,
		 * et on observe ce qui va se passer si on essaye de supprimer l'une
		 * des Company.
		 */
		company4.addEmployee4(person4);
		companyService.update(company4);
		company5.addEmployee1(person4);
		companyService.update(company5);

		/*
		 * Code qu'on avait avant : si jamais l'entité était encore attachée par ailleurs, la base renvoyait une exception
		 * et du coup, ça donnait une indication.
		 *
		 * Cependant, il semble que l'esprit de la norme JPA dit que si un objet à supprimer par cascade est attaché
		 * par ailleurs, la suppression doit être purement et simplement ignorée...
		 * Ca ne va pas nous aider à trouver les soucis mais, après discussion avec les gens d'Hibernate, ça restera comme cela...
		 *
		try {
			companyService.delete(company4);
			Assert.fail("Supprimer en cascade une entité qui à encore des relations lève une exception");
		} catch (JpaObjectRetrievalFailureException e) {
			// La tentative de suppression de la personne viole une contrainte d'intégrité
			// de la base de données. On ne peut pas supprimer en cascade une Person encore
			// en relation avec d'autres Company. Pour parer à ce problème, pas de solution
			// automatique, on doit délier l'entité pour pouvoir la supprimer en cascade.
			company4 = companyService.getById(company4.getId());
			company5 = companyService.getById(company5.getId());
			Assert.assertTrue(companyService.list().contains(company4));
			Assert.assertTrue(personService.list().contains(person4));
		}*/

		// on délie toute les relations et on doit donc pouvoir supprimer supprimer person4 par cascade sans souci
		person4 = personService.getById(person4.getId());
		company5.removeEmployee1(person4);
		companyService.update(company5);
		companyService.delete(company4);
		Assert.assertNull(personService.getById(person4.getId()));

		/* Une fois l'entité Person déliée de la seconde Company, elle est supprimée sans
		 * problèmes par la cascade.
		 */
		Assert.assertFalse(companyService.list().contains(company4));
		Assert.assertFalse(personService.list().contains(person4));

		/* Cascade DELETE_ORPHAN :
		 *
		 * La cascade DELETE_ORPHAN (ou orphanRemoval) va détruire, en plus des entités liées
		 * par la relation, les entités qui sont référencés comme anciennement liés. Pour mettre
		 * ce comportement en valeur, on lie une Person une Company puis on détruit le lien.
		 * Lorsque l'on supprime la Company, on constate que la Person est aussi détruite
		 */
		person5 = personService.getById(person5.getId());
		company5.addEmployee5(person5);
		companyService.update(company5);
		Assert.assertTrue(companyService.list().contains(company5));

		companyService.delete(company5);
		Assert.assertFalse(companyService.list().contains(company5));
		Assert.assertFalse(personService.list().contains(person5));

		/* Cascade MERGE :
		 *
		 * Comme attendu, lors de la suppression de la Company, la cascade
		 * MERGE n'est pas déclenchée et la Person liée n'est pas supprimée.
		 */
		person6 = personService.getById(person6.getId());
		company6 = companyService.getById(company6.getId());
		company6.addEmployee6(person6);
		companyService.update(company6);
		Assert.assertTrue(companyService.list().contains(company6));

		companyService.delete(company6);
		Assert.assertFalse(companyService.list().contains(company6));
		Assert.assertTrue(personService.list().contains(person6));
	}
}


text:
import {State} from './state';

export class StateMachine {
  private stateMap: Map<string, State> = new Map<string, State>();
  private currentState: State = new State();

  add(id: string, state: State) {
    this.stateMap.set(id, state);
  }

  remove(id: string) {
    this.stateMap.delete(id);
  }

  clear() {
    this.stateMap.clear();
    this.change('1');
  }

  change(id: string, ...argsForStateEnter: any[]) {
    this.currentState.exit();
    const next: State = this.stateMap.get(id);
    next.enter(...argsForStateEnter);
    this.currentState = next;
  }

  update() {
    this.currentState.update();
  }

  handleInput() {
    this.currentState.handleInput();
  }
}


text:
#ifndef _GUEST_PCI_CONFIG_H
#define _GUEST_PCI_CONFIG_H

#include "list.h"
#include "host_pci_configuration.h"
#include "vmm_objects.h"

struct _GUEST_PCI_DEVICE;

typedef void (*GUEST_PCI_READ_HANDLER) (
    GUEST_CPU_HANDLE  gcpu,
    struct _GUEST_PCI_DEVICE *pci_device,
    UINT32 port_id,
    UINT32 port_size,
    void   *value);

typedef void (*GUEST_PCI_WRITE_HANDLER) (
    GUEST_CPU_HANDLE  gcpu,
    struct _GUEST_PCI_DEVICE *pci_device,
    UINT32 port_id,
    UINT32 port_size,
    void   *value);

typedef struct _GPCI_GUEST_PROFILE
{
    GUEST_PCI_READ_HANDLER pci_read;
    GUEST_PCI_WRITE_HANDLER pci_write;
} GPCI_GUEST_PROFILE;

typedef enum
{
    GUEST_DEVICE_VIRTUALIZATION_DIRECT_ASSIGNMENT,
    GUEST_DEVICE_VIRTUALIZATION_HIDDEN
} GUEST_DEVICE_VIRTUALIZATION_TYPE;

typedef struct _GUEST_PCI_DEVICE
{
    GUEST_ID                 guest_id;
    char                     padding[2];
    GUEST_DEVICE_VIRTUALIZATION_TYPE type;
    HOST_PCI_DEVICE         *host_device;
    GUEST_PCI_READ_HANDLER   pci_read;
    GUEST_PCI_WRITE_HANDLER  pci_write;
    UINT8                   *config_space;
} GUEST_PCI_DEVICE;

typedef struct _GUEST_PCI_DEVICES
{
    GUEST_ID guest_id;
    char padding[2];
    UINT32 num_devices;
    GUEST_PCI_DEVICE devices[PCI_MAX_NUM_SUPPORTED_DEVICES + 1];
    PCI_DEV_INDEX device_lookup_table[PCI_MAX_NUM_FUNCTIONS]; // index 0 is reserved to mark "not-present" device
    LIST_ELEMENT guests[1];
    PCI_CONFIG_ADDRESS *gcpu_pci_access_address;
} GUEST_PCI_DEVICES;

BOOLEAN gpci_initialize(void);

BOOLEAN gpci_guest_initialize(GUEST_ID guest_id);

BOOLEAN gpci_register_device(GUEST_ID  guest_id,
          GUEST_DEVICE_VIRTUALIZATION_TYPE type, HOST_PCI_DEVICE *host_pci_device,
          UINT8*  config_space, GUEST_PCI_READ_HANDLER pci_read,
          GUEST_PCI_WRITE_HANDLER pci_write);

#ifdef INCLUDE_UNUSED_CODE
void gpci_unregister_device(GUEST_ID guest_id, UINT16 bus,
                            UINT16 device, UINT16 function);
#endif

GUEST_ID gpci_get_device_guest_id(UINT16 bus, UINT16 device,
                                  UINT16 function);

#endif


text:
package com.qxcmp.account.auth;

import com.qxcmp.config.SystemConfigService;
import com.qxcmp.core.QxcmpSystemConfig;
import com.qxcmp.user.UserService;
import lombok.AllArgsConstructor;
import org.springframework.security.authentication.*;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

/**
 * 认证失败处理器,属于框架基本功能,供平台和前端共同使用
 *

 * 配置在认证过滤器{@link AuthenticationFilter} 中,负责对认证失败进行处理
 *

 * 处理流程如下:

如果用户状态不正确,用过sessionAttribute设置状态错误码

计算session认证错误次数

如果错误次数超过验证码阈值,则生成验证码

 *
如果开启账户锁定,并且错误次数超过锁定阈值,则锁定该账户

 *
 * @author aaric
 */
@Component
@AllArgsConstructor
public class AuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {

    /**
     * 会话属性,用于标识是否生成验证码
     */
    public static final String AUTHENTICATION_SHOW_CAPTCHA = "authenticationShowCaptcha";

    /**
     * 会话属性,用于存放认证错误消息国际化代码
     */
    public static final String AUTHENTICATION_ERROR_MESSAGE = "authenticationMessage";

    /**
     * 会话属性,用于存放当前会话认证失败次数
     */
    private static final String AUTHENTICATION_ERROR_TIMES = "authenticationErrorTimes";

    private SystemConfigService systemConfigService;

    private UserService userService;

    @Override
    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
        super.onAuthenticationFailure(request, response, exception);

        setExceptionMessage(request, exception);

        setFailedCount(request);

        calculateCaptcha(request);

        calculateAccountLock(request);
    }

    /**
     * 根据认证失败错误类型设置会话错误消息国际化代码
     *
     * @param request   会话请求
     * @param exception 认证错误类型
     */
    private void setExceptionMessage(HttpServletRequest request, AuthenticationException exception) {
        if (exception instanceof BadCredentialsException) {
            request.getSession().setAttribute(AUTHENTICATION_ERROR_MESSAGE, "Authentication.badCredential");
        } else if (exception instanceof DisabledException) {
            request.getSession().setAttribute(AUTHENTICATION_ERROR_MESSAGE, "Authentication.accountDisabled");
        } else if (exception instanceof LockedException) {
            request.getSession().setAttribute(AUTHENTICATION_ERROR_MESSAGE, "Authentication.accountLocked");
        } else if (exception instanceof AccountExpiredException) {
            request.getSession().setAttribute(AUTHENTICATION_ERROR_MESSAGE, "Authentication.accountExpired");
        } else if (exception instanceof CredentialsExpiredException) {
            request.getSession().setAttribute(AUTHENTICATION_ERROR_MESSAGE, "Authentication.credentialExpired");
        } else {
            request.getSession().setAttribute(AUTHENTICATION_ERROR_MESSAGE, exception.getMessage());
        }
    }

    /**
     * 设置会话认证失败次数加一
     *

     * 失败次数可以用于判断是否生成验证码,以及是否锁定账户
     *
     * @param request 认证请求
     */
    private void setFailedCount(HttpServletRequest request) {
        if (request.getSession().getAttribute(AUTHENTICATION_ERROR_TIMES) != null) {
            int failedCount = (int) request.getSession().getAttribute(AUTHENTICATION_ERROR_TIMES);
            request.getSession().setAttribute(AUTHENTICATION_ERROR_TIMES, ++failedCount);
        } else {
            request.getSession().setAttribute(AUTHENTICATION_ERROR_TIMES, 1);
        }
    }

    /**
     * 计算是否生成验证码
     *

     * 如果认证失败次数超过 {@link QxcmpSystemConfig#AUTHENTICATION_CAPTCHA_THRESHOLD} 以后则生成验证码
     *
     * @param request 认证请求
     */
    private void calculateCaptcha(HttpServletRequest request) {

        int failedCount = (int) request.getSession().getAttribute(AUTHENTICATION_ERROR_TIMES);

        if (failedCount >= systemConfigService.getInteger(QxcmpSystemConfig.AUTHENTICATION_CAPTCHA_THRESHOLD).orElse(QxcmpSystemConfig.AUTHENTICATION_CAPTCHA_THRESHOLD_DEFAULT)) {
            request.getSession().setAttribute(AUTHENTICATION_SHOW_CAPTCHA, true);
        }
    }

    /**
     * 计算是否锁定账户
     *

     * 如果开启了账户锁定功能,并且认证失败次数超过了 {@link QxcmpSystemConfig#AUTHENTICATION_ACCOUNT_LOCK_THRESHOLD}
     * 则锁定该账户
     *
     * @param request 认证请求
     */
    private void calculateAccountLock(HttpServletRequest request) {

        int failedCount = (int) request.getSession().getAttribute(AUTHENTICATION_ERROR_TIMES);

        boolean lockAccount = systemConfigService.getBoolean(QxcmpSystemConfig.AUTHENTICATION_ACCOUNT_LOCK).orElse(QxcmpSystemConfig.AUTHENTICATION_ACCOUNT_LOCK_DEFAULT);

        if (lockAccount && failedCount >= systemConfigService.getInteger(QxcmpSystemConfig.AUTHENTICATION_ACCOUNT_LOCK_THRESHOLD).orElse(QxcmpSystemConfig.AUTHENTICATION_ACCOUNT_LOCK_THRESHOLD_DEFAULT)) {
            userService.update(request.getParameter("username"), user -> {
                user.setAccountNonLocked(false);
                user.setDateLock(new Date());
            });
        }
    }
}


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

    <!-- YouTube Fragment -->
    <fragment
        android:id="@+id/fragment_youtube"
        android:name="com.example.dieuvainmusaghi.viuc.fragment.YouTubeFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" />

    <!-- You could put anything here -->
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:gravity="center"
        android:padding="8dp"
        android:text="@string/youtube_activity_fragment_placeholder"
        android:textSize="18sp" />

</RelativeLayout>


text:
<!doctype html>

    <title>Food Review</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>

    <link rel="icon" type="image/ico" href="favicon.ico" />
    <link rel="stylesheet" href="bower_components/normalize-css/normalize.css" />
    <link rel="stylesheet" href="bower_components/angular-material/angular-material.min.css" />
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
    <link rel="stylesheet" href="bower_components/animate.css/animate.css" />
    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css" />
    <link rel="stylesheet" href="bower_components/angular-ui-select/dist/select.min.css" />
    <link rel="stylesheet" href="styles/main.css">
    <link rel="stylesheet" href="styles/layout.css">
    <link rel="stylesheet" href="styles/spin-loader.css">

    <resolve-loader></resolve-loader>


text:
require 'spec_helper'

describe Quacky, "#double" do
  it "returns a new Double" do
    name = double(:name)
    duck_types = [double(:duck_type), double(:duck_type)]
    double = double(:double)
    Quacky::Double.stub(:new).with(name, duck_types).and_return(double)

    Quacky.double(name, duck_types).should == double
  end
end


text:
package biweekly.io.scribe.property;

import java.util.Date;
import java.util.EnumSet;
import java.util.Set;

import biweekly.ICalDataType;
import biweekly.ICalVersion;
import biweekly.io.CannotParseException;
import biweekly.io.ParseContext;
import biweekly.io.WriteContext;
import biweekly.io.json.JCalValue;
import biweekly.io.xml.XCalElement;
import biweekly.parameter.ICalParameters;
import biweekly.property.Trigger;
import biweekly.util.Duration;
import biweekly.util.ICalDate;

import com.github.mangstadt.vinnie.io.VObjectPropertyValues;

/**
 * Marshals {@link Trigger} properties.
 * @author Michael Angstadt
 */
public class TriggerScribe extends ICalPropertyScribe<Trigger> {
	public TriggerScribe() {
		super(Trigger.class, "TRIGGER", ICalDataType.DURATION);
	}

	@Override
	protected ICalDataType _dataType(Trigger property, ICalVersion version) {
		return (property.getDate() == null) ? ICalDataType.DURATION : ICalDataType.DATE_TIME;
	}

	@Override
	protected String _writeText(Trigger property, WriteContext context) {
		Duration duration = property.getDuration();
		if (duration != null) {
			return duration.toString();
		}

		Date date = property.getDate();
		return date(date, property, context).extended(false).write();
	}

	@Override
	protected Trigger _parseText(String value, ICalDataType dataType, ICalParameters parameters, ParseContext context) {
		value = VObjectPropertyValues.unescape(value);

		try {
			ICalDate date = date(value).parse();
			Trigger property = new Trigger(date);
			context.addDate(date, property, parameters);
			return property;
		} catch (IllegalArgumentException e) {
			//unable to parse value as date, must be a duration
		}

		try {
			return new Trigger(Duration.parse(value), parameters.getRelated());
		} catch (IllegalArgumentException e) {
			//unable to parse duration
		}

		throw new CannotParseException(25);
	}

	@Override
	protected void _writeXml(Trigger property, XCalElement element, WriteContext context) {
		Duration duration = property.getDuration();
		if (duration != null) {
			element.append(ICalDataType.DURATION, duration.toString());
			return;
		}

		Date date = property.getDate();
		if (date != null) {
			String dateStr = date(date, property, context).extended(true).write();
			element.append(ICalDataType.DATE_TIME, dateStr);
			return;
		}

		element.append(defaultDataType(context.getVersion()), "");
	}

	@Override
	protected Trigger _parseXml(XCalElement element, ICalParameters parameters, ParseContext context) {
		String value = element.first(ICalDataType.DURATION);
		if (value != null) {
			try {
				return new Trigger(Duration.parse(value), parameters.getRelated());
			} catch (IllegalArgumentException e) {
				throw new CannotParseException(26, value);
			}
		}

		value = element.first(ICalDataType.DATE_TIME);
		if (value != null) {
			try {
				ICalDate date = date(value).parse();
				Trigger property = new Trigger(date);
				context.addDate(date, property, parameters);
				return property;
			} catch (IllegalArgumentException e) {
				throw new CannotParseException(27, value);
			}
		}

		throw missingXmlElements(ICalDataType.DURATION, ICalDataType.DATE_TIME);
	}

	@Override
	protected JCalValue _writeJson(Trigger property, WriteContext context) {
		Duration duration = property.getDuration();
		if (duration != null) {
			return JCalValue.single(duration.toString());
		}

		Date date = property.getDate();
		if (date != null) {
			String dateStr = date(date, property, context).extended(true).write();
			return JCalValue.single(dateStr);
		}

		return JCalValue.single("");
	}

	@Override
	protected Trigger _parseJson(JCalValue value, ICalDataType dataType, ICalParameters parameters, ParseContext context) {
		String valueStr = value.asSingle();

		try {
			ICalDate date = date(valueStr).parse();
			Trigger property = new Trigger(date);
			context.addDate(date, property, parameters);
			return property;
		} catch (IllegalArgumentException e) {
			//must be a duration
		}

		try {
			return new Trigger(Duration.parse(valueStr), parameters.getRelated());
		} catch (IllegalArgumentException e) {
			throw new CannotParseException(25);
		}
	}

	@Override
	public Set<ICalVersion> getSupportedVersions() {
		return EnumSet.of(ICalVersion.V2_0_DEPRECATED, ICalVersion.V2_0);
	}
}